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

Fix for anon_chi missing #752

Merged
merged 4 commits into from
Jul 19, 2023
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
20 changes: 10 additions & 10 deletions R/run_episode_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ run_episode_file <- function(
)
) %>%
# Check chi is valid using phsmethods function
# If the CHI is invalid for whatever reason, set the CHI to blank string
# If the CHI is invalid for whatever reason, set the CHI to NA
dplyr::mutate(
chi = dplyr::if_else(
phsmethods::chi_check(.data$chi) != "Valid CHI",
Expand All @@ -110,11 +110,11 @@ run_episode_file <- function(
load_ep_file_vars(year)

if (anon_chi_out) {
episode_file <- slfhelper::get_anon_chi(
episode_file,
chi_var = "chi",
drop = TRUE
)
# TODO When slfhelper is updated remove the unnecessary code
episode_file <- episode_file %>%
tidyr::replace_na(list(chi = "")) %>%
slfhelper::get_anon_chi() %>%
dplyr::mutate(anon_chi = dplyr::na_if(.data$anon_chi, ""))
}

if (write_to_disk) {
Expand All @@ -135,10 +135,10 @@ run_episode_file <- function(

#' Store the unneeded episode file variables
#'
#' @param data The in progress episode file data.
#' @param data The in-progress episode file data.
#' @inheritParams run_episode_file
#' @param vars_to_keep a character vector of variable to keep, all others will
#' be stored.
#' @param vars_to_keep a character vector of the variables to keep, all others
#' will be stored.
#'
#' @return `data` with only the `vars_to_keep` kept
store_ep_file_vars <- function(data, year, vars_to_keep) {
Expand Down Expand Up @@ -324,7 +324,7 @@ create_cost_inc_dna <- function(data) {
#'
#' @return The data unchanged (the cohorts are written to disk)
create_cohort_lookups <- function(data, year, update = latest_update()) {
# Use future so the cohorts can be create simultaneously (in parallel)
# Use future so the cohorts can be created simultaneously (in parallel)
future::plan(strategy = future.callr::callr, .skip = TRUE)
options(future.globals.maxSize = 21474836480)

Expand Down
2 changes: 1 addition & 1 deletion man/correct_cij_vars.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/create_cohort_lookups.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/create_cost_inc_dna.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/fill_missing_cij_markers.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/join_cohort_lookups.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/join_sparra_hhg.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/load_ep_file_vars.Rd

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

6 changes: 3 additions & 3 deletions man/store_ep_file_vars.Rd

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