Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VOR - add duplicated funding checks #818

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/final-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -2441,6 +2441,8 @@

</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"/>
<let name="funder-id" value="parent::award-group/descendant::institution-id[1]"/>
<let name="funder-name" value="parent::award-group/descendant::institution[1]"/>

<report see="https://elifeproduction.slab.com/posts/funding-3sv64358#award-id-test-1" test="matches(.,',|;')" role="warning" id="award-id-test-1">[award-id-test-1] Funding entry with id <value-of select="$id"/> has a comma or semi-colon in the award id. Should this be separated out into several funding entries? - <value-of select="."/>.</report>

Expand All @@ -2452,6 +2454,12 @@

<report test="matches(.,'http[s]?://d?x?\.?doi.org/')" role="error" id="award-id-test-5">[award-id-test-5] Award id contains a DOI link - <value-of select="."/>. If the award ID is for a grant DOI it should contain the DOI without the https://... protocol (e.g. 10.37717/220020477).</report>

<report test=". = preceding::award-id[parent::award-group/descendant::institution-id[1] = $funder-id]" role="error" id="award-id-test-6">[award-id-test-6] Funding entry has an award id - <value-of select="."/> - which is also used in another funding entry with the same funder ID. This must be incorrect. Either the funder ID or the award ID is wrong, or it is a duplicate that should be removed.</report>

<report test=". = preceding::award-id[parent::award-group/descendant::institution[1] = $funder-name]" role="error" id="award-id-test-7">[award-id-test-7] Funding entry has an award id - <value-of select="."/> - which is also used in another funding entry with the same funder name. This must be incorrect. Either the funder name or the award ID is wrong, or it is a duplicate that should be removed.</report>

<report test=". = preceding::award-id[parent::award-group[not(descendant::institution[1] = $funder-name) and not(descendant::institution-id[1] = $funder-id)]]" role="warning" id="award-id-test-8">[award-id-test-8] Funding entry has an award id - <value-of select="."/> - which is also used in another funding entry with a different funder. Has there been a mistake with the award id? If the grant was awarded jointly by two funders, then this capture is correct and should be retained.</report>

</rule></pattern><pattern id="institution-wrap-tests-pattern"><rule context="article-meta//award-group//institution-wrap" id="institution-wrap-tests">

<assert see="https://elifeproduction.slab.com/posts/funding-3sv64358#institution-id-test" test="institution-id[@institution-id-type='FundRef']" role="warning" id="institution-id-test">[institution-id-test] Whenever possible, a funder should have a doi - please check whether there is an appropriate doi in the open funder registry. (institution-id[@institution-id-type="FundRef"] is not present in institution-wrap).</assert>
Expand Down
41 changes: 41 additions & 0 deletions src/final-JATS-schematron.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -12209,6 +12209,8 @@
<!--RULE award-id-tests-->
<xsl:template match="funding-group/award-group/award-id" priority="1000" mode="M159">
<xsl:variable name="id" select="parent::award-group/@id"/>
<xsl:variable name="funder-id" select="parent::award-group/descendant::institution-id[1]"/>
<xsl:variable name="funder-name" select="parent::award-group/descendant::institution[1]"/>
<!--REPORT warning-->
<xsl:if test="matches(.,',|;')">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="matches(.,',|;')">
Expand Down Expand Up @@ -12280,6 +12282,45 @@
<xsl:text/>. If the award ID is for a grant DOI it should contain the DOI without the https://... protocol (e.g. 10.37717/220020477).</svrl:text>
</svrl:successful-report>
</xsl:if>
<!--REPORT error-->
<xsl:if test=". = preceding::award-id[parent::award-group/descendant::institution-id[1] = $funder-id]">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test=". = preceding::award-id[parent::award-group/descendant::institution-id[1] = $funder-id]">
<xsl:attribute name="id">award-id-test-6</xsl:attribute>
<xsl:attribute name="role">error</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[award-id-test-6] Funding entry has an award id - <xsl:text/>
<xsl:value-of select="."/>
<xsl:text/> - which is also used in another funding entry with the same funder ID. This must be incorrect. Either the funder ID or the award ID is wrong, or it is a duplicate that should be removed.</svrl:text>
</svrl:successful-report>
</xsl:if>
<!--REPORT error-->
<xsl:if test=". = preceding::award-id[parent::award-group/descendant::institution[1] = $funder-name]">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test=". = preceding::award-id[parent::award-group/descendant::institution[1] = $funder-name]">
<xsl:attribute name="id">award-id-test-7</xsl:attribute>
<xsl:attribute name="role">error</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[award-id-test-7] Funding entry has an award id - <xsl:text/>
<xsl:value-of select="."/>
<xsl:text/> - which is also used in another funding entry with the same funder name. This must be incorrect. Either the funder name or the award ID is wrong, or it is a duplicate that should be removed.</svrl:text>
</svrl:successful-report>
</xsl:if>
<!--REPORT warning-->
<xsl:if test=". = preceding::award-id[parent::award-group[not(descendant::institution[1] = $funder-name) and not(descendant::institution-id[1] = $funder-id)]]">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test=". = preceding::award-id[parent::award-group[not(descendant::institution[1] = $funder-name) and not(descendant::institution-id[1] = $funder-id)]]">
<xsl:attribute name="id">award-id-test-8</xsl:attribute>
<xsl:attribute name="role">warning</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[award-id-test-8] Funding entry has an award id - <xsl:text/>
<xsl:value-of select="."/>
<xsl:text/> - which is also used in another funding entry with a different funder. Has there been a mistake with the award id? If the grant was awarded jointly by two funders, then this capture is correct and should be retained.</svrl:text>
</svrl:successful-report>
</xsl:if>
<xsl:apply-templates select="*" mode="M159"/>
</xsl:template>
<xsl:template match="text()" priority="-1" mode="M159"/>
Expand Down
8 changes: 8 additions & 0 deletions src/final-package-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -2447,6 +2447,8 @@

