Skip to content

Commit

Permalink
fix minor conflict
Browse files Browse the repository at this point in the history
Merge branch 'main' into bex

# Conflicts:
#	01_control/control_mmi.R
  • Loading branch information
bex-0-madden committed Sep 26, 2024
2 parents 4555ea1 + d42cbd4 commit b4dba3d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 6 deletions.
17 changes: 13 additions & 4 deletions 01_control/control_mmi.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,34 @@ source("./07_publication/script/chapters/3_set_constants.R")

# Step 3 - Analyse Data ---------------------------------------------------

summarise_referrals()
summarise_non_acceptance()

summarise_appointments_att() # key output "/appointments_att/apps_att_mth_hb.parquet"
summarise_patients_seen() # key outputs "/patients_seen/pat_seen_unadj_wait_grp_mth.parquet' and "/patients_seen/pat_seen_adj_wait_grp_mth.parquet'

summarise_open_cases()
summarise_referrals()
summarise_non_acceptance()

# Step 4 - Excel summaries ------------------------------------------------# being used?

compile_referrals_summary()
compile_non_acceptance_summary()
compile_appointments_summary()

compile_pat_seen_adj_summary()
compile_pat_seen_unadj_summary()
compile_appointments_summary()

compile_open_cases_summary()
compile_referrals_summary()
compile_non_acceptance_summary()

# Step 5 - Create plots ---------------------------------------------------
#
#create_plots_patients_seen("PT")
#create_plots_patients_seen("CAMHS")


# Step 6 - Create MMI excel doc -------------------------------------------




9 changes: 8 additions & 1 deletion 01_control/control_pre_shorewise.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,14 @@ df_captnd_checked <- rbind.fill(
df_checked_dis) |>
save_captnd_checked()


rm(df_checked_demo,
df_checked_ref,
df_checked_apps,
df_checked_unav,
df_checked_diag,
df_checked_dis,
df_captnd_checked,
df)

# 4 - Create DQ heatmap reports -------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion 10_pre_shorewise_scripts/dq_reporting/arrange_dq_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
arrange_dq_df <- function(df){

level_order_hb2 <- setdiff(level_order_hb, "NHS Scotland")
level_order_hb2 <- c("NHS Scotland", test)
level_order_hb2 <- c("NHS Scotland", level_order_hb2)

df_arranged <- df |>
mutate(hb_name = factor(hb_name, levels = level_order_hb2),
Expand Down
29 changes: 29 additions & 0 deletions 10_pre_shorewise_scripts/dq_reporting/update_dq_values.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,35 @@ update_dq_values <- function(wb){
startCol = 2, startRow = 2, #headerStyle = style_text,
colNames = FALSE, withFilter = FALSE, keepNA = TRUE, na.string = "-")

# trend - alternative table with tic marks
df_trend2 <- read_parquet(paste0(pre_shorewise_output_dir, "/02_data_quality/captnd_dq_clean_all.parquet")) |>
mutate(header_date_month = format(as.Date(header_date_month), "%b %Y"),
value = str_to_title(value),
value = factor(value, levels = c("Known", "Missing", "Invalid", "Not Known"))) |>
arrange(header_date_month, dataset_type, hb_name, variable, value) |>
select(Month = header_date_month,
Dataset = dataset_type,
`Health Board` = hb_name,
Variable = variable,
`Submission Status` = submission_status,
PMS = pms,
`DQ Assessment` = value,
-count, -total, Proportion = proportion) |>
pivot_wider(names_from = Month, values_from = Proportion)

export(df_trend2,
file = paste0(pre_shorewise_output_dir, "/02_data_quality/captnd_dq_trend_summary"),
format = "xlsx")

# deleteData(wb, sheet = "Trend Summary", cols = 2:14, rows = 2:19681, gridExpand = TRUE)

# writeData(wb, sheet = "Trend Summary",
# x = df_trend2,
# startCol = 2, startRow = 2, #headerStyle = style_text,
# colNames = FALSE, withFilter = FALSE, keepNA = TRUE, na.string = "-")



# update references
vec_hb <- unique(df_trend$`Health Board`)
writeData(wb, sheet = "Refs",
Expand Down

0 comments on commit b4dba3d

Please sign in to comment.