Skip to content

Commit

Permalink
Elaborate "publisher" into expected record, and schemeURI -> schemeUri
Browse files Browse the repository at this point in the history
  • Loading branch information
yarikoptic committed Nov 4, 2024
1 parent 28c0ff5 commit 6ef121e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
12 changes: 9 additions & 3 deletions dandischema/datacite.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ def to_datacite(
attributes["descriptions"] = [
{"description": meta.description, "descriptionType": "Abstract"}
]
attributes["publisher"] = "DANDI Archive"
attributes["publisher"] = {
"name": "DANDI Archive",
"schemeUri": "https://scicrunch.org/resolver/",
"publisherIdentifier": "https://scicrunch.org/resolver/RRID:SCR_017571",
"publisherIdentifierScheme": "RRID",
"lang": "en",
}
attributes["publicationYear"] = str(meta.datePublished.year)
# not sure about it dandi-api had "resourceTypeGeneral": "NWB"
attributes["types"] = {
Expand All @@ -102,7 +108,7 @@ def to_datacite(
# assuming that all licenses are from SPDX?
attributes["rightsList"] = [
{
"schemeURI": "https://spdx.org/licenses/",
"schemeUri": "https://spdx.org/licenses/",
"rightsIdentifierScheme": "SPDX",
"rightsIdentifier": el.name,
}
Expand Down Expand Up @@ -139,7 +145,7 @@ def to_datacite(
contr_dict: Dict[str, Any] = {
"name": contr_el.name,
"contributorName": contr_el.name,
"schemeURI": "orcid.org",
"schemeUri": "orcid.org",
}
if isinstance(contr_el, Person):
contr_dict["nameType"] = "Personal"
Expand Down
25 changes: 20 additions & 5 deletions dandischema/tests/test_datacite.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,16 @@ def test_datacite(dandi_id: str, schema: Any) -> None:
1,
{"description": "testing", "descriptionType": "Abstract"},
),
"publisher": (None, "DANDI Archive"),
"publisher": (
None,
{
"name": "DANDI Archive",
"publisherIdentifier": "https://scicrunch.org/resolver/RRID:SCR_017571",
"publisherIdentifierScheme": "RRID",
"schemeUri": "https://scicrunch.org/resolver/",
"lang": "en",
},
),
"rightsList": (
1,
{"rightsIdentifierScheme": "SPDX", "rightsIdentifier": "CC_BY_40"},
Expand Down Expand Up @@ -451,7 +460,7 @@ def test_datacite_publish(metadata_basic: Dict[str, Any]) -> None:
"givenName": "A_first",
"name": "A_last, A_first",
"nameType": "Personal",
"schemeURI": "orcid.org",
"schemeUri": "orcid.org",
}
],
"creators": [
Expand All @@ -462,7 +471,7 @@ def test_datacite_publish(metadata_basic: Dict[str, Any]) -> None:
"givenName": "A_first",
"name": "A_last, A_first",
"nameType": "Personal",
"schemeURI": "orcid.org",
"schemeUri": "orcid.org",
}
],
"descriptions": [
Expand Down Expand Up @@ -490,12 +499,18 @@ def test_datacite_publish(metadata_basic: Dict[str, Any]) -> None:
},
],
"publicationYear": "1970",
"publisher": "DANDI Archive",
"publisher": {
"name": "DANDI Archive",
"publisherIdentifier": "https://scicrunch.org/resolver/RRID:SCR_017571",
"publisherIdentifierScheme": "RRID",
"schemeUri": "https://scicrunch.org/resolver/",
"lang": "en",
},
"rightsList": [
{
"rightsIdentifier": "CC_BY_40",
"rightsIdentifierScheme": "SPDX",
"schemeURI": "https://spdx.org/licenses/",
"schemeUri": "https://spdx.org/licenses/",
}
],
"schemaVersion": "http://datacite.org/schema/kernel-4",
Expand Down

0 comments on commit 6ef121e

Please sign in to comment.