mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 15:26:12 +01:00
(v2.1.1.9058) fix hosts, add translations
This commit is contained in:
parent
a4dc37a4e4
commit
1bc2e04e1c
@ -1,5 +1,5 @@
|
||||
Package: AMR
|
||||
Version: 2.1.1.9057
|
||||
Version: 2.1.1.9058
|
||||
Date: 2024-06-17
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
||||
# AMR 2.1.1.9057
|
||||
# AMR 2.1.1.9058
|
||||
|
||||
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://msberends.github.io/AMR/#latest-development-version).)*
|
||||
|
||||
|
50
R/sir.R
50
R/sir.R
@ -844,6 +844,25 @@ convert_host <- function(x, lang = get_AMR_locale()) {
|
||||
x_out[is.na(x_out) & (x %like% "horse|equine" | x %like% translate_AMR("horse|horses|equine", lang))] <- "horse"
|
||||
x_out[is.na(x_out) & (x %like% "aqua|fish" | x %like% translate_AMR("aquatic|fish", lang))] <- "aquatic"
|
||||
x_out[is.na(x_out) & (x %like% "bird|chicken|poultry|avia" | x %like% translate_AMR("bird|birds|poultry", lang))] <- "poultry"
|
||||
# additional animals, not necessarily currently in breakpoint guidelines:
|
||||
x_out[is.na(x_out) & (x %like% "camel|camelid" | x %like% translate_AMR("camel|camels|camelid", lang))] <- "camels"
|
||||
x_out[is.na(x_out) & (x %like% "deer|cervine" | x %like% translate_AMR("deer|deers|cervine", lang))] <- "deer"
|
||||
x_out[is.na(x_out) & (x %like% "donkey|asinine" | x %like% translate_AMR("donkey|donkeys|asinine", lang))] <- "donkeys"
|
||||
x_out[is.na(x_out) & (x %like% "ferret|musteline" | x %like% translate_AMR("ferret|ferrets|musteline", lang))] <- "ferrets"
|
||||
x_out[is.na(x_out) & (x %like% "goat|caprine" | x %like% translate_AMR("goat|goats|caprine", lang))] <- "goats"
|
||||
x_out[is.na(x_out) & (x %like% "guinea pig|caviine" | x %like% translate_AMR("guinea pig|guinea pigs|caviine", lang))] <- "guinea pigs"
|
||||
x_out[is.na(x_out) & (x %like% "hamster|cricetine" | x %like% translate_AMR("hamster|hamsters|cricetine", lang))] <- "hamsters"
|
||||
x_out[is.na(x_out) & (x %like% "monkey|simian" | x %like% translate_AMR("monkey|monkeys|simian", lang))] <- "monkeys"
|
||||
x_out[is.na(x_out) & (x %like% "mouse|murine" | x %like% translate_AMR("mouse|mice|murine", lang))] <- "mice"
|
||||
x_out[is.na(x_out) & (x %like% "pig|porcine" | x %like% translate_AMR("pig|pigs|porcine", lang))] <- "pigs"
|
||||
x_out[is.na(x_out) & (x %like% "rabbit|leporine" | x %like% translate_AMR("rabbit|rabbits|leporine", lang))] <- "rabbits"
|
||||
x_out[is.na(x_out) & (x %like% "rat|ratine" | x %like% translate_AMR("rat|rats|ratine", lang))] <- "rats"
|
||||
x_out[is.na(x_out) & (x %like% "sheep|ovine" | x %like% translate_AMR("sheep|sheeps|ovine", lang))] <- "sheep"
|
||||
x_out[is.na(x_out) & (x %like% "snake|serpentine" | x %like% translate_AMR("snake|snakes|serpentine", lang))] <- "snakes"
|
||||
x_out[is.na(x_out) & (x %like% "turkey|meleagrine" | x %like% translate_AMR("turkey|turkeys|meleagrine", lang))] <- "turkey"
|
||||
if (message_not_thrown_before("convert_host", x) && any(is.na(x_out) & !is.na(x))) {
|
||||
warning_("The following host(s) are invalid: ", vector_and(x[is.na(x_out) & !is.na(x)]), call = FALSE, immediate = TRUE)
|
||||
}
|
||||
x_out[x_out == "ecoff"] <- "ECOFF"
|
||||
x_out
|
||||
}
|
||||
@ -912,18 +931,21 @@ as_sir_method <- function(method_short,
|
||||
host <- breakpoint_type
|
||||
}
|
||||
}
|
||||
if (!is.null(current_df) && length(host) == 1 && host %in% colnames(current_df) && any(current_df[[host]] %like% "[A-Z]", na.rm = TRUE)) {
|
||||
host <- current_df[[host]]
|
||||
} else if (length(host) != length(x)) {
|
||||
# for dplyr's across()
|
||||
cur_column_dplyr <- import_fn("cur_column", "dplyr", error_on_fail = FALSE)
|
||||
if (!is.null(cur_column_dplyr) && is.data.frame(current_df)) {
|
||||
# try to get current column, which will only be available when in across()
|
||||
host <- tryCatch(cur_column_dplyr(),
|
||||
error = function(e) host
|
||||
)
|
||||
if (!is.null(host) && !all(toupper(as.character(host)) %in% c("HUMAN", "ECOFF"))) {
|
||||
if (!is.null(current_df) && length(host) == 1 && host %in% colnames(current_df) && any(current_df[[host]] %like% "[A-Z]", na.rm = TRUE)) {
|
||||
host <- current_df[[host]]
|
||||
} else if (length(host) != length(x)) {
|
||||
# for dplyr's across()
|
||||
cur_column_dplyr <- import_fn("cur_column", "dplyr", error_on_fail = FALSE)
|
||||
if (!is.null(cur_column_dplyr) && is.data.frame(current_df)) {
|
||||
# try to get current column, which will only be available when in across()
|
||||
host <- tryCatch(cur_column_dplyr(),
|
||||
error = function(e) host
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
host.bak <- host
|
||||
host <- convert_host(host)
|
||||
if (breakpoint_type == "animal" && message_not_thrown_before("as.sir", "host_preferred_order")) {
|
||||
message_("Please note that in the absence of specific veterinary breakpoints for certain animal hosts, breakpoints for dogs, cattle, swine, cats, horse, aquatic, and poultry, in that order, are used as substitutes.\n\n")
|
||||
@ -1169,6 +1191,10 @@ as_sir_method <- function(method_short,
|
||||
mo_current <- df_unique[i, "mo", drop = TRUE]
|
||||
ab_current <- df_unique[i, "ab", drop = TRUE]
|
||||
host_current <- df_unique[i, "host", drop = TRUE]
|
||||
if (is.na(host_current)) {
|
||||
# fall back to human
|
||||
host_current <- "human"
|
||||
}
|
||||
uti_current <- df_unique[i, "uti", drop = TRUE]
|
||||
notes_current <- character(0)
|
||||
if (isFALSE(uti_current)) {
|
||||
@ -1229,7 +1255,7 @@ as_sir_method <- function(method_short,
|
||||
index = rows,
|
||||
ab_given = vectorise_log_entry(ab.bak[match(ab_current, df$ab)][1], length(rows)),
|
||||
mo_given = vectorise_log_entry(mo.bak[match(mo_current, df$mo)][1], length(rows)),
|
||||
host_given = vectorise_log_entry(host_current, length(rows)),
|
||||
host_given = vectorise_log_entry(host.bak[match(host_current, df$host)][1], length(rows)),
|
||||
ab = vectorise_log_entry(ab_current, length(rows)),
|
||||
mo = vectorise_log_entry(mo_current, length(rows)),
|
||||
host = vectorise_log_entry(host_current, length(rows)),
|
||||
@ -1353,7 +1379,7 @@ as_sir_method <- function(method_short,
|
||||
index = rows,
|
||||
ab_given = vectorise_log_entry(ab.bak[match(ab_current, df$ab)][1], length(rows)),
|
||||
mo_given = vectorise_log_entry(mo.bak[match(mo_current, df$mo)][1], length(rows)),
|
||||
host_given = vectorise_log_entry(host_current, length(rows)),
|
||||
host_given = vectorise_log_entry(host.bak[match(host_current, df$host)][1], length(rows)),
|
||||
ab = vectorise_log_entry(breakpoints_current[, "ab", drop = TRUE], length(rows)),
|
||||
mo = vectorise_log_entry(breakpoints_current[, "mo", drop = TRUE], length(rows)),
|
||||
host = vectorise_log_entry(breakpoints_current[, "host", drop = TRUE], length(rows)),
|
||||
|
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
@ -306,3 +306,16 @@ dog|dogs|canine FALSE FALSE FALSE FALSE 狗|狗|犬类 pes|psi|psí hund|hunde h
|
||||
horse|horses|equine FALSE FALSE FALSE FALSE 马|马|马 kůň|koně|koně hest|heste paard|paarden hevonen|hevoset|hevoset cheval|chevaux|équine pferd|pferde άλογο|άλογα|ιπποειδή cavallo|cavalli|equino 馬|馬|馬 hest koń|konie|koń cavalo|cavalos|equinos cal|cai|ecvideu лошадь|лошади|лошадь caballo|caballos|equino häst|hästar|häst at|atlar|atçılık кінь|коні|конячий
|
||||
bird|birds|poultry FALSE FALSE FALSE FALSE 鸟类|鸟类|家禽 ptáci|ptáci|drůbež fugl|fugle|fjerkræ vogel|vogels|pluimvee lintu|linnut|siipikarja oiseaux|oiseaux|volaille vogel|vögel|geflügel πουλιά|πουλιά|πουλερικά uccello|uccelli|pollame 鳥|鳥|家禽 fugl|fugler|fjørfe ptak|ptaki|drób aves|aves|aves de capoeira pasăre|păsări|păsări de curte птица|птицы|домашняя птица aves|aves|aves de corral fågel|fåglar|fjäderfä kuş|kuşlar|kümes hayvanları птах|птахів|птиця
|
||||
swine|swines FALSE FALSE FALSE FALSE 猪|猪 prasata|prasata svin varken|varkens sika|sikaa porcine|porcs schwein|schweine χοίροι|χοίροι suino|suini 豚|豚|頭 svin trzoda chlewna|świnie suínos porc|porcine свинья|свиньи porcino|porcinos svin domuz|domuz свиня|свині
|
||||
camel|camels|camelid FALSE FALSE FALSE FALSE 骆驼|骆驼|骆驼科 velbloud|velbloudi|velbloudí kamel|kameler|kamelid kameel|kamelen|kameelachtig kameli|kamelit|kamelidi chameau|chameaux|camélidé Kamel|Kamele|Kameliden καμήλα|καμήλες|καμηλίδιο cammello|camelli|camelide ラクダ|ラクダ|ラクダ科 kamel|kameler|kamelid wielbłąd|wielbłądy|wielbłądowate camelo|camelos|camelídeo camel|cămila|camelidă верблюд|верблюды|верблюдовые camello|camellos|camélido kamel|kameler|kamelid deve|develer|devegiller верблюд|верблюди|верблюдовий
|
||||
deer|deers|cervine FALSE FALSE FALSE FALSE 鹿|鹿|鹿科 jelen|jeleni|jelení hjort|hjorte|hjortedyr hert|herten|hertachtig peura|peurat|peura cerf|cerfs|cervidé Hirsch|Hirsche|Hirschartige ελάφι|ελάφια|ελαφίδι cervo|cervi|cervino 鹿|鹿|鹿科 hjort|hjorter|hjortedyr jelen|jelenie|jeleniowate cervo|cervos|cervídeo cer|cerbi|cervină олень|олени|оленевые ciervo|ciervos|cervino hjort|hjortar|hjortdjur geyik|geyikler|geyikgiller олень|олені|оленячий
|
||||
donkey|donkeys|asinine FALSE FALSE FALSE FALSE 驴|驴|驴科 osel|osli|oslovitý æsel|æsler|æselagtig ezel|ezels|ezelachtig aasi|aasit|aasimainen âne|ânes|asinin Esel|Esel|asinisch γάιδαρος|γάιδαροι|γαιδουρίνο asino|asini|asinino ロバ|ロバ|ロバ科 esel|esler|eselaktig osioł|osły|osiołowate burro|burros|asinino măgar|măgari|asinin осел|ослы|ослиный burro|burros|asnal åsna|åsnor|åsne esek|eşekler|eşekgiller осел|осли|ослячий
|
||||
ferret|ferrets|musteline FALSE FALSE FALSE FALSE 雪貂|雪貂|鼬科 tchoř|tchoři|tchořovitý fritte|fritter|mårhund fret|fretten|fretachtig viiru|viirut|näätäeläin furet|furets|mustélidé Frettchen|Frettchen|Marderartige νεράιδα|νεράιδες|μουστελίδα furetto|furetti|mustelide フェレット|フェレット|イタチ科 frett|fretter|mårhund szop|szopy|szopowate furão|furões|mustelídeo jder|jderi|mustelidă хорек|хорьки|хорьковые hurón|hurones|mustélido iller|iller|marten göründü|göründüler|göründü хорек|хорки|хорьковий
|
||||
goat|goats|caprine FALSE FALSE FALSE FALSE 山羊|山羊|山羊科 koza|kozy|kozí ged|geder|gede geit|geiten|geitachtig vuohi|vuohet|vuohi chèvre|chèvres|caprin Ziege|Ziegen|ziegenartig κατσίκα|κατσίκες|κατσικίσιο capra|capre|caprino ヤギ|ヤギ|ヤギ科 geit|geiter|geite koza|kozy|kozowate cabra|cabras|caprino capră|capre|caprină коза|козы|козий cabra|cabras|caprino get|getter|getdjur keçi|keçiler|keçi коза|кози|козячий
|
||||
guinea pig|guinea pigs|caviine FALSE FALSE FALSE FALSE 豚鼠|豚鼠|豚鼠科 morce|morče|morčecovitý marsvin|marsvin|marsvin cavia merisika|merisikat|merisika cobaye|cobayes|cobaye Meerschweinchen|Meerschweinchen|Meerschweinchenartige τσιντσιλά|τσιντσιλάδες|τσιντσιλίδι cavia|cavie|cavino モルモット|モルモット|モルモット科 marsvin|marsvin|marsvin swinka morska|swinki morskie|świnka morska porquinho-da-índia|porquinhos-da-índia|caviíneo porcușor de Guineea|porcușori de Guineea|caviină морская свинка|морские свинки|морская свинка cobaya|cobayas|cavino marsvin|marsvin|marsvin yaban domuzu|yaban domuzları|yaban domuzu морська свинка|морські свинки|морська свинка
|
||||
hamster|hamsters|cricetine FALSE FALSE FALSE FALSE 仓鼠|仓鼠|仓鼠科 křeček|křečci|křečkovitý hamster|hamstere|hamster hamster|hamsters|hamsterachtig hamsteri|hamsterit|hamsteri hamster|hamsters|cricétidé Hamster|Hamster|Hamsterartige χάμστερ|χάμστερ|χαμστερίδι criceto|criceti|cricetino ハムスター|ハムスター|ハムスター科 hamster|hamstere|hamster chomik|chomiki|chomikowate hamster|hamsters|cricetídeo hamster|hamsteri|cricetină хомяк|хомяки|хомячий hamster|hamsters|cricetino hamster|hamstrar|hamster hamster|hamsterler|hamster хом'як|хом'яки|хом'ячий
|
||||
monkey|monkeys|simian FALSE FALSE FALSE FALSE 猴子|猴子|猴科 opice|opice|opičí abe|aber|abe aap|apen|aapachtig apina|apinat|apina singe|singes|simien Affe|Affen|affenartig πίθηκος|πίθηκοι|πιθηκίδι scimmia|scimmie|scimmia 猿|猿|サル ape|aper|ape małpa|małpy|małpia macaco|macacos|símio maimută|maimuțe|simeză обезьяна|обезьяны|обезьяньи mono|monos|simio apa|apor|apa maymun|maymunlar|maymun мавпа|мавпи|мавпячий
|
||||
mouse|mice|murine FALSE FALSE FALSE FALSE 老鼠|老鼠|鼠科 myš|myši|myšovitý mus|mus|mus muis|muizen|muisachtig hiiri|hiiret|hiiri souris|souris|murin Maus|Mäuse|Mäuseartig ποντίκι|ποντίκια|μυοειδές topo|topi|murino ネズミ|ネズミ|ネズミ科 mus|mus|muse mysz|myszy|myszowate rato|ratos|murino șoarece|șoareci|murină мышь|мыши|мышиный ratón|ratones|murino mus|möss|mus fare|fareler|fare миша|миші|мишачий
|
||||
pig|pigs|porcine FALSE FALSE FALSE FALSE 猪|猪|猪科 prase|prasata|prasatovitý gris|grise|svin varken|varkens|varkenachtig sika|siat|sika cochon|cochons|porcin Schwein|Schweine|schweineartig γουρούνι|γουρούνια|χοιρίδι maiale|maiali|suino 豚|豚|豚科 gris|griser|svin świnia|świnie|świński porco|porcos|porcino porc|porci|porcină свинья|свиньи|свиный cerdo|cerdos|porcino gris|grisar|svin domuz|domuzlar|domuz свиня|свині|свинячий
|
||||
rat|rats|ratine FALSE FALSE FALSE FALSE 鼠|鼠|鼠科 krysa|krysy|krysí rat|rotter|rotte rat|ratten|ratachtig rotta|rotat|rotta rat|rats|raté Ratte|Ratten|Rattenartig αρουραίος|αρουραίοι|αρουραίδι ratto|ratti|rattino ラット|ラット|ラット科 ratte|rotter|rotte szczur|szczury|szczurzy rato|ratos|rato șobolan|șobolani|șobolănesc крыса|крысы|крысиный rata|ratas|rata råtta|råttor|råtta sıçan|sıçanlar|sıçan щур|щури|щурячий
|
||||
snake|snakes|serpentine FALSE FALSE FALSE FALSE 蛇|蛇|蛇科 had|hadi|hadí slange|slanger|slange slang|slangen|slangachtig käärme|käärmeet|käärme serpent|serpents|serpentin Schlange|Schlangen|schlangenartig φίδι|φίδια|οφιειδές serpente|serpenti|serpentino ヘビ|ヘビ|ヘビ科 slange|slanger|slange wąż|węże|wężowy cobra|cobras|serpentina șarpe|șerpi|șerpuitor змея|змеи|змеиный serpiente|serpientes|serpentina orm|ormar|orm yılan|yılanlar|yılan змія|змії|змієвий
|
||||
turkey|turkeys|meleagrine FALSE FALSE FALSE FALSE 火鸡|火鸡|火鸡科 krocan|krocany|krocanovitý kalkun|kalkuner|kalkun kalkoen|kalkoenen|kalkoenachtig kalkkuna|kalkkunat|kalkkuna dinde|dindes|meleagrin Pute|Puten|Truthuhn γαλοπούλα|γαλοπούλες|μελεαγρίδιο tacchino|tacchini|meleagride 七面鳥|七面鳥|七面鳥科 kalkun|kalkuner|kalkun indyk|indyki|indykowy peru|perus|meleagrina curcan|curcani|meleagrină индейка|индейки|индейковый pavo|pavos|meleagrina kalkon|kalkoner|kalkon hindi|hindiler|hindi індик|індики|індиковий
|
||||
|
|
Loading…
Reference in New Issue
Block a user