expert rules 12.0

This commit is contained in:
dr. M.S. (Matthijs) Berends 2022-11-14 15:20:39 +01:00
parent 7ca44fb756
commit f6862a139d
35 changed files with 433 additions and 128 deletions

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 1.8.2.9050 Version: 1.8.2.9051
Date: 2022-11-13 Date: 2022-11-14
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR) Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by data analysis and to work with microbial and antimicrobial properties by

View File

@ -1,4 +1,4 @@
# AMR 1.8.2.9050 # AMR 1.8.2.9051
This version will eventually become v2.0! We're happy to reach a new major milestone soon! This version will eventually become v2.0! We're happy to reach a new major milestone soon!
@ -15,7 +15,7 @@ This version will eventually become v2.0! We're happy to reach a new major miles
* Using `units` in `ab_ddd(..., units = "...")` had been deprecated and is now not supported anymore. Use `ab_ddd_units()` instead. * Using `units` in `ab_ddd(..., units = "...")` had been deprecated and is now not supported anymore. Use `ab_ddd_units()` instead.
### New ### New
* **EUCAST 2022 and CLSI 2022 guidelines** have been added for `as.rsi()`. EUCAST 2022 is now the new default guideline for all MIC and disks diffusion interpretations. * **EUCAST 2022 and CLSI 2022 guidelines** have been added for `as.rsi()`. EUCAST 2022 (v12.0) is now the new default guideline for all MIC and disks diffusion interpretations, and for `eucast_rules()` to apply EUCAST Expert Rules.
* Support for the following languages: Chinese, Greek, Japanese, Polish, Turkish and Ukrainian. We are very grateful for the valuable input by our colleagues from other countries. The `AMR` package is now available in 16 languages. The automatic language determination will give a note at start-up on systems in supported languages. * Support for the following languages: Chinese, Greek, Japanese, Polish, Turkish and Ukrainian. We are very grateful for the valuable input by our colleagues from other countries. The `AMR` package is now available in 16 languages. The automatic language determination will give a note at start-up on systems in supported languages.
* **All new algorithm for `as.mo()`** (and thus all `mo_*()` functions) while still following our original set-up as described in our recently submitted JSS paper (DOI [10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)). * **All new algorithm for `as.mo()`** (and thus all `mo_*()` functions) while still following our original set-up as described in our recently submitted JSS paper (DOI [10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)).
* A new argument `keep_synonyms` allows to *not* correct for updated taxonomy, in favour of the now deleted argument `allow_uncertain` * A new argument `keep_synonyms` allows to *not* correct for updated taxonomy, in favour of the now deleted argument `allow_uncertain`

View File

