Skip to content

Commit

Permalink
Merge Development branch into master (#891)
Browse files Browse the repository at this point in the history
Development has completed and we can now merge this into master. We can
then create a new branch for the march update and add any new changes
onto that branch. This will ensure Master has the most up to date
changes.
  • Loading branch information
rchlv authored Jan 9, 2024
2 parents 7ab162d + f9384cb commit ada9af1
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 19 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export(find_latest_file)
export(fy_interval)
export(get_boxi_extract_path)
export(get_ch_costs_path)
export(get_datazone_pop_path)
export(get_dd_path)
export(get_dd_period)
export(get_demographic_cohorts_path)
Expand All @@ -52,6 +51,7 @@ export(get_locality_path)
export(get_lookups_dir)
export(get_ltcs_path)
export(get_nsu_path)
export(get_pop_path)
export(get_practice_details_path)
export(get_readcode_lookup_path)
export(get_sc_at_episodes_path)
Expand Down
33 changes: 25 additions & 8 deletions R/get_lookup_paths.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,29 +94,46 @@ get_simd_path <- function(file_name = NULL, ext = "parquet") {
return(simd_path)
}

# TODO update this function to look for a specified type of pop estimate e.g. datazone, hscp etc.
#' Datazone Populations File Path

#' Populations File Path for different types
#'
#' @description Get the path to the Datazone populations estimates
#' @description Get the path to the populations estimates
#'
#' @inheritParams get_file_path
#'
#' @return An [fs::path()] to the populations estimates file
#' @export
#'
#' @family lookup file paths
get_datazone_pop_path <- function(file_name = NULL, ext = "rds") {
datazone_pop_dir <-
get_pop_path <- function(file_name = NULL,
ext = "rds",
type = c(
"datazone",
"hscp",
"ca",
"hb",
"intzone"
)) {
pop_dir <-
fs::path(get_lookups_dir(), "Populations", "Estimates")

file_name_re <- dplyr::case_match(
type,
"datazone" ~ stringr::str_glue("DataZone2011_pop_est_2011_\\d+?\\.{ext}"),
"hscp" ~ stringr::str_glue("HSCP2019_pop_est_1981_\\d+?\\.{ext}"),
"ca" ~ stringr::str_glue("CA2019_pop_est_1981_\\d+?\\.{ext}"),
"hb" ~ stringr::str_glue("HB2019_pop_est_1981_\\d+?\\.{ext}"),
"intzone" ~ stringr::str_glue("IntZone_pop_est_2011_\\d+?\\.{ext}")
)

datazone_pop_path <- get_file_path(
directory = datazone_pop_dir,
directory = pop_dir,
file_name = file_name,
ext = ext,
file_name_regexp = stringr::str_glue("DataZone2011_pop_est_2001_\\d+?\\.{ext}")
file_name_regexp = file_name_re
)

return(datazone_pop_path)
return(pop_path)
}


Expand Down
2 changes: 1 addition & 1 deletion man/get_gpprac_ref_path.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_locality_path.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_lookups_dir.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions man/get_datazone_pop_path.Rd → man/get_pop_path.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_simd_path.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_spd_path.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ada9af1

Please sign in to comment.