-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into data-mean-paternal-age
- Loading branch information
Showing
40 changed files
with
1,131 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
etl/steps/data/garden/antibiotics/2024-12-05/microbe_neonatal_total_amr.countries.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"Global": "World" | ||
} |
42 changes: 42 additions & 0 deletions
42
etl/steps/data/garden/antibiotics/2024-12-05/microbe_neonatal_total_amr.meta.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# NOTE: To learn more about the fields, hover over their names. | ||
definitions: | ||
common: | ||
presentation: | ||
topic_tags: | ||
- Antibiotics | ||
|
||
# Learn more about the available fields: | ||
# http://docs.owid.io/projects/etl/architecture/metadata/reference/ | ||
dataset: | ||
update_period_days: 365 | ||
|
||
tables: | ||
microbe_neonatal_total_amr: | ||
variables: | ||
amr_attributable_deaths: | ||
title: Neonatal deaths from infections attributed to AMR, by pathogen | ||
unit: deaths | ||
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age – who die each year from infections that are attributed to antimicrobial resistance. | ||
presentation: | ||
title_public: Neonatal deaths from infections attributed to AMR, by pathogen | ||
display: | ||
roundingMode: significantFigures | ||
numSignificantFigures: 3 | ||
non_amr_attributable_deaths: | ||
title: Neonatal global deaths from infections not attributed to AMR, by pathogen | ||
unit: deaths | ||
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age – who die each year from infections that are not attributed to antimicrobial resistance. | ||
presentation: | ||
title_public: Neonatal global deaths from infections not attributed to AMR, by pathogen | ||
display: | ||
roundingMode: significantFigures | ||
numSignificantFigures: 3 | ||
total_deaths: | ||
title: Neonatal global deaths from infections | ||
unit: deaths | ||
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age – who die each year from infections. | ||
presentation: | ||
title_public: Neonatal global deaths from infections | ||
display: | ||
roundingMode: significantFigures | ||
numSignificantFigures: 3 |
45 changes: 45 additions & 0 deletions
45
etl/steps/data/garden/antibiotics/2024-12-05/microbe_neonatal_total_amr.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""Load a meadow dataset and create a garden dataset.""" | ||
|
||
from etl.data_helpers import geo | ||
from etl.helpers import PathFinder, create_dataset | ||
|
||
# Get paths and naming conventions for current step. | ||
paths = PathFinder(__file__) | ||
|
||
|
||
def run(dest_dir: str) -> None: | ||
# | ||
# Load inputs. | ||
# | ||
# Load meadow dataset. | ||
ds_meadow = paths.load_dataset("microbe_neonatal_total_amr") | ||
ds_total = paths.load_dataset("microbe") | ||
|
||
# Read table from meadow dataset. | ||
tb = ( | ||
ds_meadow.read("microbe_neonatal_total_amr") | ||
.drop(columns=["upper", "lower"]) | ||
.rename(columns={"value": "amr_attributable_deaths"}) | ||
) | ||
tb_total = ds_total.read("microbe").drop(columns=["upper", "lower"]).rename(columns={"value": "total_deaths"}) | ||
|
||
# | ||
# Process data. | ||
# | ||
tb = geo.harmonize_countries(df=tb, countries_file=paths.country_mapping_path) | ||
|
||
tb = tb.merge(tb_total, on=["country", "year", "pathogen", "pathogen_type"], how="inner") | ||
tb["non_amr_attributable_deaths"] = tb["total_deaths"] - tb["amr_attributable_deaths"] | ||
tb = tb.drop(columns=["country", "pathogen_type"]).rename(columns={"pathogen": "country"}) | ||
tb = tb.format(["country", "year"]) | ||
|
||
# | ||
# Save outputs. | ||
# | ||
# Create a new garden dataset with the same metadata as the meadow dataset. | ||
ds_garden = create_dataset( | ||
dest_dir, tables=[tb], check_variables_metadata=True, default_metadata=ds_meadow.metadata | ||
) | ||
|
||
# Save changes in the new garden dataset. | ||
ds_garden.save() |
3 changes: 3 additions & 0 deletions
3
etl/steps/data/garden/antibiotics/2024-12-05/microbe_total_deaths_by_syndrome.countries.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"Global": "World" | ||
} |
45 changes: 45 additions & 0 deletions
45
etl/steps/data/garden/antibiotics/2024-12-05/microbe_total_deaths_by_syndrome.meta.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# NOTE: To learn more about the fields, hover over their names. | ||
definitions: | ||
common: | ||
presentation: | ||
topic_tags: | ||
- Antibiotics | ||
|
||
# Learn more about the available fields: | ||
# http://docs.owid.io/projects/etl/architecture/metadata/reference/ | ||
dataset: | ||
update_period_days: 365 | ||
|
||
tables: | ||
microbe_total_deaths_by_syndrome: | ||
variables: | ||
value: | ||
title: Total deaths from << infectious_syndrome.lower() >> | ||
unit: deaths | ||
description_short: Estimated number of deaths from << infectious_syndrome.lower() >>. | ||
presentation: | ||
title_public: Total deaths from << infectious_syndrome.lower() >> | ||
display: | ||
roundingMode: significantFigures | ||
numSignificantFigures: 3 | ||
name: << pathogen >> | ||
lower: | ||
title: Lower bound of deaths from << infectious_syndrome.lower() >> | ||
unit: deaths | ||
description_short: Estimated number of deaths from << infectious_syndrome.lower() >>. | ||
presentation: | ||
title_public: Lower bound of deaths from << infectious_syndrome.lower() >> | ||
display: | ||
roundingMode: significantFigures | ||
numSignificantFigures: 3 | ||
name: << pathogen >> | ||
upper: | ||
title: Upper bound of deaths from << infectious_syndrome.lower() >> | ||
unit: deaths | ||
description_short: Estimated number of deaths from << infectious_syndrome.lower() >>. | ||
presentation: | ||
title_public: Upper bound of deaths from << infectious_syndrome.lower() >> | ||
display: | ||
roundingMode: significantFigures | ||
numSignificantFigures: 3 | ||
name: << pathogen >> |
35 changes: 35 additions & 0 deletions
35
etl/steps/data/garden/antibiotics/2024-12-05/microbe_total_deaths_by_syndrome.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""Load a meadow dataset and create a garden dataset.""" | ||
|
||
from etl.data_helpers import geo | ||
from etl.helpers import PathFinder, create_dataset | ||
|
||
# Get paths and naming conventions for current step. | ||
paths = PathFinder(__file__) | ||
|
||
|
||
def run(dest_dir: str) -> None: | ||
# | ||
# Load inputs. | ||
# | ||
# Load meadow dataset. | ||
ds_meadow = paths.load_dataset("microbe_total_deaths_by_syndrome") | ||
|
||
# Read table from meadow dataset. | ||
tb = ds_meadow.read("microbe_total_deaths_by_syndrome") | ||
|
||
# | ||
# Process data. | ||
# | ||
tb = geo.harmonize_countries(df=tb, countries_file=paths.country_mapping_path) | ||
tb = tb.format(["country", "year", "infectious_syndrome"]) | ||
|
||
# | ||
# Save outputs. | ||
# | ||
# Create a new garden dataset with the same metadata as the meadow dataset. | ||
ds_garden = create_dataset( | ||
dest_dir, tables=[tb], check_variables_metadata=True, default_metadata=ds_meadow.metadata | ||
) | ||
|
||
# Save changes in the new garden dataset. | ||
ds_garden.save() |
3 changes: 3 additions & 0 deletions
3
...ps/data/garden/antibiotics/2024-12-05/microbe_total_deaths_by_syndrome_amr.countries.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"Global": "World" | ||
} |
42 changes: 42 additions & 0 deletions
42
etl/steps/data/garden/antibiotics/2024-12-05/microbe_total_deaths_by_syndrome_amr.meta.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# NOTE: To learn more about the fields, hover over their names. | ||
definitions: | ||
common: | ||
presentation: | ||
topic_tags: | ||
- Antibiotics | ||
|
||
# Learn more about the available fields: | ||
# http://docs.owid.io/projects/etl/architecture/metadata/reference/ | ||
dataset: | ||
update_period_days: 365 | ||
|
||
tables: | ||
microbe_total_deaths_by_syndrome_amr: | ||
variables: | ||
amr_attributable_deaths: | ||
title: Total deaths from infections attributed to AMR, by syndrome | ||
unit: deaths | ||
description_short: Estimated number of deaths each year from infections that are attributed to antimicrobial resistance. | ||
presentation: | ||
title_public: Total deaths from infections attributed to AMR, by syndrome | ||
display: | ||
roundingMode: significantFigures | ||
numSignificantFigures: 3 | ||
non_amr_attributable_deaths: | ||
title: Total deaths from infections not attributed to AMR, by syndrome | ||
unit: deaths | ||
description_short: Estimated number of deaths each year from infections that are not attributed to antimicrobial resistance. | ||
presentation: | ||
title_public: Total deaths from infections not attributed to AMR, by syndrome | ||
display: | ||
roundingMode: significantFigures | ||
numSignificantFigures: 3 | ||
total_deaths: | ||
title: Total deaths from infections, by syndrome | ||
unit: deaths | ||
description_short: Estimated number deaths each year from infections. | ||
presentation: | ||
title_public: Total deaths from infections, by syndrome | ||
display: | ||
roundingMode: significantFigures | ||
numSignificantFigures: 3 |
Oops, something went wrong.