diff --git a/DESCRIPTION b/DESCRIPTION index af8113f4..feef38cd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.5.0.9000 -Date: 2021-01-12 +Version: 1.5.0.9001 +Date: 2021-01-14 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index fa2afa83..f4965a7a 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,11 +1,10 @@ -# AMR 1.5.0.9000 -## Last updated: 12 January 2021 -*Note: the rules of 'EUCAST Clinical Breakpoints v11.0 (2021)' will also be added in this next release, to be expected in February/March 2021.* +# AMR 1.5.0.9001 +## Last updated: 14 January 2021 ### New * Support for EUCAST Clinical Breakpoints v11.0 (2021), effective in the `eucast_rules()` function and in `as.rsi()` to interpret MIC and disk diffusion values. This is now the default guideline in this package. -* Function `eucast_dosage()` to to get advised dosages of a certain bug-drug combination based on EUCAST dosage data * Data set `dosage` to fuel the new `eucast_dosage()` function and to make this data available in a structured way +* Function `eucast_dosage()` to get a `data.frame` with advised dosages of a certain bug-drug combination, which is based on the new `dosage` data set * Function `isolate_identifier()`, which will paste a microorganism code with all antimicrobial results of a data set into one string for each row. This is useful to compare isolates, e.g. between institutions or regions, when there is no genotyping available. * Function `mo_is_yeast()`, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales: ```r @@ -31,6 +30,7 @@ * Using functions without setting a data set (e.g., `mo_is_gram_negative()`, `mo_is_gram_positive()`, `mo_is_intrinsic_resistant()`, `first_isolate()`, `mdro()`) now work with `dplyr`s `group_by()` again * Updated the data set `microorganisms.codes` (which contains popular LIS and WHONET codes for microorganisms) for some species of *Mycobacterium* that previously incorrectly returned *M. africanum* * Added Pretomanid (PMD, J04AK08) to the `antibiotics` data set +* WHONET code `"PNV"` will now correctly be interpreted as `PHN`, the antibiotic code for phenoxymethylpenicillin ('peni V') # AMR 1.5.0 diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index afa9e53a..a0fc5811 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -479,12 +479,39 @@ meet_criteria <- function(object, stop_if(allow_NA == FALSE, "argument `", obj_name, "` must not be NA", call = call_depth) return(invisible()) } + + translate_class <- function(allow_class, plural = isTRUE(has_length > 1)) { + allow_class.bak <- allow_class + allow_class[allow_class %in% c("numeric", "double")] <- "number" + allow_class[allow_class == "integer"] <- "whole number" + if (any(c("numeric", "double") %in% allow_class.bak, na.rm = TRUE) & "integer" %in% allow_class.bak) { + allow_class[allow_class %in% c("number", "whole number")] <- "(whole) number" + } + allow_class[allow_class == "character"] <- "text string" + allow_class[allow_class %in% c("Date", "POSIXt")] <- "date" + allow_class[allow_class != allow_class.bak] <- paste0(ifelse(plural, "", "a "), + allow_class[allow_class != allow_class.bak], + ifelse(plural, "s", "")) + # exceptions + allow_class[allow_class == "logical"] <- ifelse(plural, "a vector of `TRUE`/`FALSE`", "`TRUE` or `FALSE`") + if ("data.frame" %in% allow_class) { + allow_class <- "a data set" + } + if ("list" %in% allow_class) { + allow_class <- "a list" + } + if ("matrix" %in% allow_class) { + allow_class <- "a matrix" + } + allow_class[allow_class == allow_class.bak] <- paste0("a class <", allow_class[allow_class == allow_class.bak], ">") + # output + vector_or(allow_class, quotes = FALSE) + } if (!is.null(allow_class)) { stop_ifnot(inherits(object, allow_class), "argument `", obj_name, - "` must ", # ifelse(allow_NULL, "be NULL or must ", ""), - "be of class ", vector_or(allow_class, quotes = TRUE), - ", not \"", paste(class(object), collapse = "/"), "\"", + "` must be ", translate_class(allow_class), + ", not ", translate_class(class(object)), call = call_depth) # check data.frames for data if (inherits(object, "data.frame")) { @@ -515,9 +542,8 @@ meet_criteria <- function(object, } stop_ifnot(all(object %in% is_in, na.rm = TRUE), "argument `", obj_name, "` must be ", - ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1, "one of: ", ""), - vector_or(is_in, quotes = TRUE), - ", not ", paste0("\"", object, "\"", collapse = "/"), "", + ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1, "either ", ""), + vector_or(is_in, quotes = !isTRUE(any(c("double", "numeric", "integer") %in% allow_class))), call = call_depth) } if (!is.null(contains_column_class)) { diff --git a/R/ab.R b/R/ab.R index 331893c7..65dc4949 100755 --- a/R/ab.R +++ b/R/ab.R @@ -82,6 +82,14 @@ #' # they use as.ab() internally: #' ab_name("J01FA01") # "Erythromycin" #' ab_name("eryt") # "Erythromycin" +#' +#' if (require("dplyr")) { +#' +#' # you can quickly rename columns using dplyr >= 1.0.0: +#' example_isolates %>% +#' rename_with(as.ab, where(is.rsi)) +#' +#' } as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) { meet_criteria(x, allow_class = c("character", "numeric", "integer", "factor"), allow_NA = TRUE) meet_criteria(flag_multiple_results, allow_class = "logical", has_length = 1) diff --git a/R/data.R b/R/data.R index e52f47f5..37f18c59 100755 --- a/R/data.R +++ b/R/data.R @@ -285,7 +285,7 @@ catalogue_of_life <- list( #' - `name`\cr Official name of the antimicrobial agent as used by WHONET/EARS-Net or the WHO #' - `type`\cr Type of the dosage, either `r vector_or(dosage$type)` #' - `dose`\cr Dose, such as "2 g" or "25 mg/kg" -#' - `dose_times`\cr Dose, such as "2 g" or "25 mg/kg" +#' - `dose_times`\cr Number of times a dose must be administered #' - `administration`\cr Route of administration, either `r vector_or(dosage$administration)` #' - `notes`\cr Additional dosage notes #' - `original_txt`\cr Original text in the PDF file of EUCAST diff --git a/R/eucast_rules.R b/R/eucast_rules.R index 00204a89..d5c84317 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -58,7 +58,7 @@ format_eucast_version_nr <- function(version, markdown = TRUE) { #' Apply EUCAST rules #' #' @description -#' Apply rules for clinical breakpoints and intrinsic resistance as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, ), see *Source*. Use [eucast_dosage()] to get advised dosages of a certain bug-drug combination, which is based on the [dosage] data set. +#' Apply rules for clinical breakpoints and intrinsic resistance as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, ), see *Source*. Use [eucast_dosage()] to get a [data.frame] with advised dosages of a certain bug-drug combination, which is based on the [dosage] data set. #' #' To improve the interpretation of the antibiogram before EUCAST rules are applied, some non-EUCAST rules can applied at default, see Details. #' @inheritSection lifecycle Stable lifecycle @@ -166,8 +166,8 @@ eucast_rules <- function(x, meet_criteria(info, allow_class = "logical", has_length = 1) meet_criteria(rules, allow_class = "character", has_length = c(1, 2, 3, 4), is_in = c("breakpoints", "expert", "other", "all")) meet_criteria(verbose, allow_class = "logical", has_length = 1) - meet_criteria(version_breakpoints, allow_class = "numeric", has_length = 1) - meet_criteria(version_expertrules, allow_class = "numeric", has_length = 1) + meet_criteria(version_breakpoints, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_BREAKPOINTS))) + meet_criteria(version_expertrules, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_EXPERT_RULES))) meet_criteria(ampc_cephalosporin_resistance, allow_class = c("rsi", "character"), has_length = 1, allow_NA = TRUE, allow_NULL = TRUE, is_in = c("R", "S", "I")) x_deparsed <- deparse(substitute(x)) @@ -177,12 +177,6 @@ eucast_rules <- function(x, check_dataset_integrity() - version_breakpoints <- as.double(gsub("[^0-9.]+", "", version_breakpoints)) - version_expertrules <- as.double(gsub("[^0-9.]+", "", version_expertrules)) - stop_ifnot(version_breakpoints %in% as.double(names(EUCAST_VERSION_BREAKPOINTS)), - "EUCAST version ", version_breakpoints, " for clinical breakpoints not found") - stop_ifnot(version_expertrules %in% as.double(names(EUCAST_VERSION_EXPERT_RULES)), - "EUCAST version ", version_expertrules, " for expert rules/intrinsic resistance not found") breakpoints_info <- EUCAST_VERSION_BREAKPOINTS[[which(as.double(names(EUCAST_VERSION_BREAKPOINTS)) == version_breakpoints)]] expertrules_info <- EUCAST_VERSION_EXPERT_RULES[[which(as.double(names(EUCAST_VERSION_EXPERT_RULES)) == version_expertrules)]] @@ -1180,6 +1174,10 @@ edit_rsi <- function(x, #' @rdname eucast_rules #' @export eucast_dosage <- function(ab, administration = "iv", version_breakpoints = 11.0) { + meet_criteria(ab, allow_class = c("character", "numeric", "integer", "factor")) + meet_criteria(administration, allow_class = "character", is_in = dosage$administration[!is.na(dosage$administration)]) + meet_criteria(version_breakpoints, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_BREAKPOINTS))) + # show used version_breakpoints number once per session (pkg_env will reload every session) if (message_not_thrown_before(paste0("eucast_dosage_v", gsub("[^0-9]", "", version_breakpoints)), entire_session = TRUE)) { message_("Dosages for antimicrobial drugs, as meant for ", @@ -1187,15 +1185,11 @@ eucast_dosage <- function(ab, administration = "iv", version_breakpoints = 11.0) font_red("This note will be shown once per session.")) remember_thrown_message(paste0("eucast_dosage_v", gsub("[^0-9]", "", version_breakpoints)), entire_session = TRUE) } + ab <- as.ab(ab) - out <- character(length(ab)) - for (i in seq_len(length(ab))) { - df <- data.frame(ab = ab[i], stringsAsFactors = FALSE, administration = administration) %pm>% - pm_inner_join(AMR::dosage, by = c("ab", "administration")) %pm>% - pm_mutate(txt = paste0(gsub("_", " ", type), ": ", dose_times, "x ", dose, " ", administration), perl = TRUE) - out[i] <- paste(df$txt, collapse = ", ") - } - names(out) <- ab_name(ab, language = NULL) - out[out == ""] <- NA_character_ - out + df <- AMR::dosage[which(AMR::dosage$ab %in% ab & AMR::dosage$administration %in% administration), , drop = FALSE] + df <- df[match(ab, df$ab), colnames(df)[colnames(df) != "administration"], drop = FALSE] + rownames(df) <- NULL + df$ab <- ab + df } diff --git a/R/globals.R b/R/globals.R index bc7fc2e0..80dea18a 100755 --- a/R/globals.R +++ b/R/globals.R @@ -33,6 +33,8 @@ globalVariables(c(".rowid", "atc_group2", "code", "data", + "dose", + "dose_times", "fullname", "fullname_lower", "g_species", @@ -73,6 +75,7 @@ globalVariables(c(".rowid", "species_id", "total", "txt", + "type", "value", "varname", "xvar", diff --git a/data-raw/AMR_1.5.0.9000.tar.gz b/data-raw/AMR_1.5.0.9001.tar.gz similarity index 81% rename from data-raw/AMR_1.5.0.9000.tar.gz rename to data-raw/AMR_1.5.0.9001.tar.gz index 0217ff26..603157da 100644 Binary files a/data-raw/AMR_1.5.0.9000.tar.gz and b/data-raw/AMR_1.5.0.9001.tar.gz differ diff --git a/data-raw/reproduction_of_eucast_dosage.R b/data-raw/reproduction_of_dosage.R similarity index 98% rename from data-raw/reproduction_of_eucast_dosage.R rename to data-raw/reproduction_of_dosage.R index 62a8eeab..ae921e47 100644 --- a/data-raw/reproduction_of_eucast_dosage.R +++ b/data-raw/reproduction_of_dosage.R @@ -123,7 +123,8 @@ dosage <- bind_rows( original_txt = sapply(uti, function(x) x$original_txt), stringsAsFactors = FALSE )) %>% - mutate(eucast_version = breakpoints_version) %>% + mutate(eucast_version = breakpoints_version, + dose_times = as.integer(dose_times)) %>% arrange(name, administration, type) %>% filter(!is.na(dose), dose != ".") diff --git a/data/dosage.rda b/data/dosage.rda index 934c3496..a8a94230 100644 Binary files a/data/dosage.rda and b/data/dosage.rda differ diff --git a/docs/404.html b/docs/404.html index 34eaa2e8..1d2bbd3c 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9000 + 1.5.0.9001 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 4365f2d3..cb5ebf95 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9000 + 1.5.0.9001 diff --git a/docs/articles/index.html b/docs/articles/index.html index 342a7e77..6a1fd7fc 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9000 + 1.5.0.9001 diff --git a/docs/authors.html b/docs/authors.html index 46f017c3..c0aa89dd 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9000 + 1.5.0.9001 diff --git a/docs/index.html b/docs/index.html index f9c20886..f66dcfe8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.5.0.9000 + 1.5.0.9001 diff --git a/docs/news/index.html b/docs/news/index.html index 703d0672..7e4e3dcd 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9000 + 1.5.0.9001 @@ -236,22 +236,21 @@ Source: NEWS.md -
-

