1
0
mirror of https://github.com/msberends/AMR.git synced 2025-04-15 13:10:32 +02:00

(v2.1.1.9227) unit test fixes

This commit is contained in:
dr. M.S. (Matthijs) Berends 2025-03-27 15:36:27 +01:00
parent 969a42cc8c
commit d77ad6bd6e
No known key found for this signature in database
11 changed files with 21 additions and 17 deletions

View File

@ -1,5 +1,5 @@
Package: AMR
Version: 2.1.1.9226
Version: 2.1.1.9227
Date: 2025-03-27
Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR)

View File

@ -1,4 +1,4 @@
# AMR 2.1.1.9226
# AMR 2.1.1.9227
*(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://msberends.github.io/AMR/#latest-development-version).)*

View File

@ -1299,7 +1299,13 @@ font_purple_bg <- function(..., collapse = " ") {
try_colour(font_black(..., collapse = collapse, adapt = FALSE), before = "\033[48;5;89m", after = "\033[49m", collapse = collapse)
}
font_rose_bg <- function(..., collapse = " ") {
try_colour(font_black(..., collapse = collapse, adapt = FALSE), before = "\033[48;5;217m", after = "\033[49m", collapse = collapse)
if (is_dark()) {
# this is #ed553b (picked to be colourblind-safe with other SIR colours)
try_colour(font_black(..., collapse = collapse, adapt = FALSE), before = "\033[48;5;203m", after = "\033[49m", collapse = collapse)
} else {
# also colourblind-safe but softer
try_colour(font_black(..., collapse = collapse, adapt = FALSE), before = "\033[48;5;217m", after = "\033[49m", collapse = collapse)
}
}
font_na <- function(..., collapse = " ") {
font_red(..., collapse = collapse)

View File

@ -253,7 +253,7 @@ print.custom_eucast_rules <- function(x, ...) {
if (is.na(rule$result_value)) {
val <- font_red("<NA>")
} else if (rule$result_value == "R") {
val <- font_red_bg(" R ")
val <- font_rose_bg(" R ")
} else if (rule$result_value == "S") {
val <- font_green_bg(" S ")
} else {
@ -297,7 +297,7 @@ format_custom_query_rule <- function(query, colours = has_colour()) {
query <- gsub(" %in% ", sub("{text}", " is one of ", txt, fixed = TRUE), query, fixed = TRUE)
query <- gsub(" %like% ", sub("{text}", " resembles ", txt, fixed = TRUE), query, fixed = TRUE)
if (colours == TRUE) {
query <- gsub('"R"', font_red_bg(" R "), query, fixed = TRUE)
query <- gsub('"R"', font_rose_bg(" R "), query, fixed = TRUE)
query <- gsub('"S"', font_green_bg(" S "), query, fixed = TRUE)
query <- gsub('"I"', font_orange_bg(" I "), query, fixed = TRUE)
}

View File

@ -656,7 +656,9 @@ eucast_rules <- function(x,
if (isTRUE(ampc_cephalosporin_resistance)) {
ampc_cephalosporin_resistance <- "R"
}
eucast_rules_df[which(eucast_rules_df$reference.rule %like% "ampc"), "to_value"] <- as.character(ampc_cephalosporin_resistance)
if (!is.null(eucast_rules_df$reference.rule)) {
eucast_rules_df[which(eucast_rules_df$reference.rule %like% "ampc"), "to_value"] <- as.character(ampc_cephalosporin_resistance)
}
}
# sometimes, the screenings are missing but the names are actually available

View File

@ -1715,11 +1715,7 @@ pillar_shaft.sir <- function(x, ...) {
out[x == "S"] <- font_green_bg(" S ")
out[x == "I"] <- font_orange_bg(" I ")
out[x == "SDD"] <- font_orange_bg(" SDD ")
if (is_dark()) {
out[x == "R"] <- font_red_bg(" R ")
} else {
out[x == "R"] <- font_rose_bg(" R ")
}
out[x == "R"] <- font_rose_bg(" R ")
}
create_pillar_column(out, align = "left", width = 5)
}

Binary file not shown.

View File

@ -809,7 +809,7 @@ genus_species is Aeromonas veronii AMP, AMX, SAM, TIC R Table 1: Expected resi
genus_species is Aeromonas dhakensis AMP, AMX, SAM, FOX R Table 1: Expected resistant phenotype in Enterobacterales and Aeromonas spp. Expected phenotypes 1.2
genus_species is Aeromonas caviae AMP, AMX, SAM R Table 1: Expected resistant phenotype in Enterobacterales and Aeromonas spp. Expected phenotypes 1.2
genus_species is Aeromonas jandaei AMP, AMX, SAM, TIC R Table 1: Expected resistant phenotype in Enterobacterales and Aeromonas spp. Expected phenotypes 1.2
genus one_of Acinetobacter, Achromobacter, Burkholderia, Elizabethkingia, Elizabethkingia, Ochrobactrum, Pseudomonas, Stenotrophomonas, Chryseobacterium PEN, cephalosporins_1st, cephalosporins_2nd, glycopeptides, lipglycopeptides, FUS, macrolides, lincosamides, streptogramins, RIF, oxazolidinones R Table 2: Expected resistant phenotype in non-fermentative gram-negative bacteria Expected phenotypes 1.2
genus one_of Acinetobacter, Achromobacter, Burkholderia, Elizabethkingia, Elizabethkingia, Ochrobactrum, Pseudomonas, Stenotrophomonas, Chryseobacterium PEN, cephalosporins_1st, cephalosporins_2nd, glycopeptides, lipoglycopeptides, FUS, macrolides, lincosamides, streptogramins, RIF, oxazolidinones R Table 2: Expected resistant phenotype in non-fermentative gram-negative bacteria Expected phenotypes 1.2
genus_species one_of Acinetobacter baumannii, Acinetobacter pittii, Acinetobacter nosocomialis AMP, AMX, AMC, CTX, CRO, ATM, ETP, TMP, FOS, TCY, DOX R Table 2: Expected resistant phenotype in non-fermentative gram-negative bacteria Expected phenotypes 1.2
genus_species is Achromobacter xylosoxidans AMP, AMX, CTX, CRO, ATM, ETP R Table 2: Expected resistant phenotype in non-fermentative gram-negative bacteria Expected phenotypes 1.2
genus_species one_of Burkholderia cepacia complex AMP, AMX, AMC, SAM, TIC, TCC, PIP, TZP, CTX, CRO, ATM, ETP, CIP, CHL, aminoglycosides, TMP, FOS, PLB, COL R Table 2: Expected resistant phenotype in non-fermentative gram-negative bacteria Expected phenotypes 1.2

Can't render this file because it has a wrong number of fields in line 9.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long