Skip to content

Commit

Permalink
link to epidatpy everywhere clients are mentioned
Browse files Browse the repository at this point in the history
  • Loading branch information
nmdefries committed Oct 9, 2024
1 parent b9bd5d8 commit cb097db
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 13 deletions.
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://github.com/cmu-delphi/epidatpy) 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://github.com/cmu-delphi/epidatpy) 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 cb097db

Please sign in to comment.