WIP: resolve attributed_to for KISTE usecase #2
1 changed files with 18 additions and 0 deletions
|
|
@ -25,8 +25,26 @@ def _resolve_record(
|
|||
if resolved is not None:
|
||||
break
|
||||
rules.append(resolved if resolved is not None else r)
|
||||
attributed_to = []
|
||||
attrs = rec.get('attributed_to', [])
|
||||
for i in range(len(attrs)):
|
||||
a = attrs[i].get('object', [])
|
||||
resolved = None
|
||||
for col in collection:
|
||||
resolved = collection_read_record_with_pid(
|
||||
api_url,
|
||||
col,
|
||||
a,
|
||||
token=token,
|
||||
)
|
||||
if resolved is not None:
|
||||
break
|
||||
if resolved is not None:
|
||||
attrs[i]['object'] = resolved
|
||||
attributed_to.append(attrs[i])
|
||||
out = deepcopy(rec)
|
||||
out['rules'] = rules
|
||||
out['attributed_to'] = attributed_to
|
||||
return out
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue