From dc53c673dd28a325e47659835015e31e8d345692 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 22 May 2019 14:03:02 -0700 Subject: all new importers need to set contrib index (order) --- python/fatcat_tools/importers/arxiv.py | 2 +- python/fatcat_tools/importers/jalc.py | 6 +++++- python/fatcat_tools/importers/jstor.py | 4 ++++ python/fatcat_tools/importers/pubmed.py | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) (limited to 'python/fatcat_tools/importers') diff --git a/python/fatcat_tools/importers/arxiv.py b/python/fatcat_tools/importers/arxiv.py index e6fb8039..38d10da3 100644 --- a/python/fatcat_tools/importers/arxiv.py +++ b/python/fatcat_tools/importers/arxiv.py @@ -117,7 +117,7 @@ class ArxivRawImporter(EntityImporter): doi = None title = latex_to_text(metadata.title.string) authors = parse_arxiv_authors(metadata.authors.string) - contribs = [fatcat_client.ReleaseContrib(raw_name=a, role='author') for a in authors] + contribs = [fatcat_client.ReleaseContrib(index=i, raw_name=a, role='author') for i, a in enumerate(authors)] lang = "en" # the vast majority in english if metadata.comments and metadata.comments.string: diff --git a/python/fatcat_tools/importers/jalc.py b/python/fatcat_tools/importers/jalc.py index d560686f..94ebeff9 100644 --- a/python/fatcat_tools/importers/jalc.py +++ b/python/fatcat_tools/importers/jalc.py @@ -157,7 +157,7 @@ class JalcImporter(EntityImporter): given_name = eng.find('givenName') if given_name: given_name = given_name.string - contrib = dict( + contrib = fatcat_client.ReleaseContrib( raw_name=clean(eng.find('name').string), given_name=clean(given_name), surname=clean(surname), @@ -165,6 +165,10 @@ class JalcImporter(EntityImporter): ) contribs.append(contrib) + for i, contrib in enumerate(contribs): + if contrib.raw_name != "et al.": + contrib.index = i + release_year = None release_date = None date = record.date or None diff --git a/python/fatcat_tools/importers/jstor.py b/python/fatcat_tools/importers/jstor.py index 6e6ec6a0..5016e813 100644 --- a/python/fatcat_tools/importers/jstor.py +++ b/python/fatcat_tools/importers/jstor.py @@ -165,6 +165,10 @@ class JstorImporter(EntityImporter): surname=surname, )) + for i, contrib in enumerate(contribs): + if contrib.raw_name != "et al.": + contrib.index = i + release_year = None release_date = None pub_date = article_meta.find('pub-date') diff --git a/python/fatcat_tools/importers/pubmed.py b/python/fatcat_tools/importers/pubmed.py index b79eb1f8..eecf99f6 100644 --- a/python/fatcat_tools/importers/pubmed.py +++ b/python/fatcat_tools/importers/pubmed.py @@ -615,6 +615,10 @@ class PubmedImporter(EntityImporter): if medline.AuthorList['CompleteYN'] == 'N': contribs.append(fatcat_client.ReleaseContrib(raw_name="et al.")) + + for i, contrib in enumerate(contribs): + if contrib.raw_name != "et al.": + contrib.index = i if not contribs: contribs = None -- cgit v1.2.3