diff options
author | Vinay Goel <vinay@archive.org> | 2018-06-21 21:24:13 +0000 |
---|---|---|
committer | Vinay Goel <vinay@archive.org> | 2018-06-21 21:24:13 +0000 |
commit | 5b376b98ca6fe8e9f75a42c807786a2aa9a52d94 (patch) | |
tree | 375f8673e26f67ce89280032f3a4ff9a991ea083 /python | |
parent | 7de80cd1641f575795067bcfa6aefca6eaa7f052 (diff) | |
download | fatcat-5b376b98ca6fe8e9f75a42c807786a2aa9a52d94.tar.gz fatcat-5b376b98ca6fe8e9f75a42c807786a2aa9a52d94.zip |
crossref importer tweaks and fixes
Diffstat (limited to 'python')
-rw-r--r-- | python/fatcat/crossref_importer.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/python/fatcat/crossref_importer.py b/python/fatcat/crossref_importer.py index ea6b1a2c..06c162f0 100644 --- a/python/fatcat/crossref_importer.py +++ b/python/fatcat/crossref_importer.py @@ -18,17 +18,28 @@ class FatcatCrossrefImporter(FatcatImporter): returns a ReleaseEntity """ + # This work is out of scope if it doesn't have authors or a title + if (not 'author' in obj) or (not 'title' in obj): + return None + # contribs contribs = [] for i, am in enumerate(obj['author']): creator_id = None if 'ORCID' in am.keys(): creator_id = self.lookup_orcid(am['ORCID'].split('/')[-1]) + # Sorry humans :( + if am.get('given') and am.get('family'): + raw_name = "{} {}".format(am['given'], am['family']) + elif am.get('family'): + raw_name = am['family'] + else: + # TODO: defaults back to a pseudo-null value + raw_name = am.get('given', '<blank>') contribs.append(fatcat_client.ReleaseContrib( creator_id=creator_id, index=i+1, - # Sorry humans :( - raw="{} {}".format(am['given'], am['family']), + raw=raw_name, role="author")) # container @@ -45,7 +56,6 @@ class FatcatCrossrefImporter(FatcatImporter): issnl=issnl, publisher=publisher, name=obj['container-title'][0]) - print("created container: {}".format(issnl)) # references refs = [] |