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

(v0.7.1.9063) septic_patients -> example_isolates

This commit is contained in:
2019-08-27 16:45:42 +02:00
parent 7a6fce4eb8
commit 93be16484b
92 changed files with 1143 additions and 818 deletions

View File

@ -30,15 +30,15 @@ test_that("EUCAST rules work", {
"then_change_these_antibiotics", "to_value",
"reference.rule", "reference.rule_group"))
expect_error(suppressWarnings(eucast_rules(septic_patients, col_mo = "Non-existing")))
expect_error(suppressWarnings(eucast_rules(example_isolates, col_mo = "Non-existing")))
expect_error(eucast_rules(x = "text"))
expect_error(eucast_rules(data.frame(a = "test")))
expect_error(eucast_rules(data.frame(mo = "test"), rules = "invalid rules set"))
expect_warning(eucast_rules(data.frame(mo = "Escherichia coli", vancomycin = "S")))
expect_identical(colnames(septic_patients),
colnames(suppressWarnings(eucast_rules(septic_patients))))
expect_identical(colnames(example_isolates),
colnames(suppressWarnings(eucast_rules(example_isolates))))
a <- data.frame(mo = c("Klebsiella pneumoniae",
"Pseudomonas aeruginosa",
@ -66,7 +66,7 @@ test_that("EUCAST rules work", {
# piperacillin must be R in Enterobacteriaceae when tica is R
library(dplyr)
expect_equal(suppressWarnings(
septic_patients %>%
example_isolates %>%
mutate(TIC = as.rsi("R"),
PIP = as.rsi("S")) %>%
eucast_rules(col_mo = "mo") %>%
@ -79,7 +79,7 @@ test_that("EUCAST rules work", {
# Azithromicin and Clarythromycin must be equal to Erythromycin
a <- suppressWarnings(
septic_patients %>%
example_isolates %>%
transmute(mo,
ERY,
AZM = as.rsi("R"),
@ -87,7 +87,7 @@ test_that("EUCAST rules work", {
eucast_rules(col_mo = "mo") %>%
pull(CLR))
b <- suppressWarnings(
septic_patients %>%
example_isolates %>%
select(mo, ERY) %>%
eucast_rules(col_mo = "mo") %>%
pull(ERY))
@ -108,9 +108,9 @@ test_that("EUCAST rules work", {
"S")
# also test norf
expect_output(suppressWarnings(eucast_rules(septic_patients %>% mutate(NOR = "S", NAL = "S"))))
expect_output(suppressWarnings(eucast_rules(example_isolates %>% mutate(NOR = "S", NAL = "S"))))
# check verbose output
expect_output(suppressWarnings(eucast_rules(septic_patients, verbose = TRUE)))
expect_output(suppressWarnings(eucast_rules(example_isolates, verbose = TRUE)))
})