Skip to content

Commit

Permalink
trying to sort metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
spoonerf committed Jul 25, 2023
1 parent bc164c6 commit 8e23521
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 64 deletions.
1 change: 1 addition & 0 deletions dag/health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ steps:
- data://meadow/ihme_gbd/2020-12-19/child_mortality
data://grapher/ihme_gbd/2020-12-19/child_mortality:
- data://garden/ihme_gbd/2020-12-19/child_mortality

# IHME Global Burden of Disease - Deaths and DALYs
data://meadow/ihme_gbd/2019/gbd_cause:
- walden://ihme_gbd/2019/gbd_cause
Expand Down
45 changes: 0 additions & 45 deletions etl/steps/data/garden/ihme_gbd/2019/gbd_cause.meta.yml

This file was deleted.

38 changes: 37 additions & 1 deletion etl/steps/data/garden/ihme_gbd/2019/gbd_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,47 @@ def create_variable_metadata(variable: Variable, cause: str, age: str, sex: str)
"unit": "DALYs",
"short_unit": "",
},
"Incidence - Number": {
"title": f"Number of new cases of {cause.lower()}, in {sex.lower()} aged {age.lower()}",
"description": "",
"unit": "cases",
"short_unit": "",
},
"Prevalence - Number": {
"title": f"Current number of cases of {cause.lower()}, in {sex.lower()} aged {age.lower()}",
"description": "",
"unit": "cases",
"short_unit": "",
},
"Incidence - Rate": {
"title": f"Number of new cases of {cause.lower()} per 100,000 people, in {sex.lower()} aged {age.lower()}",
"description": "",
"unit": "cases",
"short_unit": "",
},
"Prevalence - Rate": {
"title": f"Current number of cases of {cause.lower()} per 100,000 people, in {sex.lower()} aged {age.lower()}",
"description": "",
"unit": "cases",
"short_unit": "",
},
"Incidence - Share of the population": {
"title": f"Number of new cases of {cause.lower()} per 100 people, in {sex.lower()} aged {age.lower()}",
"description": "",
"unit": "%",
"short_unit": "%",
},
"Prevalence - Share of the population": {
"title": f"Current number of cases of {cause.lower()} per 100 people, in {sex.lower()} aged {age.lower()}",
"description": "",
"unit": "%",
"short_unit": "%",
},
}
new_variable = variable.copy()
new_variable.name = underscore(var_name_dict[variable.name]["title"])
new_variable.metadata.title = var_name_dict[variable.name]["title"]
new_variable.metadata.display["name"] = var_name_dict[variable.name]["title"]
new_variable.metadata.description = var_name_dict[variable.name]["description"]
new_variable.metadata.unit = var_name_dict[variable.name]["unit"]
new_variable.metadata.short_unit = var_name_dict[variable.name]["short_unit"]
Expand Down Expand Up @@ -236,7 +273,6 @@ def add_metadata_and_save(dest_dir: str, ds_meadow: Dataset, df: pd.DataFrame, d
cleaned_variable = create_variable_metadata(variable=tb_group[variable_name], cause=cause, sex=sex, age=age)
tb_group[cleaned_variable.name] = cleaned_variable
tb_group = tb_group.drop(columns=variable_name)
# tb_group = underscore_table(tb_group)
tb_group = tb_group.set_index(["country", "year"] + dims, verify_integrity=True)
ds_garden.add(tb_group)
ds_garden.save()
Expand Down
1 change: 0 additions & 1 deletion etl/steps/data/grapher/ihme_gbd/2019/gbd_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ def run_wrapper(garden_dataset: Dataset, dataset: Dataset, dims: List[str]) -> D
tables = garden_dataset.table_names
for table in tables:
tab = garden_dataset[table]

dataset.add(tab)
return dataset
17 changes: 1 addition & 16 deletions etl/steps/data/meadow/ihme_gbd/2019/gbd_cause.meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,4 @@ dataset:
sources:
-
name: IHME, Global Burden of Disease Study (2019)
published_by: Institute of Health Metrics and Evaluation

tables:
gbd_cause:
variables:
measure:
title: Measure name
description: Deaths or DALYs - ways of measuring the impact of causes of death.
cause:
title: Causes of death
description: Disease or injuries that result in or contribute to an individuals death.
value:
title: Deaths or DALYs
description: The number of deaths or disability adjusted life years (DALYs) caused by a given disease or injury.


published_by: Institute of Health Metrics and Evaluation
2 changes: 1 addition & 1 deletion etl/steps/data/meadow/ihme_gbd/2019/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def run_wrapper(dataset: str, metadata_path: str, namespace: str, version: str,
tb = underscore_table(tb)

ds.metadata.update_from_yaml(metadata_path, if_source_exists="replace")
tb.update_metadata_from_yaml(metadata_path, f"{dataset}")
# tb.update_metadata_from_yaml(metadata_path, f"{dataset}")
tb.reset_index(drop=True, inplace=True)
# add table to a dataset
ds.add(tb)
Expand Down

0 comments on commit 8e23521

Please sign in to comment.