1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 04:46:11 +01:00

(v1.7.1.9065) unit tests

This commit is contained in:
dr. M.S. (Matthijs) Berends 2021-12-11 15:13:44 +01:00
parent 77ba4318ea
commit e0a2634f14
7 changed files with 24 additions and 21 deletions

View File

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

View File

@ -1,4 +1,4 @@
# `AMR` 1.7.1.9064 # `AMR` 1.7.1.9065
## <small>Last updated: 11 December 2021</small> ## <small>Last updated: 11 December 2021</small>
### Breaking changes ### Breaking changes

View File

@ -912,17 +912,18 @@ unique_call_id <- function(entire_session = FALSE, match_fn = NULL) {
# combination of environment ID (such as "0x7fed4ee8c848") # combination of environment ID (such as "0x7fed4ee8c848")
# and relevant system call (where 'match_fn' is being called in) # and relevant system call (where 'match_fn' is being called in)
calls <- sys.calls() calls <- sys.calls()
int <- which(vapply(FUN.VALUE = logical(1), if (!identical(Sys.getenv("R_RUN_TINYTEST"), "true") &&
calls, !any(as.character(calls[[1]]) %like_case% "run_test_dir|run_test_file|test_all|tinytest|test_package|testthat")) {
function(call, fun = match_fn) { for (i in seq_len(length(calls))) {
call_clean <- gsub("[^a-zA-Z0-9_().-]", "", as.character(call), perl = TRUE) call_clean <- gsub("[^a-zA-Z0-9_().-]", "", as.character(calls[[i]]), perl = TRUE)
any(call_clean %like% paste0(fun, "\\("), na.rm = TRUE) if (any(call_clean %like% paste0(match_fn, "\\("), na.rm = TRUE)) {
}))[1L] return(c(envir = gsub("<environment: (.*)>", "\\1", utils::capture.output(sys.frames()[[1]]), perl = TRUE),
if (is.na(int)) { call = paste0(deparse(calls[[i]]), collapse = "")))
int <- 1
} }
c(envir = gsub("<environment: (.*)>", "\\1", utils::capture.output(sys.frames()[[1]]), perl = TRUE), }
call = paste0(deparse(calls[[int]]), collapse = "")) }
c(envir = paste0(sample(c(c(0:9), letters[1:6]), size = 32, replace = TRUE), collapse = ""),
call = paste0(sample(c(c(0:9), letters[1:6]), size = 32, replace = TRUE), collapse = ""))
} }
#' @noRd #' @noRd

Binary file not shown.

View File

@ -44,7 +44,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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.9064</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.7.1.9065</span>
</span> </span>
</div> </div>

View File

