Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Development branch into master #891

Merged
merged 4 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -30,7 +30,7 @@
directory = locality_dir,
file_name = file_name,
ext = ext,
file_name_regexp = stringr::str_glue("HSCP Localities_DZ11_Lookup_\\d+?\\.{ext}")

Check warning on line 33 in R/get_lookup_paths.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/get_lookup_paths.R,line=33,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 85 characters.
)

return(locality_path)
Expand Down Expand Up @@ -60,7 +60,7 @@
directory = spd_dir,
file_name = file_name,
ext = ext,
file_name_regexp = stringr::str_glue("Scottish_Postcode_Directory_.+?\\.{ext}")

Check warning on line 63 in R/get_lookup_paths.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/get_lookup_paths.R,line=63,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 83 characters.
)

return(spd_path)
Expand Down Expand Up @@ -94,29 +94,46 @@
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(

Check warning on line 129 in R/get_lookup_paths.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/get_lookup_paths.R,line=129,col=3,[object_usage_linter] local variable 'datazone_pop_path' assigned but may not be used
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)

Check warning on line 136 in R/get_lookup_paths.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/get_lookup_paths.R,line=136,col=10,[object_usage_linter] no visible binding for global variable '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.

Loading