1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 09:31:58 +02:00

(v0.8.0.9033) antivirals data set, cleanup

This commit is contained in:
2019-11-18 12:10:47 +01:00
parent 67f3f4387b
commit 267320f15f
97 changed files with 1131 additions and 644 deletions

View File

@ -34,7 +34,7 @@
#' \item{\code{abbr}}{List of abbreviations as used in many countries, also for antibiotic susceptibility testing (AST)}
#' \item{\code{synonyms}}{Synonyms (often trade names) of a drug, as found in PubChem based on their compound ID}
#' \item{\code{oral_ddd}}{Defined Daily Dose (DDD), oral treatment}
#' \item{\code{oral_units}}{Units of \code{ddd_units}}
#' \item{\code{oral_units}}{Units of \code{oral_ddd}}
#' \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment}
#' \item{\code{iv_units}}{Units of \code{iv_ddd}}
#' }
@ -48,9 +48,28 @@
#' European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}
#' @inheritSection WHOCC WHOCC
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{microorganisms}}
#' @seealso \code{\link{antivirals}} \code{\link{microorganisms}}
"antibiotics"
#' Data set with ~100 antivirals
#'
#' A data set containing all antivirals, according to the ATC code group 'J05' (Antivirals for systemic use).
#' @format A \code{\link{data.frame}} with 102 observations and 7 variables:
#' \describe{
#' \item{\code{atc}}{ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC}
#' \item{\code{name}}{Official name as used by WHONET/EARS-Net or the WHO}
#' \item{\code{atc_group}}{Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC}
#' \item{\code{oral_ddd}}{Defined Daily Dose (DDD), oral treatment}
#' \item{\code{oral_units}}{Units of \code{oral_ddd}}
#' \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment}
#' \item{\code{iv_units}}{Units of \code{iv_ddd}}
#' }
#' @source World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology (WHOCC): \url{https://www.whocc.no/atc_ddd_index/}
#' @inheritSection WHOCC WHOCC
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{antibiotics}} \code{\link{microorganisms}}
"antivirals"
#' Data set with ~70,000 microorganisms
#'
#' A data set containing the microbial taxonomy of six kingdoms from the Catalogue of Life. MO codes can be looked up using \code{\link{as.mo}}.
@ -126,9 +145,9 @@ catalogue_of_life <- list(
#' @seealso \code{\link{as.mo}} \code{\link{microorganisms}}
"microorganisms.codes"
#' Data set with 2,000 blood culture isolates
#' Data set with 2,000 example isolates
#'
#' An anonymised data set containing 2,000 microbial blood culture isolates with their full antibiograms found 4 different hospitals in the Netherlands, between 2001 and 2017. This \code{data.frame} can be used to practice AMR analysis. For examples, please read \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{the tutorial on our website}.
#' A data set containing 2,000 microbial isolates with their full antibiograms. The data set reflects reality and can be used to practice AMR analysis. For examples, please read \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{the tutorial on our website}.
#' @format A \code{\link{data.frame}} with 2,000 observations and 49 variables:
#' \describe{
#' \item{\code{date}}{date of receipt at the laboratory}
@ -138,7 +157,7 @@ catalogue_of_life <- list(
#' \item{\code{ward_outpatient}}{logical to determine if ward is an outpatient clinic}
#' \item{\code{age}}{age of the patient}
#' \item{\code{gender}}{gender of the patient}
#' \item{\code{patient_id}}{ID of the patient, first 10 characters of an SHA hash containing irretrievable information}
#' \item{\code{patient_id}}{ID of the patient}
#' \item{\code{mo}}{ID of microorganism created with \code{\link{as.mo}}, see also \code{\link{microorganisms}}}
#' \item{\code{PEN:RIF}}{40 different antibiotics with class \code{rsi} (see \code{\link{as.rsi}}); these column names occur in \code{\link{antibiotics}} data set and can be translated with \code{\link{ab_name}}}
#' }
@ -183,17 +202,17 @@ catalogue_of_life <- list(
#' Data set for RSI interpretation
#'
#' Data set to interpret MIC and disk diffusion to RSI values. Included guidelines are CLSI (2011-2019) and EUCAST (2011-2019). Use \code{\link{as.rsi}} to transform MICs or disks measurements to RSI values.
#' @format A \code{\link{data.frame}} with 11,559 observations and 9 variables:
#' @format A \code{\link{data.frame}} with 13,975 observations and 9 variables:
#' \describe{
#' \item{\code{guideline}}{Name of the guideline}
#' \item{\code{method}}{Either "MIC" or "DISK"}
#' \item{\code{site}}{Body site, e.g. "Oral" or "Respiratory"}
#' \item{\code{mo}}{Microbial ID, see \code{\link{as.mo}}}
#' \item{\code{ab}}{Antibiotic ID, see \code{\link{as.ab}}}
#' \item{\code{ref_tbl}}{Info about where the guideline rule can be found}
#' \item{\code{S_mic}}{Lowest MIC value that leads to "S"}
#' \item{\code{R_mic}}{Highest MIC value that leads to "R"}
#' \item{\code{dose_disk}}{Dose of the used disk diffusion method}
#' \item{\code{S_disk}}{Lowest number of millimeters that leads to "S"}
#' \item{\code{R_disk}}{Highest number of millimeters that leads to "R"}
#' \item{\code{disk_dose}}{Dose of the used disk diffusion method}
#' \item{\code{breakpoint_S}}{Lowest MIC value or highest number of millimeters that leads to "S"}
#' \item{\code{breakpoint_R}}{Highest MIC value or lowest number of millimeters that leads to "R"}
#' }
#' @inheritSection AMR Read more on our website!
"rsi_translation"

View File

@ -163,6 +163,7 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016"
#' }
#' @inheritSection AMR Read more on our website!
#' @examples
#' \donttest{
#' a <- data.frame(mo = c("Staphylococcus aureus",
#' "Enterococcus faecalis",
#' "Escherichia coli",
@ -198,7 +199,6 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016"
#' # 5 Pseudomonas aeruginosa R R - - R R R
#'
#'
#' \donttest{
#' # do not apply EUCAST rules, but rather get a data.frame
#' # with 18 rows, containing all details about the transformations:
#' c <- eucast_rules(a, verbose = TRUE)

View File

@ -54,29 +54,24 @@
#' @rdname mdro
#' @aliases MDR XDR PDR BRMO 3MRGN 4MRGN
#' @importFrom dplyr %>% filter_at vars all_vars pull mutate_at
#' @importFrom crayon blue bold italic
#' @importFrom crayon blue bold italic red
#' @importFrom cleaner percentage
#' @export
#' @inheritSection AMR Read more on our website!
#' @source
#' Please see Details for the list of publications used for this function.
#' @examples
#' \donttest{
#' library(dplyr)
#'
#' example_isolates %>%
#' mdro() %>%
#' freq()
#'
#' \donttest{
#' example_isolates %>%
#' mutate(EUCAST = eucast_exceptional_phenotypes(.),
#' BRMO = brmo(.),
#' MRGN = mrgn(.))
#'
#' example_isolates %>%
#' rename(PIP = TZP) %>% # no piperacillin, so take piperacillin/tazobactam
#' mrgn() %>% # check German guideline
#' freq() # check frequencies
#' }
mdro <- function(x,
guideline = NULL,
@ -155,7 +150,7 @@ mdro <- function(x,
guideline$name <- "Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance."
guideline$author <- "Magiorakos AP, Srinivasan A, Carey RB, ..., Vatopoulos A, Weber JT, Monnet DL"
guideline$version <- "N/A"
guideline$source <- "Magiorakos et al. (2012) Clinical Microbiology and Infection 18:3. DOI: 10.1111/j.1469-0691.2011.03570.x"
guideline$source <- "Clinical Microbiology and Infection 18:3, 2012. DOI: 10.1111/j.1469-0691.2011.03570.x"
} else if (guideline$code == "eucast") {
guideline$name <- "EUCAST Expert Rules, \"Intrinsic Resistance and Exceptional Phenotypes Tables\""
@ -174,7 +169,7 @@ mdro <- function(x,
guideline$name <- "Cross-border comparison of the Dutch and German guidelines on multidrug-resistant Gram-negative microorganisms"
guideline$author <- "M\u00fcller J, Voss A, K\u00f6ck R, ..., Kern WV, Wendt C, Friedrich AW"
guideline$version <- "N/A"
guideline$source <- "M\u00fcller et al. (2015) Antimicrobial Resistance and Infection Control 4:7. DOI: 10.1186/s13756-015-0047-6"
guideline$source <- "Antimicrobial Resistance and Infection Control 4:7, 2015. DOI: 10.1186/s13756-015-0047-6"
} else if (guideline$code == "brmo") {
guideline$name <- "WIP-Richtlijn Bijzonder Resistente Micro-organismen (BRMO)"
@ -422,9 +417,9 @@ mdro <- function(x,
if (info == TRUE) {
if (combine_SI == TRUE) {
cat("\nOnly results with 'R' are considered as resistance. Use `combine_SI = FALSE` to also consider 'I' as resistance.\n")
cat(red("\nOnly results with 'R' are considered as resistance. Use `combine_SI = FALSE` to also consider 'I' as resistance.\n"))
} else {
cat("\nResults with 'R' or 'I' are considered as resistance. Use `combine_SI = TRUE` to only consider 'R' as resistance.\n")
cat(red("\nResults with 'R' or 'I' are considered as resistance. Use `combine_SI = TRUE` to only consider 'R' as resistance.\n"))
}
cat("\nDetermining multidrug-resistant organisms (MDRO), according to:\n",
bold("Guideline: "), italic(guideline$name), "\n",

22
R/mo.R
View File

@ -572,22 +572,21 @@ exec_as.mo <- function(x,
# add start en stop regex
x <- paste0("^", x, "$")
x_withspaces_start_only <- paste0("^", x_withspaces)
x_withspaces_end_only <- paste0(x_withspaces, "$")
x_withspaces_start_end <- paste0("^", x_withspaces, "$")
if (isTRUE(debug)) {
cat(paste0(blue('x'), ' "', x, '"\n'))
cat(paste0(blue('x_species'), ' "', x_species, '"\n'))
cat(paste0(blue('x_withspaces_start_only'), ' "', x_withspaces_start_only, '"\n'))
cat(paste0(blue('x_withspaces_end_only'), ' "', x_withspaces_end_only, '"\n'))
cat(paste0(blue('x_withspaces_start_end'), ' "', x_withspaces_start_end, '"\n'))
cat(paste0(blue('x_backup'), ' "', x_backup, '"\n'))
cat(paste0(blue('x_backup_without_spp'), ' "', x_backup_without_spp, '"\n'))
cat(paste0(blue('x_trimmed'), ' "', x_trimmed, '"\n'))
cat(paste0(blue('x_trimmed_species'), ' "', x_trimmed_species, '"\n'))
cat(paste0(blue('x_trimmed_without_group'), ' "', x_trimmed_without_group, '"\n'))
cat(paste0(blue("x"), ' "', x, '"\n'))
cat(paste0(blue("x_species"), ' "', x_species, '"\n'))
cat(paste0(blue("x_withspaces_start_only"), ' "', x_withspaces_start_only, '"\n'))
cat(paste0(blue("x_withspaces_end_only"), ' "', x_withspaces_end_only, '"\n'))
cat(paste0(blue("x_withspaces_start_end"), ' "', x_withspaces_start_end, '"\n'))
cat(paste0(blue("x_backup"), ' "', x_backup, '"\n'))
cat(paste0(blue("x_backup_without_spp"), ' "', x_backup_without_spp, '"\n'))
cat(paste0(blue("x_trimmed"), ' "', x_trimmed, '"\n'))
cat(paste0(blue("x_trimmed_species"), ' "', x_trimmed_species, '"\n'))
cat(paste0(blue("x_trimmed_without_group"), ' "', x_trimmed_without_group, '"\n'))
}
progress <- progress_estimated(n = length(x), min_time = 3)
@ -1782,6 +1781,7 @@ pillar_shaft.mo <- function(x, ...) {
out[is.na(x)] <- pillar::style_na(" NA")
out[x == "UNKNOWN"] <- pillar::style_na(" UNKNOWN")
# make it always fit exactly
pillar::new_pillar_shaft_simple(out, align = "left", width = max(nchar(x)))
}

View File

@ -24,7 +24,7 @@
#' All antimicrobial drugs and their official names, ATC codes, ATC groups and defined daily dose (DDD) are included in this package, using the WHO Collaborating Centre for Drug Statistics Methodology.
#' @section WHOCC:
#' \if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr}
#' This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}).
#' This package contains \strong{all ~550 antibiotic, antimycotic and antiviral drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}).
#'
#' These have become the gold standard for international drug utilisation monitoring and research.
#'