-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
all
social care extracts (#854)
addresses #842 Produces tests for social care `all` extracts. The data is the processed extract taken from the social care platform containing all years worth of data. Still to do: - Add these tests into the targets pipeline. (@SwiftySalmon happy to have a call with you to share how to do this!)
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#' Process Social Care Alarms Telecare all episodes tests | ||
#' | ||
#' @param data The processed Alarms Telecare all episode data produced by | ||
#' [process_sc_all_alarms_telecare()]. | ||
#' | ||
#' @description This script takes the processed all Alarms Telecare file and produces | ||
#' a test comparison with the previous data. | ||
#' | ||
#' @return a [tibble][tibble::tibble-package] containing a test comparison. | ||
#' | ||
#' @export | ||
process_tests_sc_all_at_episodes <- function(data) { | ||
comparison <- produce_test_comparison( | ||
old_data = produce_sc_all_episodes_tests( | ||
read_file(get_sc_at_episodes_path(update = previous_update())) | ||
), | ||
new_data = produce_sc_all_episodes_tests( | ||
data | ||
) | ||
) | ||
|
||
comparison %>% | ||
write_tests_xlsx(sheet_name = "all_at_episodes", workbook_name = "lookup") | ||
|
||
return(comparison) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#' Process Social Care Care Home all episodes tests | ||
#' | ||
#' @param data The processed Care Home all episode data produced by | ||
#' [process_extract_care_home()]. | ||
#' | ||
#' @description This script takes the processed all Care Home file and produces | ||
#' a test comparison with the previous data. | ||
#' | ||
#' @return a [tibble][tibble::tibble-package] containing a test comparison. | ||
#' | ||
#' @export | ||
process_tests_sc_all_ch_episodes <- function(data) { | ||
comparison <- produce_test_comparison( | ||
old_data = produce_sc_all_episodes_tests( | ||
read_file(get_sc_ch_episodes_path(update = previous_update())) | ||
), | ||
new_data = produce_sc_all_episodes_tests( | ||
data | ||
) | ||
) | ||
|
||
comparison %>% | ||
write_tests_xlsx(sheet_name = "all_ch_episodes", workbook_name = "lookup") | ||
|
||
return(comparison) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#' Process Social Care Home Care all episodes tests | ||
#' | ||
#' @param data The processed Home Care all episode data produced by | ||
#' [process_sc_all_home_care()]. | ||
#' | ||
#' @description This script takes the processed all Home Care file and produces | ||
#' a test comparison with the previous data. | ||
#' | ||
#' @return a [tibble][tibble::tibble-package] containing a test comparison. | ||
#' | ||
#' @export | ||
process_tests_sc_all_hc_episodes <- function(data) { | ||
comparison <- produce_test_comparison( | ||
old_data = produce_sc_all_episodes_tests( | ||
read_file(get_sc_hc_episodes_path(update = previous_update())) | ||
), | ||
new_data = produce_sc_all_episodes_tests( | ||
data | ||
) | ||
) | ||
|
||
comparison %>% | ||
write_tests_xlsx(sheet_name = "all_hc_episodes", workbook_name = "lookup") | ||
|
||
return(comparison) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#' Process Social Care SDS all episodes tests | ||
#' | ||
#' @param data The processed SDS all episode data produced by | ||
#' [process_sc_all_sds()]. | ||
#' | ||
#' @description This script takes the processed all SDS file and produces | ||
#' a test comparison with the previous data. | ||
#' | ||
#' @return a [tibble][tibble::tibble-package] containing a test comparison. | ||
#' | ||
#' @export | ||
process_tests_sc_all_sds_episodes <- function(data) { | ||
comparison <- produce_test_comparison( | ||
old_data = produce_sc_all_episodes_tests( | ||
read_file(get_sc_sds_episodes_path(update = previous_update())) | ||
), | ||
new_data = produce_sc_all_episodes_tests( | ||
data | ||
) | ||
) | ||
|
||
comparison %>% | ||
write_tests_xlsx(sheet_name = "all_sds_episodes", workbook_name = "lookup") | ||
|
||
return(comparison) | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#' Social care All Episodes Tests | ||
#' | ||
#' @description Produce the test for the social care all episodes | ||
#' | ||
#' @param data new or old data for testing summary flags | ||
#' | ||
#' @return a dataframe with a count of each flag. | ||
#' | ||
#' @family social care test functions | ||
produce_sc_all_episodes_tests <- function(data) { | ||
data %>% | ||
# create test flags | ||
create_demog_test_flags() %>% | ||
dplyr::mutate( | ||
n_missing_sending_loc = dplyr::if_else( | ||
is.na(.data$sending_location), | ||
1L, | ||
0L | ||
), | ||
n_missing_sc_id = dplyr::if_else( | ||
is_missing(.data$social_care_id), | ||
1L, | ||
0L | ||
) | ||
) %>% | ||
# keep variables for comparison | ||
dplyr::select(c("valid_chi":dplyr::last_col())) %>% | ||
# use function to sum new test flags | ||
calculate_measures(measure = "sum") | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.