summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-12-23 18:55:35 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-12-23 18:56:53 -0800
commit19bbc2f1959f19b8ec8e7f0609442d67509e49a8 (patch)
tree7fb161badc310faffe432681ef083a9727aff90c
parentdcb43953784db9a8068e5c51d4499592a49f2ea8 (diff)
downloadfatcat-19bbc2f1959f19b8ec8e7f0609442d67509e49a8.tar.gz
fatcat-19bbc2f1959f19b8ec8e7f0609442d67509e49a8.zip
pubmed: if doing update, also do subtitle schema update
-rw-r--r--python/fatcat_tools/importers/pubmed.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/python/fatcat_tools/importers/pubmed.py b/python/fatcat_tools/importers/pubmed.py
index 8019e36a..3611a299 100644
--- a/python/fatcat_tools/importers/pubmed.py
+++ b/python/fatcat_tools/importers/pubmed.py
@@ -647,7 +647,6 @@ class PubmedImporter(EntityImporter):
# extra:
# translation_of
- # subtitle
# aliases
# container_name
# group-title
@@ -728,6 +727,15 @@ class PubmedImporter(EntityImporter):
existing.ext_ids.pmcid = existing.ext_ids.pmcid or re.ext_ids.pmcid
existing.refs = existing.refs or re.refs
existing.extra['pubmed'] = re.extra['pubmed']
+ # update subtitle in-place first
+ if not existing.subtitle and existing.extra.get('subtitle'):
+ subtitle = existing.extra.pop('subtitle')
+ if type(subtitle) == list:
+ subtitle = subtitle[0]
+ if subtitle:
+ existing.subtitle = subtitle
+ if not existing.subtitle:
+ existing.subtitle = re.subtitle
try:
self.api.update_release(self.get_editgroup_id(), existing.ident, existing)
self.counts['update'] += 1