Skip to content

Commit

Permalink
merge dev
Browse files Browse the repository at this point in the history
Merge branch 'dev' into grf-arx-hotfix

# Conflicts:
#	tests/testthat/test-snapshots.R
dajmcdon committed Oct 28, 2024
2 parents a3d1b11 + 7cc4a8f commit 109113b
Showing 128 changed files with 975 additions and 1,262 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ URL: https://github.com/cmu-delphi/epipredict/,
BugReports: https://github.com/cmu-delphi/epipredict/issues/
Depends:
epiprocess (>= 0.9.0),
epidatasets,
parsnip (>= 1.0.0),
R (>= 3.5.0)
Imports:
@@ -49,7 +50,6 @@ Imports:
workflows (>= 1.0.0)
Suggests:
data.table,
epidatasets,
epidatr (>= 1.0.0),
fs,
grf,
@@ -69,6 +69,7 @@ Suggests:
VignetteBuilder:
knitr
Remotes:
cmu-delphi/epidatasets,
cmu-delphi/epidatr,
cmu-delphi/epiprocess,
cmu-delphi/epidatasets,
70 changes: 52 additions & 18 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
## Setting up the development environment

```r
install.packages(c('devtools', 'pkgdown', 'styler', 'lintr')) # install dev dependencies
devtools::install_deps(dependencies = TRUE) # install package dependencies
devtools::document() # generate package meta data and man files
devtools::build() # build package
install.packages(c('devtools', 'pkgdown', 'styler', 'lintr', 'pak')) # install dev dependencies
pak::pkg_install(".") # install package and dependencies
```

## Validating the package
@@ -13,35 +11,71 @@ devtools::build() # build package
styler::style_pkg() # format code
lintr::lint_package() # lint code

devtools::check() # run R CMD check, which runs everything below
devtools::document() # generate package meta data and man files
devtools::test() # test package
devtools::check() # check package for errors
devtools::build_vignettes() # build vignettes only
devtools::run_examples() # run doc examples
devtools::check(vignettes = FALSE) # check package without vignettes
```

## Developing the documentation site

The [documentation site](https://cmu-delphi.github.io/epipredict/) is built off of the `main` branch. The `dev` version of the site is available at https://cmu-delphi.github.io/epipredict/dev.

The documentation site can be previewed locally by running in R

```r
pkgdown::build_site(preview=TRUE)
```
Our CI builds two versions of the documentation:

The `main` version is available at `file:///<local path>/epidatr/epipredict/index.html` and `dev` at `file:///<local path>/epipredict/docs/dev/index.html`.
- https://cmu-delphi.github.io/epipredict/ from the `main` branch and
- https://cmu-delphi.github.io/epipredict/dev from the `dev` branch.

You can also build the docs manually and launch the site with python. From the terminal, this looks like
Commands for developing the documentation site:

