Skip to content

Commit 8598215

Browse files
nmdefriesdshemetov
andauthored
Mention epidatpy everywhere as a current client (#1550)
* add link to epidatpy api keys handling * link to epidatpy everywhere clients are mentioned * use epidatpy doc site for links Co-authored-by: Dmitry Shemetov <[email protected]> * use epidatpy doc site for links Co-authored-by: Dmitry Shemetov <[email protected]> --------- Co-authored-by: Dmitry Shemetov <[email protected]>
1 parent a9a2535 commit 8598215

File tree

4 files changed

+47
-16
lines changed

4 files changed

+47
-16
lines changed

docs/api/api_keys.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ there are several ways to use your key to authenticate your requests:
4242

4343
### Using a client
4444

45-
* covidcast
45+
* [epidatr](https://cmu-delphi.github.io/epidatr/#api-keys)
46+
* [epidatpy](https://cmu-delphi.github.io/epidatpy/#api-keys)
47+
* [delphi-epidata](https://cmu-delphi.github.io/delphi-epidata/api/client_libraries.html)
48+
* covidcast (deprecated in favor of `epidatr` and `epidatpy`)
4649
* [R client](https://cmu-delphi.github.io/covidcast/covidcastR/reference/covidcast_signal.html#api-keys-1)
4750
* [Python client](https://cmu-delphi.github.io/covidcast/covidcast-py/html/signals.html#covidcast.use_api_key)
48-
* [epidatr](https://github.com/cmu-delphi/epidatr#api-keys)
49-
* [delphi-epidata](https://cmu-delphi.github.io/delphi-epidata/api/client_libraries.html)
5051

5152
### Via request parameter
5253

docs/api/client_libraries.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ nav_order: 1
99
To access Delphi Epidata programmatically, we recommend our client libraries:
1010

1111
- R: [epidatr](https://cmu-delphi.github.io/epidatr/),
12-
- Python: [delphi-epidata](https://pypi.org/project/delphi-epidata/) (soon to be replaced with [epidatpy](https://github.com/cmu-delphi/epidatpy)),
12+
- Python: [epidatpy](https://cmu-delphi.github.io/epidatpy/) (recommended) and [delphi-epidata](https://pypi.org/project/delphi-epidata/),
1313
- Javascript: [delphi-epidata](https://github.com/cmu-delphi/delphi-epidata/blob/master/src/client/delphi_epidata.js).
1414

1515
For anyone looking for COVIDCast data, please visit our [COVIDCast API Client Libraries](covidcast_clients.md).
@@ -23,18 +23,41 @@ COVID-19 Surveillance Streams from Facebook Survey CLI for county 06001 and days
2323
Install [`epidatr` from CRAN](https://cran.r-project.org/package=epidatr)
2424
with `install.packages("epidatr")`.
2525

26-
```R
26+
```r
2727
# Configure API key interactively, if needed. See
2828
# https://cmu-delphi.github.io/epidatr/articles/epidatr.html#api-keys for details.
2929
#save_api_key()
3030
library(epidatr)
31-
res <- pub_covidcast('fb-survey', 'smoothed_cli', 'county', 'day', geo_values = '06001',
31+
data <- pub_covidcast('fb-survey', 'smoothed_cli', 'county', 'day', geo_values = '06001',
3232
time_values = c(20200401, 20200405:20200414))
33-
cat(res)
33+
cat(data)
3434
```
3535

3636
### Python
3737

38+
The `epidatpy` package will soon be [available on PyPI as `epidatpy`](https://pypi.org/project/epidatpy/).
39+
Meanwhile, it can be [installed from GitHub](https://github.com/cmu-delphi/epidatpy/) with
40+
`pip install "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy"`.
41+
42+
```python
43+
# Configure API key, if needed.
44+
# https://github.com/cmu-delphi/epidatpy/blob/dev/docs/index.rst#api-keys
45+
46+
from epidatpy import EpiDataContext, EpiRange
47+
48+
# Create the client object.
49+
epidata = EpiDataContext()
50+
apicall = epidata.pub_covidcast(
51+
data_source="jhu-csse",
52+
signals="confirmed_cumulative_num",
53+
geo_type="nation",
54+
time_type="day",
55+
geo_values="us",
56+
time_values=EpiRange(20210405, 20210410),
57+
)
58+
print(apicall.df())
59+
```
60+
3861
Install [`delphi-epidata` from PyPI](https://pypi.org/project/delphi-epidata/) with
3962
`pip install delphi-epidata`.
4063

docs/api/covidcast.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,27 @@ COVIDcast data. Once you install the appropriate client for your programming
5656
language, accessing data is as easy as, in [R](https://www.r-project.org/):
5757

5858
```r
59-
library(covidcast)
59+
library(epidatr)
6060

61-
data <- covidcast_signal("fb-survey", "smoothed_cli", start_day = "2020-05-01",
62-
end_day = "2020-05-07")
61+
data <- pub_covidcast('fb-survey', 'smoothed_cli', 'county', 'day', geo_values = '06001',
62+
time_values = c(20200401, 20200405:20200414))
6363
```
6464

6565
or, in [Python](https://www.python.org):
6666

6767
```python
68-
import covidcast
69-
from datetime import date
70-
71-
data = covidcast.signal("fb-survey", "smoothed_cli", date(2020, 5, 1), date(2020, 5, 7),
72-
"county")
68+
from epidatpy import EpiDataContext, EpiRange
69+
70+
epidata = EpiDataContext()
71+
apicall = epidata.pub_covidcast(
72+
data_source="fb-survey",
73+
signals="smoothed_cli",
74+
geo_type="county",
75+
time_type="day",
76+
geo_values="*",
77+
time_values=EpiRange(20200501, 20200507),
78+
)
79+
data = apicall.df()
7380
```
7481

7582
[The API clients](covidcast_clients.md) have extensive documentation providing

docs/api/covidcast_clients.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ nav_order: 1
99
To access COVIDcast data, we recommend using the following client libraries:
1010

1111
- R: [epidatr](https://cmu-delphi.github.io/epidatr/)
12-
- Python: [covidcast](https://cmu-delphi.github.io/covidcast/covidcast-py/html/) (soon to be replaced with [epidatpy](https://github.com/cmu-delphi/epidatpy))
12+
- Python: [epidatpy](https://cmu-delphi.github.io/epidatpy/) (recommended) and [delphi-epidata](https://pypi.org/project/delphi-epidata/),
1313

1414
These packages provide a convenient way to obtain COVIDcast data as a data frame
1515
ready to be used in further analyses and provide convenient mapping and analysis

0 commit comments

Comments
 (0)