Skip to content

Commit 1382c83

Browse files
committed
wip
1 parent ca15261 commit 1382c83

File tree

6 files changed

+164
-223
lines changed

6 files changed

+164
-223
lines changed

docs/epidatpy.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
epidatpy package
1+
epidatpy Reference
22
================
33

4+
.. toctree::
5+
:maxdepth: 4
6+
47
Submodules
58
----------
69

7-
epidatpy.async\_request module
8-
------------------------------
10+
Module contents
11+
---------------
912

10-
.. automodule:: epidatpy.async_request
13+
.. automodule:: epidatpy
1114
:members:
1215
:undoc-members:
1316
:show-inheritance:
@@ -20,10 +23,11 @@ epidatpy.request module
2023
:undoc-members:
2124
:show-inheritance:
2225

23-
Module contents
24-
---------------
26+
epidatpy.async\_request module
27+
------------------------------
2528

26-
.. automodule:: epidatpy
29+
.. automodule:: epidatpy.async_request
2730
:members:
2831
:undoc-members:
2932
:show-inheritance:
33+

docs/getting_started.rst

Lines changed: 45 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4,156 +4,143 @@ Getting Started
44
Overview
55
--------------
66

7-
This package provides access to data from various Epidata API endpoints including COVIDcast,
8-
which provides numerous COVID-related data streams, updated daily.
7+
This package provides access to data from various Epidata API endpoints including COVIDcast,
8+
which provides numerous COVID-related data streams, updated daily.
99

1010
.. _epidata-endpoints:
1111

1212
Epidata Data Sources
13-
--------------
13+
--------------------
1414
The parameters available for each source data are documented in each linked source-specific API page.
1515

16-
|
1716
**COVID-19 Data**
1817

19-
.. list-table::
18+
.. list-table::
2019
:widths: 20 20 40
2120
:header-rows: 1
2221

2322
* - Endpoint
2423
- Name
2524
- Description
26-
* - `covidcast <https://cmu-delphi.github.io/delphi-epidata/api/covidcast.html>`_
25+
* - `pub_covidcast <https://cmu-delphi.github.io/delphi-epidata/api/covidcast.html>`_
2726
- COVIDcast
2827
- Delphi’s COVID-19 surveillance streams.
29-
* - `covidcast_meta <https://cmu-delphi.github.io/delphi-epidata/api/covidcast_meta.html>`_
28+
* - `pub_covidcast_meta <https://cmu-delphi.github.io/delphi-epidata/api/covidcast_meta.html>`_
3029
- COVIDcast metadata
3130
- Metadata for Delphi's COVID-19 surveillance streams.
32-
* - `covid_hosp_facility <https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp_facility.html>`_
31+
* - `pub_covid_hosp_facility <https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp_facility.html>`_
3332
- COVID-19 Hospitalization by Facility
3433
- COVID-19 Reported Patient Impact and Hospital Capacity - Facility Lookup
35-
* - `covid_hosp <https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp.html>`_
34+
* - `pub_covid_hosp <https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp.html>`_
3635
- COVID-19 Hospitalization
3736
- COVID-19 Reported Patient Impact and Hospital Capacity.
3837

39-
|
4038
**Influenza Data**
4139

42-
.. list-table::
40+
.. list-table::
4341
:widths: 20 20 40
4442
:header-rows: 1
4543

