From 440168322c136f4126c5175910ccadef31ca41e1 Mon Sep 17 00:00:00 2001 From: Christopher Cave-Ayland Date: Mon, 5 Aug 2024 17:01:32 +0100 Subject: [PATCH 1/3] Map dates between schema formats for test datasets --- test_data/create_test_data_records.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test_data/create_test_data_records.py b/test_data/create_test_data_records.py index 3e14d6f..dee17c3 100644 --- a/test_data/create_test_data_records.py +++ b/test_data/create_test_data_records.py @@ -146,6 +146,13 @@ def datacite_to_invenio_schema(datacite): for reference in references ], "identifiers": [], + "dates": [ + { + "date": date_meta["date"], + "type": {"id": date_meta["dateType"].lower()}, + } + for date_meta in data["dates"] + ], }, } From ec2c2b17880b64161adf1f14bae62a89563048f4 Mon Sep 17 00:00:00 2001 From: Christopher Cave-Ayland Date: Mon, 5 Aug 2024 21:24:49 +0100 Subject: [PATCH 2/3] Map rights (licenses) between schema formats --- test_data/create_test_data_records.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test_data/create_test_data_records.py b/test_data/create_test_data_records.py index dee17c3..2aa7b45 100644 --- a/test_data/create_test_data_records.py +++ b/test_data/create_test_data_records.py @@ -153,6 +153,12 @@ def datacite_to_invenio_schema(datacite): } for date_meta in data["dates"] ], + "rights": [ + { + "id": rights_meta.get("rightsIdentifier", "cc0-1.0").lower(), + } + for rights_meta in data["rightsList"] + ], }, } From 1e04cbefa707d8970445f8da17d1f26d48055b67 Mon Sep 17 00:00:00 2001 From: Christopher Cave-Ayland Date: Tue, 20 Aug 2024 13:50:37 +0100 Subject: [PATCH 3/3] Map related_identifiers between schemas --- test_data/create_test_data_records.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test_data/create_test_data_records.py b/test_data/create_test_data_records.py index 2aa7b45..12c3c46 100644 --- a/test_data/create_test_data_records.py +++ b/test_data/create_test_data_records.py @@ -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 { @@ -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": [ {