Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for cases where there are no extra dims in config #15

Merged
merged 1 commit into from
Nov 18, 2024
Merged
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
2 changes: 1 addition & 1 deletion src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def parse_pipeline_config(dataset, test, update, mode):
end_date = config["end_date"]
sel_iso3s = None
forecast = config["forecast"]
extra_dims = parse_extra_dims(config.get("extra_dims"))
extra_dims = parse_extra_dims(config)
if not end_date:
end_date = date.today() - timedelta(days=1)
if update:
Expand Down
17 changes: 10 additions & 7 deletions src/utils/general_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,16 @@ def parse_date(filename):
return pd.to_datetime(res[0])


def parse_extra_dims(extra_dims):
def parse_extra_dims(config):
parsed_extra_dims = {}
for extra_dim in extra_dims:
dim = next(iter(extra_dim))
if extra_dim[dim] == "str":
parsed_extra_dims[dim] = VARCHAR
else:
parsed_extra_dims[dim] = Integer

if "extra_dims" in config.keys():
extra_dims = config.get("extra_dims")
for extra_dim in extra_dims:
dim = next(iter(extra_dim))
if extra_dim[dim] == "str":
parsed_extra_dims[dim] = VARCHAR
else:
parsed_extra_dims[dim] = Integer

return parsed_extra_dims
Loading