Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cds_migrator_kit/rdm/records/transform/mappers/custom_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,26 @@ def apply(self, ctx):
"cern:departments", []
)
for department in departments:
if department.lower() == "xx":
continue
if "-" in department:
dep = department.split("-")[0]
if not ctx.custom_fields.get("cern:administrative_unit"):
ctx.custom_fields["cern:administrative_unit"] = department
elif (
ctx.custom_fields.get("cern:administrative_unit").lower()
== department.lower()
):
continue
else:
Comment thread
kpsherva marked this conversation as resolved.
raise UnexpectedValue(
subfield="5",
value=department,
field="710",
message=f"conflict on administrative unit "
f"{ctx.custom_fields['cern:administrative_unit']} VS {department}",
stage="vocabulary match",
)
else:
dep = department
result = search_vocabulary(dep, "departments")
Expand Down
Loading
Loading