Msberends AMR Versions Save

Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by using evidence-based methods, as described in https://doi.org/10.18637/jss.v104.i03.

v2.1.1

7 months ago
  • Fix for selecting first isolates using the phenotype-based method
    • This included too many isolates when patients had altering antibiograms within the same bacterial species
    • See for more info our issue #122
  • Added 1,366 LOINC codes to the antibiotics data set and updated to the latest version (LOINC v2.76)
  • MICs can now be used in complex number calculations and allow scientific number format as input (e.g., as.mic("1.28e-2"))
  • Fix rounding MICs on latest R beta ('R-devel')
  • Removed unneeded note about the used language when option AMR_locale is set
  • Fixed non-ASCII characters in documentation, according to CRAN maintainers

v2.1.0

10 months ago

New

  • Regarding clinical breakpoints:
    • Clinical breakpoints and intrinsic resistance of EUCAST 2023 and CLSI 2023 have been added to the clinical_breakpoints data set for usage in as.sir(). EUCAST 2023 (v13.0) is now the new default guideline for all MIC and disks diffusion interpretations
    • The EUCAST dosage guideline of v13.0 has been added to the dosage data set
    • The clinical_breakpoints data set now also contains epidemiological cut-off (ECOFF) values and CLSI animal breakpoints. These two new breakpoint types can be used for MIC/disk interpretation using as.sir(..., breakpoint_type = "ECOFF") oras.sir(..., breakpoint_type = "animal"), which is an important new addition for veterinary microbiology.
  • Added support for 30 species groups / complexes. They are gathered in a new data set microorganisms.groups and are used in clinical breakpoint interpretation. For example, CLSI 2023 contains breakpoints for the RGM group (Rapidly Growing Mycobacterium, containing over 80 species) which is now supported by our package.
  • Added oxygen tolerance from BacDive to over 25,000 bacteria in the microorganisms data set
    • Added mo_oxygen_tolerance() to retrieve the values
    • Added mo_is_anaerobic() to determine which genera/species are obligate anaerobic bacteria
  • Added LPSN and GBIF identifiers, and oxygen tolerance to mo_info()
  • Added SAS Transport files (file extension .xpt) to our download page to use in SAS software
  • Added microbial codes for Gram-negative/positive anaerobic bacteria

Changed

  • Updated algorithm of as.mo() by giving more weight to fungi
  • Fixed clinical breakpoints errors introduced by the source we import the rules from
  • mo_rank() now returns NA for 'unknown' microorganisms (B_ANAER, B_ANAER-NEG, B_ANAER-POS, B_GRAMN, B_GRAMP, F_FUNGUS, F_YEAST, and UNKNOWN)
  • When printing microorganism or antibiotic codes in a tibble, a mouse-hover now shows the full name of the code
  • Plots for MIC and disk diffusion values:
    • Now have settable arguments for breakpoint type and PK/PD, like as.sir()
    • Will now contain the name of the guideline table in the subtitle of the plot
  • Fixed formatting for sir_interpretation_history()
  • Fixed some WHONET codes for microorganisms and consequently a couple of entries in clinical_breakpoints
  • Fixed a bug for as.mo() that led to coercion of NA values when using custom microorganism codes
  • Fixed usage of icu_exclude in first_isolates()
  • Improved as.mo() algorithm:
    • Now allows searching on only species names
    • Fix for using the keep_synonyms argument when using MO codes as input
    • Fix for using the minimum_matching_score argument
  • Updated the code table in microorganisms.codes
  • Fixed an endless loop if using reference_df in as.mo()
  • Fixed bug for indicating UTIs in as.sir()
  • Greatly improved speed of as.sir()

v2.0.0

1 year ago

AMR v2.0.0

This is a new major release of the AMR package, with great new additions but also some breaking changes for current users.

The full changelog can be read here.

TL;DR

  • All functions and arguments with 'rsi' were replaced with 'sir', such as the interpretation of MIC values (now as.sir() instead of as.rsi()) - all old functions still work for now
  • Many new interesting functions, such as antibiogram() (for generating traditional/combined/syndromic/WISCA antibiograms), sir_confidence_interval() and mean_amr_distance(), and add_custom_microorganisms() to add custom microorganisms to this package
  • Clinical breakpoints added for EUCAST 2022 and CLSI 2022
  • Microbiological taxonomy (microorganisms data set) updated to 2022 and now based on LPSN and GBIF
  • Much increased algorithms to translate user input to valid taxonomy, e.g. by using recent scientific work about per-species human pathogenicity
  • 20 new antibiotics added and updated all DDDs and ATC codes
  • Extended support for antiviral agents (antivirals data set), with many new functions
  • Now available in 20 languages
  • Many small bug fixes

v1.8.2

1 year ago

v1.8.1

2 years ago

