Skip to content

Commit f184eab

Browse files
committed
doc: update instructions for client libraries
1 parent c1551af commit f184eab

File tree

2 files changed

+46
-52
lines changed

2 files changed

+46
-52
lines changed

docs/api/client_libraries.md

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,83 +6,77 @@ nav_order: 1
66

77
# Epidata API Client Libraries
88

9+
To access Delphi Epidata programmatically, we recommend our client libraries:
10+
11+
- R: [epidatr](https://cmu-delphi.github.io/epidatr/),
12+
- Python: [delphi-epidata](https://pypi.org/project/delphi-epidata/) (soon to be replaced [epidatpy](https://github.com/cmu-delphi/epidatpy)),
13+
- Javascript: [delphi-epidata](https://github.com/cmu-delphi/delphi-epidata/blob/master/src/client/delphi_epidata.js).
14+
915
For anyone looking for COVIDCast data, please visit our [COVIDCast Libraries](covidcast_clients.md).
1016

11-
A full-featured Epidata client for R is available at
12-
[epidatr](https://github.com/cmu-delphi/epidatr) and
13-
[also on CRAN](https://cran.r-project.org/web/packages/epidatr/index.html).
14-
15-
We are currently working on a new full-featured Epidata client for Python. It is not ready
16-
for release yet, but you can track our development progress and help us test it out at
17-
[epidatpy](https://github.com/cmu-delphi/epidatpy).
18-
19-
In the meantime, minimalist Epidata clients remain available for
20-
[Python](https://github.com/cmu-delphi/delphi-epidata/blob/master/src/client/delphi_epidata.py),
21-
[JavaScript](https://github.com/cmu-delphi/delphi-epidata/blob/master/src/client/delphi_epidata.js),
22-
and
23-
[R (legacy)](https://github.com/cmu-delphi/delphi-epidata/blob/master/src/client/delphi_epidata.R).
24-
The following samples show how to import the library and fetch Delphi's COVID-19
25-
Surveillance Streams from Facebook Survey CLI for county 06001, and days
17+
The following samples show how to import the library and fetch Delphi's
18+
COVID-19 Surveillance Streams from Facebook Survey CLI for county 06001 and days
2619
`20200401` and `20200405-20200414` (11 days total).
2720

2821
### R
2922

30-
````R
31-
# [Optional] configure your API key, if desired
32-
# Interactive. See https://cmu-delphi.github.io/epidatr/articles/epidatr.html#api-keys for details.
23+
Install [`epidatr` from CRAN](https://cran.r-project.org/package=epidatr)
24+
with `install.packages("epidatr")`.
25+
26+
```R
27+
# Configure API key interactively, if needed. See
28+
# https://cmu-delphi.github.io/epidatr/articles/epidatr.html#api-keys for details.
3329
#save_api_key()
34-
# Import
3530
library(epidatr)
36-
# Fetch data
3731
res <- pub_covidcast('fb-survey', 'smoothed_cli', 'county', 'day', geo_values = '06001',
3832
time_values = c(20200401, 20200405:20200414))
3933
cat(res)
40-
````
34+
```
4135

4236
### Python
4337

44-
Optionally install the [package from PyPI](https://pypi.org/project/delphi-epidata/) using pip(env):
45-
````bash
46-
pip install delphi-epidata
47-
````
48-
49-
Otherwise, place
50-
[`delphi_epidata.py`](https://github.com/cmu-delphi/delphi-epidata/blob/master/src/client/delphi_epidata.py)
51-
in the same directory as your Python script.
38+
Install [`delphi-epidata` from PyPI](https://pypi.org/project/delphi-epidata/) with
39+
`pip install delphi-epidata`.
5240

53-
````python
54-
# Import
41+
```python
5542
from delphi_epidata import Epidata
56-
# [Optional] configure your API key, if desired
43+
# Configure API key, if needed.
5744
#Epidata.auth = ('epidata', <your API key>)
58-
# Fetch data
5945
res = Epidata.covidcast('fb-survey', 'smoothed_cli', 'day', 'county', [20200401, Epidata.range(20200405, 20200414)], '06001')
6046
print(res['result'], res['message'], len(res['epidata']))
61-
````
47+
```
6248

6349
### JavaScript (in a web browser)
6450

65-
The minimalist JavaScript client does not currently support API keys. If you need API key support in JavaScript, contact [email protected].
51+
The minimalist JavaScript client does not currently support API keys.
52+
If you need API key support in JavaScript, contact [email protected].
6653

67-
````html
68-
<!-- Imports -->
54+
```html
6955
<script src="delphi_epidata.js"></script>
70-
<!-- Fetch data -->
7156
<script>
72-
EpidataAsync.covidcast('fb-survey', 'smoothed_cli', 'day', 'county', [20200401, EpidataAsync.range(20200405, 20200414)], '06001').then((res) => {
73-
console.log(res.result, res.message, res.epidata != null ? res.epidata.length : 0);
57+
EpidataAsync.covidcast(
58+
"fb-survey",
59+
"smoothed_cli",
60+
"day",
61+
"county",
62+
[20200401, EpidataAsync.range(20200405, 20200414)],
63+
"06001"
64+
).then((res) => {
65+
console.log(
66+
res.result,
67+
res.message,
68+
res.epidata != null ? res.epidata.length : 0
69+
);
7470
});
7571
</script>
76-
````
72+
```
7773

7874
### R (legacy)
7975

8076
```R
81-
# [Optional] configure your API key, if desired
77+
# Configure API key, if needed.
8278
#option('epidata.auth', <your API key>)
83-
# Import
8479
source('delphi_epidata.R')
85-
# Fetch data
8680
res <- Epidata$covidcast('fb-survey', 'smoothed_cli', 'day', 'county', list(20200401, Epidata$range(20200405, 20200414)), '06001')
8781
cat(paste(res$result, res$message, length(res$epidata), "\n"))
8882
```

docs/api/covidcast_clients.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ nav_order: 1
66

77
# COVIDcast Libraries
88

9-
Dedicated COVIDcast access and analysis libraries are available for several languages:
9+
To access COVIDcast data, we recommend using the following client libraries:
1010

11-
* R: [covidcast](https://cmu-delphi.github.io/covidcast/covidcastR/)
12-
* Python: [covidcast](https://cmu-delphi.github.io/covidcast/covidcast-py/html/)
11+
- R: [epidatr](https://cmu-delphi.github.io/epidatr/),
12+
- Python: [covidcast](https://cmu-delphi.github.io/covidcast/covidcast-py/html/) (soon to be replaced [epidatpy](https://github.com/cmu-delphi/epidatpy)).
1313

1414
These packages provide a convenient way to obtain COVIDcast data as a data frame
15-
ready to be used in further analyses and provide convenient mapping and
16-
analysis functions. For installation instructions and examples, consult their
17-
respective webpages.
15+
ready to be used in further analyses and provide convenient mapping and analysis
16+
functions. For installation instructions and examples, consult their respective
17+
webpages.
1818

19-
20-
To access Epidata datasets on other diseases, visit our [Epidata API Client Libraries)](client_libraries.md) documentation.
19+
To access Epidata datasets on other diseases, visit our [Epidata API Client
20+
Libraries)](client_libraries.md) documentation.

0 commit comments

Comments
 (0)