nokey.health package

Submodules

nokey.health.open_disease module

class nokey.health.open_disease.OpenDisease(use_caching=False, cache_name='open_disease_cache', backend='sqlite', expire_after=3600)[source]

Bases: object

A class for interacting with the Open Disease API.

base_url

The base URL for the API.

about

A short description of the API.

get_all_countries_apple()[source]

Returns a list of supported country names.

Parameters:

None

Returns:

A list containing supported country names.

Return type:

list

get_all_countries_ecdc()[source]

Returns a list of supported country names.

Parameters:

None

Returns:

A list containing supported country names.

Return type:

list

get_all_countries_gov()[source]

Returns a list of supported country names for government specific data.

Parameters:

None

Returns:

A list containing supported country names.

Return type:

list

get_all_us_states_jhu()[source]

Returns all possible US States and provinces to query the /historical/usacounties/{state} endpoint with.

Parameters:

None

Returns:

A list containing all US states and provinces.

Return type:

list

get_apple_mobility_data_for_subregions(country, subregions)[source]

Returns a list of mobility data entries for subregion(s) every day since January 13th. Each entry has driving, transit, and walking data with an associated number of percentage change since January 13th.

Parameters:
  • country (str) – A valid country name from the /v3/covid-19/apple/countries endpoint.

  • subregions (str) – Valid subregion(s) from the /v3/covid-19/apple/countries/{country} endpoint, separated by with commas.

Returns:

A dictionary containing a list of mobility data.

Return type:

dict

get_apple_supported_subregions_for_country(country)[source]

Returns a list of supported subregions in a country where data is available.

Parameters:

country (str) – A valid country name from the /v3/covid-19/apple/countries endpoint

Returns:

A dictionary containing a list of supported subregions.

Return type:

dict

get_docs_url()[source]

Returns the URL for the Open Disease API documentation.

Parameters:

None

Returns:

The URL for the API docs.

Return type:

string

get_ecdc_covid_variant_data_for_country(country)[source]

Returns COVID-19 ECDC reported data for a specific country.

Parameters:

country (str) – A valid country name from the /v3/covid-19/variants/countries/ endpoint

Returns:

A dictionary containing covid data.

Return type:

dict

get_gov_covid_data_for_country(country, allow_null=False)[source]

Returns government supported data for a specific country.

Parameters:
  • country (str) – A valid country name from the /v3/covid-19/gov endpoint.

  • allow_null (bool) – By default, if a value is missing, it is returned as 0. This allows nulls to be returned.

Returns:

A dictionary containing a list of supported subregions.

Return type:

dict

get_jhu_global_accumulated_covid_data(last_days=30)[source]

Returns global accumulated COVID-19 time series data for all countries and all their provences.

Parameters:

last_days (int, str) – Number of days’ data to return. Use ‘all’ to return all data. Default is 30.

Returns:

A dictionary containing global accumulated COVID-19 time series data.

Return type:

dict

get_jhu_global_time_series_covid_data(last_days=30)[source]

Returns COVID-19 time series data for all countries and all their provences.

Parameters:

last_days (int, str) – Number of days’ data to return. Use ‘all’ to return all data. Default is 30.

Returns:

A dictionary containing COVID-19 time series data.

Return type:

dict

get_jhu_time_series_covid_data_for_countries(countries, last_days=30)[source]

Returns COVID-19 time series data for a specific countries.

Parameters:
  • country (str) – Multiple country names, iso2s, iso3s, or country ID codes, in comma separated no spaced string.

  • last_days (int, str) – Number of days’ data to return. Use ‘all’ to return all data. Default is 30.

Returns:

A dictionary containing COVID-19 time series data.

Return type:

dict

get_jhu_time_series_covid_data_for_country(country, last_days=30)[source]

Returns COVID-19 time series data for a specific country.

Parameters:
  • country (str) – A country name, iso2, iso3, or country ID code.

  • last_days (int, str) – Number of days’ data to return. Use ‘all’ to return all data. Default is 30.

Returns:

A dictionary containing COVID-19 time series data.

Return type:

dict

get_jhu_time_series_covid_data_for_province(province, country, last_days=30)[source]

Returns COVID-19 time series data for a specific province in a country.

Parameters:
  • country (str) – A country name, iso2, iso3, or country ID code.

  • province (str) – Province name. All available names can be found in the /v3/covid-19/historical/{query} endpoint.

  • last_days (int, str) – Number of days’ data to return. Use ‘all’ to return all data. Default is 30.

Returns:

A dictionary containing COVID-19 time series data.

Return type:

dict

get_jhu_time_series_covid_data_for_provinces(provinces, country, last_days=30)[source]

Returns COVID-19 time series data for a specific set of provinces in a country.

Parameters:
  • country (str) – A country name, iso2, iso3, or country ID code.

  • province (str) – Provinces spelled correctly separated by ‘,’ or ‘|’ delimiters, never both in the same query.

  • last_days (int, str) – Number of days’ data to return. Use ‘all’ to return all data. Default is 30.

Returns:

A dictionary containing COVID-19 time series data.

