Skip to content

Commit

Permalink
feat+test+docs+build: fetch by default
Browse files Browse the repository at this point in the history
  • Loading branch information
dshemetov committed Aug 26, 2023
1 parent 3db0081 commit 65a3736
Show file tree
Hide file tree
Showing 44 changed files with 775 additions and 384 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ env
/doc/
/Meta/
.secrets
epidatr.Rproj
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export(dengue_nowcast)
export(ecdc_ili)
export(epirange)
export(fetch)
export(fetch_args_list)
export(flusurv)
export(fluview)
export(fluview_clinical)
Expand All @@ -38,11 +39,12 @@ export(pvt_quidel)
export(pvt_sensors)
export(pvt_twitter)
export(wiki)
export(with_base_url)
importFrom(MMWRweek,MMWRweek2Date)
importFrom(checkmate,assert)
importFrom(checkmate,assert_character)
importFrom(checkmate,assert_integerish)
importFrom(checkmate,assert_logical)
importFrom(checkmate,assert_numeric)
importFrom(checkmate,check_character)
importFrom(checkmate,check_class)
importFrom(checkmate,check_date)
Expand Down
27 changes: 19 additions & 8 deletions R/covidcast.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ parse_signal <- function(signal, base_url) {
#'
#' @param data_source data source to fetch
#' @param signals data source to fetch
#' @param time_type data source to fetch
#' @param time_values data source to fetch
#' @param geo_type geo_type to fetch
#' @param time_type data source to fetch
#' @param geo_values data source to fetch
#' @param time_values data source to fetch
#' @param as_of data source to fetch
#' @param issues data source to fetch
#' @param lag data source to fetch
Expand All @@ -18,13 +18,24 @@ parse_signal <- function(signal, base_url) {
signal$call <- function(geo_type,
geo_values,
time_values,
...) {
epicall <- covidcast(
signal$source, signal$signal, geo_type, signal$time_type,
geo_values, time_values, ...
as_of = NULL,
issues = NULL,
lag = NULL,
fetch_args = fetch_args_list()) {
stopifnot(is.character(geo_type) & length(geo_type) == 1)

covidcast(
source = signal$source,
signals = signal$signal,
geo_type = geo_type,
time_type = signal$time_type,
geo_values = geo_values,
time_values = time_values,
as_of = as_of,
issues = issues,
lag = lag,
fetch_args = fetch_args
)
epicall$base_url <- base_url
epicall
}
r <- list()
r[[signal$signal]] <- signal
Expand Down
Loading

0 comments on commit 65a3736

Please sign in to comment.