From 6ef121ed6b90e880eb17406afe12ec5a7fa135ce Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 4 Nov 2024 18:44:09 -0500 Subject: [PATCH] Elaborate "publisher" into expected record, and schemeURI -> schemeUri --- dandischema/datacite.py | 12 +++++++++--- dandischema/tests/test_datacite.py | 25 ++++++++++++++++++++----- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/dandischema/datacite.py b/dandischema/datacite.py index 0f1a4ce..70a0420 100644 --- a/dandischema/datacite.py +++ b/dandischema/datacite.py @@ -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"] = { @@ -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, } @@ -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" diff --git a/dandischema/tests/test_datacite.py b/dandischema/tests/test_datacite.py index 4f7e042..2a2e779 100644 --- a/dandischema/tests/test_datacite.py +++ b/dandischema/tests/test_datacite.py @@ -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"}, @@ -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": [ @@ -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": [ @@ -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",