covsirphy.downloading package

covsirphy.downloading.downloader module

class DataDownloader(directory='input', update_interval=12, **kwargs)[source]

Bases: Term

Class to download datasets from the recommended data servers.

Parameters:
  • directory (str | Path) – directory to save downloaded datasets

  • update_interval (int) – update interval of downloading dataset

Note

Location layers are fixed to [‘ISO3’, ‘Province’, ‘City’].

LAYERS: list[str] = ['ISO3', 'Province', 'City']
citations(variables=None)[source]

Return citation list of the data sources.

Parameters:

variables (list[str] | None) – list of variables to collect or None (all available variables)

Return type:

list[str]

Returns:

citations

layer(country=None, province=None, databases=None)[source]

Return the data at the selected layer.

Parameters:
  • country (str | None) – country name or None

  • province (str | None) – province/state/prefecture name or None

  • databases (list[str] | None) –

    databases to use or None (japan, covid19dh, owid). Candidates are as follows.

    • ”japan”: COVID-19 Dataset in Japan,

    • ”covid19dh”: COVID-19 Data Hub,

    • ”owid”: Our World In Data,

    • ”wpp”: World Population Prospects by United nations.

Return type:

DataFrame

Returns:

A dataframe with reset index and the following columns.

  • Date (pandas.Timestamp): observation date

  • ISO3 (str): country names

  • Province (str): province/state/prefecture names

  • City (str): city names

  • Country (str): country names (the top level administration)

  • Province (str): province names (the 2nd level administration)

  • ISO3 (str): ISO3 codes

  • Confirmed (pandas.Int64): the number of confirmed cases

  • Fatal (pandas.Int64): the number of fatal cases

  • Recovered (pandas.Int64): the number of recovered cases

  • Population (pandas.Int64): population values

  • Tests (pandas.Int64): the number of tests

  • Product (pandas.Int64): vaccine product names

  • Vaccinations (pandas.Int64): cumulative number of vaccinations

  • Vaccinations_boosters (pandas.Int64): cumulative number of booster vaccinations

  • Vaccinated_once (pandas.Int64): cumulative number of people who received at least one vaccine dose

  • Vaccinated_full (pandas.Int64): cumulative number of people who received all doses prescribed by the protocol

  • School_closing

  • Workplace_closing

  • Cancel_events

  • Gatherings_restrictions

  • Transport_closing

  • Stay_home_restrictions

  • Internal_movement_restrictions

  • International_movement_restrictions

  • Information_campaigns

  • Testing_policy

  • Contact_tracing

  • Stringency_index

Note

  • When @country is None, country-level data will be returned.

  • When @country is a string and @province is None, province-level data in the country will be returned.

  • When @country and @province are strings, city-level data in the province will be returned.