Skip to content

Commit 8f61786

Browse files
committed
Merge remote-tracking branch 'origin/ar/release-fixes' into djm/pkgdown-updates
2 parents 9688954 + 0adb796 commit 8f61786

21 files changed

+107
-110
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
^env$
2222
^.env$
2323
^README\.Rmd$
24+
^CRAN-SUBMISSION$

CRAN-SUBMISSION

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Version: 1.0.0
2+
Date: 2023-09-12 08:00:50 UTC
3+
SHA: 52436eb250eab1f9c70b250bf4ca1ab25cc48316

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Package: epidatr
22
Type: Package
33
Title: Client for Delphi's 'Epidata' API
44
Version: 1.0.0
5+
Date: 2023-09-11
56
Authors@R:
67
c(
78
person("Logan", "Brooks", email = "[email protected]", role = c("aut")),
@@ -15,9 +16,9 @@ Authors@R:
1516
person("George", "Haff", role = c("ctb")),
1617
person("Kathryn", "Mazaitis", role = c("ctb"))
1718
)
18-
URL: https://cmu-delphi.github.io/epidatr/, https://github.com/cmu-delphi/epidatr
19+
URL: https://cmu-delphi.github.io/epidatr/, https://cmu-delphi.github.io/delphi-epidata/, https://github.com/cmu-delphi/epidatr
1920
BugReports: https://github.com/cmu-delphi/epidatr/issues
20-
Description: The Delphi 'Epidata' API provides real-time access to epidemiological surveillance data for influenza, COVID-19, and other diseases for the USA at various geographical resolutions, both from official government sources such as the Center for Disease Control (CDC) and Google Trends and private partners such as Facebook and Change Healthcare. It is built and maintained by the Carnegie Mellon University Delphi research group.
21+
Description: The Delphi 'Epidata' API provides real-time access to epidemiological surveillance data for influenza, 'COVID-19', and other diseases for the USA at various geographical resolutions, both from official government sources such as the Center for Disease Control (CDC) and Google Trends and private partners such as Facebook and Change 'Healthcare'. It is built and maintained by the Carnegie Mellon University Delphi research group. To cite this API: David C. Farrow, Logan C. Brooks, Aaron 'Rumack', Ryan J. 'Tibshirani', 'Roni' 'Rosenfeld' (2015). Delphi 'Epidata' API. <https://github.com/cmu-delphi/delphi-epidata>.
2122
Depends: R (>= 3.5.0)
2223
License: MIT + file LICENSE
2324
Encoding: UTF-8

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ S3method(print,covidcast_data_signal_list)
77
S3method(print,covidcast_data_source)
88
S3method(print,covidcast_epidata)
99
S3method(print,epidata_call)
10-
export("%>%")
1110
export(avail_endpoints)
1211
export(cache_info)
1312
export(clear_cache)

