aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2020-01-07 15:20:25 +0100
committerMartin Czygan <martin.czygan@gmail.com>2020-01-07 15:20:25 +0100
commitf9c711f77bba992e6e9e1d75929d35e8da828f61 (patch)
tree187b808ae2a84344ab23a88926b1204bd35bb5bb /python/fatcat_tools
parent3b531d2f83e9fde67e3c45d751fb80b2d9c815be (diff)
downloadfatcat-f9c711f77bba992e6e9e1d75929d35e8da828f61.tar.gz
fatcat-f9c711f77bba992e6e9e1d75929d35e8da828f61.zip
datacite: adding datacite-specific extra metadata
* attributes.metadataVersion * attributes.schemaVersion * attributes.version (source dependent values, follows suggestions in https://schema.datacite.org/meta/kernel-4.3/doc/DataCite-MetadataKernel_v4.3.pdf#page=26, but values vary) Furthermore: * attributes.types.resourceTypeGeneral * attributes.types.resourceType
Diffstat (limited to 'python/fatcat_tools')
-rw-r--r--python/fatcat_tools/importers/datacite.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py
index d7fbd269..c2725aeb 100644
--- a/python/fatcat_tools/importers/datacite.py
+++ b/python/fatcat_tools/importers/datacite.py
@@ -607,6 +607,25 @@ class DataciteImporter(EntityImporter):
if attributes.get('subjects'):
extra_datacite['subjects'] = attributes['subjects']
+ # Include version information.
+ metadata_version = attributes.get('metadataVersion') or ''
+ schema_version = attributes.get('schemaVersion') or ''
+
+ if metadata_version:
+ extra_datacite['metadataVersion'] = metadata_version
+ if schema_version:
+ extra_datacite['schemaVersion'] = schema_version
+
+ # Include resource types.
+ types = attributes.get('types', {}) or {}
+ resource_type = types.get('resourceType', '') or ''
+ resource_type_general = types.get('resourceTypeGeneral', '') or ''
+
+ if resource_type:
+ extra_datacite['resourceType'] = resource_type
+ if resource_type_general:
+ extra_datacite['resourceTypeGeneral'] = resource_type_general
+
# Include certain relations from relatedIdentifiers. Keeping the
# original structure of data here, which is a list of dicts, with
# relation type, identifer and identifier type (mostly).
@@ -625,6 +644,14 @@ class DataciteImporter(EntityImporter):
extra = dict()
+ # "1.0.0", "v1.305.2019", "Final", "v1.0.0", "v0.3.0", "1", "0.19.0",
+ # "3.1", "v1.1", "{version}", "4.0", "10329", "11672", "11555",
+ # "v1.4.5", "2", "V1", "v3.0", "v0", "v0.6", "11124", "v1.0-beta", "1st
+ # Edition", "20191024", "v2.0.0", "v0.9.3", "10149", "2.0", null,
+ # "v0.1.1", "3.0", "1.0", "3", "v1.12.2", "20191018", "v0.3.1", "v1.0",
+ # "10161", "10010691", "10780", # "PresentaciĆ³n"
+ version = attributes.get('version')
+
# top-level extra keys
if not container_id and container_name:
extra['container_name'] = container_name
@@ -666,6 +693,7 @@ class DataciteImporter(EntityImporter):
refs=refs,
extra=extra,
license_slug=license_slug,
+ version=version,
)
return re