From fd2bb2cba4eda28335573d4cdb3641f5acb72708 Mon Sep 17 00:00:00 2001 From: Jennifer Thom Date: Fri, 14 Jul 2023 11:22:07 +0100 Subject: [PATCH 1/6] rename `hscp` to `hscp2018` --- R/fill_geographies.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/fill_geographies.R b/R/fill_geographies.R index 22b3f03ba..d3f27f793 100644 --- a/R/fill_geographies.R +++ b/R/fill_geographies.R @@ -117,7 +117,7 @@ fill_postcode_geogs <- function(data) { cascade_geographies() %>% dplyr::mutate( hbrescode = dplyr::coalesce(.data$hb2018, .data$hbrescode), - hscp = dplyr::coalesce(.data$hscp2018, .data$hscp), + hscp2018 = dplyr::coalesce(.data$hscp2018, .data$hscp), lca = dplyr::coalesce(.data$lca, .data$lca_old) ) %>% dplyr::select(!c("hb2018", "hscp2018", "lca_old", "most_recent_postcode")) From dd8859dc19f8413d9b699b0e7637d593b96f96f1 Mon Sep 17 00:00:00 2001 From: Jennifer Thom Date: Mon, 17 Jul 2023 11:37:55 +0100 Subject: [PATCH 2/6] rename `spd` as `slf_pc_lookup` --- R/fill_geographies.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/fill_geographies.R b/R/fill_geographies.R index d3f27f793..b01753ac0 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", "") ) %>% From abacf92f0093733dc7c5b63ee86e00e159d1e1b0 Mon Sep 17 00:00:00 2001 From: Jennifer Thom Date: Mon, 17 Jul 2023 11:41:44 +0100 Subject: [PATCH 3/6] Add `datazone2011` to coalesce code --- R/fill_geographies.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/fill_geographies.R b/R/fill_geographies.R index b01753ac0..8c8c55b10 100644 --- a/R/fill_geographies.R +++ b/R/fill_geographies.R @@ -118,7 +118,8 @@ fill_postcode_geogs <- function(data) { dplyr::mutate( hbrescode = dplyr::coalesce(.data$hb2018, .data$hbrescode), hscp2018 = dplyr::coalesce(.data$hscp2018, .data$hscp), - lca = dplyr::coalesce(.data$lca, .data$lca_old) + 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")) From 61239758ac2180f541f6c72234967c5d261622da Mon Sep 17 00:00:00 2001 From: Jennifer Thom Date: Mon, 17 Jul 2023 12:05:12 +0100 Subject: [PATCH 4/6] Rename `datazone` to `datazone2011` --- R/fill_geographies.R | 2 +- R/process_extract_acute.R | 2 +- R/process_extract_district_nursing.R | 2 +- R/process_extract_gp_ooh.R | 2 +- R/process_extract_mental_health.R | 2 +- R/read_extract_acute.R | 2 +- R/read_extract_district_nursing.R | 2 +- R/read_extract_mental_health.R | 2 +- R/read_extract_nrs_deaths.R | 2 +- R/read_extract_ooh_consultations.R | 2 +- R/run_episode_file.R | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/R/fill_geographies.R b/R/fill_geographies.R index 22b3f03ba..28bab7fa2 100644 --- a/R/fill_geographies.R +++ b/R/fill_geographies.R @@ -14,7 +14,7 @@ fill_geographies <- function(data) { "hbrescode", "hscp", "lca", - "datazone", + "datazone2011", "hbpraccode", "hbtreatcode", "gpprac" diff --git a/R/process_extract_acute.R b/R/process_extract_acute.R index db810b9fb..7d47d0ef4 100644 --- a/R/process_extract_acute.R +++ b/R/process_extract_acute.R @@ -79,7 +79,7 @@ process_extract_acute <- function(data, year, write_to_disk = TRUE) { "hbrescode", "lca", "hscp", - "datazone", + "datazone2011", "location", "hbtreatcode", "yearstay", diff --git a/R/process_extract_district_nursing.R b/R/process_extract_district_nursing.R index 2097b38d2..a1b3bf816 100644 --- a/R/process_extract_district_nursing.R +++ b/R/process_extract_district_nursing.R @@ -107,7 +107,7 @@ process_extract_district_nursing <- function( "gender", "gpprac", "postcode", - "datazone", + "datazone2011", "lca", "hscp", "hbrescode", diff --git a/R/process_extract_gp_ooh.R b/R/process_extract_gp_ooh.R index d85ce33f5..4add41cfa 100644 --- a/R/process_extract_gp_ooh.R +++ b/R/process_extract_gp_ooh.R @@ -111,7 +111,7 @@ process_extract_gp_ooh <- function(year, data_list, write_to_disk = TRUE) { "gpprac", "postcode", "hbrescode", - "datazone", + "datazone2011", "hscp", "hbtreatcode", "location", diff --git a/R/process_extract_mental_health.R b/R/process_extract_mental_health.R index f79eff35f..108c14c61 100644 --- a/R/process_extract_mental_health.R +++ b/R/process_extract_mental_health.R @@ -85,7 +85,7 @@ process_extract_mental_health <- function(data, year, write_to_disk = TRUE) { "hbrescode", "lca", "hscp", - "datazone", + "datazone2011", "location", "hbtreatcode", "stay", diff --git a/R/read_extract_acute.R b/R/read_extract_acute.R index 6c699d6b4..a0fba0707 100644 --- a/R/read_extract_acute.R +++ b/R/read_extract_acute.R @@ -107,7 +107,7 @@ read_extract_acute <- function(year, file_path = get_boxi_extract_path(year = ye disch = "Discharge Type Code", falls_adm = "Falls Related Admission (01)", lca = "Geo Council Area Code", - datazone = "Geo Data Zone 2011", + datazone2011 = "Geo Data Zone 2011", postcode = "Geo Postcode [C]", hscp = "Geo HSCP of Residence Code - current", conc = "Lead Consultant/HCP Code", diff --git a/R/read_extract_district_nursing.R b/R/read_extract_district_nursing.R index 5640fb7b7..607f9b47e 100644 --- a/R/read_extract_district_nursing.R +++ b/R/read_extract_district_nursing.R @@ -43,7 +43,7 @@ read_extract_district_nursing <- function( lca = "Patient Council Area Code (Contact)", postcode = "Patient Postcode [C] (Contact)", gpprac = "Practice Code (Contact)", - datazone = "Patient Data Zone 2011 (Contact)", + datazone2011 = "Patient Data Zone 2011 (Contact)", hbpraccode = "Practice NHS Board Code 9 (Contact)", hbtreatcode = "Treatment NHS Board Code 9", chi = "UPI Number [C]", diff --git a/R/read_extract_mental_health.R b/R/read_extract_mental_health.R index bbdd1d5f9..fe82732c8 100644 --- a/R/read_extract_mental_health.R +++ b/R/read_extract_mental_health.R @@ -83,7 +83,7 @@ read_extract_mental_health <- function( hbrescode = "NHS Board of Residence Code - current", lca = "Geo Council Area Code", hscp = "Geo HSCP of Residence Code - current", - datazone = "Geo Data Zone 2011", + datazone2011 = "Geo Data Zone 2011", location = "Treatment Location Code", hbtreatcode = "Treatment NHS Board Code - current", yearstay = "Occupied Bed Days (04)", diff --git a/R/read_extract_nrs_deaths.R b/R/read_extract_nrs_deaths.R index 8fd2f26e9..1734b23aa 100644 --- a/R/read_extract_nrs_deaths.R +++ b/R/read_extract_nrs_deaths.R @@ -39,7 +39,7 @@ read_extract_nrs_deaths <- function( dplyr::rename( death_location_code = "Death Location Code", lca = "Geo Council Area Code", - datazone = "Geo Data Zone 2011", + datazone2011 = "Geo Data Zone 2011", postcode = "Geo Postcode [C]", hscp = "Geo HSCP of Residence Code - current", death_board_occurrence = "NHS Board of Occurrence Code - current", diff --git a/R/read_extract_ooh_consultations.R b/R/read_extract_ooh_consultations.R index 1c32ca085..4e16527a3 100644 --- a/R/read_extract_ooh_consultations.R +++ b/R/read_extract_ooh_consultations.R @@ -34,7 +34,7 @@ read_extract_ooh_consultations <- function( postcode = "Patient Postcode [C]", hbrescode = "Patient NHS Board Code 9 - current", hscp = "HSCP of Residence Code Current", - datazone = "Patient Data Zone 2011", + datazone2011 = "Patient Data Zone 2011", gpprac = "Practice Code", ooh_case_id = "GUID", attendance_status = "Consultation Recorded", diff --git a/R/run_episode_file.R b/R/run_episode_file.R index 00e864f40..ee53c3f5f 100644 --- a/R/run_episode_file.R +++ b/R/run_episode_file.R @@ -51,7 +51,7 @@ run_episode_file <- function(processed_data_list, year, write_to_disk = TRUE) { "cij_dis_spec", "cost_total_net", "hscp", - "datazone", + "datazone2011", "attendance_status", "deathdiag1", "deathdiag2", From fd1214e14b66d27963677865dd6d24850fa0d471 Mon Sep 17 00:00:00 2001 From: Jennifer Thom Date: Mon, 17 Jul 2023 12:28:26 +0100 Subject: [PATCH 5/6] include `datazone2011_old` in selections --- R/fill_geographies.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/fill_geographies.R b/R/fill_geographies.R index 17745d9b3..89a72c488 100644 --- a/R/fill_geographies.R +++ b/R/fill_geographies.R @@ -121,7 +121,7 @@ fill_postcode_geogs <- function(data) { 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", "hscp2018", "lca_old", "datazone2011_old", "most_recent_postcode")) return(filled_postcodes) } From 744bb80dce670435a11afbc843996347794f762b Mon Sep 17 00:00:00 2001 From: James McMahon Date: Mon, 17 Jul 2023 15:54:40 +0100 Subject: [PATCH 6/6] Update R/fill_geographies.R --- R/fill_geographies.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/fill_geographies.R b/R/fill_geographies.R index 89a72c488..58d001493 100644 --- a/R/fill_geographies.R +++ b/R/fill_geographies.R @@ -121,7 +121,7 @@ fill_postcode_geogs <- function(data) { lca = dplyr::coalesce(.data$lca, .data$lca_old), datazone2011 = dplyr::coalesce(.data$datazone2011, .data$datazone2011_old) ) %>% - dplyr::select(!c("hb2018", "hscp2018", "lca_old", "datazone2011_old", "most_recent_postcode")) + dplyr::select(!c("hb2018", "hscp", "lca_old", "datazone2011_old", "most_recent_postcode")) return(filled_postcodes) }