WHO Global Health Observatory (GHO) indicators: sample notebook

A worked notebook for WHO Global Health Observatory (GHO) indicators, with 5 code cells and the output each one printed. On Scigantic it opens in a hosted JupyterLab with the dataset already mounted, so nothing is downloaded first.

Provider
World Health Organization
License
WHO data terms: free use, reproduction and distribution for public health purposes with attribution; no use in promotion of a commercial enterprise (https://www.who.int/about/policies/publishing/data-policy/terms-and-conditions)
Format
Parquet (in sampled files)
Stored at
Amazon S3, s3://scigantic-who (us-east-1)
Access
Free and public. No account with the data provider is needed.

The notebook

WHO Global Health Observatory

Every Global Health Observatory indicator, mounted read-only as parquet under gho/. WHO's own API serves one indicator per request and has no bulk download; here data/ .parquet holds each indicator, observations.parquet holds all of them, and indicators.parquet / dimension_values.parquet turn codes into names.

This notebook finds an indicator, plots it, decodes its dimension codes, then ranks the causes of under-five deaths for one country. Everything runs on DuckDB over the mount.

import os
import duckdb
import pandas as pd
import matplotlib.pyplot as plt

ARCHIVE = os.environ.get("SCIGANTIC_MOUNT_PATH", "/mnt/archive")
con = duckdb.connect()

def q(sql, **params):
    return con.execute(sql.format(a=ARCHIVE, **params)).df()

print(open(f"{ARCHIVE}/_MIRROR.txt").read().split("\n\n")[0])
q("select count(*) as indicators, sum(row_count) as observations, "
  "count(*) filter (where row_count = 0) as empty_indicators from '{a}/gho/indicators.parquet'")

Output:

Scigantic mirror of WHO Global Health Observatory
   indicators  observations  empty_indicators
0        3099     9944921.0               612

1. Find an indicator

Search indicators.parquet by name. row_count is how many observations the indicator actually has; a few hundred codes exist in WHO's catalog with no data behind them, and names starting with Archived point at a replacement code.

q("""
select IndicatorCode, IndicatorName, row_count, first_year, last_year, n_spatial_units
from '{a}/gho/indicators.parquet'
where IndicatorName ilike '%under-five mortality%' and row_count > 0
order by row_count desc
""")

Output:

    IndicatorCode                                      IndicatorName  \
0  MDG_0000000007  Under-five mortality rate (probability of dyin...   

   row_count  first_year  last_year  n_spatial_units  
0      64510        1931       2024              249

2. One indicator, three countries

MDG_0000000001 is the under-five mortality rate (deaths per 1,000 live births). Read it from its own file under gho/data/, keep the both-sexes series (Dim1 = 'SEX_BTSX'), and plot. Value is the published string with its uncertainty interval; NumericValue, Low and High are the numbers.

u5 = q("""
select SpatialDim as iso3, TimeDim as year, NumericValue as rate, Low, High, Value
from '{a}/gho/data/MDG_0000000001.parquet'
where SpatialDimType = 'COUNTRY' and SpatialDim in ('BRA', 'IND', 'NGA')
  and Dim1 = 'SEX_BTSX' and TimeDim >= 2000
order by iso3, year
""")

fig, ax = plt.subplots(figsize=(8, 4))
for iso3, g in u5.groupby("iso3"):
    ax.plot(g["year"], g["rate"], marker="o", ms=3, label=iso3)
    ax.fill_between(g["year"], g["Low"], g["High"], alpha=0.15)
ax.set_ylabel("deaths per 1,000 live births")
ax.set_title("Under-five mortality rate, both sexes (WHO GHO MDG_0000000001)")
ax.legend()
plt.show()
u5.tail(3)

Output:

   iso3  year       rate        Low       High             Value
72  NGA  2022  70.163303  62.129077  79.329716  70.2 [62.1-79.3]
73  NGA  2023  70.130311  61.113004  80.759944  70.1 [61.1-80.8]
74  NGA  2024  69.771281  59.634972  82.162548  69.8 [59.6-82.2]

3. Decode the codes

SpatialDim, Dim1..Dim3 and friends are codes. dimension_values.parquet maps every (Dimension, Code) to a label and its parent, so one join names the country and the sex.

q("""
select o.SpatialDim as code, c.Title as country, c.ParentTitle as who_region,
       o.Dim1 as sex_code, s.Title as sex, o.TimeDim as year, o.Value
from '{a}/gho/data/MDG_0000000001.parquet' o
join '{a}/gho/dimension_values.parquet' c on c.Dimension = 'COUNTRY' and c.Code = o.SpatialDim
join '{a}/gho/dimension_values.parquet' s on s.Dimension = o.Dim1Type and s.Code = o.Dim1
where o.SpatialDim = 'NGA' and o.TimeDim = (select max(TimeDim) from '{a}/gho/data/MDG_0000000001.parquet')
order by sex_code
""")

Output:

  code  country who_region  sex_code         sex  year             Value
0  NGA  Nigeria     Africa  SEX_BTSX  Both sexes  2024  69.8 [59.6-82.2]
1  NGA  Nigeria     Africa  SEX_FMLE      Female  2024  63.2 [53.7-74.8]
2  NGA  Nigeria     Africa   SEX_MLE        Male  2024  76.0 [64.8-89.9]

4. What are those children dying of?

MORT_100 is the number of under-five deaths by cause (WHO and partner estimates), by country and year, with the cause in Dim3 under the CHILDCAUSE dimension and the age band in Dim2. Here every other column is pinned (AGEGROUP_YEARS0-4 is the whole under-five band; the narrower DAYS0-27 and MONTHS1-59 rows would double count it) and any all-causes total row is dropped so the ranking is not led by its own sum.

causes = q("""
select c.Title as cause, o.TimeDim as year, o.NumericValue as deaths
from '{a}/gho/data/MORT_100.parquet' o
join '{a}/gho/dimension_values.parquet' c on c.Dimension = o.Dim3Type and c.Code = o.Dim3
where o.SpatialDim = 'NGA' and o.Dim3Type = 'CHILDCAUSE' and o.Dim2 = 'AGEGROUP_YEARS0-4'
  and o.Dim1 = 'SEX_BTSX' and c.Title not ilike '%all causes%'
  and o.TimeDim = (select max(TimeDim) from '{a}/gho/data/MORT_100.parquet')
order by deaths desc
""")
print(f"Nigeria, {causes['year'].iloc[0]}: under-five deaths by cause (WHO MORT_100, both sexes)")
causes.drop(columns='year').round(0)

Output:

Nigeria, 2021: under-five deaths by cause (WHO MORT_100, both sexes)
                                                cause    deaths
0                                             Malaria  180294.0
1                  Acute lower respiratory infections  169149.0
2                                 Diarrhoeal diseases  135857.0
3                     Birth asphyxia and birth trauma   79818.0
4   Other Group 1 and Other noncommunicable (neona...   76626.0
5                                         Prematurity   56905.0
6   Sepsis and other infectious conditions of the ...   41386.0
7                                            Injuries   35231.0
8                             Meningitis/encephalitis   28600.0
9                                Congenital anomalies   18905.0
10                                       Tuberculosis   14805.0
11                                           HIV/AIDS   10640.0
12                                            Measles    3489.0
...

Where to go next

Run it

Open this notebook to run it, see the dataset page for the full description, or browse the full catalog.