mirror of
https://github.com/msberends/AMR.git
synced 2025-10-19 11:06:20 +02:00
(v2.1.1.9286) deprecate antibiotics
better, add ATC for ceftaroline
This commit is contained in:
@@ -948,6 +948,8 @@ get_atc_code <- function(ab) {
|
||||
# exception for imipenem
|
||||
if (ab_name == "imipenem") ab_name <- "imipenem/cilastatin"
|
||||
if (ab_name == "imipenem/relebactam") ab_name <- "imipenem/cilastatin/relebactam"
|
||||
if (ab_name == "ceftaroline") ab_name <- "ceftaroline fosamil"
|
||||
ab_name.bak <- ab_name
|
||||
if (ab_name %like% "/") {
|
||||
ab_name <- strsplit(ab_name, "[/ ]")[[1]]
|
||||
}
|
||||
@@ -971,28 +973,33 @@ get_atc_code <- function(ab) {
|
||||
} else if (ab_name_full %like% " and " && ab_name_bla %in% atc_tbl[[2]]) {
|
||||
out <- atc_tbl[[1]][which(atc_tbl[[2]] == ab_name_bla)]
|
||||
} else {
|
||||
if (any(atc_tbl_human$X1 %like% ab_name.bak, na.rm = TRUE)) {
|
||||
message("returning NA, but DO MIND: ", ab_name.bak, " resembles ATC name(s) ", toString(atc_tbl_human$X1), appendLF = FALSE)
|
||||
}
|
||||
out <- NA_character_
|
||||
}
|
||||
unique(out)
|
||||
}
|
||||
|
||||
# update all:
|
||||
to_update <- 1:nrow(antimicrobials)
|
||||
# or just the empty ones:
|
||||
to_update <- which(sapply(antimicrobials$atc, function(x) length(x[!is.na(x)])) == 0)
|
||||
|
||||
updated_atc <- lapply(seq_len(length(to_update)),
|
||||
function(x) NA_character_)
|
||||
|
||||
to_update <- 1:nrow(antimicrobials)
|
||||
# or just the empty ones:
|
||||
to_update <- which(sapply(antimicrobials$atc, length) == 0)
|
||||
|
||||
# this takes around 10 minutes (some are skipped and go faster)
|
||||
# this takes around 10 minutes for the whole table (some ABx are skipped and go faster)
|
||||
for (i in to_update) {
|
||||
message(percentage(i / length(updated_atc), digits = 1),
|
||||
message(percentage(which(to_update == i) / length(updated_atc), digits = 1),
|
||||
" - Downloading ", antimicrobials$name[i],
|
||||
appendLF = FALSE
|
||||
)
|
||||
atcs <- get_atc_code(antimicrobials$name[i])
|
||||
if (length(atcs[!is.na(atcs)]) > 0) {
|
||||
updated_atc[[i]] <- atcs
|
||||
message(" (", length(atcs[!is.na(atcs)]), " results: ", toString(atcs[!is.na(atcs)]), ")")
|
||||
message(font_blue(paste0(" (", length(atcs[!is.na(atcs)]), " results: ", toString(atcs[!is.na(atcs)]), ")")))
|
||||
# let the WHO server rest for a second - they might have a limitation on the queries per second
|
||||
Sys.sleep(1)
|
||||
} else {
|
||||
@@ -1001,7 +1008,8 @@ for (i in to_update) {
|
||||
}
|
||||
|
||||
updated_atc <- lapply(updated_atc, function(x) sort(x[!is.na(x)]))
|
||||
antimicrobials$atc <- updated_atc
|
||||
antimicrobials$atc[to_update] <- updated_atc[to_update]
|
||||
|
||||
# DO NOT FORGET TO UPDATE R/aa_globals.R!
|
||||
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
959459b92fe6ff57c02bab08381a73a8
|
||||
228840b3941753c4adee2b781d901590
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -114,7 +114,7 @@
|
||||
"CRD" 5284529 "Cefroxadine" "Cephalosporins (1st gen.)" "J01DB11,QJ01DB11" "Other beta-lactam antibacterials" "First-generation cephalosporins" "ceftix" "cefroxadin,cefroxadino,cefroxadinum,oraspor" 2.1 "g" "NA"
|
||||
"CFS" 656575 "Cefsulodin" "Cephalosporins (3rd gen.)" "J01DD03,QJ01DD03" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cefsul,cfsl,cfsu" "cefomonil,cefonomil,cefsulodine,cefsulodinhydrate,cefsulodino,cefsulodinum,pseudocef,pseudomonil,pyocefal,sulcephalosporin,takesulin,tilmapor,ulfaret" 4 "g" "127-1,128-9,129-7,130-5,131-3,18892-0,25242-9,55647-2"
|
||||
"CSU" 68718 "Cefsumide" "Cephalosporins (unclassified gen.)" "NA" "NA" "cefsulmid,cefsumido,cefsumidum" "NA"
|
||||
"CPT" 56841980 "Ceftaroline" "Cephalosporins (5th gen.)" "NA" "ceftar,cfro" "ceftaroine,teflaro,zinforo" "73604-1,73605-8,73626-4,73627-2,73649-6,73650-4,74170-2"
|
||||
"CPT" 56841980 "Ceftaroline" "Cephalosporins (5th gen.)" "J01DI02,QJ01DI02" "ceftar,cfro" "ceftaroine,teflaro,zinforo" "73604-1,73605-8,73626-4,73627-2,73649-6,73650-4,74170-2"
|
||||
"CPA" "Ceftaroline/avibactam" "Cephalosporins (5th gen.)" "NA" "NA" "NA" "73604-1,73626-4,73649-6"
|
||||
"CAZ" 5481173 "Ceftazidime" "Cephalosporins (3rd gen.)" "J01DD02,QJ01DD02" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "caz,cefta,ceftaz,cfta,cftz,taz,tz,xtz" "ceftazimide,ceptaz,fortam,fortaz,fortum,glazidim,kefazim,modacin,pentacef,tazicef,tizime" 4 "g" "101481-0,101482-8,101483-6,132-1,133-9,134-7,135-4,18893-8,21151-6,3449-6,35774-9,35775-6,35776-4,42352-5,55648-0,55649-8,55650-6,55651-4,58705-5,6995-5,73603-3,73625-6,73648-8,80960-8,87734-0,90850-9"
|
||||
"CZA" 90643431 "Ceftazidime/avibactam" "Cephalosporins (3rd gen.)" "J01DD52,QJ01DD52" "cfav" "avycaz,zavicefta" 6 "g" "101483-6,73603-3,73625-6,73648-8,87734-0"
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user