From a47cbb8fb740fd6d3b5e82b5d16469294e1e598a Mon Sep 17 00:00:00 2001 From: Jennifer Thom Date: Tue, 19 Sep 2023 12:45:28 +0100 Subject: [PATCH] Only use hscp test flags if NOT 00B --- R/process_tests_episode_file.R | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/R/process_tests_episode_file.R b/R/process_tests_episode_file.R index dc35d266b..2f80beb9c 100644 --- a/R/process_tests_episode_file.R +++ b/R/process_tests_episode_file.R @@ -76,7 +76,6 @@ produce_episode_file_tests <- function( create_demog_test_flags() %>% create_hb_test_flags(.data$hbtreatcode) %>% create_hb_cost_test_flags(.data$hbtreatcode, .data$cost_total_net) %>% - create_hscp_test_flags(.data$hscp2018) %>% # Flags to count stay types dplyr::mutate( cij_elective = dplyr::if_else( @@ -99,7 +98,13 @@ produce_episode_file_tests <- function( 1L, 0L ) - ) %>% + ) + + if (!recid == "00B") { + test_flags <- create_hscp_test_flags(test_flags, .data$hscp2018) + } + + test_flags <- test_flags %>% # keep variables for comparison dplyr::select("valid_chi":dplyr::last_col()) %>% # use function to sum new test flags