Skip to content

Commit

Permalink
Remove incorrect references to rds
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
Moohan committed Aug 10, 2023
1 parent 04399a4 commit 3d459f5
Show file tree
Hide file tree
Showing 58 changed files with 145 additions and 165 deletions.
18 changes: 12 additions & 6 deletions R/process_costs_rmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)}}."
)
}

Expand All @@ -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"
)

Expand All @@ -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.
#'
Expand All @@ -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
#'
Expand All @@ -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
#'
Expand All @@ -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
#'
Expand Down
15 changes: 7 additions & 8 deletions R/process_extract_acute.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
}
15 changes: 7 additions & 8 deletions R/process_extract_ae.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion R/process_extract_alarms_telecare.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
#'
Expand Down
2 changes: 1 addition & 1 deletion R/process_extract_care_home.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 7 additions & 8 deletions R/process_extract_cmh.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand All @@ -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)
}
2 changes: 1 addition & 1 deletion R/process_extract_consultations.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion R/process_extract_delayed_discharges.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion R/process_extract_district_nursing.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion R/process_extract_gp_ooh.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion R/process_extract_home_care.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
#'
Expand Down
2 changes: 1 addition & 1 deletion R/process_extract_homelessness.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 7 additions & 11 deletions R/process_extract_maternity.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
}
16 changes: 7 additions & 9 deletions R/process_extract_mental_health.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion R/process_extract_ooh_diagnosis.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion R/process_extract_ooh_outcomes.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 7 additions & 12 deletions R/process_extract_outpatients.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
}
9 changes: 5 additions & 4 deletions R/process_extract_prescribing.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 3d459f5

Please sign in to comment.