@@ -6,83 +6,81 @@ 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 with [ 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+
915For 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
3530library(epidatr )
36- # Fetch data
3731res <- pub_covidcast(' fb-survey' , ' smoothed_cli' , ' county' , ' day' , geo_values = ' 06001' ,
3832 time_values = c(20200401 , 20200405 : 20200414 ))
3933cat(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- ````
38+ Install [ ` delphi-epidata ` from PyPI] ( https://pypi.org/project/delphi-epidata/ ) with
39+ ` pip install delphi-epidata ` .
4840
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.
52-
53- ```` python
54- # Import
41+ ``` python
5542from 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
5945res = Epidata.covidcast(' fb-survey' , ' smoothed_cli' , ' day' , ' county' , [20200401 , Epidata.range(20200405 , 20200414 )], ' 06001' )
6046print (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
76+ The old Delphi Epidata R client is available
77+ [ here] ( https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R ) ,
78+ but its use is discouraged.
79+
8080``` R
81- # [Optional] configure your API key, if desired
81+ # Configure API key, if needed.
8282# option('epidata.auth', <your API key>)
83- # Import
8483source(' delphi_epidata.R' )
85- # Fetch data
8684res <- Epidata $ covidcast(' fb-survey' , ' smoothed_cli' , ' day' , ' county' , list (20200401 , Epidata $ range(20200405 , 20200414 )), ' 06001' )
8785cat(paste(res $ result , res $ message , length(res $ epidata ), " \n " ))
8886```
0 commit comments