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

Becker classification

Lancefield classification
Added Lancefield groups to `microorganisms` data set
This commit is contained in:
2018-08-02 13:15:45 +02:00
parent edd2dd09dc
commit 6262315527
10 changed files with 161 additions and 26 deletions

View File

@ -30,6 +30,33 @@ test_that("as.bactid works", {
"VISA"))),
rep("STAAUR", 8))
# check for Becker classification
expect_identical(as.character(guess_bactid("S. epidermidis", Becker = FALSE)), "STAEPI")
expect_identical(as.character(guess_bactid("S. epidermidis", Becker = TRUE)), "STACNS")
expect_identical(as.character(guess_bactid("STAEPI", Becker = TRUE)), "STACNS")
expect_identical(as.character(guess_bactid("S. intermedius", Becker = FALSE)), "STAINT")
expect_identical(as.character(guess_bactid("S. intermedius", Becker = TRUE)), "STACPS")
expect_identical(as.character(guess_bactid("STAINT", Becker = TRUE)), "STACPS")
# aureus must only be influenced if Becker = "all"
expect_identical(as.character(guess_bactid("STAAUR", Becker = FALSE)), "STAAUR")
expect_identical(as.character(guess_bactid("STAAUR", Becker = TRUE)), "STAAUR")
expect_identical(as.character(guess_bactid("STAAUR", Becker = "all")), "STACPS")
# check for Lancefield classification
expect_identical(as.character(guess_bactid("S. pyogenes", Lancefield = FALSE)), "STCPYO")
expect_identical(as.character(guess_bactid("S. pyogenes", Lancefield = TRUE)), "STCGRA")
expect_identical(as.character(guess_bactid("STCPYO", Lancefield = TRUE)), "STCGRA")
expect_identical(as.character(guess_bactid("S. agalactiae", Lancefield = FALSE)), "STCAGA")
expect_identical(as.character(guess_bactid("S. agalactiae", Lancefield = TRUE)), "STCGRB") # group B
expect_identical(as.character(guess_bactid("S. equisimilis", Lancefield = FALSE)), "STCEQS")
expect_identical(as.character(guess_bactid("S. equisimilis", Lancefield = TRUE)), "STCGRC") # group C
expect_identical(as.character(guess_bactid("S. anginosus", Lancefield = FALSE)), "STCANG")
expect_identical(as.character(guess_bactid("S. anginosus", Lancefield = TRUE)), "STCGRF") # group F
expect_identical(as.character(guess_bactid("S. sanguis", Lancefield = FALSE)), "STCSAN")
expect_identical(as.character(guess_bactid("S. sanguis", Lancefield = TRUE)), "STCGRH") # group H
expect_identical(as.character(guess_bactid("S. salivarius", Lancefield = FALSE)), "STCSAL")
expect_identical(as.character(guess_bactid("S. salivarius", Lancefield = TRUE)), "STCGRK") # group K
# select with one column
expect_identical(
septic_patients[1:10,] %>%

View File

@ -1,7 +1,7 @@
context("first_isolate.R")
test_that("first isolates work", {
# septic_patients contains 1959 out of 2000 first isolates
# septic_patients contains 1331 out of 2000 first isolates
expect_equal(
sum(
first_isolate(tbl = septic_patients,
@ -10,9 +10,9 @@ test_that("first isolates work", {
col_bactid = "bactid",
info = TRUE),
na.rm = TRUE),
1326)
1331)
# septic_patients contains 1962 out of 2000 first *weighted* isolates
# septic_patients contains 1426 out of 2000 first *weighted* isolates
expect_equal(
suppressWarnings(
sum(
@ -24,8 +24,8 @@ test_that("first isolates work", {
type = "keyantibiotics",
info = TRUE),
na.rm = TRUE)),
1421)
# and 1961 when using points
1426)
# and 1430 when using points
expect_equal(
suppressWarnings(
sum(
@ -37,9 +37,9 @@ test_that("first isolates work", {
type = "points",
info = TRUE),
na.rm = TRUE)),
1425)
1430)
# septic_patients contains 1732 out of 2000 first non-ICU isolates
# septic_patients contains 1176 out of 2000 first non-ICU isolates
expect_equal(
sum(
first_isolate(septic_patients,
@ -50,7 +50,7 @@ test_that("first isolates work", {
info = TRUE,
icu_exclude = TRUE),
na.rm = TRUE),
1171)
1176)
# set 1500 random observations to be of specimen type 'Urine'
random_rows <- sample(x = 1:2000, size = 1500, replace = FALSE)