diff --git a/NAMESPACE b/NAMESPACE index e980ddc0d..2b8dda538 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -38,6 +38,7 @@ export(get_boxi_extract_path) export(get_byoc_output_files) export(get_ch_costs_path) export(get_combined_slf_deaths_lookup_path) +export(get_datazone_pop_data) export(get_dd_path) export(get_dd_period) export(get_demographic_cohorts_path) @@ -60,6 +61,7 @@ export(get_it_deaths_path) export(get_it_ltc_path) export(get_it_prescribing_path) export(get_la_code_opendata_lookup) +export(get_locality_data) export(get_locality_path) export(get_lookups_dir) export(get_ltcs_path) @@ -76,6 +78,7 @@ export(get_sc_hc_episodes_path) export(get_sc_sds_episodes_path) export(get_service_use_cohorts_path) export(get_sg_homelessness_pub_path) +export(get_simd_data) export(get_simd_path) export(get_slf_ch_name_lookup_path) export(get_slf_chi_deaths_path) diff --git a/R/add_keep_population_flag.R b/R/add_keep_population_flag.R index 03f662d17..586d229c4 100644 --- a/R/add_keep_population_flag.R +++ b/R/add_keep_population_flag.R @@ -6,23 +6,28 @@ #' #' @return A data frame with keep_population flags #' @family individual_file -add_keep_population_flag <- function(individual_file, year) { - calendar_year <- paste0("20", substr(year, 1, 2)) %>% as.integer() +add_keep_population_flag <- function(individual_file, + year, + pop_estimates = get_datazone_pop_data( + denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_pop_path(type = "datazone"), + BYOC_MODE + ), + locality_data = get_locality_data( + denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_locality_path(), + BYOC_MODE + ), + BYOC_MODE) { + # TODO: Check arguments - do get_datazone_pop_data and get_locality_data just need BYOC_MODE? + + calendar_year <- paste0("20", substr(year, 1, 2)) %>% + as.integer() if (!check_year_valid(year, "nsu")) { individual_file <- individual_file %>% dplyr::mutate(keep_population = 1L) } else { - ## Obtain the population estimates for Locality AgeGroup and Gender. - pop_estimates <- - readr::read_rds(get_pop_path(type = "datazone")) %>% - dplyr::select( - .data$year, - .data$datazone2011, - .data$sex, - .data$age0:.data$age90plus - ) - # Step 1: Obtain the population estimates for Locality, AgeGroup, and Gender # Select out the estimates for the year of interest. # if we don't have estimates for this year (and so have to use previous year). @@ -55,8 +60,7 @@ add_keep_population_flag <- function(individual_file, year) { dplyr::mutate(age = as.integer(.data$age)) %>% add_age_group(.data$age) %>% dplyr::left_join( - readr::read_rds(get_locality_path()) %>% - dplyr::select("locality" = "hscp_locality", .data$datazone2011), + locality_data, by = "datazone2011" ) %>% dplyr::group_by(.data$locality, .data$age_group, .data$gender) %>% @@ -139,7 +143,7 @@ add_keep_population_flag <- function(individual_file, year) { ) } - cli::cli_alert_info("Add keep population function finished at {Sys.time()}") + cli::cli_alert_info("Add keep population function finished at {Sys.time()}") # TODO: Is this being kept or changed with a logger_utils function? return(individual_file) } diff --git a/R/fill_geographies.R b/R/fill_geographies.R index 8e239ae25..2f6bbe65d 100644 --- a/R/fill_geographies.R +++ b/R/fill_geographies.R @@ -11,11 +11,14 @@ #' Postcode and GP Practice details. fill_geographies <- function( data, - slf_pc_lookup = read_file(get_slf_postcode_path()), + slf_pc_lookup = read_file( + get_slf_postcode_path(BYOC_MODE = BYOC_MODE) + ), slf_gpprac_lookup = read_file( - get_slf_gpprac_path(), + get_slf_gpprac_path(BYOC_MODE = BYOC_MODE), col_select = c("gpprac", "cluster", "hbpraccode") - ) + ), + BYOC_MODE = BYOC_MODE ) { check_variables_exist(data, c( "anon_chi", @@ -29,17 +32,10 @@ fill_geographies <- function( )) data <- data %>% - fill_postcode_geogs( - slf_pc_lookup = read_file(get_slf_postcode_path()) - ) %>% - fill_gpprac_geographies( - slf_gpprac_lookup = read_file( - get_slf_gpprac_path(), - col_select = c("gpprac", "cluster", "hbpraccode") - ) - ) + fill_postcode_geogs(slf_pc_lookup) %>% + fill_gpprac_geographies(slf_gpprac_lookup) - cli::cli_alert_info("Fill geographies function finished at {Sys.time()}") + cli::cli_alert_info("Fill geographies function finished at {Sys.time()}") # TODO: Is this being kept or changed with a logger_utils function? return(data) } diff --git a/R/get_lookup_paths.R b/R/get_lookup_paths.R index dad2d1afa..7f692647d 100644 --- a/R/get_lookup_paths.R +++ b/R/get_lookup_paths.R @@ -18,7 +18,7 @@ get_lookups_dir <- function() { #' #' @inheritParams get_file_path #' -#' @return An [fs::path()] to the Scottish Postcode Directory +#' @return An [fs::path()] to the HSCP Localities file #' @export #' #' @family lookup file paths @@ -37,6 +37,50 @@ get_locality_path <- function(file_name = NULL, ext = "rds") { } +#' Locality data +#' +#' @description Return the data for centrally held HSCP Localities file. +#' +#' @param denodo_connect Connection to denodo +#' @param file_path Path to local HSCP Localities file +#' @param BYOC_MODE BYOC MODE +#' +#' @return a [tibble][tibble::tibble-package]. +#' @export +#' +#' @family lookup files +get_locality_data <- function(denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_locality_path(), + BYOC_MODE) { + if (isTRUE(BYOC_MODE)) { + log_slf_event(stage = "read", status = "start", type = "HSCP Localities Lookup", year = "all") # TODO: Check whether to add hscp_locality to log_slf_event mapping list + + on.exit(try(DBI::dbDisconnect(denodo_connect), silent = TRUE), add = TRUE) + + locality_data <- dplyr::tbl( + denodo_connect, + dbplyr::in_schema("sdl", "sdl_hscp_locality_source") # TODO: Check table name + ) %>% + dplyr::select( + locality = "hscp_locality", + tidyselect::matches("datazone\\d{4}$") + ) %>% # TODO: Check whether we need to select columns + collect() + + log_slf_event(stage = "read", status = "complete", type = "HSCP Localities Lookup", year = "all") # TODO: Check whether to add hscp_locality to log_slf_event mapping list + } else { # TODO: Check logic - are we reading the local file when BYOC_MODE = FALSE or are we still reading from Denodo? + + locality_data <- read_file(file_path) %>% + dplyr::select( + locality = "hscp_locality", + tidyselect::matches("datazone\\d{4}$") + ) # TODO: Check whether we need to select columns + } + + return(locality_data) +} + + #' Scottish Postcode Directory File Path #' #' @description Get the path to the centrally held Scottish Postcode Directory @@ -95,6 +139,63 @@ get_simd_path <- function(file_name = NULL, ext = "parquet") { } +#' SIMD data +#' +#' @description Return the data for centrally held Scottish Index of Multiple +#' Deprivation (SIMD) file. +#' +#' @param denodo_connect Connection to denodo +#' @param file_path Path to local SIMD file +#' @param BYOC_MODE BYOC MODE +#' +#' @return a [tibble][tibble::tibble-package]. +#' @export +#' +#' @family lookup files +get_simd_data <- function(denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_simd_path(), + BYOC_MODE) { + if (isTRUE(BYOC_MODE)) { + log_slf_event(stage = "read", status = "start", type = "SIMD Lookup", year = "all") # TODO: Check whether to add simd to log_slf_event mapping list + + on.exit(try(DBI::dbDisconnect(denodo_connect), silent = TRUE), add = TRUE) + + simd_data <- dplyr::tbl( + denodo_connect, + dbplyr::in_schema("sdl", "sdl_simd_source") # TODO: Check table name + ) %>% + dplyr::select( + "pc7", + "simd2020v2_rank", + "simd2020v2_sc_decile", + "simd2020v2_sc_quintile", + "simd2020v2_hb2019_decile", + "simd2020v2_hb2019_quintile", + "simd2020v2_hscp2019_decile", + "simd2020v2_hscp2019_quintile" + ) %>% # TODO: Check whether we need to select columns. When a new version of the SIMD is released, the column names within the file will change. + collect() + + log_slf_event(stage = "read", status = "complete", type = "SIMD Lookup", year = "all") # TODO: Check whether to add simd to log_slf_event mapping list + } else { # TODO: Check logic - are we reading the local file when BYOC_MODE = FALSE or are we still reading from Denodo? + + simd_data <- read_file(file_path) %>% + dplyr::select( + "pc7", + "simd2020v2_rank", + "simd2020v2_sc_decile", + "simd2020v2_sc_quintile", + "simd2020v2_hb2019_decile", + "simd2020v2_hb2019_quintile", + "simd2020v2_hscp2019_decile", + "simd2020v2_hscp2019_quintile" + ) # TODO: Check whether we need to select columns. When a new version of the SIMD is released, the column names within the file will change. + } + + return(simd_data) +} + + #' Populations File Path for different types #' #' @description Get the path to the populations estimates @@ -138,6 +239,54 @@ get_pop_path <- function(file_name = NULL, } +#' DataZone population data +#' +#' @description Return the data for DataZone population estimates. +#' +#' @param denodo_connect Connection to denodo +#' @param file_path Path to local DataZone population file +#' @param BYOC_MODE BYOC MODE +#' +#' @return a [tibble][tibble::tibble-package]. +#' @export +#' +#' @family lookup files +get_datazone_pop_data <- function(denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_pop_path(type = "datazone"), + BYOC_MODE) { + if (isTRUE(BYOC_MODE)) { + log_slf_event(stage = "read", status = "start", type = "DataZone Population Lookup", year = "all") # TODO: Check whether to add datazone_pop to log_slf_event mapping list + + on.exit(try(DBI::dbDisconnect(denodo_connect), silent = TRUE), add = TRUE) + + datazone_pop_data <- dplyr::tbl( + denodo_connect, + dbplyr::in_schema("sdl", "sdl_datazone_population_source") # TODO: Check table name + ) %>% + dplyr::select( + "year", + "datazone2011", + "sex", + dplyr::starts_with("age") + ) %>% # TODO: Check whether we need to select columns + collect() + + log_slf_event(stage = "read", status = "complete", type = "DataZone Population Lookup", year = "all") # TODO: Check whether to add datazone_pop to log_slf_event mapping list + } else { # TODO: Check logic - are we reading the local file when BYOC_MODE = FALSE or are we still reading from Denodo? + + datazone_pop_data <- read_file(file_path) %>% + dplyr::select( + "year", + "datazone2011", + "sex", + dplyr::starts_with("age") + ) # TODO: Check whether we need to select columns + } + + return(datazone_pop_data) +} + + #' GP Practice Reference File Path (gpprac) #' #' @description Get the path for the centrally held reference file `gpprac` diff --git a/R/get_slf_lookup_paths.R b/R/get_slf_lookup_paths.R index 6a25fc3bd..28d9e784f 100644 --- a/R/get_slf_lookup_paths.R +++ b/R/get_slf_lookup_paths.R @@ -9,13 +9,23 @@ #' @export #' @family slf lookup file path #' @seealso [get_file_path()] for the generic function. -get_slf_postcode_path <- function(update = latest_update(), ...) { - get_file_path( - directory = fs::path(get_slf_dir(), "Lookups"), - file_name = stringr::str_glue("source_postcode_lookup_{update}"), - ext = "parquet", - ... - ) +get_slf_postcode_path <- function(update = latest_update(), BYOC_MODE, ...) { # TODO: Check whether to keep the update argument + + file_name <- stringr::str_glue("source_postcode_lookup_{update}.parquet") + + if (BYOC_MODE) { + slf_postcode_path <- file.path( + directory = denodo_output_path(), + file_name = file_name + ) + } else { + slf_postcode_path <- get_file_path( + directory = fs::path(get_slf_dir(), "Lookups"), + file_name = file_name, + ... + ) + } + return(slf_postcode_path) } #' get uk postcode list file path diff --git a/R/process_lookup_postcode.R b/R/process_lookup_postcode.R index 0c29566e4..6c9f685ce 100644 --- a/R/process_lookup_postcode.R +++ b/R/process_lookup_postcode.R @@ -12,15 +12,33 @@ #' @return the final data as a [tibble][tibble::tibble-package]. #' @export #' @family process extracts -process_lookup_postcode <- function(spd_path = get_spd_path(), - simd_path = get_simd_path(), - locality_path = get_locality_path(), +process_lookup_postcode <- function(spd_data = get_spd_data( + denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_spd_path(), # TODO: Add this argument to the function in refactor-sc-demographics branch? + BYOC_MODE + ), + simd_data = get_simd_data( + denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_simd_path(), + BYOC_MODE + ), + locality_data = get_locality_data( + denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_locality_path(), + BYOC_MODE + ), + BYOC_MODE = FALSE, + run_id = NA, + run_date_time = NA, write_to_disk = TRUE) { + # TODO: Check arguments - do get_spd_data, simd_data and get_locality_data just need BYOC_MODE? + # Alternatively we could have no default and just call data in targets (i.e. same as process_extract_XXX). + # Read lookup files ------------------------------------------------------- log_slf_event(stage = "process", status = "start", type = "slf_pc_lookup", year = "all") # postcode data - spd_file <- read_file(spd_path) %>% + spd_file <- spd_data %>% dplyr::select( "pc7", # tidyselect::matches("datazone\\d{4}$"), @@ -39,7 +57,7 @@ process_lookup_postcode <- function(spd_path = get_spd_path(), dplyr::mutate(lca = convert_ca_to_lca(.data$ca2019)) # simd data - simd_file <- read_file(simd_path) %>% + simd_file <- simd_data %>% dplyr::select( "pc7", tidyselect::matches("simd\\d{4}.?.?_rank"), @@ -52,7 +70,7 @@ process_lookup_postcode <- function(spd_path = get_spd_path(), ) # locality - locality_file <- read_file(locality_path) %>% + locality_file <- locality_data %>% dplyr::select( locality = "hscp_locality", tidyselect::matches("datazone\\d{4}$") @@ -93,12 +111,20 @@ process_lookup_postcode <- function(spd_path = get_spd_path(), tidyselect::matches("ur6_\\d{4}$"), tidyselect::matches("ur3_\\d{4}$"), tidyselect::matches("ur2_\\d{4}$") + ) %>% + dplyr::mutate( + run_id = run_id, + run_date_time = run_date_time ) if (write_to_disk) { write_file( slf_pc_lookup, - get_slf_postcode_path(check_mode = "write"), + get_slf_postcode_path( + BYOC_MODE = BYOC_MODE, + check_mode = "write" + ), + BYOC_MODE = BYOC_MODE, group_id = 3206 # hscdiip owner ) } diff --git a/SDL_process/dummy_targets.R b/SDL_process/dummy_targets.R index 23ff54a02..3a0e4a32f 100644 --- a/SDL_process/dummy_targets.R +++ b/SDL_process/dummy_targets.R @@ -59,9 +59,7 @@ tar_option_set( garbage_collection = TRUE, # format - default is parquet format format = "parquet", - resources = tar_resources( - parquet = tar_resources_parquet(compression = "zstd") - ), + resources = tar_resources(parquet = tar_resources_parquet(compression = "zstd")), # error - if an error occurs, the pipeline will continue error = "stop", # storage - the worker saves/uploads the value. @@ -82,30 +80,80 @@ list( ## Stage 2.1 non-specific targets ---- - ### IT CHI deaths Activity ---- - # READ - IT CHI deaths + ## Lookup data ##----------------------------------------------------------- + + # Locality data------ + tar_target( + # Target name + locality_data, + # Function + get_locality_data( + denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_locality_path(), + BYOC_MODE + ) + ), + # SIMD data------ tar_target( # Target name - it_chi_deaths_extract, - read_it_chi_deaths( + simd_data, + # Function + get_simd_data( denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), - file_path = get_it_deaths_path(BYOC_MODE = BYOC_MODE), - BYOC_MODE = BYOC_MODE + file_path = get_simd_path(), + BYOC_MODE ) ), - # PROCESS - IT CHI deaths + + # Postcode lookup----------------------------------------------------------- + # PROCESS - postcode lookup------ tar_target( # Target name - it_chi_deaths_data, + source_pc_lookup, # Function - process_it_chi_deaths( - data = it_chi_deaths_extract, - write_to_disk = write_to_disk, + process_lookup_postcode( + spd_data = spd_data, + simd_data = simd_data, + locality_data = locality_data, BYOC_MODE = BYOC_MODE, run_id = run_id, - run_date_time = run_date_time - ) + run_date_time = run_date_time, + write_to_disk = write_to_disk + ), + priority = 0.9 ), + # # TESTS - postcode lookup------ + # tar_target( + # # Target name + # tests_source_pc_lookup, + # # Function + # process_tests_lookup_pc(source_pc_lookup) + # ), + + ### IT CHI deaths Activity ---- + # # READ - IT CHI deaths + # tar_target( + # # Target name + # it_chi_deaths_extract, + # read_it_chi_deaths( + # denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + # file_path = get_it_deaths_path(BYOC_MODE = BYOC_MODE), + # BYOC_MODE = BYOC_MODE + # ) + # ), + # # PROCESS - IT CHI deaths + # tar_target( + # # Target name + # it_chi_deaths_data, + # # Function + # process_it_chi_deaths( + # data = it_chi_deaths_extract, + # write_to_disk = write_to_disk, + # BYOC_MODE = BYOC_MODE, + # run_id = run_id, + # run_date_time = run_date_time + # ) + # ), ### Long-Term Conditions (LTCs) Activity ---- # # READ - LTCs @@ -117,18 +165,18 @@ list( # ) # ), - # ### NRS BOXI Deaths ---- - # PROCESS - Refined deaths - combine all NRS death data into a lookup - tar_target( - refined_death_data, - process_refined_death( - it_chi_deaths = it_chi_deaths_data, - write_to_disk = write_to_disk, - BYOC_MODE = BYOC_MODE, - run_id = run_id, - run_date_time = run_date_time - ) - ), + # # ### NRS BOXI Deaths ---- + # # PROCESS - Refined deaths - combine all NRS death data into a lookup + # tar_target( + # refined_death_data, + # process_refined_death( + # it_chi_deaths = it_chi_deaths_data, + # write_to_disk = write_to_disk, + # BYOC_MODE = BYOC_MODE, + # run_id = run_id, + # run_date_time = run_date_time + # ) + # ), ## Stage 2.2 year specific targets ---- @@ -193,17 +241,17 @@ list( ### Death Activity ---- - # PROCESS - Deaths - tar_target( - # Target name - source_nrs_deaths_extract, - # use this anonymous function with redundant but necessary refined_death - # to make sure reading year-specific NRS deaths extracts after it is produced - (\(year, refined_death_data) { - createslf::read_file(get_source_extract_path(year, "nrs_deaths", BYOC_MODE = BYOC_MODE)) %>% - as.data.frame() - })(year, refined_death_data) - ) + # # PROCESS - Deaths + # tar_target( + # # Target name + # source_nrs_deaths_extract, + # # use this anonymous function with redundant but necessary refined_death + # # to make sure reading year-specific NRS deaths extracts after it is produced + # (\(year, refined_death_data) { + # createslf::read_file(get_source_extract_path(year, "nrs_deaths", BYOC_MODE = BYOC_MODE)) %>% + # as.data.frame() + # })(year, refined_death_data) + # ) # # TESTS - Deaths # tar_target( diff --git a/SDL_process/run_sdl.r b/SDL_process/run_sdl.r index ad5ebe509..1f91a3d73 100644 --- a/SDL_process/run_sdl.r +++ b/SDL_process/run_sdl.r @@ -92,9 +92,7 @@ year <- "1920" byoc_output_files <- get_byoc_output_files( year, types = c( - "nrs_deaths", - "combined_deaths", - "chi_deaths" + "postcode_lookup" ) ) # using homelessness for test purpose. When development is complete, diff --git a/_targets.R b/_targets.R index a3aafa1b1..2a6a2ce3b 100644 --- a/_targets.R +++ b/_targets.R @@ -108,21 +108,27 @@ list( get_gpprac_ref_path(), format = "file" ), - # Locality path------ + # Locality data------ tar_target( # Target name - locality_path, + locality_data, # Function - get_locality_path(), - format = "file" + get_locality_data( + denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_locality_path(), + BYOC_MODE + ) ), - # SIMD path------ + # SIMD data------ tar_target( # Target name - simd_path, + simd_data, # Function - get_simd_path(), - format = "file" + get_simd_data( + denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_simd_path(), + BYOC_MODE + ) ), # Scottish postcode directory------ tar_target( @@ -209,9 +215,12 @@ list( source_pc_lookup, # Function process_lookup_postcode( - spd_path = spd_path, - simd_path = simd_path, - locality_path = locality_path, + spd_data = spd_data, + simd_data = simd_data, + locality_data = locality_data, + BYOC_MODE = BYOC_MODE, + run_id = run_id, + run_date_time = run_date_time, write_to_disk = write_to_disk ), priority = 0.9 diff --git a/man/add_keep_population_flag.Rd b/man/add_keep_population_flag.Rd index a74fa7a1c..d6e165ea0 100644 --- a/man/add_keep_population_flag.Rd +++ b/man/add_keep_population_flag.Rd @@ -4,7 +4,15 @@ \alias{add_keep_population_flag} \title{Add keep_popluation flag} \usage{ -add_keep_population_flag(individual_file, year) +add_keep_population_flag( + individual_file, + year, + pop_estimates = get_datazone_pop_data(denodo_connect = get_denodo_connection(BYOC_MODE + = BYOC_MODE), file_path = get_pop_path(type = "datazone"), BYOC_MODE), + locality_data = get_locality_data(denodo_connect = get_denodo_connection(BYOC_MODE = + BYOC_MODE), file_path = get_locality_path(), BYOC_MODE), + BYOC_MODE +) } \arguments{ \item{individual_file}{individual files under processing} diff --git a/man/fill_geographies.Rd b/man/fill_geographies.Rd index bb619405b..1cc848392 100644 --- a/man/fill_geographies.Rd +++ b/man/fill_geographies.Rd @@ -6,9 +6,10 @@ \usage{ fill_geographies( data, - slf_pc_lookup = read_file(get_slf_postcode_path()), - slf_gpprac_lookup = read_file(get_slf_gpprac_path(), col_select = c("gpprac", - "cluster", "hbpraccode")) + slf_pc_lookup = read_file(get_slf_postcode_path(BYOC_MODE = BYOC_MODE)), + slf_gpprac_lookup = read_file(get_slf_gpprac_path(BYOC_MODE = BYOC_MODE), col_select = + c("gpprac", "cluster", "hbpraccode")), + BYOC_MODE = BYOC_MODE ) } \arguments{ diff --git a/man/get_datazone_pop_data.Rd b/man/get_datazone_pop_data.Rd new file mode 100644 index 000000000..40747fe62 --- /dev/null +++ b/man/get_datazone_pop_data.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/get_lookup_paths.R +\name{get_datazone_pop_data} +\alias{get_datazone_pop_data} +\title{DataZone population data} +\usage{ +get_datazone_pop_data( + denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_pop_path(type = "datazone"), + BYOC_MODE +) +} +\arguments{ +\item{denodo_connect}{Connection to denodo} + +\item{file_path}{Path to local DataZone population file} + +\item{BYOC_MODE}{BYOC MODE} +} +\value{ +a \link[tibble:tibble-package]{tibble}. +} +\description{ +Return the data for DataZone population estimates. +} +\seealso{ +Other lookup files: +\code{\link[=get_locality_data]{get_locality_data()}}, +\code{\link[=get_simd_data]{get_simd_data()}} +} +\concept{lookup files} diff --git a/man/get_locality_data.Rd b/man/get_locality_data.Rd new file mode 100644 index 000000000..8a383c593 --- /dev/null +++ b/man/get_locality_data.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/get_lookup_paths.R +\name{get_locality_data} +\alias{get_locality_data} +\title{Locality data} +\usage{ +get_locality_data( + denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_locality_path(), + BYOC_MODE +) +} +\arguments{ +\item{denodo_connect}{Connection to denodo} + +\item{file_path}{Path to local HSCP Localities file} + +\item{BYOC_MODE}{BYOC MODE} +} +\value{ +a \link[tibble:tibble-package]{tibble}. +} +\description{ +Return the data for centrally held HSCP Localities file. +} +\seealso{ +Other lookup files: +\code{\link[=get_datazone_pop_data]{get_datazone_pop_data()}}, +\code{\link[=get_simd_data]{get_simd_data()}} +} +\concept{lookup files} diff --git a/man/get_locality_path.Rd b/man/get_locality_path.Rd index 8ea9922ee..2bd18e312 100644 --- a/man/get_locality_path.Rd +++ b/man/get_locality_path.Rd @@ -12,7 +12,7 @@ get_locality_path(file_name = NULL, ext = "rds") \item{ext}{The extension (type of the file) - optional} } \value{ -An \code{\link[fs:path]{fs::path()}} to the Scottish Postcode Directory +An \code{\link[fs:path]{fs::path()}} to the HSCP Localities file } \description{ Get the path to the centrally held HSCP Localities file. diff --git a/man/get_simd_data.Rd b/man/get_simd_data.Rd new file mode 100644 index 000000000..c435e0e18 --- /dev/null +++ b/man/get_simd_data.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/get_lookup_paths.R +\name{get_simd_data} +\alias{get_simd_data} +\title{SIMD data} +\usage{ +get_simd_data( + denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_simd_path(), + BYOC_MODE +) +} +\arguments{ +\item{denodo_connect}{Connection to denodo} + +\item{file_path}{Path to local SIMD file} + +\item{BYOC_MODE}{BYOC MODE} +} +\value{ +a \link[tibble:tibble-package]{tibble}. +} +\description{ +Return the data for centrally held Scottish Index of Multiple +Deprivation (SIMD) file. +} +\seealso{ +Other lookup files: +\code{\link[=get_datazone_pop_data]{get_datazone_pop_data()}}, +\code{\link[=get_locality_data]{get_locality_data()}} +} +\concept{lookup files} diff --git a/man/get_slf_postcode_path.Rd b/man/get_slf_postcode_path.Rd index c4f757fc9..f25626c5f 100644 --- a/man/get_slf_postcode_path.Rd +++ b/man/get_slf_postcode_path.Rd @@ -4,7 +4,7 @@ \alias{get_slf_postcode_path} \title{SLF Postcode Lookup File Path} \usage{ -get_slf_postcode_path(update = latest_update(), ...) +get_slf_postcode_path(update = latest_update(), BYOC_MODE, ...) } \arguments{ \item{update}{the update month (defaults to use \code{\link[=latest_update]{latest_update()}})} diff --git a/man/process_lookup_postcode.Rd b/man/process_lookup_postcode.Rd index 6d6722c2b..e623f7a94 100644 --- a/man/process_lookup_postcode.Rd +++ b/man/process_lookup_postcode.Rd @@ -5,21 +5,25 @@ \title{Process the SLF postcode lookup} \usage{ process_lookup_postcode( - spd_path = get_spd_path(), - simd_path = get_simd_path(), - locality_path = get_locality_path(), + spd_data = get_spd_data(denodo_connect = get_denodo_connection(BYOC_MODE = BYOC_MODE), + file_path = get_spd_path(), BYOC_MODE), + simd_data = get_simd_data(denodo_connect = get_denodo_connection(BYOC_MODE = + BYOC_MODE), file_path = get_simd_path(), BYOC_MODE), + locality_data = get_locality_data(denodo_connect = get_denodo_connection(BYOC_MODE = + BYOC_MODE), file_path = get_locality_path(), BYOC_MODE), + BYOC_MODE = FALSE, + run_id = NA, + run_date_time = NA, write_to_disk = TRUE ) } \arguments{ -\item{spd_path}{Path to Scottish Postcode Directory.} +\item{write_to_disk}{(optional) Should the data be written to disk default is +\code{TRUE} i.e. write the data to disk.} \item{simd_path}{Path to SIMD lookup.} \item{locality_path}{Path to locality lookup.} - -\item{write_to_disk}{(optional) Should the data be written to disk default is -\code{TRUE} i.e. write the data to disk.} } \value{ the final data as a \link[tibble:tibble-package]{tibble}.