(v2.1.1.9186) replace antibiotics with antimicrobials!

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2025-03-07 20:43:26 +01:00
1 parent f2b2a450cb
commit f7938289eb
140 files changed
+4870 -4702

No files matched your search

+3 -3
View File
@@ -115,7 +115,7 @@ example_isolates['date'] = pd.to_datetime(example_isolates['date'])
# microorganisms
microorganisms = pandas2ri.rpy2py(robjects.r('AMR::microorganisms[, !sapply(AMR::microorganisms, is.list)]'))
antibiotics = pandas2ri.rpy2py(robjects.r('AMR::antibiotics[, !sapply(AMR::antibiotics, is.list)]'))
antimicrobials = pandas2ri.rpy2py(robjects.r('AMR::antimicrobials[, !sapply(AMR::antimicrobials, is.list)]'))
clinical_breakpoints = pandas2ri.rpy2py(robjects.r('AMR::clinical_breakpoints[, !sapply(AMR::clinical_breakpoints, is.list)]'))
base.options(warn = 0)
@@ -125,7 +125,7 @@ EOL
echo "from .datasets import example_isolates" >> $init_file
echo "from .datasets import microorganisms" >> $init_file
echo "from .datasets import antibiotics" >> $init_file
echo "from .datasets import antimicrobials" >> $init_file
echo "from .datasets import clinical_breakpoints" >> $init_file
@@ -239,7 +239,7 @@ for rd_file in "$rd_dir"/*.Rd; do
}
# Skip functions matching the regex pattern
if (func_name_py ~ /^(x |facet|scale|set|get|NA_|microorganisms|antibiotics|clinical_breakpoints|example_isolates)/) {
if (func_name_py ~ /^(x |facet|scale|set|get|NA_|microorganisms|antimicrobials|clinical_breakpoints|example_isolates)/) {
next
}
+39 -39
View File
@@ -364,98 +364,98 @@ pre_commit_lst$MO_RELEVANT_GENERA <- c(
# antibiotic groups
# (these will also be used for eucast_rules() and understanding data-raw/eucast_rules.tsv)
pre_commit_lst$AB_AMINOGLYCOSIDES <- antibiotics %>%
pre_commit_lst$AB_AMINOGLYCOSIDES <- antimicrobials %>%
filter(group %like% "aminoglycoside") %>%
pull(ab)
pre_commit_lst$AB_AMINOPENICILLINS <- as.ab(c("AMP", "AMX"))
pre_commit_lst$AB_ANTIFUNGALS <- antibiotics %>%
pre_commit_lst$AB_ANTIFUNGALS <- antimicrobials %>%
filter(group %like% "antifungal") %>%
pull(ab)
pre_commit_lst$AB_ANTIMYCOBACTERIALS <- antibiotics %>%
pre_commit_lst$AB_ANTIMYCOBACTERIALS <- antimicrobials %>%
filter(group %like% "antimycobacterial") %>%
pull(ab)
pre_commit_lst$AB_CARBAPENEMS <- antibiotics %>%
pre_commit_lst$AB_CARBAPENEMS <- antimicrobials %>%
filter(group %like% "carbapenem") %>%
pull(ab)
pre_commit_lst$AB_CEPHALOSPORINS <- antibiotics %>%
pre_commit_lst$AB_CEPHALOSPORINS <- antimicrobials %>%
filter(group %like% "cephalosporin") %>%
pull(ab)
pre_commit_lst$AB_CEPHALOSPORINS_1ST <- antibiotics %>%
pre_commit_lst$AB_CEPHALOSPORINS_1ST <- antimicrobials %>%
filter(group %like% "cephalosporin.*1") %>%
pull(ab)
pre_commit_lst$AB_CEPHALOSPORINS_2ND <- antibiotics %>%
pre_commit_lst$AB_CEPHALOSPORINS_2ND <- antimicrobials %>%
filter(group %like% "cephalosporin.*2") %>%
pull(ab)
pre_commit_lst$AB_CEPHALOSPORINS_3RD <- antibiotics %>%
pre_commit_lst$AB_CEPHALOSPORINS_3RD <- antimicrobials %>%
filter(group %like% "cephalosporin.*3") %>%
pull(ab)
pre_commit_lst$AB_CEPHALOSPORINS_4TH <- antibiotics %>%
pre_commit_lst$AB_CEPHALOSPORINS_4TH <- antimicrobials %>%
filter(group %like% "cephalosporin.*4") %>%
pull(ab)
pre_commit_lst$AB_CEPHALOSPORINS_5TH <- antibiotics %>%
pre_commit_lst$AB_CEPHALOSPORINS_5TH <- antimicrobials %>%
filter(group %like% "cephalosporin.*5") %>%
pull(ab)
pre_commit_lst$AB_CEPHALOSPORINS_EXCEPT_CAZ <- pre_commit_lst$AB_CEPHALOSPORINS[pre_commit_lst$AB_CEPHALOSPORINS != "CAZ"]
pre_commit_lst$AB_FLUOROQUINOLONES <- antibiotics %>%
pre_commit_lst$AB_FLUOROQUINOLONES <- antimicrobials %>%
filter(atc_group2 %like% "fluoroquinolone" | (group %like% "quinolone" & is.na(atc_group2))) %>%
pull(ab)
pre_commit_lst$AB_GLYCOPEPTIDES <- antibiotics %>%
pre_commit_lst$AB_GLYCOPEPTIDES <- antimicrobials %>%
filter(group %like% "glycopeptide") %>%
pull(ab)
pre_commit_lst$AB_ISOXAZOLYLPENICILLINS <- antibiotics %>%
pre_commit_lst$AB_ISOXAZOLYLPENICILLINS <- antimicrobials %>%
filter(name %like% "oxacillin|cloxacillin|dicloxacillin|flucloxacillin|meth?icillin") %>%
pull(ab)
pre_commit_lst$AB_LIPOGLYCOPEPTIDES <- as.ab(c("DAL", "ORI", "TLV")) # dalba/orita/tela
pre_commit_lst$AB_GLYCOPEPTIDES_EXCEPT_LIPO <- pre_commit_lst$AB_GLYCOPEPTIDES[!pre_commit_lst$AB_GLYCOPEPTIDES %in% pre_commit_lst$AB_LIPOGLYCOPEPTIDES]
pre_commit_lst$AB_LINCOSAMIDES <- antibiotics %>%
pre_commit_lst$AB_LINCOSAMIDES <- antimicrobials %>%
filter(atc_group2 %like% "lincosamide" | (group %like% "lincosamide" & is.na(atc_group2) & name %like% "^(pirlimycin)" & name %unlike% "screening|inducible")) %>%
pull(ab)
pre_commit_lst$AB_MACROLIDES <- antibiotics %>%
pre_commit_lst$AB_MACROLIDES <- antimicrobials %>%
filter(atc_group2 %like% "macrolide" | (group %like% "macrolide" & is.na(atc_group2) & name %like% "^(acetylmidecamycin|acetylspiramycin|gamith?romycin|kitasamycin|meleumycin|nafith?romycin|solith?romycin|tildipirosin|tilmicosin|tulath?romycin|tylosin|tylvalosin)" & name %unlike% "screening|inducible")) %>%
pull(ab)
pre_commit_lst$AB_MONOBACTAMS <- antibiotics %>%
pre_commit_lst$AB_MONOBACTAMS <- antimicrobials %>%
filter(group %like% "monobactam") %>%
pull(ab)
pre_commit_lst$AB_NITROFURANS <- antibiotics %>%
pre_commit_lst$AB_NITROFURANS <- antimicrobials %>%
filter(name %like% "^furaz|nitrofura" | atc_group2 %like% "nitrofuran") %>%
pull(ab)
pre_commit_lst$AB_OXAZOLIDINONES <- antibiotics %>%
pre_commit_lst$AB_OXAZOLIDINONES <- antimicrobials %>%
filter(group %like% "oxazolidinone") %>%
pull(ab)
pre_commit_lst$AB_PENICILLINS <- antibiotics %>%
pre_commit_lst$AB_PENICILLINS <- antimicrobials %>%
filter(group %like% "penicillin" & !(name %unlike% "/" & name %like% ".*bactam$")) %>%
pull(ab)
pre_commit_lst$AB_PHENICOLS <- antibiotics %>%
pre_commit_lst$AB_PHENICOLS <- antimicrobials %>%
filter(group %like% "phenicol" | atc_group1 %like% "phenicol" | atc_group2 %like% "phenicol") %>%
pull(ab)
pre_commit_lst$AB_POLYMYXINS <- antibiotics %>%
pre_commit_lst$AB_POLYMYXINS <- antimicrobials %>%
filter(group %like% "polymyxin") %>%
pull(ab)
pre_commit_lst$AB_QUINOLONES <- antibiotics %>%
pre_commit_lst$AB_QUINOLONES <- antimicrobials %>%
filter(group %like% "quinolone") %>%
pull(ab)
pre_commit_lst$AB_RIFAMYCINS <- antibiotics %>%
pre_commit_lst$AB_RIFAMYCINS <- antimicrobials %>%
filter(name %like% "Rifampi|Rifabutin|Rifapentine|rifamy") %>%
pull(ab)
pre_commit_lst$AB_STREPTOGRAMINS <- antibiotics %>%
pre_commit_lst$AB_STREPTOGRAMINS <- antimicrobials %>%
filter(atc_group2 %like% "streptogramin") %>%
pull(ab)
pre_commit_lst$AB_TETRACYCLINES <- antibiotics %>%
pre_commit_lst$AB_TETRACYCLINES <- antimicrobials %>%
filter(group %like% "tetracycline") %>%
pull(ab)
pre_commit_lst$AB_TETRACYCLINES_EXCEPT_TGC <- pre_commit_lst$AB_TETRACYCLINES[pre_commit_lst$AB_TETRACYCLINES != "TGC"]
pre_commit_lst$AB_TRIMETHOPRIMS <- antibiotics %>%
pre_commit_lst$AB_TRIMETHOPRIMS <- antimicrobials %>%
filter(group %like% "trimethoprim") %>%
pull(ab)
pre_commit_lst$AB_UREIDOPENICILLINS <- as.ab(c("PIP", "TZP", "AZL", "MEZ"))
pre_commit_lst$AB_BETALACTAMS <- sort(c(pre_commit_lst$AB_PENICILLINS, pre_commit_lst$AB_CEPHALOSPORINS, pre_commit_lst$AB_CARBAPENEMS, pre_commit_lst$AB_MONOBACTAMS))
pre_commit_lst$AB_BETALACTAMS_WITH_INHIBITOR <- antibiotics %>%
pre_commit_lst$AB_BETALACTAMS_WITH_INHIBITOR <- antimicrobials %>%
filter(name %like% "/" & name %unlike% "EDTA" & ab %in% pre_commit_lst$AB_BETALACTAMS) %>%
pull(ab)
# this will be used for documentation:
pre_commit_lst$DEFINED_AB_GROUPS <- sort(names(pre_commit_lst)[names(pre_commit_lst) %like% "^AB_" & names(pre_commit_lst) != "AB_LOOKUP"])
pre_commit_lst$AB_LOOKUP <- create_AB_AV_lookup(antibiotics)
pre_commit_lst$AB_LOOKUP <- create_AB_AV_lookup(antimicrobials)
pre_commit_lst$AV_LOOKUP <- create_AB_AV_lookup(antivirals)
# Export to package as internal data ----
@@ -506,7 +506,7 @@ changed_md5 <- function(object) {
# give official names to ABs and MOs
clin_break <- clinical_breakpoints %>%
mutate(mo_name = microorganisms$fullname[match(mo, microorganisms$mo)], .after = mo) %>%
mutate(ab_name = antibiotics$name[match(ab, antibiotics$ab)], .after = ab)
mutate(ab_name = antimicrobials$name[match(ab, antimicrobials$ab)], .after = ab)
if (changed_md5(clin_break)) {
usethis::ui_info(paste0("Saving {usethis::ui_value('clinical_breakpoints')} to {usethis::ui_value('data-raw/')}"))
write_md5(clin_break)
@@ -560,18 +560,18 @@ if (changed_md5(microorganisms.groups)) {
try(arrow::write_parquet(microorganisms.groups, "data-raw/microorganisms.groups.parquet"), silent = TRUE)
}
ab <- dplyr::mutate_if(antibiotics, ~ !is.numeric(.), as.character)
ab <- dplyr::mutate_if(antimicrobials, ~ !is.numeric(.), as.character)
if (changed_md5(ab)) {
usethis::ui_info(paste0("Saving {usethis::ui_value('antibiotics')} to {usethis::ui_value('data-raw/')}"))
usethis::ui_info(paste0("Saving {usethis::ui_value('antimicrobials')} to {usethis::ui_value('data-raw/')}"))
write_md5(ab)
try(saveRDS(antibiotics, "data-raw/antibiotics.rds", version = 2, compress = "xz"), silent = TRUE)
try(haven::write_sav(ab, "data-raw/antibiotics.sav"), silent = TRUE)
try(haven::write_dta(ab, "data-raw/antibiotics.dta"), silent = TRUE)
ab_lists <- antibiotics %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
try(write.table(ab_lists, "data-raw/antibiotics.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
try(openxlsx2::write_xlsx(ab_lists, "data-raw/antibiotics.xlsx"), silent = TRUE)
try(arrow::write_feather(antibiotics, "data-raw/antibiotics.feather"), silent = TRUE)
try(arrow::write_parquet(antibiotics, "data-raw/antibiotics.parquet"), silent = TRUE)
try(saveRDS(antimicrobials, "data-raw/antimicrobials.rds", version = 2, compress = "xz"), silent = TRUE)
try(haven::write_sav(ab, "data-raw/antimicrobials.sav"), silent = TRUE)
try(haven::write_dta(ab, "data-raw/antimicrobials.dta"), silent = TRUE)
ab_lists <- antimicrobials %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
try(write.table(ab_lists, "data-raw/antimicrobials.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
try(openxlsx2::write_xlsx(ab_lists, "data-raw/antimicrobials.xlsx"), silent = TRUE)
try(arrow::write_feather(antimicrobials, "data-raw/antimicrobials.feather"), silent = TRUE)
try(arrow::write_parquet(antimicrobials, "data-raw/antimicrobials.parquet"), silent = TRUE)
}
av <- dplyr::mutate_if(antivirals, ~ !is.numeric(.), as.character)
@@ -1,6 +1,6 @@
This knowledge base contains all context you must know about the AMR package for R. You are a GPT trained to be an assistant for the AMR package in R. You are an incredible R specialist, especially trained in this package and in the tidyverse.
First and foremost, you are trained on version 2.1.1.9183. Remember this whenever someone asks which AMR package version you’re at.
First and foremost, you are trained on version 2.1.1.9186. Remember this whenever someone asks which AMR package version you’re at.
Below are the contents of the file, the file, and all the files (documentation) in the package. Every file content is split using 100 hypens.
----------------------------------------------------------------------------------------------------
@@ -170,6 +170,7 @@ export(amr_distance_from_row)
export(amr_selector)
export(anti_join_microorganisms)
export(antibiogram)
export(antibiotics)
export(antifungals)
export(antimicrobials_equal)
export(antimycobacterials)
@@ -419,7 +420,7 @@ The `AMR` package is a [free and open-source](#copyright) R package with [zero d
This work was published in the Journal of Statistical Software (Volume 104(3); [DOI 10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)) and formed the basis of two PhD theses ([DOI 10.33612/diss.177417131](https://doi.org/10.33612/diss.177417131) and [DOI 10.33612/diss.192486375](https://doi.org/10.33612/diss.192486375)).
After installing this package, R knows [**~52,000 distinct microbial species**](./reference/microorganisms.html) (updated December 2022) and all [**~600 antibiotic, antimycotic and antiviral drugs**](./reference/antibiotics.html) by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI and EUCAST are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). **It was designed to work in any setting, including those with very limited resources**. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the [University of Groningen](https://www.rug.nl), in collaboration with non-profit organisations [Certe Medical Diagnostics and Advice Foundation](https://www.certe.nl) and [University Medical Center Groningen](https://www.umcg.nl).
After installing this package, R knows [**~52,000 distinct microbial species**](./reference/microorganisms.html) (updated December 2022) and all [**~600 antimicrobial and antiviral drugs**](./reference/antibiotics.html) by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI and EUCAST are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). **It was designed to work in any setting, including those with very limited resources**. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the [University of Groningen](https://www.rug.nl), in collaboration with non-profit organisations [Certe Medical Diagnostics and Advice Foundation](https://www.certe.nl) and [University Medical Center Groningen](https://www.umcg.nl).
##### Used in over 175 countries, available in 20 languages
@@ -451,7 +452,7 @@ example_isolates %>%
carbapenems())
```
With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (`mo_is_gram_negative()` and `mo_is_intrinsic_resistant()`) and a column selection on two antibiotic groups (`aminoglycosides()` and `carbapenems()`), the reference data about [all microorganisms](./reference/microorganisms.html) and [all antibiotics](./reference/antibiotics.html) in the `AMR` package make sure you get what you meant:
With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (`mo_is_gram_negative()` and `mo_is_intrinsic_resistant()`) and a column selection on two antibiotic groups (`aminoglycosides()` and `carbapenems()`), the reference data about [all microorganisms](./reference/microorganisms.html) and [all antimicrobials](./reference/antimicrobials.html) in the `AMR` package make sure you get what you meant:
|bacteria | GEN | TOB | AMK | KAN | IPM | MEM |
|:------------------------------|:---:|:---:|:---:|:---:|:---:|:---:|
@@ -474,7 +475,8 @@ If used inside [R Markdown](https://rmarkdown.rstudio.com) or [Quarto](https://q
```r
antibiogram(example_isolates,
antibiotics = c(aminoglycosides(), carbapenems()))
antibiotics = c(aminoglycosides(), carbapenems()),
formatting_type = 14)
```
| Pathogen | Amikacin | Gentamicin | Imipenem | Kanamycin | Meropenem | Tobramycin |
@@ -495,7 +497,8 @@ In combination antibiograms, it is clear that combined antibiotics yield higher
```r
antibiogram(example_isolates,
antibiotics = c("TZP", "TZP+TOB", "TZP+GEN"),
mo_transform = "gramstain")
mo_transform = "gramstain",
formatting_type = 14)
```
|Pathogen | Piperacillin/tazobactam | Piperacillin/tazobactam + Gentamicin | Piperacillin/tazobactam + Tobramycin |
@@ -510,6 +513,7 @@ antibiogram(example_isolates,
antibiotics = c("cipro", "tobra", "genta"), # any arbitrary name or code will work
mo_transform = "gramstain",
ab_transform = "name",
formatting_type = 14,
language = "uk") # Ukrainian
```
@@ -720,19 +724,27 @@ THE PART HEREAFTER CONTAINS CONTENTS FROM FILE 'man/AMR-deprecated.Rd':
% 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}
\format{
An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 487 rows and 14 columns.
}
\usage{
antibiotics
ab_class(...)
ab_selector(...)
}
\description{
These functions are so-called '\link{Deprecated}'. \strong{They will be removed in a future version of this package.} Using these functions will give a warning with the name of the function it has been replaced by (if there is one).
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}
@@ -752,7 +764,7 @@ This is an overview of all the package-specific \code{\link[=options]{options()}
\section{Options}{
\itemize{
\item \code{AMR_antibiogram_formatting_type} \cr A \link{numeric} (1-12) to use in \code{\link[=antibiogram]{antibiogram()}}, to indicate which formatting type to use.
\item \code{AMR_antibiogram_formatting_type} \cr A \link{numeric} (1-22) to use in \code{\link[=antibiogram]{antibiogram()}}, to indicate which formatting type to use.
\item \code{AMR_breakpoint_type} \cr A \link{character} to use in \code{\link[=as.sir]{as.sir()}}, to indicate which breakpoint type to use. This must be either "ECOFF", "animal", or "human".
\item \code{AMR_cleaning_regex} \cr A \link[base:regex]{regular expression} (case-insensitive) to use in \code{\link[=as.mo]{as.mo()}} and all \code{\link[=mo_property]{mo_*}} functions, to clean the user input. The default is the outcome of \code{\link[=mo_cleaning_regex]{mo_cleaning_regex()}}, which removes texts between brackets and texts such as "species" and "serovar".
\item \code{AMR_custom_ab} \cr A file location to an RDS file, to use custom antimicrobial drugs with this package. This is explained in \code{\link[=add_custom_antimicrobials]{add_custom_antimicrobials()}}.
@@ -781,7 +793,7 @@ In this file, you can set options such as...
options(AMR_include_PKPD = TRUE)
}\if{html}{\out{</div>}}
...to add Portuguese language support of antibiotics, and allow PK/PD rules when interpreting MIC values with \code{\link[=as.sir]{as.sir()}}.
...to add Portuguese language support of antimicrobials, and allow PK/PD rules when interpreting MIC values with \code{\link[=as.sir]{as.sir()}}.
\subsection{Share Options Within Team}{
For a more global approach, e.g. within a (data) team, save an options file to a remote file location, such as a shared network drive, and have each user read in this file automatically at start-up. This would work in this way:
@@ -840,13 +852,13 @@ The \code{AMR} package is a \href{https://msberends.github.io/AMR/#copyright}{fr
This work was published in the Journal of Statistical Software (Volume 104(3); \doi{10.18637/jss.v104.i03}) and formed the basis of two PhD theses (\doi{10.33612/diss.177417131} and \doi{10.33612/diss.192486375}).
After installing this package, R knows \href{https://msberends.github.io/AMR/reference/microorganisms.html}{\strong{~79 000 microorganisms}} (updated June 2024) and all \href{https://msberends.github.io/AMR/reference/antibiotics.html}{\strong{~610 antibiotic, antimycotic and antiviral drugs}} by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI and EUCAST are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). \strong{It was designed to work in any setting, including those with very limited resources}. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the public \href{https://www.rug.nl}{University of Groningen}, in collaboration with non-profit organisations \href{https://www.certe.nl}{Certe Medical Diagnostics and Advice Foundation} and \href{https://www.umcg.nl}{University Medical Center Groningen}.
After installing this package, R knows \href{https://msberends.github.io/AMR/reference/microorganisms.html}{\strong{~79 000 microorganisms}} (updated June 2024) and all \href{https://msberends.github.io/AMR/reference/antimicrobials.html}{\strong{~610 antibiotic, antimycotic and antiviral drugs}} by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI and EUCAST are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). \strong{It was designed to work in any setting, including those with very limited resources}. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the public \href{https://www.rug.nl}{University of Groningen}, in collaboration with non-profit organisations \href{https://www.certe.nl}{Certe Medical Diagnostics and Advice Foundation} and \href{https://www.umcg.nl}{University Medical Center Groningen}.
The \code{AMR} package is available in English, Chinese, Czech, Danish, Dutch, Finnish, French, German, Greek, Italian, Japanese, Norwegian, Polish, Portuguese, Romanian, Russian, Spanish, Swedish, Turkish, and Ukrainian. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages.
}
\section{Reference Data Publicly Available}{
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
All data sets in this \code{AMR} package (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
\seealso{
@@ -969,14 +981,14 @@ A \link[tibble:tibble]{tibble} with 500 observations and 53 variables:
\item \verb{Inducible clindamycin resistance}\cr Clindamycin can be induced?
\item \code{Comment}\cr Other comments
\item \verb{Date of data entry}\cr \link{Date} this data was entered in WHONET
\item \code{AMP_ND10:CIP_EE}\cr 28 different antibiotics. You can lookup the abbreviations in the \link{antibiotics} data set, or use e.g. \code{\link[=ab_name]{ab_name("AMP")}} to get the official name immediately. Before analysis, you should transform this to a valid antibiotic class, using \code{\link[=as.sir]{as.sir()}}.
\item \code{AMP_ND10:CIP_EE}\cr 28 different antimicrobials. You can lookup the abbreviations in the \link{antimicrobials} data set, or use e.g. \code{\link[=ab_name]{ab_name("AMP")}} to get the official name immediately. Before analysis, you should transform this to a valid antimcrobial class, using \code{\link[=as.sir]{as.sir()}}.
}
}
\usage{
WHONET
}
\description{
This example data set has the exact same structure as an export file from WHONET. Such files can be used with this package, as this example data set shows. The antibiotic results are from our \link{example_isolates} data set. All patient names were created using online surname generators and are only in place for practice purposes.
This example data set has the exact same structure as an export file from WHONET. Such files can be used with this package, as this example data set shows. The antimcrobial results are from our \link{example_isolates} data set. All patient names were created using online surname generators and are only in place for practice purposes.
}
\details{
Like all data sets in this package, this data set is publicly available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
@@ -1009,7 +1021,7 @@ ab_from_text(text, type = c("drug", "dose", "administration"),
\item{collapse}{a \link{character} to pass on to \code{paste(, collapse = ...)} to only return one \link{character} per element of \code{text}, see \emph{Examples}}
\item{translate_ab}{if \code{type = "drug"}: a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}. The default is \code{FALSE}. Using \code{TRUE} is equal to using "name".}
\item{translate_ab}{if \code{type = "drug"}: a column name of the \link{antimicrobials} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}. The default is \code{FALSE}. Using \code{TRUE} is equal to using "name".}
\item{thorough_search}{a \link{logical} to indicate whether the input must be extensively searched for misspelling and other faulty input values. Setting this to \code{TRUE} will take considerably more time than when using \code{FALSE}. At default, it will turn \code{TRUE} when all input elements contain a maximum of three words.}
@@ -1160,7 +1172,7 @@ set_ab_names(data, ..., property = "name", language = get_AMR_locale(),
\item{open}{browse the URL using \code{\link[utils:browseURL]{utils::browseURL()}}}
\item{property}{one of the column names of one of the \link{antibiotics} data set: \code{vector_or(colnames(antibiotics), sort = FALSE)}.}
\item{property}{one of the column names of one of the \link{antimicrobials} data set: \code{vector_or(colnames(antimicrobials), sort = FALSE)}.}
\item{data}{a \link{data.frame} of which the columns need to be renamed, or a \link{character} vector of column names}
@@ -1176,7 +1188,7 @@ set_ab_names(data, ..., property = "name", language = get_AMR_locale(),
}
}
\description{
Use these functions to return a specific property of an antibiotic from the \link{antibiotics} data set. All input values will be evaluated internally with \code{\link[=as.ab]{as.ab()}}.
Use these functions to return a specific property of an antibiotic from the \link{antimicrobials} data set. All input values will be evaluated internally with \code{\link[=as.ab]{as.ab()}}.
}
\details{
All output \link[=translate]{will be translated} where possible.
@@ -1194,7 +1206,7 @@ European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{htt
\section{Reference Data Publicly Available}{
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
All data sets in this \code{AMR} package (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
\examples{
@@ -1263,7 +1275,7 @@ if (require("dplyr")) {
}
}
\seealso{
\link{antibiotics}
\link{antimicrobials}
}
@@ -1284,7 +1296,7 @@ add_custom_antimicrobials(x)
clear_custom_antimicrobials()
}
\arguments{
\item{x}{a \link{data.frame} resembling the \link{antibiotics} data set, at least containing columns "ab" and "name"}
\item{x}{a \link{data.frame} resembling the \link{antimicrobials} data set, at least containing columns "ab" and "name"}
}
\description{
With \code{\link[=add_custom_antimicrobials]{add_custom_antimicrobials()}} you can add your own custom antimicrobial drug names and codes.
@@ -1296,7 +1308,7 @@ There are two ways to circumvent this and automate the process of adding antimic
\strong{Method 1:} Using the package option \code{\link[=AMR-options]{AMR_custom_ab}}, which is the preferred method. To use this method:
\enumerate{
\item Create a data set in the structure of the \link{antibiotics} data set (containing at the very least columns "ab" and "name") and save it with \code{\link[=saveRDS]{saveRDS()}} to a location of choice, e.g. \code{"~/my_custom_ab.rds"}, or any remote location.
\item Create a data set in the structure of the \link{antimicrobials} data set (containing at the very least columns "ab" and "name") and save it with \code{\link[=saveRDS]{saveRDS()}} to a location of choice, e.g. \code{"~/my_custom_ab.rds"}, or any remote location.
\item Set the file location to the package option \code{\link[=AMR-options]{AMR_custom_ab}}: \code{options(AMR_custom_ab = "~/my_custom_ab.rds")}. This can even be a remote file location, such as an https URL. Since options are not saved between \R sessions, it is best to save this option to the \code{.Rprofile} file so that it will be loaded on start-up of \R. To do this, open the \code{.Rprofile} file using e.g. \code{utils::file.edit("~/.Rprofile")}, add this text and save the file:
\if{html}{\out{<div class="sourceCode r">}}\preformatted{# Add custom antimicrobial codes:
@@ -1334,7 +1346,7 @@ add_custom_antimicrobials(
ab = "TESTAB",
name = "Test Antibiotic",
# you can add any property present in the
# 'antibiotics' data set, such as 'group':
# 'antimicrobials' data set, such as 'group':
group = "Test Group"
)
)
@@ -1662,10 +1674,10 @@ THE PART HEREAFTER CONTAINS CONTENTS FROM FILE 'man/antibiogram.Rd':
antibiogram(x, antibiotics = where(is.sir), mo_transform = "shortname",
ab_transform = "name", syndromic_group = NULL, add_total_n = FALSE,
only_all_tested = FALSE, digits = ifelse(wisca, 1, 0),
formatting_type = getOption("AMR_antibiogram_formatting_type", 14),
col_mo = NULL, language = get_AMR_locale(), minimum = 30,
combine_SI = TRUE, sep = " + ", wisca = FALSE, simulations = 1000,
conf_interval = 0.95, interval_side = "two-tailed",
formatting_type = getOption("AMR_antibiogram_formatting_type",
ifelse(wisca, 14, 18)), col_mo = NULL, language = get_AMR_locale(),
minimum = 30, combine_SI = TRUE, sep = " + ", wisca = FALSE,
simulations = 1000, conf_interval = 0.95, interval_side = "two-tailed",
info = interactive())
wisca(x, antibiotics = where(is.sir), ab_transform = "name",
@@ -1693,7 +1705,7 @@ retrieve_wisca_parameters(wisca_model, ...)
\item{mo_transform}{a character to transform microorganism input - must be \code{"name"}, \code{"shortname"} (default), \code{"gramstain"}, or one of the column names of the \link{microorganisms} data set: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "oxygen_tolerance", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "mycobank", "mycobank_parent", "mycobank_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence", or "snomed". Can also be \code{NULL} to not transform the input or \code{NA} to consider all microorganisms 'unknown'.}
\item{ab_transform}{a character to transform antimicrobial input - must be one of the column names of the \link{antibiotics} data set (defaults to \code{"name"}): "ab", "cid", "name", "group", "atc", "atc_group1", "atc_group2", "abbreviations", "synonyms", "oral_ddd", "oral_units", "iv_ddd", "iv_units", or "loinc". Can also be \code{NULL} to not transform the input.}
\item{ab_transform}{a character to transform antimicrobial input - must be one of the column names of the \link{antimicrobials} data set (defaults to \code{"name"}): "ab", "cid", "name", "group", "atc", "atc_group1", "atc_group2", "abbreviations", "synonyms", "oral_ddd", "oral_units", "iv_ddd", "iv_units", or "loinc". Can also be \code{NULL} to not transform the input.}
\item{syndromic_group}{a column name of \code{x}, or values calculated to split rows of \code{x}, e.g. by using \code{\link[=ifelse]{ifelse()}} or \code{\link[dplyr:case_when]{case_when()}}. See \emph{Examples}.}
@@ -1750,7 +1762,7 @@ For estimating antimicrobial coverage, especially when creating a WISCA, the out
The numeric values of an antibiogram are stored in a long format as the \link[=attributes]{attribute} \code{long_numeric}. You can retrieve them using \code{attributes(x)$long_numeric}, where \code{x} is the outcome of \code{\link[=antibiogram]{antibiogram()}} or \code{\link[=wisca]{wisca()}}. This is ideal for e.g. advanced plotting.
\subsection{Formatting Type}{
The formatting of the 'cells' of the table can be set with the argument \code{formatting_type}. In these examples, \code{5} is the antimicrobial coverage (\code{4-6} indicates the confidence level), \code{15} the number of susceptible isolates, and \code{300} the number of tested (i.e., available) isolates:
The formatting of the 'cells' of the table can be set with the argument \code{formatting_type}. In these examples, \code{5} indicates the antimicrobial coverage (\code{4-6} the confidence level), \code{15} the number of susceptible isolates, and \code{300} the number of tested (i.e., available) isolates:
\enumerate{
\item 5
\item 15
@@ -1765,18 +1777,18 @@ The formatting of the 'cells' of the table can be set with the argument \code{fo
\item 5 (N=15/300)
\item 5\% (N=15/300)
\item 5 (4-6)
\item 5\% (4-6\%) - \strong{default}
\item 5\% (4-6\%) - \strong{default for WISCA}
\item 5 (4-6,300)
\item 5\% (4-6\%,300)
\item 5 (4-6,N=300)
\item 5\% (4-6\%,N=300)
\item 5\% (4-6\%,N=300) - \strong{default for non-WISCA}
\item 5 (4-6,15/300)
\item 5\% (4-6\%,15/300)
\item 5 (4-6,N=15/300)
\item 5\% (4-6\%,N=15/300)
}
The default is \code{14}, which can be set globally with the package option \code{\link[=AMR-options]{AMR_antibiogram_formatting_type}}, e.g. \code{options(AMR_antibiogram_formatting_type = 5)}. Do note that for WISCA, the total numbers of tested and susceptible isolates are less useful to report, since these are included in the Bayesian model and apparent from the susceptibility and its confidence level.
The default can be set globally with the package option \code{\link[=AMR-options]{AMR_antibiogram_formatting_type}}, e.g. \code{options(AMR_antibiogram_formatting_type = 5)}. Do note that for WISCA, the total numbers of tested and susceptible isolates are less useful to report, since these are included in the Bayesian model and apparent from the susceptibility and its confidence level.
Set \code{digits} (defaults to \code{0}) to alter the rounding of the susceptibility percentages.
}
@@ -2088,101 +2100,6 @@ Implementation: Dr. Larisse Bolton and Dr. Matthijs Berends
----------------------------------------------------------------------------------------------------
THE PART HEREAFTER CONTAINS CONTENTS FROM FILE 'man/antibiotics.Rd':
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\docType{data}
\name{antibiotics}
\alias{antibiotics}
\alias{antivirals}
\title{Data Sets with 607 Antimicrobial Drugs}
\format{
\subsection{For the \link{antibiotics} data set: a \link[tibble:tibble]{tibble} with 487 observations and 14 variables:}{
\itemize{
\item \code{ab}\cr Antibiotic ID as used in this package (such as \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. \emph{\strong{This is a unique identifier.}}
\item \code{cid}\cr Compound ID as found in PubChem. \emph{\strong{This is a unique identifier.}}
\item \code{name}\cr Official name as used by WHONET/EARS-Net or the WHO. \emph{\strong{This is a unique identifier.}}
\item \code{group}\cr A short and concise group name, based on WHONET and WHOCC definitions
\item \code{atc}\cr ATC codes (Anatomical Therapeutic Chemical) as defined by the WHOCC, like \code{J01CR02}
\item \code{atc_group1}\cr Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC, like \code{"Macrolides, lincosamides and streptogramins"}
\item \code{atc_group2}\cr Official chemical subgroup (4th level ATC code) as defined by the WHOCC, like \code{"Macrolides"}
\item \code{abbr}\cr List of abbreviations as used in many countries, also for antibiotic susceptibility testing (AST)
\item \code{synonyms}\cr Synonyms (often trade names) of a drug, as found in PubChem based on their compound ID
\item \code{oral_ddd}\cr Defined Daily Dose (DDD), oral treatment, currently available for 179 drugs
\item \code{oral_units}\cr Units of \code{oral_ddd}
\item \code{iv_ddd}\cr Defined Daily Dose (DDD), parenteral (intravenous) treatment, currently available for 153 drugs
\item \code{iv_units}\cr Units of \code{iv_ddd}
\item \code{loinc}\cr All codes associated with the name of the antimicrobial drug from Logical Observation Identifiers Names and Codes (LOINC), Version 2.76 (18 September, 2023). Use \code{\link[=ab_loinc]{ab_loinc()}} to retrieve them quickly, see \code{\link[=ab_property]{ab_property()}}.
}
}
\subsection{For the \link{antivirals} data set: a \link[tibble:tibble]{tibble} with 120 observations and 11 variables:}{
\itemize{
\item \code{av}\cr Antiviral ID as used in this package (such as \code{ACI}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. \emph{\strong{This is a unique identifier.}} Combinations are codes that contain a \code{+} to indicate this, such as \code{ATA+COBI} for atazanavir/cobicistat.
\item \code{name}\cr Official name as used by WHONET/EARS-Net or the WHO. \emph{\strong{This is a unique identifier.}}
\item \code{atc}\cr ATC codes (Anatomical Therapeutic Chemical) as defined by the WHOCC
\item \code{cid}\cr Compound ID as found in PubChem. \emph{\strong{This is a unique identifier.}}
\item \code{atc_group}\cr Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC
\item \code{synonyms}\cr Synonyms (often trade names) of a drug, as found in PubChem based on their compound ID
\item \code{oral_ddd}\cr Defined Daily Dose (DDD), oral treatment
\item \code{oral_units}\cr Units of \code{oral_ddd}
\item \code{iv_ddd}\cr Defined Daily Dose (DDD), parenteral treatment
\item \code{iv_units}\cr Units of \code{iv_ddd}
\item \code{loinc}\cr All codes associated with the name of the antiviral drug from Logical Observation Identifiers Names and Codes (LOINC), Version 2.76 (18 September, 2023). Use \code{\link[=av_loinc]{av_loinc()}} to retrieve them quickly, see \code{\link[=av_property]{av_property()}}.
}
}
An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 120 rows and 11 columns.
}
\source{
\itemize{
\item World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology (WHOCC): \url{https://atcddd.fhi.no/atc_ddd_index/}
\item Logical Observation Identifiers Names and Codes (LOINC), Version 2.76 (18 September, 2023). Accessed from \url{https://loinc.org} on October 19th, 2023.
\item European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm}
}
}
\usage{
antibiotics
antivirals
}
\description{
Two data sets containing all antibiotics/antimycotics 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{antibiotics} data set. Three identifiers are included in this data set: an antibiotic 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.
}
\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}.
Synonyms (i.e. trade names) were derived from the PubChem Compound ID (column \code{cid}) and consequently only available where a CID is available.
\subsection{Direct download}{
Like all data sets in this package, these data sets are publicly available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
}
\section{WHOCC}{
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://atcddd.fhi.no}) and the Pharmaceuticals Community Register of the European Commission (\url{https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm}).
These have become the gold standard for international drug utilisation monitoring and research.
The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.
\strong{NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package.} See \url{https://atcddd.fhi.no/copyright_disclaimer/.}
}
\examples{
antibiotics
antivirals
}
\seealso{
\link{microorganisms}, \link{intrinsic_resistant}
}
\keyword{datasets}
----------------------------------------------------------------------------------------------------
THE PART HEREAFTER CONTAINS CONTENTS FROM FILE 'man/antimicrobial_selectors.Rd':
@@ -2319,9 +2236,9 @@ not_intrinsic_resistant(only_sir_columns = FALSE, col_mo = NULL,
\item{...}{ignored, only in place to allow future extensions}
\item{amr_class}{an antimicrobial class or a part of it, such as \code{"carba"} and \code{"carbapenems"}. The columns \code{group}, \code{atc_group1} and \code{atc_group2} of the \link{antibiotics} data set will be searched (case-insensitive) for this value.}
\item{amr_class}{an antimicrobial class or a part of it, such as \code{"carba"} and \code{"carbapenems"}. The columns \code{group}, \code{atc_group1} and \code{atc_group2} of the \link{antimicrobials} data set will be searched (case-insensitive) for this value.}
\item{filter}{an \link{expression} to be evaluated in the \link{antibiotics} data set, such as \code{name \%like\% "trim"}}
\item{filter}{an \link{expression} to be evaluated in the \link{antimicrobials} data set, such as \code{name \%like\% "trim"}}
\item{col_mo}{column name of the names or codes of the microorganisms (see \code{\link[=as.mo]{as.mo()}}) - the default is the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
@@ -2345,13 +2262,13 @@ These functions can be used in data set calls for selecting columns and filterin
All selectors can also be used in \code{tidymodels} packages such as \code{recipe} and \code{parsnip}. See for more info \href{https://msberends.github.io/AMR/articles/AMR_with_tidymodels.html}{our tutorial} on using antimicrobial selectors for predictive modelling.
All columns in the data in which these functions are called will be searched for known antimicrobial names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) according to the \link{antibiotics} data set. This means that a selector such as \code{\link[=aminoglycosides]{aminoglycosides()}} will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.
All columns in the data in which these functions are called will be searched for known antimicrobial names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) according to the \link{antimicrobials} data set. This means that a selector such as \code{\link[=aminoglycosides]{aminoglycosides()}} will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.
The \code{\link[=amr_class]{amr_class()}} function can be used to filter/select on a manually defined antimicrobial class. It searches for results in the \link{antibiotics} data set within the columns \code{group}, \code{atc_group1} and \code{atc_group2}.
The \code{\link[=amr_class]{amr_class()}} function can be used to filter/select on a manually defined antimicrobial class. It searches for results in the \link{antimicrobials} data set within the columns \code{group}, \code{atc_group1} and \code{atc_group2}.
The \code{\link[=administrable_per_os]{administrable_per_os()}} and \code{\link[=administrable_iv]{administrable_iv()}} functions also rely on the \link{antibiotics} data set - antimicrobials will be matched where a DDD (defined daily dose) for resp. oral and IV treatment is available in the \link{antibiotics} data set.
The \code{\link[=administrable_per_os]{administrable_per_os()}} and \code{\link[=administrable_iv]{administrable_iv()}} functions also rely on the \link{antimicrobials} data set - antimicrobials will be matched where a DDD (defined daily dose) for resp. oral and IV treatment is available in the \link{antimicrobials} data set.
The \code{\link[=amr_selector]{amr_selector()}} function can be used to internally filter the \link{antibiotics} data set on any results, see \emph{Examples}. It allows for filtering on a (part of) a certain name, and/or a group name or even a minimum of DDDs for oral treatment. This function yields the highest flexibility, but is also the least user-friendly, since it requires a hard-coded filter to set.
The \code{\link[=amr_selector]{amr_selector()}} function can be used to internally filter the \link{antimicrobials} data set on any results, see \emph{Examples}. It allows for filtering on a (part of) a certain name, and/or a group name or even a minimum of DDDs for oral treatment. This function yields the highest flexibility, but is also the least user-friendly, since it requires a hard-coded filter to set.
The \code{\link[=not_intrinsic_resistant]{not_intrinsic_resistant()}} function can be used to only select antimicrobials that pose no intrinsic resistance for the microorganisms in the data set. For example, if a data set contains only microorganism codes or names of \emph{E. coli} and \emph{K. pneumoniae} and contains a column "vancomycin", this column will be removed (or rather, unselected) using this function. It currently applies \href{https://www.eucast.org/expert_rules_and_expected_phenotypes}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3} (2021) to determine intrinsic resistance, using the \code{\link[=eucast_rules]{eucast_rules()}} function internally. Because of this determination, this function is quite slow in terms of performance.
}
@@ -2394,7 +2311,7 @@ The \code{\link[=not_intrinsic_resistant]{not_intrinsic_resistant()}} function c
\section{Reference Data Publicly Available}{
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
All data sets in this \code{AMR} package (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
\examples{
@@ -2530,7 +2447,7 @@ example_isolates[any(carbapenems() == "R"), penicillins()]
# and erythromycin is not a penicillin:
example_isolates[, penicillins() & administrable_per_os()]
# amr_selector() applies a filter in the `antibiotics` data set and is thus
# amr_selector() applies a filter in the `antimicrobials` data set and is thus
# very flexible. For instance, to select antimicrobials with an oral DDD
# of at least 1 gram:
example_isolates[, amr_selector(oral_ddd > 1 & oral_units == "g")]
@@ -2572,6 +2489,102 @@ if (require("data.table")) {
----------------------------------------------------------------------------------------------------
THE PART HEREAFTER CONTAINS CONTENTS FROM FILE 'man/antimicrobials.Rd':
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\docType{data}
\name{antimicrobials}
\alias{antimicrobials}
\alias{antibiotics}
\alias{antivirals}
\title{Data Sets with 607 Antimicrobial Drugs}
\format{
\subsection{For the \link{antimicrobials} data set: a \link[tibble:tibble]{tibble} with 487 observations and 14 variables:}{
\itemize{
\item \code{ab}\cr antimcrobial ID as used in this package (such as \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. \emph{\strong{This is a unique identifier.}}
\item \code{cid}\cr Compound ID as found in PubChem. \emph{\strong{This is a unique identifier.}}
\item \code{name}\cr Official name as used by WHONET/EARS-Net or the WHO. \emph{\strong{This is a unique identifier.}}
\item \code{group}\cr A short and concise group name, based on WHONET and WHOCC definitions
\item \code{atc}\cr ATC codes (Anatomical Therapeutic Chemical) as defined by the WHOCC, like \code{J01CR02}
\item \code{atc_group1}\cr Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC, like \code{"Macrolides, lincosamides and streptogramins"}
\item \code{atc_group2}\cr Official chemical subgroup (4th level ATC code) as defined by the WHOCC, like \code{"Macrolides"}
\item \code{abbr}\cr List of abbreviations as used in many countries, also for antimcrobial susceptibility testing (AST)
\item \code{synonyms}\cr Synonyms (often trade names) of a drug, as found in PubChem based on their compound ID
\item \code{oral_ddd}\cr Defined Daily Dose (DDD), oral treatment, currently available for 179 drugs
\item \code{oral_units}\cr Units of \code{oral_ddd}
\item \code{iv_ddd}\cr Defined Daily Dose (DDD), parenteral (intravenous) treatment, currently available for 153 drugs
\item \code{iv_units}\cr Units of \code{iv_ddd}
\item \code{loinc}\cr All codes associated with the name of the antimicrobial drug from Logical Observation Identifiers Names and Codes (LOINC), Version 2.76 (18 September, 2023). Use \code{\link[=ab_loinc]{ab_loinc()}} to retrieve them quickly, see \code{\link[=ab_property]{ab_property()}}.
}
}
\subsection{For the \link{antivirals} data set: a \link[tibble:tibble]{tibble} with 120 observations and 11 variables:}{
\itemize{
\item \code{av}\cr Antiviral ID as used in this package (such as \code{ACI}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. \emph{\strong{This is a unique identifier.}} Combinations are codes that contain a \code{+} to indicate this, such as \code{ATA+COBI} for atazanavir/cobicistat.
\item \code{name}\cr Official name as used by WHONET/EARS-Net or the WHO. \emph{\strong{This is a unique identifier.}}
\item \code{atc}\cr ATC codes (Anatomical Therapeutic Chemical) as defined by the WHOCC
\item \code{cid}\cr Compound ID as found in PubChem. \emph{\strong{This is a unique identifier.}}
\item \code{atc_group}\cr Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC
\item \code{synonyms}\cr Synonyms (often trade names) of a drug, as found in PubChem based on their compound ID
\item \code{oral_ddd}\cr Defined Daily Dose (DDD), oral treatment
\item \code{oral_units}\cr Units of \code{oral_ddd}
\item \code{iv_ddd}\cr Defined Daily Dose (DDD), parenteral treatment
\item \code{iv_units}\cr Units of \code{iv_ddd}
\item \code{loinc}\cr All codes associated with the name of the antiviral drug from Logical Observation Identifiers Names and Codes (LOINC), Version 2.76 (18 September, 2023). Use \code{\link[=av_loinc]{av_loinc()}} to retrieve them quickly, see \code{\link[=av_property]{av_property()}}.
}
}
An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 120 rows and 11 columns.
}
\source{
\itemize{
\item World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology (WHOCC): \url{https://atcddd.fhi.no/atc_ddd_index/}
\item Logical Observation Identifiers Names and Codes (LOINC), Version 2.76 (18 September, 2023). Accessed from \url{https://loinc.org} on October 19th, 2023.
\item European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm}
}
}
\usage{
antimicrobials
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 antimcrobial 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.
}
\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}.
Synonyms (i.e. trade names) were derived from the PubChem Compound ID (column \code{cid}) and consequently only available where a CID is available.
\subsection{Direct download}{
Like all data sets in this package, these data sets are publicly available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
}
\section{WHOCC}{
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://atcddd.fhi.no}) and the Pharmaceuticals Community Register of the European Commission (\url{https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm}).
These have become the gold standard for international drug utilisation monitoring and research.
The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.
\strong{NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package.} See \url{https://atcddd.fhi.no/copyright_disclaimer/.}
}
\examples{
antimicrobials
antivirals
}
\seealso{
\link{microorganisms}, \link{intrinsic_resistant}
}
\keyword{datasets}
----------------------------------------------------------------------------------------------------
THE PART HEREAFTER CONTAINS CONTENTS FROM FILE 'man/as.ab.Rd':
@@ -2607,10 +2620,10 @@ ab_reset_session()
A \link{character} \link{vector} with additional class \code{\link{ab}}
}
\description{
Use this function to determine the antibiotic drug code of one or more antibiotics. The data set \link{antibiotics} will be searched for abbreviations, official names and synonyms (brand names).
Use this function to determine the antimicrobial drug code of one or more antimicrobials. The data set \link{antimicrobials} will be searched for abbreviations, official names and synonyms (brand names).
}
\details{
All entries in the \link{antibiotics} data set have three different identifiers: a human readable EARS-Net code (column \code{ab}, used by ECDC and WHONET), an ATC code (column \code{atc}, used by WHO), and a CID code (column \code{cid}, Compound ID, used by PubChem). The data set contains more than 5,000 official brand names from many different countries, as found in PubChem. Not that some drugs contain multiple ATC codes.
All entries in the \link{antimicrobials} data set have three different identifiers: a human readable EARS-Net code (column \code{ab}, used by ECDC and WHONET), an ATC code (column \code{atc}, used by WHO), and a CID code (column \code{cid}, Compound ID, used by PubChem). The data set contains more than 5,000 official brand names from many different countries, as found in PubChem. Not that some drugs contain multiple ATC codes.
All these properties will be searched for the user input. The \code{\link[=as.ab]{as.ab()}} can correct for different forms of misspelling:
\itemize{
@@ -2646,7 +2659,7 @@ The WHOCC is located in Oslo at the Norwegian Institute of Public Health and fun
\section{Reference Data Publicly Available}{
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
All data sets in this \code{AMR} package (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
\examples{
@@ -2682,7 +2695,7 @@ if (require("dplyr")) {
}
\seealso{
\itemize{
\item \link{antibiotics} for the \link{data.frame} that is being used to determine ATCs
\item \link{antimicrobials} for the \link{data.frame} that is being used to determine ATCs
\item \code{\link[=ab_from_text]{ab_from_text()}} for a function to retrieve antimicrobial drugs from clinical text (from health care records)
}
}
@@ -2755,7 +2768,7 @@ The WHOCC is located in Oslo at the Norwegian Institute of Public Health and fun
\section{Reference Data Publicly Available}{
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
All data sets in this \code{AMR} package (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
\examples{
@@ -3224,7 +3237,7 @@ All matches are sorted descending on their matching score and for all user input
\section{Reference Data Publicly Available}{
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
All data sets in this \code{AMR} package (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
\examples{
@@ -3509,7 +3522,7 @@ This AMR package honours this insight. Use \code{\link[=susceptibility]{suscepti
\section{Reference Data Publicly Available}{
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
All data sets in this \code{AMR} package (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
\examples{
@@ -3730,7 +3743,7 @@ atc_online_ddd(atc_code, ...)
atc_online_ddd_units(atc_code, ...)
}
\arguments{
\item{atc_code}{a \link{character} (vector) with ATC code(s) of antibiotics, will be coerced with \code{\link[=as.ab]{as.ab()}} and \code{\link[=ab_atc]{ab_atc()}} internally if not a valid ATC code}
\item{atc_code}{a \link{character} (vector) with ATC code(s) of antimicrobials, will be coerced with \code{\link[=as.ab]{as.ab()}} and \code{\link[=ab_atc]{ab_atc()}} internally if not a valid ATC code}
\item{property}{property of an ATC code. Valid values are \code{"ATC"}, \code{"Name"}, \code{"DDD"}, \code{"U"} (\code{"unit"}), \code{"Adm.R"}, \code{"Note"} and \code{groups}. For this last option, all hierarchical groups of an ATC code will be returned, see \emph{Examples}.}
@@ -3743,7 +3756,7 @@ atc_online_ddd_units(atc_code, ...)
\item{...}{arguments to pass on to \code{atc_property}}
}
\description{
Gets data from the WHOCC website to determine properties of an Anatomical Therapeutic Chemical (ATC) (e.g. an antibiotic), such as the name, defined daily dose (DDD) or standard unit.
Gets data from the WHOCC website to determine properties of an Anatomical Therapeutic Chemical (ATC) (e.g. an antimicrobial), such as the name, defined daily dose (DDD) or standard unit.
}
\details{
Options for argument \code{administration}:
@@ -3940,7 +3953,7 @@ European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{htt
\section{Reference Data Publicly Available}{
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
All data sets in this \code{AMR} package (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
\examples{
@@ -4040,7 +4053,7 @@ bug_drug_combinations(x, col_mo = NULL, FUN = mo_shortname,
",", ".", ","), ...)
}
\arguments{
\item{x}{a data set with antibiotic columns, such as \code{amox}, \code{AMX} and \code{AMC}}
\item{x}{a data set with antimicrobials columns, such as \code{amox}, \code{AMX} and \code{AMC}}
\item{col_mo}{column name of the names or codes of the microorganisms (see \code{\link[=as.mo]{as.mo()}}) - the default is the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
@@ -4050,7 +4063,7 @@ bug_drug_combinations(x, col_mo = NULL, FUN = mo_shortname,
\item{...}{arguments passed on to \code{FUN}}
\item{translate_ab}{a \link{character} of length 1 containing column names of the \link{antibiotics} data set}
\item{translate_ab}{a \link{character} of length 1 containing column names of the \link{antimicrobials} data set}
\item{language}{language of the returned text - the default is the current system language (see \code{\link[=get_AMR_locale]{get_AMR_locale()}}) and can also be set with the package option \code{\link[=AMR-options]{AMR_locale}}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
@@ -4126,7 +4139,7 @@ A \link[tibble:tibble]{tibble} with 34 063 observations and 14 variables:
\item \code{site}\cr Body site for which the breakpoint must be applied, e.g. "Oral" or "Respiratory"
\item \code{mo}\cr Microbial ID, see \code{\link[=as.mo]{as.mo()}}
\item \code{rank_index}\cr Taxonomic rank index of \code{mo} from 1 (subspecies/infraspecies) to 5 (unknown microorganism)
\item \code{ab}\cr Antibiotic code as used by this package, EARS-Net and WHONET, see \code{\link[=as.ab]{as.ab()}}
\item \code{ab}\cr Antimcrobial code as used by this package, EARS-Net and WHONET, see \code{\link[=as.ab]{as.ab()}}
\item \code{ref_tbl}\cr Info about where the guideline rule can be found
\item \code{disk_dose}\cr Dose of the used disk diffusion method
\item \code{breakpoint_S}\cr Lowest MIC value or highest number of millimetres that leads to "S"
@@ -4229,11 +4242,11 @@ count_df(data, translate_ab = "name", language = get_AMR_locale(),
\arguments{
\item{...}{one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with \code{\link[=as.sir]{as.sir()}} if needed.}
\item{only_all_tested}{(for combination therapies, i.e. using more than one variable for \code{...}): a \link{logical} to indicate that isolates must be tested for all antibiotics, see section \emph{Combination Therapy} below}
\item{only_all_tested}{(for combination therapies, i.e. using more than one variable for \code{...}): a \link{logical} to indicate that isolates must be tested for all antimicrobials, see section \emph{Combination Therapy} below}
\item{data}{a \link{data.frame} containing columns with class \code{\link{sir}} (see \code{\link[=as.sir]{as.sir()}})}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{translate_ab}{a column name of the \link{antimicrobials} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{language}{language of the returned text - the default is the current system language (see \code{\link[=get_AMR_locale]{get_AMR_locale()}}) and can also be set with the package option \code{\link[=AMR-options]{AMR_locale}}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
@@ -4252,7 +4265,7 @@ These functions are meant to count isolates. Use the \code{\link[=resistance]{re
The function \code{\link[=count_resistant]{count_resistant()}} is equal to the function \code{\link[=count_R]{count_R()}}. The function \code{\link[=count_susceptible]{count_susceptible()}} is equal to the function \code{\link[=count_SI]{count_SI()}}.
The function \code{\link[=n_sir]{n_sir()}} is an alias of \code{\link[=count_all]{count_all()}}. They can be used to count all available isolates, i.e. where all input antibiotics have an available result (S, I or R). Their use is equal to \code{n_distinct()}. Their function is equal to \code{count_susceptible(...) + count_resistant(...)}.
The function \code{\link[=n_sir]{n_sir()}} is an alias of \code{\link[=count_all]{count_all()}}. They can be used to count all available isolates, i.e. where all input antimicrobials have an available result (S, I or R). Their use is equal to \code{n_distinct()}. Their function is equal to \code{count_susceptible(...) + count_resistant(...)}.
The function \code{\link[=count_df]{count_df()}} takes any variable from \code{data} that has an \code{\link{sir}} class (created with \code{\link[=as.sir]{as.sir()}}) and counts the number of S's, I's and R's. It also supports grouped variables. The function \code{\link[=sir_df]{sir_df()}} works exactly like \code{\link[=count_df]{count_df()}}, but adds the percentage of S, I and R.
}
@@ -4276,7 +4289,7 @@ This AMR package honours this insight. Use \code{\link[=susceptibility]{suscepti
\section{Combination Therapy}{
When using more than one variable for \code{...} (= combination therapy), use \code{only_all_tested} to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antibiotics, Drug A and Drug B, about how \code{\link[=susceptibility]{susceptibility()}} works to calculate the \%SI:
When using more than one variable for \code{...} (= combination therapy), use \code{only_all_tested} to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antimicrobials, Drug A and Drug B, about how \code{\link[=susceptibility]{susceptibility()}} works to calculate the \%SI:
\if{html}{\out{<div class="sourceCode">}}\preformatted{--------------------------------------------------------------------
only_all_tested = FALSE only_all_tested = TRUE
@@ -4467,11 +4480,11 @@ eucast_rules(df, rules = "custom", custom_rules = y, info = FALSE)
}\if{html}{\out{</div>}}
}
\subsection{Usage of multiple antibiotics and antibiotic group names}{
\subsection{Usage of multiple antimicrobials and antimicrobial group names}{
You can define antibiotic groups instead of single antibiotics for the rule consequence, which is the part \emph{after} the tilde (~). In the examples above, the antibiotic group \code{aminopenicillins} includes both ampicillin and amoxicillin.
You can define antimicrobial groups instead of single antimicrobials for the rule consequence, which is the part \emph{after} the tilde (~). In the examples above, the antimicrobial group \code{aminopenicillins} includes both ampicillin and amoxicillin.
Rules can also be applied to multiple antibiotics and antibiotic groups simultaneously. Use the \code{c()} function to combine multiple antibiotics. For instance, the following example sets all aminopenicillins and ureidopenicillins to "R" if column TZP (piperacillin/tazobactam) is "R":
Rules can also be applied to multiple antimicrobials and antimicrobial groups simultaneously. Use the \code{c()} function to combine multiple antimicrobials. For instance, the following example sets all aminopenicillins and ureidopenicillins to "R" if column TZP (piperacillin/tazobactam) is "R":
\if{html}{\out{<div class="sourceCode r">}}\preformatted{x <- custom_eucast_rules(TZP == "R" ~ c(aminopenicillins, ureidopenicillins) == "R")
x
@@ -4481,7 +4494,7 @@ x
#> amoxicillin (AMX), ampicillin (AMP), azlocillin (AZL), mezlocillin (MEZ), piperacillin (PIP), piperacillin/tazobactam (TZP)
}\if{html}{\out{</div>}}
These 34 antibiotic groups are allowed in the rules (case-insensitive) and can be used in any combination:
These 34 antimicrobial groups are allowed in the rules (case-insensitive) and can be used in any combination:
\itemize{
\item aminoglycosides\cr(amikacin, amikacin/fosfomycin, apramycin, arbekacin, astromicin, bekanamycin, dibekacin, framycetin, gentamicin, gentamicin-high, habekacin, hygromycin, isepamicin, kanamycin, kanamycin-high, kanamycin/cephalexin, micronomicin, neomycin, netilmicin, pentisomicin, plazomicin, propikacin, ribostamycin, sisomicin, streptoduocin, streptomycin, streptomycin-high, tobramycin, and tobramycin-high)
\item aminopenicillins\cr(amoxicillin and ampicillin)
@@ -4559,7 +4572,7 @@ THE PART HEREAFTER CONTAINS CONTENTS FROM FILE 'man/dosage.Rd':
\format{
A \link[tibble:tibble]{tibble} with 503 observations and 9 variables:
\itemize{
\item \code{ab}\cr Antibiotic ID as used in this package (such as \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available
\item \code{ab}\cr Antimcrobial ID as used in this package (such as \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available
\item \code{name}\cr Official name of the antimicrobial drug as used by WHONET/EARS-Net or the WHO
\item \code{type}\cr Type of the dosage, either "high_dosage", "standard_dosage", or "uncomplicated_uti"
\item \code{dose}\cr Dose, such as "2 g" or "25 mg/kg"
@@ -4620,7 +4633,7 @@ eucast_rules(x, col_mo = NULL, info = interactive(),
eucast_dosage(ab, administration = "iv", version_breakpoints = 12)
}
\arguments{
\item{x}{a data set with antibiotic columns, such as \code{amox}, \code{AMX} and \code{AMC}}
\item{x}{a data set with antimicrobials columns, such as \code{amox}, \code{AMX} and \code{AMC}}
\item{col_mo}{column name of the names or codes of the microorganisms (see \code{\link[=as.mo]{as.mo()}}) - the default is the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
@@ -4636,20 +4649,20 @@ eucast_dosage(ab, administration = "iv", version_breakpoints = 12)
\item{ampc_cephalosporin_resistance}{a \link{character} value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants - the default is \code{NA}. Currently only works when \code{version_expertrules} is \code{3.2} and higher; these version of '\emph{EUCAST Expert Rules on Enterobacterales}' state that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these three drugs. A value of \code{NA} (the default) for this argument will remove results for these three drugs, while e.g. a value of \code{"R"} will make the results for these drugs resistant. Use \code{NULL} or \code{FALSE} to not alter results for these three drugs of AmpC de-repressed cephalosporin-resistant mutants. Using \code{TRUE} is equal to using \code{"R"}. \cr For \emph{EUCAST Expert Rules} v3.2, this rule applies to: \emph{Citrobacter braakii}, \emph{Citrobacter freundii}, \emph{Citrobacter gillenii}, \emph{Citrobacter murliniae}, \emph{Citrobacter rodenticum}, \emph{Citrobacter sedlakii}, \emph{Citrobacter werkmanii}, \emph{Citrobacter youngae}, \emph{Enterobacter}, \emph{Hafnia alvei}, \emph{Klebsiella aerogenes}, \emph{Morganella morganii}, \emph{Providencia}, and \emph{Serratia}.}
\item{only_sir_columns}{a \link{logical} to indicate whether only antibiotic columns must be detected that were transformed to class \code{sir} (see \code{\link[=as.sir]{as.sir()}}) on beforehand (default is \code{FALSE})}
\item{only_sir_columns}{a \link{logical} to indicate whether only antimicrobial columns must be detected that were transformed to class \code{sir} (see \code{\link[=as.sir]{as.sir()}}) on beforehand (default is \code{FALSE})}
\item{custom_rules}{custom rules to apply, created with \code{\link[=custom_eucast_rules]{custom_eucast_rules()}}}
\item{overwrite}{a \link{logical} to indicate whether non-\code{NA} values must be overwritten (defaults to \code{TRUE}). With \code{FALSE}, only \code{NA} values are changed.}
\item{...}{column name of an antibiotic, see section \emph{Antibiotics} below}
\item{...}{column name of an antimicrobial, see section \emph{Antimicrobials} below}
\item{ab}{any (vector of) text that can be coerced to a valid antibiotic drug code with \code{\link[=as.ab]{as.ab()}}}
\item{ab}{any (vector of) text that can be coerced to a valid antimicrobial drug code with \code{\link[=as.ab]{as.ab()}}}
\item{administration}{route of administration, either "im", "iv", or "oral"}
}
\value{
The input of \code{x}, possibly with edited values of antibiotics. Or, if \code{verbose = TRUE}, a \link{data.frame} with all original and new values of the affected bug-drug combinations.
The input of \code{x}, possibly with edited values of antimicrobials. Or, if \code{verbose = TRUE}, a \link{data.frame} with all original and new values of the affected bug-drug combinations.
}
\description{
Apply rules from clinical breakpoints notes and expected resistant phenotypes as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, \url{https://www.eucast.org}), see \emph{Source}. Use \code{\link[=eucast_dosage]{eucast_dosage()}} to get a \link{data.frame} with advised dosages of a certain bug-drug combination, which is based on the \link{dosage} data set.
@@ -4685,18 +4698,18 @@ Important examples include amoxicillin and amoxicillin/clavulanic acid, and trim
Since these rules are not officially approved by EUCAST, they are not applied at default. To use these rules, include \code{"other"} to the \code{rules} argument, or use \code{eucast_rules(..., rules = "all")}. You can also set the package option \code{\link[=AMR-options]{AMR_eucastrules}}, i.e. run \code{options(AMR_eucastrules = "all")}.
}
}
\section{Antibiotics}{
\section{Antimicrobials}{
To define antibiotics column names, leave as it is to determine it automatically with \code{\link[=guess_ab_col]{guess_ab_col()}} or input a text (case-insensitive), or use \code{NULL} to skip a column (e.g. \code{TIC = NULL} to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.
To define antimicrobials column names, leave as it is to determine it automatically with \code{\link[=guess_ab_col]{guess_ab_col()}} or input a text (case-insensitive), or use \code{NULL} to skip a column (e.g. \code{TIC = NULL} to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.
The following antibiotics are eligible for the functions \code{\link[=eucast_rules]{eucast_rules()}} and \code{\link[=mdro]{mdro()}}. These are shown below in the format 'name (\verb{antimicrobial ID}, \href{https://atcddd.fhi.no/atc/structure_and_principles/}{ATC code})', sorted alphabetically:
The following antimicrobials are eligible for the functions \code{\link[=eucast_rules]{eucast_rules()}} and \code{\link[=mdro]{mdro()}}. These are shown below in the format 'name (\verb{antimicrobial ID}, \href{https://atcddd.fhi.no/atc/structure_and_principles/}{ATC code})', sorted alphabetically:
Amikacin (\code{AMK}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01GB06&showdescription=no}{J01GB06}), amoxicillin (\code{AMX}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA04&showdescription=no}{J01CA04}), amoxicillin/clavulanic acid (\code{AMC}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CR02&showdescription=no}{J01CR02}), ampicillin (\code{AMP}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA01&showdescription=no}{J01CA01}), ampicillin/sulbactam (\code{SAM}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CR01&showdescription=no}{J01CR01}), apramycin (\code{APR}, \href{https://atcddd.fhi.no/atcvet/atcvet_index/?code=QA07AA92&showdescription=no}{QA07AA92}), arbekacin (\code{ARB}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01GB12&showdescription=no}{J01GB12}), aspoxicillin (\code{APX}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA19&showdescription=no}{J01CA19}), azidocillin (\code{AZD}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CE04&showdescription=no}{J01CE04}), azithromycin (\code{AZM}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01FA10&showdescription=no}{J01FA10}), azlocillin (\code{AZL}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA09&showdescription=no}{J01CA09}), aztreonam (\code{ATM}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DF01&showdescription=no}{J01DF01}), bacampicillin (\code{BAM}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA06&showdescription=no}{J01CA06}), bekanamycin (\code{BEK}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01GB13&showdescription=no}{J01GB13}), benzathine benzylpenicillin (\code{BNB}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CE08&showdescription=no}{J01CE08}), benzathine phenoxymethylpenicillin (\code{BNP}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CE10&showdescription=no}{J01CE10}), benzylpenicillin (\code{PEN}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CE01&showdescription=no}{J01CE01}), besifloxacin (\code{BES}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=S01AE08&showdescription=no}{S01AE08}), biapenem (\code{BIA}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DH05&showdescription=no}{J01DH05}), carbenicillin (\code{CRB}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA03&showdescription=no}{J01CA03}), carindacillin (\code{CRN}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA05&showdescription=no}{J01CA05}), carumonam (\code{CAR}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DF02&showdescription=no}{J01DF02}), cefacetrile (\code{CAC}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB10&showdescription=no}{J01DB10}), cefaclor (\code{CEC}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DC04&showdescription=no}{J01DC04}), cefadroxil (\code{CFR}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB05&showdescription=no}{J01DB05}), cefalexin (\code{LEX}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB01&showdescription=no}{J01DB01}), cefaloridine (\code{RID}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB02&showdescription=no}{J01DB02}), cefalotin (\code{CEP}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB03&showdescription=no}{J01DB03}), cefamandole (\code{MAN}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DC03&showdescription=no}{J01DC03}), cefapirin (\code{HAP}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB08&showdescription=no}{J01DB08}), cefatrizine (\code{CTZ}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB07&showdescription=no}{J01DB07}), cefazedone (\code{CZD}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB06&showdescription=no}{J01DB06}), cefazolin (\code{CZO}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB04&showdescription=no}{J01DB04}), cefcapene (\code{CCP}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD17&showdescription=no}{J01DD17}), cefdinir (\code{CDR}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD15&showdescription=no}{J01DD15}), cefditoren (\code{DIT}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD16&showdescription=no}{J01DD16}), cefepime (\code{FEP}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DE01&showdescription=no}{J01DE01}), cefepime/amikacin (\code{CFA}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01RA06&showdescription=no}{J01RA06}), cefetamet (\code{CAT}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD10&showdescription=no}{J01DD10}), cefiderocol (\code{FDC}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DI04&showdescription=no}{J01DI04}), cefixime (\code{CFM}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD08&showdescription=no}{J01DD08}), cefmenoxime (\code{CMX}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD05&showdescription=no}{J01DD05}), cefmetazole (\code{CMZ}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DC09&showdescription=no}{J01DC09}), cefodizime (\code{DIZ}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD09&showdescriLine truncated
}
\section{Reference Data Publicly Available}{
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
All data sets in this \code{AMR} package (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
\examples{
@@ -4762,7 +4775,7 @@ A \link[tibble:tibble]{tibble} with 2 000 observations and 46 variables:
\item \code{gender}\cr Gender of the patient, either "F" or "M"
\item \code{ward}\cr Ward type where the patient was admitted, either "Clinical", "ICU", or "Outpatient"
\item \code{mo}\cr ID of microorganism created with \code{\link[=as.mo]{as.mo()}}, see also the \link{microorganisms} data set
\item \code{PEN:RIF}\cr 40 different antibiotics with class \code{\link{sir}} (see \code{\link[=as.sir]{as.sir()}}); these column names occur in the \link{antibiotics} data set and can be translated with \code{\link[=set_ab_names]{set_ab_names()}} or \code{\link[=ab_name]{ab_name()}}
\item \code{PEN:RIF}\cr 40 different antimicrobials with class \code{\link{sir}} (see \code{\link[=as.sir]{as.sir()}}); these column names occur in the \link{antimicrobials} data set and can be translated with \code{\link[=set_ab_names]{set_ab_names()}} or \code{\link[=ab_name]{ab_name()}}
}
}
\usage{
@@ -4798,7 +4811,7 @@ A \link[tibble:tibble]{tibble} with 3 000 observations and 8 variables:
\item \code{date}\cr date of receipt at the laboratory
\item \code{hospital}\cr ID of the hospital, from A to C
\item \code{bacteria}\cr info about microorganism that can be transformed with \code{\link[=as.mo]{as.mo()}}, see also \link{microorganisms}
\item \code{AMX:GEN}\cr 4 different antibiotics that have to be transformed with \code{\link[=as.sir]{as.sir()}}
\item \code{AMX:GEN}\cr 4 different antimicrobials that have to be transformed with \code{\link[=as.sir]{as.sir()}}
}
}
\usage{
@@ -5556,7 +5569,7 @@ geom_sir(position = NULL, x = c("antibiotic", "interpretation"),
\item{limits}{a \link{numeric} vector of length two providing limits of the scale, use \code{NA} to refer to the existing minimum or maximum}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{translate_ab}{a column name of the \link{antimicrobials} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{combine_SI}{a \link{logical} to indicate whether all values of S, SDD, and I must be merged into one, so the output only consists of S+SDD+I vs. R (susceptible vs. resistant) - the default is \code{TRUE}}
@@ -5590,9 +5603,9 @@ geom_sir(position = NULL, x = c("antibiotic", "interpretation"),
Use these functions to create bar plots for AMR data analysis. All functions rely on \link[ggplot2:ggplot]{ggplot2} functions.
}
\details{
At default, the names of antibiotics will be shown on the plots using \code{\link[=ab_name]{ab_name()}}. This can be set with the \code{translate_ab} argument. See \code{\link[=count_df]{count_df()}}.
At default, the names of antimicrobials will be shown on the plots using \code{\link[=ab_name]{ab_name()}}. This can be set with the \code{translate_ab} argument. See \code{\link[=count_df]{count_df()}}.
\code{\link[=geom_sir]{geom_sir()}} will take any variable from the data that has an \code{\link{sir}} class (created with \code{\link[=as.sir]{as.sir()}}) using \code{\link[=sir_df]{sir_df()}} and will plot bars with the percentage S, I, and R. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.
\code{\link[=geom_sir]{geom_sir()}} will take any variable from the data that has an \code{\link{sir}} class (created with \code{\link[=as.sir]{as.sir()}}) using \code{\link[=sir_df]{sir_df()}} and will plot bars with the percentage S, I, and R. The default behaviour is to have the bars stacked and to have the different antimicrobials on the x axis.
Additional functions include:
\itemize{
@@ -5733,10 +5746,10 @@ guess_ab_col(x = NULL, search_string = NULL, verbose = FALSE,
A column name of \code{x}, or \code{NULL} when no result is found.
}
\description{
This tries to find a column name in a data set based on information from the \link{antibiotics} data set. Also supports WHONET abbreviations.
This tries to find a column name in a data set based on information from the \link{antimicrobials} data set. Also supports WHONET abbreviations.
}
\details{
You can look for an antibiotic (trade) name or abbreviation and it will search \code{x} and the \link{antibiotics} data set for any column containing a name or code of that antibiotic.
You can look for an antibiotic (trade) name or abbreviation and it will search \code{x} and the \link{antimicrobials} data set for any column containing a name or code of that antibiotic.
}
\examples{
df <- data.frame(
@@ -5776,7 +5789,7 @@ THE PART HEREAFTER CONTAINS CONTENTS FROM FILE 'man/intrinsic_resistant.Rd':
A \link[tibble:tibble]{tibble} with 301 583 observations and 2 variables:
\itemize{
\item \code{mo}\cr Microorganism ID
\item \code{ab}\cr Antibiotic ID
\item \code{ab}\cr Antimcrobial ID
}
}
\usage{
@@ -5948,7 +5961,7 @@ antimicrobials_equal(y, z, type = c("points", "keyantimicrobials"),
ignore_I = TRUE, points_threshold = 2, ...)
}
\arguments{
\item{x}{a \link{data.frame} with antibiotics columns, like \code{AMX} or \code{amox}. Can be left blank to determine automatically}
\item{x}{a \link{data.frame} with antimicrobials columns, like \code{AMX} or \code{amox}. Can be left blank to determine automatically.}
\item{col_mo}{column name of the names or codes of the microorganisms (see \code{\link[=as.mo]{as.mo()}}) - the default is the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
@@ -6039,7 +6052,7 @@ antimicrobials_equal(strainA, strainB, type = "keyantimicrobials", ignore_I = FA
\donttest{
if (require("dplyr")) {
# set key antibiotics to a new variable
# set key antimicrobials to a new variable
my_patients <- example_isolates \%>\%
mutate(keyab = key_antimicrobials(antifungal = NULL)) \%>\% # no need to define `x`
mutate(
@@ -6231,7 +6244,7 @@ eucast_exceptional_phenotypes(x = NULL, only_sir_columns = FALSE,
verbose = FALSE, ...)
}
\arguments{
\item{x}{a \link{data.frame} with antibiotics columns, like \code{AMX} or \code{amox}. Can be left blank for automatic determination.}
\item{x}{a \link{data.frame} with antimicrobials columns, like \code{AMX} or \code{amox}. Can be left blank for automatic determination.}
\item{guideline}{a specific guideline to follow, see sections \emph{Supported international / national guidelines} and \emph{Using Custom Guidelines} below. When left empty, the publication by Magiorakos \emph{et al.} (see below) will be followed.}
@@ -6257,9 +6270,9 @@ eucast_exceptional_phenotypes(x = NULL, only_sir_columns = FALSE,
\item{verbose}{a \link{logical} to turn Verbose mode on and off (default is off). In Verbose mode, the function does not return the MDRO results, but instead returns a data set in logbook form with extensive info about which isolates would be MDRO-positive, or why they are not.}
\item{only_sir_columns}{a \link{logical} to indicate whether only antibiotic columns must be detected that were transformed to class \code{sir} (see \code{\link[=as.sir]{as.sir()}}) on beforehand (default is \code{FALSE})}
\item{only_sir_columns}{a \link{logical} to indicate whether only antimicrobial columns must be detected that were transformed to class \code{sir} (see \code{\link[=as.sir]{as.sir()}}) on beforehand (default is \code{FALSE})}
\item{...}{in case of \code{\link[=custom_mdro_guideline]{custom_mdro_guideline()}}: a set of rules, see section \emph{Using Custom Guidelines} below. Otherwise: column name of an antibiotic, see section \emph{Antibiotics} below.}
\item{...}{in case of \code{\link[=custom_mdro_guideline]{custom_mdro_guideline()}}: a set of rules, see section \emph{Using Custom Guidelines} below. Otherwise: column name of an antibiotic, see section \emph{Antimicrobials} below.}
\item{as_factor}{a \link{logical} to indicate whether the returned value should be an ordered \link{factor} (\code{TRUE}, default), or otherwise a \link{character} vector}
}
@@ -6369,11 +6382,11 @@ table(x)
The rules set (the \code{custom} object in this case) could be exported to a shared file location using \code{\link[=saveRDS]{saveRDS()}} if you collaborate with multiple users. The custom rules set could then be imported using \code{\link[=readRDS]{readRDS()}}.
}
\section{Antibiotics}{
\section{Antimicrobials}{
To define antibiotics column names, leave as it is to determine it automatically with \code{\link[=guess_ab_col]{guess_ab_col()}} or input a text (case-insensitive), or use \code{NULL} to skip a column (e.g. \code{TIC = NULL} to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.
To define antimicrobials column names, leave as it is to determine it automatically with \code{\link[=guess_ab_col]{guess_ab_col()}} or input a text (case-insensitive), or use \code{NULL} to skip a column (e.g. \code{TIC = NULL} to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.
The following antibiotics are eligible for the functions \code{\link[=eucast_rules]{eucast_rules()}} and \code{\link[=mdro]{mdro()}}. These are shown below in the format 'name (\verb{antimicrobial ID}, \href{https://atcddd.fhi.no/atc/structure_and_principles/}{ATC code})', sorted alphabetically:
The following antimicrobials are eligible for the functions \code{\link[=eucast_rules]{eucast_rules()}} and \code{\link[=mdro]{mdro()}}. These are shown below in the format 'name (\verb{antimicrobial ID}, \href{https://atcddd.fhi.no/atc/structure_and_principles/}{ATC code})', sorted alphabetically:
Amikacin (\code{AMK}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01GB06&showdescription=no}{J01GB06}), amoxicillin (\code{AMX}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA04&showdescription=no}{J01CA04}), amoxicillin/clavulanic acid (\code{AMC}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CR02&showdescription=no}{J01CR02}), ampicillin (\code{AMP}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA01&showdescription=no}{J01CA01}), ampicillin/sulbactam (\code{SAM}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CR01&showdescription=no}{J01CR01}), apramycin (\code{APR}, \href{https://atcddd.fhi.no/atcvet/atcvet_index/?code=QA07AA92&showdescription=no}{QA07AA92}), arbekacin (\code{ARB}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01GB12&showdescription=no}{J01GB12}), aspoxicillin (\code{APX}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA19&showdescription=no}{J01CA19}), azidocillin (\code{AZD}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CE04&showdescription=no}{J01CE04}), azithromycin (\code{AZM}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01FA10&showdescription=no}{J01FA10}), azlocillin (\code{AZL}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA09&showdescription=no}{J01CA09}), aztreonam (\code{ATM}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DF01&showdescription=no}{J01DF01}), bacampicillin (\code{BAM}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA06&showdescription=no}{J01CA06}), bekanamycin (\code{BEK}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01GB13&showdescription=no}{J01GB13}), benzathine benzylpenicillin (\code{BNB}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CE08&showdescription=no}{J01CE08}), benzathine phenoxymethylpenicillin (\code{BNP}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CE10&showdescription=no}{J01CE10}), benzylpenicillin (\code{PEN}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CE01&showdescription=no}{J01CE01}), besifloxacin (\code{BES}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=S01AE08&showdescription=no}{S01AE08}), biapenem (\code{BIA}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DH05&showdescription=no}{J01DH05}), carbenicillin (\code{CRB}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA03&showdescription=no}{J01CA03}), carindacillin (\code{CRN}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01CA05&showdescription=no}{J01CA05}), carumonam (\code{CAR}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DF02&showdescription=no}{J01DF02}), cefacetrile (\code{CAC}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB10&showdescription=no}{J01DB10}), cefaclor (\code{CEC}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DC04&showdescription=no}{J01DC04}), cefadroxil (\code{CFR}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB05&showdescription=no}{J01DB05}), cefalexin (\code{LEX}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB01&showdescription=no}{J01DB01}), cefaloridine (\code{RID}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB02&showdescription=no}{J01DB02}), cefalotin (\code{CEP}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB03&showdescription=no}{J01DB03}), cefamandole (\code{MAN}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DC03&showdescription=no}{J01DC03}), cefapirin (\code{HAP}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB08&showdescription=no}{J01DB08}), cefatrizine (\code{CTZ}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB07&showdescription=no}{J01DB07}), cefazedone (\code{CZD}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB06&showdescription=no}{J01DB06}), cefazolin (\code{CZO}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DB04&showdescription=no}{J01DB04}), cefcapene (\code{CCP}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD17&showdescription=no}{J01DD17}), cefdinir (\code{CDR}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD15&showdescription=no}{J01DD15}), cefditoren (\code{DIT}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD16&showdescription=no}{J01DD16}), cefepime (\code{FEP}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DE01&showdescription=no}{J01DE01}), cefepime/amikacin (\code{CFA}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01RA06&showdescription=no}{J01RA06}), cefetamet (\code{CAT}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD10&showdescription=no}{J01DD10}), cefiderocol (\code{FDC}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DI04&showdescription=no}{J01DI04}), cefixime (\code{CFM}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD08&showdescription=no}{J01DD08}), cefmenoxime (\code{CMX}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD05&showdescription=no}{J01DD05}), cefmetazole (\code{CMZ}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DC09&showdescription=no}{J01DC09}), cefodizime (\code{DIZ}, \href{https://atcddd.fhi.no/atc_ddd_index//?code=J01DD09&showdescriLine truncated
}
@@ -6786,7 +6799,7 @@ All matches are sorted descending on their matching score and for all user input
\section{Reference Data Publicly Available}{
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
All data sets in this \code{AMR} package (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
\examples{
@@ -7006,7 +7019,7 @@ Determination of the Gram stain (\code{\link[=mo_gramstain]{mo_gramstain()}}) wi
Determination of yeasts (\code{\link[=mo_is_yeast]{mo_is_yeast()}}) will be based on the taxonomic kingdom and class. \emph{Budding yeasts} are yeasts that reproduce asexually through a process called budding, where a new cell develops from a small protrusion on the parent cell. Taxonomically, these are members of the phylum Ascomycota, class Saccharomycetes (also called Hemiascomycetes) or Pichiomycetes. \emph{True yeasts} quite specifically refers to yeasts in the underlying order Saccharomycetales (such as \emph{Saccharomyces cerevisiae}). Thus, for all microorganisms that are member of the taxonomic class Saccharomycetes or Pichiomycetes, the function will return \code{TRUE}. It returns \code{FALSE} otherwise (or \code{NA} when the input is \code{NA} or the MO code is \code{UNKNOWN}).
Determination of intrinsic resistance (\code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}}) will be based on the \link{intrinsic_resistant} data set, which is based on \href{https://www.eucast.org/expert_rules_and_expected_phenotypes}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3} (2021). The \code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}} function can be vectorised over both argument \code{x} (input for microorganisms) and \code{ab} (input for antibiotics).
Determination of intrinsic resistance (\code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}}) will be based on the \link{intrinsic_resistant} data set, which is based on \href{https://www.eucast.org/expert_rules_and_expected_phenotypes}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3} (2021). The \code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}} function can be vectorised over both argument \code{x} (input for microorganisms) and \code{ab} (input for antimicrobials).
Determination of bacterial oxygen tolerance (\code{\link[=mo_oxygen_tolerance]{mo_oxygen_tolerance()}}) will be based on BacDive, see \emph{Source}. The function \code{\link[=mo_is_anaerobic]{mo_is_anaerobic()}} only returns \code{TRUE} if the oxygen tolerance is \code{"anaerobe"}, indicting an obligate anaerobic species or genus. It always returns \code{FALSE} for species outside the taxonomic kingdom of Bacteria.
@@ -7038,7 +7051,7 @@ This function uses \code{\link[=as.mo]{as.mo()}} internally, which uses an advan
\section{Reference Data Publicly Available}{
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
All data sets in this \code{AMR} package (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
\examples{
@@ -7539,7 +7552,7 @@ labels_sir_count(position = NULL, x = "antibiotic",
\item{position}{position adjustment of bars, either \code{"fill"}, \code{"stack"} or \code{"dodge"}}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{translate_ab}{a column name of the \link{antimicrobials} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{minimum}{the minimum allowed number of available (tested) isolates. Any isolate count lower than \code{minimum} will return \code{NA} with a warning. The default number of \code{30} isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see \emph{Source}.}
@@ -7800,7 +7813,7 @@ sir_df(data, translate_ab = "name", language = get_AMR_locale(),
\item{as_percent}{a \link{logical} to indicate whether the output must be returned as a hundred fold with \% sign (a character). A value of \code{0.123456} will then be returned as \code{"12.3\%"}.}
\item{only_all_tested}{(for combination therapies, i.e. using more than one variable for \code{...}): a \link{logical} to indicate that isolates must be tested for all antibiotics, see section \emph{Combination Therapy} below}
\item{only_all_tested}{(for combination therapies, i.e. using more than one variable for \code{...}): a \link{logical} to indicate that isolates must be tested for all antimicrobials, see section \emph{Combination Therapy} below}
\item{ab_result}{antibiotic results to test against, must be one or more values of "S", "SDD", "I", or "R"}
@@ -7812,7 +7825,7 @@ sir_df(data, translate_ab = "name", language = get_AMR_locale(),
\item{data}{a \link{data.frame} containing columns with class \code{\link{sir}} (see \code{\link[=as.sir]{as.sir()}})}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{translate_ab}{a column name of the \link{antimicrobials} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{language}{language of the returned text - the default is the current system language (see \code{\link[=get_AMR_locale]{get_AMR_locale()}}) and can also be set with the package option \code{\link[=AMR-options]{AMR_locale}}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
@@ -7841,7 +7854,7 @@ The function \code{\link[=proportion_df]{proportion_df()}} takes any variable fr
}
\section{Combination Therapy}{
When using more than one variable for \code{...} (= combination therapy), use \code{only_all_tested} to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antibiotics, Drug A and Drug B, about how \code{\link[=susceptibility]{susceptibility()}} works to calculate the \%SI:
When using more than one variable for \code{...} (= combination therapy), use \code{only_all_tested} to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antimicrobials, Drug A and Drug B, about how \code{\link[=susceptibility]{susceptibility()}} works to calculate the \%SI:
\if{html}{\out{<div class="sourceCode">}}\preformatted{--------------------------------------------------------------------
only_all_tested = FALSE only_all_tested = TRUE
@@ -8986,7 +8999,7 @@ In this example, we generate an antibiogram by selecting various antibiotics.
## Taxonomic Data Sets Now in Python!
As a Python user, you might like that the most important data sets of the `AMR` R package, `microorganisms`, `antibiotics`, `clinical_breakpoints`, and `example_isolates`, are now available as regular Python data frames:
As a Python user, you might like that the most important data sets of the `AMR` R package, `microorganisms`, `antimicrobials`, `clinical_breakpoints`, and `example_isolates`, are now available as regular Python data frames:
```python
AMR.microorganisms
@@ -9007,7 +9020,7 @@ AMR.microorganisms
| F_ZYZYG | Zyzygomyces | unknown | Fungi | None | 7581 | None | 2.0 |
```python
AMR.antibiotics
AMR.antimicrobials
```
| ab | cid | name | group | oral_ddd | oral_units | iv_ddd | iv_units |
@@ -9104,7 +9117,7 @@ data <- example_isolates %>%
**Explanation:**
- `aminoglycosides()` and `betalactams()` dynamically select columns for antibiotics in these classes.
- `aminoglycosides()` and `betalactams()` dynamically select columns for antimicrobials in these classes.
- `drop_na()` ensures the model receives complete cases for training.
### **Defining the Workflow**
@@ -9286,7 +9299,7 @@ oops
eucast_rules(oops, info = FALSE)
```
A more convenient function is `mo_is_intrinsic_resistant()` that uses the same guideline, but allows to check for one or more specific microorganisms or antibiotics:
A more convenient function is `mo_is_intrinsic_resistant()` that uses the same guideline, but allows to check for one or more specific microorganisms or antimicrobials:
```{r, warning = FALSE, message = FALSE}
mo_is_intrinsic_resistant(
@@ -9758,7 +9771,7 @@ download_txt <- function(filename) {
msg <- paste0(
"It was last updated on ",
trimws(format(file.mtime(paste0("../data/", filename, ".rda")), "%e %B %Y %H:%M:%S %Z", tz = "UTC")),
". Find more info about the structure of this data set [here](https://msberends.github.io/AMR/reference/", ifelse(filename == "antivirals", "antibiotics", filename), ".html).\n"
". Find more info about the structure of this data set [here](https://msberends.github.io/AMR/reference/", ifelse(filename == "antivirals", "antimicrobials", filename), ".html).\n"
)
github_base <- "https://github.com/msberends/AMR/raw/main/data-raw/"
filename <- paste0("../data-raw/", filename)
@@ -9829,7 +9842,7 @@ print_df <- function(x, rows = 6) {
}
```
All reference data (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) in this `AMR` package are reliable, up-to-date and freely available. We continually export our data sets to formats for use in R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated text files that are machine-readable and suitable for input in any software program, such as laboratory information systems.
All reference data (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) in this `AMR` package are reliable, up-to-date and freely available. We continually export our data sets to formats for use in R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated text files that are machine-readable and suitable for input in any software program, such as laboratory information systems.
On this page, we explain how to download them and how the structure of the data sets look like.
@@ -9876,13 +9889,13 @@ microorganisms %>%
```
## `antibiotics`: Antibiotic (+Antifungal) Drugs
## `antimicrobials`: Antibiotic and Antifungal Drugs
`r structure_txt(antibiotics)`
`r structure_txt(antimicrobials)`
This data set is in R available as `antibiotics`, after you load the `AMR` package.
This data set is in R available as `antimicrobials`, after you load the `AMR` package.
`r download_txt("antibiotics")`
`r download_txt("antimicrobials")`
The tab-separated text, Microsoft Excel, SPSS, and Stata files all contain the ATC codes, common abbreviations, trade names and LOINC codes as comma separated values.
@@ -9898,7 +9911,7 @@ This data set contains all EARS-Net and ATC codes gathered from WHO and WHONET,
### Example content
```{r, echo = FALSE}
antibiotics %>%
antimicrobials %>%
filter(ab %in% colnames(example_isolates)) %>%
print_df()
```
@@ -10262,7 +10275,7 @@ The `AMR` package is a [free and open-source](https://msberends.github.io/AMR/#c
This work was published in the Journal of Statistical Software (Volume 104(3); [DOI 10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)) and formed the basis of two PhD theses ([DOI 10.33612/diss.177417131](https://doi.org/10.33612/diss.177417131) and [DOI 10.33612/diss.192486375](https://doi.org/10.33612/diss.192486375)).
After installing this package, R knows `r AMR:::format_included_data_number(AMR::microorganisms)` distinct microbial species and all `r AMR:::format_included_data_number(rbind(AMR::antibiotics[, "atc", drop = FALSE], AMR::antivirals[, "atc", drop = FALSE]))` antibiotic, antimycotic and antiviral drugs by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral breakpoint guidelines from CLSI and EUCAST are included from the last 10 years. It supports and can read any data format, including WHONET data.
After installing this package, R knows `r AMR:::format_included_data_number(AMR::microorganisms)` distinct microbial species and all `r AMR:::format_included_data_number(rbind(AMR::antimicrobials[, "atc", drop = FALSE], AMR::antivirals[, "atc", drop = FALSE]))` antibiotic, antimycotic and antiviral drugs by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral breakpoint guidelines from CLSI and EUCAST are included from the last 10 years. It supports and can read any data format, including WHONET data.
With the help of contributors from all corners of the world, the `AMR` package is available in English, Czech, Chinese, Danish, Dutch, Finnish, French, German, Greek, Italian, Japanese, Norwegian, Polish, Portuguese, Romanian, Russian, Spanish, Swedish, Turkish, and Ukrainian. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages.
@@ -10287,7 +10300,7 @@ This package can be used for:
* Machine reading the EUCAST and CLSI guidelines from 2011-2020 to translate MIC values and disk diffusion diameters to SIR
* Principal component analysis for AMR
All reference data sets (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) in this `AMR` package are publicly and freely available. We continually export our data sets to formats for use in R, SPSS, Stata and Excel. We also supply flat files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please find [all download links on our website](https://msberends.github.io/AMR/articles/datasets.html), which is automatically updated with every code change.
All reference data sets (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) in this `AMR` package are publicly and freely available. We continually export our data sets to formats for use in R, SPSS, Stata and Excel. We also supply flat files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please find [all download links on our website](https://msberends.github.io/AMR/articles/datasets.html), which is automatically updated with every code change.
This R package was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the [University of Groningen](https://www.rug.nl), in collaboration with non-profit organisations [Certe Medical Diagnostics and Advice Foundation](https://www.certe.nl) and [University Medical Center Groningen](https://www.umcg.nl), and is being [actively and durably maintained](https://msberends.github.io/AMR/news/) by two public healthcare organisations in the Netherlands.
+13 -13
View File
@@ -50,15 +50,15 @@ loinc_df <- loinc_df %>%
filter(CLASS %in% c("DRUG/TOX", "ABXBACT")) %>%
mutate(name = generalise_antibiotic_name(COMPONENT), .before = 1)
# antibiotics
antibiotics$loinc <- as.list(rep(NA_character_, nrow(antibiotics)))
for (i in seq_len(nrow(antibiotics))) {
# antimicrobials
antimicrobials$loinc <- as.list(rep(NA_character_, nrow(antimicrobials)))
for (i in seq_len(nrow(antimicrobials))) {
message(i)
loinc_ab <- loinc_df %>%
filter(name %like% paste0("^", generalise_antibiotic_name(antibiotics$name[i]))) %>%
filter(name %like% paste0("^", generalise_antibiotic_name(antimicrobials$name[i]))) %>%
pull(LOINC_NUM)
if (length(loinc_ab) > 0) {
antibiotics$loinc[i] <- list(loinc_ab)
antimicrobials$loinc[i] <- list(loinc_ab)
}
}
@@ -75,10 +75,10 @@ for (i in seq_len(nrow(antivirals))) {
}
# sort and fix for empty values
for (i in 1:nrow(antibiotics)) {
loinc <- as.character(sort(unique(tolower(antibiotics[i, "loinc", drop = TRUE][[1]]))))
for (i in 1:nrow(antimicrobials)) {
loinc <- as.character(sort(unique(tolower(antimicrobials[i, "loinc", drop = TRUE][[1]]))))
loinc <- loinc[loinc != ""]
antibiotics[i, "loinc"][[1]] <- ifelse(length(loinc) == 0, list(""), list(loinc))
antimicrobials[i, "loinc"][[1]] <- ifelse(length(loinc) == 0, list(""), list(loinc))
}
for (i in 1:nrow(antivirals)) {
loinc <- as.character(sort(unique(tolower(antivirals[i, "loinc", drop = TRUE][[1]]))))
@@ -86,17 +86,17 @@ for (i in 1:nrow(antivirals)) {
antivirals[i, "loinc"][[1]] <- ifelse(length(loinc) == 0, list(""), list(loinc))
}
antibiotics <- dataset_UTF8_to_ASCII(as.data.frame(antibiotics, stringsAsFactors = FALSE))
antibiotics <- dplyr::arrange(antibiotics, name)
antimicrobials <- dataset_UTF8_to_ASCII(as.data.frame(antimicrobials, stringsAsFactors = FALSE))
antimicrobials <- dplyr::arrange(antimicrobials, name)
antivirals <- dataset_UTF8_to_ASCII(as.data.frame(antivirals, stringsAsFactors = FALSE))
antivirals <- dplyr::arrange(antivirals, name)
# remember to update R/aa_globals.R for the documentation
dim(antibiotics) # for R/data.R
usethis::use_data(antibiotics, internal = FALSE, overwrite = TRUE, compress = "xz", version = 2)
rm(antibiotics)
dim(antimicrobials) # for R/data.R
usethis::use_data(antimicrobials, internal = FALSE, overwrite = TRUE, compress = "xz", version = 2)
rm(antimicrobials)
dim(antivirals) # for R/data.R
usethis::use_data(antivirals, internal = FALSE, overwrite = TRUE, compress = "xz", version = 2)
-948
View File
@@ -1,948 +0,0 @@
# ==================================================================== #
# TITLE: #
# AMR: An R Package for Working with Antimicrobial Resistance Data #
# #
# SOURCE CODE: #
# https://github.com/msberends/AMR #
# #
# PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 #
# #
# Developed at the University of Groningen and the University Medical #
# Center Groningen in The Netherlands, in collaboration with many #
# colleagues from around the world, see our website. #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# We created this package for both routine data analysis and academic #
# research and it was publicly released in the hope that it will be #
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
# #
# Visit our website for the full manual and a complete tutorial about #
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
library(dplyr)
# got EARS-Net codes (= ECDC/WHO codes) from here:
# Installed WHONET 2019 software on Windows (http://www.whonet.org/software.html),
# opened C:\WHONET\Codes\WHONETCodes.mdb in MS Access
# and exported table 'DRGLST' to MS Excel
library(readxl)
DRGLST <- read_excel("DRGLST.xlsx")
abx <- DRGLST %>%
select(
ab = WHON5_CODE,
name = ANTIBIOTIC
) %>%
# remove the ones without WHONET code
filter(!is.na(ab)) %>%
distinct(name, .keep_all = TRUE) %>%
# add the ones without WHONET code
bind_rows(
DRGLST %>%
select(
ab = WHON5_CODE,
name = ANTIBIOTIC
) %>%
filter(is.na(ab)) %>%
distinct(name, .keep_all = TRUE)
# add new ab code later
) %>%
arrange(name)
# add old ATC codes
ab_old <- AMR::antibiotics %>%
mutate(
official = gsub("( and |, )", "/", official),
abbr = tolower(paste(ifelse(is.na(abbr), "", abbr),
ifelse(is.na(certe), "", certe),
ifelse(is.na(umcg), "", umcg),
sep = "|"
))
)
for (i in 1:nrow(ab_old)) {
abbr <- ab_old[i, "abbr"]
abbr <- strsplit(abbr, "|", fixed = TRUE) %>%
unlist() %>%
unique()
abbr <- abbr[abbr != ""]
# print(abbr)
if (length(abbr) == 0) {
ab_old[i, "abbr"] <- NA_character_
} else {
ab_old[i, "abbr"] <- paste(abbr, collapse = "|")
}
}
# create reference data set: to be able to map ab to atc
abx_atc1 <- abx %>%
mutate(name_lower = tolower(name)) %>%
left_join(ab_old %>%
select(ears_net, atc), by = c(ab = "ears_net")) %>%
rename(atc1 = atc) %>%
left_join(ab_old %>%
mutate(official = gsub(", combinations", "", official, fixed = TRUE)) %>%
transmute(official = tolower(official), atc), by = c(name_lower = "official")) %>%
rename(atc2 = atc) %>%
left_join(ab_old %>%
mutate(official = gsub(", combinations", "", official, fixed = TRUE)) %>%
mutate(official = gsub("f", "ph", official)) %>%
transmute(official = tolower(official), atc), by = c(name_lower = "official")) %>%
rename(atc3 = atc) %>%
left_join(ab_old %>%
mutate(official = gsub(", combinations", "", official, fixed = TRUE)) %>%
mutate(official = gsub("t", "th", official)) %>%
transmute(official = tolower(official), atc), by = c(name_lower = "official")) %>%
rename(atc4 = atc) %>%
left_join(ab_old %>%
mutate(official = gsub(", combinations", "", official, fixed = TRUE)) %>%
mutate(official = gsub("f", "ph", official)) %>%
mutate(official = gsub("t", "th", official)) %>%
transmute(official = tolower(official), atc), by = c(name_lower = "official")) %>%
rename(atc5 = atc) %>%
left_join(ab_old %>%
mutate(official = gsub(", combinations", "", official, fixed = TRUE)) %>%
mutate(official = gsub("f", "ph", official)) %>%
mutate(official = gsub("t", "th", official)) %>%
mutate(official = gsub("ine$", "in", official)) %>%
transmute(official = tolower(official), atc), by = c(name_lower = "official")) %>%
rename(atc6 = atc) %>%
mutate(atc = case_when(
!is.na(atc1) ~ atc1,
!is.na(atc2) ~ atc2,
!is.na(atc3) ~ atc3,
!is.na(atc4) ~ atc4,
!is.na(atc4) ~ atc5,
TRUE ~ atc6
)) %>%
distinct(ab, name, .keep_all = TRUE) %>%
select(ab, atc, name)
abx_atc2 <- ab_old %>%
filter(
!atc %in% abx_atc1$atc,
is.na(ears_net),
!is.na(atc_group1),
atc_group1 %unlike% ("virus|vaccin|viral|immun"),
official %unlike% "(combinations| with )"
) %>%
mutate(ab = NA_character_) %>%
as.data.frame(stringsAsFactors = FALSE) %>%
select(ab, atc, name = official)
abx2 <- bind_rows(abx_atc1, abx_atc2)
rm(abx_atc1)
rm(abx_atc2)
abx2$ab[is.na(abx2$ab)] <- toupper(abbreviate(
gsub(
"[/0-9-]",
" ",
abx2$name[is.na(abx2$ab)]
),
minlength = 3,
method = "left.kept",
strict = TRUE
))
n_distinct(abx2$ab)
abx2 <- abx2 %>% arrange(ab)
seqnr <- 0
# add follow up nrs
for (i in 2:nrow(abx2)) {
if (abx2[i, "ab", drop = TRUE] == abx2[i - 1, "ab", drop = TRUE]) {
seqnr <- seqnr + 1
abx2[i, "seqnr"] <- seqnr
} else {
seqnr <- 0
}
}
for (i in 2:nrow(abx2)) {
if (!is.na(abx2[i, "seqnr"])) {
abx2[i, "ab"] <- paste0(abx2[i, "ab", drop = TRUE], abx2[i, "seqnr", drop = TRUE])
}
}
abx2 <- abx2 %>%
select(-seqnr) %>%
arrange(name)
# everything unique??
nrow(abx2) == n_distinct(abx2$ab)
# get ATC properties
abx2 <- abx2 %>%
left_join(ab_old %>%
select(
atc, abbr, atc_group1, atc_group2,
oral_ddd, oral_units, iv_ddd, iv_units
))
abx2$abbr <- lapply(as.list(abx2$abbr), function(x) unlist(strsplit(x, "|", fixed = TRUE)))
# Update Compound IDs and Synonyms ----
# vector with official names, returns vector with CIDs
get_CID <- function(ab) {
CID <- rep(NA_integer_, length(ab))
p <- AMR:::progress_ticker(n = length(ab), min_time = 0)
for (i in 1:length(ab)) {
p$tick()
CID[i] <- tryCatch(
data.table::fread(
paste0(
"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/",
URLencode(ab[i], reserved = TRUE),
"/cids/TXT?name_type=complete"
),
showProgress = FALSE
)[[1]][1],
error = function(e) NA_integer_
)
if (is.na(CID[i])) {
# try with removing the text in brackets
CID[i] <- tryCatch(
data.table::fread(
paste0(
"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/",
URLencode(trimws(gsub("[(].*[)]", "", ab[i])), reserved = TRUE),
"/cids/TXT?name_type=complete"
),
showProgress = FALSE
)[[1]][1],
error = function(e) NA_integer_
)
}
if (is.na(CID[i])) {
# try match on word and take the lowest CID value (sorted)
ab[i] <- gsub("[^a-z0-9]+", " ", ab[i], ignore.case = TRUE)
CID[i] <- tryCatch(
data.table::fread(
paste0(
"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/",
URLencode(ab[i], reserved = TRUE),
"/cids/TXT?name_type=word"
),
showProgress = FALSE
)[[1]][1],
error = function(e) NA_integer_
)
}
Sys.sleep(0.1)
}
CID
}
# get CIDs (4-5 min)
CIDs <- get_CID(antibiotics$name)
# take missing from previously found CIDs
CIDs[is.na(CIDs) & !is.na(antibiotics$cid)] <- antibiotics$cid[is.na(CIDs) & !is.na(antibiotics$cid)]
# These could not be found:
antibiotics[is.na(CIDs), ] %>% View()
# returns list with synonyms (brand names), with CIDs as names
get_synonyms <- function(CID, clean = TRUE) {
synonyms <- rep(NA_character_, length(CID))
p <- AMR:::progress_ticker(n = length(CID), min_time = 0)
for (i in 1:length(CID)) {
p$tick()
synonyms_txt <- ""
if (is.na(CID[i])) {
next
}
# we will now get the closest compounds with a 96% threshold
similar_cids <- tryCatch(
data.table::fread(
paste0(
"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/fastsimilarity_2d/cid/",
CID[i],
"/cids/TXT?Threshold=96&MaxRecords=5"
),
sep = "\n",
showProgress = FALSE
)[[1]],
error = function(e) NA_character_
)
# include the current CID of course
all_cids <- unique(c(CID[i], similar_cids))
# but leave out all CIDs that we have in our antibiotics dataset to prevent duplication
all_cids <- all_cids[!all_cids %in% antibiotics$cid[!is.na(antibiotics$cid)]]
# for each one, we are getting the synonyms
current_syns <- character(0)
for (j in seq_len(length(all_cids))) {
synonyms_txt <- tryCatch(
data.table::fread(
paste0(
"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/fastidentity/cid/",
all_cids[j],
"/synonyms/TXT"
),
sep = "\n",
showProgress = FALSE
)[[1]],
error = function(e) NA_character_
)
Sys.sleep(0.05)
if (clean == TRUE) {
# remove text between brackets
synonyms_txt <- trimws(gsub(
"[(].*[)]", "",
gsub(
"[[].*[]]", "",
gsub(
"[(].*[]]", "",
gsub("[[].*[)]", "", synonyms_txt)
)
)
))
synonyms_txt <- gsub("Co-", "Co", synonyms_txt, fixed = TRUE)
synonyms_txt <- gsub(" ?(mono)?sodium ?", "", ignore.case = TRUE, synonyms_txt)
synonyms_txt <- gsub(" ?(injection|pediatric) ?", "", ignore.case = TRUE, synonyms_txt)
# only length 6 to 20 and no txt with reading marks or numbers and must start with capital letter (= brand)
synonyms_txt <- synonyms_txt[nchar(synonyms_txt) %in% c(5:20) &
!grepl("[-&{},_0-9/:]", synonyms_txt) &
grepl("^[A-Z]", synonyms_txt, ignore.case = FALSE)]
synonyms_txt <- unlist(strsplit(synonyms_txt, ";", fixed = TRUE))
}
current_syns <- c(current_syns, synonyms_txt)
}
current_syns <- unique(trimws(current_syns[tolower(current_syns) %in% unique(tolower(current_syns))]))
synonyms[i] <- list(sort(current_syns))
}
names(synonyms) <- CID
synonyms
}
# get brand names from PubChem (3-4 min)
synonyms <- get_synonyms(CIDs)
synonyms.bak <- synonyms
synonyms <- synonyms.bak
# add existing ones (will be cleaned later)
for (i in seq_len(length(synonyms))) {
old <- unname(unlist(AMR::antibiotics[i, "synonyms", drop = TRUE]))
synonyms[[i]] <- c(unname(synonyms[[i]]), old)
}
antibiotics$synonyms <- synonyms
stop("remember to remove co-trimoxazole as synonyms from SMX (Sulfamethoxazole), so it only exists in SXT!")
sulfa <- antibiotics[which(antibiotics$ab == "SMX"), "synonyms", drop = TRUE][[1]]
cotrim <- antibiotics[which(antibiotics$ab == "SXT"), "synonyms", drop = TRUE][[1]]
# 2024-10-06 not the case anymore, no overlapping names: sulfa[sulfa %in% cotrim]
sulfa <- sulfa[!sulfa %in% cotrim]
antibiotics[which(antibiotics$ab == "SMX"), "synonyms"][[1]][[1]] <- sulfa
# now go to end of this file
# -----
# add them to data set
antibiotics <- abx2 %>%
left_join(DRGLST %>%
select(ab = WHON5_CODE, CLASS, SUBCLASS) %>%
distinct(ab, .keep_all = TRUE), by = "ab") %>%
transmute(ab,
atc,
cid = CIDs,
# no capital after a slash: Ampicillin/Sulbactam -> Ampicillin/sulbactam
name = name %>%
gsub("([/-])([A-Z])", "\\1\\L\\2", ., perl = TRUE) %>%
gsub("edta", "EDTA", ., ignore.case = TRUE),
group = case_when(
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "am(ph|f)enicol" ~ "Amphenicols",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "aminoglycoside" ~ "Aminoglycosides",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "carbapenem" | name %like% "(imipenem|meropenem)" ~ "Carbapenems",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "First-generation cephalosporin" ~ "Cephalosporins (1st gen.)",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "Second-generation cephalosporin" ~ "Cephalosporins (2nd gen.)",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "Third-generation cephalosporin" ~ "Cephalosporins (3rd gen.)",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "Fourth-generation cephalosporin" ~ "Cephalosporins (4th gen.)",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "(tuberculosis|mycobacter)" ~ "Antimycobacterials",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "cephalosporin" ~ "Cephalosporins",
name %like% "^Ce" & is.na(atc_group1) & paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "beta-?lactam" ~ "Cephalosporins",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "(beta-?lactam|penicillin)" ~ "Beta-lactams/penicillins",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "quinolone" ~ "Quinolones",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "glycopeptide" ~ "Glycopeptides",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "macrolide" ~ "Macrolides/lincosamides",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "tetracycline" ~ "Tetracyclines",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "trimethoprim" ~ "Trimethoprims",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "polymyxin" ~ "Polymyxins",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "(fungal|mycot)" ~ "Antifungals/antimycotics",
TRUE ~ "Other antibacterials"
),
atc_group1, atc_group2,
abbreviations = unname(abbr),
synonyms = unname(synonyms),
oral_ddd, oral_units,
iv_ddd, iv_units
) %>%
as.data.frame(stringsAsFactors = FALSE)
# some exceptions
antibiotics[which(antibiotics$ab == "DOX"), "abbreviations"][[1]] <- list(c("dox", "doxy"))
antibiotics[which(antibiotics$ab == "FLC"), "abbreviations"][[1]] <- list(c("clox"))
antibiotics[which(antibiotics$ab == "CEC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CEC"), "abbreviations"][[1]], "CFC")) # cefaclor old WHONET4 code
antibiotics[which(antibiotics$ab == "AMX"), "synonyms"][[1]] <- list(sort(c(antibiotics[which(antibiotics$ab == "AMX"), "synonyms"][[1]], "Amoxy")))
# 'Polymixin B' (POL) and 'Polymyxin B' (PLB) both exist, so:
antibiotics[which(antibiotics$ab == "PLB"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PLB"), "abbreviations"][[1]], "POL", "Polymixin", "Polymixin B", "Poly B"))
antibiotics <- filter(antibiotics, ab != "POL")
# 'Latamoxef' (LTM) and 'Moxalactam (Latamoxef)' (MOX) both exist, so:
antibiotics[which(antibiotics$ab == "LTM"), "abbreviations"][[1]] <- list(c("MOX", "moxa"))
antibiotics <- filter(antibiotics, ab != "MOX")
# RFP and RFP1 (the J0 one) both mean 'rifapentine', although 'rifp' is not recognised, so:
antibiotics <- filter(antibiotics, ab != "RFP")
antibiotics[which(antibiotics$ab == "RFP1"), "ab"] <- "RFP"
antibiotics[which(antibiotics$ab == "RFP"), "abbreviations"][[1]] <- list(c("rifp"))
# Rifampicin is better known as a drug than Rifampin (Rifampin is still listed as a brand name), so:
antibiotics[which(antibiotics$ab == "RIF"), "name"] <- "Rifampicin"
# PME and PVM1 (the J0 one) both mean 'Pivmecillinam', so:
antibiotics <- filter(antibiotics, ab != "PME")
antibiotics[which(antibiotics$ab == "PVM1"), "ab"] <- "PME"
# Remove Sinecatechins
antibiotics <- filter(antibiotics, ab != "SNC")
# GLIMS codes
antibiotics[which(antibiotics$ab == as.ab("cefuroxim")), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == as.ab("cefuroxim")), "abbreviations"][[1]], "cfrx"))
antibiotics[which(antibiotics$ab == as.ab("cefotaxim")), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == as.ab("cefotaxim")), "abbreviations"][[1]], "cftx"))
antibiotics[which(antibiotics$ab == as.ab("ceftazidime")), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == as.ab("ceftazidime")), "abbreviations"][[1]], "cftz"))
antibiotics[which(antibiotics$ab == as.ab("cefepime")), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == as.ab("cefepime")), "abbreviations"][[1]], "cfpi"))
antibiotics[which(antibiotics$ab == as.ab("cefoxitin")), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == as.ab("cefoxitin")), "abbreviations"][[1]], "cfxt"))
# Add cefoxitin screening
class(antibiotics$ab) <- "character"
antibiotics <- rbind(antibiotics, data.frame(
ab = "FOX1", atc = NA, cid = NA,
name = "Cefoxitin screening",
group = "Cephalosporins (2nd gen.)", atc_group1 = NA, atc_group2 = NA,
abbreviations = "cfsc", synonyms = NA,
oral_ddd = NA, oral_units = NA, iv_ddd = NA, iv_units = NA,
loinc = NA,
stringsAsFactors = FALSE
))
# More GLIMS codes
antibiotics[which(antibiotics$ab == "AMB"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "AMB"), "abbreviations"][[1]], "amf"))
antibiotics[which(antibiotics$ab == "CAZ"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CAZ"), "abbreviations"][[1]], "cftz"))
antibiotics[which(antibiotics$ab == "COL"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "COL"), "abbreviations"][[1]], "cst"))
antibiotics[which(antibiotics$ab == "CRO"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CRO"), "abbreviations"][[1]], "cftr"))
antibiotics[which(antibiotics$ab == "CTX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CTX"), "abbreviations"][[1]], "cftx"))
antibiotics[which(antibiotics$ab == "CXM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CXM"), "abbreviations"][[1]], "cfrx"))
antibiotics[which(antibiotics$ab == "CZO"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CZO"), "abbreviations"][[1]], "cfzl"))
antibiotics[which(antibiotics$ab == "FCT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FCT"), "abbreviations"][[1]], "fcu"))
antibiotics[which(antibiotics$ab == "FCT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FCT"), "abbreviations"][[1]], "fluy"))
antibiotics[which(antibiotics$ab == "FLU"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FLU"), "abbreviations"][[1]], "flz"))
antibiotics[which(antibiotics$ab == "FOS"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FOS"), "abbreviations"][[1]], "fof"))
antibiotics[which(antibiotics$ab == "FOX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FOX"), "abbreviations"][[1]], "cfxt"))
antibiotics[which(antibiotics$ab == "FUS"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FUS"), "abbreviations"][[1]], "fa"))
antibiotics[which(antibiotics$ab == "GEH"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "GEH"), "abbreviations"][[1]], "g_h"))
antibiotics[which(antibiotics$ab == "KAH"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "KAH"), "abbreviations"][[1]], "k_h"))
antibiotics[which(antibiotics$ab == "KET"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "KET"), "abbreviations"][[1]], "ktc"))
antibiotics[which(antibiotics$ab == "PIP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PIP"), "abbreviations"][[1]], "pipc"))
antibiotics[which(antibiotics$ab == "PIP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PIP"), "abbreviations"][[1]], "PIPC"))
antibiotics[which(antibiotics$ab == "SPX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SPX"), "abbreviations"][[1]], "spa"))
antibiotics[which(antibiotics$ab == "STH"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "STH"), "abbreviations"][[1]], "s_h"))
antibiotics[which(antibiotics$ab == "STR1"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "STR1"), "abbreviations"][[1]], "stm"))
antibiotics[which(antibiotics$ab == "SXT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SXT"), "abbreviations"][[1]], "COTRIM"))
antibiotics[which(antibiotics$ab == "SXT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SXT"), "abbreviations"][[1]], "trsx"))
antibiotics[which(antibiotics$ab == "TGC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TGC"), "abbreviations"][[1]], "tig"))
antibiotics[which(antibiotics$ab == "TMP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TMP"), "abbreviations"][[1]], "tri"))
antibiotics[which(antibiotics$ab == "TZP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TZP"), "abbreviations"][[1]], "PIPTAZ"))
antibiotics[which(antibiotics$ab == "TZP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TZP"), "abbreviations"][[1]], "pit"))
antibiotics[which(antibiotics$ab == "TZP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TZP"), "abbreviations"][[1]], "pita"))
antibiotics[which(antibiotics$ab == "VOR"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "VOR"), "abbreviations"][[1]], "vrc"))
# official RIVM codes (Dutch National Health Institute)
# https://www.rivm.nl/sites/default/files/2019-09/Bijlage_4_Lijst_antibiotica%202020%201.0.pdf
antibiotics[which(antibiotics$ab == "FCT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FCT"), "abbreviations"][[1]], "5flc"))
antibiotics[which(antibiotics$ab == "AMC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "AMC"), "abbreviations"][[1]], "amcl"))
antibiotics[which(antibiotics$ab == "AMB"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "AMB"), "abbreviations"][[1]], "amfb"))
antibiotics[which(antibiotics$ab == "AMH"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "AMH"), "abbreviations"][[1]], "amhl"))
antibiotics[which(antibiotics$ab == "AMK"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "AMK"), "abbreviations"][[1]], "amik"))
antibiotics[which(antibiotics$ab == "AMX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "AMX"), "abbreviations"][[1]], "amox"))
antibiotics[which(antibiotics$ab == "AMP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "AMP"), "abbreviations"][[1]], "ampi"))
antibiotics[which(antibiotics$ab == "SAM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SAM"), "abbreviations"][[1]], "amsu"))
antibiotics[which(antibiotics$ab == "ANI"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "ANI"), "abbreviations"][[1]], "anid"))
antibiotics[which(antibiotics$ab == "SAM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SAM"), "abbreviations"][[1]], "apsu"))
antibiotics[which(antibiotics$ab == "AZM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "AZM"), "abbreviations"][[1]], "azit"))
antibiotics[which(antibiotics$ab == "AZL"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "AZL"), "abbreviations"][[1]], "azlo"))
antibiotics[which(antibiotics$ab == "ATM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "ATM"), "abbreviations"][[1]], "aztr"))
antibiotics[which(antibiotics$ab == "PNV"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PNV"), "abbreviations"][[1]], "bepe"))
antibiotics[which(antibiotics$ab == "CAP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CAP"), "abbreviations"][[1]], "capr"))
antibiotics[which(antibiotics$ab == "CRB"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CRB"), "abbreviations"][[1]], "carb"))
antibiotics[which(antibiotics$ab == "CAS"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CAS"), "abbreviations"][[1]], "casp"))
antibiotics[which(antibiotics$ab == "CDC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CDC"), "abbreviations"][[1]], "cecl"))
antibiotics[which(antibiotics$ab == "CXA"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CXA"), "abbreviations"][[1]], "cfax"))
antibiotics[which(antibiotics$ab == "CTB"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CTB"), "abbreviations"][[1]], "cfbu"))
antibiotics[which(antibiotics$ab == "CEC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CEC"), "abbreviations"][[1]], "cfcl"))
antibiotics[which(antibiotics$ab == "CFR"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CFR"), "abbreviations"][[1]], "cfdx"))
antibiotics[which(antibiotics$ab == "CEP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CEP"), "abbreviations"][[1]], "cflt"))
antibiotics[which(antibiotics$ab == "LEX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "LEX"), "abbreviations"][[1]], "cflx"))
antibiotics[which(antibiotics$ab == "MAN"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "MAN"), "abbreviations"][[1]], "cfmn"))
antibiotics[which(antibiotics$ab == "CPD"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CPD"), "abbreviations"][[1]], "cfpd"))
antibiotics[which(antibiotics$ab == "FEP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FEP"), "abbreviations"][[1]], "cfpi"))
antibiotics[which(antibiotics$ab == "CPO"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CPO"), "abbreviations"][[1]], "cfpr"))
antibiotics[which(antibiotics$ab == "CFP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CFP"), "abbreviations"][[1]], "cfpz"))
antibiotics[which(antibiotics$ab == "CED"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CED"), "abbreviations"][[1]], "cfrd"))
antibiotics[which(antibiotics$ab == "CPT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CPT"), "abbreviations"][[1]], "cfro"))
antibiotics[which(antibiotics$ab == "CXM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CXM"), "abbreviations"][[1]], "cfrx"))
antibiotics[which(antibiotics$ab == "CFS"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CFS"), "abbreviations"][[1]], "cfsl"))
antibiotics[which(antibiotics$ab == "CRO"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CRO"), "abbreviations"][[1]], "cftr"))
antibiotics[which(antibiotics$ab == "CTT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CTT"), "abbreviations"][[1]], "cftt"))
antibiotics[which(antibiotics$ab == "CTX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CTX"), "abbreviations"][[1]], "cftx"))
antibiotics[which(antibiotics$ab == "CAZ"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CAZ"), "abbreviations"][[1]], "cftz"))
antibiotics[which(antibiotics$ab == "CFM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CFM"), "abbreviations"][[1]], "cfxm"))
antibiotics[which(antibiotics$ab == "FOX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FOX"), "abbreviations"][[1]], "cfxt"))
antibiotics[which(antibiotics$ab == "CZA"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CZA"), "abbreviations"][[1]], "cfav"))
antibiotics[which(antibiotics$ab == "CZO"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CZO"), "abbreviations"][[1]], "cfzl"))
antibiotics[which(antibiotics$ab == "CZX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CZX"), "abbreviations"][[1]], "cfzx"))
antibiotics[which(antibiotics$ab == "CHL"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CHL"), "abbreviations"][[1]], "chlo"))
antibiotics[which(antibiotics$ab == "CPC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CPC"), "abbreviations"][[1]], "cicl"))
antibiotics[which(antibiotics$ab == "CIN"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CIN"), "abbreviations"][[1]], "cino"))
antibiotics[which(antibiotics$ab == "CIP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CIP"), "abbreviations"][[1]], "cipr"))
antibiotics[which(antibiotics$ab == "CIX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CIX"), "abbreviations"][[1]], "cipx"))
antibiotics[which(antibiotics$ab == "CLR"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CLR"), "abbreviations"][[1]], "clar"))
antibiotics[which(antibiotics$ab == "CLI"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CLI"), "abbreviations"][[1]], "clin"))
antibiotics[which(antibiotics$ab == "CTR"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CTR"), "abbreviations"][[1]], "clot"))
antibiotics[which(antibiotics$ab == "CLO"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CLO"), "abbreviations"][[1]], "clox"))
antibiotics[which(antibiotics$ab == "COL"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "COL"), "abbreviations"][[1]], "coli"))
antibiotics[which(antibiotics$ab == "CTC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CTC"), "abbreviations"][[1]], "cxcl"))
antibiotics[which(antibiotics$ab == "CYC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CYC"), "abbreviations"][[1]], "cycl"))
antibiotics[which(antibiotics$ab == "CCV"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CCV"), "abbreviations"][[1]], "czcl"))
antibiotics[which(antibiotics$ab == "DAP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "DAP"), "abbreviations"][[1]], "dapt"))
antibiotics[which(antibiotics$ab == "DIC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "DIC"), "abbreviations"][[1]], "dicl"))
antibiotics[which(antibiotics$ab == "DOR"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "DOR"), "abbreviations"][[1]], "dori"))
antibiotics[which(antibiotics$ab == "DOX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "DOX"), "abbreviations"][[1]], "doxy"))
antibiotics[which(antibiotics$ab == "ENX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "ENX"), "abbreviations"][[1]], "enox"))
antibiotics[which(antibiotics$ab == "ETP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "ETP"), "abbreviations"][[1]], "erta"))
antibiotics[which(antibiotics$ab == "ERY"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "ERY"), "abbreviations"][[1]], "eryt"))
antibiotics[which(antibiotics$ab == "PHE"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PHE"), "abbreviations"][[1]], "fene"))
antibiotics[which(antibiotics$ab == "PHN"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PHN"), "abbreviations"][[1]], "fepe"))
antibiotics[which(antibiotics$ab == "FLE"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FLE"), "abbreviations"][[1]], "fler"))
antibiotics[which(antibiotics$ab == "FLU"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FLU"), "abbreviations"][[1]], "fluc"))
antibiotics[which(antibiotics$ab == "FLC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FLC"), "abbreviations"][[1]], "flux"))
antibiotics[which(antibiotics$ab == "FOS"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FOS"), "abbreviations"][[1]], "fosf"))
antibiotics[which(antibiotics$ab == "FRM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FRM"), "abbreviations"][[1]], "fram"))
antibiotics[which(antibiotics$ab == "FUS"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FUS"), "abbreviations"][[1]], "fusi"))
antibiotics[which(antibiotics$ab == "GAT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "GAT"), "abbreviations"][[1]], "gati"))
antibiotics[which(antibiotics$ab == "GEH"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "GEH"), "abbreviations"][[1]], "gehl"))
antibiotics[which(antibiotics$ab == "GEN"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "GEN"), "abbreviations"][[1]], "gent"))
antibiotics[which(antibiotics$ab == "GRX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "GRX"), "abbreviations"][[1]], "grep"))
antibiotics[which(antibiotics$ab == "IPM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "IPM"), "abbreviations"][[1]], "imci"))
antibiotics[which(antibiotics$ab == "IPM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "IPM"), "abbreviations"][[1]], "imip"))
antibiotics[which(antibiotics$ab == "ISV"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "ISV"), "abbreviations"][[1]], "isav"))
antibiotics[which(antibiotics$ab == "ITR"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "ITR"), "abbreviations"][[1]], "itra"))
antibiotics[which(antibiotics$ab == "KAH"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "KAH"), "abbreviations"][[1]], "kahl"))
antibiotics[which(antibiotics$ab == "KAN"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "KAN"), "abbreviations"][[1]], "kana"))
antibiotics[which(antibiotics$ab == "KET"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "KET"), "abbreviations"][[1]], "keto"))
antibiotics[which(antibiotics$ab == "LVX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "LVX"), "abbreviations"][[1]], "levo"))
antibiotics[which(antibiotics$ab == "LIN"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "LIN"), "abbreviations"][[1]], "linc"))
antibiotics[which(antibiotics$ab == "LNZ"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "LNZ"), "abbreviations"][[1]], "line"))
antibiotics[which(antibiotics$ab == "LOR"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "LOR"), "abbreviations"][[1]], "lora"))
antibiotics[which(antibiotics$ab == "MEM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "MEM"), "abbreviations"][[1]], "mero"))
antibiotics[which(antibiotics$ab == "MET"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "MET"), "abbreviations"][[1]], "meti"))
antibiotics[which(antibiotics$ab == "MTR"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "MTR"), "abbreviations"][[1]], "metr"))
antibiotics[which(antibiotics$ab == "MEZ"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "MEZ"), "abbreviations"][[1]], "mezl"))
antibiotics[which(antibiotics$ab == "MIF"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "MIF"), "abbreviations"][[1]], "mica"))
antibiotics[which(antibiotics$ab == "MCZ"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "MCZ"), "abbreviations"][[1]], "mico"))
antibiotics[which(antibiotics$ab == "MNO"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "MNO"), "abbreviations"][[1]], "mino"))
antibiotics[which(antibiotics$ab == "LTM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "LTM"), "abbreviations"][[1]], "moxa", "moxalactam"))
antibiotics[which(antibiotics$ab == "MFX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "MFX"), "abbreviations"][[1]], "moxi"))
antibiotics[which(antibiotics$ab == "NAL"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "NAL"), "abbreviations"][[1]], "nali"))
antibiotics[which(antibiotics$ab == "NEO"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "NEO"), "abbreviations"][[1]], "neom"))
antibiotics[which(antibiotics$ab == "NET"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "NET"), "abbreviations"][[1]], "neti"))
antibiotics[which(antibiotics$ab == "NIT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "NIT"), "abbreviations"][[1]], "nitr"))
antibiotics[which(antibiotics$ab == "NOR"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "NOR"), "abbreviations"][[1]], "norf"))
antibiotics[which(antibiotics$ab == "NYS"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "NYS"), "abbreviations"][[1]], "nyst"))
antibiotics[which(antibiotics$ab == "OFX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "OFX"), "abbreviations"][[1]], "oflo"))
antibiotics[which(antibiotics$ab == "OXA"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "OXA"), "abbreviations"][[1]], "oxal"))
antibiotics[which(antibiotics$ab == "PEF"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PEF"), "abbreviations"][[1]], "pefl"))
antibiotics[which(antibiotics$ab == "PEN"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PEN"), "abbreviations"][[1]], "peni"))
antibiotics[which(antibiotics$ab == "PIP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PIP"), "abbreviations"][[1]], "pipc"))
antibiotics[which(antibiotics$ab == "PPA"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PPA"), "abbreviations"][[1]], "pipz"))
antibiotics[which(antibiotics$ab == "TZP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TZP"), "abbreviations"][[1]], "pita"))
antibiotics[which(antibiotics$ab == "PLB"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PLB"), "abbreviations"][[1]], "polb"))
antibiotics[which(antibiotics$ab == "POS"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "POS"), "abbreviations"][[1]], "posa"))
antibiotics[which(antibiotics$ab == "PRI"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PRI"), "abbreviations"][[1]], "pris"))
antibiotics[which(antibiotics$ab == "QDA"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "QDA"), "abbreviations"][[1]], "quda"))
antibiotics[which(antibiotics$ab == "RIF"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "RIF"), "abbreviations"][[1]], "rifa"))
antibiotics[which(antibiotics$ab == "RXT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "RXT"), "abbreviations"][[1]], "roxi"))
antibiotics[which(antibiotics$ab == "SMX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SMX"), "abbreviations"][[1]], "sfmx"))
antibiotics[which(antibiotics$ab == "SLF4"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SLF4"), "abbreviations"][[1]], "sfmz"))
antibiotics[which(antibiotics$ab == "SSS"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SSS"), "abbreviations"][[1]], "sfna"))
antibiotics[which(antibiotics$ab == "SLF"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SLF"), "abbreviations"][[1]], "sfsz"))
antibiotics[which(antibiotics$ab == "SPX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SPX"), "abbreviations"][[1]], "spar"))
antibiotics[which(antibiotics$ab == "SPT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SPT"), "abbreviations"][[1]], "spec"))
antibiotics[which(antibiotics$ab == "SPI"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SPI"), "abbreviations"][[1]], "spir"))
antibiotics[which(antibiotics$ab == "STH"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "STH"), "abbreviations"][[1]], "sthl"))
antibiotics[which(antibiotics$ab == "STR1"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "STR1"), "abbreviations"][[1]], "stre"))
antibiotics[which(antibiotics$ab == "TAZ"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TAZ"), "abbreviations"][[1]], "tazo"))
antibiotics[which(antibiotics$ab == "TEC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TEC"), "abbreviations"][[1]], "teic"))
antibiotics[which(antibiotics$ab == "TLT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TLT"), "abbreviations"][[1]], "teli"))
antibiotics[which(antibiotics$ab == "TMX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TMX"), "abbreviations"][[1]], "tema"))
antibiotics[which(antibiotics$ab == "TEM"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TEM"), "abbreviations"][[1]], "temo"))
antibiotics[which(antibiotics$ab == "TRB"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TRB"), "abbreviations"][[1]], "terb"))
antibiotics[which(antibiotics$ab == "TCY"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TCY"), "abbreviations"][[1]], "tetr"))
antibiotics[which(antibiotics$ab == "TIC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TIC"), "abbreviations"][[1]], "tica"))
antibiotics[which(antibiotics$ab == "TCC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TCC"), "abbreviations"][[1]], "ticl"))
antibiotics[which(antibiotics$ab == "TGC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TGC"), "abbreviations"][[1]], "tige"))
antibiotics[which(antibiotics$ab == "TIN"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TIN"), "abbreviations"][[1]], "tini"))
antibiotics[which(antibiotics$ab == "TOB"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TOB"), "abbreviations"][[1]], "tobr"))
antibiotics[which(antibiotics$ab == "TOH"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TOH"), "abbreviations"][[1]], "tohl"))
antibiotics[which(antibiotics$ab == "TMP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TMP"), "abbreviations"][[1]], "trim"))
antibiotics[which(antibiotics$ab == "TVA"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "TVA"), "abbreviations"][[1]], "trov"))
antibiotics[which(antibiotics$ab == "SLT4"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SLT4"), "abbreviations"][[1]], "trsm"))
antibiotics[which(antibiotics$ab == "SXT"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "SXT"), "abbreviations"][[1]], "trsx"))
antibiotics[which(antibiotics$ab == "VAN"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "VAN"), "abbreviations"][[1]], "vanc"))
antibiotics[which(antibiotics$ab == "VOR"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "VOR"), "abbreviations"][[1]], "vori"))
antibiotics[which(antibiotics$ab == "FOS"), "synonyms"][[1]] <- list(sort(c(antibiotics[which(antibiotics$ab == "FOS"), "synonyms"][[1]], "Monuril")))
antibiotics[which(antibiotics$ab == "FOS"), "synonyms"][[1]] <- list(sort(c(antibiotics[which(antibiotics$ab == "FOS"), "synonyms"][[1]], "Monurol")))
antibiotics[which(antibiotics$ab == "TZP"), "abbreviations"][[1]] <- list(sort(c(antibiotics[which(antibiotics$ab == "TZP"), "abbreviations"][[1]], "piptazo")))
antibiotics[which(antibiotics$ab == "RFP"), "abbreviations"][[1]] <- list(sort(c(antibiotics[which(antibiotics$ab == "RFP"), "abbreviations"][[1]], "RPT")))
antibiotics[which(antibiotics$ab == "RTP"), "abbreviations"][[1]] <- list(sort(c(antibiotics[which(antibiotics$ab == "RTP"), "abbreviations"][[1]], "RET")))
antibiotics[which(antibiotics$ab == "TYL1"), "abbreviations"][[1]] <- list(sort(c(antibiotics[which(antibiotics$ab == "TYL1"), "abbreviations"][[1]], "TVN")))
antibiotics <- antibiotics %>%
mutate(ab = as.character(ab)) %>%
rbind(antibiotics %>%
filter(ab == "GEH") %>%
mutate(
ab = "AMH",
name = "Amphotericin B-high",
abbreviations = list(c("amhl", "amfo b high", "ampho b high", "amphotericin high"))
)) %>%
rbind(antibiotics %>%
filter(ab == "GEH") %>%
mutate(
ab = "TOH",
name = "Tobramycin-high",
abbreviations = list(c("tohl", "tobra high", "tobramycin high"))
)) %>%
rbind(antibiotics %>%
filter(ab == "BUT") %>%
mutate(
ab = "CIX",
atc = "D01AE14",
name = "Ciclopirox",
group = "Antifungals/antimycotics",
atc_group1 = "Antifungals for topical use",
atc_group2 = "Other antifungals for topical use",
abbreviations = list(c("cipx"))
))
antibiotics[which(antibiotics$ab == "SSS"), "name"] <- "Sulfonamide"
# ESBL E-test codes:
antibiotics[which(antibiotics$ab == "CCV"), "abbreviations"][[1]] <- list(c("xtzl"))
antibiotics[which(antibiotics$ab == "CAZ"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CAZ"), "abbreviations"][[1]], "xtz", "cefta"))
antibiotics[which(antibiotics$ab == "CPC"), "abbreviations"][[1]] <- list(c("xpml"))
antibiotics[which(antibiotics$ab == "FEP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FEP"), "abbreviations"][[1]], "xpm"))
antibiotics[which(antibiotics$ab == "CTC"), "abbreviations"][[1]] <- list(c("xctl"))
antibiotics[which(antibiotics$ab == "CTX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CTX"), "abbreviations"][[1]], "xct"))
# High level Gentamcin and Streptomycin
antibiotics[which(antibiotics$ab == "GEH"), "abbreviations"][[1]] <- list(c("gehl", "gentamicin high", "genta high", "gehi"))
antibiotics[which(antibiotics$ab == "STH"), "abbreviations"][[1]] <- list(c("sthl", "streptomycin high", "strepto high", "sthi"))
# add imi and "imipenem/cilastatine" to imipenem
antibiotics[which(antibiotics$ab == "IPM"), "abbreviations"][[1]] <- list(c("imip", "imi", "imp"))
antibiotics[which(antibiotics$ab == "IPM"), "synonyms"][[1]] <- list(sort(c(antibiotics[which(antibiotics$ab == "IPM"), "synonyms"][[1]], "imipenem/cilastatin")))
# add synonyms of ones not found
antibiotics[which(antibiotics$ab == "TZP"), "synonyms"][[1]] <- list(sort(c(antibiotics[which(antibiotics$ab == "TZP"), "synonyms"][[1]], "Tazocel", "tazocillin", "Tazocin", "Zosyn")))
antibiotics[which(antibiotics$ab == "COL"), "synonyms"][[1]] <- list(sort(unique(c(antibiotics[which(antibiotics$ab == "COL"), "synonyms"][[1]], "Colisticin", "Polymyxin E", "Colimycin", "Coly-Mycin", "Totazina", "Colistimethate", "Promixin", "Colistimethate Sodium"))))
# remove incorrect synonyms from rifampicin (RIF) and add them to the combination rifampicin/isoniazid (RFI)
old_sym <- antibiotics[which(antibiotics$ab == "RIF"), "synonyms"][[1]]
old_sym <- old_sym[!old_sym %in% c("Rifinah", "Rimactazid")]
antibiotics[which(antibiotics$ab == "RIF"), "synonyms"][[1]] <- list(old_sym)
antibiotics[which(antibiotics$ab == "RFI"), "synonyms"][[1]] <- list(sort(c("Rifinah", "Rimactazid")))
# remove incorrect synonyms from sulfamethoxazole (SMX) and add them to the combination trimethoprim/sulfamethoxazole (SXT)
old_sym <- antibiotics[which(antibiotics$ab == "SMX"), "synonyms"][[1]]
old_sym <- old_sym[!old_sym %in% c("Cotrimoxazole", "Bactrimel")]
antibiotics[which(antibiotics$ab == "SMX"), "synonyms"][[1]] <- list(old_sym)
antibiotics[which(antibiotics$ab == "SXT"), "synonyms"][[1]] <- list(sort(unique(c(antibiotics[which(antibiotics$ab == "COL"), "synonyms"][[1]], "Cotrimoxazole", "Bactrimel", "Septra", "Bactrim", "Cotrimazole"))))
# Fix penicillins
antibiotics[which(antibiotics$ab == "PEN"), "abbreviations"][[1]] <- list(c("bepe", "pg", "pen", "peni", "peni g", "penicillin", "penicillin g"))
antibiotics[which(antibiotics$ab == "PEN"), "name"] <- "Benzylpenicillin"
antibiotics[which(antibiotics$ab == "PHN"), "abbreviations"][[1]] <- list(c("fepe", "peni v", "pv", "penicillin v", "PNV"))
antibiotics <- subset(antibiotics, antibiotics$ab != "PNV")
# New DDDs
antibiotics[which(antibiotics$ab == "PEN"), "iv_ddd"] <- 3.6
antibiotics[which(antibiotics$ab == "PEN"), "iv_units"] <- "g"
## new ATC codes
# ceftaroline
antibiotics[which(antibiotics$ab == "CPT"), "atc"] <- "J01DI02"
# faropenem
antibiotics[which(antibiotics$ab == "FAR"), "atc"] <- "J01DI03"
# ceftobiprole
antibiotics[which(antibiotics$ab == "BPR"), "atc"] <- "J01DI01"
# ceftazidime / avibactam
antibiotics[which(antibiotics$ab == "CZA"), "atc"] <- "J01DD52"
antibiotics[which(antibiotics$ab == "CZA"), "cid"] <- 90643431
antibiotics[which(antibiotics$ab == "CZA"), "atc_group1"] <- "Other beta-lactam antibacterials"
antibiotics[which(antibiotics$ab == "CZA"), "atc_group2"] <- "Third-generation cephalosporins"
antibiotics[which(antibiotics$ab == "CZA"), "iv_ddd"] <- 6
antibiotics[which(antibiotics$ab == "CZA"), "iv_units"] <- "g"
antibiotics[which(antibiotics$ab == "CZA"), "synonyms"] <- list(c("Avycaz", "Zavicefta"))
# typo
antibiotics[which(antibiotics$ab == "RXT"), "name"] <- "Roxithromycin"
antibiotics[which(antibiotics$ab == "PEN"), "atc"] <- "J01CE01"
# WHONET cleanup
antibiotics[which(antibiotics$ab == "BCZ"), "name"] <- "Bicyclomycin"
antibiotics[which(antibiotics$ab == "CCL"), "name"] <- "Cefetecol"
antibiotics[which(antibiotics$ab == "ENV"), "name"] <- "Enviomycin"
antibiotics[which(antibiotics$ab == "KIT"), "name"] <- "Kitasamycin"
antibiotics[which(antibiotics$ab == "LSP"), "name"] <- "Linco-spectin"
antibiotics[which(antibiotics$ab == "MEC"), "name"] <- "Mecillinam"
antibiotics[which(antibiotics$ab == "PMR"), "name"] <- "Pimaricin"
antibiotics[which(antibiotics$ab == "BCZ"), "abbreviations"][[1]] <- list(sort(unique(c(antibiotics[which(antibiotics$ab == "BCZ"), "abbreviations"][[1]], "Bicozamycin"))))
antibiotics[which(antibiotics$ab == "CCL"), "abbreviations"][[1]] <- list(sort(unique(c(antibiotics[which(antibiotics$ab == "CCL"), "abbreviations"][[1]], "Cefcatacol"))))
antibiotics[which(antibiotics$ab == "ENV"), "abbreviations"][[1]] <- list(sort(unique(c(antibiotics[which(antibiotics$ab == "ENV"), "abbreviations"][[1]], "Tuberactinomycin"))))
antibiotics[which(antibiotics$ab == "KIT"), "abbreviations"][[1]] <- list(sort(unique(c(antibiotics[which(antibiotics$ab == "KIT"), "abbreviations"][[1]], "Leucomycin"))))
antibiotics[which(antibiotics$ab == "LSP"), "abbreviations"][[1]] <- list(sort(unique(c(antibiotics[which(antibiotics$ab == "LSP"), "abbreviations"][[1]], "lincomycin/spectinomycin"))))
antibiotics[which(antibiotics$ab == "MEC"), "abbreviations"][[1]] <- list(sort(unique(c(antibiotics[which(antibiotics$ab == "MEC"), "abbreviations"][[1]], "Amdinocillin"))))
antibiotics[which(antibiotics$ab == "PMR"), "abbreviations"][[1]] <- list(sort(unique(c(antibiotics[which(antibiotics$ab == "PMR"), "abbreviations"][[1]], "Natamycin"))))
# set cephalosporins groups for the ones that could not be determined automatically:
antibiotics <- antibiotics %>%
mutate(group = case_when(
name == "Cefcapene" ~ "Cephalosporins (3rd gen.)",
name == "Cefcapene pivoxil" ~ "Cephalosporins (3rd gen.)",
name == "Cefditoren pivoxil" ~ "Cephalosporins (3rd gen.)",
name == "Cefepime/clavulanic acid" ~ "Cephalosporins (4th gen.)",
name == "Cefepime/tazobactam" ~ "Cephalosporins (4th gen.)",
name == "Cefetamet pivoxil" ~ "Cephalosporins (3rd gen.)",
name == "Cefetecol (Cefcatacol)" ~ "Cephalosporins (4th gen.)",
name == "Cefetrizole" ~ "Cephalosporins (unclassified gen.)",
name == "Cefoselis" ~ "Cephalosporins (4th gen.)",
name == "Cefotaxime/clavulanic acid" ~ "Cephalosporins (3rd gen.)",
name == "Cefotaxime/sulbactam" ~ "Cephalosporins (3rd gen.)",
name == "Cefotiam hexetil" ~ "Cephalosporins (3rd gen.)",
name == "Cefovecin" ~ "Cephalosporins (3rd gen.)",
name == "Cefozopran" ~ "Cephalosporins (4th gen.)",
name == "Cefpimizole" ~ "Cephalosporins (3rd gen.)",
name == "Cefpodoxime proxetil" ~ "Cephalosporins (3rd gen.)",
name == "Cefpodoxime/clavulanic acid" ~ "Cephalosporins (3rd gen.)",
name == "Cefquinome" ~ "Cephalosporins (4th gen.)",
name == "Cefsumide" ~ "Cephalosporins (unclassified gen.)",
name == "Ceftaroline" ~ "Cephalosporins (5th gen.)",
name == "Ceftaroline/avibactam" ~ "Cephalosporins (5th gen.)",
name == "Ceftazidime/avibactam" ~ "Cephalosporins (3rd gen.)",
name == "Cefteram" ~ "Cephalosporins (3rd gen.)",
name == "Cefteram pivoxil" ~ "Cephalosporins (3rd gen.)",
name == "Ceftiofur" ~ "Cephalosporins (3rd gen.)",
name == "Ceftizoxime alapivoxil" ~ "Cephalosporins (3rd gen.)",
name == "Ceftobiprole" ~ "Cephalosporins (5th gen.)",
name == "Ceftobiprole medocaril" ~ "Cephalosporins (5th gen.)",
name == "Ceftolozane/enzyme inhibitor" ~ "Cephalosporins (5th gen.)",
name == "Ceftolozane/tazobactam" ~ "Cephalosporins (5th gen.)",
name == "Cefuroxime axetil" ~ "Cephalosporins (2nd gen.)",
TRUE ~ group
))
antibiotics[which(antibiotics$ab %in% c("CYC", "LNZ", "THA", "TZD")), "group"] <- "Oxazolidinones"
# add efflux
effl <- antibiotics |>
filter(ab == "ACM") |>
mutate(ab = as.character("EFF"),
cid = NA_real_,
name = "Efflux",
group = "Other")
antibiotics <- antibiotics |>
mutate(ab = as.character(ab)) |>
bind_rows(effl)
class(antibiotics$ab) <- c("ab", "character")
antibiotics[which(antibiotics$ab == "EFF"), "abbreviations"][[1]] <- list(c("effflux pump"))
# add clindamycin inducible screening
clin <- antibiotics |>
filter(ab == "FOX1") |>
mutate(ab = as.character("CLI1"),
name = "Clindamycin inducible screening",
group = "Macrolides/lincosamides")
antibiotics <- antibiotics |>
mutate(ab = as.character(ab)) |>
bind_rows(clin)
class(antibiotics$ab) <- c("ab", "character")
antibiotics[which(antibiotics$ab == "CLI1"), "abbreviations"][[1]] <- list(c("clindamycin inducible", "clinda inducible", "clin inducible"))
# add pretomanid
antibiotics <- antibiotics %>%
mutate(ab = as.character(ab)) %>%
bind_rows(antibiotics %>%
mutate(ab = as.character(ab)) %>%
filter(ab == "SMF") %>%
mutate(
ab = "PMD",
atc = "J04AK08",
cid = 456199,
name = "Pretomanid",
abbreviations = list(""),
oral_ddd = NA_real_
))
# update ATC codes from WHOCC website -------------------------------------
# last time checked: 2024-02-22
library(rvest)
updated_atc <- as.list(antibiotics$atc)
get_atcs <- function(ab_name, type = "human") {
if (type == "human") {
url <- "https://atcddd.fhi.no/atc_ddd_index/"
} else if (type == "veterinary") {
url <- "https://atcddd.fhi.no/atcvet/atcvet_index/"
} else {
stop("invalid type")
}
ab_name <- gsub("/", " and ", tolower(ab_name), fixed = TRUE)
# we will do a search on their website, which means:
# go to the url
atc_tbl <- read_html(url) %>%
# get all forms
html_form() %>%
# get the second form (the first form is a global website form)
.[[2]] %>%
# set the name input box to our search parameter
html_form_set(name = ab_name) %>%
# hit Submit
html_form_submit() %>%
# read the resulting page
read_html() %>%
# retrieve the table on it
html_node("table") %>%
# transform it to an R data set
html_table(header = FALSE)
# and get the ATCs (first column) of only exact hits
unique(as.character(atc_tbl[which(tolower(atc_tbl[, 2, drop = TRUE]) == ab_name), 1, drop = TRUE]))
}
# this takes around 4 minutes (some are skipped and go faster)
for (i in seq_len(nrow(antibiotics))) {
message(percentage(i / nrow(antibiotics), digits = 1),
" - Downloading ", antibiotics$name[i],
appendLF = FALSE
)
atcs <- get_atcs(antibiotics$name[i], type = "human")
if (all(is.na(atcs))) {
atcs <- get_atcs(antibiotics$name[i], type = "veterinary")
}
if (length(atcs) > 0) {
updated_atc[[i]] <- atcs
message(" (", length(atcs), " results)")
# let the WHO server rest for a second - they might have a limitation on the queries per second
Sys.sleep(1)
} else {
message(" (skipping)")
}
}
antibiotics$atc <- updated_atc
# update DDDs from WHOCC website ------------------------------------------
# last time checked: 2024-02-22
ddd_oral <- rep(NA_real_, nrow(antibiotics))
ddd_oral_units <- rep(NA_character_, nrow(antibiotics))
ddd_iv <- rep(NA_real_, nrow(antibiotics))
ddd_iv_units <- rep(NA_character_, nrow(antibiotics))
progress <- progress_ticker(nrow(antibiotics))
for (i in seq_len(nrow(antibiotics))) {
on.exit(close(progress))
progress$tick()
atcs <- antibiotics$atc[[i]]
if (!all(is.na(atcs))) {
for (j in seq_len(length(atcs))) {
# oral
if (is.na(ddd_oral[i])) {
ddd_oral[i] <- atc_online_ddd(atcs[j], administration = "O")
if (!is.na(ddd_oral[i])) {
ddd_oral_units[i] <- atc_online_ddd_units(atcs[j], administration = "O")
}
}
# parenteral
if (is.na(ddd_iv[i])) {
ddd_iv[i] <- atc_online_ddd(atcs[j], administration = "P")
if (!is.na(ddd_iv[i])) {
ddd_iv_units[i] <- atc_online_ddd_units(atcs[j], administration = "P")
}
}
}
}
if (!is.na(ddd_oral[i]) | !is.na(ddd_iv[i])) {
# let the WHO server rest for 0.25 second - they might have a limitation on the queries per second
Sys.sleep(0.25)
}
}
antibiotics$oral_ddd <- ddd_oral
antibiotics$oral_units <- ddd_oral_units
antibiotics$iv_ddd <- ddd_iv
antibiotics$iv_units <- ddd_iv_units
# Wrap up -----------------------------------------------------------------
# set as data.frame again
antibiotics <- dataset_UTF8_to_ASCII(as.data.frame(antibiotics, stringsAsFactors = FALSE))
class(antibiotics$ab) <- c("ab", "character")
antibiotics <- dplyr::arrange(antibiotics, name)
# REFER TO data-raw/loinc.R FOR ADDING LOINC CODES
# make all abbreviations and synonyms lower case, unique and alphabetically sorted ----
for (i in 1:nrow(antibiotics)) {
abb <- as.character(sort(unique(tolower(antibiotics[i, "abbreviations", drop = TRUE][[1]]))))
abb <- abb[abb != "" & abb %unlike% ":"]
syn <- as.character(sort(unique(tolower(unname(unlist(antibiotics[i, "synonyms", drop = TRUE]))))))
syn <- gsub("[^a-z]", "", syn)
syn <- gsub(" +", " ", syn)
pharm_terms <- "(pa?ediatric|injection|oral|inhale|otic|sulfate|sulphate|sodium|base|anhydrous|anhydrate|stearate|syrup|natrium|hydrate|x?hcl|gsalt|vet[.]?)"
syn <- gsub(paste0(" ", pharm_terms, "$"), "", syn)
syn <- gsub(paste0("^", pharm_terms, " "), "", syn)
syn <- trimws(syn)
syn <- gsub(" [a-z]{1,3}$", "", syn, perl = TRUE)
syn <- trimws(syn)
syn <- syn[syn != "" & syn %unlike% ":" & !syn %in% tolower(antibiotics$name)]
syn <- unique(syn)
# special cases
if (antibiotics$ab[i] == "VAN") syn <- syn[syn %unlike% "^tei?ch?o"]
if (antibiotics$ab[i] == "CLR") syn <- syn[syn %unlike% "^ery"]
antibiotics[i, "abbreviations"][[1]] <- ifelse(length(abb) == 0, list(""), list(abb))
antibiotics[i, "synonyms"][[1]] <- ifelse(length(syn) == 0, list(""), list(syn))
if ("loinc" %in% colnames(antibiotics)) {
loinc <- as.character(sort(unique(tolower(antibiotics[i, "loinc", drop = TRUE][[1]]))))
loinc <- loinc[loinc != ""]
antibiotics[i, "loinc"][[1]] <- ifelse(length(loinc) == 0, list(""), list(loinc))
}
}
usethis::use_data(antibiotics, overwrite = TRUE, version = 2, compress = "xz")
rm(antibiotics)
+948
View File
@@ -0,0 +1,948 @@
# ==================================================================== #
# TITLE: #
# AMR: An R Package for Working with Antimicrobial Resistance Data #
# #
# SOURCE CODE: #
# https://github.com/msberends/AMR #
# #
# PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 #
# #
# Developed at the University of Groningen and the University Medical #
# Center Groningen in The Netherlands, in collaboration with many #
# colleagues from around the world, see our website. #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# We created this package for both routine data analysis and academic #
# research and it was publicly released in the hope that it will be #
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
# #
# Visit our website for the full manual and a complete tutorial about #
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
library(dplyr)
# got EARS-Net codes (= ECDC/WHO codes) from here:
# Installed WHONET 2019 software on Windows (http://www.whonet.org/software.html),
# opened C:\WHONET\Codes\WHONETCodes.mdb in MS Access
# and exported table 'DRGLST' to MS Excel
library(readxl)
DRGLST <- read_excel("DRGLST.xlsx")
abx <- DRGLST %>%
select(
ab = WHON5_CODE,
name = ANTIBIOTIC
) %>%
# remove the ones without WHONET code
filter(!is.na(ab)) %>%
distinct(name, .keep_all = TRUE) %>%
# add the ones without WHONET code
bind_rows(
DRGLST %>%
select(
ab = WHON5_CODE,
name = ANTIBIOTIC
) %>%
filter(is.na(ab)) %>%
distinct(name, .keep_all = TRUE)
# add new ab code later
) %>%
arrange(name)
# add old ATC codes
ab_old <- AMR::antimicrobials %>%
mutate(
official = gsub("( and |, )", "/", official),
abbr = tolower(paste(ifelse(is.na(abbr), "", abbr),
ifelse(is.na(certe), "", certe),
ifelse(is.na(umcg), "", umcg),
sep = "|"
))
)
for (i in 1:nrow(ab_old)) {
abbr <- ab_old[i, "abbr"]
abbr <- strsplit(abbr, "|", fixed = TRUE) %>%
unlist() %>%
unique()
abbr <- abbr[abbr != ""]
# print(abbr)
if (length(abbr) == 0) {
ab_old[i, "abbr"] <- NA_character_
} else {
ab_old[i, "abbr"] <- paste(abbr, collapse = "|")
}
}
# create reference data set: to be able to map ab to atc
abx_atc1 <- abx %>%
mutate(name_lower = tolower(name)) %>%
left_join(ab_old %>%
select(ears_net, atc), by = c(ab = "ears_net")) %>%
rename(atc1 = atc) %>%
left_join(ab_old %>%
mutate(official = gsub(", combinations", "", official, fixed = TRUE)) %>%
transmute(official = tolower(official), atc), by = c(name_lower = "official")) %>%
rename(atc2 = atc) %>%
left_join(ab_old %>%
mutate(official = gsub(", combinations", "", official, fixed = TRUE)) %>%
mutate(official = gsub("f", "ph", official)) %>%
transmute(official = tolower(official), atc), by = c(name_lower = "official")) %>%
rename(atc3 = atc) %>%
left_join(ab_old %>%
mutate(official = gsub(", combinations", "", official, fixed = TRUE)) %>%
mutate(official = gsub("t", "th", official)) %>%
transmute(official = tolower(official), atc), by = c(name_lower = "official")) %>%
rename(atc4 = atc) %>%
left_join(ab_old %>%
mutate(official = gsub(", combinations", "", official, fixed = TRUE)) %>%
mutate(official = gsub("f", "ph", official)) %>%
mutate(official = gsub("t", "th", official)) %>%
transmute(official = tolower(official), atc), by = c(name_lower = "official")) %>%
rename(atc5 = atc) %>%
left_join(ab_old %>%
mutate(official = gsub(", combinations", "", official, fixed = TRUE)) %>%
mutate(official = gsub("f", "ph", official)) %>%
mutate(official = gsub("t", "th", official)) %>%
mutate(official = gsub("ine$", "in", official)) %>%
transmute(official = tolower(official), atc), by = c(name_lower = "official")) %>%
rename(atc6 = atc) %>%
mutate(atc = case_when(
!is.na(atc1) ~ atc1,
!is.na(atc2) ~ atc2,
!is.na(atc3) ~ atc3,
!is.na(atc4) ~ atc4,
!is.na(atc4) ~ atc5,
TRUE ~ atc6
)) %>%
distinct(ab, name, .keep_all = TRUE) %>%
select(ab, atc, name)
abx_atc2 <- ab_old %>%
filter(
!atc %in% abx_atc1$atc,
is.na(ears_net),
!is.na(atc_group1),
atc_group1 %unlike% ("virus|vaccin|viral|immun"),
official %unlike% "(combinations| with )"
) %>%
mutate(ab = NA_character_) %>%
as.data.frame(stringsAsFactors = FALSE) %>%
select(ab, atc, name = official)
abx2 <- bind_rows(abx_atc1, abx_atc2)
rm(abx_atc1)
rm(abx_atc2)
abx2$ab[is.na(abx2$ab)] <- toupper(abbreviate(
gsub(
"[/0-9-]",
" ",
abx2$name[is.na(abx2$ab)]
),
minlength = 3,
method = "left.kept",
strict = TRUE
))
n_distinct(abx2$ab)
abx2 <- abx2 %>% arrange(ab)
seqnr <- 0
# add follow up nrs
for (i in 2:nrow(abx2)) {
if (abx2[i, "ab", drop = TRUE] == abx2[i - 1, "ab", drop = TRUE]) {
seqnr <- seqnr + 1
abx2[i, "seqnr"] <- seqnr
} else {
seqnr <- 0
}
}
for (i in 2:nrow(abx2)) {
if (!is.na(abx2[i, "seqnr"])) {
abx2[i, "ab"] <- paste0(abx2[i, "ab", drop = TRUE], abx2[i, "seqnr", drop = TRUE])
}
}
abx2 <- abx2 %>%
select(-seqnr) %>%
arrange(name)
# everything unique??
nrow(abx2) == n_distinct(abx2$ab)
# get ATC properties
abx2 <- abx2 %>%
left_join(ab_old %>%
select(
atc, abbr, atc_group1, atc_group2,
oral_ddd, oral_units, iv_ddd, iv_units
))
abx2$abbr <- lapply(as.list(abx2$abbr), function(x) unlist(strsplit(x, "|", fixed = TRUE)))
# Update Compound IDs and Synonyms ----
# vector with official names, returns vector with CIDs
get_CID <- function(ab) {
CID <- rep(NA_integer_, length(ab))
p <- AMR:::progress_ticker(n = length(ab), min_time = 0)
for (i in 1:length(ab)) {
p$tick()
CID[i] <- tryCatch(
data.table::fread(
paste0(
"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/",
URLencode(ab[i], reserved = TRUE),
"/cids/TXT?name_type=complete"
),
showProgress = FALSE
)[[1]][1],
error = function(e) NA_integer_
)
if (is.na(CID[i])) {
# try with removing the text in brackets
CID[i] <- tryCatch(
data.table::fread(
paste0(
"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/",
URLencode(trimws(gsub("[(].*[)]", "", ab[i])), reserved = TRUE),
"/cids/TXT?name_type=complete"
),
showProgress = FALSE
)[[1]][1],
error = function(e) NA_integer_
)
}
if (is.na(CID[i])) {
# try match on word and take the lowest CID value (sorted)
ab[i] <- gsub("[^a-z0-9]+", " ", ab[i], ignore.case = TRUE)
CID[i] <- tryCatch(
data.table::fread(
paste0(
"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/",
URLencode(ab[i], reserved = TRUE),
"/cids/TXT?name_type=word"
),
showProgress = FALSE
)[[1]][1],
error = function(e) NA_integer_
)
}
Sys.sleep(0.1)
}
CID
}
# get CIDs (4-5 min)
CIDs <- get_CID(antimicrobials$name)
# take missing from previously found CIDs
CIDs[is.na(CIDs) & !is.na(antimicrobials$cid)] <- antimicrobials$cid[is.na(CIDs) & !is.na(antimicrobials$cid)]
# These could not be found:
antimicrobials[is.na(CIDs), ] %>% View()
# returns list with synonyms (brand names), with CIDs as names
get_synonyms <- function(CID, clean = TRUE) {
synonyms <- rep(NA_character_, length(CID))
p <- AMR:::progress_ticker(n = length(CID), min_time = 0)
for (i in 1:length(CID)) {
p$tick()
synonyms_txt <- ""
if (is.na(CID[i])) {
next
}
# we will now get the closest compounds with a 96% threshold
similar_cids <- tryCatch(
data.table::fread(
paste0(
"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/fastsimilarity_2d/cid/",
CID[i],
"/cids/TXT?Threshold=96&MaxRecords=5"
),
sep = "\n",
showProgress = FALSE
)[[1]],
error = function(e) NA_character_
)
# include the current CID of course
all_cids <- unique(c(CID[i], similar_cids))
# but leave out all CIDs that we have in our antimicrobials dataset to prevent duplication
all_cids <- all_cids[!all_cids %in% antimicrobials$cid[!is.na(antimicrobials$cid)]]
# for each one, we are getting the synonyms
current_syns <- character(0)
for (j in seq_len(length(all_cids))) {
synonyms_txt <- tryCatch(
data.table::fread(
paste0(
"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/fastidentity/cid/",
all_cids[j],
"/synonyms/TXT"
),
sep = "\n",
showProgress = FALSE
)[[1]],
error = function(e) NA_character_
)
Sys.sleep(0.05)
if (clean == TRUE) {
# remove text between brackets
synonyms_txt <- trimws(gsub(
"[(].*[)]", "",
gsub(
"[[].*[]]", "",
gsub(
"[(].*[]]", "",
gsub("[[].*[)]", "", synonyms_txt)
)
)
))
synonyms_txt <- gsub("Co-", "Co", synonyms_txt, fixed = TRUE)
synonyms_txt <- gsub(" ?(mono)?sodium ?", "", ignore.case = TRUE, synonyms_txt)
synonyms_txt <- gsub(" ?(injection|pediatric) ?", "", ignore.case = TRUE, synonyms_txt)
# only length 6 to 20 and no txt with reading marks or numbers and must start with capital letter (= brand)
synonyms_txt <- synonyms_txt[nchar(synonyms_txt) %in% c(5:20) &
!grepl("[-&{},_0-9/:]", synonyms_txt) &
grepl("^[A-Z]", synonyms_txt, ignore.case = FALSE)]
synonyms_txt <- unlist(strsplit(synonyms_txt, ";", fixed = TRUE))
}
current_syns <- c(current_syns, synonyms_txt)
}
current_syns <- unique(trimws(current_syns[tolower(current_syns) %in% unique(tolower(current_syns))]))
synonyms[i] <- list(sort(current_syns))
}
names(synonyms) <- CID
synonyms
}
# get brand names from PubChem (3-4 min)
synonyms <- get_synonyms(CIDs)
synonyms.bak <- synonyms
synonyms <- synonyms.bak
# add existing ones (will be cleaned later)
for (i in seq_len(length(synonyms))) {
old <- unname(unlist(AMR::antimicrobials[i, "synonyms", drop = TRUE]))
synonyms[[i]] <- c(unname(synonyms[[i]]), old)
}
antimicrobials$synonyms <- synonyms
stop("remember to remove co-trimoxazole as synonyms from SMX (Sulfamethoxazole), so it only exists in SXT!")
sulfa <- antimicrobials[which(antimicrobials$ab == "SMX"), "synonyms", drop = TRUE][[1]]
cotrim <- antimicrobials[which(antimicrobials$ab == "SXT"), "synonyms", drop = TRUE][[1]]
# 2024-10-06 not the case anymore, no overlapping names: sulfa[sulfa %in% cotrim]
sulfa <- sulfa[!sulfa %in% cotrim]
antimicrobials[which(antimicrobials$ab == "SMX"), "synonyms"][[1]][[1]] <- sulfa
# now go to end of this file
# -----
# add them to data set
antimicrobials <- abx2 %>%
left_join(DRGLST %>%
select(ab = WHON5_CODE, CLASS, SUBCLASS) %>%
distinct(ab, .keep_all = TRUE), by = "ab") %>%
transmute(ab,
atc,
cid = CIDs,
# no capital after a slash: Ampicillin/Sulbactam -> Ampicillin/sulbactam
name = name %>%
gsub("([/-])([A-Z])", "\\1\\L\\2", ., perl = TRUE) %>%
gsub("edta", "EDTA", ., ignore.case = TRUE),
group = case_when(
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "am(ph|f)enicol" ~ "Amphenicols",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "aminoglycoside" ~ "Aminoglycosides",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "carbapenem" | name %like% "(imipenem|meropenem)" ~ "Carbapenems",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "First-generation cephalosporin" ~ "Cephalosporins (1st gen.)",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "Second-generation cephalosporin" ~ "Cephalosporins (2nd gen.)",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "Third-generation cephalosporin" ~ "Cephalosporins (3rd gen.)",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "Fourth-generation cephalosporin" ~ "Cephalosporins (4th gen.)",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "(tuberculosis|mycobacter)" ~ "Antimycobacterials",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "cephalosporin" ~ "Cephalosporins",
name %like% "^Ce" & is.na(atc_group1) & paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "beta-?lactam" ~ "Cephalosporins",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "(beta-?lactam|penicillin)" ~ "Beta-lactams/penicillins",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "quinolone" ~ "Quinolones",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "glycopeptide" ~ "Glycopeptides",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "macrolide" ~ "Macrolides/lincosamides",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "tetracycline" ~ "Tetracyclines",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "trimethoprim" ~ "Trimethoprims",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "polymyxin" ~ "Polymyxins",
paste(atc_group1, atc_group2, CLASS, SUBCLASS) %like% "(fungal|mycot)" ~ "Antifungals/antimycotics",
TRUE ~ "Other antibacterials"
),
atc_group1, atc_group2,
abbreviations = unname(abbr),
synonyms = unname(synonyms),
oral_ddd, oral_units,
iv_ddd, iv_units
) %>%
as.data.frame(stringsAsFactors = FALSE)
# some exceptions
antimicrobials[which(antimicrobials$ab == "DOX"), "abbreviations"][[1]] <- list(c("dox", "doxy"))
antimicrobials[which(antimicrobials$ab == "FLC"), "abbreviations"][[1]] <- list(c("clox"))
antimicrobials[which(antimicrobials$ab == "CEC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CEC"), "abbreviations"][[1]], "CFC")) # cefaclor old WHONET4 code
antimicrobials[which(antimicrobials$ab == "AMX"), "synonyms"][[1]] <- list(sort(c(antimicrobials[which(antimicrobials$ab == "AMX"), "synonyms"][[1]], "Amoxy")))
# 'Polymixin B' (POL) and 'Polymyxin B' (PLB) both exist, so:
antimicrobials[which(antimicrobials$ab == "PLB"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "PLB"), "abbreviations"][[1]], "POL", "Polymixin", "Polymixin B", "Poly B"))
antimicrobials <- filter(antimicrobials, ab != "POL")
# 'Latamoxef' (LTM) and 'Moxalactam (Latamoxef)' (MOX) both exist, so:
antimicrobials[which(antimicrobials$ab == "LTM"), "abbreviations"][[1]] <- list(c("MOX", "moxa"))
antimicrobials <- filter(antimicrobials, ab != "MOX")
# RFP and RFP1 (the J0 one) both mean 'rifapentine', although 'rifp' is not recognised, so:
antimicrobials <- filter(antimicrobials, ab != "RFP")
antimicrobials[which(antimicrobials$ab == "RFP1"), "ab"] <- "RFP"
antimicrobials[which(antimicrobials$ab == "RFP"), "abbreviations"][[1]] <- list(c("rifp"))
# Rifampicin is better known as a drug than Rifampin (Rifampin is still listed as a brand name), so:
antimicrobials[which(antimicrobials$ab == "RIF"), "name"] <- "Rifampicin"
# PME and PVM1 (the J0 one) both mean 'Pivmecillinam', so:
antimicrobials <- filter(antimicrobials, ab != "PME")
antimicrobials[which(antimicrobials$ab == "PVM1"), "ab"] <- "PME"
# Remove Sinecatechins
antimicrobials <- filter(antimicrobials, ab != "SNC")
# GLIMS codes
antimicrobials[which(antimicrobials$ab == as.ab("cefuroxim")), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == as.ab("cefuroxim")), "abbreviations"][[1]], "cfrx"))
antimicrobials[which(antimicrobials$ab == as.ab("cefotaxim")), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == as.ab("cefotaxim")), "abbreviations"][[1]], "cftx"))
antimicrobials[which(antimicrobials$ab == as.ab("ceftazidime")), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == as.ab("ceftazidime")), "abbreviations"][[1]], "cftz"))
antimicrobials[which(antimicrobials$ab == as.ab("cefepime")), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == as.ab("cefepime")), "abbreviations"][[1]], "cfpi"))
antimicrobials[which(antimicrobials$ab == as.ab("cefoxitin")), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == as.ab("cefoxitin")), "abbreviations"][[1]], "cfxt"))
# Add cefoxitin screening
class(antimicrobials$ab) <- "character"
antimicrobials <- rbind(antimicrobials, data.frame(
ab = "FOX1", atc = NA, cid = NA,
name = "Cefoxitin screening",
group = "Cephalosporins (2nd gen.)", atc_group1 = NA, atc_group2 = NA,
abbreviations = "cfsc", synonyms = NA,
oral_ddd = NA, oral_units = NA, iv_ddd = NA, iv_units = NA,
loinc = NA,
stringsAsFactors = FALSE
))
# More GLIMS codes
antimicrobials[which(antimicrobials$ab == "AMB"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "AMB"), "abbreviations"][[1]], "amf"))
antimicrobials[which(antimicrobials$ab == "CAZ"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CAZ"), "abbreviations"][[1]], "cftz"))
antimicrobials[which(antimicrobials$ab == "COL"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "COL"), "abbreviations"][[1]], "cst"))
antimicrobials[which(antimicrobials$ab == "CRO"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CRO"), "abbreviations"][[1]], "cftr"))
antimicrobials[which(antimicrobials$ab == "CTX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CTX"), "abbreviations"][[1]], "cftx"))
antimicrobials[which(antimicrobials$ab == "CXM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CXM"), "abbreviations"][[1]], "cfrx"))
antimicrobials[which(antimicrobials$ab == "CZO"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CZO"), "abbreviations"][[1]], "cfzl"))
antimicrobials[which(antimicrobials$ab == "FCT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FCT"), "abbreviations"][[1]], "fcu"))
antimicrobials[which(antimicrobials$ab == "FCT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FCT"), "abbreviations"][[1]], "fluy"))
antimicrobials[which(antimicrobials$ab == "FLU"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FLU"), "abbreviations"][[1]], "flz"))
antimicrobials[which(antimicrobials$ab == "FOS"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FOS"), "abbreviations"][[1]], "fof"))
antimicrobials[which(antimicrobials$ab == "FOX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FOX"), "abbreviations"][[1]], "cfxt"))
antimicrobials[which(antimicrobials$ab == "FUS"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FUS"), "abbreviations"][[1]], "fa"))
antimicrobials[which(antimicrobials$ab == "GEH"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "GEH"), "abbreviations"][[1]], "g_h"))
antimicrobials[which(antimicrobials$ab == "KAH"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "KAH"), "abbreviations"][[1]], "k_h"))
antimicrobials[which(antimicrobials$ab == "KET"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "KET"), "abbreviations"][[1]], "ktc"))
antimicrobials[which(antimicrobials$ab == "PIP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "PIP"), "abbreviations"][[1]], "pipc"))
antimicrobials[which(antimicrobials$ab == "PIP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "PIP"), "abbreviations"][[1]], "PIPC"))
antimicrobials[which(antimicrobials$ab == "SPX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SPX"), "abbreviations"][[1]], "spa"))
antimicrobials[which(antimicrobials$ab == "STH"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "STH"), "abbreviations"][[1]], "s_h"))
antimicrobials[which(antimicrobials$ab == "STR1"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "STR1"), "abbreviations"][[1]], "stm"))
antimicrobials[which(antimicrobials$ab == "SXT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SXT"), "abbreviations"][[1]], "COTRIM"))
antimicrobials[which(antimicrobials$ab == "SXT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SXT"), "abbreviations"][[1]], "trsx"))
antimicrobials[which(antimicrobials$ab == "TGC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TGC"), "abbreviations"][[1]], "tig"))
antimicrobials[which(antimicrobials$ab == "TMP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TMP"), "abbreviations"][[1]], "tri"))
antimicrobials[which(antimicrobials$ab == "TZP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TZP"), "abbreviations"][[1]], "PIPTAZ"))
antimicrobials[which(antimicrobials$ab == "TZP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TZP"), "abbreviations"][[1]], "pit"))
antimicrobials[which(antimicrobials$ab == "TZP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TZP"), "abbreviations"][[1]], "pita"))
antimicrobials[which(antimicrobials$ab == "VOR"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "VOR"), "abbreviations"][[1]], "vrc"))
# official RIVM codes (Dutch National Health Institute)
# https://www.rivm.nl/sites/default/files/2019-09/Bijlage_4_Lijst_antibiotica%202020%201.0.pdf
antimicrobials[which(antimicrobials$ab == "FCT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FCT"), "abbreviations"][[1]], "5flc"))
antimicrobials[which(antimicrobials$ab == "AMC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "AMC"), "abbreviations"][[1]], "amcl"))
antimicrobials[which(antimicrobials$ab == "AMB"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "AMB"), "abbreviations"][[1]], "amfb"))
antimicrobials[which(antimicrobials$ab == "AMH"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "AMH"), "abbreviations"][[1]], "amhl"))
antimicrobials[which(antimicrobials$ab == "AMK"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "AMK"), "abbreviations"][[1]], "amik"))
antimicrobials[which(antimicrobials$ab == "AMX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "AMX"), "abbreviations"][[1]], "amox"))
antimicrobials[which(antimicrobials$ab == "AMP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "AMP"), "abbreviations"][[1]], "ampi"))
antimicrobials[which(antimicrobials$ab == "SAM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SAM"), "abbreviations"][[1]], "amsu"))
antimicrobials[which(antimicrobials$ab == "ANI"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "ANI"), "abbreviations"][[1]], "anid"))
antimicrobials[which(antimicrobials$ab == "SAM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SAM"), "abbreviations"][[1]], "apsu"))
antimicrobials[which(antimicrobials$ab == "AZM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "AZM"), "abbreviations"][[1]], "azit"))
antimicrobials[which(antimicrobials$ab == "AZL"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "AZL"), "abbreviations"][[1]], "azlo"))
antimicrobials[which(antimicrobials$ab == "ATM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "ATM"), "abbreviations"][[1]], "aztr"))
antimicrobials[which(antimicrobials$ab == "PNV"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "PNV"), "abbreviations"][[1]], "bepe"))
antimicrobials[which(antimicrobials$ab == "CAP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CAP"), "abbreviations"][[1]], "capr"))
antimicrobials[which(antimicrobials$ab == "CRB"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CRB"), "abbreviations"][[1]], "carb"))
antimicrobials[which(antimicrobials$ab == "CAS"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CAS"), "abbreviations"][[1]], "casp"))
antimicrobials[which(antimicrobials$ab == "CDC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CDC"), "abbreviations"][[1]], "cecl"))
antimicrobials[which(antimicrobials$ab == "CXA"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CXA"), "abbreviations"][[1]], "cfax"))
antimicrobials[which(antimicrobials$ab == "CTB"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CTB"), "abbreviations"][[1]], "cfbu"))
antimicrobials[which(antimicrobials$ab == "CEC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CEC"), "abbreviations"][[1]], "cfcl"))
antimicrobials[which(antimicrobials$ab == "CFR"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CFR"), "abbreviations"][[1]], "cfdx"))
antimicrobials[which(antimicrobials$ab == "CEP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CEP"), "abbreviations"][[1]], "cflt"))
antimicrobials[which(antimicrobials$ab == "LEX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "LEX"), "abbreviations"][[1]], "cflx"))
antimicrobials[which(antimicrobials$ab == "MAN"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "MAN"), "abbreviations"][[1]], "cfmn"))
antimicrobials[which(antimicrobials$ab == "CPD"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CPD"), "abbreviations"][[1]], "cfpd"))
antimicrobials[which(antimicrobials$ab == "FEP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FEP"), "abbreviations"][[1]], "cfpi"))
antimicrobials[which(antimicrobials$ab == "CPO"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CPO"), "abbreviations"][[1]], "cfpr"))
antimicrobials[which(antimicrobials$ab == "CFP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CFP"), "abbreviations"][[1]], "cfpz"))
antimicrobials[which(antimicrobials$ab == "CED"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CED"), "abbreviations"][[1]], "cfrd"))
antimicrobials[which(antimicrobials$ab == "CPT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CPT"), "abbreviations"][[1]], "cfro"))
antimicrobials[which(antimicrobials$ab == "CXM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CXM"), "abbreviations"][[1]], "cfrx"))
antimicrobials[which(antimicrobials$ab == "CFS"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CFS"), "abbreviations"][[1]], "cfsl"))
antimicrobials[which(antimicrobials$ab == "CRO"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CRO"), "abbreviations"][[1]], "cftr"))
antimicrobials[which(antimicrobials$ab == "CTT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CTT"), "abbreviations"][[1]], "cftt"))
antimicrobials[which(antimicrobials$ab == "CTX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CTX"), "abbreviations"][[1]], "cftx"))
antimicrobials[which(antimicrobials$ab == "CAZ"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CAZ"), "abbreviations"][[1]], "cftz"))
antimicrobials[which(antimicrobials$ab == "CFM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CFM"), "abbreviations"][[1]], "cfxm"))
antimicrobials[which(antimicrobials$ab == "FOX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FOX"), "abbreviations"][[1]], "cfxt"))
antimicrobials[which(antimicrobials$ab == "CZA"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CZA"), "abbreviations"][[1]], "cfav"))
antimicrobials[which(antimicrobials$ab == "CZO"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CZO"), "abbreviations"][[1]], "cfzl"))
antimicrobials[which(antimicrobials$ab == "CZX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CZX"), "abbreviations"][[1]], "cfzx"))
antimicrobials[which(antimicrobials$ab == "CHL"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CHL"), "abbreviations"][[1]], "chlo"))
antimicrobials[which(antimicrobials$ab == "CPC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CPC"), "abbreviations"][[1]], "cicl"))
antimicrobials[which(antimicrobials$ab == "CIN"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CIN"), "abbreviations"][[1]], "cino"))
antimicrobials[which(antimicrobials$ab == "CIP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CIP"), "abbreviations"][[1]], "cipr"))
antimicrobials[which(antimicrobials$ab == "CIX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CIX"), "abbreviations"][[1]], "cipx"))
antimicrobials[which(antimicrobials$ab == "CLR"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CLR"), "abbreviations"][[1]], "clar"))
antimicrobials[which(antimicrobials$ab == "CLI"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CLI"), "abbreviations"][[1]], "clin"))
antimicrobials[which(antimicrobials$ab == "CTR"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CTR"), "abbreviations"][[1]], "clot"))
antimicrobials[which(antimicrobials$ab == "CLO"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CLO"), "abbreviations"][[1]], "clox"))
antimicrobials[which(antimicrobials$ab == "COL"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "COL"), "abbreviations"][[1]], "coli"))
antimicrobials[which(antimicrobials$ab == "CTC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CTC"), "abbreviations"][[1]], "cxcl"))
antimicrobials[which(antimicrobials$ab == "CYC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CYC"), "abbreviations"][[1]], "cycl"))
antimicrobials[which(antimicrobials$ab == "CCV"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CCV"), "abbreviations"][[1]], "czcl"))
antimicrobials[which(antimicrobials$ab == "DAP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "DAP"), "abbreviations"][[1]], "dapt"))
antimicrobials[which(antimicrobials$ab == "DIC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "DIC"), "abbreviations"][[1]], "dicl"))
antimicrobials[which(antimicrobials$ab == "DOR"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "DOR"), "abbreviations"][[1]], "dori"))
antimicrobials[which(antimicrobials$ab == "DOX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "DOX"), "abbreviations"][[1]], "doxy"))
antimicrobials[which(antimicrobials$ab == "ENX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "ENX"), "abbreviations"][[1]], "enox"))
antimicrobials[which(antimicrobials$ab == "ETP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "ETP"), "abbreviations"][[1]], "erta"))
antimicrobials[which(antimicrobials$ab == "ERY"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "ERY"), "abbreviations"][[1]], "eryt"))
antimicrobials[which(antimicrobials$ab == "PHE"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "PHE"), "abbreviations"][[1]], "fene"))
antimicrobials[which(antimicrobials$ab == "PHN"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "PHN"), "abbreviations"][[1]], "fepe"))
antimicrobials[which(antimicrobials$ab == "FLE"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FLE"), "abbreviations"][[1]], "fler"))
antimicrobials[which(antimicrobials$ab == "FLU"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FLU"), "abbreviations"][[1]], "fluc"))
antimicrobials[which(antimicrobials$ab == "FLC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FLC"), "abbreviations"][[1]], "flux"))
antimicrobials[which(antimicrobials$ab == "FOS"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FOS"), "abbreviations"][[1]], "fosf"))
antimicrobials[which(antimicrobials$ab == "FRM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FRM"), "abbreviations"][[1]], "fram"))
antimicrobials[which(antimicrobials$ab == "FUS"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FUS"), "abbreviations"][[1]], "fusi"))
antimicrobials[which(antimicrobials$ab == "GAT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "GAT"), "abbreviations"][[1]], "gati"))
antimicrobials[which(antimicrobials$ab == "GEH"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "GEH"), "abbreviations"][[1]], "gehl"))
antimicrobials[which(antimicrobials$ab == "GEN"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "GEN"), "abbreviations"][[1]], "gent"))
antimicrobials[which(antimicrobials$ab == "GRX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "GRX"), "abbreviations"][[1]], "grep"))
antimicrobials[which(antimicrobials$ab == "IPM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "IPM"), "abbreviations"][[1]], "imci"))
antimicrobials[which(antimicrobials$ab == "IPM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "IPM"), "abbreviations"][[1]], "imip"))
antimicrobials[which(antimicrobials$ab == "ISV"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "ISV"), "abbreviations"][[1]], "isav"))
antimicrobials[which(antimicrobials$ab == "ITR"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "ITR"), "abbreviations"][[1]], "itra"))
antimicrobials[which(antimicrobials$ab == "KAH"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "KAH"), "abbreviations"][[1]], "kahl"))
antimicrobials[which(antimicrobials$ab == "KAN"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "KAN"), "abbreviations"][[1]], "kana"))
antimicrobials[which(antimicrobials$ab == "KET"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "KET"), "abbreviations"][[1]], "keto"))
antimicrobials[which(antimicrobials$ab == "LVX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "LVX"), "abbreviations"][[1]], "levo"))
antimicrobials[which(antimicrobials$ab == "LIN"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "LIN"), "abbreviations"][[1]], "linc"))
antimicrobials[which(antimicrobials$ab == "LNZ"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "LNZ"), "abbreviations"][[1]], "line"))
antimicrobials[which(antimicrobials$ab == "LOR"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "LOR"), "abbreviations"][[1]], "lora"))
antimicrobials[which(antimicrobials$ab == "MEM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "MEM"), "abbreviations"][[1]], "mero"))
antimicrobials[which(antimicrobials$ab == "MET"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "MET"), "abbreviations"][[1]], "meti"))
antimicrobials[which(antimicrobials$ab == "MTR"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "MTR"), "abbreviations"][[1]], "metr"))
antimicrobials[which(antimicrobials$ab == "MEZ"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "MEZ"), "abbreviations"][[1]], "mezl"))
antimicrobials[which(antimicrobials$ab == "MIF"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "MIF"), "abbreviations"][[1]], "mica"))
antimicrobials[which(antimicrobials$ab == "MCZ"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "MCZ"), "abbreviations"][[1]], "mico"))
antimicrobials[which(antimicrobials$ab == "MNO"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "MNO"), "abbreviations"][[1]], "mino"))
antimicrobials[which(antimicrobials$ab == "LTM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "LTM"), "abbreviations"][[1]], "moxa", "moxalactam"))
antimicrobials[which(antimicrobials$ab == "MFX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "MFX"), "abbreviations"][[1]], "moxi"))
antimicrobials[which(antimicrobials$ab == "NAL"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "NAL"), "abbreviations"][[1]], "nali"))
antimicrobials[which(antimicrobials$ab == "NEO"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "NEO"), "abbreviations"][[1]], "neom"))
antimicrobials[which(antimicrobials$ab == "NET"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "NET"), "abbreviations"][[1]], "neti"))
antimicrobials[which(antimicrobials$ab == "NIT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "NIT"), "abbreviations"][[1]], "nitr"))
antimicrobials[which(antimicrobials$ab == "NOR"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "NOR"), "abbreviations"][[1]], "norf"))
antimicrobials[which(antimicrobials$ab == "NYS"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "NYS"), "abbreviations"][[1]], "nyst"))
antimicrobials[which(antimicrobials$ab == "OFX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "OFX"), "abbreviations"][[1]], "oflo"))
antimicrobials[which(antimicrobials$ab == "OXA"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "OXA"), "abbreviations"][[1]], "oxal"))
antimicrobials[which(antimicrobials$ab == "PEF"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "PEF"), "abbreviations"][[1]], "pefl"))
antimicrobials[which(antimicrobials$ab == "PEN"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "PEN"), "abbreviations"][[1]], "peni"))
antimicrobials[which(antimicrobials$ab == "PIP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "PIP"), "abbreviations"][[1]], "pipc"))
antimicrobials[which(antimicrobials$ab == "PPA"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "PPA"), "abbreviations"][[1]], "pipz"))
antimicrobials[which(antimicrobials$ab == "TZP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TZP"), "abbreviations"][[1]], "pita"))
antimicrobials[which(antimicrobials$ab == "PLB"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "PLB"), "abbreviations"][[1]], "polb"))
antimicrobials[which(antimicrobials$ab == "POS"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "POS"), "abbreviations"][[1]], "posa"))
antimicrobials[which(antimicrobials$ab == "PRI"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "PRI"), "abbreviations"][[1]], "pris"))
antimicrobials[which(antimicrobials$ab == "QDA"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "QDA"), "abbreviations"][[1]], "quda"))
antimicrobials[which(antimicrobials$ab == "RIF"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "RIF"), "abbreviations"][[1]], "rifa"))
antimicrobials[which(antimicrobials$ab == "RXT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "RXT"), "abbreviations"][[1]], "roxi"))
antimicrobials[which(antimicrobials$ab == "SMX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SMX"), "abbreviations"][[1]], "sfmx"))
antimicrobials[which(antimicrobials$ab == "SLF4"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SLF4"), "abbreviations"][[1]], "sfmz"))
antimicrobials[which(antimicrobials$ab == "SSS"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SSS"), "abbreviations"][[1]], "sfna"))
antimicrobials[which(antimicrobials$ab == "SLF"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SLF"), "abbreviations"][[1]], "sfsz"))
antimicrobials[which(antimicrobials$ab == "SPX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SPX"), "abbreviations"][[1]], "spar"))
antimicrobials[which(antimicrobials$ab == "SPT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SPT"), "abbreviations"][[1]], "spec"))
antimicrobials[which(antimicrobials$ab == "SPI"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SPI"), "abbreviations"][[1]], "spir"))
antimicrobials[which(antimicrobials$ab == "STH"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "STH"), "abbreviations"][[1]], "sthl"))
antimicrobials[which(antimicrobials$ab == "STR1"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "STR1"), "abbreviations"][[1]], "stre"))
antimicrobials[which(antimicrobials$ab == "TAZ"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TAZ"), "abbreviations"][[1]], "tazo"))
antimicrobials[which(antimicrobials$ab == "TEC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TEC"), "abbreviations"][[1]], "teic"))
antimicrobials[which(antimicrobials$ab == "TLT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TLT"), "abbreviations"][[1]], "teli"))
antimicrobials[which(antimicrobials$ab == "TMX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TMX"), "abbreviations"][[1]], "tema"))
antimicrobials[which(antimicrobials$ab == "TEM"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TEM"), "abbreviations"][[1]], "temo"))
antimicrobials[which(antimicrobials$ab == "TRB"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TRB"), "abbreviations"][[1]], "terb"))
antimicrobials[which(antimicrobials$ab == "TCY"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TCY"), "abbreviations"][[1]], "tetr"))
antimicrobials[which(antimicrobials$ab == "TIC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TIC"), "abbreviations"][[1]], "tica"))
antimicrobials[which(antimicrobials$ab == "TCC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TCC"), "abbreviations"][[1]], "ticl"))
antimicrobials[which(antimicrobials$ab == "TGC"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TGC"), "abbreviations"][[1]], "tige"))
antimicrobials[which(antimicrobials$ab == "TIN"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TIN"), "abbreviations"][[1]], "tini"))
antimicrobials[which(antimicrobials$ab == "TOB"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TOB"), "abbreviations"][[1]], "tobr"))
antimicrobials[which(antimicrobials$ab == "TOH"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TOH"), "abbreviations"][[1]], "tohl"))
antimicrobials[which(antimicrobials$ab == "TMP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TMP"), "abbreviations"][[1]], "trim"))
antimicrobials[which(antimicrobials$ab == "TVA"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "TVA"), "abbreviations"][[1]], "trov"))
antimicrobials[which(antimicrobials$ab == "SLT4"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SLT4"), "abbreviations"][[1]], "trsm"))
antimicrobials[which(antimicrobials$ab == "SXT"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "SXT"), "abbreviations"][[1]], "trsx"))
antimicrobials[which(antimicrobials$ab == "VAN"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "VAN"), "abbreviations"][[1]], "vanc"))
antimicrobials[which(antimicrobials$ab == "VOR"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "VOR"), "abbreviations"][[1]], "vori"))
antimicrobials[which(antimicrobials$ab == "FOS"), "synonyms"][[1]] <- list(sort(c(antimicrobials[which(antimicrobials$ab == "FOS"), "synonyms"][[1]], "Monuril")))
antimicrobials[which(antimicrobials$ab == "FOS"), "synonyms"][[1]] <- list(sort(c(antimicrobials[which(antimicrobials$ab == "FOS"), "synonyms"][[1]], "Monurol")))
antimicrobials[which(antimicrobials$ab == "TZP"), "abbreviations"][[1]] <- list(sort(c(antimicrobials[which(antimicrobials$ab == "TZP"), "abbreviations"][[1]], "piptazo")))
antimicrobials[which(antimicrobials$ab == "RFP"), "abbreviations"][[1]] <- list(sort(c(antimicrobials[which(antimicrobials$ab == "RFP"), "abbreviations"][[1]], "RPT")))
antimicrobials[which(antimicrobials$ab == "RTP"), "abbreviations"][[1]] <- list(sort(c(antimicrobials[which(antimicrobials$ab == "RTP"), "abbreviations"][[1]], "RET")))
antimicrobials[which(antimicrobials$ab == "TYL1"), "abbreviations"][[1]] <- list(sort(c(antimicrobials[which(antimicrobials$ab == "TYL1"), "abbreviations"][[1]], "TVN")))
antimicrobials <- antimicrobials %>%
mutate(ab = as.character(ab)) %>%
rbind(antimicrobials %>%
filter(ab == "GEH") %>%
mutate(
ab = "AMH",
name = "Amphotericin B-high",
abbreviations = list(c("amhl", "amfo b high", "ampho b high", "amphotericin high"))
)) %>%
rbind(antimicrobials %>%
filter(ab == "GEH") %>%
mutate(
ab = "TOH",
name = "Tobramycin-high",
abbreviations = list(c("tohl", "tobra high", "tobramycin high"))
)) %>%
rbind(antimicrobials %>%
filter(ab == "BUT") %>%
mutate(
ab = "CIX",
atc = "D01AE14",
name = "Ciclopirox",
group = "Antifungals/antimycotics",
atc_group1 = "Antifungals for topical use",
atc_group2 = "Other antifungals for topical use",
abbreviations = list(c("cipx"))
))
antimicrobials[which(antimicrobials$ab == "SSS"), "name"] <- "Sulfonamide"
# ESBL E-test codes:
antimicrobials[which(antimicrobials$ab == "CCV"), "abbreviations"][[1]] <- list(c("xtzl"))
antimicrobials[which(antimicrobials$ab == "CAZ"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CAZ"), "abbreviations"][[1]], "xtz", "cefta"))
antimicrobials[which(antimicrobials$ab == "CPC"), "abbreviations"][[1]] <- list(c("xpml"))
antimicrobials[which(antimicrobials$ab == "FEP"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "FEP"), "abbreviations"][[1]], "xpm"))
antimicrobials[which(antimicrobials$ab == "CTC"), "abbreviations"][[1]] <- list(c("xctl"))
antimicrobials[which(antimicrobials$ab == "CTX"), "abbreviations"][[1]] <- list(c(antimicrobials[which(antimicrobials$ab == "CTX"), "abbreviations"][[1]], "xct"))
# High level Gentamcin and Streptomycin
antimicrobials[which(antimicrobials$ab == "GEH"), "abbreviations"][[1]] <- list(c("gehl", "gentamicin high", "genta high", "gehi"))
antimicrobials[which(antimicrobials$ab == "STH"), "abbreviations"][[1]] <- list(c("sthl", "streptomycin high", "strepto high", "sthi"))
# add imi and "imipenem/cilastatine" to imipenem
antimicrobials[which(antimicrobials$ab == "IPM"), "abbreviations"][[1]] <- list(c("imip", "imi", "imp"))
antimicrobials[which(antimicrobials$ab == "IPM"), "synonyms"][[1]] <- list(sort(c(antimicrobials[which(antimicrobials$ab == "IPM"), "synonyms"][[1]], "imipenem/cilastatin")))
# add synonyms of ones not found
antimicrobials[which(antimicrobials$ab == "TZP"), "synonyms"][[1]] <- list(sort(c(antimicrobials[which(antimicrobials$ab == "TZP"), "synonyms"][[1]], "Tazocel", "tazocillin", "Tazocin", "Zosyn")))
antimicrobials[which(antimicrobials$ab == "COL"), "synonyms"][[1]] <- list(sort(unique(c(antimicrobials[which(antimicrobials$ab == "COL"), "synonyms"][[1]], "Colisticin", "Polymyxin E", "Colimycin", "Coly-Mycin", "Totazina", "Colistimethate", "Promixin", "Colistimethate Sodium"))))
# remove incorrect synonyms from rifampicin (RIF) and add them to the combination rifampicin/isoniazid (RFI)
old_sym <- antimicrobials[which(antimicrobials$ab == "RIF"), "synonyms"][[1]]
old_sym <- old_sym[!old_sym %in% c("Rifinah", "Rimactazid")]
antimicrobials[which(antimicrobials$ab == "RIF"), "synonyms"][[1]] <- list(old_sym)
antimicrobials[which(antimicrobials$ab == "RFI"), "synonyms"][[1]] <- list(sort(c("Rifinah", "Rimactazid")))
# remove incorrect synonyms from sulfamethoxazole (SMX) and add them to the combination trimethoprim/sulfamethoxazole (SXT)
old_sym <- antimicrobials[which(antimicrobials$ab == "SMX"), "synonyms"][[1]]
old_sym <- old_sym[!old_sym %in% c("Cotrimoxazole", "Bactrimel")]
antimicrobials[which(antimicrobials$ab == "SMX"), "synonyms"][[1]] <- list(old_sym)
antimicrobials[which(antimicrobials$ab == "SXT"), "synonyms"][[1]] <- list(sort(unique(c(antimicrobials[which(antimicrobials$ab == "COL"), "synonyms"][[1]], "Cotrimoxazole", "Bactrimel", "Septra", "Bactrim", "Cotrimazole"))))
# Fix penicillins
antimicrobials[which(antimicrobials$ab == "PEN"), "abbreviations"][[1]] <- list(c("bepe", "pg", "pen", "peni", "peni g", "penicillin", "penicillin g"))
antimicrobials[which(antimicrobials$ab == "PEN"), "name"] <- "Benzylpenicillin"
antimicrobials[which(antimicrobials$ab == "PHN"), "abbreviations"][[1]] <- list(c("fepe", "peni v", "pv", "penicillin v", "PNV"))
antimicrobials <- subset(antimicrobials, antimicrobials$ab != "PNV")
# New DDDs
antimicrobials[which(antimicrobials$ab == "PEN"), "iv_ddd"] <- 3.6
antimicrobials[which(antimicrobials$ab == "PEN"), "iv_units"] <- "g"
## new ATC codes
# ceftaroline
antimicrobials[which(antimicrobials$ab == "CPT"), "atc"] <- "J01DI02"
# faropenem
antimicrobials[which(antimicrobials$ab == "FAR"), "atc"] <- "J01DI03"
# ceftobiprole
antimicrobials[which(antimicrobials$ab == "BPR"), "atc"] <- "J01DI01"
# ceftazidime / avibactam
antimicrobials[which(antimicrobials$ab == "CZA"), "atc"] <- "J01DD52"
antimicrobials[which(antimicrobials$ab == "CZA"), "cid"] <- 90643431
antimicrobials[which(antimicrobials$ab == "CZA"), "atc_group1"] <- "Other beta-lactam antibacterials"
antimicrobials[which(antimicrobials$ab == "CZA"), "atc_group2"] <- "Third-generation cephalosporins"
antimicrobials[which(antimicrobials$ab == "CZA"), "iv_ddd"] <- 6
antimicrobials[which(antimicrobials$ab == "CZA"), "iv_units"] <- "g"
antimicrobials[which(antimicrobials$ab == "CZA"), "synonyms"] <- list(c("Avycaz", "Zavicefta"))
# typo
antimicrobials[which(antimicrobials$ab == "RXT"), "name"] <- "Roxithromycin"
antimicrobials[which(antimicrobials$ab == "PEN"), "atc"] <- "J01CE01"
# WHONET cleanup
antimicrobials[which(antimicrobials$ab == "BCZ"), "name"] <- "Bicyclomycin"
antimicrobials[which(antimicrobials$ab == "CCL"), "name"] <- "Cefetecol"
antimicrobials[which(antimicrobials$ab == "ENV"), "name"] <- "Enviomycin"
antimicrobials[which(antimicrobials$ab == "KIT"), "name"] <- "Kitasamycin"
antimicrobials[which(antimicrobials$ab == "LSP"), "name"] <- "Linco-spectin"
antimicrobials[which(antimicrobials$ab == "MEC"), "name"] <- "Mecillinam"
antimicrobials[which(antimicrobials$ab == "PMR"), "name"] <- "Pimaricin"
antimicrobials[which(antimicrobials$ab == "BCZ"), "abbreviations"][[1]] <- list(sort(unique(c(antimicrobials[which(antimicrobials$ab == "BCZ"), "abbreviations"][[1]], "Bicozamycin"))))
antimicrobials[which(antimicrobials$ab == "CCL"), "abbreviations"][[1]] <- list(sort(unique(c(antimicrobials[which(antimicrobials$ab == "CCL"), "abbreviations"][[1]], "Cefcatacol"))))
antimicrobials[which(antimicrobials$ab == "ENV"), "abbreviations"][[1]] <- list(sort(unique(c(antimicrobials[which(antimicrobials$ab == "ENV"), "abbreviations"][[1]], "Tuberactinomycin"))))
antimicrobials[which(antimicrobials$ab == "KIT"), "abbreviations"][[1]] <- list(sort(unique(c(antimicrobials[which(antimicrobials$ab == "KIT"), "abbreviations"][[1]], "Leucomycin"))))
antimicrobials[which(antimicrobials$ab == "LSP"), "abbreviations"][[1]] <- list(sort(unique(c(antimicrobials[which(antimicrobials$ab == "LSP"), "abbreviations"][[1]], "lincomycin/spectinomycin"))))
antimicrobials[which(antimicrobials$ab == "MEC"), "abbreviations"][[1]] <- list(sort(unique(c(antimicrobials[which(antimicrobials$ab == "MEC"), "abbreviations"][[1]], "Amdinocillin"))))
antimicrobials[which(antimicrobials$ab == "PMR"), "abbreviations"][[1]] <- list(sort(unique(c(antimicrobials[which(antimicrobials$ab == "PMR"), "abbreviations"][[1]], "Natamycin"))))
# set cephalosporins groups for the ones that could not be determined automatically:
antimicrobials <- antimicrobials %>%
mutate(group = case_when(
name == "Cefcapene" ~ "Cephalosporins (3rd gen.)",
name == "Cefcapene pivoxil" ~ "Cephalosporins (3rd gen.)",
name == "Cefditoren pivoxil" ~ "Cephalosporins (3rd gen.)",
name == "Cefepime/clavulanic acid" ~ "Cephalosporins (4th gen.)",
name == "Cefepime/tazobactam" ~ "Cephalosporins (4th gen.)",
name == "Cefetamet pivoxil" ~ "Cephalosporins (3rd gen.)",
name == "Cefetecol (Cefcatacol)" ~ "Cephalosporins (4th gen.)",
name == "Cefetrizole" ~ "Cephalosporins (unclassified gen.)",
name == "Cefoselis" ~ "Cephalosporins (4th gen.)",
name == "Cefotaxime/clavulanic acid" ~ "Cephalosporins (3rd gen.)",
name == "Cefotaxime/sulbactam" ~ "Cephalosporins (3rd gen.)",
name == "Cefotiam hexetil" ~ "Cephalosporins (3rd gen.)",
name == "Cefovecin" ~ "Cephalosporins (3rd gen.)",
name == "Cefozopran" ~ "Cephalosporins (4th gen.)",
name == "Cefpimizole" ~ "Cephalosporins (3rd gen.)",
name == "Cefpodoxime proxetil" ~ "Cephalosporins (3rd gen.)",
name == "Cefpodoxime/clavulanic acid" ~ "Cephalosporins (3rd gen.)",
name == "Cefquinome" ~ "Cephalosporins (4th gen.)",
name == "Cefsumide" ~ "Cephalosporins (unclassified gen.)",
name == "Ceftaroline" ~ "Cephalosporins (5th gen.)",
name == "Ceftaroline/avibactam" ~ "Cephalosporins (5th gen.)",
name == "Ceftazidime/avibactam" ~ "Cephalosporins (3rd gen.)",
name == "Cefteram" ~ "Cephalosporins (3rd gen.)",
name == "Cefteram pivoxil" ~ "Cephalosporins (3rd gen.)",
name == "Ceftiofur" ~ "Cephalosporins (3rd gen.)",
name == "Ceftizoxime alapivoxil" ~ "Cephalosporins (3rd gen.)",
name == "Ceftobiprole" ~ "Cephalosporins (5th gen.)",
name == "Ceftobiprole medocaril" ~ "Cephalosporins (5th gen.)",
name == "Ceftolozane/enzyme inhibitor" ~ "Cephalosporins (5th gen.)",
name == "Ceftolozane/tazobactam" ~ "Cephalosporins (5th gen.)",
name == "Cefuroxime axetil" ~ "Cephalosporins (2nd gen.)",
TRUE ~ group
))
antimicrobials[which(antimicrobials$ab %in% c("CYC", "LNZ", "THA", "TZD")), "group"] <- "Oxazolidinones"
# add efflux
effl <- antimicrobials |>
filter(ab == "ACM") |>
mutate(ab = as.character("EFF"),
cid = NA_real_,
name = "Efflux",
group = "Other")
antimicrobials <- antimicrobials |>
mutate(ab = as.character(ab)) |>
bind_rows(effl)
class(antimicrobials$ab) <- c("ab", "character")
antimicrobials[which(antimicrobials$ab == "EFF"), "abbreviations"][[1]] <- list(c("effflux pump"))
# add clindamycin inducible screening
clin <- antimicrobials |>
filter(ab == "FOX1") |>
mutate(ab = as.character("CLI1"),
name = "Clindamycin inducible screening",
group = "Macrolides/lincosamides")
antimicrobials <- antimicrobials |>
mutate(ab = as.character(ab)) |>
bind_rows(clin)
class(antimicrobials$ab) <- c("ab", "character")
antimicrobials[which(antimicrobials$ab == "CLI1"), "abbreviations"][[1]] <- list(c("clindamycin inducible", "clinda inducible", "clin inducible"))
# add pretomanid
antimicrobials <- antimicrobials %>%
mutate(ab = as.character(ab)) %>%
bind_rows(antimicrobials %>%
mutate(ab = as.character(ab)) %>%
filter(ab == "SMF") %>%
mutate(
ab = "PMD",
atc = "J04AK08",
cid = 456199,
name = "Pretomanid",
abbreviations = list(""),
oral_ddd = NA_real_
))
# update ATC codes from WHOCC website -------------------------------------
# last time checked: 2024-02-22
library(rvest)
updated_atc <- as.list(antimicrobials$atc)
get_atcs <- function(ab_name, type = "human") {
if (type == "human") {
url <- "https://atcddd.fhi.no/atc_ddd_index/"
} else if (type == "veterinary") {
url <- "https://atcddd.fhi.no/atcvet/atcvet_index/"
} else {
stop("invalid type")
}
ab_name <- gsub("/", " and ", tolower(ab_name), fixed = TRUE)
# we will do a search on their website, which means:
# go to the url
atc_tbl <- read_html(url) %>%
# get all forms
html_form() %>%
# get the second form (the first form is a global website form)
.[[2]] %>%
# set the name input box to our search parameter
html_form_set(name = ab_name) %>%
# hit Submit
html_form_submit() %>%
# read the resulting page
read_html() %>%
# retrieve the table on it
html_node("table") %>%
# transform it to an R data set
html_table(header = FALSE)
# and get the ATCs (first column) of only exact hits
unique(as.character(atc_tbl[which(tolower(atc_tbl[, 2, drop = TRUE]) == ab_name), 1, drop = TRUE]))
}
# this takes around 4 minutes (some are skipped and go faster)
for (i in seq_len(nrow(antimicrobials))) {
message(percentage(i / nrow(antimicrobials), digits = 1),
" - Downloading ", antimicrobials$name[i],
appendLF = FALSE
)
atcs <- get_atcs(antimicrobials$name[i], type = "human")
if (all(is.na(atcs))) {
atcs <- get_atcs(antimicrobials$name[i], type = "veterinary")
}
if (length(atcs) > 0) {
updated_atc[[i]] <- atcs
message(" (", length(atcs), " results)")
# let the WHO server rest for a second - they might have a limitation on the queries per second
Sys.sleep(1)
} else {
message(" (skipping)")
}
}
antimicrobials$atc <- updated_atc
# update DDDs from WHOCC website ------------------------------------------
# last time checked: 2024-02-22
ddd_oral <- rep(NA_real_, nrow(antimicrobials))
ddd_oral_units <- rep(NA_character_, nrow(antimicrobials))
ddd_iv <- rep(NA_real_, nrow(antimicrobials))
ddd_iv_units <- rep(NA_character_, nrow(antimicrobials))
progress <- progress_ticker(nrow(antimicrobials))
for (i in seq_len(nrow(antimicrobials))) {
on.exit(close(progress))
progress$tick()
atcs <- antimicrobials$atc[[i]]
if (!all(is.na(atcs))) {
for (j in seq_len(length(atcs))) {
# oral
if (is.na(ddd_oral[i])) {
ddd_oral[i] <- atc_online_ddd(atcs[j], administration = "O")
if (!is.na(ddd_oral[i])) {
ddd_oral_units[i] <- atc_online_ddd_units(atcs[j], administration = "O")
}
}
# parenteral
if (is.na(ddd_iv[i])) {
ddd_iv[i] <- atc_online_ddd(atcs[j], administration = "P")
if (!is.na(ddd_iv[i])) {
ddd_iv_units[i] <- atc_online_ddd_units(atcs[j], administration = "P")
}
}
}
}
if (!is.na(ddd_oral[i]) | !is.na(ddd_iv[i])) {
# let the WHO server rest for 0.25 second - they might have a limitation on the queries per second
Sys.sleep(0.25)
}
}
antimicrobials$oral_ddd <- ddd_oral
antimicrobials$oral_units <- ddd_oral_units
antimicrobials$iv_ddd <- ddd_iv
antimicrobials$iv_units <- ddd_iv_units
# Wrap up -----------------------------------------------------------------
# set as data.frame again
antimicrobials <- dataset_UTF8_to_ASCII(as.data.frame(antimicrobials, stringsAsFactors = FALSE))
class(antimicrobials$ab) <- c("ab", "character")
antimicrobials <- dplyr::arrange(antimicrobials, name)
# REFER TO data-raw/loinc.R FOR ADDING LOINC CODES
# make all abbreviations and synonyms lower case, unique and alphabetically sorted ----
for (i in 1:nrow(antimicrobials)) {
abb <- as.character(sort(unique(tolower(antimicrobials[i, "abbreviations", drop = TRUE][[1]]))))
abb <- abb[abb != "" & abb %unlike% ":"]
syn <- as.character(sort(unique(tolower(unname(unlist(antimicrobials[i, "synonyms", drop = TRUE]))))))
syn <- gsub("[^a-z]", "", syn)
syn <- gsub(" +", " ", syn)
pharm_terms <- "(pa?ediatric|injection|oral|inhale|otic|sulfate|sulphate|sodium|base|anhydrous|anhydrate|stearate|syrup|natrium|hydrate|x?hcl|gsalt|vet[.]?)"
syn <- gsub(paste0(" ", pharm_terms, "$"), "", syn)
syn <- gsub(paste0("^", pharm_terms, " "), "", syn)
syn <- trimws(syn)
syn <- gsub(" [a-z]{1,3}$", "", syn, perl = TRUE)
syn <- trimws(syn)
syn <- syn[syn != "" & syn %unlike% ":" & !syn %in% tolower(antimicrobials$name)]
syn <- unique(syn)
# special cases
if (antimicrobials$ab[i] == "VAN") syn <- syn[syn %unlike% "^tei?ch?o"]
if (antimicrobials$ab[i] == "CLR") syn <- syn[syn %unlike% "^ery"]
antimicrobials[i, "abbreviations"][[1]] <- ifelse(length(abb) == 0, list(""), list(abb))
antimicrobials[i, "synonyms"][[1]] <- ifelse(length(syn) == 0, list(""), list(syn))
if ("loinc" %in% colnames(antimicrobials)) {
loinc <- as.character(sort(unique(tolower(antimicrobials[i, "loinc", drop = TRUE][[1]]))))
loinc <- loinc[loinc != ""]
antimicrobials[i, "loinc"][[1]] <- ifelse(length(loinc) == 0, list(""), list(loinc))
}
}
usethis::use_data(antimicrobials, overwrite = TRUE, version = 2, compress = "xz")
rm(antimicrobials)
@@ -235,7 +235,7 @@ breakpoints %>%
filter(!WHONET_ABX_CODE %in% whonet_antibiotics$WHONET_ABX_CODE) %>%
pull(WHONET_ABX_CODE) %>%
unique()
# they are at the moment all old codes that have the right replacements in `antibiotics`, so we can use as.ab()
# they are at the moment all old codes that have the right replacements in `antimicrobials`, so we can use as.ab()
## Build new breakpoints table ----
@@ -30,9 +30,9 @@
library(AMR)
library(dplyr)
int_resis <- data.frame(mo = microorganisms$mo, stringsAsFactors = FALSE)
for (i in seq_len(nrow(antibiotics))) {
for (i in seq_len(nrow(antimicrobials))) {
int_resis$new <- as.sir("S")
colnames(int_resis)[ncol(int_resis)] <- antibiotics$ab[i]
colnames(int_resis)[ncol(int_resis)] <- antimicrobials$ab[i]
}
int_resis <- eucast_rules(int_resis,
@@ -49,14 +49,14 @@ int_resis2 <- int_resis[, sapply(int_resis, function(x) any(!is.sir(x) | x == "R
select(mo, ab = name)
# remove lab drugs
untreatable <- antibiotics[which(antibiotics$name %like% "-high|EDTA|polysorbate|macromethod|screening|/nacubactam"), "ab", drop = TRUE]
untreatable <- antimicrobials[which(antimicrobials$name %like% "-high|EDTA|polysorbate|macromethod|screening|/nacubactam"), "ab", drop = TRUE]
# takes ages with filter()..., weird
int_resis3 <- int_resis2[which(!int_resis2$ab %in% untreatable), ]
class(int_resis3$ab) <- c("ab", "character")
int_resis3
all(int_resis3$mo %in% microorganisms$mo)
all(int_resis3$ab %in% antibiotics$ab)
all(int_resis3$ab %in% antimicrobials$ab)
intrinsic_resistant <- df_remove_nonASCII(int_resis3)
usethis::use_data(intrinsic_resistant, internal = FALSE, overwrite = TRUE, version = 2, compress = "xz")