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

🐛 gbd-risk: Add missing percentages #3262

Merged
merged 4 commits into from
Sep 10, 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
18 changes: 11 additions & 7 deletions etl/grapher_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,17 @@ def cleanup_ghost_variables(engine: Engine, dataset_id: int, upserted_variable_i
if rows:
rows = pd.DataFrame(rows, columns=["chartId", "variableId"])

# show a warning
log.warning(
"Variables used in charts will not be deleted automatically",
rows=rows,
variables=variable_ids_to_delete,
)
return False
# raise an error if on staging server
if config.ENV == "staging":
raise ValueError(f"Variables used in charts will not be deleted automatically:\n{rows}")
else:
# otherwise show a warning
log.warning(
"Variables used in charts will not be deleted automatically",
rows=rows,
variables=variable_ids_to_delete,
)
return False

# then variables themselves with related data in other tables
con.execute(
Expand Down
3 changes: 2 additions & 1 deletion etl/steps/data/garden/ihme_gbd/2024-05-20/gbd_risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def run(dest_dir: str) -> None:
ds_meadow = paths.load_dataset("gbd_risk")

# Read table from meadow dataset.
tb = ds_meadow["gbd_risk"].reset_index()
tb = ds_meadow.read_table("gbd_risk", reset_index=True)
ds_regions = paths.load_dataset("regions")
#
# Process data.
Expand All @@ -39,6 +39,7 @@ def run(dest_dir: str) -> None:
index_cols=["country", "year", "metric", "measure", "rei", "cause", "age"],
regions=REGIONS,
age_group_mapping=AGE_GROUPS_RANGES,
run_percent=False,
)

# Format the tables
Expand Down
2 changes: 1 addition & 1 deletion etl/steps/data/garden/ihme_gbd/2024-05-20/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def add_regional_aggregates(
assert tb_percent["value"].max() <= 100 or tb_percent.shape[0] == 0
assert tb_percent["value"].min() >= 0 or tb_percent.shape[0] == 0
# Combine all the metrics back together
tb_out = pr.concat([tb_out, tb_percent], ignore_index=True)
tb_out = pr.concat([tb_out, tb_percent], ignore_index=True)
assert tb_out.age.m.origins
tb_out = tb_out.drop(columns="population")
return tb_out
Expand Down
Loading