Skip to content
Open
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
3 changes: 2 additions & 1 deletion tools/import_validation/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ def _load_differ_df_from_mcf(self, input_dir: str) -> pd.DataFrame:
stats[current_var][diff_type] += 1

if not stats:
return pd.DataFrame()
return pd.DataFrame(
columns=['StatVar', 'ADDED', 'DELETED', 'MODIFIED'])

rows = []
for var, counts in stats.items():
Expand Down
6 changes: 5 additions & 1 deletion tools/statvar_importer/mcf_file_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ def normalize_list(value: str, sort: bool = True) -> str:
value_list = get_value_list(value)
has_quotes = True
else:
value_list = value.split(',')
value_list = [v.strip() for v in value.split(',')]
values = []
if sort:
value_list = sorted(value_list)
Expand Down Expand Up @@ -931,6 +931,10 @@ def normalize_value(
if value[0] == '"' and value[-1] == '"' and len(value) > 100:
# Retain very long strings, such as geoJsonCoordinates, as is.
return value
if value.startswith('[') and value.endswith(']') and ',' in value:
inner_list = value[1:-1].strip()
normalized_list = normalize_list(inner_list)
return f'[{normalized_list}]'
if ',' in value and maybe_list:
return normalize_list(value)
if value[0] == '[':
Expand Down
Loading