knitr::opts_chunk$set(echo = FALSE) library(ggplot2) library(tidyverse)
include_graphics("LOMWRU.jpg")
Antimicrobial resistance is a great public health concern in Laos now. Misuse of antimicrobials is likely to be a key driver of the worsening AMR situation in Laos. The use of antimicrobials in hospital has not been well documented in Laos. Conducting point prevalence surveys (PPS) on hospital AMU in Laos is one method for monitoring the rational use of antimicrobials in Laos.
dta_patient <- patients_filter() %>% mutate(spec_quarter = floor_date(surdate, "3 months")) %>% mutate(spec_quarter = as.character(quarter(spec_quarter, with_year = TRUE))) %>% group_by(spec_quarter, ipdopd) %>% summarise(n = n_distinct(patient_id), .groups = "drop") # Complete dataset missing <- seq(min(patients_filter()$surdate), max(patients_filter()$surdate), by = "month") %>% floor_date("3 months") %>% quarter(with_year = TRUE) %>% as.character() %>% unique() %>% setdiff(unique(dta_patient$spec_quarter)) dta_patient <- bind_rows(dta_patient, tibble(spec_quarter = missing, n = 0)) %>% arrange(spec_quarter) %>% mutate(spec_quarter = str_replace(spec_quarter, "[.]", " Q")) %>% complete(spec_quarter, ipdopd, fill = list(n = 0)) %>% filter(!is.na(ipdopd)) dta_ward <- wards_filter() %>% mutate(spec_quarter = floor_date(surdate, "3 months")) %>% mutate(spec_quarter = as.character(quarter(spec_quarter, with_year = TRUE))) %>% mutate(screened_patient = case_when( ipdopd == "Inpatient" ~ numadm, ipdopd == "Outpatient" ~ numconsu )) %>% group_by(spec_quarter, ipdopd) %>% summarise(nb_screened_patient = sum(screened_patient), .groups = "drop") # Complete dataset missing <- seq(min(wards_filter()$surdate), max(wards_filter()$surdate), by = "month") %>% floor_date("3 months") %>% quarter(with_year = TRUE) %>% as.character() %>% unique() %>% setdiff(unique(dta_ward$spec_quarter)) dta_ward <- bind_rows(dta_ward, tibble(spec_quarter = missing, nb_screened_patient = 0)) %>% arrange(spec_quarter) %>% mutate(spec_quarter = str_replace(spec_quarter, "[.]", " Q")) %>% complete(spec_quarter, ipdopd, fill = list(nb_screened_patient = 0)) %>% filter(!is.na(ipdopd)) dta <- left_join(dta_ward, dta_patient, by = c("spec_quarter", "ipdopd")) %>% mutate(prop_receiving_am = round(100*n / nb_screened_patient, 1)) dta %>% ggplot(aes(x = spec_quarter, y = prop_receiving_am, fill = ipdopd)) + scale_fill_manual(values = c("Inpatient" = "#af8dc3", "Outpatient" = "#f1a340")) + geom_bar(stat = "identity", position = "dodge") + labs(title = "Patients Receiving an Antimicrobial Prescription", x = "", y = "%") + theme_light(base_size = 17) + theme(axis.text.x = element_text(angle = 90), legend.title = element_blank())
print(dta)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.