From 80f08f91da8ac4213e03a927f09ca86ae3ba27d2 Mon Sep 17 00:00:00 2001 From: Matthijs Berends Date: Wed, 21 May 2025 16:51:40 +0200 Subject: [PATCH] (v2.1.1.9285) mdro fix --- DESCRIPTION | 4 ++-- NEWS.md | 2 +- R/mdro.R | 13 +++++++------ R/mo.R | 11 +++++++++-- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0f537f4d7..cdfea16ed 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 2.1.1.9281 -Date: 2025-05-20 +Version: 2.1.1.9285 +Date: 2025-05-21 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by diff --git a/NEWS.md b/NEWS.md index fc03da7e7..bdbe675e4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 2.1.1.9281 +# AMR 2.1.1.9285 *(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://amr-for-r.org/#get-this-package).)* diff --git a/R/mdro.R b/R/mdro.R index d59b7b7f5..3f6b407b4 100755 --- a/R/mdro.R +++ b/R/mdro.R @@ -499,10 +499,11 @@ mdro <- function(x = NULL, if (!"AMP" %in% names(cols_ab) && "AMX" %in% names(cols_ab)) { # ampicillin column is missing, but amoxicillin is available if (isTRUE(info)) { - message_("Using column '", cols_ab[names(cols_ab) == "AMX"], "' as input for ampicillin since many MDRO rules depend on it.") + message_("Using column '", cols_ab[names(cols_ab) == "AMX"], "' as input for ampicillin since many MDRO rules depend on it.", add_fn = font_red) } cols_ab <- c(cols_ab, c(AMP = unname(cols_ab[names(cols_ab) == "AMX"]))) } + cols_ab <- cols_ab[!duplicated(cols_ab)] # nolint start AMC <- cols_ab["AMC"] @@ -1607,20 +1608,20 @@ mdro <- function(x = NULL, reason = "E. faecium: vanA/vanB gene + penicillin group" ) - # Staphylococcus aureus + # Staphylococcus aureus complex (= aureus, argenteus or schweitzeri) trans_tbl( 2, - rows = which(x$genus == "Staphylococcus" & x$species == "aureus" & (is.na(mecA) | is.na(mecC))), + rows = which(x$genus == "Staphylococcus" & x$species %in% c("aureus", "argenteus", "schweitzeri") & (is.na(mecA) | is.na(mecC))), cols = c(AMC, TZP, FLC, OXA, FOX, FOX1), any_all = "any", - reason = "S. aureus: potential MRSA" + reason = "S. aureus complex: potential MRSA" ) trans_tbl( 3, - rows = which(x$genus == "Staphylococcus" & x$species == "aureus" & (mecA == TRUE | mecC == TRUE)), + rows = which(x$genus == "Staphylococcus" & x$species %in% c("aureus", "argenteus", "schweitzeri") & (mecA == TRUE | mecC == TRUE)), cols = "any", any_all = "any", - reason = "S. aureus: mecA/mecC gene" + reason = "S. aureus complex: mecA/mecC gene" ) # Candida auris diff --git a/R/mo.R b/R/mo.R index d368641f0..8abd52d28 100755 --- a/R/mo.R +++ b/R/mo.R @@ -276,12 +276,17 @@ as.mo <- function(x, AMR_env$mo_failures <- NULL # Laboratory systems: remove (translated) entries like "no growth", "not E. coli", etc. - x[trimws2(x) %like% translate_into_language("no .*growth", language = language)] <- NA_character_ - x[trimws2(x) %like% paste0("^(", translate_into_language("no|not", language = language), ") ")] <- NA_character_ + x[trimws2(x) %like% translate_AMR("no .*growth", language = language)] <- NA_character_ + x[trimws2(x) %like% paste0("^(", translate_AMR("no|not", language = language), ") ")] <- NA_character_ # groups are in our taxonomic table with a capital G x <- gsub(" group( |$)", " Group\\1", x, perl = TRUE) + # convert translations + x[x %like_case% "enter[o\u00F6]?[ck]o[ck](ken)?$"] <- gsub("(.* )?enter[o\u00F6]?[ck]o[ck](ken)?$", "enterococcus", x[x %like_case% "enter[o\u00F6]?[ck]o[ck](ken)?$"], perl = TRUE) + x[x %like_case% "strept[o\u00F6]?[ck]o[ck](ken)?$"] <- gsub("(.* )?strept[o\u00F6]?[ck]o[ck](ken)?$", "streptococcus", x[x %like_case% "strept[o\u00F6]?[ck]o[ck](ken)?$"], perl = TRUE) + x[x %like_case% "staph[yij]?[lo]*[ck]o[ck](ken)?$"] <- gsub("(.* )?staph[yij]?[lo]*[ck]o[ck](ken)?$", "staphylococcus", x[x %like_case% "staph[yij]?[lo]*[ck]o[ck](ken)?$"], perl = TRUE) + # run over all unique leftovers x_unique <- unique(x[is.na(out) & !is.na(x)]) @@ -1065,6 +1070,8 @@ convert_colloquial_input <- function(x) { out[x %like_case% "mil+er+i gr"] <- "B_STRPT_MILL" out[x %like_case% "((strepto|^s).* viridans|^vgs[^a-z]*$)"] <- "B_STRPT_VIRI" out[x %like_case% "(viridans.* (strepto|^s).*|^vgs[^a-z]*$)"] <- "B_STRPT_VIRI" + out[x %like_case% "meningo[ck]o[ck](ken)?$"] <- "B_NESSR_MNNG" + out[x %like_case% "pneumo[ck]o[ck](ken)?$"] <- "B_STRPT_PNMN" # Salmonella in different languages, like "Salmonella grupo B" out[x %like_case% "salmonella.* [abcdefgh]$"] <- gsub(".*salmonella.* ([abcdefgh])$",