summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-04-12 17:30:01 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-04-12 17:35:53 -0700
commit09caaed60efbf525d7eadb73887b50843bd2d9bd (patch)
tree5df3a24e1acc900d20d24a73321441c429e3c0dd
parent4abb99c545c3d4af91f98715708fc58310f70f03 (diff)
downloadfatcat-09caaed60efbf525d7eadb73887b50843bd2d9bd.tar.gz
fatcat-09caaed60efbf525d7eadb73887b50843bd2d9bd.zip
prefer contrib.creator.display_name over contrib.raw_name
These will be getting updates from ORCID and are usually more complete and more correct for display, attribution, and search purposes. Might need to tweak fuzzycat code to handle multiple names at the verification stage.
-rw-r--r--python/fatcat_tools/transforms/csl.py6
-rw-r--r--python/fatcat_tools/transforms/elasticsearch.py5
-rw-r--r--python/fatcat_web/templates/entity_base.html4
-rw-r--r--python/fatcat_web/templates/release_view_contribs.html11
4 files changed, 17 insertions, 9 deletions
diff --git a/python/fatcat_tools/transforms/csl.py b/python/fatcat_tools/transforms/csl.py
index ba199efb..15bb369f 100644
--- a/python/fatcat_tools/transforms/csl.py
+++ b/python/fatcat_tools/transforms/csl.py
@@ -33,19 +33,19 @@ def release_to_csl(entity):
if contrib.creator:
# Default to "local" (publication-specific) metadata; fall back to
# creator-level
- family = contrib.surname or contrib.creator.surname or (contrib.raw_name and contrib.raw_name.split()[-1])
+ family = contrib.creator.surname or contrib.surname or (contrib.raw_name and contrib.raw_name.split()[-1])
if not family:
# CSL requires some surname (family name)
continue
c = dict(
family=family,
- given=contrib.given_name or contrib.creator.given_name,
+ given=contrib.creator.given_name or contrib.given_name,
#dropping-particle
#non-dropping-particle
#suffix
#comma-suffix
#static-ordering
- literal=contrib.raw_name or contrib.creator.display_name,
+ literal=contrib.creator.display_name or contrib.raw_name,
#parse-names,
# role must be defined; default to author
role=contrib.role or 'author',
diff --git a/python/fatcat_tools/transforms/elasticsearch.py b/python/fatcat_tools/transforms/elasticsearch.py
index 4bf9091a..331ca4e7 100644
--- a/python/fatcat_tools/transforms/elasticsearch.py
+++ b/python/fatcat_tools/transforms/elasticsearch.py
@@ -113,10 +113,13 @@ def release_to_elasticsearch(entity: ReleaseEntity, force_bool: bool = True) ->
contrib_affiliations = []
creator_ids = []
for c in (release.contribs or []):
- if c.raw_name:
+ if c.creator and c.creator.display_ame:
+ contrib_names.append(c.creator.display_ame)
+ elif c.raw_name:
contrib_names.append(c.raw_name)
elif c.surname:
contrib_names.append(c.surname)
+
if c.creator_id:
creator_ids.append(c.creator_id)
if c.raw_affiliation:
diff --git a/python/fatcat_web/templates/entity_base.html b/python/fatcat_web/templates/entity_base.html
index f30df0da..36280f5d 100644
--- a/python/fatcat_web/templates/entity_base.html
+++ b/python/fatcat_web/templates/entity_base.html
@@ -65,8 +65,8 @@
<p style="font-size: larger;">
{% if entity._authors and entity._authors != [] %} by
{% for contrib in entity._authors[:12] %}
- {% if contrib.creator_id %}
- <b><a href="/creator/{{contrib.creator_id}}">{{ contrib.raw_name }}</a></b>{% if not loop.last %}, {% endif %}
+ {% if contrib.creator_id and contrib.creator and contrib.creator.display_name %}
+ <b><a href="/creator/{{contrib.creator_id}}">{{ contrib.creator.display_name }}</a></b>{% if not loop.last %}, {% endif %}
{% else %}
{% if contrib.raw_name != None %}{{ contrib.raw_name }}{% else %}<i>Unknown</i>{% endif %}{% if not loop.last %}, {% endif %}
{% endif %}
diff --git a/python/fatcat_web/templates/release_view_contribs.html b/python/fatcat_web/templates/release_view_contribs.html
index 55cdf133..f4969e32 100644
--- a/python/fatcat_web/templates/release_view_contribs.html
+++ b/python/fatcat_web/templates/release_view_contribs.html
@@ -12,12 +12,17 @@
{% for contrib in release.contribs %}
<tr><td class="collapsing">{% if contrib.index or contrib.index == 0 %} {{ contrib.index + 1 }}{% endif %}
<td><span itemprop="author">
- {% if contrib.creator_id %}
- <a href="/creator/{{contrib.creator_id}}">{{ contrib.raw_name or 'unknown' }}</a>
+ {% if contrib.creator_id and contrib.creator and contrib.creator.display_name %}
+ <a href="/creator/{{contrib.creator_id}}">{{ contrib.creator.display_name }}</a>
{% else %}
{{ contrib.raw_name or '' }}
{% endif %}
- {% if contrib.surname %}
+
+ {% if contrib.creator and contrib.creator.surname %}
+ <code>&nbsp;
+ ({{ contrib.creator.surname }}{% if contrib.creator.given_name %}, {{ contrib.creator.given_name }}{% endif %})
+ </code>
+ {% elif contrib.surname %}
<code>&nbsp;
({{ contrib.surname }}{% if contrib.given_name %}, {{ contrib.given_name }}{% endif %})
</code>