Skip to content

Commit

Permalink
docs: add notes, confirmed deaths #2600
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasrodes committed Apr 19, 2022
1 parent 5cfc389 commit 163bf8a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
12 changes: 12 additions & 0 deletions public/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ The variables represent all of our main data related to confirmed cases, deaths,
| `total_cases_per_million` | Total confirmed cases of COVID-19 per 1,000,000 people. Counts can include probable cases, where reported. |
| `new_cases_per_million` | New confirmed cases of COVID-19 per 1,000,000 people. Counts can include probable cases, where reported. |
| `new_cases_smoothed_per_million` | New confirmed cases of COVID-19 (7-day smoothed) per 1,000,000 people. Counts can include probable cases, where reported. |

### Confirmed deaths
| Variable | Description |
|:----------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -55,13 +56,18 @@ The variables represent all of our main data related to confirmed cases, deaths,
| `total_deaths_per_million` | Total deaths attributed to COVID-19 per 1,000,000 people. Counts can include probable deaths, where reported. |
| `new_deaths_per_million` | New deaths attributed to COVID-19 per 1,000,000 people. Counts can include probable deaths, where reported. |
| `new_deaths_smoothed_per_million` | New deaths attributed to COVID-19 (7-day smoothed) per 1,000,000 people. Counts can include probable deaths, where reported. |

#### Notes:
* Due to varying protocols and challenges in the attribution of the cause of death, the number of confirmed deaths may not accurately represent the true number of deaths caused by COVID-19.

### Excess mortality
| Variable | Description |
|:------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `excess_mortality` | Percentage difference between the reported number of weekly or monthly deaths in 2020–2021 and the projected number of deaths for the same period based on previous years. For more information, see https://github.com/owid/covid-19-data/tree/master/public/data/excess_mortality |
| `excess_mortality_cumulative` | Percentage difference between the cumulative number of deaths since 1 January 2020 and the cumulative projected deaths for the same period based on previous years. For more information, see https://github.com/owid/covid-19-data/tree/master/public/data/excess_mortality |
| `excess_mortality_cumulative_absolute` | Cumulative difference between the reported number of deaths since 1 January 2020 and the projected number of deaths for the same period based on previous years. For more information, see https://github.com/owid/covid-19-data/tree/master/public/data/excess_mortality |
| `excess_mortality_cumulative_per_million` | Cumulative difference between the reported number of deaths since 1 January 2020 and the projected number of deaths for the same period based on previous years, per million people. For more information, see https://github.com/owid/covid-19-data/tree/master/public/data/excess_mortality |

### Hospital & ICU
| Variable | Description |
|:-------------------------------------|:---------------------------------------------------------------------------------------------------------------|
Expand All @@ -73,14 +79,17 @@ The variables represent all of our main data related to confirmed cases, deaths,
| `weekly_icu_admissions_per_million` | Number of COVID-19 patients newly admitted to intensive care units (ICUs) in a given week per 1,000,000 people |
| `weekly_hosp_admissions` | Number of COVID-19 patients newly admitted to hospitals in a given week |
| `weekly_hosp_admissions_per_million` | Number of COVID-19 patients newly admitted to hospitals in a given week per 1,000,000 people |

### Policy responses
| Variable | Description |
|:-------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `stringency_index` | Government Response Stringency Index: composite measure based on 9 response indicators including school closures, workplace closures, and travel bans, rescaled to a value from 0 to 100 (100 = strictest response) |

### Reproduction rate
| Variable | Description |
|:--------------------|:----------------------------------------------------------------------------------------------------------------------------------------------|
| `reproduction_rate` | Real-time estimate of the effective reproduction rate (R) of COVID-19. See https://github.com/crondonm/TrackingR/tree/main/Estimates-Database |

### Tests & positivity
| Variable | Description |
|:----------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -93,6 +102,7 @@ The variables represent all of our main data related to confirmed cases, deaths,
| `positive_rate` | The share of COVID-19 tests that are positive, given as a rolling 7-day average (this is the inverse of tests_per_case) |
| `tests_per_case` | Tests conducted per new confirmed case of COVID-19, given as a rolling 7-day average (this is the inverse of positive_rate) |
| `tests_units` | Units used by the location to report its testing data |

