Skip to content

Commit

Permalink
moving dd and homelessness to front
Browse files Browse the repository at this point in the history
  • Loading branch information
lizihao-anu committed Oct 21, 2024
1 parent 7787668 commit 27d5bc7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
24 changes: 10 additions & 14 deletions R/create_episode_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ create_episode_file <- function(
episode_file <- dplyr::bind_rows(processed_data_list) %>%
slfhelper::get_chi() %>%
write_temp_data(year, file_name = "ep_temp1", write_temp_to_disk) %>%
add_homelessness_flag(year, lookup = homelessness_lookup) %>%
add_homelessness_date_flags(year, lookup = homelessness_lookup) %>%
link_delayed_discharge_eps(year, dd_data) %>%
write_temp_data(year, file_name = "ep_temp1-2", write_temp_to_disk) %>%
create_cost_inc_dna() %>%
apply_cost_uplift() %>%
store_ep_file_vars(
Expand Down Expand Up @@ -127,31 +131,23 @@ create_episode_file <- function(
write_temp_data(year, file_name = "ep_temp2", write_temp_to_disk) %>%
correct_cij_vars() %>%
fill_missing_cij_markers() %>%
add_homelessness_flag(year, lookup = homelessness_lookup) %>%
add_homelessness_date_flags(year, lookup = homelessness_lookup) %>%
add_ppa_flag() %>%
write_temp_data(year, file_name = "ep_temp3", write_temp_to_disk) %>%
link_delayed_discharge_eps(year, dd_data) %>%
add_nsu_cohort(year, nsu_cohort) %>%
match_on_ltcs(year, ltc_data) %>%
correct_demographics(year) %>%
write_temp_data(year, file_name = "ep_temp4", write_temp_to_disk) %>%
create_cohort_lookups(year) %>%
join_cohort_lookups(year) %>%
join_sparra_hhg(year) %>%
fill_geographies(
slf_pc_lookup,
slf_gpprac_lookup
) %>%
join_deaths_data(
year,
slf_deaths_lookup
) %>%
fill_geographies(slf_pc_lookup,
slf_gpprac_lookup) %>%
join_deaths_data(year,
slf_deaths_lookup) %>%
write_temp_data(year, file_name = "ep_temp5", write_temp_to_disk) %>%
add_activity_after_death_flag(year,
deaths_data = read_file(get_combined_slf_deaths_lookup_path()) %>%
slfhelper::get_chi()
) %>%
deaths_data = read_file(get_combined_slf_deaths_lookup_path()) %>%
slfhelper::get_chi()) %>%
load_ep_file_vars(year) %>%
write_temp_data(year, file_name = "ep_temp6", write_temp_to_disk)

Expand Down
1 change: 0 additions & 1 deletion R/link_delayed_discharge_eps.R
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ link_delayed_discharge_eps <- function(
# keep variables from ep files
dplyr::select(
-c(
"ep_file_row_id",
"year",
"recid",
"record_keydate1",
Expand Down
3 changes: 1 addition & 2 deletions R/write_temp_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ write_temp_data <-
full_file_name
)

cli::cli_alert_info(stringr::str_glue("Writing {full_file_name} to disk started at {Sys.time()}"))

write_file(data,
path = file_path
)
cli::cli_alert_info(stringr::str_glue("Writing {full_file_name} to disk finished at {Sys.time()}"))
}
return(data)
}
Expand Down

0 comments on commit 27d5bc7

Please sign in to comment.