opts_chunk$set(echo = FALSE)
include_graphics("img_ACORN_logo.png")

Version r version


ACORN (“A Clinically Oriented antimicrobial Resistance Network”) is intended to generate patient-focused and clinically actionable AMR surveillance data. Details of the ACORN project protocol can be found here: https://wellcomeopenresearch.org/articles/5-13.

ACORN includes data on both community-acquired infections (CAI) and hospital-acquired infections (HAI). The six key ACORN pathogens are the WHO bloodstream infection priority pathogens Acinetobacter baumannii, Escherichia coli, Klebsiella pneumoniae, Staphylococcus aureus, Streptococcus pneumoniae, and Salmonella sp.

This report contains a summary report of patients enrolled into ACORN, their clinical infection syndromes, associated pathogens and resistance profiles, and outcomes. Care should be taken when interpreting rates and AMR profiles where there are small numbers of cases or bacterial isolates: point estimates may be unreliable.

This report was generated the r Sys.time() from the possibly filtered patient dataset in the ACORN App. Using different filter values, one can generate as many reports as required.

Links to the sections:

# Test is there is at least one isolate for the pathogen
test_data <- function(mic = microbio_filter_blood(), pat = patient_filter(), organism_input) {
  data <- left_join(
    mic,
    pat %>% select(episode_id, surveillance_cat),
    by = 'episode_id') %>%
    filter(organism %in% organism_input)

  nb_isolates <- data %>% nrow()

  return(nb_isolates > 0)
}
cols_sir <- c("Resistant" = "#b2182b", "Susceptible" = NA)

