(v1.5.0.9001) more informative argument errors

v1.8.2
parent d014955ce0
commit bc00470dca
  1. 4
      DESCRIPTION
  2. 8
      NEWS.md
  3. 38
      R/aa_helper_functions.R
  4. 8
      R/ab.R
  5. 2
      R/data.R
  6. 32
      R/eucast_rules.R
  7. 3
      R/globals.R
  8. BIN
      data-raw/AMR_1.5.0.9001.tar.gz
  9. 3
      data-raw/reproduction_of_dosage.R
  10. BIN
      data/dosage.rda
  11. 2
      docs/404.html
  12. 2
      docs/LICENSE-text.html
  13. 2
      docs/articles/index.html
  14. 2
      docs/authors.html
  15. 2
      docs/index.html
  16. 16
      docs/news/index.html
  17. 2
      docs/pkgdown.yml
  18. 10
      docs/reference/as.ab.html
  19. 6
      docs/reference/as.rsi.html
  20. 4
      docs/reference/dosage.html
  21. 12
      docs/reference/eucast_rules.html
  22. 2
      docs/reference/index.html
  23. 8
      docs/reference/rsi_translation.html
  24. 2
      docs/survey.html
  25. 8
      man/as.ab.Rd
  26. 4
      man/as.rsi.Rd
  27. 2
      man/dosage.Rd
  28. 8
      man/eucast_rules.Rd
  29. 4
      man/rsi_translation.Rd
  30. 4
      tests/testthat/test-eucast_rules.R

@ -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"),

@ -1,11 +1,10 @@
# AMR 1.5.0.9000
## <small>Last updated: 12 January 2021</small>
*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
## <small>Last updated: 14 January 2021</small>
### 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

@ -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)) {

@ -82,6 +82,14 @@
#' # 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))
#'
#' }
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)

@ -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

@ -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, <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.
#' @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
}

@ -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",

@ -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 != ".")

Binary file not shown.

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9000</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9000</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9000</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9000</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>

@ -43,7 +43,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9000</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9000</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>
@ -236,22 +236,21 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="amr-1509000" class="section level1">
<h1 class="page-header" data-toc-text="1.5.0.9000">
<a href="#amr-1509000" class="anchor"></a>AMR 1.5.0.9000<small> Unreleased </small>
<div id="amr-1509001" class="section level1">
<h1 class="page-header" data-toc-text="1.5.0.9001">
<a href="#amr-1509001" class="anchor"></a>AMR 1.5.0.9001<small> Unreleased </small>
</h1>
<div id="last-updated-12-january-2021" class="section level2">
<div id="last-updated-14-january-2021" class="section level2">
<h2 class="hasAnchor">
<a href="#last-updated-12-january-2021" class="anchor"></a><small>Last updated: 12 January 2021</small>
<a href="#last-updated-14-january-2021" class="anchor"></a><small>Last updated: 14 January 2021</small>
</h2>
<p><em>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.</em></p>
<div id="new" class="section level3">
<h3 class="hasAnchor">
<a href="#new" class="anchor"></a>New</h3>
<ul>
<li><p>Support for EUCAST Clinical Breakpoints v11.0 (2021), effective in the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function and in <code><a href="../reference/as.rsi.html">as.rsi()</a></code> to interpret MIC and disk diffusion values. This is now the default guideline in this package.</p></li>
<li><p>Function <code><a href="../reference/eucast_rules.html">eucast_dosage()</a></code> to to get advised dosages of a certain bug-drug combination based on EUCAST dosage data</p></li>
<li><p>Data set <code>dosage</code> to fuel the new <code><a href="../reference/eucast_rules.html">eucast_dosage()</a></code> function and to make this data available in a structured way</p></li>
<li><p>Function <code><a href="../reference/eucast_rules.html">eucast_dosage()</a></code> to get a <code>data.frame</code> with advised dosages of a certain bug-drug combination, which is based on the new <code>dosage</code> data set</p></li>
<li><p>Function <code><a href="../reference/isolate_identifier.html">isolate_identifier()</a></code>, 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.</p></li>
<li>
<p>Function <code><a href="../reference/mo_property.html">mo_is_yeast()</a></code>, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:</p>
@ -284,6 +283,7 @@
<li>Updated the data set <code>microorganisms.codes</code> (which contains popular LIS and WHONET codes for microorganisms) for some species of <em>Mycobacterium</em> that previously incorrectly returned <em>M. africanum</em>
</li>
<li>Added Pretomanid (PMD, J04AK08) to the <code>antibiotics</code> data set</li>
<li>WHONET code <code>"PNV"</code> will now correctly be interpreted as <code>PHN</code>, the antibiotic code for phenoxymethylpenicillin (‘peni V’)</li>
</ul>
</div>
</div>

