diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-29 16:58:04 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-29 16:58:06 -0800 |
commit | 1305a503b116e8f8081cbc48dc14c92b4b64b17d (patch) | |
tree | 0f69fba9f48470037b221174c42085b2e1c89272 /python/fatcat_tools/importers | |
parent | 26d30331174087a57591c9860c1a84d7010b3f20 (diff) | |
download | fatcat-1305a503b116e8f8081cbc48dc14c92b4b64b17d.tar.gz fatcat-1305a503b116e8f8081cbc48dc14c92b4b64b17d.zip |
crossref import tweaks/fixes
- refs: article-title not title; save unstructured; authors not author
- save 'language' field (already an ISO code)
Diffstat (limited to 'python/fatcat_tools/importers')
-rw-r--r-- | python/fatcat_tools/importers/crossref.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/python/fatcat_tools/importers/crossref.py b/python/fatcat_tools/importers/crossref.py index c4e55962..f9a4fe46 100644 --- a/python/fatcat_tools/importers/crossref.py +++ b/python/fatcat_tools/importers/crossref.py @@ -239,11 +239,13 @@ class CrossrefImporter(EntityImporter): ref_extra['journal-title'] = rm['journal-title'] if rm.get('DOI'): 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', - 'accessed_date', 'issued', 'page', 'medium', - 'collection_title', 'chapter_number'): + author = clean(rm.get('author')) + if author: + ref_extra['authors'] = [author] + for k in ('editor', 'edition', 'authority', 'version', 'genre', + 'url', 'event', 'issue', 'volume', 'date', 'accessed_date', + 'issued', 'page', 'medium', 'collection_title', 'chapter_number', + 'unstructured', 'series-title', 'volume-title'): if clean(rm.get(k)): ref_extra[k] = clean(rm[k]) if not ref_extra: @@ -255,7 +257,7 @@ class CrossrefImporter(EntityImporter): key=key, year=year, container_name=clean(container_name), - title=clean(rm.get('title')), + title=clean(rm.get('article-title')), locator=clean(rm.get('first-page')), # TODO: just dump JSON somewhere here? extra=ref_extra)) @@ -378,7 +380,7 @@ class CrossrefImporter(EntityImporter): volume=clean(obj.get('volume')), issue=clean(obj.get('issue')), pages=clean(obj.get('page')), - language=None, # crossref doesn't supply language info + language=clean(obj.get('language')), license_slug=license_slug, extra=extra, abstracts=abstracts, |