ggplot_sir <- function(mic = microbio_filter_blood(), 
                       pat = patient_filter(), corresp = corresp_org_antibio(), organism_input, matching_name_column, title, surv_cat) {

  if(length(organism_input) == 0) return(
    ggplot() + 
      theme_minimal(base_size = 18) +
      theme(panel.spacing = unit(2, "lines"), panel.grid.minor = element_blank(),
            panel.grid.major.x = element_blank(),
            axis.text.x = element_text(angle = 30, hjust = 1, vjust = 1),
            plot.title = element_text(size = 20),
            legend.position = "none") +
      labs(title = paste0(title, ": No data to display"), y = NULL, x = NULL)
  )

  data <- left_join(
    mic,
    pat %>% select(episode_id, surveillance_cat),
    by = 'episode_id') %>%
    filter(organism %in% organism_input) %>%
    filter(surveillance_cat %in% surv_cat) %>%
    fun_deduplication(method = input$deduplication_method)


  data <- data %>%
    select(specimen_id, 9:ncol(data)) %>%
    pivot_longer(-specimen_id) %>%
    filter(value %in% c("S", "I", "R")) %>%
    mutate(value = recode(value, S = "Susceptible", I = "Susceptible", R = "Resistant")) %>%
    group_by(name) %>%
    count(value) %>%
    ungroup() %>%
    complete(name, value, fill = list(n = 0))

  total_tested <- data %>%
    group_by(name) %>%
    summarise(total_org = sum(n), .groups = "drop")

  sir_results <- data %>%
    left_join(total_tested, by = "name") %>%
    mutate(percent = round(100*n / total_org, 1),
           text = paste0(n, " of ", total_org))

  sir_results <- left_join(sir_results, corresp, by = c('name' = 'antibio_code')) %>%
    filter(UQ(as.symbol(matching_name_column)) == "show") %>%
    mutate(antibio = paste0(antibio_group, ", ", antibio_name)) %>%
    select(antibio, value, n, text, percent) %>%
    complete(antibio, value, fill = list(n = 0, percent = 0, text = "no resistant")) %>%
    mutate(value  = factor(value, levels = c("Resistant", "Susceptible")))

  if(sir_results %>% nrow() == 0) return(
    ggplot() + 
      theme_minimal(base_size = 18) +
      theme(panel.spacing = unit(2, "lines"), panel.grid.minor = element_blank(),
            panel.grid.major.x = element_blank(),
            axis.text.x = element_text(angle = 30, hjust = 1),
            plot.title = element_text(size = 20),
            legend.position = "none") +
      labs(title = paste0(title, ": No data to display"), y = NULL, x = NULL)
  )

  ggplot(sir_results, aes(x = stats::reorder(antibio, desc(antibio)), y = percent, fill = value)) +
    geom_col(color = NA, position = position_stack(reverse = TRUE)) +
    geom_text(data = sir_results %>% filter(value == "Resistant"), aes(label = text), size = 6, hjust = -0.1) +
    labs(x = NULL, y = "Antibio") +
    scale_fill_manual(values = cols_sir) +
    coord_flip(ylim = c(0, 110)) +
    scale_y_continuous(breaks = c(0, 25, 50, 75, 100)) + 
    theme_minimal(base_size = 20) +
    theme(panel.spacing = unit(2, "lines"), panel.grid.minor = element_blank(),
          panel.grid.major.y = element_blank(),
          plot.title = element_text(size = 22),
          legend.position = "none") +
    labs(title = title, y = "% of Resistant Isolates", x = NULL, fill = NULL) +
    scale_x_discrete()
}
table_bacteraemia <- function(pat, mic, org, blood) {
  # prepare datasets for merging
  pat <- pat %>%
    mutate(surveillance_cat = factor(surveillance_cat, levels = c("CAI", "HAI")),
           surveillance_diag = factor(surveillance_diag, levels = c("Meningitis", "Pneumonia", "Sepsis"))) %>%
    select(surveillance_cat, surveillance_diag, episode_id)

  # add "surveillance_cat" and "surveillance_diag" to mic
  mic <- left_join(mic, pat, by = 'episode_id')

  # the column "Enrolments w/ bacteraemia" is independent on the type of specimen
  dta_enrolments <- mic %>%
    filter(organism %in% org, specimen_type == "Blood") %>%
    group_by(surveillance_cat, surveillance_diag, .drop = FALSE) %>%
    summarise(enrolments = n_distinct(episode_id), .groups = "drop")

  # the column "Total Enrolments..." depends on the type of specimen
  if(blood) {
    header_tot <- "Total Enrolments w/ Blood Culture"

    episode_blood <- mic %>% filter(specimen_type == "Blood") %>% pull(episode_id)

    dta_total_enrolments <- pat %>%
      filter(episode_id %in% episode_blood) %>%
      group_by(surveillance_cat, surveillance_diag) %>%
      summarise(total_enrolments = n_distinct(episode_id), .groups = "drop")
  }

  if(! blood) {
    header_tot <- "Total Enrolments"

    dta_total_enrolments <- pat %>%
      group_by(surveillance_cat, surveillance_diag) %>%
      summarise(total_enrolments = n_distinct(episode_id), .groups = "drop")
  }

  # Merge datasets
  dta <- left_join(
    dta_enrolments,
    dta_total_enrolments,
    by = c("surveillance_cat", "surveillance_diag")) %>%
    # per 1,000 column
    mutate(per1000 = round(1000 * enrolments/total_enrolments, 1)) %>%
    complete(surveillance_cat, surveillance_diag, fill = list(enrolments = 0, total_enrolments = 0, per1000 = 0))


  if(nrow(dta) >= 1) {
    return(
      flextable(dta) %>%
        set_header_labels(surveillance_cat = "", surveillance_diag = "", 
                          enrolments = "Enrolments w/ bacteraemia", total_enrolments = header_tot, per1000 = "per 1,000") %>%
        bold(j = ncol(dta)) %>%
        bold(part = "header") %>%
        merge_v(j = ~ surveillance_cat) %>%
        autofit()
    )
  }
}

Data Summary

add_text <- function(text)  paste0(feedback_text, " ~~~ ", text)

# Summary
start <- patient() %>% nrow()
end <- patient_filter() %>% nrow()
prop <- round(100 * end / start, 0)
if(start == end) feedback_text <- paste0("All ", start, " patients selected.")
if(start != end) feedback_text <- paste0(end, " patients selected (", prop, "% of ", start, ").")

# Surveillance Category
if(input$filter_category == "CAI") feedback_text <- add_text("Community Acquired Infections.")
if(input$filter_category == "HAI") feedback_text <- add_text("Hospital Acquired Infections.")

