summaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/transform.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-01-29 00:28:03 -0800
committerBryan Newbold <bnewbold@archive.org>2021-01-29 00:28:03 -0800
commitba34b1a24639599b107bdb9387483ad4dde2c237 (patch)
tree734bfe1f6f4dd010bcd9b6097b1adb374fa39949 /fatcat_scholar/transform.py
parent20d64731769de21ee3717066accb245f2a54484e (diff)
downloadfatcat-scholar-ba34b1a24639599b107bdb9387483ad4dde2c237.tar.gz
fatcat-scholar-ba34b1a24639599b107bdb9387483ad4dde2c237.zip
bugfix: lang_code sometimes a list
Diffstat (limited to 'fatcat_scholar/transform.py')
-rw-r--r--fatcat_scholar/transform.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/fatcat_scholar/transform.py b/fatcat_scholar/transform.py
index e50c411..4114885 100644
--- a/fatcat_scholar/transform.py
+++ b/fatcat_scholar/transform.py
@@ -138,6 +138,12 @@ def es_biblio_from_sim(sim: Dict[str, Any]) -> ScholarBiblio:
if release_year and abs(release_year) > 2050:
release_year = None
+ lang_code = SIM_LANG_MAP.get(issue_meta.get("language")) or SIM_LANG_MAP.get(
+ pub_meta.get("language")
+ )
+ if isinstance(lang_code, list):
+ lang_code = lang_code[0]
+
return ScholarBiblio(
# release_ident=release.ident,
title=None,
@@ -149,8 +155,7 @@ def es_biblio_from_sim(sim: Dict[str, Any]) -> ScholarBiblio:
or SIM_RELEASE_TYPE_MAP.get(pub_meta.get("pub_type")),
release_stage="published", # as a default
# withdrawn_status=release.withdrawn_status,
- lang_code=SIM_LANG_MAP.get(issue_meta.get("language"))
- or SIM_LANG_MAP.get(pub_meta.get("language")),
+ lang_code=lang_code,
country_code=SIM_COUNTRY_MAP.get(pub_meta.get("country")),
volume=volume,
volume_int=volume_int,