From 11dd979073ff09671c841955ae7f908b991c312a Mon Sep 17 00:00:00 2001 From: Dmitry Shemetov Date: Thu, 31 Mar 2022 14:17:05 -0700 Subject: [PATCH 1/5] Endpoints and covidcast_epidata documentation pass --- R/covidcast.R | 13 ++- R/endpoints.R | 219 ++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 188 insertions(+), 44 deletions(-) diff --git a/R/covidcast.R b/R/covidcast.R index 5d008bca..a2c9fbba 100644 --- a/R/covidcast.R +++ b/R/covidcast.R @@ -84,7 +84,18 @@ print.covidcast_data_source <- function(source, ...) { #' creates the covidcast epidata helper #' -#' @param base_url optional alternative base url +#' Creates a helper object that can use auto-complete to help find covidcast +#' sources and signals. +#' +#' @examples +#' covidcast_api <- covidcast_epidata() +#' print(covidcast_api) # print available sources and signals +#' fb_survey <- covidcast_api$sources$`fb-survey` # tab completion for sources +#' print(fb_survey) # print a verbose list of available signals +#' smoothed_cli <- fb_survey$signals$smoothed_cli # tab completion for signals +#' print(smoothed_cli) +#' df <- smoothed_cli$call("nation", "us", epirange(20210405, 20210410)) +#' @param base_url optional alternative API base url #' @importFrom httr RETRY stop_for_status content #' @importFrom jsonlite fromJSON #' @return an instance of covidcast_epidata diff --git a/R/endpoints.R b/R/endpoints.R index 9dab9c11..4949da43 100644 --- a/R/endpoints.R +++ b/R/endpoints.R @@ -1,11 +1,16 @@ #' fetch AFHSB data (point data, no min/max) #' -#' @param auth authenfication token -#' @param locations locations to fetch -#' @param epiweeks epiweeks to fetch -#' @param flu_types flu_types to fetch +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/afhsb.html +#' +#' @param auth character authentication token +#' @param locations character locations to fetch +#' @param epiweeks epirange epiweeks to fetch +#' @param flu_types character flu_types to fetch #' @return an instance of epidata_call #' +#' @examples +#' call <- pvt_afhsb(auth = "yourkey", "fl,ca", epirange(202001, 202110), "flu1,flu2-flu1") +#' # fetch_csv(call) #' @export pvt_afhsb <- function(auth, locations, epiweeks, flu_types) { check_single_string_param("auth", auth) @@ -30,12 +35,16 @@ pvt_afhsb <- function(auth, locations, epiweeks, flu_types) { ) } -#' #' fetch CDC page hits #' -#' @param auth authenfication token -#' @param epiweeks epiweeks to fetch -#' @param locations locations to fetch +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/cdc.html +#' +#' @examples +#' call <- pvt_cdc(auth = "yourkey", epirange(20210101, 20210201), "fl,ca") +#' # fetch_csv(call) +#' @param auth character authentication token +#' @param epiweeks epirange epiweeks to fetch +#' @param locations character locations to fetch #' @return an instance of epidata_call #' #' @export @@ -68,14 +77,18 @@ pvt_cdc <- function(auth, epiweeks, locations) { ) } -#' #' fetch COVID hospitalization facility identifiers #' -#' @param state optional state -#' @param ccn optional ccn -#' @param city optional city -#' @param zip optional zip code -#' @param fips_code optional fips code +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp_facility_lookup.html +#' +#' @examples +#' call <- covid_hosp_facility_lookup(state = "fl") +#' fetch_csv(call) +#' @param state optional character state +#' @param ccn optional character ccn +#' @param city optional character city +#' @param zip optional numeric zip code +#' @param fips_code optional numeric fips code #' @return an instance of epidata_call #' #' @export @@ -119,12 +132,16 @@ covid_hosp_facility_lookup <- ) } -#' #' fetch COVID hospitalization data for specific facilities #' -#' @param hospital_pks hospitals to fetch -#' @param collection_weeks weeks to fetch -#' @param publication_dates publication dates to fetch +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp_facility_lookup.html +#' +#' @examples +#' call <- covid_hosp_facility(hospital_pks = "100075", collection_weeks = epirange(202001, 202005)) +#' fetch_csv(call) +#' @param hospital_pks character hospitals to fetch +#' @param collection_weeks epirange weeks to fetch +#' @param publication_dates optional epirange publication dates to fetch #' @return an instance of epidata_call #' #' @export @@ -393,9 +410,13 @@ covid_hosp_facility <- ) } -#' #' fetch COVID hospitalization data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp.html +#' +#' @examples +#' call <- covid_hosp_state_timeseries(states = "fl", dates = epirange(20200101, 20200501)) +#' fetch_csv(call) #' @param states states to fetch #' @param dates dates to fetch #' @param issues issues to fetch @@ -531,9 +552,10 @@ covid_hosp_state_timeseries <- ) } -#' #' fetch covidcast meta data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/covidcast_meta.html +#' #' @return an instance of epidata_call #' #' @export @@ -564,9 +586,10 @@ covidcast_meta <- function() { } -#' #' fetch covidcast_nowcast data #' +#' Not an active endpoint yet. +#' #' @param data_source data source to fetch #' @param signals data source to fetch #' @param sensor_names sensor names to fetch @@ -643,9 +666,21 @@ covidcast_nowcast <- ) ) } -#' + #' fetch covidcast data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/covidcast.html +#' +#' @examples +#' call <- covidcast( +#' data_source = "jhu-csse", +#' signals = "confirmed_7dav_incidence_prop", +#' time_type = "day", +#' geo_type = "state", +#' time_values = epirange(20200601, 20200801), +#' geo_values = "ca,fl" +#' ) +#' fetch_csv(call) #' @param data_source data source to fetch #' @param signals data source to fetch #' @param time_type data source to fetch @@ -731,8 +766,13 @@ covidcast <- ) } -#' #' fetch Delphi's forecast +#' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/delphi.html +#' +#' @examples +#' call <- delphi(system = "ec", epiweek = 202006) +#' fetch_classic(call) #' @param system system to fetch #' @param epiweek epiweek to fetch #' @return an instance of epidata_call @@ -754,8 +794,14 @@ delphi <- function(system, epiweek) { ) } -#' #' fetch Delphi's PAHO Dengue nowcast +#' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/dengue_nowcast.html +#' +#' TODO: what are valid locations? +#' @examples +#' call <- dengue_nowcast(locations = "?", epiweeks = epirange(201501, 202001)) +#' fetch_classic(call) #' @param locations locations to fetch #' @param epiweeks epiweeks to fetch #' @return an instance of epidata_call @@ -777,8 +823,14 @@ dengue_nowcast <- function(locations, epiweeks) { ) } -#' #' fetch Delphi's digital surveillance sensors +#' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/dengue_sensors.html +#' +#' TODO: what are valid locations and names? +#' @examples +#' call <- pvt_dengue_sensors(auth = "yourkey", names = "?", locations = "?", epiweeks = epirange(201501, 202001)) +#' # fetch_classic(call) #' @param auth authenfication token #' @param names names to fetch #' @param locations locations to fetch @@ -809,10 +861,14 @@ pvt_dengue_sensors <- function(auth, names, locations, epiweeks) { ) } - -#' #' fetch ECDC data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/ecdc_ili.html +#' +#' TODO: find a region that has non-trivial output +#' @examples +#' call <- ecdc_ili(regions = "?", epiweeks = epirange(201201, 202001)) +#' fetch_classic(call) #' @param regions regions to fetch #' @param epiweeks epiweeks to fetch #' @param issues optionally specify the exact issues to fetch @@ -850,9 +906,13 @@ ecdc_ili <- function(regions, ) } -#' #' fetch FluSurv virological data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/flusurv.html +#' +#' @examples +#' call <- flusurv(locations = "CA", epiweeks = epirange(201201, 202001)) +#' fetch_classic(call) #' @param locations locations to fetch #' @param epiweeks epiweeks to fetch #' @param issues optionally specify the exact issues to fetch @@ -895,9 +955,13 @@ flusurv <- function(locations, ) } -#' #' fetch FluView virological data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/fluview_clinical.html +#' +#' @examples +#' call <- fluview_clinical(regions = "nat", epiweeks = epirange(201201, 202001)) +#' fetch_classic(call) #' @param regions regions to fetch #' @param epiweeks epiweeks to fetch #' @param issues optionally specify the exact issues to fetch @@ -941,9 +1005,10 @@ fluview_clinical <- ) } -#' #' fetch fluview meta data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/fluview_meta.html +#' #' @return an instance of epidata_call #' #' @export @@ -959,9 +1024,13 @@ fluview_meta <- function() { ) } -#' #' fetch fluview data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/fluview.html +#' +#' @examples +#' call <- fluview(regions = "nat", epiweeks = epirange(201201, 202001)) +#' fetch_classic(call) #' @param regions regions to fetch #' @param epiweeks epiweeks to fetch #' @param issues optionally specify the exact issues to fetch @@ -1014,9 +1083,13 @@ fluview <- ) } -#' #' fetch Google Flu Trends data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/gft.html +#' +#' @examples +#' call <- gft(locations = "hhs1", epiweeks = epirange(201201, 202001)) +#' fetch_classic(call) #' @param locations locations to fetch #' @param epiweeks epiweeks to fetch #' @return an instance of epidata_call @@ -1036,9 +1109,14 @@ gft <- function(locations, epiweeks) { ) } -#' #' fetch Google Health Trends data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/ght.html +#' +#' TODO: find a non-trivial query +#' @examples +#' call <- pvt_ght(auth = "yourkey", locations = "ca", epiweeks = epirange(201201, 202001), query = "?") +#' # fetch_classic(call) #' @param auth autentification #' @param locations locations to fetch #' @param epiweeks epiweeks to fetch @@ -1067,9 +1145,14 @@ pvt_ght <- function(auth, locations, epiweeks, query) { ) } -#' #' fetch KCDC data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/kcdc_ili.html +#' +#' TODO: find a non-trivial region +#' @examples +#' call <- kcdc_ili(regions = "?", epiweeks = epirange(201201, 202001)) +#' fetch_csv(call) #' @param regions regions to fetch #' @param epiweeks epiweeks to fetch #' @param issues optionally specify the exact issues to fetch @@ -1107,9 +1190,10 @@ kcdc_ili <- function(regions, ) } - #' fetch AFHSB meta data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/meta_afhsb.html +#' #' @param auth authenfication token #' @return an instance of epidata_call #' @@ -1122,6 +1206,8 @@ pvt_meta_afhsb <- function(auth) { #' fetch NoroSTAT meta data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/meta_norostat.html +#' #' @param auth authenfication token #' @return an instance of epidata_call #' @@ -1132,9 +1218,10 @@ pvt_meta_norostat <- function(auth) { create_epidata_call("meta_norostat/", list(auth = auth), only_supports_classic = TRUE) } -#' #' fetch api meta data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/meta.html +#' #' @return an instance of epidata_call #' #' @export @@ -1142,8 +1229,13 @@ meta <- function() { create_epidata_call("meta/", list(), only_supports_classic = TRUE) } -#' #' fetch NIDSS dengue data +#' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/nidss_dengue.html +#' +#' @examples +#' call <- nidss_dengue(locations = "taipei", epiweeks = epirange(201201, 202001)) +#' fetch_classic(call) #' @param locations locations to fech #' @param epiweeks epiweeks to fetch #' @return an instance of epidata_call @@ -1164,8 +1256,13 @@ nidss_dengue <- function(locations, epiweeks) { ) } +#' fetch NIDSS flu data #' -#' fetch NIDSS dengue data +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/nidss_flu.html +#' +#' @examples +#' call <- nidss_flu(regions = "taipei", epiweeks = epirange(201201, 202001)) +#' fetch_classic(call) #' @param regions regions to fetch #' @param epiweeks epiweeks to fetch #' @param issues optional issues @@ -1210,6 +1307,15 @@ nidss_flu <- #' fetch NoroSTAT data (point data, no min/max) #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/norostat.html +#' +#' @examples +#' call <- pvt_norostat( +#' auth = "yourkey", +#' location = "Minnesota, Ohio, Oregon, Tennessee, and Wisconsin", +#' epiweeks = epirange(201201, 202001) +#' ) +#' # fetch_classic(call) #' @param auth authenfication token #' @param location location to fetch #' @param epiweeks epiweeks to fetch @@ -1236,8 +1342,13 @@ pvt_norostat <- function(auth, location, epiweeks) { ) } -#' #' fetch Delphi's wILI nowcast +#' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/nowcast.html +#' +#' @examples +#' call <- nowcast(location = "ca", epiweeks = epirange(201201, 202001)) +#' fetch_classic(call) #' @param locations locations to fetch #' @param epiweeks epiweeks to fetch #' @return an instance of epidata_call @@ -1261,6 +1372,11 @@ nowcast <- function(locations, epiweeks) { #' fetch Paho Dengue #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/paho_dengue.html +#' +#' @examples +#' call <- paho_dengue(regions = "ca", epiweeks = epirange(201201, 202001)) +#' fetch_classic(call) #' @param regions regions to fetch #' @param epiweeks epiweeks to fetch #' @param issues issues to fetch @@ -1301,9 +1417,13 @@ paho_dengue <- function(regions, ) } - #' fetch Quidel data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/quidel.html +#' +#' @examples +#' call <- pvt_quidel(auth = "yourkey", epiweeks = epirange(201201, 202001), locations = "hhs1") +#' # fetch_classic(call) #' @param auth authenfication token #' @param epiweeks epiweeks to fetch #' @param locations locations to fetch @@ -1330,8 +1450,13 @@ pvt_quidel <- function(auth, epiweeks, locations) { ) } -#' #' fetch Delphi's digital surveillance sensors +#' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/sensors.html +#' +#' @examples +#' call <- pvt_sensors(auth = "yourkey", names = "sar3", locations = "nat", epiweeks = epirange(201501, 202001)) +#' # fetch_classic(call) #' @param auth authenfication token #' @param names names to fetch #' @param locations locations to fetch @@ -1362,9 +1487,13 @@ pvt_sensors <- function(auth, names, locations, epiweeks) { ) } -#' #' fetch HealthTweets data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/twitter.html +#' +#' @examples +#' call <- pvt_twitter(auth = "yourkey", locations = "CA", epiweeks = epirange(201501, 202001)) +#' # fetch_csv(call) #' @param auth autentification #' @param locations locations to fetch #' @param dates epiweeks to fetch @@ -1407,9 +1536,13 @@ pvt_twitter <- ) } -#' #' fetch Wikipedia access data #' +#' API docs: https://cmu-delphi.github.io/delphi-epidata/api/wiki.html +#' +#' @examples +#' call <- wiki(articles = "avian_influenza", epiweeks = epirange(201501, 202001)) +#' fetch_csv(call) #' @param articles articles to fetch #' @param dates dates to fetch #' @param epiweeks epiweeks to fetch From 8634ab725eb42ba18719dd907f670ddaf241ea25 Mon Sep 17 00:00:00 2001 From: "Logan C. Brooks" Date: Wed, 19 Oct 2022 13:33:24 -0700 Subject: [PATCH 2/5] Re-`document()` --- DESCRIPTION | 2 +- man/covid_hosp_facility.Rd | 12 ++++++++---- man/covid_hosp_facility_lookup.Rd | 16 ++++++++++------ man/covid_hosp_state_timeseries.Rd | 6 +++++- man/covidcast.Rd | 13 ++++++++++++- man/covidcast_epidata.Rd | 14 ++++++++++++-- man/covidcast_meta.Rd | 2 +- man/covidcast_nowcast.Rd | 2 +- man/delphi.Rd | 6 +++++- man/dengue_nowcast.Rd | 9 ++++++++- man/ecdc_ili.Rd | 9 ++++++++- man/flusurv.Rd | 6 +++++- man/fluview.Rd | 6 +++++- man/fluview_clinical.Rd | 6 +++++- man/fluview_meta.Rd | 2 +- man/gft.Rd | 6 +++++- man/kcdc_ili.Rd | 9 ++++++++- man/meta.Rd | 2 +- man/nidss_dengue.Rd | 6 +++++- man/nidss_flu.Rd | 8 ++++++-- man/nowcast.Rd | 6 +++++- man/paho_dengue.Rd | 6 +++++- man/pvt_afhsb.Rd | 14 +++++++++----- man/pvt_cdc.Rd | 12 ++++++++---- man/pvt_dengue_sensors.Rd | 9 ++++++++- man/pvt_ght.Rd | 9 ++++++++- man/pvt_meta_afhsb.Rd | 2 +- man/pvt_meta_norostat.Rd | 2 +- man/pvt_norostat.Rd | 10 +++++++++- man/pvt_quidel.Rd | 6 +++++- man/pvt_sensors.Rd | 6 +++++- man/pvt_twitter.Rd | 6 +++++- man/wiki.Rd | 6 +++++- 33 files changed, 186 insertions(+), 50 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d96b2f1f..7198610d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,7 +25,7 @@ Imports: readr, MMWRweek, rlang -RoxygenNote: 7.1.1 +RoxygenNote: 7.2.1 Suggests: knitr, magrittr, diff --git a/man/covid_hosp_facility.Rd b/man/covid_hosp_facility.Rd index eb91f775..9629ed8b 100644 --- a/man/covid_hosp_facility.Rd +++ b/man/covid_hosp_facility.Rd @@ -7,15 +7,19 @@ covid_hosp_facility(hospital_pks, collection_weeks, publication_dates = NULL) } \arguments{ -\item{hospital_pks}{hospitals to fetch} +\item{hospital_pks}{character hospitals to fetch} -\item{collection_weeks}{weeks to fetch} +\item{collection_weeks}{epirange weeks to fetch} -\item{publication_dates}{publication dates to fetch} +\item{publication_dates}{optional epirange publication dates to fetch} } \value{ an instance of epidata_call } \description{ -fetch COVID hospitalization data for specific facilities +API docs: https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp_facility_lookup.html +} +\examples{ +call <- covid_hosp_facility(hospital_pks = "100075", collection_weeks = epirange(202001, 202005)) +fetch_csv(call) } diff --git a/man/covid_hosp_facility_lookup.Rd b/man/covid_hosp_facility_lookup.Rd index e5ce133f..665949d6 100644 --- a/man/covid_hosp_facility_lookup.Rd +++ b/man/covid_hosp_facility_lookup.Rd @@ -13,19 +13,23 @@ covid_hosp_facility_lookup( ) } \arguments{ -\item{state}{optional state} +\item{state}{optional character state} -\item{ccn}{optional ccn} +\item{ccn}{optional character ccn} -\item{city}{optional city} +\item{city}{optional character city} -\item{zip}{optional zip code} +\item{zip}{optional numeric zip code} -\item{fips_code}{optional fips code} +\item{fips_code}{optional numeric fips code} } \value{ an instance of epidata_call } \description{ -fetch COVID hospitalization facility identifiers +API docs: https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp_facility_lookup.html +} +\examples{ +call <- covid_hosp_facility_lookup(state = "fl") +fetch_csv(call) } diff --git a/man/covid_hosp_state_timeseries.Rd b/man/covid_hosp_state_timeseries.Rd index c248ae48..3919d630 100644 --- a/man/covid_hosp_state_timeseries.Rd +++ b/man/covid_hosp_state_timeseries.Rd @@ -17,5 +17,9 @@ covid_hosp_state_timeseries(states, dates, issues = NULL) an instance of epidata_call } \description{ -fetch COVID hospitalization data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp.html +} +\examples{ +call <- covid_hosp_state_timeseries(states = "fl", dates = epirange(20200101, 20200501)) +fetch_csv(call) } diff --git a/man/covidcast.Rd b/man/covidcast.Rd index be6261e7..38445ad3 100644 --- a/man/covidcast.Rd +++ b/man/covidcast.Rd @@ -39,5 +39,16 @@ covidcast( an instance of epidata_call } \description{ -fetch covidcast data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/covidcast.html +} +\examples{ +call <- covidcast( + data_source = "jhu-csse", + signals = "confirmed_7dav_incidence_prop", + time_type = "day", + geo_type = "state", + time_values = epirange(20200601, 20200801), + geo_values = "ca,fl" +) +fetch_csv(call) } diff --git a/man/covidcast_epidata.Rd b/man/covidcast_epidata.Rd index 40e0ac94..ab844b01 100644 --- a/man/covidcast_epidata.Rd +++ b/man/covidcast_epidata.Rd @@ -7,11 +7,21 @@ covidcast_epidata(base_url = global_base_url) } \arguments{ -\item{base_url}{optional alternative base url} +\item{base_url}{optional alternative API base url} } \value{ an instance of covidcast_epidata } \description{ -creates the covidcast epidata helper +Creates a helper object that can use auto-complete to help find covidcast +sources and signals. +} +\examples{ +covidcast_api <- covidcast_epidata() +print(covidcast_api) # print available sources and signals +fb_survey <- covidcast_api$sources$`fb-survey` # tab completion for sources +print(fb_survey) # print a verbose list of available signals +smoothed_cli <- fb_survey$signals$smoothed_cli # tab completion for signals +print(smoothed_cli) +df <- smoothed_cli$call("nation", "us", epirange(20210405, 20210410)) } diff --git a/man/covidcast_meta.Rd b/man/covidcast_meta.Rd index 34333e13..0870f983 100644 --- a/man/covidcast_meta.Rd +++ b/man/covidcast_meta.Rd @@ -10,5 +10,5 @@ covidcast_meta() an instance of epidata_call } \description{ -fetch covidcast meta data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/covidcast_meta.html } diff --git a/man/covidcast_nowcast.Rd b/man/covidcast_nowcast.Rd index 20dffae0..21aebd10 100644 --- a/man/covidcast_nowcast.Rd +++ b/man/covidcast_nowcast.Rd @@ -42,5 +42,5 @@ covidcast_nowcast( an instance of epidata_call } \description{ -fetch covidcast_nowcast data +Not an active endpoint yet. } diff --git a/man/delphi.Rd b/man/delphi.Rd index e59fb34c..18ac3691 100644 --- a/man/delphi.Rd +++ b/man/delphi.Rd @@ -15,5 +15,9 @@ delphi(system, epiweek) an instance of epidata_call } \description{ -fetch Delphi's forecast +API docs: https://cmu-delphi.github.io/delphi-epidata/api/delphi.html +} +\examples{ +call <- delphi(system = "ec", epiweek = 202006) +fetch_classic(call) } diff --git a/man/dengue_nowcast.Rd b/man/dengue_nowcast.Rd index a86d94df..f94dd32d 100644 --- a/man/dengue_nowcast.Rd +++ b/man/dengue_nowcast.Rd @@ -15,5 +15,12 @@ dengue_nowcast(locations, epiweeks) an instance of epidata_call } \description{ -fetch Delphi's PAHO Dengue nowcast +API docs: https://cmu-delphi.github.io/delphi-epidata/api/dengue_nowcast.html +} +\details{ +TODO: what are valid locations? +} +\examples{ +call <- dengue_nowcast(locations = "?", epiweeks = epirange(201501, 202001)) +fetch_classic(call) } diff --git a/man/ecdc_ili.Rd b/man/ecdc_ili.Rd index 5492a7ef..9eaa8e5d 100644 --- a/man/ecdc_ili.Rd +++ b/man/ecdc_ili.Rd @@ -19,5 +19,12 @@ ecdc_ili(regions, epiweeks, issues = NULL, lag = NULL) an instance of epidata_call } \description{ -fetch ECDC data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/ecdc_ili.html +} +\details{ +TODO: find a region that has non-trivial output +} +\examples{ +call <- ecdc_ili(regions = "?", epiweeks = epirange(201201, 202001)) +fetch_classic(call) } diff --git a/man/flusurv.Rd b/man/flusurv.Rd index 8279f860..9f03d62e 100644 --- a/man/flusurv.Rd +++ b/man/flusurv.Rd @@ -19,5 +19,9 @@ flusurv(locations, epiweeks, issues = NULL, lag = NULL) an instance of epidata_call } \description{ -fetch FluSurv virological data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/flusurv.html +} +\examples{ +call <- flusurv(locations = "CA", epiweeks = epirange(201201, 202001)) +fetch_classic(call) } diff --git a/man/fluview.Rd b/man/fluview.Rd index f165d138..7ca37f3d 100644 --- a/man/fluview.Rd +++ b/man/fluview.Rd @@ -21,5 +21,9 @@ fluview(regions, epiweeks, issues = NULL, lag = NULL, auth = NULL) an instance of epidata_call } \description{ -fetch fluview data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/fluview.html +} +\examples{ +call <- fluview(regions = "nat", epiweeks = epirange(201201, 202001)) +fetch_classic(call) } diff --git a/man/fluview_clinical.Rd b/man/fluview_clinical.Rd index e313508f..a2b99091 100644 --- a/man/fluview_clinical.Rd +++ b/man/fluview_clinical.Rd @@ -19,5 +19,9 @@ fluview_clinical(regions, epiweeks, issues = NULL, lag = NULL) an instance of epidata_call } \description{ -fetch FluView virological data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/fluview_clinical.html +} +\examples{ +call <- fluview_clinical(regions = "nat", epiweeks = epirange(201201, 202001)) +fetch_classic(call) } diff --git a/man/fluview_meta.Rd b/man/fluview_meta.Rd index 86fadef3..6d00edf5 100644 --- a/man/fluview_meta.Rd +++ b/man/fluview_meta.Rd @@ -10,5 +10,5 @@ fluview_meta() an instance of epidata_call } \description{ -fetch fluview meta data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/fluview_meta.html } diff --git a/man/gft.Rd b/man/gft.Rd index 973fab28..daf5d0dd 100644 --- a/man/gft.Rd +++ b/man/gft.Rd @@ -15,5 +15,9 @@ gft(locations, epiweeks) an instance of epidata_call } \description{ -fetch Google Flu Trends data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/gft.html +} +\examples{ +call <- gft(locations = "hhs1", epiweeks = epirange(201201, 202001)) +fetch_classic(call) } diff --git a/man/kcdc_ili.Rd b/man/kcdc_ili.Rd index 6cd245d1..2f745915 100644 --- a/man/kcdc_ili.Rd +++ b/man/kcdc_ili.Rd @@ -19,5 +19,12 @@ kcdc_ili(regions, epiweeks, issues = NULL, lag = NULL) an instance of epidata_call } \description{ -fetch KCDC data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/kcdc_ili.html +} +\details{ +TODO: find a non-trivial region +} +\examples{ +call <- kcdc_ili(regions = "?", epiweeks = epirange(201201, 202001)) +fetch_csv(call) } diff --git a/man/meta.Rd b/man/meta.Rd index 19f7d905..f1483002 100644 --- a/man/meta.Rd +++ b/man/meta.Rd @@ -10,5 +10,5 @@ meta() an instance of epidata_call } \description{ -fetch api meta data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/meta.html } diff --git a/man/nidss_dengue.Rd b/man/nidss_dengue.Rd index ff294ad9..610604fc 100644 --- a/man/nidss_dengue.Rd +++ b/man/nidss_dengue.Rd @@ -15,5 +15,9 @@ nidss_dengue(locations, epiweeks) an instance of epidata_call } \description{ -fetch NIDSS dengue data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/nidss_dengue.html +} +\examples{ +call <- nidss_dengue(locations = "taipei", epiweeks = epirange(201201, 202001)) +fetch_classic(call) } diff --git a/man/nidss_flu.Rd b/man/nidss_flu.Rd index 282eb91f..42e37f20 100644 --- a/man/nidss_flu.Rd +++ b/man/nidss_flu.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/endpoints.R \name{nidss_flu} \alias{nidss_flu} -\title{fetch NIDSS dengue data} +\title{fetch NIDSS flu data} \usage{ nidss_flu(regions, epiweeks, issues = NULL, lag = NULL) } @@ -19,5 +19,9 @@ nidss_flu(regions, epiweeks, issues = NULL, lag = NULL) an instance of epidata_call } \description{ -fetch NIDSS dengue data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/nidss_flu.html +} +\examples{ +call <- nidss_flu(regions = "taipei", epiweeks = epirange(201201, 202001)) +fetch_classic(call) } diff --git a/man/nowcast.Rd b/man/nowcast.Rd index 0039bbac..9ec78cd1 100644 --- a/man/nowcast.Rd +++ b/man/nowcast.Rd @@ -15,5 +15,9 @@ nowcast(locations, epiweeks) an instance of epidata_call } \description{ -fetch Delphi's wILI nowcast +API docs: https://cmu-delphi.github.io/delphi-epidata/api/nowcast.html +} +\examples{ +call <- nowcast(location = "ca", epiweeks = epirange(201201, 202001)) +fetch_classic(call) } diff --git a/man/paho_dengue.Rd b/man/paho_dengue.Rd index d7b13d19..1525eae2 100644 --- a/man/paho_dengue.Rd +++ b/man/paho_dengue.Rd @@ -19,5 +19,9 @@ paho_dengue(regions, epiweeks, issues = NULL, lag = NULL) an instance of epidata_call } \description{ -fetch Paho Dengue +API docs: https://cmu-delphi.github.io/delphi-epidata/api/paho_dengue.html +} +\examples{ +call <- paho_dengue(regions = "ca", epiweeks = epirange(201201, 202001)) +fetch_classic(call) } diff --git a/man/pvt_afhsb.Rd b/man/pvt_afhsb.Rd index e47cefca..76c76067 100644 --- a/man/pvt_afhsb.Rd +++ b/man/pvt_afhsb.Rd @@ -7,17 +7,21 @@ pvt_afhsb(auth, locations, epiweeks, flu_types) } \arguments{ -\item{auth}{authenfication token} +\item{auth}{character authentication token} -\item{locations}{locations to fetch} +\item{locations}{character locations to fetch} -\item{epiweeks}{epiweeks to fetch} +\item{epiweeks}{epirange epiweeks to fetch} -\item{flu_types}{flu_types to fetch} +\item{flu_types}{character flu_types to fetch} } \value{ an instance of epidata_call } \description{ -fetch AFHSB data (point data, no min/max) +API docs: https://cmu-delphi.github.io/delphi-epidata/api/afhsb.html +} +\examples{ +call <- pvt_afhsb(auth = "yourkey", "fl,ca", epirange(202001, 202110), "flu1,flu2-flu1") +# fetch_csv(call) } diff --git a/man/pvt_cdc.Rd b/man/pvt_cdc.Rd index 7448c5bf..653edade 100644 --- a/man/pvt_cdc.Rd +++ b/man/pvt_cdc.Rd @@ -7,15 +7,19 @@ pvt_cdc(auth, epiweeks, locations) } \arguments{ -\item{auth}{authenfication token} +\item{auth}{character authentication token} -\item{epiweeks}{epiweeks to fetch} +\item{epiweeks}{epirange epiweeks to fetch} -\item{locations}{locations to fetch} +\item{locations}{character locations to fetch} } \value{ an instance of epidata_call } \description{ -fetch CDC page hits +API docs: https://cmu-delphi.github.io/delphi-epidata/api/cdc.html +} +\examples{ +call <- pvt_cdc(auth = "yourkey", epirange(20210101, 20210201), "fl,ca") +# fetch_csv(call) } diff --git a/man/pvt_dengue_sensors.Rd b/man/pvt_dengue_sensors.Rd index 56743a31..dac8a4c7 100644 --- a/man/pvt_dengue_sensors.Rd +++ b/man/pvt_dengue_sensors.Rd @@ -19,5 +19,12 @@ pvt_dengue_sensors(auth, names, locations, epiweeks) an instance of epidata_call } \description{ -fetch Delphi's digital surveillance sensors +API docs: https://cmu-delphi.github.io/delphi-epidata/api/dengue_sensors.html +} +\details{ +TODO: what are valid locations and names? +} +\examples{ +call <- pvt_dengue_sensors(auth = "yourkey", names = "?", locations = "?", epiweeks = epirange(201501, 202001)) +# fetch_classic(call) } diff --git a/man/pvt_ght.Rd b/man/pvt_ght.Rd index c077a3e9..dd06355d 100644 --- a/man/pvt_ght.Rd +++ b/man/pvt_ght.Rd @@ -19,5 +19,12 @@ pvt_ght(auth, locations, epiweeks, query) an instance of epidata_call } \description{ -fetch Google Health Trends data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/ght.html +} +\details{ +TODO: find a non-trivial query +} +\examples{ +call <- pvt_ght(auth = "yourkey", locations = "ca", epiweeks = epirange(201201, 202001), query = "?") +# fetch_classic(call) } diff --git a/man/pvt_meta_afhsb.Rd b/man/pvt_meta_afhsb.Rd index 680d676a..dc673346 100644 --- a/man/pvt_meta_afhsb.Rd +++ b/man/pvt_meta_afhsb.Rd @@ -13,5 +13,5 @@ pvt_meta_afhsb(auth) an instance of epidata_call } \description{ -fetch AFHSB meta data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/meta_afhsb.html } diff --git a/man/pvt_meta_norostat.Rd b/man/pvt_meta_norostat.Rd index dd328d17..9176ff3c 100644 --- a/man/pvt_meta_norostat.Rd +++ b/man/pvt_meta_norostat.Rd @@ -13,5 +13,5 @@ pvt_meta_norostat(auth) an instance of epidata_call } \description{ -fetch NoroSTAT meta data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/meta_norostat.html } diff --git a/man/pvt_norostat.Rd b/man/pvt_norostat.Rd index 5b17b689..f6e03aa1 100644 --- a/man/pvt_norostat.Rd +++ b/man/pvt_norostat.Rd @@ -17,5 +17,13 @@ pvt_norostat(auth, location, epiweeks) an instance of epidata_call } \description{ -fetch NoroSTAT data (point data, no min/max) +API docs: https://cmu-delphi.github.io/delphi-epidata/api/norostat.html +} +\examples{ +call <- pvt_norostat( + auth = "yourkey", + location = "Minnesota, Ohio, Oregon, Tennessee, and Wisconsin", + epiweeks = epirange(201201, 202001) +) +# fetch_classic(call) } diff --git a/man/pvt_quidel.Rd b/man/pvt_quidel.Rd index e56fcfe9..393f2b8d 100644 --- a/man/pvt_quidel.Rd +++ b/man/pvt_quidel.Rd @@ -17,5 +17,9 @@ pvt_quidel(auth, epiweeks, locations) an instance of epidata_call } \description{ -fetch Quidel data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/quidel.html +} +\examples{ +call <- pvt_quidel(auth = "yourkey", epiweeks = epirange(201201, 202001), locations = "hhs1") +# fetch_classic(call) } diff --git a/man/pvt_sensors.Rd b/man/pvt_sensors.Rd index e9395197..fcc28c2c 100644 --- a/man/pvt_sensors.Rd +++ b/man/pvt_sensors.Rd @@ -19,5 +19,9 @@ pvt_sensors(auth, names, locations, epiweeks) an instance of epidata_call } \description{ -fetch Delphi's digital surveillance sensors +API docs: https://cmu-delphi.github.io/delphi-epidata/api/sensors.html +} +\examples{ +call <- pvt_sensors(auth = "yourkey", names = "sar3", locations = "nat", epiweeks = epirange(201501, 202001)) +# fetch_classic(call) } diff --git a/man/pvt_twitter.Rd b/man/pvt_twitter.Rd index 24cf71ee..e437fd32 100644 --- a/man/pvt_twitter.Rd +++ b/man/pvt_twitter.Rd @@ -19,5 +19,9 @@ pvt_twitter(auth, locations, dates = NULL, epiweeks = NULL) an instance of epidata_call } \description{ -fetch HealthTweets data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/twitter.html +} +\examples{ +call <- pvt_twitter(auth = "yourkey", locations = "CA", epiweeks = epirange(201501, 202001)) +# fetch_csv(call) } diff --git a/man/wiki.Rd b/man/wiki.Rd index f8c00b18..2b73ffc5 100644 --- a/man/wiki.Rd +++ b/man/wiki.Rd @@ -21,5 +21,9 @@ wiki(articles, dates = NULL, epiweeks = NULL, hours = NULL, language = "en") an instance of epidata_call } \description{ -fetch Wikipedia access data +API docs: https://cmu-delphi.github.io/delphi-epidata/api/wiki.html +} +\examples{ +call <- wiki(articles = "avian_influenza", epiweeks = epirange(201501, 202001)) +fetch_csv(call) } From adac5057a6fb0514282d7d974ba01221edb39739 Mon Sep 17 00:00:00 2001 From: "Logan C. Brooks" Date: Tue, 25 Oct 2022 11:41:59 -0700 Subject: [PATCH 3/5] Don't test some long-running examples pending backend resolutions --- R/endpoints.R | 4 ++++ man/covid_hosp_facility_lookup.Rd | 2 ++ man/fluview_clinical.Rd | 2 ++ 3 files changed, 8 insertions(+) diff --git a/R/endpoints.R b/R/endpoints.R index 4949da43..f81d34ce 100644 --- a/R/endpoints.R +++ b/R/endpoints.R @@ -82,8 +82,10 @@ pvt_cdc <- function(auth, epiweeks, locations) { #' API docs: https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp_facility_lookup.html #' #' @examples +#' \donttest{ # can take a few minutes; donttesting while backend performance is being improved #' call <- covid_hosp_facility_lookup(state = "fl") #' fetch_csv(call) +#' } #' @param state optional character state #' @param ccn optional character ccn #' @param city optional character city @@ -960,8 +962,10 @@ flusurv <- function(locations, #' API docs: https://cmu-delphi.github.io/delphi-epidata/api/fluview_clinical.html #' #' @examples +#' \donttest{ # can take a couple minutes; donttesting while cmu-delphi/delphi-epidata#48 is unresolved #' call <- fluview_clinical(regions = "nat", epiweeks = epirange(201201, 202001)) #' fetch_classic(call) +#' } #' @param regions regions to fetch #' @param epiweeks epiweeks to fetch #' @param issues optionally specify the exact issues to fetch diff --git a/man/covid_hosp_facility_lookup.Rd b/man/covid_hosp_facility_lookup.Rd index 665949d6..44053201 100644 --- a/man/covid_hosp_facility_lookup.Rd +++ b/man/covid_hosp_facility_lookup.Rd @@ -30,6 +30,8 @@ an instance of epidata_call API docs: https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp_facility_lookup.html } \examples{ +\donttest{ # can take a few minutes; donttesting while backend performance is being improved call <- covid_hosp_facility_lookup(state = "fl") fetch_csv(call) } +} diff --git a/man/fluview_clinical.Rd b/man/fluview_clinical.Rd index a2b99091..8f49b955 100644 --- a/man/fluview_clinical.Rd +++ b/man/fluview_clinical.Rd @@ -22,6 +22,8 @@ an instance of epidata_call API docs: https://cmu-delphi.github.io/delphi-epidata/api/fluview_clinical.html } \examples{ +\donttest{ # can take a couple minutes; donttesting while cmu-delphi/delphi-epidata#48 is unresolved call <- fluview_clinical(regions = "nat", epiweeks = epirange(201201, 202001)) fetch_classic(call) } +} From 7503c38a2ffcc307ad3291a56be7cd50e2c20134 Mon Sep 17 00:00:00 2001 From: "Logan C. Brooks" Date: Tue, 25 Oct 2022 11:50:46 -0700 Subject: [PATCH 4/5] Re-`style_pkg()` --- R/endpoints.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/endpoints.R b/R/endpoints.R index f81d34ce..465b1480 100644 --- a/R/endpoints.R +++ b/R/endpoints.R @@ -82,7 +82,8 @@ pvt_cdc <- function(auth, epiweeks, locations) { #' API docs: https://cmu-delphi.github.io/delphi-epidata/api/covid_hosp_facility_lookup.html #' #' @examples -#' \donttest{ # can take a few minutes; donttesting while backend performance is being improved +#' \donttest{ +#' # can take a few minutes; donttesting while backend performance is being improved #' call <- covid_hosp_facility_lookup(state = "fl") #' fetch_csv(call) #' } @@ -962,7 +963,8 @@ flusurv <- function(locations, #' API docs: https://cmu-delphi.github.io/delphi-epidata/api/fluview_clinical.html #' #' @examples -#' \donttest{ # can take a couple minutes; donttesting while cmu-delphi/delphi-epidata#48 is unresolved +#' \donttest{ +#' # can take a couple minutes; donttesting while cmu-delphi/delphi-epidata#48 is unresolved #' call <- fluview_clinical(regions = "nat", epiweeks = epirange(201201, 202001)) #' fetch_classic(call) #' } From fc76084870a3f8231af8b249318c59e0028f5172 Mon Sep 17 00:00:00 2001 From: "Logan C. Brooks" Date: Tue, 25 Oct 2022 12:12:55 -0700 Subject: [PATCH 5/5] Re-`style_pkg()` with newer `styler` --- vignettes/covidcast.Rmd | 4 ++-- vignettes/delphi-epidata.Rmd | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vignettes/covidcast.Rmd b/vignettes/covidcast.Rmd index 23160de7..f0453966 100644 --- a/vignettes/covidcast.Rmd +++ b/vignettes/covidcast.Rmd @@ -18,8 +18,8 @@ knitr::opts_chunk$set(echo = TRUE) ```{r libraries} # devtools::install_url("https://github.com/cmu-delphi/delphi-epidata-r/releases/latest/download/delphi-epidata.tar.gz") # install.packages('delphi.epidata') -library('delphi.epidata') -library('magrittr') +library("delphi.epidata") +library("magrittr") ``` diff --git a/vignettes/delphi-epidata.Rmd b/vignettes/delphi-epidata.Rmd index 97417c1f..86ef2dfe 100644 --- a/vignettes/delphi-epidata.Rmd +++ b/vignettes/delphi-epidata.Rmd @@ -18,8 +18,8 @@ knitr::opts_chunk$set(echo = TRUE) ```{r libraries} # devtools::install_url("https://github.com/cmu-delphi/delphi-epidata-r/releases/latest/download/delphi-epidata.tar.gz") # install.packages('delphi.epidata') -library('delphi.epidata') -library('magrittr') +library("delphi.epidata") +library("magrittr") ```