Skip to content

Commit

Permalink
🐛 proper fix for missing countries in monkeypox
Browse files Browse the repository at this point in the history
  • Loading branch information
Marigold committed Sep 6, 2024
1 parent a57a3b0 commit 6d7a5c5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions etl/steps/data/garden/who/latest/monkeypox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

import owid.catalog.processing as pr
import pandas as pd
import structlog
from owid.catalog import Table

from etl.data_helpers import geo
from etl.helpers import PathFinder, create_dataset

log = structlog.get_logger()

# Get paths and naming conventions for current step.
paths = PathFinder(__file__)

Expand Down Expand Up @@ -46,9 +49,11 @@ def run(dest_dir: str) -> None:
make_missing_countries_nan=True,
)

missing_countries = set(tb_orig[tb.country.isnull()].country)
ix = tb.country.isnull()
missing_countries = set(tb_orig[ix].country)
if missing_countries:
raise ValueError(f"Missing countries in monkeypox.meta.yml: {missing_countries}")
log.warning(f"Missing countries in monkeypox.countries.json: {missing_countries}")
tb.country = tb.country.astype(str).fillna(tb_orig.country)

tb = (
tb.pipe(clean_columns)
Expand Down

0 comments on commit 6d7a5c5

Please sign in to comment.