diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-05-21 17:20:17 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-05-21 17:20:17 -0700 |
commit | 818a891a5e306e84e8165dec28cc4a5961180e8c (patch) | |
tree | be119d5f35f9f3281de22138e6a69d0d1fac1646 /python/fatcat_tools | |
parent | 90560ba18ac042a23db6995cc07a5cef024bc179 (diff) | |
download | fatcat-818a891a5e306e84e8165dec28cc4a5961180e8c.tar.gz fatcat-818a891a5e306e84e8165dec28cc4a5961180e8c.zip |
more JALC importer polish
Diffstat (limited to 'python/fatcat_tools')
-rw-r--r-- | python/fatcat_tools/importers/jalc.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/python/fatcat_tools/importers/jalc.py b/python/fatcat_tools/importers/jalc.py index 09b8bd76..e2ccb230 100644 --- a/python/fatcat_tools/importers/jalc.py +++ b/python/fatcat_tools/importers/jalc.py @@ -101,28 +101,37 @@ class JalcImporter(EntityImporter): name = eng if not name.find('name'): name = jpn + surname = name.find('familyName') + if surname: + surname = surname.string contrib = fatcat_client.ReleaseContrib( raw_name=clean(name.find('name').string), given_name=clean(name.find('givenName').string), - surname=clean(name.find('familyName').string), + surname=clean(surname), role='author', ) if eng.find('name') and jpn.find('name'): + jpn_surname = jpn.find('familyName') + if jpn_surname: + jpn_surname = jpn_surname.string contrib.extra = { 'original_name': { 'lang': 'ja', 'raw_name': clean(jpn.find('name').string), 'given_name': clean(jpn.find('givenName').string), - 'surname': clean(jpn.find('familyName').string), + 'surname': clean(jpn_surname), }} contribs.append(contrib) elif people: # TODO: test for this codepath? for eng in people: + surname = eng.find('familyName') + if surname: + surname = surname.string contrib = dict( raw_name=clean(eng.find('name').string), given_name=clean(eng.find('givenName').string), - surname=clean(eng.find('familyName').string), + surname=clean(surname), role='author', ) contribs.append(contrib) @@ -228,10 +237,14 @@ class JalcImporter(EntityImporter): # (informally) extra['jalc'] = extra_jalc + title = clean(title) + if not title: + return None + re = fatcat_client.ReleaseEntity( work_id=None, title=title, - original_title=original_title, + original_title=clean(original_title), release_type="article-journal", release_stage='published', release_date=release_date, |