Skip to contents

Use this function to determine the antibiotic code of one or more antibiotics. The data set antibiotics will be searched for abbreviations, official names and synonyms (brand names).

Usage

as.ab(x, flag_multiple_results = TRUE, info = interactive(), ...)

is.ab(x)

Arguments

x

a character vector to determine to antibiotic ID

flag_multiple_results

a logical to indicate whether a note should be printed to the console that probably more than one antibiotic code or name can be retrieved from a single input value.

info

a logical to indicate whether a progress bar should be printed, defaults to TRUE only in interactive mode

...

arguments passed on to internal functions

Value

A character

vector with additional class ab

Details

All entries in the antibiotics data set have three different identifiers: a human readable EARS-Net code (column ab, used by ECDC and WHONET), an ATC code (column atc, used by WHO), and a CID code (column 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 as.ab() can correct for different forms of misspelling:

  • Wrong spelling of drug names (such as "tobramicin" or "gentamycin"), which corrects for most audible similarities such as f/ph, x/ks, c/z/s, t/th, etc.

  • Too few or too many vowels or consonants

  • Switching two characters (such as "mreopenem", often the case in clinical data, when doctors typed too fast)

  • Digitalised paper records, leaving artefacts like 0/o/O (zero and O's), B/8, n/r, etc.

Use the ab_* functions to get properties based on the returned antibiotic ID, see Examples.

Note: the as.ab() and ab_* functions may use very long regular expression to match brand names of antimicrobial agents. This may fail on some systems.

Source

World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: https://www.whocc.no/atc_ddd_index/

European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm

WHOCC


This package contains 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, https://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission (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.

NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See https://www.whocc.no/copyright_disclaimer/.

Reference Data Publicly Available

All reference data sets (about microorganisms, antibiotics, R/SI 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, SAS, 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, which is automatically updated with every code change.

See also

  • antibiotics for the data.frame that is being used to determine ATCs

  • ab_from_text() for a function to retrieve antimicrobial drugs from clinical text (from health care records)

Examples

# these examples all return "ERY", the ID of erythromycin:
as.ab("J01FA01")
#> Class <ab>
#> [1] ERY
as.ab("J 01 FA 01")
#> Class <ab>
#> [1] ERY
as.ab("Erythromycin")
#> Class <ab>
#> [1] ERY
as.ab("eryt")
#> Class <ab>
#> [1] ERY
as.ab("   eryt 123")
#> Class <ab>
#> [1] ERY
as.ab("ERYT")
#> Class <ab>
#> [1] ERY
as.ab("ERY")
#> Class <ab>
#> [1] ERY
as.ab("eritromicine") # spelled wrong, yet works
#> Class <ab>
#> [1] ERY
as.ab("Erythrocin")   # trade name
#> Class <ab>
#> [1] ERY
as.ab("Romycin")      # trade name
#> Class <ab>
#> [1] ERY

# spelling from different languages and dyslexia are no problem
ab_atc("ceftriaxon")
#> [1] "J01DD04"
ab_atc("cephtriaxone")     # small spelling error
#> [1] "J01DD04"
ab_atc("cephthriaxone")    # or a bit more severe
#> [1] "J01DD04"
ab_atc("seephthriaaksone") # and even this works
#> [1] "J01DD04"

# use ab_* functions to get a specific properties (see ?ab_property);
# they use as.ab() internally:
ab_name("J01FA01")    # "Erythromycin"
#> [1] "Erythromycin"
ab_name("eryt")       # "Erythromycin"
#> [1] "Erythromycin"
# \donttest{
if (require("dplyr")) {

  # you can quickly rename <rsi> columns using dplyr >= 1.0.0:
  example_isolates %>%
    rename_with(as.ab, where(is.rsi))
   
}
#> # A tibble: 2,000 × 49
#>    date       hospit…¹ ward_…² ward_…³ ward_…⁴   age gender patie…⁵ mo          
#>    <date>     <fct>    <lgl>   <lgl>   <lgl>   <dbl> <chr>  <chr>   <mo>        
#>  1 2002-01-02 D        FALSE   TRUE    FALSE      65 F      A77334  B_ESCHR_COLI
#>  2 2002-01-03 D        FALSE   TRUE    FALSE      65 F      A77334  B_ESCHR_COLI
#>  3 2002-01-07 B        TRUE    FALSE   FALSE      45 F      067927  B_STPHY_EPDR
#>  4 2002-01-07 B        TRUE    FALSE   FALSE      45 F      067927  B_STPHY_EPDR
#>  5 2002-01-13 B        TRUE    FALSE   FALSE      45 F      067927  B_STPHY_EPDR
#>  6 2002-01-13 B        TRUE    FALSE   FALSE      45 F      067927  B_STPHY_EPDR
#>  7 2002-01-14 D        FALSE   TRUE    FALSE      78 M      462729  B_STPHY_AURS
#>  8 2002-01-14 D        FALSE   TRUE    FALSE      78 M      462729  B_STPHY_AURS
#>  9 2002-01-16 B        TRUE    FALSE   FALSE      45 F      067927  B_STPHY_EPDR
#> 10 2002-01-17 B        TRUE    FALSE   FALSE      79 F      858515  B_STPHY_EPDR
#> # … with 1,990 more rows, 40 more variables: PEN <rsi>, OXA <rsi>, FLC <rsi>,
#> #   AMX <rsi>, AMC <rsi>, AMP <rsi>, TZP <rsi>, CZO <rsi>, FEP <rsi>,
#> #   CXM <rsi>, FOX <rsi>, CTX <rsi>, CAZ <rsi>, CRO <rsi>, GEN <rsi>,
#> #   TOB <rsi>, AMK <rsi>, KAN <rsi>, TMP <rsi>, SXT <rsi>, NIT <rsi>,
#> #   FOS <rsi>, LNZ <rsi>, CIP <rsi>, MFX <rsi>, VAN <rsi>, TEC <rsi>,
#> #   TCY <rsi>, TGC <rsi>, DOX <rsi>, ERY <rsi>, CLI <rsi>, AZM <rsi>,
#> #   IPM <rsi>, MEM <rsi>, MTR <rsi>, CHL <rsi>, COL <rsi>, MUP <rsi>, …
# }