-AMR 1.5.0.9000 Unreleased +
+

+AMR 1.5.0.9001 Unreleased

-
+

-Last updated: 12 January 2021 +Last updated: 14 January 2021

-

Note: the rules of ‘EUCAST Clinical Breakpoints v11.0 (2021)’ will also be added in this next release, to be expected in February/March 2021.

New

  • Support for EUCAST Clinical Breakpoints v11.0 (2021), effective in the eucast_rules() function and in as.rsi() to interpret MIC and disk diffusion values. This is now the default guideline in this package.

  • -
  • Function eucast_dosage() to to get advised dosages of a certain bug-drug combination based on EUCAST dosage data

  • Data set dosage to fuel the new eucast_dosage() function and to make this data available in a structured way

  • +
  • Function eucast_dosage() to get a data.frame with advised dosages of a certain bug-drug combination, which is based on the new dosage data set

  • Function isolate_identifier(), which will paste a microorganism code with all antimicrobial results of a data set into one string for each row. This is useful to compare isolates, e.g. between institutions or regions, when there is no genotyping available.

  • Function mo_is_yeast(), which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:

    @@ -284,6 +283,7 @@
  • Updated the data set microorganisms.codes (which contains popular LIS and WHONET codes for microorganisms) for some species of Mycobacterium that previously incorrectly returned M. africanum
  • Added Pretomanid (PMD, J04AK08) to the antibiotics data set
  • +
  • WHONET code "PNV" will now correctly be interpreted as PHN, the antibiotic code for phenoxymethylpenicillin (‘peni V’)
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index da1bab7c..9c347240 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -12,7 +12,7 @@ articles: datasets: datasets.html resistance_predict: resistance_predict.html welcome_to_AMR: welcome_to_AMR.html -last_built: 2021-01-12T21:06Z +last_built: 2021-01-14T13:26Z urls: reference: https://msberends.github.io/AMR//reference article: https://msberends.github.io/AMR//articles diff --git a/docs/reference/as.ab.html b/docs/reference/as.ab.html index 3181dbd9..520908ef 100644 --- a/docs/reference/as.ab.html +++ b/docs/reference/as.ab.html @@ -82,7 +82,7 @@ AMR (for R) - 1.5.0 + 1.5.0.9001
@@ -347,6 +347,14 @@ This package contains all ~550 antibiotic, antimycotic and antiviral dru # they use as.ab() internally: ab_name("J01FA01") # "Erythromycin" ab_name("eryt") # "Erythromycin" + +if (require("dplyr")) { + + # you can quickly rename <rsi> columns using dplyr >= 1.0.0: + example_isolates %>% + rename_with(as.ab, where(is.rsi)) + +}
@@ -363,7 +363,7 @@

