mirror of
https://github.com/msberends/AMR.git
synced 2026-11-16 05:00:50 +01:00
Store all screening breakpoints under screening agents, and add these agents to antimicrobials (#328)
Implements the decisions ticked in #328, and the behaviour specified in https://github.com/msberends/AMR/pull/339#issuecomment-6577438074: `include_screening` now defaults to NULL, using screening breakpoints for screening agents only. With TRUE, a regular agent also takes these breakpoints, and with FALSE a screening agent gives NA with a note. - antimicrobials gains 13 screening agents, e.g. GEN-S, ERY-S and STR1-S - GEH and STH rows move to GEN-S and STR1-S, and as.sir() keeps accepting both codes - Topical cut-off values move to -S agents with site "Topical" - WHONET-based rows move as ticked, including CLSI cefoxitin for staphylococci and pefloxacin for Salmonella, and EUCAST 2012-2018 cefoxitin MIC - Clinical breakpoints that EUCAST also allows as a screening test get a copy under the -S agent
This commit is contained in:
1 parent
fab20c5eaa
commit
2c98dac7ae
12 files changed
+213
-37
No files matched your search
@@ -582,6 +582,40 @@ test_that("microorganisms.codes: unique codes for existing names", {
|
||||
expect_true(all(is.na(microorganisms.codes$source) | grepl("^WHONET \\(.+\\)$", microorganisms.codes$source)))
|
||||
})
|
||||
|
||||
test_that("clinical_breakpoints: screening tests are under screening agents (#328)", {
|
||||
skip_on_cran()
|
||||
cb <- as.data.frame(clinical_breakpoints, stringsAsFactors = FALSE)
|
||||
ab <- as.character(cb$ab)
|
||||
year <- as.integer(gsub("[^0-9]", "", cb$guideline))
|
||||
is_regular <- !grepl("-S$", ab)
|
||||
# no regular agent has a screening site
|
||||
expect_false(any(is_regular & grepl("screen", cb$site, ignore.case = TRUE)))
|
||||
expect_true(all(c("FOX-S", "OXA-S", "NAL-S", "NOR-S", "PEF-S", "PEN-S", "TCY-S", "ERY-S", "GEN-S", "STR1-S", "CIP-S", "MUP-S") %in% ab))
|
||||
# all codes of screening agents are valid, without an ATC code
|
||||
screening_agents <- subset(AMR::antimicrobials, grepl("-S$", ab))
|
||||
expect_true(all(unique(ab[!is_regular]) %in% screening_agents$ab))
|
||||
expect_true(all(grepl("screening test$", screening_agents$name)))
|
||||
# the two high-level codes hold no rows themselves, and are still valid
|
||||
expect_false(any(ab %in% c("GEH", "STH")))
|
||||
expect_true(all(c("GEH", "STH") %in% AMR::antimicrobials$ab))
|
||||
# topical cut-off values
|
||||
topical <- cb[cb$site %in% "Topical", , drop = FALSE]
|
||||
expect_true(all(grepl("-S$", as.character(topical$ab))))
|
||||
expect_false(any(cb$site %in% "Topical, Screen"))
|
||||
# explicit lists: moved
|
||||
human <- cb$type == "human"
|
||||
expect_false(any(human & cb$guideline %like% "EUCAST" & year %in% 2012:2018 & ab == "FOX" & cb$method == "MIC" & as.character(cb$mo) %in% c("B_STPHY_AURS", "B_STPHY_LGDN")))
|
||||
expect_false(any(human & cb$guideline %like% "CLSI" & ab == "FOX" & mo_genus(cb$mo, keep_synonyms = TRUE, language = NULL) %in% "Staphylococcus"))
|
||||
expect_false(any(human & cb$guideline %like% "CLSI" & year >= 2015 & ab == "PEF" & mo_genus(cb$mo, keep_synonyms = TRUE, language = NULL) %in% "Salmonella"))
|
||||
# explicit list: stays under the regular agent, also as decided in the issue
|
||||
expect_true(any(human & cb$guideline == "EUCAST 2013" & ab == "NAL" & cb$method == "DISK"))
|
||||
expect_true(any(human & cb$guideline == "CLSI 2026" & ab == "OXA" & as.character(cb$mo) == "B_STRPT_PNMN" & cb$method == "DISK"))
|
||||
# rows that are a clinical breakpoint and a screen are under both (from EUCAST 2023)
|
||||
ery <- function(agent) cb[human & cb$guideline == "EUCAST 2026" & ab == agent & as.character(cb$mo) == "B_MRXLL_CTRR" & cb$method == "DISK", c("breakpoint_S", "breakpoint_R"), drop = FALSE]
|
||||
expect_true(nrow(ery("ERY")) > 0)
|
||||
expect_identical(unname(as.list(ery("ERY-S"))), unname(as.list(ery("ERY"))))
|
||||
})
|
||||
|
||||
test_that("clinical_breakpoints: no EUCAST breakpoints in brackets (#327)", {
|
||||
skip_on_cran()
|
||||
expect_false(any(grepl("brackets", clinical_breakpoints$note, fixed = TRUE)))
|
||||
|
||||
@@ -433,7 +433,7 @@ test_that("test-sir.R", {
|
||||
)
|
||||
# an S category remains unaffected, e.g. EUCAST CIP in E. coli (S <= 0.25, R > 0.5)
|
||||
expect_equal(
|
||||
suppressMessages(as.sir(as.mic(c("<=0.5", "<0.5", "<=0.25")), mo = "Escherichia coli", ab = "CIP", guideline = "EUCAST 2026", capped_mic_handling = "standard")),
|
||||
suppressMessages(as.sir(as.mic(c("<=0.5", "<0.5", "<=0.25")), mo = "Escherichia coli", ab = "CIP", guideline = "EUCAST 2026", capped_mic_handling = "standard", site = "non-meningitis")),
|
||||
as.sir(c("NI", "S", "S"))
|
||||
)
|
||||
# capped values must not be forced to S or R if there is no breakpoint (blocking row, here: EUCAST CIP in S. aureus in brackets only)
|
||||
@@ -638,6 +638,26 @@ test_that("custom reference_data: host = NA acts as host-agnostic fallback", {
|
||||
expect_equal(as.character(result), "R")
|
||||
})
|
||||
|
||||
test_that("as.sir() uses screening breakpoints as specified (#328)", {
|
||||
skip_on_cran()
|
||||
sir <- function(ab, ...) {
|
||||
as.character(suppressMessages(suppressWarnings(as.sir(as.disk(20), mo = "S. aureus", ab = ab, guideline = "EUCAST 2026", info = FALSE, ...))))
|
||||
}
|
||||
expect_identical(sir("FOX"), NA_character_)
|
||||
expect_false(is.na(sir("FOX-S")))
|
||||
expect_false(is.na(sir("FOX-S", include_screening = TRUE)))
|
||||
expect_false(is.na(sir("FOX", include_screening = TRUE)))
|
||||
expect_identical(sir("FOX", include_screening = TRUE), sir("FOX-S"))
|
||||
expect_identical(sir("FOX", include_screening = FALSE), NA_character_)
|
||||
expect_identical(sir("FOX-S", include_screening = FALSE), NA_character_)
|
||||
# with a note, as this may be by accident
|
||||
expect_message(as.sir(as.disk(20), mo = "S. aureus", ab = "FOX-S", guideline = "EUCAST 2026", include_screening = FALSE, info = FALSE), "include_screening")
|
||||
sir_interpretation_history(clean = TRUE)
|
||||
sir("FOX-S", include_screening = FALSE)
|
||||
sir_history <- sir_interpretation_history(clean = TRUE)
|
||||
expect_match(sir_history$notes, "include_screening = FALSE", fixed = TRUE)
|
||||
})
|
||||
|
||||
test_that("as.sir() takes the site of a breakpoint into account", {
|
||||
skip_on_cran()
|
||||
sir <- function(x, mo, ab, ..., guideline = "EUCAST 2026") {
|
||||
@@ -788,7 +808,7 @@ test_that("Morganella is interpreted as reported, not as M. morganii (#330)", {
|
||||
|
||||
test_that("EUCAST blocking rows prevent falling back to broader breakpoints", {
|
||||
skip_on_cran()
|
||||
sir <- function(x, mo, ab, guideline, include_screening = FALSE, uti = NA) {
|
||||
sir <- function(x, mo, ab, guideline, include_screening = NULL, uti = NA) {
|
||||
as.character(suppressMessages(suppressWarnings(
|
||||
as.sir(x, mo = mo, ab = ab, guideline = guideline, include_screening = include_screening, uti = uti)
|
||||
)))
|
||||
@@ -813,7 +833,7 @@ test_that("EUCAST blocking rows prevent falling back to broader breakpoints", {
|
||||
# H. influenzae MIC breakpoints apply to H. parainfluenzae, zone diameters do not
|
||||
expect_identical(sir(as.mic(0.5), "Haemophilus parainfluenzae", "CIP", "EUCAST 2026"), "R")
|
||||
expect_identical(sir(as.disk(30), "Haemophilus parainfluenzae", "CIP", "EUCAST 2026"), NA_character_)
|
||||
# cefoxitin screen: CoNS not identified to species level use S >= 25 mm
|
||||
# cefoxitin screen: CoNS not identified to species level use S >= 25 mm, also with the regular agent if allowed (#328)
|
||||
expect_identical(sir(as.disk(23), "B_STPHY_CONS", "FOX", "EUCAST 2026", include_screening = TRUE), "R")
|
||||
expect_identical(sir(as.disk(23), "Staphylococcus hominis", "FOX", "EUCAST 2026", include_screening = TRUE), "S")
|
||||
expect_identical(sir(as.disk(26), "Staphylococcus epidermidis", "FOX", "EUCAST 2026", include_screening = TRUE), "R")
|
||||
@@ -824,8 +844,9 @@ test_that("EUCAST blocking rows prevent falling back to broader breakpoints", {
|
||||
expect_identical(sir(as.mic(0.0005), "Pseudomonas aeruginosa", "CIP", "EUCAST 2026"), "I")
|
||||
# EUCAST's 0.06 mg/L is the dilution 0.0625, i.e. 0.064 in this package
|
||||
expect_identical(sir(as.mic(0.064), "Haemophilus influenzae", "LVX", "EUCAST 2026"), "S")
|
||||
# high-level gentamicin resistance (screening test given in the notes)
|
||||
# high-level gentamicin resistance (screening test given in the notes), under both codes (#328)
|
||||
expect_identical(sir(as.mic(256), "Enterococcus faecium", "GEH", "EUCAST 2026"), "R")
|
||||
expect_identical(sir(as.mic(256), "Enterococcus faecium", "GEN-S", "EUCAST 2026"), "R")
|
||||
# breakpoints in brackets are not in the data set (#327), so a UTI breakpoint is used if uti is unknown and nothing else is available, which is noted every time
|
||||
sir_interpretation_history(clean = TRUE)
|
||||
expect_identical(sir(as.mic(4), "Acinetobacter baumannii", "AMK", "EUCAST 2026"), "S")
|
||||
|
||||
Reference in new issue
Block a user