R/cache.R

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,12 @@ cache_environ$epidatr_cache <- NULL
6868
#' encoding of the call url. Each file corresponds to a unique epidata-API
6969
#' call.
7070
#' @examples
71-
#' \dontrun{
7271
#' set_cache(
73-
#' dir = "some/subdir",
72+
#' cache_dir = tempdir(),
7473
#' days = 14,
7574
#' max_size = 512,
76-
#' logfile = "some/subdir/logs.txt"
75+
#' logfile = "logs.txt"
7776
#' )
78-
#' }
7977
#'
8078
#' @param cache_dir the directory in which the cache is stored. By default, this
8179
#' is `tools::R_user_dir()` if on R 4.0+, but must be specified for earlier
@@ -92,6 +90,8 @@ cache_environ$epidatr_cache <- NULL
9290
#' variable is `EPIDATR_CACHE_LOGFILE`.
9391
#' @param confirm whether to confirm directory creation. default is `TRUE`;
9492
#' should only be set in non-interactive scripts
93+
#' @return [`NULL`] no return value, all effects are stored in the package
94+
#' environment
9595
#' @seealso [`clear_cache`] to delete the old cache while making a new one,
9696
#' [`disable_cache`] to disable without deleting, and [`cache_info`]
9797
#' @export
@@ -176,28 +176,23 @@ set_cache <- function(cache_dir = NULL,
176176
#' are using a session unique cache, you will have to pass the arguments you
177177
#' used for `set_cache` earlier, otherwise the system-wide `.Renviron`-based
178178
#' defaults will be used.
179-
#' @examples
180-
#' \dontrun{
181-
#' clear_cache(
182-
#' dir = "some/subdir",
183-
#' days = 14,
184-
#' max_size = 512,
185-
#' logfile = "some/subdir/logs.txt",
186-
#' )
187-
#' }
188179
#' @param disable instead of setting a new cache, disable caching entirely;
189180
#' defaults to `FALSE`
190181
#' @inheritDotParams set_cache
182+
#' @return [`NULL`] no return value, all effects are stored in the package
183+
#' environment
191184
#' @seealso [`set_cache`] to start a new cache (and general caching info),
192185
#' [`disable_cache`] to only disable without deleting, and [`cache_info`]
193186
#' @export
194187
#' @import cachem
195188
clear_cache <- function(disable = FALSE, ...) {
196-
cache_environ$epidatr_cache$destroy()
197-
if (!disable) {
198-
set_cache(...)
199-
} else {
189+
if (any(!is.na(cache_environ$epidatr_cache))) {
190+
cache_environ$epidatr_cache$destroy()
191+
}
192+
if (disable) {
200193
cache_environ$epidatr_cache <- NULL
194+
} else {
195+
set_cache(...)
201196
}
202197
}
203198

@@ -207,6 +202,8 @@ clear_cache <- function(disable = FALSE, ...) {
207202
#' the cache are untouched. If you are looking to disable the caching more
208203
#' permanently, set `EPIDATR_USE_CACHE=FALSE` as environmental variable in
209204
#' your `.Renviron`.
205+
#' @return [`NULL`] no return value, all effects are stored in the package
206+
#' environment
210207
#' @export
211208
#' @seealso [`set_cache`] to start a new cache (and general caching info),
212209
#' [`clear_cache`] to delete the cache and set a new one, and [`cache_info`]
@@ -220,6 +217,7 @@ disable_cache <- function() {
220217
#' @description
221218
#' Print out the information about the cache (as would be returned by cachem's
222219
#' `info()` method).
220+
#' @return [`list`] containing the info result as created by cachem
223221
#'
224222
#' @seealso [`set_cache`] to start a new cache (and general caching info),
225223
#' [`clear_cache`] to delete the cache and set a new one, and [`disable_cache`] to
@@ -239,7 +237,7 @@ cache_info <- function() {
239237
#' The guts of caching, its interposed between fetch and the specific fetch
240238
#' methods. Internal method only.
241239
#'
242-
#' @param call the `epidata_call` object
240+
#' @param epidata_call the `epidata_call` object
243241
#' @param fetch_args the args list for fetch as generated by [`fetch_args_list()`]
244242
#' @keywords internal
245243
#' @importFrom openssl md5

R/covidcast.R

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1+
#' turn a signal into a callable
2+
#' @param signal the signal of interest
3+
#' @param base_url the base url
4+
#' @keywords internal
15
parse_signal <- function(signal, base_url) {
26
class(signal) <- c("covidcast_data_signal", class(signal))
37
signal$key <- paste(signal$source, signal$signal, sep = ":")
48

59
#' fetch covidcast data
610
#'
7-
#' @param data_source data source to fetch
8-
#' @param signals data source to fetch
9-
#' @param geo_type geo_type to fetch
10-
#' @param time_type data source to fetch
11-
#' @param geo_values data source to fetch
12-
#' @param time_values data source to fetch
13-
#' @param as_of data source to fetch
14-
#' @param issues data source to fetch
15-
#' @param lag data source to fetch
16-
#' @return an instance of epidata_call
17-
#' @keywords internal
11+
#' param data_source data source to fetch
12+
#' param signals data source to fetch
13+
#' param geo_type geo_type to fetch
14+
#' param time_type data source to fetch
15+
#' param geo_values data source to fetch
16+
#' param time_values data source to fetch
17+
#' param as_of data source to fetch
18+
#' param issues data source to fetch
19+
#' param lag data source to fetch
20+
#' return an instance of epidata_call
21+
#' keywords internal
1822
signal$call <- function(geo_type,
1923
geo_values,
2024
time_values,

R/endpoints.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ pub_covidcast_meta <- function(fetch_args = fetch_args_list()) {
658658
#' signals = "confirmed_7dav_incidence_prop",
659659
#' geo_type = "state",
660660
#' time_type = "day",
661-
#' geo_values = "ca,fl",
661+
#' geo_values = c("ca", "fl"),
662662
#' time_values = epirange(20200601, 20200801)
663663
#' )
664664
#' pub_covidcast(
@@ -1102,11 +1102,13 @@ pub_fluview_meta <- function(fetch_args = fetch_args_list()) {
11021102
#' more information on ILINet, see
11031103
#' <https://gis.cdc.gov/grasp/fluview/fluportaldashboard.html>.
11041104
#'
1105-
#' @details The full list of location inputs can be accsssed at
1105+
#' @details The full list of location inputs can be accessed at
11061106
#' <https://github.com/cmu-delphi/delphi-epidata/blob/main/src/acquisition/fluview/fluview_locations.py>.
11071107
#'
11081108
#' @examples
1109-
#' pub_fluview(regions = "nat", epiweeks = epirange(201201, 202001))
1109+
#' \dontrun{
1110+
#' pub_fluview(regions = "nat", epiweeks = epirange(201201, 202005))
1111+
#' }
11101112
#' @param regions character. Locations to fetch. Can be any string IDs in
11111113
#' national, HHS region, census division, most states and territories, and so
11121114
#' on. Full list link below.
@@ -1492,7 +1494,7 @@ pvt_norostat <- function(auth, locations, epiweeks, fetch_args = fetch_args_list
14921494
#'
14931495
#' Obtains information on outpatient inluenza-like-illness (ILI) from Delphi's
14941496
#'
1495-
#' @details The full list of location inputs can be accsssed at
1497+
#' @details The full list of location inputs can be accessed at
14961498
#' <https://github.com/cmu-delphi/delphi-epidata/blob/main/src/acquisition/fluview/fluview_locations.py>.
14971499
#'
14981500
#' @examples

R/utils-pipe.R

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,2 @@
1-
#' Pipe operator
2-
#'
3-
#' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details.
4-
#'
5-
#' @name %>%
6-
#' @rdname pipe
7-
#' @keywords internal
8-
#' @export
91
#' @importFrom magrittr %>%
10-
#' @usage lhs \%>\% rhs
11-
#' @param lhs A value or the magrittr placeholder.
12-
#' @param rhs A function call using the magrittr semantics.
13-
#' @return The result of calling `rhs(lhs)`.
142
NULL

cran-comments.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- Calls in the following files call an API which if queried too frequently without a key would result in CRAN being temporarily locked out of running API calls (so a soft-API key problem)
2+
- [`epidatr/R/epidatacall.R`]
3+
- [`epidatr/R/request.R`]
4+
- [`epidatr/R/endpoints.R`]

inst/CITATION

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
bibentry(
2+
"Misc",
3+
title = "Delphi Epidata API",
4+
author = "David C. Farrow, Logan C. Brooks, Aaron Rumack, Ryan J. Tibshirani, Roni Rosenfeld",
5+
year = 2015,
6+
url = "https://github.com/cmu-delphi/delphi-epidata"
7+
)

0 commit comments

Comments
 (0)