Supported guidelines

-

For interpreting MIC values as well as disk diffusion diameters, supported guidelines to be used as input for the guideline argument are: "CLSI 2010", "CLSI 2011", "CLSI 2012", "CLSI 2013", "CLSI 2014", "CLSI 2015", "CLSI 2016", "CLSI 2017", "CLSI 2018", "CLSI 2019", "EUCAST 2011", "EUCAST 2012", "EUCAST 2013", "EUCAST 2014", "EUCAST 2015", "EUCAST 2016", "EUCAST 2017", "EUCAST 2018", "EUCAST 2019", "EUCAST 2020".

+

For interpreting MIC values as well as disk diffusion diameters, supported guidelines to be used as input for the guideline argument are: "CLSI 2010", "CLSI 2011", "CLSI 2012", "CLSI 2013", "CLSI 2014", "CLSI 2015", "CLSI 2016", "CLSI 2017", "CLSI 2018", "CLSI 2019", "EUCAST 2011", "EUCAST 2012", "EUCAST 2013", "EUCAST 2014", "EUCAST 2015", "EUCAST 2016", "EUCAST 2017", "EUCAST 2018", "EUCAST 2019", "EUCAST 2020", "EUCAST 2021".

Simply using "CLSI" or "EUCAST" as input will automatically select the latest version of that guideline. You can set your own data set using the reference_data argument. The guideline argument will then be ignored.

