mirror of
https://github.com/msberends/AMR.git
synced 2025-01-15 20:02:44 +01:00
Compare commits
2 Commits
4d050aef7c
...
40d9658e06
Author | SHA1 | Date | |
---|---|---|---|
|
40d9658e06 | ||
f781998904 |
1
.github/workflows/check.yaml
vendored
1
.github/workflows/check.yaml
vendored
@ -100,7 +100,6 @@ jobs:
|
|||||||
- name: Unpack AMR and install R dependencies
|
- name: Unpack AMR and install R dependencies
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
tar -xf data-raw/AMR_latest.tar.gz
|
|
||||||
Rscript -e "source('data-raw/_install_deps.R')"
|
Rscript -e "source('data-raw/_install_deps.R')"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.8.1.9033
|
Version: 1.8.1.9034
|
||||||
Date: 2022-08-28
|
Date: 2022-08-28
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||||
|
3
NEWS.md
3
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 1.8.1.9033
|
# AMR 1.8.1.9034
|
||||||
|
|
||||||
### New
|
### 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.
|
* 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()`
|
* 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.
|
* 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
|
* 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
|
### 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
|
* 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
31
R/rsi.R
@ -722,7 +722,12 @@ as_rsi_method <- function(method_short,
|
|||||||
agent_formatted <- paste0("'", font_bold(ab), "'")
|
agent_formatted <- paste0("'", font_bold(ab), "'")
|
||||||
agent_name <- ab_name(ab_coerced, tolower = TRUE, language = NULL)
|
agent_name <- ab_name(ab_coerced, tolower = TRUE, language = NULL)
|
||||||
if (generalise_antibiotic_name(ab) != generalise_antibiotic_name(agent_name)) {
|
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 ", ""),
|
message_("=> Interpreting ", method_long, " of ", ifelse(isTRUE(list(...)$is_data.frame), "column ", ""),
|
||||||
agent_formatted,
|
agent_formatted,
|
||||||
@ -799,19 +804,31 @@ exec_as.rsi <- function(method,
|
|||||||
|
|
||||||
new_rsi <- rep(NA_character_, length(x))
|
new_rsi <- rep(NA_character_, length(x))
|
||||||
ab_param <- ab
|
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)) {
|
if (identical(reference_data, AMR::rsi_translation)) {
|
||||||
trans <- reference_data %pm>%
|
trans <- reference_data %pm>%
|
||||||
subset(guideline == guideline_coerced & method == method_param & ab == ab_param)
|
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 {
|
} else {
|
||||||
trans <- reference_data %pm>%
|
trans <- reference_data %pm>%
|
||||||
subset(method == method_param & ab == ab_param)
|
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)
|
trans$lookup <- paste(trans$mo, trans$ab)
|
||||||
|
|
||||||
lookup_mo <- paste(mo, ab_param)
|
lookup_mo <- paste(mo, ab_param)
|
||||||
|
@ -494,4 +494,4 @@ invisible(capture.output(styler::style_dir(
|
|||||||
|
|
||||||
|
|
||||||
# Finished ----------------------------------------------------------------
|
# Finished ----------------------------------------------------------------
|
||||||
usethis::ui_info("All done")
|
usethis::ui_done("All done")
|
||||||
|
Loading…
Reference in New Issue
Block a user