Skip to content

Commit

Permalink
use preferredName if available
Browse files Browse the repository at this point in the history
  • Loading branch information
Ammarpad committed Jun 21, 2021
1 parent 272b199 commit f0eea0c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion extra/update_gnd_id_qualifiers.py
Expand Up @@ -83,13 +83,18 @@ def getTargetVal(id):
if result.status_code == 200:
res = result.json()
if res['@type'] == 'person':
preferredName = res.get('preferredName', None)

if preferredName:
return preferredName

pref = res.get('prefix', '')
sname = res.get('surname', '')
fname = res.get('forename', '')
if not fname or (fname and sname == ''):
return fname if fname else None

val = '%s, %s' %(sname, fname)
val = '%s %s' %(sname, fname)
val = ('%s %s' %(val, pref)) if pref else val

return val
Expand Down

0 comments on commit f0eea0c

Please sign in to comment.