Missing structured treatment [Mandatory check r qc_missing_treatment_id]

write(" o Missing structured treatment", stderr())
qc_description <- "All participants should have their antimicrobials entered in a structured way and not in free text to facilitate the statistical analysis."
qc_rule <- action_alert_no_modification
qc_type <- "free_text_missing_structured_entry"
df <- day0_data
qc_text <- "free text drug"
qc_idx <- paste0(qc_free_text_rx_id, 'a')
qc_export_label <- "missing_structured_treatment"
qc_export_description <- "the treatments should have been entered in a structured manner"
cat(knitr::knit_child('database_export_sub_quality_check.Rmd',
                      envir = environment(),
                      quiet = TRUE))
n_free_text_rx_cg <- n_detected
fig_df <- day0_data %>%
  dplyr::mutate(week = as.Date(lubridate::floor_date(as.Date(start), "week", week_start = getOption("lubridate.week.start", 1)))) %>% 
  dplyr::mutate("Structured treatment entry" = dplyr::case_when(
    ( !is.na(rx_amoxicillin) & !is.na(rx_misc) & rx_misc != "996" ) | ( is.na(rx_amoxicillin_hf) & ( is.na(rx_misc_hf) | rx_misc_hf == "996" ) ) ~ "a) Yes",
    .default                                                                                                                                     = "b) No"))

fig_caption <- "Spatiotemporal pattern of treatments"
facility_col <- "fid"
date_col <- "week"
date_lbl <- "Weeks"
date_format <- "%b%y"
comparison <- "type"
fill_col <- "Structured treatment entry"

cat(knitr::knit_child('database_export_sub_facet_bar_plot.Rmd',
                      envir = environment(),
                      quiet = TRUE))
mc_description <- "Update with reentered drug data"
to_correct_df <- day0_data
correction_type <- "correct_day0_drugs"

# Parameters for the quality check following manual corrections
qc_idx <- paste0(qc_free_text_rx_id, 'b')

cat(knitr::knit_child('database_export_sub_corrections.Rmd',
                      envir = environment(),
                      quiet = TRUE))

day0_data <- corrected_df
n_drug_edits <- n_mc
n_free_text_rx_cg <- n_detected
fig_df <- day0_data %>%
  dplyr::mutate(week = as.Date(lubridate::floor_date(as.Date(start), "week", week_start = getOption("lubridate.week.start", 1)))) %>% 
  dplyr::mutate("Structured treatment entry" = dplyr::case_when(
    ( !is.na(rx_amoxicillin) & !is.na(rx_misc) & rx_misc != "996" ) | ( is.na(rx_amoxicillin_hf) & ( is.na(rx_misc_hf) | rx_misc_hf == "996" ) ) ~ "a) Yes",
    .default                                                                                                                                     = "b) No"))

fig_caption <- "Spatiotemporal pattern of treatments"
facility_col <- "fid"
date_col <- "week"
date_lbl <- "Weeks"
date_format <- "%b%y"
comparison <- "type"
fill_col <- "Structured treatment entry"

cat(knitr::knit_child('database_export_sub_facet_bar_plot.Rmd',
                      envir = environment(),
                      quiet = TRUE))


Thaliehln/timci documentation built on April 8, 2024, 3:38 p.m.