4644
* - Endpoint
4745
- Name
4846
- Description
49-
* - `afhsb <https://cmu-delphi.github.io/delphi-epidata/api/afhsb.html>`_
50-
- AFHSB
51-
- ...
52-
* - `meta_afhsb <https://cmu-delphi.github.io/delphi-epidata/api/meta_afhsb.html>`_
53-
- AFHSB Metadata
54-
- ...
55-
* - `cdc <https://cmu-delphi.github.io/delphi-epidata/api/cdc.html>`_
56-
- CDC Page Hits
47+
* - `pvt_cdc <https://cmu-delphi.github.io/delphi-epidata/api/cdc.html>`_
48+
- CDC Page Hits
5749
- ...
58-
* - `delphi <https://cmu-delphi.github.io/delphi-epidata/api/delphi.html>`_
59-
- Delphi’s Forecast
50+
* - `pub_delphi <https://cmu-delphi.github.io/delphi-epidata/api/delphi.html>`_
51+
- Delphi’s Forecast
6052
- ...
61-
* - `ecdc_ili <https://cmu-delphi.github.io/delphi-epidata/api/ecdc_ili.html>`_
53+
* - `pub_ecdc_ili <https://cmu-delphi.github.io/delphi-epidata/api/ecdc_ili.html>`_
6254
- ECDC ILI
6355
- ECDC ILI data from the ECDC website.
64-
* - `flusurv <https://cmu-delphi.github.io/delphi-epidata/api/flusurv.html>`_
65-
- FluSurv
56+
* - `pub_flusurv <https://cmu-delphi.github.io/delphi-epidata/api/flusurv.html>`_
57+
- FluSurv
6658
- FluSurv-NET data (flu hospitaliation rates) from CDC.
67-
* - `fluview <https://cmu-delphi.github.io/delphi-epidata/api/fluview.html>`_
59+
* - `pub_fluview <https://cmu-delphi.github.io/delphi-epidata/api/fluview.html>`_
6860
- FluView
6961
- Influenza-like illness (ILI) from U.S. Outpatient Influenza-like Illness Surveillance Network (ILINet).
70-
* - `fluview_meta <https://cmu-delphi.github.io/delphi-epidata/api/fluview_meta.html>`_
62+
* - `pub_fluview_meta <https://cmu-delphi.github.io/delphi-epidata/api/fluview_meta.html>`_
7163
- FluView Metadata
7264
- Summary data about ``fluview``.
73-
* - `fluview_clinical <https://cmu-delphi.github.io/delphi-epidata/api/fluview_clinical.html>`_
65+
* - `pub_fluview_clinical <https://cmu-delphi.github.io/delphi-epidata/api/fluview_clinical.html>`_
7466
- FluView Clinical
7567
- ...
76-
* - `gft <https://cmu-delphi.github.io/delphi-epidata/api/gft.html>`_
68+
* - `pub_gft <https://cmu-delphi.github.io/delphi-epidata/api/gft.html>`_
7769
- Google Flu Trends
7870
- Estimate of influenza activity based on volume of certain search queries. This is now a static endpoint due to discontinuation.
79-
* - `ght <https://cmu-delphi.github.io/delphi-epidata/api/ght.html>`_
80-
- Google Health Trends
81-
- Estimate of influenza activity based on volume of certain search queries.
82-
* - `kcdc_ili <https://cmu-delphi.github.io/delphi-epidata/api/kcdc_ili.html>`_
71+
* - `pub_kcdc_ili <https://cmu-delphi.github.io/delphi-epidata/api/kcdc_ili.html>`_
8372
- KCDC ILI
8473
- KCDC ILI data from KCDC website.
85-
* - `meta <https://cmu-delphi.github.io/delphi-epidata/api/meta.html>`_
74+
* - `pub_meta <https://cmu-delphi.github.io/delphi-epidata/api/meta.html>`_
8675
- API Metadata
8776
- Metadata for ``fluview``, ``twitter``, ``wiki``, and ``delphi``.
88-
* - `nidss_flu <https://cmu-delphi.github.io/delphi-epidata/api/nidss_flu.html>`_
77+
* - `pub_nidss_flu <https://cmu-delphi.github.io/delphi-epidata/api/nidss_flu.html>`_
8978
- NIDSS Flu
9079
- Outpatient ILI from Taiwan's National Infectious Disease Statistics System (NIDSS).
91-
* - `nowcast <https://cmu-delphi.github.io/delphi-epidata/api/nowcast.html>`_
80+
* - `pub_nowcast <https://cmu-delphi.github.io/delphi-epidata/api/nowcast.html>`_
9281
- ILI Nearby
9382
- 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.
94-
* - `quidel <https://cmu-delphi.github.io/delphi-epidata/api/quidel.html>`_
83+
* - `pvt_quidel <https://cmu-delphi.github.io/delphi-epidata/api/quidel.html>`_
9584
- Quidel
9685
- Data provided by Quidel Corp., which contains flu lab test results.
97-
* - `sensors <https://cmu-delphi.github.io/delphi-epidata/api/sensors.html>`_
86+
* - `pvt_sensors <https://cmu-delphi.github.io/delphi-epidata/api/sensors.html>`_
9887
- Delphi's Digital Surveillance Sensors
9988
- ...
100-
* - `twitter <https://cmu-delphi.github.io/delphi-epidata/api/twitter.html>`_
89+
* - `pvt_twitter <https://cmu-delphi.github.io/delphi-epidata/api/twitter.html>`_
10190
- Twitter Stream
10291
- Estimate of influenza activity based on analysis of language used in tweets from HealthTweets.
103-
* - `wiki <https://cmu-delphi.github.io/delphi-epidata/api/wiki.html>`_
92+
* - `pub_wiki <https://cmu-delphi.github.io/delphi-epidata/api/wiki.html>`_
10493
- Wikipedia Access Logs
10594
- Number of page visits for selected English, Influenza-related wikipedia articles.
106-
|
10795

10896
**Dengue Data**
10997

110-
.. list-table::
98+
.. list-table::
11199
:widths: 20 20 40
112100
:header-rows: 1
113101

