Skip to content

Commit

Permalink
SSR ETL: Replace <5 values by null (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulineribeyre authored Nov 11, 2020
1 parent 42b2ab5 commit 52a87b5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions covid19-etl/etl/ssr.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ def format_value(key, value, _type, date_mode=None):
value = value.split(" ")[0]

if _type == int and int(value) < MINIMUM_COUNT:
raise Exception(
f"Found value < {MINIMUM_COUNT} ({key}: {value}). This value cannot be submitted."
print(
f" Warning: Found value < {MINIMUM_COUNT} ({key}: {value}). This value cannot be submitted, replacing it with null."
)
return None

return value
return _type(value)


class SSR(base.BaseETL):
Expand Down Expand Up @@ -129,8 +130,8 @@ def parse_input(self, row_data, date_mode=None):

for orig_prop_name, (node_type, prop_name, _type) in mapping:
if row_data[orig_prop_name]:
row_records[node_type][prop_name] = _type(
format_value(prop_name, row_data[orig_prop_name], _type, date_mode)
row_records[node_type][prop_name] = format_value(
prop_name, row_data[orig_prop_name], _type, date_mode
)

# add missing summary_location props
Expand Down

0 comments on commit 52a87b5

Please sign in to comment.