# Type of ward
if(! identical(input$filter_type_ward, sort(unique(patient()$ward)))) feedback_text <- add_text(paste0("Admitted in ", paste(input$filter_type_ward, collapse = ", "), " wards"))

# Date of enrollment (always displayed)
feedback_text <- add_text(paste0("Patients enrolled between ", min(patient_filter()$date_enrollment), " and ", max(patient_filter()$date_enrollment), "."))

# Age
if(input$filter_age_min > 0 | input$filter_age_max < 99) {
  feedback_text <- add_text(paste0("Aged ", input$filter_age_min, " to ", input$filter_age_max, " ", input$filter_age_unit))
}
if(! input$filter_age_na) {
  feedback_text <- add_text("Excluding missing ages")
}

# Patient diagnosis
if(length(input$filter_diagnosis) != 3) {
  feedback_text <- add_text(paste0("Patients diagnosed with ", paste(input$filter_diagnosis, collapse = " or "), " only"))
}

# Diagnosis confirmation
if(input$confirmed_diagnosis %in% c("Diagnosis confirmed", "Diagnosis rejected")) feedback_text <- add_text(paste0(input$confirmed_diagnosis, " by clinical outcome"))

# Outcomes
if(input$filter_outcome_clinical & !input$filter_outcome_d28)  feedback_text <- add_text("Patients with clinical outcome")
if(!input$filter_outcome_clinical & input$filter_outcome_d28)  feedback_text <- add_text("Patients with D28-outcome")
if(input$filter_outcome_clinical & input$filter_outcome_d28)  feedback_text <- add_text("Patients with clinical and D28-outcome")

# Comorbidities
if(input$filter_comorb)  feedback_text <- add_text("At least one Comorbidity")
if(input$filter_cancer)  feedback_text <- add_text("With Cancer")
if(input$filter_renal)  feedback_text <- add_text("With Chronic Renal Failure")
if(input$filter_lung)  feedback_text <- add_text("With Chronic Lung Disease")
if(input$filter_diabetes)  feedback_text <- add_text("With Diabetes mellitus")
if(input$filter_malnutrition)  feedback_text <- add_text("With Malnutrition")

# Clinical severity
if(input$filter_clinical_severity)  feedback_text <- add_text("With one qSOFA/Paediatric severity point")

# Prior hospitalisation
if(input$filter_overnight_3months)  feedback_text <- add_text("With prior hospitalisation (in the past three months)")

# Surgery
if(input$filter_surgery_3months)  feedback_text <- add_text("With surgery in the past three months")

# Presence of medical devices
if(input$filter_medical_p_catheter)  feedback_text <- add_text("With Peripheral IV catheter")
if(input$filter_medical_c_catheter)  feedback_text <- add_text("With Central IV catheter")
if(input$filter_medical_u_catheter)  feedback_text <- add_text("With Urinary catheter")
if(input$filter_medical_ventilation)  feedback_text <- add_text("With Intubation / Mechanical ventilation")

# Ward
if(! identical(input$filter_ward, sort(unique(patient()$ward_text))))  feedback_text <- add_text(paste0("Admitted in ", paste(input$filter_ward, collapse = ", "), " wards"))

# Empiric Antibiotics Prescribed
if(! is.null(input$filter_type_antibio)) feedback_text <- add_text(paste0("Prescribed with ", paste(input$filter_type_antibio, collapse = ", ")))

# Return text
return(HTML(feedback_text))
if(length(input$filter_method_collection) == 2)  feedback_text <- paste0("All specimen types.")
if(length(input$filter_method_collection) == 1) {
  if(input$filter_method_collection == "blood") feedback_text <- paste0("(Filter) Only Blood specimens.")
  if(input$filter_method_collection == "other_not_blood") feedback_text <- paste0("(Filter) Specimen types: ", paste(input$filter_method_other, collapse = ", "), ".")
}
feedback_text <- add_text(input$deduplication_method)

# Return text
return(HTML(feedback_text))

