Store EUCAST MIC breakpoints exactly as published, and compare dilutions in as.sir() (#331)

The reproduction script no longer maps MIC breakpoints to AMR:::COMMON_MIC_VALUES, and also keeps the off-scale S breakpoint of 0.001 mg/L. as.sir() compares through the new internal mic_dilution_level(), so that e.g. an MIC of 0.032 and a breakpoint of 0.03 are the same dilution, and shows the published breakpoints in sir_interpretation_history().

Every parsed breakpoint now holds the address of its workbook cell in breakpoints_eucast_raw, and the script stops if a second reading of the workbooks with readxl does not find the value in that cell.

The data sets are rebuilt once, at the end of this PR.
This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2026-11-02 16:56:51 +01:00
1 parent 844e2581ee
commit 5eed396dce
5 files changed
+119 -19

No files matched your search

+17
View File
@@ -582,6 +582,23 @@ 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: EUCAST MIC breakpoints are stored as published (#331)", {
skip_on_cran()
cb <- as.data.frame(clinical_breakpoints, stringsAsFactors = FALSE)
cb <- cb[cb$type == "human" & cb$method == "MIC" & cb$guideline %like% "EUCAST" & cb$ref_tbl %like% "file: ", , drop = FALSE]
expect_true(nrow(cb) > 0)
# these notations do not occur in the EUCAST Clinical Breakpoint Tables
published_as <- c("0.032" = 0.032, "0.064" = 0.064, "0.0001" = 0.0001)
for (value in names(published_as)) {
wrong <- which(cb$breakpoint_S == published_as[value] | cb$breakpoint_R == published_as[value])
expect_true(length(wrong) == 0, info = paste("EUCAST MIC breakpoint", value, "in", paste(unique(cb$guideline[wrong]), collapse = ", ")))
}
# but those as published do, e.g., benzylpenicillin for group A streptococci in v16.1
expect_true(any(cb$breakpoint_S == 0.03, na.rm = TRUE))
expect_true(any(cb$breakpoint_S == 0.06, na.rm = TRUE))
expect_true(any(cb$breakpoint_S == 0.001, na.rm = TRUE))
})
test_that("clinical_breakpoints: consistent and unambiguous", {
skip_on_cran()
cb <- clinical_breakpoints