Skip to content

Commit

Permalink
Mention epidatpy everywhere as a current client (#1550)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
nmdefries and dshemetov authored Oct 16, 2024
1 parent a9a2535 commit 8598215
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 16 deletions.
7 changes: 4 additions & 3 deletions docs/api/api_keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ there are several ways to use your key to authenticate your requests:

### Using a client

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

### Via request parameter

Expand Down
31 changes: 27 additions & 4 deletions docs/api/client_libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ nav_order: 1
To access Delphi Epidata programmatically, we recommend our client libraries:

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

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

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

### Python

The `epidatpy` package will soon be [available on PyPI as `epidatpy`](https://pypi.org/project/epidatpy/).
Meanwhile, it can be [installed from GitHub](https://github.com/cmu-delphi/epidatpy/) with
`pip install "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy"`.

```python
# Configure API key, if needed.
# https://github.com/cmu-delphi/epidatpy/blob/dev/docs/index.rst#api-keys

from epidatpy import EpiDataContext, EpiRange

# Create the client object.
epidata = EpiDataContext()
apicall = 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),
)
print(apicall.df())
```

Install [`delphi-epidata` from PyPI](https://pypi.org/project/delphi-epidata/) with
`pip install delphi-epidata`.

Expand Down
23 changes: 15 additions & 8 deletions docs/api/covidcast.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,27 @@ COVIDcast data. Once you install the appropriate client for your programming
language, accessing data is as easy as, in [R](https://www.r-project.org/):

```r
library(covidcast)
library(epidatr)

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

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

```python
import covidcast
from datetime import date

data = covidcast.signal("fb-survey", "smoothed_cli", date(2020, 5, 1), date(2020, 5, 7),
"county")
from epidatpy import EpiDataContext, EpiRange

epidata = EpiDataContext()
apicall = epidata.pub_covidcast(
data_source="fb-survey",
signals="smoothed_cli",
geo_type="county",
time_type="day",
geo_values="*",
time_values=EpiRange(20200501, 20200507),
)
data = apicall.df()
```

[The API clients](covidcast_clients.md) have extensive documentation providing
Expand Down
2 changes: 1 addition & 1 deletion docs/api/covidcast_clients.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ nav_order: 1
To access COVIDcast data, we recommend using the following client libraries:

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

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

0 comments on commit 8598215

Please sign in to comment.