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

🐝 Update WHO API endpoint #3344

Merged
merged 3 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions snapshots/who/2022-09-30/ghe.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def main(upload: bool) -> None:


def get_causes_list() -> List[str]:
url = "https://frontdoor-l4uikgap6gz3m.azurefd.net/DEX_CMS/GHE_FULL?$apply=groupby((DIM_GHECAUSE_TITLE))"
url = "https://xmart-api-public.who.int/DEX_CMS/GHE_FULL?$apply=groupby((DIM_GHECAUSE_TITLE))"
res = requests.get(url)
assert res.ok
value_json = json.loads(res.content)["value"]
Expand All @@ -56,9 +56,9 @@ def download_cause_data(causes) -> pd.DataFrame:
for year in range(2000, 2020):
log.info("Downloading...", cause=cause, year=year)
# Use this url to download data for just the All Ages category and for the both sexes category
# url = f"https://frontdoor-l4uikgap6gz3m.azurefd.net/DEX_CMS/GHE_FULL?$filter=DIM_GHECAUSE_TITLE%20eq%20%27{cause}%27%20and%20DIM_SEX_CODE%20eq%20%27BTSX%27and%20DIM_AGEGROUP_CODE%20eq%20%27ALLAges%27&$select=DIM_GHECAUSE_TITLE,DIM_YEAR_CODE,DIM_COUNTRY_CODE,DIM_AGEGROUP_CODE,DIM_SEX_CODE,VAL_DALY_COUNT_NUMERIC,VAL_DALY_RATE100K_NUMERIC,VAL_DEATHS_COUNT_NUMERIC,VAL_DEATHS_RATE100K_NUMERIC,FLAG_LEVEL"
# url = f"https://xmart-api-public.who.int/DEX_CMS/GHE_FULL?$filter=DIM_GHECAUSE_TITLE%20eq%20%27{cause}%27%20and%20DIM_SEX_CODE%20eq%20%27BTSX%27and%20DIM_AGEGROUP_CODE%20eq%20%27ALLAges%27&$select=DIM_GHECAUSE_TITLE,DIM_YEAR_CODE,DIM_COUNTRY_CODE,DIM_AGEGROUP_CODE,DIM_SEX_CODE,VAL_DALY_COUNT_NUMERIC,VAL_DALY_RATE100K_NUMERIC,VAL_DEATHS_COUNT_NUMERIC,VAL_DEATHS_RATE100K_NUMERIC,FLAG_LEVEL"
# Use this url to download data for all age groups and sexes
url = f"https://frontdoor-l4uikgap6gz3m.azurefd.net/DEX_CMS/GHE_FULL?$filter=DIM_GHECAUSE_TITLE%20eq%20%27{cause}%27%20and%20DIM_YEAR_CODE%20eq%20%27{year}%27&$select=DIM_GHECAUSE_TITLE,DIM_YEAR_CODE,DIM_COUNTRY_CODE,DIM_AGEGROUP_CODE,DIM_SEX_CODE,VAL_DALY_COUNT_NUMERIC,VAL_DALY_RATE100K_NUMERIC,VAL_DEATHS_COUNT_NUMERIC,VAL_DEATHS_RATE100K_NUMERIC,FLAG_LEVEL"
url = f"https://xmart-api-public.who.int/DEX_CMS/GHE_FULL?$filter=DIM_GHECAUSE_TITLE%20eq%20%27{cause}%27%20and%20DIM_YEAR_CODE%20eq%20%27{year}%27&$select=DIM_GHECAUSE_TITLE,DIM_YEAR_CODE,DIM_COUNTRY_CODE,DIM_AGEGROUP_CODE,DIM_SEX_CODE,VAL_DALY_COUNT_NUMERIC,VAL_DALY_RATE100K_NUMERIC,VAL_DEATHS_COUNT_NUMERIC,VAL_DEATHS_RATE100K_NUMERIC,FLAG_LEVEL"
df = get_cause_data(url)
df = repack_frame(df)
all_data.append(df)
Expand Down
6 changes: 3 additions & 3 deletions snapshots/who/2024-07-30/ghe.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def main(upload: bool) -> None:


