aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-08-10 17:35:16 -0700
committerBryan Newbold <bnewbold@robocracy.org>2020-08-11 15:32:28 -0700
commitff05a03a3874e17557174d3534a1c2d11e01c4a6 (patch)
tree0f06f2b6bd1d58140422dd1be8b6d614290007ea
parent211ef075f5ac2960fa09134043a8246270d99baf (diff)
downloadfatcat-ff05a03a3874e17557174d3534a1c2d11e01c4a6.tar.gz
fatcat-ff05a03a3874e17557174d3534a1c2d11e01c4a6.zip
datacite import: figshare-specific hacks
-rw-r--r--python/fatcat_tools/importers/datacite.py6
-rw-r--r--python/tests/files/datacite/datacite_result_16.json1
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": [
{