mirror of
https://github.com/msberends/AMR.git
synced 2026-11-16 04:20:53 +01:00
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:
1 parent
844e2581ee
commit
5eed396dce
5 files changed
+119
-19
No files matched your search
@@ -1906,9 +1906,18 @@ as_sir_method <- function(method_short,
|
||||
)
|
||||
}
|
||||
|
||||
# EUCAST indicates that there is no S category with an off-scale S breakpoint of 0.001 mg/L (stored as 0.0001 in
|
||||
# clinical_breakpoints), so that wild-type isolates are I; capped MICs such as "<=0.5" must then not be S or NI (#295)
|
||||
# clinical_breakpoints holds breakpoints as published, so keep these for sir_interpretation_history() (#331)
|
||||
breakpoint_S_R_published <- paste0(breakpoints_current[, "breakpoint_S", drop = TRUE], "-", breakpoints_current[, "breakpoint_R", drop = TRUE])
|
||||
# EUCAST indicates that there is no S category with an off-scale S breakpoint of 0.001 mg/L, so that wild-type isolates are I, also below that value; capped MICs such as "<=0.5" must then not be S or NI (#295)
|
||||
no_S_category <- method == "mic" & isTRUE(breakpoints_current$breakpoint_S <= 0.001)
|
||||
if (method == "mic") {
|
||||
# compare dilutions, not their notation, e.g. an MIC of 0.032 and a breakpoint of 0.03 are the same dilution (#331)
|
||||
breakpoints_current$breakpoint_S <- mic_dilution_level(breakpoints_current$breakpoint_S)
|
||||
breakpoints_current$breakpoint_R <- mic_dilution_level(breakpoints_current$breakpoint_R)
|
||||
if (guideline_current %like% "EUCAST" && !custom_breakpoints_set && isTRUE(breakpoints_current$breakpoint_S == 0.001)) {
|
||||
breakpoints_current$breakpoint_S <- 0.0001
|
||||
}
|
||||
}
|
||||
middle_sir <- if (isTRUE(breakpoints_current$is_SDD)) as.sir("SDD") else as.sir("I")
|
||||
clsi_closed_R <- !custom_breakpoints_set & guideline_current %like% "CLSI"
|
||||
capped_low_not_R <- (as.character(input_original) %like% "^<[0-9]" & as.double(input_clean) <= breakpoints_current$breakpoint_R) |
|
||||
@@ -2097,7 +2106,7 @@ as_sir_method <- function(method_short,
|
||||
guideline = vectorise_log_entry(guideline_current, length(rows)),
|
||||
ref_table = vectorise_log_entry(breakpoints_current[, "ref_tbl", drop = TRUE], length(rows)),
|
||||
uti = vectorise_log_entry(breakpoints_current[, "uti", drop = TRUE], length(rows)),
|
||||
breakpoint_S_R = vectorise_log_entry(paste0(breakpoints_current[, "breakpoint_S", drop = TRUE], "-", breakpoints_current[, "breakpoint_R", drop = TRUE]), length(rows)),
|
||||
breakpoint_S_R = vectorise_log_entry(breakpoint_S_R_published, length(rows)),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
out <- subset(out, !is.na(input_given))
|
||||
|
||||
Reference in new issue
Block a user