114102
* - Endpoint
115103
- Name
116104
- Description
117-
* - `dengue_nowcast <https://cmu-delphi.github.io/delphi-epidata/api/dengue_nowcast.html>`_
105+
* - `pub_dengue_nowcast <https://cmu-delphi.github.io/delphi-epidata/api/dengue_nowcast.html>`_
118106
- Delphi's Dengue Nowcast
119107
- ...
120-
* - `dengue_sensors <https://cmu-delphi.github.io/delphi-epidata/api/dengue_sensors.html>`_
108+
* - `pvt_dengue_sensors <https://cmu-delphi.github.io/delphi-epidata/api/dengue_sensors.html>`_
121109
- Delphi’s Dengue Digital Surveillance Sensors
122110
- ...
123-
* - `nidss_dengue <https://cmu-delphi.github.io/delphi-epidata/api/nidss_dengue.html>`_
111+
* - `pub_nidss_dengue <https://cmu-delphi.github.io/delphi-epidata/api/nidss_dengue.html>`_
124112
- NIDSS Dengue
125113
- Counts of confirmed dengue cases from Taiwan's NIDSS.
126-
* - `paho_dengue <https://cmu-delphi.github.io/delphi-epidata/api/paho_dengue.html>`_
114+
* - `pub_paho_dengue <https://cmu-delphi.github.io/delphi-epidata/api/paho_dengue.html>`_
127115
- PAHO Dengue
128116
- ...
129-
|
130117

131118
**Norovirus Data**
132119

133-
.. list-table::
120+
.. list-table::
134121
:widths: 20 20 40
135122
:header-rows: 1
136123

137124
* - Endpoint
138125
- Name
139126
- Description
140-
* - `meta_norostat <https://cmu-delphi.github.io/delphi-epidata/api/meta_norostat.html>`_
127+
* - `pvt_meta_norostat <https://cmu-delphi.github.io/delphi-epidata/api/meta_norostat.html>`_
141128
- NoroSTAT Metadata
142129
- ...
143-
* - `norostat <https://cmu-delphi.github.io/delphi-epidata/api/norostat.html>`_
130+
* - `pvt_norostat <https://cmu-delphi.github.io/delphi-epidata/api/norostat.html>`_
144131
- NoroSTAT
145132
- Suspected and confirmed norovirus outbreaks reported by state health departments to the CDC.
146133

147-
|
148-
149134
Epiweeks and Dates
150135
------------------
151-
Epiweeks use the U.S. definition. That is, the first epiweek each year is the week, starting on a Sunday,
152-
containing January 4. See `this page <https://www.cmmcp.org/mosquito-surveillance-data/pages/epi-week-calendars-2008-2021>`_ for more information.
136+
Epiweeks use the U.S. definition. That is, the first epiweek each year is the
137+
week, starting on a Sunday, containing January 4. See `this page
138+
<https://www.cmmcp.org/mosquito-surveillance-data/pages/epi-week-calendars-2008-2021>`_
139+
for more information.
153140

154141
Formatting for epiweeks is YYYYWW and for dates is YYYYMMDD.
155142

156-
Use individual values, comma-separated lists or, a hyphenated range of values to specify single or several dates.
143+
Use individual values, comma-separated lists or, a hyphenated range of values to specify single or several dates.
157144
An ``EpiRange`` object can be also used to construct a range of epiweeks or dates. Examples include:
158145

159146
- ``param = 201530`` (A single epiweek)
@@ -162,8 +149,6 @@ An ``EpiRange`` object can be also used to construct a range of epiweeks or date
162149
- ``param = '201440,201501-201510'`` (Several epiweeks, including a range)
163150
- ``param = EpiRange(20070101, 20071231)`` (A range of dates)
164151

165-
|
166-
167152
.. _getting-started:
168153

169154
Basic examples
@@ -176,8 +161,8 @@ distributed through Facebook, for every county in the United States between
176161
2020-05-01 and 2020-05-07:
177162

178163
>>> from epidatpy.request import Epidata, EpiRange
179-
>>> apicall = Epidata.covidcast("fb-survey", "smoothed_cli",
180-
... "day", "county",
164+
>>> apicall = Epidata.covidcast("fb-survey", "smoothed_cli",
165+
... "day", "county",
181166
... EpiRange(20200501, 20200507), "*")
182167
>>> data = apicall.df()
183168
>>> data.head()
@@ -197,7 +182,7 @@ May 1st were updated on September 3rd based on new data, giving a ``lag`` of 125
197182
See the :py:func:`epidatpy.request.Epidata.covidcast` documentation for further details on the returned
198183
columns.
199184

200-
In the above code, the ``.df()`` function on the ``apicall`` variable generated a Pandas DataFrame. We can use
185+
In the above code, the ``.df()`` function on the ``apicall`` variable generated a Pandas DataFrame. We can use
201186
other :ref:`output functions <output-data>` to parse the requested API call in different formats. To parse the data
202187
into JSON format, we can use the following command:
203188

@@ -238,7 +223,7 @@ into JSON format, we can use the following command:
238223
.
239224
}]
240225

