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

📊 antimicrobial resistance: MICROBE dataset - neonatal deaths - total #3578

Merged
merged 37 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e735ceb
adding meadow and garden steps
spoonerf Nov 20, 2024
0e3350b
adding grapher step
spoonerf Nov 20, 2024
e02e003
add grapher step
spoonerf Nov 20, 2024
b91d961
adding bloodstream infections
spoonerf Nov 20, 2024
2f7aca2
jinja
spoonerf Nov 20, 2024
08323bb
no reset index
spoonerf Nov 20, 2024
381d514
decimal places to 0
spoonerf Nov 20, 2024
de097b3
adding display names
spoonerf Nov 20, 2024
06e7c62
remove title public
spoonerf Nov 20, 2024
0a9d311
setting significant figures
spoonerf Nov 20, 2024
d063fed
minor jinja
spoonerf Nov 20, 2024
df59320
add bloodstream amr
spoonerf Nov 20, 2024
cc1860c
add dag
spoonerf Nov 20, 2024
eacd71e
add snapshot
spoonerf Nov 21, 2024
93d63f5
Merge branch 'master' into microbe-neonatal
spoonerf Nov 21, 2024
ee10284
spaces
spoonerf Nov 21, 2024
65bdc6e
typo
spoonerf Nov 21, 2024
2f89138
typos
spoonerf Nov 21, 2024
742e04e
adding resistance type to display name
spoonerf Nov 21, 2024
5ffe3f0
removing decimal places
spoonerf Nov 24, 2024
ed2d091
adding flipped entities
spoonerf Nov 24, 2024
905fb6c
lowering case
spoonerf Nov 24, 2024
5558fdb
trying trimming
spoonerf Nov 24, 2024
637e9f3
adding extra table
spoonerf Nov 24, 2024
e0fa3ef
clarifying it's bloodstream infections
spoonerf Nov 24, 2024
4c8ce55
sig figs
spoonerf Nov 24, 2024
f530c6f
adding flipped table
spoonerf Nov 24, 2024
b7feafd
adding table to grapher
spoonerf Nov 24, 2024
1b869ba
remove full stop
spoonerf Nov 24, 2024
8254a29
adding snapshot -> garden
spoonerf Nov 24, 2024
b75f6c7
adding grapher
spoonerf Nov 24, 2024
4ed09a9
lower case
spoonerf Nov 24, 2024
772b511
fixing jinja
spoonerf Nov 24, 2024
f44659d
Merge branch 'master' into microbe-neonatal
spoonerf Nov 24, 2024
617b55c
metadta
spoonerf Nov 24, 2024
579e013
metadata
spoonerf Nov 24, 2024
4d5e769
add rounding mode
spoonerf Nov 24, 2024
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
29 changes: 29 additions & 0 deletions dag/health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -926,3 +926,32 @@ steps:
- data://meadow/antibiotics/2024-11-15/testing_coverage
data://grapher/antibiotics/2024-11-15/testing_coverage:
- data://garden/antibiotics/2024-11-15/testing_coverage

# IHME Neonatal all infectious syndromes
data-private://meadow/antibiotics/2024-11-20/microbe:
- snapshot-private://antibiotics/2024-11-20/microbe.zip
data-private://garden/antibiotics/2024-11-20/microbe:
- data-private://meadow/antibiotics/2024-11-20/microbe
data-private://grapher/antibiotics/2024-11-20/microbe:
- data-private://garden/antibiotics/2024-11-20/microbe
# IHME Neonatal bloodstream infections by pathogen
data-private://meadow/antibiotics/2024-11-20/pathogen_bloodstream:
- snapshot-private://antibiotics/2024-11-20/pathogen_bloodstream.csv
data-private://garden/antibiotics/2024-11-20/pathogen_bloodstream:
- data-private://meadow/antibiotics/2024-11-20/pathogen_bloodstream
data-private://grapher/antibiotics/2024-11-20/pathogen_bloodstream:
- data-private://garden/antibiotics/2024-11-20/pathogen_bloodstream
# IHME Neonatal bloodstream infections by resistance
data-private://meadow/antibiotics/2024-11-20/bloodstream_amr:
- snapshot-private://antibiotics/2024-11-20/bloodstream_amr.csv
data-private://garden/antibiotics/2024-11-20/bloodstream_amr:
- data-private://meadow/antibiotics/2024-11-20/bloodstream_amr
data-private://grapher/antibiotics/2024-11-20/bloodstream_amr:
- data-private://garden/antibiotics/2024-11-20/bloodstream_amr
# IHME Neonatal infections by syndrome
data-private://meadow/antibiotics/2024-11-24/total_syndrome:
- snapshot-private://antibiotics/2024-11-24/total_syndrome.csv
data-private://garden/antibiotics/2024-11-24/total_syndrome:
- data-private://meadow/antibiotics/2024-11-24/total_syndrome
data-private://grapher/antibiotics/2024-11-24/total_syndrome:
- data-private://garden/antibiotics/2024-11-24/total_syndrome
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Global": "World"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
definitions:
common:
presentation:
topic_tags:
- Antibiotics
display:
numSignificantFigures: 3

