[API] covid19Italy

Access a tidy format dataset of the 2019 Novel Coronavirus COVID-19 (2019-nCoV) pandemic outbreak in Italy through the covid19Italy API.

Thierry Warin https://warin.ca/aboutme.html (HEC Montréal and CIRANO (Canada))https://www.hec.ca/en/profs/thierry.warin.html
04-03-2020

Table of Contents


Database description

The coronavirus package provides a tidy format dataset of the 2019 Novel Coronavirus COVID-19 (2019-nCoV) epidemic. The raw data pulled from the Johns Hopkins University Center for Systems Science and Engineering (JHU CCSE) Coronavirus repository.

A csv format of the package dataset available here.

A summary dashboard is available here.

Functions

The covid19italy package dev version is updated on a daily bases. The function below allows you to download the data.

Each of these functions are detailed in this course and some examples are provided.

update_data()

The update_data function enables a simple refresh of the installed package datasets with the most updated version on Github:


library(covid19italy)

update_data()

Updates are available on the covid19italy Dev version, do you want to update? n/Y

Note: must restart the R session to have the updates available.


Usage


data(italy_total)

head(italy_total)

        date hospitalized_with_symptoms intensive_care
1 2020-02-24                        101             26
2 2020-02-25                        114             35
3 2020-02-26                        128             36
4 2020-02-27                        248             56
5 2020-02-28                        345             64
6 2020-02-29                        401            105
  total_hospitalized home_confinement cumulative_positive_cases
1                127               94                       221
2                150              162                       311
3                164              221                       385
4                304              284                       588
5                409              412                       821
6                506              543                      1049
  daily_positive_cases recovered death cumulative_cases total_tests
1                    0         1     7              229        4324
2                   90         1    10              322        8623
3                   74         3    12              400        9587
4                  203        45    17              650       12014
5                  233        46    21              888       15695
6                  228        50    29             1128       18661
  total_people_tested
1                  NA
2                  NA
3                  NA
4                  NA
5                  NA
6                  NA

Plotting the active cases distribution


library(plotly)

plot_ly(data = italy_total,
        x = ~ date,
        y = ~home_confinement, 
        name = 'Home Confinement', 
        fillcolor = '#FDBBBC',
        type = 'scatter',
        mode = 'none', 
        stackgroup = 'one') %>%
  add_trace( y = ~ hospitalized_with_symptoms, 
             name = "Hospitalized with Symptoms",
             fillcolor = '#E41317') %>%
  add_trace(y = ~intensive_care, 
                name = 'Intensive Care', 
                fillcolor = '#9E0003') %>%
  layout(title = "Italy - Distribution of Active Covid19 Cases",
         legend = list(x = 0.1, y = 0.9),
         yaxis = list(title = "Number of Cases"),
         xaxis = list(title = "Source: Italy Department of Civil Protection"))

Check here to see more graphics examples of the data retrived from the covid19italy package.

tl;dr


library(covid19italy)

update_data()

data(italy_total)

head(italy_total)

library(plotly)

plot_ly(data = italy_total,
        x = ~ date,
        y = ~home_confinement, 
        name = 'Home Confinement', 
        fillcolor = '#FDBBBC',
        type = 'scatter',
        mode = 'none', 
        stackgroup = 'one') %>%
  add_trace( y = ~ hospitalized_with_symptoms, 
             name = "Hospitalized with Symptoms",
             fillcolor = '#E41317') %>%
  add_trace(y = ~intensive_care, 
                name = 'Intensive Care', 
                fillcolor = '#9E0003') %>%
  layout(title = "Italy - Distribution of Active Covid19 Cases",
         legend = list(x = 0.1, y = 0.9),
         yaxis = list(title = "Number of Cases"),
         xaxis = list(title = "Source: Italy Department of Civil Protection"))

Code learned this week

Command Detail
update_data() Get data for of all Corona Virus cases in Italy

References

This course uses the covid19Italy package, created by Rami Krispin.


Citation

For attribution, please cite this work as

Warin (2020, April 3). Thierry Warin: [API] covid19Italy. Retrieved from https://warin.ca/posts/api-covid19italy/

BibTeX citation

@misc{warin2020[api],
  author = {Warin, Thierry},
  title = {Thierry Warin: [API] covid19Italy},
  url = {https://warin.ca/posts/api-covid19italy/},
  year = {2020}
}