Return type:

dict

get_jhu_time_series_covid_data_for_state(state, last_days=30)[source]

Returns COVID-19 time series data for all counties in a specific state.

Parameters:
  • state (str) – US state name, validated in the array returned from the /v3/covid-19/historical/usacounties endpoint.

  • last_days (int, str) – Number of days’ data to return. Use ‘all’ to return all data. Default is 30.

Returns:

A dictionary containing COVID-19 time series data.

Return type:

dict

get_nyt_time_series_covid_data_for_all_states(last_days=30)[source]

Returns COVID-19 time series data for all states, with an entry for each day since the pandemic began.

Parameters:

last_days (int, str) – Number of days’ data to return. Use ‘all’ to return all data. Default is 30.

Returns:

A dictionary containing COVID-19 time series data.

Return type:

dict

get_nyt_time_series_covid_data_for_all_us_counties(last_days=30)[source]

Returns COVID-19 time series data for all available US counties, with an entry for each day since the pandemic began.

Parameters:

last_days (int, str) – Number of days’ data to return. Use ‘all’ to return all data. Default is 30.

Returns:

A dictionary containing COVID-19 time series data.

Return type:

dict

get_nyt_time_series_covid_data_for_entire_usa()[source]

Returns COVID-19 time series data for entire USA, with an entry for each day since the pandemic began.

Parameters:

None

Returns:

A dictionary containing COVID-19 time series data.

Return type:

dict

get_nyt_time_series_covid_data_for_specific_states(states, last_days=30)[source]

Returns COVID-19 time series data for specific state(s), with an entry for each day since the pandemic began.

Parameters:
  • states (str) – State name(s), separated by commas (e.g. ‘Illinois, California’).

  • last_days (int, str) – Number of days’ data to return. Use ‘all’ to return all data. Default is 30.

Returns:

A dictionary containing COVID-19 time series data.

Return type:

dict

get_nyt_time_series_covid_data_for_specific_us_counties(counties, last_days=30)[source]

Returns COVID-19 time series data for specific state(s), with an entry for each day since the pandemic began.

Parameters:
  • states (str) – County name(s), separated by commas (e.g. ‘Alameda, Humboldt’).

  • last_days (int, str) – Number of days’ data to return. Use ‘all’ to return all data. Default is 30.

Returns:

A dictionary containing COVID-19 time series data.

Return type:

dict

get_raps_covid_vaccines_administered_for_all_countries(last_days=30, full_data=False)[source]

Returns Get COVID-19 vaccine doses administered for all countries that have reported rolling out vaccination. Sourced from https://covid.ourworldindata.org/