pathogen_type:
<%- if pathogen_type == "Fungi" -%>
fungus
<%- elif pathogen_type == "Viruses" -%>
virus
<%- else -%>
<< pathogen_type.lower() >>
<%- endif -%>
counterfactual:
<% if counterfactual == "Associated" %>
where the death was associated with antibiotic resistance
<% elif counterfactual == "Susceptible" %>
where the bacteria causing the death were susceptible to antibiotics
<% elif counterfactual == "Untested" %>
where the pathogen was not tested for antibiotic resistance
<% endif %>



# Learn more about the available fields:
# http://docs.owid.io/projects/etl/architecture/metadata/reference/
dataset:
update_period_days: 365


tables:
bloodstream_amr:
variables:
value:
title: Neonatal deaths from << pathogen >> infections {definitions.counterfactual}
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from << pathogen >> infections, {definitions.counterfactual} << pathogen >> is a {definitions.pathogen_type}.
display:
name: << pathogen >> - << counterfactual >>
upper:
title: Upper bound of neonatal deaths from << pathogen >> infections {definitions.counterfactual}
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from << pathogen >> infections, {definitions.counterfactual}. << pathogen >> is a {definitions.pathogen_type}.
display:
name: << pathogen >> - << counterfactual >>
lower:
title: Lower bound of neonatal deaths from << pathogen >> infections {definitions.counterfactual}
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from << pathogen >> infections, {definitions.counterfactual}. << pathogen >> is a {definitions.pathogen_type}.
display:
name: << pathogen >> - << counterfactual >>
amr_entity:
variables:
value:
title: Global neonatal deaths from bloodstream infections, by pathogen {definitions.counterfactual}
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from bloodstream infections, {definitions.counterfactual}.
display:
name: << counterfactual >>
upper:
title: Upper bound of global neonatal deaths from bloodstream infections, by pathogen {definitions.counterfactual}
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from bloodstream infections, {definitions.counterfactual}.
display:
name: << counterfactual >>
lower:
title: Lower bound of global neonatal deaths from bloodstream infections, by pathogen {definitions.counterfactual}
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from bloodstream infections, {definitions.counterfactual}.
display:
name: << counterfactual >>
38 changes: 38 additions & 0 deletions etl/steps/data/garden/antibiotics/2024-11-20/bloodstream_amr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""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("bloodstream_amr")

# Read table from meadow dataset.
tb = ds_meadow.read("bloodstream_amr")

#
# Process data.
#
tb = geo.harmonize_countries(df=tb, countries_file=paths.country_mapping_path)
tb = tb.drop(columns=["age", "sex", "measure", "metric", "infectious_syndrome"])
tb_amr = tb.drop(columns=["country", "pathogen_type"]).rename(columns={"pathogen": "country"})
tb_amr = tb_amr.format(["country", "year", "counterfactual"], short_name="amr_entity")
tb = tb.format(["country", "year", "pathogen", "pathogen_type", "counterfactual"])

#
# Save outputs.
#
# Create a new garden dataset with the same metadata as the meadow dataset.
ds_garden = create_dataset(
dest_dir, tables=[tb, tb_amr], check_variables_metadata=True, default_metadata=ds_meadow.metadata
)

# Save changes in the new garden dataset.
ds_garden.save()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Global": "World"
}
53 changes: 53 additions & 0 deletions etl/steps/data/garden/antibiotics/2024-11-20/microbe.meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# NOTE: To learn more about the fields, hover over their names.
definitions:
common:
presentation:
topic_tags:
- Global Health
display:
numSignificantFigures: 3
pathogen_type:
<%- if pathogen_type == "Fungi" -%>
fungus
<%- elif pathogen_type == "Viruses" -%>
virus
<%- else -%>
<< pathogen_type.lower() >>
<%- endif -%>


