1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 23:21:56 +02:00

(v1.3.0.9035) mdro() for EUCAST 3.2, examples cleanup

This commit is contained in:
2020-09-29 23:35:46 +02:00
parent 68e6e1e329
commit 4e0374af29
94 changed files with 1143 additions and 1165 deletions

View File

@ -66,6 +66,8 @@ test_that("creation of data sets is valid", {
expect_true(all(c("fullname", "fullname_new", "ref", "prevalence",
"fullname_lower", "g_species") %in% colnames(olddf)))
expect_s3_class(create_species_cons_cops("CoNS"), "mo")
})
test_that("CoL version info works", {

View File

@ -31,14 +31,16 @@ test_that("mdro works", {
expect_error(mdro(example_isolates, col_mo = "invalid", info = TRUE))
outcome <- suppressWarnings(mdro(example_isolates))
outcome <- mdro(example_isolates, "eucast3.1", info = TRUE)
outcome <- eucast_exceptional_phenotypes(example_isolates, info = TRUE)
# check class
expect_equal(outcome %>% class(), c("ordered", "factor"))
expect_equal(class(outcome), c("ordered", "factor"))
outcome <- mdro(example_isolates, "nl", info = TRUE)
# check class
expect_equal(outcome %>% class(), c("ordered", "factor"))
expect_equal(class(outcome), c("ordered", "factor"))
library(dplyr)
# example_isolates should have these finding using Dutch guidelines
expect_equal(outcome %>% cleaner::freq() %>% pull(count),
c(1969, 25, 6)) # 1969 neg, 25 unconfirmed, 6 pos

View File

@ -84,18 +84,20 @@ test_that("mic2rsi works", {
skip_on_cran()
# S. pneumoniae/ampicillin in EUCAST 2020: 0.5-2 ug/ml (R is only > 2)
expect_equal(as.character(
as.rsi(x = as.mic(0.125),
mo = "B_STRPT_PNMN",
ab = "AMX",
guideline = "EUCAST")),
"S")
as.rsi(x = as.mic(c(0.125, 0.5, 1, 2, 4)),
mo = "B_STRPT_PNMN",
ab = "AMP",
guideline = "EUCAST 2020")),
c("S", "S", "I", "I", "R"))
# S. pneumoniae/amoxicillin in CLSI 2019: 2-8 ug/ml (R is 8 and > 8)
expect_equal(as.character(
as.rsi(x = as.mic(4),
as.rsi(x = as.mic(c(1, 2, 4, 8, 16)),
mo = "B_STRPT_PNMN",
ab = "AMX",
guideline = "EUCAST")),
"I")
guideline = "CLSI 2019")),
c("S", "S", "I", "R", "R"))
# cutoffs at MIC = 8
expect_equal(as.rsi(as.mic(2), "E. coli", "ampicillin", guideline = "EUCAST 2020"),