File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 3
3
import requests
4
4
from flask import g
5
5
6
+ from openatlas .display .util import link
7
+
8
+
9
+ def print_values (values : dict [str : str ]) -> str :
10
+ items = []
11
+ for item in values :
12
+ items .append (link (item ["label" ], item ["id" ], external = True ))
13
+ return '<br>' .join (items )
14
+
6
15
7
16
def fetch_gnd (id_ : str ) -> dict [str , Any ]:
8
17
url = f'{ g .gnd .resolver_url } { id_ } .json'
@@ -13,4 +22,17 @@ def fetch_gnd(id_: str) -> dict[str, Any]:
13
22
return {}
14
23
if 'preferredName' in data :
15
24
info ['preferred name' ] = data ['preferredName' ]
25
+ if 'gender' in data :
26
+ info ['gender' ] = print_values (data ['gender' ])
27
+ if 'dateOfBirth' in data :
28
+ info ['date of birth' ] = data ['dateOfBirth' ]
29
+ if 'placeOfBirth' in data :
30
+ info ['place of birth' ] = print_values (data ['placeOfBirth' ])
31
+ if 'dateOfDeath' in data :
32
+ info ['date of death' ] = data ['dateOfDeath' ]
33
+ if 'placeOfDeath' in data :
34
+ info ['place of death' ] = print_values (data ['placeOfDeath' ])
35
+ if 'type' in data :
36
+ info ['type' ] = '<br>' .join (data ['type' ])
37
+
16
38
return info
You can’t perform that action at this time.
0 commit comments