Skip to content

Scripts we're using to create automated charts tracking the spread of Covid-19 in Datawrapper

Notifications You must be signed in to change notification settings

sueddeutsche/corona_automated_charts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automate charts for the Covid-19 outbreak

Creates automated charts in Datawrapper for the spread of Covid-19.

Prerequisites

Installation

  • You will need a Datawrapper-API-Key (which is set as a constant in main.R). You can find more on that here.

Usage

You can run this scripts from your machine, or put it on a server which has R and all required packages installed (check out the needs-call in main.R to find them).

  • main.R contains all constants that need to be set beforehand. In the beginning of each function there is a chart_id which needs to be set to the correct Datawrapper-ID. This is quite a manual process but in ensures that there is always a correct mapping between script and chart.

  • You might want to set up a Cronjob to run every hour e.g.: 0 * * * * Rscript [PATH TO THE MAIN.R]/main.R >> log.txt (yes, there are a couple of logs written - just in case).


Dashboard

create_dashboard.R

We've created a dashboard for our website that shows the current case-count and calculated statistics on the doubling-speed and a trend indicator. You can find the live chart here.

Sources:


Maps

We currently only show maps of the German Federal States and Bavarian Counties. We deprecated a map of the whole world when there had been cases everywhere - it is now shown as a Datawrapper table with bar charts (see below).

Both scripts are called in get_geographical_data.R.

German Federal States

You can find the live map here.

map_german_states.R

Source:

  • our own research (combining sources like the RKI and state-level authorities in a Google Sheet)

Create a map of Bavarian counties

You can find the live map here.

map_bavaria_counties.R

This script maps the cases in Bavarian counties. It combines them with a translation table beforehand, to match county name with Lat and Lon-coordinates. Unfortunately the data source changes the names wildly each day (sometimes with a "Land"- or "Stadt"-suffix, sometimes without). So it needs a lot of manual correction.

Source:


Charts

Line chart of the cases

line_cases.R

Showing the cases in China and Worldwide over time. You can find the live chart here.

Sources:

Area chart comparing Cases, deaths and cured numbers

area_cases_vs_cured.R

Showing the cases, deaths and cured cum-sums over time. You can find the live chart here.

Source:

Table for all countries comparing Cases and deaths

table_world_cases_deaths.R

Showing the cases and deaths for each country in a sorted table. You can find the live chart here.

Sources:

Table for several countries comparing Cases and deaths

table_cases_deaths_recovered.R

Showing the cases, recovered and deaths only for China, Italy, Germany and the World right now in a table. You can find the live chart here.

Source:

Barchart: Death rates by Country

bar_deathrate.R

Trys to give a hint which country might be undertested, when deathrates (deaths/cases) exceed prior estimates heavily in some place. You can find the live chart here.

Source:

Linechart: Corona vs. SARS

line_corona_vs_sars.R

Comparing cases of the both. It was used often in the beginning, but right now other aspects emerged. You can find the live chart here.

Sources:


Contributors

About

Scripts we're using to create automated charts tracking the spread of Covid-19 in Datawrapper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages