Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.1.0 release #229

Merged
merged 38 commits into from
Dec 27, 2024
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
558e147
fixes the mis-labeled date columns in get_cdc_hosp
vpnagraj Oct 22, 2024
9d7a7bb
fixes issue with missing weeklyrate values in get_cdc_hosp
vpnagraj Oct 22, 2024
034e706
Merge pull request #216 from signaturescience/215-fix-incorrectly-lab…
vpnagraj Oct 22, 2024
6130681
includes helper and new functionality in get_cdc_hosp to pull data fr…
vpnagraj Oct 23, 2024
33caca5
sets the default for get_cdc_hosp to fluview
vpnagraj Oct 23, 2024
4669cfa
Merge pull request #217 from signaturescience/214-use-resp-net-to-ret…
vpnagraj Oct 23, 2024
4a7072c
filters to overall flutype only in fluview hospitalization pull
vpnagraj Oct 24, 2024
90acf97
Merge pull request #218 from signaturescience/214-use-resp-net-to-ret…
vpnagraj Oct 24, 2024
1a2c3fc
adds the extended time series data as internal pkg data and updates p…
vpnagraj Nov 3, 2024
4efdaa3
documents the augment option in prep_hdgov_hosp
vpnagraj Nov 3, 2024
fcb2234
Merge pull request #223 from signaturescience/219-add-extended-flu-ho…
vpnagraj Nov 3, 2024
c5f9549
fixes typo in error message for categorical forecasting
vpnagraj Nov 3, 2024
d17c2f7
includes current data for rate change while retaining 23-24 season da…
vpnagraj Nov 3, 2024
bab35c1
fixes column expectations for rate change file
vpnagraj Nov 3, 2024
1869fad
Merge pull request #224 from signaturescience/221-updated-categorical…
vpnagraj Nov 3, 2024
834a887
bumps dev version to 2.0.2.9000
vpnagraj Nov 4, 2024
2928c2f
adds first draft of the get_nhsn_weekly retrieval function
vpnagraj Dec 5, 2024
bb1e6eb
adds prep function for nhsn weekly data
vpnagraj Dec 5, 2024
73e6170
makes minor updates to nhsn weekly retrieval docs
vpnagraj Dec 5, 2024
747f7a6
adds trim argument to prep_nhsn_weekly()
vpnagraj Dec 5, 2024
f9701dc
exports prep_nhsn_weekly; adds ns_impute function
vpnagraj Dec 6, 2024
2673f64
defines unquoted columns as global variables per check NOTE
vpnagraj Dec 6, 2024
f104280
includes floom data prep and internal data object
vpnagraj Dec 10, 2024
dc897bb
Merge pull request #228 from signaturescience/227-curate-static-retro…
vpnagraj Dec 10, 2024
4428647
adds option to pull from alternative NHSN weekly endpoint
vpnagraj Dec 11, 2024
50aed89
increments the version to 2.1.0
vpnagraj Dec 11, 2024
4344acf
updates nhsn imputation to include version with ili
vpnagraj Dec 11, 2024
ef2e3d8
fixes bug in floom dates with date class being stripped
vpnagraj Dec 11, 2024
736fe59
makes some minor edits to prep_hdgov_hosp docs for consistency; adds …
vpnagraj Dec 24, 2024
bca4791
fixes one more bug in prep_hdgov_hosp docs; minor edits to prep_nhsn_…
vpnagraj Dec 24, 2024
2308329
fixes broken example in get_cdc_hosp; minor edits to docs and referen…
vpnagraj Dec 26, 2024
ecd70a7
clarifies the get_nhsn_weekly retrieval docs
vpnagraj Dec 26, 2024
a8ff4dd
makes several clarifications in docs for ns_impute
vpnagraj Dec 26, 2024
7b9588e
adds an inline comment to floom prep script
vpnagraj Dec 26, 2024
5f2956f
fixes typo in get_nowcast_ili docs
vpnagraj Dec 26, 2024
ac6d9d3
fixes bug in validate_forecast example
vpnagraj Dec 26, 2024
573dc13
fixes bug in plot_forecast_categorical example
vpnagraj Dec 26, 2024
0eb768d
updates changelog with v2.1.0 release notes
vpnagraj Dec 27, 2024
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
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: fiphde
Title: Forecasting Influenza in Support of Public Health Decision Making
Version: 2.0.2
Version: 2.1.0
Authors@R:
c(person(given = "VP",
family = "Nagraj",
@@ -26,7 +26,7 @@ License: GPL (>= 3)
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Imports:
dplyr,
fable,
@@ -48,7 +48,8 @@ Imports:
readr,
shiny,
httr,
distfromq
distfromq,
rlang
Depends:
R (>= 2.10)
Suggests:
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -10,17 +10,20 @@ export(get_cdc_clin)
export(get_cdc_hosp)
export(get_cdc_ili)
export(get_hdgov_hosp)
export(get_nhsn_weekly)
export(get_nowcast_ili)
export(glm_wrap)
export(is_monday)
export(make_tsibble)
export(mmwr_week_to_date)
export(mnz)
export(mnz_replace)
export(ns_impute)
export(plot_forecast)
export(plot_forecast_categorical)
export(pois_forc)
export(prep_hdgov_hosp)
export(prep_nhsn_weekly)
export(replace_ili_nowcast)
export(smoothie)
export(this_monday)
@@ -29,3 +32,5 @@ export(ts_fit_forecast)
export(ts_format_for_submission)
export(validate_forecast)
importFrom(magrittr,"%>%")
importFrom(rlang,.data)
importFrom(rlang,.env)
36 changes: 33 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
# fiphde 2.1.0

## New features

### Extended time series and augumented data

As of this release, the package now includes internal package datasets for an extended and augmented NHSN flu hospitalization time series (`fiphde:::nhsn_imputed` and `fiphde:::nhsn_floom`). The extended time series was created using methods published in [Benefield et al. (2024)](https://www.medrxiv.org/content/10.1101/2024.07.31.24311314). The augmentation stitches together the extended time series (prior to 2020) and NHSN reporting (2020-2024), with weeks between April and November 2024 filled using an imputation approach due to limited reporting in this window. The script to create the final dataset is available in the package source at `data-raw/floom.R`.

### Functionality to retrieve data from new NHSN API

In November 2024, the NHSN weekly respiratory hospitalization metrics began being reported via a new API. The "preliminary" and "final" data are now aggregated to the week and reported at distinct endpoints. We have included the `get_nhsn_weekly()` and `prep_nhsn_weekly()` functions to retrieve and format data from these endpoints.

### Updated categorical rate trend thresholds for 2024-25 flu season

The FluSight challenge updated the thresholds for categorical rate changes in the 2024-25 season (see https://github.com/cdcepi/Flusight-forecast-data/blob/master/data-experimental/README.md for more details). This release brings in a new crosswalk file to apply cutoffs for categorical thresholds and implements corresponding logic in the `forecast_categorical()` function.

### More options for FluSurv-NET data retrieval

The `get_cdc_hosp()` function now includes an option to either retrieve FluSurv-NET reporting from the the RESP-NET API or the FluView API.

## Bug fixes

### Incorrect column names for hospitalization retrival function output

Previously, the `get_cdc_hosp()` reversed the names of the columns containing the dates for the start and end of the given epiweek. This release addresses that issue, ensuring that all columns in the `get_cdc_hosp()` output are named correctly.

### Miscellaneous fixes for documentation and examples

We addressed multiple instances of unclear or misspelled documentation and examples that were failing, all of which were marked as "not run" and therefore were not flagged by `R CMD CHECK`.

# fiphde 2.0.2

## New features
@@ -40,7 +70,7 @@ The 2022-23 FluSight guidelines solicited categorical rate change forecasts for

### Plausibility analysis in explorer app

As of this release, the explorer app now includes a plausibility analysis feature built using the `rplanes` package (https://signaturescience.github.io/rplanes/). The plausibility analysis is intended to help guide human forecast review via visualizatons. Currently the scoring uses default parameters, although users can define the components to use via a select input prior to running the scoring in the explorer app.
As of this release, the explorer app now includes a plausibility analysis feature built using the `rplanes` package (https://signaturescience.github.io/rplanes/). The plausibility analysis is intended to help guide human forecast review via visualizations. Currently the scoring uses default parameters, although users can define the components to use via a select input prior to running the scoring in the explorer app.

### Additional example data

@@ -94,7 +124,7 @@ The API for the package has been simplified to remove outmoded functions and har
- Removed `get_cdc_vax()` function
- Removed `state_replace_ili_nowcast_all()` function
- Removed `submission/` directory from the source code repository on GitHub
- More intuitive handling of arguments in `ts_fit_forecast()`, including case-insenstive model names, better handling of optional covariates, and removing the inoperative "remove_null_models" argument
- More intuitive handling of arguments in `ts_fit_forecast()`, including case-insensitive model names, better handling of optional covariates, and removing the inoperative "remove_null_models" argument

### Documentation

@@ -148,7 +178,7 @@ Prior to this release the explorer app (see `?fiphde_launcher`) would default vi

This release brings in additional data retrieval and processing functions. The package now includes code adapted from `cdcfluview` to query the NREVSS surveillance system and pull clinical laboratory percent positive flu data. The `who_nrevss()` function is unexported but is used in the user-facing `get_cdc_clin()` function, which pulls and preps the percent positive data. A complementary function, `clin_nowcast()`, is now available to augment the clinical laboratory percent positivity with a nowcasted value.

The package also now includes helper functions to prepare covariates for modeling. For example, the new `pois_forc()` helper creates a forecasted counts based on recently observed values. This can be used to create forecasted values for number of tests and number of positive flu specimens (and thefore percent positivity) to feed into models that include percent positive lab results as a covariate. The new `smoothie()` function is also available to create weighted averages of recent observations, which can be used as covariate data in models.
The package also now includes helper functions to prepare covariates for modeling. For example, the new `pois_forc()` helper creates a forecasted counts based on recently observed values. This can be used to create forecasted values for number of tests and number of positive flu specimens (and therefore percent positivity) to feed into models that include percent positive lab results as a covariate. The new `smoothie()` function is also available to create weighted averages of recent observations, which can be used as covariate data in models.

# fiphde 0.2.1

17 changes: 17 additions & 0 deletions R/fiphde-package.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## usethis namespace: start
#' @importFrom rlang .data
#' @importFrom rlang .env
#' @keywords internal
"_PACKAGE"

@@ -133,5 +136,19 @@ if(getRversion() >= "2.15.1") utils::globalVariables(c(".",
"target_name",
"target_prob",
"nnetar",
"mean_flu_admits",
"Geographic aggregation",
"Total Influenza Admissions",
"max_reporting",
"flu.admits.cov.perc",
"hosp_mean",
"hosp_rank",
"ili_mean",
"ili_rank",
"Week Ending Date",
"Percent Hospitals Reporting Influenza Admissions",
"Percent Hospitals Reporting Influenza Admissions",
"Number Hospitals Reporting Influenza Admissions",
"Number Hospitals Reporting Influenza Admissions",
"."))

24 changes: 12 additions & 12 deletions R/forecast.R
Original file line number Diff line number Diff line change
@@ -596,7 +596,7 @@ forecast_categorical <- function(.forecast, .observed, method = "density", forma
} else if (method == "density") {

if(format != "hubverse") {
stop("Currently the desnity method only works with 'hubverse' forecast format.")
stop("Currently the density method only works with 'hubverse' forecast format.")
}

last_week <-
@@ -673,32 +673,32 @@ density_probs <- function(df, n_horizons = 5, ...){
"-1" = list(t1 = max(c(10, as.numeric(unique(df$count_rate1)))),
t2 = max(c(10, as.numeric(unique(df$count_rate2))))
),
"0" = list(t1 = max(c(10, as.numeric(unique(df$count_rate1)))),
"0" = list(t1 = max(c(10, as.numeric(unique(df$count_rate0p3)))),
t2 = max(c(10, as.numeric(unique(df$count_rate1p7))))
),
"1" = list(t1 = max(c(10, as.numeric(unique(df$count_rate0p5)))),
t2 = max(c(10, as.numeric(unique(df$count_rate3))))
),
"1" = list(t1 = max(c(10, as.numeric(unique(df$count_rate2)))),
"2" = list(t1 = max(c(10, as.numeric(unique(df$count_rate0p7)))),
t2 = max(c(10, as.numeric(unique(df$count_rate4))))
),
"2" = list(t1 = max(c(10, as.numeric(unique(df$count_rate2p5)))),
t2 = max(c(10, as.numeric(unique(df$count_rate5))))
),
"3" = list(t1 = max(c(10, as.numeric(unique(df$count_rate2p5)))),
"3" = list(t1 = max(c(10, as.numeric(unique(df$count_rate1)))),
t2 = max(c(10, as.numeric(unique(df$count_rate5))))
)
)
} else if (n_horizons == 4) {
thresh <-
switch (as.character(tmp_horizon),
"0" = list(t1 = max(c(10, as.numeric(unique(df$count_rate1)))),
t2 = max(c(10, as.numeric(unique(df$count_rate2))))
"0" = list(t1 = max(c(10, as.numeric(unique(df$count_rate0p3)))),
t2 = max(c(10, as.numeric(unique(df$count_rate1p7))))
),
"1" = list(t1 = max(c(10, as.numeric(unique(df$count_rate1)))),
"1" = list(t1 = max(c(10, as.numeric(unique(df$count_rate0p5)))),
t2 = max(c(10, as.numeric(unique(df$count_rate3))))
),
"2" = list(t1 = max(c(10, as.numeric(unique(df$count_rate2)))),
"2" = list(t1 = max(c(10, as.numeric(unique(df$count_rate0p7)))),
t2 = max(c(10, as.numeric(unique(df$count_rate4))))
),
"3" = list(t1 = max(c(10, as.numeric(unique(df$count_rate2p5)))),
"3" = list(t1 = max(c(10, as.numeric(unique(df$count_rate1)))),
t2 = max(c(10, as.numeric(unique(df$count_rate5))))
)
)
Loading