Patients Per Surveillance Category {#surv_category}

Type of ward:

dta <- patient_filter() %>%
  group_by(ward, surveillance_cat) %>%
  summarise(patients = n(), .groups = "drop") %>%
  complete(surveillance_cat, ward) %>%
  mutate(patients = replace_na(patients, 0)) %>%
  pivot_wider(names_from = surveillance_cat, values_from = patients) %>%

  # add totals
  bind_rows(summarise_all(., ~ (if(is.numeric(.)) sum(.) else "Total"))) %>%
  mutate(Total = rowSums(.[-1]))

# Alternative code (summarise_all is superseded):
# dta <- patient_filter() %>%
#   group_by(ward, surveillance_cat) %>%
#   summarise(patients = n(), .groups = "drop") %>%
#   complete(surveillance_cat, ward) %>%
#   mutate(patients = replace_na(patients, 0)) %>%
#   pivot_wider(names_from = surveillance_cat, values_from = patients)
# 
# # add totals
# total_row <- bind_cols(tibble(ward = "Total"), dta %>% summarise(across(where(is.numeric), ~ sum(.x))))
# dta <- bind_rows(dta, total_row) %>% mutate(Total = rowSums(.[-1]))

# create table
flextable(dta) %>%
  set_header_labels(ward = "") %>%
  autofit() %>%
  bold(i = nrow(dta)) %>%
  bold(j = ncol(dta)) %>%
  bold(part = "header")

Age Category:

dta <- patient_filter() %>%
  mutate(age_category = case_when(
    age < 28 / 365 ~ "0-27 days",
    age < 1 ~ "1 month to  1 year",
    age < 5 ~ "1 to  5 years",
    TRUE ~ "Above 5 years")) %>%
  mutate(age_category = factor(age_category, levels = c("0-27 days", "1 month to  1 year", "1 to  5 years", "Above 5 years"))) %>%
  group_by(age_category, surveillance_cat) %>%
  summarise(patients = n(), .groups = "drop") %>%
  complete(surveillance_cat, age_category) %>%
  mutate(patients = replace_na(patients, 0)) %>%
  pivot_wider(names_from = surveillance_cat, values_from = patients) %>%
  mutate(age_category = as.character(age_category)) %>%

  # add totals
  bind_rows(summarise_all(., ~ (if(is.numeric(.)) sum(.) else "Total"))) %>%
  mutate(Total = rowSums(.[-1]))

# create table
flextable(dta) %>%
  set_header_labels(age_category = "") %>%
  autofit() %>%
  bold(i = nrow(dta)) %>%
  bold(j = ncol(dta)) %>%
  bold(part = "header")

Suspected Diagnosis:

dta <- patient_filter() %>%
  group_by(surveillance_diag, surveillance_cat) %>%
  summarise(patients = n(), .groups = "drop") %>%
  complete(surveillance_cat, surveillance_diag) %>%
  mutate(patients = replace_na(patients, 0)) %>%
  pivot_wider(names_from = surveillance_cat, values_from = patients) %>%

  # add totals
  bind_rows(summarise_all(., ~ (if(is.numeric(.)) sum(.) else "Total"))) %>%
  mutate(Total = rowSums(.[-1]))

# create table
flextable(dta) %>%
  set_header_labels(surveillance_diag = "") %>%
  autofit() %>%
  bold(i = nrow(dta)) %>%
  bold(j = ncol(dta)) %>%
  bold(part = "header")

Hospital Discharge Status:

dta <- patient_filter() %>%
  group_by(discharge_status, surveillance_cat) %>%
  summarise(patients = n(), .groups = "drop") %>%
  complete(surveillance_cat, discharge_status) %>%
  mutate(patients = replace_na(patients, 0)) %>%
  pivot_wider(names_from = surveillance_cat, values_from = patients) %>%

  # add totals
  bind_rows(summarise_all(., ~ (if(is.numeric(.)) sum(.) else "Total"))) %>%
  mutate(discharge_status = replace_na(discharge_status, "Unknown")) %>%
  mutate(Total = rowSums(.[-1]))

# create table
flextable(dta) %>%
  set_header_labels(discharge_status = "") %>%
  autofit() %>%
  bold(i = nrow(dta)) %>%
  bold(j = ncol(dta)) %>%
  bold(part = "header")


Day 28 Status:

dta <- patient_filter() %>%
  group_by(status_d28, surveillance_cat) %>%
  summarise(patients = n(), .groups = "drop") %>%
  complete(surveillance_cat, status_d28) %>%
  mutate(patients = replace_na(patients, 0)) %>%
  pivot_wider(names_from = surveillance_cat, values_from = patients) %>%

  # add totals
  bind_rows(summarise_all(., ~ (if(is.numeric(.)) sum(.) else "Total"))) %>%
  mutate(status_d28 = replace_na(status_d28, "Unknown")) %>%
  mutate(Total = rowSums(.[-1]))

# create table
flextable(dta) %>%
  set_header_labels(status_d28 = "") %>%
  autofit() %>%
  bold(i = nrow(dta)) %>%
  bold(j = ncol(dta)) %>%
  bold(part = "header")

Patients Per Diagnosis {#diagnosis}

Type of ward:

dta <- patient_filter() %>%
  group_by(ward, surveillance_diag) %>%
  summarise(patients = n(), .groups = "drop") %>%
  complete(surveillance_diag, ward) %>%
  mutate(patients = replace_na(patients, 0)) %>%
  pivot_wider(names_from = surveillance_diag, values_from = patients) %>%


  # add totals
  bind_rows(summarise_all(., ~ (if(is.numeric(.)) sum(.) else "Total"))) %>%
  mutate(Total = rowSums(.[-1]))

# create table
flextable(dta) %>%
  set_header_labels(ward = "") %>%
  autofit() %>%
  bold(i = nrow(dta)) %>%
  bold(j = ncol(dta)) %>%
  bold(part = "header")

Age Category:

dta <- patient_filter() %>%
  mutate(age_category = case_when(
    age < 28 / 365 ~ "0-27 days",
    age < 1 ~ "1 month to  1 year",
    age < 5 ~ "1 to  5 years",
    TRUE ~ "Above 5 years")) %>%
  mutate(age_category = factor(age_category, levels = c("0-27 days", "1 month to  1 year", "1 to  5 years", "Above 5 years"))) %>% 
  group_by(age_category, surveillance_diag) %>%
  summarise(patients = n(), .groups = "drop") %>%
  complete(surveillance_diag, age_category) %>%
  mutate(patients = replace_na(patients, 0)) %>%
  pivot_wider(names_from = surveillance_diag, values_from = patients) %>%
  mutate(age_category = as.character(age_category)) %>%

  # add totals
  bind_rows(summarise_all(., ~ (if(is.numeric(.)) sum(.) else "Total"))) %>%
  mutate(Total = rowSums(.[-1]))

# create table
flextable(dta) %>%
  set_header_labels(age_category = "") %>%
  autofit() %>%
  bold(i = nrow(dta)) %>%
  bold(j = ncol(dta)) %>%
  bold(part = "header")

Hospital Discharge Status:

dta <- patient_filter() %>%
  group_by(discharge_status, surveillance_diag) %>%
  summarise(patients = n(), .groups = "drop") %>%
  complete(surveillance_diag, discharge_status) %>%
  mutate(patients = replace_na(patients, 0)) %>%
  pivot_wider(names_from = surveillance_diag, values_from = patients) %>%

  # add totals
  bind_rows(summarise_all(., ~ (if(is.numeric(.)) sum(.) else "Total"))) %>%
  mutate(discharge_status = replace_na(discharge_status, "Unknown")) %>%
  mutate(Total = rowSums(.[-1]))

# create table
flextable(dta) %>%
  set_header_labels(discharge_status = "") %>%
  autofit() %>%
  bold(i = nrow(dta)) %>%
  bold(j = ncol(dta)) %>%
  bold(part = "header")

Day 28 Status:

dta <- patient_filter() %>%
  group_by(status_d28, surveillance_diag) %>%
  summarise(patients = n(), .groups = "drop") %>%
  complete(surveillance_diag, status_d28) %>%
  mutate(patients = replace_na(patients, 0)) %>%
  pivot_wider(names_from = surveillance_diag, values_from = patients) %>%

  # add totals
  bind_rows(summarise_all(., ~ (if(is.numeric(.)) sum(.) else "Total"))) %>%
  mutate(status_d28 = replace_na(status_d28, "Unknown")) %>%
  mutate(Total = rowSums(.[-1]))

# create table
flextable(dta) %>%
  set_header_labels(status_d28 = "") %>%
  autofit() %>%
  bold(i = nrow(dta)) %>%
  bold(j = ncol(dta)) %>%
  bold(part = "header")

Enrolments with Blood Cultures {#bc}

Enrolments with Blood Culture / Total enrolments.

# Add surveillance category, surveillance diagnosis to microbio
mic <- left_join(microbio_filter_blood(), 
                 patient_filter() %>% select(surveillance_cat, surveillance_diag, episode_id),
                 by = 'episode_id')

dta <- left_join(
  # Enrolments with Blood Culture
  mic %>%
    group_by(surveillance_cat, surveillance_diag) %>%
    summarise(blood = n_distinct(episode_id), .groups = "drop"),
  # Total Enrolments
  patient_filter() %>%
    group_by(surveillance_cat, surveillance_diag) %>%
    summarise(all = n_distinct(episode_id), .groups = "drop"),
  by = c("surveillance_cat", "surveillance_diag")) %>%
  mutate(percent = round(100 * blood/all, 1)) %>%
  complete(surveillance_cat, surveillance_diag, fill = list(blood = 0, all = 0, percent = 0))


flextable(dta) %>%
  set_header_labels(surveillance_cat = "", surveillance_diag = "", blood = "Enrolments with Blood Culture", all = "Total Enrolments", percent = "% Blood Culture")  %>%
  bold(j = ncol(dta)) %>%
  bold(part = "header") %>%
  merge_v(j = ~ surveillance_cat) %>%
  autofit()

Key Pathogens

The six key pathogens are Acinetobacter baumannii, Escherichia coli, Klebsiella pneumoniae, Staphylococcus aureus, Streptococcus pneumoniae, and Salmonella combined.

In the following figures, the "Susceptible" and "Intermediate" categories are merged into one category labelled "Susceptible", following EUCAST new definitions of S, I and R from 2019.

For clarity, the following sections just include AMR data on blood culture isolates. AMR data on other specimen types can be visualized via the ACORN dashboard.


Acinetobacter baumannii {#a_baumannii}

org <- "Acinetobacter baumannii"
match <- "a_baumannii"
show <- test_data(mic = microbio_filter_blood(), pat = patient_filter(), organism_input = org)

r if(!show){"There are no isolates for this pathogen."}

g1 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "All Infections", surv_cat = c("CAI", "HAI"))
g2 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "Community Acquired Infections", surv_cat = "CAI")
g3 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "Hospital Acquired Infections", surv_cat = "HAI")
grid.arrange(g1, g2, g3, ncol = 1)

r if(show){"*Acinetobacter baumannii* bacteraemia per 1,000 enrolments:"}

table_bacteraemia(pat = patient_filter(), mic = microbio_filter(), org = org, blood = FALSE)

r if(show){"*Acinetobacter baumannii* bacteraemia per 1,000 blood cultured infection episodes:"}

table_bacteraemia(pat = patient_filter(), mic = microbio_filter_blood(), org = org, blood = TRUE)

Escherichia coli {#e_coli}

org <- "Escherichia coli"
match <- "e_coli"
show <- test_data(mic = microbio_filter_blood(), pat = patient_filter(), organism_input = org)

r if(!show){"There are no isolates for this pathogen."}

g1 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "All Infections", surv_cat = c("CAI", "HAI"))
g2 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "Community Acquired Infections", surv_cat = "CAI")
g3 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "Hospital Acquired Infections", surv_cat = "HAI")
grid.arrange(g1, g2, g3, ncol = 1)

