1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-24 18:46:14 +01:00

fix for Salmonella group A, unit tests

This commit is contained in:
dr. M.S. (Matthijs) Berends 2023-02-10 16:47:25 +01:00
parent bc434db835
commit 03294c7901
8 changed files with 20 additions and 16 deletions

View File

@ -1,5 +1,5 @@
Package: AMR
Version: 1.8.2.9114
Version: 1.8.2.9115
Date: 2023-02-10
Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR)

View File

@ -1,4 +1,4 @@
# AMR 1.8.2.9114
# AMR 1.8.2.9115
*(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)*

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]

View File

@ -163,7 +163,7 @@ expect_identical(mo_current(c("Escherichia blattae", "Escherichia coli")),
expect_identical(mo_ref("Chlamydia psittaci"), "Garcia-Lopez et al., 2019")
expect_identical(mo_ref("Chlamydophila psittaci", keep_synonyms = TRUE), "Everett et al., 1999")
expect_true(112283007 %in% mo_snomed("Escherichia coli"))
expect_true(112283007 %in% mo_snomed("Escherichia coli")[[1]])
# old codes must throw a warning in mo_* family
expect_warning(mo_name(c("B_ESCHR_COL", "B_STPHY_AUR")))
# outcome of mo_fullname must always return the fullname from the data set

View File

@ -284,9 +284,8 @@ mo_property(
\itemize{
\item An \link{integer} in case of \code{\link[=mo_year]{mo_year()}}
\item An \link[=factor]{ordered factor} in case of \code{\link[=mo_pathogenicity]{mo_pathogenicity()}}
\item A \link{list} in case of \code{\link[=mo_taxonomy]{mo_taxonomy()}}, \code{\link[=mo_synonyms]{mo_synonyms()}} and \code{\link[=mo_info]{mo_info()}}
\item A \link{list} in case of \code{\link[=mo_taxonomy]{mo_taxonomy()}}, \code{\link[=mo_synonyms]{mo_synonyms()}}, \code{\link[=mo_snomed]{mo_snomed()}} and \code{\link[=mo_info]{mo_info()}}
\item A named \link{character} in case of \code{\link[=mo_url]{mo_url()}}
\item A \link{numeric} in case of \code{\link[=mo_snomed]{mo_snomed()}}
\item A \link{character} in all other cases
}
}