Skip to content

first pass endpoints vignette (for closing #96) #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ env
.httr-oauth
/doc/
/Meta/
.secrets
42 changes: 30 additions & 12 deletions R/endpoints.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' \dontrun{
#' pvt_cdc(
#' auth = "yourkey",
#' "fl,ca",
#' locations = "fl,ca",
#' epirange(201501, 201601)
#' ) %>% fetch()
#' }
Expand Down Expand Up @@ -62,6 +62,7 @@ pvt_cdc <- function(auth, locations, epiweeks) {
#' @examples
#' \donttest{
#' covid_hosp_facility_lookup(state = "fl") %>% fetch()
#' covid_hosp_facility_lookup(city = "southlake") %>% fetch()
#' }
#' @param state string. A two-letter character string state abbreviation.
#' @param ccn string. A character string for facility CMS certification number.
Expand Down Expand Up @@ -583,7 +584,7 @@ covid_hosp_state_timeseries <- function(states, dates, issues = NULL) {
#' covidcast_meta() %>% fetch()
#' }
#'
#' @seealso [covidcast()]
#' @seealso [covidcast()],[covidcast_epidata()]
#' @export
covidcast_meta <- function() {
create_epidata_call(
Expand Down Expand Up @@ -614,6 +615,7 @@ covidcast_meta <- function() {
#' Fetch covidcast data
#'
#' API docs: <https://cmu-delphi.github.io/delphi-epidata/api/covidcast.html>
#'
#' COVIDcast public dashboard: <https://delphi.cmu.edu/covidcast/>
#'
#' @examples
Expand All @@ -626,11 +628,19 @@ covidcast_meta <- function() {
#' geo_values = "ca,fl",
#' time_values = epirange(20200601, 20200801)
#' ) %>% fetch()
#' covidcast(
#' data_source = "jhu-csse",
#' signals = "confirmed_7dav_incidence_prop",
#' geo_type = "state",
#' time_type = "day",
#' geo_values = "*",
#' time_values = epirange(20200601, 20200801)
#' ) %>% fetch()
#' }
#' @param data_source string. The data source to query (see:
#' <https://cmu-delphi.github.io/delphi-epidata/api/covidcast_signals.html>).
#' @param signals string. The signals to query from a specific source (see:
#' <https://cmu-delphi.github.io/delphi-epidata/api/covidcast-signals>).
#' <https://cmu-delphi.github.io/delphi-epidata/api/covidcast-signals.html>).
#' @param geo_type string. The geographic resolution of the data (see:
#' <https://cmu-delphi.github.io/delphi-epidata/api/covidcast_geography.html>).
#' @param time_type string. The temporal resolution of the data (either "day" or
Expand All @@ -649,7 +659,7 @@ covidcast_meta <- function() {
#' `issues`.
#' @return [`epidata_call`]
#'
#' @seealso [covidcast_meta()], [epirange()]
#' @seealso [covidcast_meta()], [covidcast_epidata()], [epirange()]
#'
#' @export
covidcast <- function(
Expand Down Expand Up @@ -737,7 +747,7 @@ covidcast <- function(
#'
#' @examples
#' \donttest{
#' delphi(system = "ec", epiweek = 201501) %>% fetch()
#' delphi(system = "ec", epiweek = 202006) %>% fetch()
#' }
#' @param system string. The system name to fetch.
#' @param epiweek [`timeset`]. The epiweeks to fetch.
Expand Down Expand Up @@ -769,7 +779,7 @@ delphi <- function(system, epiweek) {
#' @examples
#' \dontrun{
#' dengue_nowcast(
#' locations = "?",
#' locations = "pr",
#' epiweeks = epirange(201501, 202001)
#' ) %>% fetch()
#' }
Expand Down Expand Up @@ -805,8 +815,8 @@ dengue_nowcast <- function(locations, epiweeks) {
#' \dontrun{
#' pvt_dengue_sensors(
#' auth = "yourkey",
#' names = "?",
#' locations = "?",
#' names = "ght",
#' locations = "ag",
#' epiweeks = epirange(201501, 202001)
#' ) %>% fetch()
#' }
Expand Down Expand Up @@ -1010,6 +1020,10 @@ fluview_clinical <- function(regions, epiweeks, issues = NULL, lag = NULL) {
#' Fetch FluView metadata
#'
#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/fluview_meta.html
#' @examples
#' \donttest{
#' fluview_meta() %>% fetch()
#' }
#'
#' @return [`epidata_call`]
#'
Expand Down Expand Up @@ -1149,7 +1163,7 @@ gft <- function(locations, epiweeks) {
#' auth = "yourkey",
#' locations = "ca",
#' epiweeks = epirange(201201, 202001),
#' query = "?"
#' query = "how to get over the flu"
#' ) %>% fetch()
#' }
#' @param auth string. Restricted access key (not the same as API key).
Expand Down Expand Up @@ -1189,7 +1203,7 @@ pvt_ght <- function(auth, locations, epiweeks, query) {
#' TODO: find a non-trivial region
#' @examples
#' \dontrun{
#' kcdc_ili(regions = "?", epiweeks = epirange(201201, 202001)) %>% fetch()
#' kcdc_ili(regions = "ROC", epiweeks = 200436) %>% fetch()
#' }
#' @param regions character vector. The regions to be fetched.
#' @param epiweeks [`timeset`]. The epiweeks to be fetched.
Expand Down Expand Up @@ -1234,6 +1248,10 @@ kcdc_ili <- function(regions, epiweeks, issues = NULL, lag = NULL) {
#'
#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/meta_norostat.html
#'
#' @examples
#' \donttest{
#' pvt_meta_norostat(auth = "yourkey") %>% fetch()
#' }
#' @param auth string. Restricted access key (not the same as API key).
#' @return [`epidata_call`]
#'
Expand Down Expand Up @@ -1354,8 +1372,8 @@ nidss_flu <- function(regions, epiweeks, issues = NULL, lag = NULL) {
#' \dontrun{
#' pvt_norostat(
#' auth = "yourkey",
#' locations = "Minnesota, Ohio, Oregon, Tennessee, and Wisconsin",
#' epiweeks = epirange(201401, 201501)
#' locations = "1",
#' epiweeks = 201233
#' ) %>% fetch()
#' }
#' @param auth string. Your authentication key.
Expand Down
1 change: 1 addition & 0 deletions man/covid_hosp_facility_lookup.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions man/covidcast.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/covidcast_meta.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/delphi.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/dengue_nowcast.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/do_request.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions man/fluview_meta.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/kcdc_ili.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/pvt_cdc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/pvt_dengue_sensors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/pvt_ght.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/pvt_meta_norostat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/pvt_norostat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion vignettes/covidcast.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ library("epidatr")
library("magrittr")
```


```{r}
covidcast_api <- covidcast_epidata()
epicall <- covidcast_api$sources$`fb-survey`$signals$smoothed_cli$call("nation", "us", epirange(20210405, 20210410))
Expand Down
Loading