241-
Note that all of the :ref:`output functions <output-data>` have a ``field`` parameter which takes in any form of iterator objects
226+
Note that all of the :ref:`output functions <output-data>` have a ``field`` parameter which takes in any form of iterator objects
242227
to enable fetching the data with customization (e.g. specifying which fields or columns to output). Similar to the previous example,
243228
to parse the data in JSON format, but customize the field to show only ``geo_value`` and ``value``, we would use the following
244229
command:
@@ -259,18 +244,13 @@ command:
259244
.
260245
}]
261246

262-
263-
|
264-
265247
**Wikipedia Access article "influenza" on 2020w01**
266248

267249
>>> apicall_wiki = Epidata.wiki(articles='influenza', epiweeks='202001')
268250
>>> data = apicall_wiki.json()
269251
>>> print(data)
270252
[{'article': 'influenza', 'count': 6516, 'total': 663604044, 'hour': -1, 'epiweek': datetime.date(2019, 12, 29), 'value': 9.81910834}]
271253

272-
|
273-
274254
**FluView on 2019w01 (national)**
275255

276256
>>> apicall_fluview = Epidata.fluview(regions='nat', epiweeks='201901')
@@ -294,10 +274,3 @@ command:
294274
'ili': 3.63095}],
295275
'result': 1,
296276
'message': 'success'}
297-
298-
|
299-
300-
Other examples (TODO)
301-
--------------
302-
303-
(TODO)

docs/index.rst

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,53 @@ The package source code and bug tracker can be found `on GitHub
1313
Installation
1414
------------
1515

16-
This package is available on PyPI as `covidcast
17-
<https://pypi.org/project/epidatpy/>`_, and can be installed using ``pip`` or
18-
your favorite Python package manager:
16+
This package will be available on PyPI as `epidatpy
17+
<https://pypi.org/project/epidatpy/>`_ and will be installable with ``pip``.
18+
Meanwhile, it can be installed from GitHub:
1919

2020
.. code-block:: sh
2121
22-
pip install epidatpy
22+
pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy"
2323
2424
The package requires `pandas <https://pandas.pydata.org/>`_ and `requests
2525
<https://requests.readthedocs.io/en/master/>`_; these should be installed
2626
automatically.
2727

28+
API Keys
29+
--------
30+
31+
The Delphi Epidata API requires a (free) API key for full functionality. To
32+
generate your key, register for a pseudo-anonymous account `here
33+
<https://api.delphi.cmu.edu/epidata/admin/registration_form>`_ and see more
34+
discussion on the `general API website
35+
<https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html>`_. The ``epidatpy``
36+
client will automatically look for this key in the environment variable
37+
``DELPHI_EPIDATA_KEY``. We recommend storing your key in a ``.env`` file and using
38+
`python-dotenv <https://github.com/theskumar/python-dotenv>`_ to load it into
39+
your environment.
40+
41+
Note that for the time being, the private endpoints (i.e. those prefixed with
42+
``pvt``) will require a separate key that needs to be passed as an argument.
43+
44+
See also the `COVIDcast Terms of Use
45+
<https://covidcast.cmu.edu/terms-of-use.html>`_, noting that the data is a
46+
research product and not warranted for a particular purpose.
47+
48+
For users of the covidcast Python package
49+
------------------------------------------
50+
51+
The `covidcast <https://cmu-delphi.github.io/covidcast/covidcast-py/html/>`_
52+
package is deprecated and will no longer be updated. The ``epidatpy`` package is a
53+
complete rewrite with a focus on speed, reliability, and ease of use. It also
54+
supports more endpoints and data sources than ``covidcast``. When migrating from
55+
that package, you will need to use the ``pub_covidcast`` function in
56+
``epidatpy``.
57+
2858
.. note :: **You should consider subscribing** to the `API mailing list
2959
<https://lists.andrew.cmu.edu/mailman/listinfo/delphi-covidcast-api>`_ to be
3060
notified of package updates, new data sources, corrections, and other
3161
updates.
3262
33-
.. warning :: If you use data from the COVIDcast API to power a public product,
34-
dashboard, app, or other service, please download the data you need and store
35-
it centrally rather than making API requests for every user. Our server
36-
resources are limited and cannot support high-volume interactive use.
37-
38-
See also the `COVIDcast Terms of Use
39-
<https://covidcast.cmu.edu/terms-of-use.html>`_, noting that the data is a
40-
research product and not warranted for a particular purpose.
41-
42-
4363
Contents
4464
--------
4565

@@ -48,5 +68,9 @@ Contents
4868

4969
getting_started
5070

71+
covidcast_examples
72+
5173
signals_covid
5274

75+
epidatpy
76+

docs/modules.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)