From 6899087f86b62e76eeccf958ce975ece22677d89 Mon Sep 17 00:00:00 2001 From: Joshua Lambert Date: Wed, 19 Jun 2024 16:15:45 +0100 Subject: [PATCH 1/2] update .cross_check_sim_input to not error due to hosp_death_risk when hospitalisation is disallowed --- R/checkers.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/checkers.R b/R/checkers.R index adfea514..d36629ee 100644 --- a/R/checkers.R +++ b/R/checkers.R @@ -289,10 +289,10 @@ )) } if (!rlang::is_lgl_na(onset_to_death_eval)) { - if (rlang::is_lgl_na(hosp_death_risk)) { + if (rlang::is_lgl_na(hosp_death_risk) && !rlang::is_lgl_na(hosp_risk)) { msg <- c(msg, paste( - "hosp_death_risk is set to NA but onset_to_death is specified \n", - "set hosp_death_risk to numeric value" + "hosp_death_risk is set to NA but hosp_risk and onset_to_death is", + "specified \n set hosp_death_risk to numeric value" )) } if (rlang::is_lgl_na(non_hosp_death_risk)) { From c6eedf43d36bbb6bd9034bba220b7ff1a9d87139 Mon Sep 17 00:00:00 2001 From: Joshua Lambert Date: Wed, 19 Jun 2024 16:16:19 +0100 Subject: [PATCH 2/2] update sim_linelist test regexp for updated .cross_check_sim_input msg --- tests/testthat/test-sim_linelist.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-sim_linelist.R b/tests/testthat/test-sim_linelist.R index ebc3394b..11015c89 100644 --- a/tests/testthat/test-sim_linelist.R +++ b/tests/testthat/test-sim_linelist.R @@ -332,7 +332,7 @@ test_that("sim_linelist fails when onset-to-event are given by risk is NA", { onset_to_death = onset_to_death, hosp_death_risk = NA ), - regexp = "(hosp_death_risk is set to NA but onset_to_death is specified)" + regexp = "(hosp_death_risk is set to NA but hosp_risk and onset_to_death)" ) expect_error( sim_linelist(