@ -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

@ -82,7 +82,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>
@ -347,6 +347,14 @@ This package contains <strong>all ~550 antibiotic, antimycotic and antiviral dru
<span class='co'># they use as.ab() internally:</span>
<span class='fu'><a href='ab_property.html'>ab_name</a></span><span class='op'>(</span><span class='st'>"J01FA01"</span><span class='op'>)</span> <span class='co'># "Erythromycin"</span>
<span class='fu'><a href='ab_property.html'>ab_name</a></span><span class='op'>(</span><span class='st'>"eryt"</span><span class='op'>)</span> <span class='co'># "Erythromycin"</span>
<span class='kw'>if</span> <span class='op'>(</span><span class='kw'><a href='https://rdrr.io/r/base/library.html'>require</a></span><span class='op'>(</span><span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span><span class='op'>)</span><span class='op'>)</span> <span class='op'>{</span>
<span class='co'># you can quickly rename &lt;rsi&gt; columns using dplyr &gt;= 1.0.0:</span>
<span class='va'>example_isolates</span> <span class='op'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/rename.html'>rename_with</a></span><span class='op'>(</span><span class='va'>as.ab</span>, <span class='fu'>where</span><span class='op'>(</span><span class='va'>is.rsi</span><span class='op'>)</span><span class='op'>)</span>
<span class='op'>}</span>
</pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">

@ -82,7 +82,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>
@ -363,7 +363,7 @@
<h3 class='hasAnchor' id='arguments'><a class='anchor' href='#arguments'></a>Supported guidelines</h3>
<p>For interpreting MIC values as well as disk diffusion diameters, supported guidelines to be used as input for the <code>guideline</code> 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".</p>
<p>For interpreting MIC values as well as disk diffusion diameters, supported guidelines to be used as input for the <code>guideline</code> 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".</p>
<p>Simply using <code>"CLSI"</code> or <code>"EUCAST"</code> as input will automatically select the latest version of that guideline. You can set your own data set using the <code>reference_data</code> argument. The <code>guideline</code> argument will then be ignored.</p>
<h3 class='hasAnchor' id='arguments'><a class='anchor' href='#arguments'></a>After interpretation</h3>
@ -374,7 +374,7 @@
<h3 class='hasAnchor' id='arguments'><a class='anchor' href='#arguments'></a>Machine readable interpretation guidelines</h3>
<p>The repository of this package <a href='https://github.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt'>contains a machine readable version</a> 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)</strong>. Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.</p>
<p>The repository of this package <a href='https://github.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt'>contains a machine readable version</a> 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)</strong>. Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.</p>
<h3 class='hasAnchor' id='arguments'><a class='anchor' href='#arguments'></a>Other</h3>

@ -82,7 +82,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>
@ -252,7 +252,7 @@
<li><p><code>name</code><br /> Official name of the antimicrobial agent as used by WHONET/EARS-Net or the WHO</p></li>
<li><p><code>type</code><br /> Type of the dosage, either "high_dosage", "standard_dosage" or "uncomplicated_uti"</p></li>
<li><p><code>dose</code><br /> Dose, such as "2 g" or "25 mg/kg"</p></li>
<li><p><code>dose_times</code><br /> Dose, such as "2 g" or "25 mg/kg"</p></li>
<li><p><code>dose_times</code><br /> Number of times a dose must be administered</p></li>
<li><p><code>administration</code><br /> Route of administration, either "im", "iv" or "oral"</p></li>
<li><p><code>notes</code><br /> Additional dosage notes</p></li>
<li><p><code>original_txt</code><br /> Original text in the PDF file of EUCAST</p></li>