Parameters:
  • last_data (int, str) – Number of days to return. Use ‘all’ for the full data set (e.g. 15, all, 24

  • full_data (bool) – Flag indicating whether to return data type as simpleVaccineTimeline (false) or fullVaccineTimeline (true).

Returns:

A dictionary containing vaccine administration data.

Return type:

dict

get_raps_covid_vaccines_administered_for_all_states(last_days=30, full_data=False)[source]

Returns Get COVID-19 vaccine doses administered for all states that have reported rolling out vaccination. Sourced from https://covid.ourworldindata.org/

Parameters:
  • last_data (int, str) – Number of days to return. Use ‘all’ for the full data set (e.g. 15, all, 24

  • full_data (bool) – Flag indicating whether to return data type as simpleVaccineTimeline (false) or fullVaccineTimeline (true).

Returns:

A dictionary containing vaccine administration data.

Return type:

dict

get_raps_covid_vaccines_administered_for_country(country, last_days=30, full_data=False)[source]

Returns Get COVID-19 vaccine doses administered for any country that has reported rolling out vaccination. Sourced from https://covid.ourworldindata.org/

Parameters:
  • country (str) – A valid country name, iso2, iso3.

  • last_data (int, str) – Number of days to return. Use ‘all’ for the full data set (e.g. 15, all, 24

  • full_data (bool) – Flag indicating whether to return data type as simpleVaccineTimeline (false) or fullVaccineTimeline (true).

Returns:

A dictionary containing vaccine administration data.

Return type:

dict

get_raps_covid_vaccines_administered_for_state(state, last_days=30, full_data=False)[source]

Returns Get COVID-19 vaccine doses administered for any state that has reported rolling out vaccination. Sourced from https://covid.ourworldindata.org/

Parameters:
  • country (str) – A valid state name

  • last_data (int, str) – Number of days to return. Use ‘all’ for the full data set (e.g. 15, all, 24

  • full_data (bool) – Flag indicating whether to return data type as simpleVaccineTimeline (false) or fullVaccineTimeline (true).

Returns:

A dictionary containing vaccine administration data.

Return type:

dict

get_raps_total_covid_vaccines_administered(last_days=30, full_data=False)[source]

Returns total global COVID-19 vaccine doses administered. Sourced from https://covid.ourworldindata.org.

Parameters:
  • last_data (int, str) – Number of days to return. Use ‘all’ for the full data set (e.g. 15, all, 24

  • full_data (bool) – Flag indicating whether to return data type as simpleVaccineTimeline (false) or fullVaccineTimeline (true).

Returns:

A dictionary containing vaccine administration data.

Return type:

dict

get_worldometers_covid_data_for_all_continents(sort=None, day=0, allow_null=False)[source]

Returns COVID-19 totals for all the continents.

Parameters:
  • sort (str) – Provided a key (e.g. cases, todayCases, deaths, active), result will be sorted from greatest to least. See docs for possible fields to sort by. Default is None.

  • day (int) – Which day’s data to return. Supported values are 0 for today, 1 for yesterday, and 2 for the day before yesterday. Default is 0, today.

  • allow_null (bool) – True if, where the value is 0, null is instead retired. Default is False.

Returns:

A dictionary containing COVID-19 totals for the continents.

Return type:

dict

get_worldometers_covid_data_for_all_countries(sort=None, day=0, allow_null=False)[source]

Returns COVID-19 totals for all the countries.

Parameters:
  • sort (str) – Provided a key (e.g. cases, todayCases, deaths, active), result will be sorted from greatest to least. See docs for possible fields to sort by. Default is None.

  • day (int) – Which day’s data to return. Supported values are 0 for today and 1 for yesterday. Default is 0, today.

  • allow_null (bool) – True if, where the value is 0, null is instead retired. Default is False.

Returns:

A dictionary containing COVID-19 totals for the countries.

Return type:

dict

get_worldometers_covid_data_for_all_states(sort=None, day=0, allow_null=False)[source]

Returns COVID-19 totals for the states.

Parameters:
  • sort (str) – Provided a key (e.g. cases, todayCases, deaths, active), result will be sorted from greatest to least. See docs for possible fields to sort by. Default is None.

  • day (int) – Which day’s data to return. Supported values are 0 for today and 1 for yesterday. Default is 0, today.

  • allow_null (bool) – True if, where the value is 0, null is instead retired. Default is False.

Returns:

A dictionary containing state COVID-19 totals.

Return type:

dict

get_worldometers_covid_data_for_specific_continent(continent, day=0, strict=True, allow_null=False)[source]

Returns COVID-19 totals for the specified continent.

Parameters:
  • continent (str) – Name of the continent, spelled correctly.

  • day (int) – Which day’s data to return. Supported values are 0 for today, 1 for yesterday, and 2 for the day before yesterday. Default is 0, today.

  • strict (bool) – Setting to false gives you the ability to fuzzy search continents (i.e. Oman vs. rOMANia). Default is True.

  • allow_null (bool) – True if, where the value is 0, null is instead retired. Default is False.

Returns:

A dictionary containing COVID-19 totals for specified continent.

Return type:

dict

get_worldometers_covid_data_for_specific_countries(countries, day=0, strict=True, allow_null=False)[source]

Returns COVID-19 totals for the specified countries.

Parameters:
  • countries (str) – Multiple country names, iso2s, iso3s, or country ID codes, separated by commas, non spaces.

  • day (int) – Which day’s data to return. Supported values are 0 for today, 1 for yesterday, and 2 for the day before yesterday. Default is 0, today.

  • strict (bool) – Setting to false gives you the ability to fuzzy search countries (i.e. Oman vs. rOMANia). Default is True.

  • allow_null (bool) – True if, where the value is 0, null is instead retired. Default is False.

Returns:

A dictionary containing COVID-19 totals for specified countries.

Return type:

dict

get_worldometers_covid_data_for_specific_country(country, day=0, strict=True, allow_null=False)[source]

Returns COVID-19 totals for the specified country.

Parameters:
  • country (str) – A country name, iso2, iso3, or country ID code

  • day (int) – Which day’s data to return. Supported values are 0 for today, 1 for yesterday, and 2 for the day before yesterday. Default is 0, today.

  • strict (bool) – Setting to false gives you the ability to fuzzy search countries (i.e. Oman vs. rOMANia). Default is True.

  • allow_null (bool) – True if, where the value is 0, null is instead retired. Default is False.

Returns:

A dictionary containing COVID-19 totals for specified country.

Return type:

dict

get_worldometers_covid_data_for_specific_states(states, day=0, allow_null=False)[source]

Returns COVID-19 totals for the specified state(s).

Parameters:
  • states (str) – State name or comma separated non-spaced names, spelled correctly.

  • day (int) – Which day’s data to return. Supported values are 0 for today and 1 for yesterday. Default is 0, today.

  • allow_null (bool) – True if, where the value is 0, null is instead retired. Default is False.

Returns:

A dictionary containing COVID-19 totals for specified state(s).

Return type:

dict

get_worldometers_global_covid_data(day=0, allow_null=False)[source]

Returns global COVID-19 totals for today, yesterday and two days ago.

Parameters:
  • day (int) – Which day’s data to return. Supported values are 0 for today, 1 for yesterday, and 2 for the day before yesterday. Default is 0, today.

  • allow_null (bool) – True if, where the value is 0, null is instead retired. Default is False.

Returns:

A dictionary containing global COVID-19 totals.

Return type:

dict

Module contents