AMR 1.8.1

All functions in this package are considered to be stable. Updates to the AMR interpretation rules (such as by EUCAST and CLSI), the microbial taxonomy, and the antibiotic dosages will all be updated every 6 to 12 months.

Changed

  • Fix for using as.rsi() on values containing capped values (such as >=), sometimes leading to NA
  • Support for antibiotic interpretations of the MIPS laboratory system: "U" for S ('susceptible urine'), "D" for I ('susceptible dose-dependent')
  • Improved algorithm of as.mo(), especially for ignoring non-taxonomic text, such as:
    mo_name("methicillin-resistant S. aureus (MRSA)")
    #> [1] "Staphylococcus aureus"
    
  • More informative warning messages
  • Added 192 as valid MIC
  • Updated MIC printing in tibbles
  • Increased speed for loading the package

Other

  • Fix for unit testing on R 3.3
  • Fix for size of some image elements, as requested by CRAN

v1.8.0

2 years ago

All functions in this package are now all considered to be stable. Updates to the AMR interpretation rules (such as by EUCAST and CLSI), the microbial taxonomy, and the antibiotic dosages will all be updated every 6 to 12 months from now on.

Breaking changes

  • Removed p_symbol() and all filter_*() functions (except for filter_first_isolate()), which were all deprecated in a previous package version
  • Removed the key_antibiotics() and key_antibiotics_equal() functions, which were deprecated and superseded by key_antimicrobials() and antimicrobials_equal()
  • Removed all previously implemented ggplot2::ggplot() generics for classes <mic>, <disk>, <rsi> and <resistance_predict> as they did not follow the ggplot2 logic. They were replaced with ggplot2::autoplot() generics.
  • Renamed function get_locale() to get_AMR_locale() to prevent conflicts with other packages

New

  • Support for the CLSI 2021 guideline for interpreting MIC/disk diffusion values, which are incorporated in the rsi_translation data set. This data set now more strictly follows the WHONET software as well.
  • Support for EUCAST Intrinsic Resistance and Unusual Phenotypes v3.3 (October 2021). This is now the default EUCAST guideline in the package (all older guidelines are still available) for eucast_rules(), mo_is_intrinsic_resistant() and mdro(). The intrinsic_resistant data set was also updated accordingly.
  • Support for all antimicrobial drug (group) names and colloquial microorganism names in Danish, Dutch, English, French, German, Italian, Portuguese, Russian, Spanish and Swedish
  • Function set_ab_names() to rename data set columns that resemble antimicrobial drugs. This allows for quickly renaming columns to official names, ATC codes, etc. Its second argument can be a tidyverse way of selecting:
    example_isolates %>% set_ab_names(where(is.rsi))
    example_isolates %>% set_ab_names(AMC:GEN, property = "atc")
    
  • Function mo_lpsn() to retrieve the LPSN record ID
  • Function ab_ddd_units() to get units of DDDs (daily defined doses), deprecating the use of ab_ddd(..., units = TRUE) to be more consistent in data types of function output

