Search
Summary

COVID-19 Outbreak Data

This report has been created using Jupyter Book. The graphs tries to visualize and analyze some data related to the COVID-19 outbreak. Interactive charts have been generated using plotly.

Summary

This page shows the progression of the pandemic worldwide (in a selection of countries, mainly in Europe and America). Additional pages are being set up for Italy and Berlin

The data are constantly updated from the repository by Johns Hopkins CCSE and from additional sources specific for each considered country case.

This is a work-in-progress, graphs will be addedd in the next days and week.

Method

We wrote a small Python module that read in the data fro JHU, group them in a dataframe (computing also confirmed cases and deaths per day) and extract single country data by name. We also compute few derived quantities, such as mortality rate and an estimate of the reproduction number (R0).

Below, we analyze a set of European and American countries.

import os,sys
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(''), '../../Code')))
from hedera_covid import DataHandler, plot_death_rate, plot_daily_cases, plot_confirmed_cases



# for plotly
from plotly.offline import iplot
from plotly.offline import init_notebook_mode, plot
from IPython.core.display import display, HTML
import plotly as py
import plotly.tools as tls

import numpy as np

# load data
path_confirmed = '../../Data/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv'
path_death = '../../Data/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv'

europe_covid_data = DataHandler(data_confirmed_path = path_confirmed,data_death_path = path_death)
america_covid_data = DataHandler(data_confirmed_path = path_confirmed,data_death_path = path_death)

Europe

Europe = ['Italy','Spain','Germany','France','United Kingdom',
          'Netherlands','Belgium','Portugal','Sweden','Austria','Russia','Turkey']

Total number of cases

The number of (reported) cases is strongly dependent on the capacity and on the politics of each country in terms of tests. Realistic estimates can only be obtained starting from (realistic estimates of) the number of deaths and of the death rate.

Nevertheless, the number of reported cases can provide a measure of the spread of the virus.

The following figure shows the number of reported cases, shifting the curves so that they start when the number of infected persons reached 100. The number has also been smoothed taking, for each day, the average of a week (3 days before and 3 days after).

Note You can double click on a country name on legend to isolate its data. Simple clicking on a name will switch on/off the corresponding data.

for c in Europe:
    europe_covid_data.add_country(c)

# confirmed
data = europe_covid_data.get_confirmed_data(start_date=0,n_smooth=0,rescale=True)
covid_data = europe_covid_data
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Confirmed Cases (rescaled in each country)"}}
}

plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

Daily variation

data = europe_covid_data.get_daily_confirmed_data(start_date=0,n_smooth=7,rescale=True)
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Daily Cases (rescaled)"}}
}

plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

These curves show whether and how the different countries are able to flatten the curves. Try to double-click on the legend, then switch on, country by country, e.g., comparing Italy, Germany, and Spain.

Note These data are dependent on the testing policy of each country. For example, at the beginning of April Italy drastically increased the number of performed test, which might result in an increase of reported cases.

Number of deaths

data = europe_covid_data.get_deaths_data(start_date=40,n_smooth=7,rescale=False)
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Total deaths (rescaled)"}, "legend_orientation": "h", 
              "legend" :{"x":0.3, "y": 1.15}
              }
}

plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

Daily variation

To look at the daily variation, we can rescale the curves setting the first day when at least 5 deaths were reported.

data = europe_covid_data.get_daily_deaths_data(start_date=0,n_smooth=7,rescale=True)
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Daily deaths (rescaled)"}, "legend_orientation": "h"}
}
plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

Letality Rate

The following figure shows the letality rate (# of reported death/# of reported cases) for each country/

data = europe_covid_data.get_death_rate_data(start_date=40,n_smooth=0,rescale=False)
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Letality rate"},
               "font_size":10,
              "legend": {'x':1.05}
              }
}
plot(fig,filename = 'figure.html')
display(HTML('figure.html'))

Americas

America = ['US','Canada','Mexico','Colombia','Peru',
          'Chile','Brazil','Ecuador','Argentina']

for c in America:
    america_covid_data.add_country(c)

Total confirmed cases

# confirmed
data = america_covid_data.get_confirmed_data(start_date=0,n_smooth=0,rescale=True)

init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Confirmed cases (rescaled)"}, "legend_orientation": "h"}
}

plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

Daily variation

data = america_covid_data.get_daily_confirmed_data(start_date=0,n_smooth=7,rescale=True)
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Daily Cases (rescaled)"}}
}

plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

Daily deaths

data = america_covid_data.get_daily_deaths_data(start_date=0,n_smooth=7,rescale=True)
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Daily deaths (rescaled)"}, "legend_orientation": "h"}
}
plot(fig, filename = 'figure.html')
display(HTML('figure.html'))