Skip to content

Commit

Permalink
names: improve affiliations deduplication
Browse files Browse the repository at this point in the history
  • Loading branch information
jrcastro2 committed Dec 5, 2024
1 parent a8fedd0 commit 2b7156f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions invenio_vocabularies/contrib/names/datastreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,17 @@ def _extract_affiliations(self, record):
continue

org = employment["organization"]
aff = {"name": org["name"]}

# Extract the org ID, to link to the affiliation vocabulary
aff_id = self._extract_affiliation_id(org)

# Skip adding if the id is already in result
if aff_id and any(aff.get("id") == aff_id for aff in result):
continue

aff = {"name": org["name"]}
if aff_id:
aff["id"] = aff_id

if aff not in result:
result.append(aff)
result.append(aff)
except Exception:
pass
return result
Expand Down

0 comments on commit 2b7156f

Please sign in to comment.