aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/importers/crossref.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-05-13 17:08:28 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-05-13 17:08:28 -0700
commitc67fb5d850ec6bd6659ada8ce8162a8859dafe15 (patch)
tree0fad6d0d486854ecda4604127b458568cca15af5 /python/fatcat_tools/importers/crossref.py
parentc9e067e4b7c23b4d871ac091c7a9ec5a6650e909 (diff)
downloadfatcat-c67fb5d850ec6bd6659ada8ce8162a8859dafe15.tar.gz
fatcat-c67fb5d850ec6bd6659ada8ce8162a8859dafe15.zip
importer code updates
Diffstat (limited to 'python/fatcat_tools/importers/crossref.py')
-rw-r--r--python/fatcat_tools/importers/crossref.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/python/fatcat_tools/importers/crossref.py b/python/fatcat_tools/importers/crossref.py
index 999ce13f..c875010c 100644
--- a/python/fatcat_tools/importers/crossref.py
+++ b/python/fatcat_tools/importers/crossref.py
@@ -218,6 +218,8 @@ class CrossrefImporter(EntityImporter):
creator_id=creator_id,
index=index,
raw_name=raw_name,
+ given_name=clean(am.get('given')),
+ surname=clean(am.get('family')),
raw_affiliation=clean(raw_affiliation),
role=ctype,
extra=extra))
@@ -318,13 +320,15 @@ class CrossrefImporter(EntityImporter):
if not container_id:
if obj.get('container-title'):
extra['container_name'] = clean(obj['container-title'][0])
- for key in ('group-title', 'subtitle'):
+ for key in ('group-title'):
val = obj.get(key)
if val:
if type(val) == list:
val = val[0]
if type(val) == str:
- extra[key] = clean(val)
+ val = clean(val)
+ if val:
+ extra[key] = clean(val)
else:
extra[key] = val
# crossref-nested extra keys
@@ -397,6 +401,13 @@ class CrossrefImporter(EntityImporter):
# title can't be just a single character
return None
+ subtitle = None
+ if obj.get('subtitle'):
+ subtitle = clean(obj.get('subtitle')[0], force_xml=True)
+ if not subtitle or len(subtitle) <= 1:
+ # subtitle can't be just a single character
+ return None
+
if extra_crossref:
extra['crossref'] = extra_crossref
if not extra:
@@ -406,6 +417,7 @@ class CrossrefImporter(EntityImporter):
work_id=None,
container_id=container_id,
title=title,
+ subtitle=subtitle,
original_title=original_title,
release_type=release_type,
release_stage=release_stage,