</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"/>
<let name="funder-id" value="parent::award-group/descendant::institution-id[1]"/>
<let name="funder-name" value="parent::award-group/descendant::institution[1]"/>

<report see="https://elifeproduction.slab.com/posts/funding-3sv64358#award-id-test-1" test="matches(.,',|;')" role="warning" id="award-id-test-1">Funding entry with id <value-of select="$id"/> has a comma or semi-colon in the award id. Should this be separated out into several funding entries? - <value-of select="."/>.</report>

Expand All @@ -2458,6 +2460,12 @@

<report test="matches(.,'http[s]?://d?x?\.?doi.org/')" role="error" id="award-id-test-5">Award id contains a DOI link - <value-of select="."/>. If the award ID is for a grant DOI it should contain the DOI without the https://... protocol (e.g. 10.37717/220020477).</report>

<report test=". = preceding::award-id[parent::award-group/descendant::institution-id[1] = $funder-id]" role="error" id="award-id-test-6">Funding entry has an award id - <value-of select="."/> - which is also used in another funding entry with the same funder ID. This must be incorrect. Either the funder ID or the award ID is wrong, or it is a duplicate that should be removed.</report>

<report test=". = preceding::award-id[parent::award-group/descendant::institution[1] = $funder-name]" role="error" id="award-id-test-7">Funding entry has an award id - <value-of select="."/> - which is also used in another funding entry with the same funder name. This must be incorrect. Either the funder name or the award ID is wrong, or it is a duplicate that should be removed.</report>

<report test=". = preceding::award-id[parent::award-group[not(descendant::institution[1] = $funder-name) and not(descendant::institution-id[1] = $funder-id)]]" role="warning" id="award-id-test-8">Funding entry has an award id - <value-of select="."/> - which is also used in another funding entry with a different funder. Has there been a mistake with the award id? If the grant was awarded jointly by two funders, then this capture is correct and should be retained.</report>

</rule></pattern><pattern id="institution-wrap-tests-pattern"><rule context="article-meta//award-group//institution-wrap" id="institution-wrap-tests">

<assert see="https://elifeproduction.slab.com/posts/funding-3sv64358#institution-id-test" test="institution-id[@institution-id-type='FundRef']" role="warning" id="institution-id-test">Whenever possible, a funder should have a doi - please check whether there is an appropriate doi in the open funder registry. (institution-id[@institution-id-type="FundRef"] is not present in institution-wrap).</assert>
Expand Down
8 changes: 8 additions & 0 deletions src/pre-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,8 @@

