mirror of
https://github.com/msberends/AMR.git
synced 2026-11-15 22:20:47 +01:00
(v3.0.1.9125) Fix translations being translated again (e.g. Ticarcillinee, groupee) and untranslated parts of combination names, and let as.mo() recognise translated names in the set language, cached per language
This commit is contained in:
1 parent
d4ba5051e7
commit
04a2f0b3ac
9 files changed
+98
-35
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
||||
Package: AMR
|
||||
Version: 3.0.1.9124
|
||||
Version: 3.0.1.9125
|
||||
Date: 2026-10-12
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# AMR 3.0.1.9124
|
||||
# AMR 3.0.1.9125
|
||||
|
||||
Planned as v3.1.0, mid October 2026.
|
||||
|
||||
@@ -84,6 +84,8 @@ Planned as v3.1.0, mid October 2026.
|
||||
* Taxonomy: consistent higher taxonomy and parent records, and data sets refer only to current names (except `intrinsic_resistant`)
|
||||
* `antimicrobials`: trade names of combinations (Tazocin, Timentin, Recarbrio, Exblifep) were listed under a single component, and names of screening libraries and suppliers (e.g. Prestwick, Spectrum) as synonyms (#315)
|
||||
* WT, NWT, NS and NI results were handled incorrectly in `count_*()` and `proportion_*()` with multiple antimicrobials (#321)
|
||||
* Translations were translated again, e.g. "Ticarcillinee" in Dutch and "groupee" in French, and parts of combination names were left untranslated
|
||||
* `as.mo()` now recognises translated names in the set language, such as the output of `mo_name(x, language = "fr")`
|
||||
* `g.test()` returned the degrees of freedom as `argument` instead of `parameter`, so they were not printed
|
||||
* `antibiogram()` and `wisca()` failed without the `antimicrobials` argument if tidyselect was not available, e.g. for binary installations without dplyr
|
||||
* R could crash after unloading the `data.table` package, and suggested packages available on the machine that built the package were used even if not available to the user
|
||||
|
||||
@@ -98,6 +98,7 @@ reset_ab_cache <- function() {
|
||||
|
||||
reset_mo_cache <- function() {
|
||||
AMR_env$MO_index <- NULL
|
||||
AMR_env$MO_translated <- NULL
|
||||
AMR_env$mo_accepted <- NULL
|
||||
AMR_env$mo_previously_coerced <- new_coercion_cache()
|
||||
AMR_env$mo_previously_uncertain <- NULL
|
||||
@@ -132,3 +133,29 @@ get_mo_index <- function() {
|
||||
}
|
||||
AMR_env$MO_index
|
||||
}
|
||||
|
||||
get_mo_translated_index <- function(language) {
|
||||
# translated names of microorganisms, such as "Staphylocoque à coagulase négative (CoNS)", so that as.mo() recognises the output of mo_name() in that language
|
||||
# this is built once per language and only contains the few names that change by translation
|
||||
add_MO_lookup_to_AMR_env()
|
||||
if (is.null(AMR_env$MO_translated[[language]])) {
|
||||
trns <- TRANSLATIONS[which(TRANSLATIONS$affect_mo_name == TRUE), , drop = FALSE]
|
||||
fullname <- AMR_env$MO_lookup$fullname
|
||||
is_translatable <- grepl(paste0("(", paste(trns$pattern, collapse = "|"), ")"), fullname, perl = TRUE)
|
||||
fullname <- fullname[is_translatable]
|
||||
mo <- as.character(AMR_env$MO_lookup$mo[is_translatable])
|
||||
translated <- translate_into_language(fullname, language = language, only_affect_mo_names = TRUE)
|
||||
is_changed <- translated != fullname
|
||||
translated <- translated[is_changed]
|
||||
mo <- mo[is_changed]
|
||||
# also without the abbreviation, such as "(CoNS)"
|
||||
translated_short <- gsub(" +\\([^()]+\\)$", "", translated, perl = TRUE)
|
||||
name <- tolower(c(translated, translated_short))
|
||||
mo <- c(mo, mo)
|
||||
AMR_env$MO_translated[[language]] <- list(
|
||||
name = name[!duplicated(name)],
|
||||
mo = mo[!duplicated(name)]
|
||||
)
|
||||
}
|
||||
AMR_env$MO_translated[[language]]
|
||||
}
|
||||
@@ -247,6 +247,12 @@ as.mo <- function(x,
|
||||
out[is.na(out) & x_lower %in% AMR_env$MO_lookup$fullname_lower] <- AMR_env$MO_lookup$mo[match(x_lower[is.na(out) & x_lower %in% AMR_env$MO_lookup$fullname_lower], AMR_env$MO_lookup$fullname_lower)]
|
||||
# one exception: "Fungi" matches the domain, but instead it should return the 'unknown' code for fungi
|
||||
out[out == "F_[KNG]_FUNGI"] <- "F_FUNGUS"
|
||||
# From translated names, such as the output of mo_name() in the set language ----
|
||||
if (language != "en" && any(is.na(out) & !is.na(x))) {
|
||||
mo_translated <- get_mo_translated_index(language)
|
||||
ind <- is.na(out) & x_lower %in% mo_translated$name
|
||||
out[ind] <- mo_translated$mo[match(x_lower[ind], mo_translated$name)]
|
||||
}
|
||||
# From known codes ----
|
||||
ind <- is.na(out) & toupper(x) %in% AMR::microorganisms.codes$code
|
||||
out[ind] <- AMR::microorganisms.codes$mo[match(toupper(x)[ind], AMR::microorganisms.codes$code)]
|
||||
@@ -1167,6 +1173,8 @@ convert_colloquial_input <- function(x) {
|
||||
perl = TRUE
|
||||
)
|
||||
out[x %like_case% "ha?emoly.*strep"] <- "B_STRPT_HAEM"
|
||||
# also in other word orders, like "streptocoque beta-hemolytique"
|
||||
out[x %like_case% "strep.*(beta|b\u00eata|\u03b2).?h(a?e|\u00e9)moly"] <- "B_STRPT_HAEM"
|
||||
out[x %like_case% "(strepto.* [abcg, ]{2,4}$)"] <- "B_STRPT_ABCG"
|
||||
out[x %like_case% "(strepto.* mil+er+i|^mgs[^a-z]*$)"] <- "B_STRPT_MILL"
|
||||
out[x %like_case% "mil+er+i gr"] <- "B_STRPT_MILL"
|
||||
@@ -1188,8 +1196,8 @@ convert_colloquial_input <- function(x) {
|
||||
perl = TRUE
|
||||
)
|
||||
|
||||
# CoNS/CoPS in different languages (support for German, Dutch, Spanish, Portuguese)
|
||||
out[x %like_case% "([ck]oagulas[ea].negatie?[vf]|^[ck]o?ns[^a-z]*$)"] <- "B_STPHY_CONS"
|
||||
# CoNS/CoPS in different languages (support for German, Dutch, French, Spanish, Portuguese)
|
||||
out[x %like_case% "([ck]oagulas[ea].n[e\u00e9]gatie?[vf]|^[ck]o?ns[^a-z]*$)"] <- "B_STPHY_CONS"
|
||||
out[x %like_case% "([ck]oagulas[ea].positie?[vf]|^[ck]o?ps[^a-z]*$)"] <- "B_STPHY_COPS"
|
||||
|
||||
# Gram stains
|
||||
|
||||
Binary file not shown.
+31
-27
@@ -203,26 +203,6 @@ translate_into_language <- function(from,
|
||||
df_trans <- TRANSLATIONS # internal data file
|
||||
from.bak <- from
|
||||
from_unique <- unique(from)
|
||||
from_split_combined <- function(vec) {
|
||||
sapply(vec, function(x) {
|
||||
if (grepl("/", x, fixed = TRUE)) {
|
||||
parts <- strsplit(x, "/", fixed = TRUE)[[1]]
|
||||
# Translate each part separately
|
||||
translated_parts <- translate_into_language(
|
||||
parts,
|
||||
language = lang,
|
||||
only_unknown = only_unknown,
|
||||
only_affect_ab_names = only_affect_ab_names,
|
||||
only_affect_mo_names = only_affect_mo_names
|
||||
)
|
||||
paste(translated_parts, collapse = "/")
|
||||
} else {
|
||||
x
|
||||
}
|
||||
}, USE.NAMES = FALSE)
|
||||
}
|
||||
from_unique_translated <- from_split_combined(from_unique)
|
||||
|
||||
# only keep lines where translation is available for this language
|
||||
df_trans <- df_trans[which(!is.na(df_trans[, lang, drop = TRUE])), , drop = FALSE]
|
||||
# and where the original string is not equal to the string in the target language
|
||||
@@ -263,26 +243,50 @@ translate_into_language <- function(from,
|
||||
df_trans$pattern[df_trans$regular_expr == TRUE] <- gsub("$$", "$", df_trans$pattern[df_trans$regular_expr == TRUE], fixed = TRUE)
|
||||
}
|
||||
|
||||
# non-regex part
|
||||
# sort trans file on length of pattern, so that the longest pattern is replaced first (word boundaries of regular expressions do not count)
|
||||
trns <- df_trans[order(nchar(gsub("\\b", "", df_trans$pattern, fixed = TRUE)), decreasing = TRUE), , drop = FALSE]
|
||||
# every translation is first replaced by a placeholder, so that a translation is never translated again, e.g. "Ticarcillin" to "Ticarcilline" and then to "Ticarcillinee"
|
||||
# placeholders consist of ASCII control characters only, so that no pattern can match them
|
||||
control_chars <- vapply(FUN.VALUE = character(1), 3:31, function(i) rawToChar(as.raw(i)))
|
||||
placeholders <- paste0("\001", control_chars[(seq_len(nrow(trns)) - 1) %/% length(control_chars) %/% length(control_chars) + 1], control_chars[(seq_len(nrow(trns)) - 1) %/% length(control_chars) %% length(control_chars) + 1], control_chars[(seq_len(nrow(trns)) - 1) %% length(control_chars) + 1], "\002")
|
||||
replacements <- trns[, lang, drop = TRUE]
|
||||
# keep backreferences like "\\1" of regular expressions outside the placeholder
|
||||
literals <- gsub("\\\\[0-9]", "", replacements)
|
||||
replacements_placeholder <- ifelse(
|
||||
literals == "",
|
||||
replacements,
|
||||
vapply(FUN.VALUE = character(1), seq_along(replacements), function(i) sub(literals[i], placeholders[i], replacements[i], fixed = TRUE))
|
||||
)
|
||||
translate_exec <- function(term) {
|
||||
# sort trans file on length of pattern
|
||||
trns <- df_trans[order(nchar(df_trans$pattern), decreasing = TRUE), ]
|
||||
for (i in seq_len(nrow(trns))) {
|
||||
term <- gsub(
|
||||
pattern = trns$pattern[i],
|
||||
replacement = trns[i, lang, drop = TRUE],
|
||||
replacement = replacements_placeholder[i],
|
||||
x = term,
|
||||
ignore.case = !trns$case_sensitive[i] & trns$regular_expr[i],
|
||||
fixed = !trns$regular_expr[i],
|
||||
perl = trns$regular_expr[i],
|
||||
perl = trns$regular_expr[i]
|
||||
)
|
||||
}
|
||||
for (i in which(vapply(FUN.VALUE = logical(1), placeholders, grepl, x = term, fixed = TRUE))) {
|
||||
term <- gsub(placeholders[i], literals[i], term, fixed = TRUE)
|
||||
}
|
||||
term
|
||||
}
|
||||
from_unique_translated[order(nchar(from_unique_translated), decreasing = TRUE)] <- vapply(
|
||||
|
||||
from_unique_translated <- from_unique
|
||||
# combinations like "Ticarcillin/clavulanic acid" are translated per part, unless the combination itself is in the translations
|
||||
is_combination <- grepl("/", from_unique, fixed = TRUE) & !from_unique %in% df_trans$pattern
|
||||
from_unique_translated[is_combination] <- vapply(
|
||||
FUN.VALUE = character(1),
|
||||
USE.NAMES = FALSE,
|
||||
from_unique_translated[order(nchar(from_unique_translated), decreasing = TRUE)],
|
||||
strsplit(from_unique[is_combination], "/", fixed = TRUE),
|
||||
function(parts) paste(translate_into_language(parts, language = lang, only_unknown = only_unknown, only_affect_ab_names = only_affect_ab_names, only_affect_mo_names = only_affect_mo_names), collapse = "/")
|
||||
)
|
||||
from_unique_translated[!is_combination] <- vapply(
|
||||
FUN.VALUE = character(1),
|
||||
USE.NAMES = FALSE,
|
||||
from_unique[!is_combination],
|
||||
translate_exec
|
||||
)
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ unknown species TRUE TRUE FALSE TRUE unknown species نوع غير معروف
|
||||
unknown subspecies TRUE TRUE FALSE TRUE unknown subspecies نوع فرعي غير معروف অজানা উপপ্রজাতি 未知亚种 neznámý poddruh ukendt underart onbekende ondersoort tuntematon alalaji sous-espèce inconnue unbekannte Unterart άγνωστο υποείδος अज्ञात उप-प्रजाति Subspesies tidak diketahui sottospecie sconosciute 亜種不明 알 수 없는 아종 ukjent underart nieznany podgatunek subespécies desconhecida subspecie necunoscută неизвестный подвид subespecie desconocida Aina ndogo isiyojulikana okänd underart bilinmeyen alt türler невідомий підвид نامعلوم ذیلی نوع Phân loài chưa xác định
|
||||
unknown rank TRUE TRUE FALSE TRUE unknown rank رتبة غير معروفة অজানা র্যাঙ্ক 未知等级 neznámý stupeň ukendt rang onbekende rang tuntematon sukuluokka rang inconnu unbekannter Rang άγνωστη τάξη अज्ञात रैंक Peringkat tidak diketahui grado sconosciuto 未知ランク 알 수 없는 계급 ukjent rang nieznany stopień classificação desconhecido rang necunoscut неизвестный ранг rango desconocido Daraja isiyojulikana okänd rang bilinmeyen rütbe невідомий ранг نامعلوم درجہ Bậc phân loại chưa xác định
|
||||
unknown FALSE TRUE FALSE FALSE unknown غير معروف অজানা 未知 neznámý ukendt onbekend tuntematon inconnu unbekannt άγνωστο अज्ञात Tidak diketahui sconosciuto 未知 알 수 없음 ukjent nieznany desconhecido necunoscut неизвестно desconocido Haijulikani okänd bilinmiyor невідомий نامعلوم Không xác định
|
||||
group TRUE TRUE FALSE TRUE group مجموعة গ্রুপ 组 skupina gruppe groep ryhmä groupe Gruppe ομάδα समूह grup gruppo グループ 그룹 gruppe grupa grupo grup группа grupo kundi grupp Grup група گروپ nhóm
|
||||
Group TRUE TRUE FALSE TRUE Group مجموعة গ্রুপ 组 Skupina Gruppe groep Ryhmä groupe Gruppe Ομάδα समूह Grup Gruppo グループ 그룹 Gruppe Grupa Grupo Grup Группа Grupo Kundi Grupp Grup Група گروپ Nhóm
|
||||
\\bgroup\\b TRUE TRUE FALSE TRUE group مجموعة গ্রুপ 组 skupina gruppe groep ryhmä groupe Gruppe ομάδα समूह grup gruppo グループ 그룹 gruppe grupa grupo grup группа grupo kundi grupp Grup група گروپ nhóm
|
||||
\\bGroup\\b TRUE TRUE FALSE TRUE Group مجموعة গ্রুপ 组 Skupina Gruppe groep Ryhmä groupe Gruppe Ομάδα समूह Grup Gruppo グループ 그룹 Gruppe Grupa Grupo Grup Группа Grupo Kundi Grupp Grup Група گروپ Nhóm
|
||||
CoNS FALSE TRUE FALSE TRUE CoNS المكورات العنقودية سالبة التخثر কোয়াগুলেজ-নেগেটিভ স্ট্যাফিলোকক্কাস KNS KNS CNS KNS KNS CoNS कोएनएस (CoNS) Stafilokokus koagulase-negatif グラム陰性 코아귤라제 음성 포도상구균 KNS CoNS SCN КОС SCN KNS KNS КНС کواگولیز منفی اسٹیفیلوکوکس Staphylococcus âm tính coagulase
|
||||
CoPS FALSE TRUE FALSE TRUE CoPS المكورات العنقودية موجبة التخثر কোয়াগুলেজ-পজিটিভ স্ট্যাফিলোকক্কাস KPS KPS CPS KPS KPS CoPS कोपीएस (CoPS) Stafilokokus koagulase-positif グラム陽性 코아귤라제 양성 포도상구균 KPS CoPS SCP КПС SCP KPS KPS КПС کواگولیز مثبت اسٹیفیلوکوکس Staphylococcus dương tính coagulase
|
||||
Gram-negative TRUE TRUE FALSE FALSE Gram-negative سالبة الجرام গ্রাম-নেগেটিভ 革兰氏阴性 Gramnegativní Gram-negativ Gram-negatief Gramnegatiiviset Gram négatif Gramnegativ Αρνητικό κατά Gram ग्राम-ऩेगेटिव Gram-negatif Gram negativo ^細菌$ 그람 음성 Gram-negativ Gram-ujemne Gram negativo Gram-negativ Грамотрицательные Gram negativo Gram hasi Gram-negativ Gram-negatif Грамнегативні گرام منفی Gram âm
|
||||
@@ -35,8 +35,8 @@ Gram-positive TRUE TRUE FALSE FALSE Gram-positive موجبة الجرام গ্
|
||||
biogroup TRUE TRUE FALSE FALSE biogroup مجموعة حيوية জীববৈচিত্র্য দল 生物群 bioskupina biogruppe biogroep Bioryhmä biogroupe Biogruppe βιοομάδα बायोग्रुप Grup biologi biogruppo 植物型 생물학적 그룹 biogruppe biogrupa biogrupo biogrupul биогруппа biogrupo Kundi la kibaolojia biogrupp biyogrup біогрупа حیاتیاتی گروپ Nhóm sinh học
|
||||
biotype TRUE TRUE FALSE FALSE biotype النمط الحيوي জীববৈচিত্র্য ধরন 生物型 biotyp biotype biotyyppi Biotyp βιότυπος बायोटाइप Biotipe biotipo ([([ ]*?))) グループ 생물형 biotype biotyp biótipo biotip биотип biotipo Aina ya kibaolojia biotyp biyotip біотип حیاتیاتی قسم Kiểu sinh học
|
||||
vegetative TRUE TRUE FALSE FALSE vegetative نباتي/خضري উদ্ভিদীয় 无性系 vegetativní vegetativ vegetatief kasvullinen végétatif vegetativ βλαστικός वनस्पतिक/शरीरिक Vegetatif vegetativo ([[ ]*?)グループ 영양체 vegetativ wegetatywna vegetativo vegetativ вегетативный vegetativo Mkavu/mbegu inayoota vegetativ vejetatif вегетативний نباتاتی Sinh dưỡng
|
||||
([([ ]*?)group TRUE TRUE FALSE FALSE \\1group \\1 مجموعة \\1গ্রুপ ([([]*?)组 \\1skupina \\1gruppe \\1groep \\1ryhmä \\1groupe \\1Gruppe ([([ ]*?)ομάδα \\1समूह \\1grup \\1gruppo \\1グループ \\1그룹 \\1gruppe ([([ ]*?)grupa \\1grupo \\1grup \\1группа \\1grupo \\1 kundi \\1grupp ([([ ]*?)grup \\1група \\1گروپ \\1nhóm
|
||||
([([ ]*?)Group TRUE TRUE FALSE FALSE \\1Group \\1 مجموعة \\1গ্রুপ ([([]*?)组 \\1Skupina \\1Gruppe \\1Groep \\1Ryhmä \\1Groupe \\1Gruppe ([([ ]*;)ομάδα \\1समूह \\1Grup \\1Gruppo \\1グループ \\1그룹 \\1Gruppe ([([ ]*?)Grupa \\1Grupo \\1Grup \\1Группа \\1Grupo \\1 Kundi \\1Grupp ([([ ]*?)Grup \\1Група \\1گروپ \\1Nhóm
|
||||
([([ ]*?)group\\b TRUE TRUE FALSE FALSE \\1group \\1 مجموعة \\1গ্রুপ ([([]*?)组 \\1skupina \\1gruppe \\1groep \\1ryhmä \\1groupe \\1Gruppe ([([ ]*?)ομάδα \\1समूह \\1grup \\1gruppo \\1グループ \\1그룹 \\1gruppe ([([ ]*?)grupa \\1grupo \\1grup \\1группа \\1grupo \\1 kundi \\1grupp ([([ ]*?)grup \\1група \\1گروپ \\1nhóm
|
||||
([([ ]*?)Group\\b TRUE TRUE FALSE FALSE \\1Group \\1 مجموعة \\1গ্রুপ ([([]*?)组 \\1Skupina \\1Gruppe \\1Groep \\1Ryhmä \\1Groupe \\1Gruppe ([([ ]*;)ομάδα \\1समूह \\1Grup \\1Gruppo \\1グループ \\1그룹 \\1Gruppe ([([ ]*?)Grupa \\1Grupo \\1Grup \\1Группа \\1Grupo \\1 Kundi \\1Grupp ([([ ]*?)Grup \\1Група \\1گروپ \\1Nhóm
|
||||
no .*growth FALSE FALSE FALSE FALSE no .*growth لا يوجد نمو কোনও বৃদ্ধি নেই 无.*生长 žádný .*růst ingen .*vækst geen .*groei ei .*kasvua pas .*croissance keine(|n|m|r|s)|nicht .*wachstum όχι .*αύξηση कोई वृद्धि नहीं Tidak ada pertumbuhan sem .*crescimento 成長なし 성장 없음 nei .*vekst brak .*wzrostu sem .*crescimento fără creștere отсутствие.*роста no .*crecimientonon Hakuna ukuaji ingen .*tillväxt büyüme yok відсутність .*росту کسی قسم کی افزائش نہیں Không có phát triển
|
||||
no|not FALSE FALSE FALSE FALSE no|not لا না|নয় 不|不 ne nej|ikke geen|niet ei non keine? no|not नहीं tidak|bukan sem no|ない 없음 nei|ikke nie|nie sem nu нет? no|sin hapana nej|inte hayır|değil|hayir|degil ні نہیں|نہ không
|
||||
Intermediate TRUE FALSE FALSE FALSE Intermediate متوسط মধ্যবর্তী 中级 Meziprodukt Mellemliggende Intermediair Väliaikainen Intermédiaire Mittlere Ενδιάμεση मध्यम Intermediat Intermedio 中間体 중간 Mellomliggende Pośrednia Intermediário Intermediar Проміжний Intermedio Kati Mellanliggande Orta seviye Знижена чутливість درمیانی Trung gian
|
||||
|
||||
|
@@ -365,4 +365,14 @@ test_that("test-mo.R", {
|
||||
c("B_SLMNL_TYPH", "B_SLMNL_TYPH", "B_SLMNL_TYPH", "B_SLMNL_HMRM", "B_SLMNL_PRTA", "B_SLMNL_GRPB")
|
||||
)
|
||||
expect_identical(as.character(as.mo("Salmonella enterica arizonae", info = FALSE)), "B_SLMNL_ENTR_ARZN")
|
||||
|
||||
# translated names, such as the output of mo_name() in the set language
|
||||
translated_mos <- c("B_STPHY_CONS", "B_STPHY_COPS", "B_STRPT_HAEM", "B_STRPT_GRPA", "B_STRPT_GRPB", "B_STRPT_ABCG", "B_STRPT_MILL", "B_STRPT_VIRI", "B_SLMNL_GRPB", "B_GRAMN", "B_GRAMP", "F_YEAST", "F_FUNGUS", "P_PROTOZOAN", "UNKNOWN")
|
||||
for (lang in setdiff(AMR:::LANGUAGES_SUPPORTED, "en")) {
|
||||
expect_identical(as.character(as.mo(mo_name(translated_mos, language = lang), language = lang, info = FALSE)), translated_mos, info = lang)
|
||||
}
|
||||
expect_identical(
|
||||
as.character(as.mo(c("Staphylocoque à coagulase négative", "Streptocoque Bêta-hémolytique", "streptocoque beta-hemolytique", "Streptococcus groupe A"), language = "fr", info = FALSE)),
|
||||
c("B_STPHY_CONS", "B_STRPT_HAEM", "B_STRPT_HAEM", "B_STRPT_GRPA")
|
||||
)
|
||||
})
|
||||
@@ -54,4 +54,16 @@ test_that("test-translate.R", {
|
||||
expect_identical(mo_fullname("CoNS", "zh"), "凝固酶阴性葡萄球菌 (CoNS)")
|
||||
|
||||
expect_error(mo_fullname("CoNS", "aa"))
|
||||
|
||||
# a translation is never translated again, such as "Ticarcillin" to "Ticarcilline" and then to "Ticarcillinee"
|
||||
expect_identical(ab_name("TCC", language = "nl"), "Ticarcilline/clavulaanzuur")
|
||||
expect_identical(ab_name("TCC", language = "fr"), "Ticarcilline/acide clavulanique")
|
||||
expect_identical(ab_name(c("RIF", "PEN"), language = "it"), c("Rifampicina", "Benzilpenicillina"))
|
||||
expect_identical(ab_name("AKF", language = "nl"), "Amikacine/fosfomycin")
|
||||
expect_identical(AMR:::translate_into_language(c("Syndromic Group", "Streptococcus Group A", "Salmonella group B", "biogroup 1"), language = "fr"), c("Groupe syndromique", "Streptococcus Groupe A", "Salmonella groupe B", "biogroupe 1"))
|
||||
expect_identical(mo_name(c("B_STRPT_GRPA", "B_SLMNL_GRPB"), language = "fr"), c("Streptococcus groupe A", "Salmonella groupe B"))
|
||||
for (lang in setdiff(AMR:::LANGUAGES_SUPPORTED, "en")) {
|
||||
translated <- AMR:::translate_into_language(AMR::antimicrobials$name, language = lang, only_affect_ab_names = TRUE)
|
||||
expect_false(any(translated %like_case% "(cillinee|mycinee|cinaa|cillinaa)"), info = lang)
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user