diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/fatcat/crossref_importer.py | 16 | ||||
-rw-r--r-- | python/fatcat/routes.py | 3 | ||||
-rw-r--r-- | python/fatcat/templates/release_view.html | 2 |
3 files changed, 16 insertions, 5 deletions
diff --git a/python/fatcat/crossref_importer.py b/python/fatcat/crossref_importer.py index ca31d241..d3e525a4 100644 --- a/python/fatcat/crossref_importer.py +++ b/python/fatcat/crossref_importer.py @@ -73,16 +73,27 @@ class FatcatCrossrefImporter(FatcatImporter): return None except: year = None + extra = dict(crossref=rm) + if rm.get('DOI') != None: + extra['doi'] = rm.get('DOI').lower() refs.append(fatcat_client.ReleaseRef( index=i+1, - target_release_id=None, # TODO: DOI lookup: rm.get("DOI", None), + # doing lookups would be a second import pass + target_release_id=None, # unreliable for crossref: key=rm['key'].split('|')[-1], year=year, container_title=rm.get('volume-title'), title=rm.get('title'), locator=rm.get('first-page'), # TODO: just dump JSON somewhere here? - extra=rm.get('unstructured'))) + extra=dict(crossref=rm))) + + # abstracts + abstracts = [] + if obj.get('abstract') != None: + abstracts.append(fatcat_client.ReleaseEntityAbstracts( + mimetype="application/xml+jats", + content=obj.get('abstract'))) # release extra = dict(crossref={ @@ -104,6 +115,7 @@ class FatcatCrossrefImporter(FatcatImporter): issue=obj.get('issue'), volume=obj.get('volume'), pages=obj.get('page'), + abstracts=abstracts, extra=extra) return (re, ce) diff --git a/python/fatcat/routes.py b/python/fatcat/routes.py index 209a7676..965040f5 100644 --- a/python/fatcat/routes.py +++ b/python/fatcat/routes.py @@ -17,7 +17,7 @@ def container_history(ident): history = api.get_container_history(ident) except ApiException as ae: abort(ae.status) - print(history) + #print(history) return render_template('entity_history.html', page_title=entity.name, entity_type="container", @@ -262,7 +262,6 @@ def editgroup_view(ident): try: entity = api.get_editgroup(str(ident)) except ApiException as ae: - print(ae.body) abort(ae.status) return render_template('editgroup_view.html', editgroup=entity) diff --git a/python/fatcat/templates/release_view.html b/python/fatcat/templates/release_view.html index d7da7080..dd92f611 100644 --- a/python/fatcat/templates/release_view.html +++ b/python/fatcat/templates/release_view.html @@ -150,7 +150,7 @@ This release citing other releases. <li>{% if ref.extra != None %}{{ ref.extra }}{% else %}<i>unknown</i>{% endif %} {% if ref.target_release_id != None %} (<a href="/release/{{ ref.target_release_id }}">fatcat release</a>) - {% else if ref.extra.doi != None %} + {% elif ref.extra != None and ref.extra.doi != None %} (DOI: <a href="/release/lookup?doi={{ ref.exta.doi }}">{{ ref.extra.doi }}</a>) {% endif %} {% endfor %} |