r if(show){"*Escherichia coli* bacteraemia per 1,000 enrolments:"}

table_bacteraemia(pat = patient_filter(), mic = microbio_filter(), org = org, blood = FALSE)

r if(show){"*Escherichia coli* bacteraemia per 1,000 blood cultured infection episodes:"}

table_bacteraemia(pat = patient_filter(), mic = microbio_filter_blood(), org = org, blood = TRUE)

Klebsiella pneumoniae {#k_pneumoniae}

org <- "Klebsiella pneumoniae"
match <- "k_pneumoniae"
show <- test_data(mic = microbio_filter_blood(), pat = patient_filter(), organism_input = org)

r if(!show){"There are no isolates for this pathogen."}

g1 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "All Infections", surv_cat = c("CAI", "HAI"))
g2 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "Community Acquired Infections", surv_cat = "CAI")
g3 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "Hospital Acquired Infections", surv_cat = "HAI")
grid.arrange(g1, g2, g3, ncol = 1)

r if(show){"*Klebsiella pneumoniae* bacteraemia per 1,000 enrolments:"}

table_bacteraemia(pat = patient_filter(), mic = microbio_filter(), org = org, blood = FALSE)

r if(show){"*Klebsiella pneumoniae* bacteraemia per 1,000 blood cultured infection episodes:"}

