Skip to content

Commit 72306ff

Browse files
committed
docs+fix: make_call->dry_run, fixed pkgdown name
1 parent aab10f1 commit 72306ff

File tree

7 files changed

+46
-46
lines changed

7 files changed

+46
-46
lines changed

R/epidatacall.R

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#' geo_type = "state",
2828
#' time_values = epirange(20200601, 20200801),
2929
#' geo_values = c("ca", "fl"),
30-
#' fetch_args = fetch_args_list(make_call = FALSE)
30+
#' fetch_args = fetch_args_list(dry_run = TRUE)
3131
#' )
3232
#' call %>% fetch()
3333
#' }
@@ -123,7 +123,7 @@ print.epidata_call <- function(x, ...) {
123123
#' `FALSE`
124124
#' @param base_url base URL to use; by default `NULL`, which means the global base url
125125
#' `"https://api.delphi.cmu.edu/epidata/"`
126-
#' @param make_call boolean that allows skipping the call to the API and instead
126+
#' @param dry_run boolean that allows skipping the call to the API and instead
127127
#' returns the `epidata_call` object (useful for debugging); by default `TRUE`
128128
#' @param debug boolean that allows returning the raw response from the API; by default
129129
#' `FALSE`
@@ -143,7 +143,7 @@ fetch_args_list <- function(
143143
return_empty = FALSE,
144144
timeout_seconds = 30,
145145
base_url = NULL,
146-
make_call = TRUE,
146+
dry_run = FALSE,
147147
debug = FALSE,
148148
format_type = "json") {
149149
assert_character(fields, null.ok = TRUE, len = NULL, any.missing = FALSE)
@@ -152,7 +152,7 @@ fetch_args_list <- function(
152152
assert_logical(return_empty, null.ok = TRUE, len = 1L, any.missing = FALSE)
153153
assert_numeric(timeout_seconds, null.ok = TRUE, len = 1L, any.missing = FALSE)
154154
assert_character(base_url, null.ok = TRUE, len = 1L, any.missing = FALSE)
155-
assert_logical(make_call, null.ok = TRUE, len = 1L, any.missing = FALSE)
155+
assert_logical(dry_run, null.ok = FALSE, len = 1L, any.missing = TRUE)
156156
assert_logical(debug, null.ok = TRUE, len = 1L, any.missing = FALSE)
157157
assert_character(format_type, null.ok = TRUE, len = 1L, any.missing = FALSE)
158158
assert(format_type %in% c("json", "csv", "classic"), "format_type must be one of json, csv, classic")
@@ -165,7 +165,7 @@ fetch_args_list <- function(
165165
return_empty = return_empty,
166166
timeout_seconds = timeout_seconds,
167167
base_url = base_url,
168-
make_call = make_call,
168+
dry_run = dry_run,
169169
debug = debug,
170170
format_type = format_type
171171
),
@@ -194,7 +194,7 @@ fetch <- function(epidata_call, fetch_args = fetch_args_list()) {
194194
epidata_call <- with_base_url(epidata_call, fetch_args$base_url)
195195
}
196196

197-
if (!fetch_args$make_call) {
197+
if (!fetch_args$dry_run) {
198198
return(epidata_call)
199199
}
200200

_pkgdown.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ reference:
1818
desc: Query Delphi Epidata endpoints
1919
- contents:
2020
- epidata_call
21-
- fetch_args_list
21+
- fetch_args
2222
- covid_hosp_facility
2323
- covid_hosp_facility_lookup
2424
- covid_hosp_state_timeseries

man/epidata_call.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-covidcast.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test_that("covidcast", {
55
"nation",
66
"us",
77
epirange(20210405, 20210410),
8-
fetch_args = fetch_args_list(make_call = FALSE)
8+
fetch_args = fetch_args_list(dry_run = TRUE)
99
),
1010
covidcast(
1111
"fb-survey",
@@ -14,7 +14,7 @@ test_that("covidcast", {
1414
"day",
1515
"us",
1616
epirange(20210405, 20210410),
17-
fetch_args = fetch_args_list(make_call = FALSE)
17+
fetch_args = fetch_args_list(dry_run = TRUE)
1818
)
1919
)
2020
})

tests/testthat/test-endpoints.R

+28-28
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ test_that("basic_epidata_call", {
33
auth = "yourkey",
44
"fl,ca",
55
epirange(201501, 201601),
6-
fetch_args = fetch_args_list(make_call = FALSE)
6+
fetch_args = fetch_args_list(dry_run = TRUE)
77
) %>% request_url())
88
expect_no_error(covid_hosp_facility_lookup(
99
state = "fl",
10-
fetch_args = fetch_args_list(make_call = FALSE)
10+
fetch_args = fetch_args_list(dry_run = TRUE)
1111
) %>% request_url())
1212
expect_no_error(covid_hosp_facility(
1313
hospital_pks = "100075",
1414
collection_weeks = epirange(20200101, 20200501),
15-
fetch_args = fetch_args_list(make_call = FALSE)
15+
fetch_args = fetch_args_list(dry_run = TRUE)
1616
) %>% request_url())
1717
expect_no_error(covid_hosp_state_timeseries(
1818
states = "fl",
1919
dates = epirange(20200101, 20200501),
20-
fetch_args = fetch_args_list(make_call = FALSE)
20+
fetch_args = fetch_args_list(dry_run = TRUE)
2121
) %>% request_url())
2222
expect_no_error(covidcast_meta(
23-
fetch_args = fetch_args_list(make_call = FALSE)
23+
fetch_args = fetch_args_list(dry_run = TRUE)
2424
) %>% request_url())
2525
expect_no_error(covidcast(
2626
source = "jhu-csse",
@@ -29,120 +29,120 @@ test_that("basic_epidata_call", {
2929
geo_type = "state",
3030
time_values = epirange(20200601, 20200801),
3131
geo_values = "ca,fl",
32-
fetch_args = fetch_args_list(make_call = FALSE)
32+
fetch_args = fetch_args_list(dry_run = TRUE)
3333
) %>% request_url())
3434
expect_no_error(delphi(
3535
system = "ec",
3636
epiweek = 202006,
37-
fetch_args = fetch_args_list(make_call = FALSE)
37+
fetch_args = fetch_args_list(dry_run = TRUE)
3838
) %>% request_url())
3939
expect_no_error(dengue_nowcast(
4040
locations = "?",
4141
epiweeks = epirange(201501, 202001),
42-
fetch_args = fetch_args_list(make_call = FALSE)
42+
fetch_args = fetch_args_list(dry_run = TRUE)
4343
) %>% request_url())
4444
expect_no_error(pvt_dengue_sensors(
4545
auth = "yourkey",
4646
names = "?",
4747
locations = "?",
4848
epiweeks = epirange(201501, 202001),
49-
fetch_args = fetch_args_list(make_call = FALSE)
49+
fetch_args = fetch_args_list(dry_run = TRUE)
5050
) %>% request_url())
5151
expect_no_error(ecdc_ili(
5252
regions = "austria",
5353
epiweeks = epirange(201201, 202001),
54-
fetch_args = fetch_args_list(make_call = FALSE)
54+
fetch_args = fetch_args_list(dry_run = TRUE)
5555
) %>% request_url())
5656
expect_no_error(flusurv(
5757
locations = "CA",
5858
epiweeks = epirange(201201, 202001),
59-
fetch_args = fetch_args_list(make_call = FALSE)
59+
fetch_args = fetch_args_list(dry_run = TRUE)
6060
) %>% request_url())
6161
expect_no_error(fluview_clinical(
6262
regions = "nat",
6363
epiweeks = epirange(201601, 201701),
64-
fetch_args = fetch_args_list(make_call = FALSE)
64+
fetch_args = fetch_args_list(dry_run = TRUE)
6565
) %>% request_url())
6666
expect_no_error(fluview_meta(
67-
fetch_args = fetch_args_list(make_call = FALSE)
67+
fetch_args = fetch_args_list(dry_run = TRUE)
6868
) %>% request_url())
6969
expect_no_error(fluview(
7070
regions = "nat",
7171
epiweeks = epirange(201601, 201701),
72-
fetch_args = fetch_args_list(make_call = FALSE)
72+
fetch_args = fetch_args_list(dry_run = TRUE)
7373
) %>% request_url())
7474
expect_no_error(gft(
7575
locations = "hhs1",
7676
epiweeks = epirange(201201, 202001),
77-
fetch_args = fetch_args_list(make_call = FALSE)
77+
fetch_args = fetch_args_list(dry_run = TRUE)
7878
) %>% request_url())
7979
expect_no_error(pvt_ght(
8080
auth = "yourkey",
8181
locations = "ca",
8282
epiweeks = epirange(201201, 202001),
8383
query = "?",
84-
fetch_args = fetch_args_list(make_call = FALSE)
84+
fetch_args = fetch_args_list(dry_run = TRUE)
8585
) %>% request_url())
8686
expect_no_error(kcdc_ili(
8787
regions = "?",
8888
epiweeks = epirange(201201, 202001),
89-
fetch_args = fetch_args_list(make_call = FALSE)
89+
fetch_args = fetch_args_list(dry_run = TRUE)
9090
) %>% request_url())
9191
expect_no_error(pvt_meta_norostat(
9292
auth = "yourkey",
93-
fetch_args = fetch_args_list(make_call = FALSE)
93+
fetch_args = fetch_args_list(dry_run = TRUE)
9494
) %>% request_url())
9595
expect_no_error(meta(
96-
fetch_args = fetch_args_list(make_call = FALSE)
96+
fetch_args = fetch_args_list(dry_run = TRUE)
9797
) %>% request_url())
9898
expect_no_error(nidss_dengue(
9999
locations = "taipei",
100100
epiweeks = epirange(201201, 202001),
101-
fetch_args = fetch_args_list(make_call = FALSE)
101+
fetch_args = fetch_args_list(dry_run = TRUE)
102102
) %>% request_url())
103103
expect_no_error(nidss_flu(
104104
regions = "taipei",
105105
epiweeks = epirange(201201, 202001),
106-
fetch_args = fetch_args_list(make_call = FALSE)
106+
fetch_args = fetch_args_list(dry_run = TRUE)
107107
) %>% request_url())
108108
expect_no_error(pvt_norostat(
109109
auth = "yourkey",
110110
locations = "Minnesota, Ohio, Oregon, Tennessee, and Wisconsin",
111111
epiweeks = epirange(201201, 202001),
112-
fetch_args = fetch_args_list(make_call = FALSE)
112+
fetch_args = fetch_args_list(dry_run = TRUE)
113113
) %>% request_url())
114114
expect_no_error(nowcast(
115115
locations = "ca",
116116
epiweeks = epirange(201201, 202001),
117-
fetch_args = fetch_args_list(make_call = FALSE)
117+
fetch_args = fetch_args_list(dry_run = TRUE)
118118
) %>% request_url())
119119
expect_no_error(paho_dengue(
120120
regions = "ca",
121121
epiweeks = epirange(201201, 202001),
122-
fetch_args = fetch_args_list(make_call = FALSE)
122+
fetch_args = fetch_args_list(dry_run = TRUE)
123123
) %>% request_url())
124124
expect_no_error(pvt_quidel(
125125
auth = "yourkey",
126126
locations = "hhs1",
127127
epiweeks = epirange(201201, 202001),
128-
fetch_args = fetch_args_list(make_call = FALSE)
128+
fetch_args = fetch_args_list(dry_run = TRUE)
129129
) %>% request_url())
130130
expect_no_error(pvt_sensors(
131131
auth = "yourkey",
132132
names = "sar3",
133133
locations = "nat",
134134
epiweeks = epirange(201501, 202001),
135-
fetch_args = fetch_args_list(make_call = FALSE)
135+
fetch_args = fetch_args_list(dry_run = TRUE)
136136
) %>% request_url())
137137
expect_no_error(pvt_twitter(
138138
auth = "yourkey",
139139
locations = "CA",
140140
epiweeks = epirange(201501, 202001),
141-
fetch_args = fetch_args_list(make_call = FALSE)
141+
fetch_args = fetch_args_list(dry_run = TRUE)
142142
) %>% request_url())
143143
expect_no_error(wiki(
144144
articles = "avian_influenza",
145145
epiweeks = epirange(201501, 202001),
146-
fetch_args = fetch_args_list(make_call = FALSE)
146+
fetch_args = fetch_args_list(dry_run = TRUE)
147147
) %>% request_url())
148148
})

tests/testthat/test-epidatacall.R

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_that("request_impl http errors", {
44
auth = "ImALittleTeapot",
55
epiweeks = epirange(202003, 202304),
66
locations = "ma",
7-
fetch_args = fetch_args_list(make_call = FALSE)
7+
fetch_args = fetch_args_list(dry_run = TRUE)
88
)
99
local_mocked_bindings(
1010
# generated via
@@ -39,7 +39,7 @@ test_that("fetch_args", {
3939
return_empty = FALSE,
4040
timeout_seconds = 30,
4141
base_url = NULL,
42-
make_call = TRUE,
42+
dry_run = FALSE,
4343
debug = FALSE,
4444
format_type = "json"
4545
),
@@ -54,7 +54,7 @@ test_that("fetch_args", {
5454
return_empty = TRUE,
5555
timeout_seconds = 10,
5656
base_url = "https://example.com",
57-
make_call = FALSE,
57+
dry_run = TRUE,
5858
debug = TRUE,
5959
format_type = "classic"
6060
),
@@ -66,7 +66,7 @@ test_that("fetch_args", {
6666
return_empty = TRUE,
6767
timeout_seconds = 10,
6868
base_url = "https://example.com",
69-
make_call = FALSE,
69+
dry_run = TRUE,
7070
debug = TRUE,
7171
format_type = "classic"
7272
),
@@ -83,7 +83,7 @@ test_that("fetch and fetch_tbl", {
8383
geo_type = "state",
8484
time_values = epirange("2020-06-01", "2020-08-01"),
8585
geo_values = "ca,fl",
86-
fetch_args = fetch_args_list(make_call = FALSE)
86+
fetch_args = fetch_args_list(dry_run = TRUE)
8787
)
8888
local_mocked_bindings(
8989
request_impl = function(...) NULL,
@@ -123,7 +123,7 @@ test_that("fetch_tbl warns on non-success", {
123123
geo_type = "state",
124124
time_values = epirange("2020-06-01", "2020-08-01"),
125125
geo_values = "ca,fl",
126-
fetch_args = fetch_args_list(make_call = FALSE)
126+
fetch_args = fetch_args_list(dry_run = TRUE)
127127
)
128128

129129
local_mocked_bindings(
@@ -155,7 +155,7 @@ test_that("classic only fetch", {
155155
epidata_call <- delphi(
156156
system = "ec",
157157
epiweek = 201501,
158-
fetch_args = fetch_args_list(make_call = FALSE)
158+
fetch_args = fetch_args_list(dry_run = TRUE)
159159
)
160160
local_mocked_bindings(
161161
# generated using

tests/testthat/test-model.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ test_that("null parsing", {
5252
epidata_call <- flusurv(
5353
locations = "ca",
5454
epiweeks = 202001,
55-
fetch_args = fetch_args_list(make_call = FALSE)
55+
fetch_args = fetch_args_list(dry_run = TRUE)
5656
)
5757
# mocked data generated with
5858
# epidata_call %>%

0 commit comments

Comments
 (0)