With the function mdro(), you can determine which micro-organisms are multi-drug resistant organisms (MDRO).

Type of input

The mdro() function takes a data set as input, such as a regular data.frame. It tries to automatically determine the right columns for info about your isolates, such as the name of the species and all columns with results of antimicrobial agents. See the help page for more info about how to set the right settings for your data with the command ?mdro.

For WHONET data (and most other data), all settings are automatically set correctly.

Guidelines

The mdro() function support multiple guidelines. You can select a guideline with the guideline parameter. Currently supported guidelines are (case-insensitive):

  • guideline = "CMI2012" (default)

    Magiorakos AP, Srinivasan A et al. “Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance.” Clinical Microbiology and Infection (2012) (link)

  • guideline = "EUCAST3.2" (or simply guideline = "EUCAST")

    The European international guideline - EUCAST Expert Rules Version 3.2 “Intrinsic Resistance and Unusual Phenotypes” (link)

  • guideline = "EUCAST3.1"

    The European international guideline - EUCAST Expert Rules Version 3.1 “Intrinsic Resistance and Exceptional Phenotypes Tables” (link)

  • guideline = "TB"

    The international guideline for multi-drug resistant tuberculosis - World Health Organization “Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis” (link)

  • guideline = "MRGN"

    The German national guideline - Mueller et al. (2015) Antimicrobial Resistance and Infection Control 4:7. DOI: 10.1186/s13756-015-0047-6

  • guideline = "BRMO"

    The Dutch national guideline - Rijksinstituut voor Volksgezondheid en Milieu “WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) (ZKH)” (link)

Please suggest your own (country-specific) guidelines by letting us know: https://github.com/msberends/AMR/issues/new.

Custom Guidelines

You can also use your own custom guideline. Custom guidelines can be set with the custom_mdro_guideline() function. This is of great importance if you have custom rules to determine MDROs in your hospital, e.g., rules that are dependent on ward, state of contact isolation or other variables in your data.

If you are familiar with case_when() of the dplyr package, you will recognise the input method to set your own rules. Rules must be set using what R considers to be the ‘formula notation’:

custom <- custom_mdro_guideline(CIP == "R" & age > 60 ~ "Elderly Type A",
                                ERY == "R" & age > 60 ~ "Elderly Type B")

If a row/an isolate matches the first rule, the value after the first ~ (in this case ‘Elderly Type A’) will be set as MDRO value. Otherwise, the second rule will be tried and so on. The maximum number of rules is unlimited.

You can print the rules set in the console for an overview. Colours will help reading it if your console supports colours.

custom
# A set of custom MDRO rules:
#   1. If CIP is "R" and age is higher than 60 then: Elderly Type A
#   2. If ERY is "R" and age is higher than 60 then: Elderly Type B
#   3. Otherwise: Negative
# 
# Unmatched rows will return NA.
# Results will be of class <factor>, with ordered levels: Negative < Elderly Type A < Elderly Type B

The outcome of the function can be used for the guideline argument in the mdro() function:

x <- mdro(example_isolates, guideline = custom)
# Determining MDROs based on custom rules, resulting in factor levels:
# Negative < Elderly Type A < Elderly Type B.
# - Custom MDRO rule 1: `CIP == "R" & age > 60` (198 rows matched)
# - Custom MDRO rule 2: `ERY == "R" & age > 60` (732 rows matched)
table(x)
# x
#       Negative Elderly Type A Elderly Type B 
#           1070            198            732

The rules set (the custom object in this case) could be exported to a shared file location using saveRDS() if you collaborate with multiple users. The custom rules set could then be imported using readRDS().

Examples

The mdro() function always returns an ordered factor for predefined guidelines. For example, the output of the default guideline by Magiorakos et al. returns a factor with levels ‘Negative’, ‘MDR’, ‘XDR’ or ‘PDR’ in that order.

The next example uses the example_isolates data set. This is a data set included with this package and contains full antibiograms of 2,000 microbial isolates. It reflects reality and can be used to practise AMR data analysis. If we test the MDR/XDR/PDR guideline on this data set, we get:

library(dplyr)   # to support pipes: %>%
library(cleaner) # to create frequency tables
example_isolates %>% 
  mdro() %>% 
  freq() # show frequency table of the result
