1
0
mirror of https://github.com/msberends/AMR.git synced 2025-06-07 21:54:00 +02:00

(v2.1.1.9289) unit test fix

This commit is contained in:
dr. M.S. (Matthijs) Berends 2025-06-01 16:00:12 +02:00
parent 46f80b1378
commit d384b492cf
No known key found for this signature in database
6 changed files with 17 additions and 4 deletions

View File

@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 2.1.1.9288 Version: 2.1.1.9289
Date: 2025-06-01 Date: 2025-06-01
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 2.1.1.9288 # AMR 2.1.1.9289
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://amr-for-r.org/#get-this-package).)* *(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://amr-for-r.org/#get-this-package).)*

View File

@ -29,7 +29,10 @@
#' Data Sets with `r format(nrow(antimicrobials) + nrow(antivirals), big.mark = " ")` Antimicrobial Drugs #' Data Sets with `r format(nrow(antimicrobials) + nrow(antivirals), big.mark = " ")` Antimicrobial Drugs
#' #'
#' @description
#' Two data sets containing all antimicrobials and antivirals. Use [as.ab()] or one of the [`ab_*`][ab_property()] functions to retrieve values from the [antimicrobials] data set. Three identifiers are included in this data set: an antimicrobial ID (`ab`, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (`atc`) as defined by the WHO, and a Compound ID (`cid`) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes. #' Two data sets containing all antimicrobials and antivirals. Use [as.ab()] or one of the [`ab_*`][ab_property()] functions to retrieve values from the [antimicrobials] data set. Three identifiers are included in this data set: an antimicrobial ID (`ab`, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (`atc`) as defined by the WHO, and a Compound ID (`cid`) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes.
#'
#' **The `antibiotics` data set has been renamed to `antimicrobials`. The old name will be removed in a future version.**
#' @format #' @format
#' ### For the [antimicrobials] data set: a [tibble][tibble::tibble] with `r nrow(antimicrobials)` observations and `r ncol(antimicrobials)` variables: #' ### For the [antimicrobials] data set: a [tibble][tibble::tibble] with `r nrow(antimicrobials)` observations and `r ncol(antimicrobials)` variables:
#' - `ab`\cr antimicrobial ID as used in this package (such as `AMC`), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. ***This is a unique identifier.*** #' - `ab`\cr antimicrobial ID as used in this package (such as `AMC`), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. ***This is a unique identifier.***
@ -88,6 +91,9 @@
#' antivirals #' antivirals
"antimicrobials" "antimicrobials"
#' @rdname antimicrobials
"antibiotics"
#' @rdname antimicrobials #' @rdname antimicrobials
"antivirals" "antivirals"

View File

@ -1490,7 +1490,7 @@ mdro <- function(x = NULL,
if (length(ESBLs) > 0) { if (length(ESBLs) > 0) {
trans_tbl( trans_tbl(
2, # positive, unconfirmed 2, # positive, unconfirmed
rows = which(x$order == "Enterobacterales" & x[[ESBLs[1]]] == "R" & x[[ESBLs[2]]] == "R" & is.na(esbl)), rows = which(x$order == "Enterobacterales" & col_values(x, ESBLs[1]) == "R" & col_values(x, ESBLs[2]) == "R" & is.na(esbl)),
cols = c(AMX %or% AMP, cephalosporins_3rd), cols = c(AMX %or% AMP, cephalosporins_3rd),
any_all = "all", any_all = "all",
reason = "Enterobacterales: potential ESBL" reason = "Enterobacterales: potential ESBL"

View File

@ -3,6 +3,7 @@
\docType{data} \docType{data}
\name{antimicrobials} \name{antimicrobials}
\alias{antimicrobials} \alias{antimicrobials}
\alias{antibiotics}
\alias{antivirals} \alias{antivirals}
\title{Data Sets with 617 Antimicrobial Drugs} \title{Data Sets with 617 Antimicrobial Drugs}
\format{ \format{
@ -49,6 +50,8 @@ LOINC:
} }
} }
An object of class \code{deprecated_amr_dataset} (inherits from \code{tbl_df}, \code{tbl}, \code{data.frame}) with 497 rows and 14 columns.
An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 120 rows and 11 columns. An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 120 rows and 11 columns.
} }
\source{ \source{
@ -61,10 +64,14 @@ An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) w
\usage{ \usage{
antimicrobials antimicrobials
antibiotics
antivirals antivirals
} }
\description{ \description{
Two data sets containing all antimicrobials and antivirals. Use \code{\link[=as.ab]{as.ab()}} or one of the \code{\link[=ab_property]{ab_*}} functions to retrieve values from the \link{antimicrobials} data set. Three identifiers are included in this data set: an antimicrobial ID (\code{ab}, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (\code{atc}) as defined by the WHO, and a Compound ID (\code{cid}) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes. Two data sets containing all antimicrobials and antivirals. Use \code{\link[=as.ab]{as.ab()}} or one of the \code{\link[=ab_property]{ab_*}} functions to retrieve values from the \link{antimicrobials} data set. Three identifiers are included in this data set: an antimicrobial ID (\code{ab}, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (\code{atc}) as defined by the WHO, and a Compound ID (\code{cid}) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes.
\strong{The \code{antibiotics} data set has been renamed to \code{antimicrobials}. The old name will be removed in a future version.}
} }
\details{ \details{
Properties that are based on an ATC code are only available when an ATC is available. These properties are: \code{atc_group1}, \code{atc_group2}, \code{oral_ddd}, \code{oral_units}, \code{iv_ddd} and \code{iv_units}. Do note that ATC codes are not unique. For example, J01CR02 is officially the ATC code for "amoxicillin and beta-lactamase inhibitor". Consequently, these two items from the \link{antimicrobials} data set both return \code{"J01CR02"}: Properties that are based on an ATC code are only available when an ATC is available. These properties are: \code{atc_group1}, \code{atc_group2}, \code{oral_ddd}, \code{oral_units}, \code{iv_ddd} and \code{iv_units}. Do note that ATC codes are not unique. For example, J01CR02 is officially the ATC code for "amoxicillin and beta-lactamase inhibitor". Consequently, these two items from the \link{antimicrobials} data set both return \code{"J01CR02"}:

View File

@ -48,7 +48,7 @@ test_that("test-mdro.R", {
# example_isolates should have these finding using Dutch guidelines # example_isolates should have these finding using Dutch guidelines
expect_equal( expect_equal(
as.double(table(outcome)), as.double(table(outcome)),
c(1977, 23, 0) c(1977, 21, 2)
) )
expect_equal( expect_equal(