amoxicillin interpretation fix

This commit is contained in:
dr. M.S. (Matthijs) Berends 2022-08-28 11:17:53 +02:00
parent 4d050aef7c
commit f781998904
4 changed files with 28 additions and 10 deletions

View File

@ -1,5 +1,5 @@
Package: AMR
Version: 1.8.1.9033
Version: 1.8.1.9034
Date: 2022-08-28
Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR)

View File

@ -1,4 +1,4 @@
# AMR 1.8.1.9033
# AMR 1.8.1.9034
### New
* EUCAST 2022 and CLSI 2022 guidelines have been added for `as.rsi()`. EUCAST 2022 is now the new default guideline for all MIC and disks diffusion interpretations.
@ -20,6 +20,7 @@
* Fix for using `info = FALSE` in `mdro()`
* All data sets in this package are now exported as `tibble`, instead of base R `data.frame`s. Older R versions are still supported.
* Automatic language determination will give a note once a session
* For all interpretation guidelines using `as.rsi()` on amoxicillin, the rules for ampicillin will be used if amoxicillin rules are not available
### Other
* New website to make use of the new Bootstrap 5 and pkgdown v2.0. The website now contains results for all examples and will be automatically regenerated with every change to our repository, using GitHub Actions

31
R/rsi.R
View File

@ -722,7 +722,12 @@ as_rsi_method <- function(method_short,
agent_formatted <- paste0("'", font_bold(ab), "'")
agent_name <- ab_name(ab_coerced, tolower = TRUE, language = NULL)
if (generalise_antibiotic_name(ab) != generalise_antibiotic_name(agent_name)) {
agent_formatted <- paste0(agent_formatted, " (", ab_coerced, ", ", agent_name, ")")
agent_formatted <- paste0(
agent_formatted,
" (", ifelse(ab == ab_coerced, "",
paste0(ab_coerced, ", ")
), agent_name, ")"
)
}
message_("=> Interpreting ", method_long, " of ", ifelse(isTRUE(list(...)$is_data.frame), "column ", ""),
agent_formatted,
@ -799,19 +804,31 @@ exec_as.rsi <- function(method,
new_rsi <- rep(NA_character_, length(x))
ab_param <- ab
if (ab_param == "AMX") {
ab_param <- "AMP"
if (message_not_thrown_before("as.rsi", "AMP_for_AMX")) {
message_("(using ampicillin rules)", appendLF = FALSE, as_note = FALSE)
}
}
if (identical(reference_data, AMR::rsi_translation)) {
trans <- reference_data %pm>%
subset(guideline == guideline_coerced & method == method_param & ab == ab_param)
if (ab_param == "AMX" && nrow(trans) == 0) {
ab_param <- "AMP"
if (message_not_thrown_before("as.rsi", "AMP_for_AMX")) {
message_("(using ampicillin rules)", appendLF = FALSE, as_note = FALSE)
}
trans <- reference_data %pm>%
subset(guideline == guideline_coerced & method == method_param & ab == ab_param)
}
} else {
trans <- reference_data %pm>%
subset(method == method_param & ab == ab_param)
}
if (nrow(trans) == 0) {
message_(" OK.", add_fn = list(font_green, font_bold), as_note = FALSE)
load_mo_failures_uncertainties_renamed(metadata_mo)
return(set_clean_class(factor(new_rsi, levels = c("S", "I", "R"), ordered = TRUE),
new_class = c("rsi", "ordered", "factor")
))
}
trans$lookup <- paste(trans$mo, trans$ab)
lookup_mo <- paste(mo, ab_param)

View File

@ -494,4 +494,4 @@ invisible(capture.output(styler::style_dir(
# Finished ----------------------------------------------------------------
usethis::ui_info("All done")
usethis::ui_done("All done")