1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 00:43:00 +02:00

fix for Salmonella group A, unit tests

This commit is contained in:
2023-02-10 16:47:25 +01:00
parent bc434db835
commit 03294c7901
8 changed files with 20 additions and 16 deletions

View File

@ -94,7 +94,9 @@ TAXONOMY_VERSION <- list(
)
globalVariables(c(
".mo",
".rowid",
".syndromic_group",
"ab",
"ab_txt",
"affect_ab_name",
@ -105,8 +107,10 @@ globalVariables(c(
"atc_group1",
"atc_group2",
"base_ab",
"ci_min",
"bind_rows",
"ci_max",
"ci_min",
"clinical_breakpoints",
"code",
"cols",
"count",
@ -130,14 +134,15 @@ globalVariables(c(
"language",
"lookup",
"method",
"mic",
"mic ",
"mic",
"microorganism",
"microorganisms",
"microorganisms.codes",
"mo",
"name",
"new",
"numerator",
"observations",
"old",
"old_name",
@ -149,13 +154,14 @@ globalVariables(c(
"reference.rule_group",
"reference.version",
"rowid",
"sir",
"clinical_breakpoints",
"rule_group",
"rule_name",
"se_max",
"se_min",
"SI",
"sir",
"species",
"syndromic_group",
"total",
"txt",
"type",

View File

@ -165,7 +165,7 @@ bug_drug_combinations <- function(x,
out <- run_it(x)
}
rownames(out) <- NULL
out <- out %>% pm_arrange(mo, ab)
out <- out %pm>% pm_arrange(mo, ab)
out <- as_original_data_class(out, class(x.bak)) # will remove tibble groups
structure(out, class = c("bug_drug_combinations", ifelse(data_has_groups, "grouped", character(0)), class(out)))
}

8
R/mo.R
View File

@ -966,14 +966,14 @@ convert_colloquial_input <- function(x) {
out[x %like_case% "(viridans.* (strepto|^s).*|^vgs[^a-z]*$)"] <- "B_STRPT_VIRI"
# Salmonella in different languages, like "Salmonella grupo B"
out[x %like_case% "salmonella.* [bcd]$"] <- gsub(".*salmonella.* ([bcd])$",
out[x %like_case% "salmonella.* [abcd]$"] <- gsub(".*salmonella.* ([abcd])$",
"B_SLMNL_GRP\\U\\1",
x[x %like_case% "salmonella.* [bcd]$"],
x[x %like_case% "salmonella.* [abcd]$"],
perl = TRUE
)
out[x %like_case% "group [bcd] salmonella"] <- gsub(".*group ([bcd]) salmonella*",
out[x %like_case% "group [abcd] salmonella"] <- gsub(".*group ([abcd]) salmonella*",
"B_SLMNL_GRP\\U\\1",
x[x %like_case% "group [bcd] salmonella"],
x[x %like_case% "group [abcd] salmonella"],
perl = TRUE
)

View File

@ -69,9 +69,8 @@
#' @return
#' - An [integer] in case of [mo_year()]
#' - An [ordered factor][factor] in case of [mo_pathogenicity()]
#' - A [list] in case of [mo_taxonomy()], [mo_synonyms()] and [mo_info()]
#' - A [list] in case of [mo_taxonomy()], [mo_synonyms()], [mo_snomed()] and [mo_info()]
#' - A named [character] in case of [mo_url()]
#' - A [numeric] in case of [mo_snomed()]
#' - A [character] in all other cases
#' @export
#' @seealso Data set [microorganisms]