1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-10 21:41:54 +02:00

(v2.1.1.9198) support eucast expert rules 14 and 13.1

This commit is contained in:
2025-03-14 10:10:35 +01:00
parent eafe9bd113
commit e134e01418
34 changed files with 604 additions and 175 deletions

View File

@ -30,12 +30,18 @@
# add new version numbers here, and add the rules themselves to "data-raw/eucast_rules.tsv" and clinical_breakpoints
# (sourcing "data-raw/_pre_commit_checks.R" will process the TSV file)
EUCAST_VERSION_BREAKPOINTS <- list(
# "13.0" = list(
# version_txt = "v13.0",
# year = 2023,
# title = "'EUCAST Clinical Breakpoint Tables'",
# url = "https://www.eucast.org/clinical_breakpoints/"
# ),
"14.0" = list(
version_txt = "v14.0",
year = 2024,
title = "'EUCAST Clinical Breakpoint Tables'",
url = "https://www.eucast.org/clinical_breakpoints/"
),
"13.1" = list(
version_txt = "v13.1",
year = 2023,
title = "'EUCAST Clinical Breakpoint Tables'",
url = "https://www.eucast.org/clinical_breakpoints/"
),
"12.0" = list(
version_txt = "v12.0",
year = 2022,

7
R/ab.R
View File

@ -211,6 +211,12 @@ as.ab <- function(x, flag_multiple_results = TRUE, language = get_AMR_locale(),
next
}
# screening, but written without the hyphen, e.g., FOXS instead of FOX-S
if (substr(x[i], 4, 4) == "S" && paste0(substr(x[i], 1, 3), "-S") %in% AMR_env$AB_lookup$ab) {
x_new[i] <- paste0(substr(x[i], 1, 3), "-S")
next
}
if (fast_mode == FALSE && flag_multiple_results == TRUE && x[i] %like% "[ ]") {
from_text <- tryCatch(suppressWarnings(ab_from_text(x[i], translate_ab = FALSE)[[1]]),
error = function(e) character(0)
@ -306,7 +312,6 @@ as.ab <- function(x, flag_multiple_results = TRUE, language = get_AMR_locale(),
next
}
# try if name ends with it
found <- AMR_env$AB_lookup[which(AMR_env$AB_lookup$generalised_name %like% paste0(x_spelling, "$")), "ab", drop = TRUE]
if (nchar(x[i]) >= 4 && length(found) > 0) {

View File

@ -290,10 +290,10 @@ carbapenems <- function(only_sir_columns = FALSE, only_treatable = TRUE, return_
#' @rdname antimicrobial_selectors
#' @export
cephalosporins <- function(only_sir_columns = FALSE, return_all = TRUE, ...) {
cephalosporins <- function(only_sir_columns = FALSE, only_treatable = TRUE, return_all = TRUE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(return_all, allow_class = "logical", has_length = 1)
amr_select_exec("cephalosporins", only_sir_columns = only_sir_columns, return_all = return_all)
amr_select_exec("cephalosporins", only_sir_columns = only_sir_columns, only_treatable = only_treatable, return_all = return_all)
}
#' @rdname antimicrobial_selectors
@ -314,10 +314,10 @@ cephalosporins_2nd <- function(only_sir_columns = FALSE, return_all = TRUE, ...)
#' @rdname antimicrobial_selectors
#' @export
cephalosporins_3rd <- function(only_sir_columns = FALSE, return_all = TRUE, ...) {
cephalosporins_3rd <- function(only_sir_columns = FALSE, only_treatable = TRUE, return_all = TRUE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(return_all, allow_class = "logical", has_length = 1)
amr_select_exec("cephalosporins_3rd", only_sir_columns = only_sir_columns, return_all = return_all)
amr_select_exec("cephalosporins_3rd", only_sir_columns = only_sir_columns, only_treatable = only_treatable, return_all = return_all)
}
#' @rdname antimicrobial_selectors

View File

@ -306,6 +306,8 @@
#' ### Imported from WHONET
#' Clinical breakpoints in this package were validated through and imported from [WHONET](https://whonet.org), a free desktop Windows application developed and supported by the WHO Collaborating Centre for Surveillance of Antimicrobial Resistance. More can be read on [their website](https://whonet.org). The developers of WHONET and this `AMR` package have been in contact about sharing their work. We highly appreciate their great development on the WHONET software.
#'
#' Our import and reproduction script can be found here: <https://github.com/msberends/AMR/blob/main/data-raw/reproduction_of_clinical_breakpoints.R>.
#'
#' ### Response from CLSI and EUCAST
#' The CEO of CLSI and the chairman of EUCAST have endorsed the work and public use of this `AMR` package (and consequently the use of their breakpoints) in June 2023, when future development of distributing clinical breakpoints was discussed in a meeting between CLSI, EUCAST, WHO, developers of WHONET software, and developers of this `AMR` package.
#'

View File

@ -72,7 +72,7 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
#' @param administration route of administration, either `r vector_or(dosage$administration)`
#' @param only_sir_columns a [logical] to indicate whether only antimicrobial columns must be detected that were transformed to class `sir` (see [as.sir()]) on beforehand (default is `FALSE`)
#' @param custom_rules custom rules to apply, created with [custom_eucast_rules()]
#' @param overwrite a [logical] to indicate whether non-`NA` values must be overwritten (defaults to `TRUE`). With `FALSE`, only `NA` values are changed.
#' @param overwrite A [logical] indicating whether to overwrite non-`NA` values (default: `FALSE`). When `FALSE`, only `NA` values are modified. To ensure compliance with EUCAST guidelines, **this should remain** `FALSE`, as EUCAST notes often state that an organism "should be tested for susceptibility to individual agents or be reported resistant."
#' @inheritParams first_isolate
#' @details
#' **Note:** This function does not translate MIC values to SIR values. Use [as.sir()] for that. \cr
@ -167,13 +167,13 @@ eucast_rules <- function(x,
info = interactive(),
rules = getOption("AMR_eucastrules", default = c("breakpoints", "expert")),
verbose = FALSE,
version_breakpoints = 12.0,
version_breakpoints = 14.0,
version_expertrules = 3.3,
# TODO version_resistant_phenotypes = 1.2,
ampc_cephalosporin_resistance = NA,
only_sir_columns = FALSE,
custom_rules = NULL,
overwrite = TRUE,
overwrite = FALSE,
...) {
meet_criteria(x, allow_class = "data.frame")
meet_criteria(col_mo, allow_class = "character", has_length = 1, is_in = colnames(x), allow_NULL = TRUE)
@ -630,10 +630,10 @@ eucast_rules <- function(x,
# sometimes, the screenings are missing but the names are actually available
# we only hints on remaining rows in `eucast_rules_df`
screening_abx <- c("FOX", "BTL", "CLI", "NAL", "NOR", "OXA", "PEF", "PEN", "TCY")
screening_abx <- as.character(AMR::antimicrobials$ab[which(AMR::antimicrobials$ab %like% "-S$")])
screening_abx <- screening_abx[screening_abx %in% unique(unlist(strsplit(EUCAST_RULES_DF$and_these_antibiotics[!is.na(EUCAST_RULES_DF$and_these_antibiotics)], ", *")))]
for (ab in screening_abx) {
ab_s <- paste0(ab, "-S")
for (ab_s in screening_abx) {
ab <- gsub("-S$", "", ab_s)
if (ab %in% names(cols_ab) && !ab_s %in% names(cols_ab)) {
if (isTRUE(info)) {
message_("Using column '", cols_ab[names(cols_ab) == ab],
@ -1130,7 +1130,7 @@ edit_sir <- function(x,
if (any(!vapply(FUN.VALUE = logical(1), x[, cols, drop = FALSE], is.sir), na.rm = TRUE)) {
track_changes$sir_warn <- cols[!vapply(FUN.VALUE = logical(1), x[, cols, drop = FALSE], is.sir)]
}
non_SIR <- !(new_edits[rows, cols] == "S" | new_edits[rows, cols] == "I" | new_edits[rows, cols] == "R" | new_edits[rows, cols] == "SDD" | new_edits[rows, cols] == "NI")
non_SIR <- is.na(new_edits[rows, cols]) | !(new_edits[rows, cols] == "S" | new_edits[rows, cols] == "I" | new_edits[rows, cols] == "R" | new_edits[rows, cols] == "SDD" | new_edits[rows, cols] == "NI")
tryCatch(
# insert into original table
if (isTRUE(overwrite)) {

Binary file not shown.