From 3f67d29266913fd6aba9996351594601e844b0bf Mon Sep 17 00:00:00 2001 From: Marianne Date: Thu, 24 Feb 2022 13:52:26 +0100 Subject: [PATCH] check if value is in controlled vocabulary for newtiers --- ChildProject/converters.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ChildProject/converters.py b/ChildProject/converters.py index e53fb8f7d..9d39ceaab 100644 --- a/ChildProject/converters.py +++ b/ChildProject/converters.py @@ -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())