aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_scholar
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-09-04 18:16:36 -0700
committerBryan Newbold <bnewbold@archive.org>2020-09-04 18:16:36 -0700
commit6955d603734440835e28f7ab218b24e569523780 (patch)
treea00d3bc685bcfd3036532e88a8a3b1625703466e /fatcat_scholar
parent3bf706f07d68aaacebcbf08d21c7b4c4f91856ea (diff)
downloadfatcat-scholar-6955d603734440835e28f7ab218b24e569523780.tar.gz
fatcat-scholar-6955d603734440835e28f7ab218b24e569523780.zip
fixes to refs transform (for non-str author fields)
Diffstat (limited to 'fatcat_scholar')
-rw-r--r--fatcat_scholar/transform.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/fatcat_scholar/transform.py b/fatcat_scholar/transform.py
index 158ed6f..a21abf9 100644
--- a/fatcat_scholar/transform.py
+++ b/fatcat_scholar/transform.py
@@ -454,12 +454,14 @@ def refs_from_grobid(release: ReleaseEntity, tei_dict: dict) -> Sequence[RefStru
ref_year: Optional[int] = None
if ref_date and len(ref_date) > 4 and ref_date[:4].isdigit():
ref_year = int(ref_date[:4])
+ authors = ref.get("authors") or []
+ authors = [a for a in authors if type(a) == str]
output.append(
RefStructured(
biblio=RefBiblio(
title=ref.get("title"),
# subtitle
- contrib_raw_names=ref.get("authors") or [],
+ contrib_raw_names=authors,
year=ref_year,
container_name=ref.get("journal"),
volume=ref.get("volume"),
@@ -495,12 +497,14 @@ def refs_from_release_refs(release: ReleaseEntity) -> Sequence[RefStructured]:
elif release.extra and release.extra.get("datacite"):
ref_source = "datacite"
extra = ref.extra or dict()
+ authors = extra.get("authors") or []
+ authors = [a for a in authors if type(a) == str]
output.append(
RefStructured(
biblio=RefBiblio(
title=ref.title,
subtitle=extra.get("subtitle"),
- contrib_raw_names=extra.get("authors") or [],
+ contrib_raw_names=authors,
year=ref.year,
container_name=ref.container_name,
volume=extra.get("volume"),