# Learn more about the available fields:
# http://docs.owid.io/projects/etl/architecture/metadata/reference/
dataset:
update_period_days: 365


tables:
microbe:
variables:
value:
title: Neonatal deaths from << pathogen >> infections
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from << pathogen >> infections. << pathogen >> is a {definitions.pathogen_type}.
upper:
title: Upper bound of neonatal deaths from << pathogen >> infections
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from << pathogen >> infections. << pathogen >> is a {definitions.pathogen_type}.
lower:
title: Lower bound of neonatal deaths from << pathogen >> infections
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from << pathogen >> infections. << pathogen >> is a {definitions.pathogen_type}.
pathogen_entity:
variables:
value:
title: Global neonatal deaths from bloodstream infections, by pathogen
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from bloodstream infections.
upper:
title: Upper bound of global neonatal deaths from bloodstream infections, by pathogen
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from bloodstream infections.
lower:
title: Lower bound of global neonatal deaths from bloodstream infections, by pathogen
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from bloodstream infections.
39 changes: 39 additions & 0 deletions etl/steps/data/garden/antibiotics/2024-11-20/microbe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""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")

# Read table from meadow dataset.
tb = ds_meadow.read("microbe")

#
# Process data.
#
tb = geo.harmonize_countries(df=tb, countries_file=paths.country_mapping_path)

tb = tb.drop(columns=["age", "sex", "measure", "metric", "counterfactual", "infectious_syndrome"])
# Create a table where the pathogen is the entity
tb_pathogen = tb.drop(columns=["country", "pathogen_type"]).rename(columns={"pathogen": "country"})
tb = tb.format(["country", "year", "pathogen_type", "pathogen"])
tb_pathogen = tb_pathogen.format(["country", "year"], short_name="pathogen_entity")
#
# Save outputs.
#
# Create a new garden dataset with the same metadata as the meadow dataset.
ds_garden = create_dataset(
dest_dir, tables=[tb, tb_pathogen], check_variables_metadata=True, default_metadata=ds_meadow.metadata
)

# Save changes in the new garden dataset.
ds_garden.save()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Global": "World"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# NOTE: To learn more about the fields, hover over their names.
definitions:
common:
presentation:
topic_tags:
- Antibiotics
display:
numSignificantFigures: 3
name: << pathogen >>

pathogen_type:
<% if pathogen_type == "Fungi" %>
fungus
<% elif pathogen_type == "Viruses" %>
virus
<% else %>
<< pathogen_type.lower() >>
<% endif %>

# Learn more about the available fields:
# http://docs.owid.io/projects/etl/architecture/metadata/reference/
dataset:
update_period_days: 365


tables:
pathogen_bloodstream:
variables:
value:
title: Neonatal deaths from << pathogen >> infections
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from << pathogen >> infections. << pathogen >> is a {definitions.pathogen_type}.
upper:
title: Upper bound of neonatal deaths from << pathogen >> infections
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from << pathogen >> infections. << pathogen >> is a {definitions.pathogen_type}.
lower:
title: Lower bound of neonatal deaths from << pathogen >> infections
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from << pathogen >> infections. << pathogen >> is a {definitions.pathogen_type}.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""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("pathogen_bloodstream")

# Read table from meadow dataset.
tb = ds_meadow.read("pathogen_bloodstream")

#
# Process data.
#
tb = geo.harmonize_countries(df=tb, countries_file=paths.country_mapping_path)

tb = tb.drop(columns=["age", "sex", "measure", "metric", "counterfactual", "infectious_syndrome"])
tb = tb.format(["country", "year", "pathogen_type", "pathogen"])

#
# 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()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Global": "World"
}
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:
total_syndrome:
variables:
value:
title: Global neonatal deaths from << infectious_syndrome.lower() >> infections
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from << infectious_syndrome.lower() >>.
display:
roundingMode: significantFigures
numSignificantFigures: 3
name: << infectious_syndrome >>
upper:
title: Upper bound of global neonatal deaths from << infectious_syndrome.lower() >> infections
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from << infectious_syndrome.lower() >>.
display:
roundingMode: significantFigures
numSignificantFigures: 3
name: << infectious_syndrome >>
lower:
title: Lower bound of global neonatal deaths from << infectious_syndrome.lower() >> infections
unit: deaths
description_short: Estimated number of [neonates](#dod:neonatal) – newborns under 28 days of age –  who die each year from << infectious_syndrome.lower() >>.
display:
numSignificantFigures: 3
roundingMode: significantFigures
name: << infectious_syndrome >>

Loading