Skip to content

Commit 29c784a

Browse files
authored
Merge pull request #166 from cmu-delphi/ds/friendly-docs
docs: make friendly
2 parents 1744d1b + 2a1e685 commit 29c784a

File tree

7 files changed

+53
-15
lines changed

7 files changed

+53
-15
lines changed

.github/workflows/document.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ jobs:
3737
git config --local user.name "$GITHUB_ACTOR"
3838
git config --local user.email "[email protected]"
3939
git add man/\* NAMESPACE DESCRIPTION
40-
git commit -m "Update documentation" || echo "No changes to commit"
40+
git commit -m "docs: document (GHA)" || echo "No changes to commit"
4141
git pull --rebase
4242
git push origin

.github/workflows/style.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
then
6666
git config --local user.name "$GITHUB_ACTOR"
6767
git config --local user.email "[email protected]"
68-
git commit ${FILES_TO_COMMIT[*]} -m "Style code (GHA)"
68+
git commit ${FILES_TO_COMMIT[*]} -m "style: styler (GHA)"
6969
git pull --rebase
7070
git push origin
7171
else

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Imports:
3636
RoxygenNote: 7.2.3
3737
Suggests:
3838
dplyr,
39+
ggplot2,
3940
knitr,
4041
rmarkdown,
4142
testthat (>= 3.1.5),

Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
install:
2-
Rscript -e "install.packages(c('devtools', 'pkgdown', 'webshot', 'textshaping', 'styler', 'lintr'));devtools::install_deps(dependencies = TRUE)"
2+
Rscript -e "install.packages(c('devtools', 'pkgdown', 'webshot', 'textshaping', 'styler', 'lintr'));devtools::install_deps(dependencies = TRUE)"
33
lint:
4-
Rscript -e "devtools::load_all();lintr::lint_package()"
4+
Rscript -e "devtools::load_all();lintr::lint_package()"
55
format:
6-
Rscript -e "styler::style_pkg()"
6+
Rscript -e "styler::style_pkg()"
77
test:
8-
Rscript -e "devtools::test()"
9-
build:
10-
Rscript -e "devtools::document();devtools::build()"
8+
Rscript -e "devtools::test()"
9+
document:
10+
Rscript -e "devtools::document()"
11+
build: document
12+
Rscript -e "devtools::build()"
1113
check:
12-
Rscript -e "devtools::check(args = c('--no-manual', '--as-cran'), error_on = 'error')"
14+
Rscript -e "devtools::check(args = c('--no-manual', '--as-cran'), error_on = 'warning')"
15+
chores: format lint check

README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,26 @@
33
[![License: MIT][mit-image]][mit-url] [![Github Actions][github-actions-image]][github-actions-url]
44
[![codecov](https://codecov.io/gh/dsweber2/epidatr/branch/dev/graph/badge.svg?token=jVHL9eHZNZ)](https://codecov.io/gh/dsweber2/epidatr)
55

6-
This package provides an R client for the [Delphi Epidata
7-
API](https://cmu-delphi.github.io/delphi-epidata/).
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 from both official government sources such as the [Center for Disease Control (CDC)](https://www.cdc.gov/datastatistics/index.html) and private partners such as [Quidel](https://www.quidel.com/), [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/).
7+
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)).
810

911
## Usage
1012

1113
```R
1214
library(epidatr)
13-
epicall <- covidcast(
15+
# Obtain the smoothed covid-like illness (CLI) signal from the Facebook survey as it was on April 10, 2021 for the US
16+
epidata <- covidcast(
1417
source = "fb-survey",
1518
signals = "smoothed_cli",
1619
geo_type = "nation",
1720
time_type = "day",
1821
geo_values = "us",
19-
time_values = epirange(20210405, 20210410)
22+
time_values = epirange(20210101, 20210601),
23+
as_of = "2021-06-01"
2024
)
25+
epidata
2126
```
2227

2328
```
@@ -36,6 +41,19 @@ epicall <- covidcast(
3641
# sample_size <dbl>
3742
```
3843

44+
```r
45+
# Plot this data
46+
library(ggplot2)
47+
ggplot(epidata, aes(x = time_value, y = value)) +
48+
geom_line() +
49+
labs(title = "Smoothed CLI from Facebook Survey",
50+
subtitle = "US, 2021",
51+
x = "Date",
52+
y = "CLI")
53+
```
54+
55+
<img src="man/figures/fb-cli-signal.png" style="height:750px; width:750px" alt="Smoothed CLI from Facebook Survey">
56+
3957
## Installation
4058

4159
Install from GitHub:

man/figures/fb-cli-signal.png

35.9 KB
Loading

vignettes/epidatr.Rmd

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ output: rmarkdown::html_vignette
44
vignette: >
55
%\VignetteIndexEntry{Delphi Epidata R API Client}
66
%\VignetteEngine{knitr::rmarkdown}
7+
%\VignetteDepends{ggplot2}
78
\usepackage[utf8]{inputenc}
89
---
910

@@ -44,10 +45,25 @@ In this case, the `covidcast()` function lets us specify these parameters for
4445
the endpoint and returns a tibble with the results:
4546

4647
```{r}
47-
covidcast(
48+
epidata <- covidcast(
4849
"fb-survey", "smoothed_cli", "state", "day", "pa",
49-
epirange(20210405, 20210410)
50+
epirange(20210105, 20210410)
5051
)
52+
epidata
53+
```
54+
55+
We can then easily plot the data using ggplot2:
56+
57+
```{r, out.height="65%"}
58+
library(ggplot2)
59+
ggplot(epidata, aes(x = time_value, y = value)) +
60+
geom_line() +
61+
labs(
62+
title = "Smoothed CLI from Facebook Survey",
63+
subtitle = "PA, 2021",
64+
x = "Date",
65+
y = "CLI"
66+
)
5167
```
5268

5369
The [Delphi Epidata API documentation](https://cmu-delphi.github.io/delphi-epidata/) has more information on the available endpoints and arguments. You can also use the `avail_endpoints()` function to get a table of endpoint functions:

0 commit comments

Comments
 (0)