diff --git a/R/check_year_valid.R b/R/check_year_valid.R index 217aa1c2b..da257ff4c 100644 --- a/R/check_year_valid.R +++ b/R/check_year_valid.R @@ -17,6 +17,7 @@ check_year_valid <- function( "ch", "client", "cmh", + "cost_dna", "dd", "deaths", "dn", @@ -34,9 +35,9 @@ check_year_valid <- function( )) { if (year <= "1415" && type %in% c("dn", "sparra")) { return(FALSE) - } else if (year <= "1516" && type %in% c("cmh", "homelessness")) { + } else if (year <= "1516" && type %in% c("cmh", "homelessness", "dd")) { return(FALSE) - } else if (year <= "1617" && type %in% c("ch", "hc", "sds", "at")) { + } else if (year <= "1617" && type %in% c("ch", "hc", "sds", "at", "client", "cost_dna")) { return(FALSE) } else if (year <= "1718" && type %in% "hhg") { return(FALSE) diff --git a/R/create_episode_file.R b/R/create_episode_file.R index dd22dbc1d..ecb6fc126 100644 --- a/R/create_episode_file.R +++ b/R/create_episode_file.R @@ -175,7 +175,65 @@ create_episode_file <- function( sc_social_worker = NA, sc_type_of_housing = NA, sc_meals = NA, - sc_day_care = NA + sc_day_care = NA, + social_care_id = NA, + sc_dementia = NA, + sc_learning_disability = NA, + sc_mental_health_disorders = NA, + sc_physical_and_sensory_disability = NA, + sc_drugs = NA, + sc_alcohol = NA, + sc_palliative_care = NA, + sc_carer = NA, + sc_elderly_frail = NA, + sc_neurological_condition = NA, + sc_autism = NA, + sc_other_vulnerable_groups = NA, + ch_provider_description = NA + ) + } + + if (!check_year_valid(year, type = "homelessness")) { + episode_file <- episode_file %>% + dplyr::mutate( + hl1_12_months_post_app = NA, + hl1_12_months_pre_app = NA, + hl1_6after_ep = NA, + hl1_6before_ep = NA, + hl1_application_ref = NA, + hl1_completeness = NA, + hl1_during_ep = NA, + hl1_in_fy = NA, + hl1_property_type = NA, + hl1_reason_ftm = NA, + hl1_sending_lca = NA + ) + } + + if (!check_year_valid(year, type = "dd")) { + episode_file <- episode_file %>% + dplyr::mutate( + cij_delay = NA, + dd_quality = NA, + dd_responsible_lca = NA, + delay_end_reason = NA, + primary_delay_reason = NA, + secondary_delay_reason = NA, + ) + } + + if (!check_year_valid(year, type = "dn")) { + episode_file <- episode_file %>% + dplyr::mutate( + ccm = NA, + total_no_dn_contacts = NA + ) + } + + if (!check_year_valid(year, type = "cost_dna")) { + episode_file <- episode_file %>% + dplyr::mutate( + cost_total_net_inc_dnas = NA ) } @@ -471,6 +529,11 @@ join_sc_client <- function(data, 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) + } + if (file_type == "episode") { # Match on client variables by chi data_file <- data %>% diff --git a/R/create_individual_file.R b/R/create_individual_file.R index f826294d1..273761efc 100644 --- a/R/create_individual_file.R +++ b/R/create_individual_file.R @@ -115,6 +115,9 @@ create_individual_file <- function( hc_personal_hours = NA, hc_non_personal_hours = NA, hc_reablement_hours = NA, + hc_non_personal_hours_cost = NA, + hc_personal_hours_cost = NA, + hc_reablement_hours_cost = NA, at_alarms = NA, at_telecare = NA, sds_option_1 = NA, @@ -125,10 +128,33 @@ create_individual_file <- function( sc_support_from_unpaid_carer = NA, sc_social_worker = NA, sc_meals = NA, - sc_day_care = NA + sc_day_care = NA, + sc_type_of_housing = NA, + count_not_known = NA, + sc_latest_submission = NA, + social_care_id = NA, + person_id = NA, + sc_alcohol = NA, + sc_autism = NA, + sc_carer = NA, + sc_dementia = NA, + sc_drugs = NA, + sc_elderly_frail = NA, + sc_learning_disability = NA, + sc_mental_health_disorders = NA, + sc_neurological_condition = NA, + sc_other_vulnerable_groups = NA, + sc_palliative_care = NA, + sc_physical_and_sensory_disability = NA ) } + if (!check_year_valid(year, type = "homelessness")) { + individual_file <- individual_file %>% + dplyr::mutate(hl1_in_fy = NA) + } + + if (anon_chi_out) { individual_file <- individual_file %>% tidyr::replace_na(list(chi = "")) %>% diff --git a/R/get_boxi_extract_path.R b/R/get_boxi_extract_path.R index a1c59b4f2..9c21cabe9 100644 --- a/R/get_boxi_extract_path.R +++ b/R/get_boxi_extract_path.R @@ -86,9 +86,11 @@ get_boxi_extract_path <- function( #' #' @return an [fs::path()] to a dummy file which can be used with targets. get_dummy_boxi_extract_path <- function() { - get_file_path( + dummy_path <- get_file_path( directory = get_dev_dir(), file_name = ".dummy", create = TRUE ) + + return(dummy_path) } diff --git a/R/get_sc_lookup_paths.R b/R/get_sc_lookup_paths.R index d201f416f..90a08e7e1 100644 --- a/R/get_sc_lookup_paths.R +++ b/R/get_sc_lookup_paths.R @@ -38,11 +38,18 @@ get_sc_demog_lookup_path <- function(update = latest_update(), ...) { #' @family social care lookup file paths #' @seealso [get_file_path()] for the generic function. get_sc_client_lookup_path <- function(year, update = latest_update(), ...) { - sc_client_lookup_path <- get_file_path( - directory = fs::path(get_slf_dir(), "Social_care", "processed_sc_client_lookup"), - file_name = stringr::str_glue("anon-sc_client_lookup_{year}_{update}.parquet"), - ... - ) - - return(sc_client_lookup_path) + if (!check_year_valid(year, type = "client")) { + return(get_dummy_boxi_extract_path()) + } else { + sc_client_lookup_path <- get_file_path( + directory = fs::path( + get_slf_dir(), + "Social_care", + "processed_sc_client_lookup" + ), + file_name = stringr::str_glue("anon-sc_client_lookup_{year}_{update}.parquet"), + ... + ) + return(sc_client_lookup_path) + } } diff --git a/R/link_delayed_discharge_eps.R b/R/link_delayed_discharge_eps.R index b80b35807..d4162b619 100644 --- a/R/link_delayed_discharge_eps.R +++ b/R/link_delayed_discharge_eps.R @@ -14,8 +14,12 @@ link_delayed_discharge_eps <- function( 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()}") - names_ep <- names(episode_file) + if (!check_year_valid(year, type = "dd")) { + episode_file <- episode_file + return(episode_file) + } + names_ep <- names(episode_file) episode_file <- episode_file %>% dplyr::mutate( # remember to revoke the cij_end_date with dummy_cij_end @@ -370,7 +374,7 @@ link_delayed_discharge_eps <- function( delay_dd, cij_delay )) %>% - dplyr::select(-c("has_dd", "delay_dd")) + dplyr::select(-c("has_dd", "delay_dd", "original_admission_date", "amended_dates")) return(linked_data) } diff --git a/R/process_lookup_homelessness.R b/R/process_lookup_homelessness.R index 5341cf2b6..30772383e 100644 --- a/R/process_lookup_homelessness.R +++ b/R/process_lookup_homelessness.R @@ -15,6 +15,10 @@ create_homelessness_lookup <- function( 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) + } homelessness_lookup <- homelessness_data %>% dplyr::distinct(.data$chi, .data$record_keydate1, .data$record_keydate2) %>% tidyr::drop_na(.data$chi) %>% @@ -39,6 +43,11 @@ 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) + } + data <- data %>% dplyr::left_join( lookup %>% @@ -65,6 +74,11 @@ add_homelessness_flag <- function(data, year, 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) + } + lookup <- lookup %>% dplyr::filter(!(is.na(.data$record_keydate2))) %>% dplyr::rename( diff --git a/R/process_lookup_sc_client.R b/R/process_lookup_sc_client.R index b8fc2fb6d..91c08632d 100644 --- a/R/process_lookup_sc_client.R +++ b/R/process_lookup_sc_client.R @@ -20,6 +20,11 @@ process_lookup_sc_client <- slfhelper::get_chi() %>% dplyr::select(c("sending_location", "social_care_id", "chi", "latest_flag")), write_to_disk = TRUE) { + # Specify years available for running + if (year < "1718") { + return(NULL) + } + # Match to demographics lookup to get CHI sc_client_demographics <- data %>% dplyr::right_join( diff --git a/R/read_file.R b/R/read_file.R index 022f4cc26..3d174606c 100644 --- a/R/read_file.R +++ b/R/read_file.R @@ -24,7 +24,7 @@ read_file <- function(path, col_select = NULL, as_data_frame = TRUE, ...) { # Return an empty tibble if trying to read the dummy path if (path == get_dummy_boxi_extract_path()) { - return(tibble::tibble()) + return(tibble::tibble(anon_chi = NA_character_)) } ext <- fs::path_ext(path) diff --git a/R/replace_sc_id_with_latest.R b/R/replace_sc_id_with_latest.R index 215816753..f15808f1e 100644 --- a/R/replace_sc_id_with_latest.R +++ b/R/replace_sc_id_with_latest.R @@ -7,33 +7,23 @@ replace_sc_id_with_latest <- function(data) { # Check for required variables check_variables_exist( data, - c("sending_location", "social_care_id", "chi", "period") + c("sending_location", "social_care_id", "chi", "latest_flag") ) # select variables we need filter_data <- data %>% dplyr::select( - "sending_location", "social_care_id", "chi", "period" + "sending_location", "social_care_id", "chi", "latest_flag" ) %>% - dplyr::filter(!(is.na(.data$chi))) + dplyr::filter(!(is.na(.data$chi))) %>% + dplyr::distinct() change_sc_id <- filter_data %>% - # Sort (by sending_location, chi and period) for unique chi/sending location - dplyr::arrange( - .data$sending_location, - .data$chi, - dplyr::desc(.data$period) - ) %>% - # Find the latest sc_id for each chi/sending location by keeping latest period - dplyr::distinct( - .data$sending_location, - .data$chi, - .keep_all = TRUE - ) %>% + dplyr::filter(latest_flag == 1) %>% # Rename for latest sc id dplyr::rename(latest_sc_id = "social_care_id") %>% - # drop period for matching - dplyr::select(-"period") + # drop latest_flag for matching + dplyr::select(-"latest_flag") return_data <- change_sc_id %>% # Match back onto data @@ -41,6 +31,7 @@ replace_sc_id_with_latest <- function(data) { by = c("sending_location", "chi"), multiple = "all" ) %>% + dplyr::filter(!(is.na(period))) %>% # Overwrite sc id with the latest dplyr::mutate( social_care_id = dplyr::if_else( diff --git a/R/write_tests_xlsx.R b/R/write_tests_xlsx.R index 6847cc977..a1b53f971 100644 --- a/R/write_tests_xlsx.R +++ b/R/write_tests_xlsx.R @@ -121,6 +121,14 @@ write_tests_xlsx <- function(comparison_data, date_today <- stringr::str_to_lower(date_today) + sheet_name_dated <- ifelse( + is.null(year), + stringr::str_glue("{sheet_name}_{date_today}"), + stringr::str_glue("{year}_{sheet_name}_{date_today}") + ) + + date_today <- stringr::str_to_lower(date_today) + if (is.null(year)) { sheet_name_dated <- stringr::str_glue("{sheet_name}_{date_today}") } else { diff --git a/Run_SLF_Files_manually/run_episode_file_1415.R b/Run_SLF_Files_manually/run_episode_file_1415.R new file mode 100644 index 000000000..b5a2eab38 --- /dev/null +++ b/Run_SLF_Files_manually/run_episode_file_1415.R @@ -0,0 +1,79 @@ +library(targets) +library(createslf) + +year <- "1415" + +targets_store <- fs::path("/conf/sourcedev/Source_Linkage_File_Updates/", "_targets") + +processed_data_list <- list( + acute = targets::tar_read( + "source_acute_extract_1415", + store = targets_store + ), + ae = targets::tar_read( + "source_ae_extract_1415", + store = targets_store + ), + cmh = targets::tar_read( + "source_cmh_extract_1415", + store = targets_store + ), + cmh = targets::tar_read( + "source_cmh_extract_1415", + store = targets_store + ), + dn = targets::tar_read( + "source_dn_extract_1415", + store = targets_store + ), + deaths = targets::tar_read( + "source_nrs_deaths_extract_1415", + store = targets_store + ), + homelessness = targets::tar_read( + "source_homelessness_extract_1415", + store = targets_store + ), + maternity = targets::tar_read( + "source_maternity_extract_1415", + store = targets_store + ), + mental_health = targets::tar_read( + "source_mental_health_extract_1415", + store = targets_store + ), + outpatients = targets::tar_read( + "source_outpatients_extract_1415", + store = targets_store + ), + gp_ooh = targets::tar_read( + "source_ooh_extract_1415", + store = targets_store + ), + prescribing = targets::tar_read( + "source_prescribing_extract_1415", + store = targets_store + ), + care_home = targets::tar_read( + "source_sc_care_home_1415", + store = targets_store + ), + home_care = targets::tar_read( + "source_sc_home_care_1415", + store = targets_store + ), + at = targets::tar_read( + "source_sc_alarms_tele_1415", + store = targets_store + ), + sds = targets::tar_read( + "source_sc_sds_1415", + store = targets_store + ) +) + +# Run episode file +create_episode_file(processed_data_list, year = year) %>% + process_tests_episode_file(year = year) + +## End of Script ## diff --git a/Run_SLF_Files_manually/run_episode_file_1516.R b/Run_SLF_Files_manually/run_episode_file_1516.R new file mode 100644 index 000000000..59c7ddc63 --- /dev/null +++ b/Run_SLF_Files_manually/run_episode_file_1516.R @@ -0,0 +1,79 @@ +library(targets) +library(createslf) + +year <- "1516" + +targets_store <- fs::path("/conf/sourcedev/Source_Linkage_File_Updates/", "_targets") + +processed_data_list <- list( + acute = targets::tar_read( + "source_acute_extract_1516", + store = targets_store + ), + ae = targets::tar_read( + "source_ae_extract_1516", + store = targets_store + ), + cmh = targets::tar_read( + "source_cmh_extract_1516", + store = targets_store + ), + cmh = targets::tar_read( + "source_cmh_extract_1516", + store = targets_store + ), + dn = targets::tar_read( + "source_dn_extract_1516", + store = targets_store + ), + deaths = targets::tar_read( + "source_nrs_deaths_extract_1516", + store = targets_store + ), + homelessness = targets::tar_read( + "source_homelessness_extract_1516", + store = targets_store + ), + maternity = targets::tar_read( + "source_maternity_extract_1516", + store = targets_store + ), + mental_health = targets::tar_read( + "source_mental_health_extract_1516", + store = targets_store + ), + outpatients = targets::tar_read( + "source_outpatients_extract_1516", + store = targets_store + ), + gp_ooh = targets::tar_read( + "source_ooh_extract_1516", + store = targets_store + ), + prescribing = targets::tar_read( + "source_prescribing_extract_1516", + store = targets_store + ), + care_home = targets::tar_read( + "source_sc_care_home_1516", + store = targets_store + ), + home_care = targets::tar_read( + "source_sc_home_care_1516", + store = targets_store + ), + at = targets::tar_read( + "source_sc_alarms_tele_1516", + store = targets_store + ), + sds = targets::tar_read( + "source_sc_sds_1516", + store = targets_store + ) +) + +# Run episode file +create_episode_file(processed_data_list, year = year) ## %>% +# process_tests_episode_file(year = year) + +## End of Script ## diff --git a/Run_SLF_Files_manually/run_episode_file_1617.R b/Run_SLF_Files_manually/run_episode_file_1617.R new file mode 100644 index 000000000..b10372be6 --- /dev/null +++ b/Run_SLF_Files_manually/run_episode_file_1617.R @@ -0,0 +1,79 @@ +library(targets) +library(createslf) + +year <- "1617" + +targets_store <- fs::path("/conf/sourcedev/Source_Linkage_File_Updates/", "_targets") + +processed_data_list <- list( + acute = targets::tar_read( + "source_acute_extract_1617", + store = targets_store + ), + ae = targets::tar_read( + "source_ae_extract_1617", + store = targets_store + ), + cmh = targets::tar_read( + "source_cmh_extract_1617", + store = targets_store + ), + cmh = targets::tar_read( + "source_cmh_extract_1617", + store = targets_store + ), + dn = targets::tar_read( + "source_dn_extract_1617", + store = targets_store + ), + deaths = targets::tar_read( + "source_nrs_deaths_extract_1617", + store = targets_store + ), + homelessness = targets::tar_read( + "source_homelessness_extract_1617", + store = targets_store + ), + maternity = targets::tar_read( + "source_maternity_extract_1617", + store = targets_store + ), + mental_health = targets::tar_read( + "source_mental_health_extract_1617", + store = targets_store + ), + outpatients = targets::tar_read( + "source_outpatients_extract_1617", + store = targets_store + ), + gp_ooh = targets::tar_read( + "source_ooh_extract_1617", + store = targets_store + ), + prescribing = targets::tar_read( + "source_prescribing_extract_1617", + store = targets_store + ), + care_home = targets::tar_read( + "source_sc_care_home_1617", + store = targets_store + ), + home_care = targets::tar_read( + "source_sc_home_care_1617", + store = targets_store + ), + at = targets::tar_read( + "source_sc_alarms_tele_1617", + store = targets_store + ), + sds = targets::tar_read( + "source_sc_sds_1617", + store = targets_store + ) +) + +# Run episode file +create_episode_file(processed_data_list, year = year) ## %>% +# process_tests_episode_file(year = year) + +## End of Script ## diff --git a/Run_SLF_Files_manually/run_individual_file_1415.R b/Run_SLF_Files_manually/run_individual_file_1415.R new file mode 100644 index 000000000..70aa2bfca --- /dev/null +++ b/Run_SLF_Files_manually/run_individual_file_1415.R @@ -0,0 +1,9 @@ +library(createslf) + +year <- "1415" + +episode_file <- arrow::read_parquet(get_slf_episode_path(year)) + +# Run individual file +create_individual_file(episode_file, year = year) %>% + process_tests_individual_file(year = year) diff --git a/Run_SLF_Files_manually/run_individual_file_1516.R b/Run_SLF_Files_manually/run_individual_file_1516.R new file mode 100644 index 000000000..8e8dae906 --- /dev/null +++ b/Run_SLF_Files_manually/run_individual_file_1516.R @@ -0,0 +1,9 @@ +library(createslf) + +year <- "1516" + +episode_file <- arrow::read_parquet(get_slf_episode_path(year)) + +# Run individual file +create_individual_file(episode_file, year = year) %>% + process_tests_individual_file(year = year) diff --git a/Run_SLF_Files_manually/run_individual_file_1617.R b/Run_SLF_Files_manually/run_individual_file_1617.R new file mode 100644 index 000000000..255e4e674 --- /dev/null +++ b/Run_SLF_Files_manually/run_individual_file_1617.R @@ -0,0 +1,9 @@ +library(createslf) + +year <- "1617" + +episode_file <- arrow::read_parquet(get_slf_episode_path(year)) + +# Run individual file +create_individual_file(episode_file, year = year) %>% + process_tests_individual_file(year = year) diff --git a/Run_SLF_Files_targets/run_targets_1415.R b/Run_SLF_Files_targets/run_targets_1415.R new file mode 100644 index 000000000..a37068c0d --- /dev/null +++ b/Run_SLF_Files_targets/run_targets_1415.R @@ -0,0 +1,9 @@ +library(targets) + +year <- "1415" + +# use targets for the process until testing episode files +tar_make_future( + # it does not recognise `contains(year)` + names = (targets::contains("1415")) +) diff --git a/Run_SLF_Files_targets/run_targets_1516.R b/Run_SLF_Files_targets/run_targets_1516.R new file mode 100644 index 000000000..7930d5bb5 --- /dev/null +++ b/Run_SLF_Files_targets/run_targets_1516.R @@ -0,0 +1,9 @@ +library(targets) + +year <- "1516" + +# use targets for the process until testing episode files +tar_make_future( + # it does not recognise `contains(year)` + names = (targets::contains("1516")) +) diff --git a/Run_SLF_Files_targets/run_targets_1617.R b/Run_SLF_Files_targets/run_targets_1617.R new file mode 100644 index 000000000..16361f71e --- /dev/null +++ b/Run_SLF_Files_targets/run_targets_1617.R @@ -0,0 +1,9 @@ +library(targets) + +year <- "1617" + +# use targets for the process until testing episode files +tar_make_future( + # it does not recognise `contains(year)` + names = (targets::contains("1617")) +) diff --git a/man/check_year_valid.Rd b/man/check_year_valid.Rd index 91c29861e..59960da30 100644 --- a/man/check_year_valid.Rd +++ b/man/check_year_valid.Rd @@ -6,9 +6,9 @@ \usage{ check_year_valid( year, - type = c("acute", "ae", "at", "ch", "client", "cmh", "dd", "deaths", "dn", "gpooh", - "hc", "homelessness", "hhg", "maternity", "mh", "nsu", "outpatients", "pis", "sds", - "sparra") + type = c("acute", "ae", "at", "ch", "client", "cmh", "cost_dna", "dd", "deaths", "dn", + "gpooh", "hc", "homelessness", "hhg", "maternity", "mh", "nsu", "outpatients", "pis", + "sds", "sparra") ) } \arguments{ diff --git a/run_targets_1718.R b/run_targets_1718.R new file mode 100644 index 000000000..488918e1d --- /dev/null +++ b/run_targets_1718.R @@ -0,0 +1,20 @@ +library(targets) + +Sys.setenv("CREATESLF_KEYRING_PASS" = "createslf") + +year <- "1718" + +# use targets for the process until testing episode files +tar_make_future( + # it does not recognise `contains(year)` + names = (targets::contains("1718")) +) + +# use targets to create individual files due to RAM limit +library(createslf) + +episode_file <- arrow::read_parquet(get_slf_episode_path(year)) + +# Run individual file +create_individual_file(episode_file, year = year) %>% + process_tests_individual_file(year = year) diff --git a/run_targets_1819.R b/run_targets_1819.R new file mode 100644 index 000000000..7c63807e8 --- /dev/null +++ b/run_targets_1819.R @@ -0,0 +1,20 @@ +library(targets) + +Sys.setenv("CREATESLF_KEYRING_PASS" = "createslf") + +year <- "1819" + +# use targets for the process until testing episode files +tar_make_future( + # it does not recognise `contains(year)` + names = (targets::contains("1819")) +) + +# use targets to create individual files due to RAM limit +library(createslf) + +episode_file <- arrow::read_parquet(get_slf_episode_path(year)) + +# Run individual file +create_individual_file(episode_file, year = year) %>% + process_tests_individual_file(year = year) diff --git a/run_targets_1920.R b/run_targets_1920.R new file mode 100644 index 000000000..d3361a34c --- /dev/null +++ b/run_targets_1920.R @@ -0,0 +1,20 @@ +library(targets) + +Sys.setenv("CREATESLF_KEYRING_PASS" = "createslf") + +year <- "1920" + +# use targets for the process until testing episode files +tar_make_future( + # it does not recognise `contains(year)` + names = (targets::contains("1920")) +) + +# use targets to create individual files due to RAM limit +library(createslf) + +episode_file <- arrow::read_parquet(get_slf_episode_path(year)) + +# Run individual file +create_individual_file(episode_file, year = year) %>% + process_tests_individual_file(year = year) diff --git a/run_targets_2021.R b/run_targets_2021.R new file mode 100644 index 000000000..efcfaed7a --- /dev/null +++ b/run_targets_2021.R @@ -0,0 +1,20 @@ +library(targets) + +Sys.setenv("CREATESLF_KEYRING_PASS" = "createslf") + +year <- "2021" + +# use targets for the process until testing episode files +tar_make_future( + # it does not recognise `contains(year)` + names = (targets::contains("2021")) +) + +# use targets to create individual files due to RAM limit +library(createslf) + +episode_file <- arrow::read_parquet(get_slf_episode_path(year)) + +# Run individual file +create_individual_file(episode_file, year = year) %>% + process_tests_individual_file(year = year) diff --git a/run_targets_2122.R b/run_targets_2122.R new file mode 100644 index 000000000..e92d75c7d --- /dev/null +++ b/run_targets_2122.R @@ -0,0 +1,20 @@ +library(targets) + +Sys.setenv("CREATESLF_KEYRING_PASS" = "createslf") + +year <- "2122" + +# use targets for the process until testing episode files +tar_make_future( + # it does not recognise `contains(year)` + names = (targets::contains("2122")) +) + +# use targets to create individual files due to RAM limit +library(createslf) + +episode_file <- arrow::read_parquet(get_slf_episode_path(year)) + +# Run individual file +create_individual_file(episode_file, year = year) %>% + process_tests_individual_file(year = year) diff --git a/run_targets_2223.R b/run_targets_2223.R new file mode 100644 index 000000000..f5c93ee2f --- /dev/null +++ b/run_targets_2223.R @@ -0,0 +1,20 @@ +library(targets) + +Sys.setenv("CREATESLF_KEYRING_PASS" = "createslf") + +year <- "2223" + +# use targets for the process until testing episode files +tar_make_future( + # it does not recognise `contains(year)` + names = (targets::contains("2223")) +) + +# use targets to create individual files due to RAM limit +library(createslf) + +episode_file <- arrow::read_parquet(get_slf_episode_path(year)) + +# Run individual file +create_individual_file(episode_file, year = year) %>% + process_tests_individual_file(year = year) diff --git a/run_targets_2324.R b/run_targets_2324.R new file mode 100644 index 000000000..5e3885bc2 --- /dev/null +++ b/run_targets_2324.R @@ -0,0 +1,20 @@ +library(targets) + +Sys.setenv("CREATESLF_KEYRING_PASS" = "createslf") + +year <- "2324" + +# use targets for the process until testing episode files +tar_make_future( + # it does not recognise `contains(year)` + names = (targets::contains("2324")) +) + +# use targets to create individual files due to RAM limit +library(createslf) + +episode_file <- arrow::read_parquet(get_slf_episode_path(year)) + +# Run individual file +create_individual_file(episode_file, year = year) %>% + process_tests_individual_file(year = year)