@ -30,6 +30,12 @@
# add new version numbers here, and add the rules themselves to "data-raw/eucast_rules.tsv" and rsi_translation # add new version numbers here, and add the rules themselves to "data-raw/eucast_rules.tsv" and rsi_translation
# (sourcing "data-raw/_pre_commit_hook.R" will process the TSV file) # (sourcing "data-raw/_pre_commit_hook.R" will process the TSV file)
EUCAST_VERSION_BREAKPOINTS <- list( EUCAST_VERSION_BREAKPOINTS <- list(
"12.0" = list(
version_txt = "v12.0",
year = 2022,
title = "'EUCAST Clinical Breakpoint Tables'",
url = "https://www.eucast.org/clinical_breakpoints/"
),
"11.0" = list( "11.0" = list(
version_txt = "v11.0", version_txt = "v11.0",
year = 2021, year = 2021,

View File

@ -304,7 +304,7 @@ search_type_in_df <- function(x, type, info = TRUE) {
found <- found[1] found <- found[1]
if (!is.null(found) && info == TRUE) { if (!is.null(found) && isTRUE(info)) {
if (message_not_thrown_before("search_in_type", type)) { if (message_not_thrown_before("search_in_type", type)) {
msg <- paste0("Using column '", font_bold(found), "' as input for `col_", type, "`.") msg <- paste0("Using column '", font_bold(found), "' as input for `col_", type, "`.")
if (type %in% c("keyantibiotics", "keyantimicrobials", "specimen")) { if (type %in% c("keyantibiotics", "keyantimicrobials", "specimen")) {

12
R/ab.R
View File

@ -132,7 +132,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_unknown_ATCs <- character(0) x_unknown_ATCs <- character(0)
note_if_more_than_one_found <- function(found, index, from_text) { note_if_more_than_one_found <- function(found, index, from_text) {
if (initial_search == TRUE && isTRUE(length(from_text) > 1)) { if (isTRUE(initial_search) && isTRUE(length(from_text) > 1)) {
abnames <- ab_name(from_text, tolower = TRUE, initial_search = FALSE) abnames <- ab_name(from_text, tolower = TRUE, initial_search = FALSE)
if (ab_name(found[1L], language = NULL) %like% "(clavulanic acid|avibactam)") { if (ab_name(found[1L], language = NULL) %like% "(clavulanic acid|avibactam)") {
abnames <- abnames[!abnames %in% c("clavulanic acid", "avibactam")] abnames <- abnames[!abnames %in% c("clavulanic acid", "avibactam")]
@ -175,13 +175,13 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_new[is.na(x)] <- NA x_new[is.na(x)] <- NA
already_known[is.na(x)] <- FALSE already_known[is.na(x)] <- FALSE
if (initial_search == TRUE && sum(already_known) < length(x)) { if (isTRUE(initial_search) && sum(already_known) < length(x)) {
progress <- progress_ticker(n = sum(!already_known), n_min = 25, print = info) # start if n >= 25 progress <- progress_ticker(n = sum(!already_known), n_min = 25, print = info) # start if n >= 25
on.exit(close(progress)) on.exit(close(progress))
} }
for (i in which(!already_known)) { for (i in which(!already_known)) {
if (initial_search == TRUE) { if (isTRUE(initial_search)) {
progress$tick() progress$tick()
} }
@ -316,7 +316,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# INITIAL SEARCH - More uncertain results ---- # INITIAL SEARCH - More uncertain results ----
if (initial_search == TRUE && fast_mode == FALSE) { if (isTRUE(initial_search) && fast_mode == FALSE) {
# only run on first try # only run on first try
# try by removing all spaces # try by removing all spaces
@ -487,12 +487,12 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1]) x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1])
} }
if (initial_search == TRUE && sum(already_known) < length(x)) { if (isTRUE(initial_search) && sum(already_known) < length(x)) {
close(progress) close(progress)
} }
# save to package env to save time for next time # save to package env to save time for next time
if (initial_search == TRUE) { if (isTRUE(initial_search)) {
AMR_env$ab_previously_coerced <- AMR_env$ab_previously_coerced[which(!AMR_env$ab_previously_coerced$x %in% x), , drop = FALSE] AMR_env$ab_previously_coerced <- AMR_env$ab_previously_coerced[which(!AMR_env$ab_previously_coerced$x %in% x), , drop = FALSE]
AMR_env$ab_previously_coerced <- unique(rbind(AMR_env$ab_previously_coerced, AMR_env$ab_previously_coerced <- unique(rbind(AMR_env$ab_previously_coerced,
data.frame( data.frame(

View File

@ -685,7 +685,7 @@ all.ab_selector_any_all <- function(..., na.rm = FALSE) {
# e.g., example_isolates %>% filter(all(carbapenems() == "R")) # e.g., example_isolates %>% filter(all(carbapenems() == "R"))
# so just return the vector as is, only correcting for na.rm # so just return the vector as is, only correcting for na.rm
out <- unclass(c(...)) out <- unclass(c(...))
if (na.rm == TRUE) { if (isTRUE(na.rm)) {
out <- out[!is.na(out)] out <- out[!is.na(out)]
} }
out out
@ -699,7 +699,7 @@ any.ab_selector_any_all <- function(..., na.rm = FALSE) {
# e.g., example_isolates %>% filter(any(carbapenems() == "R")) # e.g., example_isolates %>% filter(any(carbapenems() == "R"))
# so just return the vector as is, only correcting for na.rm # so just return the vector as is, only correcting for na.rm
out <- unclass(c(...)) out <- unclass(c(...))
if (na.rm == TRUE) { if (isTRUE(na.rm)) {
out <- out[!is.na(out)] out <- out[!is.na(out)]
} }
out out

12
R/av.R
View File

@ -114,7 +114,7 @@ as.av <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_unknown_ATCs <- character(0) x_unknown_ATCs <- character(0)
note_if_more_than_one_found <- function(found, index, from_text) { note_if_more_than_one_found <- function(found, index, from_text) {
if (initial_search == TRUE && isTRUE(length(from_text) > 1)) { if (isTRUE(initial_search) && isTRUE(length(from_text) > 1)) {
avnames <- av_name(from_text, tolower = TRUE, initial_search = FALSE) avnames <- av_name(from_text, tolower = TRUE, initial_search = FALSE)
if (av_name(found[1L], language = NULL) %like% "(clavulanic acid|avibactam)") { if (av_name(found[1L], language = NULL) %like% "(clavulanic acid|avibactam)") {
avnames <- avnames[!avnames %in% c("clavulanic acid", "avibactam")] avnames <- avnames[!avnames %in% c("clavulanic acid", "avibactam")]
@ -157,13 +157,13 @@ as.av <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_new[is.na(x)] <- NA x_new[is.na(x)] <- NA
already_known[is.na(x)] <- FALSE already_known[is.na(x)] <- FALSE
if (initial_search == TRUE && sum(already_known) < length(x)) { if (isTRUE(initial_search) && sum(already_known) < length(x)) {
progress <- progress_ticker(n = sum(!already_known), n_min = 25, print = info) # start if n >= 25 progress <- progress_ticker(n = sum(!already_known), n_min = 25, print = info) # start if n >= 25
on.exit(close(progress)) on.exit(close(progress))
} }
for (i in which(!already_known)) { for (i in which(!already_known)) {
if (initial_search == TRUE) { if (isTRUE(initial_search)) {
progress$tick() progress$tick()
} }
@ -286,7 +286,7 @@ as.av <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# INITIAL SEARCH - More uncertain results ---- # INITIAL SEARCH - More uncertain results ----
if (initial_search == TRUE && fast_mode == FALSE) { if (isTRUE(initial_search) && fast_mode == FALSE) {
# only run on first try # only run on first try
# try by removing all spaces # try by removing all spaces
@ -452,12 +452,12 @@ as.av <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1]) x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1])
} }
if (initial_search == TRUE && sum(already_known) < length(x)) { if (isTRUE(initial_search) && sum(already_known) < length(x)) {
close(progress) close(progress)
} }
# save to package env to save time for next time # save to package env to save time for next time
if (initial_search == TRUE) { if (isTRUE(initial_search)) {
AMR_env$av_previously_coerced <- AMR_env$av_previously_coerced[which(!AMR_env$av_previously_coerced$x %in% x), , drop = FALSE] AMR_env$av_previously_coerced <- AMR_env$av_previously_coerced[which(!AMR_env$av_previously_coerced$x %in% x), , drop = FALSE]
AMR_env$av_previously_coerced <- unique(rbind(AMR_env$av_previously_coerced, AMR_env$av_previously_coerced <- unique(rbind(AMR_env$av_previously_coerced,
data.frame( data.frame(

View File

@ -281,7 +281,7 @@
#' - `original_txt`\cr Original text in the PDF file of EUCAST #' - `original_txt`\cr Original text in the PDF file of EUCAST
#' - `eucast_version`\cr Version number of the EUCAST Clinical Breakpoints guideline to which these dosages apply #' - `eucast_version`\cr Version number of the EUCAST Clinical Breakpoints guideline to which these dosages apply
#' @details #' @details
#' This data set is based on `r format_eucast_version_nr(11.0)`. #' This data set is based on `r format_eucast_version_nr(12.0)` and `r format_eucast_version_nr(11.0)`.
#' #'
#' ### Direct download #' ### Direct download
#' Like all data sets in this package, this data set is publicly available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. Please visit [our website for the download links](https://msberends.github.io/AMR/articles/datasets.html). The actual files are of course available on [our GitHub repository](https://github.com/msberends/AMR/tree/main/data-raw). #' Like all data sets in this package, this data set is publicly available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. Please visit [our website for the download links](https://msberends.github.io/AMR/articles/datasets.html). The actual files are of course available on [our GitHub repository](https://github.com/msberends/AMR/tree/main/data-raw).

View File

@ -75,7 +75,7 @@ as.disk <- function(x, na.rm = FALSE) {
if (!is.disk(x)) { if (!is.disk(x)) {
x <- unlist(x) x <- unlist(x)
if (na.rm == TRUE) { if (isTRUE(na.rm)) {
x <- x[!is.na(x)] x <- x[!is.na(x)]
} }
x[trimws2(x) == ""] <- NA x[trimws2(x) == ""] <- NA

View File

@ -165,7 +165,7 @@ eucast_rules <- function(x,
info = interactive(), info = interactive(),
rules = getOption("AMR_eucastrules", default = c("breakpoints", "expert")), rules = getOption("AMR_eucastrules", default = c("breakpoints", "expert")),
verbose = FALSE, verbose = FALSE,
version_breakpoints = 11.0, version_breakpoints = 12.0,
version_expertrules = 3.3, version_expertrules = 3.3,
ampc_cephalosporin_resistance = NA, ampc_cephalosporin_resistance = NA,
only_rsi_columns = FALSE, only_rsi_columns = FALSE,
@ -182,13 +182,13 @@ eucast_rules <- function(x,
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
meet_criteria(custom_rules, allow_class = "custom_eucast_rules", allow_NULL = TRUE) meet_criteria(custom_rules, allow_class = "custom_eucast_rules", allow_NULL = TRUE)
if ("custom" %in% rules & is.null(custom_rules)) { if ("custom" %in% rules && is.null(custom_rules)) {
warning_("in `eucast_rules()`: no custom rules were set with the `custom_rules` argument", warning_("in `eucast_rules()`: no custom rules were set with the `custom_rules` argument",
immediate = TRUE immediate = TRUE
) )
rules <- rules[rules != "custom"] rules <- rules[rules != "custom"]
if (length(rules) == 0) { if (length(rules) == 0) {
if (info == TRUE) { if (isTRUE(info)) {
message_("No other rules were set, returning original data", add_fn = font_red, as_note = FALSE) message_("No other rules were set, returning original data", add_fn = font_red, as_note = FALSE)
} }
return(x) return(x)
@ -204,11 +204,11 @@ eucast_rules <- function(x,
expertrules_info <- EUCAST_VERSION_EXPERT_RULES[[which(as.double(names(EUCAST_VERSION_EXPERT_RULES)) == version_expertrules)]] expertrules_info <- EUCAST_VERSION_EXPERT_RULES[[which(as.double(names(EUCAST_VERSION_EXPERT_RULES)) == version_expertrules)]]
# support old setting (until AMR v1.3.0) # support old setting (until AMR v1.3.0)
if (missing(rules) & !is.null(getOption("AMR.eucast_rules", default = NULL))) { if (missing(rules) && !is.null(getOption("AMR.eucast_rules", default = NULL))) {
rules <- getOption("AMR.eucast_rules") rules <- getOption("AMR.eucast_rules")
} }
if (interactive() & verbose == TRUE & info == TRUE) { if (interactive() && isTRUE(verbose) && isTRUE(info)) {
txt <- paste0( txt <- paste0(
"WARNING: In Verbose mode, the eucast_rules() function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way.", "WARNING: In Verbose mode, the eucast_rules() function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way.",
"\n\nThis may overwrite your existing data if you use e.g.:", "\n\nThis may overwrite your existing data if you use e.g.:",
@ -247,9 +247,9 @@ eucast_rules <- function(x,
cat(font_subtle(" (no changes)\n")) cat(font_subtle(" (no changes)\n"))
} else { } else {
# opening # opening
if (n_added > 0 & n_changed == 0) { if (n_added > 0 && n_changed == 0) {
cat(font_green(" (")) cat(font_green(" ("))
} else if (n_added == 0 & n_changed > 0) { } else if (n_added == 0 && n_changed > 0) {
cat(font_blue(" (")) cat(font_blue(" ("))
} else { } else {
cat(font_grey(" (")) cat(font_grey(" ("))
@ -263,7 +263,7 @@ eucast_rules <- function(x,
} }
} }
# separator # separator
if (n_added > 0 & n_changed > 0) { if (n_added > 0 && n_changed > 0) {
cat(font_grey(", ")) cat(font_grey(", "))
} }
# changes # changes
@ -275,9 +275,9 @@ eucast_rules <- function(x,
} }
} }
# closing # closing
if (n_added > 0 & n_changed == 0) { if (n_added > 0 && n_changed == 0) {
cat(font_green(")\n")) cat(font_green(")\n"))
} else if (n_added == 0 & n_changed > 0) { } else if (n_added == 0 && n_changed > 0) {
cat(font_blue(")\n")) cat(font_blue(")\n"))
} else { } else {
cat(font_grey(")\n")) cat(font_grey(")\n"))
@ -314,16 +314,16 @@ eucast_rules <- function(x,
... ...
) )
if (!"AMP" %in% names(cols_ab) & "AMX" %in% names(cols_ab)) { if (!"AMP" %in% names(cols_ab) && "AMX" %in% names(cols_ab)) {
# ampicillin column is missing, but amoxicillin is available # ampicillin column is missing, but amoxicillin is available
if (info == TRUE) { if (isTRUE(info)) {
message_("Using column '", cols_ab[names(cols_ab) == "AMX"], "' as input for ampicillin since many EUCAST rules depend on it.") message_("Using column '", cols_ab[names(cols_ab) == "AMX"], "' as input for ampicillin since many EUCAST rules depend on it.")
} }
cols_ab <- c(cols_ab, c(AMP = unname(cols_ab[names(cols_ab) == "AMX"]))) cols_ab <- c(cols_ab, c(AMP = unname(cols_ab[names(cols_ab) == "AMX"])))
} }
# data preparation ---- # data preparation ----
if (info == TRUE & NROW(x) > 10000) { if (isTRUE(info) && NROW(x) > 10000) {
message_("Preparing data...", appendLF = FALSE, as_note = FALSE) message_("Preparing data...", appendLF = FALSE, as_note = FALSE)
} }
@ -430,7 +430,7 @@ eucast_rules <- function(x,
x <- left_join_microorganisms(x, by = col_mo, suffix = c("_oldcols", "")) x <- left_join_microorganisms(x, by = col_mo, suffix = c("_oldcols", ""))
x$gramstain <- mo_gramstain(x[, col_mo, drop = TRUE], language = NULL, info = FALSE) x$gramstain <- mo_gramstain(x[, col_mo, drop = TRUE], language = NULL, info = FALSE)
x$genus_species <- trimws(paste(x$genus, x$species)) x$genus_species <- trimws(paste(x$genus, x$species))
if (info == TRUE & NROW(x) > 10000) { if (isTRUE(info) && NROW(x) > 10000) {
message_(" OK.", add_fn = list(font_green, font_bold), as_note = FALSE) message_(" OK.", add_fn = list(font_green, font_bold), as_note = FALSE)
} }
@ -448,7 +448,7 @@ eucast_rules <- function(x,
# Other rules: enzyme inhibitors ------------------------------------------ # Other rules: enzyme inhibitors ------------------------------------------
if (any(c("all", "other") %in% rules)) { if (any(c("all", "other") %in% rules)) {
if (info == TRUE) { if (isTRUE(info)) {
cat("\n") cat("\n")
cat(word_wrap( cat(word_wrap(
font_bold(paste0( font_bold(paste0(
@ -487,7 +487,7 @@ eucast_rules <- function(x,
ab_enzyme$base_name[i], " ('", font_bold(col_base), "') = R if ", ab_enzyme$base_name[i], " ('", font_bold(col_base), "') = R if ",
tolower(ab_enzyme$enzyme_name[i]), " ('", font_bold(col_enzyme), "') = R" tolower(ab_enzyme$enzyme_name[i]), " ('", font_bold(col_enzyme), "') = R"
) )
if (info == TRUE) { if (isTRUE(info)) {
cat(word_wrap(rule_current, cat(word_wrap(rule_current,
width = getOption("width") - 30, width = getOption("width") - 30,
extra_indent = 6 extra_indent = 6
@ -514,7 +514,7 @@ eucast_rules <- function(x,
x <- run_changes$output x <- run_changes$output
warn_lacking_rsi_class <- c(warn_lacking_rsi_class, run_changes$rsi_warn) warn_lacking_rsi_class <- c(warn_lacking_rsi_class, run_changes$rsi_warn)
# Print number of new changes # Print number of new changes
if (info == TRUE) { if (isTRUE(info)) {
# print only on last one of rules in this group # print only on last one of rules in this group
txt_ok(n_added = n_added, n_changed = n_changed, warned = warned) txt_ok(n_added = n_added, n_changed = n_changed, warned = warned)
# and reset counters # and reset counters
@ -528,7 +528,7 @@ eucast_rules <- function(x,
tolower(ab_enzyme$base_name[i]), " ('", font_bold(col_base), "') = S" tolower(ab_enzyme$base_name[i]), " ('", font_bold(col_base), "') = S"
) )
if (info == TRUE) { if (isTRUE(info)) {
cat(word_wrap(rule_current, cat(word_wrap(rule_current,
width = getOption("width") - 30, width = getOption("width") - 30,
extra_indent = 6 extra_indent = 6
@ -555,7 +555,7 @@ eucast_rules <- function(x,
x <- run_changes$output x <- run_changes$output
warn_lacking_rsi_class <- c(warn_lacking_rsi_class, run_changes$rsi_warn) warn_lacking_rsi_class <- c(warn_lacking_rsi_class, run_changes$rsi_warn)
# Print number of new changes # Print number of new changes
if (info == TRUE) { if (isTRUE(info)) {
# print only on last one of rules in this group # print only on last one of rules in this group
txt_ok(n_added = n_added, n_changed = n_changed, warned = warned) txt_ok(n_added = n_added, n_changed = n_changed, warned = warned)
# and reset counters # and reset counters
@ -565,14 +565,14 @@ eucast_rules <- function(x,
} }
} }
} else { } else {
if (info == TRUE) { if (isTRUE(info)) {
cat("\n") cat("\n")
message_("Skipping inheritance rules defined by this AMR package, such as setting trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R. Add \"other\" or \"all\" to the `rules` argument to apply those rules.") message_("Skipping inheritance rules defined by this AMR package, such as setting trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R. Add \"other\" or \"all\" to the `rules` argument to apply those rules.")
} }
} }
if (!any(c("all", "custom") %in% rules) & !is.null(custom_rules)) { if (!any(c("all", "custom") %in% rules) && !is.null(custom_rules)) {
if (info == TRUE) { if (isTRUE(info)) {
message_("Skipping custom EUCAST rules, since the `rules` argument does not contain \"custom\".") message_("Skipping custom EUCAST rules, since the `rules` argument does not contain \"custom\".")
} }
custom_rules <- NULL custom_rules <- NULL
@ -626,14 +626,14 @@ eucast_rules <- function(x,
rule_group_previous <- eucast_rules_df[max(1, i - 1), "reference.rule_group", drop = TRUE] rule_group_previous <- eucast_rules_df[max(1, i - 1), "reference.rule_group", drop = TRUE]
rule_group_current <- eucast_rules_df[i, "reference.rule_group", drop = TRUE] rule_group_current <- eucast_rules_df[i, "reference.rule_group", drop = TRUE]
# don't apply rules if user doesn't want to apply them # don't apply rules if user doesn't want to apply them
if (rule_group_current %like% "breakpoint" & !any(c("all", "breakpoints") %in% rules)) { if (rule_group_current %like% "breakpoint" && !any(c("all", "breakpoints") %in% rules)) {
next next
} }
if (rule_group_current %like% "expert" & !any(c("all", "expert") %in% rules)) { if (rule_group_current %like% "expert" && !any(c("all", "expert") %in% rules)) {
next next
} }
if (isFALSE(info) | isFALSE(verbose)) { if (isFALSE(info) || isFALSE(verbose)) {
rule_text <- "" rule_text <- ""
} else { } else {
if (is.na(eucast_rules_df[i, "and_these_antibiotics", drop = TRUE])) { if (is.na(eucast_rules_df[i, "and_these_antibiotics", drop = TRUE])) {
@ -657,9 +657,9 @@ eucast_rules <- function(x,
rule_next <- "" rule_next <- ""
} }
if (info == TRUE) { if (isTRUE(info)) {
# Print EUCAST intro ------------------------------------------------------ # Print EUCAST intro ------------------------------------------------------
if (rule_group_current %unlike% "other" & eucast_notification_shown == FALSE) { if (rule_group_current %unlike% "other" && eucast_notification_shown == FALSE) {
cat( cat(
paste0( paste0(
"\n", font_grey(strrep("-", 0.95 * options()$width)), "\n", "\n", font_grey(strrep("-", 0.95 * options()$width)), "\n",
@ -781,7 +781,7 @@ eucast_rules <- function(x,
) )
} else { } else {
source_antibiotics <- get_ab_from_namespace(source_antibiotics, cols_ab) source_antibiotics <- get_ab_from_namespace(source_antibiotics, cols_ab)
if (length(source_value) == 1 & length(source_antibiotics) > 1) { if (length(source_value) == 1 && length(source_antibiotics) > 1) {
source_value <- rep(source_value, length(source_antibiotics)) source_value <- rep(source_value, length(source_antibiotics))
} }
if (length(source_antibiotics) == 0) { if (length(source_antibiotics) == 0) {
@ -838,7 +838,7 @@ eucast_rules <- function(x,
x <- run_changes$output x <- run_changes$output
warn_lacking_rsi_class <- c(warn_lacking_rsi_class, run_changes$rsi_warn) warn_lacking_rsi_class <- c(warn_lacking_rsi_class, run_changes$rsi_warn)
# Print number of new changes --------------------------------------------- # Print number of new changes ---------------------------------------------
if (info == TRUE & rule_next != rule_current) { if (isTRUE(info) && rule_next != rule_current) {
# print only on last one of rules in this group # print only on last one of rules in this group
txt_ok(n_added = n_added, n_changed = n_changed, warned = warned) txt_ok(n_added = n_added, n_changed = n_changed, warned = warned)
# and reset counters # and reset counters
@ -849,7 +849,7 @@ eucast_rules <- function(x,
# Apply custom rules ---- # Apply custom rules ----
if (!is.null(custom_rules)) { if (!is.null(custom_rules)) {
if (info == TRUE) { if (isTRUE(info)) {
cat("\n") cat("\n")
cat(font_bold("Custom EUCAST rules, set by user"), "\n") cat(font_bold("Custom EUCAST rules, set by user"), "\n")
} }
@ -868,7 +868,7 @@ eucast_rules <- function(x,
format_custom_query_rule(rule$query, colours = FALSE), ": ", format_custom_query_rule(rule$query, colours = FALSE), ": ",
get_antibiotic_names(cols) get_antibiotic_names(cols)
) )
if (info == TRUE) { if (isTRUE(info)) {
# print rule # print rule
cat(italicise_taxonomy(word_wrap(format_custom_query_rule(rule$query, colours = FALSE), cat(italicise_taxonomy(word_wrap(format_custom_query_rule(rule$query, colours = FALSE),
width = getOption("width") - 30, width = getOption("width") - 30,
@ -904,7 +904,7 @@ eucast_rules <- function(x,
x <- run_changes$output x <- run_changes$output
warn_lacking_rsi_class <- c(warn_lacking_rsi_class, run_changes$rsi_warn) warn_lacking_rsi_class <- c(warn_lacking_rsi_class, run_changes$rsi_warn)
# Print number of new changes --------------------------------------------- # Print number of new changes ---------------------------------------------
if (info == TRUE & rule_next != rule_current) { if (isTRUE(info) && rule_next != rule_current) {
# print only on last one of rules in this group # print only on last one of rules in this group
txt_ok(n_added = n_added, n_changed = n_changed, warned = warned) txt_ok(n_added = n_added, n_changed = n_changed, warned = warned)
# and reset counters # and reset counters
@ -915,7 +915,7 @@ eucast_rules <- function(x,
} }
# Print overview ---------------------------------------------------------- # Print overview ----------------------------------------------------------
if (info == TRUE | verbose == TRUE) { if (isTRUE(info) || isTRUE(verbose)) {
verbose_info <- x.bak %pm>% verbose_info <- x.bak %pm>%
pm_mutate(row = pm_row_number()) %pm>% pm_mutate(row = pm_row_number()) %pm>%
pm_select(`.rowid`, row) %pm>% pm_select(`.rowid`, row) %pm>%
@ -929,8 +929,8 @@ eucast_rules <- function(x,
rownames(verbose_info) <- NULL rownames(verbose_info) <- NULL
} }
if (info == TRUE) { if (isTRUE(info)) {
if (verbose == TRUE) { if (isTRUE(verbose)) {
wouldve <- "would have " wouldve <- "would have "
} else { } else {
wouldve <- "" wouldve <- ""
@ -1010,9 +1010,9 @@ eucast_rules <- function(x,
cat(paste0(font_grey(strrep("-", 0.95 * options()$width)), "\n")) cat(paste0(font_grey(strrep("-", 0.95 * options()$width)), "\n"))
if (verbose == FALSE & total_n_added + total_n_changed > 0) { if (isFALSE(verbose) && total_n_added + total_n_changed > 0) {
cat("\n", word_wrap("Use ", font_bold("eucast_rules(..., verbose = TRUE)"), " (on your original data) to get a data.frame with all specified edits instead."), "\n\n", sep = "") cat("\n", word_wrap("Use ", font_bold("eucast_rules(..., verbose = TRUE)"), " (on your original data) to get a data.frame with all specified edits instead."), "\n\n", sep = "")
} else if (verbose == TRUE) { } else if (isTRUE(verbose)) {
cat("\n", word_wrap("Used 'Verbose mode' (", font_bold("verbose = TRUE"), "), which returns a data.frame with all specified edits.\nUse ", font_bold("verbose = FALSE"), " to apply the rules on your data."), "\n\n", sep = "") cat("\n", word_wrap("Used 'Verbose mode' (", font_bold("verbose = TRUE"), "), which returns a data.frame with all specified edits.\nUse ", font_bold("verbose = FALSE"), " to apply the rules on your data."), "\n\n", sep = "")
} }
} }
@ -1034,7 +1034,7 @@ eucast_rules <- function(x,
} }
# Return data set --------------------------------------------------------- # Return data set ---------------------------------------------------------
if (verbose == TRUE) { if (isTRUE(verbose)) {
as_original_data_class(verbose_info, old_attributes$class) as_original_data_class(verbose_info, old_attributes$class)
} else { } else {
# x was analysed with only unique rows, so join everything together again # x was analysed with only unique rows, so join everything together again
@ -1072,16 +1072,16 @@ edit_rsi <- function(x,
) )
txt_error <- function() { txt_error <- function() {
if (info == TRUE) cat("", font_red_bg(" ERROR "), "\n\n") if (isTRUE(info)) cat("", font_red_bg(" ERROR "), "\n\n")
} }
txt_warning <- function() { txt_warning <- function() {
if (warned == FALSE) { if (warned == FALSE) {
if (info == TRUE) cat(" ", font_orange_bg(" WARNING "), sep = "") if (isTRUE(info)) cat(" ", font_orange_bg(" WARNING "), sep = "")
} }
warned <<- TRUE warned <<- TRUE
} }
if (length(rows) > 0 & length(cols) > 0) { if (length(rows) > 0 && length(cols) > 0) {
new_edits <- x new_edits <- x
if (any(!vapply(FUN.VALUE = logical(1), x[, cols, drop = FALSE], is.rsi), na.rm = TRUE)) { if (any(!vapply(FUN.VALUE = logical(1), x[, cols, drop = FALSE], is.rsi), na.rm = TRUE)) {
track_changes$rsi_warn <- cols[!vapply(FUN.VALUE = logical(1), x[, cols, drop = FALSE], is.rsi)] track_changes$rsi_warn <- cols[!vapply(FUN.VALUE = logical(1), x[, cols, drop = FALSE], is.rsi)]
@ -1127,7 +1127,7 @@ edit_rsi <- function(x,
) )
track_changes$output <- new_edits track_changes$output <- new_edits
if ((info == TRUE | verbose == TRUE) && !isTRUE(all.equal(x, track_changes$output))) { if ((isTRUE(info) || isTRUE(verbose)) && !isTRUE(all.equal(x, track_changes$output))) {
get_original_rows <- function(rowids) { get_original_rows <- function(rowids) {
as.integer(rownames(original_data[which(original_data$.rowid %in% rowids), , drop = FALSE])) as.integer(rownames(original_data[which(original_data$.rowid %in% rowids), , drop = FALSE]))
} }
@ -1173,7 +1173,7 @@ edit_rsi <- function(x,
#' @rdname eucast_rules #' @rdname eucast_rules
#' @export #' @export
eucast_dosage <- function(ab, administration = "iv", version_breakpoints = 11.0) { eucast_dosage <- function(ab, administration = "iv", version_breakpoints = 12.0) {
meet_criteria(ab, allow_class = c("character", "numeric", "integer", "factor")) meet_criteria(ab, allow_class = c("character", "numeric", "integer", "factor"))
meet_criteria(administration, allow_class = "character", is_in = dosage$administration[!is.na(dosage$administration)], has_length = 1) meet_criteria(administration, allow_class = "character", is_in = dosage$administration[!is.na(dosage$administration)], has_length = 1)
meet_criteria(version_breakpoints, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_BREAKPOINTS))) meet_criteria(version_breakpoints, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_BREAKPOINTS)))

View File

@ -243,7 +243,7 @@ first_isolate <- function(x = NULL,
if (method == "phenotype-based" && !any_col_contains_rsi) { if (method == "phenotype-based" && !any_col_contains_rsi) {
method <- "episode-based" method <- "episode-based"
} }
if (info == TRUE && message_not_thrown_before("first_isolate", "method")) { if (isTRUE(info) && message_not_thrown_before("first_isolate", "method")) {
message_(paste0( message_(paste0(
"Determining first isolates ", "Determining first isolates ",
ifelse(method %in% c("episode-based", "phenotype-based"), ifelse(method %in% c("episode-based", "phenotype-based"),
@ -353,7 +353,7 @@ first_isolate <- function(x = NULL,
testcodes_exclude <- NULL testcodes_exclude <- NULL
} }
# remove testcodes # remove testcodes
if (!is.null(testcodes_exclude) && info == TRUE && message_not_thrown_before("first_isolate", "excludingtestcodes")) { if (!is.null(testcodes_exclude) && isTRUE(info) && message_not_thrown_before("first_isolate", "excludingtestcodes")) {
message_("Excluding test codes: ", vector_and(testcodes_exclude, quotes = TRUE), message_("Excluding test codes: ", vector_and(testcodes_exclude, quotes = TRUE),
add_fn = font_black, add_fn = font_black,
as_note = FALSE as_note = FALSE
@ -367,7 +367,7 @@ first_isolate <- function(x = NULL,
# filter on specimen group and keyantibiotics when they are filled in # filter on specimen group and keyantibiotics when they are filled in
if (!is.null(specimen_group)) { if (!is.null(specimen_group)) {
check_columns_existance(col_specimen, x) check_columns_existance(col_specimen, x)
if (info == TRUE && message_not_thrown_before("first_isolate", "excludingspecimen")) { if (isTRUE(info) && message_not_thrown_before("first_isolate", "excludingspecimen")) {
message_("Excluding other than specimen group '", specimen_group, "'", message_("Excluding other than specimen group '", specimen_group, "'",
add_fn = font_black, add_fn = font_black,
as_note = FALSE as_note = FALSE
@ -411,7 +411,7 @@ first_isolate <- function(x = NULL,
# speed up - return immediately if obvious # speed up - return immediately if obvious
if (abs(row.start) == Inf || abs(row.end) == Inf) { if (abs(row.start) == Inf || abs(row.end) == Inf) {
if (info == TRUE) { if (isTRUE(info)) {
message_("=> Found ", font_bold("no isolates"), message_("=> Found ", font_bold("no isolates"),
add_fn = font_black, add_fn = font_black,
as_note = FALSE as_note = FALSE
@ -420,7 +420,7 @@ first_isolate <- function(x = NULL,
return(rep(FALSE, nrow(x))) return(rep(FALSE, nrow(x)))
} }
if (row.start == row.end) { if (row.start == row.end) {
if (info == TRUE) { if (isTRUE(info)) {
message_("=> Found ", font_bold("1 first isolate"), ", as the data only contained 1 row", message_("=> Found ", font_bold("1 first isolate"), ", as the data only contained 1 row",
add_fn = font_black, add_fn = font_black,
as_note = FALSE as_note = FALSE
@ -429,7 +429,7 @@ first_isolate <- function(x = NULL,
return(TRUE) return(TRUE)
} }
if (length(c(row.start:row.end)) == pm_n_distinct(x[c(row.start:row.end), col_mo, drop = TRUE])) { if (length(c(row.start:row.end)) == pm_n_distinct(x[c(row.start:row.end), col_mo, drop = TRUE])) {
if (info == TRUE) { if (isTRUE(info)) {
message_("=> Found ", font_bold(paste(length(c(row.start:row.end)), "first isolates")), message_("=> Found ", font_bold(paste(length(c(row.start:row.end)), "first isolates")),
", as all isolates were different microbial species", ", as all isolates were different microbial species",
add_fn = font_black, add_fn = font_black,
@ -447,7 +447,7 @@ first_isolate <- function(x = NULL,
# Analysis of first isolate ---- # Analysis of first isolate ----
if (!is.null(col_keyantimicrobials)) { if (!is.null(col_keyantimicrobials)) {
if (info == TRUE && message_not_thrown_before("first_isolate", "type")) { if (isTRUE(info) && message_not_thrown_before("first_isolate", "type")) {
if (type == "keyantimicrobials") { if (type == "keyantimicrobials") {
message_("Basing inclusion on key antimicrobials, ", message_("Basing inclusion on key antimicrobials, ",
ifelse(ignore_I == FALSE, "not ", ""), ifelse(ignore_I == FALSE, "not ", ""),
@ -533,7 +533,7 @@ first_isolate <- function(x = NULL,
decimal.mark <- getOption("OutDec") decimal.mark <- getOption("OutDec")
big.mark <- ifelse(decimal.mark != ",", ",", ".") big.mark <- ifelse(decimal.mark != ",", ",", ".")
if (info == TRUE) { if (isTRUE(info)) {
# print group name if used in dplyr::group_by() # print group name if used in dplyr::group_by()
cur_group <- import_fn("cur_group", "dplyr", error_on_fail = FALSE) cur_group <- import_fn("cur_group", "dplyr", error_on_fail = FALSE)
if (!is.null(cur_group)) { if (!is.null(cur_group)) {
@ -558,7 +558,7 @@ first_isolate <- function(x = NULL,
} }
# handle empty microorganisms # handle empty microorganisms
if (any(x$newvar_mo == "UNKNOWN", na.rm = TRUE) && info == TRUE) { if (any(x$newvar_mo == "UNKNOWN", na.rm = TRUE) && isTRUE(info)) {
message_( message_(
ifelse(include_unknown == TRUE, "Included ", "Excluded "), ifelse(include_unknown == TRUE, "Included ", "Excluded "),
format(sum(x$newvar_mo == "UNKNOWN", na.rm = TRUE), format(sum(x$newvar_mo == "UNKNOWN", na.rm = TRUE),
@ -570,7 +570,7 @@ first_isolate <- function(x = NULL,
x[which(x$newvar_mo == "UNKNOWN"), "newvar_first_isolate"] <- include_unknown x[which(x$newvar_mo == "UNKNOWN"), "newvar_first_isolate"] <- include_unknown
# exclude all NAs # exclude all NAs
if (anyNA(x$newvar_mo) && info == TRUE) { if (anyNA(x$newvar_mo) && isTRUE(info)) {
message_( message_(
"Excluded ", format(sum(is.na(x$newvar_mo), na.rm = TRUE), "Excluded ", format(sum(is.na(x$newvar_mo), na.rm = TRUE),
decimal.mark = decimal.mark, big.mark = big.mark decimal.mark = decimal.mark, big.mark = big.mark
@ -594,7 +594,7 @@ first_isolate <- function(x = NULL,
x <- x[order(x$newvar_row_index), , drop = FALSE] x <- x[order(x$newvar_row_index), , drop = FALSE]
rownames(x) <- NULL rownames(x) <- NULL
if (info == TRUE) { if (isTRUE(info)) {
n_found <- sum(x$newvar_first_isolate, na.rm = TRUE) n_found <- sum(x$newvar_first_isolate, na.rm = TRUE)
p_found_total <- percentage(n_found / nrow(x[which(!is.na(x$newvar_mo)), , drop = FALSE]), digits = 1) p_found_total <- percentage(n_found / nrow(x[which(!is.na(x$newvar_mo)), , drop = FALSE]), digits = 1)
p_found_scope <- percentage(n_found / scope.size, digits = 1) p_found_scope <- percentage(n_found / scope.size, digits = 1)

View File

@ -77,7 +77,7 @@ guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE, only_r
ab_result <- unname(all_found[names(all_found) == search_string.ab]) ab_result <- unname(all_found[names(all_found) == search_string.ab])
if (length(ab_result) == 0) { if (length(ab_result) == 0) {
if (verbose == TRUE) { if (isTRUE(verbose)) {
message_("No column found as input for ", search_string, message_("No column found as input for ", search_string,
" (", ab_name(search_string, language = NULL, tolower = TRUE), ").", " (", ab_name(search_string, language = NULL, tolower = TRUE), ").",
add_fn = font_black, add_fn = font_black,
@ -86,7 +86,7 @@ guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE, only_r
} }
return(NULL) return(NULL)
} else { } else {
if (verbose == TRUE) { if (isTRUE(verbose)) {
message_( message_(
"Using column '", font_bold(ab_result), "' as input for ", search_string, "Using column '", font_bold(ab_result), "' as input for ", search_string,
" (", ab_name(search_string, language = NULL, tolower = TRUE), ")." " (", ab_name(search_string, language = NULL, tolower = TRUE), ")."
@ -147,7 +147,7 @@ get_column_abx <- function(x,
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
meet_criteria(sort, allow_class = "logical", has_length = 1) meet_criteria(sort, allow_class = "logical", has_length = 1)
if (info == TRUE) { if (isTRUE(info)) {
message_("Auto-guessing columns suitable for analysis", appendLF = FALSE, as_note = FALSE) message_("Auto-guessing columns suitable for analysis", appendLF = FALSE, as_note = FALSE)
} }
@ -159,14 +159,14 @@ get_column_abx <- function(x,
if (NROW(x) > 10000) { if (NROW(x) > 10000) {
# only test maximum of 10,000 values per column # only test maximum of 10,000 values per column
if (info == TRUE) { if (isTRUE(info)) {
message_(" (using only ", font_bold("the first 10,000 rows"), ")...", message_(" (using only ", font_bold("the first 10,000 rows"), ")...",
appendLF = FALSE, appendLF = FALSE,
as_note = FALSE as_note = FALSE
) )
} }
x <- x[1:10000, , drop = FALSE] x <- x[1:10000, , drop = FALSE]
} else if (info == TRUE) { } else if (isTRUE(info)) {
message_("...", appendLF = FALSE, as_note = FALSE) message_("...", appendLF = FALSE, as_note = FALSE)
} }
@ -210,7 +210,7 @@ get_column_abx <- function(x,
if (length(dots) > 0) { if (length(dots) > 0) {
newnames <- suppressWarnings(as.ab(names(dots), info = FALSE)) newnames <- suppressWarnings(as.ab(names(dots), info = FALSE))
if (anyNA(newnames)) { if (anyNA(newnames)) {
if (info == TRUE) { if (isTRUE(info)) {
message_(" WARNING", add_fn = list(font_yellow, font_bold), as_note = FALSE) message_(" WARNING", add_fn = list(font_yellow, font_bold), as_note = FALSE)
} }
warning_("Invalid antibiotic reference(s): ", vector_and(names(dots)[is.na(newnames)], quotes = FALSE), warning_("Invalid antibiotic reference(s): ", vector_and(names(dots)[is.na(newnames)], quotes = FALSE),
@ -221,7 +221,7 @@ get_column_abx <- function(x,
} }
unexisting_cols <- which(!vapply(FUN.VALUE = logical(1), dots, function(col) all(col %in% x_columns))) unexisting_cols <- which(!vapply(FUN.VALUE = logical(1), dots, function(col) all(col %in% x_columns)))
if (length(unexisting_cols) > 0) { if (length(unexisting_cols) > 0) {
if (info == TRUE) { if (isTRUE(info)) {
message_(" ERROR", add_fn = list(font_red, font_bold), as_note = FALSE) message_(" ERROR", add_fn = list(font_red, font_bold), as_note = FALSE)
} }
stop_("Column(s) not found: ", vector_and(unlist(dots[[unexisting_cols]]), quotes = FALSE), stop_("Column(s) not found: ", vector_and(unlist(dots[[unexisting_cols]]), quotes = FALSE),
@ -240,7 +240,7 @@ get_column_abx <- function(x,
} }
if (length(out) == 0) { if (length(out) == 0) {
if (info == TRUE && all_okay == TRUE) { if (isTRUE(info) && all_okay == TRUE) {
message_("No columns found.") message_("No columns found.")
} }
AMR_env$get_column_abx.call <- unique_call_id(entire_session = FALSE, match_fn = fn) AMR_env$get_column_abx.call <- unique_call_id(entire_session = FALSE, match_fn = fn)
@ -259,14 +259,14 @@ get_column_abx <- function(x,
all_okay <- FALSE all_okay <- FALSE
} }
if (info == TRUE) { if (isTRUE(info)) {
if (all_okay == TRUE) { if (all_okay == TRUE) {
message_(" OK.", add_fn = list(font_green, font_bold), as_note = FALSE) message_(" OK.", add_fn = list(font_green, font_bold), as_note = FALSE)
} else { } else {
message_(" WARNING.", add_fn = list(font_yellow, font_bold), as_note = FALSE) message_(" WARNING.", add_fn = list(font_yellow, font_bold), as_note = FALSE)
} }
for (i in seq_len(length(out))) { for (i in seq_len(length(out))) {
if (verbose == TRUE && !names(out[i]) %in% names(duplicates)) { if (isTRUE(verbose) && !names(out[i]) %in% names(duplicates)) {
message_( message_(
"Using column '", font_bold(out[i]), "' as input for ", names(out)[i], "Using column '", font_bold(out[i]), "' as input for ", names(out)[i],
" (", ab_name(names(out)[i], tolower = TRUE, language = NULL), ")." " (", ab_name(names(out)[i], tolower = TRUE, language = NULL), ")."
@ -304,7 +304,7 @@ get_column_abx <- function(x,
} }
if (!is.null(soft_dependencies)) { if (!is.null(soft_dependencies)) {
soft_dependencies <- unique(soft_dependencies) soft_dependencies <- unique(soft_dependencies)
if (info == TRUE && !all(soft_dependencies %in% names(out))) { if (isTRUE(info) && !all(soft_dependencies %in% names(out))) {
# missing a soft dependency may lower the reliability # missing a soft dependency may lower the reliability
missing <- soft_dependencies[!soft_dependencies %in% names(out)] missing <- soft_dependencies[!soft_dependencies %in% names(out)]
missing_msg <- vector_and(paste0( missing_msg <- vector_and(paste0(

View File

@ -52,7 +52,7 @@ kurtosis.default <- function(x, na.rm = FALSE, excess = FALSE) {
meet_criteria(na.rm, allow_class = "logical", has_length = 1) meet_criteria(na.rm, allow_class = "logical", has_length = 1)
meet_criteria(excess, allow_class = "logical", has_length = 1) meet_criteria(excess, allow_class = "logical", has_length = 1)
x <- as.vector(x) x <- as.vector(x)
if (na.rm == TRUE) { if (isTRUE(na.rm)) {
x <- x[!is.na(x)] x <- x[!is.na(x)]
} }
n <- length(x) n <- length(x)

View File

@ -176,7 +176,7 @@ as.mic <- function(x, na.rm = FALSE) {
} else { } else {
x <- as.character(unlist(x)) x <- as.character(unlist(x))
} }
if (na.rm == TRUE) { if (isTRUE(na.rm)) {
x <- x[!is.na(x)] x <- x[!is.na(x)]
} }
x[trimws2(x) == ""] <- NA x[trimws2(x) == ""] <- NA

View File

@ -197,7 +197,7 @@ resistance_predict <- function(x,
if (model %in% c("binomial", "binom", "logit")) { if (model %in% c("binomial", "binom", "logit")) {
model <- "binomial" model <- "binomial"
model_lm <- with(df, glm(df_matrix ~ year, family = binomial)) model_lm <- with(df, glm(df_matrix ~ year, family = binomial))
if (info == TRUE) { if (isTRUE(info)) {
cat("\nLogistic regression model (logit) with binomial distribution") cat("\nLogistic regression model (logit) with binomial distribution")
cat("\n------------------------------------------------------------\n") cat("\n------------------------------------------------------------\n")
print(summary(model_lm)) print(summary(model_lm))
@ -209,7 +209,7 @@ resistance_predict <- function(x,
} else if (model %in% c("loglin", "poisson")) { } else if (model %in% c("loglin", "poisson")) {
model <- "poisson" model <- "poisson"
model_lm <- with(df, glm(R ~ year, family = poisson)) model_lm <- with(df, glm(R ~ year, family = poisson))
if (info == TRUE) { if (isTRUE(info)) {
cat("\nLog-linear regression model (loglin) with poisson distribution") cat("\nLog-linear regression model (loglin) with poisson distribution")
cat("\n--------------------------------------------------------------\n") cat("\n--------------------------------------------------------------\n")
print(summary(model_lm)) print(summary(model_lm))
@ -221,7 +221,7 @@ resistance_predict <- function(x,
} else if (model %in% c("lin", "linear")) { } else if (model %in% c("lin", "linear")) {
model <- "linear" model <- "linear"
model_lm <- with(df, lm((R / (R + S)) ~ year)) model_lm <- with(df, lm((R / (R + S)) ~ year))
if (info == TRUE) { if (isTRUE(info)) {
cat("\nLinear regression model") cat("\nLinear regression model")
cat("\n-----------------------\n") cat("\n-----------------------\n")
print(summary(model_lm)) print(summary(model_lm))

23
R/rsi.R
View File

@ -853,7 +853,7 @@ as_rsi_method <- function(method_short,
is_intrinsic_r <- paste(mo[i], ab_param) %in% AMR_env$intrinsic_resistant is_intrinsic_r <- paste(mo[i], ab_param) %in% AMR_env$intrinsic_resistant
any_is_intrinsic_resistant <- any_is_intrinsic_resistant | is_intrinsic_r any_is_intrinsic_resistant <- any_is_intrinsic_resistant | is_intrinsic_r
if (isTRUE(add_intrinsic_resistance) & is_intrinsic_r) { if (isTRUE(add_intrinsic_resistance) && isTRUE(is_intrinsic_r)) {
if (guideline_coerced %unlike% "EUCAST") { if (guideline_coerced %unlike% "EUCAST") {
if (message_not_thrown_before("as.rsi", "intrinsic")) { if (message_not_thrown_before("as.rsi", "intrinsic")) {
warning_("in `as.rsi()`: using 'add_intrinsic_resistance' is only useful when using EUCAST guidelines, since the rules for intrinsic resistance are based on EUCAST.") warning_("in `as.rsi()`: using 'add_intrinsic_resistance' is only useful when using EUCAST guidelines, since the rules for intrinsic resistance are based on EUCAST.")
@ -985,17 +985,16 @@ as_rsi_method <- function(method_short,
data.frame( data.frame(
datetime = Sys.time(), datetime = Sys.time(),
index = i, index = i,
ab_input = ab.bak[1], ab_userinput = ab.bak[1],
ab_considered = ab[1], ab_actual = ab[1],
mo_input = mo.bak[1], mo_userinput = mo.bak[1],
mo_considered = mo[1], mo_actual = mo[1],
guideline = guideline_coerced, guideline = guideline_coerced,
ref_table = get_record[, "ref_tbl", drop = TRUE], ref_table = get_record[, "ref_tbl", drop = TRUE],
method = method, method = method,
breakpoint_S = get_record[, "breakpoint_S", drop = TRUE],
breakpoint_R = get_record[, "breakpoint_R", drop = TRUE],
input = as.double(x[i]), input = as.double(x[i]),
interpretation = new_rsi[i], outcome = new_rsi[i],
breakpoint_S_R = paste0(get_record[, "breakpoint_S", drop = TRUE], "-", get_record[, "breakpoint_R", drop = TRUE]),
stringsAsFactors = FALSE stringsAsFactors = FALSE
) )
) )
@ -1045,11 +1044,11 @@ rsi_interpretation_history <- function(clean = FALSE) {
out <- out.bak out <- out.bak
if (NROW(out) == 0) { if (NROW(out) == 0) {
message_("No results to return. Run `as.rsi()` on MIC values or disk diffusion zones first to see a 'logbook' data set here.") message_("No results to return. Run `as.rsi()` on MIC values or disk diffusion zones first to see a 'logbook' data set here.")
return(NULL) return(invisible(NULL))
} }
out$ab_considered <- as.ab(out$ab_considered) out$ab_actual <- as.ab(out$ab_actual)
out$mo_considered <- as.mo(out$mo_considered) out$mo_actual <- as.mo(out$mo_actual)
out$interpretation <- as.rsi(out$interpretation) out$outcome <- as.rsi(out$outcome)
# keep stored for next use # keep stored for next use
if (isTRUE(clean)) { if (isTRUE(clean)) {
AMR_env$rsi_interpretation_history <- AMR_env$rsi_interpretation_history[0, , drop = FALSE] AMR_env$rsi_interpretation_history <- AMR_env$rsi_interpretation_history[0, , drop = FALSE]

View File

@ -50,7 +50,7 @@ skewness <- function(x, na.rm = FALSE) {
skewness.default <- function(x, na.rm = FALSE) { skewness.default <- function(x, na.rm = FALSE) {
meet_criteria(na.rm, allow_class = "logical", has_length = 1) meet_criteria(na.rm, allow_class = "logical", has_length = 1)
x <- as.vector(x) x <- as.vector(x)
if (na.rm == TRUE) { if (isTRUE(na.rm)) {
x <- x[!is.na(x)] x <- x[!is.na(x)]
} }
n <- length(x) n <- length(x)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -42,7 +42,7 @@ old_globalenv <- ls(envir = globalenv())
# See 'data-raw/eucast_rules.tsv' for the EUCAST reference file # See 'data-raw/eucast_rules.tsv' for the EUCAST reference file
EUCAST_RULES_DF <- utils::read.delim( EUCAST_RULES_DF <- utils::read.delim(
file = "data-raw/eucast_rules.tsv", file = "data-raw/eucast_rules.tsv",
skip = 10, skip = 9,
sep = "\t", sep = "\t",
stringsAsFactors = FALSE, stringsAsFactors = FALSE,
header = TRUE, header = TRUE,

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
e000567383fb9289741ed2360d10f72f 9a9fad0100acf4738f3f66b25ed3d8ef

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,171 @@
"ab" "name" "type" "dose" "dose_times" "administration" "notes" "original_txt" "eucast_version" "ab" "name" "type" "dose" "dose_times" "administration" "notes" "original_txt" "eucast_version"
"AMK" "Amikacin" "standard_dosage" "25-30 mg/kg" 1 "iv" "" "25-30 mg/kg x 1 iv" 12
"AMX" "Amoxicillin" "high_dosage" "2 g" 6 "iv" "" "2 g x 6 iv" 12
"AMX" "Amoxicillin" "standard_dosage" "1 g" 3 "iv" "" "1 g x 3-4 iv" 12
"AMX" "Amoxicillin" "high_dosage" "0.75-1 g" 3 "oral" "" "0.75-1 g x 3 oral" 12
"AMX" "Amoxicillin" "standard_dosage" "0.5 g" 3 "oral" "" "0.5 g x 3 oral" 12
"AMX" "Amoxicillin" "uncomplicated_uti" "0.5 g" 3 "oral" "" "0.5 g x 3 oral" 12
"AMC" "Amoxicillin/clavulanic acid" "high_dosage" "2 g + 0.2 g" 3 "iv" "" "(2 g amoxicillin + 0.2 g clavulanic acid) x 3 iv" 12
"AMC" "Amoxicillin/clavulanic acid" "standard_dosage" "1 g + 0.2 g" 3 "iv" "" "(1 g amoxicillin + 0.2 g clavulanic acid) x 3-4 iv" 12
"AMC" "Amoxicillin/clavulanic acid" "high_dosage" "0.875 g + 0.125 g" 3 "oral" "" "(0.875 g amoxicillin + 0.125 g clavulanic acid) x 3 oral" 12
"AMC" "Amoxicillin/clavulanic acid" "standard_dosage" "0.5 g + 0.125 g" 3 "oral" "" "(0.5 g amoxicillin + 0.125 g clavulanic acid) x 3 oral" 12
"AMC" "Amoxicillin/clavulanic acid" "uncomplicated_uti" "0.5 g + 0.125 g" 3 "oral" "" "(0.5 g amoxicillin + 0.125 g clavulanic acid) x 3 oral" 12
"AMP" "Ampicillin" "high_dosage" "2 g" 4 "iv" "" "2 g x 4 iv" 12
"AMP" "Ampicillin" "standard_dosage" "2 g" 3 "iv" "" "2 g x 3 iv" 12
"SAM" "Ampicillin/sulbactam" "high_dosage" "2 g + 1 g" 4 "iv" "" "(2 g ampicillin + 1 g sulbactam) x 4 iv" 12
"SAM" "Ampicillin/sulbactam" "standard_dosage" "2 g + 1 g" 3 "iv" "" "(2 g ampicillin + 1 g sulbactam) x 3 iv" 12
"AZM" "Azithromycin" "standard_dosage" "0.5 g" 1 "iv" "" "0.5 g x 1 iv" 12
"AZM" "Azithromycin" "standard_dosage" "0.5 g" 1 "oral" "" "0.5 g x 1 oral" 12
"ATM" "Aztreonam" "high_dosage" "2 g" 4 "iv" "" "2 g x 4 iv" 12
"ATM" "Aztreonam" "standard_dosage" "1 g" 3 "iv" "" "1 g x 3 iv" 12
"PEN" "Benzylpenicillin" "high_dosage" "1.2 g" 4 "iv" "" "1.2 g (2 MU) x 4-6 iv" 12
"PEN" "Benzylpenicillin" "standard_dosage" "0.6 g" 4 "iv" "" "0.6 g (1 MU) x 4 iv" 12
"CEC" "Cefaclor" "high_dosage" "1 g" 3 "oral" "" "1 g x 3 oral" 12
"CEC" "Cefaclor" "standard_dosage" "0.25-0.5 g" 3 "oral" "" "0.25-0.5 g x 3 oral" 12
"CFR" "Cefadroxil" "standard_dosage" "0.5-1 g" 2 "oral" "" "0.5-1 g x 2 oral" 12
"CFR" "Cefadroxil" "uncomplicated_uti" "0.5-1 g" 2 "oral" "" "0.5-1 g x 2 oral" 12
"LEX" "Cefalexin" "standard_dosage" "0.25-1 g" 2 "oral" "" "0.25-1 g x 2-3 oral" 12
"LEX" "Cefalexin" "uncomplicated_uti" "0.25-1 g" 2 "oral" "" "0.25-1 g x 2-3 oral" 12
"CZO" "Cefazolin" "high_dosage" "2 g" 3 "iv" "" "2 g x 3 iv" 12
"CZO" "Cefazolin" "standard_dosage" "1 g" 3 "iv" "" "1 g x 3 iv" 12
"FEP" "Cefepime" "high_dosage" "2 g" 3 "iv" "" "2 g x 3 iv" 12
"FEP" "Cefepime" "standard_dosage" "2 g" 2 "iv" "" "2 g x 2 iv" 12
"FDC" "Cefiderocol" "standard_dosage" "2 g" 3 "iv" "over 3 hours" "2 g x 3 iv over 3 hours" 12
"CFM" "Cefixime" "standard_dosage" "0.2-0.4 g" 2 "oral" "" "0.2-0.4 g x 2 oral" 12
"CFM" "Cefixime" "uncomplicated_uti" "0.2-0.4 g" 2 "oral" "" "0.2-0.4 g x 2 oral" 12
"CTX" "Cefotaxime" "high_dosage" "2 g" 3 "iv" "" "2 g x 3 iv" 12
"CTX" "Cefotaxime" "standard_dosage" "1 g" 3 "iv" "" "1 g x 3 iv" 12
"CPD" "Cefpodoxime" "standard_dosage" "0.1-0.2 g" 2 "oral" "" "0.1-0.2 g x 2 oral" 12
"CPD" "Cefpodoxime" "uncomplicated_uti" "0.1-0.2 g" 2 "oral" "" "0.1-0.2 g x 2 oral" 12
"CPT" "Ceftaroline" "high_dosage" "0.6 g" 3 "iv" "over 2 hours" "0.6 g x 3 iv over 2 hours" 12
"CPT" "Ceftaroline" "standard_dosage" "0.6 g" 2 "iv" "over 1 hour" "0.6 g x 2 iv over 1 hour" 12
"CAZ" "Ceftazidime" "high_dosage" "1 g" 6 "iv" "" "1 g x 6 iv" 12
"CAZ" "Ceftazidime" "standard_dosage" "1 g" 3 "iv" "" "1 g x 3 iv" 12
"CZA" "Ceftazidime/avibactam" "standard_dosage" "2 g + 0.5 g" 3 "iv" "over 2 hours" "(2 g ceftazidime + 0.5 g avibactam) x 3 iv over 2 hours" 12
"CTB" "Ceftibuten" "standard_dosage" "0.4 g" 1 "oral" "" "0.4 g x 1 oral" 12
"BPR" "Ceftobiprole" "standard_dosage" "0.5 g" 3 "iv" "over 2 hours" "0.5 g x 3 iv over 2 hours" 12
"CZT" "Ceftolozane/tazobactam" "standard_dosage" "1 g + 0.5 g" 3 "iv" "over 1 hour" "(1 g ceftolozane + 0.5 g tazobactam) x 3 iv over 1 hour" 12
"CZT" "Ceftolozane/tazobactam" "standard_dosage" "2 g + 1 g" 3 "iv" "over 1 hour" "(2 g ceftolozane + 1 g tazobactam) x 3 iv over 1 hour" 12
"CRO" "Ceftriaxone" "high_dosage" "4 g" 1 "iv" "" "4 g x 1 iv" 12
"CRO" "Ceftriaxone" "standard_dosage" "2 g" 1 "iv" "" "2 g x 1 iv" 12
"CXM" "Cefuroxime" "high_dosage" "1.5 g" 3 "iv" "" "1.5 g x 3 iv" 12
"CXM" "Cefuroxime" "standard_dosage" "0.75 g" 3 "iv" "" "0.75 g x 3 iv" 12
"CXM" "Cefuroxime" "high_dosage" "0.5 g" 2 "oral" "" "0.5 g x 2 oral" 12
"CXM" "Cefuroxime" "standard_dosage" "0.25 g" 2 "oral" "" "0.25 g x 2 oral" 12
"CXM" "Cefuroxime" "uncomplicated_uti" "0.25 g" 2 "oral" "" "0.25 g x 2 oral" 12
"CHL" "Chloramphenicol" "high_dosage" "2 g" 4 "iv" "" "2 g x 4 iv" 12
"CHL" "Chloramphenicol" "standard_dosage" "1 g" 4 "iv" "" "1 g x 4 iv" 12
"CHL" "Chloramphenicol" "high_dosage" "2 g" 4 "oral" "" "2 g x 4 oral" 12
"CHL" "Chloramphenicol" "standard_dosage" "1 g" 4 "oral" "" "1 g x 4 oral" 12
"CIP" "Ciprofloxacin" "high_dosage" "0.4 g" 3 "iv" "" "0.4 g x 3 iv" 12
"CIP" "Ciprofloxacin" "standard_dosage" "0.4 g" 2 "iv" "" "0.4 g x 2 iv" 12
"CIP" "Ciprofloxacin" "high_dosage" "0.75 g" 2 "oral" "" "0.75 g x 2 oral" 12
"CIP" "Ciprofloxacin" "standard_dosage" "0.5 g" 2 "oral" "" "0.5 g x 2 oral" 12
"CLR" "Clarithromycin" "high_dosage" "0.5 g" 2 "oral" "" "0.5 g x 2 oral" 12
"CLR" "Clarithromycin" "standard_dosage" "0.25 g" 2 "oral" "" "0.25 g x 2 oral" 12
"CLI" "Clindamycin" "high_dosage" "0.9 g" 3 "iv" "" "0.9 g x 3 iv" 12
"CLI" "Clindamycin" "standard_dosage" "0.6 g" 3 "iv" "" "0.6 g x 3 iv" 12
"CLI" "Clindamycin" "high_dosage" "0.3 g" 4 "oral" "" "0.3 g x 4 oral" 12
"CLI" "Clindamycin" "standard_dosage" "0.3 g" 2 "oral" "" "0.3 g x 2 oral" 12
"CLO" "Cloxacillin" "high_dosage" "2 g" 6 "iv" "" "2 g x 6 iv" 12
"CLO" "Cloxacillin" "standard_dosage" "1 g" 4 "iv" "" "1 g x 4 iv" 12
"CLO" "Cloxacillin" "high_dosage" "1 g" 4 "oral" "" "1 g x 4 oral" 12
"CLO" "Cloxacillin" "standard_dosage" "0.5 g" 4 "oral" "" "0.5 g x 4 oral" 12
"COL" "Colistin" "standard_dosage" "4.5 MU" 2 "iv" "loading dose of 9 MU" "4.5 MU x 2 iv with a loading dose of 9 MU" 12
"DAL" "Dalbavancin" "standard_dosage" "1 g" 1 "iv" "over 30 minutes on day 8" "1 g x 1 iv over 30 minutes on day 1 If needed, 0.5 g x 1 iv over 30 minutes on day 8" 12
"DAP" "Daptomycin" "standard_dosage" "4 mg/kg" 1 "iv" "" "4 mg/kg x 1 iv" 12
"DAP" "Daptomycin" "standard_dosage" "6 mg/kg" 1 "iv" "" "6 mg/kg x 1 iv" 12
"DFX" "Delafloxacin" "standard_dosage" "0.3 g" 2 "iv" "" "0.3 g x 2 iv" 12
"DFX" "Delafloxacin" "standard_dosage" "0.45 g" 2 "oral" "" "0.45 g x 2 oral" 12
"DIC" "Dicloxacillin" "high_dosage" "2 g" 6 "iv" "" "2 g x 6 iv" 12
"DIC" "Dicloxacillin" "standard_dosage" "1 g" 4 "iv" "" "1 g x 4 iv" 12
"DIC" "Dicloxacillin" "high_dosage" "2 g" 4 "oral" "" "2 g x 4 oral" 12
"DIC" "Dicloxacillin" "standard_dosage" "0.5-1 g" 4 "oral" "" "0.5-1 g x 4 oral" 12
"DOR" "Doripenem" "high_dosage" "1 g" 3 "iv" "over 1 hour" "1 g x 3 iv over 1 hour" 12
"DOR" "Doripenem" "standard_dosage" "0.5 g" 3 "iv" "over 1 hour" "0.5 g x 3 iv over 1 hour" 12
"DOX" "Doxycycline" "high_dosage" "0.2 g" 1 "oral" "" "0.2 g x 1 oral" 12
"DOX" "Doxycycline" "standard_dosage" "0.1 g" 1 "oral" "" "0.1 g x 1 oral" 12
"ERV" "Eravacycline" "standard_dosage" "1 mg/kg" 2 "iv" "" "1 mg/kg x 2 iv" 12
"ETP" "Ertapenem" "standard_dosage" "1 g" 1 "iv" "over 30 minutes" "1 g x 1 iv over 30 minutes" 12
"ERY" "Erythromycin" "high_dosage" "1 g" 4 "iv" "" "1 g x 4 iv" 12
"ERY" "Erythromycin" "standard_dosage" "0.5 g" 2 "iv" "" "0.5 g x 2-4 iv" 12
"ERY" "Erythromycin" "high_dosage" "1 g" 4 "oral" "" "1 g x 4 oral" 12
"ERY" "Erythromycin" "standard_dosage" "0.5 g" 2 "oral" "" "0.5 g x 2-4 oral" 12
"FDX" "Fidaxomicin" "standard_dosage" "0.2 g" 2 "oral" "" "0.2 g x 2 oral" 12
"FLC" "Flucloxacillin" "high_dosage" "2 g" 6 "iv" "" "2 g x 6 iv" 12
"FLC" "Flucloxacillin" "standard_dosage" "2 g" 4 "iv" "" "2 g x 4 iv (or 1 g x 6 iv)" 12
"FLC" "Flucloxacillin" "high_dosage" "1 g" 4 "oral" "" "1 g x 4 oral" 12
"FLC" "Flucloxacillin" "standard_dosage" "1 g" 3 "oral" "" "1 g x 3 oral" 12
"FOS" "Fosfomycin" "high_dosage" "8 g" 3 "iv" "" "8 g x 3 iv" 12
"FOS" "Fosfomycin" "standard_dosage" "4 g" 3 "iv" "" "4 g x 3 iv" 12
"FUS" "Fusidic acid" "high_dosage" "0.5 g" 3 "iv" "" "0.5 g x 3 iv" 12
"FUS" "Fusidic acid" "standard_dosage" "0.5 g" 2 "iv" "" "0.5 g x 2 iv" 12
"FUS" "Fusidic acid" "high_dosage" "0.5 g" 3 "oral" "" "0.5 g x 3 oral" 12
"FUS" "Fusidic acid" "standard_dosage" "0.5 g" 2 "oral" "" "0.5 g x 2 oral" 12
"GEN" "Gentamicin" "standard_dosage" "6-7 mg/kg" 1 "iv" "" "6-7 mg/kg x 1 iv" 12
"IPM" "Imipenem" "high_dosage" "1 g" 4 "iv" "over 30 minutes" "1 g x 4 iv over 30 minutes" 12
"IPM" "Imipenem" "standard_dosage" "0.5 g" 4 "iv" "over 30 minutes" "0.5 g x 4 iv over 30 minutes" 12
"IMR" "Imipenem/relebactam" "standard_dosage" "0.5 g + 0.25 g" 4 "iv" "over 30 minutes" "(0.5 g imipenem + 0.25 g relebactam) x 4 iv over 30 minutes" 12
"IMR" "Imipenem/relebactam" "standard_dosage" "0.5 g + 0.25 g" 4 "iv" "over 30 minutes" "(0.5 g imipenem + 0.25 g relebactam) x 4 iv over 30 minutes" 12
"LMU" "Lefamulin" "standard_dosage" "0.15 g" 2 "iv" "or 0.6 g x 2 oral" "0.15 g x 2 iv or 0.6 g x 2 oral" 12
"LMU" "Lefamulin" "standard_dosage" "0.6 g" 2 "oral" "" "0.6 g x 2 oral" 12
"LVX" "Levofloxacin" "high_dosage" "0.5 g" 2 "iv" "" "0.5 g x 2 iv" 12
"LVX" "Levofloxacin" "standard_dosage" "0.5 g" 1 "iv" "" "0.5 g x 1 iv" 12
"LVX" "Levofloxacin" "high_dosage" "0.5 g" 2 "oral" "" "0.5 g x 2 oral" 12
"LVX" "Levofloxacin" "standard_dosage" "0.5 g" 1 "oral" "" "0.5 g x 1 oral" 12
"LNZ" "Linezolid" "standard_dosage" "0.6 g" 2 "iv" "" "0.6 g x 2 iv" 12
"LNZ" "Linezolid" "standard_dosage" "0.6 g" 2 "oral" "" "0.6 g x 2 oral" 12
"MEM" "Meropenem" "high_dosage" "2 g" 3 "iv" "over 3 hours" "2 g x 3 iv over 3 hours" 12
"MEM" "Meropenem" "standard_dosage" "1 g" 3 "iv" "over 30 minutes" "1 g x 3 iv over 30 minutes" 12
"MEV" "Meropenem/vaborbactam" "standard_dosage" "2 g + 2 g" 3 "iv" "over 3 hours" "(2 g meropenem + 2 g vaborbactam) x 3 iv over 3 hours" 12
"MTR" "Metronidazole" "high_dosage" "0.5 g" 3 "iv" "" "0.5 g x 3 iv" 12
"MTR" "Metronidazole" "standard_dosage" "0.4 g" 3 "iv" "" "0.4 g x 3 iv" 12
"MTR" "Metronidazole" "high_dosage" "0.5 g" 3 "oral" "" "0.5 g x 3 oral" 12
"MTR" "Metronidazole" "standard_dosage" "0.4 g" 3 "oral" "" "0.4 g x 3 oral" 12
"MNO" "Minocycline" "standard_dosage" "0.1 g" 2 "oral" "" "0.1 g x 2 oral" 12
"MFX" "Moxifloxacin" "standard_dosage" "0.4 g" 1 "iv" "" "0.4 g x 1 iv" 12
"MFX" "Moxifloxacin" "standard_dosage" "0.4 g" 1 "oral" "" "0.4 g x 1 oral" 12
"OFX" "Ofloxacin" "high_dosage" "0.4 g" 2 "iv" "" "0.4 g x 2 iv" 12
"OFX" "Ofloxacin" "standard_dosage" "0.2 g" 2 "iv" "" "0.2 g x 2 iv" 12
"OFX" "Ofloxacin" "high_dosage" "0.4 g" 2 "oral" "" "0.4 g x 2 oral" 12
"OFX" "Ofloxacin" "standard_dosage" "0.2 g" 2 "oral" "" "0.2 g x 2 oral" 12
"ORI" "Oritavancin" "standard_dosage" "1.2 g" 1 "iv" "" "1.2 g x 1 (single dose) iv over 3 hours" 12
"OXA" "Oxacillin" "high_dosage" "1 g" 6 "iv" "" "1 g x 6 iv" 12
"OXA" "Oxacillin" "standard_dosage" "1 g" 4 "iv" "" "1 g x 4 iv" 12
"PHN" "Phenoxymethylpenicillin" "standard_dosage" "0.5-2 g" 3 "oral" "" "0.5-2 g x 3-4 oral" 12
"PIP" "Piperacillin" "high_dosage" "4 g" 4 "iv" "" "4 g x 4 iv by extended 3-hour infusion" 12
"PIP" "Piperacillin" "standard_dosage" "4 g" 4 "iv" "" "4 g x 4 iv" 12
"TZP" "Piperacillin/tazobactam" "high_dosage" "4 g + 0.5 g" 4 "iv" "" "(4 g piperacillin + 0.5 g tazobactam) x 4 iv by extended 3-hour infusion" 12
"TZP" "Piperacillin/tazobactam" "standard_dosage" "4 g + 0.5 g" 4 "iv" "" "(4 g piperacillin + 0.5 g tazobactam) x 4 iv 30-minute infusion or x 3 iv by extended 4-hour infusion" 12
"QDA" "Quinupristin/dalfopristin" "high_dosage" "7.5 mg/kg" 3 "iv" "" "7.5 mg/kg x 3 iv" 12
"QDA" "Quinupristin/dalfopristin" "standard_dosage" "7.5 mg/kg" 2 "iv" "" "7.5 mg/kg x 2 iv" 12
"RIF" "Rifampicin" "standard_dosage" "0.6 g" 1 "iv" "" "0.6 g x 1 iv" 12
"RIF" "Rifampicin" "standard_dosage" "0.6 g" 1 "oral" "" "0.6 g x 1 oral" 12
"RXT" "Roxithromycin" "standard_dosage" "0.15 g" 2 "oral" "" "0.15 g x 2 oral" 12
"SPT" "Spectinomycin" "standard_dosage" "2 g" 1 "im" "" "2 g x 1 im" 12
"TZD" "Tedizolid" "standard_dosage" "0.2 g" 1 "iv" "" "0.2 g x 1 iv" 12
"TZD" "Tedizolid" "standard_dosage" "0.2 g" 1 "oral" "" "0.2 g x 1 oral" 12
"TEC" "Teicoplanin" "high_dosage" "0.8 g" 1 "iv" "" "0.8 g x 1 iv" 12
"TEC" "Teicoplanin" "standard_dosage" "0.4 g" 1 "iv" "" "0.4 g x 1 iv" 12
"TLV" "Telavancin" "standard_dosage" "10 mg/kg" 1 "iv" "over 1 hour" "10 mg/kg x 1 iv over 1 hour" 12
"TLT" "Telithromycin" "standard_dosage" "0.8 g" 1 "oral" "" "0.8 g x 1 oral" 12
"TEM" "Temocillin" "high_dosage" "2 g" 3 "iv" "" "2 g x 3 iv" 12
"TEM" "Temocillin" "standard_dosage" "2 g" 2 "iv" "" "2 g x 2 iv" 12
"TCY" "Tetracycline" "high_dosage" "0.5 g" 4 "oral" "" "0.5 g x 4 oral" 12
"TCY" "Tetracycline" "standard_dosage" "0.25 g" 4 "oral" "" "0.25 g x 4 oral" 12
"TIC" "Ticarcillin" "high_dosage" "3 g" 6 "iv" "" "3 g x 6 iv" 12
"TIC" "Ticarcillin" "standard_dosage" "3 g" 4 "iv" "" "3 g x 4 iv" 12
"TCC" "Ticarcillin/clavulanic acid" "high_dosage" "3 g + 0.1 g" 6 "iv" "" "(3 g ticarcillin + 0.1 g clavulanic acid) x 6 iv" 12
"TCC" "Ticarcillin/clavulanic acid" "standard_dosage" "3 g + 0.1-0.2 g" 4 "iv" "" "(3 g ticarcillin + 0.1-0.2 g clavulanic acid) x 4 iv" 12
"TGC" "Tigecycline" "standard_dosage" "0.1 g" "loading dose followed by 50 mg x 2 iv" "0.1 g loading dose followed by 50 mg x 2 iv" 12
"TOB" "Tobramycin" "standard_dosage" "6-7 mg/kg" 1 "iv" "" "6-7 mg/kg x 1 iv" 12
"SXT" "Trimethoprim/sulfamethoxazole" "high_dosage" "0.24 g + 1.2 g" 2 "oral" "" "(0.24 g trimethoprim + 1.2 g sulfamethoxazole) x 2 oral" 12
"SXT" "Trimethoprim/sulfamethoxazole" "high_dosage" "0.24 g + 1.2 g" 2 "oral" "" "(0.24 g trimethoprim + 1.2 g sulfamethoxazole) x 2 oral or (0.24 g trimethoprim + 1.2 g sulfamethoxazole) x 2 iv" 12
"SXT" "Trimethoprim/sulfamethoxazole" "standard_dosage" "0.16 g + 0.8 g" 2 "oral" "" "(0.16 g trimethoprim + 0.8 g sulfamethoxazole) x 2 oral" 12
"SXT" "Trimethoprim/sulfamethoxazole" "standard_dosage" "0.16 g + 0.8 g" 2 "oral" "" "(0.16 g trimethoprim + 0.8 g sulfamethoxazole) x 2 oral or (0.16 g trimethoprim + 0.8 g sulfamethoxazole) x 2 iv" 12
"SXT" "Trimethoprim/sulfamethoxazole" "uncomplicated_uti" "0.16 g + 0.8 g" 2 "oral" "" "(0.16 g trimethoprim + 0.8 g sulfamethoxazole) x 2 oral" 12
"SXT" "Trimethoprim/sulfamethoxazole" "uncomplicated_uti" "0.16 g + 0.8 g" 2 "oral" "" "(0.16 g trimethoprim + 0.8 g sulfamethoxazole) x 2 oral" 12
"VAN" "Vancomycin" "standard_dosage" "1 g" 2 "iv" "" "1 g x 2 iv or 2 g x 1 by continuous infusion" 12
"AMK" "Amikacin" "standard_dosage" "25-30 mg/kg" 1 "iv" "" "25-30 mg/kg x 1 iv" 11 "AMK" "Amikacin" "standard_dosage" "25-30 mg/kg" 1 "iv" "" "25-30 mg/kg x 1 iv" 11
"AMX" "Amoxicillin" "high_dosage" "2 g" 6 "iv" "" "2 g x 6 iv" 11 "AMX" "Amoxicillin" "high_dosage" "2 g" 6 "iv" "" "2 g x 6 iv" 11
"AMX" "Amoxicillin" "standard_dosage" "1 g" 3 "iv" "" "1 g x 3-4 iv" 11 "AMX" "Amoxicillin" "standard_dosage" "1 g" 3 "iv" "" "1 g x 3-4 iv" 11

Binary file not shown.

View File

@ -1,12 +1,11 @@
# ------------------------------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------------------------------
# For editing this EUCAST reference file, these values can all be used for targeting antibiotics: # For editing this EUCAST reference file, these values can all be used for targeting antibiotics:
# 'betalactams', 'aminoglycosides', 'aminopenicillins', 'carbapenems', 'cephalosporins', 'cephalosporins_1st', 'cephalosporins_2nd', 'cephalosporins_3rd', 'cephalosporins_except_CAZ', # aminoglycosides, aminopenicillins, antifungals, antimycobacterials, betalactams, carbapenems, cephalosporins, cephalosporins_1st, cephalosporins_2nd, cephalosporins_3rd, cephalosporins_4th, cephalosporins_5th, cephalosporins_except_CAZ, fluoroquinolones, glycopeptides, glycopeptides_except_lipo, lincosamides, lipoglycopeptides, macrolides, oxazolidinones, penicillins, polymyxins, quinolones, streptogramins, tetracyclines, tetracyclines_except_TGC, trimethoprims, ureidopenicillins
# 'fluoroquinolones', 'glycopeptides', 'glycopeptides_except_lipo', 'lincosamides', 'lipoglycopeptides', 'macrolides', 'oxazolidinones', 'polymyxins', 'streptogramins', 'tetracyclines', 'tetracyclines_except_TGC', 'ureidopenicillins', # and all separate EARS-Net letter codes such as AMC. They can be separated by comma: 'AMC, fluoroquinolones'.
# and all separate EARS-Net letter codes like 'AMC'. They can be separated by comma: 'AMC, fluoroquinolones'.
# The 'if_mo_property' column can be any column name from the AMR::microorganisms data set, or "genus_species" or "gramstain". # The 'if_mo_property' column can be any column name from the AMR::microorganisms data set, or "genus_species" or "gramstain".
# The like.is.one_of column must be 'like' or 'is' or 'one_of' ('like' will read the 'this_value' column as regular expression) # The like.is.one_of column must be 'like' or 'is' or 'one_of' ('like' will read the 'this_value' column as regular expression)
# The EUCAST guideline contains references to the 'Burkholderia cepacia complex'. All species in this group are noted on the 'B.cepacia' sheet of the EUCAST Clinical Breakpoint v.10.0 Excel file of 2020 (v_10.0_Breakpoint_Tables.xlsx). # The EUCAST guideline contains references to the 'Burkholderia cepacia complex'. All species in this group are noted on the 'B.cepacia' sheet of the EUCAST Clinical Breakpoint v.10.0 Excel file of 2020 and later
# >>>>> IF YOU WANT TO IMPORT THIS FILE INTO YOUR OWN SOFTWARE, HAVE THE FIRST 10 LINES SKIPPED <<<<< # >>>>> IF YOU WANT TO IMPORT THIS FILE INTO YOUR OWN SOFTWARE, HAVE THE FIRST 9 LINES SKIPPED <<<<<
# ------------------------------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------------------------------
if_mo_property like.is.one_of this_value and_these_antibiotics have_these_values then_change_these_antibiotics to_value reference.rule reference.rule_group reference.version note if_mo_property like.is.one_of this_value and_these_antibiotics have_these_values then_change_these_antibiotics to_value reference.rule reference.rule_group reference.version note
order is Enterobacterales AMP S AMX S Enterobacterales (Order) Breakpoints 10 order is Enterobacterales AMP S AMX S Enterobacterales (Order) Breakpoints 10
@ -176,12 +175,12 @@ genus_species is Moraxella catarrhalis ERY S AZM, CLR, RXT S Moraxella catarrhal
genus_species is Moraxella catarrhalis ERY I AZM, CLR, RXT I Moraxella catarrhalis Breakpoints 11 genus_species is Moraxella catarrhalis ERY I AZM, CLR, RXT I Moraxella catarrhalis Breakpoints 11
genus_species is Moraxella catarrhalis ERY R AZM, CLR, RXT R Moraxella catarrhalis Breakpoints 11 genus_species is Moraxella catarrhalis ERY R AZM, CLR, RXT R Moraxella catarrhalis Breakpoints 11
genus_species is Moraxella catarrhalis TCY S DOX, MNO S Moraxella catarrhalis Breakpoints 11 genus_species is Moraxella catarrhalis TCY S DOX, MNO S Moraxella catarrhalis Breakpoints 11
genus one_of Actinomyces, Bifidobacterium, Clostridium, Cutibacterium, Eggerthella, Eubacterium, Lactobacillus, Propionibacterium PEN S AMP, AMX, PIP, TZP, TIC S Anaerobic Gram-positives Breakpoints 11 genus one_of Actinomyces, Bifidobacterium, Clostridium, Cutibacterium, Eggerthella, Eubacterium, Lactobacillus, Propionibacterium PEN S AMP, AMX, PIP, TIC S Anaerobic Gram-positives Breakpoints 11
genus one_of Actinomyces, Bifidobacterium, Clostridium, Cutibacterium, Eggerthella, Eubacterium, Lactobacillus, Propionibacterium PEN I AMP, AMX, PIP, TZP, TIC I Anaerobic Gram-positives Breakpoints 11 genus one_of Actinomyces, Bifidobacterium, Clostridium, Cutibacterium, Eggerthella, Eubacterium, Lactobacillus, Propionibacterium PEN I AMP, AMX, PIP, TIC I Anaerobic Gram-positives Breakpoints 11
genus one_of Actinomyces, Bifidobacterium, Clostridium, Cutibacterium, Eggerthella, Eubacterium, Lactobacillus, Propionibacterium PEN R AMP, AMX, PIP, TZP, TIC R Anaerobic Gram-positives Breakpoints 11 genus one_of Actinomyces, Bifidobacterium, Clostridium, Cutibacterium, Eggerthella, Eubacterium, Lactobacillus, Propionibacterium PEN R AMP, AMX, PIP, TIC R Anaerobic Gram-positives Breakpoints 11
genus one_of Bacteroides, Bilophila , Fusobacterium, Mobiluncus, Porphyromonas, Prevotella PEN S AMP, AMX, PIP, TZP, TIC S Anaerobic Gram-negatives Breakpoints 11 genus one_of Bacteroides, Bilophila , Fusobacterium, Mobiluncus, Porphyromonas, Prevotella PEN S AMP, AMX, PIP, TIC S Anaerobic Gram-negatives Breakpoints 11
genus one_of Bacteroides, Bilophila , Fusobacterium, Mobiluncus, Porphyromonas, Prevotella PEN I AMP, AMX, PIP, TZP, TIC I Anaerobic Gram-negatives Breakpoints 11 genus one_of Bacteroides, Bilophila , Fusobacterium, Mobiluncus, Porphyromonas, Prevotella PEN I AMP, AMX, PIP, TIC I Anaerobic Gram-negatives Breakpoints 11
genus one_of Bacteroides, Bilophila , Fusobacterium, Mobiluncus, Porphyromonas, Prevotella PEN R AMP, AMX, PIP, TZP, TIC R Anaerobic Gram-negatives Breakpoints 11 genus one_of Bacteroides, Bilophila , Fusobacterium, Mobiluncus, Porphyromonas, Prevotella PEN R AMP, AMX, PIP, TIC R Anaerobic Gram-negatives Breakpoints 11
genus_species is Pasteurella multocida PEN S AMP, AMX S Pasteurella multocida Breakpoints 11 genus_species is Pasteurella multocida PEN S AMP, AMX S Pasteurella multocida Breakpoints 11
genus_species is Pasteurella multocida PEN I AMP, AMX I Pasteurella multocida Breakpoints 11 genus_species is Pasteurella multocida PEN I AMP, AMX I Pasteurella multocida Breakpoints 11
genus_species is Pasteurella multocida PEN R AMP, AMX R Pasteurella multocida Breakpoints 11 genus_species is Pasteurella multocida PEN R AMP, AMX R Pasteurella multocida Breakpoints 11
@ -224,6 +223,133 @@ genus_species is Burkholderia pseudomallei TCY R DOX R Burkholderia pseudomallei
genus is Bacillus NOR S fluoroquinolones S Bacillus Breakpoints 11 added in 11 genus is Bacillus NOR S fluoroquinolones S Bacillus Breakpoints 11 added in 11
genus is Bacillus NOR I fluoroquinolones I Bacillus Breakpoints 11 added in 11 genus is Bacillus NOR I fluoroquinolones I Bacillus Breakpoints 11 added in 11
genus is Bacillus NOR R fluoroquinolones R Bacillus Breakpoints 11 added in 11 genus is Bacillus NOR R fluoroquinolones R Bacillus Breakpoints 11 added in 11
order is Enterobacterales AMP S AMX S Enterobacterales (Order) Breakpoints 12
order is Enterobacterales AMP I AMX I Enterobacterales (Order) Breakpoints 12
order is Enterobacterales AMP R AMX R Enterobacterales (Order) Breakpoints 12
genus is Staphylococcus PEN, FOX S AMP, AMX, PIP, TIC S Staphylococcus Breakpoints 12
genus is Staphylococcus PEN, FOX R, S OXA, FLC S Staphylococcus Breakpoints 12
genus is Staphylococcus FOX R betalactams R Staphylococcus Breakpoints 12
genus_species is Staphylococcus saprophyticus AMP S AMX, AMC, PIP, TZP S Staphylococcus Breakpoints 12
genus is Staphylococcus FOX S carbapenems, cephalosporins_except_CAZ S Staphylococcus Breakpoints 12
genus is Staphylococcus FOX I carbapenems, cephalosporins_except_CAZ I Staphylococcus Breakpoints 12
genus is Staphylococcus FOX R carbapenems, cephalosporins_except_CAZ R Staphylococcus Breakpoints 12
genus is Staphylococcus NOR S MFX S Staphylococcus Breakpoints 12
genus is Staphylococcus NOR S CIP, LVX I Staphylococcus Breakpoints 12
genus is Staphylococcus NOR R MFX, CIP, LVX R Staphylococcus Breakpoints 12
genus is Staphylococcus ERY S AZM, CLR, RXT S Staphylococcus Breakpoints 12
genus is Staphylococcus ERY R AZM, CLR, RXT R Staphylococcus Breakpoints 12
genus is Staphylococcus TCY S DOX, MNO S Staphylococcus Breakpoints 12
genus is Staphylococcus TCY R DOX, MNO R Staphylococcus Breakpoints 12
genus is Enterococcus AMP S AMX, AMC, PIP, TZP S Enterococcus Breakpoints 12
genus is Enterococcus AMP I AMX, AMC, PIP, TZP I Enterococcus Breakpoints 12
genus is Enterococcus AMP R AMX, AMC, PIP, TZP R Enterococcus Breakpoints 12
genus is Enterococcus NOR S CIP, LVX S Enterococcus Breakpoints 12
genus is Enterococcus NOR I CIP, LVX I Enterococcus Breakpoints 12
genus is Enterococcus NOR R CIP, LVX R Enterococcus Breakpoints 12
genus_species one_of Streptococcus group A, Streptococcus group B, Streptococcus group C, Streptococcus group G PEN S aminopenicillins, ureidopenicillins, cephalosporins_except_CAZ, carbapenems, FLC, AMC S Streptococcus groups A, B, C, G Breakpoints 12
genus_species like Streptococcus group A, Streptococcus group B, Streptococcus group C, Streptococcus group G PEN I aminopenicillins, ureidopenicillins, cephalosporins_except_CAZ, carbapenems, FLC, AMC I Streptococcus groups A, B, C, G Breakpoints 12
genus_species like Streptococcus group A, Streptococcus group B, Streptococcus group C, Streptococcus group G PEN R aminopenicillins, ureidopenicillins, cephalosporins_except_CAZ, carbapenems, FLC, AMC R Streptococcus groups A, B, C, G Breakpoints 12
genus_species like Streptococcus group A, Streptococcus group B, Streptococcus group C, Streptococcus group G NOR S MFX S Streptococcus groups A, B, C, G Breakpoints 12
genus_species like Streptococcus group A, Streptococcus group B, Streptococcus group C, Streptococcus group G NOR S LVX I Streptococcus groups A, B, C, G Breakpoints 12
genus_species like Streptococcus group A, Streptococcus group B, Streptococcus group C, Streptococcus group G NOR R MFX, LVX R Streptococcus groups A, B, C, G Breakpoints 12
genus_species like Streptococcus group A, Streptococcus group B, Streptococcus group C, Streptococcus group G ERY S AZM, CLR, RXT S Streptococcus groups A, B, C, G Breakpoints 12
genus_species like Streptococcus group A, Streptococcus group B, Streptococcus group C, Streptococcus group G ERY I AZM, CLR, RXT I Streptococcus groups A, B, C, G Breakpoints 12
genus_species like Streptococcus group A, Streptococcus group B, Streptococcus group C, Streptococcus group G ERY R AZM, CLR, RXT R Streptococcus groups A, B, C, G Breakpoints 12
genus_species like Streptococcus group A, Streptococcus group B, Streptococcus group C, Streptococcus group G TCY S DOX, MNO S Streptococcus groups A, B, C, G Breakpoints 12
genus_species like Streptococcus group A, Streptococcus group B, Streptococcus group C, Streptococcus group G TCY R DOX, MNO R Streptococcus groups A, B, C, G Breakpoints 12
genus_species is Streptococcus pneumoniae PEN S AMP, AMX, AMC, PIP, TZP S Streptococcus pneumoniae Breakpoints 12
genus_species is Streptococcus pneumoniae AMP S AMX, AMC, PIP, TZP S Streptococcus pneumoniae Breakpoints 12
genus_species is Streptococcus pneumoniae AMP I AMX, AMC, PIP, TZP I Streptococcus pneumoniae Breakpoints 12
genus_species is Streptococcus pneumoniae AMP R AMX, AMC, PIP, TZP R Streptococcus pneumoniae Breakpoints 12
genus_species is Streptococcus pneumoniae NOR S MFX S Streptococcus pneumoniae Breakpoints 12
genus_species is Streptococcus pneumoniae NOR S LVX I Streptococcus pneumoniae Breakpoints 12
genus_species is Streptococcus pneumoniae NOR R MFX, LVX R Streptococcus pneumoniae Breakpoints 12
genus_species is Streptococcus pneumoniae ERY S AZM, CLR, RXT S Streptococcus pneumoniae Breakpoints 12
genus_species is Streptococcus pneumoniae ERY I AZM, CLR, RXT I Streptococcus pneumoniae Breakpoints 12
genus_species is Streptococcus pneumoniae ERY R AZM, CLR, RXT R Streptococcus pneumoniae Breakpoints 12
genus_species is Streptococcus pneumoniae TCY S DOX, MNO S Streptococcus pneumoniae Breakpoints 12
genus_species is Streptococcus pneumoniae TCY R DOX, MNO R Streptococcus pneumoniae Breakpoints 12
genus_species like ^Streptococcus (anginosus|australis|bovis|constellatus|cristatus|equinus|gallolyticus|gordonii|infantarius|infantis|intermedius|mitis|mutans|oligofermentans|oralis|parasanguinis|peroris|pseudopneumoniae|salivarius|sanguinis|sinensis|sobrinus|thermophilus|vestibularis|viridans)$ PEN S AMP, AMX, AMC, PIP, TZP S Viridans group streptococci Breakpoints 12
genus_species like ^Streptococcus (anginosus|australis|bovis|constellatus|cristatus|equinus|gallolyticus|gordonii|infantarius|infantis|intermedius|mitis|mutans|oligofermentans|oralis|parasanguinis|peroris|pseudopneumoniae|salivarius|sanguinis|sinensis|sobrinus|thermophilus|vestibularis|viridans)$ AMP S AMX, AMC, PIP, TZP S Viridans group streptococci Breakpoints 12
genus_species like ^Streptococcus (anginosus|australis|bovis|constellatus|cristatus|equinus|gallolyticus|gordonii|infantarius|infantis|intermedius|mitis|mutans|oligofermentans|oralis|parasanguinis|peroris|pseudopneumoniae|salivarius|sanguinis|sinensis|sobrinus|thermophilus|vestibularis|viridans)$ AMP I AMX, AMC, PIP, TZP I Viridans group streptococci Breakpoints 12
genus_species like ^Streptococcus (anginosus|australis|bovis|constellatus|cristatus|equinus|gallolyticus|gordonii|infantarius|infantis|intermedius|mitis|mutans|oligofermentans|oralis|parasanguinis|peroris|pseudopneumoniae|salivarius|sanguinis|sinensis|sobrinus|thermophilus|vestibularis|viridans)$ AMP R AMX, AMC, PIP, TZP R Viridans group streptococci Breakpoints 12
genus_species is Haemophilus influenzae AMP S AMX, PIP S Haemophilus influenzae Breakpoints 12
genus_species is Haemophilus influenzae AMP I AMX, PIP I Haemophilus influenzae Breakpoints 12
genus_species is Haemophilus influenzae AMP R AMX, PIP R Haemophilus influenzae Breakpoints 12
genus_species is Haemophilus influenzae PEN S AMP, AMX, AMC, PIP, TZP S Haemophilus influenzae Breakpoints 12
genus_species is Haemophilus influenzae AMC S TZP S Haemophilus influenzae Breakpoints 12
genus_species is Haemophilus influenzae AMC I TZP I Haemophilus influenzae Breakpoints 12
genus_species is Haemophilus influenzae AMC R TZP R Haemophilus influenzae Breakpoints 12
genus_species is Haemophilus influenzae NAL S CIP, LVX, MFX, OFX S Haemophilus influenzae Breakpoints 12
genus_species is Haemophilus influenzae TCY S DOX, MNO S Haemophilus influenzae Breakpoints 12
genus_species is Haemophilus influenzae TCY R DOX, MNO R Haemophilus influenzae Breakpoints 12
genus_species is Moraxella catarrhalis NOR S CIP, LVX, MFX, OFX S Streptococcus pneumoniae Breakpoints 12
genus_species is Moraxella catarrhalis NOR R CIP, LVX, MFX, OFX R Streptococcus pneumoniae Breakpoints 12
genus_species is Moraxella catarrhalis AMC S TZP S Moraxella catarrhalis Breakpoints 12
genus_species is Moraxella catarrhalis AMC I TZP I Moraxella catarrhalis Breakpoints 12
genus_species is Moraxella catarrhalis AMC R TZP R Moraxella catarrhalis Breakpoints 12
genus_species is Moraxella catarrhalis NAL S CIP, LVX, MFX, OFX S Moraxella catarrhalis Breakpoints 12
genus_species is Moraxella catarrhalis ERY S AZM, CLR, RXT S Moraxella catarrhalis Breakpoints 12
genus_species is Moraxella catarrhalis ERY I AZM, CLR, RXT I Moraxella catarrhalis Breakpoints 12
genus_species is Moraxella catarrhalis ERY R AZM, CLR, RXT R Moraxella catarrhalis Breakpoints 12
genus_species is Moraxella catarrhalis TCY S DOX, MNO S Moraxella catarrhalis Breakpoints 12
genus_species is Moraxella catarrhalis TCY R DOX, MNO R Moraxella catarrhalis Breakpoints 12
genus_species is Pasteurella multocida PEN S AMP, AMX S Pasteurella multocida Breakpoints 12
genus_species is Pasteurella multocida PEN I AMP, AMX I Pasteurella multocida Breakpoints 12
genus_species is Pasteurella multocida PEN R AMP, AMX R Pasteurella multocida Breakpoints 12
genus_species is Pasteurella multocida NOR S CIP, LVX S Streptococcus pneumoniae Breakpoints 12
genus_species is Pasteurella multocida NOR R CIP, LVX R Streptococcus pneumoniae Breakpoints 12
genus_species is Campylobacter coli ERY S AZM, CLR S Campylobacter coli Breakpoints 12
genus_species is Campylobacter coli ERY I AZM, CLR I Campylobacter coli Breakpoints 12
genus_species is Campylobacter coli ERY R AZM, CLR R Campylobacter coli Breakpoints 12
genus_species is Campylobacter coli TCY S DOX S Campylobacter coli Breakpoints 12
genus_species is Campylobacter coli TCY I DOX I Campylobacter coli Breakpoints 12
genus_species is Campylobacter coli TCY R DOX R Campylobacter coli Breakpoints 12
genus_species is Campylobacter jejuni ERY S AZM, CLR S Campylobacter jejuni Breakpoints 12
genus_species is Campylobacter jejuni ERY I AZM, CLR I Campylobacter jejuni Breakpoints 12
genus_species is Campylobacter jejuni ERY R AZM, CLR R Campylobacter jejuni Breakpoints 12
genus_species is Campylobacter jejuni TCY S DOX S Campylobacter jejuni Breakpoints 12
genus_species is Campylobacter jejuni TCY I DOX I Campylobacter jejuni Breakpoints 12
genus_species is Campylobacter jejuni TCY R DOX R Campylobacter jejuni Breakpoints 12
genus_species is Aerococcus sanguinicola AMP S AMX S Aerococcus sanguinicola Breakpoints 12
genus_species is Aerococcus sanguinicola AMP I AMX I Aerococcus sanguinicola Breakpoints 12
genus_species is Aerococcus sanguinicola AMP R AMX R Aerococcus sanguinicola Breakpoints 12
genus_species is Aerococcus sanguinicola NOR S fluoroquinolones S Aerococcus sanguinicola Breakpoints 12
genus_species is Aerococcus sanguinicola NOR I fluoroquinolones I Aerococcus sanguinicola Breakpoints 12
genus_species is Aerococcus sanguinicola NOR R fluoroquinolones R Aerococcus sanguinicola Breakpoints 12
genus_species is Aerococcus sanguinicola CIP S LVX S Aerococcus sanguinicola Breakpoints 12
genus_species is Aerococcus sanguinicola CIP I LVX I Aerococcus sanguinicola Breakpoints 12
genus_species is Aerococcus sanguinicola CIP R LVX R Aerococcus urinae Breakpoints 12
genus_species is Aerococcus urinae AMP S AMX S Aerococcus sanguinicola Breakpoints 12
genus_species is Aerococcus urinae AMP I AMX I Aerococcus sanguinicola Breakpoints 12
genus_species is Aerococcus urinae AMP R AMX R Aerococcus sanguinicola Breakpoints 12
genus_species is Aerococcus urinae NOR S fluoroquinolones S Aerococcus urinae Breakpoints 12
genus_species is Aerococcus urinae NOR I fluoroquinolones I Aerococcus urinae Breakpoints 12
genus_species is Aerococcus urinae NOR R fluoroquinolones R Aerococcus urinae Breakpoints 12
genus_species is Aerococcus urinae CIP S LVX S Aerococcus urinae Breakpoints 12
genus_species is Aerococcus urinae CIP I LVX I Aerococcus urinae Breakpoints 12
genus_species is Aerococcus urinae CIP R LVX R Aerococcus urinae Breakpoints 12
genus_species is Kingella kingae PEN S AMP, AMX S Kingella kingae Breakpoints 12
genus_species is Kingella kingae PEN I AMP, AMX I Kingella kingae Breakpoints 12
genus_species is Kingella kingae PEN R AMP, AMX R Kingella kingae Breakpoints 12
genus_species is Kingella kingae ERY S AZM, CLR S Kingella kingae Breakpoints 12
genus_species is Kingella kingae ERY I AZM, CLR I Kingella kingae Breakpoints 12
genus_species is Kingella kingae ERY R AZM, CLR R Kingella kingae Breakpoints 12
genus_species is Kingella kingae TCY S DOX S Kingella kingae Breakpoints 12
genus_species is Kingella kingae TCY R DOX R Kingella kingae Breakpoints 12
genus is Vibrio PEF S CIP, LVX S Vibrio spp. Breakpoints 12
genus is Vibrio PEF I CIP, LVX I Vibrio spp. Breakpoints 12
genus is Vibrio PEF R CIP, LVX R Vibrio spp. Breakpoints 12
genus is Vibrio ERY S AZM S Vibrio spp. Breakpoints 12
genus is Vibrio ERY I AZM I Vibrio spp. Breakpoints 12
genus is Vibrio ERY R AZM R Vibrio spp. Breakpoints 12
genus is Vibrio TCY S DOX S Vibrio spp. Breakpoints 12
genus is Vibrio TCY I DOX I Vibrio spp. Breakpoints 12
genus is Vibrio TCY R DOX R Vibrio spp. Breakpoints 12
genus is Bacillus NOR S CIP, LVX S Bacillus Breakpoints 12
genus is Bacillus NOR R CIP, LVX R Bacillus Breakpoints 12
genus_species is Burkholderia pseudomallei TCY S DOX I Burkholderia pseudomallei Breakpoints 12
genus_species is Burkholderia pseudomallei TCY R DOX R Burkholderia pseudomallei Breakpoints 12
order is Enterobacterales PEN, glycopeptides_except_lipo, FUS, macrolides, LIN, streptogramins, RIF, DAP, LNZ R Table 01: Intrinsic resistance in Enterobacterales (at the time: Enterobacteriaceae) Expert Rules 3.1 order is Enterobacterales PEN, glycopeptides_except_lipo, FUS, macrolides, LIN, streptogramins, RIF, DAP, LNZ R Table 01: Intrinsic resistance in Enterobacterales (at the time: Enterobacteriaceae) Expert Rules 3.1
fullname like ^Citrobacter (koseri|amalonaticus|sedlakii|farmeri|rodentium) aminopenicillins, TIC R Table 01: Intrinsic resistance in Enterobacterales (at the time: Enterobacteriaceae) Expert Rules 3.1 fullname like ^Citrobacter (koseri|amalonaticus|sedlakii|farmeri|rodentium) aminopenicillins, TIC R Table 01: Intrinsic resistance in Enterobacterales (at the time: Enterobacteriaceae) Expert Rules 3.1
fullname like ^Citrobacter (freundii|braakii|murliniae|werkmanii|youngae) aminopenicillins, AMC, CZO, FOX R Table 01: Intrinsic resistance in Enterobacterales (at the time: Enterobacteriaceae) Expert Rules 3.1 fullname like ^Citrobacter (freundii|braakii|murliniae|werkmanii|youngae) aminopenicillins, AMC, CZO, FOX R Table 01: Intrinsic resistance in Enterobacterales (at the time: Enterobacteriaceae) Expert Rules 3.1
@ -373,7 +499,9 @@ genus is Salmonella cephalosporins_2nd R Expert Rules on Salmonella Expert Rul
genus is Salmonella aminoglycosides R Expert Rules on Salmonella Expert Rules 3.2 genus is Salmonella aminoglycosides R Expert Rules on Salmonella Expert Rules 3.2
genus is Salmonella PEF R CIP R Expert Rules on Salmonella Expert Rules 3.2 genus is Salmonella PEF R CIP R Expert Rules on Salmonella Expert Rules 3.2
genus_species is Staphylococcus aureus FOX1 R betalactams R Expert Rules on Staphylococcus Expert Rules 3.2 genus_species is Staphylococcus aureus FOX1 R betalactams R Expert Rules on Staphylococcus Expert Rules 3.2
genus_species is Staphylococcus aureus FOX R betalactams R Expert Rules on Staphylococcus Expert Rules 3.2
genus_species is Staphylococcus aureus FOX1 S betalactams S Expert Rules on Staphylococcus Expert Rules 3.2 genus_species is Staphylococcus aureus FOX1 S betalactams S Expert Rules on Staphylococcus Expert Rules 3.2
genus_species is Staphylococcus aureus FOX S betalactams S Expert Rules on Staphylococcus Expert Rules 3.2
genus_species one_of Staphylococcus aureus, Staphylococcus lugdunensis PEN R AMP, AMX, AZL, BAM, CRB, CRN, EPC, HET, MEC, MEZ, MTM, PIP, PME, PVM, SBC, TAL, TEM, TIC R Expert Rules on Staphylococcus Expert Rules 3.2 all penicillins without beta-lactamse inhibitor genus_species one_of Staphylococcus aureus, Staphylococcus lugdunensis PEN R AMP, AMX, AZL, BAM, CRB, CRN, EPC, HET, MEC, MEZ, MTM, PIP, PME, PVM, SBC, TAL, TEM, TIC R Expert Rules on Staphylococcus Expert Rules 3.2 all penicillins without beta-lactamse inhibitor
genus is Staphylococcus ERY, CLI S macrolides, lincosamides S Expert Rules on Staphylococcus Expert Rules 3.2 genus is Staphylococcus ERY, CLI S macrolides, lincosamides S Expert Rules on Staphylococcus Expert Rules 3.2
genus is Staphylococcus NOR S CIP, LVX, MFX, OFX S Expert Rules on Staphylococcus Expert Rules 3.2 genus is Staphylococcus NOR S CIP, LVX, MFX, OFX S Expert Rules on Staphylococcus Expert Rules 3.2
@ -491,7 +619,9 @@ genus is Salmonella cephalosporins_2nd R Expert Rules on Salmonella Expert Rul
genus is Salmonella aminoglycosides R Expert Rules on Salmonella Expert Rules 3.3 genus is Salmonella aminoglycosides R Expert Rules on Salmonella Expert Rules 3.3
genus is Salmonella PEF R CIP R Expert Rules on Salmonella Expert Rules 3.3 genus is Salmonella PEF R CIP R Expert Rules on Salmonella Expert Rules 3.3
genus_species is Staphylococcus aureus FOX1 R betalactams R Expert Rules on Staphylococcus Expert Rules 3.3 genus_species is Staphylococcus aureus FOX1 R betalactams R Expert Rules on Staphylococcus Expert Rules 3.3
genus_species is Staphylococcus aureus FOX R betalactams R Expert Rules on Staphylococcus Expert Rules 3.3
genus_species is Staphylococcus aureus FOX1 S betalactams S Expert Rules on Staphylococcus Expert Rules 3.3 genus_species is Staphylococcus aureus FOX1 S betalactams S Expert Rules on Staphylococcus Expert Rules 3.3
genus_species is Staphylococcus aureus FOX S betalactams S Expert Rules on Staphylococcus Expert Rules 3.3
genus_species one_of Staphylococcus aureus, Staphylococcus lugdunensis PEN R AMP, AMX, AZL, BAM, CRB, CRN, EPC, HET, MEC, MEZ, MTM, PIP, PME, PVM, SBC, TAL, TEM, TIC R Expert Rules on Staphylococcus Expert Rules 3.3 all penicillins without beta-lactamse inhibitor genus_species one_of Staphylococcus aureus, Staphylococcus lugdunensis PEN R AMP, AMX, AZL, BAM, CRB, CRN, EPC, HET, MEC, MEZ, MTM, PIP, PME, PVM, SBC, TAL, TEM, TIC R Expert Rules on Staphylococcus Expert Rules 3.3 all penicillins without beta-lactamse inhibitor
genus is Staphylococcus ERY, CLI S macrolides, lincosamides S Expert Rules on Staphylococcus Expert Rules 3.3 genus is Staphylococcus ERY, CLI S macrolides, lincosamides S Expert Rules on Staphylococcus Expert Rules 3.3
genus is Staphylococcus NOR S CIP, LVX, MFX, OFX S Expert Rules on Staphylococcus Expert Rules 3.3 genus is Staphylococcus NOR S CIP, LVX, MFX, OFX S Expert Rules on Staphylococcus Expert Rules 3.3

Can't render this file because it contains an unexpected character in line 6 and column 96.

View File

@ -33,12 +33,12 @@ library(cleaner)
# URL: # URL:
# https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/Dosages_v_11.0_Breakpoint_Tables.pdf # https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/Dosages_v_11.0_Breakpoint_Tables.pdf
# download the PDF file, open in Acrobat Pro and export as Excel workbook # download the PDF file, open in Adobe Acrobat and export as Excel workbook
breakpoints_version <- 11 breakpoints_version <- 12
dosage_source <- read_excel("data-raw/Dosages_v_11.0_Breakpoint_Tables.xlsx", skip = 5, na = "None") %>% dosage_source <- read_excel("data-raw/Dosages_v_12.0_Breakpoint_Tables.xlsx", skip = 4, na = "None") %>%
format_names(snake_case = TRUE, penicillins = "drug") %>% format_names(snake_case = TRUE, penicillins = "drug") %>%
filter(!tolower(standard_dosage) %in% c("standard dosage_source", "under review")) %>% filter(!tolower(standard_dosage) %in% c("standard dosage", "standard dosage_source", "under review")) %>%
filter(!is.na(standard_dosage)) %>% filter(!is.na(standard_dosage)) %>%
# keep only one drug in the table # keep only one drug in the table
arrange(desc(drug)) %>% arrange(desc(drug)) %>%
@ -125,7 +125,7 @@ get_dosage_lst <- function(col_data) {
standard <- get_dosage_lst(dosage_source$standard_dosage) standard <- get_dosage_lst(dosage_source$standard_dosage)
high <- get_dosage_lst(dosage_source$high_dosage) high <- get_dosage_lst(dosage_source$high_dosage)
uti <- get_dosage_lst(dosage_source$uncomplicated_uti) uti <- get_dosage_lst(dosage_source$uncomplicated_uti)
dosage <- bind_rows( dosage_new <- bind_rows(
# standard dose # standard dose
data.frame( data.frame(
ab = dosage_source$ab, ab = dosage_source$ab,
@ -171,6 +171,9 @@ dosage <- bind_rows(
arrange(name, administration, type) %>% arrange(name, administration, type) %>%
filter(!is.na(dose), dose != ".") %>% filter(!is.na(dose), dose != ".") %>%
as.data.frame(stringsAsFactors = FALSE) as.data.frame(stringsAsFactors = FALSE)
rownames(dosage) <- NULL rownames(dosage_new) <- NULL
dosage <- bind_rows(dosage_new, AMR::dosage) %>%
dataset_UTF8_to_ASCII()
usethis::use_data(dosage, internal = FALSE, overwrite = TRUE, version = 2) usethis::use_data(dosage, internal = FALSE, overwrite = TRUE, version = 2)

Binary file not shown.

View File

@ -5,7 +5,7 @@
\alias{dosage} \alias{dosage}
\title{Data Set with Treatment Dosages as Defined by EUCAST} \title{Data Set with Treatment Dosages as Defined by EUCAST}
\format{ \format{
A \link[tibble:tibble]{tibble} with 169 observations and 9 variables: A \link[tibble:tibble]{tibble} with 336 observations and 9 variables:
\itemize{ \itemize{
\item \code{ab}\cr Antibiotic ID as used in this package (such as \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available \item \code{ab}\cr Antibiotic ID as used in this package (such as \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available
\item \code{name}\cr Official name of the antimicrobial drug as used by WHONET/EARS-Net or the WHO \item \code{name}\cr Official name of the antimicrobial drug as used by WHONET/EARS-Net or the WHO
@ -25,7 +25,7 @@ dosage
EUCAST breakpoints used in this package are based on the dosages in this data set. They can be retrieved with \code{\link[=eucast_dosage]{eucast_dosage()}}. EUCAST breakpoints used in this package are based on the dosages in this data set. They can be retrieved with \code{\link[=eucast_dosage]{eucast_dosage()}}.
} }
\details{ \details{
This data set is based on \href{https://www.eucast.org/clinical_breakpoints/}{'EUCAST Clinical Breakpoint Tables' v11.0} (2021). This data set is based on \href{https://www.eucast.org/clinical_breakpoints/}{'EUCAST Clinical Breakpoint Tables' v12.0} (2022) and \href{https://www.eucast.org/clinical_breakpoints/}{'EUCAST Clinical Breakpoint Tables' v11.0} (2021).
\subsection{Direct download}{ \subsection{Direct download}{
Like all data sets in this package, this data set is publicly available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}. Like all data sets in this package, this data set is publicly available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.

View File

@ -25,7 +25,7 @@ eucast_rules(
info = interactive(), info = interactive(),
rules = getOption("AMR_eucastrules", default = c("breakpoints", "expert")), rules = getOption("AMR_eucastrules", default = c("breakpoints", "expert")),
verbose = FALSE, verbose = FALSE,
version_breakpoints = 11, version_breakpoints = 12,
version_expertrules = 3.3, version_expertrules = 3.3,
ampc_cephalosporin_resistance = NA, ampc_cephalosporin_resistance = NA,
only_rsi_columns = FALSE, only_rsi_columns = FALSE,
@ -33,7 +33,7 @@ eucast_rules(
... ...
) )
eucast_dosage(ab, administration = "iv", version_breakpoints = 11) eucast_dosage(ab, administration = "iv", version_breakpoints = 12)
} }
\arguments{ \arguments{
\item{x}{a data set with antibiotic columns, such as \code{amox}, \code{AMX} and \code{AMC}} \item{x}{a data set with antibiotic columns, such as \code{amox}, \code{AMX} and \code{AMC}}
@ -46,7 +46,7 @@ eucast_dosage(ab, administration = "iv", version_breakpoints = 11)
\item{verbose}{a \link{logical} to turn Verbose mode on and off (default is off). In Verbose mode, the function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way. Using Verbose mode takes a lot more time.} \item{verbose}{a \link{logical} to turn Verbose mode on and off (default is off). In Verbose mode, the function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way. Using Verbose mode takes a lot more time.}
\item{version_breakpoints}{the version number to use for the EUCAST Clinical Breakpoints guideline. Can be either "11.0" or "10.0".} \item{version_breakpoints}{the version number to use for the EUCAST Clinical Breakpoints guideline. Can be either "12.0", "11.0" or "10.0".}
\item{version_expertrules}{the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either "3.3", "3.2" or "3.1".} \item{version_expertrules}{the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either "3.3", "3.2" or "3.1".}