(v3.0.1.9106) Fix trade names of combinations filed under a single agent, and remove non-synonyms from antimicrobials (#315)

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2026-10-09 22:25:44 +02:00
1 parent 891d248fab
commit 9e05fe184b
15 files changed
+55 -20

No files matched your search

+18
View File
@@ -615,3 +615,21 @@ test_that("antimicrobials: unique and well-formed", {
loinc <- loinc[!is.na(loinc) & loinc != ""]
expect_true(all(loinc %like_case% "^[0-9]+-[0-9]$"), info = paste(utils::head(loinc[loinc %unlike_case% "^[0-9]+-[0-9]$"], 20), collapse = ", "))
})
test_that("antimicrobials: synonyms are unambiguous and filed under the right agent", {
skip_on_cran()
ab <- AMR::antimicrobials
syn <- data.frame(ab = rep(as.character(ab$ab), lengths(ab$synonyms)), synonym = unlist(ab$synonyms), stringsAsFactors = FALSE)
syn <- syn[!is.na(syn$synonym), , drop = FALSE]
# a synonym must not belong to more than one agent
dups <- unique(syn$synonym[duplicated(syn$synonym)])
expect_identical(length(dups), 0L, info = paste(dups, collapse = ", "))
# trade names of combinations belong to the combination, not to one of its components (#315)
expect_identical(
as.character(as.ab(c("Tazocin", "Zosyn", "Timentin", "Recarbrio", "Exblifep", "Augmentin", "Bactrim"))),
c("TZP", "TZP", "TCC", "IMR", "FPE", "AMC", "SXT")
)
# names of screening libraries, suppliers and chemical fragments are no synonyms (#315)
expect_false(any(c("lopac", "nbleomycinamide", "pharmakon", "prestwick", "spectrum", "spiro", "tocris") %in% syn$synonym))
expect_false("AMA" %in% as.character(unlist(ab_from_text("Patient started on broad spectrum antibiotics"))))
})