(v1.7.1.9071) rsi disk fix

This commit is contained in:
dr. M.S. (Matthijs) Berends 2021-12-13 11:57:34 +01:00
parent 578e7dfee9
commit 0cbf8f48b6
23 changed files with 910 additions and 873 deletions

View File

@ -1,5 +1,5 @@
Package: AMR
Version: 1.7.1.9070
Version: 1.7.1.9071
Date: 2021-12-13
Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR)

View File

@ -1,4 +1,4 @@
# `AMR` 1.7.1.9070
# `AMR` 1.7.1.9071
## <small>Last updated: 13 December 2021</small>
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.
@ -10,7 +10,7 @@ All functions in this package are now all considered to be stable. Updates to th
* 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
* 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:

16
R/mic.R
View File

@ -37,8 +37,8 @@ valid_mic_levels <- c(c(t(vapply(FUN.VALUE = character(9), ops,
function(x) paste0(x, sort(c(1:9, 1.5)))))),
c(t(vapply(FUN.VALUE = character(45), ops,
function(x) paste0(x, c(10:98)[9:98 %% 2 == TRUE])))),
c(t(vapply(FUN.VALUE = character(15), ops,
function(x) paste0(x, sort(c(2 ^ c(7:10), 80 * c(2:12))))))))
c(t(vapply(FUN.VALUE = character(16), ops,
function(x) paste0(x, sort(c(2 ^ c(7:11), 80 * c(2:12))))))))
#' Transform Input to Minimum Inhibitory Concentrations (MIC)
#'
@ -628,6 +628,12 @@ cummin.mic <- function(x) {
# Ops (see ?groupGeneric) -----------------------------------------------
is_greater <- function(el) {
el %like_case% ">[0-9]"
}
is_lower <- function(el) {
el %like_case% "<[0-9]"
}
#' @method + mic
#' @export
@ -739,6 +745,12 @@ cummin.mic <- function(x) {
#' @noRd
`>.mic` <- function(e1, e2) {
as.double(e1) > as.double(e2)
# doesn't work...
# nolint start
# as.double(e1) > as.double(e2) |
# (as.double(e1) == as.double(e2) & is_lower(e2) & !is_lower(e1)) |
# (as.double(e1) == as.double(e2) & is_greater(e1) & !is_greater(e2))
# nolint end
}
# Summary (see ?groupGeneric) -------------------------------------------

View File

@ -12,7 +12,7 @@ The latest built **source package** (`AMR_latest.tar.gz`) can be found in folder
`AMR` is a free, open-source and independent R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. Our aim is to provide a standard for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. It is currently being used in over 150 countries.
After installing this package, R knows ~71,000 distinct microbial species and all ~560 antibiotic, antimycotic, and antiviral drugs by name and code (including ATC, EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data. Antimicrobial names and group names are available in Danish, Dutch, English, French, German, Italian, Portuguese and Spanish.
After installing this package, R knows ~71,000 distinct microbial species and all ~570 antibiotic, antimycotic, and antiviral drugs by name and code (including ATC, WHONET/EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data. Antimicrobial names and group names are available in Danish, Dutch, English, French, German, Italian, Portuguese and Spanish.
This package is fully independent of any other R package and works on Windows, macOS and Linux with all versions of R since R-3.0.0 (April 2013). It was designed to work in any setting, including those with very limited resources. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the University of Groningen, in collaboration with non-profit organisations Certe Medical Diagnostics and Advice Foundation and University Medical Center Groningen. This R package is actively maintained and free software; you can freely use and distribute it for both personal and commercial (but not patent) purposes under the terms of the GNU General Public License version 2.0 (GPL-2), as published by the Free Software Foundation.

Binary file not shown.

View File

@ -111,6 +111,23 @@ rsi_translation <- rsi_generic %>%
distinct(guideline, ab, mo, method, site, .keep_all = TRUE) %>%
as.data.frame(stringsAsFactors = FALSE)
# disks MUST be 6-50 mm, so correct where that is wrong:
rsi_translation[which(rsi_translation$method == "DISK" &
(is.na(rsi_translation$breakpoint_S) | rsi_translation$breakpoint_S > 50)), "breakpoint_S"] <- 50
rsi_translation[which(rsi_translation$method == "DISK" &
(is.na(rsi_translation$breakpoint_R) | rsi_translation$breakpoint_R < 6)), "breakpoint_R"] <- 6
m <- unique(as.double(as.mic(levels(as.mic(1)))))
rsi_translation[which(rsi_translation$method == "MIC" &
is.na(rsi_translation$breakpoint_S)), "breakpoint_S"] <- min(m)
rsi_translation[which(rsi_translation$method == "MIC" &
is.na(rsi_translation$breakpoint_R)), "breakpoint_R"] <- max(m)
# WHONET has no >1024 but instead uses 1025, 513, etc, so raise these one higher valid MIC factor level:
rsi_translation[which(rsi_translation$breakpoint_R == 129), "breakpoint_R"] <- m[which(m == 128) + 1]
rsi_translation[which(rsi_translation$breakpoint_R == 257), "breakpoint_R"] <- m[which(m == 256) + 1]
rsi_translation[which(rsi_translation$breakpoint_R == 513), "breakpoint_R"] <- m[which(m == 512) + 1]
rsi_translation[which(rsi_translation$breakpoint_R == 1025), "breakpoint_R"] <- m[which(m == 1024) + 1]
# save to package
usethis::use_data(rsi_translation, overwrite = TRUE)
rm(rsi_translation)

View File

@ -1 +1 @@
14cdc0922a0dc5ec6bcacd5938fdeb93
2d5adb3d28ff14e0ce09b391b4a55768

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -43,7 +43,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="Released version">1.7.1.9070</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.7.1.9071</span>
</span>
</div>

View File

@ -17,7 +17,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="Released version">1.7.1.9070</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.7.1.9071</span>
</span>
</div>

View File

@ -44,7 +44,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="Released version">1.7.1.9070</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.7.1.9071</span>
</span>
</div>
@ -1057,7 +1057,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
</h2>
<p>A data set with 20,318 rows and 11 columns, containing the following column names:<br><em>guideline</em>, <em>method</em>, <em>site</em>, <em>mo</em>, <em>rank_index</em>, <em>ab</em>, <em>ref_tbl</em>, <em>disk_dose</em>, <em>breakpoint_S</em>, <em>breakpoint_R</em> and <em>uti</em>.</p>
<p>This data set is in R available as <code>rsi_translation</code>, after you load the <code>AMR</code> package.</p>
<p>It was last updated on 13 December 2021 08:00:17 UTC. Find more info about the structure of this data set <a href="https://msberends.github.io/AMR/reference/rsi_translation.html">here</a>.</p>
<p>It was last updated on 13 December 2021 10:08:29 UTC. Find more info about the structure of this data set <a href="https://msberends.github.io/AMR/reference/rsi_translation.html">here</a>.</p>
<p><strong>Direct download links:</strong></p>
<ul>
<li>Download as <a href="https://github.com/msberends/AMR/raw/main/data-raw/../data-raw/rsi_translation.rds" class="external-link">R file</a> (39 kB)<br>

View File

@ -17,7 +17,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="Released version">1.7.1.9070</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.7.1.9071</span>
</span>
</div>

View File

@ -47,7 +47,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="Released version">1.7.1.9070</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.7.1.9071</span>
</span>
</div>
@ -201,7 +201,7 @@
<h3 id="what-is-amr-for-r">What is <code>AMR</code> (for R)?<a class="anchor" aria-label="anchor" href="#what-is-amr-for-r"></a>
</h3>
<p><code>AMR</code> is a free, open-source and independent <a href="https://www.r-project.org" class="external-link">R package</a> (see <a href="#copyright">Copyright</a>) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. <strong>Our aim is to provide a standard</strong> for clean and reproducible AMR data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.</p>
<p>After installing this package, R knows <a href="./reference/microorganisms.html"><strong>~71,000 distinct microbial species</strong></a> and all <a href="./reference/antibiotics.html"><strong>~560 antibiotic, antimycotic and antiviral drugs</strong></a> by name and code (including ATC, EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.</p>
<p>After installing this package, R knows <a href="./reference/microorganisms.html"><strong>~71,000 distinct microbial species</strong></a> and all <a href="./reference/antibiotics.html"><strong>~570 antibiotic, antimycotic and antiviral drugs</strong></a> by name and code (including ATC, WHONET/EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.</p>
<p>The <code>AMR</code> package is available in <img src="lang_da.svg" style="height: 11px !important; vertical-align: initial !important;"> Danish, <img src="lang_nl.svg" style="height: 11px !important; vertical-align: initial !important;"> Dutch, <img src="lang_en.svg" style="height: 11px !important; vertical-align: initial !important;"> English, <img src="lang_fr.svg" style="height: 11px !important; vertical-align: initial !important;"> French, <img src="lang_de.svg" style="height: 11px !important; vertical-align: initial !important;"> German, <img src="lang_it.svg" style="height: 11px !important; vertical-align: initial !important;"> Italian, <img src="lang_pt.svg" style="height: 11px !important; vertical-align: initial !important;"> Portuguese, <img src="lang_ru.svg" style="height: 11px !important; vertical-align: initial !important;"> Russian, <img src="lang_es.svg" style="height: 11px !important; vertical-align: initial !important;"> Spanish and <img src="lang_sv.svg" style="height: 11px !important; vertical-align: initial !important;"> Swedish. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages.</p>
<p>This package is <a href="https://en.wikipedia.org/wiki/Dependency_hell" class="external-link">fully independent of any other R package</a> and works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). <strong>It was designed to work in any setting, including those with very limited resources</strong>. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the <a href="https://www.rug.nl" class="external-link">University of Groningen</a>, in collaboration with non-profit organisations <a href="https://www.certe.nl" class="external-link">Certe Medical Diagnostics and Advice Foundation</a> and <a href="https://www.umcg.nl" class="external-link">University Medical Center Groningen</a>. This R package formed the basis of two PhD theses (<a href="https://doi.org/10.33612/diss.177417131" class="external-link">DOI 10.33612/diss.177417131</a> and <a href="https://doi.org/10.33612/diss.192486375" class="external-link">DOI 10.33612/diss.192486375</a>) but is <a href="./news">actively and durably maintained</a> by two public healthcare organisations in the Netherlands.</p>
<div class="main-content" style="display: inline-block;">

View File

@ -17,7 +17,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="Released version">1.7.1.9070</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.7.1.9071</span>
</span>
</div>
@ -157,13 +157,13 @@
</div>
<div class="section level2">
<h2 class="page-header" data-toc-text="1.7.1.9070" id="amr-1719070">
<code>AMR</code> 1.7.1.9070<a class="anchor" aria-label="anchor" href="#amr-1719070"></a></h2>
<h2 class="page-header" data-toc-text="1.7.1.9071" id="amr-1719071">
<code>AMR</code> 1.7.1.9071<a class="anchor" aria-label="anchor" href="#amr-1719071"></a></h2>
<div class="section level3">
<h3 id="last-updated-december-1-7-1-9070"><small>Last updated: 13 December 2021</small><a class="anchor" aria-label="anchor" href="#last-updated-december-1-7-1-9070"></a></h3>
<h3 id="last-updated-december-1-7-1-9071"><small>Last updated: 13 December 2021</small><a class="anchor" aria-label="anchor" href="#last-updated-december-1-7-1-9071"></a></h3>
<p>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.</p>
<div class="section level4">
<h4 id="breaking-changes-1-7-1-9070">Breaking changes<a class="anchor" aria-label="anchor" href="#breaking-changes-1-7-1-9070"></a></h4>
<h4 id="breaking-changes-1-7-1-9071">Breaking changes<a class="anchor" aria-label="anchor" href="#breaking-changes-1-7-1-9071"></a></h4>
<ul><li>Removed <code>p_symbol()</code> and all <code>filter_*()</code> functions (except for <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>), which were all deprecated in a previous package version</li>
<li>Removed the <code>key_antibiotics()</code> and <code>key_antibiotics_equal()</code> functions, which were deprecated and superseded by <code><a href="../reference/key_antimicrobials.html">key_antimicrobials()</a></code> and <code><a href="../reference/key_antimicrobials.html">antimicrobials_equal()</a></code>
</li>
@ -171,8 +171,8 @@
<li>Renamed function <code>get_locale()</code> to <code><a href="../reference/translate.html">get_AMR_locale()</a></code> to prevent conflicts with other packages</li>
</ul></div>
<div class="section level4">
<h4 id="new-1-7-1-9070">New<a class="anchor" aria-label="anchor" href="#new-1-7-1-9070"></a></h4>
<ul><li><p>Support for the CLSI 2021 guideline for interpreting MIC/disk diffusion values, which are incorporated in the <code>rsi_translation</code> data set</p></li>
<h4 id="new-1-7-1-9071">New<a class="anchor" aria-label="anchor" href="#new-1-7-1-9071"></a></h4>
<ul><li><p>Support for the CLSI 2021 guideline for interpreting MIC/disk diffusion values, which are incorporated in the <code>rsi_translation</code> data set. This data set now more strictly follows the WHONET software as well.</p></li>
<li><p>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 <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>, <code><a href="../reference/mo_property.html">mo_is_intrinsic_resistant()</a></code> and <code><a href="../reference/mdro.html">mdro()</a></code>. The <code>intrinsic_resistant</code> data set was also updated accordingly.</p></li>
<li><p>Support for all antimicrobial drug (group) names and colloquial microorganism names in Danish, Dutch, English, French, German, Italian, Portuguese, Russian, Spanish and Swedish</p></li>
<li>
@ -186,7 +186,7 @@
<li><p>Function <code><a href="../reference/ab_property.html">ab_ddd_units()</a></code> to get units of DDDs (daily defined doses), deprecating the use of <code>ab_ddd(..., units = TRUE)</code> to be more consistent in data types of function output</p></li>
</ul></div>
<div class="section level4">
<h4 id="changed-1-7-1-9070">Changed<a class="anchor" aria-label="anchor" href="#changed-1-7-1-9070"></a></h4>
<h4 id="changed-1-7-1-9071">Changed<a class="anchor" aria-label="anchor" href="#changed-1-7-1-9071"></a></h4>
<ul><li>Updated the bacterial taxonomy to 5 October 2021 (according to <a href="https://lpsn.dsmz.de" class="external-link">LPSN</a>), including all 11 new staphylococcal species named since 1 January last year</li>
<li>The <code>antibiotics</code> data set now contains <strong>all ATC codes</strong> that are available through the <a href="https://www.whocc.no" class="external-link">WHOCC website</a>, regardless of drugs being present in more than one ATC group. This means that:
<ul><li>Some drugs now contain multiple ATC codes (e.g., metronidazole contains 5)</li>
@ -256,7 +256,7 @@
<code><a href="../reference/get_episode.html">get_episode()</a></code> and <code><a href="../reference/get_episode.html">is_new_episode()</a></code> can now cope with <code>NA</code>s</li>
</ul></div>
<div class="section level4">
<h4 id="other-1-7-1-9070">Other<a class="anchor" aria-label="anchor" href="#other-1-7-1-9070"></a></h4>
<h4 id="other-1-7-1-9071">Other<a class="anchor" aria-label="anchor" href="#other-1-7-1-9071"></a></h4>
<ul><li>This package is now being maintained by two epidemiologists and a data scientist from two different non-profit healthcare organisations.</li>
</ul></div>
</div>

View File

@ -17,7 +17,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="Released version">1.7.1.9070</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.7.1.9071</span>
</span>
</div>

View File

@ -6,7 +6,7 @@
`AMR` is a free, open-source and independent [R package](https://www.r-project.org) (see [Copyright](#copyright)) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. **Our aim is to provide a standard** for clean and reproducible AMR data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.
After installing this package, R knows [**~71,000 distinct microbial species**](./reference/microorganisms.html) and all [**~560 antibiotic, antimycotic and antiviral drugs**](./reference/antibiotics.html) by name and code (including ATC, EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
After installing this package, R knows [**~71,000 distinct microbial species**](./reference/microorganisms.html) and all [**~570 antibiotic, antimycotic and antiviral drugs**](./reference/antibiotics.html) by name and code (including ATC, WHONET/EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
The `AMR` package is available in <img src="lang_da.svg" style="height: 11px !important; vertical-align: initial !important;"> Danish, <img src="lang_nl.svg" style="height: 11px !important; vertical-align: initial !important;"> Dutch, <img src="lang_en.svg" style="height: 11px !important; vertical-align: initial !important;"> English, <img src="lang_fr.svg" style="height: 11px !important; vertical-align: initial !important;"> French, <img src="lang_de.svg" style="height: 11px !important; vertical-align: initial !important;"> German, <img src="lang_it.svg" style="height: 11px !important; vertical-align: initial !important;"> Italian, <img src="lang_pt.svg" style="height: 11px !important; vertical-align: initial !important;"> Portuguese, <img src="lang_ru.svg" style="height: 11px !important; vertical-align: initial !important;"> Russian, <img src="lang_es.svg" style="height: 11px !important; vertical-align: initial !important;"> Spanish and <img src="lang_sv.svg" style="height: 11px !important; vertical-align: initial !important;"> Swedish. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages.

View File

@ -44,6 +44,11 @@ expect_false(any(is.na(microorganisms.codes$code)))
expect_false(any(is.na(microorganisms.codes$mo)))
expect_true(all(dosage$ab %in% antibiotics$ab))
expect_true(all(dosage$name %in% antibiotics$name))
# check valid disks/MICs
expect_false(any(is.na(as.mic(rsi_translation[which(rsi_translation$method == "MIC"), "breakpoint_S"]))))
expect_false(any(is.na(as.mic(rsi_translation[which(rsi_translation$method == "MIC"), "breakpoint_R"]))))
expect_false(any(is.na(as.disk(rsi_translation[which(rsi_translation$method == "DISK"), "breakpoint_S"]))))
expect_false(any(is.na(as.disk(rsi_translation[which(rsi_translation$method == "DISK"), "breakpoint_R"]))))
# antibiotic names must always be coercible to their original AB code
expect_identical(as.ab(antibiotics$name), antibiotics$ab)

View File

@ -27,6 +27,9 @@ expect_true(as.mic(8) == as.mic("8"))
expect_true(as.mic("1") > as.mic("<=0.0625"))
expect_true(as.mic("1") < as.mic(">=32"))
expect_true(is.mic(as.mic(8)))
# expect_true(as.mic(1024) < as.mic(">1024"))
# expect_true(as.mic("<1024") > as.mic("1024"))
expect_equal(as.double(as.mic(">=32")), 32)
expect_equal(as.numeric(as.mic(">=32")), 32)