### Vaccinations
| Variable | Description |
|:---------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -109,6 +119,7 @@ The variables represent all of our main data related to confirmed cases, deaths,
| `new_vaccinations_smoothed_per_million` | New COVID-19 vaccination doses administered (7-day smoothed) per 1,000,000 people in the total population |
| `new_people_vaccinated_smoothed` | Daily number of people receiving their first vaccine dose (7-day smoothed) |
| `new_people_vaccinated_smoothed_per_hundred` | Daily number of people receiving their first vaccine dose (7-day smoothed) per 100 people in the total population |

### Others
| Variable | Description |
|:-----------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -132,6 +143,7 @@ The variables represent all of our main data related to confirmed cases, deaths,
| `life_expectancy` | Life expectancy at birth in 2019 |
| `human_development_index` | A composite index measuring average achievement in three basic dimensions of human development—a long and healthy life, knowledge and a decent standard of living. Values for 2019, imported from http://hdr.undp.org/en/indicators/137506 |


A [full codebook](https://github.com/owid/covid-19-data/tree/master/public/data/owid-covid-codebook.csv) is made available, with a description and source for each variable in the dataset.


Expand Down
2 changes: 2 additions & 0 deletions scripts/input/owid/covid_category_notes.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
category,notes
Confirmed deaths,"Due to varying protocols and challenges in the attribution of the cause of death, the number of confirmed deaths may not accurately represent the true number of deaths caused by COVID-19."
16 changes: 14 additions & 2 deletions scripts/src/cowidev/megafile/export/readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,30 @@ def load_macro_df():


def get_variable_section():
template = """### {title}\n{table}"""
template = """### {title}\n{table}\n{notes}"""
df = pd.read_csv(CODEBOOK_CSV).rename(columns={"description": "Description"})
df_notes = pd.read_csv(PATHS.INTERNAL_INPUT_OWID_COVID_NOTES_FILE, index_col="category")
df = df.assign(Variable=df.column.apply(lambda x: f"`{x}`"))
variable_description = []
categories = list(filter(lambda x: x != "Others", sorted(df.category.unique()))) + ["Others"]
for cat in categories:
df_ = df[df.category == cat]
table = df_[["Variable", "Description"]].to_markdown(index=False)
variable_description.append(template.format(title=cat, table=table))
notes = _generate_category_notes(df_notes, cat)
variable_description.append(template.format(title=cat, table=table, notes=notes))
return variable_description


def _generate_category_notes(df_notes, category):
notes_pretty = "\n#### Notes:\n"
if category in df_notes.index:
notes = df_notes.loc[category]
for note in notes:
notes_pretty += f"* {note}\n"
return notes_pretty
return ""


def get_placeholder():
placeholders = {
"num_countries_vaccinations": get_num_countries_by_iso(
Expand Down
1 change: 1 addition & 0 deletions scripts/src/cowidev/utils/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def _get_project_dir_from_env(err: bool = False):
INTERNAL_INPUT_OWID_ANNOTATIONS_FILE = os.path.join(INTERNAL_DIR, "scripts", "annotations_internal.yaml")
INTERNAL_INPUT_OWID_READ_FILE = os.path.join(INTERNAL_DIR, "scripts", "README.md.template")
INTERNAL_INPUT_OWID_TESTCUT_FILE = os.path.join(INTERNAL_INPUT_OWID_DIR, "testing_cutoffs.csv")
INTERNAL_INPUT_OWID_COVID_NOTES_FILE = os.path.join(INTERNAL_INPUT_OWID_DIR, "covid_category_notes.csv")
INTERNAL_INPUT_UN_DIR = os.path.join(INTERNAL_INPUT_DIR, "un")
INTERNAL_INPUT_UN_POPULATION_FILE = os.path.join(INTERNAL_INPUT_UN_DIR, "population_latest.csv")
INTERNAL_INPUT_UN_POPULATION_AGE_FILE = os.path.join(INTERNAL_INPUT_UN_DIR, "population_age_latest.csv")
Expand Down

0 comments on commit 163bf8a

Please sign in to comment.