diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-05-13 14:23:02 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-05-13 14:23:06 -0700 |
commit | 955d4942d5111cbbd8f4b99d4e3c6d79262dab6e (patch) | |
tree | 87757a7afdf00ab6de5ed7455267654bf49b5239 /python/fatcat_tools/importers/crossref.py | |
parent | 287e892abb4adac8ea7f7211524a41c7cd06851c (diff) | |
download | fatcat-955d4942d5111cbbd8f4b99d4e3c6d79262dab6e.tar.gz fatcat-955d4942d5111cbbd8f4b99d4e3c6d79262dab6e.zip |
partial python impl of ext_id and release_stage refactors
Diffstat (limited to 'python/fatcat_tools/importers/crossref.py')
-rw-r--r-- | python/fatcat_tools/importers/crossref.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/python/fatcat_tools/importers/crossref.py b/python/fatcat_tools/importers/crossref.py index 722f93aa..999ce13f 100644 --- a/python/fatcat_tools/importers/crossref.py +++ b/python/fatcat_tools/importers/crossref.py @@ -355,10 +355,10 @@ class CrossrefImporter(EntityImporter): # release status if obj['type'] in ('journal-article', 'conference-proceeding', 'book', 'dissertation', 'book-chapter'): - release_status = "published" + release_stage = "published" else: # unknown - release_status = None + release_stage = None # external identifiers extids = self.lookup_ext_ids(doi=obj['DOI'].lower()) @@ -408,18 +408,20 @@ class CrossrefImporter(EntityImporter): title=title, original_title=original_title, release_type=release_type, - release_status=release_status, + release_stage=release_stage, release_date=release_date, release_year=release_year, publisher=publisher, - doi=obj['DOI'].lower(), - pmid=extids['pmid'], - pmcid=extids['pmcid'], - wikidata_qid=extids['wikidata_qid'], - isbn13=isbn13, - core_id=extids['core_id'], - arxiv_id=extids['arxiv_id'], - jstor_id=extids['jstor_id'], + ext_ids=fatcat_client.ReleaseEntityExtIds( + doi=obj['DOI'].lower(), + pmid=extids['pmid'], + pmcid=extids['pmcid'], + wikidata_qid=extids['wikidata_qid'], + isbn13=isbn13, + core=extids['core_id'], + arxiv=extids['arxiv_id'], + jstor=extids['jstor_id'], + ), volume=clean(obj.get('volume')), issue=clean(obj.get('issue')), pages=clean(obj.get('page')), @@ -437,7 +439,7 @@ class CrossrefImporter(EntityImporter): # lookup existing DOI (don't need to try other ext idents for crossref) existing = None try: - existing = self.api.lookup_release(doi=re.doi) + existing = self.api.lookup_release(doi=re.ext_ids.doi) except fatcat_client.rest.ApiException as err: if err.status != 404: raise err |