table_bacteraemia(pat = patient_filter(), mic = microbio_filter_blood(), org = org, blood = TRUE)

Staphylococcus aureus {#s_aureus}

org <- "Staphylococcus aureus"
match <- "s_aureus"
show <- test_data(mic = microbio_filter_blood(), pat = patient_filter(), organism_input = org)

r if(!show){"There are no isolates for this pathogen."}

g1 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "All Infections", surv_cat = c("CAI", "HAI"))
g2 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "Community Acquired Infections", surv_cat = "CAI")
g3 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "Hospital Acquired Infections", surv_cat = "HAI")
grid.arrange(g1, g2, g3, ncol = 1)

r if(show){"*Staphylococcus aureus* bacteraemia per 1,000 enrolments:"}

table_bacteraemia(pat = patient_filter(), mic = microbio_filter(), org = org, blood = FALSE)

r if(show){"*Staphylococcus aureus* bacteraemia per 1,000 blood cultured infection episodes:"}

table_bacteraemia(pat = patient_filter(), mic = microbio_filter_blood(), org = org, blood = TRUE)

Streptococcus pneumoniae {#s_pneumoniae}

org <- "Streptococcus pneumoniae"
match <- "s_pneumoniae"
show <- test_data(mic = microbio_filter_blood(), pat = patient_filter(), organism_input = org)

r if(!show){"There are no isolates for this pathogen."}

g1 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "All Infections", surv_cat = c("CAI", "HAI"))
g2 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "Community Acquired Infections", surv_cat = "CAI")
g3 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "Hospital Acquired Infections", surv_cat = "HAI")
grid.arrange(g1, g2, g3, ncol = 1)