Changed

  • Updated the bacterial taxonomy to 5 October 2021 (according to LPSN), including all 11 new staphylococcal species named since 1 January last year
  • The antibiotics data set now contains all ATC codes that are available through the WHOCC website, regardless of drugs being present in more than one ATC group. This means that:
    • Some drugs now contain multiple ATC codes (e.g., metronidazole contains 5)
    • antibiotics$atc is now a list containing character vectors, and this atc column was moved to the 5th position of the antibiotics data set
    • ab_atc() does not always return a character vector of length 1, and returns a list if the input is larger than length 1
    • ab_info() has a slightly different output
    • Some DDDs (daily defined doses) were added or updated according to newly included ATC codes
  • Antibiotic selectors
    • They now also work in R-3.0 and R-3.1, supporting every version of R since 2013 like the rest of the package
    • Added more selectors for antibiotic classes: aminopenicillins(), antifungals(), antimycobacterials(), lincosamides(), lipoglycopeptides(), polymyxins(), quinolones(), streptogramins(), trimethoprims() and ureidopenicillins()
    • Added specific selectors for certain types for treatment: administrable_per_os() and administrable_iv(), which are based on available Defined Daily Doses (DDDs), as defined by the WHOCC. These are ideal for e.g. analysing pathogens in primary care where IV treatment is not an option. They can be combined with other AB selectors, e.g. to select penicillins that are only administrable per os (i.e., orally):
      example_isolates[, penicillins() & administrable_per_os()]          # base R
      example_isolates %>% select(penicillins() & administrable_per_os()) # dplyr
      
    • Added the selector ab_selector(), which accepts a filter to be used internally on the antibiotics data set, yielding great flexibility on drug properties, such as selecting antibiotic columns with an oral DDD of at least 1 gram:
      example_isolates[, ab_selector(oral_ddd > 1 & oral_units == "g")]          # base R
      example_isolates %>% select(ab_selector(oral_ddd > 1 & oral_units == "g")) # dplyr
      
    • Added the selector not_intrinsic_resistant(), which only keeps antibiotic columns that are not intrinsic resistant for all microorganisms in a data set, based on the latest EUCAST guideline on intrinsic resistance. For example, if a data set contains only microorganism codes or names of E. coli and K. pneumoniae and contains a column "vancomycin", this column will be removed (or rather, unselected) using this function.
    • Added argument only_treatable, which defaults to TRUE and will exclude drugs that are only for laboratory tests and not for treating patients (such as imipenem/EDTA and gentamicin-high)
    • Fix for using selectors multiple times in one call (e.g., using them in dplyr::filter() and immediately after in dplyr::select())
    • Fix for using having multiple columns that are coerced to the same antibiotic agent
    • Fixed for using all() or any() on antibiotic selectors in an R Markdown file
  • Added the following antimicrobial agents that are now covered by the WHO: aztreonam/nacubactam (ANC), cefepime/nacubactam (FNC), exebacase (EXE), ozenoxacin (OZN), zoliflodacin (ZFD), manogepix (MGX), ibrexafungerp (IBX), and rezafungin (RZF). None of these agents have an ATC code yet.
  • Fixed the Gram stain (mo_gramstain()) determination of the taxonomic class Negativicutes within the phylum of Firmicutes - they were considered Gram-positives because of their phylum but are actually Gram-negative. This impacts 137 taxonomic species, genera and families, such as Negativicoccus and Veillonella.
  • Dramatic speed improvement for first_isolate()
  • Fix to prevent introducing NAs for old MO codes when running as.mo() on them
  • Added more informative error messages when any of the proportion_*() and count_*() functions fail
  • When printing a tibble with any old MO code, a warning will be thrown that old codes should be updated using as.mo()
  • Improved automatic column selector when col_* arguments are left blank, e.g. in first_isolate()
  • The right input types for random_mic(), random_disk() and random_rsi() are now enforced
  • as.rsi() has an improved algorithm and can now also correct for textual input (such as "Susceptible", "Resistant") in all supported languages
  • as.mic() has an improved algorithm
  • When warnings are thrown because of too few isolates in any count_*(), proportion_*() function (or resistant() or susceptible()), the dplyr group will be shown, if available
  • Fix for legends created with scale_rsi_colours() when using ggplot2 v3.3.4 or higher (this is ggplot2 bug 4511, soon to be fixed)
  • Fix for minor translation errors
  • Fix for the MIC interpretation of Morganellaceae (such as Morganella and Proteus) when using the EUCAST 2021 guideline
  • Improved algorithm of as.mo()
  • Improved algorithm for generating random MICs with random_mic()
  • Improved plot legends for MICs and disk diffusion values
  • Improved speed of as.ab() and all ab_*() functions
  • Added fortify() extensions for plotting methods
  • NA values of the classes <mic>, <disk> and <rsi> are now exported objects of this package, e.g. NA_mic_ is an NA of class mic (just like the base R NA_character_ is an NA of class character)
  • The proportion_df(), count_df() and rsi_df() functions now return with the additional S3 class 'rsi_df' so they can be extended by other packages
  • The mdro() function now returns NA for all rows that have no test results
  • The species_id column in the microorganisms data set now only contains LPSN record numbers. For this reason, this column is now numeric instead of a character, and mo_url() has been updated to reflect this change.
  • Fixed a small bug in the functions get_episode() and is_new_episode()
  • get_episode() and is_new_episode() can now cope with NAs

Other

  • This package is now being maintained by two epidemiologists and a data scientist from two different non-profit healthcare organisations.

v1.7.1

3 years ago

Breaking change

  • All antibiotic class selectors (such as carbapenems(), aminoglycosides()) can now be used for filtering as well, making all their accompanying filter_*() functions redundant (such as filter_carbapenems(), filter_aminoglycosides()). These functions are now deprecated and will be removed in a next release. Examples of how the selectors can be used for filtering:
    # select columns with results for carbapenems
    example_isolates[, carbapenems()]           # base R
    example_isolates %>% select(carbapenems())  # dplyr
    
    # filter rows for resistance in any carbapenem
    example_isolates[any(carbapenems() == "R"), ]                  # base R
    example_isolates %>% filter(any(carbapenems() == "R"))         # dplyr
    example_isolates %>% filter(if_any(carbapenems(), ~.x == "R")) # dplyr (formal)
    
    # filter rows for resistance in all carbapenems
    example_isolates[all(carbapenems() == "R"), ]           # base R
    example_isolates[carbapenems() == "R", ]
    example_isolates %>% filter(all(carbapenems() == "R"))  # dplyr
    example_isolates %>% filter(carbapenems() == "R")
    

