Delphi’s Dengue Nowcast

Attribute Details
Source Name dengue_nowcast
Data Source Delphi
Geographic Levels Countries and territories in the Americas (see Geographic Codes)
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

Overview

This endpoint provides nowcast esimtates of dengue incidence, based on historical data and reported case counts.

General topics not specific to any particular endpoint are discussed in the API overview. Such topics include: contributing, citing, and data licensing.

Table of contents

  1. The API
    1. Parameters
      1. Required
    2. Response
  2. Example URLs
    1. Dengue Nowcast on 2015w01 (Puerto Rico)
  3. Code Samples
    1. Legacy Clients

The API

The base URL is: https://api.delphi.cmu.edu/epidata/dengue_nowcast/

Parameters

Required

Parameter Description Type
epiweeks epiweeks (see Date Formats) list of epiweeks
locations locations list of location labels (see Geographic Codes)

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[].value nowcast value float
epidata[].std standard deviation float
message success or error message string

Example URLs

Dengue Nowcast on 2015w01 (Puerto Rico)

https://api.delphi.cmu.edu/epidata/dengue_nowcast/?locations=pr&epiweeks=201401-202301

{
  "result": 1,
  "epidata": [
    {
      "location": "pr",
      "epiweek": 201501,
      "value": 12.34,
      "std": 1.23
    }
  ],
  "message": "success"
}

Code Samples

Libraries are available for R and Python. 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:

pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy"
# 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']))
library(epidatr)
# Fetch data
res <- pub_dengue_nowcast(locations = 'pr', epiweeks = epirange(201401, 202301))
print(res)

Legacy Clients

We recommend using the modern client libraries mentioned above. Legacy clients are also available for Python, R, and JavaScript.

Optionally install the package using pip(env):

pip install delphi-epidata

Otherwise, place delphi_epidata.py from this repo next to your python script.

# 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.

source("delphi_epidata.R")
# Fetch data
res <- Epidata$dengue_nowcast(locations = list("pr"), epiweeks = list(201501))
print(res$message)
print(length(res$epidata))
<!-- Imports -->
<script src="delphi_epidata.js"></script>
<!-- Fetch data -->
<script>
  EpidataAsync.dengue_nowcast('pr', [201501]).then((res) => {
    console.log(res.result, res.message, res.epidata != null ? res.epidata.length : 0);
  });
</script>