r if(show){"*Streptococcus pneumoniae* bacteraemia per 1,000 enrolments:"}

table_bacteraemia(pat = patient_filter(), mic = microbio_filter(), org = org, blood = FALSE)

r if(show){"*Streptococcus pneumoniae* bacteraemia per 1,000 blood cultured infection episodes:"}

table_bacteraemia(pat = patient_filter(), mic = microbio_filter_blood(), org = org, blood = TRUE)

Salmonella combined (S. typhi, S. paratyphi, and Salmonella sp.) {#salmonella}

vec <- unique(microbio_filter_blood()$organism)
org <- vec[str_detect(vec, "Salmonella")]
match <- "salmonella_species"
show <- test_data(mic = microbio_filter_blood(), pat = patient_filter(), organism_input = org)

r if(!show){"There are no isolates for this pathogen."}

g1 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "All Infections", surv_cat = c("CAI", "HAI"))
g2 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "Community Acquired Infections", surv_cat = "CAI")
g3 <- ggplot_sir(organism_input = org, matching_name_column = match, title = "Hospital Acquired Infections", surv_cat = "HAI")
grid.arrange(g1, g2, g3, ncol = 1)

r if(show){"*Salmonella* combined bacteraemia per 1,000 enrolments:"}

table_bacteraemia(pat = patient_filter(), mic = microbio_filter(), org = org, blood = FALSE)

r if(show){"*Salmonella* combined bacteraemia per 1,000 blood cultured infection episodes:"}

table_bacteraemia(pat = patient_filter(), mic = microbio_filter_blood(), org = org, blood = TRUE)


ocelhay/ACORN documentation built on Dec. 6, 2020, 5:20 a.m.