New

  • Support for CLSI 2020 guideline for interpreting MICs and disk diffusion values (using as.rsi())
  • Function custom_eucast_rules() that brings support for custom AMR rules in eucast_rules()
  • Function italicise_taxonomy() to make taxonomic names within a string italic, with support for markdown and ANSI
  • Support for all four methods to determine first isolates as summarised by Hindler et al. (doi: 10.1086/511864): isolate-based, patient-based, episode-based and phenotype-based. The last method is now the default.
    • The first_isolate() function gained the argument method that has to be "phenotype-based", "episode-based", "patient-based", or "isolate-based". The old behaviour is equal to "episode-based". The new default is "phenotype-based" if antimicrobial test results are available, and "episode-based" otherwise. This new default will yield slightly more isolates for selection (which is a good thing).
    • Since fungal isolates can also be selected, the functions key_antibiotics() and key_antibiotics_equal() are now deprecated in favour of the key_antimicrobials() and antimicrobials_equal() functions. Also, the new all_antimicrobials() function works like the old key_antibiotics() function, but includes any column with antimicrobial test results. Using key_antimicrobials() still only selects six preferred antibiotics for Gram-negatives, six for Gram-positives, and six universal antibiotics. It has a new antifungal argument to set antifungal agents (antimycotics).
    • Using type == "points" in the first_isolate() function for phenotype-based selection will now consider all antimicrobial drugs in the data set, using the new all_antimicrobials()
    • The first_isolate() function can now take a vector of values for col_keyantibiotics and can have an episode length of Inf
    • Since the phenotype-based method is the new default, filter_first_isolate() renders the filter_first_weighted_isolate() function redundant. For this reason, filter_first_weighted_isolate() is now deprecated.
    • The documentation of the first_isolate() and key_antimicrobials() functions has been completely rewritten.
  • Function betalactams() as additional antbiotic column selector and function filter_betalactams() as additional antbiotic column filter. The group of betalactams consists of all carbapenems, cephalosporins and penicillins.
  • A ggplot() method for resistance_predict()

Changed

  • bug_drug_combinations() now supports grouping using the dplyr package
  • Custom MDRO guidelines (mdro(), custom_mdro_guideline()):
    • Custom MDRO guidelines can now be combined with other custom MDRO guidelines using c()
    • Fix for applying the rules; in previous versions, rows were interpreted according to the last matched rule. Now, rows are interpreted according to the first matched rule
  • Fix for age_groups() for persons aged zero
  • The example_isolates data set now contains some (fictitious) zero-year old patients
  • Fix for minor translation errors
  • Printing of microbial codes in a data.frame or tibble now gives a warning if the data contains old microbial codes (from a previous AMR package version)
  • Extended the like() functions:
    • Now checks if pattern is a valid regular expression
    • Added %unlike% and %unlike_case% (as negations of the existing %like% and %like_case%). This greatly improves readability:
      if (!grepl("EUCAST", guideline)) ...
      # same:
      if (guideline %unlike% "EUCAST") ...
      
    • Altered the RStudio addin, so it now iterates over %like% -> %unlike% -> %like_case% -> %unlike_case% if you keep pressing your keyboard shortcut
  • Fixed an installation error on R-3.0
  • Added info argument to as.mo() to turn on/off the progress bar
  • Fixed a bug where col_mo in some functions (esp. eucast_rules() and mdro()) could not be a column name of the microorganisms data set as it would throw an error
  • Fix for transforming numeric values to RSI (as.rsi()) when the vctrs package is loaded (i.e., when using tidyverse)
  • Colour fix for using barplot() on an RSI class
  • Added 25 common system codes for bacteria to the microorganisms.codes data set
  • Added 16 common system codes for antimicrobial agents to the antibiotics data set
  • Fix for using skimr::skim() on classes mo, mic and disk when using the just released dplyr v1.0.6
  • Updated skimr::skim() usage for MIC values to also include 25th and 75th percentiles
  • Fix for plotting missing MIC/disk diffusion values
  • Updated join functions to always use dplyr join functions if the dplyr package is installed - now also preserving grouped variables
  • Antibiotic class selectors (such as cephalosporins()) now maintain the column order from the original data
  • Fix for selecting columns using fluoroquinolones()
  • age() now vectorises over both x and reference

Other

  • As requested by CRAN administrators: decreased package size by 3 MB in costs of a slower loading time of the package
  • All unit tests are now processed by the tinytest package, instead of the testthat package. The testthat package unfortunately requires tons of dependencies that are also heavy and only usable for recent R versions, disallowing developers to test a package under any R 3.* version. On the contrary, the tinytest package is very lightweight and dependency-free.