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

Investigate missing datazone from episode file #773

Merged
merged 10 commits into from
Aug 2, 2023
3 changes: 2 additions & 1 deletion R/create_individual_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,8 @@ join_slf_lookup_vars <- function(individual_file,
#' @param year financial year.
#' @param sc_client SC client lookup
#' @param sc_demographics SC Demographic lookup
join_sc_client <- function(individual_file,
join_sc_client <- function(
individual_file,
year,
sc_client = read_file(get_source_extract_path(year, "Client")),
sc_demographics = read_file(get_sc_demog_lookup_path(),
Expand Down
4 changes: 4 additions & 0 deletions R/process_extract_ae.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ process_extract_ae <- function(data, year, write_to_disk = TRUE) {
.data$postcode_chi,
.data$postcode_epi
)) %>%
# A&E data has postcode in PC8 format but we need it in PC7 format
dplyr::mutate(
postcode = phsmethods::format_postcode(.data$postcode, "pc7")
) %>%
## recode cypher HB codes ##
dplyr::mutate(
dplyr::across(c("hbtreatcode", "hbrescode"), ~ dplyr::case_when(
Expand Down
3 changes: 2 additions & 1 deletion R/process_lookup_gpprac.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#' @return the final data as a [tibble][tibble::tibble-package].
#' @export
#' @family process extracts
process_lookup_gpprac <- function(open_data = get_gpprac_opendata(),
process_lookup_gpprac <- function(
open_data = get_gpprac_opendata(),
gpprac_ref_path = get_gpprac_ref_path(),
spd_path = get_spd_path(),
write_to_disk = TRUE) {
Expand Down
5 changes: 2 additions & 3 deletions R/read_lookup_sc_client.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
#' @return the final data as a [tibble][tibble::tibble-package].
#' @export
#' @family process extracts
read_lookup_sc_client <- function(
fyyear,
sc_dvprod_connection = phs_db_connection(dsn = "DVPROD")) {
read_lookup_sc_client <- function(fyyear,
sc_dvprod_connection = phs_db_connection(dsn = "DVPROD")) {
check_year_format(fyyear)
year <- convert_fyyear_to_year(fyyear)

Expand Down
3 changes: 1 addition & 2 deletions R/read_lookup_sc_demographics.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#' @return a [tibble][tibble::tibble-package]
#' @export
#'
read_lookup_sc_demographics <- function(
sc_connection = phs_db_connection(dsn = "DVPROD")) {
read_lookup_sc_demographics <- function(sc_connection = phs_db_connection(dsn = "DVPROD")) {
sc_demog <- dplyr::tbl(
sc_connection,
dbplyr::in_schema("social_care_2", "demographic_snapshot")
Expand Down
3 changes: 1 addition & 2 deletions R/read_sc_all_alarms_telecare.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#'
#' @export
#'
read_sc_all_alarms_telecare <- function(
sc_dvprod_connection = phs_db_connection(dsn = "DVPROD")) {
read_sc_all_alarms_telecare <- function(sc_dvprod_connection = phs_db_connection(dsn = "DVPROD")) {
# Read in data---------------------------------------

## read in data - social care 2 demographic
Expand Down
4 changes: 3 additions & 1 deletion R/run_episode_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ run_episode_file <- function(
NA_character_,
.data$chi
),
gpprac = convert_eng_gpprac_to_dummy(.data[["gpprac"]])
gpprac = convert_eng_gpprac_to_dummy(.data[["gpprac"]]),
# PC8 format may still be used. Ensure here that all datasets are in PC7 format.
postcode = phsmethods::format_postcode(.data$postcode, "pc7")
) %>%
correct_cij_vars() %>%
fill_missing_cij_markers() %>%
Expand Down
Loading