diff --git a/docs/api/01meta.md b/docs/api/01meta.md index 803a0a9e1..6b013216e 100644 --- a/docs/api/01meta.md +++ b/docs/api/01meta.md @@ -1,8 +1,7 @@ --- -title: inactive Epidata Metadata -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: Epidata Metadata permalink: api/meta.html --- @@ -18,13 +17,13 @@ General topics not specific to any particular endpoint are discussed in the ## API Metadata -... +Overview of the current state of the database, including the latest update times and data volume for specific endpoints. # The API -The base URL is: https://api.delphi.cmu.edu/epidata/meta/ +The base URL is: -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +See [this documentation](date_formats.md) for details on specifying epiweeks, dates, and lists. ## Parameters @@ -36,12 +35,15 @@ None. |-----------|-----------------------------------------------------------------|------------------| | `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | | `epidata` | list of results | array of objects | -| ... | ... | ... | +| `epidata[].fluview` | Metadata for [FluView](fluview.md) | array of objects | +| `epidata[].twitter` | Metadata for [Twitter](twitter.md) | array of objects | +| `epidata[].wiki` | Metadata for [Wikipedia](wiki.md) | array of objects | +| `epidata[].delphi` | Metadata for [Delphi Forecasts](delphi.md) | array of objects | | `message` | `success` or error message | string | # Example URLs -https://api.delphi.cmu.edu/epidata/meta/ + ```json { @@ -108,4 +110,101 @@ https://api.delphi.cmu.edu/epidata/meta/ # Code Samples - +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch API metadata. + +
+
+ + + +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_meta() +print(res) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pub_meta() +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
+ +Optionally install the package using pip(env): +```bash +pip install delphi-epidata +``` + +Otherwise, place `delphi_epidata.py` from this repo next to your python script. + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.meta() +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$meta() +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
+ +
diff --git a/docs/api/README.md b/docs/api/README.md index 6f38d8cf6..b5e75620d 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -40,7 +40,7 @@ like to cite it, we would gratefully recommend the following copy: > Roni Rosenfeld > (2015). > _Delphi Epidata API_. -> https://github.com/cmu-delphi/delphi-epidata +> ## Data Licensing @@ -71,23 +71,16 @@ Please note that our `endpoint` parameters were previously referenced as `source # The API -The base URL is: https://api.delphi.cmu.edu/epidata/ +The base URL is: ## Specifying Epiweeks, Dates, and Lists -Epiweeks use the U.S. definition. That is, the first epiweek each year is the -week, starting on a Sunday, containing January 4. See -[this page](https://www.cmmcp.org/mosquito-surveillance-data/pages/epi-week-calendars-2008-2020) -for more information. - Formatting for epiweeks is YYYYWW and for dates is YYYYMMDD. -`list` parameters consist of a comma-separated list of individual values or, for numeric parameters, a hyphenated range of values. Examples include: - - `param=201530` *(A single epiweek)* - - `param=201401,201501,201601` *(Several epiweeks)* - - `param=200501-200552` *(A range of epiweeks)* - - `param=201440,201501-201510` *(Several epiweeks, including a range)* - - `param=20070101-20071231` *(A range of dates)* +See [Date Formats](date_formats.html) for full details on specifying epiweeks, dates, lists, and ranges. + +`list` parameters consist of a comma-separated list of individual values or, for numeric parameters, a hyphenated range of values. + ## Universal Parameters @@ -111,13 +104,13 @@ The parameters available for each source are documented in each linked source-sp | Endpoint | Name | Description | Restricted? | | --- | --- | --- | --- | -| [`cdc`](cdc.md) | CDC Page Hits | ... | yes | -| [`delphi`](delphi.md) | Delphi's Forecast | ... | no | +| [`cdc`](cdc.md) | CDC Page Hits | CDC total and by topic webpage visits. | yes | +| [`delphi`](delphi.md) | Delphi's Forecast | Delphi's ILINet outpatient doctor visits forecasts. | no | | [`ecdc_ili`](ecdc_ili.md) | ECDC ILI | ECDC ILI data from the ECDC website. | no | | [`flusurv`](flusurv.md) | FluSurv | FluSurv-NET data (flu hospitaliation rates) from CDC. | no | | [`fluview`](fluview.md) | FluView | Influenza-like illness (ILI) from U.S. Outpatient Influenza-like Illness Surveillance Network (ILINet). | no | | [`fluview_meta`](fluview_meta.md) | FluView Metadata | Summary data about [`fluview`](fluview.md). | no | -| [`fluview_clinical`](fluview_clinical.md) | FluView Clinical | ... | no | +| [`fluview_clinical`](fluview_clinical.md) | FluView Clinical | Clinical flu data. | no | | [`gft`](gft.md) | Google Flu Trends | Estimate of influenza activity based on volume of certain search queries. Google has discontinued Flu Trends, and this is now a static endpoint. | no | | [`ght`](ght.md) | Google Health Trends | Estimate of influenza activity based on volume of certain search queries. | yes | | [`kcdc_ili`](kcdc_ili.md) | KCDC ILI | KCDC ILI data from KCDC website. | no | @@ -125,7 +118,7 @@ The parameters available for each source are documented in each linked source-sp | [`nidss_flu`](nidss_flu.md) | NIDSS Flu | Outpatient ILI from Taiwan's National Infectious Disease Statistics System (NIDSS). | no | | [`nowcast`](nowcast.md) | ILI Nearby | A nowcast of U.S. national, regional, and state-level (weighted) percent ILI, available seven days (regionally) or five days (state-level) before the first ILINet report for the corresponding week. | no | | [`quidel`](quidel.md) | Quidel | Data provided by Quidel Corp., which contains flu lab test results. | yes | -| [`sensors`](sensors.md) | Delphi's Digital Surveillance Sensors | ... | no | +| [`sensors`](sensors.html) | Delphi's Digital Surveillance Sensors | Influenza and dengue digital surveillance sensors. | partially | | [`twitter`](twitter.md) | Twitter Stream | Estimate of influenza activity based on analysis of language used in tweets from [HealthTweets](http://HealthTweets.org/). | yes | | [`wiki`](wiki.md) | Wikipedia Access Logs | Number of page visits for selected English, Influenza-related wikipedia articles. | no | @@ -133,17 +126,17 @@ The parameters available for each source are documented in each linked source-sp | Endpoint | Name | Description | Restricted? | | --- | --- | --- | --- | -| [`dengue_nowcast`](dengue_nowcast.md) | Delphi's Dengue Nowcast | ... | ... | -| [`dengue_sensors`](dengue_sensors.md) | Delphi's Dengue Digital Surveillance Sensors | ... | ... | -| [`nidss_dengue`](nidss_dengue.md) | NIDSS Dengue | Counts of confirmed dengue cases from Taiwan's NIDSS. | no | -| [`paho_dengue`](paho_dengue.md) | PAHO Dengue | ... | ... | +| [`dengue_nowcast`](dengue_nowcast.md) | Delphi's Dengue Nowcast | Delphi's PAHO dengue nowcasts (North and South America). | no | +| [`dengue_sensors`](dengue_sensors.md) | Delphi's Dengue Digital Surveillance Sensors | PAHO dengue digital surveillance sensors (North and South America). | yes | +| [`nidss_dengue`](nidss_dengue.md) | NIDSS Dengue | NIDSS dengue cases (Taiwan). | no | +| [`paho_dengue`](paho_dengue.md) | PAHO Dengue | PAHO dengue data (North and South America). | no | ### Norovirus Data | Endpoint | Name | Description | Restricted? | | --- | --- | --- | --- | -| [`meta_norostat`](meta_norostat.md) | NoroSTAT Metadata | ... | ... | -| [`norostat`](norostat.md) | NoroSTAT | Suspected and confirmed norovirus outbreaks reported by state health departments to the CDC. | ... | +| [`meta_norostat`](meta_norostat.md) | NoroSTAT Metadata | Metadata for the NoroSTAT endpoint. | yes | +| [`norostat`](norostat.md) | NoroSTAT | CDC NoroSTAT norovirus outbreaks. | yes | ### Deprecated * `ilinet` - replaced by [`fluview`](fluview.md) @@ -153,7 +146,7 @@ The parameters available for each source are documented in each linked source-sp # Example URLs ### FluView on 2015w01 (national) -https://api.delphi.cmu.edu/epidata/fluview/?regions=nat&epiweeks=201501 + ```json { @@ -183,7 +176,7 @@ https://api.delphi.cmu.edu/epidata/fluview/?regions=nat&epiweeks=201501 ``` ### Wikipedia Access article "influenza" on 2020w01 -https://api.delphi.cmu.edu/epidata/wiki/?language=en&articles=influenza&epiweeks=202001 + ```json { @@ -204,7 +197,7 @@ https://api.delphi.cmu.edu/epidata/wiki/?language=en&articles=influenza&epiweeks # Code Samples -To access our Epidata API, visit our [Epidata API Client Libraries)](client_libraries.md). For anyone looking for COVIDCast data in particular, please visit our purpose-built [COVIDCast Libraries](covidcast_clients.md) instead. +To access our Epidata API, visit our [Epidata API Client Libraries](client_libraries.md). For anyone looking for COVIDCast data in particular, please visit our purpose-built [COVIDCast Libraries](covidcast_clients.md) instead. # Related Work diff --git a/docs/api/cdc.md b/docs/api/cdc.md index 29ae7ebe8..6fc46f2ef 100644 --- a/docs/api/cdc.md +++ b/docs/api/cdc.md @@ -1,53 +1,218 @@ --- -title: inactive CDC -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: CDC Webpage Visits --- # CDC +{: .no_toc} -This is the API documentation for accessing the CDC (`cdc`) endpoint of -[Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `cdc` | +| **Data Source** | US Centers for Disease Control (CDC) site statistics | +| **Geographic Levels** | National, Department of Health & Human Services (HHS) Regions, Census Divisions, State (see [Geographic Codes](geographic_codes.md)) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2020w03 (2020-01-12) | +| **Temporal Scope Start** | 2013w02 (2013-01-06) | +| **License** | Permission by CDC flu division | + +## Overview +{: .no_toc} + +This data source tracks public interest in influenza by counting visits to specific informational pages on the CDC website. Delphi receives server log summaries directly from the CDC, which count page hits for key topics such as 'Flu Symptoms & Severity', 'How Flu Spreads', and 'What To Do If You Get Sick'. These counts act as a proxy for information-seeking behavior related to the flu. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## CDC Data +{: .note} +> **Note:** Restricted access: This endpoint requires authentication. -... +## Table of contents +{: .no_toc .text-delta} -# The API +1. TOC +{:toc} -The base URL is: https://api.delphi.cmu.edu/epidata/cdc/ +## Estimation -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +This endpoint exposes raw aggregation of server logs. -## Parameters +The endpoint consists of page hit counts for specific CDC informational pages. -### Required +| Field | Description | +|:---|:---| +| `num1` | hits for 'What You Should Know for the ... Influenza Season' | +| `num2` | hits for 'What To Do If You Get Sick' | +| `num3` | hits for 'Flu Symptoms & Severity' | +| `num4` | hits for 'How Flu Spreads' | +| `num5` | hits for 'What You Should Know About Flu Antiviral Drugs' | +| `num6` | hits for 'Weekly US Map' | +| `num7` | hits for 'Basics' | +| `num8` | hits for 'Flu Activity & Surveillance' | +| `total` | total number of hits for all CDC pages | -| Parameter | Description | Type | -| --- | --- | --- | -| `auth` | password | string | -| `epiweeks` | epiweeks | `list` of epiweeks | -| `locations` | locations | `list` of [region](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/regions.txt)/[state](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/states.txt) labels | + -## Response +### Proxy Nature +These signals represent information-seeking behavior (internet searches/page visits), which may not perfectly correlate with clinical influenza burden. Media events or public panic can drive spikes in traffic unrelated to actual disease prevalence. -| Field | Description | Type | -|-----------|-----------------------------------------------------------------|------------------| -| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | -| `epidata` | list of results | array of objects | -| ... | ... | ... | -| `message` | `success` or error message | string | +## The API -# Example URLs +The base URL is: - -# Code Samples +### Parameters + +#### Required + +| Parameter | Description | Type | +| --- | --- | --- | +| `auth` | password | string | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `locations` | locations | `list` of location codes: `nat` (national), HHS regions (`hhs1`-`hhs10`), Census divisions (`cen1`-`cen9`), or state codes (see [Geographic Codes](geographic_codes.md#us-regions-and-states)) | + +### Response + +| Field | Description | Type | +|-----------------------|-----------------------------------------------------------------|------------------| +| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | +| `epidata` | list of results | array of objects | +| `epidata[].location` | location label | string | +| `epidata[].epiweek` | epiweek | integer | +| `epidata[].num(1-8)` | number of page hits for specific pages (see [Signal Data Sources](#signal-data-sources)) | integer | +| `epidata[].total` | total page hits across all datasources | integer | +| `epidata[].value` | computed value (may be null) | float or null | +| `message` | `success` or error message | string | + +## Example URLs + +### CDC Page Hits on 2015w01 (national) + + +```json +{ + "result": 1, + "epidata": [ + { + "location": "nat", + "epiweek": 201501, + "num1": 91858, + "num2": 81121, + "num3": 89511, + "num4": 52278, + "num5": 16219, + "num6": 87327, + "num7": 38310, + "num8": 51461, + "total": 4252190, + "value": null + } + ], + "message": "success" +} +``` + +## Code Samples + +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch `cdc` data at the national level for epiweek `201501`. + +
+
+ + + +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pvt_cdc(auth='auth_token', locations=['nat'], epiweeks=[201501]) +print(res) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pvt_cdc(auth = 'auth_token', locations = 'nat', epiweeks = 201501) +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
+ +Optionally install the package using pip(env): +```bash +pip install delphi-epidata +``` + +Otherwise, place `delphi_epidata.py` from this repo next to your python script. + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.cdc('auth_token', [201501], ['nat']) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$cdc(auth = "auth_token", epiweeks = list(201501), locations = list("nat")) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
- +
diff --git a/docs/api/covid_hosp.md b/docs/api/covid_hosp.md index 372402e5b..1ab1545b4 100644 --- a/docs/api/covid_hosp.md +++ b/docs/api/covid_hosp.md @@ -1,17 +1,27 @@ --- -title: inactive COVID-19 Reported Patient Impact and Hospital Capacity by State Timeseries -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: COVID-19 Reported Patient Impact and Hospital Capacity by State Timeseries --- # COVID-19 Hospitalization by State +{: .no_toc} -This data source is a mirror of the "COVID-19 Reported Patient Impact and -Hospital Capacity by State Timeseries" and "COVID-19 Reported Patient Impact and -Hospital Capacity by State" datasets provided by the US Department of -Health & Human Services via healthdata.gov. The latter provides more frequent updates, -so it is combined with the former to create a single dataset which is as recent as possible. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `covid_hosp_state_timeseries` | +| **Data Source** | [US Department of Health & Human Services](https://healthdata.gov/Hospital/COVID-19-Reported-Patient-Impact-and-Hospital-Capa/g62h-syeh) | +| **Geographic Levels** | US States plus DC, PR, and VI (see [Geographic Codes](geographic_codes.md#us-states-and-territories)) | +| **Temporal Granularity** | Daily | +| **Reporting Cadence** | Inactive - No longer updated since 2024-04-27 | +| **Temporal Scope Start** | 2020-01-01 | +| **License** | [Public Domain US Government](https://www.usa.gov/government-works) | + +## Overview +{: .no_toc} + +This dataset provides daily surveys of hospital COVID-19 capacity and patient impact, as reported by US hospitals. Data is acquired from HealthData.gov. It is a mirror of the "COVID-19 Reported Patient Impact and Hospital Capacity by State Timeseries" and "COVID-19 Reported Patient Impact and Hospital Capacity by State" datasets provided by HHS via healthdata.gov. The latter provides more frequent updates, so it is combined with the former to create a single dataset which is as recent as possible. HHS performs up to four days of forward-fill for missing values in the [facility-level data](covid_hosp_facility.md) which are aggregated to make this @@ -34,23 +44,16 @@ General topics not specific to any particular data source are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing) and [citing](README.md#citing). -## Metadata +## Table of contents +{: .no_toc .text-delta} -This data source provides various measures of COVID-19 burden on patients and healthcare in the US. -- Data source: US Department of Health & Human Services (HHS) [COVID-19 Reported Patient Impact and -Hospital Capacity by State Timeseries](https://healthdata.gov/Hospital/COVID-19-Reported-Patient-Impact-and-Hospital-Capa/g62h-syeh) (published weekly) - and [COVID-19 Reported Patient Impact and Hospital Capacity by State](https://healthdata.gov/dataset/COVID-19-Reported-Patient-Impact-and-Hospital-Capa/6xf2-c3ie) (published on an irregular schedule, every 1-6 days) -- Temporal Resolution: Daily, starting 2020-01-01 -- Spatial Resolution: US States plus DC, PR, and VI -- Open Access: [Public Domain US Government](https://www.usa.gov/government-works) -- Versioned by Delphi according to "issue" date, which is the date that the -dataset was published by HHS. +1. TOC +{:toc} # The API -The base URL is: https://api.delphi.cmu.edu/epidata/covid_hosp_state_timeseries/ +The base URL is: -See [this documentation](README.md) for details on specifying locations and dates. ## Parameters @@ -58,14 +61,14 @@ See [this documentation](README.md) for details on specifying locations and date | Parameter | Description | Type | |-----------|--------------------------------|--------------------------------| -| `states` | two-letter state abbreviations | `list` of states | -| `dates` | dates | `list` of dates or date ranges | +| `states` | two-letter state abbreviations (see [Geographic Codes](geographic_codes.md#us-states-and-territories)) | `list` of states | +| `dates` | dates (see [Date Formats](date_formats.md)) | `list` of dates or date ranges | ### Optional | Parameter | Description | Type | |-----------|-------------|----------------------------------------| -| `issues` | issues | `list` of "issue" dates or date ranges | +| `issues` | issues (see [Date Formats](date_formats.md)) | `list` of "issue" dates or date ranges | If `issues` is not specified, then the most recent issue is used by default. @@ -84,7 +87,7 @@ If `issues` is not specified, then the most recent issue is used by default. # Example URLs ### MA on 2020-05-10 (per most recent issue) -https://api.delphi.cmu.edu/epidata/covid_hosp_state_timeseries/?states=MA&dates=20200510 + ```json { @@ -218,11 +221,56 @@ https://api.delphi.cmu.edu/epidata/covid_hosp_state_timeseries/?states=MA&dates= # Code Samples -Libraries are available for [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js), [Python](https://pypi.org/project/delphi-epidata/), and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). The following sample shows how to import the library and fetch MA on 2020-05-10 (per most recent issue). -### Python +
+
+ + +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_covid_hosp(states="MA", dates=20200510) +print(res) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pub_covid_hosp_state_timeseries(states = "MA", dates = 20200510) +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/) and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). + +
+
+ + +
+ +
Optionally install the package using pip(env): ```bash @@ -260,3 +308,19 @@ The following issues were repaired: These issues had been imported using the wrong column order due to an imprecise database migration. If you pulled these issues before January 22, you will want to discard that data. +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$covid_hosp(states = list("MA"), dates = list(20200510)) +print(res$message) +print(length(res$epidata)) +``` +
+ +
diff --git a/docs/api/covid_hosp_facility.md b/docs/api/covid_hosp_facility.md index 3cca8b20a..828e4eceb 100644 --- a/docs/api/covid_hosp_facility.md +++ b/docs/api/covid_hosp_facility.md @@ -1,15 +1,27 @@ --- -title: inactive COVID-19 Reported Patient Impact and Hospital Capacity by Facility -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: COVID-19 Reported Patient Impact and Hospital Capacity by Facility --- # COVID-19 Hospitalization by Facility +{: .no_toc} -This data source is a mirror of the "COVID-19 Reported Patient Impact and -Hospital Capacity by Facility" dataset provided by the US Department of Health -& Human Services via healthdata.gov. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `covid_hosp_facility` | +| **Data Source** | [US Department of Health & Human Services](https://healthdata.gov/Hospital/COVID-19-Reported-Patient-Impact-and-Hospital-Capa/anag-cw7u) | +| **Geographic Levels** | Healthcare Facility (see [HealthData.gov](https://healthdata.gov/Hospital/COVID-19-Reported-Patient-Impact-and-Hospital-Capa/anag-cw7u) or [Facility Lookup](covid_hosp_facility_lookup.md)) | +| **Temporal Granularity** | Weekly (Friday -- Thursday) | +| **Reporting Cadence** | Inactive - No longer updated since 2024w08 | +| **Temporal Scope Start** | 2020-07-31 | +| **License** | [Public Domain US Government](https://www.usa.gov/government-works) | + +## Overview +{: .no_toc} + +This dataset provides facility-level daily surveys of hospital COVID-19 capacity and patient impact. Data is acquired from HealthData.gov. It is a mirror of the "COVID-19 Reported Patient Impact and Hospital Capacity by Facility" dataset provided by HHS via healthdata.gov. HHS performs up to four days of forward-fill for missing values. @@ -26,20 +38,15 @@ General topics not specific to any particular data source are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing) and [citing](README.md#citing). -## Metadata +## Table of contents +{: .no_toc .text-delta} -This data source provides various measures of COVID-19 burden on patients and healthcare in the US. -- Data source: [US Department of Health & Human Services](https://healthdata.gov/Hospital/COVID-19-Reported-Patient-Impact-and-Hospital-Capa/anag-cw7u) (HHS) -- Geographic resolution: healthcare facility (address, city, zip, fips) -- Temporal resolution: weekly (Friday -- Thursday) -- First week: 2020-07-31 -- Open Access: [Public Domain US Government](https://www.usa.gov/government-works) -- Versioned by Delphi according to the date that the dataset was published by -HHS. New versions are expected to be published roughly weekly. +1. TOC +{:toc} # The API -The base URL is: https://api.delphi.cmu.edu/epidata/covid_hosp_facility/ +The base URL is: See [this documentation](README.md) for details on specifying locations and dates. @@ -52,14 +59,14 @@ See [this documentation](README.md) for details on specifying locations and date | `hospital_pks` | facility unique identifiers | `list` of identifiers | | `collection_weeks` | dates | `list` of dates or date ranges | -NOTE: The companion -[`covid_hosp_facility_lookup` endpoint](covid_hosp_facility_lookup.md) can be -used to lookup facility identifiers in a variety of ways. -NOTE: A collection week spans Friday -- Thursday, and weeks are identified by -the date corresponding to the Friday at the start of the week. Therefore, the -`collection_weeks` parameter is formatted as a `YYYYMMDD` date (or list of -dates) rather than an "epiweek" as in other endpoints. +{: .note} +> **NOTES:** +> - The companion [`covid_hosp_facility_lookup` endpoint](covid_hosp_facility_lookup.md) can be used to lookup facility identifiers in a variety of ways. +> - A collection week spans Friday -- Thursday, and weeks are identified by +> the date corresponding to the Friday at the start of the week. Therefore, the +> `collection_weeks` parameter is formatted as a `YYYYMMDD` date (or list of +> dates) rather than an "epiweek" as in other endpoints. ### Optional @@ -70,9 +77,10 @@ dates) rather than an "epiweek" as in other endpoints. If `publication_dates` is not specified, then the most recent issue is used by default. -NOTE: The `publication_dates` parameter is semantically equivalent to the -`issues` parameter in the related [`covid_hosp` endpoint](covid_hosp.md). It -has been renamed here for clarity. +{: .note} +> **NOTE:** The `publication_dates` parameter is semantically equivalent to the +> `issues` parameter in the related [`covid_hosp` endpoint](covid_hosp.md). It +> has been renamed here for clarity. ## Response @@ -89,7 +97,7 @@ has been renamed here for clarity. # Example URLs ### Moses Taylor Hospital (Scranton, PA) on the first collection week of December 2020 (per most recent issue) -https://api.delphi.cmu.edu/epidata/covid_hosp_facility/?hospital_pks=390119&collection_weeks=20201201-20201207 + ```json { @@ -199,24 +207,85 @@ https://api.delphi.cmu.edu/epidata/covid_hosp_facility/?hospital_pks=390119&coll # Code Samples -Libraries are available for [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js), [Python](https://pypi.org/project/delphi-epidata/), and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). The following sample shows how to import the library and fetch Moses Taylor Hospital (Scranton, PA) on the first collection week of December 2020 (per most recent issue). -### Python +
+
+ + +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_covid_hosp_facility(hospital_pks="390119", collection_weeks=EpiRange(20201201, 20201207)) +print(res) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pub_covid_hosp_facility(hospital_pks = "390119", collection_weeks = epirange(20201201, 20201207)) +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/) and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). + +
+
+ + +
+ +
Optionally install the package using pip(env): -````bash +```bash pip install delphi-epidata -```` +``` Otherwise, place `delphi_epidata.py` from this repo next to your python script. -````python +```python # Import from delphi_epidata import Epidata # Fetch data res = Epidata.covid_hosp_facility('390119', Epidata.range(20201201, 20201207)) print(res['result'], res['message'], len(res['epidata'])) -```` +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$covid_hosp_facility(hospital_pks = list("390119"), collection_weeks = list(Epidata$range(20201201, 20201207))) +print(res$message) +print(length(res$epidata)) +``` +
+ +
diff --git a/docs/api/covid_hosp_facility_lookup.md b/docs/api/covid_hosp_facility_lookup.md index 98356d0cd..bde9141c6 100644 --- a/docs/api/covid_hosp_facility_lookup.md +++ b/docs/api/covid_hosp_facility_lookup.md @@ -1,19 +1,31 @@ --- -title: inactive COVID-19 Reported Patient Impact and Hospital Capacity - Facility lookup -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: COVID-19 Reported Patient Impact and Hospital Capacity - Facility lookup --- # COVID-19 Hospitalization: Facility Lookup +{: .no_toc} -This endpoint is a companion to the -[`covid_hosp_facility` endpoint](covid_hosp_facility.md). It provides a way to -find unique identifiers and other metadata for facilities of interest. -Metadata is derived from the "COVID-19 Reported Patient Impact and Hospital -Capacity by Facility" dataset provided by the US Department of Health & Human -Services via healthdata.gov. +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `covid_hosp_facility_lookup` | +| **Data Source** | [US Department of Health & Human Services](https://healthdata.gov/Hospital/COVID-19-Reported-Patient-Impact-and-Hospital-Capa/anag-cw7u) | +| **Geographic Levels** | Healthcare Facility ([State](geographic_codes.md#us-states-and-territories), CCN, City, Zip, FIPS) | +| **Reporting Cadence** | Inactive - No longer updated since 2024w08 | +| **License** | [Public Domain US Government](https://www.usa.gov/government-works) | + + + +## Overview +{: .no_toc} + +This endpoint is a companion to the [`covid_hosp_facility` endpoint](covid_hosp_facility.md). It provides a way to find unique identifiers and other metadata for facilities of interest. +A total of 4922 facilities are included. + +Metadata is derived from the "COVID-19 Reported Patient Impact and Hospital Capacity by Facility" dataset provided by HHS via healthdata.gov. See the [official description and data dictionary at healthdata.gov](https://healthdata.gov/Hospital/COVID-19-Reported-Patient-Impact-and-Hospital-Capa/anag-cw7u) @@ -23,32 +35,34 @@ General topics not specific to any particular data source are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing) and [citing](README.md#citing). -## Metadata +## Table of contents +{: .no_toc .text-delta} -This data source provides metadata about healthcare facilities in the US. -- Data source: [US Department of Health & Human Services](https://healthdata.gov/Hospital/COVID-19-Reported-Patient-Impact-and-Hospital-Capa/anag-cw7u) (HHS) -- Total number of facilities: 4922 -- Open Access: [Public Domain US Government](https://www.usa.gov/government-works) +1. TOC +{:toc} # The API -The base URL is: https://api.delphi.cmu.edu/epidata/covid_hosp_facility_lookup/ +The base URL is: See [this documentation](README.md) for details on specifying locations and dates. ## Parameters +### Required + | Parameter | Description | Type | |-------------|-----------------------------------|--------| -| `state` | two-letter state abbreviation | string | +| `state` | two-letter state abbreviation (see [Geographic Codes](geographic_codes.md#us-states-and-territories)) | string | | `ccn` | facility CMS Certification Number | string | | `city` | city name | string | | `zip` | 5-digit ZIP code | string | | `fips_code` | 5-digit FIPS county code | string | -NOTE: Exactly one of the above parameters must be present in requests. -Combinations of parameters (e.g. specifying both `city` and `state`) are not -supported. +{: .note} +> **NOTE:** Exactly one of the above parameters must be present in requests. +> Combinations of parameters (e.g. specifying both `city` and `state`) are not +> supported. ## Response @@ -74,7 +88,7 @@ Use the `hospital_pk` value when querying # Example URLs ### Lookup facilities in the city of Southlake (TX) -https://api.delphi.cmu.edu/epidata/covid_hosp_facility_lookup/?city=southlake + ```json { @@ -112,23 +126,84 @@ https://api.delphi.cmu.edu/epidata/covid_hosp_facility_lookup/?city=southlake # Code Samples -Libraries are available for [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js), [Python](https://pypi.org/project/delphi-epidata/), and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). The following sample shows how to import the library and fetch facilities in the city of Southlake (TX). -### Python +
+
+ + +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_covid_hosp_facility_lookup(city="southlake") +print(res) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pub_covid_hosp_facility_lookup(city = "southlake") +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/) and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). + +
+
+ + +
+ +
Optionally install the package using pip(env): -````bash +```bash pip install delphi-epidata -```` +``` Otherwise, place `delphi_epidata.py` from this repo next to your python script. -````python +```python # Import from delphi_epidata import Epidata # Fetch data res = Epidata.covid_hosp_facility_lookup(city='southlake') print(res['result'], res['message'], len(res['epidata'])) -```` +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$covid_hosp_facility_lookup(city = "southlake") +print(res$message) +print(length(res$epidata)) +``` +
+ +
diff --git a/docs/api/date_formats.md b/docs/api/date_formats.md new file mode 100644 index 000000000..e754ef73d --- /dev/null +++ b/docs/api/date_formats.md @@ -0,0 +1,53 @@ +--- +title: Date Formats +parent: Other Endpoints (COVID-19 and Other Diseases) +nav_order: 901 +--- + +# Date Formats +{: .no_toc} + +This page documents the valid date and time formats accepted by various API endpoints. + +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Epiweeks + +Epiweeks (Epidemiological Weeks) use the [U.S. CDC definition](https://ndc.services.cdc.gov/wp-content/uploads/MMWR_week_overview.pdf). That is, the first epiweek each year is the week, starting on a Sunday, that contains January 4. + +**Format:** `YYYYWW` +* `YYYY`: Four-digit year +* `WW`: Two-digit week (01-53) + +Example: `201501` represents the first epiweek of 2015. + +See [this page](https://www.cmmcp.org/mosquito-surveillance-data/pages/epi-week-calendars-2008-2020) for more information and calendars. + +## Dates + +Dates generally follow the ISO 8601 basic format, but without hyphens. + +**Format:** `YYYYMMDD` +* `YYYY`: Four-digit year +* `MM`: Two-digit month (01-12) +* `DD`: Two-digit day (01-31) + +Example: `20150201` represents February 1st, 2015. + +## Specifying Lists and Ranges + +Many API parameters accept lists of values or ranges. + +`list` parameters consist of a comma-separated list of individual values or, for numeric parameters (like epiweeks or dates), a hyphenated range of values. + +**Examples:** + +* **Single Value:** `param=201530` +* **List of Values:** `param=201401,201501,201601` +* **Range:** `param=200501-200552` +* **Mixed List and Range:** `param=201440,201501-201510` +* **Date Range:** `param=20070101-20071231` diff --git a/docs/api/delphi.md b/docs/api/delphi.md index dae9c672b..3d8422b20 100644 --- a/docs/api/delphi.md +++ b/docs/api/delphi.md @@ -1,40 +1,67 @@ --- -title: inactive Delphi Forecasts -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: Delphi Forecasts --- # Delphi Forecasts +{: .no_toc} -This is the documentation of the API for accessing the Delphi Forecast (`delphi`) endpoint of -the [Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `delphi` | +| **Data Source** | [Delphi](https://delphi.cmu.edu/) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Systems available** | `af`, `eb`, `ec`, `sp`, `st` (see [details below](#forecasting-systems)) | +| **Reporting Cadence** | Inactive - No longer updated since 2020w19 | +| **Temporal Scope Start** | Varies by system (earliest 2014w41) | +| **License** | [CC BY](https://creativecommons.org/licenses/by/4.0/) | + +## Overview +{: .no_toc} + +This data source provides access to experimental and retrospective Delphi forecasting systems and nowcasting outputs. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## Delphi Forecast Data +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Forecasting Systems + +The following systems are available, representing different forecasting models for ILINet % weighted ILI: -... +| Code | Name | +| :--- | :--- | +| `af` | [Archefilter](http://reports-archive.adm.cs.cmu.edu/anon/cbd/CMU-CB-16-101.pdf#Appendix.1.B) | +| `eb` | [Empirical Bayes](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1004382) | +| `ec` | [Epicast](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005248) | +| `sp` | [Pinned Spline](http://reports-archive.adm.cs.cmu.edu/anon/cbd/CMU-CB-16-101.pdf#Appendix.1.A) | +| `st` | [Delphi-Stat](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1006134) | -# The API -The base URL is: https://api.delphi.cmu.edu/epidata/delphi/ +## The API -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +The base URL is: -## Parameters -### Required +### Parameters + +#### Required | Parameter | Description | Type | |-----------|-------------|--------------------------------------| -| `system` | system | system name from (...) | -| `epiweek` | epiweek | epiweek when forecast was made | +| `system` | system | system name (`af`, `eb`, `ec`, `sp`, `st`) | +| `epiweek` | epiweek (see [Date Formats](date_formats.html)) | epiweek when forecast was made | -## Response +### Response | Field | Description | Type | | --- | --- | --- | @@ -43,24 +70,33 @@ See [this documentation](README.md) for details on specifying epiweeks, dates, a | `epidata[].system` | system | string | | `epidata[].epiweek` | epiweek | integer | | `epidata[].forecast` | forecast structure | object | -| `epidata[].forecast.season` | year (yyyy) | integer | -| `epidata[].forecast.ili_bins` | | integer | +| `epidata[].forecast._version` | forecast version | integer | +| `epidata[].forecast.baselines` | baseline values for each region (see [Note below](#cdc-ili-baseline)) | object | +| `epidata[].forecast.baselines.` | CDC %ILI baseline for \ (see [Note below](#cdc-ili-baseline)) | float | | `epidata[].forecast.data` | forecast data for each region | object | | `epidata[].forecast.data.` | forecast data for \ | object | | `epidata[].forecast.data..` | distribution for \ (`peak`, `peakweek`, `onset`, `x1`, `x2`, `x3`, `x4`) | object | -| ... | ... | ... | -| `epidata[].forecast.name` | name = "delphi-epicast" | string | -| `epidata[].forecast.year_weeks` | number of weeks in year | integer | -| `epidata[].forecast.ili_bin_size` | float | -| `epidata[].forecast.season_weeks` | number of weeks in season | integer | -| `epidata[].forecast._version` | forecast version | integer | +| `epidata[].forecast.data...dist` | probability distribution | array of float | +| `epidata[].forecast.data...point` | point estimate | float | +| `epidata[].forecast.data...none` | probability of "none" (if applicable) | float | | `epidata[].forecast.epiweek` | forecast epiweek | integer | +| `epidata[].forecast.ili_bin_size` | size of ILI bins | float | +| `epidata[].forecast.ili_bins` | number of ILI bins | integer | +| `epidata[].forecast.name` | system name | string | +| `epidata[].forecast.season` | season year (yyyy) | integer | +| `epidata[].forecast.season_weeks` | number of weeks in season | integer | +| `epidata[].forecast.year_weeks` | number of weeks in year | integer | | `message` | `success` or error message | string | -# Example URLs +{: .tip} +> **What is the CDC ILI Baseline?** +> {: #cdc-ili-baseline} +> The baseline marks when flu season begins in a region. It is calculated from historical low-activity periods and represents the expected ILI percentage when influenza is not actively circulating. See [CDC's U.S. Influenza Surveillance](https://www.cdc.gov/fluview/overview/index.html#:~:text=The%20baseline%20is%20developed%20by%20calculating%20the%20mean%20percentage%20of%20patient%20visits%20for%20ILI%20during%20non%2Dinfluenza%20weeks%20for%20the%20most%20recent%20three%20seasons) for more details. + +## Example URLs -### Delphi on 2020w01 (EC) -https://api.delphi.cmu.edu/epidata/delphi/?system=ec&epiweek=202001 +### Delphi on 2015w01 (EC) + ```json { @@ -140,6 +176,102 @@ https://api.delphi.cmu.edu/epidata/delphi/?system=ec&epiweek=202001 } ``` -# Code Samples +## Code Samples + +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch Delphi Forecast data for system `ec` on epiweek `201501`. + +
+
+ + + +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.delphi('ec', 201501) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pub_delphi(system = 'ec', epiweek = 201501) +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
+ +Optionally install the package using pip(env): +```bash +pip install delphi-epidata +``` +Place `delphi_epidata.py` from this repo next to your python script. + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.delphi('ec', 201501) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$delphi(system = 'ec', epiweek = 201501) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
- +
diff --git a/docs/api/dengue_digital_surveillance.md b/docs/api/dengue_digital_surveillance.md index 9351e7dff..177ee0867 100644 --- a/docs/api/dengue_digital_surveillance.md +++ b/docs/api/dengue_digital_surveillance.md @@ -1,51 +1,209 @@ --- -title: inactive Dengue Digital Surveillance -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: Dengue Digital Surveillance permalink: api/dengue_sensors.html --- # Dengue Digital Surveillance Sensors +{: .no_toc} -This is the API documentation for accessing the Dengue Digital Surveillance -Sensors (`dengue_sensors`) endpoint of [Delphi](https://delphi.cmu.edu/)'s -epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `dengue_sensors` | +| **Data Source** | Various digital data streams | +| **Geographic Levels** | Countries and territories in the Americas (see [Geographic Codes](geographic_codes.md#countries-and-territories-in-the-americas))
*Note: Data availability varies by country.* | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2020w32| +| **Temporal Scope Start** | 2014w04 | +| **License** | [CC BY](https://creativecommons.org/licenses/by/4.0/) | + + +## Overview +{: .no_toc} + +This endpoint provides access to Delphi's digital surveillance sensor estimates for dengue activity. These sensors are designed to provide early indicators of disease prevalence by aggregating indicators from digital data streams, specifically Google Health Trends and internet search query volume. + +By tracking these digital indicators, the sensors can help to identify trends and potential outbreaks before official laboratory-confirmed results are released. These sensors were specifically developed to support modeling and forecasting efforts for infectious diseases in countries and territories across the Americas. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## Delphi's Dengue Digital Surveillance Sensors Data +{: .note} +> **Note:** Restricted access: This endpoint requires authentication. + + +### Indicators +{: .no_toc} + +The following indicators are available. Both represent estimated dengue case counts derived from digital data streams. + +| Name | Description | Source | +| :--- | :--- | :--- | +| `ght` | Estimate based on Google Health Trends | [GHT](ght.md) | +| `isch` | Estimate based on Internet Search | n/a | + +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## The API + +The base URL is: + + +### Parameters + +#### Required + +| Parameter | Description | Type | +| --- | --- | --- | +| `auth` | authentication token | string | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `names` | indicator names (see [Indicators](#indicators)) | `list` of strings | +| `locations` | country or territory codes (see [Geographic Codes](geographic_codes.md#countries-and-territories-in-the-americas)) | `list` of strings | + + +### Response + +| Field | Description | Type | +|-----------------------|-----------------------------------------------------------------|------------------| +| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | +| `epidata` | list of results | array of objects | +| `epidata[].location` | country or territory code. See [Geographic Codes](geographic_codes.md#countries-and-territories-in-the-americas) | string | +| `epidata[].epiweek` | epiweek (YYYYWW) | integer | +| `epidata[].name` | indicator name. See [Indicators](#indicators) | string | +| `epidata[].value` | estimated number of dengue cases (see below) | float | +| `message` | `success` or error message | string | + +#### Value Interpretation + +The `value` field for all indicators (`ght`, `isch`) represents the estimated number of dengue cases in the specified location and week. These values are generated by fitting digital indicators to official case counts. + +{: .note} +> **Note:** The `ght` indicator provided here is a case estimate, which is different from the raw search volume returned by the separate [Google Health Trends](ght.md) endpoint. + +## Example URLs + +### Dengue Sensors on 2015w01 (Puerto Rico) + + +```json +{ + "result": 1, + "epidata": [ + { + "location": "pr", + "epiweek": 201501, + "name": "ght", + "value": 103.676 + } + ], + "message": "success" +} +``` + +## Code Samples + +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch Dengue Sensors data for Puerto Rico for epiweek `201501`. + +
+
+ + -... +
-# The API +
-The base URL is: https://api.delphi.cmu.edu/epidata/dengue_sensors/ +Install the package using pip: -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` -## Parameters +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.dengue_sensors('auth_token', ['ght'], ['pr'], [201501]) +print(res['result'], res['message'], len(res['epidata'])) +``` +
-### Required +
- +```R +library(epidatr) +# Fetch data +res <- pvt_dengue_sensors(auth = 'auth_token', names = 'ght', locations = 'pr', epiweeks = 201501) +print(res) +``` +
-## Response +
-| Field | Description | Type | -|-----------|-----------------------------------------------------------------|------------------| -| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | -| `epidata` | list of results | array of objects | -| ... | ... | ... | -| `message` | `success` or error message | string | +### Legacy Clients -# Example URLs +We recommend using our client libraries: [epidatr](https://cmu-delphi.github.io/epidatr/) for R and [epidatpy](https://cmu-delphi.github.io/epidatpy/) for Python. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). - +
+
+ + + +
+ +
+ +Optionally install the package using pip(env): +```bash +pip install delphi-epidata +``` + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.dengue_sensors('auth_token', ['ght'], ['pr'], [201501]) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. -# Code Samples +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$dengue_sensors(auth = "auth_token", sensors = list("ght"), locations = list("pr"), epiweeks = list(201501)) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
- +
diff --git a/docs/api/dengue_nowcast.md b/docs/api/dengue_nowcast.md index 52dc80fca..9e54df0dd 100644 --- a/docs/api/dengue_nowcast.md +++ b/docs/api/dengue_nowcast.md @@ -1,50 +1,207 @@ --- -title: inactive Dengue Nowcast -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: Dengue Nowcast --- # Delphi's Dengue Nowcast +{: .no_toc} -This is the API documentation for accessing the Dengue Nowcast -(`dengue_nowcast`) endpoint of [Delphi](https://delphi.cmu.edu/)'s -epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `dengue_nowcast` | +| **Data Source** | [Delphi](https://delphi.cmu.edu/) | +| **Geographic Levels** | Countries and territories in the Americas (see [Geographic Codes](geographic_codes.html#countries-and-territories-in-the-americas))
*Note: Data availability varies by country.* | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2020w32 | +| **Temporal Scope Start** | 2014w09 | +| **License** | [CC BY](https://creativecommons.org/licenses/by/4.0/) | + + +## Overview +{: .no_toc} + +This endpoint provides Delphi's nowcast estimates of dengue incidence. These estimates are generated using a Sensor Fusion approach that combines reported case counts with digital surveillance data to provide timely insights into dengue activity across the Americas. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## Delphi's Dengue Nowcast Data +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Estimation + +Values are generated by a Sensor Fusion model designed to estimate current dengue activity. + +The endpoint provides estimates of dengue incidence. + +| Field | Description | +|:---|:---| +| `value` | Nowcast estimate of dengue incidence (cases per 100,000 population) | +| `std` | Standard deviation of the nowcast estimate | + +### Methodology +The model synthesizes historical incidence records (from PAHO) with real-time digital surveillance signals (such as Google Health Trends) to produce a current nowcast with quantified uncertainty. + +For details on the methodology, see Jahja et al., ["Kalman Filter, Sensor Fusion, and Constrained Regression: Equivalences and Insights"](https://arxiv.org/abs/1905.11436). + + + +## Limitations + +The accuracy of the nowcasts relies on the availability and timeliness of underlying surveillance data from regional health organizations. + +## The API + +The base URL is: + + +### Parameters + +#### Required + +| Parameter | Description | Type | +| --- | --- | --- | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `locations` | locations | `list` of location labels (see [Geographic Codes](geographic_codes.md#countries-and-territories-in-the-americas)) | + +### Response + +| Field | Description | Type | +|-----------------------|-----------------------------------------------------------------|------------------| +| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | +| `epidata` | list of results | array of objects | +| `epidata[].location` | country or territory code. See [Geographic Codes](geographic_codes.md#countries-and-territories-in-the-americas) | string | +| `epidata[].epiweek` | epiweek (YYYYWW) | integer | +| `epidata[].value` | nowcast estimate of dengue incidence (cases per 100,000 population) | float | +| `epidata[].std` | standard deviation of the nowcast estimate | float | +| `message` | `success` or error message | string | + +## Example URLs + +### Dengue Nowcast on 2015w01 (Puerto Rico) + + +```json +{ + "result": 1, + "epidata": [ + { + "location": "pr", + "epiweek": 201501, + "value": 12.34, + "std": 1.23 + } + ], + "message": "success" +} +``` + +## Code Samples + +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch Dengue Nowcast data for Puerto Rico for epiweeks `201401` to `202301`. + +
+
+ + + +
+ +
-... +Install the package using pip: -# The API +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` -The base URL is: https://api.delphi.cmu.edu/epidata/dengue_nowcast/ +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.dengue_nowcast(['pr'], EpiRange(201401, 202301)) +print(res['result'], res['message'], len(res['epidata'])) +``` +
-See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +
-## Parameters +```R +library(epidatr) +# Fetch data +res <- pub_dengue_nowcast(locations = 'pr', epiweeks = epirange(201401, 202301)) +print(res) +``` +
-### Required +
- +### Legacy Clients -## Response +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). -| Field | Description | Type | -|-----------|-----------------------------------------------------------------|------------------| -| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | -| `epidata` | list of results | array of objects | -| ... | ... | ... | -| `message` | `success` or error message | string | +
+
+ + + +
-# Example URLs +
- +Optionally install the package using pip(env): -# Code Samples +```bash +pip install delphi-epidata +``` + +Otherwise, place `delphi_epidata.py` from this repo next to your python script. + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.dengue_nowcast(['pr'], [201501]) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$dengue_nowcast(locations = list("pr"), epiweeks = list(201501)) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
- +
diff --git a/docs/api/digital_surveillance_sensors.md b/docs/api/digital_surveillance_sensors.md index 6437d58a3..fb402a611 100644 --- a/docs/api/digital_surveillance_sensors.md +++ b/docs/api/digital_surveillance_sensors.md @@ -1,79 +1,111 @@ --- -title: inactive Digital Surveillance Sensors -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: Digital Surveillance Sensors permalink: api/sensors.html --- # Digital Surveillance Sensors +{: .no_toc} -This is the documentation of the API for accessing the Digital Surveillance Sensors (`sensors`) endpoint of -the [Delphi](https://delphi.cmu.edu/)'s epidemiological data. +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `sensors` | +| **Data Source** | Various digital data streams | +| **Geographic Levels** | National, Department of Health & Human Services (HHS) Regions, Census Divisions, State (see [Geographic Codes](geographic_codes.md#us-regions-and-states)) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2022w36 | +| **Temporal Scope Start** | 2010w40 | +| **License** | [CC BY](https://creativecommons.org/licenses/by/4.0/) | + +## Overview +{: .no_toc} + +This endpoint provides access to Delphi's digital surveillance sensor estimates for seasonal influenza-like illness (ILI). It aggregates signals from multiple digital sources, including Google Health Trends, Wikipedia access counts, Twitter posts, and CDC web traffic, to provide real-time indicators of flu activity before official clinical reports are finalized. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## Delphi's Digital Surveillance Sensors Data +{: .note} +> **Note:** This repository was built to support modelling and forecasting efforts +> surrounding dengue and seasonal influenza. +> Syndromic surveillance data, like ILI data (influenza-like illness) through +> FluView, will likely prove very useful for understanding disease in +> the time period that includes the COVID-19 pandemic. +> However, **we urge caution to users examining the digital surveillance sensors**, +> like ILI Nearby, Google Flu +> Trends, etc., during that same date range, because these were designed to track +> ILI as driven by _seasonal_ influenza, and were NOT designed to track ILI during +> the COVID-19 pandemic. + + +## Table of contents +{: .no_toc .text-delta} -... +1. TOC +{:toc} -**Note:** this repository was built to support modeling and forecasting efforts -surrounding seasonal influenza (and dengue). In the current COVID-19 pandemic, -syndromic surveillance data, like ILI data (influenza-like illness) through -FluView, will likely prove very useful. However, **we urge caution to users -examining the digital surveillance sensors**, like ILI Nearby, Google Flu -Trends, etc., during the COVID-19 pandemic, because these were designed to track -ILI as driven by seasonal influenza, and were NOT designed to track ILI during -the COVID-19 pandemic. +## Data Sources +The endpoint aggregates data from the following sources. -# The API +| Signal | Name | Description | Documentation | +|:---|:---|:---|:---| +| `cdc` | **CDC Webpage Visits** | Count of hits to CDC flu-related pages | [Docs](cdc.md) | +| `gft` | **Google Flu Trends** | Estimated ILI cases | [Docs](gft.md) | +| `ght` | **Google Health Trends** | Search volume for flu terms | [Docs](ght.md) | +| `twtr` | **Twitter Stream** | Percentage of tweets related to ILI | [Docs](twitter.md) | +| `wiki` | **Wikipedia Access** | Page view counts for flu articles | [Docs](wiki.md) | +| `quid` | **Quidel** | Positive influenza lab tests | [Docs](quidel.md) | +| `sar3` | **Seasonal Auto-Regressive model (v3)** | SAR3 is a regression model that, given the current week number and preliminary wILI values of the past three weeks, provides an estimate of the final wILI value of the current week. | [Reference (Subsection 4.3.2: Predictions)](http://reports-archive.adm.cs.cmu.edu/anon/cbd/CMU-CB-16-101.pdf) | +| `epic` | **Epicast** | A web-based system that collects and aggregates epidemic predictions from human participants to leverage collective human judgment. | [Reference](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005248) | +| `arch` | **Archefilter** | Builds an archetype influenza trajectory by splitting, smoothing, centering, and averaging historical wILI trajectories to estimate the current season's curve. | [Reference (Appendix B: The Archefilter)](http://reports-archive.adm.cs.cmu.edu/anon/cbd/CMU-CB-16-101.pdf) | -The base URL is: https://api.delphi.cmu.edu/epidata/sensors/ -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +## The API -## Parameters +The base URL is: -### Required + +### Parameters + +#### Required | Parameter | Description | Type | | --- | --- | --- | -| `epiweeks` | epiweeks | `list` of epiweeks | -| `locations` | locations | `list` of [region](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/regions.txt)/[state](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/states.txt) labels | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `locations` | locations | `list` of location codes: `nat`, HHS regions, Census divisions, or state codes (see [Geographic Codes](geographic_codes.md#us-regions-and-states)) | | `names` | sensor names | `list` of string | -Notes: -* Names of open sensors (no `auth` token required): `sar3`, `epic`, `arch` -* Names of sensors requiring `auth` token: `twtr`, `gft`, `ght`, `ghtj`, `cdc`, `quid`, `wiki` +{: .note} +> **Note:** Restricted access: Some component signals require authentication. +> - **Publicly-accessible sensors:** `sar3`, `epic`, `arch` (no `auth` required) +> - **Private sensors:** `twtr`, `gft`, `ght`, `ghtj`, `cdc`, `quid`, `wiki` (require `auth` token) -### Optional +#### Optional -| Parameter | Description | Type | +| Parameter | Description | Type | |-----------|-------------------------------------------------------------------------------------|------------------| | `auth` | sensor authentication tokens (currently restricted to 1); can be global or granular | `list` of string | -## Response - - +### Response | Field | Description | Type | |----------------------|-----------------------------------------------------------------|------------------| | `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | | `epidata` | list of results | array of objects | | `epidata[].name` | sensor name | string | -| `epidata[].location` | | string | -| `epidata[].epiweek` | | integer | -| `epidata[].value` | | float | +| `epidata[].location` | location code | string | +| `epidata[].epiweek` | epiweek | integer | +| `epidata[].value` | signal value (varies by sensor) | float | | `message` | `success` or error message | string | -# Example URLs +## Example URLs ### Delphi's Digital Surveillance SAR3 Sensor on 2020w01 (national) -https://api.delphi.cmu.edu/epidata/sensors/?names=sar3&locations=nat&epiweeks=202001 + ```json { @@ -91,47 +123,108 @@ https://api.delphi.cmu.edu/epidata/sensors/?names=sar3&locations=nat&epiweeks=20 ``` -# Code Samples +## Code Samples -Libraries are available for [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js), [Python](https://pypi.org/project/delphi-epidata/), and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). -The following samples show how to import the library and fetch national Delphi's Digital Surveillance SAR3 Sensor data for epiweeks `201940` and `202001-202010` (11 weeks total). +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch national Delphi's Digital Surveillance SAR3 Sensor data for epiweeks `201501-202001`. -### JavaScript (in a web browser) +
+
+ + -````html - - - - -```` +
+ +
+ +Install the package using pip: + +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.sensors(['nat'], ['sar3'], EpiRange(201501, 202001)) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pvt_sensors(auth = 'SECRET_API_AUTH_SENSORS', locations = 'nat', +names = 'sar3', epiweeks = epirange(201501, 202001)) +print(res) +``` +
+ + + +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
-### Python +
Optionally install the package using pip(env): -````bash + +```bash pip install delphi-epidata -```` +``` Otherwise, place `delphi_epidata.py` from this repo next to your python script. -````python +```python # Import from delphi_epidata import Epidata # Fetch data -res = Epidata.sensors(['nat'], ['sar3'], [201940, Epidata.range(202001, 202010)]) +res = Epidata.sensors(['nat'], ['sar3'], Epidata.range(201501, 202001)) print(res['result'], res['message'], len(res['epidata'])) -```` +``` +
-### R +
-````R -# Import -source('delphi_epidata.R') +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") # Fetch data -res <- Epidata$sensors(list('nat'), list('sar3') list(201940, Epidata$range(202001, 202010))) -cat(paste(res$result, res$message, length(res$epidata), "\n")) -```` +res <- Epidata$sensors(locations = list("nat"), sensors = list("sar3"), epiweeks = Epidata$range(201501, 202001)) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
+ +
diff --git a/docs/api/ecdc_ili.md b/docs/api/ecdc_ili.md index c379fe369..7d307b578 100644 --- a/docs/api/ecdc_ili.md +++ b/docs/api/ecdc_ili.md @@ -1,63 +1,207 @@ --- -title: inactive ECDC ILI -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: ECDC ILI --- # ECDC ILI +{: .no_toc} -This is the API documentation for accessing the ECDC ILI (`ecdc_ili`) endpoint -of [Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `ecdc_ili` | +| **Data Source** | [European Centre for Disease Prevention and Control (ECDC)](https://www.ecdc.europa.eu/en/home) | +| **Geographic Levels** | European countries (see [Geographic Codes](geographic_codes.md#european-countries)) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2020w12 | +| **Temporal Scope Start** | 2018w40 | +| **License** | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (with [attribution to ECDC](https://www.ecdc.europa.eu/en/copyright)) | + + +## Overview +{: .no_toc} + +This endpoint provides weekly influenza-like illness (ILI) incidence rates for European countries. Data is sourced from the European Centre for Disease Prevention and Control (ECDC). General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## ECDC ILI Data +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Estimation + +Values represent ILI incidence rates (cases per 100,000 population) as reported and presented by the ECDC. Data is subject to backfill if the source provides historical revisions. + + + +## The API + +The base URL is: + + +### Parameters + +#### Required + +| Parameter | Description | Type | +| --- | --- | --- | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `regions` | regions | `list` of European country labels (see [Geographic Codes](geographic_codes.md#european-countries)) | + +#### Optional + +| Parameter | Description | Type | +| --- | --- | --- | +| `issues` | issues (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `lag` | # weeks between each epiweek and its issue | integer | + +{: .note} +> **Notes:** +> - If both `issues` and `lag` are specified, only `issues` is used. +> - If neither is specified, the current issues are used. + +### Response -ECDC ILI data from ECDC website. ... +| Field | Description | Type | +|---------------------------|-----------------------------------------------------------------|------------------| +| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | +| `epidata` | list of results | array of objects | +| `epidata[].release_date` | date of release | string | +| `epidata[].region` | region name | string | +| `epidata[].issue` | epiweek of issue | integer | +| `epidata[].epiweek` | epiweek of data | integer | +| `epidata[].lag` | lag in weeks | integer | +| `epidata[].incidence_rate`| ILI incidence rate (cases per 100,000 population) | float | +| `message` | `success` or error message | string | -# The API +## Example URLs -The base URL is: https://api.delphi.cmu.edu/epidata/ecdc_ili/ +### ECDC ILI in Austria on 2020w01 + -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +```json +{ + "result": 1, + "epidata": [ + { + "release_date":"2020-03-26", + "region": "Austria", + "issue": 202012, + "epiweek": 202001, + "lag": 11, + "incidence_rate": 406.60630449 + } + ], + "message": "success" +} +``` -## Parameters +## Code Samples -### Required +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch ECDC ILI data for Austria for epiweeks `202001` and `202002`. -| Parameter | Description | Type | -|------------|-------------|-------------------------------------------------------------------------------------------------------------| -| `epiweeks` | epiweeks | `list` of epiweeks | -| `regions` | regions | `list` of [location](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/ecdc_regions.txt) labels | +
+
+ + -### Optional +
-| Parameter | Description | Type | -|-----------|--------------------------------------------|--------------------| -| `issues` | issues | `list` of epiweeks | -| `lag` | # weeks between each epiweek and its issue | integer | +
-Notes: -- If both `issues` and `lag` are specified, only `issues` is used. -If neither is specified, the current issues are used. +Install the package using pip: -## Response +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` -| Field | Description | Type | -|-----------|-----------------------------------------------------------------|------------------| -| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | -| `epidata` | list of results | array of objects | -| ... | ... | ... | -| `message` | `success` or error message | string | +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.ecdc_ili(['austria'], [202001, 202002]) +print(res['result'], res['message'], len(res['epidata'])) +``` +
-# Example URLs +
- +```R +library(epidatr) +# Fetch data +res <- pub_ecdc_ili(regions = 'austria', epiweeks = c(202001, 202002)) +print(res) +``` +
-# Code Samples +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
+ +Optionally install the package using pip(env): + +```bash +pip install delphi-epidata +``` + +Otherwise, place `delphi_epidata.py` from this repo next to your python script. + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.ecdc_ili(['austria'], [202001, 202002]) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$ecdc_ili(regions = list("austria"), epiweeks = list(202001, 202002)) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
- +
diff --git a/docs/api/flusurv.md b/docs/api/flusurv.md index 79ddd15ef..40c92aa86 100644 --- a/docs/api/flusurv.md +++ b/docs/api/flusurv.md @@ -1,24 +1,41 @@ --- -title: inactive Flusurv +title: Flusurv parent: Data Sources and Signals grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +nav_order: 3 --- # FluSurv +{: .no_toc} -This is the API documentation for accessing the FluSurv (`flusurv`) endpoint of -[Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `flusurv` | +| **Data Source** | [CDC FluSurv-NET](https://gis.cdc.gov/GRASP/Fluview/FluHospRates.html) | +| **Geographic Levels** | Specific catchment areas (Network, State, or County-level catchments). See [Geographic Codes](geographic_codes.html#flusurv-locations) for full list | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Temporal Scope Start** | 2003w40 | +| **Reporting Cadence** | Weekly | +| **License** | [Publicly Accessible US Government](https://www.usa.gov/government-works) | + + + + +## Overview +{: .no_toc} + +This data source provides laboratory-confirmed influenza hospitalization rates from the [CDC's Influenza Hospitalization Surveillance Network (FluSurv-NET)](https://www.cdc.gov/fluview/overview/influenza-hospitalization-surveillance.html?CDC_AAref_Val=https://www.cdc.gov/flu/weekly/influenza-hospitalization-surveillance.htm). The data includes age-stratified hospitalization rates and rates by race, sex, and flu type, when available. + +{: .note} +> **Note:** +> FluSurv-NET age groups differ from ILINet. `age_0` matches ILINet's 0-4 years; `age_3` matches 50-64 years; `age_4` matches 65+ years. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## FluSurv Data - -FluSurv-NET data (flu hospitaliation rates) from CDC. - See also: - - @@ -26,33 +43,118 @@ See also: The US Influenza Hospitalization Surveillance Network. Emerging Infectious Diseases, 21(9), 1543-1550. . -# The API +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + + +## Estimation + +The rates provided in this dataset are pulled directly from the CDC's GRASP (Geospatial Research, Analysis, and Services Program) API. + +For a specific location and stratum (e.g., Age 0-4), the rate represents the number of residents of the catchment area hospitalized with laboratory-confirmed influenza divided by the total population of that stratum in that catchment area, multiplied by 100,000. + +### Processing Details +The Delphi pipeline scrapes the CDC GRASP API to emulate browser requests. +* **Duplicate Handling:** In rare instances where the source API provides two differing rates for the same location, epiweek, and demographic group, the pipeline is configured to retain the first value returned by the API. +* **Seasonality:** Data is processed based on "seasons" defined by the CDC, but is stored and served by Delphi indexed by Epiweek. + + + +## Strata Definitions + +The signals are broken down into specific demographic groups. The suffix of the signal name corresponds to the groups below. + +### Age Groups +The dataset includes both historical age groupings (0-4) and newer, more granular groupings (0tlt1, etc.) added in recent years. + +| Signal Suffix | Age Group | +| :--- | :--- | +| `age_0` | 0-4 yr | +| `age_1` | 5-17 yr | +| `age_2` | 18-49 yr | +| `age_3` | 50-64 yr | +| `age_4` | 65+ yr | +| `age_5` | 65-74 yr | +| `age_6` | 75-84 yr | +| `age_7` | 85+ yr | +| `age_0tlt1` | 0 to <1 yr | +| `age_1t4` | 1-4 yr | +| `age_5t11` | 5-11 yr | +| `age_12t17` | 12-17 yr | +| `age_18t29` | 18-29 yr | +| `age_30t39` | 30-39 yr | +| `age_40t49` | 40-49 yr | +| `age_gte75` | >= 75 yr | +| `age_lt18` | < 18 yr | +| `age_gte18` | >= 18 yr | + +### Race and Ethnicity +The dataset tracks 5 specific racial and ethnic groups. + +| Signal Suffix | Group Description | +| :--- | :--- | +| `race_white` | White | +| `race_black` | Black | +| `race_hisp` | Hispanic/Latino | +| `race_asian` | Asian/Pacific Islander | +| `race_natamer` | American Indian/Alaska Native | + +### Sex + +| Signal Suffix | Group Description | +| :--- | :--- | +| `sex_male` | Male | +| `sex_female` | Female | + +### Influenza Type + +| Signal Suffix | Group Description | +| :--- | :--- | +| `flu_a` | Influenza A | +| `flu_b` | Influenza B | + +## Lag and Backfill + +FluSurv-NET data is subject to reporting lags and revisions. The CDC may update past weekly rates as more hospitalization data becomes available or is corrected. + +The Delphi API tracks these changes via the `issue` date (inferred from the `loaddatetime` provided by the CDC API). When new data is fetched from the CDC, if a rate for a past week has changed, the database is updated to reflect the new value, allowing users to query historical versions of the data using the `lag` or `issues` parameters. + +## Limitations + +* This data does not cover the entire United States. It covers specific catchment areas within 13 states (EIP sites) and additional states participating in the IHSP. Rates are representative of these specific populations and may not perfectly generalize to the entire national population. +* As with all surveillance data, recent weeks may be subject to significant backfill. +* Not all strata (e.g., specific age bands or racial groups) may be available for all locations or all historical dates, depending on the data collection practices at the time. + +## The API The base URL is: -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. -## Parameters +### Parameters -### Required +#### Required | Parameter | Description | Type | | --- | --- | --- | -| `epiweeks` | epiweeks | `list` of epiweeks | -| `locations` | locations | `list` of [location](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/flusurv_locations.txt) labels | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.html)) | `list` of epiweeks | +| `locations` | locations | `list` of location labels (see [Geographic Codes](geographic_codes.html#flusurv-locations)) | -### Optional +#### Optional | Parameter | Description | Type | |-----------|--------------------------------------------|--------------------| -| `issues` | issues | `list` of epiweeks | +| `issues` | issues (see [Date Formats](date_formats.html)) | `list` of epiweeks | | `lag` | # weeks between each epiweek and its issue | integer | -Notes: -- If both `issues` and `lag` are specified, only `issues` is used. -If neither is specified, the current issues are used. +{: .note} +> **Notes:** +> - If both `issues` and `lag` are specified, only `issues` is used. +> - If neither is specified, the current issues are used. -## Response +### Response | Field | Description | Type | |---|---|---| @@ -94,14 +196,15 @@ If neither is specified, the current issues are used. | `epidata[].season` | indicates the start and end years of the winter flu season in the format YYYY-YY (e.g. 2022-23 indicates the flu season running late 2022 through early 2023) | string | | `message` | `success` or error message | string | -Notes: -* The `flusurv` age groups are, in general, not the same as the ILINet +{: .note} +> **Note:** +> * The `flusurv` age groups are, in general, not the same as the ILINet (`fluview`) age groups. However, the following groups are equivalent: - - flusurv age_0 == fluview age_0 (0-4 years) - - flusurv age_3 == fluview age_4 (50-64 years) - - flusurv age_4 == fluview age_5 (65+ years) +> - flusurv age_0 == fluview age_0 (0-4 years) +> - flusurv age_3 == fluview age_4 (50-64 years) +> - flusurv age_4 == fluview age_5 (65+ years) -# Example URLs +## Example URLs ### FluSurv on 2020w01 (CA) @@ -111,64 +214,158 @@ Notes: "result": 1, "epidata": [ { - "release_date": "2020-04-10", + "release_date": "2025-11-03", "location": "CA", - "issue": 202014, + "season": "2019-20", + "issue": 202538, "epiweek": 202001, - "lag": 13, - "rate_age_0": 8.4, + "lag": 298, + "rate_age_0": 8.6, "rate_age_1": 0.8, - "rate_age_2": 1.6, - "rate_age_3": 5.6, - "rate_age_4": 16.5, - "rate_overall": 4.8 + "rate_age_2": 1.5, + "rate_age_3": 5.7, + "rate_age_4": 15.3, + "rate_age_5": 11.5, + "rate_age_6": 20.4, + "rate_age_7": 20.8, + "rate_age_0tlt1": 12.6, + "rate_age_1t4": 7.6, + "rate_age_5t11": 1.1, + "rate_age_12t17": 0.4, + "rate_age_18t29": 1.2, + "rate_age_30t39": 1.6, + "rate_age_40t49": 1.8, + "rate_age_lt18": 2.9, + "rate_age_gte18": 5.1, + "rate_age_gte75": 20.5, + "rate_race_white": 4.1, + "rate_race_black": 8.1, + "rate_race_hisp": 4.1, + "rate_race_asian": 3.4, + "rate_race_natamer": 0.0, + "rate_sex_male": 4.7, + "rate_sex_female": 4.7, + "rate_flu_a": 3.6, + "rate_flu_b": 1.0, + "rate_overall": 4.7 } ], "message": "success" } ``` -# Code Samples +## Code Samples + +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch CA FluView Clinical data for epiweeks `201701-201801`. + +
+
+ + +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_flusurv(locations="CA", epiweeks=EpiRange(201701, 201801)) +print(res) +``` +
-Libraries are available for [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js), [Python](https://pypi.org/project/delphi-epidata/), and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). -The following samples show how to import the library and fetch CA FluView Clinical data for epiweeks `201940` and `202001-202010` (11 weeks total). +
-### JavaScript (in a web browser) +```R +library(epidatr) +# Fetch data +res <- pub_flusurv(locations = "CA", epiweeks = epirange(201701, 201801)) +print(res) +``` +
-````html +
+ +The JavaScript client is available [here](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js). + +```html -```` +``` +
+ +
-### Python +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
Optionally install the package using pip(env): -````bash +```bash pip install delphi-epidata -```` +``` Otherwise, place `delphi_epidata.py` from this repo next to your python script. -````python +```python # Import from delphi_epidata import Epidata # Fetch data -res = Epidata.flusurv(['ca'], [201940, Epidata.range(202001, 202010)]) +res = Epidata.flusurv(['CA'], [Epidata.range(201701, 201801)]) print(res['result'], res['message'], len(res['epidata'])) -```` +``` +
-### R +
-````R -# Import -source('delphi_epidata.R') +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") # Fetch data -res <- Epidata$flusurv(list('ca'), list(201940, Epidata$range(202001, 202010))) -cat(paste(res$result, res$message, length(res$epidata), "\n")) -```` +res <- Epidata$flusurv(locations = list("CA"), epiweeks = list(Epidata$range(201701, 201801))) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
+ +
diff --git a/docs/api/fluview.md b/docs/api/fluview.md index 34d878cd7..95f9c9f94 100644 --- a/docs/api/fluview.md +++ b/docs/api/fluview.md @@ -5,84 +5,125 @@ grand_parent: Other Endpoints (COVID-19 and Other Diseases) nav_order: 1 --- -# FluView +# FluView (ILINet) +{: .no_toc} -This is the API documentation for accessing the FluView (`fluview`) endpoint of -[Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `fluview` | +| **Data Source** | [United States Centers for Disease Control and Prevention (CDC)](http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html) | +| **Geographic Levels** | National, Department of Health & Human Services (HHS) Regions, Census Divisions, State (see [Geographic Codes](geographic_codes.md#us-regions-and-states)), Cities (see [FluView Cities](geographic_codes.md#fluview-cities)) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Weekly (typically Fridays) | +| **Temporal Scope Start** | 1997w40 | +| **License** | [Publicly Accessible US Government](https://www.usa.gov/government-works) | + +## Overview +{: .no_toc} + +The `fluview` endpoint reports influenza-like illness (ILI) data sourced from the U.S. Outpatient Influenza-like Illness Surveillance Network (ILINet) dashboard. Data is sourced from both ILINet (public health labs) and WHO_NREVSS (clinical labs). General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## FluView Data +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Estimation + +### Definition of ILI +For this system, ILI is defined as fever (temperature of 100°F [37.8°C] or greater) and a cough and/or a sore throat without a known cause other than influenza. + +### Weighted vs. Unweighted ILI +The `fluview` endpoint provides two percentage metrics: `ili` (unweighted) and `wili` (weighted). + +* **Unweighted (`ili`):** Calculated simply as the number of ILI cases divided by the total number of patients seen: + + $$ILI = 100 \cdot \frac{\text{num\_ili}}{\text{num\_patients}}$$ + +* **Weighted (`wili`):** To produce a representative estimate for larger regions (like National or HHS Regions), the CDC weights the state-level data by state population. This corrects for the fact that some states may have higher provider participation rates than others relative to their actual population. + + $$wILI_{region} = \sum_{s \in region} \left( \%ILI_s \times \frac{Pop_s}{Pop_{region}} \right)$$ + +### Imputation +State-level data was not publicly available from the CDC prior to the 2010-2011 flu season (2010w40). For dates prior to this, and for occasional missing reports, Delphi uses a sensor fusion approach (OLS regression) to impute state-level values based on the available regional data. + +Private imputed data may require specific authorization via the `auth` parameter. + + -Influenza-like illness (ILI) from U.S. Outpatient Influenza-like Illness Surveillance Network (ILINet). - - Data source: [United States Centers for Disease Control and Prevention](http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html) (CDC) - - Temporal Resolution: Weekly* from 1997w40 - - Spatial Resolution: National, [HHS regions](https://www.hhs.gov/about/agencies/iea/regional-offices/index.html), [Census divisions](https://www2.census.gov/geo/pdfs/maps-data/maps/reference/us_regdiv.pdf), most States and Territories, and some Cities (full list [here](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/acquisition/fluview/fluview_locations.py)) - - Open access +## Lag and Backfill -\* Data is usually released on Friday +The data is preliminary and subject to revision. Participating providers may report data late, or correct previously reported data. The `issues` and `lag` parameters in the API allow you to access historical versions of the data as they were reported on specific dates. -# The API +## Limitations -The base URL is: https://api.delphi.cmu.edu/epidata/fluview/ +ILINet is a voluntary system. While it covers all states, the coverage within a state may not be perfectly representative of the entire population. Also, ILI is a syndromic definition, not a laboratory diagnosis. It captures patients with flu-like symptoms, which can be caused by other respiratory pathogens (including SARS-CoV-2 and RSV). -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +## The API -## Parameters +The base URL is: -### Required + +### Parameters + +#### Required | Parameter | Description | Type | | --- | --- | --- | -| `epiweeks` | epiweeks | `list` of epiweeks | -| `regions` | regions | `list` of [region](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/regions.txt) labels | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `regions` | regions | `list` of region labels: `nat`, states, `hhs1`-`hhs10`, `cen1`-`cen9` (see [Geographic Codes](geographic_codes.md#us-regions-and-states)) | -### Optional +#### Optional | Parameter | Description | Type | |-----------|--------------------------------------------|--------------------| -| `issues` | issues | `list` of epiweeks | +| `issues` | issues (see [Date Formats](date_formats.md)) | `list` of epiweeks | | `lag` | # weeks between each epiweek and its issue | integer | | `auth` | password for private imputed data | string | -Notes: -- If both `issues` and `lag` are specified, only `issues` is used. -If neither is specified, the current issues are used. +{: .note} +> **Notes:** +> - If both `issues` and `lag` are specified, only `issues` is used. +> - If neither is specified, the current issues are used. -## Response +### Response | Field | Description | Type | -|---------------------------|-----------------------------------------------------------------|------------------| +|---------------------------|-----------------------------------------------------------------|---------------------| | `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | | `epidata` | list of results | array of objects | -| `epidata[].release_date` | | string or null | -| `epidata[].region` | | string | -| `epidata[].issue` | | integer | -| `epidata[].epiweek` | | integer | -| `epidata[].lag` | | integer | -| `epidata[].num_ili` | | integer | -| `epidata[].num_patients` | | integer | -| `epidata[].num_providers` | | integer | -| `epidata[].num_age_0` | | integer or null | -| `epidata[].num_age_1` | | integer or null | -| `epidata[].num_age_2` | | integer or null | -| `epidata[].num_age_3` | | integer or null | -| `epidata[].num_age_4` | | integer or null | -| `epidata[].num_age_5` | | integer or null | +| `epidata[].release_date` | date when data was released | string or null | +| `epidata[].region` | region identifier | string | +| `epidata[].issue` | epiweek of publication | integer | +| `epidata[].epiweek` | epiweek for which data is valid | integer | +| `epidata[].lag` | number of weeks between epiweek and issue | integer | +| `epidata[].num_ili` | number of ILI cases | integer | +| `epidata[].num_patients` | total number of patients | integer | +| `epidata[].num_providers` | number of reporting providers | integer | +| `epidata[].num_age_0` | number of ILI cases for ages 0-4 | integer or null | +| `epidata[].num_age_1` | number of ILI cases for ages 5-24 | integer or null | +| `epidata[].num_age_2` | number of ILI cases for ages 25-49 | integer or null | +| `epidata[].num_age_3` | number of ILI cases for ages 50-64 | integer or null | +| `epidata[].num_age_4` | number of ILI cases for ages 65+ | integer or null | +| `epidata[].num_age_5` | number of ILI cases with unknown age | integer or null | | `epidata[].wili` | weighted percent influenza-like illness | float | | `epidata[].ili` | percent influenza-like illness | float | | `message` | `success` or error message | string | -Notes: -- If authorized via `auth`, private data is not included. +{: .note} +> **Note:** Private data (imputed values) is only returned if authorized via a valid `auth` token. -# Example URLs +## Example URLs ### FluView on 2015w01 (national) -https://api.delphi.cmu.edu/epidata/fluview/?regions=nat&epiweeks=201501 + ```json { @@ -113,55 +154,119 @@ https://api.delphi.cmu.edu/epidata/fluview/?regions=nat&epiweeks=201501 ### FluView in HHS Regions 4 and 6 for the 2014/2015 flu season -https://api.delphi.cmu.edu/epidata/fluview/?regions=hhs4,hhs6&epiweeks=201440-201520 + ### Updates to FluView on 2014w53, reported from 2015w01 through 2015w10 (national) -https://api.delphi.cmu.edu/epidata/fluview/?regions=nat&epiweeks=201453&issues=201501-201510 + + + +## Code Samples +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch national FluView data for epiweeks `201501-201510`. -# Code Samples +
+
+ + -Libraries are available for [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js), [Python](https://pypi.org/project/delphi-epidata/), and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). -The following samples show how to import the library and fetch national FluView data for epiweeks `201440` and `201501-201510` (11 weeks total). +
+
-### JavaScript (in a web browser) +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_fluview(regions="nat", epiweeks=EpiRange(201501, 201510)) +print(res) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pub_fluview(regions = "nat", epiweeks = epirange(201501, 201510)) +print(res) +``` +
-````html +
+ +The JavaScript client is available [here](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js). + +```html -```` + EpidataAsync.fluview('nat', [EpidataAsync.range(201501, 201510)]).then((res) => { +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). -### Python +
+
+ + +
+ +
Optionally install the package using pip(env): -````bash +```bash pip install delphi-epidata -```` +``` Otherwise, place `delphi_epidata.py` from this repo next to your python script. -````python +```python # Import from delphi_epidata import Epidata # Fetch data -res = Epidata.fluview(['nat'], [201440, Epidata.range(201501, 201510)]) +res = Epidata.fluview(['nat'], [Epidata.range(201501, 201510)]) print(res['result'], res['message'], len(res['epidata'])) -```` +``` +
-### R +
-````R -# Import -source('delphi_epidata.R') +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") # Fetch data -res <- Epidata$fluview(list('nat'), list(201440, Epidata$range(201501, 201510))) -cat(paste(res$result, res$message, length(res$epidata), "\n")) -```` +res <- Epidata$fluview(regions = list("nat"), epiweeks = list(Epidata$range(201501, 201510))) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
+ +
diff --git a/docs/api/fluview_clinical.md b/docs/api/fluview_clinical.md index ca2b7b801..d37a438cc 100644 --- a/docs/api/fluview_clinical.md +++ b/docs/api/fluview_clinical.md @@ -2,139 +2,228 @@ title: FluView Clinical parent: Data Sources and Signals grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 1 +nav_order: 2 --- # FluView Clinical +{: .no_toc} -This is the API documentation for accessing the FluView Clinical -(`fluview_clinical`) endpoint of [Delphi](https://delphi.cmu.edu/)'s -epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `fluview_clinical` | +| **Data Source** | [United States Centers for Disease Control and Prevention (CDC)](http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html) | +| **Geographic Levels** | National, Department of Health & Human Services (HHS) Regions, Census Divisions, State (see [Geographic Codes](geographic_codes.md#us-regions-and-states)) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Weekly (typically Fridays) | +| **Temporal Scope Start** | 2016w40 | +| **License** | [Publicly Accessible US Government](https://www.usa.gov/government-works) | + + +## Overview +{: .no_toc} + +This data source provides age-stratified clinical data based on laboratory-confirmed influenza reports from the US FluView dashboard. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## FluView Clinical Data +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Estimation + +Values are sourced directly from the CDC's NREVSS (National Respiratory and Enteric Virus Surveillance System) clinical laboratories. + +The metrics consist of weekly counts of influenza specimens (total tested and total positive for types A and B) and their corresponding positivity rates. Unlike the syndromic ILI data in the [FluView](fluview.html) endpoint, these metrics provide laboratory confirmation of influenza circulation. + +### Percentages + +The CDC calculates three percentage metrics: -... +* **`percent_positive`**: Percentage of total specimens that tested positive for influenza (A or B) +* **`percent_a`**: Percentage of total specimens that tested positive for influenza A +* **`percent_b`**: Percentage of total specimens that tested positive for influenza B -# The API + -The base URL is: https://api.delphi.cmu.edu/epidata/fluview_clinical/ +## Lag and Backfill -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +The data is preliminary and subject to revision. Clinical labs may report data late or correct previously reported data. The `issues` and `lag` parameters allow access to historical versions of the data. -## Parameters +## The API -### Required +The base URL is: + + +### Parameters + +#### Required | Parameter | Description | Type | | --- | --- | --- | -| `epiweeks` | epiweeks | `list` of epiweeks | -| `regions` | regions | `list` of [region](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/regions.txt) labels | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `regions` | regions | `list` of region labels: `nat`, states, `hhs1`-`hhs10`, `cen1`-`cen9` (see [Geographic Codes](geographic_codes.md#us-regions-and-states)) | -### Optional +#### Optional | Parameter | Description | Type | |-----------|--------------------------------------------|--------------------| -| `issues` | issues | `list` of epiweeks | +| `issues` | issues (see [Date Formats](date_formats.md)) | `list` of epiweeks | | `lag` | # weeks between each epiweek and its issue | integer | -Notes: -- If both `issues` and `lag` are specified, only `issues` is used. -If neither is specified, the current issues are used. +{: .note} +> **Notes:** +> - If both `issues` and `lag` are specified, only `issues` is used. +> - If neither is specified, the current issues are used. -## Response +### Response | Field | Description | Type | |------------------------------|-----------------------------------------------------------------|------------------| | `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | | `epidata` | list of results | array of objects | -| `epidata[].release_date` | | string | -| `epidata[].region` | | string | -| `epidata[].issue` | | integer | -| `epidata[].epiweek` | | integer | -| `epidata[].lag` | | integer | -| `epidata[].total_specimens` | | integer | -| `epidata[].total_a` | | integer | -| `epidata[].total_b` | | integer | -| `epidata[].percent_positive` | | float | -| `epidata[].percent_a` | | float | -| `epidata[].percent_b` | | float | +| `epidata[].release_date` | date when data was released | string | +| `epidata[].region` | region identifier | string | +| `epidata[].issue` | epiweek of publication | integer | +| `epidata[].epiweek` | epiweek for which data is valid | integer | +| `epidata[].lag` | number of weeks between epiweek and issue | integer | +| `epidata[].total_specimens` | total number of specimens tested | integer | +| `epidata[].total_a` | total specimens positive for influenza A | integer | +| `epidata[].total_b` | total specimens positive for influenza B | integer | +| `epidata[].percent_positive` | percentage of specimens testing positive for influenza | float | +| `epidata[].percent_a` | percentage of specimens testing positive for influenza A | float | +| `epidata[].percent_b` | percentage of specimens testing positive for influenza B | float | | `message` | `success` or error message | string | -# Example URLs +## Example URLs ### FluView Clinical on 2020w01 (national) -https://api.delphi.cmu.edu/epidata/fluview_clinical/?regions=nat&epiweeks=202001 + ```json { "result": 1, "epidata": [ { - "release_date": "2020-04-10", + "release_date": "2021-10-08", "region": "nat", - "issue": 202014, + "issue": 202139, "epiweek": 202001, - "lag": 13, - "total_specimens": 64980, - "total_a": 5651, - "total_b": 9647, - "percent_positive": 23.5426, - "percent_a": 8.69652, - "percent_b": 14.8461 - }, - ... + "lag": 91, + "total_specimens": 65177, + "total_a": 5645, + "total_b": 9664, + "percent_positive": 23.4883, + "percent_a": 8.66103, + "percent_b": 14.8273 + } ], "message": "success" } ``` +## Code Samples + +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch national FluView Clinical data for epiweeks `201601-201701`. + +
+
+ + + +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +res = Epidata.fluview_clinical(['nat'], [Epidata.range(201601, 201701)]) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
-# Code Samples +```R +library(epidatr) +# Fetch data +res <- pub_fluview_clinical(regions = "nat", epiweeks = epirange(201601, 201701)) +print(res) +``` +
-Libraries are available for [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js), [Python](https://pypi.org/project/delphi-epidata/), and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). -The following samples show how to import the library and fetch national FluView Clinical data for epiweeks `201940` and `202001-202010` (11 weeks total). +
-### JavaScript (in a web browser) +### Legacy Clients -````html - - - - -```` +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). -### Python +
+
+ + + +
+ +
Optionally install the package using pip(env): -````bash +```bash pip install delphi-epidata -```` +``` -Otherwise, place `delphi_epidata.py` from this repo next to your python script. +Place `delphi_epidata.py` from this repo next to your python script. -````python +```python # Import from delphi_epidata import Epidata # Fetch data -res = Epidata.fluview_clinical(['nat'], [201940, Epidata.range(202001, 202010)]) +res = Epidata.fluview_clinical(['nat'], [Epidata.range(201601, 201701)]) print(res['result'], res['message'], len(res['epidata'])) -```` +``` +
-### R +
-````R -# Import -source('delphi_epidata.R') +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") # Fetch data -res <- Epidata$fluview_clinical(list('nat'), list(201940, Epidata$range(202001, 202010))) -cat(paste(res$result, res$message, length(res$epidata), "\n")) -```` +res <- Epidata$fluview_clinical(regions = list("nat"), epiweeks = list(Epidata$range(201601, 201701))) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + + ```html + + + + + ``` +
+ +
diff --git a/docs/api/fluview_meta.md b/docs/api/fluview_meta.md index 0826a98ba..1e489395c 100644 --- a/docs/api/fluview_meta.md +++ b/docs/api/fluview_meta.md @@ -6,31 +6,45 @@ nav_order: 1 --- # FluView Metadata +{: .no_toc} -This is the API documentation for accessing the FluView metadata -(`fluview_meta`) endpoint of [Delphi](https://delphi.cmu.edu/)'s epidemiological -data. +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `fluview_meta` | +| **Data Source** | [United States Centers for Disease Control and Prevention (CDC)](http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html) | +| **License** | [Publicly Accessible US Government](https://www.usa.gov/government-works) | + +## Overview +{: .no_toc} + +The FluView metadata (`fluview_meta`) endpoint is a companion data source to the [FluView](fluview.md) endpoint. +It describes when the FluView endpoint was last updated and how many records are available. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + ## FluView Metadata Returns information about the [`fluview` endpoint](fluview.md). -# The API +## The API -The base URL is: https://api.delphi.cmu.edu/epidata/fluview_meta/ +The base URL is: -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. -## Parameters +### Parameters There are no parameters for this endpoint. -## Response +### Response | Field | Description | Type | |---------------------------|-----------------------------------------------------------------|------------------| @@ -41,10 +55,10 @@ There are no parameters for this endpoint. | `epidata[].table_rows` | total number of rows in the table | integer | | `message` | `success` or error message | string | -# Example URLs +## Example URLs ### FluView Metadata -https://api.delphi.cmu.edu/epidata/fluview_meta/ + ```json { @@ -59,3 +73,38 @@ https://api.delphi.cmu.edu/epidata/fluview_meta/ "message": "success" } ``` + +## Code Samples + +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch FluView metadata. + +
+
+ + +
+ +
+ +```python +# Import +from epidatpy import EpiDataContext +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_fluview_meta() +print(res) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pub_fluview_meta() +print(res) +``` +
+ +
diff --git a/docs/api/geographic_codes.md b/docs/api/geographic_codes.md new file mode 100644 index 000000000..fe2fcaecc --- /dev/null +++ b/docs/api/geographic_codes.md @@ -0,0 +1,467 @@ +--- +title: Geographic Codes +parent: Other Endpoints (COVID-19 and Other Diseases) +nav_order: 900 +--- + +# Geographic Codes +{: .no_toc} + +This page documents the valid geographic codes accepted by various API endpoints. + +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Countries and Territories in the Americas + +Multiple endpoints accept ISO 3166-1 alpha-2 country codes for countries and territories in the Americas. + +{: .note} +> **Note:** While the API accepts codes for all countries listed below, data may not be available for every country or territory. + +### Supported Codes + +| Code | Name | +|---|---| +| AG | Antigua and Barbuda | +| AI | Anguilla | +| AR | Argentina | +| AW | Aruba | +| BB | Barbados | +| BL | Saint Barthelemy | +| BM | Bermuda | +| BO | Bolivia | +| BQ | Bonaire, Saint Eustatius and Saba | +| BR | Brazil | +| BS | Bahamas | +| BZ | Belize | +| CA | Canada | +| CL | Chile | +| CO | Colombia | +| CR | Costa Rica | +| CU | Cuba | +| CW | Curaçao | +| DO | Dominican Republic | +| EC | Ecuador | +| GD | Grenada | +| GF | French Guiana | +| GP | Guadeloupe | +| GT | Guatemala | +| GY | Guyana | +| HN | Honduras | +| HT | Haiti | +| JM | Jamaica | +| KN | Saint Kitts and Nevis | +| KY | Cayman Islands | +| LC | Saint Lucia | +| MF | Saint Martin (French part) | +| MQ | Martinique | +| MS | Montserrat | +| MX | Mexico | +| NI | Nicaragua | +| PA | Panama | +| PE | Peru | +| PR | Puerto Rico | +| PY | Paraguay | +| SR | Suriname | +| SV | El Salvador | +| SX | Sint Maarten (Dutch part) | +| TC | Turks and Caicos Islands | +| TT | Trinidad and Tobago | +| US | United States of America | +| UY | Uruguay | +| VC | Saint Vincent and the Grenadines | +| VE | Venezuela | +| VG | Virgin Islands (UK) | +| VI | Virgin Islands (US) | + + + +## US Regions and States + +Multiple endpoints use standard US geographic codes. These include the national code, HHS regions, Census divisions, and state codes. + +### National Code + +| Code | Name | +|---|---| +| nat | United States (National) | + +### HHS Regions + +The US Department of Health and Human Services divides the country into 10 regions. + +| Code | Region | States | +|---|---|---| +| hhs1 | Region 1 | CT, ME, MA, NH, RI, VT | +| hhs2 | Region 2 | NJ, NY, PR, VI | +| hhs3 | Region 3 | DE, DC, MD, PA, VA, WV | +| hhs4 | Region 4 | AL, FL, GA, KY, MS, NC, SC, TN | +| hhs5 | Region 5 | IL, IN, MI, MN, OH, WI | +| hhs6 | Region 6 | AR, LA, NM, OK, TX | +| hhs7 | Region 7 | IA, KS, MO, NE | +| hhs8 | Region 8 | CO, MT, ND, SD, UT, WY | +| hhs9 | Region 9 | AZ, CA, HI, NV, AS, GU, MP | +| hhs10 | Region 10 | AK, ID, OR, WA | + +### Census Divisions + +The US Census Bureau divides the country into 9 divisions. + +| Code | Division | States | +|---|---|---| +| cen1 | New England | CT, ME, MA, NH, RI, VT | +| cen2 | Mid-Atlantic | NJ, NY, PA | +| cen3 | East North Central | IL, IN, MI, OH, WI | +| cen4 | West North Central | IA, KS, MN, MO, NE, ND, SD | +| cen5 | South Atlantic | DE, DC, FL, GA, MD, NC, SC, VA, WV | +| cen6 | East South Central | AL, KY, MS, TN | +| cen7 | West South Central | AR, LA, OK, TX | +| cen8 | Mountain | AZ, CO, ID, MT, NV, NM, UT, WY | +| cen9 | Pacific | AK, CA, HI, OR, WA | + +### US States and Territories + +Full list of 51 US states and territories used by multiple endpoints: + +#### US States + +| Code | Name | +|---|---| +| AK | Alaska | +| AL | Alabama | +| AR | Arkansas | +| AZ | Arizona | +| CA | California | +| CO | Colorado | +| CT | Connecticut | +| DC | District of Columbia | +| DE | Delaware | +| FL | Florida | +| GA | Georgia | +| HI | Hawaii | +| IA | Iowa | +| ID | Idaho | +| IL | Illinois | +| IN | Indiana | +| KS | Kansas | +| KY | Kentucky | +| LA | Louisiana | +| MA | Massachusetts | +| MD | Maryland | +| ME | Maine | +| MI | Michigan | +| MN | Minnesota | +| MO | Missouri | +| MS | Mississippi | +| MT | Montana | +| NC | North Carolina | +| ND | North Dakota | +| NE | Nebraska | +| NH | New Hampshire | +| NJ | New Jersey | +| NM | New Mexico | +| NV | Nevada | +| NY | New York | +| OH | Ohio | +| OK | Oklahoma | +| OR | Oregon | +| PA | Pennsylvania | +| RI | Rhode Island | +| SC | South Carolina | +| SD | South Dakota | +| TN | Tennessee | +| TX | Texas | +| UT | Utah | +| VA | Virginia | +| VT | Vermont | +| WA | Washington | +| WI | Wisconsin | +| WV | West Virginia | +| WY | Wyoming | + +#### US Territories + +| Code | Name | +|---|---| +| PR | Puerto Rico | +| VI | Virgin Islands | +| GU | Guam | +| AS | American Samoa | +| MP | Northern Mariana Islands | +| FM | Federated States of Micronesia | +| MH | Marshall Islands | +| PW | Palau | + +## Selected US cities + +Selected US cities used by multiple endpoints. + +| Code | +|---| +| Abilene_TX | +| Akron_OH | +| Albany_NY | +| Albuquerque_NM | +| Alexandria_VA | +| Allentown_PA | +| Amarillo_TX | +| Anaheim_CA | +| Anchorage_AK | +| Ann_Arbor_MI | +| Arlington_TX | +| Arlington_VA | +| Atlanta_GA | +| Austin_TX | +| Bakersfield_CA | +| Baltimore_MD | +| Baton_Rouge_LA | +| Berkeley_CA | +| Birmingham_AL | +| Boise_ID | +| Boston_MA | +| Boulder_CO | +| Buffalo_NY | +| Cary_NC | +| Charlotte_NC | +| Chicago_IL | +| Cleveland_OH | +| Colorado_Springs_CO | +| Columbia_SC | +| Columbus_OH | +| Dallas_TX | +| Dayton_OH | +| Denver_CO | +| Des_Moines_IA | +| Durham_NC | +| Eugene_OR | +| Fresno_CA | +| Ft_Worth_TX | +| Gainesville_FL | +| Grand_Rapids_MI | +| Greensboro_NC | +| Greenville_SC | +| Honolulu_HI | +| Houston_TX | +| Indianapolis_IN | +| Irvine_CA | +| Irving_TX | +| Jacksonville_FL | +| Jackson_MS | +| Kansas_City_MO | +| Knoxville_TN | +| Las_Vegas_NV | +| Lexington_KY | +| Lincoln_NE | +| Little_Rock_AR | +| Los_Angeles_CA | +| Lubbock_TX | +| Madison_WI | +| Memphis_TN | +| Mesa_AZ | +| Miami_FL | +| Milwaukee_WI | +| Nashville_TN | +| Newark_NJ | +| New_Orleans_LA | +| New_York_NY | +| Norfolk_VA | +| Oakland_CA | +| Oklahoma_City_OK | +| Omaha_NE | +| Orlando_FL | +| Philadelphia_PA | +| Phoenix_AZ | +| Pittsburgh_PA | +| Plano_TX | +| Portland_OR | +| Providence_RI | +| Raleigh_NC | +| Reno_NV | +| Reston_VA | +| Richmond_VA | +| Rochester_NY | +| Roswell_GA | +| Sacramento_CA | +| Salt_Lake_City_UT | +| Santa_Clara_CA | +| San_Antonio_TX | +| San_Diego_CA | +| San_Francisco_CA | +| San_Jose_CA | +| Scottsdale_AZ | +| Seattle_WA | +| Somerville_MA | +| Spokane_WA | +| Springfield_MO | +| State_College_PA | +| St_Louis_MO | +| St_Paul_MN | +| Sunnyvale_CA | +| Tampa_FL | +| Tempe_AZ | +| Tucson_AZ | +| Tulsa_OK | +| Washington_DC | +| Wichita_KS | + +## NIDSS + +Geographic codes used by [NIDSS Flu](nidss_flu.html) and [NIDSS Dengue](nidss_dengue.html) endpoints. + +### Taiwan Regions + +Regions of Taiwan. + +| Code | +|---| +| nationwide | +| central | +| eastern | +| kaoping | +| northern | +| southern | +| taipei | + +### Taiwan Cities and Counties + +Administrative divisions of Taiwan. + +| Code | +|---| +| changhua_county | +| chiayi_city | +| chiayi_county | +| hsinchu_city | +| hsinchu_county | +| hualien_county | +| kaohsiung_city | +| keelung_city | +| kinmen_county | +| lienchiang_county | +| miaoli_county | +| nantou_county | +| new_taipei_city | +| penghu_county | +| pingtung_county | +| taichung_city | +| tainan_city | +| taipei_city | +| taitung_county | +| taoyuan_city | +| yilan_county | +| yunlin_county | + +## European Countries + +European countries and regions used by the [ECDC ILI](ecdc_ili.html) endpoint. + +| Name | +|---| +| Armenia | +| Austria | +| Azerbaijan | +| Belarus | +| Belgium | +| Czech Republic | +| Denmark | +| Estonia | +| Finland | +| France | +| Georgia | +| Iceland | +| Ireland | +| Israel | +| Italy | +| Kazakhstan | +| Kosovo* | +| Kyrgyzstan | +| Latvia | +| Lithuania | +| Luxembourg | +| Malta | +| Moldova | +| Montenegro | +| Netherlands | +| North Macedonia | +| Norway | +| Poland | +| Portugal | +| Romania | +| Russia | +| Serbia | +| Slovakia | +| Slovenia | +| Spain | +| Switzerland | +| Tajikistan | +| Turkey | +| Turkmenistan | +| Ukraine | +| United Kingdom - England | +| United Kingdom - Northern Irel | +| United Kingdom - Scotland | +| United Kingdom - Wales | +| Uzbekistan | + +## FluSurv Locations + +Locations used by the [FluSurv](flusurv.html) endpoint. + +| Code | Description | +|---|---| +| CA | California | +| CO | Colorado | +| CT | Connecticut | +| GA | Georgia | +| IA | Iowa | +| ID | Idaho | +| MD | Maryland | +| MI | Michigan | +| MN | Minnesota | +| NM | New Mexico | +| NY_albany | New York (Albany) | +| NY_rochester | New York (Rochester) | +| OH | Ohio | +| OK | Oklahoma | +| OR | Oregon | +| RI | Rhode Island | +| SD | South Dakota | +| TN | Tennessee | +| UT | Utah | +| network_all | All Networks | +| network_eip | Emerging Infections Program | +| network_ihsp | Influenza Hospitalization Surveillance Project | + +## Republic of Korea + +Geographic codes used by the [KCDC ILI](kcdc_ili.html) endpoint. + +| Code | Name | +|---|---| +| ROK | Republic of Korea | + + +## FluView Cities + +Specific cities used by the [FluView](fluview.html) endpoint. + +| City | Code | +|---|---| +| Chicago | ord | +| Los Angeles | lax | +| New York City | jfk | + +### Note on New York + +In the CDC FluView system, New York State and New York City are often reported separately. +* `ny_minus_jfk` represents New York State **excluding** NYC. +* `jfk` represents New York City. +* `ny` represents the entire state (the sum of the two). diff --git a/docs/api/gft.md b/docs/api/gft.md index ced862113..914292fa0 100644 --- a/docs/api/gft.md +++ b/docs/api/gft.md @@ -1,58 +1,72 @@ --- -title: inactive Google Flu Trends -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: Google Flu Trends --- # Google Flu Trends +{: .no_toc} -This is the API documentation for accessing the Google Flu Trends (`gft`) -endpoint of [Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `gft` | +| **Data Source** | [Google Flu Trends Estimates](https://www.google.com/publicdata/explore?ds=z3bsqef7ki44ac_) ([context](https://en.wikipedia.org/wiki/Google_Flu_Trends)) | +| **Geographic Levels** | National, Department of Health & Human Services (HHS) Regions, State (see [Geographic Codes](geographic_codes.md#us-regions-and-states)), Selected US Cities (see [Selected US Cities](geographic_codes.md#selected-us-cities)) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2015w32 | +| **Temporal Scope Start** | 2003w40 | +| **License** | [Google Terms of Service](https://policies.google.com/terms) | + + +## Overview +{: .no_toc} + +This data source provides a historical estimate of influenza activity based on the aggregated volume of search queries related to flu symptoms, treatments, and related topics. The data is sourced from Google Flu Trends (GFT), which used these query volumes to model ILI rates. + +We offer similar search query-based disease tracking that is more up to date: [Google Health Trends](ght.md), available through mid 2022, and [Google Symptoms](covidcast-signals/google-symptoms.md), available through late 2025. +Although these datasets are all based on search query volume, the processing and privacy handling differs such that reported values may not be comparable between sources. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## Google Flu Trends Data +## Table of contents +{: .no_toc .text-delta} -Estimate of influenza activity based on volume of certain search queries. Google has discontinued Flu Trends, and this is now a static endpoint. - - Data Source: [Google Flu Trends Estimates](https://www.google.com/publicdata/explore?ds=z3bsqef7ki44ac_) ([context](https://en.wikipedia.org/wiki/Google_Flu_Trends)) - - Temporal Resolution: Weekly from 2003w40 until 2015w32 - - Spatial Resolution: National, [HHS regions](http://www.hhs.gov/iea/regional/) ([1+10](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/regions.txt)); by state/territory ([50+1](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/states.txt)); and by city ([97](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/cities.txt)) - - Open access +1. TOC +{:toc} -# The API +## The API -The base URL is: https://api.delphi.cmu.edu/epidata/gft/ +The base URL is: -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. -## Parameters +### Parameters -### Required +#### Required | Parameter | Description | Type | | --- | --- | --- | -| `epiweeks` | epiweeks | `list` of epiweeks | -| `locations` | locations | `list` of [region](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/regions.txt)/[state](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/states.txt)/[city](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/cities.txt) labels | +| `locations` | Locations to fetch. National, HHS regions, US states (see [US Regions and States](geographic_codes.md#us-regions-and-states)), and select cities (see [Selected US Cities](geographic_codes.md#selected-us-cities)). | `list` of strings | +| `epiweeks` | Epiweeks to fetch. Supports [`epirange()`] and defaults to all ("*") dates. | `list` of epiweeks | -## Response +### Response | Field | Description | Type | |----------------------|-----------------------------------------------------------------|------------------| | `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | | `epidata` | list of results | array of objects | | `epidata[].location` | location | string | -| `epidata[].epiweek` | epiweek | epiweek | -| `epidata[].num` | number | integer | +| `epidata[].epiweek` | epiweek | integer | +| `epidata[].num` | GFT estimate (estimated ILI cases per 100,000 physician visits) | integer | | `message` | `success` or error message | string | -# Example URLs +## Example URLs ### Google Flu Trends on 2015w01 (national) -https://api.delphi.cmu.edu/epidata/gft/?locations=nat&epiweeks=201501 + ```json { @@ -69,47 +83,103 @@ https://api.delphi.cmu.edu/epidata/gft/?locations=nat&epiweeks=201501 ``` -# Code Samples +## Code Samples -Libraries are available for [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js), [Python](https://pypi.org/project/delphi-epidata/), and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). -The following samples show how to import the library and fetch Google Flu Trends data for epiweeks `201440` and `201501-201510` (11 weeks total). +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch Google Flu Trends data for epiweeks `201501-201510`. -### JavaScript (in a web browser) +
+
+ + -````html - - - - -```` +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_gft(locations='nat', epiweeks=EpiRange(201501, 201510)) +print(res) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pub_gft(locations = 'nat', epiweeks = epirange(201501, 201510)) +print(res) +``` +
-### Python +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
Optionally install the package using pip(env): -````bash +```bash pip install delphi-epidata -```` +``` Otherwise, place `delphi_epidata.py` from this repo next to your python script. -````python +```python # Import from delphi_epidata import Epidata # Fetch data -res = Epidata.gft(['nat'], [201440, Epidata.range(201501, 201510)]) +res = Epidata.gft(['nat'], Epidata.range(201501, 201510)) print(res['result'], res['message'], len(res['epidata'])) -```` +``` +
-### R +
-````R -# Import -source('delphi_epidata.R') +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") # Fetch data -res <- Epidata$gft(list('nat'), list(201440, Epidata$range(201501, 201510))) -cat(paste(res$result, res$message, length(res$epidata), "\n")) -```` +res <- Epidata$gft(locations = list("nat"), epiweeks = Epidata$range(201501, 201510)) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
+ +
diff --git a/docs/api/ght.md b/docs/api/ght.md index 20698e753..4ed89eec0 100644 --- a/docs/api/ght.md +++ b/docs/api/ght.md @@ -1,60 +1,311 @@ --- -title: inactive Google Health Trends -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: Google Health Trends --- # Google Health Trends +{: .no_toc} -This is the API documentation for accessing the [Google Health Trends](https://trends.google.com/trends/fullscreen/m/IN) (`ght`) -endpoint of [Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `ght` | +| **Data Source** | Google Health Trends | +| **Geographic Levels** | National, State (see [Geographic Codes](geographic_codes.md#us-states-and-territories)) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2022w36 | +| **Temporal Scope Start** | 1993w01 | +| **License** | [Google Terms of Service](https://policies.google.com/terms) | + +## Overview +{: .no_toc} + +The `ght` endpoint provides access to Google Health Trends data, which tracks the aggregated volume of search queries related to specific influenza symptoms and treatments. + +{: .note} +> **Notes:** +> - This data source tracks the search interest for specific terms (e.g., "flu symptoms", "thermometer") rather than model estimates. It is distinct from Google Flu Trends (GFT) which provided modeled ILI rates. +> - Restricted access: This endpoint requires authentication. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## Google Health Trends Data - -Estimate of influenza activity based on volume of certain search queries. This data may be useful for real-time monitoring of diseases, as in: - - Herman Anthony Carneiro, Eleftherios Mylonakis. [Google Trends: A Web-Based Tool for Real-Time Surveillance of Disease Outbreaks](https://doi.org/10.1086/630200). Clinical Infectious Diseases, Volume 49, Issue 10, 15 November 2009, Pages 1557–1564. - Abel Brodeur, Andrew E. Clark, Sarah Fleche, Nattavudh Powdthavee. [COVID-19, lockdowns and well-being: Evidence from Google Trends](https://doi.org/10.1016/j.jpubeco.2020.104346). Journal of Public Economics, Volume 193, 2021, 104346. - Sudhakar V. Nuti, Brian Wayda, Isuru Ranasinghe, Sisi Wang, Rachel P. Dreyer, Serene I. Chen, Karthik Murugiah. [The Use of Google Trends in Health Care Research: A Systematic Review](https://doi.org/10.1371/journal.pone.0109583), October 2014. -# The API +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Estimation + +Values represent the relative search volume for a specific query or topic within a geographic region. + + -The base URL is: https://api.delphi.cmu.edu/epidata/ght/ -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +## The API -## Parameters +The base URL is: -### Required + +### Parameters + +#### Required | Parameter | Description | Type | | --- | --- | --- | | `auth` | password | string | -| `epiweeks` | epiweeks | `list` of epiweeks | -| `locations` | locations | `list` of [state](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/states.txt) and/or `US` labels | -| `query` | search query or topic ID (see https://www.freebase.com/) | string | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `locations` | locations | `list` of state codes (see [Geographic Codes](geographic_codes.md#us-states-and-territories)) and/or `US` | +| `query` | search query or topic ID (see [Valid Queries](#valid-queries)) | string | + +##### Valid Queries + +
+Click to expand full list of valid queries + +* `/m/0cycc` +* `influenza type a` +* `flu duration` +* `flu fever` +* `treating flu` +* `fever flu` +* `flu recovery` +* `braun thermoscan` +* `oscillococcinum` +* `treating the flu` +* `cold or flu` +* `flu versus cold` +* `flu remedies` +* `contagious flu` +* `type a influenza` +* `flu or cold` +* `duration of flu` +* `cold versus flu` +* `flu cough` +* `flu headache` +* `thermoscan` +* `influenza incubation period` +* `flu lasts` +* `length of flu` +* `flu stomach` +* `cold vs flu` +* `flu and fever` +* `getting over the flu` +* `influenza a` +* `treatment for flu` +* `flu length` +* `treatment for the flu` +* `influenza symptoms` +* `over the counter flu` +* `flu complications` +* `cold and flu symptoms` +* `influenza incubation` +* `treatment of flu` +* `human temperature` +* `low body` +* `flu contagious` +* `robitussin ac` +* `flu how long` +* `ear thermometer` +* `flu contagious period` +* `treat flu` +* `cough flu` +* `low body temperature` +* `expectorant` +* `flu and cold` +* `rapid flu` +* `flu vs. cold` +* `how to treat the flu` +* `how long does the flu last?` +* `viral pneumonia` +* `flu in kids` +* `type a flu` +* `influenza treatment` +* `fighting the flu` +* `flu relief` +* `treat the flu` +* `flu medicine` +* `dangerous fever` +* `what is influenza` +* `tussin` +* `low body temp` +* `flu care` +* `flu in infants` +* `flu dizziness` +* `feed a fever` +* `flu vs cold` +* `flu vomiting` +* `bacterial pneumonia` +* `flu activity` +* `flu chills` +* `anas barbariae` +* `flu germs` +* `tylenol cold` +* `how to get over the flu` +* `flu in children` +* `influenza a and b` +* `duration of the flu` +* `cold symptoms` +* `flu report` +* `rapid flu test` +* `flu relapse` +* `get over the flu` +* `flu during pregnancy` +* `flu recovery time` +* `cure for flu` +* `tamiflu and breastfeeding` +* `flu chest pain` +* `flu treatment` +* `flu nausea` +* `remedies for the flu` +* `tamiflu in pregnancy` +* `side effects of tamiflu` +* `how to treat flu` +* `viral bronchitis` +* `flu how long contagious` +* `flu remedy` + +
+ +### Response + +| Field | Description | Type | +|-----------------------|-----------------------------------------------------------------|------------------| +| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | +| `epidata` | list of results | array of objects | +| `epidata[].location` | location label | string | +| `epidata[].epiweek` | epiweek | integer | +| `epidata[].query` | search query | string | +| `epidata[].value` | search volume | float | +| `message` | `success` or error message | string | + +## Example URLs + +### Google Health Trends for "how to get over the flu" on 2015w01 (US) + + +```json +{ + "result": 1, + "epidata": [ + { + "location": "US", + "epiweek": 201501, + "value": 9.113 + } + ], + "message": "success" +} +``` + +## Code Samples + +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch GHT data for "how to get over the flu" in the US for epiweek `201501`. + +
+
+ + + +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.ght('auth_token', ['US'], [201501], 'how to get over the flu') +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pvt_ght(auth = 'auth_token', locations = 'US', epiweeks = 201501, + query = "how to get over the flu") +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
+ +Optionally install the package using pip(env): +```bash +pip install delphi-epidata +``` + +Otherwise, place `delphi_epidata.py` from this repo next to your python script. + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.ght('auth_token', ['US'], [201501], 'how to get over the flu') +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. -## Response +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$ght(auth = "auth_token", locations = list("US"), epiweeks = list(201501), query = "how to get over the flu") +print(res$message) +print(length(res$epidata)) +``` +
-| Field | Description | Type | -|-----------|-----------------------------------------------------------------|------------------| -| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | -| `epidata` | list of results | array of objects | -| ... | ... | ... | -| `message` | `success` or error message | string | +
-# Example URLs - -# Code Samples +```html + + + + +``` +
- +
diff --git a/docs/api/ili_nearby_nowcast.md b/docs/api/ili_nearby_nowcast.md index defd13b22..2d4d1fa45 100644 --- a/docs/api/ili_nearby_nowcast.md +++ b/docs/api/ili_nearby_nowcast.md @@ -1,62 +1,97 @@ --- -title: inactive ILI Nearby Nowcast -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: ILI Nearby Nowcast permalink: api/nowcast.html --- # ILI Nearby Nowcast +{: .no_toc} -This is the documentation of the API for accessing the ILI Nearby (`nowcast`) endpoint of -the [Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `nowcast` | +| **Data Source** | [Delphi's ILI Nearby system](https://delphi.cmu.edu/nowcast/) | +| **Dataset Type** | Predictive (Leading Indicator) | +| **Geographic Levels** | National, Department of Health & Human Services (HHS) Regions, Census Divisions, State (see [Geographic Codes](geographic_codes.md#us-regions-and-states)) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2022w36 | +| **Temporal Scope Start** | 2010w45 | +| **License** | [CC BY](https://creativecommons.org/licenses/by/4.0/) | + +## Overview +{: .no_toc} + +This endpoint provides Delphi's nowcast estimates of the percentage of outpatient visits due to Influenza-Like Illness (ILI). + +This system uses a sensor-fusion approach to estimate the current level of flu activity before the official CDC reports are finalized. +It is available for: +* **National/Regional:** 7 days before the first official CDC ILINet report for a given date. +* **State-level:** 5 days before the first official CDC ILINet report for a given date. State values report weighted percent ILI. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## ILI Nearby Data -A nowcast of U.S. national, regional, and state-level (weighted) %ILI, available seven days (regionally) or five days (state-level) before the first ILINet report for the corresponding week. - - Source: [Delphi's ILI Nearby system](https://delphi.cmu.edu/nowcast/) - - Temporal Resolution: Weekly, from 2010w30* - - Spatial Resolution: National, [HHS regions](http://www.hhs.gov/iea/regional/), [Census divisions](http://www.census.gov/econ/census/help/geography/regions_and_divisions.html) ([1+10+9](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/regions.txt)), and by state/territory ([51](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/states.txt)) - - Open access +# Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Estimation + +This system uses a sensor-fusion approach to estimate the current level of flu activity (ILI%). It combines data sources to produce a single estimate, aiming to provide an early indicator before the official CDC FluView report is finalized. -\* Data is usually released on Friday and updated on Sunday and Monday +The endpoint exposes the following signals: -# The API +* **`value`**: The nowcast estimate of the percentage of outpatient visits due to Influenza-Like Illness (ILI). +* **`std`**: The standard deviation of the nowcast estimate, providing a measure of uncertainty. -The base URL is: https://api.delphi.cmu.edu/epidata/nowcast/ +The model combines multiple digital surveillance signals, including Wikipedia access logs (see [Wikipedia Access](wiki.md)) and CDC webpage visits (see [CDC Webpage Visits](cdc.md)), to create a predictive model for the current week's ILI%. -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +## Lag and Backfill -## Parameters +Nowcast estimates were subject to revision as input data was updated or backfilled. -### Required +## Limitations + +* These values are estimates (nowcasts), not ground-truth surveillance data. They are subject to modeling errors. +* The accuracy of the nowcast depends on the availability and stability of the input (Wikipedia, CDC page hits, etc.). Changes in user behaviour or platform algorithms can affect these inputs. + +## The API + +The base URL is: + + +### Parameters + +#### Required | Parameter | Description | Type | | --- | --- | --- | -| `epiweeks` | epiweeks | `list` of epiweeks | -| `locations` | locations | `list` of [region](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/regions.txt)/[state](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/states.txt) labels | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `locations` | locations | `list` of location codes: `nat`, HHS regions, Census divisions, or state codes (see [Geographic Codes](geographic_codes.md#us-regions-and-states)) | -## Response +### Response | Field | Description | Type | |----------------------|-----------------------------------------------------------------|------------------| | `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | | `epidata` | list of results | array of objects | -| `epidata[].location` | | string | -| `epidata[].epiweek` | | integer | -| `epidata[].value` | | float | -| `epidata[].std` | | float | +| `epidata[].location` | location identifier (e.g., 'nat', state code, HHS region, census division) | string | +| `epidata[].epiweek` | epiweek for the nowcast estimate | integer | +| `epidata[].value` | nowcast estimate of %ILI (percentage of outpatient visits due to ILI) | float | +| `epidata[].std` | standard deviation of the nowcast estimate | float | | `message` | `success` or error message | string | -# Example URLs +## Example URLs ### ILI Nearby on 2020w01 (national) -https://api.delphi.cmu.edu/epidata/nowcast/?locations=nat&epiweeks=202001 + ```json { @@ -74,47 +109,103 @@ https://api.delphi.cmu.edu/epidata/nowcast/?locations=nat&epiweeks=202001 ``` -# Code Samples +## Code Samples -Libraries are available for [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js), [Python](https://pypi.org/project/delphi-epidata/), and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). -The following samples show how to import the library and fetch national ILI Nearby data for epiweeks `201940` and `202001-202010` (11 weeks total). +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch national ILI Nearby data for epiweeks `202001-202010` (10 weeks total). -### JavaScript (in a web browser) +
+
+ + -````html - - - - -```` +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_nowcast(locations=['nat'], epiweeks=EpiRange(202001, 202010)) +print(res) +``` +
-### Python +
+ +```R +library(epidatr) +# Fetch data +res <- pub_nowcast(locations = 'nat', epiweeks = epirange(202001, 202010)) +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
Optionally install the package using pip(env): -````bash +```bash pip install delphi-epidata -```` +``` Otherwise, place `delphi_epidata.py` from this repo next to your python script. -````python +```python # Import from delphi_epidata import Epidata # Fetch data -res = Epidata.nowcast(['nat'], [201940, Epidata.range(202001, 202010)]) +res = Epidata.nowcast(['nat'], Epidata.range(202001, 202010)) print(res['result'], res['message'], len(res['epidata'])) -```` +``` +
-### R +
-````R -# Import -source('delphi_epidata.R') +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") # Fetch data -res <- Epidata$nowcast(list('nat'), list(201940, Epidata$range(202001, 202010))) -cat(paste(res$result, res$message, length(res$epidata), "\n")) -```` +res <- Epidata$nowcast(locations = list("nat"), epiweeks = Epidata$range(202001, 202010)) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
+ +
diff --git a/docs/api/inactive_other.md b/docs/api/inactive_other.md new file mode 100644 index 000000000..3b9361088 --- /dev/null +++ b/docs/api/inactive_other.md @@ -0,0 +1,12 @@ +--- +title: Inactive Sources (Other) +parent: Data Sources and Signals +grand_parent: Other Endpoints (COVID-19 and Other Diseases) +nav_order: 99 +has_children: true +--- + +# Inactive Other Sources +{: .no_toc} + +These Other Endpoint data sources are no longer actively updated. diff --git a/docs/api/kcdc_ili.md b/docs/api/kcdc_ili.md index 340d886d2..f98e33448 100644 --- a/docs/api/kcdc_ili.md +++ b/docs/api/kcdc_ili.md @@ -1,11 +1,27 @@ --- -title: inactive KCDC ILI -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: KCDC ILI --- # KCDC ILI +{: .no_toc} + + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `kcdc_ili` | +| **Data Source** | [Korea Disease Control and Prevention Agency (KCDC) ILI surveillance](https://www.kdca.go.kr/) | +| **Geographic Levels** | ROK (Republic of Korea) (see [Geographic Codes](geographic_codes.md#republic-of-korea)) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2020w44 | +| **Temporal Scope Start** | 2004w36 | +| **License** | [KCDC Copyright policy](https://www.kdca.go.kr/kdca/3509/subview..do) | + +## Overview +{: .no_toc} + +This endpoint provides weekly influenza-like illness (ILI) rates for South Korea, as reported by the Korea Centers for Disease Control and Prevention (KCDC). This is the API documentation for accessing the KCDC ILI (`kcdc_ili`) endpoint of [Delphi](https://delphi.cmu.edu/)'s epidemiological data. @@ -14,49 +30,185 @@ General topics not specific to any particular endpoint are discussed in the [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## KCDC ILI Data +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Estimation + +The data is reported directly by the Korea Centers for Disease Control and Prevention (KCDC) through their infectious disease surveillance system. The `ili` value represents the number of ILI cases per 1,000 outpatient visits. + +KCDC reports are scraped and stored directly. No additional smoothing or statistical adjustments are applied by the Delphi group, other than typical data parsing and versioning. + + + +## Lag and Backfill + +Historical data were revised as KCDC updated its surveillance reports. + + + +## The API + +The base URL is: + + +### Parameters + +#### Required + +| Parameter | Description | Type | +| --- | --- | --- | +| `regions` | Regions to fetch. See [Geographic Codes](geographic_codes.html#republic-of-korea). | `list` of strings | +| `epiweeks` | Epiweeks to fetch. Supports [`epirange()`] and defaults to all ("*") dates. | `list` of epiweeks | + +#### Optional + +| Parameter | Description | Type | +| --- | --- | --- | +| `issues` | Optionally, the issue(s) (see [Date Formats](date_formats.html)) of the data to fetch. | `list` of epiweeks | +| `lag` | Optionally, the lag of the issues to fetch. | integer | -KCDC ILI data from KCDC website. ... +{: .note} +> **Notes:** +> - If both `issues` and `lag` are specified, only `issues` is used. +> - If neither is specified, the current issues are used. -# The API +### Response -The base URL is: https://api.delphi.cmu.edu/epidata/kcdc_ili/ +| Field | Description | Type | +|---------------------------|-----------------------------------------------------------------|------------------| +| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | +| `epidata` | list of results | array of objects | +| `epidata[].release_date` | date of release | string | +| `epidata[].region` | region name | string | +| `epidata[].issue` | epiweek of issue | integer | +| `epidata[].epiweek` | epiweek of data | integer | +| `epidata[].lag` | lag in weeks | integer | +| `epidata[].ili` | ILI cases per 1,000 outpatient visits | float | +| `message` | `success` or error message | string | -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +## Example URLs -## Parameters +### KCDC ILI in ROK on 2020w01 + -### Required +```json +{ + "result": 1, + "epidata": [ + { + "release_date": "2020-01-10", + "region": "ROK", + "issue": 202001, + "epiweek": 202001, + "lag": 44, + "ili": 49.8 + } + ], + "message": "success" +} +``` -| Parameter | Description | Type | -|------------|-------------|--------------------| -| `epiweeks` | epiweeks | `list` of epiweeks | -| `regions` | regions | `ROK` | +## Code Samples -### Optional +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch KCDC ILI data for ROK for epiweeks `202001` and `202002`. -| Parameter | Description | Type | -|-----------|--------------------------------------------|--------------------| -| `issues` | issues | `list` of epiweeks | -| `lag` | # weeks between each epiweek and its issue | integer | +
+
+ + -Notes: -- If both `issues` and `lag` are specified, only `issues` is used. -If neither is specified, the current issues are used. +
-## Response +
-| Field | Description | Type | -|-----------|-----------------------------------------------------------------|------------------| -| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | -| `epidata` | list of results | array of objects | -| ... | ... | ... | -| `message` | `success` or error message | string | +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` -# Example URLs +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_kcdc_ili(regions=['ROK'], epiweeks=[202001, 202002]) +print(res) +``` +
- +
-# Code Samples +```R +library(epidatr) +# Fetch data +res <- pub_kcdc_ili(regions = 'ROK', epiweeks = c(202001, 202002)) +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
+ +Optionally install the package using pip(env): +```bash +pip install delphi-epidata +``` + +Otherwise, place `delphi_epidata.py` from this repo next to your python script. + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.kcdc_ili(['ROK'], [202001, 202002]) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$kcdc_ili(regions = list("ROK"), epiweeks = list(202001, 202002)) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
- +
diff --git a/docs/api/nidss_dengue.md b/docs/api/nidss_dengue.md index 33cd2ffc3..5d25329a9 100644 --- a/docs/api/nidss_dengue.md +++ b/docs/api/nidss_dengue.md @@ -1,58 +1,84 @@ --- -title: inactive NIDSS Dengue -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: NIDSS Dengue --- # NIDSS Dengue +{: .no_toc} -This is the documentation of the API for accessing the Taiwan National Infectious Disease Statistics System Dengue (`nidss_dengue`) endpoint of -the [Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `nidss_dengue` | +| **Data Source** | [Taiwan CDC](http://nidss.cdc.gov.tw/en/SingleDisease.aspx?dc=1&dt=4&disease=061&position=1)| +| **Geographic Levels** | Taiwan [hexchotomy regions](https://en.wikipedia.org/wiki/Regions_of_Taiwan#Hexchotomy) and [cities/counties](https://en.wikipedia.org/wiki/List_of_administrative_divisions_of_Taiwan) (see [Geographic Codes](geographic_codes.md#nidss)) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2018w10 | +| **Temporal Scope Start** | 2003w01 | +| **License** | [Open Access](https://data.gov.tw/license) | + +## Overview +{: .no_toc} + +This endpoint reports counts of confirmed dengue cases from the Taiwan National Infectious Disease Statistics System (NIDSS) via the Taiwan CDC. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## NIDSS Dengue Data +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Estimation + +Confirmed dengue cases are aggregated from NIDSS weekly reports, summing across all demographic groups (age/gender) and combining city/county data into six major [hexchotomy regions](geographic_codes.md#nidss). + + -Counts of confirmed dengue cases from Taiwan's National Infectious Disease Statistics System (NIDSS). - - Data source: [Taiwan CDC](http://nidss.cdc.gov.tw/en/SingleDisease.aspx?dc=1&dt=4&disease=061&position=1) - - Temporal Resolution: Weekly from 2003w01 - - Spatial Resolution: By [hexchotomy region](https://en.wikipedia.org/wiki/Regions_of_Taiwan#Hexchotomy) ([6+1](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/nidss_regions.txt)) and by [city/county](https://en.wikipedia.org/wiki/List_of_administrative_divisions_of_Taiwan) ([22](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/nidss_locations.txt)) - - Open access +## Lag and Backfill -# The API +Historical data were subject to revisions as new cases were confirmed or reclassified. -The base URL is: https://api.delphi.cmu.edu/epidata/nidss_dengue/ +## Limitations -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +Users should be aware of Taiwan's epiweek definition changes in 2009 (see [NIDSS Flu](nidss_flu.md) for similar quirks). -## Parameters -### Required + +## The API + +The base URL is: + + +### Parameters + +#### Required | Parameter | Description | Type | | --- | --- | --- | -| `epiweeks` | epiweeks | `list` of epiweeks | -| `locations` | locations | `list` of [region](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/nidss_regions.txt) and/or [location](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/nidss_locations.txt) labels | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `locations` | locations | `list` of Taiwan region and/or location labels (see [Geographic Codes](geographic_codes.md#nidss)) | -## Response +### Response | Field | Description | Type | |----------------------|-----------------------------------------------------------------|------------------| | `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | | `epidata` | list of results | array of objects | -| `epidata[].location` | location | string | +| `epidata[].location` | location (hexchotomy region) | string | | `epidata[].epiweek` | epiweek during which the data was collected | integer | -| `epidata[].count` | number of cases | integer | +| `epidata[].count` | number of confirmed dengue cases | integer | | `message` | `success` or error message | string | -# Example URLs +## Example URLs ### NIDSS Dengue on 2015w01 (nationwide) -https://api.delphi.cmu.edu/epidata/nidss_dengue/?locations=nationwide&epiweeks=201501 + ```json { @@ -69,51 +95,107 @@ https://api.delphi.cmu.edu/epidata/nidss_dengue/?locations=nationwide&epiweeks=2 ``` -# Code Samples +## Code Samples -Libraries are available for [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js), [Python](https://pypi.org/project/delphi-epidata/), and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). -The following samples show how to import the library and fetch national NIDSS Dengue data for epiweeks `201440` and `201501-201510` (11 weeks total). +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch national NIDSS Dengue data for epiweeks `201501-201510` (10 weeks total). -### JavaScript (in a web browser) +
+
+ + -````html - - - - -```` +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_nidss_dengue(locations=['nationwide'], epiweeks=EpiRange(201501, 201510)) +print(res) +``` +
+ +
-### Python +```R +library(epidatr) +# Fetch data +res <- pub_nidss_dengue(locations = 'nationwide', epiweeks = epirange(201501, 201510)) +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
Optionally install the package using pip(env): -````bash +```bash pip install delphi-epidata -```` +``` Otherwise, place `delphi_epidata.py` from this repo next to your python script. -````python +```python # Import from delphi_epidata import Epidata # Fetch data -res = Epidata.nidss_dengue(['nationwide'], [201440, Epidata.range(201501, 201510)]) +res = Epidata.nidss_dengue(['nationwide'], Epidata.range(201501, 201510)) print(res['result'], res['message'], len(res['epidata'])) -```` +``` -### R +# Source and Licensing -````R -# Import -source('delphi_epidata.R') +The full text of the NIDSS Dengue license information is available on the Taiwan Digital Development Department's [website](https://data.gov.tw/license). +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") # Fetch data -res <- Epidata$nidss_dengue(list('nationwide'), list(201440, Epidata$range(201501, 201510))) -cat(paste(res$result, res$message, length(res$epidata), "\n")) -```` +res <- Epidata$nidss_dengue(regions = list("nationwide"), epiweeks = Epidata$range(201501, 201510)) +print(res$message) +print(length(res$epidata)) +``` +
-# Source and Licensing +
+ + + +```html + + + + +``` +
-The full text of the NIDSS Dengue license information is available on the Taiwan Digital Development Department's [website](https://data.gov.tw/license). \ No newline at end of file +
diff --git a/docs/api/nidss_flu.md b/docs/api/nidss_flu.md index d35e991d3..b16ef4873 100644 --- a/docs/api/nidss_flu.md +++ b/docs/api/nidss_flu.md @@ -1,57 +1,94 @@ --- -title: inactive NIDSS Flu -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: NIDSS Flu --- # NIDSS Flu +{: .no_toc} -This is the documentation of the API for accessing the Taiwan National Infectious Disease Statistics System Flu (`nidss_flu`) endpoint of -the [Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `nidss_flu` | +| **Source** | [Taiwan CDC](http://nidss.cdc.gov.tw/en/CDCWNH01.aspx?dc=wnh) | +| **Geographic Levels** | Taiwan [hexchotomy regions](https://en.wikipedia.org/wiki/Regions_of_Taiwan#Hexchotomy) (see [Geographic Codes](geographic_codes.html#taiwan-regions)) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2018w10 | +| **Temporal Scope Start** | 2008w14 | +| **License** | [Open Access](https://data.gov.tw/license) | + +## Overview +{: .no_toc} + +This endpoint provides weekly influenza case counts for Taiwan, as reported by the Taiwan National Infectious Disease Statistics System (NIDSS) via the Taiwan CDC. + +The data is generally released weekly on Tuesday. + +{: .warning} +> **Historical Reporting Quirks** +> +> This data source contains historical reporting quirks. See [Limitations](#limitations) for details. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## NIDSS Flu Data +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Estimation -Outpatient ILI from Taiwan's National Infectious Disease Statistics System (NIDSS). - - Source: [Taiwan CDC](http://nidss.cdc.gov.tw/en/CDCWNH01.aspx?dc=wnh) - - Temporal Resolution: Weekly* from 2008w14 - - Spatial Resolution: By [hexchotomy region](https://en.wikipedia.org/wiki/Regions_of_Taiwan#Hexchotomy) ([6+1](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/nidss_regions.txt)) - - Open access +Data is directly sourced from the Taiwan CDC's National Infectious Disease Statistics System (NIDSS). Delphi does not perform any adjustments or smoothing. The reported metrics include: +* **`visits`**: The total number of patients visiting outpatient departments (OPD) and emergency rooms (ER) with influenza-like illness. +* **`ili`**: The percentage of visits due to ILI, calculated as `(ILI Visits / Total Visits) * 100`. -\* Data is usually released on Tuesday + -# The API +## Lag and Backfill -The base URL is: https://api.delphi.cmu.edu/epidata/nidss_flu/ +Historical values were revised as new data became available or due to the epiweek adjustments described above. -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +## Limitations -## Parameters +{: .warning} +> **Historical Reporting Quirks** +> +> * **Week 53 (2003-2007):** For years prior to 2008 (excluding 2003), week 53 was reported but is mapped to week 52 in this endpoint to maintain standard epiweek numbering. +> * **2009 Epiweek Change:** Taiwan adopted a new epiweek system in 2009. Data for 2009 is shifted by -1 week (e.g., 2009w02 becomes 2009w01) to align with standard US CDC epiweek definitions. -### Required + +## The API + +The base URL is: + + +### Parameters + +#### Required | Parameter | Description | Type | | --- | --- | --- | -| `epiweeks` | epiweeks | `list` of epiweeks | -| `regions` | regions | `list` of [region](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/nidss_regions.txt) labels | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.html)) | `list` of epiweeks | +| `regions` | regions | `list` of Taiwan region labels (see [Geographic Codes](geographic_codes.html#taiwan-regions)) | -### Optional +#### Optional | Parameter | Description | Type | |-----------|--------------------------------------------|--------------------| -| `issues` | issues | `list` of epiweeks | +| `issues` | issues (see [Date Formats](date_formats.html)) | `list` of epiweeks | | `lag` | # weeks between each epiweek and its issue | integer | -Notes: -- If both `issues` and `lag` are specified, only `issues` is used. -If neither is specified, the current issues are used. +{: .note} +> **Notes:** +> - If both `issues` and `lag` are specified, only `issues` is used. +> - If neither is specified, the current issues are used. -## Response +### Response | Field | Description | Type | |--------------------------|-----------------------------------------------------------------|------------------| @@ -66,10 +103,10 @@ If neither is specified, the current issues are used. | `epidata[].ili` | percent ILI | float | | `message` | `success` or error message | string | -# Example URLs +## Example URLs ### NIDSS Flu on 2015w01 (nationwide) -https://api.delphi.cmu.edu/epidata/nidss_flu/?regions=nationwide&epiweeks=201501 + ```json { @@ -90,51 +127,107 @@ https://api.delphi.cmu.edu/epidata/nidss_flu/?regions=nationwide&epiweeks=201501 ``` -# Code Samples +## Code Samples -Libraries are available for [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js), [Python](https://pypi.org/project/delphi-epidata/), and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). -The following samples show how to import the library and fetch national NIDSS Flu data for epiweeks `201440` and `201501-201510` (11 weeks total). +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch national NIDSS Flu data for epiweeks `201501-201510` (10 weeks total). -### JavaScript (in a web browser) +
+
+ + -````html - - - - -```` +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_nidss_flu(regions=['nationwide'], epiweeks=EpiRange(201501, 201510)) +print(res) +``` +
+ +
-### Python +```R +library(epidatr) +# Fetch data +res <- pub_nidss_flu(regions = 'nationwide', epiweeks = epirange(201501, 201510)) +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
Optionally install the package using pip(env): -````bash +```bash pip install delphi-epidata -```` +``` Otherwise, place `delphi_epidata.py` from this repo next to your python script. -````python +```python # Import from delphi_epidata import Epidata # Fetch data -res = Epidata.nidss_flu(['nationwide'], [201440, Epidata.range(201501, 201510)]) +res = Epidata.nidss_flu(['nationwide'], Epidata.range(201501, 201510)) print(res['result'], res['message'], len(res['epidata'])) -```` +``` + +# Source and Licensing -### R +The full text of the NIDSS Flu license information is available on the Taiwan Digital Development Department's [website](https://data.gov.tw/license). +
-````R -# Import -source('delphi_epidata.R') +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") # Fetch data -res <- Epidata$nidss_flu(list('nationwide'), list(201440, Epidata$range(201501, 201510))) -cat(paste(res$result, res$message, length(res$epidata), "\n")) -```` +res <- Epidata$nidss_flu(regions = list("nationwide"), epiweeks = Epidata$range(201501, 201510)) +print(res$message) +print(length(res$epidata)) +``` +
-# Source and Licensing +
+ + + +```html + + + + +``` +
-The full text of the NIDSS Flu license information is available on the Taiwan Digital Development Department's [website](https://data.gov.tw/license). \ No newline at end of file +
diff --git a/docs/api/norostat.md b/docs/api/norostat.md index 80c289c84..442326ce0 100644 --- a/docs/api/norostat.md +++ b/docs/api/norostat.md @@ -1,51 +1,201 @@ --- -title: inactive NoroSTAT -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: NoroSTAT --- # NoroSTAT +{: .no_toc} -This is the documentation of the API for accessing the NoroSTAT (`norostat`) endpoint of -the [Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `norostat` | +| **Data Source** | [CDC NoroSTAT](https://www.cdc.gov/norovirus/php/reporting/norostat-data.html) metadata endpoint (requires authentication) | +| **Dataset Type** | Surveillance (Inactive) | +| **Geographic Levels** | Only a specific list of full state names are permitted. See the `locations` output of the [meta_norostat](norostat_meta.md#norostat-metadata-1) endpoint for the allowed values. | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2020w30. | +| **Temporal Scope Start** | 2012w31 | +| **License** | [Publicly Accessible US Government](https://www.usa.gov/government-works) | + +## Overview +{: .no_toc} + +This data source provides norovirus surveillance data for US states, collected through the NoroSTAT system via the US CDC. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -**NOTE**: Delphi stopped stopped acquiring data from this data source in November 2020. +{: .note} +> **Note:** Restricted access: This endpoint requires authentication. + +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Estimation + +NoroSTAT data is derived from the CDC's sentinel surveillance system, which tracks norovirus outbreaks in participating states. The `value` field represents raw outbreak counts. + +Outbreak reports are aggregated weekly. No additional smoothing or statistical adjustments are applied by Delphi. + +## Lag and Backfill + +* **Lag:** Historically, data was released with a lag of several weeks. +* **Backfill:** NoroSTAT data was subject to revisions as new reports were finalized or historical data was updated by participating states. The API tracks these revisions via the `release_date`. + +## Limitations + +* Data is only available for specific lists of participating states. Use the [NoroSTAT Metadata](norostat_meta.md) endpoint to check available locations. + + +## The API + +The base URL is: + + +### Parameters + +#### Required + +| Parameter | Description | Type | +| --- | --- | --- | +| `auth` | password | string | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.html)) | `list` of epiweeks | +| `location` | Location string. Must be an exact match from the `location` field of the [NoroSTAT Metadata](norostat_meta.md) endpoint. | string | + +### Response + +| Field | Description | Type | +|---------------------------|-----------------------------------------------------------------|------------------| +| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | +| `epidata` | list of results | array of objects | +| `epidata[].release_date` | date when data was released | date (YYYY-MM-DD)| +| `epidata[].epiweek` | epiweek for the data point | integer | +| `epidata[].value` | count of norovirus outbreaks | integer | +| `message` | `success` or error message | string | + +## Example URLs + +### NoroSTAT on 2015w01 + + +```json +{ + "result": 1, + "epidata": [ + { + "release_date": "2014-10-21", + "epiweek": 201233, + "value": 2 + } + ], + "message": "success" +} +``` + +## Code Samples + +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch NoroSTAT data for the most recent available states for epiweek `201501`. -## NoroSTAT Data +
+
+ + -... +
-# The API +
-The base URL is: https://api.delphi.cmu.edu/epidata/norostat/ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pvt_norostat(auth='auth_token', locations=['Minnesota, Ohio, Oregon, Tennessee, and Wisconsin'], epiweeks=[201501]) +print(res) +``` +
-## Parameters +
-### Required +```R +library(epidatr) +# Fetch data +res <- pvt_norostat(auth = 'auth_token', locations = 'Minnesota, Ohio, Oregon, Tennessee, and Wisconsin', epiweeks = 201501) +print(res) +``` +
- +
-## Response +### Legacy Clients -| Field | Description | Type | -|-----------|-----------------------------------------------------------------|------------------| -| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | -| `epidata` | list of results | array of objects | -| ... | ... | ... | -| `message` | `success` or error message | string | +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). -# Example URLs +
+
+ + + +
- +
-# Code Samples +Optionally install the package using pip(env): +```bash +pip install delphi-epidata +``` + +Otherwise, place `delphi_epidata.py` from this repo next to your python script. + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.norostat('auth_token', ['Minnesota, Ohio, Oregon, Tennessee, and Wisconsin'], [201501]) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$norostat(auth = "auth_token", locations = list("Minnesota, Ohio, Oregon, Tennessee, and Wisconsin"), epiweeks = list(201501)) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
- +
diff --git a/docs/api/norostat_meta.md b/docs/api/norostat_meta.md index 47b99dfd0..ec3ebc66d 100644 --- a/docs/api/norostat_meta.md +++ b/docs/api/norostat_meta.md @@ -1,50 +1,199 @@ --- -title: inactive NoroSTAT Metadata -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: NoroSTAT Metadata permalink: api/meta_norostat.html --- # NoroSTAT Metadata +{: .no_toc} -This is the documentation of the API for accessing the NoroSTAT Metadata (`meta_norostat`) endpoint of -the [Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `meta_norostat` | +| **Data Source** | [CDC NoroSTAT](https://www.cdc.gov/norovirus/php/reporting/norostat-data.html) | +| **Reporting Cadence** | Inactive - Delphi stopped stopped acquiring data from this data source in November 2020. | +| **License** | [Publicly Accessible US Government](https://www.usa.gov/government-works) | + +## Overview +{: .no_toc} + +This endpoint is a companion data source to the [NoroSTAT](norostat.md) endpoint. +It describes when the NoroSTAT endpoint was last updated and for which locations. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## NoroSTAT Metadata - -... - -# The API - -The base URL is: https://api.delphi.cmu.edu/epidata/meta_norostat/ - -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. - -## Parameters - -### Required - - - -## Response - -| Field | Description | Type | -|-----------|-----------------------------------------------------------------|------------------| -| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | -| `epidata` | list of results | array of objects | -| ... | ... | ... | -| `message` | `success` or error message | string | - -# Example URLs - - - -# Code Samples +{: .note} +> **Note:** Restricted access: This endpoint requires authentication. + +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + + +## The API + +The base URL is: + + +### Parameters + +#### Required + +| Parameter | Description | Type | +| --- | --- | --- | +| `auth` | password | string | + +### Response + +| Field | Description | Type | +|-------------------------------|-----------------------------------------------------------------|------------------| +| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | +| `epidata` | metadata object containing locations and releases | object | +| `epidata.locations` | list of location sets available over time | array of objects | +| `epidata.locations[].location`| comma-separated list of state names available in this release | string | +| `epidata.releases` | list of data release dates | array of objects | +| `epidata.releases[].release_date` | date when data was released (YYYY-MM-DD) | string | +| `message` | `success` or error message | string | + +## Example URLs + +### NoroSTAT Metadata + + +```json +{ + "result": 1, + "epidata": { + "locations": [ + { + "location": "Massachusetts, Michigan, Minnesota, Nebraska, New Mexico, Ohio, Oregon, South Carolina, Tennessee, Virginia, Wisconsin, and Wyoming" + }, + { + "location": "Massachusetts, Michigan, Minnesota, New Mexico, Ohio, Oregon, South Carolina, Tennessee, Virginia, Wisconsin, and Wyoming" + }, + { + "location": "Massachusetts, Michigan, Minnesota, Ohio, Oregon, South Carolina, Tennessee, Virginia, and Wisconsin" + }, + { + "location": "Michigan, Minnesota, Ohio, Oregon, South Carolina, Tennessee, and Wisconsin" + }, + { + "location": "Minnesota, Ohio, Oregon, Tennessee, and Wisconsin" + } + ], + "releases": [ + {"release_date": "2014-10-21"}, + {"release_date": "2015-03-30"}, + ...] + }, + "message": "success" +} +``` + +## Code Samples + +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch NoroSTAT Metadata. + +
+
+ + + +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pvt_meta_norostat(auth='auth_token') +print(res) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pvt_meta_norostat(auth = 'auth_token') +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
+ +Optionally install the package using pip(env): +```bash +pip install delphi-epidata +``` + +Otherwise, place `delphi_epidata.py` from this repo next to your python script. + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.meta_norostat('auth_token') +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$meta_norostat(auth = "auth_token") +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
- +
diff --git a/docs/api/paho_dengue.md b/docs/api/paho_dengue.md index 70d3bb300..917a24848 100644 --- a/docs/api/paho_dengue.md +++ b/docs/api/paho_dengue.md @@ -1,49 +1,214 @@ --- -title: inactive PAHO Dengue -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: PAHO Dengue --- # PAHO Dengue +{: .no_toc} -This is the documentation of the API for accessing the PAHO Dengue (`paho_dengue`) endpoint of -the [Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `paho_dengue` | +| **Data Source** | [Pan American Health Organization (PAHO) Dengue surveillance](https://www.paho.org/en/arbo-portal/dengue-data-and-analysis) | +| **Geographic Levels** | Countries and territories in the Americas (see [Geographic Codes](geographic_codes.md#countries-and-territories-in-the-americas))
*Note: Data availability varies by country.* | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2020w31 | +| **Temporal Scope Start** | 2014w01 | +| **License** | This was scraped from a publicly-accessible website, but no explicit license terms were found. | + +## Overview +{: .no_toc} + +This endpoint provides weekly dengue case counts for countries and territories in the Americas, as reported by the Pan American Health Organization (PAHO). General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## PAHO Dengue Data +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Estimation + +Data is scraped from PAHO epidemiological reports. The endpoint exposes cumulative counts per calendar year for each country. + +The available indicators include: +* **`num_dengue`**: Total cumulative cases of dengue. +* **`num_severe`**: Cumulative cases of severe dengue. +* **`num_deaths`**: Cumulative dengue-related deaths. +* **`incidence_rate`**: Incidence rate per 100,000 population, calculated as `(num_dengue / total_pop) * 100` (where `total_pop` is in thousands). + +No additional smoothing or statistical adjustments are applied by Delphi. + +## Lag and Backfill + +* **Lag:** Historically, data was updated weekly but with varying reporting lags depending on the country or territory. +* **Backfill:** Historical values were subject to revisions by PAHO as more laboratory confirmations were finalized. Delphi tracks these via the `issue` and `release_date`. + +## Limitations + +* Not all countries report all metrics (e.g., severe cases or deaths) consistently every week. + + + +## The API + +The base URL is: + + +### Parameters + +#### Required + +| Parameter | Description | Type | +| --- | --- | --- | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `regions` | regions | `list` of region labels (see [Geographic Codes](geographic_codes.md#paho-dengue)) | -... +### Response -# The API +| Field | Description | Type | +|------------------------------|-----------------------------------------------------------------|------------------| +| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | +| `epidata` | list of results | array of objects | +| `epidata[].release_date` | date when data was released | date (YYYY-MM-DD)| +| `epidata[].region` | region label (ISO 3166-1 alpha-2 code) | string | +| `epidata[].serotype` | dengue serotype information | string | +| `epidata[].issue` | epiweek when data was issued | integer | +| `epidata[].epiweek` | epiweek for the data point | integer | +| `epidata[].lag` | number of weeks between epiweek and issue | integer | +| `epidata[].total_pop` | total population (in thousands) | integer | +| `epidata[].num_dengue` | total number of dengue cases | integer | +| `epidata[].num_severe` | number of severe dengue cases | integer | +| `epidata[].num_deaths` | number of dengue-related deaths | integer | +| `epidata[].incidence_rate` | incidence rate per 100,000 population | float | +| `message` | `success` or error message | string | -The base URL is: https://api.delphi.cmu.edu/epidata/paho_dengue/ +## Example URLs -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +### PAHO Dengue on 2015w01 (Canada) + -## Parameters +```json +{ + "result": 1, + "epidata": [ + { + "release_date": "2020-08-07", + "region": "CA", + "serotype": " ", + "issue": 202032, + "epiweek": 201501, + "lag": 291, + "total_pop": 0, + "num_dengue": 0, + "num_severe": 0, + "num_deaths": 0, + "incidence_rate": 0.0 + } + ], + "message": "success" +} +``` -### Required +## Code Samples - +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch PAHO Dengue data for Canada for epiweek `201501`. -## Response +
+
+ + -| Field | Description | Type | -|-----------|-----------------------------------------------------------------|------------------| -| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | -| `epidata` | list of results | array of objects | -| ... | ... | ... | -| `message` | `success` or error message | string | +
-# Example URLs +
- +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` -# Code Samples +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_paho_dengue(regions=['ca'], epiweeks=[201501]) +print(res) +``` +
- +
+ +```R +library(epidatr) +# Fetch data +res <- pub_paho_dengue(regions = 'ca', epiweeks = 201501) +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
+ +Place `delphi_epidata.py` from this repo next to your python script. + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.paho_dengue(['ca'], [201501]) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$paho_dengue(regions = list("ca"), epiweeks = list(201501)) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
+ +
diff --git a/docs/api/quidel.md b/docs/api/quidel.md index 28655e219..25274a0f0 100644 --- a/docs/api/quidel.md +++ b/docs/api/quidel.md @@ -1,41 +1,199 @@ --- -title: inactive Quidel -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: Quidel --- # Quidel +{: .no_toc} -This is the documentation of the API for accessing the Quidel (`quidel`) endpoint of the Delphi’s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `quidel` | +| **Data Source** | QuidelOrtho Corp. influenza testing data | +| **Geographic Levels** | Department of Health & Human Services (HHS) Regions (see [Geographic Codes](geographic_codes.md#hhs-regions)) | +| **Temporal Granularity** | Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2020w15| +| **Temporal Scope Start** | 2015w35 | +| **License** | Permission by QuidelOrtho | + +## Overview +{: .no_toc} + +This data source provides influenza testing data from Quidel Corporation, covering HHS health regions. Data is aggregated by unique device. Covers US states (excluding some like FL in older mappings). General topics not specific to any particular endpoint are discussed in the [API overview](https://cmu-delphi.github.io/delphi-epidata/). Such topics include: [contributing](https://cmu-delphi.github.io/delphi-epidata/api/README.html#contributing), [citing](https://cmu-delphi.github.io/delphi-epidata/api/README.html#citing), and [data licensing](https://cmu-delphi.github.io/delphi-epidata/api/README.html#data-licensing). -## Quidel Data +{: .note} +> **Note:** Restricted access: This endpoint requires authentication. + +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} -Data provided by Quidel Corp., which contains flu lab test results. +## Estimation + +Data is aggregated from Quidel's network and reports the average number of test records per unique device within the given HHS region and epiweek: + +$$Value = \frac{\text{Total Test Records}}{\text{Number of Unique Devices}}$$ + +{: .important } +> This metric reflects the average testing volume per device, not the positivity rate. + +For further details on data processing, lag, and limitations, please refer to the [main endpoint documentation regarding Quidel data](covidcast-signals/quidel.md). ## The API -The base URL is: https://api.delphi.cmu.edu/epidata/quidel/ +The base URL is: See this [documentation](https://cmu-delphi.github.io/delphi-epidata/api/README.html) for details on specifying epiweeks, dates, and lists. -## Parameters +### Parameters -### Required +#### Required | Parameter | Description | Type | | --- | --- | --- | | `auth` | password | string | -| `epiweeks` | epiweeks | `list` of epiweeks | -| `locations` | locations | `list` of `hhs<#>` [region](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/regions.txt) labels | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | +| `locations` | locations | `list` of `hhs<#>` region labels (see [Geographic Codes](geographic_codes.md#hhs-regions)) | + +### Response + +| Field | Description | Type | +|-----------------------|-----------------------------------------------------------------|------------------| +| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | +| `epidata` | list of results | array of objects | +| `epidata[].location` | HHS region label | string | +| `epidata[].epiweek` | epiweek for the data point | integer | +| `epidata[].value` | average number of test records per unique facility | float | +| `message` | `success` or error message | string | + +## Example URLs + +### Quidel on 2015w35-2020w01 (HHS Region 1) + + +```json +{ + "result": 1, + "epidata": [ + { + "location": "hhs1", + "epiweek": 201535, + "value": 2.0 + }, + { + "location": "hhs1", + "epiweek": 201536, + "value": 6.16667 + }, + ... + ], + "message": "success" +} +``` + +## Code Samples + +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch Quidel data for HHS Region 1 for epiweeks `201535-202001`. + +
+
+ + + +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pvt_quidel(auth='auth_token', locations=['hhs1'], epiweeks=EpiRange(201535, 202001)) +print(res) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pvt_quidel(auth = 'auth_token', locations = 'hhs1', epiweeks = epirange(201535, 202001)) +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
+ +Optionally install the package using pip(env): +```bash +pip install delphi-epidata +``` + +Otherwise, place `delphi_epidata.py` from this repo next to your python script. + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.quidel('auth_token', ['hhs1'], Epidata.range(201535, 202001)) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$quidel(auth = "auth_token", locations = list("hhs1"), epiweeks = Epidata$range(201535, 202001)) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + -## Response +```html + + + + +``` +
-| Field | Description | Type | -|-----------|-----------------------------------------------------------------|------------------| -| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | -| `epidata` | list of results | array of objects | -| ... | ... | ... | -| `message` | `success` or error message | string | \ No newline at end of file +
diff --git a/docs/api/twitter.md b/docs/api/twitter.md index e14d940b6..8b7190992 100644 --- a/docs/api/twitter.md +++ b/docs/api/twitter.md @@ -1,77 +1,223 @@ --- -title: inactive Twitter Stream -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: Twitter Stream --- # Twitter Stream +{: .no_toc} -This is the API documentation for accessing the Twitter Stream (`twitter`) -endpoint of [Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `twitter` | +| **Data Source** | [HealthTweets](http://www.healthtweets.org/) | +| **Geographic Levels** | National, Department of Health & Human Services (HHS) Regions, Census Divisions, State (see [Geographic Codes](geographic_codes.md#us-regions-and-states)) | +| **Temporal Granularity** | Daily and Weekly (Epiweek) | +| **Reporting Cadence** | Inactive - No longer updated since 2020w31 (2020-12-07)| +| **Temporal Scope Start** | 2011w48 (2011-11-27) | + + + +## Overview +{: .no_toc} + +This data source provides estimates of influenza activity derived from the content of public Twitter posts. The data was processed by HealthTweets.org using natural language processing (NLP) to classify tweets as flu-related. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## Twitter Stream Data +{: .note} +> **Note:** Restricted access: This endpoint requires authentication. -Estimate of influenza activity based on analysis of language used in tweets. - - Source: [HealthTweets](http://www.healthtweets.org/) - - Temporal Resolution: Daily and weekly from 2011-12-01 (2011w48) - - Spatial Resolution: National, [HHS regions](http://www.hhs.gov/iea/regional/), and [Census divisions](http://www.census.gov/econ/census/help/geography/regions_and_divisions.html) ([1+10+9](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/regions.txt)); and by state/territory ([51](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/states.txt)) - - Restricted access: Delphi doesn't have permission to share this dataset +## Table of contents +{: .no_toc .text-delta} -# The API +1. TOC +{:toc} -The base URL is: https://api.delphi.cmu.edu/epidata/twitter/ -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +## Estimation -## Parameters +The classification and processing pipeline involves several stages to transform raw Twitter data into health trends: -### Required +1. **Data Collection**: Two streams are collected via the Twitter Streaming API: + * **HEALTH Stream**: Capped at 1% of public tweets, filtered using 269 health-related keywords. + * **SAMPLE Stream**: A random 1% sample of all public tweets. +2. **Classification**: A statistical classifier identifies health-related tweets within the HEALTH stream (estimated F1-score of 0.70). These are further processed to distinguish actual influenza reports from general awareness or concern. +3. **Geolocation**: Every identified health tweet and every tweet from the SAMPLE stream is geolocated using **Carmen**, which resolves location down to the city level using profile data and geotags. +4. **Normalization**: The volume of identified influenza infections (`num`) is normalized by the total volume of tweets from the same location in the SAMPLE stream (`total`) to calculate the prevalence (`percent`). +5. **Gap Filling**: Missing data (e.g., due to network interruptions) is estimated based on adjacent days. -| Parameter | Description | Type | -| --- | --- | --- | -| `auth` | password | string | -| `locations` | locations | `list` of [region](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/regions.txt)/[state](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/states.txt) labels | -| `dates` | dates | `list` of dates | -| `epiweeks` | epiweeks | `list` of epiweeks | +For more technical details, see the [research paper below](#citing-the-survey). + +## Limitations + +* Highly dependent on Twitter's API access and terms of service, which have changed significantly. +* Twitter users are not a representative sample of the general population. -Note: -- Only one of `dates` and `epiweeks` is required. If both are provided, `epiweeks` is ignored. +## The API -## Response +The base URL is: -| Field | Description | Type | -|-----------|-----------------------------------------------------------------|------------------| -| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | -| `epidata` | list of results | array of objects | -| ... | ... | ... | -| `message` | `success` or error message | string | -# Example URLs +### Parameters + +#### Required + +| Parameter | Description | Type | +| --- | --- | --- | +| `auth` | password | string | +| `locations` | locations | `list` of location codes: `nat`, HHS regions, Census divisions, or state codes (see [Geographic Codes](geographic_codes.md#us-regions-and-states)) | +| `dates` | dates (see [Date Formats](date_formats.md)) | `list` of dates | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.md)) | `list` of epiweeks | + +{: .note} +> **Note:** Only one of `dates` and `epiweeks` is required. If both are provided, `epiweeks` is ignored. + +### Response + +| Field | Description | Type | +|-----------------------|-----------------------------------------------------------------|------------------| +| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | +| `epidata` | list of results | array of objects | +| `epidata[].location` | location label | string | +| `epidata[].date` | date (yyyy-MM-dd) | string | +| `epidata[].epiweek` | epiweek | integer | +| `epidata[].num` | number of flu-related tweets in the HEALTH stream (see [Methodology](#methodology)) | integer | +| `epidata[].total` | total number of tweets in the random SAMPLE stream for the same location | integer | +| `epidata[].percent` | flu-related tweets normalized based on the number +of tweets in SAMPLE | float | +| `message` | `success` or error message | string | + +## Example URLs ### Twitter on 2015w01 (national) -https://api.delphi.cmu.edu/epidata/twitter/?auth=...&locations=nat&epiweeks=201501 + ```json { - "result":1, - "epidata":[...], - "message":"success" + "result": 1, + "epidata": [ + { + "location": "nat", + "num": 3067, + "total": 443291, + "epiweek": 201501, + "percent": 0.6919 + } + ], + "message": "success" } ``` # Citing the Survey Researchers who use the Twitter Stream data for research are asked to credit and cite the survey in publications based on the data. Specifically, we ask that you cite our paper describing the survey: - > Mark Dredze, Renyuan Cheng, Michael J Paul, David A Broniatowski. HealthTweets.org: A Platform for Public Health Surveillance using Twitter. AAAI Workshop on the World Wide Web and Public Health + > Mark Dredze, Renyuan Cheng, Michael J Paul, David A Broniatowski. HealthTweets.org: A Platform for Public Health Surveillance using Twitter. AAAI Workshop on the World Wide Web and Public Health > Intelligence, 2014. - -# Code Samples - +## Code Samples + +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch Twitter data for national level for epiweek `201501`. + +
+
+ + + +
+ +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pvt_twitter(auth='auth_token', locations=['nat'], time_type="week", time_values=[201501]) +print(res) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pvt_twitter(auth = 'auth_token', locations = 'nat', + time_type = "week", time_values = 201501) +print(res) +``` +
+ +
+ +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
+ +Optionally install the package using pip(env): +```bash +pip install delphi-epidata +``` + +Otherwise, place `delphi_epidata.py` from this repo next to your python script. + +```python +# Import +from delphi_epidata import Epidata +# Fetch data +res = Epidata.twitter('auth_token', ['nat'], time_type="week", time_values=[201501]) +print(res['result'], res['message'], len(res['epidata'])) +``` +
+ +
+ +Place `delphi_epidata.R` from this repo next to your R script. + +```R +source("delphi_epidata.R") +# Fetch data +res <- Epidata$twitter(auth = "auth_token", locations = list("nat"), time_type = "week", time_values = list(201501)) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + + +```html + + + + +``` +
+ +
diff --git a/docs/api/wiki.md b/docs/api/wiki.md index ba780ea6f..91ccb91dd 100644 --- a/docs/api/wiki.md +++ b/docs/api/wiki.md @@ -1,74 +1,231 @@ --- -title: inactive Wikipedia Access -parent: Data Sources and Signals -grand_parent: Other Endpoints (COVID-19 and Other Diseases) -nav_order: 2 +parent: Inactive Sources (Other) +grand_parent: Data Sources and Signals +title: Wikipedia Access --- # Wikipedia Access +{: .no_toc} -This is the API documentation for accessing the Wikipedia Access (`wiki`) -endpoint of [Delphi](https://delphi.cmu.edu/)'s epidemiological data. + +| Attribute | Details | +| :--- | :--- | +| **Source Name** | `wiki` | +| **Data Source** | [Wikimedia pageviews](https://dumps.wikimedia.org/other/pagecounts-raw/) for health-related Wikipedia articles | +| **Geographic Levels** | Not applicable (article-based) | +| **Temporal Granularity** | Hourly, Daily, and Weekly (Epiweek) | +| **Available Articles** | [54 health-related articles](#available-articles) | +| **Reporting Cadence** | Inactive - No longer updated since 2021w11| +| **Temporal Scope Start** | 2007w50 (December 9th, 2007) | +| **License** | [CC BY-SA](https://creativecommons.org/licenses/by-sa/4.0/) | + + +## Overview +{: .no_toc} + +This data source measures public interest in health topics by tracking access counts for specific influenza-related articles on English-language Wikipedia. Delphi aggregates these counts from Wikimedia's public pageview dumps, providing a proxy for information-seeking behavior and public awareness of the flu. General topics not specific to any particular endpoint are discussed in the [API overview](README.md). Such topics include: [contributing](README.md#contributing), [citing](README.md#citing), and [data licensing](README.md#data-licensing). -## Wikipedia Access Data +## Table of contents +{: .no_toc .text-delta} + +1. TOC +{:toc} + +## Estimation + +Counts are extracted directly from Wikimedia's public pageviews dumps. -Number of page visits for selected English, Influenza-related wikipedia articles. - - Source: [Wikimedia](https://dumps.wikimedia.org/other/pagecounts-raw/) - - Temporal Resolution: Hourly, daily, and weekly from 2007-12-09 (2007w50) - - Spatial Resolution: N/A - - Other resolution: By article ([54](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/articles.txt)) - - Open access +The available indicators include: +* **`count`**: The number of pageviews for the specific article in the given language and time period. +* **`total`**: The total number of pageviews for all articles in the specified language during the same time period. +* **`value`**: The normalized pageview rate, calculated as `(count / total) * 1,000,000` (views per million). -# The API +Counts are aggregated by hour and then summed to daily or weekly totals. No smoothing is applied. -The base URL is: https://api.delphi.cmu.edu/epidata/wiki/ + -See [this documentation](README.md) for details on specifying epiweeks, dates, and lists. +## Limitations -## Parameters +* Information-seeking behaviour does not always correlate perfectly with disease incidence. -### Required + +## The API + +The base URL is: + + +### Parameters + +#### Required | Parameter | Description | Type | | --- | --- | --- | -| `articles` | articles | list of [articles](https://github.com/cmu-delphi/delphi-epidata/blob/main/labels/articles.md) | +| `articles` | articles | list of [articles](#available-articles) | | `language` | language (currently `en`, `es`, and `pt` supported) | string | -| `dates` | dates | `list` of dates | -| `epiweeks` | epiweeks | `list` of epiweeks | - -Note: -- Only one of `dates` and `epiweeks` is required. If both are provided, `epiweeks` is ignored. - -### Optional +| `dates` | dates (see [Date Formats](date_formats.html)) | `list` of dates | +| `epiweeks` | epiweeks (see [Date Formats](date_formats.html)) | `list` of epiweeks | + +##### Available Articles + +Articles are categorized by the disease or condition they are most closely related to. Note that some articles (like "fever" or "nausea") may overlap across categories. + +###### Influenza (Flu) +
+Click to expand + +| Article Name | +|---| +| amantadine | +| antiviral_drugs | +| avian_influenza | +| canine_influenza | +| cat_flu | +| chills | +| common_cold | +| cough | +| equine_influenza | +| fatigue_(medical) | +| fever | +| flu_season | +| gastroenteritis | +| headache | +| hemagglutinin_(influenza) | +| human_flu | +| influenza | +| influenzalike_illness | +| influenzavirus_a | +| influenzavirus_c | +| influenza_a_virus | +| influenza_a_virus_subtype_h10n7 | +| influenza_a_virus_subtype_h1n1 | +| influenza_a_virus_subtype_h1n2 | +| influenza_a_virus_subtype_h2n2 | +| influenza_a_virus_subtype_h3n2 | +| influenza_a_virus_subtype_h3n8 | +| influenza_a_virus_subtype_h5n1 | +| influenza_a_virus_subtype_h7n2 | +| influenza_a_virus_subtype_h7n3 | +| influenza_a_virus_subtype_h7n7 | +| influenza_a_virus_subtype_h7n9 | +| influenza_a_virus_subtype_h9n2 | +| influenza_b_virus | +| influenza_pandemic | +| influenza_prevention | +| influenza_vaccine | +| malaise | +| myalgia | +| nasal_congestion | +| nausea | +| neuraminidase_inhibitor | +| orthomyxoviridae | +| oseltamivir | +| paracetamol | +| rhinorrhea | +| rimantadine | +| shivering | +| sore_throat | +| swine_influenza | +| viral_neuraminidase | +| viral_pneumonia | +| vomiting | +| zanamivir | + +
+ +###### Norovirus (Noro) +
+Click to expand + +| Article Name | +|---| +| abdominal_pain | +| caliciviridae | +| dehydration | +| diarrhea | +| fecal–oral_route | +| foodborne_illness | +| gastroenteritis | +| intravenous_therapy | +| leaky_scanning | +| nausea | +| norovirus | +| oral_rehydration_therapy | +| rotavirus | +| shellfish | +| vomiting | + +
+ +###### Dengue +
+Click to expand + +| Article Name | +|---| +| aedes | +| aedes_aegypti | +| arthralgia | +| blood_transfusion | +| dengue_fever | +| dengue_vaccine | +| dengue_virus | +| diarrhea | +| exanthem | +| fever | +| flavivirus | +| headache | +| hematuria | +| mosquito | +| mosquito-borne_disease | +| myalgia | +| nausea | +| nosebleed | +| paracetamol | +| petechia | +| rhinitis | +| thrombocytopenia | +| vomiting | + +
+ + + +#### Optional | Parameter | Description | Type | |-----------|-------------|------------------------| | `hours` | hours | `list` of hours (0-23) | -## Response +{: .note} +> **Notes:** +> - Only one of `dates` and `epiweeks` is required. If both are provided, `epiweeks` is ignored. +> - `dates`, `epiweeks`, and `hours` are `None` by default. +> - `language` is `en` by default. + +### Response | Field | Description | Type | |---------------------|-----------------------------------------------------------------|------------------| | `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | | `epidata` | list of results | array of objects | -| `epidata[].article` | | string | -| `epidata[].count` | | integer | -| `epidata[].total` | | integer | -| `epidata[].hour` | hour (-1 if `hour` not used) | integer | -| `epidata[].date` | date (yyyy-MM-dd) (only included if `date` used) | string | -| `epidata[].epiweek` | epiweek (only included if `epiweek` used) | integer | -| `epidata[].value` | | float | +| `epidata[].article` | Wikipedia article name | string | +| `epidata[].count` | article-specific pageview count for the requested period/hours | integer | +| `epidata[].total` | total Wikipedia pageviews for the specified `language` (e.g., all English Wikipedia traffic) over the same period/hours | integer | +| `epidata[].hour` | hour (0-23) of access (-1 if not filtering by hour) | integer | +| `epidata[].date` | date (yyyy-MM-dd) | string | +| `epidata[].epiweek` | epiweek | integer | +| `epidata[].value` | normalized pageview count (pageviews per million total language traffic): `(count / total) * 10^6` | float | | `message` | `success` or error message | string | -# Example URLs +## Example URLs ### Wikipedia Access article "influenza" on 2020w01 -https://api.delphi.cmu.edu/epidata/wiki/?language=en&articles=influenza&epiweeks=202001 + ```json { @@ -88,7 +245,7 @@ https://api.delphi.cmu.edu/epidata/wiki/?language=en&articles=influenza&epiweeks ``` ### Wikipedia Access article "influenza" on date 2020-01-01 -https://api.delphi.cmu.edu/epidata/wiki/?language=en&articles=influenza&dates=20200101 + ```json { @@ -107,54 +264,103 @@ https://api.delphi.cmu.edu/epidata/wiki/?language=en&articles=influenza&dates=20 } ``` -# Code Samples +## Code Samples -Libraries are available for [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/delphi_epidata.js), [Python](https://pypi.org/project/delphi-epidata/), and [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R). -The following samples show how to import the library and fetch national Wikipedia Access data for article "influenza" on -epiweeks `201940` and `202001-202010` (11 weeks total) for hours 0 and 12 in English. +Libraries are available for [R](https://cmu-delphi.github.io/epidatr/) and [Python](https://cmu-delphi.github.io/epidatpy/). +The following samples show how to import the library and fetch Wikipedia Access data for article "influenza" in English for epiweeks `202001-202010` (10 weeks total) and hours 0 and 12. - +
+
+ + -### JavaScript (in a web browser) +
-````html - - - - -```` +
+ +Install the package using pip: +```bash +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +``` + +```python +# Import +from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange +# Fetch data +epidata = EpiDataContext() +res = epidata.pub_wiki(articles=['influenza'], time_values=EpiRange(202001, 202010), time_type='week', language='en', hours=[0, 12]) +print(res) +``` +
+ +
+ +```R +library(epidatr) +# Fetch data +res <- pub_wiki(articles = "influenza", time_values = epirange(202001, 202010), + time_type = "week", language = "en", hours = c(0, 12)) +print(res) +``` +
+ +
-### Python +### Legacy Clients + +We recommend using the modern client libraries mentioned above. Legacy clients are also available for [Python](https://pypi.org/project/delphi-epidata/), [R](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R), and [JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.js). + +
+
+ + + +
+ +
Optionally install the package using pip(env): -````bash +```bash pip install delphi-epidata -```` +``` Otherwise, place `delphi_epidata.py` from this repo next to your python script. -````python +```python # Import from delphi_epidata import Epidata # Fetch data -res = Epidata.wiki(['influenza'], None, [201940, Epidata.range(202001, 202010)], [0, 12]) +res = Epidata.wiki(['influenza'], Epidata.range(202001, 202010), {'time_type': 'week', 'language': 'en', 'hours': [0, 12]}) print(res['result'], res['message'], len(res['epidata'])) -```` +``` +
-Note: -- `dates`, `epiweeks`, and `hours` are `None` by default. -- `language` is `en` by default. +
-### R +Place `delphi_epidata.R` from this repo next to your R script. -````R -# Import -source('delphi_epidata.R') +```R +source("delphi_epidata.R") # Fetch data -res <- Epidata$wiki(list('nat'), NULL, list(201940, Epidata$range(202001, 202010)), list(0, 12), 'en') -cat(paste(res$result, res$message, length(res$epidata), "\n")) -```` +res <- Epidata$wiki(articles = list("influenza"), time_values = Epidata$range(202001, 202010), time_type = "week", options = list(language = "en", hours = list(0, 12))) +print(res$message) +print(length(res$epidata)) +``` +
+ +
+ + +```html + + + + +``` +
+ +
diff --git a/docs/symptom-survey/contingency-tables.md b/docs/symptom-survey/contingency-tables.md index f92ee1ef4..b05a871aa 100644 --- a/docs/symptom-survey/contingency-tables.md +++ b/docs/symptom-survey/contingency-tables.md @@ -30,7 +30,7 @@ territories worldwide, also [through ICPSR](https://www.icpsr.umich.edu/web/ICPSR/studies/39206). These tables are more detailed than the [coarse aggregates reported in the -COVIDcast Epidata API](../api/covidcast-signals/fb-survey.md), which are grouped +COVIDcast Epidata API](../api/covidcast-signals/covid-trends-and-impact-survey.md), which are grouped only by geographic region. [Individual response data](survey-files.md) for the survey is available, but only to researchers who request restricted data access via ICPSR, whereas these contingency tables are available to the general public. diff --git a/docs/symptom-survey/data-access.md b/docs/symptom-survey/data-access.md index 435f07ee2..6c30c759c 100644 --- a/docs/symptom-survey/data-access.md +++ b/docs/symptom-survey/data-access.md @@ -13,7 +13,7 @@ well-being. This may help improve our local and national responses to the pandemic and our understanding of how it has affected society. [High-level aggregates](../api/covidcast.md) of select survey items are -publicly available in the [COVIDcast API](../api/covidcast-signals/fb-survey.md). +publicly available in the [COVIDcast API](../api/covidcast-signals/covid-trends-and-impact-survey.md). [Finer aggregates](./contingency-tables.md) grouped by various demographic characteristics are available for download. diff --git a/docs/symptom-survey/index.md b/docs/symptom-survey/index.md index 48b42b012..dbba7e899 100644 --- a/docs/symptom-survey/index.md +++ b/docs/symptom-survey/index.md @@ -40,7 +40,7 @@ If you have questions about the survey or getting access to data, contact us at The [survey results dashboard](https://delphi.cmu.edu/covidcast/survey-results/) provides a high-level summary of survey results. Geographically aggregated data from this survey is publicly available through the [COVIDcast API](../api/covidcast.md) -as the [`fb-survey` data source](../api/covidcast-signals/fb-survey.md). Demographic breakdowns of survey +as the [`fb-survey` data source](../api/covidcast-signals/covid-trends-and-impact-survey.md). Demographic breakdowns of survey data are publicly available as [downloadable contingency tables](contingency-tables.md). CTIS data has been used in [numerous peer-reviewed publications](publications.md). diff --git a/docs/symptom-survey/weights.md b/docs/symptom-survey/weights.md index 3cd1c60ee..a6a5df858 100644 --- a/docs/symptom-survey/weights.md +++ b/docs/symptom-survey/weights.md @@ -10,7 +10,7 @@ nav_order: 5 The survey's individual response files contain respondent weights calculated by Facebook. These weights are also used to produce our [public contingency tables](./contingency-tables.md) and the geographic aggregates -[in the COVIDcast Epidata API](../api/covidcast-signals/fb-survey.md). +[in the COVIDcast Epidata API](../api/covidcast-signals/covid-trends-and-impact-survey.md). Facebook has developed a [User Guide for the CTIS Weights](https://dataforgood.facebook.com/dfg/resources/user-guide-for-ctis-weights)