-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/development' into YDA-5721-add-t…
…ests
- Loading branch information
Showing
12 changed files
with
277 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ on: | |
branches: | ||
- 'development' | ||
- 'release-1.9' | ||
- 'release-1.10' | ||
|
||
jobs: | ||
push-image: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# -*- coding: utf-8 -*- | ||
"""JSON schema transformation utility functions.""" | ||
|
||
__copyright__ = 'Copyright (c) 2024, Utrecht University' | ||
__license__ = 'GPLv3, see LICENSE' | ||
|
||
import re | ||
|
||
|
||
def correctify_orcid(org_orcid): | ||
"""Correct illformatted ORCID.""" | ||
# Get rid of all spaces. | ||
orcid = org_orcid.replace(' ', '') | ||
|
||
# Upper-case X. | ||
orcid = orcid.replace('x', 'X') | ||
|
||
# The last part should hold a valid id like eg: 1234-1234-1234-123X. | ||
# If not, it is impossible to correct it to the valid orcid format | ||
orcs = orcid.split('/') | ||
if not re.search("^[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]$", orcs[-1]): | ||
return None | ||
|
||
return "https://orcid.org/{}".format(orcs[-1]) | ||
|
||
|
||
def correctify_scopus(org_scopus): | ||
"""Correct illformatted Scopus.""" | ||
# Get rid of all spaces. | ||
new_scopus = org_scopus.replace(' ', '') | ||
|
||
if not re.search("^\d{1,11}$", new_scopus): | ||
return None | ||
|
||
return new_scopus | ||
|
||
|
||
def correctify_isni(org_isni): | ||
"""Correct ill-formatted ISNI.""" | ||
# Remove all spaces. | ||
new_isni = org_isni.replace(' ', '') | ||
|
||
# Upper-case X. | ||
new_isni = new_isni.replace('x', 'X') | ||
|
||
# The last part should hold a valid id like eg: 123412341234123X. | ||
# If not, it is impossible to correct it to the valid isni format | ||
new_isni = new_isni.split('/') | ||
if not re.search("^[0-9]{15}[0-9X]$", new_isni[-1]): | ||
return None | ||
|
||
return "https://isni.org/isni/{}".format(new_isni[-1]) | ||
|
||
|
||
def correctify_researcher_id(org_researcher_id): | ||
"""Correct illformatted ResearcherID.""" | ||
# Get rid of all spaces. | ||
researcher_id = org_researcher_id.replace(' ', '') | ||
|
||
# The last part should hold a valid id like eg: A-1234-1234 | ||
# If not, it is impossible to correct it to the valid ResearcherID format | ||
orcs = researcher_id.split('/') | ||
if not re.search("^[A-Z]-[0-9]{4}-[0-9]{4}$", orcs[-1]): | ||
# Return original value. | ||
return org_researcher_id | ||
|
||
return "https://www.researcherid.com/rid/{}".format(orcs[-1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.