@ -17,7 +17,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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.9064</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.7.1.9065</span>
</span> </span>
</div> </div>
@ -157,19 +157,19 @@
</div> </div>
<div class="section level2"> <div class="section level2">
<h2 class="page-header" data-toc-text="1.7.1.9064" id="amr-1719064"> <h2 class="page-header" data-toc-text="1.7.1.9065" id="amr-1719065">
<code>AMR</code> 1.7.1.9064<a class="anchor" aria-label="anchor" href="#amr-1719064"></a></h2> <code>AMR</code> 1.7.1.9065<a class="anchor" aria-label="anchor" href="#amr-1719065"></a></h2>
<div class="section level3"> <div class="section level3">
<h3 id="last-updated-december-1-7-1-9064"><small>Last updated: 11 December 2021</small><a class="anchor" aria-label="anchor" href="#last-updated-december-1-7-1-9064"></a></h3> <h3 id="last-updated-december-1-7-1-9065"><small>Last updated: 11 December 2021</small><a class="anchor" aria-label="anchor" href="#last-updated-december-1-7-1-9065"></a></h3>
<div class="section level4"> <div class="section level4">
<h4 id="breaking-changes-1-7-1-9064">Breaking changes<a class="anchor" aria-label="anchor" href="#breaking-changes-1-7-1-9064"></a></h4> <h4 id="breaking-changes-1-7-1-9065">Breaking changes<a class="anchor" aria-label="anchor" href="#breaking-changes-1-7-1-9065"></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> <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>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> </li>
<li>Removed all previously implemented <code><a href="https://ggplot2.tidyverse.org/reference/ggplot.html" class="external-link">ggplot2::ggplot()</a></code> generics for classes <code>&lt;mic&gt;</code>, <code>&lt;disk&gt;</code>, <code>&lt;rsi&gt;</code> and <code>&lt;resistance_predict&gt;</code> as they did not follow the <code>ggplot2</code> logic. They were replaced with <code><a href="https://ggplot2.tidyverse.org/reference/autoplot.html" class="external-link">ggplot2::autoplot()</a></code> generics.</li> <li>Removed all previously implemented <code><a href="https://ggplot2.tidyverse.org/reference/ggplot.html" class="external-link">ggplot2::ggplot()</a></code> generics for classes <code>&lt;mic&gt;</code>, <code>&lt;disk&gt;</code>, <code>&lt;rsi&gt;</code> and <code>&lt;resistance_predict&gt;</code> as they did not follow the <code>ggplot2</code> logic. They were replaced with <code><a href="https://ggplot2.tidyverse.org/reference/autoplot.html" class="external-link">ggplot2::autoplot()</a></code> generics.</li>
</ul></div> </ul></div>
<div class="section level4"> <div class="section level4">
<h4 id="new-1-7-1-9064">New<a class="anchor" aria-label="anchor" href="#new-1-7-1-9064"></a></h4> <h4 id="new-1-7-1-9065">New<a class="anchor" aria-label="anchor" href="#new-1-7-1-9065"></a></h4>
<ul><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>mo_intrinsic_resistant()</code> and <code><a href="../reference/mdro.html">mdro()</a></code>. The <code>intrinsic_resistant</code> data set was also updated accordingly.</p></li> <ul><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>mo_intrinsic_resistant()</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 Danish, and also added missing translations of all antimicrobial drugs in Italian, French and Portuguese</p></li> <li><p>Support for Danish, and also added missing translations of all antimicrobial drugs in Italian, French and Portuguese</p></li>
<li> <li>
@ -183,7 +183,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> <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> </ul></div>
<div class="section level4"> <div class="section level4">
<h4 id="changed-1-7-1-9064">Changed<a class="anchor" aria-label="anchor" href="#changed-1-7-1-9064"></a></h4> <h4 id="changed-1-7-1-9065">Changed<a class="anchor" aria-label="anchor" href="#changed-1-7-1-9065"></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> <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: <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> <ul><li>Some drugs now contain multiple ATC codes (e.g., metronidazole contains 5)</li>
@ -252,7 +252,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> <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> </ul></div>
<div class="section level4"> <div class="section level4">
<h4 id="other-1-7-1-9064">Other<a class="anchor" aria-label="anchor" href="#other-1-7-1-9064"></a></h4> <h4 id="other-1-7-1-9065">Other<a class="anchor" aria-label="anchor" href="#other-1-7-1-9065"></a></h4>
<ul><li>This package is now being maintained by two epidemiologists and a data scientist from two different non-profit healthcare organisations. 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.</li> <ul><li>This package is now being maintained by two epidemiologists and a data scientist from two different non-profit healthcare organisations. 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.</li>
</ul></div> </ul></div>
</div> </div>

View File

@ -30,6 +30,8 @@ expect_error(mdro(example_isolates, col_mo = "invalid", info = TRUE))
expect_stdout(suppressMessages(suppressWarnings(mdro(example_isolates, info = TRUE)))) expect_stdout(suppressMessages(suppressWarnings(mdro(example_isolates, info = TRUE))))
expect_stdout(suppressMessages(suppressWarnings(mdro(example_isolates, "eucast3.1", info = TRUE)))) expect_stdout(suppressMessages(suppressWarnings(mdro(example_isolates, "eucast3.1", info = TRUE))))
expect_stdout(suppressMessages(suppressWarnings(mdro(example_isolates, "eucast3.2", info = TRUE))))
expect_stdout(suppressMessages(suppressWarnings(mdro(example_isolates, "eucast3.3", info = TRUE))))
expect_stdout(outcome <- suppressMessages(suppressWarnings(eucast_exceptional_phenotypes(example_isolates, info = TRUE)))) expect_stdout(outcome <- suppressMessages(suppressWarnings(eucast_exceptional_phenotypes(example_isolates, info = TRUE))))
# check class # check class
expect_identical(class(outcome), c("ordered", "factor")) expect_identical(class(outcome), c("ordered", "factor"))