@ -49,7 +49,7 @@
<script src="../extra.js"></script>
<meta property="og:title" content="Apply EUCAST rules — eucast_rules" />
<meta property="og:description" content="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.
<meta property="og:description" content="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." />
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png" />
@ -83,7 +83,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>
@ -240,7 +240,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
</div>
<div class="ref-description">
<p>Apply rules for clinical breakpoints and intrinsic resistance as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, <a href='https://eucast.org'>https://eucast.org</a>), see <em>Source</em>. Use <code>eucast_dosage()</code> to get advised dosages of a certain bug-drug combination, which is based on the <a href='dosage.html'>dosage</a> data set.</p>
<p>Apply rules for clinical breakpoints and intrinsic resistance as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, <a href='https://eucast.org'>https://eucast.org</a>), see <em>Source</em>. Use <code>eucast_dosage()</code> to get a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> with advised dosages of a certain bug-drug combination, which is based on the <a href='dosage.html'>dosage</a> data set.</p>
<p>To improve the interpretation of the antibiogram before EUCAST rules are applied, some non-EUCAST rules can applied at default, see Details.</p>
</div>
@ -250,7 +250,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
info <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/interactive.html'>interactive</a></span><span class='op'>(</span><span class='op'>)</span>,
rules <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/options.html'>getOption</a></span><span class='op'>(</span><span class='st'>"AMR_eucastrules"</span>, default <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"breakpoints"</span>, <span class='st'>"expert"</span><span class='op'>)</span><span class='op'>)</span>,
verbose <span class='op'>=</span> <span class='cn'>FALSE</span>,
version_breakpoints <span class='op'>=</span> <span class='fl'>10</span>,
version_breakpoints <span class='op'>=</span> <span class='fl'>11</span>,
version_expertrules <span class='op'>=</span> <span class='fl'>3.2</span>,
ampc_cephalosporin_resistance <span class='op'>=</span> <span class='cn'>NA</span>,
<span class='va'>...</span>
@ -283,11 +283,11 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
</tr>
<tr>
<th>version_breakpoints</th>
<td><p>the version number to use for the EUCAST Clinical Breakpoints guideline. Currently supported: 11.0, 10.0.</p></td>
<td><p>the version number to use for the EUCAST Clinical Breakpoints guideline. Can be either "11.0" or "10.0".</p></td>
</tr>
<tr>
<th>version_expertrules</th>
<td><p>the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Currently supported: 3.1, 3.2.</p></td>
<td><p>the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either "3.2" or "3.1".</p></td>
</tr>
<tr>
<th>ampc_cephalosporin_resistance</th>

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9000</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>

@ -49,7 +49,7 @@
<script src="../extra.js"></script>
<meta property="og:title" content="Data set for R/SI interpretation — rsi_translation" />
<meta property="og:description" content="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." />
<meta property="og:description" content="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." />
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png" />
@ -82,7 +82,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>
@ -239,7 +239,7 @@
</div>
<div class="ref-description">
<p>Data set to interpret MIC and disk diffusion to R/SI values. Included guidelines are CLSI (2010-2019) and EUCAST (2011-2020). Use <code><a href='as.rsi.html'>as.rsi()</a></code> to transform MICs or disks measurements to R/SI values.</p>
<p>Data set to interpret MIC and disk diffusion to R/SI values. Included guidelines are CLSI (2010-2019) and EUCAST (2011-2021). Use <code><a href='as.rsi.html'>as.rsi()</a></code> to transform MICs or disks measurements to R/SI values.</p>
</div>
<pre class="usage"><span class='va'>rsi_translation</span></pre>
@ -247,7 +247,7 @@
<h2 class="hasAnchor" id="format"><a class="anchor" href="#format"></a>Format</h2>
<p>A <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> with 18,650 observations and 10 variables:</p><ul>
<p>A <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> with 20,486 observations and 10 variables:</p><ul>
<li><p><code>guideline</code><br /> Name of the guideline</p></li>
<li><p><code>method</code><br /> Either "MIC" or "DISK"</p></li>
<li><p><code>site</code><br /> Body site, e.g. "Oral" or "Respiratory"</p></li>

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9000</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9001</span>
</span>
</div>

@ -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 <rsi> columns using dplyr >= 1.0.0:
example_isolates \%>\%
rename_with(as.ab, where(is.rsi))
}
}
\seealso{
\itemize{

@ -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}{

@ -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

@ -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.
}

@ -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.

@ -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")
})

Loading…
Cancel
Save