mirror of
https://github.com/msberends/AMR.git
synced 2025-06-07 19:14:01 +02:00
(v2.1.1.9286) deprecate antibiotics
better, add ATC for ceftaroline
This commit is contained in:
parent
80f08f91da
commit
e70f3de02e
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 2.1.1.9285
|
||||
Date: 2025-05-21
|
||||
Version: 2.1.1.9286
|
||||
Date: 2025-06-01
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
data analysis and to work with microbial and antimicrobial properties by
|
||||
|
@ -1,12 +1,14 @@
|
||||
# Generated by roxygen2: do not edit by hand
|
||||
|
||||
S3method("!=",amr_selector)
|
||||
S3method("$",deprecated_amr_dataset)
|
||||
S3method("&",amr_selector)
|
||||
S3method("+",ab)
|
||||
S3method("+",amr_selector)
|
||||
S3method("==",amr_selector)
|
||||
S3method("[",ab)
|
||||
S3method("[",av)
|
||||
S3method("[",deprecated_amr_dataset)
|
||||
S3method("[",disk)
|
||||
S3method("[",mic)
|
||||
S3method("[",mo)
|
||||
@ -18,6 +20,7 @@ S3method("[<-",mo)
|
||||
S3method("[<-",sir)
|
||||
S3method("[[",ab)
|
||||
S3method("[[",av)
|
||||
S3method("[[",deprecated_amr_dataset)
|
||||
S3method("[[",disk)
|
||||
S3method("[[",mic)
|
||||
S3method("[[",mo)
|
||||
@ -40,6 +43,7 @@ S3method(any,amr_selector)
|
||||
S3method(any,amr_selector_any_all)
|
||||
S3method(as.data.frame,ab)
|
||||
S3method(as.data.frame,av)
|
||||
S3method(as.data.frame,deprecated_amr_dataset)
|
||||
S3method(as.data.frame,mic)
|
||||
S3method(as.data.frame,mo)
|
||||
S3method(as.double,mic)
|
||||
@ -93,6 +97,7 @@ S3method(print,av)
|
||||
S3method(print,bug_drug_combinations)
|
||||
S3method(print,custom_eucast_rules)
|
||||
S3method(print,custom_mdro_guideline)
|
||||
S3method(print,deprecated_amr_dataset)
|
||||
S3method(print,disk)
|
||||
S3method(print,mic)
|
||||
S3method(print,mo)
|
||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
||||
# AMR 2.1.1.9285
|
||||
# AMR 2.1.1.9286
|
||||
|
||||
*(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://amr-for-r.org/#get-this-package).)*
|
||||
|
||||
|
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
@ -36,9 +36,45 @@
|
||||
NULL
|
||||
|
||||
#' @rdname AMR-deprecated
|
||||
#' @usage NULL
|
||||
#' @usage antibiotics
|
||||
#' @export
|
||||
"antibiotics"
|
||||
antibiotics <- local({
|
||||
warned <- FALSE
|
||||
value <- AMR::antimicrobials
|
||||
structure(
|
||||
value,
|
||||
class = c("deprecated_amr_dataset", class(value))
|
||||
)
|
||||
})
|
||||
.amr_deprecation_warn <- function() {
|
||||
deprecation_warning(old = "antibiotics", new = "antimicrobials", is_dataset = TRUE)
|
||||
invisible(NULL)
|
||||
}
|
||||
#' @export
|
||||
`[.deprecated_amr_dataset` <- function(x, ...) {
|
||||
.amr_deprecation_warn()
|
||||
NextMethod("[")
|
||||
}
|
||||
#' @export
|
||||
`[[.deprecated_amr_dataset` <- function(x, ...) {
|
||||
.amr_deprecation_warn()
|
||||
NextMethod("[[")
|
||||
}
|
||||
#' @export
|
||||
`$.deprecated_amr_dataset` <- function(x, name) {
|
||||
.amr_deprecation_warn()
|
||||
NextMethod("$")
|
||||
}
|
||||
#' @export
|
||||
print.deprecated_amr_dataset <- function(x, ...) {
|
||||
.amr_deprecation_warn()
|
||||
NextMethod("print")
|
||||
}
|
||||
#' @export
|
||||
as.data.frame.deprecated_amr_dataset <- function(x, ...) {
|
||||
.amr_deprecation_warn()
|
||||
NextMethod("as.data.frame")
|
||||
}
|
||||
|
||||
# REMEMBER to search for `deprecation_warning` in the package code to find all instances.
|
||||
# currently deprecated arguments at least:
|
||||
|
8
R/zzz.R
8
R/zzz.R
@ -110,14 +110,6 @@ AMR_env$cross_icon <- if (isTRUE(base::l10n_info()$`UTF-8`)) "\u00d7" else "x"
|
||||
AB_LOOKUP <- create_AB_AV_lookup(AMR::antimicrobials)
|
||||
}
|
||||
|
||||
# deprecated antibiotics data set
|
||||
makeActiveBinding("antibiotics", function() {
|
||||
if (interactive()) {
|
||||
deprecation_warning(old = "antibiotics", new = "antimicrobials", is_dataset = TRUE)
|
||||
}
|
||||
AMR::antimicrobials
|
||||
}, env = asNamespace(pkgname))
|
||||
|
||||
AMR_env$AB_lookup <- cbind(AMR::antimicrobials, AB_LOOKUP)
|
||||
AMR_env$AV_lookup <- cbind(AMR::antivirals, AV_LOOKUP)
|
||||
}
|
||||
|
@ -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.
Binary file not shown.
@ -8,9 +8,11 @@
|
||||
\alias{ab_selector}
|
||||
\title{Deprecated Functions, Arguments, or Datasets}
|
||||
\format{
|
||||
An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 497 rows and 14 columns.
|
||||
An object of class \code{deprecated_amr_dataset} (inherits from \code{tbl_df}, \code{tbl}, \code{data.frame}) with 497 rows and 14 columns.
|
||||
}
|
||||
\usage{
|
||||
antibiotics
|
||||
|
||||
ab_class(...)
|
||||
|
||||
ab_selector(...)
|
||||
|
Loading…
x
Reference in New Issue
Block a user