A programmatic interface to Delphi's Epidata API.
Project description
epidatpy
The Python client for the Delphi Epidata API.
Install
Install with the following commands:
# Latest dev version
pip install "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy"
# PyPI version (not yet available)
pip install epidatpy
Usage
from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange
# All calls using the `epidata` object will now be cached for 7 days
epidata = EpiDataContext(use_cache=True, cache_max_age_days=7)
# Obtain a DataFrame of the most up-to-date version of the smoothed covid-like illness (CLI)
# signal from the COVID-19 Trends and Impact survey for the US
epidata.pub_covidcast(
data_source="jhu-csse",
signals="confirmed_cumulative_num",
geo_type="nation",
time_type="day",
geo_values="us",
time_values=EpiRange(20210405, 20210410),
).df()
CAST API (snapshot / archive)
The CAST API exposes versioned signals (NSSP, pophive, NWSS, ...). Use
epidata_snapshot for a single as-of view, epidata_archive for the full
report-time history, or epidata to dispatch between them.
from epidatpy import EpiDataContext, EpiRange
epidata = EpiDataContext()
# Source-level metadata (signals, geo_types, available date ranges).
epidata.epidata_meta(source="nssp")
# Latest snapshot of a signal (omit `snapshot_date` to fetch the newest version).
epidata.epidata_snapshot(
source="nssp",
signals="pct_ed_visits_influenza",
geo_type="state",
geo_values="ca,ny",
reference_time=EpiRange("2025-01-01", "2025-06-01"),
).df()
# Full report-time history, filtered to report_times on or before 2025-10-16.
epidata.epidata_archive(
source="nssp",
signals="pct_ed_visits_influenza",
geo_type="state",
report_time="<2025-10-16",
).df()
# Router: pass `report_time` (or `snapshot_date="*"`) for archive, `snapshot_date` for snapshot.
epidata.epidata(
source="nssp",
signals="pct_ed_visits_influenza",
geo_type="state",
report_time=EpiRange("2025-01-01", "2025-10-16"),
).df()
geo_values, reference_time, and an EpiRange report_time lower
bound are filtered locally after the request.
Development
The following commands are available for developers:
make install # setup venv, install dependencies and local package
make test # run unit tests
make format # format code
make lint # check linting
make doc # build docs
make doc-preview # preview docs in browser
make release # build distribution packages
make upload # upload the current version to pypi
make clean # clean build and docs artifacts
Release Process
dev is the only long-lived branch; each release line lives on a rel-X.Y branch.
Everything is driven by the create_release
workflow, run with a bump of major, minor, or patch:
major/minor: bumps the version ondev, cuts a newrel-X.Ybranch at that commit, and tagsvX.Y.0.patch(hotfix): bumps the patch version on an existingrel-X.Ybranch and tagsvX.Y.Z. Land the fix on that branch first (commit directly or cherry-pick fromdev); setrelease_branchto pick the branch (defaults to the line matchingdev's version).
Either way the workflow creates a GitHub release
with auto-generated notes. Pushing the vX.Y.Z tag then triggers pypi_publish
(build + upload to PyPI) and documentation
(docs rebuild). Because publishing is a separate workflow keyed off the tag rather
than a step inside create_release, a failed PyPI upload can be re-run against the
existing tag via the pypi_publish workflow's Run workflow button — without redoing
the release cut.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file epidatpy-0.5.1.tar.gz.
File metadata
- Download URL: epidatpy-0.5.1.tar.gz
- Upload date:
- Size: 33.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e97b6934eec20bb93df9b8ba6efc620e05f769c11732f285146ff4b51ca4148
|
|
| MD5 |
319731eefe67867c486b8bdcdbcc4f3d
|
|
| BLAKE2b-256 |
a4c22c1b08614ab36ac0244f9eab179df817b9f7a6053ffc185775754fa6b728
|
Provenance
The following attestation bundles were made for epidatpy-0.5.1.tar.gz:
Publisher:
pypi_publish.yml on cmu-delphi/epidatpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
epidatpy-0.5.1.tar.gz -
Subject digest:
3e97b6934eec20bb93df9b8ba6efc620e05f769c11732f285146ff4b51ca4148 - Sigstore transparency entry: 1855635893
- Sigstore integration time:
-
Permalink:
cmu-delphi/epidatpy@39710c9e8671947b4989a695bf1c793edbdf47fe -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/cmu-delphi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@39710c9e8671947b4989a695bf1c793edbdf47fe -
Trigger Event:
push
-
Statement type:
File details
Details for the file epidatpy-0.5.1-py3-none-any.whl.
File metadata
- Download URL: epidatpy-0.5.1-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
737dc6cccb84e667b97a758b852e6b255e065a8e8d00110a1f5d4db3c9e3fb21
|
|
| MD5 |
82d693e18283515877b9663fe5e3e72d
|
|
| BLAKE2b-256 |
3d822aab8448fd44a79340102cce22fda31901e6deb6169666fce96de9acaf63
|
Provenance
The following attestation bundles were made for epidatpy-0.5.1-py3-none-any.whl:
Publisher:
pypi_publish.yml on cmu-delphi/epidatpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
epidatpy-0.5.1-py3-none-any.whl -
Subject digest:
737dc6cccb84e667b97a758b852e6b255e065a8e8d00110a1f5d4db3c9e3fb21 - Sigstore transparency entry: 1855635939
- Sigstore integration time:
-
Permalink:
cmu-delphi/epidatpy@39710c9e8671947b4989a695bf1c793edbdf47fe -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/cmu-delphi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@39710c9e8671947b4989a695bf1c793edbdf47fe -
Trigger Event:
push
-
Statement type: