Skip to content

Commit

Permalink
Split grant doi checks into wellcome and not wellcome
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-atherden committed Sep 28, 2023
1 parent e3e6985 commit bdc3c92
Show file tree
Hide file tree
Showing 2,104 changed files with 11,415 additions and 6,450 deletions.
1 change: 1 addition & 0 deletions src/dl-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<let name="MSAs" value="('Biochemistry and Chemical Biology', 'Cancer Biology', 'Cell Biology', 'Chromosomes and Gene Expression', 'Computational and Systems Biology', 'Developmental Biology', 'Ecology', 'Epidemiology and Global Health', 'Evolutionary Biology', 'Genetics and Genomics', 'Medicine', 'Immunology and Inflammation', 'Microbiology and Infectious Disease', 'Neuroscience', 'Physics of Living Systems', 'Plant Biology', 'Stem Cells and Regenerative Medicine', 'Structural Biology and Molecular Biophysics')"/>

<let name="funders" value="'funders.xml'"/>
<let name="wellcome-fundref-ids" value="('http://dx.doi.org/10.13039/100010269','http://dx.doi.org/10.13039/100004440')"/>

<!--=== Custom functions ===-->
<xsl:function name="e:is-prc" as="xs:boolean">
Expand Down
613 changes: 307 additions & 306 deletions src/dl-schematron.xsl

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions src/final-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<let name="MSAs" value="('Biochemistry and Chemical Biology', 'Cancer Biology', 'Cell Biology', 'Chromosomes and Gene Expression', 'Computational and Systems Biology', 'Developmental Biology', 'Ecology', 'Epidemiology and Global Health', 'Evolutionary Biology', 'Genetics and Genomics', 'Medicine', 'Immunology and Inflammation', 'Microbiology and Infectious Disease', 'Neuroscience', 'Physics of Living Systems', 'Plant Biology', 'Stem Cells and Regenerative Medicine', 'Structural Biology and Molecular Biophysics')"/>

<let name="funders" value="'funders.xml'"/>
<let name="wellcome-fundref-ids" value="('http://dx.doi.org/10.13039/100010269','http://dx.doi.org/10.13039/100004440')"/>

<!--=== Custom functions ===-->
<xsl:function name="e:is-prc" as="xs:boolean">
Expand Down Expand Up @@ -2591,19 +2592,30 @@

</rule>
</pattern>
<pattern id="grant-doi-tests-pattern">
<rule context="funding-group/award-group[funding-source/institution-wrap/institution-id]" id="grant-doi-tests">
<pattern id="general-grant-doi-tests-pattern">
<rule context="funding-group/award-group[funding-source/institution-wrap/institution-id[not(.=$wellcome-fundref-ids)]]" id="general-grant-doi-tests">
<let name="award-id" value="award-id"/>
<let name="funder-id" value="funding-source/institution-wrap/institution-id"/>
<let name="funder-entry" value="document($funders)//funder[@fundref=$funder-id]"/>
<let name="mints-grant-dois" value="$funder-entry/@grant-dois='yes'"/>
<!-- Consider alternatives to exact match as this is no better than simply using Crossref's API -->
<let name="grant-matches" value="if (not($mints-grant-dois)) then () else $funder-entry//*:grant[@award=$award-id]"/>

<report test="$grant-matches" role="warning" id="grant-doi-test-1">[grant-doi-test-1] Funding entry from <value-of select="funding-source/institution-wrap/institution"/> has an award-id (<value-of select="$award-id"/>) which could be replaced with a grant DOI. The following grant DOIs are possibilities: <value-of select="string-join(for $grant in $grant-matches return concat('https://doi.org/',$grant/@doi),'; ')"/>.</report>
<report test="$grant-matches" role="warning" id="grant-doi-test-1">[grant-doi-test-1] Funding entry from <value-of select="funding-source/institution-wrap/institution"/> has an award-id (<value-of select="$award-id"/>) which could potentially be replaced with a grant DOI. The following grant DOIs are possibilities: <value-of select="string-join(for $grant in $grant-matches return concat('https://doi.org/',$grant/@doi),'; ')"/>.</report>

</rule>
</pattern>
<pattern id="wellcome-grant-doi-tests-pattern">
<rule context="funding-group/award-group[funding-source/institution-wrap/institution-id=$wellcome-fundref-ids]" id="wellcome-grant-doi-tests">
<let name="wellcome-grants" value="document($funders)//funder[@fundref=$wellcome-fundref-ids]/grant"/>
<let name="award-id-elem" value="award-id"/>
<let name="award-id" value="if (contains(lower-case($award-id-elem),'/z')) then replace(substring-before(lower-case($award-id-elem),'/z'),'[^\d]','') else if (matches($award-id-elem,'[^\d]') and matches($award-id-elem,'\d')) then replace($award-id-elem,'[^\d]','') else $award-id-elem"/>
<let name="grant-matches" value="if ($award-id='') then () else $wellcome-grants[@award=$award-id]"/>

<report test="$grant-matches" role="warning" id="wellcome-grant-doi-test-1">[wellcome-grant-doi-test-1] Funding entry from <value-of select="funding-source/institution-wrap/institution"/> has an award-id (<value-of select="$award-id-elem"/>) which could potentially be replaced with a grant DOI. The following grant DOIs are possibilities: <value-of select="string-join(for $grant in $grant-matches return concat('https://doi.org/',$grant/@doi),'; ')"/>.</report>

</rule>
</pattern>
<pattern id="award-id-tests-pattern">
<rule context="funding-group/award-group/award-id" id="award-id-tests">
<let name="id" value="parent::award-group/@id"/>
Expand Down
Loading

0 comments on commit bdc3c92

Please sign in to comment.