```bash
```sh
# Basic build and preview
R -e 'pkgdown::clean_site()'
R -e 'devtools::document()'
R -e 'pkgdown::build_site()'
python -m http.server -d docs
```

If you work without R Studio and want to iterate on documentation, you might
find [this
script](https://gist.github.com/gadenbuie/d22e149e65591b91419e41ea5b2e0621)
helpful.

## Versioning

Please follow the guidelines in the [PR template document](.github/pull_request_template.md).

## Release process
## Planned CRAN release process

Open a release issue and then copy and follow this checklist in the issue (modified from the checklist generated by `usethis::use_release_issue(version = "1.0.2")`):

- [ ] `git pull` on `dev` branch.
- [ ] Make sure all changes are committed and pushed.
- [ ] Check [current CRAN check results](https://cran.rstudio.org/web/checks/check_results_epipredict.html).
- [ ] `devtools::check(".", manual = TRUE, env_vars = c(NOT_CRAN = "false"))`.
- Aim for 10/10, no notes.
- [ ] If check works well enough, merge to main. Otherwise open a PR to fix up.
- [ ] [Polish NEWS](https://github.com/cmu-delphi/epipredict/blob/dev/NEWS.md).
- Some [guidelines](https://style.tidyverse.org/news.html#news-release).
- [ ] `git checkout main`
- [ ] `git pull`
- [ ] `urlchecker::url_check()`.
- This may choke on the MIT license url, and that's ok.
- [ ] `devtools::build_readme()`
- [ ] `devtools::check_win_devel()`
- [ ] Have maintainer ("cre" in description) check email for problems.
- [ ] `revdepcheck::revdep_check(num_workers = 4)`.
- This may choke, it is very sensitive to the binary versions of packages on a given system. Either bypass or ask someone else to run it if you're concerned.
- [ ] Update `cran-comments.md`
- [ ] PR with any changes (and go through the list again) into `dev` and run through the list again.

Submit to CRAN:

- [ ] `devtools::submit_cran()`.
- [ ] Maintainer approves email.

Wait for CRAN...

TBD
- [ ] If accepted :tada:, move to next steps. If rejected, fix and resubmit.
- [ ] Open and merge a PR containing any updates made to `main` back to `dev`.
- [ ] `usethis::use_github_release(publish = FALSE)` (publish off, otherwise it won't push) will create a draft release based on the commit hash in CRAN-SUBMISSION and push a tag to the GitHub repo.
- [ ] Go to the repo, verify the release notes, and publish when ready.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -215,6 +215,7 @@ export(update_model)
export(validate_layer)
export(weighted_interval_score)
import(distributional)
import(epidatasets)
import(epiprocess)
import(parsnip)
import(recipes)
15 changes: 12 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -4,12 +4,21 @@ Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.0.x will indicat

# epipredict 0.2

## features
## Breaking changes

- Moved example datasets from being hosted in the package to being loaded
from the `epidatasets` package. The datasets can no longer be loaded with
`data(<dataset name>)`, but can be accessed with
`data(<dataset name>, package = "epidatasets")`, `epidatasets::<dataset name>`
or, after loading the package, the name of the dataset alone (#382).

## Improvements

- Add `step_adjust_latency`, which give several methods to adjust the forecast if the `forecast_date` is after the last day of data.
- (temporary) ahead negative is allowed for `step_epi_ahead` until we have `step_epi_shift`

## bugfixes
- shifting no columns results in no error for either `step_epi_ahead` and `step_epi_lag`
## Bug fixes
- Shifting no columns results in no error for either `step_epi_ahead` and `step_epi_lag`
- Quantiles produced by `grf` were sometimes out of order.

# epipredict 0.1
4 changes: 2 additions & 2 deletions R/arx_classifier.R
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
#'
#' @examples
#' library(dplyr)
#' jhu <- case_death_rate_subset %>%
#' jhu <- covid_case_death_rates %>%
#' filter(time_value >= as.Date("2021-11-01"))
#'
#' out <- arx_classifier(jhu, "death_rate", c("case_rate", "death_rate"))
@@ -104,7 +104,7 @@ arx_classifier <- function(
#' @seealso [arx_classifier()]
#' @examples
#' library(dplyr)
#' jhu <- case_death_rate_subset %>%
#' jhu <- covid_case_death_rates %>%
#' filter(time_value >= as.Date("2021-11-01"))
#'
#' arx_class_epi_workflow(jhu, "death_rate", c("case_rate", "death_rate"))
4 changes: 2 additions & 2 deletions R/arx_forecaster.R
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
#' @seealso [arx_fcast_epi_workflow()], [arx_args_list()]
#'
#' @examples
#' jhu <- case_death_rate_subset %>%
#' jhu <- covid_case_death_rates %>%
#' dplyr::filter(time_value >= as.Date("2021-12-01"))
#'
#' out <- arx_forecaster(
@@ -96,7 +96,7 @@ arx_forecaster <- function(
#'
#' @examples
#' library(dplyr)
#' jhu <- case_death_rate_subset %>%
#' jhu <- covid_case_death_rates %>%
#' filter(time_value >= as.Date("2021-12-01"))
#'
#' arx_fcast_epi_workflow(
4 changes: 2 additions & 2 deletions R/autoplot.R
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ ggplot2::autoplot
#' @name autoplot-epipred
#' @examples
#' library(dplyr)
#' jhu <- case_death_rate_subset %>%
#' jhu <- covid_case_death_rates %>%
#' filter(time_value >= as.Date("2021-11-01"))
#'
#' r <- epi_recipe(jhu) %>%
@@ -70,7 +70,7 @@ ggplot2::autoplot
#'
#' # ------- Plotting canned forecaster output
#'
#' jhu <- case_death_rate_subset %>%
#' jhu <- covid_case_death_rates %>%
#' filter(time_value >= as.Date("2021-11-01"))
#' flat <- flatline_forecaster(jhu, "death_rate")
#' autoplot(flat, .max_facets = 4)
2 changes: 1 addition & 1 deletion R/cdc_baseline_forecaster.R
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
#'
#' @examples
#' library(dplyr)
#' weekly_deaths <- case_death_rate_subset %>%
#' weekly_deaths <- covid_case_death_rates %>%
#' select(geo_value, time_value, death_rate) %>%
#' left_join(state_census %>% select(pop, abbr), by = c("geo_value" = "abbr")) %>%
#' mutate(deaths = pmax(death_rate / 1e5 * pop * 7, 0)) %>%
87 changes: 0 additions & 87 deletions R/data.R

This file was deleted.

6 changes: 3 additions & 3 deletions R/epi_recipe.R
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ epi_recipe.default <- function(x, ...) {
#' @examples
#' library(dplyr)
#' library(recipes)
#' jhu <- case_death_rate_subset %>%
#' jhu <- covid_case_death_rates %>%
#' filter(time_value > "2021-08-01") %>%
#' arrange(geo_value, time_value)
#'
@@ -263,7 +263,7 @@ is_epi_recipe <- function(x) {
#' library(dplyr)
#' library(recipes)
#'
#' jhu <- case_death_rate_subset %>%
#' jhu <- covid_case_death_rates %>%
#' filter(time_value > "2021-08-01") %>%
#' arrange(geo_value, time_value)
#'
@@ -347,7 +347,7 @@ update_epi_recipe <- function(x, recipe, ..., blueprint = default_epi_recipe_blu
#' library(dplyr)
#' library(workflows)
#'
#' jhu <- case_death_rate_subset %>%
#' jhu <- covid_case_death_rates %>%
#' filter(time_value > "2021-11-01", geo_value %in% c("ak", "ca", "ny"))
#' r <- epi_recipe(jhu) %>%
#' step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
6 changes: 3 additions & 3 deletions R/epi_workflow.R
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
#' @importFrom generics augment
#' @export
#' @examples
#' jhu <- case_death_rate_subset
#' jhu <- covid_case_death_rates
#'
#' r <- epi_recipe(jhu) %>%
#' step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
@@ -84,7 +84,7 @@ is_epi_workflow <- function(x) {
#' @name fit-epi_workflow
#' @export
#' @examples
#' jhu <- case_death_rate_subset %>%
#' jhu <- covid_case_death_rates %>%
#' filter(time_value > "2021-11-01", geo_value %in% c("ak", "ca", "ny"))
#'
#' r <- epi_recipe(jhu) %>%
@@ -142,7 +142,7 @@ fit.epi_workflow <- function(object, data, ..., control = workflows::control_wor
#' @name predict-epi_workflow
#' @export
#' @examples
#' jhu <- case_death_rate_subset
#' jhu <- covid_case_death_rates
#'
#' r <- epi_recipe(jhu) %>%
#' step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
2 changes: 1 addition & 1 deletion R/epipredict-package.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## usethis namespace: start
#' @import epiprocess parsnip
#' @import epiprocess parsnip epidatasets
#' @importFrom checkmate assert_class assert_numeric
#' @importFrom checkmate test_character test_date test_function
#' @importFrom checkmate test_integerish test_logical
2 changes: 1 addition & 1 deletion R/flatline_forecaster.R
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
#' @export
#'
#' @examples
#' jhu <- case_death_rate_subset %>%
#' jhu <- covid_case_death_rates %>%
#' dplyr::filter(time_value >= as.Date("2021-12-01"))
#'
#' out <- flatline_forecaster(jhu, "death_rate")
Loading

0 comments on commit 109113b

Please sign in to comment.