From ff05a03a3874e17557174d3534a1c2d11e01c4a6 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 10 Aug 2020 17:35:16 -0700 Subject: datacite import: figshare-specific hacks --- python/fatcat_tools/importers/datacite.py | 6 +++--- python/tests/files/datacite/datacite_result_16.json | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py index 0481337a..6c050565 100644 --- a/python/fatcat_tools/importers/datacite.py +++ b/python/fatcat_tools/importers/datacite.py @@ -729,7 +729,7 @@ class DataciteImporter(EntityImporter): # figshare if re.ext_ids.doi.startswith('10.6084/') or re.ext_ids.doi.startswith('10.25384'): # set version if DOI ends with versioned suffix - doi_suffix = re.ext_ids.doi.split('.') + doi_suffix = re.ext_ids.doi.split('.')[-1] if doi_suffix and doi_suffix.startswith('v') and doi_suffix[1:].isdigit(): re.version = doi_suffix # "Figure 123 from " -> component @@ -741,8 +741,8 @@ class DataciteImporter(EntityImporter): re.release_type = "component" # figshare.com - if re.ext_ids.doi.startswith('10.6084/m9.figshare.') and re.container_name is None: - re.container_name = "figshare.com" + if re.ext_ids.doi.startswith('10.6084/m9.figshare.') and re.extra.get('container_name') is None: + re.extra['container_name'] = "figshare.com" return re diff --git a/python/tests/files/datacite/datacite_result_16.json b/python/tests/files/datacite/datacite_result_16.json index ef26c47c..d0b933d1 100644 --- a/python/tests/files/datacite/datacite_result_16.json +++ b/python/tests/files/datacite/datacite_result_16.json @@ -13,6 +13,7 @@ "doi": "10.6084/m9.figshare.1282478" }, "extra": { + "container_name": "figshare.com", "datacite": { "license": [ { -- cgit v1.2.3