-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Set up `get_sandpit_extract_path` * Update documentation * Update sc `all` data paths * Write sandpit extract if file does not exist * Style code --------- Co-authored-by: Jennit07 <[email protected]>
- Loading branch information
Showing
11 changed files
with
132 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#' Sandpit Extract File Path | ||
#' | ||
#' @description Get the file path for sandpit extracts | ||
#' | ||
#' @param update The update month to use, | ||
#' defaults to [latest_update()] | ||
#' | ||
#' @param ... additional arguments passed to [get_file_path()] | ||
#' | ||
#' @return The path to the sandpit extracts as an [fs::path()] | ||
#' @export | ||
#' @family social care sandpit extract paths | ||
#' @seealso [get_file_path()] for the generic function. | ||
get_sandpit_extract_path <- function(type = c( | ||
"at", "ch", "hc", | ||
"sds", "client", "demographics" | ||
), | ||
year = NULL, | ||
update = latest_update(), ...) { | ||
dir <- fs::path(get_slf_dir(), "Social_care", "Sandpit_Extracts") | ||
|
||
file_name <- dplyr::case_match( | ||
type, | ||
"at" ~ "sandpit_at_extract", | ||
"ch" ~ "sandpit_ch_extract", | ||
"hc" ~ "sandpit_hc_extract", | ||
"sds" ~ "sandpit_sds_extract", | ||
"client" ~ "sandpit_sc_client_extract", | ||
"demographics" ~ "sandpit_sc_demographics_extract" | ||
) | ||
|
||
if (type == "client") { | ||
sandpit_extract_path <- fs::path(dir, stringr::str_glue("{file_name}_{year}_{update}.parquet")) | ||
} else { | ||
sandpit_extract_path <- fs::path(dir, stringr::str_glue("{file_name}_{update}.parquet")) | ||
} | ||
|
||
return(sandpit_extract_path) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.