From 65984ddd3a74fc886276b7ade3318184704b5070 Mon Sep 17 00:00:00 2001 From: Jennit07 <67372904+Jennit07@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:05:36 +0100 Subject: [PATCH 1/6] Move `cli` warning messages before `return()` (#1016) * reorder episode file functions cli messages * reorder indiv file functions cli messages * Refine cli messages * reorder cli messages * Style code --------- Co-authored-by: Jennit07 --- R/add_activity_after_death_flag.R | 4 +- R/add_hri_variables.R | 2 + R/add_keep_population_flag.R | 4 + R/add_nsu_cohort.R | 4 +- R/add_ppa_flag.R | 4 +- R/aggregate_by_chi.R | 8 +- R/correct_demographics.R | 4 +- R/cost_uplift.R | 4 +- R/create_episode_file.R | 41 +++--- R/create_individual_file.R | 207 ++++++++++++++++++------------ R/fill_geographies.R | 8 +- R/join_deaths_data.R | 22 ++-- R/join_sparra_hhg.R | 4 +- R/link_delayed_discharge_eps.R | 4 +- R/match_on_ltcs.R | 4 +- R/process_lookup_homelessness.R | 12 +- 16 files changed, 198 insertions(+), 138 deletions(-) diff --git a/R/add_activity_after_death_flag.R b/R/add_activity_after_death_flag.R index 5e800c80b..72216a611 100644 --- a/R/add_activity_after_death_flag.R +++ b/R/add_activity_after_death_flag.R @@ -13,8 +13,6 @@ add_activity_after_death_flag <- function( year, deaths_data = read_file(get_combined_slf_deaths_lookup_path()) %>% slfhelper::get_chi()) { - cli::cli_alert_info("Add activity after death flag function started at {Sys.time()}") - # to skip warnings no visible binding for global variable ‘.’ . <- NULL @@ -94,7 +92,7 @@ add_activity_after_death_flag <- function( dplyr::select(-death_date_boxi) %>% dplyr::distinct() - + cli::cli_alert_info("Add activity after death flag function finished at {Sys.time()}") return(final_data) } diff --git a/R/add_hri_variables.R b/R/add_hri_variables.R index 3765e1d4d..fd37fba19 100644 --- a/R/add_hri_variables.R +++ b/R/add_hri_variables.R @@ -46,6 +46,8 @@ flag_non_scottish_residents <- function( ) %>% dplyr::select(-"dummy_postcode", -"eng_prac") + cli::cli_alert_info("Add HRI variables function finished at {Sys.time()}") + return(return_data) } diff --git a/R/add_keep_population_flag.R b/R/add_keep_population_flag.R index 6f2470f53..2f665c954 100644 --- a/R/add_keep_population_flag.R +++ b/R/add_keep_population_flag.R @@ -138,6 +138,10 @@ add_keep_population_flag <- function(individual_file, year) { ) ) } + + cli::cli_alert_info("Add keep population function finished at {Sys.time()}") + + return(individual_file) } diff --git a/R/add_nsu_cohort.R b/R/add_nsu_cohort.R index bf6216e57..b573c14ac 100644 --- a/R/add_nsu_cohort.R +++ b/R/add_nsu_cohort.R @@ -13,8 +13,6 @@ add_nsu_cohort <- function( data, year, nsu_cohort = read_file(get_nsu_path(year)) %>% slfhelper::get_chi()) { - cli::cli_alert_info("Add NSU cohort function started at {Sys.time()}") - year_param <- year if (!check_year_valid(year, "nsu")) { @@ -118,5 +116,7 @@ add_nsu_cohort <- function( ) %>% dplyr::select(-dplyr::contains("_nsu"), -"has_chi") + cli::cli_alert_info("Add NSU cohort function finished at {Sys.time()}") + return(return_df) } diff --git a/R/add_ppa_flag.R b/R/add_ppa_flag.R index 1d5f9739d..3d3c7eeaf 100644 --- a/R/add_ppa_flag.R +++ b/R/add_ppa_flag.R @@ -8,8 +8,6 @@ #' @return A data frame to use as a lookup of PPAs #' @family episode_file add_ppa_flag <- function(data) { - cli::cli_alert_info("Add PPA flag function started at {Sys.time()}") - check_variables_exist( data, variables = c( @@ -227,5 +225,7 @@ add_ppa_flag <- function(data) { .data$cij_ppa )) + cli::cli_alert_info("Add PPA flag function finished at {Sys.time()}") + return(ppa_cij_data) } diff --git a/R/aggregate_by_chi.R b/R/aggregate_by_chi.R index ff5cbaad1..010ff5bad 100644 --- a/R/aggregate_by_chi.R +++ b/R/aggregate_by_chi.R @@ -10,8 +10,6 @@ #' #' @inheritParams create_individual_file aggregate_by_chi <- function(episode_file, year, exclude_sc_var = FALSE) { - cli::cli_alert_info("Aggregate by CHI function started at {Sys.time()}") - # recommended by `data.table` team to tackle the issue # "no visible binding for global variable" gender <- @@ -199,6 +197,8 @@ aggregate_by_chi <- function(episode_file, year, exclude_sc_var = FALSE) { ) individual_file <- individual_file[, year := year] + cli::cli_alert_info("Aggregate by CHI function finished at {Sys.time()}") + # convert back to tibble return(dplyr::as_tibble(individual_file)) } @@ -246,8 +246,6 @@ vars_contain <- function(data, vars, ignore_case = FALSE) { #' #' @inheritParams create_individual_file aggregate_ch_episodes <- function(episode_file) { - cli::cli_alert_info("Aggregate ch episodes function started at {Sys.time()}") - # recommended by `data.table` team to tackle the issue # "no visible binding for global variable" ch_no_cost <- @@ -274,5 +272,7 @@ aggregate_ch_episodes <- function(episode_file) { # Convert back to tibble if needed episode_file <- tibble::as_tibble(episode_file) + cli::cli_alert_info("Aggregate ch episodes function finished at {Sys.time()}") + return(episode_file) } diff --git a/R/correct_demographics.R b/R/correct_demographics.R index d221c25ab..d7322b164 100644 --- a/R/correct_demographics.R +++ b/R/correct_demographics.R @@ -7,8 +7,6 @@ #' #' @return episode files with updated date of birth and ages correct_demographics <- function(data, year) { - cli::cli_alert_info("Correct demographics function started at {Sys.time()}") - # keep episodes with missing chi data_no_chi <- data %>% dplyr::filter(is_missing(.data$chi)) @@ -102,5 +100,7 @@ correct_demographics <- function(data, year) { data_chi ) + cli::cli_alert_info("Correct demographics function finished at {Sys.time()}") + return(data) } diff --git a/R/cost_uplift.R b/R/cost_uplift.R index abbbd9b5a..ea3df4abe 100644 --- a/R/cost_uplift.R +++ b/R/cost_uplift.R @@ -5,8 +5,6 @@ #' @return episode data with uplifted costs #' @family episode_file apply_cost_uplift <- function(data) { - cli::cli_alert_info("Apply cost uplift function started at {Sys.time()}") - data <- data %>% # attach a uplift scale as the last column lookup_uplift() %>% @@ -29,6 +27,8 @@ apply_cost_uplift <- function(data) { # remove the last uplift column dplyr::select(-"uplift") + cli::cli_alert_info("Apply cost uplift function finished at {Sys.time()}") + return(data) } diff --git a/R/create_episode_file.R b/R/create_episode_file.R index ecb6fc126..2d560449b 100644 --- a/R/create_episode_file.R +++ b/R/create_episode_file.R @@ -33,6 +33,8 @@ create_episode_file <- function( sc_client = read_file(get_sc_client_lookup_path(year)) %>% slfhelper::get_chi(), write_to_disk = TRUE, anon_chi_out = TRUE) { + cli::cli_alert_info("Create episode file function started at {Sys.time()}") + processed_data_list <- purrr::discard(processed_data_list, ~ is.null(.x) | identical(.x, tibble::tibble())) episode_file <- dplyr::bind_rows(processed_data_list) %>% @@ -265,8 +267,6 @@ create_episode_file <- function( #' #' @return `data` with only the `vars_to_keep` kept store_ep_file_vars <- function(data, year, vars_to_keep) { - cli::cli_alert_info("Store episode file variables function started at {Sys.time()}") - tempfile_path <- get_file_path( directory = get_year_dir(year), file_name = stringr::str_glue("temp_ep_file_variable_store_{year}.parquet"), @@ -289,6 +289,8 @@ store_ep_file_vars <- function(data, year, vars_to_keep) { path = tempfile_path ) + cli::cli_alert_info("Store episode file variables function finished at {Sys.time()}") + return( dplyr::select( data, @@ -304,8 +306,6 @@ store_ep_file_vars <- function(data, year, vars_to_keep) { #' #' @return The full SLF data. load_ep_file_vars <- function(data, year) { - cli::cli_alert_info("Load episode file variable function started at {Sys.time()}") - tempfile_path <- get_file_path( directory = get_year_dir(year), file_name = stringr::str_glue("temp_ep_file_variable_store_{year}.parquet"), @@ -324,6 +324,8 @@ load_ep_file_vars <- function(data, year) { fs::file_delete(tempfile_path) + cli::cli_alert_info("Load episode file variable function finished at {Sys.time()}") + return(full_data) } @@ -333,8 +335,6 @@ load_ep_file_vars <- function(data, year) { #' #' @return A data frame with CIJ markers filled in for those missing. fill_missing_cij_markers <- function(data) { - cli::cli_alert_info("Fill missing cij markers function started at {Sys.time()}") - fixable_data <- data %>% dplyr::filter( .data[["recid"]] %in% c("01B", "04B", "GLS", "02B", "DD") & !is.na(.data[["chi"]]) @@ -380,6 +380,8 @@ fill_missing_cij_markers <- function(data) { return_data <- dplyr::bind_rows(non_fixable_data, fixed_data) + cli::cli_alert_info("Fill missing cij markers function finished at {Sys.time()}") + return(return_data) } @@ -389,14 +391,12 @@ fill_missing_cij_markers <- function(data) { #' #' @return The data with CIJ variables corrected. correct_cij_vars <- function(data) { - cli::cli_alert_info("Correct cij variables function started at {Sys.time()}") - check_variables_exist( data, c("chi", "recid", "cij_admtype", "cij_pattype_code") ) - data %>% + data <- data %>% # Change some values of cij_pattype_code based on cij_admtype dplyr::mutate( cij_admtype = dplyr::if_else( @@ -424,6 +424,10 @@ correct_cij_vars <- function(data) { 9L ~ "Other" ) ) + + cli::cli_alert_info("Correct cij variables function finished at {Sys.time()}") + + return(data) } #' Create cost total net inc DNA @@ -432,13 +436,11 @@ correct_cij_vars <- function(data) { #' #' @return The data with cost including dna. create_cost_inc_dna <- function(data) { - cli::cli_alert_info("Create cost inc dna function started at {Sys.time()}") - check_variables_exist(data, c("cost_total_net", "attendance_status")) # Create cost including DNAs and modify costs # not including DNAs using cattend - data %>% + data <- data %>% dplyr::mutate( cost_total_net_inc_dnas = .data$cost_total_net, # In the Cost_Total_Net column set the cost for @@ -449,6 +451,10 @@ create_cost_inc_dna <- function(data) { .data$cost_total_net ) ) + + cli::cli_alert_info("Create cost inc dna function finished at {Sys.time()}") + + return(data) } #' Create the cohort lookups @@ -458,8 +464,6 @@ create_cost_inc_dna <- function(data) { #' #' @return The data unchanged (the cohorts are written to disk) create_cohort_lookups <- function(data, year, update = latest_update()) { - cli::cli_alert_info("Create cohort lookups function started at {Sys.time()}") - create_demographic_cohorts( data, year, @@ -474,6 +478,7 @@ create_cohort_lookups <- function(data, year, update = latest_update()) { write_to_disk = TRUE ) + cli::cli_alert_info("Create cohort lookups function finished at {Sys.time()}") return(data) } @@ -499,8 +504,6 @@ join_cohort_lookups <- function( col_select = c("anon_chi", "service_use_cohort") ) %>% slfhelper::get_chi()) { - cli::cli_alert_info("Join cohort lookups function started at {Sys.time()}") - join_cohort_lookups <- data %>% dplyr::left_join( demographic_cohort, @@ -511,6 +514,8 @@ join_cohort_lookups <- function( by = "chi" ) + cli::cli_alert_info("Join cohort lookups function finished at {Sys.time()}") + return(join_cohort_lookups) } @@ -527,8 +532,6 @@ join_sc_client <- function(data, year, sc_client = read_file(get_sc_client_lookup_path(year)) %>% slfhelper::get_chi(), file_type = c("episode", "individual")) { - cli::cli_alert_info("Join social care client function started at {Sys.time()}") - if (!check_year_valid(year, type = "client")) { data_file <- data return(data_file) @@ -551,5 +554,7 @@ join_sc_client <- function(data, ) } + cli::cli_alert_info("Join social care client function finished at {Sys.time()}") + return(data_file) } diff --git a/R/create_individual_file.R b/R/create_individual_file.R index 273761efc..8079bc948 100644 --- a/R/create_individual_file.R +++ b/R/create_individual_file.R @@ -18,6 +18,8 @@ create_individual_file <- function( write_to_disk = TRUE, anon_chi_in = TRUE, anon_chi_out = TRUE) { + cli::cli_alert_info("Create individual file function finished at {Sys.time()}") + if (anon_chi_in) { episode_file <- slfhelper::get_chi( episode_file, @@ -177,11 +179,13 @@ create_individual_file <- function( #' @family individual_file #' @inheritParams create_individual_file remove_blank_chi <- function(episode_file) { - cli::cli_alert_info("Remove blank CHI function started at {Sys.time()}") - - episode_file %>% + episode_file <- episode_file %>% dplyr::mutate(chi = dplyr::na_if(.data$chi, "")) %>% dplyr::filter(!is.na(.data$chi)) + + cli::cli_alert_info("Remove blank CHI function finished at {Sys.time()}") + + return(episode_file) } @@ -191,9 +195,7 @@ remove_blank_chi <- function(episode_file) { #' @family individual_file #' @inheritParams create_individual_file add_cij_columns <- function(episode_file) { - cli::cli_alert_info("Add cij columns function started at {Sys.time()}") - - episode_file %>% + episode_file <- episode_file %>% dplyr::mutate( cij_non_el = dplyr::if_else( .data$cij_pattype_code == 0L, @@ -221,6 +223,10 @@ add_cij_columns <- function(episode_file) { NA_integer_ ) ) + + cli::cli_alert_info("Add cij columns function finished at {Sys.time()}") + + return(episode_file) } #' Add all columns @@ -230,8 +236,6 @@ add_cij_columns <- function(episode_file) { #' @family individual_file #' @inheritParams create_individual_file add_all_columns <- function(episode_file, year) { - cli::cli_alert_info("Add all columns function started at {Sys.time()}") - episode_file <- episode_file %>% add_acute_columns("Acute", (.data$smrtype == "Acute-DC" | .data$smrtype == "Acute-IP") & .data$cij_pattype != "Maternity") %>% add_mat_columns("Mat", .data$recid == "02B" | .data$cij_pattype == "Maternity") %>% @@ -277,6 +281,10 @@ add_all_columns <- function(episode_file, year) { .data$OP_cost_dnas ) ) + + cli::cli_alert_info("Add all columns function finished at {Sys.time()}") + + return(episode_file) } #' Add Acute columns @@ -286,12 +294,14 @@ add_all_columns <- function(episode_file, year) { #' @param condition Condition to create new columns based on #' @family individual_file add_acute_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add acute columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition, episode = TRUE, cost = TRUE) %>% add_ipdc_cols(prefix, condition) + + cli::cli_alert_info("Add acute columns function finished at {Sys.time()}") + + return(episode_file) } #' Add Mat columns @@ -299,12 +309,14 @@ add_acute_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_mat_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add maternity columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition, episode = TRUE, cost = TRUE) %>% add_ipdc_cols(prefix, condition, elective = FALSE) + + cli::cli_alert_info("Add maternity columns function finished at {Sys.time()}") + + return(episode_file) } #' Add MH columns @@ -312,12 +324,14 @@ add_mat_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_mh_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add mental health columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition, episode = TRUE, cost = TRUE) %>% add_ipdc_cols(prefix, condition, ipdc_d = FALSE) + + cli::cli_alert_info("Add mental health columns function finished at {Sys.time()}") + + return(episode_file) } #' Add GLS columns @@ -325,12 +339,14 @@ add_mh_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_gls_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add geriatric long stay columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition, episode = TRUE, cost = TRUE) %>% add_ipdc_cols(prefix, condition, ipdc_d = FALSE) + + cli::cli_alert_info("Add geriatric long stay columns function finished at {Sys.time()}") + + return(episode_file) } #' Add OP columns @@ -338,8 +354,6 @@ add_gls_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_op_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add outpatient columns function started at {Sys.time()}") - condition <- substitute(condition) episode_file <- episode_file %>% add_standard_cols(prefix, condition) @@ -355,6 +369,9 @@ add_op_columns <- function(episode_file, prefix, condition) { "{prefix}_newcons_dnas" := dplyr::if_else(eval(condition_5_8), 1L, NA_integer_), "{prefix}_cost_dnas" := dplyr::if_else(eval(condition_5_8), .data$cost_total_net_inc_dnas, NA_real_) ) + + cli::cli_alert_info("Add outpatient columns function finished at {Sys.time()}") + return(episode_file) } @@ -363,12 +380,14 @@ add_op_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_ae_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add A&E columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition, cost = TRUE) %>% dplyr::mutate("{prefix}_attendances" := dplyr::if_else(eval(condition), 1L, NA_integer_)) + + cli::cli_alert_info("Add A&E columns function finished at {Sys.time()}") + + return(episode_file) } #' Add PIS columns @@ -376,12 +395,13 @@ add_ae_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_pis_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add prescribing columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition, cost = TRUE) %>% dplyr::mutate("{prefix}_paid_items" := dplyr::if_else(eval(condition), .data$no_paid_items, NA_integer_)) + cli::cli_alert_info("Add prescribing columns function finished at {Sys.time()}") + + return(episode_file) } #' Add OoH columns @@ -389,8 +409,6 @@ add_pis_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_ooh_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add out of hours columns function started at {Sys.time()}") - condition <- substitute(condition) episode_file <- episode_file %>% add_standard_cols(prefix, condition, cost = TRUE) %>% @@ -418,6 +436,8 @@ add_ooh_columns <- function(episode_file, prefix, condition) { ) ) + cli::cli_alert_info("Add out of hours columns function finished at {Sys.time()}") + return(episode_file) } @@ -426,11 +446,9 @@ add_ooh_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_dn_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add district nursing columns function started at {Sys.time()}") - condition <- substitute(condition) if ("total_no_dn_contacts" %in% names(episode_file)) { - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition, episode = TRUE, cost = TRUE) %>% dplyr::mutate( "{prefix}_contacts" := dplyr::if_else( @@ -440,10 +458,14 @@ add_dn_columns <- function(episode_file, prefix, condition) { ) ) } else { - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition, episode = TRUE, cost = TRUE) %>% dplyr::mutate("{prefix}_contacts" := NA_integer_) } + + cli::cli_alert_info("Add district nursing columns function finished at {Sys.time()}") + + return(episode_file) } #' Add CMH columns @@ -451,12 +473,14 @@ add_dn_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_cmh_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add communicty mental health columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition) %>% dplyr::mutate("{prefix}_contacts" := dplyr::if_else(eval(condition), 1L, NA_integer_)) + + cli::cli_alert_info("Add communicty mental health columns function finished at {Sys.time()}") + + return(episode_file) } #' Add DD columns @@ -464,8 +488,6 @@ add_cmh_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_dd_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add delayed discharges columns function started at {Sys.time()}") - condition <- substitute(condition) condition_delay <- substitute(condition & primary_delay_reason != "9") episode_file <- episode_file %>% @@ -479,6 +501,9 @@ add_dd_columns <- function(episode_file, prefix, condition) { "{prefix}_Code9_episodes" := dplyr::if_else(eval(condition_delay_9), 1L, NA_integer_), "{prefix}_Code9_beddays" := dplyr::if_else(eval(condition_delay_9), .data$yearstay, NA_real_) ) + + cli::cli_alert_info("Add delayed discharges columns function finished at {Sys.time()}") + return(episode_file) } @@ -487,12 +512,14 @@ add_dd_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_nsu_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add non service users columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition) %>% dplyr::mutate("{prefix}" := dplyr::if_else(eval(condition), 1L, NA_integer_)) + + cli::cli_alert_info("Add non service users columns function finished at {Sys.time()}") + + return(episode_file) } #' Add NRS columns @@ -500,12 +527,14 @@ add_nsu_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_nrs_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add nrs columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition) %>% dplyr::mutate("{prefix}" := dplyr::if_else(eval(condition), 1L, NA_integer_)) + + cli::cli_alert_info("Add nrs columns function finished at {Sys.time()}") + + return(episode_file) } #' Add HL1 columns @@ -513,11 +542,13 @@ add_nrs_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_hl1_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add homelessness columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition) + + cli::cli_alert_info("Add homelessness columns function finished at {Sys.time()}") + + return(episode_file) } #' Add CH columns @@ -525,10 +556,8 @@ add_hl1_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_ch_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add care home columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition) %>% dplyr::mutate( ch_cost_per_day = dplyr::if_else( @@ -550,6 +579,10 @@ add_ch_columns <- function(episode_file, prefix, condition) { .data$ch_ep_end ) ) + + cli::cli_alert_info("Add care home columns function finished at {Sys.time()}") + + return(episode_file) } #' Add HC columns @@ -557,8 +590,6 @@ add_ch_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_hc_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add home care columns function started at {Sys.time()}") - condition <- substitute(condition) episode_file <- episode_file %>% @@ -596,6 +627,10 @@ add_hc_columns <- function(episode_file, prefix, condition) { "{prefix}_reablement_hours" := dplyr::if_else(eval(condition_reabl), .data$hc_hours_annual, NA_real_), "{prefix}_reablement_hours_cost" := dplyr::if_else(eval(condition_reabl), .data$cost_total_net, NA_real_) ) + + cli::cli_alert_info("Add home care columns function finished at {Sys.time()}") + + return(episode_file) } #' Add AT columns @@ -603,15 +638,17 @@ add_hc_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_at_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add alarms telecare columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition) %>% dplyr::mutate( "{prefix}_alarms" := dplyr::if_else(eval(condition) & .data$smrtype == "AT-Alarm", 1L, NA_integer_), "{prefix}_telecare" := dplyr::if_else(eval(condition) & .data$smrtype == "AT-Tele", 1L, NA_integer_) ) + + cli::cli_alert_info("Add alarms telecare columns function finished at {Sys.time()}") + + return(episode_file) } #' Add SDS columns @@ -619,10 +656,8 @@ add_at_columns <- function(episode_file, prefix, condition) { #' @inheritParams add_acute_columns #' @family individual_file add_sds_columns <- function(episode_file, prefix, condition) { - cli::cli_alert_info("Add SDS columns function started at {Sys.time()}") - condition <- substitute(condition) - episode_file %>% + episode_file <- episode_file %>% add_standard_cols(prefix, condition) %>% dplyr::mutate( "{prefix}_option_1" := dplyr::if_else(eval(condition) & .data$smrtype == "SDS-1", 1L, NA_integer_), @@ -630,6 +665,10 @@ add_sds_columns <- function(episode_file, prefix, condition) { "{prefix}_option_3" := dplyr::if_else(eval(condition) & .data$smrtype == "SDS-3", 1L, NA_integer_), "{prefix}_option_4" := dplyr::if_else(eval(condition) & .data$smrtype == "SDS-4", 1L, NA_integer_) ) + + cli::cli_alert_info("Add SDS columns function finished at {Sys.time()}") + + return(episode_file) } #' Add columns based on IPDC @@ -643,8 +682,6 @@ add_sds_columns <- function(episode_file, prefix, condition) { #' cij_pattype (lgl) #' @family individual_file add_ipdc_cols <- function(episode_file, prefix, condition, ipdc_d = TRUE, elective = TRUE) { - cli::cli_alert_info("Add ipdc columns function started at {Sys.time()}") - condition_i <- substitute(eval(condition) & ipdc == "I") episode_file <- episode_file %>% dplyr::mutate( @@ -676,6 +713,9 @@ add_ipdc_cols <- function(episode_file, prefix, condition, ipdc_d = TRUE, electi "{prefix}_daycase_cost" := dplyr::if_else(eval(condition_d), .data$cost_total_net, NA_real_) ) } + + cli::cli_alert_info("Add ipdc columns function finished at {Sys.time()}") + return(episode_file) } @@ -689,14 +729,15 @@ add_ipdc_cols <- function(episode_file, prefix, condition, ipdc_d = TRUE, electi #' @param cost Whether to create prefix_cost col, e.g. "Acute_cost" #' @family individual_file add_standard_cols <- function(episode_file, prefix, condition, episode = FALSE, cost = FALSE) { - cli::cli_alert_info("Add standard columns function started at {Sys.time()}") - if (episode) { episode_file <- dplyr::mutate(episode_file, "{prefix}_episodes" := dplyr::if_else(eval(condition), 1L, NA_integer_)) } if (cost) { episode_file <- dplyr::mutate(episode_file, "{prefix}_cost" := dplyr::if_else(eval(condition), .data$cost_total_net, NA_real_)) } + + cli::cli_alert_info("Add standard columns function finished at {Sys.time()}") + return(episode_file) } @@ -707,9 +748,7 @@ add_standard_cols <- function(episode_file, prefix, condition, episode = FALSE, #' @inheritParams create_individual_file #' @family individual_file clean_up_ch <- function(episode_file, year) { - cli::cli_alert_info("Clean up CH function started at {Sys.time()}") - - episode_file %>% + episode_file <- episode_file %>% dplyr::mutate( fy_end = end_fy(year), fy_start = start_fy(year) @@ -741,6 +780,10 @@ clean_up_ch <- function(episode_file, year) { ) ) %>% dplyr::select(-c("fy_end", "fy_start", "term_1", "term_2")) + + cli::cli_alert_info("Clean up CH function finished at {Sys.time()}") + + return(episode_file) } #' Recode gender @@ -750,9 +793,7 @@ clean_up_ch <- function(episode_file, year) { #' @inheritParams create_individual_file #' @family individual_file recode_gender <- function(episode_file) { - cli::cli_alert_info("Recode Gender function started at {Sys.time()}") - - episode_file %>% + episode_file <- episode_file %>% dplyr::mutate( gender = dplyr::if_else( .data$gender %in% c(0L, 9L), @@ -760,6 +801,10 @@ recode_gender <- function(episode_file) { .data$gender ) ) + + cli::cli_alert_info("Recode Gender function finished at {Sys.time()}") + + return(episode_file) } #' Condition columns @@ -769,11 +814,12 @@ recode_gender <- function(episode_file) { #' "dementia" and "dementia_date" #' @family individual_file condition_cols <- function() { - cli::cli_alert_info("Return condition columns function started at {Sys.time()}") - conditions <- slfhelper::ltc_vars date_cols <- paste0(conditions, "_date") all_cols <- c(conditions, date_cols) + + cli::cli_alert_info("Return condition columns function finished at {Sys.time()}") + return(all_cols) } @@ -808,9 +854,7 @@ min_no_inf <- function(x) { #' @param individual_file Individual file where each row represents a unique CHI #' @param year Financial year e.g 1718 clean_individual_file <- function(individual_file, year) { - cli::cli_alert_info("Clean individual file function started at {Sys.time()}") - - individual_file %>% + individual_file <- individual_file %>% dplyr::select(!dplyr::any_of(c( "ch_no_cost", "no_paid_items", @@ -819,6 +863,10 @@ clean_individual_file <- function(individual_file, year) { ))) %>% clean_up_gender() %>% dplyr::mutate(age = compute_mid_year_age(year, .data$dob)) + + cli::cli_alert_info("Clean individual file function finished at {Sys.time()}") + + return(individual_file) } #' Clean up gender column @@ -827,15 +875,16 @@ clean_individual_file <- function(individual_file, year) { #' #' @inheritParams clean_individual_file clean_up_gender <- function(individual_file) { - cli::cli_alert_info("Clean up gender column function started at {Sys.time()}") - - individual_file %>% + individual_file <- individual_file %>% dplyr::mutate( gender = dplyr::case_when( .data$gender != 1.5 ~ round(.data$gender), .default = phsmethods::sex_from_chi(.data$chi, chi_check = FALSE) ) ) + + cli::cli_alert_info("Clean up gender column function finished at {Sys.time()}") + return(individual_file) } #' Join slf lookup variables @@ -855,8 +904,6 @@ join_slf_lookup_vars <- function(individual_file, col_select = c("gpprac", "cluster", "hbpraccode") ), hbrescode_var = "hb2018") { - cli::cli_alert_info("Join slf lookup variables function started at {Sys.time()}") - individual_file <- individual_file %>% dplyr::left_join( slf_postcode_lookup, @@ -868,5 +915,7 @@ join_slf_lookup_vars <- function(individual_file, ) %>% dplyr::rename(hbrescode = hbrescode_var) + cli::cli_alert_info("Join slf lookup variables function finished at {Sys.time()}") + return(individual_file) } diff --git a/R/fill_geographies.R b/R/fill_geographies.R index 5638c8758..7d3d71aa6 100644 --- a/R/fill_geographies.R +++ b/R/fill_geographies.R @@ -16,8 +16,6 @@ fill_geographies <- function( get_slf_gpprac_path(), col_select = c("gpprac", "cluster", "hbpraccode") )) { - cli::cli_alert_info("Fill geographies function started at {Sys.time()}") - check_variables_exist(data, c( "chi", "postcode", @@ -30,7 +28,7 @@ fill_geographies <- function( "gpprac" )) - data %>% + data <- data %>% fill_postcode_geogs( slf_pc_lookup = read_file(get_slf_postcode_path()) ) %>% @@ -40,6 +38,10 @@ fill_geographies <- function( col_select = c("gpprac", "cluster", "hbpraccode") ) ) + + cli::cli_alert_info("Fill geographies function finished at {Sys.time()}") + + return(data) } #' Make a postcode lookup for filling to most recent postcodes based on CHI diff --git a/R/join_deaths_data.R b/R/join_deaths_data.R index 5e61a2082..55a412d8b 100644 --- a/R/join_deaths_data.R +++ b/R/join_deaths_data.R @@ -10,16 +10,16 @@ join_deaths_data <- function( data, year, slf_deaths_lookup = read_file(get_slf_deaths_lookup_path(year)) %>% slfhelper::get_chi()) { - cli::cli_alert_info("Join deaths data function started at {Sys.time()}") + data <- data %>% + dplyr::left_join( + slf_deaths_lookup %>% + dplyr::distinct(chi, .keep_all = TRUE), + by = "chi", + na_matches = "never", + relationship = "many-to-one" + ) - return( - data %>% - dplyr::left_join( - slf_deaths_lookup %>% - dplyr::distinct(chi, .keep_all = TRUE), - by = "chi", - na_matches = "never", - relationship = "many-to-one" - ) - ) + cli::cli_alert_info("Join deaths data function finished at {Sys.time()}") + + return(data) } diff --git a/R/join_sparra_hhg.R b/R/join_sparra_hhg.R index c22e1a9c3..3218d6be7 100644 --- a/R/join_sparra_hhg.R +++ b/R/join_sparra_hhg.R @@ -5,8 +5,6 @@ #' @return The data including the SPARRA and HHG variables matched #' on to the episode file. join_sparra_hhg <- function(data, year) { - cli::cli_alert_info("Join SPARRA and HHG function started at {Sys.time()}") - if (check_year_valid(year, "sparra")) { data <- dplyr::left_join( data, @@ -63,5 +61,7 @@ join_sparra_hhg <- function(data, year) { data <- dplyr::mutate(data, hhg_end_fy = NA_integer_) } + cli::cli_alert_info("Join SPARRA and HHG function finished at {Sys.time()}") + return(data) } diff --git a/R/link_delayed_discharge_eps.R b/R/link_delayed_discharge_eps.R index d4162b619..49103ab56 100644 --- a/R/link_delayed_discharge_eps.R +++ b/R/link_delayed_discharge_eps.R @@ -12,8 +12,6 @@ link_delayed_discharge_eps <- function( episode_file, year, dd_data = read_file(get_source_extract_path(year, "dd")) %>% slfhelper::get_chi()) { - cli::cli_alert_info("Link delayed discharge to episode file function started at {Sys.time()}") - if (!check_year_valid(year, type = "dd")) { episode_file <- episode_file return(episode_file) @@ -376,5 +374,7 @@ link_delayed_discharge_eps <- function( )) %>% dplyr::select(-c("has_dd", "delay_dd", "original_admission_date", "amended_dates")) + cli::cli_alert_info("Link delayed discharge to episode file function finished at {Sys.time()}") + return(linked_data) } diff --git a/R/match_on_ltcs.R b/R/match_on_ltcs.R index f0522c00d..51c280966 100644 --- a/R/match_on_ltcs.R +++ b/R/match_on_ltcs.R @@ -12,8 +12,6 @@ match_on_ltcs <- function( data, year, ltc_data = read_file(get_ltcs_path(year)) %>% slfhelper::get_chi()) { - cli::cli_alert_info("Match on LTCs function started at {Sys.time()}") - # Match on LTC lookup matched <- dplyr::left_join( data, @@ -32,5 +30,7 @@ match_on_ltcs <- function( ) %>% dplyr::select(-tidyselect::ends_with("_ltc")) + cli::cli_alert_info("Match on LTCs function finished at {Sys.time()}") + return(matched) } diff --git a/R/process_lookup_homelessness.R b/R/process_lookup_homelessness.R index 30772383e..c1adfed0d 100644 --- a/R/process_lookup_homelessness.R +++ b/R/process_lookup_homelessness.R @@ -13,8 +13,6 @@ create_homelessness_lookup <- function( year, homelessness_data = read_file(get_source_extract_path(year, "homelessness")) %>% slfhelper::get_chi()) { - cli::cli_alert_info("Create homelessness lookup function started at {Sys.time()}") - # Specify years available for running if (year < "1617") { return(NULL) @@ -24,6 +22,8 @@ create_homelessness_lookup <- function( tidyr::drop_na(.data$chi) %>% dplyr::mutate(hl1_in_fy = 1L) + cli::cli_alert_info("Create homelessness lookup function finished at {Sys.time()}") + return(homelessness_lookup) } @@ -41,8 +41,6 @@ create_homelessness_lookup <- function( #' @export add_homelessness_flag <- function(data, year, lookup = create_homelessness_lookup(year)) { - cli::cli_alert_info("Add homelessness flag function started at {Sys.time()}") - if (!check_year_valid(year, type = "homelessness")) { data <- data return(data) @@ -57,6 +55,8 @@ add_homelessness_flag <- function(data, year, ) %>% dplyr::mutate(hl1_in_fy = tidyr::replace_na(.data$hl1_in_fy, 0L)) + cli::cli_alert_info("Add homelessness flag function finished at {Sys.time()}") + return(data) } @@ -72,8 +72,6 @@ add_homelessness_flag <- function(data, year, #' @return the final data as a [tibble][tibble::tibble-package]. #' @export add_homelessness_date_flags <- function(data, year, lookup = create_homelessness_lookup(year)) { - cli::cli_alert_info("Add homelessness date flags function started at {Sys.time()}") - if (!check_year_valid(year, type = "homelessness")) { data <- data return(data) @@ -133,5 +131,7 @@ add_homelessness_date_flags <- function(data, year, lookup = create_homelessness ) ) + cli::cli_alert_info("Add homelessness date flags function finished at {Sys.time()}") + return(data) } From d516ee2d64c196ceaa1ded03ef67af7f7f15adf0 Mon Sep 17 00:00:00 2001 From: Zihao Li Date: Tue, 15 Oct 2024 10:14:27 +0100 Subject: [PATCH 2/6] Update check_year_valid.R (#1017) Co-authored-by: Jennit07 <67372904+Jennit07@users.noreply.github.com> --- R/check_year_valid.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/check_year_valid.R b/R/check_year_valid.R index da257ff4c..bc92361f5 100644 --- a/R/check_year_valid.R +++ b/R/check_year_valid.R @@ -45,9 +45,9 @@ check_year_valid <- function( return(FALSE) } else if (year >= "2324" && type %in% c("nsu", "hhg")) { return(FALSE) - } else if (year >= "2425" && type %in% "sparra") { + } else if (year >= "2425" && type %in% "nsu") { return(FALSE) - } else if (year >= "2526" && type %in% c("ch", "hc", "sds", "at")) { + } else if (year >= "2526" && type %in% c("ch", "hc", "sds", "at", "sparra")) { return(FALSE) } From 82a42b09dfbc669cdcd6ff175da695b647311a47 Mon Sep 17 00:00:00 2001 From: Jennifer Thom Date: Wed, 18 Sep 2024 12:23:37 +0100 Subject: [PATCH 3/6] Remove person_id. Matched in later process --- R/process_extract_alarms_telecare.R | 1 - R/process_extract_care_home.R | 1 - R/process_extract_home_care.R | 3 +-- R/process_extract_sds.R | 1 - R/process_sc_all_alarms_telecare.R | 6 ------ R/process_sc_all_care_home.R | 1 - R/process_sc_all_sds.R | 6 ------ 7 files changed, 1 insertion(+), 18 deletions(-) diff --git a/R/process_extract_alarms_telecare.R b/R/process_extract_alarms_telecare.R index 9d47dd5f0..0769197cd 100644 --- a/R/process_extract_alarms_telecare.R +++ b/R/process_extract_alarms_telecare.R @@ -41,7 +41,6 @@ process_extract_alarms_telecare <- function( "smrtype", "chi", "dob", - # "person_id", "gender", "postcode", "sc_send_lca", diff --git a/R/process_extract_care_home.R b/R/process_extract_care_home.R index dbf817af4..bdaba4767 100644 --- a/R/process_extract_care_home.R +++ b/R/process_extract_care_home.R @@ -115,7 +115,6 @@ process_extract_care_home <- function( "recid", "smrtype", "chi", - # "person_id", "dob", "gender", "postcode", diff --git a/R/process_extract_home_care.R b/R/process_extract_home_care.R index 651be172d..8f866e9f0 100644 --- a/R/process_extract_home_care.R +++ b/R/process_extract_home_care.R @@ -95,8 +95,7 @@ process_extract_home_care <- function( tidyselect::starts_with("hc_cost_"), "cost_total_net", "hc_provider", - "hc_reablement", - # "person_id" + "hc_reablement" ) %>% slfhelper::get_anon_chi() diff --git a/R/process_extract_sds.R b/R/process_extract_sds.R index f8e5f8579..bb2c648ea 100644 --- a/R/process_extract_sds.R +++ b/R/process_extract_sds.R @@ -41,7 +41,6 @@ process_extract_sds <- function( "smrtype", "chi", "dob", - # "person_id", "gender", "postcode", "sc_send_lca", diff --git a/R/process_sc_all_alarms_telecare.R b/R/process_sc_all_alarms_telecare.R index aafc3d727..cd20f412b 100644 --- a/R/process_sc_all_alarms_telecare.R +++ b/R/process_sc_all_alarms_telecare.R @@ -87,11 +87,6 @@ process_sc_all_alarms_telecare <- function( # Replace social_care_id with latest if needed (assuming replace_sc_id_with_latest is a custom function) data <- replace_sc_id_with_latest(data) - # data$person_id <- paste0( - # data$sending_location, - # "-", - # data$social_care_id - # ) # Deal with episodes that have a package across quarters data[, pkg_count := seq_len(.N), by = list( @@ -125,7 +120,6 @@ process_sc_all_alarms_telecare <- function( dob = data.table::last(dob), postcode = data.table::last(postcode), recid = data.table::last(recid), - # person_id = data.table::last(person_id), sc_send_lca = data.table::last(sc_send_lca) ), by = list( sending_location, diff --git a/R/process_sc_all_care_home.R b/R/process_sc_all_care_home.R index 5478d50cc..6cbce20f6 100644 --- a/R/process_sc_all_care_home.R +++ b/R/process_sc_all_care_home.R @@ -385,7 +385,6 @@ process_sc_all_care_home <- function( )) %>% dplyr::select( "chi", - # "person_id", "gender", "dob", "postcode", diff --git a/R/process_sc_all_sds.R b/R/process_sc_all_sds.R index c5b7d43eb..b48be79ad 100644 --- a/R/process_sc_all_sds.R +++ b/R/process_sc_all_sds.R @@ -128,11 +128,6 @@ process_sc_all_sds <- function( "SDS", convert_sc_sending_location_to_lca(sending_location) )] - # sds_full_clean_long$person_id <- paste0( - # sds_full_clean_long$sending_location, - # "-", - # sds_full_clean_long$social_care_id - # ) # Group, arrange and create flags for episodes sds_full_clean_long[, @@ -176,7 +171,6 @@ process_sc_all_sds <- function( dob = data.table::last(dob), postcode = data.table::last(postcode), recid = data.table::last(recid), - # person_id = data.table::last(person_id), sc_send_lca = data.table::last(sc_send_lca) ), by = list(sending_location, social_care_id, smrtype, episode_counter)] rm(sds_full_clean_long) From 9fd8dfacd923af5e488b75f516a867b016065c67 Mon Sep 17 00:00:00 2001 From: Jennifer Thom Date: Wed, 18 Sep 2024 12:40:05 +0100 Subject: [PATCH 4/6] Remove redundant #TODO comments --- R/process_extract_gp_ooh.R | 1 - R/process_extract_homelessness.R | 1 - .../All_years/04-Social_Care/00-Social_Care_functions.R | 1 - _SPSS_archived/All_years/04-Social_Care/02-Home_care_data.R | 1 - 4 files changed, 4 deletions(-) diff --git a/R/process_extract_gp_ooh.R b/R/process_extract_gp_ooh.R index e8d07b9e8..720688421 100644 --- a/R/process_extract_gp_ooh.R +++ b/R/process_extract_gp_ooh.R @@ -88,7 +88,6 @@ process_extract_gp_ooh <- function(year, ) # Keep the location descriptions as a lookup. - # TODO write the GP OoH lookup out using some functions location_lookup <- ooh_clean %>% dplyr::group_by(.data$location) %>% dplyr::summarise( diff --git a/R/process_extract_homelessness.R b/R/process_extract_homelessness.R index 49bf3935e..86324e043 100644 --- a/R/process_extract_homelessness.R +++ b/R/process_extract_homelessness.R @@ -154,7 +154,6 @@ process_extract_homelessness <- function( dplyr::rename(hl1_completeness = "pct_complete_all") %>% dplyr::mutate(hl1_completeness = round(.data$hl1_completeness, 1)) - # TODO - Include person_id (from client_id) final_data <- hl1_data %>% dplyr::select( "year", diff --git a/_SPSS_archived/All_years/04-Social_Care/00-Social_Care_functions.R b/_SPSS_archived/All_years/04-Social_Care/00-Social_Care_functions.R index 9e924e474..47d2fe0a2 100644 --- a/_SPSS_archived/All_years/04-Social_Care/00-Social_Care_functions.R +++ b/_SPSS_archived/All_years/04-Social_Care/00-Social_Care_functions.R @@ -50,7 +50,6 @@ phs_db_connection <- function(dsn, username = Sys.getenv("USER")) { } -# TODO- check R conversion for SC demog lookup. This may differ #' Social Care Demographic Lookup File Path #' #' @description Get the file path for the Social Care Demographic lookup file diff --git a/_SPSS_archived/All_years/04-Social_Care/02-Home_care_data.R b/_SPSS_archived/All_years/04-Social_Care/02-Home_care_data.R index bd35a0d89..69945ce2b 100644 --- a/_SPSS_archived/All_years/04-Social_Care/02-Home_care_data.R +++ b/_SPSS_archived/All_years/04-Social_Care/02-Home_care_data.R @@ -14,7 +14,6 @@ source("All_years/04-Social_Care/00-Social_Care_functions.R") sc_con <- phs_db_connection(dsn = "DVPROD") # Read demographic file -# TODO replace the demographic file with R code demog_file <- read_demog_file( social_care_dir = social_care_dir, latest_update = latest_update() From 898e33cd8b9d4397d3f97ee712bd8a91d655172c Mon Sep 17 00:00:00 2001 From: Jennifer Thom Date: Wed, 18 Sep 2024 12:41:10 +0100 Subject: [PATCH 5/6] remove redundant #TODO comments --- R/fill_geographies.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/fill_geographies.R b/R/fill_geographies.R index 7d3d71aa6..9b7721391 100644 --- a/R/fill_geographies.R +++ b/R/fill_geographies.R @@ -191,7 +191,6 @@ fill_gpprac_geographies <- function( #' #' @return data with matched HSCP and LCA codes cascade_geographies <- function(data) { - # TODO rework this function into a series of smaller functions which operate on vectors # e.g. cascade_hscp_lca <- function(hscp, lca) {...} # Would take HSCP and populate any missing LCA using it data <- data %>% From e61f1aff11dc5304dae700d628bf4971efc3bb64 Mon Sep 17 00:00:00 2001 From: Jennifer Thom Date: Wed, 18 Sep 2024 12:42:58 +0100 Subject: [PATCH 6/6] Update news - sep release date --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 5a07b8266..6d0b32537 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# September 2024 Update - Unreleased +# September 2024 Update - released 13-Sep-24 * New 24/25 files created * New NSU cohort for 23/24 available * New SPARRA scores calculated from April 24/25