BYOC_ID: 45986 Refactor PIS#1326
Conversation
| get_it_prescribing_path <- function(year, it_reference = NULL, BYOC_MODE, ...) { | ||
| if (isTRUE(BYOC_MODE)) { | ||
| return("dummy_BYOC_it_prescribing_path") | ||
| } else { | ||
| it_reference <- check_it_reference(it_reference) | ||
| if (is.null(it_reference)) { | ||
| it_pis_path <- get_file_path( | ||
| directory = fs::path(get_slf_dir(), "IT_extracts/anon-chi-IT"), | ||
| file_name_regexp = stringr::str_glue( | ||
| "anon-SCTASK[0-9]{{7}}_PIS_{convert_fyyear_to_year(year)}.parquet" | ||
| ) | ||
| ) | ||
| } else { | ||
| it_reference <- check_it_reference(it_reference) | ||
|
|
||
| it_pis_path <- get_file_path( | ||
| directory = fs::path(get_slf_dir(), "IT_extracts/anon-chi-IT"), | ||
| file_name = stringr::str_glue( | ||
| "anon-SCTASK{it_reference}_PIS_{convert_fyyear_to_year(year)}.parquet" | ||
| it_pis_path <- get_file_path( | ||
| directory = fs::path(get_slf_dir(), "IT_extracts/anon-chi-IT"), | ||
| file_name = stringr::str_glue( | ||
| "anon-SCTASK{it_reference}_PIS_{convert_fyyear_to_year(year)}.parquet" | ||
| ) | ||
| ) | ||
| ) | ||
| } | ||
| return(it_pis_path) |
There was a problem hiding this comment.
Did you get inspiration from the IT CHI deaths here?
There was a problem hiding this comment.
sorry getting confused with SPD file paths!
| # Format prescribing | ||
| dplyr::mutate( | ||
| dob = lubridate::dmy(.data$dob) | ||
| dob = lubridate::as_date(.data$dob) |
Jennit07
left a comment
There was a problem hiding this comment.
I need to come back to this PR to test when the data is available. It looks okay but im a little confused with how to handle the IT file paths. It looks like this was inspired by the CHI deaths file paths which has previously passed the tests with NSS. But my first thought was to handle this similar to the SPD file paths. This would maintain the consistency in the code. Happy to discuss/do further testing on this
@Jennit07 Yes I looked at CHI deaths and did the same thing here. The only change is that it returns |
| ) | ||
| get_it_prescribing_path <- function(year, it_reference = NULL, BYOC_MODE, ...) { | ||
| if (isTRUE(BYOC_MODE)) { | ||
| return("dummy_BYOC_it_prescribing_path") |
There was a problem hiding this comment.
can use get_dummy_file_path().
Complete and reviewed. Waiting for PIS data.
TO-DO:
get_it_prescribing_path. It has been refactored likeget_it_deaths_pathbut this currently returns a dummy path ifBYOC_MODE = TRUEwhich differs fromget_spd_path.