diff --git a/R/fill_geographies.R b/R/fill_geographies.R index 28bab7fa2..58d001493 100644 --- a/R/fill_geographies.R +++ b/R/fill_geographies.R @@ -85,7 +85,7 @@ make_gpprac_lookup <- function(data) { } fill_postcode_geogs <- function(data) { - spd <- read_file(get_slf_postcode_path()) + slf_pc_lookup <- read_file(get_slf_postcode_path()) filled_postcodes <- dplyr::left_join( data, @@ -102,7 +102,7 @@ fill_postcode_geogs <- function(data) { ) %>% # Fill geographies dplyr::left_join( - spd, + slf_pc_lookup, by = "postcode", suffix = c("_old", "") ) %>% @@ -117,10 +117,11 @@ fill_postcode_geogs <- function(data) { cascade_geographies() %>% dplyr::mutate( hbrescode = dplyr::coalesce(.data$hb2018, .data$hbrescode), - hscp = dplyr::coalesce(.data$hscp2018, .data$hscp), - lca = dplyr::coalesce(.data$lca, .data$lca_old) + hscp2018 = dplyr::coalesce(.data$hscp2018, .data$hscp), + lca = dplyr::coalesce(.data$lca, .data$lca_old), + datazone2011 = dplyr::coalesce(.data$datazone2011, .data$datazone2011_old) ) %>% - dplyr::select(!c("hb2018", "hscp2018", "lca_old", "most_recent_postcode")) + dplyr::select(!c("hb2018", "hscp", "lca_old", "datazone2011_old", "most_recent_postcode")) return(filled_postcodes) } diff --git a/_targets.R b/_targets.R index 3625fa072..869d0d194 100644 --- a/_targets.R +++ b/_targets.R @@ -59,7 +59,8 @@ list( process_lookup_sc_demographics( sc_demog_data, write_to_disk = write_to_disk - ) + ), + priority = 0.9 ), tar_target( tests_sc_demog_lookup, @@ -70,7 +71,8 @@ list( process_it_chi_deaths( data = it_chi_deaths_extract, write_to_disk = write_to_disk - ) + ), + priority = 0.9 ), tar_target( tests_it_chi_deaths, @@ -83,7 +85,8 @@ list( gpprac_ref_path = gpprac_ref_path, spd_path = spd_path, write_to_disk = write_to_disk - ) + ), + priority = 0.9 ), tar_target( tests_source_gp_lookup, @@ -96,16 +99,17 @@ list( simd_path = simd_path, locality_path = locality_path, write_to_disk = write_to_disk - ) + ), + priority = 0.9 ), tar_target( tests_source_pc_lookup, process_tests_lookup_pc(source_pc_lookup) ), ## Cost Lookups ## - tar_target(ch_cost_lookup, process_costs_ch_rmd()), - tar_target(dn_cost_lookup, process_costs_dn_rmd()), - tar_target(hc_cost_lookup, process_costs_hc_rmd()), + tar_target(ch_cost_lookup, process_costs_ch_rmd(), priority = 0.8), + tar_target(dn_cost_lookup, process_costs_dn_rmd(), priority = 0.8), + tar_target(hc_cost_lookup, process_costs_hc_rmd(), priority = 0.8), tar_target(gp_ooh_cost_lookup, process_costs_gp_ooh_rmd()), ## Social Care - 'All' data ## tar_target( @@ -122,7 +126,8 @@ list( all_at_extract, sc_demog_lookup = sc_demog_lookup, write_to_disk = write_to_disk - ) + ), + priority = 0.5 ), tar_target( all_home_care_extract, @@ -138,7 +143,8 @@ list( all_home_care_extract, sc_demog_lookup = sc_demog_lookup, write_to_disk = write_to_disk - ) + ), + priority = 0.5 ), tar_target( all_care_home_extract, @@ -157,7 +163,8 @@ list( ch_name_lookup_path = slf_ch_name_lookup_path, spd_path = spd_path, write_to_disk = write_to_disk - ) + ), + priority = 0.5 ), tar_target( tests_all_care_home, @@ -177,7 +184,8 @@ list( all_sds_extract, sc_demog_lookup = sc_demog_lookup, write_to_disk = write_to_disk - ) + ), + priority = 0.5 ), tar_map( list(year = years_to_run), @@ -256,14 +264,14 @@ list( get_boxi_extract_path(year = year, type = "GP_OoH-c"), format = "file" ), - tar_target(ooh_data, + tar_qs( + ooh_data, read_extract_gp_ooh( year, diagnosis_data_path, outcomes_data_path, consultations_data_path - ), - format = "rds" + ) ), ### Target source processed extracts ### tar_target(source_acute_extract, process_extract_acute(