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 12, 2024
1 parent 2095d3e commit dc19168
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
12 changes: 9 additions & 3 deletions dandischema/datacite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,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 @@ -113,7 +119,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 @@ -150,7 +156,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/datacite/tests/test_datacite.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,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 @@ -423,7 +432,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 @@ -434,7 +443,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 @@ -462,12 +471,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 dc19168

Please sign in to comment.