# ℹ Using column 'mo' as input for `col_mo`.
# Auto-guessing columns suitable for analysis... OK.
# ℹ Reliability would be improved if these antimicrobial results would be
#   available too: ampicillin/sulbactam (SAM), aztreonam (ATM), cefotetan
#   (CTT), ceftaroline (CPT), daptomycin (DAP), doripenem (DOR), ertapenem
#   (ETP), fusidic acid (FUS), gentamicin-high (GEH), levofloxacin (LVX),
#   minocycline (MNO), netilmicin (NET), polymyxin B (PLB),
#   quinupristin/dalfopristin (QDA), streptomycin-high (STH), telavancin (TLV)
#   and ticarcillin/clavulanic acid (TCC)
# Table 1 - Staphylococcus aureus... OK.
# Table 2 - Enterococcus spp.... OK.
# Table 3 - Enterobacteriaceae... OK.
# Table 4 - Pseudomonas aeruginosa... OK.
# Table 5 - Acinetobacter spp.... OK.
# Warning: in `mdro()`: NA introduced for isolates where the available percentage of
# antimicrobial classes was below 50% (set with `pct_required_classes`)

Only results with ‘R’ are considered as resistance. Use combine_SI = FALSE to also consider ‘I’ as resistance.

Determining multidrug-resistant organisms (MDRO), according to: Guideline: Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance. Author(s): Magiorakos AP, Srinivasan A, Carey RB, …, Vatopoulos A, Weber JT, Monnet DL Source: Clinical Microbiology and Infection 18:3, 2012; doi: 10.1111/j.1469-0691.2011.03570.x

(16 isolates had no test results)

Frequency table

Class: factor > ordered (numeric)
Length: 2,000
Levels: 4: Negative < Multi-drug-resistant (MDR) < Extensively drug-resistant …
Available: 1,729 (86.45%, NA: 271 = 13.55%)
Unique: 2

Item Count Percent Cum. Count Cum. Percent
1 Negative 1601 92.6% 1601 92.6%
2 Multi-drug-resistant (MDR) 128 7.4% 1729 100.0%

For another example, I will create a data set to determine multi-drug resistant TB:

# random_rsi() is a helper function to generate
# a random vector with values S, I and R
my_TB_data <- data.frame(rifampicin = random_rsi(5000),
                         isoniazid = random_rsi(5000),
                         gatifloxacin = random_rsi(5000),
                         ethambutol = random_rsi(5000),
                         pyrazinamide = random_rsi(5000),
                         moxifloxacin = random_rsi(5000),
                         kanamycin = random_rsi(5000))

Because all column names are automatically verified for valid drug names or codes, this would have worked exactly the same way:

my_TB_data <- data.frame(RIF = random_rsi(5000),
                         INH = random_rsi(5000),
                         GAT = random_rsi(5000),
                         ETH = random_rsi(5000),
                         PZA = random_rsi(5000),
                         MFX = random_rsi(5000),
                         KAN = random_rsi(5000))

The data set now looks like this:

head(my_TB_data)
#   rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin
# 1          R         I            R          R            I            S
# 2          I         I            S          S            R            S
# 3          I         S            R          R            S            R
# 4          R         I            S          R            R            I
# 5          R         I            I          I            R            I
# 6          R         I            R          S            R            I
#   kanamycin
# 1         R
# 2         R
# 3         S
# 4         I
# 5         I
# 6         R

We can now add the interpretation of MDR-TB to our data set. You can use:

mdro(my_TB_data, guideline = "TB")

or its shortcut mdr_tb():

my_TB_data$mdr <- mdr_tb(my_TB_data)
# ℹ No column found as input for `col_mo`, assuming all rows contain
#   Mycobacterium tuberculosis.
# Auto-guessing columns suitable for analysis... OK.
# ℹ Reliability would be improved if these antimicrobial results would be
#   available too: capreomycin (CAP), rifabutin (RIB) and rifapentine (RFP)
# 
# Only results with 'R' are considered as resistance. Use `combine_SI = FALSE` to also consider 'I' as resistance.
# 
# Determining multidrug-resistant organisms (MDRO), according to:
# Guideline: Companion handbook to the WHO guidelines for the programmatic
#            management of drug-resistant tuberculosis
# Author(s): WHO (World Health Organization)
# Version:   WHO/HTM/TB/2014.11, 2014
# Source:    https://www.who.int/publications/i/item/9789241548809

Create a frequency table of the results:

freq(my_TB_data$mdr)

Frequency table

Class: factor > ordered (numeric)
Length: 5,000
Levels: 5: Negative < Mono-resistant < Poly-resistant < Multi-drug-resistant <…
Available: 5,000 (100%, NA: 0 = 0%)
Unique: 5

Item Count Percent Cum. Count Cum. Percent
1 Mono-resistant 3218 64.36% 3218 64.36%
2 Negative 979 19.58% 4197 83.94%
3 Multi-drug-resistant 458 9.16% 4655 93.10%
4 Poly-resistant 237 4.74% 4892 97.84%
5 Extensively drug-resistant 108 2.16% 5000 100.00%