epidatpy Reference

epidatpy.request module

CovidcastEpidata(base_url='https://api.delphi.cmu.edu/epidata/', session=None, use_cache=None, cache_max_age_days=None)
Parameters:
  • base_url (str) –

  • session (Optional[Session]) –

  • use_cache (Optional[bool]) –

  • cache_max_age_days (Optional[int]) –

Return type:

CovidcastDataSources[EpiDataCall]

class EpiDataCall(base_url, session, endpoint, params, meta=None, only_supports_classic=False, use_cache=None, cache_max_age_days=None)

Bases: AEpiDataCall

epidata call representation

Parameters:
  • base_url (str) –

  • session (Optional[Session]) –

  • endpoint (str) –

  • params (Mapping[str, Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]], None]]) –

  • meta (Optional[Sequence[EpidataFieldInfo]]) –

  • only_supports_classic (bool) –

  • use_cache (Optional[bool]) –

  • cache_max_age_days (Optional[int]) –

classic(fields=None, disable_date_parsing=False, disable_type_parsing=False)

Request and parse epidata in CLASSIC message format.

Parameters:
  • fields (Optional[Sequence[str]]) –

  • disable_date_parsing (Optional[bool]) –

  • disable_type_parsing (Optional[bool]) –

Return type:

EpiDataResponse

df(fields=None, disable_date_parsing=False)

Request and parse epidata as a pandas data frame

Parameters:
  • fields (Optional[Sequence[str]]) –

  • disable_date_parsing (Optional[bool]) –

Return type:

DataFrame

with_base_url(base_url)
Parameters:

base_url (str) –

Return type:

EpiDataCall

with_session(session)
Parameters:

session (Session) –

Return type:

EpiDataCall

class EpiDataContext(base_url='https://api.delphi.cmu.edu/epidata/', session=None, use_cache=None, cache_max_age_days=None)

Bases: AEpiDataEndpoints[EpiDataCall]

sync epidata call class

Parameters:
  • base_url (str) –

  • session (Optional[Session]) –

  • use_cache (Optional[bool]) –

  • cache_max_age_days (Optional[int]) –

with_base_url(base_url)
Parameters:

base_url (str) –

Return type:

EpiDataContext

with_session(session)
Parameters:

session (Session) –

Return type:

EpiDataContext

available_endpoints()

Get a DataFrame of available endpoints and their descriptions.

Return type:

DataFrame

epidatpy._endpoints module

class AEpiDataEndpoints(*args, **kwds)

Bases: ABC, Generic[CALL_TYPE]

epidata endpoint list and fetcher

pub_covid_hosp_facility(hospital_pks, collection_weeks='*', publication_dates=None)

Fetch COVID hospitalization data for specific facilities.

Parameters:
  • hospital_pks (Union[str, Sequence[str]]) –

  • collection_weeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

  • publication_dates (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]], None]) –

Return type:

TypeVar(CALL_TYPE)

pub_covid_hosp_facility_lookup(state=None, ccn=None, city=None, zip=None, fips_code=None)

Lookup COVID hospitalization facility identifiers.

Parameters:
  • state (Optional[str]) –

  • ccn (Optional[str]) –

  • city (Optional[str]) –

  • zip (Optional[str]) –

  • fips_code (Optional[str]) –

Return type:

TypeVar(CALL_TYPE)

pub_covid_hosp_state_timeseries(states, dates='*', issues=None, as_of=None)

Fetch COVID hospitalization data.

Parameters:
  • states (Union[str, Sequence[str]]) –

  • dates (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

  • issues (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]], None]) –

  • as_of (Union[None, int, str]) –

Return type:

TypeVar(CALL_TYPE)

pub_covidcast(data_source, signals, geo_type, time_type, geo_values='*', time_values='*', as_of=None, issues=None, lag=None)

Fetch Delphi’s COVID-19 Surveillance Streams

Parameters:
  • data_source (str) –

  • signals (Union[str, Sequence[str]]) –

  • geo_type (Literal['nation', 'msa', 'hrr', 'hhs', 'state', 'county']) –

  • time_type (Literal['day', 'week']) –

  • geo_values (Union[str, Sequence[str]]) –

  • time_values (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

  • as_of (Union[None, int, str]) –

  • issues (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]], None]) –

  • lag (Optional[int]) –

Return type:

TypeVar(CALL_TYPE)

pub_covidcast_meta()

Fetch COVIDcast surveillance stream metadata.

Obtains a data frame of metadata describing all publicly available data streams from the COVIDcast API. See the data source and signals documentation for descriptions of the available sources.

Return type:

TypeVar(CALL_TYPE)

Returns:

A EpiDataCall object containing the following information:

data_source

Data source name.

signal

Signal name.

time_type

Temporal resolution at which this signal is reported. “day”, for example, means the signal is reported daily.

geo_type

Geographic level for which this signal is available, such as county, state, msa, hss, hrr, or nation. Most signals are available at multiple geographic levels and will hence be listed in multiple rows with their own metadata.

min_time

First day for which this signal is available. For weekly signals, will be the first day of the epiweek.

max_time

Most recent day for which this signal is available. For weekly signals, will be the first day of the epiweek.

num_locations

Number of distinct geographic locations available for this signal. For example, if geo_type is county, the number of counties for which this signal has ever been reported.

min_value

The smallest value that has ever been reported.

max_value

The largest value that has ever been reported.

mean_value

The arithmetic mean of all reported values.

stdev_value

The sample standard deviation of all reported values.

last_update

The UTC datetime for when the signal value was last updated.

max_issue

