diff --git a/metadata_backend/conf/conf.py b/metadata_backend/conf/conf.py index ce058bd55..3655f82d7 100644 --- a/metadata_backend/conf/conf.py +++ b/metadata_backend/conf/conf.py @@ -31,10 +31,11 @@ and inserted here in projects Dockerfile. """ +import json import os from distutils.util import strtobool from pathlib import Path -from typing import Tuple +from typing import Dict, Tuple import ujson from motor.motor_asyncio import AsyncIOMotorClient @@ -171,3 +172,10 @@ def create_db_client() -> AsyncIOMotorClient: "publish_route": "/rpc/v2/datasets/publish_dataset", "catalog_pid": "urn:nbn:fi:att:data-catalog-sd", } + +# TODO: update languages. More fields could be needed +metax_mappings: Dict = {"identifier_types": {}, "languages": {}} +with open("metadata_backend/helpers/metax/identifier_types.json", "r") as codes: + codes_list = json.load(codes)["codes"] + for code in codes_list: + metax_mappings["identifier_types"][code["codeValue"].lower()] = code["uri"] diff --git a/metadata_backend/helpers/metax/codelist_identifier_type.json b/metadata_backend/helpers/metax/identifier_types.json similarity index 100% rename from metadata_backend/helpers/metax/codelist_identifier_type.json rename to metadata_backend/helpers/metax/identifier_types.json diff --git a/tests/test_files/doi/test_doi.json b/tests/test_files/doi/test_doi.json index 17fa355a7..d49e66d82 100644 --- a/tests/test_files/doi/test_doi.json +++ b/tests/test_files/doi/test_doi.json @@ -41,6 +41,81 @@ } ], "contributorType": "Researcher" + }, + { + "name": "Curator, Test", + "nameType": "Personal", + "givenName": "Test", + "familyName": "Curator", + "affiliation": [ + { + "name": "affiliation place", + "schemeUri": "https://ror.org", + "affiliationIdentifier": "https://ror.org/test3", + "affiliationIdentifierScheme": "ROR" + } + ], + "contributorType": "Data Curator" + }, + { + "name": "Rights, Holder", + "nameType": "Personal", + "givenName": "Rights", + "familyName": "Holder", + "affiliation": [ + { + "name": "affiliation place", + "schemeUri": "https://ror.org", + "affiliationIdentifier": "https://ror.org/test3", + "affiliationIdentifierScheme": "ROR" + } + ], + "contributorType": "Rights Holder" + } + ], + "dates": [ + { + "date": "2020-10-10/2022-01-10", + "dateType": "Collected" + }, + { + "date": "2020-10-10", + "dateType": "Issued" + }, + { + "date": "2022-01-10", + "dateType": "Updated" + }, + { + "date": "2022-01-10", + "dateType": "Available" + } + ], + "geoLocations": [ + { + "geoLocationPlace": "Helsinki" + }, + { + "geoLocationPoint": { + "pointLongitude": "121.061", + "pointLatitude": "14.5786" + }, + "geoLocationBox": { + "westBoundLongitude": "23.1994938494", + "eastBoundLongitude": "51.3195034857", + "southBoundLatitude": "32.6936430193", + "northBoundLatitude": "56.1691299506" + } + } + ], + "language": "Assamese", + "sizes": [ + "30000" + ], + "alternateIdentifiers": [ + { + "alternateIdentifier": "arXiv:9912.12345v2", + "alternateIdentifierType": "arXiv" } ] -} \ No newline at end of file +}