</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"/>
<let name="funder-id" value="parent::award-group/descendant::institution-id[1]"/>
<let name="funder-name" value="parent::award-group/descendant::institution[1]"/>

<report see="https://elifeproduction.slab.com/posts/funding-3sv64358#award-id-test-1" test="matches(.,',|;')" role="warning" id="award-id-test-1">[award-id-test-1] Funding entry with id <value-of select="$id"/> has a comma or semi-colon in the award id. Should this be separated out into several funding entries? - <value-of select="."/>.</report>

Expand All @@ -2397,6 +2399,12 @@

<report test="matches(.,'http[s]?://d?x?\.?doi.org/')" role="error" id="award-id-test-5">[award-id-test-5] Award id contains a DOI link - <value-of select="."/>. If the award ID is for a grant DOI it should contain the DOI without the https://... protocol (e.g. 10.37717/220020477).</report>

<report test=". = preceding::award-id[parent::award-group/descendant::institution-id[1] = $funder-id]" role="error" id="award-id-test-6">[award-id-test-6] Funding entry has an award id - <value-of select="."/> - which is also used in another funding entry with the same funder ID. This must be incorrect. Either the funder ID or the award ID is wrong, or it is a duplicate that should be removed.</report>

<report test=". = preceding::award-id[parent::award-group/descendant::institution[1] = $funder-name]" role="error" id="award-id-test-7">[award-id-test-7] Funding entry has an award id - <value-of select="."/> - which is also used in another funding entry with the same funder name. This must be incorrect. Either the funder name or the award ID is wrong, or it is a duplicate that should be removed.</report>

<report test=". = preceding::award-id[parent::award-group[not(descendant::institution[1] = $funder-name) and not(descendant::institution-id[1] = $funder-id)]]" role="warning" id="award-id-test-8">[award-id-test-8] Funding entry has an award id - <value-of select="."/> - which is also used in another funding entry with a different funder. Has there been a mistake with the award id? If the grant was awarded jointly by two funders, then this capture is correct and should be retained.</report>

</rule></pattern><pattern id="institution-wrap-tests-pattern"><rule context="article-meta//award-group//institution-wrap" id="institution-wrap-tests">

<assert see="https://elifeproduction.slab.com/posts/funding-3sv64358#institution-id-test" test="institution-id[@institution-id-type='FundRef']" role="warning" id="institution-id-test">[institution-id-test] Whenever possible, a funder should have a doi - please check whether there is an appropriate doi in the open funder registry. (institution-id[@institution-id-type="FundRef"] is not present in institution-wrap).</assert>
Expand Down
41 changes: 41 additions & 0 deletions src/pre-JATS-schematron.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -12054,6 +12054,8 @@
<!--RULE award-id-tests-->
<xsl:template match="funding-group/award-group/award-id" priority="1000" mode="M157">
<xsl:variable name="id" select="parent::award-group/@id"/>
<xsl:variable name="funder-id" select="parent::award-group/descendant::institution-id[1]"/>
<xsl:variable name="funder-name" select="parent::award-group/descendant::institution[1]"/>
<!--REPORT warning-->
<xsl:if test="matches(.,',|;')">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="matches(.,',|;')">
Expand Down Expand Up @@ -12125,6 +12127,45 @@
<xsl:text/>. If the award ID is for a grant DOI it should contain the DOI without the https://... protocol (e.g. 10.37717/220020477).</svrl:text>
</svrl:successful-report>
</xsl:if>
<!--REPORT error-->
<xsl:if test=". = preceding::award-id[parent::award-group/descendant::institution-id[1] = $funder-id]">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test=". = preceding::award-id[parent::award-group/descendant::institution-id[1] = $funder-id]">
<xsl:attribute name="id">award-id-test-6</xsl:attribute>
<xsl:attribute name="role">error</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[award-id-test-6] Funding entry has an award id - <xsl:text/>
<xsl:value-of select="."/>
<xsl:text/> - which is also used in another funding entry with the same funder ID. This must be incorrect. Either the funder ID or the award ID is wrong, or it is a duplicate that should be removed.</svrl:text>
</svrl:successful-report>
</xsl:if>
<!--REPORT error-->
<xsl:if test=". = preceding::award-id[parent::award-group/descendant::institution[1] = $funder-name]">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test=". = preceding::award-id[parent::award-group/descendant::institution[1] = $funder-name]">
<xsl:attribute name="id">award-id-test-7</xsl:attribute>
<xsl:attribute name="role">error</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[award-id-test-7] Funding entry has an award id - <xsl:text/>
<xsl:value-of select="."/>
<xsl:text/> - which is also used in another funding entry with the same funder name. This must be incorrect. Either the funder name or the award ID is wrong, or it is a duplicate that should be removed.</svrl:text>
</svrl:successful-report>
</xsl:if>
<!--REPORT warning-->
<xsl:if test=". = preceding::award-id[parent::award-group[not(descendant::institution[1] = $funder-name) and not(descendant::institution-id[1] = $funder-id)]]">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test=". = preceding::award-id[parent::award-group[not(descendant::institution[1] = $funder-name) and not(descendant::institution-id[1] = $funder-id)]]">
<xsl:attribute name="id">award-id-test-8</xsl:attribute>
<xsl:attribute name="role">warning</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[award-id-test-8] Funding entry has an award id - <xsl:text/>
<xsl:value-of select="."/>
<xsl:text/> - which is also used in another funding entry with a different funder. Has there been a mistake with the award id? If the grant was awarded jointly by two funders, then this capture is correct and should be retained.</svrl:text>
</svrl:successful-report>
</xsl:if>
<xsl:apply-templates select="*" mode="M157"/>
</xsl:template>
<xsl:template match="text()" priority="-1" mode="M157"/>
Expand Down
14 changes: 14 additions & 0 deletions src/schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -3541,6 +3541,8 @@

