Skip to content

Commit 8448da4

Browse files
authored
Merge pull request #174 from cmu-delphi/djm/pkgdown-updates
Djm/pkgdown updates
2 parents 0adb796 + 8f61786 commit 8448da4

File tree

5 files changed

+211
-49
lines changed

5 files changed

+211
-49
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
^.venv$
2121
^env$
2222
^.env$
23+
^README\.Rmd$
2324
^CRAN-SUBMISSION$

README.Rmd

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
output: github_document
3+
---
4+
5+
<!-- README.md is generated from README.Rmd. Please edit that file -->
6+
7+
```{r, include = FALSE}
8+
knitr::opts_chunk$set(
9+
collapse = TRUE,
10+
comment = "#>",
11+
fig.path = "man/figures/README-",
12+
out.width = "100%"
13+
)
14+
ggplot2::theme_set(ggplot2::theme_bw())
15+
```
16+
17+
# Delphi Epidata R client
18+
19+
20+
<!-- badges: start -->
21+
[![License: MIT][mit-image]][mit-url] [![Github Actions][github-actions-image]][github-actions-url]
22+
[![codecov](https://codecov.io/gh/dsweber2/epidatr/branch/dev/graph/badge.svg?token=jVHL9eHZNZ)](https://app.codecov.io/gh/dsweber2/epidatr)
23+
<!-- badges: end -->
24+
25+
26+
27+
The [Delphi Epidata API](https://cmu-delphi.github.io/delphi-epidata/) provides real-time access to epidemiological surveillance data for influenza, COVID-19, and other diseases for the USA at various geographical resolutions, both from official government sources such as the [Center for Disease Control (CDC)](https://www.cdc.gov/datastatistics/index.html) and [Google Trends](https://cmu-delphi.github.io/delphi-epidata/api/covidcast-signals/google-symptoms.html) and private partners such as [Facebook](https://delphi.cmu.edu/blog/2020/08/26/covid-19-symptom-surveys-through-facebook/) and [Change Healthcare](https://www.changehealthcare.com/). It is built and maintained by the Carnegie Mellon University [Delphi research group](https://delphi.cmu.edu/).
28+
29+
This package is designed to streamline the downloading and usage of data from the [Delphi Epidata
30+
API](https://cmu-delphi.github.io/delphi-epidata/). It provides a simple R interface to the API, including functions for downloading data, parsing the results, and converting the data into a tidy format. The API stores a historical record of all data, including corrections and updates, which is particularly useful for accurately backtesting forecasting models. We also provide packages for downstream data processing ([epiprocess](https://github.com/cmu-delphi/epiprocess)) and modeling ([epipredict](https://github.com/cmu-delphi/epipredict)).
31+
32+
## Usage
33+
34+
```{r}
35+
library(epidatr)
36+
# Obtain the smoothed covid-like illness (CLI) signal from the
37+
# Facebook survey as it was on April 10, 2021 for the US
38+
epidata <- pub_covidcast(
39+
source = "fb-survey",
40+
signals = "smoothed_cli",
41+
geo_type = "nation",
42+
time_type = "day",
43+
geo_values = "us",
44+
time_values = epirange(20210101, 20210601),
45+
as_of = "2021-06-01"
46+
)
47+
epidata
48+
```
49+
50+
```{r fb-cli-signal}
51+
# Plot this data
52+
library(ggplot2)
53+
ggplot(epidata, aes(x = time_value, y = value)) +
54+
geom_line() +
55+
labs(
56+
title = "Smoothed CLI from Facebook Survey",
57+
subtitle = "US, 2021",
58+
x = "Date",
59+
y = "CLI"
60+
)
61+
```
62+
63+
64+
## Installation
65+
66+
Install from GitHub:
67+
68+
```R
69+
# Install the dev version using `pak` or `remotes`
70+
pak::pkg_install("cmu-delphi/epidatr")
71+
remotes::install_github("cmu-delphi/epidatr")
72+
```
73+
74+
CRAN version coming soon.
75+
76+
### API Keys
77+
78+
The Delphi API requires a (free) API key for full functionality. To generate
79+
your key, register for a pseudo-anonymous account
80+
[here](https://api.delphi.cmu.edu/epidata/admin/registration_form) and see more
81+
discussion on the [general API
82+
website](https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html). The
83+
`epidatr` client will automatically look for this key in the R option
84+
`delphi.epidata.key` or in the environment variable
85+
`DELPHI_EPIDATA_KEY`. We recommend storing your key in `.Renviron` file, which R
86+
will read by default.
87+
88+
Note that for the time being, the private endpoints (i.e. those prefixed with
89+
`pvt`) will require a separate key that needs to be passed as an argument.
90+
91+
[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg
92+
[mit-url]: https://opensource.org/license/mit/
93+
[github-actions-image]: https://github.com/cmu-delphi/epidatr/workflows/ci/badge.svg
94+
[github-actions-url]: https://github.com/cmu-delphi/epidatr/actions
95+
96+
## Get updates
97+
98+
You should consider subscribing to the [API mailing list](https://lists.andrew.cmu.edu/mailman/listinfo/delphi-covidcast-api) to be notified of package updates, new data sources, corrections, and other updates.
99+
100+
## For users of the `covidcast` R package
101+
102+
The `epidatr` package is a complete rewrite of the [`covidcast` package](https://cmu-delphi.github.io/covidcast/covidcastR/), with a focus on speed, reliability, and ease of use. The `covidcast` package is deprecated and will no longer be updated.

README.md

Lines changed: 82 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,47 @@
1-
# Delphi Epidata R client
21

3-
[![License: MIT][mit-image]][mit-url] [![Github Actions][github-actions-image]][github-actions-url]
4-
[![codecov](https://codecov.io/gh/dsweber2/epidatr/branch/dev/graph/badge.svg?token=jVHL9eHZNZ)](https://app.codecov.io/gh/dsweber2/epidatr)
2+
<!-- README.md is generated from README.Rmd. Please edit that file -->
53

6-
The [Delphi Epidata API](https://cmu-delphi.github.io/delphi-epidata/) provides real-time access to epidemiological surveillance data for influenza, COVID-19, and other diseases for the USA at various geographical resolutions, both from official government sources such as the [Center for Disease Control (CDC)](https://www.cdc.gov/datastatistics/index.html) and [Google Trends](https://cmu-delphi.github.io/delphi-epidata/api/covidcast-signals/google-symptoms.html) and private partners such as [Facebook](https://delphi.cmu.edu/blog/2020/08/26/covid-19-symptom-surveys-through-facebook/) and [Change Healthcare](https://www.changehealthcare.com/). It is built and maintained by the Carnegie Mellon University [Delphi research group](https://delphi.cmu.edu/).
4+
# Delphi Epidata R client
75

8-
This package is designed to streamline the downloading and usage of data from the [Delphi Epidata
9-
API](https://cmu-delphi.github.io/delphi-epidata/). It provides a simple R interface to the API, including functions for downloading data, parsing the results, and converting the data into a tidy format. The API stores a historical record of all data, including corrections and updates, which is particularly useful for accurately backtesting forecasting models. We also provide packages for downstream data processing ([epiprocess](https://github.com/cmu-delphi/epiprocess)) and modeling ([epipredict](https://github.com/cmu-delphi/epipredict)).
6+
<!-- badges: start -->
7+
8+
[![License:
9+
MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit/)
10+
[![Github
11+
Actions](https://github.com/cmu-delphi/epidatr/workflows/ci/badge.svg)](https://github.com/cmu-delphi/epidatr/actions)
12+
[![codecov](https://codecov.io/gh/dsweber2/epidatr/branch/dev/graph/badge.svg?token=jVHL9eHZNZ)](https://app.codecov.io/gh/dsweber2/epidatr)
13+
<!-- badges: end -->
14+
15+
The [Delphi Epidata API](https://cmu-delphi.github.io/delphi-epidata/)
16+
provides real-time access to epidemiological surveillance data for
17+
influenza, COVID-19, and other diseases for the USA at various
18+
geographical resolutions, both from official government sources such as
19+
the [Center for Disease Control
20+
(CDC)](https://www.cdc.gov/datastatistics/index.html), public sources such as [Google
21+
Trends](https://cmu-delphi.github.io/delphi-epidata/api/covidcast-signals/google-symptoms.html),
22+
and private partners such as
23+
[Facebook](https://delphi.cmu.edu/blog/2020/08/26/covid-19-symptom-surveys-through-facebook/)
24+
and [Change Healthcare](https://www.changehealthcare.com/). It is built
25+
and maintained by the Carnegie Mellon University [Delphi research
26+
group](https://delphi.cmu.edu/).
27+
28+
This package is designed to streamline the downloading and usage of data
29+
from the [Delphi Epidata
30+
API](https://cmu-delphi.github.io/delphi-epidata/). It provides a simple
31+
R interface to the API, including functions for downloading data,
32+
parsing the results, and converting the data into a tidy format. The API
33+
stores a historical record of all data, including corrections and
34+
updates, which is particularly useful for accurately backtesting
35+
forecasting models. We also provide packages for downstream data
36+
processing ([epiprocess](https://github.com/cmu-delphi/epiprocess)) and
37+
modeling ([epipredict](https://github.com/cmu-delphi/epipredict)).
1038

1139
## Usage
1240

13-
```R
41+
``` r
1442
library(epidatr)
15-
# Obtain the smoothed covid-like illness (CLI) signal from the Facebook survey as it was on April 10, 2021 for the US
43+
# Obtain the smoothed covid-like illness (CLI) signal from the
44+
# Facebook survey as it was on April 10, 2021 for the US
1645
epidata <- pub_covidcast(
1746
source = "fb-survey",
1847
signals = "smoothed_cli",
@@ -23,42 +52,44 @@ epidata <- pub_covidcast(
2352
as_of = "2021-06-01"
2453
)
2554
epidata
55+
#> # A tibble: 151 × 15
56+
#> geo_value signal source geo_type time_type time_value direction issue
57+
#> <chr> <chr> <chr> <fct> <fct> <date> <dbl> <date>
58+
#> 1 us smoothed… fb-su… nation day 2021-01-01 NA 2021-01-06
59+
#> 2 us smoothed… fb-su… nation day 2021-01-02 NA 2021-01-07
60+
#> 3 us smoothed… fb-su… nation day 2021-01-03 NA 2021-01-08
61+
#> 4 us smoothed… fb-su… nation day 2021-01-04 NA 2021-01-09
62+
#> 5 us smoothed… fb-su… nation day 2021-01-05 NA 2021-01-10
63+
#> 6 us smoothed… fb-su… nation day 2021-01-06 NA 2021-01-29
64+
#> 7 us smoothed… fb-su… nation day 2021-01-07 NA 2021-01-29
65+
#> 8 us smoothed… fb-su… nation day 2021-01-08 NA 2021-01-29
66+
#> 9 us smoothed… fb-su… nation day 2021-01-09 NA 2021-01-29
67+
#> 10 us smoothed… fb-su… nation day 2021-01-10 NA 2021-01-29
68+
#> # ℹ 141 more rows
69+
#> # ℹ 7 more variables: lag <int>, missing_value <int>, missing_stderr <int>,
70+
#> # missing_sample_size <int>, value <dbl>, stderr <dbl>, sample_size <dbl>
2671
```
2772

28-
```
29-
# A tibble: 6 × 15
30-
geo_value signal source geo_type time_type time_value
31-
<chr> <chr> <chr> <fct> <fct> <date>
32-
1 us smoothed_cli fb-surv… nation day 2021-04-05
33-
2 us smoothed_cli fb-surv… nation day 2021-04-06
34-
3 us smoothed_cli fb-surv… nation day 2021-04-07
35-
4 us smoothed_cli fb-surv… nation day 2021-04-08
36-
5 us smoothed_cli fb-surv… nation day 2021-04-09
37-
6 us smoothed_cli fb-surv… nation day 2021-04-10
38-
# ℹ 9 more variables: direction <dbl>, issue <date>,
39-
# lag <int>, missing_value <int>, missing_stderr <int>,
40-
# missing_sample_size <int>, value <dbl>, stderr <dbl>,
41-
# sample_size <dbl>
42-
```
43-
44-
```r
73+
``` r
4574
# Plot this data
4675
library(ggplot2)
4776
ggplot(epidata, aes(x = time_value, y = value)) +
4877
geom_line() +
49-
labs(title = "Smoothed CLI from Facebook Survey",
50-
subtitle = "US, 2021",
51-
x = "Date",
52-
y = "CLI")
78+
labs(
79+
title = "Smoothed CLI from Facebook Survey",
80+
subtitle = "US, 2021",
81+
x = "Date",
82+
y = "CLI"
83+
)
5384
```
5485

55-
![Smoothed CLI from Facebook Survey](man/figures/fb-cli-signal.png)
86+
<img src="man/figures/README-fb-cli-signal-1.png" width="100%" />
5687

5788
## Installation
5889

5990
Install from GitHub:
6091

61-
```R
92+
``` r
6293
# Install the dev version using `pak` or `remotes`
6394
pak::pkg_install("cmu-delphi/epidatr")
6495
remotes::install_github("cmu-delphi/epidatr")
@@ -68,28 +99,30 @@ CRAN version coming soon.
6899

69100
### API Keys
70101

71-
The Delphi API requires a (free) API key for full functionality. To generate
72-
your key, register for a pseudo-anonymous account
73-
[here](https://api.delphi.cmu.edu/epidata/admin/registration_form) and see more
74-
discussion on the [general API
75-
website](https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html). The
76-
`epidatr` client will automatically look for this key in the R option
77-
`delphi.epidata.key` or in the environment variable
78-
`DELPHI_EPIDATA_KEY`. We recommend storing your key in `.Renviron` file, which R
79-
will read by default.
80-
81-
Note that for the time being, the private endpoints (i.e. those prefixed with
82-
`pvt`) will require a separate key that needs to be passed as an argument.
102+
The Delphi API requires a (free) API key for full functionality. To
103+
generate your key, register for a pseudo-anonymous account
104+
[here](https://api.delphi.cmu.edu/epidata/admin/registration_form) and
105+
see more discussion on the [general API
106+
website](https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html).
107+
The `epidatr` client will automatically look for this key in the R
108+
option `delphi.epidata.key` or in the environment variable
109+
`DELPHI_EPIDATA_KEY`. We recommend storing your key in `.Renviron` file,
110+
which R will read by default.
83111

84-
[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg
85-
[mit-url]: https://opensource.org/license/mit/
86-
[github-actions-image]: https://github.com/cmu-delphi/epidatr/workflows/ci/badge.svg
87-
[github-actions-url]: https://github.com/cmu-delphi/epidatr/actions
112+
Note that for the time being, the private endpoints (i.e. those prefixed
113+
with `pvt`) will require a separate key that needs to be passed as an
114+
argument.
88115

89116
## Get updates
90117

91-
You should consider subscribing to the [API mailing list](https://lists.andrew.cmu.edu/mailman/listinfo/delphi-covidcast-api) to be notified of package updates, new data sources, corrections, and other updates.
118+
You should consider subscribing to the [API mailing
119+
list](https://lists.andrew.cmu.edu/mailman/listinfo/delphi-covidcast-api)
120+
to be notified of package updates, new data sources, corrections, and
121+
other updates.
92122

93123
## For users of the `covidcast` R package
94124

95-
The `epidatr` package is a complete rewrite of the [`covidcast` package](https://cmu-delphi.github.io/covidcast/covidcastR/), with a focus on speed, reliability, and ease of use. The `covidcast` package is deprecated and will no longer be updated.
125+
The `epidatr` package is a complete rewrite of the [`covidcast`
126+
package](https://cmu-delphi.github.io/covidcast/covidcastR/), with a
127+
focus on speed, reliability, and ease of use. The `covidcast` package is
128+
deprecated and will no longer be updated.

_pkgdown.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
1+
template:
2+
bootstrap: 5
3+
bootswatch: cosmo
4+
bslib:
5+
font_scale: 1.0
6+
primary: '#C41230'
7+
link-color: '#C41230'
8+
navbar-bg: '#C41230'
9+
navbar-fg: '#f8f8f8'
10+
11+
navbar:
12+
bg: '#C41230'
13+
fg: '#f8f8f8'
14+
115
home:
216
links:
317
- text: Get the Python client
418
href: https://github.com/cmu-delphi/epidatpy/
519

620
- text: View the Delphi Website
721
href: https://delphi.cmu.edu/
22+
23+
- text: Introduction to Delphi's Tooling Work
24+
href: https://cmu-delphi.github.io/delphi-tooling-book/
25+
26+
- text: The epiprocess R package
27+
href: https://cmu-delphi.github.io/epiprocess/
28+
29+
- text: The epipredict R package
30+
href: https://cmu-delphi.github.io/epipredict/
31+
32+
- text: The epidatasets R package
33+
href: https://cmu-delphi.github.io/epidatasets/
834

935
reference:
1036
- title: Configuration and utilities
33.1 KB
Loading

0 commit comments

Comments
 (0)