Most recent date data was issued.

min_lag

Smallest lag from observation to issue, in days.

max_lag

Largest lag from observation to issue, in days.

pub_delphi(system, epiweek)

Fetch Delphi’s forecast.

Parameters:
  • system (str) –

  • epiweek (Union[int, str]) –

Return type:

TypeVar(CALL_TYPE)

pub_dengue_nowcast(locations, epiweeks='*')

Fetch Delphi’s dengue nowcast.

Parameters:
  • locations (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

Return type:

TypeVar(CALL_TYPE)

pub_ecdc_ili(regions, epiweeks='*', issues=None, lag=None)

Fetch ECDC ILI data.

Parameters:
  • regions (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

  • issues (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]], None]) –

  • lag (Optional[int]) –

Return type:

TypeVar(CALL_TYPE)

pub_flusurv(locations, epiweeks='*', issues=None, lag=None)

Fetch FluSurv data.

Parameters:
  • locations (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

  • issues (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]], None]) –

  • lag (Optional[int]) –

Return type:

TypeVar(CALL_TYPE)

pub_fluview(regions, epiweeks='*', issues=None, lag=None, auth=None)
Parameters:
  • regions (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

  • issues (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]], None]) –

  • lag (Optional[int]) –

  • auth (Optional[str]) –

Return type:

TypeVar(CALL_TYPE)

pub_fluview_clinical(regions, epiweeks='*', issues=None, lag=None)

Fetch FluView clinical data.

Parameters:
  • regions (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

  • issues (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]], None]) –

  • lag (Optional[int]) –

Return type:

TypeVar(CALL_TYPE)

pub_fluview_meta()
Return type:

TypeVar(CALL_TYPE)

pub_gft(locations, epiweeks='*')

Fetch Google Flu Trends data.

Parameters:
  • locations (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

Return type:

TypeVar(CALL_TYPE)

pub_kcdc_ili(regions, epiweeks='*', issues=None, lag=None)

Fetch KCDC ILI data.

Parameters:
  • regions (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

  • issues (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]], None]) –

  • lag (Optional[int]) –

Return type:

TypeVar(CALL_TYPE)

pub_meta()

Fetch API metadata.

Return type:

TypeVar(CALL_TYPE)

pub_nidss_dengue(locations, epiweeks='*')

Fetch NIDSS dengue data.

Parameters:
  • locations (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

Return type:

TypeVar(CALL_TYPE)

pub_nidss_flu(regions, epiweeks='*', issues=None, lag=None)

Fetch NIDSS flu data.

Parameters:
  • regions (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

  • issues (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]], None]) –

  • lag (Optional[int]) –

Return type:

TypeVar(CALL_TYPE)

pub_nowcast(locations, epiweeks='*')

Fetch Delphi’s wILI nowcast.

Parameters:
  • locations (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

Return type:

TypeVar(CALL_TYPE)

pub_paho_dengue(regions, epiweeks='*', issues=None, lag=None)

Fetch PAHO Dengue data.

Parameters:
  • regions (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

  • issues (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]], None]) –

  • lag (Optional[int]) –

Return type:

TypeVar(CALL_TYPE)

pub_wiki(articles, time_type, time_values='*', hours=None, language='en')

Fetch Wikipedia access data.

Parameters:
  • articles (Union[str, Sequence[str]]) –

  • time_type (Literal['day', 'week']) –

  • time_values (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

  • hours (Union[int, Sequence[int], None]) –

  • language (str) –

Return type:

TypeVar(CALL_TYPE)

pvt_cdc(auth, locations, epiweeks='*')

Fetch CDC page hits.

Parameters:
  • auth (str) –

  • locations (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

Return type:

TypeVar(CALL_TYPE)

pvt_dengue_sensors(auth, names, locations, epiweeks='*')

Fetch Delphi’s digital surveillance sensors.

Parameters:
  • auth (str) –

  • names (Union[str, Sequence[str]]) –

  • locations (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

Return type:

TypeVar(CALL_TYPE)

pvt_ght(auth, locations, epiweeks='*', query='')

Fetch Google Health Trends data.

Parameters:
  • auth (str) –

  • locations (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

  • query (str) –

Return type:

TypeVar(CALL_TYPE)

pvt_meta_norostat(auth)

Fetch NoroSTAT metadata.

Parameters:

auth (str) –

Return type:

TypeVar(CALL_TYPE)

pvt_norostat(auth, location, epiweeks='*')

Fetch NoroSTAT data (point data, no min/max).

Parameters:
  • auth (str) –

  • location (str) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

Return type:

TypeVar(CALL_TYPE)

pvt_quidel(auth, locations, epiweeks='*')

Fetch Quidel data.

Parameters:
  • auth (str) –

  • locations (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

Return type:

TypeVar(CALL_TYPE)

pvt_sensors(auth, names, locations, epiweeks='*')

Fetch Delphi’s digital surveillance sensors.

Parameters:
  • auth (str) –

  • names (Union[str, Sequence[str]]) –

  • locations (Union[str, Sequence[str]]) –

  • epiweeks (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

Return type:

TypeVar(CALL_TYPE)

pvt_twitter(auth, locations, time_type, time_values='*')

Fetch HealthTweets data.

Parameters:
  • auth (str) –

  • locations (Union[str, Sequence[str]]) –

  • time_type (Literal['day', 'week']) –

  • time_values (Union[int, str, EpiRange, EpiRangeDict, date, Week, Sequence[Union[int, str, EpiRange, EpiRangeDict, date, Week]]]) –

Return type:

TypeVar(CALL_TYPE)