Skip to content

Commit

Permalink
Map related_identifiers between schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
cc-a committed Aug 20, 2024
1 parent ec2c2b1 commit 1e04cbe
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions test_data/create_test_data_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ def datacite_to_invenio_schema(datacite):
}
version = data["version"]
description = data["descriptions"][0]["description"]
references = [
related_identifiers = [
ri
for ri in data["relatedIdentifiers"]
if ri["relationType"] in ("References", "IsReferencedBy")
if not FILE_URI_REGEX.match(ri.get("relatedIdentifier", ""))
and not ri.get("relatedMetadataScheme") == "ORE"
]

return {
Expand Down Expand Up @@ -130,21 +131,21 @@ def datacite_to_invenio_schema(datacite):
for contributor in data["contributors"][3:]
],
"languages": [],
"related_identifiers": [],
"related_identifiers": [
{
"identifier": ri["relatedIdentifier"],
"scheme": ri["relatedIdentifierType"].lower(),
"relation_type": dict(id=ri["relationType"].lower()),
}
for ri in related_identifiers
],
"sizes": [],
"formats": [],
"version": version,
"description": description,
"additional_descriptions": [],
"funding": [],
"references": [
{
"reference": reference["relationType"],
"identifier": reference["relatedIdentifier"],
"scheme": reference["relatedIdentifierType"].lower(),
}
for reference in references
],
"references": [],
"identifiers": [],
"dates": [
{
Expand Down

0 comments on commit 1e04cbe

Please sign in to comment.