mirror of
https://github.com/msberends/AMR.git
synced 2025-09-02 19:44:04 +02:00
Compare commits
6 Commits
80f08f91da
...
v3.0.0
Author | SHA1 | Date | |
---|---|---|---|
1710e220dd | |||
79038fed21 | |||
d384b492cf | |||
46f80b1378 | |||
5667ce3eae | |||
e70f3de02e |
1
.github/prehooks/commit-msg
vendored
1
.github/prehooks/commit-msg
vendored
@@ -60,6 +60,7 @@ else
|
||||
fi
|
||||
|
||||
git add data-raw/*
|
||||
git add data/*
|
||||
git add -u
|
||||
|
||||
exit 0
|
||||
|
2
.github/prehooks/pre-commit
vendored
2
.github/prehooks/pre-commit
vendored
@@ -51,6 +51,7 @@ if command -v Rscript > /dev/null; then
|
||||
currentpkg=$(Rscript -e "cat(pkgload::pkg_name())")
|
||||
echo "- Adding changed files in ./data-raw and ./man to this commit"
|
||||
git add data-raw/*
|
||||
git add data/*
|
||||
git add man/*
|
||||
git add R/sysdata.rda
|
||||
git add NAMESPACE
|
||||
@@ -112,6 +113,7 @@ echo ""
|
||||
echo "${currentversion}" > .git/commit_version.tmp
|
||||
|
||||
git add data-raw/*
|
||||
git add data/*
|
||||
git add -u
|
||||
|
||||
exit 0
|
||||
|
@@ -1,3 +1,3 @@
|
||||
Version: 2.1.1
|
||||
Date: 2023-10-20 16:05:16 UTC
|
||||
SHA: ca72a646d041f7f096c4e196e8ae2fb2b176019c
|
||||
Version: 3.0.0
|
||||
Date: 2025-06-01 16:52:53 UTC
|
||||
SHA: 79038fed2169a25a7fc067c80bb25d9d78be21d9
|
||||
|
@@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 2.1.1.9285
|
||||
Date: 2025-05-21
|
||||
Version: 3.0.0
|
||||
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)
|
||||
@@ -161,7 +166,6 @@ export(amr_distance_from_row)
|
||||
export(amr_selector)
|
||||
export(anti_join_microorganisms)
|
||||
export(antibiogram)
|
||||
export(antibiotics)
|
||||
export(antifungals)
|
||||
export(antimicrobials_equal)
|
||||
export(antimycobacterials)
|
||||
|
45
NEWS.md
45
NEWS.md
@@ -1,50 +1,7 @@
|
||||
# AMR 2.1.1.9285
|
||||
|
||||
*(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).)*
|
||||
# AMR 3.0.0
|
||||
|
||||
This package now supports not only tools for AMR data analysis in clinical settings, but also for veterinary and environmental microbiology. This was made possible through a collaboration with the [University of Prince Edward Island's Atlantic Veterinary College](https://www.upei.ca/avc), Canada. To celebrate this great improvement of the package, we also updated the package logo to reflect this change.
|
||||
|
||||
## tl;dr
|
||||
|
||||
- Scope Expansion: One Health support (Human + Veterinary + Environmental microbiology).
|
||||
- Data Updates:
|
||||
- `antibiotics` renamed to `antimicrobials`.
|
||||
- Veterinary antimicrobials and WHOCC codes added.
|
||||
- MycoBank fungal taxonomy integrated (+20,000 fungi).
|
||||
- Breakpoints & Interpretations:
|
||||
- CLSI/EUCAST 2024-2025 breakpoints added; EUCAST 2025 default.
|
||||
- `as.sir()` supports NI/SDD levels; parallel computation enabled.
|
||||
- Custom S/I/R/SDD/NI definitions allowed.
|
||||
- Improved handling of capped MICs.
|
||||
- New Tools & Functions:
|
||||
- WISCA antibiogram support (`antibiogram()`, `wisca()`).
|
||||
- New ggplot2 extensions: `scale_*_mic()`, `scale_*_sir()`, `rescale_mic()`.
|
||||
- New utility functions: `top_n_microorganisms()`, `mo_group_members()`, `mic_p50()`, `mic_p90()`.
|
||||
- Predictive Modelling:
|
||||
- Full tidymodels compatibility for antimicrobial selectors.
|
||||
- Deprecated `resistance_predict()` and `sir_predict()`.
|
||||
- Python Compatibility: AMR R package now runs in Python.
|
||||
- Selector Improvements:
|
||||
* Added selectors (`isoxazolylpenicillins()`, `monobactams()`, `nitrofurans()`, `phenicols()`, `rifamycins()`, and `sulfonamides()`)
|
||||
- Selectors renamed from `ab_*` to `amr_*`; old names deprecated.
|
||||
- MIC/Disks Handling:
|
||||
- MIC strict comparisons, added levels.
|
||||
- Disk diffusion range expanded (0–50 mm).
|
||||
- EUCAST Rules and MDROs:
|
||||
- EUCAST v12–v15 rules implemented.
|
||||
- Dutch MDRO 2024 guideline support in `mdro()`.
|
||||
- Infrastructure:
|
||||
- New website: https://amr-for-r.org.
|
||||
- Improved `vctrs` integration for tidyverse workflows.
|
||||
- Dropped SAS `.xpt` file support.
|
||||
- Other Fixes & Enhancements:
|
||||
- Support for 8 new languages, adding to a total of 28 languages.
|
||||
- Faster microorganism identification.
|
||||
- Improved antimicrobial and MIC handling.
|
||||
- Extended documentation, additional contributors acknowledged.
|
||||
|
||||
## Full Changelog
|
||||
|
||||
### Breaking
|
||||
* Dataset `antibiotics` has been renamed to `antimicrobials` as the data set contains more than just antibiotics. Using `antibiotics` will still work, but now returns a warning.
|
||||
* Removed all functions and references that used the deprecated `rsi` class, which were all replaced with their `sir` equivalents over two years ago.
|
||||
|
@@ -110,7 +110,7 @@
|
||||
#'
|
||||
#' There are various antibiogram types, as summarised by Klinker *et al.* (2021, \doi{10.1177/20499361211011373}), and they are all supported by [antibiogram()].
|
||||
#'
|
||||
#' For clinical coverage estimations, **use WISCA whenever possible**, since it provides more precise coverage estimates by accounting for pathogen incidence and antimicrobial susceptibility, as has been shown by Bielicki *et al.* (2020, \doi{10.1001.jamanetworkopen.2019.21124}). See the section *Explaining WISCA* on this page. Do note that WISCA is pathogen-agnostic, meaning that the outcome is not stratied by pathogen, but rather by syndrome.
|
||||
#' For clinical coverage estimations, **use WISCA whenever possible**, since it provides more precise coverage estimates by accounting for pathogen incidence and antimicrobial susceptibility, as has been shown by Bielicki *et al.* (2020, \doi{10.1001/jamanetworkopen.2019.21124}). See the section *Explaining WISCA* on this page. Do note that WISCA is pathogen-agnostic, meaning that the outcome is not stratied by pathogen, but rather by syndrome.
|
||||
#'
|
||||
#' 1. **Traditional Antibiogram**
|
||||
#'
|
||||
@@ -266,7 +266,7 @@
|
||||
#' For more background, interpretation, and examples, see [the WISCA vignette](https://amr-for-r.org/articles/WISCA.html).
|
||||
#' @source
|
||||
#' * Bielicki JA *et al.* (2016). **Selecting appropriate empirical antibiotic regimens for paediatric bloodstream infections: application of a Bayesian decision model to local and pooled antimicrobial resistance surveillance data** *Journal of Antimicrobial Chemotherapy* 71(3); \doi{10.1093/jac/dkv397}
|
||||
#' * Bielicki JA *et al.* (2020). **Evaluation of the coverage of 3 antibiotic regimens for neonatal sepsis in the hospital setting across Asian countries** *JAMA Netw Open.* 3(2):e1921124; \doi{10.1001.jamanetworkopen.2019.21124}
|
||||
#' * Bielicki JA *et al.* (2020). **Evaluation of the coverage of 3 antibiotic regimens for neonatal sepsis in the hospital setting across Asian countries** *JAMA Netw Open.* 3(2):e1921124; \doi{10.1001/jamanetworkopen.2019.21124}
|
||||
#' * Klinker KP *et al.* (2021). **Antimicrobial stewardship and antibiograms: importance of moving beyond traditional antibiograms**. *Therapeutic Advances in Infectious Disease*, May 5;8:20499361211011373; \doi{10.1177/20499361211011373}
|
||||
#' * Barbieri E *et al.* (2021). **Development of a Weighted-Incidence Syndromic Combination Antibiogram (WISCA) to guide the choice of the empiric antibiotic treatment for urinary tract infection in paediatric patients: a Bayesian approach** *Antimicrobial Resistance & Infection Control* May 1;10(1):74; \doi{10.1186/s13756-021-00939-2}
|
||||
#' * **M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 5th Edition**, 2022, *Clinical and Laboratory Standards Institute (CLSI)*. <https://clsi.org/standards/products/microbiology/documents/m39/>.
|
||||
|
6
R/data.R
6
R/data.R
@@ -29,7 +29,10 @@
|
||||
|
||||
#' Data Sets with `r format(nrow(antimicrobials) + nrow(antivirals), big.mark = " ")` Antimicrobial Drugs
|
||||
#'
|
||||
#' @description
|
||||
#' Two data sets containing all antimicrobials and antivirals. Use [as.ab()] or one of the [`ab_*`][ab_property()] functions to retrieve values from the [antimicrobials] data set. Three identifiers are included in this data set: an antimicrobial ID (`ab`, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (`atc`) as defined by the WHO, and a Compound ID (`cid`) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes.
|
||||
#'
|
||||
#' **The `antibiotics` data set has been renamed to `antimicrobials`. The old name will be removed in a future version.**
|
||||
#' @format
|
||||
#' ### For the [antimicrobials] data set: a [tibble][tibble::tibble] with `r nrow(antimicrobials)` observations and `r ncol(antimicrobials)` variables:
|
||||
#' - `ab`\cr antimicrobial ID as used in this package (such as `AMC`), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. ***This is a unique identifier.***
|
||||
@@ -88,6 +91,9 @@
|
||||
#' antivirals
|
||||
"antimicrobials"
|
||||
|
||||
#' @rdname antimicrobials
|
||||
"antibiotics"
|
||||
|
||||
#' @rdname antimicrobials
|
||||
"antivirals"
|
||||
|
||||
|
@@ -72,7 +72,7 @@
|
||||
#'
|
||||
#' If there are more than two categories and you want to find out which ones are significantly different from their null expectation, you can use the same method of testing each category vs. the sum of all categories, with the Bonferroni correction. You use *G*-tests for each category, of course.
|
||||
#' @seealso [chisq.test()]
|
||||
#' @references 1. McDonald, J.H. 2014. **Handbook of Biological Statistics (3rd ed.)**. Sparky House Publishing, Baltimore, Maryland. <http://www.biostathandbook.com/gtestgof.html>.
|
||||
#' @references 1. McDonald, J.H. 2014. **Handbook of Biological Statistics (3rd ed.)**. Sparky House Publishing, Baltimore, Maryland.
|
||||
#' @source The code for this function is identical to that of [chisq.test()], except that:
|
||||
#' - The calculation of the statistic was changed to \eqn{2 * sum(x * log(x / E))}
|
||||
#' - Yates' continuity correction was removed as it does not apply to a *G*-test
|
||||
|
@@ -272,25 +272,24 @@ get_column_abx <- function(x,
|
||||
} else {
|
||||
message_(" WARNING.", add_fn = list(font_yellow, font_bold), as_note = FALSE)
|
||||
}
|
||||
|
||||
for (i in seq_len(length(out))) {
|
||||
if (isTRUE(verbose) && !names(out[i]) %in% names(duplicates)) {
|
||||
if (isTRUE(verbose) && !out[i] %in% duplicates) {
|
||||
message_(
|
||||
"Using column '", font_bold(out[i]), "' as input for ", names(out)[i],
|
||||
" (", ab_name(names(out)[i], tolower = TRUE, language = NULL), ")."
|
||||
)
|
||||
}
|
||||
if (names(out[i]) %in% names(duplicates)) {
|
||||
already_set_as <- out[unname(out) == unname(out[i])][1L]
|
||||
if (names(out)[i] != names(already_set_as)) {
|
||||
warning_(
|
||||
if (out[i] %in% duplicates) {
|
||||
already_set_as <- out[which(out == out[i])[1L]]
|
||||
if (names(out)[i] != already_set_as) {
|
||||
message_(
|
||||
paste0(
|
||||
"Column '", font_bold(out[i]), "' will not be used for ",
|
||||
names(out)[i], " (", ab_name(names(out)[i], tolower = TRUE, language = NULL), ")",
|
||||
", as it is already set for ",
|
||||
names(already_set_as), " (", ab_name(names(already_set_as), tolower = TRUE, language = NULL), ")"
|
||||
names(out)[i], " (", suppressMessages(ab_name(names(out)[i], tolower = TRUE, language = NULL, fast_mode = TRUE)), ")",
|
||||
", as this antimicrobial has already been set."
|
||||
),
|
||||
add_fn = font_red,
|
||||
immediate = verbose
|
||||
add_fn = font_red
|
||||
)
|
||||
}
|
||||
}
|
||||
|
18
R/mdro.R
18
R/mdro.R
@@ -1490,7 +1490,7 @@ mdro <- function(x = NULL,
|
||||
if (length(ESBLs) > 0) {
|
||||
trans_tbl(
|
||||
2, # positive, unconfirmed
|
||||
rows = which(x$order == "Enterobacterales" & x[[ESBLs[1]]] == "R" & x[[ESBLs[2]]] == "R" & is.na(esbl)),
|
||||
rows = which(x$order == "Enterobacterales" & col_values(x, ESBLs[1]) == "R" & col_values(x, ESBLs[2]) == "R" & is.na(esbl)),
|
||||
cols = c(AMX %or% AMP, cephalosporins_3rd),
|
||||
any_all = "all",
|
||||
reason = "Enterobacterales: potential ESBL"
|
||||
@@ -1526,9 +1526,9 @@ mdro <- function(x = NULL,
|
||||
)
|
||||
trans_tbl(
|
||||
3,
|
||||
rows = which(x[[SXT]] == "R" &
|
||||
(x[[GEN]] == "R" | x[[TOB]] == "R" | x[[AMK]] == "R") &
|
||||
(x[[CIP]] == "R" | x[[NOR]] == "R" | x[[LVX]] == "R") &
|
||||
rows = which(col_values(x, SXT) == "R" &
|
||||
(col_values(x, GEN) == "R" | col_values(x, TOB) == "R" | col_values(x, AMK) == "R") &
|
||||
(col_values(x, CIP) == "R" | col_values(x, NOR) == "R" | col_values(x, LVX) == "R") &
|
||||
(x$genus %in% c("Enterobacter", "Providencia") | paste(x$genus, x$species) %in% c("Citrobacter freundii", "Klebsiella aerogenes", "Hafnia alvei", "Morganella morganii"))),
|
||||
cols = c(SXT, aminoglycosides, fluoroquinolones),
|
||||
any_all = "any",
|
||||
@@ -1536,9 +1536,9 @@ mdro <- function(x = NULL,
|
||||
)
|
||||
trans_tbl(
|
||||
3,
|
||||
rows = which(x[[SXT]] == "R" &
|
||||
x[[GEN]] == "R" &
|
||||
(x[[CIP]] == "R" | x[[NOR]] == "R" | x[[LVX]] == "R") &
|
||||
rows = which(col_values(x, SXT) == "R" &
|
||||
col_values(x, GEN) == "R" &
|
||||
(col_values(x, CIP) == "R" | col_values(x, NOR) == "R" | col_values(x, LVX) == "R") &
|
||||
paste(x$genus, x$species) == "Serratia marcescens"),
|
||||
cols = c(SXT, aminoglycosides_serratia_marcescens, fluoroquinolones),
|
||||
any_all = "any",
|
||||
@@ -1548,8 +1548,8 @@ mdro <- function(x = NULL,
|
||||
# Acinetobacter baumannii-calcoaceticus complex
|
||||
trans_tbl(
|
||||
3,
|
||||
rows = which((x[[GEN]] == "R" | x[[TOB]] == "R" | x[[AMK]] == "R") &
|
||||
(x[[CIP]] == "R" | x[[LVX]] == "R") &
|
||||
rows = which((col_values(x, GEN) == "R" | col_values(x, TOB) == "R" | col_values(x, AMK) == "R") &
|
||||
(col_values(x, CIP) == "R" | col_values(x, LVX) == "R") &
|
||||
x[[col_mo]] %in% AMR::microorganisms.groups$mo[AMR::microorganisms.groups$mo_group_name == "Acinetobacter baumannii complex"]),
|
||||
cols = c(aminoglycosides, CIP, LVX),
|
||||
any_all = "any",
|
||||
|
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
@@ -35,10 +35,35 @@
|
||||
#' @rdname AMR-deprecated
|
||||
NULL
|
||||
|
||||
#' @rdname AMR-deprecated
|
||||
#' @usage NULL
|
||||
.amr_deprecation_warn <- function() {
|
||||
deprecation_warning(old = "antibiotics", new = "antimicrobials", is_dataset = TRUE)
|
||||
invisible(NULL)
|
||||
}
|
||||
#' @export
|
||||
"antibiotics"
|
||||
`[.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)
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
As with all previous >20 releases, some CHECKs might return a NOTE for *just* hitting the installation size limit, though its size has been brought down to a minimum in collaboration with CRAN maintainers previously.
|
||||
As with all previous >20 releases, some CHECKs on `oldrel` may return a `NOTE` for narrowly exceeding the installation size limit. This has been reduced to a minimum in prior coordination with CRAN maintainers and currently returns only an `INFO` on `release` and `devel`.
|
||||
|
||||
We consider this a high-impact package: it was published in the Journal of Statistical Software (2022), is included in a CRAN Task View (Epidemiology), and is according to download stats (cranlogs) used in almost all countries in the world. If there is anything to note, please let us know up-front without directly archiving the current version. That said, we continually unit test our package extensively and have no reason to assume that anything is wrong.
|
||||
We treat this as a high-impact package: it was published in the *Journal of Statistical Software* (2022), is listed in the CRAN Task View "Epidemiology", and (based on cranlogs download statistics) is used globally. If there is anything to address, we would appreciate being informed before archiving the current version. We conduct extensive automated unit testing and have no indication of unresolved issues.
|
||||
|
||||
Thanks for maintaining and hosting CRAN! It's empowering R and its use enormously!
|
||||
Thank you for your continued maintenance of CRAN, it plays a central role in the success and growth of the R ecosystem.
|
||||
|
@@ -625,6 +625,11 @@ if (changed_md5(dosage)) {
|
||||
try(arrow::write_parquet(dosage, "data-raw/datasets/dosage.parquet"), silent = TRUE)
|
||||
}
|
||||
|
||||
# Set `antibiotics` as a deprecated data set
|
||||
antibiotics <- structure(antimicrobials, class = c("deprecated_amr_dataset", class(antimicrobials)))
|
||||
usethis::use_data(antibiotics, internal = FALSE, overwrite = TRUE, compress = "xz", version = 2)
|
||||
rm(antibiotics)
|
||||
|
||||
suppressMessages(reset_AMR_locale())
|
||||
|
||||
devtools::load_all(quiet = TRUE)
|
||||
|
@@ -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.
BIN
data/antibiotics.rda
Normal file
BIN
data/antibiotics.rda
Normal file
Binary file not shown.
Binary file not shown.
@@ -192,7 +192,7 @@ out %>% set_ab_names(property = "atc")
|
||||
|
||||
This package was intended as a comprehensive toolbox for integrated AMR data analysis. This package can be used for:
|
||||
|
||||
* Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the List of Prokaryotic names with Standing in Nomenclature ([LPSN]((https://lpsn.dsmz.de))) and the Global Biodiversity Information Facility ([GBIF](https://www.gbif.org)) ([manual](./reference/mo_property.html))
|
||||
* Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the List of Prokaryotic names with Standing in Nomenclature ([LPSN](https://lpsn.dsmz.de)) and the Global Biodiversity Information Facility ([GBIF](https://www.gbif.org)) ([manual](./reference/mo_property.html))
|
||||
* Interpreting raw MIC and disk diffusion values, based on any CLSI or EUCAST guideline ([manual](./reference/as.sir.html))
|
||||
* Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records ([manual](./reference/ab_from_text.html))
|
||||
* Determining first isolates to be used for AMR data analysis ([manual](./reference/first_isolate.html))
|
||||
|
2
index.md
2
index.md
@@ -387,7 +387,7 @@ data analysis. This package can be used for:
|
||||
|
||||
- Reference for the taxonomy of microorganisms, since the package
|
||||
contains all microbial (sub)species from the List of Prokaryotic names
|
||||
with Standing in Nomenclature ([LPSN]((https://lpsn.dsmz.de))) and the
|
||||
with Standing in Nomenclature ([LPSN](https://lpsn.dsmz.de)) and the
|
||||
Global Biodiversity Information Facility
|
||||
([GBIF](https://www.gbif.org))
|
||||
([manual](./reference/mo_property.html))
|
||||
|
@@ -1,15 +1,10 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/zz_deprecated.R
|
||||
\docType{data}
|
||||
\name{AMR-deprecated}
|
||||
\alias{AMR-deprecated}
|
||||
\alias{antibiotics}
|
||||
\alias{ab_class}
|
||||
\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.
|
||||
}
|
||||
\usage{
|
||||
ab_class(...)
|
||||
|
||||
@@ -18,5 +13,4 @@ ab_selector(...)
|
||||
\description{
|
||||
These objects are so-called '\link{Deprecated}'. \strong{They will be removed in a future version of this package.} Using these will give a warning with the name of the alternative object it has been replaced by (if there is one).
|
||||
}
|
||||
\keyword{datasets}
|
||||
\keyword{internal}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
\source{
|
||||
\itemize{
|
||||
\item Bielicki JA \emph{et al.} (2016). \strong{Selecting appropriate empirical antibiotic regimens for paediatric bloodstream infections: application of a Bayesian decision model to local and pooled antimicrobial resistance surveillance data} \emph{Journal of Antimicrobial Chemotherapy} 71(3); \doi{10.1093/jac/dkv397}
|
||||
\item Bielicki JA \emph{et al.} (2020). \strong{Evaluation of the coverage of 3 antibiotic regimens for neonatal sepsis in the hospital setting across Asian countries} \emph{JAMA Netw Open.} 3(2):e1921124; \doi{10.1001.jamanetworkopen.2019.21124}
|
||||
\item Bielicki JA \emph{et al.} (2020). \strong{Evaluation of the coverage of 3 antibiotic regimens for neonatal sepsis in the hospital setting across Asian countries} \emph{JAMA Netw Open.} 3(2):e1921124; \doi{10.1001/jamanetworkopen.2019.21124}
|
||||
\item Klinker KP \emph{et al.} (2021). \strong{Antimicrobial stewardship and antibiograms: importance of moving beyond traditional antibiograms}. \emph{Therapeutic Advances in Infectious Disease}, May 5;8:20499361211011373; \doi{10.1177/20499361211011373}
|
||||
\item Barbieri E \emph{et al.} (2021). \strong{Development of a Weighted-Incidence Syndromic Combination Antibiogram (WISCA) to guide the choice of the empiric antibiotic treatment for urinary tract infection in paediatric patients: a Bayesian approach} \emph{Antimicrobial Resistance & Infection Control} May 1;10(1):74; \doi{10.1186/s13756-021-00939-2}
|
||||
\item \strong{M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 5th Edition}, 2022, \emph{Clinical and Laboratory Standards Institute (CLSI)}. \url{https://clsi.org/standards/products/microbiology/documents/m39/}.
|
||||
@@ -163,7 +163,7 @@ Set \code{digits} (defaults to \code{0}) to alter the rounding of the susceptibi
|
||||
|
||||
There are various antibiogram types, as summarised by Klinker \emph{et al.} (2021, \doi{10.1177/20499361211011373}), and they are all supported by \code{\link[=antibiogram]{antibiogram()}}.
|
||||
|
||||
For clinical coverage estimations, \strong{use WISCA whenever possible}, since it provides more precise coverage estimates by accounting for pathogen incidence and antimicrobial susceptibility, as has been shown by Bielicki \emph{et al.} (2020, \doi{10.1001.jamanetworkopen.2019.21124}). See the section \emph{Explaining WISCA} on this page. Do note that WISCA is pathogen-agnostic, meaning that the outcome is not stratied by pathogen, but rather by syndrome.
|
||||
For clinical coverage estimations, \strong{use WISCA whenever possible}, since it provides more precise coverage estimates by accounting for pathogen incidence and antimicrobial susceptibility, as has been shown by Bielicki \emph{et al.} (2020, \doi{10.1001/jamanetworkopen.2019.21124}). See the section \emph{Explaining WISCA} on this page. Do note that WISCA is pathogen-agnostic, meaning that the outcome is not stratied by pathogen, but rather by syndrome.
|
||||
\enumerate{
|
||||
\item \strong{Traditional Antibiogram}
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
\docType{data}
|
||||
\name{antimicrobials}
|
||||
\alias{antimicrobials}
|
||||
\alias{antibiotics}
|
||||
\alias{antivirals}
|
||||
\title{Data Sets with 617 Antimicrobial Drugs}
|
||||
\format{
|
||||
@@ -49,6 +50,8 @@ LOINC:
|
||||
}
|
||||
}
|
||||
|
||||
An object of class \code{deprecated_amr_dataset} (inherits from \code{tbl_df}, \code{tbl}, \code{data.frame}) with 497 rows and 14 columns.
|
||||
|
||||
An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 120 rows and 11 columns.
|
||||
}
|
||||
\source{
|
||||
@@ -61,10 +64,14 @@ An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) w
|
||||
\usage{
|
||||
antimicrobials
|
||||
|
||||
antibiotics
|
||||
|
||||
antivirals
|
||||
}
|
||||
\description{
|
||||
Two data sets containing all antimicrobials and antivirals. Use \code{\link[=as.ab]{as.ab()}} or one of the \code{\link[=ab_property]{ab_*}} functions to retrieve values from the \link{antimicrobials} data set. Three identifiers are included in this data set: an antimicrobial ID (\code{ab}, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (\code{atc}) as defined by the WHO, and a Compound ID (\code{cid}) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes.
|
||||
|
||||
\strong{The \code{antibiotics} data set has been renamed to \code{antimicrobials}. The old name will be removed in a future version.}
|
||||
}
|
||||
\details{
|
||||
Properties that are based on an ATC code are only available when an ATC is available. These properties are: \code{atc_group1}, \code{atc_group2}, \code{oral_ddd}, \code{oral_units}, \code{iv_ddd} and \code{iv_units}. Do note that ATC codes are not unique. For example, J01CR02 is officially the ATC code for "amoxicillin and beta-lactamase inhibitor". Consequently, these two items from the \link{antimicrobials} data set both return \code{"J01CR02"}:
|
||||
|
@@ -133,7 +133,7 @@ g.test(x)
|
||||
}
|
||||
\references{
|
||||
\enumerate{
|
||||
\item McDonald, J.H. 2014. \strong{Handbook of Biological Statistics (3rd ed.)}. Sparky House Publishing, Baltimore, Maryland. \url{http://www.biostathandbook.com/gtestgof.html}.
|
||||
\item McDonald, J.H. 2014. \strong{Handbook of Biological Statistics (3rd ed.)}. Sparky House Publishing, Baltimore, Maryland.
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
@@ -71,6 +71,7 @@ test_that("test-data.R", {
|
||||
if (AMR:::pkg_is_available("tibble")) {
|
||||
# there should be no diacritics (i.e. non ASCII) characters in the datasets (CRAN policy)
|
||||
datasets <- data(package = "AMR", envir = asNamespace("AMR"))$results[, "Item", drop = TRUE]
|
||||
datasets <- datasets[datasets != "antibiotics"]
|
||||
for (i in seq_len(length(datasets))) {
|
||||
dataset <- get(datasets[i], envir = asNamespace("AMR"))
|
||||
expect_identical(AMR:::dataset_UTF8_to_ASCII(dataset), dataset, info = datasets[i])
|
||||
|
@@ -48,7 +48,7 @@ test_that("test-mdro.R", {
|
||||
# example_isolates should have these finding using Dutch guidelines
|
||||
expect_equal(
|
||||
as.double(table(outcome)),
|
||||
c(1977, 23, 0)
|
||||
c(1977, 21, 2)
|
||||
)
|
||||
|
||||
expect_equal(
|
||||
|
@@ -36,7 +36,7 @@ The `AMR` package is available in `r AMR:::vector_and(vapply(FUN.VALUE = charact
|
||||
|
||||
This package was intended as a comprehensive toolbox for integrated AMR data analysis. This package can be used for:
|
||||
|
||||
* Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the List of Prokaryotic names with Standing in Nomenclature ([LPSN]((https://lpsn.dsmz.de))) and the Global Biodiversity Information Facility ([GBIF](https://www.gbif.org)) ([manual](https://amr-for-r.org/reference/mo_property.html))
|
||||
* Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the List of Prokaryotic names with Standing in Nomenclature ([LPSN](https://lpsn.dsmz.de)) and the Global Biodiversity Information Facility ([GBIF](https://www.gbif.org)) ([manual](https://amr-for-r.org/reference/mo_property.html))
|
||||
* Interpreting raw MIC and disk diffusion values, based on any CLSI or EUCAST guideline ([manual](https://amr-for-r.org/reference/as.sir.html))
|
||||
* Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records ([manual](https://amr-for-r.org/reference/ab_from_text.html))
|
||||
* Determining first isolates to be used for AMR data analysis ([manual](https://amr-for-r.org/reference/first_isolate.html))
|
||||
|
Reference in New Issue
Block a user