After interpretation

@@ -374,7 +374,7 @@

Machine readable interpretation guidelines

-

The repository of this package contains a machine readable version of all guidelines. This is a CSV file consisting of 18,650 rows and 10 columns. This file is machine readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial agent and the microorganism. This allows for easy implementation of these rules in laboratory information systems (LIS). Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.

+

The repository of this package contains a machine readable version of all guidelines. This is a CSV file consisting of 20,486 rows and 10 columns. This file is machine readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial agent and the microorganism. This allows for easy implementation of these rules in laboratory information systems (LIS). Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.

Other

diff --git a/docs/reference/dosage.html b/docs/reference/dosage.html index c5dcdd60..1a3b9749 100644 --- a/docs/reference/dosage.html +++ b/docs/reference/dosage.html @@ -82,7 +82,7 @@ AMR (for R) - 1.5.0 + 1.5.0.9001

@@ -252,7 +252,7 @@
  • name
    Official name of the antimicrobial agent as used by WHONET/EARS-Net or the WHO

  • type
    Type of the dosage, either "high_dosage", "standard_dosage" or "uncomplicated_uti"

  • dose
    Dose, such as "2 g" or "25 mg/kg"

  • -
  • dose_times
    Dose, such as "2 g" or "25 mg/kg"

  • +
  • dose_times
    Number of times a dose must be administered

  • administration
    Route of administration, either "im", "iv" or "oral"

  • notes
    Additional dosage notes

  • original_txt
    Original text in the PDF file of EUCAST

  • diff --git a/docs/reference/eucast_rules.html b/docs/reference/eucast_rules.html index 65de1adf..e2964d66 100644 --- a/docs/reference/eucast_rules.html +++ b/docs/reference/eucast_rules.html @@ -49,7 +49,7 @@ - @@ -83,7 +83,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied AMR (for R) - 1.5.0 + 1.5.0.9001 @@ -240,7 +240,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
    -

    Apply rules for clinical breakpoints and intrinsic resistance as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, https://eucast.org), see Source. Use eucast_dosage() to get advised dosages of a certain bug-drug combination, which is based on the dosage data set.

    +

    Apply rules for clinical breakpoints and intrinsic resistance as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, https://eucast.org), see Source. Use eucast_dosage() to get a data.frame with advised dosages of a certain bug-drug combination, which is based on the dosage data set.

    To improve the interpretation of the antibiogram before EUCAST rules are applied, some non-EUCAST rules can applied at default, see Details.

    @@ -250,7 +250,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied info = interactive(), rules = getOption("AMR_eucastrules", default = c("breakpoints", "expert")), verbose = FALSE, - version_breakpoints = 10, + version_breakpoints = 11, version_expertrules = 3.2, ampc_cephalosporin_resistance = NA, ... @@ -283,11 +283,11 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied version_breakpoints -

    the version number to use for the EUCAST Clinical Breakpoints guideline. Currently supported: 11.0, 10.0.

    +

    the version number to use for the EUCAST Clinical Breakpoints guideline. Can be either "11.0" or "10.0".

    version_expertrules -

    the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Currently supported: 3.1, 3.2.

    +

    the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either "3.2" or "3.1".

    ampc_cephalosporin_resistance diff --git a/docs/reference/index.html b/docs/reference/index.html index 9d27a35c..016f26f5 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9000 + 1.5.0.9001 diff --git a/docs/reference/rsi_translation.html b/docs/reference/rsi_translation.html index 88e33ad2..ad2f3fb7 100644 --- a/docs/reference/rsi_translation.html +++ b/docs/reference/rsi_translation.html @@ -49,7 +49,7 @@ - + @@ -82,7 +82,7 @@ AMR (for R) - 1.5.0 + 1.5.0.9001 @@ -239,7 +239,7 @@
    -

    Data set to interpret MIC and disk diffusion to R/SI values. Included guidelines are CLSI (2010-2019) and EUCAST (2011-2020). Use as.rsi() to transform MICs or disks measurements to R/SI values.

    +

    Data set to interpret MIC and disk diffusion to R/SI values. Included guidelines are CLSI (2010-2019) and EUCAST (2011-2021). Use as.rsi() to transform MICs or disks measurements to R/SI values.

    rsi_translation
    @@ -247,7 +247,7 @@

    Format

    -

    A data.frame with 18,650 observations and 10 variables:

      +

      A data.frame with 20,486 observations and 10 variables:

      • guideline
        Name of the guideline

      • method
        Either "MIC" or "DISK"

      • site
        Body site, e.g. "Oral" or "Respiratory"

      • diff --git a/docs/survey.html b/docs/survey.html index f2a16b68..5aa15de9 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9000 + 1.5.0.9001 diff --git a/man/as.ab.Rd b/man/as.ab.Rd index cde77591..0e9967aa 100644 --- a/man/as.ab.Rd +++ b/man/as.ab.Rd @@ -102,6 +102,14 @@ ab_atc("seephthriaaksone") # and even this works # they use as.ab() internally: ab_name("J01FA01") # "Erythromycin" ab_name("eryt") # "Erythromycin" + +if (require("dplyr")) { + + # you can quickly rename columns using dplyr >= 1.0.0: + example_isolates \%>\% + rename_with(as.ab, where(is.rsi)) + +} } \seealso{ \itemize{ diff --git a/man/as.rsi.Rd b/man/as.rsi.Rd index 6a25518b..a75d4638 100755 --- a/man/as.rsi.Rd +++ b/man/as.rsi.Rd @@ -104,7 +104,7 @@ your_data \%>\% mutate(across(where(is.disk), as.rsi)) # since dplyr 1.0.0 \subsection{Supported guidelines}{ -For interpreting MIC values as well as disk diffusion diameters, supported guidelines to be used as input for the \code{guideline} argument are: "CLSI 2010", "CLSI 2011", "CLSI 2012", "CLSI 2013", "CLSI 2014", "CLSI 2015", "CLSI 2016", "CLSI 2017", "CLSI 2018", "CLSI 2019", "EUCAST 2011", "EUCAST 2012", "EUCAST 2013", "EUCAST 2014", "EUCAST 2015", "EUCAST 2016", "EUCAST 2017", "EUCAST 2018", "EUCAST 2019", "EUCAST 2020". +For interpreting MIC values as well as disk diffusion diameters, supported guidelines to be used as input for the \code{guideline} argument are: "CLSI 2010", "CLSI 2011", "CLSI 2012", "CLSI 2013", "CLSI 2014", "CLSI 2015", "CLSI 2016", "CLSI 2017", "CLSI 2018", "CLSI 2019", "EUCAST 2011", "EUCAST 2012", "EUCAST 2013", "EUCAST 2014", "EUCAST 2015", "EUCAST 2016", "EUCAST 2017", "EUCAST 2018", "EUCAST 2019", "EUCAST 2020", "EUCAST 2021". Simply using \code{"CLSI"} or \code{"EUCAST"} as input will automatically select the latest version of that guideline. You can set your own data set using the \code{reference_data} argument. The \code{guideline} argument will then be ignored. } @@ -116,7 +116,7 @@ After using \code{\link[=as.rsi]{as.rsi()}}, you can use the \code{\link[=eucast \subsection{Machine readable interpretation guidelines}{ -The repository of this package \href{https://github.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt}{contains a machine readable version} of all guidelines. This is a CSV file consisting of 18,650 rows and 10 columns. This file is machine readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial agent and the microorganism. \strong{This allows for easy implementation of these rules in laboratory information systems (LIS)}. Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed. +The repository of this package \href{https://github.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt}{contains a machine readable version} of all guidelines. This is a CSV file consisting of 20,486 rows and 10 columns. This file is machine readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial agent and the microorganism. \strong{This allows for easy implementation of these rules in laboratory information systems (LIS)}. Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed. } \subsection{Other}{ diff --git a/man/dosage.Rd b/man/dosage.Rd index d449286a..cf3f1929 100644 --- a/man/dosage.Rd +++ b/man/dosage.Rd @@ -11,7 +11,7 @@ A \link{data.frame} with 135 observations and 9 variables: \item \code{name}\cr Official name of the antimicrobial agent 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" -\item \code{dose_times}\cr Dose, such as "2 g" or "25 mg/kg" +\item \code{dose_times}\cr Number of times a dose must be administered \item \code{administration}\cr Route of administration, either "im", "iv" or "oral" \item \code{notes}\cr Additional dosage notes \item \code{original_txt}\cr Original text in the PDF file of EUCAST diff --git a/man/eucast_rules.Rd b/man/eucast_rules.Rd index dd678db0..2aa95b7b 100644 --- a/man/eucast_rules.Rd +++ b/man/eucast_rules.Rd @@ -23,7 +23,7 @@ eucast_rules( info = interactive(), rules = getOption("AMR_eucastrules", default = c("breakpoints", "expert")), verbose = FALSE, - version_breakpoints = 10, + version_breakpoints = 11, version_expertrules = 3.2, ampc_cephalosporin_resistance = NA, ... @@ -42,9 +42,9 @@ eucast_dosage(ab, administration = "iv", version_breakpoints = 11) \item{verbose}{a \link{logical} to turn Verbose mode on and off (default is off). In Verbose mode, the function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way. Using Verbose mode takes a lot more time.} -\item{version_breakpoints}{the version number to use for the EUCAST Clinical Breakpoints guideline. Currently supported: 11.0, 10.0.} +\item{version_breakpoints}{the version number to use for the EUCAST Clinical Breakpoints guideline. Can be either "11.0" or "10.0".} -\item{version_expertrules}{the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Currently supported: 3.1, 3.2.} +\item{version_expertrules}{the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either "3.2" or "3.1".} \item{ampc_cephalosporin_resistance}{a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to \code{NA}. Currently only works when \code{version_expertrules} is \code{3.2}; '\emph{EUCAST Expert Rules v3.2 on Enterobacterales}' states that susceptible (S) results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of \code{NA} for this argument will remove results for these agents, while e.g. a value of \code{"R"} will make the results for these agents resistant. Use \code{NULL} to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. \cr For \emph{EUCAST Expert Rules} v3.2, this rule applies to: \emph{Enterobacter, Klebsiella aerogenes, Citrobacter braakii, freundii, gillenii, murliniae, rodenticum, sedlakii, werkmanii, youngae, Hafnia alvei, Serratia, Morganella morganii, Providencia}.} @@ -58,7 +58,7 @@ eucast_dosage(ab, administration = "iv", version_breakpoints = 11) 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. } \description{ -Apply rules for clinical breakpoints and intrinsic resistance as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, \url{https://eucast.org}), see \emph{Source}. Use \code{\link[=eucast_dosage]{eucast_dosage()}} to get advised dosages of a certain bug-drug combination, which is based on the \link{dosage} data set. +Apply rules for clinical breakpoints and intrinsic resistance as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, \url{https://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. To improve the interpretation of the antibiogram before EUCAST rules are applied, some non-EUCAST rules can applied at default, see Details. } diff --git a/man/rsi_translation.Rd b/man/rsi_translation.Rd index fdce5d4c..d3750be0 100644 --- a/man/rsi_translation.Rd +++ b/man/rsi_translation.Rd @@ -5,7 +5,7 @@ \alias{rsi_translation} \title{Data set for R/SI interpretation} \format{ -A \link{data.frame} with 18,650 observations and 10 variables: +A \link{data.frame} with 20,486 observations and 10 variables: \itemize{ \item \code{guideline}\cr Name of the guideline \item \code{method}\cr Either "MIC" or "DISK" @@ -23,7 +23,7 @@ A \link{data.frame} with 18,650 observations and 10 variables: rsi_translation } \description{ -Data set to interpret MIC and disk diffusion to R/SI values. Included guidelines are CLSI (2010-2019) and EUCAST (2011-2020). Use \code{\link[=as.rsi]{as.rsi()}} to transform MICs or disks measurements to R/SI values. +Data set to interpret MIC and disk diffusion to R/SI values. Included guidelines are CLSI (2010-2019) and EUCAST (2011-2021). Use \code{\link[=as.rsi]{as.rsi()}} to transform MICs or disks measurements to R/SI values. } \details{ The repository of this \code{AMR} package contains a file comprising this exact data set: \url{https://github.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt}. This file \strong{allows for machine reading EUCAST and CLSI guidelines}, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. The file is updated automatically. diff --git a/tests/testthat/test-eucast_rules.R b/tests/testthat/test-eucast_rules.R index 55d74f98..84f46e09 100755 --- a/tests/testthat/test-eucast_rules.R +++ b/tests/testthat/test-eucast_rules.R @@ -138,4 +138,8 @@ test_that("EUCAST rules work", { info = FALSE)$cefotax, as.rsi(c("S", "S"))) + # EUCAST dosage ----------------------------------------------------------- + expect_equal(nrow(eucast_dosage(c("tobra", "genta", "cipro"))), 3) + expect_s3_class(eucast_dosage(c("tobra", "genta", "cipro")), "data.frame") + })