From 0ef91be3ac860bf943df241ef1952177989e59de Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Thu, 18 Oct 2018 12:10:10 +0200 Subject: [PATCH] param rules for EUCAST --- NAMESPACE | 4 + NEWS.md | 7 +- R/eucast.R | 2441 +++++++++++++++++++++++++------------------------ R/freq.R | 27 +- README.md | 148 +-- man/EUCAST.Rd | 34 +- man/MDRO.Rd | 118 +-- 7 files changed, 1431 insertions(+), 1348 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 42c2a039..7554b16a 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -168,6 +168,8 @@ importFrom(crayon,black) importFrom(crayon,blue) importFrom(crayon,bold) importFrom(crayon,green) +importFrom(crayon,red) +importFrom(crayon,silver) importFrom(curl,nslookup) importFrom(data.table,as.data.table) importFrom(data.table,data.table) @@ -190,6 +192,7 @@ importFrom(dplyr,if_else) importFrom(dplyr,lag) importFrom(dplyr,left_join) importFrom(dplyr,mutate) +importFrom(dplyr,mutate_at) importFrom(dplyr,n_distinct) importFrom(dplyr,progress_estimated) importFrom(dplyr,pull) @@ -201,6 +204,7 @@ importFrom(dplyr,summarise) importFrom(dplyr,summarise_if) importFrom(dplyr,tibble) importFrom(dplyr,top_n) +importFrom(dplyr,vars) importFrom(grDevices,boxplot.stats) importFrom(graphics,axis) importFrom(graphics,barplot) diff --git a/NEWS.md b/NEWS.md index 53fbf068..6d8aefa5 100755 --- a/NEWS.md +++ b/NEWS.md @@ -5,9 +5,10 @@ #### Changed * Big changes to the `EUCAST_rules` function: - * It now also applies rules from the EUCAST 'Breakpoint tables for bacteria', version 8.1, 2018, http://www.eucast.org/clinical_breakpoints/ (see Source of the function) - * There's better error handling when rules cannot be applied (i.e. new values could not be inserted) - * A new `verbose` parameter can be set to `TRUE` to get very specific messages about which columns and rows were affected + * Now also applies rules from the EUCAST 'Breakpoint tables for bacteria', version 8.1, 2018, http://www.eucast.org/clinical_breakpoints/ (see Source of the function) + * New parameter `rules` to specify which rules should be applied (expert rules, breakpoints, others or all) + * New parameter `verbose` which can be set to `TRUE` to get very specific messages about which columns and rows were affected + * Better error handling when rules cannot be applied (i.e. new values could not be inserted) * The amount of affected values will now only be measured once per row/column combination * Data set `septic_patients` now reflects these changes * Added parameter `combine_IR` (TRUE/FALSE) to functions `portion_df` and `count_df`, to indicate that all values of I and R must be merged into one, so the output only consists of S vs. IR (susceptible vs. non-susceptible) diff --git a/R/eucast.R b/R/eucast.R index 3409b7fc..8fae0609 100755 --- a/R/eucast.R +++ b/R/eucast.R @@ -22,12 +22,14 @@ #' @param tbl table with antibiotic columns, like e.g. \code{amox} and \code{amcl} #' @param col_mo column name of the microbial ID in \code{tbl} - values in this column should be present in \code{microorganisms$mo}, see \code{\link{microorganisms}} #' @param info print progress -#' @param amcl,amik,amox,ampi,azit,azlo,aztr,cefa,cfep,cfot,cfox,cfra,cfta,cftr,cfur,chlo,cipr,clar,clin,clox,coli,czol,dapt,doxy,erta,eryt,fosf,fusi,gent,imip,kana,levo,linc,line,mero,mezl,mino,moxi,nali,neom,neti,nitr,norf,novo,oflo,oxac,peni,pita,poly,pris,qida,rifa,roxi,siso,teic,tetr,tica,tige,tobr,trim,trsu,vanc column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations. +#' @param rules a character vector that specifies which rules should be applied - one or more of \code{c("breakpoints", "expert", "other", "all")} +#' @param amcl,amik,amox,ampi,azit,azlo,aztr,cefa,cfep,cfot,cfox,cfra,cfta,cftr,cfur,chlo,cipr,clar,clin,clox,coli,czol,dapt,doxy,erta,eryt,fosf,fusi,gent,imip,kana,levo,linc,line,mero,mezl,mino,moxi,nali,neom,neti,nitr,norf,novo,oflo,oxac,peni,pita,poly,pris,qida,rifa,roxi,siso,teic,tetr,tica,tige,tobr,trim,trsu,vanc column name of an antibiotic, see Details #' @param col_bactid Deprecated. Use \code{col_mo} instead. #' @param verbose a logical to indicate whether extensive info should be printed to the console about which rows and columns are effected with their old and new values #' @param ... parameters that are passed on to \code{EUCAST_rules} +#' @details To define antibiotics column names, input a text or use \code{NA} to skip a column (e.g. \code{tica = NA}). Non-existing columns will anyway be skipped with a warning. See the Antibiotics section for an explanation of the abbreviations. #' @section Antibiotics: -#' Abbrevations of the column containing antibiotics: +#' Abbrevations of the column containing antibiotics in the form: \strong{abbreviation}: generic name (\emph{ATC code}) #' #' \strong{amcl}: amoxicillin+clavulanic acid (\emph{J01CR02}), #' \strong{amik}: amikacin (\emph{J01GB06}), @@ -93,9 +95,9 @@ #' @keywords interpretive eucast reading resistance #' @rdname EUCAST #' @export -#' @importFrom dplyr %>% select pull +#' @importFrom dplyr %>% select pull mutate_at vars #' @importFrom crayon bold bgGreen bgYellow bgRed black green blue -#' @return table with edited variables of antibiotics. +#' @return Value of parameter \code{tbl}, possibly with edited values of antibiotics. #' @source #' \itemize{ #' \item{ @@ -125,14 +127,31 @@ #' coli = "-", # Colistin #' cfta = "-", # Ceftazidime #' cfur = "-", # Cefuroxime +#' peni = "S", # Benzylpenicillin +#' cfox = "S", # Cefoxitin #' stringsAsFactors = FALSE) -#' a #' -#' b <- EUCAST_rules(a) # 11 results will be forced as R due to intrinsic resistance +#' a +#' # mo vanc amox coli cfta cfur peni cfox +#' # 1 Staphylococcus aureus - - - - - S S +#' # 2 Enterococcus faecalis - - - - - S S +#' # 3 Escherichia coli - - - - - S S +#' # 4 Klebsiella pneumoniae - - - - - S S +#' # 5 Pseudomonas aeruginosa - - - - - S S +#' +#' b <- EUCAST_rules(a) # 18 results are forced as R or S +#' #' b +#' # mo vanc amox coli cfta cfur peni cfox +#' # 1 Staphylococcus aureus - S R R S S S +#' # 2 Enterococcus faecalis - - R R R S R +#' # 3 Escherichia coli R - - - - R S +#' # 4 Klebsiella pneumoniae R R - - - R S +#' # 5 Pseudomonas aeruginosa R R - - R R R EUCAST_rules <- function(tbl, col_mo = 'mo', info = TRUE, + rules = c("breakpoints", "expert", "other", "all"), amcl = 'amcl', amik = 'amik', amox = 'amox', @@ -209,6 +228,10 @@ EUCAST_rules <- function(tbl, stop('Column ', col_mo, ' not found.', call. = FALSE) } + if (!all(rules %in% c("breakpoints", "expert", "other", "all"))) { + stop("Parameter `rules` must be one or more of: 'breakpoints', 'expert', 'other', 'all'.") + } + warned <- FALSE changed_results <- 0 @@ -334,9 +357,9 @@ EUCAST_rules <- function(tbl, verbose_info <<- paste0(verbose_info, "\n\nRule Type: ", rule[1], "\nRule Set: ", rule[2], - "\nEffect: Forced '", to, "' (", - "actually changed ", sum(before != after, na.rm = TRUE), - "): cols '", paste(cols, collapse = "', '"), + "\nEffect: Set to '", to, "' (", + length(before), " found, ", sum(before != after, na.rm = TRUE), " changed): ", + "cols '", paste(cols, collapse = "', '"), "' of rows ", paste(rows, collapse = ", ")) } } @@ -349,14 +372,13 @@ EUCAST_rules <- function(tbl, } } - # join to microorganisms data set - col_mo_original <- NULL - if (!tbl %>% pull(col_mo) %>% is.mo()) { - col_mo_original <- tbl %>% pull(col_mo) - tbl[, col_mo] <- as.mo(tbl[, col_mo]) - } + # save original table tbl_original <- tbl - tbl <- tbl %>% left_join_microorganisms(by = col_mo, suffix = c("_oldcols", "")) + + # join to microorganisms data set + tbl <- tbl %>% + mutate_at(vars(col_mo), as.mo) %>% + left_join_microorganisms(by = col_mo, suffix = c("_oldcols", "")) # antibiotic classes aminoglycosides <- c(tobr, gent, kana, neom, neti, siso) @@ -394,1221 +416,1230 @@ EUCAST_rules <- function(tbl, cols = ampi) } - # BREAKPOINTS ------------------------------------------------------------- + if (any(c("all", "breakpoints") %in% rules)) { + # BREAKPOINTS ------------------------------------------------------------- - if (info == TRUE) { - cat(bold(paste0('\nEUCAST Clinical Breakpoints (v', EUCAST_VERSION_BREAKPOINTS, ')\n'))) - } - rule_group <- "Breakpoints" + if (info == TRUE) { + cat(bold(paste0('\nEUCAST Clinical Breakpoints (v', EUCAST_VERSION_BREAKPOINTS, ')\n'))) + } + rule_group <- "Breakpoints" - # Enterobacteriales (Order) ---- - rule <- 'Enterobacteriales (Order)' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } + # Enterobacteriales (Order) ---- + rule <- 'Enterobacteriales (Order)' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } - if (!is.na(ampi)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$order == 'Enterobacteriales' - & tbl[, ampi] == 'S'), - cols = amox) - } - if (!is.na(ampi)) { - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$order == 'Enterobacteriales' - & tbl[, ampi] == 'I'), - cols = amox) - } - if (!is.na(ampi)) { - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$order == 'Enterobacteriales' - & tbl[, ampi] == 'R'), - cols = amox) - } - if (info == TRUE) { - txt_ok() - } - # Staphylococcus ---- - rule <- 'Staphylococcus' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(peni) & !is.na(cfox)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Staphylococcus" - & tbl[, peni] == 'S' - & tbl[, cfox] == 'S'), - cols = c(ampi, amox, pita, tica)) - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Staphylococcus" - & tbl[, peni] == 'R' - & tbl[, cfox] == 'S'), - cols = c(oxac, clox)) - } - if (!is.na(cfox)) { - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Staphylococcus" - & tbl[, cfox] == 'R'), - cols = all_betalactam) - } - if (!is.na(ampi)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Staphylococcus saprophyticus" - & tbl[, ampi] == 'S'), - cols = c(ampi, amox, amcl, pita)) - } - if (!is.na(cfox)) { - # inferred from cefoxitin - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Staphylococcus" - & tbl[, cfox] == 'S'), - cols = c(carbapenems, cephalosporins[cephalosporins != na.rm(cfta)])) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Staphylococcus" - & tbl[, cfox] == 'I'), - cols = c(carbapenems, cephalosporins[cephalosporins != na.rm(cfta)])) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Staphylococcus" - & tbl[, cfox] == 'R'), - cols = c(carbapenems, cephalosporins[cephalosporins != na.rm(cfta)])) - } - if (!is.na(norf)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Staphylococcus" - & tbl[, norf] == 'S'), - cols = c(cipr, levo, moxi, oflo)) - } - if (!is.na(eryt)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Staphylococcus" - & tbl[, eryt] == 'S'), - cols = c(azit, clar, roxi)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Staphylococcus" - & tbl[, eryt] == 'I'), - cols = c(azit, clar, roxi)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Staphylococcus" - & tbl[, eryt] == 'R'), - cols = c(azit, clar, roxi)) - } - if (!is.na(tetr)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Staphylococcus" - & tbl[, tetr] == 'S'), - cols = c(doxy, mino)) - } - if (info == TRUE) { - txt_ok() - } - # Enterococcus ---- - rule <- 'Enterococcus' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(peni)) { - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Enterococcus faecium" - & tbl[, peni] == 'R'), - cols = all_betalactam) - } - if (!is.na(ampi)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Enterococcus" - & tbl[, ampi] == 'S'), - cols = c(amox, amcl, pita)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Enterococcus" - & tbl[, ampi] == 'I'), - cols = c(amox, amcl, pita)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Enterococcus" - & tbl[, ampi] == 'R'), - cols = c(amox, amcl, pita)) - } - if (!is.na(norf)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Enterococcus" - & tbl[, norf] == 'S'), - cols = c(cipr, levo)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Enterococcus" - & tbl[, norf] == 'I'), - cols = c(cipr, levo)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Enterococcus" - & tbl[, norf] == 'R'), - cols = c(cipr, levo)) - } - if (info == TRUE) { - txt_ok() - } - # Streptococcus A, B, C, G---- - rule <- 'Streptococcus A, B, C, G' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(peni)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" - & tbl[, peni] == 'S'), - cols = c(aminopenicillins, ureidopenicillins, cephalosporins, carbapenems, clox, amcl)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" - & tbl[, peni] == 'I'), - cols = c(aminopenicillins, ureidopenicillins, cephalosporins, carbapenems, clox, amcl)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" - & tbl[, peni] == 'R'), - cols = c(aminopenicillins, ureidopenicillins, cephalosporins, carbapenems, clox, amcl)) - } - if (!is.na(norf)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" - & tbl[, norf] == 'S'), - cols = c(levo, moxi)) - } - if (!is.na(eryt)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" - & tbl[, eryt] == 'S'), - cols = c(azit, clar, roxi)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" - & tbl[, eryt] == 'I'), - cols = c(azit, clar, roxi)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" - & tbl[, eryt] == 'R'), - cols = c(azit, clar, roxi)) - } - if (!is.na(tetr)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" - & tbl[, tetr] == 'S'), - cols = c(doxy, mino)) - } - if (info == TRUE) { - txt_ok() - } - # Streptococcus pneumoniae ---- - rule <- 'Streptococcus pneumoniae' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(peni)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" - & tbl[, peni] == 'S'), - cols = c(ampi, amox, amcl, pita)) - } - if (!is.na(ampi)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" - & tbl[, ampi] == 'S'), - cols = c(ampi, amox, amcl, pita)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" - & tbl[, ampi] == 'I'), - cols = c(ampi, amox, amcl, pita)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" - & tbl[, ampi] == 'R'), - cols = c(ampi, amox, amcl, pita)) - } - if (!is.na(norf)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" - & tbl[, norf] == 'S'), - cols = c(levo, moxi)) - } - if (!is.na(eryt)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" - & tbl[, eryt] == 'S'), - cols = c(azit, clar, roxi)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" - & tbl[, eryt] == 'I'), - cols = c(azit, clar, roxi)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" - & tbl[, eryt] == 'R'), - cols = c(azit, clar, roxi)) - } - if (!is.na(tetr)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" - & tbl[, tetr] == 'S'), - cols = c(doxy, mino)) - } - if (info == TRUE) { - txt_ok() - } - # Viridans group streptococci ---- - rule <- 'Viridans group streptococci' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - viridans_group <- c("anginosus", "australis", "bovis", "constellatus", "cristatus", - "equinus", "gallolyticus", "gordonii", "infantarius", "infantis", - "intermedius", "mitis", "mutans", "oligofermentans", "oralis", - "parasanguinis", "peroris", "pseudopneumoniae", "salivarius", - "sanguinis", "sinensis", "sobrinus", "thermophilus", "vestibularis") - if (!is.na(ampi)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Streptococcus" & tbl$species %in% viridans_group - & tbl[, ampi] == 'S'), - cols = c(ampi, amox, amcl, pita)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Streptococcus" & tbl$species %in% viridans_group - & tbl[, ampi] == 'I'), - cols = c(ampi, amox, amcl, pita)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus == "Streptococcus" & tbl$species %in% viridans_group - & tbl[, ampi] == 'R'), - cols = c(ampi, amox, amcl, pita)) - } - if (info == TRUE) { - txt_ok() - } - # Haemophilus influenzae ---- - rule <- 'Haemophilus influenzae' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(ampi)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Haemophilus influenzae" - & tbl[, ampi] == 'S'), - cols = c(amox, pita)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Haemophilus influenzae" - & tbl[, ampi] == 'I'), - cols = c(amox, pita)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Haemophilus influenzae" - & tbl[, ampi] == 'R'), - cols = c(amox, pita)) - } - if (!is.na(amcl)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Haemophilus influenzae" - & tbl[, amcl] == 'S'), - cols = pita) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Haemophilus influenzae" - & tbl[, amcl] == 'I'), - cols = pita) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Haemophilus influenzae" - & tbl[, amcl] == 'R'), - cols = pita) - } - if (!is.na(nali)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Haemophilus influenzae" - & tbl[, nali] == 'S'), - cols = c(cipr, levo, moxi, oflo)) - } - if (!is.na(tetr)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Haemophilus influenzae" - & tbl[, tetr] == 'S'), - cols = c(doxy, mino)) - } - if (info == TRUE) { - txt_ok() - } - # Moraxella catarrhalis ---- - rule <- 'Moraxella catarrhalis' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(amcl)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Moraxella catarrhalis" - & tbl[, amcl] == 'S'), - cols = pita) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Moraxella catarrhalis" - & tbl[, amcl] == 'I'), - cols = pita) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Moraxella catarrhalis" - & tbl[, amcl] == 'R'), - cols = pita) - } - if (!is.na(nali)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Moraxella catarrhalis" - & tbl[, nali] == 'S'), - cols = c(cipr, levo, moxi, oflo)) - } - if (!is.na(eryt)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Moraxella catarrhalis" - & tbl[, eryt] == 'S'), - cols = c(azit, clar, roxi)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Moraxella catarrhalis" - & tbl[, eryt] == 'I'), - cols = c(azit, clar, roxi)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Moraxella catarrhalis" - & tbl[, eryt] == 'R'), - cols = c(azit, clar, roxi)) - } - if (!is.na(tetr)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Moraxella catarrhalis" - & tbl[, tetr] == 'S'), - cols = c(doxy, mino)) - } - if (info == TRUE) { - txt_ok() - } - # Anaerobic Gram positives ---- - rule <- 'Anaerobic Gram positives' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(peni)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which((tbl$genus %in% c("Clostridium", "Actinomyces", "Propionibacterium", - "Bifidobacterium", "Eggerthella", "Eubacterium", - "Lactobacillus ", "Actinomyces") - | tbl$fullname %like% "^Propionibacterium acnes") - & tbl[, peni] == 'S'), - cols = c(ampi, amox, pita, tica)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which((tbl$genus %in% c("Clostridium", "Actinomyces", "Propionibacterium", - "Bifidobacterium", "Eggerthella", "Eubacterium", - "Lactobacillus ", "Actinomyces") - | tbl$fullname %like% "^Propionibacterium acnes") - & tbl[, peni] == 'I'), - cols = c(ampi, amox, pita, tica)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which((tbl$genus %in% c("Clostridium", "Actinomyces", "Propionibacterium", - "Bifidobacterium", "Eggerthella", "Eubacterium", - "Lactobacillus ", "Actinomyces") - | tbl$fullname %like% "^Propionibacterium acnes") - & tbl[, peni] == 'R'), - cols = c(ampi, amox, pita, tica)) - } - if (info == TRUE) { - txt_ok() - } - # Anaerobic Gram negatives ---- - rule <- 'Anaerobic Gram negatives' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(peni)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$genus %in% c("Bacteroides", "Prevotella", "Porphyromonas", - "Fusobacterium", "Bilophila ", "Mobiluncus") - & tbl[, peni] == 'S'), - cols = c(ampi, amox, pita, tica)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$genus %in% c("Bacteroides", "Prevotella", "Porphyromonas", - "Fusobacterium", "Bilophila ", "Mobiluncus") - & tbl[, peni] == 'I'), - cols = c(ampi, amox, pita, tica)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus %in% c("Bacteroides", "Prevotella", "Porphyromonas", - "Fusobacterium", "Bilophila ", "Mobiluncus") - & tbl[, peni] == 'R'), - cols = c(ampi, amox, pita, tica)) - } - if (info == TRUE) { - txt_ok() - } - # Pasteurella multocida ---- - rule <- 'Pasteurella multocida' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(peni)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Pasteurella multocida" - & tbl[, peni] == 'S'), - cols = c(ampi, amox)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Pasteurella multocida" - & tbl[, peni] == 'I'), - cols = c(ampi, amox)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Pasteurella multocida" - & tbl[, peni] == 'R'), - cols = c(ampi, amox)) - } - if (info == TRUE) { - txt_ok() - } - # Campylobacter jejuni ---- - rule <- 'Campylobacter jejuni' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(eryt)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Campylobacter jejuni" - & tbl[, eryt] == 'S'), - cols = c(azit, clar)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Campylobacter jejuni" - & tbl[, eryt] == 'I'), - cols = c(azit, clar)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Campylobacter jejuni" - & tbl[, eryt] == 'R'), - cols = c(azit, clar)) - } - if (!is.na(tetr)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Campylobacter jejuni" - & tbl[, tetr] == 'S'), - cols = doxy) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Campylobacter jejuni" - & tbl[, tetr] == 'I'), - cols = doxy) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Campylobacter jejuni" - & tbl[, tetr] == 'R'), - cols = doxy) - } - if (info == TRUE) { - txt_ok() - } - # Aerococcus sanguinicola/urinae ---- - rule <- 'Aerococcus sanguinicola/urinae' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(cipr)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Aerococcus (sanguinicola|urinae)" - & tbl[, cipr] == 'S'), - cols = levo) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Aerococcus (sanguinicola|urinae)" - & tbl[, cipr] == 'I'), - cols = levo) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Aerococcus (sanguinicola|urinae)" - & tbl[, cipr] == 'R'), - cols = levo) - } - if (info == TRUE) { - txt_ok() - } - # Kingella kingae ---- - rule <- 'Kingella kingae' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(peni)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Kingella kingae" - & tbl[, peni] == 'S'), - cols = c(ampi, amox)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Kingella kingae" - & tbl[, peni] == 'I'), - cols = c(ampi, amox)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Kingella kingae" - & tbl[, peni] == 'R'), - cols = c(ampi, amox)) - } - if (!is.na(eryt)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Kingella kingae" - & tbl[, eryt] == 'S'), - cols = c(azit, clar)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Kingella kingae" - & tbl[, eryt] == 'I'), - cols = c(azit, clar)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Kingella kingae" - & tbl[, eryt] == 'R'), - cols = c(azit, clar)) - } - if (!is.na(tetr)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Kingella kingae" - & tbl[, tetr] == 'S'), - cols = doxy) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Kingella kingae" - & tbl[, tetr] == 'I'), - cols = doxy) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% "^Kingella kingae" - & tbl[, tetr] == 'R'), - cols = doxy) - } - if (info == TRUE) { - txt_ok() - } + if (!is.na(ampi)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$order == 'Enterobacteriales' + & tbl[, ampi] == 'S'), + cols = amox) + } + if (!is.na(ampi)) { + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$order == 'Enterobacteriales' + & tbl[, ampi] == 'I'), + cols = amox) + } + if (!is.na(ampi)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$order == 'Enterobacteriales' + & tbl[, ampi] == 'R'), + cols = amox) + } + if (info == TRUE) { + txt_ok() + } + # Staphylococcus ---- + rule <- 'Staphylococcus' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(peni) & !is.na(cfox)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Staphylococcus" + & tbl[, peni] == 'S' + & tbl[, cfox] == 'S'), + cols = c(ampi, amox, pita, tica)) + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Staphylococcus" + & tbl[, peni] == 'R' + & tbl[, cfox] == 'S'), + cols = c(oxac, clox)) + } + if (!is.na(cfox)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Staphylococcus" + & tbl[, cfox] == 'R'), + cols = all_betalactam) + } + if (!is.na(ampi)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Staphylococcus saprophyticus" + & tbl[, ampi] == 'S'), + cols = c(ampi, amox, amcl, pita)) + } + if (!is.na(cfox)) { + # inferred from cefoxitin + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Staphylococcus" + & tbl[, cfox] == 'S'), + cols = c(carbapenems, cephalosporins[cephalosporins != na.rm(cfta)])) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Staphylococcus" + & tbl[, cfox] == 'I'), + cols = c(carbapenems, cephalosporins[cephalosporins != na.rm(cfta)])) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Staphylococcus" + & tbl[, cfox] == 'R'), + cols = c(carbapenems, cephalosporins[cephalosporins != na.rm(cfta)])) + } + if (!is.na(norf)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Staphylococcus" + & tbl[, norf] == 'S'), + cols = c(cipr, levo, moxi, oflo)) + } + if (!is.na(eryt)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Staphylococcus" + & tbl[, eryt] == 'S'), + cols = c(azit, clar, roxi)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Staphylococcus" + & tbl[, eryt] == 'I'), + cols = c(azit, clar, roxi)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Staphylococcus" + & tbl[, eryt] == 'R'), + cols = c(azit, clar, roxi)) + } + if (!is.na(tetr)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Staphylococcus" + & tbl[, tetr] == 'S'), + cols = c(doxy, mino)) + } + if (info == TRUE) { + txt_ok() + } + # Enterococcus ---- + rule <- 'Enterococcus' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(peni)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Enterococcus faecium" + & tbl[, peni] == 'R'), + cols = all_betalactam) + } + if (!is.na(ampi)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Enterococcus" + & tbl[, ampi] == 'S'), + cols = c(amox, amcl, pita)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Enterococcus" + & tbl[, ampi] == 'I'), + cols = c(amox, amcl, pita)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Enterococcus" + & tbl[, ampi] == 'R'), + cols = c(amox, amcl, pita)) + } + if (!is.na(norf)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Enterococcus" + & tbl[, norf] == 'S'), + cols = c(cipr, levo)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Enterococcus" + & tbl[, norf] == 'I'), + cols = c(cipr, levo)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Enterococcus" + & tbl[, norf] == 'R'), + cols = c(cipr, levo)) + } + if (info == TRUE) { + txt_ok() + } + # Streptococcus A, B, C, G---- + rule <- 'Streptococcus A, B, C, G' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(peni)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" + & tbl[, peni] == 'S'), + cols = c(aminopenicillins, ureidopenicillins, cephalosporins, carbapenems, clox, amcl)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" + & tbl[, peni] == 'I'), + cols = c(aminopenicillins, ureidopenicillins, cephalosporins, carbapenems, clox, amcl)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" + & tbl[, peni] == 'R'), + cols = c(aminopenicillins, ureidopenicillins, cephalosporins, carbapenems, clox, amcl)) + } + if (!is.na(norf)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" + & tbl[, norf] == 'S'), + cols = c(levo, moxi)) + } + if (!is.na(eryt)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" + & tbl[, eryt] == 'S'), + cols = c(azit, clar, roxi)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" + & tbl[, eryt] == 'I'), + cols = c(azit, clar, roxi)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" + & tbl[, eryt] == 'R'), + cols = c(azit, clar, roxi)) + } + if (!is.na(tetr)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)" + & tbl[, tetr] == 'S'), + cols = c(doxy, mino)) + } + if (info == TRUE) { + txt_ok() + } + # Streptococcus pneumoniae ---- + rule <- 'Streptococcus pneumoniae' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(peni)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" + & tbl[, peni] == 'S'), + cols = c(ampi, amox, amcl, pita)) + } + if (!is.na(ampi)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" + & tbl[, ampi] == 'S'), + cols = c(ampi, amox, amcl, pita)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" + & tbl[, ampi] == 'I'), + cols = c(ampi, amox, amcl, pita)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" + & tbl[, ampi] == 'R'), + cols = c(ampi, amox, amcl, pita)) + } + if (!is.na(norf)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" + & tbl[, norf] == 'S'), + cols = c(levo, moxi)) + } + if (!is.na(eryt)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" + & tbl[, eryt] == 'S'), + cols = c(azit, clar, roxi)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" + & tbl[, eryt] == 'I'), + cols = c(azit, clar, roxi)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" + & tbl[, eryt] == 'R'), + cols = c(azit, clar, roxi)) + } + if (!is.na(tetr)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Streptococcus pneumoniae" + & tbl[, tetr] == 'S'), + cols = c(doxy, mino)) + } + if (info == TRUE) { + txt_ok() + } + # Viridans group streptococci ---- + rule <- 'Viridans group streptococci' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + viridans_group <- c("anginosus", "australis", "bovis", "constellatus", "cristatus", + "equinus", "gallolyticus", "gordonii", "infantarius", "infantis", + "intermedius", "mitis", "mutans", "oligofermentans", "oralis", + "parasanguinis", "peroris", "pseudopneumoniae", "salivarius", + "sanguinis", "sinensis", "sobrinus", "thermophilus", "vestibularis") + if (!is.na(ampi)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Streptococcus" & tbl$species %in% viridans_group + & tbl[, ampi] == 'S'), + cols = c(ampi, amox, amcl, pita)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Streptococcus" & tbl$species %in% viridans_group + & tbl[, ampi] == 'I'), + cols = c(ampi, amox, amcl, pita)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == "Streptococcus" & tbl$species %in% viridans_group + & tbl[, ampi] == 'R'), + cols = c(ampi, amox, amcl, pita)) + } + if (info == TRUE) { + txt_ok() + } + # Haemophilus influenzae ---- + rule <- 'Haemophilus influenzae' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(ampi)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Haemophilus influenzae" + & tbl[, ampi] == 'S'), + cols = c(amox, pita)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Haemophilus influenzae" + & tbl[, ampi] == 'I'), + cols = c(amox, pita)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Haemophilus influenzae" + & tbl[, ampi] == 'R'), + cols = c(amox, pita)) + } + if (!is.na(amcl)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Haemophilus influenzae" + & tbl[, amcl] == 'S'), + cols = pita) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Haemophilus influenzae" + & tbl[, amcl] == 'I'), + cols = pita) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Haemophilus influenzae" + & tbl[, amcl] == 'R'), + cols = pita) + } + if (!is.na(nali)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Haemophilus influenzae" + & tbl[, nali] == 'S'), + cols = c(cipr, levo, moxi, oflo)) + } + if (!is.na(tetr)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Haemophilus influenzae" + & tbl[, tetr] == 'S'), + cols = c(doxy, mino)) + } + if (info == TRUE) { + txt_ok() + } + # Moraxella catarrhalis ---- + rule <- 'Moraxella catarrhalis' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(amcl)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Moraxella catarrhalis" + & tbl[, amcl] == 'S'), + cols = pita) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Moraxella catarrhalis" + & tbl[, amcl] == 'I'), + cols = pita) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Moraxella catarrhalis" + & tbl[, amcl] == 'R'), + cols = pita) + } + if (!is.na(nali)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Moraxella catarrhalis" + & tbl[, nali] == 'S'), + cols = c(cipr, levo, moxi, oflo)) + } + if (!is.na(eryt)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Moraxella catarrhalis" + & tbl[, eryt] == 'S'), + cols = c(azit, clar, roxi)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Moraxella catarrhalis" + & tbl[, eryt] == 'I'), + cols = c(azit, clar, roxi)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Moraxella catarrhalis" + & tbl[, eryt] == 'R'), + cols = c(azit, clar, roxi)) + } + if (!is.na(tetr)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Moraxella catarrhalis" + & tbl[, tetr] == 'S'), + cols = c(doxy, mino)) + } + if (info == TRUE) { + txt_ok() + } + # Anaerobic Gram positives ---- + rule <- 'Anaerobic Gram positives' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(peni)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which((tbl$genus %in% c("Clostridium", "Actinomyces", "Propionibacterium", + "Bifidobacterium", "Eggerthella", "Eubacterium", + "Lactobacillus ", "Actinomyces") + | tbl$fullname %like% "^Propionibacterium acnes") + & tbl[, peni] == 'S'), + cols = c(ampi, amox, pita, tica)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which((tbl$genus %in% c("Clostridium", "Actinomyces", "Propionibacterium", + "Bifidobacterium", "Eggerthella", "Eubacterium", + "Lactobacillus ", "Actinomyces") + | tbl$fullname %like% "^Propionibacterium acnes") + & tbl[, peni] == 'I'), + cols = c(ampi, amox, pita, tica)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which((tbl$genus %in% c("Clostridium", "Actinomyces", "Propionibacterium", + "Bifidobacterium", "Eggerthella", "Eubacterium", + "Lactobacillus ", "Actinomyces") + | tbl$fullname %like% "^Propionibacterium acnes") + & tbl[, peni] == 'R'), + cols = c(ampi, amox, pita, tica)) + } + if (info == TRUE) { + txt_ok() + } + # Anaerobic Gram negatives ---- + rule <- 'Anaerobic Gram negatives' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(peni)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$genus %in% c("Bacteroides", "Prevotella", "Porphyromonas", + "Fusobacterium", "Bilophila ", "Mobiluncus") + & tbl[, peni] == 'S'), + cols = c(ampi, amox, pita, tica)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$genus %in% c("Bacteroides", "Prevotella", "Porphyromonas", + "Fusobacterium", "Bilophila ", "Mobiluncus") + & tbl[, peni] == 'I'), + cols = c(ampi, amox, pita, tica)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus %in% c("Bacteroides", "Prevotella", "Porphyromonas", + "Fusobacterium", "Bilophila ", "Mobiluncus") + & tbl[, peni] == 'R'), + cols = c(ampi, amox, pita, tica)) + } + if (info == TRUE) { + txt_ok() + } + # Pasteurella multocida ---- + rule <- 'Pasteurella multocida' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(peni)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Pasteurella multocida" + & tbl[, peni] == 'S'), + cols = c(ampi, amox)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Pasteurella multocida" + & tbl[, peni] == 'I'), + cols = c(ampi, amox)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Pasteurella multocida" + & tbl[, peni] == 'R'), + cols = c(ampi, amox)) + } + if (info == TRUE) { + txt_ok() + } + # Campylobacter jejuni ---- + rule <- 'Campylobacter jejuni' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(eryt)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Campylobacter jejuni" + & tbl[, eryt] == 'S'), + cols = c(azit, clar)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Campylobacter jejuni" + & tbl[, eryt] == 'I'), + cols = c(azit, clar)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Campylobacter jejuni" + & tbl[, eryt] == 'R'), + cols = c(azit, clar)) + } + if (!is.na(tetr)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Campylobacter jejuni" + & tbl[, tetr] == 'S'), + cols = doxy) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Campylobacter jejuni" + & tbl[, tetr] == 'I'), + cols = doxy) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Campylobacter jejuni" + & tbl[, tetr] == 'R'), + cols = doxy) + } + if (info == TRUE) { + txt_ok() + } + # Aerococcus sanguinicola/urinae ---- + rule <- 'Aerococcus sanguinicola/urinae' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(cipr)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Aerococcus (sanguinicola|urinae)" + & tbl[, cipr] == 'S'), + cols = levo) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Aerococcus (sanguinicola|urinae)" + & tbl[, cipr] == 'I'), + cols = levo) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Aerococcus (sanguinicola|urinae)" + & tbl[, cipr] == 'R'), + cols = levo) + } + if (info == TRUE) { + txt_ok() + } + # Kingella kingae ---- + rule <- 'Kingella kingae' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(peni)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Kingella kingae" + & tbl[, peni] == 'S'), + cols = c(ampi, amox)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Kingella kingae" + & tbl[, peni] == 'I'), + cols = c(ampi, amox)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Kingella kingae" + & tbl[, peni] == 'R'), + cols = c(ampi, amox)) + } + if (!is.na(eryt)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Kingella kingae" + & tbl[, eryt] == 'S'), + cols = c(azit, clar)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Kingella kingae" + & tbl[, eryt] == 'I'), + cols = c(azit, clar)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Kingella kingae" + & tbl[, eryt] == 'R'), + cols = c(azit, clar)) + } + if (!is.na(tetr)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Kingella kingae" + & tbl[, tetr] == 'S'), + cols = doxy) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Kingella kingae" + & tbl[, tetr] == 'I'), + cols = doxy) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% "^Kingella kingae" + & tbl[, tetr] == 'R'), + cols = doxy) + } + if (info == TRUE) { + txt_ok() + } - # EXPERT RULES AND INTRINSIC RESISTANCE ----------------------------------- + } # end of breakpoints + if (any(c("all", "expert") %in% rules)) { - if (info == TRUE) { - cat(bold(paste0('\nEUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v', EUCAST_VERSION_EXPERT_RULES, ')\n'))) - } - rule_group <- "Expert Rules" + # EXPERT RULES AND INTRINSIC RESISTANCE ----------------------------------- - # Table 1: Intrinsic resistance in Enterobacteriaceae ---- - rule <- 'Table 1: Intrinsic resistance in Enterobacteriaceae' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - # Intrinsic R for this group - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$family == 'Enterobacteriaceae'), - cols = c(peni, glycopeptides, fusi, macrolides, linc, streptogramins, rifa, dapt, line)) - # Citrobacter - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Citrobacter (koseri|amalonaticus|sedlakii|farmeri|rodentium)'), - cols = c(aminopenicillins, tica)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Citrobacter (freundii|braakii|murliniae|werkmanii|youngae)'), - cols = c(aminopenicillins, amcl, czol, cfox)) - # Enterobacter - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Enterobacter cloacae'), - cols = c(aminopenicillins, amcl, czol, cfox)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Enterobacter aerogenes'), - cols = c(aminopenicillins, amcl, czol, cfox)) - # Escherichia - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Escherichia hermanni'), - cols = c(aminopenicillins, tica)) - # Hafnia - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Hafnia alvei'), - cols = c(aminopenicillins, amcl, czol, cfox)) - # Klebsiella - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Klebsiella'), - cols = c(aminopenicillins, tica)) - # Morganella / Proteus - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Morganella morganii'), - cols = c(aminopenicillins, amcl, czol, tetracyclines, polymyxins, nitr)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Proteus mirabilis'), - cols = c(tetracyclines, tige, polymyxins, nitr)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Proteus penneri'), - cols = c(aminopenicillins, czol, cfur, tetracyclines, tige, polymyxins, nitr)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Proteus vulgaris'), - cols = c(aminopenicillins, czol, cfur, tetracyclines, tige, polymyxins, nitr)) - # Providencia - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Providencia rettgeri'), - cols = c(aminopenicillins, amcl, czol, cfur, tetracyclines, tige, polymyxins, nitr)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Providencia stuartii'), - cols = c(aminopenicillins, amcl, czol, cfur, tetracyclines, tige, polymyxins, nitr)) - # Raoultella - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Raoultella'), - cols = c(aminopenicillins, tica)) - # Serratia - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Serratia marcescens'), - cols = c(aminopenicillins, amcl, czol, cfox, cfur, tetracyclines[tetracyclines != na.rm(mino)], polymyxins, nitr)) - # Yersinia - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Yersinia enterocolitica'), - cols = c(aminopenicillins, amcl, tica, czol, cfox)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Yersinia pseudotuberculosis'), - cols = c(poly, coli)) - if (info == TRUE) { - txt_ok() - } + if (info == TRUE) { + cat(bold(paste0('\nEUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v', EUCAST_VERSION_EXPERT_RULES, ')\n'))) + } + rule_group <- "Expert Rules" - # Table 2: Intrinsic resistance in non-fermentative Gram-negative bacteria ---- - rule <- 'Table 2: Intrinsic resistance in non-fermentative Gram-negative bacteria' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - # Intrinsic R for this group - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus %in% c('Achromobacter', - 'Acinetobacter', - 'Alcaligenes', - 'Bordatella', - 'Burkholderia', - 'Elizabethkingia', - 'Flavobacterium', - 'Ochrobactrum', - 'Pseudomonas', - 'Stenotrophomonas')), - cols = c(peni, cfox, cfur, glycopeptides, fusi, macrolides, linc, streptogramins, rifa, dapt, line)) - # Acinetobacter - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Acinetobacter (baumannii|pittii|nosocomialis|calcoaceticus)'), - cols = c(aminopenicillins, amcl, czol, cfot, cftr, aztr, erta, trim, fosf, tetracyclines[tetracyclines != na.rm(mino)])) - # Achromobacter - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Achromobacter (xylosoxydans|xylosoxidans)'), - cols = c(aminopenicillins, czol, cfot, cftr, erta)) - # Burkholderia - edit_rsi(to = 'R', - rule = c(rule_group, rule), - # onder 'Burkholderia cepacia complex' vallen deze species allemaal: PMID 16217180. - rows = which(tbl$fullname %like% '^Burkholderia (cepacia|multivorans|cenocepacia|stabilis|vietnamiensis|dolosa|ambifaria|anthina|pyrrocinia|ubonensis)'), - cols = c(aminopenicillins, amcl, tica, pita, czol, cfot, cftr, aztr, erta, cipr, chlo, aminoglycosides, trim, fosf, polymyxins)) - # Elizabethkingia - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Elizabethkingia meningoseptic(a|um)'), - cols = c(aminopenicillins, amcl, tica, czol, cfot, cftr, cfta, cfep, aztr, erta, imip, mero, polymyxins)) - # Ochrobactrum - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Ochrobactrum anthropi'), - cols = c(aminopenicillins, amcl, tica, pita, czol, cfot, cftr, cfta, cfep, aztr, erta)) - # Pseudomonas - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Pseudomonas aeruginosa'), - cols = c(aminopenicillins, amcl, czol, cfot, cftr, erta, chlo, kana, neom, trim, trsu, tetracyclines, tige)) - # Stenotrophomonas - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Stenotrophomonas maltophilia'), - cols = c(aminopenicillins, amcl, tica, pita, czol, cfot, cftr, cfta, aztr, erta, imip, mero, aminoglycosides, trim, fosf, tetr)) - if (info == TRUE) { - txt_ok() - } - - # Table 3: Intrinsic resistance in other Gram-negative bacteria ---- - rule <- 'Table 3: Intrinsic resistance in other Gram-negative bacteria' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - # Intrinsic R for this group - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus %in% c('Haemophilus', - 'Moraxella', - 'Neisseria', - 'Campylobacter')), - cols = c(glycopeptides, linc, dapt, line)) - # Haemophilus - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Haemophilus influenzae'), - cols = c(fusi, streptogramins)) - # Moraxella - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Moraxella catarrhalis'), - cols = trim) - # Neisseria - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus == 'Neisseria'), - cols = trim) - # Campylobacter - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Campylobacter fetus'), - cols = c(fusi, streptogramins, trim, nali)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Campylobacter (jejuni|coli)'), - cols = c(fusi, streptogramins, trim)) - if (info == TRUE) { - txt_ok() - } - - # Table 4: Intrinsic resistance in Gram-positive bacteria ---- - rule <- 'Table 4: Intrinsic resistance in Gram-positive bacteria' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - # Intrinsic R for this group - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$gramstain == "Gram positive"), - cols = c(aztr, polymyxins, nali)) - # Staphylococcus - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Staphylococcus saprophyticus'), - cols = c(fusi, cfta, fosf, novo)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Staphylococcus (cohnii|xylosus)'), - cols = c(cfta, novo)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Staphylococcus capitis'), - cols = c(cfta, fosf)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Staphylococcus (aureus|epidermidis|coagulase negatief|hominis|haemolyticus|intermedius|pseudointermedius)'), - cols = cfta) - # Streptococcus - # rule 4.5 - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus == 'Streptococcus'), - cols = c(fusi, aminoglycosides)) - # Enterococcus - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Enterococcus faecalis'), - cols = c(fusi, cfta, cephalosporins[cephalosporins != na.rm(cfta)], aminoglycosides, macrolides, clin, qida, trim, trsu)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Enterococcus (gallinarum|casseliflavus)'), - cols = c(fusi, cfta, cephalosporins[cephalosporins != na.rm(cfta)], aminoglycosides, macrolides, clin, qida, vanc, trim, trsu)) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Enterococcus faecium'), - cols = c(fusi, cfta, cephalosporins[cephalosporins != na.rm(cfta)], aminoglycosides, macrolides, trim, trsu)) - # Corynebacterium - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus == 'Corynebacterium'), - cols = fosf) - # Listeria - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Listeria monocytogenes'), - cols = c(cfta, cephalosporins[cephalosporins != na.rm(cfta)])) - # other - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus %in% c('Leuconostoc', 'Pediococcus')), - cols = glycopeptides) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus == 'Lactobacillus'), - cols = glycopeptides) - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Clostridium (ramosum|innocuum)'), - cols = vanc) - if (info == TRUE) { - txt_ok() - } - - # Table 8: Interpretive rules for B-lactam agents and Gram-positive cocci ---- - rule <- 'Table 8: Interpretive rules for B-lactam agents and Gram-positive cocci' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - # rule 8.3 - if (!is.na(peni)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)' - & tbl[, peni] == 'S'), - cols = c(aminopenicillins, cephalosporins, carbapenems)) - } - # rule 8.6 - if (!is.na(ampi)) { + # Table 1: Intrinsic resistance in Enterobacteriaceae ---- + rule <- 'Table 1: Intrinsic resistance in Enterobacteriaceae' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + # Intrinsic R for this group edit_rsi(to = 'R', rule = c(rule_group, rule), - rows = which(tbl$genus == 'Enterococcus' - & tbl[, ampi] == 'R'), - cols = c(ureidopenicillins, carbapenems)) - } - if (!is.na(amox)) { + rows = which(tbl$family == 'Enterobacteriaceae'), + cols = c(peni, glycopeptides, fusi, macrolides, linc, streptogramins, rifa, dapt, line)) + # Citrobacter edit_rsi(to = 'R', rule = c(rule_group, rule), - rows = which(tbl$genus == 'Enterococcus' - & tbl[, amox] == 'R'), - cols = c(ureidopenicillins, carbapenems)) - } - if (info == TRUE) { - txt_ok() - } + rows = which(tbl$fullname %like% '^Citrobacter (koseri|amalonaticus|sedlakii|farmeri|rodentium)'), + cols = c(aminopenicillins, tica)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Citrobacter (freundii|braakii|murliniae|werkmanii|youngae)'), + cols = c(aminopenicillins, amcl, czol, cfox)) + # Enterobacter + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Enterobacter cloacae'), + cols = c(aminopenicillins, amcl, czol, cfox)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Enterobacter aerogenes'), + cols = c(aminopenicillins, amcl, czol, cfox)) + # Escherichia + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Escherichia hermanni'), + cols = c(aminopenicillins, tica)) + # Hafnia + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Hafnia alvei'), + cols = c(aminopenicillins, amcl, czol, cfox)) + # Klebsiella + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Klebsiella'), + cols = c(aminopenicillins, tica)) + # Morganella / Proteus + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Morganella morganii'), + cols = c(aminopenicillins, amcl, czol, tetracyclines, polymyxins, nitr)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Proteus mirabilis'), + cols = c(tetracyclines, tige, polymyxins, nitr)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Proteus penneri'), + cols = c(aminopenicillins, czol, cfur, tetracyclines, tige, polymyxins, nitr)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Proteus vulgaris'), + cols = c(aminopenicillins, czol, cfur, tetracyclines, tige, polymyxins, nitr)) + # Providencia + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Providencia rettgeri'), + cols = c(aminopenicillins, amcl, czol, cfur, tetracyclines, tige, polymyxins, nitr)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Providencia stuartii'), + cols = c(aminopenicillins, amcl, czol, cfur, tetracyclines, tige, polymyxins, nitr)) + # Raoultella + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Raoultella'), + cols = c(aminopenicillins, tica)) + # Serratia + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Serratia marcescens'), + cols = c(aminopenicillins, amcl, czol, cfox, cfur, tetracyclines[tetracyclines != na.rm(mino)], polymyxins, nitr)) + # Yersinia + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Yersinia enterocolitica'), + cols = c(aminopenicillins, amcl, tica, czol, cfox)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Yersinia pseudotuberculosis'), + cols = c(poly, coli)) + if (info == TRUE) { + txt_ok() + } - # Table 9: Interpretive rules for B-lactam agents and Gram-negative rods ---- - rule <- 'Table 9: Interpretive rules for B-lactam agents and Gram-negative rods' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - # rule 9.3 - if (!is.na(tica) & !is.na(pita)) { + # Table 2: Intrinsic resistance in non-fermentative Gram-negative bacteria ---- + rule <- 'Table 2: Intrinsic resistance in non-fermentative Gram-negative bacteria' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + # Intrinsic R for this group edit_rsi(to = 'R', rule = c(rule_group, rule), - rows = which(tbl$family == 'Enterobacteriaceae' - & tbl[, tica] == 'R' - & tbl[, pita] == 'S'), - cols = pita) - } - if (info == TRUE) { - txt_ok() - } + rows = which(tbl$genus %in% c('Achromobacter', + 'Acinetobacter', + 'Alcaligenes', + 'Bordatella', + 'Burkholderia', + 'Elizabethkingia', + 'Flavobacterium', + 'Ochrobactrum', + 'Pseudomonas', + 'Stenotrophomonas')), + cols = c(peni, cfox, cfur, glycopeptides, fusi, macrolides, linc, streptogramins, rifa, dapt, line)) + # Acinetobacter + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Acinetobacter (baumannii|pittii|nosocomialis|calcoaceticus)'), + cols = c(aminopenicillins, amcl, czol, cfot, cftr, aztr, erta, trim, fosf, tetracyclines[tetracyclines != na.rm(mino)])) + # Achromobacter + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Achromobacter (xylosoxydans|xylosoxidans)'), + cols = c(aminopenicillins, czol, cfot, cftr, erta)) + # Burkholderia + edit_rsi(to = 'R', + rule = c(rule_group, rule), + # onder 'Burkholderia cepacia complex' vallen deze species allemaal: PMID 16217180. + rows = which(tbl$fullname %like% '^Burkholderia (cepacia|multivorans|cenocepacia|stabilis|vietnamiensis|dolosa|ambifaria|anthina|pyrrocinia|ubonensis)'), + cols = c(aminopenicillins, amcl, tica, pita, czol, cfot, cftr, aztr, erta, cipr, chlo, aminoglycosides, trim, fosf, polymyxins)) + # Elizabethkingia + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Elizabethkingia meningoseptic(a|um)'), + cols = c(aminopenicillins, amcl, tica, czol, cfot, cftr, cfta, cfep, aztr, erta, imip, mero, polymyxins)) + # Ochrobactrum + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Ochrobactrum anthropi'), + cols = c(aminopenicillins, amcl, tica, pita, czol, cfot, cftr, cfta, cfep, aztr, erta)) + # Pseudomonas + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Pseudomonas aeruginosa'), + cols = c(aminopenicillins, amcl, czol, cfot, cftr, erta, chlo, kana, neom, trim, trsu, tetracyclines, tige)) + # Stenotrophomonas + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Stenotrophomonas maltophilia'), + cols = c(aminopenicillins, amcl, tica, pita, czol, cfot, cftr, cfta, aztr, erta, imip, mero, aminoglycosides, trim, fosf, tetr)) + if (info == TRUE) { + txt_ok() + } - # Table 10: Interpretive rules for B-lactam agents and other Gram-negative bacteria ---- - rule <- 'Table 10: Interpretive rules for B-lactam agents and other Gram-negative bacteria' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - # rule 10.2 - # if (!is.na(ampi)) { - # you should know first if the are B-lactamase positive, so do not run for now - # edit_rsi(to = 'R', - # rule = c(rule_group, rule), - # rows = which(tbl$fullname %like% '^Haemophilus influenza' - # & tbl[, ampi] == 'R'), - # cols = c(ampi, amox, amcl, pita, cfur)) - # } - if (info == TRUE) { - txt_ok() - } - - # Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins ---- - rule <- 'Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - # rule 11.1 - if (!is.na(eryt)) { - edit_rsi(to = 'S', - rule = c(rule_group, rule), - rows = which(tbl[, eryt] == 'S'), - cols = c(azit, clar)) - edit_rsi(to = 'I', - rule = c(rule_group, rule), - rows = which(tbl[, eryt] == 'I'), - cols = c(azit, clar)) + # Table 3: Intrinsic resistance in other Gram-negative bacteria ---- + rule <- 'Table 3: Intrinsic resistance in other Gram-negative bacteria' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + # Intrinsic R for this group edit_rsi(to = 'R', rule = c(rule_group, rule), - rows = which(tbl[, eryt] == 'R'), - cols = c(azit, clar)) - } - if (info == TRUE) { - txt_ok() - } - - # Table 12: Interpretive rules for aminoglycosides ---- - rule <- 'Table 12: Interpretive rules for aminoglycosides' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - # rule 12.2 - if (!is.na(tobr)) { + rows = which(tbl$genus %in% c('Haemophilus', + 'Moraxella', + 'Neisseria', + 'Campylobacter')), + cols = c(glycopeptides, linc, dapt, line)) + # Haemophilus edit_rsi(to = 'R', rule = c(rule_group, rule), - rows = which(tbl$genus == 'Staphylococcus' - & tbl[, tobr] == 'R'), - cols = c(kana, amik)) - } - # rule 12.3 - if (!is.na(gent)) { + rows = which(tbl$fullname %like% '^Haemophilus influenzae'), + cols = c(fusi, streptogramins)) + # Moraxella edit_rsi(to = 'R', rule = c(rule_group, rule), - rows = which(tbl$genus == 'Staphylococcus' - & tbl[, gent] == 'R'), - cols = aminoglycosides) - } - # rule 12.8 - if (!is.na(gent) & !is.na(tobr)) { - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$family == 'Enterobacteriaceae' - & tbl[, gent] == 'I' - & tbl[, tobr] == 'S'), - cols = gent) - } - # rule 12.9 - if (!is.na(gent) & !is.na(tobr)) { - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$family == 'Enterobacteriaceae' - & tbl[, tobr] == 'I' - & tbl[, gent] == 'R'), - cols = tobr) - } - if (info == TRUE) { - txt_ok() - } - - - # Table 13: Interpretive rules for quinolones ---- - rule <- 'Table 13: Interpretive rules for quinolones' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - # rule 13.2 - if (!is.na(moxi)) { - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$genus == 'Staphylococcus' - & tbl[, moxi] == 'R'), - cols = fluoroquinolones) - } - # rule 13.4 - if (!is.na(moxi)) { - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Streptococcus pneumoniae' - & tbl[, moxi] == 'R'), - cols = fluoroquinolones) - } - # rule 13.5 - if (!is.na(cipr)) { - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$family == 'Enterobacteriaceae' - & tbl[, cipr] == 'R'), - cols = fluoroquinolones) - } - # rule 13.8 - if (!is.na(cipr)) { - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl$fullname %like% '^Neisseria gonorrhoeae' - & tbl[, cipr] == 'R'), - cols = fluoroquinolones) - } - if (info == TRUE) { - txt_ok() - } - - # OTHER RULES ------------------------------------------------------------- - - if (info == TRUE) { - cat(bold('\nOther rules\n')) - } - rule_group <- "Other rules" - - rule <- 'Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(amcl)) { - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl[, amcl] == 'R'), - cols = ampi) - } - if (info == TRUE) { - txt_ok() - } - rule <- 'Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(trsu)) { - edit_rsi(to = 'R', - rule = c(rule_group, rule), - rows = which(tbl[, trsu] == 'R'), + rows = which(tbl$fullname %like% '^Moraxella catarrhalis'), cols = trim) - } - if (info == TRUE) { - txt_ok() - } - rule <- 'Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(amcl)) { - edit_rsi(to = 'S', + # Neisseria + edit_rsi(to = 'R', rule = c(rule_group, rule), - rows = which(tbl[, ampi] == 'S'), - cols = amcl) - } - if (info == TRUE) { - txt_ok() - } - rule <- 'Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S' - if (info == TRUE) { - warned <- FALSE - changed_results <- 0 - cat(rule) - } - if (!is.na(trsu)) { - edit_rsi(to = 'S', + rows = which(tbl$genus == 'Neisseria'), + cols = trim) + # Campylobacter + edit_rsi(to = 'R', rule = c(rule_group, rule), - rows = which(tbl[, trim] == 'S'), - cols = trsu) - } - if (info == TRUE) { - txt_ok() - } + rows = which(tbl$fullname %like% '^Campylobacter fetus'), + cols = c(fusi, streptogramins, trim, nali)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Campylobacter (jejuni|coli)'), + cols = c(fusi, streptogramins, trim)) + if (info == TRUE) { + txt_ok() + } + + # Table 4: Intrinsic resistance in Gram-positive bacteria ---- + rule <- 'Table 4: Intrinsic resistance in Gram-positive bacteria' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + # Intrinsic R for this group + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$gramstain == "Gram positive"), + cols = c(aztr, polymyxins, nali)) + # Staphylococcus + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Staphylococcus saprophyticus'), + cols = c(fusi, cfta, fosf, novo)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Staphylococcus (cohnii|xylosus)'), + cols = c(cfta, novo)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Staphylococcus capitis'), + cols = c(cfta, fosf)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Staphylococcus (aureus|epidermidis|coagulase negatief|hominis|haemolyticus|intermedius|pseudointermedius)'), + cols = cfta) + # Streptococcus + # rule 4.5 + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == 'Streptococcus'), + cols = c(fusi, aminoglycosides)) + # Enterococcus + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Enterococcus faecalis'), + cols = c(fusi, cfta, cephalosporins[cephalosporins != na.rm(cfta)], aminoglycosides, macrolides, clin, qida, trim, trsu)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Enterococcus (gallinarum|casseliflavus)'), + cols = c(fusi, cfta, cephalosporins[cephalosporins != na.rm(cfta)], aminoglycosides, macrolides, clin, qida, vanc, trim, trsu)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Enterococcus faecium'), + cols = c(fusi, cfta, cephalosporins[cephalosporins != na.rm(cfta)], aminoglycosides, macrolides, trim, trsu)) + # Corynebacterium + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == 'Corynebacterium'), + cols = fosf) + # Listeria + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Listeria monocytogenes'), + cols = c(cfta, cephalosporins[cephalosporins != na.rm(cfta)])) + # other + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus %in% c('Leuconostoc', 'Pediococcus')), + cols = glycopeptides) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == 'Lactobacillus'), + cols = glycopeptides) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Clostridium (ramosum|innocuum)'), + cols = vanc) + if (info == TRUE) { + txt_ok() + } + + # Table 8: Interpretive rules for B-lactam agents and Gram-positive cocci ---- + rule <- 'Table 8: Interpretive rules for B-lactam agents and Gram-positive cocci' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + # rule 8.3 + if (!is.na(peni)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G)' + & tbl[, peni] == 'S'), + cols = c(aminopenicillins, cephalosporins, carbapenems)) + } + # rule 8.6 + if (!is.na(ampi)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == 'Enterococcus' + & tbl[, ampi] == 'R'), + cols = c(ureidopenicillins, carbapenems)) + } + if (!is.na(amox)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == 'Enterococcus' + & tbl[, amox] == 'R'), + cols = c(ureidopenicillins, carbapenems)) + } + if (info == TRUE) { + txt_ok() + } + + # Table 9: Interpretive rules for B-lactam agents and Gram-negative rods ---- + rule <- 'Table 9: Interpretive rules for B-lactam agents and Gram-negative rods' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + # rule 9.3 + if (!is.na(tica) & !is.na(pita)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$family == 'Enterobacteriaceae' + & tbl[, tica] == 'R' + & tbl[, pita] == 'S'), + cols = pita) + } + if (info == TRUE) { + txt_ok() + } + + # Table 10: Interpretive rules for B-lactam agents and other Gram-negative bacteria ---- + rule <- 'Table 10: Interpretive rules for B-lactam agents and other Gram-negative bacteria' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + # rule 10.2 + # if (!is.na(ampi)) { + # you should know first if the are B-lactamase positive, so do not run for now + # edit_rsi(to = 'R', + # rule = c(rule_group, rule), + # rows = which(tbl$fullname %like% '^Haemophilus influenza' + # & tbl[, ampi] == 'R'), + # cols = c(ampi, amox, amcl, pita, cfur)) + # } + if (info == TRUE) { + txt_ok() + } + + # Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins ---- + rule <- 'Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + # rule 11.1 + if (!is.na(eryt)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl[, eryt] == 'S'), + cols = c(azit, clar)) + edit_rsi(to = 'I', + rule = c(rule_group, rule), + rows = which(tbl[, eryt] == 'I'), + cols = c(azit, clar)) + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl[, eryt] == 'R'), + cols = c(azit, clar)) + } + if (info == TRUE) { + txt_ok() + } + + # Table 12: Interpretive rules for aminoglycosides ---- + rule <- 'Table 12: Interpretive rules for aminoglycosides' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + # rule 12.2 + if (!is.na(tobr)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == 'Staphylococcus' + & tbl[, tobr] == 'R'), + cols = c(kana, amik)) + } + # rule 12.3 + if (!is.na(gent)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == 'Staphylococcus' + & tbl[, gent] == 'R'), + cols = aminoglycosides) + } + # rule 12.8 + if (!is.na(gent) & !is.na(tobr)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$family == 'Enterobacteriaceae' + & tbl[, gent] == 'I' + & tbl[, tobr] == 'S'), + cols = gent) + } + # rule 12.9 + if (!is.na(gent) & !is.na(tobr)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$family == 'Enterobacteriaceae' + & tbl[, tobr] == 'I' + & tbl[, gent] == 'R'), + cols = tobr) + } + if (info == TRUE) { + txt_ok() + } + + + # Table 13: Interpretive rules for quinolones ---- + rule <- 'Table 13: Interpretive rules for quinolones' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + # rule 13.2 + if (!is.na(moxi)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$genus == 'Staphylococcus' + & tbl[, moxi] == 'R'), + cols = fluoroquinolones) + } + # rule 13.4 + if (!is.na(moxi)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Streptococcus pneumoniae' + & tbl[, moxi] == 'R'), + cols = fluoroquinolones) + } + # rule 13.5 + if (!is.na(cipr)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$family == 'Enterobacteriaceae' + & tbl[, cipr] == 'R'), + cols = fluoroquinolones) + } + # rule 13.8 + if (!is.na(cipr)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl$fullname %like% '^Neisseria gonorrhoeae' + & tbl[, cipr] == 'R'), + cols = fluoroquinolones) + } + if (info == TRUE) { + txt_ok() + } + + } # end of expert rules + if (any(c("all", "other") %in% rules)) { + + # OTHER RULES ------------------------------------------------------------- + + if (info == TRUE) { + cat(bold('\nOther rules\n')) + } + rule_group <- "Other rules" + + rule <- 'Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(amcl)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl[, amcl] == 'R'), + cols = ampi) + } + if (info == TRUE) { + txt_ok() + } + rule <- 'Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(trsu)) { + edit_rsi(to = 'R', + rule = c(rule_group, rule), + rows = which(tbl[, trsu] == 'R'), + cols = trim) + } + if (info == TRUE) { + txt_ok() + } + rule <- 'Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(amcl)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl[, ampi] == 'S'), + cols = amcl) + } + if (info == TRUE) { + txt_ok() + } + rule <- 'Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S' + if (info == TRUE) { + warned <- FALSE + changed_results <- 0 + cat(rule) + } + if (!is.na(trsu)) { + edit_rsi(to = 'S', + rule = c(rule_group, rule), + rows = which(tbl[, trim] == 'S'), + cols = trsu) + } + if (info == TRUE) { + txt_ok() + } + + } # end of other rules # restore old col_mo values if needed - if (!is.null(col_mo_original)) { - tbl_original[, col_mo] <- col_mo_original - } + # if (!is.null(col_mo_original)) { + # tbl_original[, col_mo] <- col_mo_original + # } if (info == TRUE) { cat(bold('\n=> EUCAST rules affected', diff --git a/R/freq.R b/R/freq.R index be8410bd..13dc9225 100755 --- a/R/freq.R +++ b/R/freq.R @@ -59,6 +59,7 @@ #' @importFrom dplyr %>% select pull n_distinct group_by arrange desc mutate summarise n_distinct tibble #' @importFrom utils browseVignettes installed.packages #' @importFrom hms is.hms +#' @importFrom crayon red silver #' @keywords summary summarise frequency freq #' @rdname freq #' @name freq @@ -321,13 +322,24 @@ frequency_tbl <- function(x, } else { header <- header %>% paste0(markdown_line, 'Class: ', class(x) %>% rev() %>% paste(collapse = " > ")) if (!mode(x) %in% class(x)) { - header <- header %>% paste0(" (", mode(x), ")") + header <- header %>% paste0(silver(paste0(" (", mode(x), ")"))) + } + } + + NAs_to_red <- function(x) { + if (!x %in% c("0", "0.00%")) { + red(x) + } else { + x } } header <- header %>% paste0(markdown_line, '\nLength: ', (NAs %>% length() + x %>% length()) %>% format(), - ' (of which NA: ', NAs %>% length() %>% format(), - ' = ', (NAs %>% length() / (NAs %>% length() + x %>% length())) %>% percent(force_zero = TRUE, round = digits) %>% sub('NaN', '0', ., fixed = TRUE), ')') + ' (of which NA: ', NAs %>% length() %>% format() %>% NAs_to_red(), + ' = ', (NAs %>% length() / (NAs %>% length() + x %>% length())) %>% + percent(force_zero = TRUE, round = digits) %>% + sub('NaN', '0', ., fixed = TRUE) %>% + NAs_to_red(), ')') header <- header %>% paste0(markdown_line, '\nUnique: ', x %>% n_distinct() %>% format()) if (NROW(x) > 0 & any(class(x) == "character")) { @@ -570,6 +582,7 @@ diff.frequency_tbl <- function(x, y, ...) { #' @exportMethod print.frequency_tbl #' @importFrom knitr kable #' @importFrom dplyr n_distinct +#' @importFrom crayon bold #' @export print.frequency_tbl <- function(x, nmax = getOption("max.print.freq", default = 15), ...) { @@ -602,7 +615,13 @@ print.frequency_tbl <- function(x, nmax = getOption("max.print.freq", default = } } - cat("Frequency table", title, "\n") + title <- paste("Frequency table", title) + + if (opt$tbl_format == "pandoc") { + title <- bold(title) # only bold in regular printing + } + + cat(title, "\n") if (!is.null(opt$header)) { cat(opt$header) diff --git a/README.md b/README.md index 933fb3ce..3813f02d 100755 --- a/README.md +++ b/README.md @@ -280,37 +280,40 @@ plot(mic_data) ### Overwrite/force resistance based on EUCAST rules This is also called *interpretive reading*. ```r -before <- data.frame(bact = c("STAAUR", # Staphylococcus aureus - "ENCFAE", # Enterococcus faecalis - "ESCCOL", # Escherichia coli - "KLEPNE", # Klebsiella pneumoniae - "PSEAER"), # Pseudomonas aeruginosa - vanc = "-", # Vancomycin - amox = "-", # Amoxicillin - coli = "-", # Colistin - cfta = "-", # Ceftazidime - cfur = "-", # Cefuroxime - stringsAsFactors = FALSE) -before -# bact vanc amox coli cfta cfur -# 1 STAAUR - - - - - -# 2 ENCFAE - - - - - -# 3 ESCCOL - - - - - -# 4 KLEPNE - - - - - -# 5 PSEAER - - - - - +a <- data.frame(mo = c("Staphylococcus aureus", + "Enterococcus faecalis", + "Escherichia coli", + "Klebsiella pneumoniae", + "Pseudomonas aeruginosa"), + vanc = "-", # Vancomycin + amox = "-", # Amoxicillin + coli = "-", # Colistin + cfta = "-", # Ceftazidime + cfur = "-", # Cefuroxime + peni = "S", # Benzylpenicillin + cfox = "S", # Cefoxitin + stringsAsFactors = FALSE) + +a +# mo vanc amox coli cfta cfur peni cfox +# 1 Staphylococcus aureus - - - - - S S +# 2 Enterococcus faecalis - - - - - S S +# 3 Escherichia coli - - - - - S S +# 4 Klebsiella pneumoniae - - - - - S S +# 5 Pseudomonas aeruginosa - - - - - S S -# Now apply those rules; just need a column with bacteria IDs and antibiotic results: -after <- EUCAST_rules(before, col_mo = "bact") -after -# bact vanc amox coli cfta cfur -# 1 STAAUR - - R R - -# 2 ENCFAE - - R R R -# 3 ESCCOL R - - - - -# 4 KLEPNE R R - - - -# 5 PSEAER R R - - R +b <- EUCAST_rules(a) # 18 results are forced as R or S + +b +# mo vanc amox coli cfta cfur peni cfox +# 1 Staphylococcus aureus - S R R S S S +# 2 Enterococcus faecalis - - R R R S R +# 3 Escherichia coli R - - - - R S +# 4 Klebsiella pneumoniae R R - - - R S +# 5 Pseudomonas aeruginosa R R - - R R R ``` -Bacteria IDs can be retrieved with the `guess_mo` function. It uses any type of info about a microorganism as input. For example, all these will return value `STAAUR`, the ID of *S. aureus*: +Bacteria IDs can be retrieved with the `guess_mo` function. It uses any type of info about a microorganism as input. For example, all these will return value `B_STPHY_AUR`, the ID of *S. aureus*: ```r guess_mo("stau") guess_mo("STAU") @@ -319,6 +322,7 @@ guess_mo("S. aureus") guess_mo("S aureus") guess_mo("Staphylococcus aureus") guess_mo("MRSA") # Methicillin Resistant S. aureus +guess_mo("MSSA") # Methicillin Susceptible S. aureus guess_mo("VISA") # Vancomycin Intermediate S. aureus guess_mo("VRSA") # Vancomycin Resistant S. aureus ``` @@ -359,32 +363,32 @@ Factors sort on item by default: ```r septic_patients %>% freq(hospital_id) # Frequency table of `hospital_id` -# Class: factor -# Length: 2000 (of which NA: 0 = 0.0%) +# Class: factor (numeric) +# Length: 2000 (of which NA: 0 = 0.00%) # Unique: 4 # # Item Count Percent Cum. Count Cum. Percent (Factor Level) # --- ----- ------ -------- ----------- ------------- --------------- -# 1 A 319 16.0% 319 16.0% 1 -# 2 B 661 33.1% 980 49.0% 2 -# 3 C 256 12.8% 1236 61.8% 3 -# 4 D 764 38.2% 2000 100.0% 4 +# 1 A 321 16.1% 321 16.1% 1 +# 2 B 663 33.1% 984 49.2% 2 +# 3 C 254 12.7% 1238 61.9% 3 +# 4 D 762 38.1% 2000 100.0% 4 ``` This can be changed with the `sort.count` parameter: ```r septic_patients %>% freq(hospital_id, sort.count = TRUE) # Frequency table of `hospital_id` -# Class: factor -# Length: 2000 (of which NA: 0 = 0.0%) +# Class: factor (numeric) +# Length: 2000 (of which NA: 0 = 0.00%) # Unique: 4 # # Item Count Percent Cum. Count Cum. Percent (Factor Level) # --- ----- ------ -------- ----------- ------------- --------------- -# 1 D 764 38.2% 764 38.2% 4 -# 2 B 661 33.1% 1425 71.2% 2 -# 3 A 319 16.0% 1744 87.2% 1 -# 4 C 256 12.8% 2000 100.0% 3 +# 1 D 762 38.1% 762 38.1% 4 +# 2 B 663 33.1% 1425 71.2% 2 +# 3 A 321 16.1% 1746 87.3% 1 +# 4 C 254 12.7% 2000 100.0% 3 ``` All other types, like numbers, characters and dates, sort on count by default: @@ -397,7 +401,7 @@ septic_patients %>% freq(date) # # Oldest: 2 January 2002 # Newest: 28 December 2017 (+5839) -# Median: 7 Augustus 2009 (~48%) +# Median: 31 July 2009 (~47%) # # Item Count Percent Cum. Count Cum. Percent # --- ----------- ------ -------- ----------- ------------- @@ -408,14 +412,14 @@ septic_patients %>% freq(date) # 5 2015-11-19 7 0.4% 41 2.1% # 6 2005-12-22 6 0.3% 47 2.4% # 7 2015-10-12 6 0.3% 53 2.6% -# 8 2002-05-16 5 0.2% 58 2.9% -# 9 2004-02-02 5 0.2% 63 3.1% -# 10 2004-02-18 5 0.2% 68 3.4% -# 11 2005-08-16 5 0.2% 73 3.6% -# 12 2005-09-01 5 0.2% 78 3.9% -# 13 2006-06-29 5 0.2% 83 4.2% -# 14 2007-08-10 5 0.2% 88 4.4% -# 15 2008-08-29 5 0.2% 93 4.7% +# 8 2002-02-27 5 0.2% 58 2.9% +# 9 2003-10-20 5 0.2% 63 3.1% +# 10 2004-02-02 5 0.2% 68 3.4% +# 11 2004-02-18 5 0.2% 73 3.6% +# 12 2004-06-22 5 0.2% 78 3.9% +# 13 2004-12-01 5 0.2% 83 4.2% +# 14 2005-08-16 5 0.2% 88 4.4% +# 15 2005-09-01 5 0.2% 93 4.7% # [ reached getOption("max.print.freq") -- omitted 1136 entries, n = 1907 (95.3%) ] ``` For numeric values, some extra descriptive statistics will be calculated: @@ -423,26 +427,26 @@ For numeric values, some extra descriptive statistics will be calculated: freq(runif(n = 10, min = 1, max = 5)) # Frequency table # Class: numeric -# Length: 10 (of which NA: 0 = 0.0%) +# Length: 10 (of which NA: 0 = 0.00%) # Unique: 10 # -# Mean: 3.4 -# Std. dev.: 1.3 (CV: 0.38, MAD: 1.3) -# Five-Num: 1.6 | 2.0 | 3.9 | 4.7 | 4.8 (IQR: 2.7, CQV: 0.4) +# Mean: 3.1 +# Std. dev.: 1.3 (CV: 0.43, MAD: 1.8) +# Five-Num: 1.3 | 1.7 | 3.2 | 4.3 | 5.0 (IQR: 2.6, CQV: 0.43) # Outliers: 0 # # Item Count Percent Cum. Count Cum. Percent # --- --------- ------ -------- ----------- ------------- -# 1 1.568997 1 10.0% 1 10.0% -# 2 1.993575 1 10.0% 2 20.0% -# 3 2.022348 1 10.0% 3 30.0% -# 4 2.236038 1 10.0% 4 40.0% -# 5 3.579828 1 10.0% 5 50.0% -# 6 4.178081 1 10.0% 6 60.0% -# 7 4.394818 1 10.0% 7 70.0% -# 8 4.689871 1 10.0% 8 80.0% -# 9 4.698626 1 10.0% 9 90.0% -# 10 4.751488 1 10.0% 10 100.0% +# 1 1.271079 1 10.0% 1 10.0% +# 2 1.333975 1 10.0% 2 20.0% +# 3 1.714946 1 10.0% 3 30.0% +# 4 2.751871 1 10.0% 4 40.0% +# 5 3.090140 1 10.0% 5 50.0% +# 6 3.260850 1 10.0% 6 60.0% +# 7 3.824105 1 10.0% 7 70.0% +# 8 4.278028 1 10.0% 8 80.0% +# 9 4.436265 1 10.0% 9 90.0% +# 10 4.996694 1 10.0% 10 100.0% # # Warning message: # All observations are unique. @@ -457,15 +461,17 @@ Data sets to work with antibiotics and bacteria properties. ```r # Data set with complete taxonomic trees from ITIS, containing of # the three kingdoms Bacteria, Fungi and Protozoa -microorganisms # A tibble: 18,831 x 15 - -# Data set with 2000 random blood culture isolates from anonymised -# septic patients between 2001 and 2017 in 5 Dutch hospitals -septic_patients # A tibble: 2,000 x 49 +microorganisms # data.frame: 18,833 x 15 +microorganisms.old # data.frame: 2,383 x 4 # Data set with ATC antibiotics codes, official names, trade names # and DDDs (oral and parenteral) -antibiotics # A tibble: 423 x 18 +antibiotics # data.frame: 423 x 18 + +# Data set with 2000 random blood culture isolates from anonymised +# septic patients between 2001 and 2017 in 5 Dutch hospitals +septic_patients # data.frame: 2,000 x 49 + ``` ## Benchmarks @@ -501,7 +507,7 @@ microbenchmark(A = as.mo("stau"), # F 10.69445 10.73852 10.80334 10.79596 10.86856 10.97465 10 ``` -The more an input value resembles a full name, the faster the result will be found. In the table above, all measurements are in milliseconds, tested on a quite regular Linux server from 2007 with 2 GB RAM. A value of 10.8 milliseconds means it can roughly determine 93 different input values per second. It case of 36.2 milliseconds, this is only 28 input values per second. +The more an input value resembles a full name, the faster the result will be found. In the table above, all measurements are in milliseconds, tested on a quite regular Linux server from 2007 with 2 GB RAM. A value of 10.8 milliseconds means it will roughly determine 93 different (unique) input values per second. It case of 36.2 milliseconds, this is only 28 input values per second. To improve speed, the `as.mo` function also takes into account the prevalence of human pathogenic microorganisms. The downside is of course that less prevalent microorganisms will be determined far less faster. See this example for the ID of *Burkholderia nodosa* (`B_BRKHL_NOD`): @@ -523,7 +529,7 @@ microbenchmark(B = as.mo("burnod"), ``` (Note: `A` is missing here, because `as.mo("buno")` returns `F_BUELL_NOT`: the ID of the fungus *Buellia notabilis*) -That takes up to 12 times as much time! A value of 190.4 milliseconds means it can only determine 5 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. +That takes up to 12 times as much time! A value of 190.4 milliseconds means it can only determine ~5 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. To relieve this pitfall and further improve performance, two important calculations take almost no time at all: **repetive results** and **already precalculated results**. diff --git a/man/EUCAST.Rd b/man/EUCAST.Rd index 6fc83ff0..17da179f 100755 --- a/man/EUCAST.Rd +++ b/man/EUCAST.Rd @@ -22,7 +22,8 @@ } } \usage{ -EUCAST_rules(tbl, col_mo = "mo", info = TRUE, amcl = "amcl", +EUCAST_rules(tbl, col_mo = "mo", info = TRUE, + rules = c("breakpoints", "expert", "other", "all"), amcl = "amcl", amik = "amik", amox = "amox", ampi = "ampi", azit = "azit", azlo = "azlo", aztr = "aztr", cefa = "cefa", cfep = "cfep", cfot = "cfot", cfox = "cfox", cfra = "cfra", cfta = "cfta", @@ -49,7 +50,9 @@ interpretive_reading(...) \item{info}{print progress} -\item{amcl, amik, amox, ampi, azit, azlo, aztr, cefa, cfep, cfot, cfox, cfra, cfta, cftr, cfur, chlo, cipr, clar, clin, clox, coli, czol, dapt, doxy, erta, eryt, fosf, fusi, gent, imip, kana, levo, linc, line, mero, mezl, mino, moxi, nali, neom, neti, nitr, norf, novo, oflo, oxac, peni, pita, poly, pris, qida, rifa, roxi, siso, teic, tetr, tica, tige, tobr, trim, trsu, vanc}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{rules}{a character vector that specifies which rules should be applied - one or more of \code{c("breakpoints", "expert", "other", "all")}} + +\item{amcl, amik, amox, ampi, azit, azlo, aztr, cefa, cfep, cfot, cfox, cfra, cfta, cftr, cfur, chlo, cipr, clar, clin, clox, coli, czol, dapt, doxy, erta, eryt, fosf, fusi, gent, imip, kana, levo, linc, line, mero, mezl, mino, moxi, nali, neom, neti, nitr, norf, novo, oflo, oxac, peni, pita, poly, pris, qida, rifa, roxi, siso, teic, tetr, tica, tige, tobr, trim, trsu, vanc}{column name of an antibiotic, see Details} \item{col_bactid}{Deprecated. Use \code{col_mo} instead.} @@ -58,14 +61,17 @@ interpretive_reading(...) \item{...}{parameters that are passed on to \code{EUCAST_rules}} } \value{ -table with edited variables of antibiotics. +Value of parameter \code{tbl}, possibly with edited values of antibiotics. } \description{ Apply susceptibility rules as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, \url{http://eucast.org}), see \emph{Source}. This includes (1) expert rules, (2) intrinsic resistance and (3) inferred resistance as defined in their breakpoint tables. } +\details{ +To define antibiotics column names, input a text or use \code{NA} to skip a column (e.g. \code{tica = NA}). Non-existing columns will anyway be skipped with a warning. See the Antibiotics section for an explanation of the abbreviations. +} \section{Antibiotics}{ -Abbrevations of the column containing antibiotics: +Abbrevations of the column containing antibiotics in the form: \strong{abbreviation}: generic name (\emph{ATC code}) \strong{amcl}: amoxicillin+clavulanic acid (\emph{J01CR02}), \strong{amik}: amikacin (\emph{J01GB06}), @@ -143,11 +149,27 @@ a <- data.frame(mo = c("Staphylococcus aureus", coli = "-", # Colistin cfta = "-", # Ceftazidime cfur = "-", # Cefuroxime + peni = "S", # Benzylpenicillin + cfox = "S", # Cefoxitin stringsAsFactors = FALSE) -a -b <- EUCAST_rules(a) # 11 results will be forced as R due to intrinsic resistance +a +# mo vanc amox coli cfta cfur peni cfox +# 1 Staphylococcus aureus - - - - - S S +# 2 Enterococcus faecalis - - - - - S S +# 3 Escherichia coli - - - - - S S +# 4 Klebsiella pneumoniae - - - - - S S +# 5 Pseudomonas aeruginosa - - - - - S S + +b <- EUCAST_rules(a) # 18 results are forced as R or S + b +# mo vanc amox coli cfta cfur peni cfox +# 1 Staphylococcus aureus - S R R S S S +# 2 Enterococcus faecalis - - R R R S R +# 3 Escherichia coli R - - - - R S +# 4 Klebsiella pneumoniae R R - - - R S +# 5 Pseudomonas aeruginosa R R - - R R R } \keyword{eucast} \keyword{interpretive} diff --git a/man/MDRO.Rd b/man/MDRO.Rd index 7df3ac7c..321aad99 100755 --- a/man/MDRO.Rd +++ b/man/MDRO.Rd @@ -40,123 +40,123 @@ EUCAST_exceptional_phenotypes(tbl, country = "EUCAST", ...) \item{info}{print progress} -\item{amcl}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{amcl}{column name of an antibiotic, see Details} -\item{amik}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{amik}{column name of an antibiotic, see Details} -\item{amox}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{amox}{column name of an antibiotic, see Details} -\item{ampi}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{ampi}{column name of an antibiotic, see Details} -\item{azit}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{azit}{column name of an antibiotic, see Details} -\item{aztr}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{aztr}{column name of an antibiotic, see Details} -\item{cefa}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{cefa}{column name of an antibiotic, see Details} -\item{cfra}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{cfra}{column name of an antibiotic, see Details} -\item{cfep}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{cfep}{column name of an antibiotic, see Details} -\item{cfot}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{cfot}{column name of an antibiotic, see Details} -\item{cfox}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{cfox}{column name of an antibiotic, see Details} -\item{cfta}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{cfta}{column name of an antibiotic, see Details} -\item{cftr}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{cftr}{column name of an antibiotic, see Details} -\item{cfur}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{cfur}{column name of an antibiotic, see Details} -\item{chlo}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{chlo}{column name of an antibiotic, see Details} -\item{cipr}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{cipr}{column name of an antibiotic, see Details} -\item{clar}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{clar}{column name of an antibiotic, see Details} -\item{clin}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{clin}{column name of an antibiotic, see Details} -\item{clox}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{clox}{column name of an antibiotic, see Details} -\item{coli}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{coli}{column name of an antibiotic, see Details} -\item{czol}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{czol}{column name of an antibiotic, see Details} -\item{dapt}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{dapt}{column name of an antibiotic, see Details} -\item{doxy}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{doxy}{column name of an antibiotic, see Details} -\item{erta}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{erta}{column name of an antibiotic, see Details} -\item{eryt}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{eryt}{column name of an antibiotic, see Details} -\item{fosf}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{fosf}{column name of an antibiotic, see Details} -\item{fusi}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{fusi}{column name of an antibiotic, see Details} -\item{gent}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{gent}{column name of an antibiotic, see Details} -\item{imip}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{imip}{column name of an antibiotic, see Details} -\item{kana}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{kana}{column name of an antibiotic, see Details} -\item{levo}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{levo}{column name of an antibiotic, see Details} -\item{linc}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{linc}{column name of an antibiotic, see Details} -\item{line}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{line}{column name of an antibiotic, see Details} -\item{mero}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{mero}{column name of an antibiotic, see Details} \item{metr}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} -\item{mino}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{mino}{column name of an antibiotic, see Details} -\item{moxi}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{moxi}{column name of an antibiotic, see Details} -\item{nali}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{nali}{column name of an antibiotic, see Details} -\item{neom}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{neom}{column name of an antibiotic, see Details} -\item{neti}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{neti}{column name of an antibiotic, see Details} -\item{nitr}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{nitr}{column name of an antibiotic, see Details} -\item{novo}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{novo}{column name of an antibiotic, see Details} -\item{norf}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{norf}{column name of an antibiotic, see Details} -\item{oflo}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{oflo}{column name of an antibiotic, see Details} -\item{peni}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{peni}{column name of an antibiotic, see Details} -\item{pita}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{pita}{column name of an antibiotic, see Details} -\item{poly}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{poly}{column name of an antibiotic, see Details} -\item{qida}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{qida}{column name of an antibiotic, see Details} -\item{rifa}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{rifa}{column name of an antibiotic, see Details} -\item{roxi}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{roxi}{column name of an antibiotic, see Details} -\item{siso}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{siso}{column name of an antibiotic, see Details} -\item{teic}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{teic}{column name of an antibiotic, see Details} -\item{tetr}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{tetr}{column name of an antibiotic, see Details} -\item{tica}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{tica}{column name of an antibiotic, see Details} -\item{tige}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{tige}{column name of an antibiotic, see Details} -\item{tobr}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{tobr}{column name of an antibiotic, see Details} -\item{trim}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{trim}{column name of an antibiotic, see Details} -\item{trsu}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{trsu}{column name of an antibiotic, see Details} -\item{vanc}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.} +\item{vanc}{column name of an antibiotic, see Details} \item{col_bactid}{Deprecated. Use \code{col_mo} instead.} @@ -173,7 +173,7 @@ When \code{country} will be left blank, guidelines will be taken from EUCAST Exp } \section{Antibiotics}{ -Abbrevations of the column containing antibiotics: +Abbrevations of the column containing antibiotics in the form: \strong{abbreviation}: generic name (\emph{ATC code}) \strong{amcl}: amoxicillin+clavulanic acid (\emph{J01CR02}), \strong{amik}: amikacin (\emph{J01GB06}),