Skip to content

Commit

Permalink
check if value is in controlled vocabulary for newtiers
Browse files Browse the repository at this point in the history
  • Loading branch information
Marianne committed Feb 24, 2022
1 parent 1475102 commit 3f67d29
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ChildProject/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,15 @@ def convert(filename: str, filter=None, **kwargs) -> pd.DataFrame:
elif label == "msc":
segment["msc_type"] = value
elif label in kwargs["new_tiers"]:
segment[label] = value
controlled_values = \
[value[0][0][0] for value in eaf.controlled_vocabularies[label][1].values()]
if value not in controlled_values:
print(
f'warning: {value} is not in the controlled'
f'vocabulary {controlled_values} for {label}'
)
else:
segment[label] = value

return pd.DataFrame(segments.values())

Expand Down

0 comments on commit 3f67d29

Please sign in to comment.