def get_causes_list() -> List[str]:
url = "https://frontdoor-l4uikgap6gz3m.azurefd.net/DEX_CMS/GHE_FULL?$apply=groupby((DIM_GHECAUSE_TITLE))"
url = "https://xmart-api-public.who.int/DEX_CMS/GHE_FULL?$apply=groupby((DIM_GHECAUSE_TITLE))"
res = requests.get(url)
assert res.ok
value_json = json.loads(res.content)["value"]
Expand Down Expand Up @@ -91,7 +91,7 @@ def download_cause_data(causes) -> pd.DataFrame:
for year in years:
log.info("Downloading...", cause=cause, year=year)
# Use this url to download data for just the All Ages category and for the both sexes category
# url = f"https://frontdoor-l4uikgap6gz3m.azurefd.net/DEX_CMS/GHE_FULL?$filter=DIM_GHECAUSE_TITLE%20eq%20%27{cause}%27%20and%20DIM_SEX_CODE%20eq%20%27BTSX%27and%20DIM_AGEGROUP_CODE%20eq%20%27ALLAges%27&$select=DIM_GHECAUSE_TITLE,DIM_YEAR_CODE,DIM_COUNTRY_CODE,DIM_AGEGROUP_CODE,DIM_SEX_CODE,VAL_DALY_COUNT_NUMERIC,VAL_DALY_RATE100K_NUMERIC,VAL_DEATHS_COUNT_NUMERIC,VAL_DEATHS_RATE100K_NUMERIC,FLAG_LEVEL"
# url = f"https://xmart-api-public.who.int/DEX_CMS/GHE_FULL?$filter=DIM_GHECAUSE_TITLE%20eq%20%27{cause}%27%20and%20DIM_SEX_CODE%20eq%20%27BTSX%27and%20DIM_AGEGROUP_CODE%20eq%20%27ALLAges%27&$select=DIM_GHECAUSE_TITLE,DIM_YEAR_CODE,DIM_COUNTRY_CODE,DIM_AGEGROUP_CODE,DIM_SEX_CODE,VAL_DALY_COUNT_NUMERIC,VAL_DALY_RATE100K_NUMERIC,VAL_DEATHS_COUNT_NUMERIC,VAL_DEATHS_RATE100K_NUMERIC,FLAG_LEVEL"
# Use this url to download data for all age groups and sexes
select_cols = [
"DIM_GHECAUSE_TITLE",
Expand All @@ -105,7 +105,7 @@ def download_cause_data(causes) -> pd.DataFrame:
"VAL_DTHS_RATE100K_NUMERIC",
"FLAG_LEVEL",
]
url = f"https://frontdoor-l4uikgap6gz3m.azurefd.net/DEX_CMS/GHE_FULL?$filter=DIM_GHECAUSE_TITLE%20eq%20%27{cause}%27%20and%20DIM_YEAR_CODE%20eq%20{year}&$select={','.join(select_cols)}"
url = f"https://xmart-api-public.who.int/DEX_CMS/GHE_FULL?$filter=DIM_GHECAUSE_TITLE%20eq%20%27{cause}%27%20and%20DIM_YEAR_CODE%20eq%20{year}&$select={','.join(select_cols)}"
df = get_cause_data_with_retry(url)
all_data.append(df)
# combine dataframes - repack them to make them smaller e.g. use categories where possible. Reset index necessary to save as feather.
Expand Down
6 changes: 3 additions & 3 deletions snapshots/who/latest/fluid.csv.dvc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta:
source_name: FluID, World Health Organization (2023)
source_published_by: FluID, World Health Organization (2023)
url: https://www.who.int/teams/global-influenza-programme/surveillance-and-monitoring/fluid
source_data_url: https://frontdoor-l4uikgap6gz3m.azurefd.net/FLUMART/VIW_FID?&$format=csv
source_data_url: https://xmart-api-public.who.int/FLUMART/VIW_FID?$format=csv
license_url: https://www.who.int/about/policies/publishing/copyright
license_name: CC BY-NC-SA 3.0 IGO
date_accessed: 2023-02-16
Expand All @@ -16,6 +16,6 @@ meta:
The platform accommodates both qualitative and quantitative data which facilitates the tracking of global trends, spread, intensity, and impact of influenza. These data are made freely available to health policy makers in order to assist them in making informed decisions regarding the management of influenza.
wdir: ../../../data/snapshots/who/latest
outs:
- md5: 594cd550d73bb1addbd1f7059b5bb10a
size: 163741988
- md5: fe69131b2518a4f7e8970a3e7548a1ef
size: 165063037
path: fluid.csv
6 changes: 3 additions & 3 deletions snapshots/who/latest/flunet.csv.dvc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta:
source_name: FluNet, World Health Organization (2023)
source_published_by: Global Influenza Surveillance and Response System, World Health Organization
url: https://www.who.int/tools/flunet
source_data_url: https://frontdoor-l4uikgap6gz3m.azurefd.net/FLUMART/VIW_FNT?&$format=csv
source_data_url: https://xmart-api-public.who.int/FLUMART/VIW_FNT?&$format=csv
license_url: https://www.who.int/about/policies/publishing/copyright
license_name: CC BY-NC-SA 3.0 IGO
date_accessed: 2023-02-16
Expand All @@ -16,6 +16,6 @@ meta:
The data are provided remotely by National Influenza Centres (NICs) of the Global Influenza Surveillance and Response System (GISRS) and other national influenza reference laboratories collaborating actively with GISRS, or are uploaded from WHO regional databases.
wdir: ../../../data/snapshots/who/latest
outs:
- md5: 50dd3b6f4bd5aad369fba83894e497f8
size: 26653510
- md5: 32ae8167e5b7ba081f3238f48a482d1d
size: 26823911
path: flunet.csv
2 changes: 1 addition & 1 deletion snapshots/who/latest/monkeypox.csv.dvc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ meta:
attribution_short: WHO

# Files
url_main: https://frontdoor-l4uikgap6gz3m.azurefd.net/MPX/V_MPX_VALIDATED_DAILY
url_main: https://xmart-api-public.who.int/MPX/V_MPX_VALIDATED_DAILY
date_accessed: 2024-08-07
date_published: "2024-08-07"

Expand Down
Loading