API: covid19Italy

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

Table of Contents


By using SKEMA Quantum Studio framework (Warin 2019), this course will teach you how to use the covid19Italy package.

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 total_currently_positive
1                127               94                      221
2                150              162                      311
3                164              221                      385
4                304              284                      588
5                409              412                      821
6                506              543                     1049
  new_currently_positive recovered death total_positive_cases
1                    221         1     7                  229
2                     90         1    10                  322
3                     74         3    12                  400
4                    203        45    17                  650
5                    233        46    21                  888
6                    228        50    29                 1128
  total_tests
1        4324
2        8623
3        9587
4       12014
5       15695
6       18661

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.


Warin, Thierry. 2019. “SKEMA Quantum Studio: A Technological Framework for Data Science in Higher Education.” https://doi.org/10.6084/m9.figshare.8204195.v2.

Citation

For attribution, please cite this work as

Warin (2020, April 3). Virtual Campus: API: covid19Italy. Retrieved from https://virtualcampus.skemagloballab.io/posts/api-covid19italy/

BibTeX citation

@misc{warin2020api:,
  author = {Warin, Thierry},
  title = {Virtual Campus: API: covid19Italy},
  url = {https://virtualcampus.skemagloballab.io/posts/api-covid19italy/},
  year = {2020}
}