Skip to content

Commit eaa1002

Browse files
committed
Add a wealth_group_category missing error report
1 parent 86d11ce commit eaa1002

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pipelines/assets/baseline.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ def get_wealth_group_dataframe(
8888
wealth_group_df = wealth_group_df.loc[:, ~wealth_group_df.columns.duplicated()]
8989
except ValueError:
9090
pass
91+
# Check if there are unrecognized wealth group category at this point and report
92+
wealth_group_missing_category_df = wealth_group_df[
93+
wealth_group_df["wealth_group_category"].isnull() & df["wealth_group_category_original"].notnull()
94+
]
95+
if not wealth_group_missing_category_df.empty:
96+
unique_values = set(wealth_group_missing_category_df["wealth_group_category_original"].unique())
97+
raise ValueError(
98+
"%s has unrecognized wealth group category in %s:\n%s"
99+
% (partition_key, worksheet_name, "\n ".join(unique_values)),
100+
)
91101

92102
# Lookup the Community instances
93103
community_lookup = CommunityLookup()

0 commit comments

Comments
 (0)