From 3d459f5dbb0f2b3362f9f64ce3b0164f6218de5b Mon Sep 17 00:00:00 2001 From: James McMahon Date: Thu, 10 Aug 2023 14:37:41 +0100 Subject: [PATCH] Remove incorrect references to rds Since we (mostly) don't use rds anymore these references are incorrect and potentially confusing. I've updated lots of documentation to remove the reference to rds. I've also updated many comments that mentioned rds (these were probably the most confusing). --- R/process_costs_rmd.R | 18 ++++++++----- R/process_extract_acute.R | 15 +++++------ R/process_extract_ae.R | 15 +++++------ R/process_extract_alarms_telecare.R | 2 +- R/process_extract_care_home.R | 2 +- R/process_extract_cmh.R | 15 +++++------ R/process_extract_consultations.R | 2 +- R/process_extract_delayed_discharges.R | 2 +- R/process_extract_district_nursing.R | 2 +- R/process_extract_gp_ooh.R | 2 +- R/process_extract_home_care.R | 2 +- R/process_extract_homelessness.R | 2 +- R/process_extract_maternity.R | 18 +++++-------- R/process_extract_mental_health.R | 16 +++++------- R/process_extract_ooh_diagnosis.R | 2 +- R/process_extract_ooh_outcomes.R | 2 +- R/process_extract_outpatients.R | 19 +++++--------- R/process_extract_prescribing.R | 9 ++++--- R/process_extract_sds.R | 2 +- R/process_lookup_ltc.R | 10 +++---- R/process_lookup_postcode.R | 19 ++++++-------- R/process_lookup_sc_client.R | 16 +++++------- R/process_lookup_sc_demographics.R | 32 +++++++++-------------- R/process_sc_all_alarms_telecare.R | 9 ++++--- R/process_sc_all_care_home.R | 2 +- R/process_sc_all_home_care.R | 2 +- R/process_sc_all_sds.R | 11 ++++---- R/read_extract_gp_ooh.R | 2 +- man/process_costs_ch_rmd.Rd | 2 +- man/process_costs_dn_rmd.Rd | 2 +- man/process_costs_gp_ooh_rmd.Rd | 2 +- man/process_costs_hc_rmd.Rd | 2 +- man/process_extract_acute.Rd | 2 +- man/process_extract_ae.Rd | 2 +- man/process_extract_alarms_telecare.Rd | 2 +- man/process_extract_care_home.Rd | 2 +- man/process_extract_cmh.Rd | 2 +- man/process_extract_delayed_discharges.Rd | 2 +- man/process_extract_district_nursing.Rd | 2 +- man/process_extract_gp_ooh.Rd | 2 +- man/process_extract_home_care.Rd | 2 +- man/process_extract_homelessness.Rd | 2 +- man/process_extract_maternity.Rd | 2 +- man/process_extract_mental_health.Rd | 2 +- man/process_extract_ooh_consultations.Rd | 2 +- man/process_extract_ooh_diagnosis.Rd | 2 +- man/process_extract_ooh_outcomes.Rd | 2 +- man/process_extract_outpatients.Rd | 2 +- man/process_extract_prescribing.Rd | 2 +- man/process_extract_sds.Rd | 2 +- man/process_lookup_postcode.Rd | 2 +- man/process_lookup_sc_client.Rd | 2 +- man/process_lookup_sc_demographics.Rd | 2 +- man/process_sc_all_alarms_telecare.Rd | 2 +- man/process_sc_all_care_home.Rd | 2 +- man/process_sc_all_home_care.Rd | 2 +- man/process_sc_all_sds.Rd | 2 +- man/read_extract_gp_ooh.Rd | 2 +- 58 files changed, 145 insertions(+), 165 deletions(-) diff --git a/R/process_costs_rmd.R b/R/process_costs_rmd.R index 2efc25dd8..5d97d705f 100644 --- a/R/process_costs_rmd.R +++ b/R/process_costs_rmd.R @@ -14,7 +14,8 @@ process_costs_rmd <- function(file_name) { stringr::fixed("Rmd", ignore_case = TRUE) )) { cli::cli_abort( - "{.arg file_name} must be an {.code .Rmd} not a {.code .{fs::path_ext(file_name)}}." + "{.arg file_name} must be an {.code .Rmd} not a + {.code .{fs::path_ext(file_name)}}." ) } @@ -34,7 +35,12 @@ process_costs_rmd <- function(file_name) { output_file <- get_file_path( directory = output_dir, - file_name = fs::path_ext_set(stringr::str_glue("{fs::path_ext_remove(file_name)}-{latest_update()}-{date_today}"), "html"), + file_name = fs::path_ext_set( + stringr::str_glue( + "{fs::path_ext_remove(file_name)}-{latest_update()}-{date_today}" + ), + "html" + ), check_mode = "write" ) @@ -55,7 +61,7 @@ process_costs_rmd <- function(file_name) { #' #' @description This will read and process the #' District Nursing cost lookup, it will return the final data -#' but also write this out as a rds. +#' and write it to disk. #' #' @param file_path Path to the cost lookup. #' @@ -73,7 +79,7 @@ process_costs_dn_rmd <- function(file_path = get_dn_costs_path()) { #' #' @description This will read and process the #' care homes cost lookup, it will return the final data -#' but also write this out as a rds. +#' and write it to disk. #' #' @inheritParams process_costs_dn_rmd #' @@ -91,7 +97,7 @@ process_costs_ch_rmd <- function(file_path = get_ch_costs_path()) { #' #' @description This will read and process the #' GP ooh cost lookup, it will return the final data -#' but also write this out as a rds. +#' and write it to disk. #' #' @inheritParams process_costs_dn_rmd #' @@ -109,7 +115,7 @@ process_costs_gp_ooh_rmd <- function(file_path = get_gp_ooh_costs_path()) { #' #' @description This will read and process the #' Home Care cost lookup, it will return the final data -#' but also write this out as a rds. +#' and write it to disk. #' #' @inheritParams process_costs_dn_rmd #' diff --git a/R/process_extract_acute.R b/R/process_extract_acute.R index 107b346c9..70ff29370 100644 --- a/R/process_extract_acute.R +++ b/R/process_extract_acute.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' acute extract, it will return the final data -#' but also write this out as an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process, in FY format. @@ -61,9 +61,7 @@ process_extract_acute <- function(data, year, write_to_disk = TRUE) { levels = 0L:8L )) - - ## save outfile --------------------------------------- - outfile <- acute_clean %>% + acute_processed <- acute_clean %>% dplyr::select( "year", "recid", @@ -113,10 +111,11 @@ process_extract_acute <- function(data, year, write_to_disk = TRUE) { dplyr::arrange(.data$chi, .data$record_keydate1) if (write_to_disk) { - # Save as rds file - outfile %>% - write_file(get_source_extract_path(year, "Acute", check_mode = "write")) + write_file( + acute_processed, + get_source_extract_path(year, "Acute", check_mode = "write") + ) } - return(outfile) + return(acute_processed) } diff --git a/R/process_extract_ae.R b/R/process_extract_ae.R index 7e61db018..95dfd99be 100644 --- a/R/process_extract_ae.R +++ b/R/process_extract_ae.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' A&E extract, it will return the final data -#' but also write this out as an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process, in FY format. @@ -237,9 +237,7 @@ process_extract_ae <- function(data, year, write_to_disk = TRUE) { .data$keytime2 ) - - # Save outfile---------------------------------------- - outfile <- matched_ae_data %>% + ae_processed <- matched_ae_data %>% dplyr::select( "year", "recid", @@ -294,10 +292,11 @@ process_extract_ae <- function(data, year, write_to_disk = TRUE) { ) if (write_to_disk) { - # Save as rds file - outfile %>% - write_file(get_source_extract_path(year, "AE", check_mode = "write")) + write_file( + ae_processed, + get_source_extract_path(year, "AE", check_mode = "write") + ) } - return(outfile) + return(ae_processed) } diff --git a/R/process_extract_alarms_telecare.R b/R/process_extract_alarms_telecare.R index 15cd79809..9a0745a04 100644 --- a/R/process_extract_alarms_telecare.R +++ b/R/process_extract_alarms_telecare.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' (year specific) Alarms Telecare extract, it will return the final data -#' but also write this out as rds. +#' and (optionally) write it to disk. #' #' @inheritParams process_extract_care_home #' diff --git a/R/process_extract_care_home.R b/R/process_extract_care_home.R index 757e47f6c..cbf6d417c 100644 --- a/R/process_extract_care_home.R +++ b/R/process_extract_care_home.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' (year specific) Care Home extract, it will return the final data -#' but also write this out as rds. +#' and (optionally) write it to disk. #' #' @param data The full processed data which will be selected from to create #' the year specific data. diff --git a/R/process_extract_cmh.R b/R/process_extract_cmh.R index 0b1ba0f19..a2adad75e 100644 --- a/R/process_extract_cmh.R +++ b/R/process_extract_cmh.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' CMH extract, it will return the final data -#' but also write this out as an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process, in FY format. @@ -44,9 +44,7 @@ process_extract_cmh <- function(data, # create blank diag 6 dplyr::mutate(diag6 = NA) - # Outfile -------------------------------------------- - - outfile <- cmh_clean %>% + cmh_processed <- cmh_clean %>% dplyr::select( "year", "recid", @@ -73,10 +71,11 @@ process_extract_cmh <- function(data, ) if (write_to_disk) { - # Save as rds file - outfile %>% - write_file(get_source_extract_path(year, "CMH", check_mode = "write")) + write_file( + cmh_processed, + get_source_extract_path(year, "CMH", check_mode = "write") + ) } - return(outfile) + return(cmh_processed) } diff --git a/R/process_extract_consultations.R b/R/process_extract_consultations.R index 7262c1df6..6dc175cb8 100644 --- a/R/process_extract_consultations.R +++ b/R/process_extract_consultations.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' GP OOH Consultations extract, it will return the final data -#' but also write this out as an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process, in FY format. diff --git a/R/process_extract_delayed_discharges.R b/R/process_extract_delayed_discharges.R index 29f37eb29..3c56807f9 100644 --- a/R/process_extract_delayed_discharges.R +++ b/R/process_extract_delayed_discharges.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' delayed discharges extract, it will return the final data -#' but also write this out as an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process, in FY format. diff --git a/R/process_extract_district_nursing.R b/R/process_extract_district_nursing.R index a1b3bf816..9d1df62a6 100644 --- a/R/process_extract_district_nursing.R +++ b/R/process_extract_district_nursing.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' District Nursing extract, it will return the final data -#' but also write this out an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process, in FY format. diff --git a/R/process_extract_gp_ooh.R b/R/process_extract_gp_ooh.R index 4add41cfa..2b536878a 100644 --- a/R/process_extract_gp_ooh.R +++ b/R/process_extract_gp_ooh.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' GP OoH extract, it will return the final data -#' but also write this out an rds. +#' and (optionally) write it to disk. #' #' @param year The year to process, in FY format. #' @param data_list A list containing the extracts. diff --git a/R/process_extract_home_care.R b/R/process_extract_home_care.R index 3fcf009eb..874ad899c 100644 --- a/R/process_extract_home_care.R +++ b/R/process_extract_home_care.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' (year specific) Home Care extract, it will return the final data -#' but also write this out as rds. +#' and (optionally) write it to disk. #' #' @inheritParams process_extract_care_home #' diff --git a/R/process_extract_homelessness.R b/R/process_extract_homelessness.R index a16c9a57b..4358a0ba0 100644 --- a/R/process_extract_homelessness.R +++ b/R/process_extract_homelessness.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' homelessness extract, it will return the final data -#' and optionally write it out as rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process from [read_extract_homelessness()]. #' @param year The year to process, in FY format. diff --git a/R/process_extract_maternity.R b/R/process_extract_maternity.R index 04fa46ced..64fa4e205 100644 --- a/R/process_extract_maternity.R +++ b/R/process_extract_maternity.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' maternity extract, it will return the final data -#' but also write this out an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process, in FY format. @@ -63,10 +63,7 @@ process_extract_maternity <- function(data, year, write_to_disk = TRUE) { ) ) - - # Save outfile------------------------------------------------ - - outfile <- maternity_clean %>% + maternity_processed <- maternity_clean %>% dplyr::select( "year", "recid", @@ -113,12 +110,11 @@ process_extract_maternity <- function(data, year, write_to_disk = TRUE) { dplyr::arrange(.data$chi, .data$record_keydate1) if (write_to_disk) { - # Save as rds file - outfile %>% - write_file( - get_source_extract_path(year, "Maternity", check_mode = "write") - ) + write_file( + maternity_processed, + get_source_extract_path(year, "Maternity", check_mode = "write") + ) } - return(outfile) + return(maternity_processed) } diff --git a/R/process_extract_mental_health.R b/R/process_extract_mental_health.R index 76e7157e3..ffea63d28 100644 --- a/R/process_extract_mental_health.R +++ b/R/process_extract_mental_health.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' mental health extract, it will return the final data -#' but also write this out an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process, in FY format. @@ -67,10 +67,7 @@ process_extract_mental_health <- function(data, year, write_to_disk = TRUE) { smrtype = add_smr_type(.data$recid) ) - - # Outfile --------------------------------------- - - outfile <- mh_clean %>% + mh_processed <- mh_clean %>% dplyr::arrange(.data$chi, .data$record_keydate1) %>% dplyr::select( "year", @@ -118,10 +115,11 @@ process_extract_mental_health <- function(data, year, write_to_disk = TRUE) { ) if (write_to_disk) { - outfile %>% - # Save as rds file - write_file(get_source_extract_path(year, "MH", check_mode = "write")) + write_file( + mh_processed, + get_source_extract_path(year, "MH", check_mode = "write") + ) } - return(outfile) + return(mh_processed) } diff --git a/R/process_extract_ooh_diagnosis.R b/R/process_extract_ooh_diagnosis.R index 128c6c772..f2afd634e 100644 --- a/R/process_extract_ooh_diagnosis.R +++ b/R/process_extract_ooh_diagnosis.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' GP OOH Diagnosis extract, it will return the final data -#' but also write this out an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process, in FY format. diff --git a/R/process_extract_ooh_outcomes.R b/R/process_extract_ooh_outcomes.R index 6a14bced5..f188e6de1 100644 --- a/R/process_extract_ooh_outcomes.R +++ b/R/process_extract_ooh_outcomes.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' GP OOH Outcomes extract, it will return the final data -#' but also write this out as an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process, in FY format. diff --git a/R/process_extract_outpatients.R b/R/process_extract_outpatients.R index 39b421ab4..341ee0f1a 100644 --- a/R/process_extract_outpatients.R +++ b/R/process_extract_outpatients.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' outpatients extract, it will return the final data -#' but also write this out as an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process, in FY format. @@ -49,11 +49,7 @@ process_extract_outpatients <- function(data, year, write_to_disk = TRUE) { ) ) - - ## save outfile --------------------------------------- - - outfile <- - outpatients_clean %>% + outpatients_processed <- outpatients_clean %>% dplyr::select( "year", "recid", @@ -89,12 +85,11 @@ process_extract_outpatients <- function(data, year, write_to_disk = TRUE) { ) if (write_to_disk) { - # Save as rds file - outfile %>% - write_file( - get_source_extract_path(year, "Outpatients", check_mode = "write") - ) + write_file( + outpatients_processed, + get_source_extract_path(year, "Outpatients", check_mode = "write") + ) } - return(outfile) + return(outpatients_processed) } diff --git a/R/process_extract_prescribing.R b/R/process_extract_prescribing.R index 776299d47..68c388b83 100644 --- a/R/process_extract_prescribing.R +++ b/R/process_extract_prescribing.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' prescribing extract, it will return the final data -#' but also write this out as an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process, in FY format. @@ -50,9 +50,10 @@ process_extract_prescribing <- function(data, year, write_to_disk = TRUE) { } if (write_to_disk) { - # Save as rds file - pis_clean %>% - write_file(get_source_extract_path(year, "PIS", check_mode = "write")) + write_file( + pis_clean, + get_source_extract_path(year, "PIS", check_mode = "write") + ) } return(pis_clean) diff --git a/R/process_extract_sds.R b/R/process_extract_sds.R index a58651749..bd9e93a3f 100644 --- a/R/process_extract_sds.R +++ b/R/process_extract_sds.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' (year specific) SDS extract, it will return the final data -#' but also write this out as rds. +#' and (optionally) write it to disk. #' #' @inheritParams process_extract_care_home #' diff --git a/R/process_lookup_ltc.R b/R/process_lookup_ltc.R index 5a80deaff..8ea33da48 100644 --- a/R/process_lookup_ltc.R +++ b/R/process_lookup_ltc.R @@ -24,13 +24,11 @@ process_lookup_ltc <- function(data, year, write_to_disk = TRUE) { .fn = ~ stringr::str_remove(.x, "_date_flag") ) - # Save Outfile--------------------------------------------- - if (write_to_disk) { - # Save .rds file - ltc_flags %>% - dplyr::arrange(.data$chi) %>% - write_file(get_ltcs_path(year, check_mode = "write")) + write_file( + ltc_flags, + get_ltcs_path(year, check_mode = "write") + ) } return(ltc_flags) diff --git a/R/process_lookup_postcode.R b/R/process_lookup_postcode.R index 878c51f37..a17a0c97e 100644 --- a/R/process_lookup_postcode.R +++ b/R/process_lookup_postcode.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' postcode lookup, it will return the final data -#' but also write this out as an rds. +#' and (optionally) write it to disk. #' #' @param simd_path Path to SIMD lookup. #' @param locality_path Path to locality lookup. @@ -58,16 +58,14 @@ process_lookup_postcode <- function(spd_path = get_spd_path(), # Join data together ----------------------------------------------------- - data <- - dplyr::left_join(spd_file, simd_file, by = "pc7") %>% + data <- dplyr::left_join(spd_file, simd_file, by = "pc7") %>% dplyr::rename(postcode = "pc7") %>% dplyr::left_join(locality_file, by = "datazone2011") # Finalise output ----------------------------------------------------- - outfile <- - data %>% + slf_pc_lookup <- data %>% dplyr::select( "postcode", "lca", @@ -89,13 +87,12 @@ process_lookup_postcode <- function(spd_path = get_spd_path(), tidyselect::matches("ur2_\\d{4}$") ) - - # Save out ---------------------------------------------------------------- if (write_to_disk) { - outfile %>% - # Save .rds file - write_file(get_slf_postcode_path(check_mode = "write")) + write_file( + slf_pc_lookup, + get_slf_postcode_path(check_mode = "write") + ) } - return(outfile) + return(slf_pc_lookup) } diff --git a/R/process_lookup_sc_client.R b/R/process_lookup_sc_client.R index 1874c2b5a..87e6b107d 100644 --- a/R/process_lookup_sc_client.R +++ b/R/process_lookup_sc_client.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' social care client lookup, it will return the final data -#' but also write this out as an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param year The year to process @@ -108,10 +108,7 @@ process_lookup_sc_client <- function(data, year, write_to_disk = TRUE) { .fn = ~ paste0("sc_", .x) ) - - ## save outfile --------------------------------------- - outfile <- - client_clean %>% + sc_client_lookup <- client_clean %>% # reorder dplyr::select( "sending_location", @@ -125,10 +122,11 @@ process_lookup_sc_client <- function(data, year, write_to_disk = TRUE) { ) if (write_to_disk) { - # Save .rds file - outfile %>% - write_file(get_source_extract_path(year, "Client", check_mode = "write")) + write_file( + sc_client_lookup, + get_source_extract_path(year, "Client", check_mode = "write") + ) } - return(outfile) + return(sc_client_lookup) } diff --git a/R/process_lookup_sc_demographics.R b/R/process_lookup_sc_demographics.R index 4b0f7500f..8c363f547 100644 --- a/R/process_lookup_sc_demographics.R +++ b/R/process_lookup_sc_demographics.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' social care demographic lookup, it will return the final data -#' but also write this out as an rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process. #' @param spd_path Path to the Scottish Postcode Directory. @@ -12,7 +12,10 @@ #' @return the final data as a [tibble][tibble::tibble-package]. #' @export #' @family process extracts -process_lookup_sc_demographics <- function(data, spd_path = get_spd_path(), write_to_disk = TRUE) { +process_lookup_sc_demographics <- function( + data, + spd_path = get_spd_path(), + write_to_disk = TRUE) { # Deal with postcodes --------------------------------------- # UK postcode regex - see https://ideal-postcodes.co.uk/guides/postcode-validation @@ -51,8 +54,7 @@ process_lookup_sc_demographics <- function(data, spd_path = get_spd_path(), writ )) # count number of na postcodes - na_postcodes <- - sc_demog %>% + na_postcodes <- sc_demog %>% dplyr::count(dplyr::across(tidyselect::contains("postcode"), ~ is.na(.x))) sc_demog <- sc_demog %>% @@ -97,17 +99,11 @@ process_lookup_sc_demographics <- function(data, spd_path = get_spd_path(), writ dplyr::count(.data$postcode_type) # count number of replaced postcode - compare with count above - na_replaced_postcodes <- - sc_demog %>% + na_replaced_postcodes <- sc_demog %>% dplyr::count(dplyr::across(tidyselect::ends_with("_postcode"), ~ is.na(.x))) - na_replaced_postcodes - na_postcodes - - ## save outfile --------------------------------------- - outfile <- - sc_demog %>% + sc_demog_lookup <- sc_demog %>% # group by sending location and ID dplyr::group_by(.data$sending_location, .data$social_care_id) %>% # arrange so latest submissions are last @@ -126,14 +122,12 @@ process_lookup_sc_demographics <- function(data, spd_path = get_spd_path(), writ ) %>% dplyr::ungroup() - - ## save file ## - if (write_to_disk) { - # Save .rds file - outfile %>% - write_file(get_sc_demog_lookup_path(check_mode = "write")) + write_file( + sc_demog_lookup, + get_sc_demog_lookup_path(check_mode = "write") + ) } - return(outfile) + return(sc_demog_lookup) } diff --git a/R/process_sc_all_alarms_telecare.R b/R/process_sc_all_alarms_telecare.R index 61bce41b6..620b14cee 100644 --- a/R/process_sc_all_alarms_telecare.R +++ b/R/process_sc_all_alarms_telecare.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' all Alarms Telecare extract, it will return the final data -#' but also write this out as a rds. +#' and (optionally) write it to disk. #' #' @inheritParams process_sc_all_care_home #' @@ -121,9 +121,10 @@ process_sc_all_alarms_telecare <- function( tibble::as_tibble() if (write_to_disk) { - # Save .rds file ---- - qtr_merge %>% - write_file(get_sc_at_episodes_path(check_mode = "write")) + write_file( + qtr_merge, + get_sc_at_episodes_path(check_mode = "write") + ) } return(qtr_merge) diff --git a/R/process_sc_all_care_home.R b/R/process_sc_all_care_home.R index a11f275e8..c41e1a1d5 100644 --- a/R/process_sc_all_care_home.R +++ b/R/process_sc_all_care_home.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' all Care Home extract, it will return the final data -#' but also write this out as a rds. +#' and (optionally) write it to disk. #' #' @param data The extract to process #' @param sc_demog_lookup The Social Care Demographics lookup produced by diff --git a/R/process_sc_all_home_care.R b/R/process_sc_all_home_care.R index b812d492b..5f2b4db49 100644 --- a/R/process_sc_all_home_care.R +++ b/R/process_sc_all_home_care.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' all home care extract, it will return the final data -#' but also write this out as a rds. +#' and (optionally) write it to disk. #' #' @inheritParams process_sc_all_care_home #' diff --git a/R/process_sc_all_sds.R b/R/process_sc_all_sds.R index 068215a28..c17f74f28 100644 --- a/R/process_sc_all_sds.R +++ b/R/process_sc_all_sds.R @@ -1,7 +1,7 @@ #' Process the all SDS extract #' @description This will read and process the #' all SDS extract, it will return the final data -#' but also write this out as a rds. +#' and (optionally) write it to disk. #' #' @inheritParams process_sc_all_care_home #' @@ -119,12 +119,11 @@ process_sc_all_sds <- function( # change the data format from data.table to data.frame tibble::as_tibble() - - # Save outfile------------------------------------------------ if (write_to_disk) { - # Save .rds file - final_data %>% - write_file(get_sc_sds_episodes_path(check_mode = "write")) + write_file( + final_data, + get_sc_sds_episodes_path(check_mode = "write") + ) } return(final_data) diff --git a/R/read_extract_gp_ooh.R b/R/read_extract_gp_ooh.R index 98606eb8a..3a711c2f8 100644 --- a/R/read_extract_gp_ooh.R +++ b/R/read_extract_gp_ooh.R @@ -2,7 +2,7 @@ #' #' @description This will read and process the #' GP OoH extract, it will return the final data -#' but also write this out as an rds. +#' and (optionally) write it to disk. #' #' @param year The year to process, in FY format. #' @param diagnosis_path Path to diagnosis BOXI extract location. diff --git a/man/process_costs_ch_rmd.Rd b/man/process_costs_ch_rmd.Rd index 520898c9e..b990564b7 100644 --- a/man/process_costs_ch_rmd.Rd +++ b/man/process_costs_ch_rmd.Rd @@ -15,5 +15,5 @@ a \link[tibble:tibble-package]{tibble} containing the final cost data. \description{ This will read and process the care homes cost lookup, it will return the final data -but also write this out as a rds. +and write it to disk. } diff --git a/man/process_costs_dn_rmd.Rd b/man/process_costs_dn_rmd.Rd index bde475d5a..46bcd93dd 100644 --- a/man/process_costs_dn_rmd.Rd +++ b/man/process_costs_dn_rmd.Rd @@ -15,5 +15,5 @@ a \link[tibble:tibble-package]{tibble} containing the final cost data. \description{ This will read and process the District Nursing cost lookup, it will return the final data -but also write this out as a rds. +and write it to disk. } diff --git a/man/process_costs_gp_ooh_rmd.Rd b/man/process_costs_gp_ooh_rmd.Rd index fd71066c0..f5c611f11 100644 --- a/man/process_costs_gp_ooh_rmd.Rd +++ b/man/process_costs_gp_ooh_rmd.Rd @@ -15,5 +15,5 @@ a \link[tibble:tibble-package]{tibble} containing the final cost data. \description{ This will read and process the GP ooh cost lookup, it will return the final data -but also write this out as a rds. +and write it to disk. } diff --git a/man/process_costs_hc_rmd.Rd b/man/process_costs_hc_rmd.Rd index b15c311da..c3448bcbc 100644 --- a/man/process_costs_hc_rmd.Rd +++ b/man/process_costs_hc_rmd.Rd @@ -15,5 +15,5 @@ a \link[tibble:tibble-package]{tibble} containing the final cost data. \description{ This will read and process the Home Care cost lookup, it will return the final data -but also write this out as a rds. +and write it to disk. } diff --git a/man/process_extract_acute.Rd b/man/process_extract_acute.Rd index af6b85bfe..88264cf3d 100644 --- a/man/process_extract_acute.Rd +++ b/man/process_extract_acute.Rd @@ -20,7 +20,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the acute extract, it will return the final data -but also write this out as an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_ae.Rd b/man/process_extract_ae.Rd index 58878e689..b2f6954b7 100644 --- a/man/process_extract_ae.Rd +++ b/man/process_extract_ae.Rd @@ -20,7 +20,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the A&E extract, it will return the final data -but also write this out as an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_alarms_telecare.Rd b/man/process_extract_alarms_telecare.Rd index a6e61365d..5e37847b3 100644 --- a/man/process_extract_alarms_telecare.Rd +++ b/man/process_extract_alarms_telecare.Rd @@ -29,7 +29,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the (year specific) Alarms Telecare extract, it will return the final data -but also write this out as rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_care_home.Rd b/man/process_extract_care_home.Rd index f058ca787..03c1cd705 100644 --- a/man/process_extract_care_home.Rd +++ b/man/process_extract_care_home.Rd @@ -32,7 +32,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the (year specific) Care Home extract, it will return the final data -but also write this out as rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_cmh.Rd b/man/process_extract_cmh.Rd index 147651f37..52086848a 100644 --- a/man/process_extract_cmh.Rd +++ b/man/process_extract_cmh.Rd @@ -20,7 +20,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the CMH extract, it will return the final data -but also write this out as an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_delayed_discharges.Rd b/man/process_extract_delayed_discharges.Rd index ddc41ec46..f9a6b7439 100644 --- a/man/process_extract_delayed_discharges.Rd +++ b/man/process_extract_delayed_discharges.Rd @@ -20,7 +20,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the delayed discharges extract, it will return the final data -but also write this out as an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_district_nursing.Rd b/man/process_extract_district_nursing.Rd index 4d9383c2e..f2f466440 100644 --- a/man/process_extract_district_nursing.Rd +++ b/man/process_extract_district_nursing.Rd @@ -27,7 +27,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the District Nursing extract, it will return the final data -but also write this out an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_gp_ooh.Rd b/man/process_extract_gp_ooh.Rd index 8217f0d6f..f96e1dcf2 100644 --- a/man/process_extract_gp_ooh.Rd +++ b/man/process_extract_gp_ooh.Rd @@ -20,7 +20,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the GP OoH extract, it will return the final data -but also write this out an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_home_care.Rd b/man/process_extract_home_care.Rd index 4fef5ac14..8dc1ec6a7 100644 --- a/man/process_extract_home_care.Rd +++ b/man/process_extract_home_care.Rd @@ -24,7 +24,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the (year specific) Home Care extract, it will return the final data -but also write this out as rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_homelessness.Rd b/man/process_extract_homelessness.Rd index 7531f8f22..9b6eb9463 100644 --- a/man/process_extract_homelessness.Rd +++ b/man/process_extract_homelessness.Rd @@ -31,7 +31,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the homelessness extract, it will return the final data -and optionally write it out as rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_maternity.Rd b/man/process_extract_maternity.Rd index cd01e6931..8ff8d7014 100644 --- a/man/process_extract_maternity.Rd +++ b/man/process_extract_maternity.Rd @@ -20,7 +20,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the maternity extract, it will return the final data -but also write this out an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_mental_health.Rd b/man/process_extract_mental_health.Rd index 7159aae8b..4a7519d2d 100644 --- a/man/process_extract_mental_health.Rd +++ b/man/process_extract_mental_health.Rd @@ -20,7 +20,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the mental health extract, it will return the final data -but also write this out an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_ooh_consultations.Rd b/man/process_extract_ooh_consultations.Rd index d682197ca..029d951cb 100644 --- a/man/process_extract_ooh_consultations.Rd +++ b/man/process_extract_ooh_consultations.Rd @@ -17,7 +17,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the GP OOH Consultations extract, it will return the final data -but also write this out as an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_ooh_diagnosis.Rd b/man/process_extract_ooh_diagnosis.Rd index 2a962989a..864d4029f 100644 --- a/man/process_extract_ooh_diagnosis.Rd +++ b/man/process_extract_ooh_diagnosis.Rd @@ -17,7 +17,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the GP OOH Diagnosis extract, it will return the final data -but also write this out an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_ooh_outcomes.Rd b/man/process_extract_ooh_outcomes.Rd index 5b220e04a..186525ca3 100644 --- a/man/process_extract_ooh_outcomes.Rd +++ b/man/process_extract_ooh_outcomes.Rd @@ -17,7 +17,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the GP OOH Outcomes extract, it will return the final data -but also write this out as an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_outpatients.Rd b/man/process_extract_outpatients.Rd index c5e10abc8..721809c1e 100644 --- a/man/process_extract_outpatients.Rd +++ b/man/process_extract_outpatients.Rd @@ -20,7 +20,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the outpatients extract, it will return the final data -but also write this out as an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_prescribing.Rd b/man/process_extract_prescribing.Rd index cf294d95c..55b9eb242 100644 --- a/man/process_extract_prescribing.Rd +++ b/man/process_extract_prescribing.Rd @@ -20,7 +20,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the prescribing extract, it will return the final data -but also write this out as an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_extract_sds.Rd b/man/process_extract_sds.Rd index 7e8e44a38..14fe9cd0b 100644 --- a/man/process_extract_sds.Rd +++ b/man/process_extract_sds.Rd @@ -24,7 +24,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the (year specific) SDS extract, it will return the final data -but also write this out as rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_lookup_postcode.Rd b/man/process_lookup_postcode.Rd index 6ad56e5b3..19520b4e8 100644 --- a/man/process_lookup_postcode.Rd +++ b/man/process_lookup_postcode.Rd @@ -27,7 +27,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the postcode lookup, it will return the final data -but also write this out as an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_lookup_sc_client.Rd b/man/process_lookup_sc_client.Rd index e48426419..5daa569b3 100644 --- a/man/process_lookup_sc_client.Rd +++ b/man/process_lookup_sc_client.Rd @@ -20,7 +20,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the social care client lookup, it will return the final data -but also write this out as an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_lookup_sc_demographics.Rd b/man/process_lookup_sc_demographics.Rd index 6c00b4352..60478ab18 100644 --- a/man/process_lookup_sc_demographics.Rd +++ b/man/process_lookup_sc_demographics.Rd @@ -24,7 +24,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the social care demographic lookup, it will return the final data -but also write this out as an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_sc_all_alarms_telecare.Rd b/man/process_sc_all_alarms_telecare.Rd index 7e21407f9..8bbc1dce0 100644 --- a/man/process_sc_all_alarms_telecare.Rd +++ b/man/process_sc_all_alarms_telecare.Rd @@ -21,7 +21,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the all Alarms Telecare extract, it will return the final data -but also write this out as a rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_sc_all_care_home.Rd b/man/process_sc_all_care_home.Rd index 691fe51db..2c5d2c4ce 100644 --- a/man/process_sc_all_care_home.Rd +++ b/man/process_sc_all_care_home.Rd @@ -36,7 +36,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the all Care Home extract, it will return the final data -but also write this out as a rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_sc_all_home_care.Rd b/man/process_sc_all_home_care.Rd index d498514db..9a0b999af 100644 --- a/man/process_sc_all_home_care.Rd +++ b/man/process_sc_all_home_care.Rd @@ -21,7 +21,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the all home care extract, it will return the final data -but also write this out as a rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/process_sc_all_sds.Rd b/man/process_sc_all_sds.Rd index f2d6d8a1c..cca9d0fe5 100644 --- a/man/process_sc_all_sds.Rd +++ b/man/process_sc_all_sds.Rd @@ -21,7 +21,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the all SDS extract, it will return the final data -but also write this out as a rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: diff --git a/man/read_extract_gp_ooh.Rd b/man/read_extract_gp_ooh.Rd index eae6c52dc..73e6672d9 100644 --- a/man/read_extract_gp_ooh.Rd +++ b/man/read_extract_gp_ooh.Rd @@ -26,7 +26,7 @@ the final data as a \link[tibble:tibble-package]{tibble}. \description{ This will read and process the GP OoH extract, it will return the final data -but also write this out as an rds. +and (optionally) write it to disk. } \seealso{ Other process extracts: