aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-04-09 18:38:23 -0700
committerBryan Newbold <bnewbold@archive.org>2020-04-09 18:38:23 -0700
commitee53062606c6d194c52013063c4ff414fc762a00 (patch)
treead2b453b9b23a3085dc5225efa8b196bbe8bfbd9
parent9a883c5699fa144f0ad1619ac8a6d0e7bda0350e (diff)
downloadfatcat-covid19-ee53062606c6d194c52013063c4ff414fc762a00.tar.gz
fatcat-covid19-ee53062606c6d194c52013063c4ff414fc762a00.zip
handle ext_ids without _id in release schema
-rw-r--r--fatcat_covid19/transform.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/fatcat_covid19/transform.py b/fatcat_covid19/transform.py
index 1d2fa7c..7803085 100644
--- a/fatcat_covid19/transform.py
+++ b/fatcat_covid19/transform.py
@@ -67,14 +67,17 @@ def fulltext_to_elasticsearch(row, force_bool=True):
'pmcid',
'isbn13',
'wikidata_qid',
- 'arxiv_id',
- 'jstor_id',
- 'mag_id',
+ 'arxiv',
+ 'jstor',
+ 'mag',
]
for key in BIBLIO_KEYS:
t[key] = release.get(key) or None
for key in EXT_IDS:
- t[key] = release['ext_ids'].get(key) or None
+ if key in ['arxiv', 'jstor', 'mag']:
+ t[key + "_id"] = release['ext_ids'].get(key) or None
+ else:
+ t[key] = release['ext_ids'].get(key) or None
t['contrib_count'] = len(release['contribs'] or [])