Free API for RIVM COVID-19 Data

2 min read Original article ↗

Products API

Today I am opening an easy to use API that exposes data on Dutch COVID-19 cases from the RIVM. The API can be used with industry standard tools for data analysis.

Using this simple API allows developers to rapidly access COVID-19 data that is normally exposed through the RIVM website. The structure can be readily used with Python Pandas' read_json function (documentation). Note that this is an unofficial API that is not supported by the RIVM.

Endpoints

The following endpoints are available:

api/v1/deaths_per_day

Returns the number of deaths for each day in the past period, with columns for total deaths that day, deaths recorded yesterday and deaths recorded up to yesterday.

api/v1/hospital_patients_per_day

Returns the number of hospital patients admitted for COVID each day in the past period, with columns for total admissions that day, admissions recorded yesterday and admissions recorded up to yesterday.

api/v1/ggd_patients_per_day

Returns the number of COVID patients identified by the GGD each day in the past period, with columns for total patients that day, patients recorded yesterday and patients recorded up to yesterday.

api/v1/age_sex_deaths

Returns the number of COVID related deaths, separated by sex and age.

This API is hosted on Google Cloud Run, with caching on CloudFlare, which means that it may take some time for data to become up-to-date.

Example usage

import pandas

df = pandas.read_json(
    "https://covid.stephanheijl.com/api/v1/deaths_per_day"
)

Results in a dataframe:

             date  new  until_yesterday  total
0   [2020, 2, 27]    0                0      0
1   [2020, 2, 28]    0                0      0
2   [2020, 2, 29]    0                0      0
3    [2020, 3, 1]    0                0      0
4    [2020, 3, 2]    0                0      0
...
70   [2020, 5, 7]    1               32     33
71   [2020, 5, 8]    2               20     22
72   [2020, 5, 9]    4               12     16
73  [2020, 5, 10]    8                0      8
74  [2020, 5, 11]    0                0      0

[75 rows x 4 columns]

Attribution/Citation

If you use this API in your work you are required to attribute the RIVM as the primary source of the data: Rijksinstituut voor Volksgezondheid en Milieu (RIVM), "Ontwikkeling COVID-19 in grafieken", 2020.

I also kindly request that you attribute me by name and website (Stephan Heijl, https://stephanheijl.com).