Return the serovar in mo_shortname() for Salmonella, keep Salmonella groups apart from streptococci, abbreviate all Lancefield groups, and apply the Typhi rule in mdro() (#341)

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2026-11-04 07:57:20 +01:00
1 parent 08fd165a60
commit 3b8b213616
7 files changed
+60 -9

No files matched your search

+21
View File
@@ -56,6 +56,27 @@ test_that("test-mdro.R", {
mdro(example_isolates, guideline = "BRMO", info = FALSE)
)
# test EUCAST rule for Salmonella Typhi, which is stored as subspecies of S. enterica
typhi <- data.frame(
mo = as.mo(rep("Salmonella Typhi", 2)),
CIP = as.sir(c("R", "S")),
IPM = as.sir(c("S", "S")),
MEM = as.sir(c("S", "S")),
AMX = as.sir(c("S", "S"))
)
expect_equal(
as.character(suppressWarnings(mdro(typhi, guideline = "EUCAST3.1", col_mo = "mo", info = FALSE))),
c("Positive", "Negative")
)
typhi$CIP <- as.sir(c("S", "S"))
typhi$MEM <- as.sir(c("R", "S"))
for (gl in c("EUCAST3.2", "EUCAST3.3")) {
expect_equal(
as.character(suppressWarnings(mdro(typhi, guideline = gl, col_mo = "mo", info = FALSE))),
c("Positive", "Negative")
)
}
# test Dutch P. aeruginosa MDRO
expect_equal(
as.character(mdro(
+19
View File
@@ -45,6 +45,25 @@ test_that("test-mo_property.R", {
expect_equal(mo_shortname("Staphylococcus aureus", Becker = "all", language = "en"), "CoPS")
expect_equal(mo_shortname("Streptococcus agalactiae"), "S. agalactiae")
expect_equal(mo_shortname("Streptococcus agalactiae", Lancefield = TRUE), "GBS")
# Salmonella serovars return the serovar, and all stay distinct
expect_equal(
mo_shortname(c("Salmonella Typhi", "Salmonella Goldcoast", "Salmonella Paratyphi A", "Salmonella enterica", "Salmonella enterica enterica", NA), language = NULL),
c("S. Typhi", "S. Goldcoast", "S. Paratyphi A", "S. enterica", "S. enterica", NA)
)
# Salmonella groups must not be abbreviated as streptococci
expect_equal(
mo_shortname(c("Salmonella group B", "Streptococcus group B"), language = NULL),
c("S. Group B", "GBS")
)
# all Lancefield groups are abbreviated, also when they share a letter with a Salmonella group
expect_equal(
mo_shortname(paste0("B_STRPT_GRP", LETTERS[1:12]), language = NULL),
paste0("G", LETTERS[1:12], "S")
)
expect_equal(mo_shortname("B_SLMNL_GRPE", language = NULL), "S. Group E")
expect_equal(mo_shortname("B_STRPT_ABCG", language = NULL), "S. Group A, B, C, G")
serovars <- microorganisms$mo[microorganisms$genus == "Salmonella" & microorganisms$subspecies %like_case% "^[A-Z]" & microorganisms$status == "accepted"]
expect_false(anyDuplicated(mo_shortname(serovars, language = NULL)) > 0)
# check gram stain determination, to prevent we lag after a taxonomic renaming
current_grampos_phyla <- c(