mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 20:06:11 +01:00
better verbose in EUCAST
This commit is contained in:
parent
b464dd524a
commit
032c0d51ef
45
R/eucast.R
45
R/eucast.R
@ -407,22 +407,22 @@ EUCAST_rules <- function(tbl,
|
|||||||
cat("Rules by the European Committee on Antimicrobial Susceptibility Testing (EUCAST)\n")
|
cat("Rules by the European Committee on Antimicrobial Susceptibility Testing (EUCAST)\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
# since ampicillin ^= amoxicillin, get the first from the latter
|
# since ampicillin ^= amoxicillin, get the first from the latter (not in original table)
|
||||||
if (!is.na(ampi) & !is.na(amox)) {
|
if (!is.na(ampi) & !is.na(amox)) {
|
||||||
rule_group <- "Ampicillin susceptibility"
|
if (verbose == TRUE) {
|
||||||
rule <- "Get ampicillin results from amoxicillin where ampicillin is missing"
|
cat("\n VERBOSE: transforming",
|
||||||
edit_rsi(to = 'S',
|
length(which(tbl[, amox] == "S" & !tbl[, ampi] %in% c("S", "I", "R"))),
|
||||||
rule = c(rule_group, rule),
|
"empty ampicillin fields to 'S' based on amoxicillin.")
|
||||||
rows = which(tbl[, amox] == 'S' & !tbl[, ampi] %in% c("S", "I", "R")),
|
cat("\n VERBOSE: transforming",
|
||||||
cols = ampi)
|
length(which(tbl[, amox] == "I" & !tbl[, ampi] %in% c("S", "I", "R"))),
|
||||||
edit_rsi(to = 'I',
|
"empty ampicillin fields to 'I' based on amoxicillin.")
|
||||||
rule = c(rule_group, rule),
|
cat("\n VERBOSE: transforming",
|
||||||
rows = which(tbl[, amox] == 'I' & !tbl[, ampi] %in% c("S", "I", "R")),
|
length(which(tbl[, amox] == "R" & !tbl[, ampi] %in% c("S", "I", "R"))),
|
||||||
cols = ampi)
|
"empty ampicillin fields to 'R' based on amoxicillin.\n")
|
||||||
edit_rsi(to = 'R',
|
}
|
||||||
rule = c(rule_group, rule),
|
tbl[which(tbl[, amox] == "S" & !tbl[, ampi] %in% c("S", "I", "R")), ampi] <- "S"
|
||||||
rows = which(tbl[, amox] == 'R' & !tbl[, ampi] %in% c("S", "I", "R")),
|
tbl[which(tbl[, amox] == "I" & !tbl[, ampi] %in% c("S", "I", "R")), ampi] <- "I"
|
||||||
cols = ampi)
|
tbl[which(tbl[, amox] == "R" & !tbl[, ampi] %in% c("S", "I", "R")), ampi] <- "R"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (any(c("all", "breakpoints") %in% rules)) {
|
if (any(c("all", "breakpoints") %in% rules)) {
|
||||||
@ -1651,11 +1651,22 @@ EUCAST_rules <- function(tbl,
|
|||||||
# }
|
# }
|
||||||
|
|
||||||
if (info == TRUE) {
|
if (info == TRUE) {
|
||||||
|
if (verbose == TRUE) {
|
||||||
|
wouldve <- "would have "
|
||||||
|
} else {
|
||||||
|
wouldve <- ""
|
||||||
|
}
|
||||||
|
if (amount_changed == 0) {
|
||||||
|
colour <- green
|
||||||
|
} else {
|
||||||
|
colour <- blue
|
||||||
|
}
|
||||||
cat(bold('\n=> EUCAST rules affected',
|
cat(bold('\n=> EUCAST rules affected',
|
||||||
amount_affected_rows %>% length() %>% format(big.mark = ","),
|
amount_affected_rows %>% length() %>% format(big.mark = ","),
|
||||||
'out of', nrow(tbl_original) %>% format(big.mark = ","),
|
'out of', nrow(tbl_original) %>% format(big.mark = ","),
|
||||||
'rows -- changed',
|
'rows ->',
|
||||||
amount_changed %>% format(big.mark = ","), 'test results.\n\n'))
|
colour(paste0(wouldve, 'changed'),
|
||||||
|
amount_changed %>% format(big.mark = ","), 'test results.\n\n')))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose == TRUE) {
|
if (verbose == TRUE) {
|
||||||
|
Loading…
Reference in New Issue
Block a user