summaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/importers/crossref.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-29 15:48:23 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-29 15:48:23 -0800
commit0720b0c77088e8402a0519da9de655576c74641b (patch)
tree4c92add1386905c02246d541d13fe6112e53b31c /python/fatcat_tools/importers/crossref.py
parentd010db9791bc187153dda1855059999a500ee3ad (diff)
downloadfatcat-0720b0c77088e8402a0519da9de655576c74641b.tar.gz
fatcat-0720b0c77088e8402a0519da9de655576c74641b.zip
fix refs extra ordering bug
Diffstat (limited to 'python/fatcat_tools/importers/crossref.py')
-rw-r--r--python/fatcat_tools/importers/crossref.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/python/fatcat_tools/importers/crossref.py b/python/fatcat_tools/importers/crossref.py
index 45a92e98..0512c963 100644
--- a/python/fatcat_tools/importers/crossref.py
+++ b/python/fatcat_tools/importers/crossref.py
@@ -229,6 +229,7 @@ class CrossrefImporter(EntityImporter):
year = None
except:
year = None
+ ref_extra = dict()
key = rm.get('key')
if key and key.startswith(obj['DOI'].upper()):
key = key.replace(obj['DOI'].upper() + "-", '')
@@ -237,10 +238,9 @@ class CrossrefImporter(EntityImporter):
if not container_name:
container_name = rm.get('journal-title')
elif rm.get('journal-title'):
- extra['journal-title'] = rm['journal-title']
- extra = dict()
+ ref_extra['journal-title'] = rm['journal-title']
if rm.get('DOI'):
- extra['doi'] = rm.get('DOI').lower()
+ ref_extra['doi'] = rm.get('DOI').lower()
# TODO: what fields here? CSL citation stuff
for k in ('author', 'editor', 'edition', 'authority', 'version',
'genre', 'url', 'event', 'issue', 'volume', 'date',
@@ -248,8 +248,8 @@ class CrossrefImporter(EntityImporter):
'collection_title', 'chapter_number'):
if clean(rm.get(k)):
extra[k] = clean(rm[k])
- if not extra:
- extra = None
+ if not ref_extra:
+ ref_extra = None
refs.append(fatcat_client.ReleaseRef(
index=i,
# doing lookups would be a second import pass
@@ -260,7 +260,7 @@ class CrossrefImporter(EntityImporter):
title=clean(rm.get('title')),
locator=clean(rm.get('first-page')),
# TODO: just dump JSON somewhere here?
- extra=extra))
+ extra=ref_extra))
# abstracts
abstracts = []