<rule context="funding-group/award-group/award-id" id="award-id-tests">
<let name="id" value="parent::award-group/@id"/>
<let name="funder-id" value="parent::award-group/descendant::institution-id[1]"/>
<let name="funder-name" value="parent::award-group/descendant::institution[1]"/>

<report see="https://elifeproduction.slab.com/posts/funding-3sv64358#award-id-test-1"
test="matches(.,',|;')"
Expand All @@ -3566,6 +3568,18 @@
role="error"
id="award-id-test-5">Award id contains a DOI link - <value-of select="."/>. If the award ID is for a grant DOI it should contain the DOI without the https://... protocol (e.g. 10.37717/220020477).</report>

<report test=". = preceding::award-id[parent::award-group/descendant::institution-id[1] = $funder-id]"
role="error"
id="award-id-test-6">Funding entry has an award id - <value-of select="."/> - which is also used in another funding entry with the same funder ID. This must be incorrect. Either the funder ID or the award ID is wrong, or it is a duplicate that should be removed.</report>

<report test=". = preceding::award-id[parent::award-group/descendant::institution[1] = $funder-name]"
role="error"
id="award-id-test-7">Funding entry has an award id - <value-of select="."/> - which is also used in another funding entry with the same funder name. This must be incorrect. Either the funder name or the award ID is wrong, or it is a duplicate that should be removed.</report>

<report test=". = preceding::award-id[parent::award-group[not(descendant::institution[1] = $funder-name) and not(descendant::institution-id[1] = $funder-id)]]"
role="warning"
id="award-id-test-8">Funding entry has an award id - <value-of select="."/> - which is also used in another funding entry with a different funder. Has there been a mistake with the award id? If the grant was awarded jointly by two funders, then this capture is correct and should be retained.</report>

</rule>

<rule context="article-meta//award-group//institution-wrap" id="institution-wrap-tests">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,8 @@
<pattern id="article-metadata">
<rule context="funding-group/award-group/award-id" id="award-id-tests">
<let name="id" value="parent::award-group/@id"/>
<let name="funder-id" value="parent::award-group/descendant::institution-id[1]"/>
<let name="funder-name" value="parent::award-group/descendant::institution[1]"/>
<report see="https://elifeproduction.slab.com/posts/funding-3sv64358#award-id-test-1" test="matches(.,',|;')" role="warning" id="award-id-test-1">Funding entry with id <value-of select="$id"/> has a comma or semi-colon in the award id. Should this be separated out into several funding entries? - <value-of select="."/>.</report>
</rule>
</pattern>
Expand Down
Loading