Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Please:

- [ ] Make sure this PR is against "dev", not "main" (unless this is a release
PR).
- [ ] Request a review from one of the current epiprocess main reviewers:
brookslogan, nmdefries.
- [ ] Request a review from one of the current epidatr main reviewers:
brookslogan, dshemetov, nmdefries, dsweber2.
- [ ] Makes sure to bump the version number in `DESCRIPTION`. Always increment
the patch version number (the third number), unless you are making a
release PR from dev to main, in which case increment the minor version
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: epidatr
Type: Package
Title: Client for Delphi's 'Epidata' API
Version: 1.0.2
Version: 1.1.0
Date: 2023-12-07
Authors@R:
c(
Expand Down
17 changes: 16 additions & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,20 @@ python -m http.server -d docs
Please follow the guidelines in the [PR template document](.github/pull_request_template.md).

## Release process
First, there's a handy function that makes a github issue; for example, at the time of writing we were doing:
```R
usethis::use_release_issue(version = "1.0.2")
```
If you want to extend it, add to the `release_bullets` function in [utils.R](https://github.com/cmu-delphi/epidatr/blob/dev/R/utils.R).
First, make sure that all the checks pass

```R
devtools::check(".", manual = TRUE, env_vars =c(NOT_CRAN = "false"))
```

TBD
Aim for 10/10, no notes.

When this has gone smoothly enough, release to CRAN via
```R
devtools::release(check = TRUE)
```
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ importFrom(openssl,md5)
importFrom(purrr,map_chr)
importFrom(purrr,map_lgl)
importFrom(readr,read_csv)
importFrom(stats,na.omit)
importFrom(tibble,as_tibble)
importFrom(tibble,tibble)
importFrom(utils,help.search)
Expand Down
11 changes: 8 additions & 3 deletions R/cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ cache_environ$epidatr_cache <- NULL
#' variable is `EPIDATR_CACHE_LOGFILE`.
#' @param confirm whether to confirm directory creation. default is `TRUE`;
#' should only be set in non-interactive scripts
#' @param startup indicates whether the function is being called on
#' startup. Affects suppressability of the messages. Default is `FALSE`.
#' @return [`NULL`] no return value, all effects are stored in the package
#' environment
#' @seealso [`clear_cache`] to delete the old cache while making a new one,
Expand All @@ -102,7 +104,8 @@ set_cache <- function(cache_dir = NULL,
days = NULL,
max_size = NULL,
logfile = NULL,
confirm = TRUE) {
confirm = TRUE,
startup = FALSE) {
if (is.null(cache_dir)) {
cache_dir <- Sys.getenv("EPIDATR_CACHE_DIR", unset = rappdirs::user_cache_dir("R", version = "epidatr"))
} else if (is.null(cache_dir)) {
Expand Down Expand Up @@ -168,12 +171,14 @@ set_cache <- function(cache_dir = NULL,
)
}

# this is effectively a startup message, and for some reason, cli_inform doesn't support start suppression, so we're on our own
# https://github.com/r-lib/cli/issues/589 when this closes we can go back.
cli::cli_inform(c(
"!" = "epidatr cache is being used (set env var EPIDATR_USE_CACHE=FALSE if not intended).",
"i" = "The cache directory is {cache_dir}.",
"i" = "The cache will be cleared after {days} days and will be pruned if it exceeds {max_size} MB.",
"i" = "The cache will be cleared after {days} day{ifelse(days>1,'s','')} and will be pruned if it exceeds {max_size} MB.",
"i" = "The log of cache transactions is stored at {file.path(cache_dir, logfile)}."
))
), class = if (startup) "packageStartupMessage" else NULL)
}

#' Manually reset the cache, deleting all currently saved data and starting afresh
Expand Down
2 changes: 1 addition & 1 deletion R/epidatr-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
cache_environ$use_cache <- Sys.getenv("EPIDATR_USE_CACHE", unset = FALSE)
cache_environ$use_cache <- (cache_environ$use_cache == "TRUE")
if (cache_environ$use_cache) {
set_cache()
set_cache(startup = TRUE)
}
}
1 change: 1 addition & 0 deletions R/model.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ print.EpidataFieldInfo <- function(x, ...) {
cli::cli_dl(x[attr(x, "names")])
}

#' @importFrom stats na.omit
parse_value <- function(info, value, disable_date_parsing = FALSE) {
stopifnot(inherits(info, "EpidataFieldInfo"))

Expand Down
6 changes: 6 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ get_wildcard_equivalent_dates <- function(time_value, time_type = c("day", "week
}
return(time_value)
}

#' inserts each string as a bullet at the end of the "Prepare for release" section
#' @keywords internal
release_bullets <- function() {
c("merge to main")
}
2 changes: 2 additions & 0 deletions man/clear_cache.Rd

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

12 changes: 12 additions & 0 deletions man/release_bullets.Rd

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

6 changes: 5 additions & 1 deletion man/set_cache.Rd

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