mirror of
https://github.com/msberends/AMR.git
synced 2026-03-30 20:15:55 +02:00
Compare commits
4 Commits
3e4983ff93
...
5173009625
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5173009625 | ||
|
|
80e267f0d1 | ||
|
|
05d3ca941f | ||
|
|
ec310ed76b |
@@ -29,10 +29,11 @@
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
# run in each PR in this repo
|
# run in each PR in this repo (1 worker, see matrix logic below)
|
||||||
branches: '**'
|
branches: '**'
|
||||||
push:
|
push:
|
||||||
branches: '**'
|
# only on main; pushing to a PR branch is already covered by pull_request above
|
||||||
|
branches: [main]
|
||||||
schedule:
|
schedule:
|
||||||
# also run a schedule everyday at 1 AM.
|
# also run a schedule everyday at 1 AM.
|
||||||
# this is to check that all dependencies are still available (see R/zzz.R)
|
# this is to check that all dependencies are still available (see R/zzz.R)
|
||||||
|
|||||||
6
.github/workflows/codecovr.yaml
vendored
6
.github/workflows/codecovr.yaml
vendored
@@ -28,10 +28,12 @@
|
|||||||
# ==================================================================== #
|
# ==================================================================== #
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: '**'
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
# run on every PR update (once per push)
|
||||||
branches: '**'
|
branches: '**'
|
||||||
|
push:
|
||||||
|
# only on main; PR pushes are already covered by pull_request above
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
name: code-coverage
|
name: code-coverage
|
||||||
|
|
||||||
|
|||||||
14
R/sir.R
14
R/sir.R
@@ -835,8 +835,7 @@ as.sir.data.frame <- function(x,
|
|||||||
message_(
|
message_(
|
||||||
"Assuming value", plural[1], " ",
|
"Assuming value", plural[1], " ",
|
||||||
vector_and(col_values, quotes = TRUE),
|
vector_and(col_values, quotes = TRUE),
|
||||||
" in column '", font_bold(col_specimen),
|
" in column ", paste0("{.field ", col_specimen, "}"), " reflect", plural[2], " ", plural[3], "urinary tract infection", plural[1],
|
||||||
"' reflect", plural[2], " ", plural[3], "urinary tract infection", plural[1],
|
|
||||||
".\n Use `as.sir(uti = FALSE)` to prevent this."
|
".\n Use `as.sir(uti = FALSE)` to prevent this."
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -975,7 +974,7 @@ as.sir.data.frame <- function(x,
|
|||||||
if (!all(x[, ab, drop = TRUE] %in% c("S", "SDD", "I", "R", "NI", NA), na.rm = TRUE)) {
|
if (!all(x[, ab, drop = TRUE] %in% c("S", "SDD", "I", "R", "NI", NA), na.rm = TRUE)) {
|
||||||
show_message <- TRUE
|
show_message <- TRUE
|
||||||
if (isTRUE(info)) {
|
if (isTRUE(info)) {
|
||||||
message_("Cleaning values in column '", font_bold(ab), "' (",
|
message_("Cleaning values in column ", paste0("{.field ", ab, "}"), " (",
|
||||||
ifelse(ab_coerced != toupper(ab), paste0(ab_coerced, ", "), ""),
|
ifelse(ab_coerced != toupper(ab), paste0(ab_coerced, ", "), ""),
|
||||||
ab_name(ab_coerced, tolower = TRUE, info = info), ")... ",
|
ab_name(ab_coerced, tolower = TRUE, info = info), ")... ",
|
||||||
appendLF = FALSE,
|
appendLF = FALSE,
|
||||||
@@ -985,7 +984,7 @@ as.sir.data.frame <- function(x,
|
|||||||
} else if (!is.sir(x.bak[, ab, drop = TRUE])) {
|
} else if (!is.sir(x.bak[, ab, drop = TRUE])) {
|
||||||
show_message <- TRUE
|
show_message <- TRUE
|
||||||
if (isTRUE(info)) {
|
if (isTRUE(info)) {
|
||||||
message_("Assigning class {.cls sir} to already clean column '", font_bold(ab), "' (",
|
message_("Assigning class {.cls sir} to already clean column ", paste0("{.field ", ab, "}"), " (",
|
||||||
ifelse(ab_coerced != toupper(ab), paste0(ab_coerced, ", "), ""),
|
ifelse(ab_coerced != toupper(ab), paste0(ab_coerced, ", "), ""),
|
||||||
ab_name(ab_coerced, tolower = TRUE, language = NULL, info = info), ")... ",
|
ab_name(ab_coerced, tolower = TRUE, language = NULL, info = info), ")... ",
|
||||||
appendLF = FALSE,
|
appendLF = FALSE,
|
||||||
@@ -2227,10 +2226,13 @@ check_reference_data <- function(reference_data, .call_depth) {
|
|||||||
class_sir <- vapply(FUN.VALUE = character(1), AMR::clinical_breakpoints, function(x) paste0("<", class(x), ">", collapse = " and "))
|
class_sir <- vapply(FUN.VALUE = character(1), AMR::clinical_breakpoints, function(x) paste0("<", class(x), ">", collapse = " and "))
|
||||||
class_ref <- vapply(FUN.VALUE = character(1), reference_data, function(x) paste0("<", class(x), ">", collapse = " and "))
|
class_ref <- vapply(FUN.VALUE = character(1), reference_data, function(x) paste0("<", class(x), ">", collapse = " and "))
|
||||||
if (!all(names(class_sir) == names(class_ref))) {
|
if (!all(names(class_sir) == names(class_ref))) {
|
||||||
stop_("{.arg reference_data} must have the same column names as the {.code clinical_breakpoints} data set.", call = .call_depth)
|
stop_("{.arg reference_data} must have the same column names as the {.topic [clinical_breakpoints](AMR::clinical_breakpoints)} data set.", call = .call_depth)
|
||||||
}
|
}
|
||||||
if (!all(class_sir == class_ref)) {
|
if (!all(class_sir == class_ref)) {
|
||||||
stop_("{.arg reference_data} must be the same structure as the {.code clinical_breakpoints} data set. Column '", names(class_ref[class_sir != class_ref][1]), "' is of class ", class_ref[class_sir != class_ref][1], ", but should be of class ", class_sir[class_sir != class_ref][1], ".", call = .call_depth)
|
bad_col <- names(class_ref[class_sir != class_ref][1])
|
||||||
|
bad_cls <- gsub("<|>", "", class_ref[class_sir != class_ref][1])
|
||||||
|
exp_cls <- gsub("<|>", "", class_sir[class_sir != class_ref][1])
|
||||||
|
stop_("{.arg reference_data} must be the same structure as the {.topic [clinical_breakpoints](AMR::clinical_breakpoints)} data set. Column ", paste0("{.field ", bad_col, "}"), " is of class ", paste0("{.cls ", bad_cls, "}"), ", but should be of class ", paste0("{.cls ", exp_cls, "}"), call = .call_depth)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user