mirror of
https://github.com/msberends/AMR.git
synced 2025-07-11 15:41:57 +02:00
new antibiotics
This commit is contained in:
@ -52,11 +52,11 @@ test_that("EUCAST rules work", {
|
||||
|
||||
a <- data.frame(mo = c("Staphylococcus aureus",
|
||||
"Streptococcus group A"),
|
||||
coli = "-", # Colistin
|
||||
COL = "-", # Colistin
|
||||
stringsAsFactors = FALSE)
|
||||
b <- data.frame(mo = c("Staphylococcus aureus",
|
||||
"Streptococcus group A"),
|
||||
coli = "R", # Colistin
|
||||
COL = "R", # Colistin
|
||||
stringsAsFactors = FALSE)
|
||||
expect_equal(suppressWarnings(eucast_rules(a, "mo", info = FALSE)), b)
|
||||
|
||||
@ -64,30 +64,30 @@ test_that("EUCAST rules work", {
|
||||
library(dplyr)
|
||||
expect_equal(suppressWarnings(
|
||||
septic_patients %>%
|
||||
mutate(tica = as.rsi("R"),
|
||||
pipe = as.rsi("S")) %>%
|
||||
mutate(TIC = as.rsi("R"),
|
||||
PIP = as.rsi("S")) %>%
|
||||
eucast_rules(col_mo = "mo") %>%
|
||||
left_join_microorganisms() %>%
|
||||
filter(family == "Enterobacteriaceae") %>%
|
||||
pull(pipe) %>%
|
||||
pull(PIP) %>%
|
||||
unique() %>%
|
||||
as.character()),
|
||||
"R")
|
||||
|
||||
# azit and clar must be equal to eryt
|
||||
# Azithromicin and Clarythromycin must be equal to Erythromycin
|
||||
a <- suppressWarnings(
|
||||
septic_patients %>%
|
||||
transmute(mo,
|
||||
eryt,
|
||||
azit = as.rsi("R"),
|
||||
clar = as.rsi("R")) %>%
|
||||
ERY,
|
||||
AZM = as.rsi("R"),
|
||||
CLR = as.rsi("R")) %>%
|
||||
eucast_rules(col_mo = "mo") %>%
|
||||
pull(clar))
|
||||
pull(CLR))
|
||||
b <- suppressWarnings(
|
||||
septic_patients %>%
|
||||
select(mo, eryt) %>%
|
||||
select(mo, ERY) %>%
|
||||
eucast_rules(col_mo = "mo") %>%
|
||||
pull(eryt))
|
||||
pull(ERY))
|
||||
|
||||
expect_identical(a[!is.na(b)],
|
||||
b[!is.na(b)])
|
||||
@ -97,15 +97,15 @@ test_that("EUCAST rules work", {
|
||||
suppressWarnings(
|
||||
as.list(eucast_rules(
|
||||
data.frame(mo = as.mo("Kingella kingae"),
|
||||
peni = "S",
|
||||
amox = "-",
|
||||
PEN = "S",
|
||||
AMX = "-",
|
||||
stringsAsFactors = FALSE)
|
||||
, info = FALSE))$amox
|
||||
, info = FALSE))$AMX
|
||||
),
|
||||
"S")
|
||||
|
||||
# also test norf
|
||||
expect_output(suppressWarnings(eucast_rules(septic_patients %>% mutate(norf = "S", nali = "S"))))
|
||||
expect_output(suppressWarnings(eucast_rules(septic_patients %>% mutate(NOR = "S", NAL = "S"))))
|
||||
|
||||
# check verbose output
|
||||
expect_output(suppressWarnings(eucast_rules(septic_patients, verbose = TRUE)))
|
||||
|
Reference in New Issue
Block a user