diff --git a/DESCRIPTION b/DESCRIPTION index 93bb0c94..d55a835b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.7.1.9075 -Date: 2021-12-14 +Version: 1.7.1.9077 +Date: 2021-12-23 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by diff --git a/NEWS.md b/NEWS.md index 4cac5722..f8c0de6d 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# `AMR` 1.7.1.9075 -## Last updated: 14 December 2021 +# `AMR` 1.7.1.9077 +## Last updated: 23 December 2021 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. diff --git a/R/ab.R b/R/ab.R index a1f92708..27e696ba 100755 --- a/R/ab.R +++ b/R/ab.R @@ -133,8 +133,8 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { note_if_more_than_one_found <- function(found, index, from_text) { if (initial_search == TRUE & isTRUE(length(from_text) > 1)) { abnames <- ab_name(from_text, tolower = TRUE, initial_search = FALSE) - if (ab_name(found[1L], language = NULL) %like% "clavulanic acid") { - abnames <- abnames[!abnames == "clavulanic acid"] + if (ab_name(found[1L], language = NULL) %like% "(clavulanic acid|avibactam)") { + abnames <- abnames[!abnames %in% c("clavulanic acid", "avibactam")] } if (length(abnames) > 1) { message_("More than one result was found for item ", index, ": ", @@ -222,6 +222,16 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { next } + # length of input is quite long, and Levenshtein distance is only max 2 + if (nchar(x[i]) >= 10) { + levenshtein <- as.double(utils::adist(x[i], AB_lookup$generalised_name)) + if (any(levenshtein <= 2)) { + found <- AB_lookup$ab[which(levenshtein <= 2)] + x_new[i] <- note_if_more_than_one_found(found, i, from_text) + next + } + } + # allow characters that resemble others, but only continue when having more than 3 characters if (nchar(x[i]) <= 3) { x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1]) @@ -238,7 +248,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { x_spelling <- gsub("E+", "E+", x_spelling, perl = TRUE) x_spelling <- gsub("O+", "O+", x_spelling, perl = TRUE) # allow any ending of -in/-ine and -im/-ime - x_spelling <- gsub("(\\[IY\\]\\+(N|M)|\\[IY\\]\\+(N|M)E\\+)$", "[IY]+(N|M)E*", x_spelling, perl = TRUE) + x_spelling <- gsub("(\\[IY\\]\\+(N|M)|\\[IY\\]\\+(N|M)E\\+?)$", "[IY]+(N|M)E*", x_spelling, perl = TRUE) # allow any ending of -ol/-ole x_spelling <- gsub("(O\\+L|O\\+LE\\+)$", "O+LE*", x_spelling, perl = TRUE) # allow any ending of -on/-one diff --git a/R/zzz.R b/R/zzz.R index 4f5d1be7..461fc7bc 100755 --- a/R/zzz.R +++ b/R/zzz.R @@ -57,10 +57,12 @@ if (utf8_supported && !is_latex) { s3_register("cleaner::freq", "mo") s3_register("cleaner::freq", "rsi") # Support for skim() from the skimr package - s3_register("skimr::get_skimmers", "mo") - s3_register("skimr::get_skimmers", "rsi") - s3_register("skimr::get_skimmers", "mic") - s3_register("skimr::get_skimmers", "disk") + if (pkg_is_available("skimr", also_load = FALSE, min_version = "2.0.0")) { + s3_register("skimr::get_skimmers", "mo") + s3_register("skimr::get_skimmers", "rsi") + s3_register("skimr::get_skimmers", "mic") + s3_register("skimr::get_skimmers", "disk") + } # Support for autoplot() from the ggplot2 package s3_register("ggplot2::autoplot", "rsi") s3_register("ggplot2::autoplot", "mic") diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz index b5fa4af6..fdb875e7 100644 Binary files a/data-raw/AMR_latest.tar.gz and b/data-raw/AMR_latest.tar.gz differ diff --git a/docs/articles/datasets.html b/docs/articles/datasets.html index 4cc1e5e5..7ed04594 100644 --- a/docs/articles/datasets.html +++ b/docs/articles/datasets.html @@ -44,7 +44,7 @@
@@ -190,7 +190,7 @@vignettes/datasets.Rmd
datasets.Rmd
It was last updated on 14 December 2021 21:59:33 UTC. Find more info about the structure of this data set here.
Direct download links:
It was last updated on 14 December 2021 21:59:33 UTC. Find more info about the structure of this data set here.
Direct download links:
It was last updated on 14 December 2021 21:59:33 UTC. Find more info about the structure of this data set here.
Direct download links:
AMR
1.7.1.9075AMR
1.7.1.9077All 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_symbol()
and all filter_*()
functions (except for filter_first_isolate()
), which were all deprecated in a previous package versionkey_antibiotics()
and key_antibiotics_equal()
functions, which were deprecated and superseded by key_antimicrobials()
and antimicrobials_equal()
get_locale()
to get_AMR_locale()
to prevent conflicts with other packagesSupport 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 ab_ddd_units()
to get units of DDDs (daily defined doses), deprecating the use of ab_ddd(..., units = TRUE)
to be more consistent in data types of function output
antibiotics
data set now contains all ATC codes that are available through the WHOCC website, regardless of drugs being present in more than one ATC group. This means that:
get_episode()
and is_new_episode()
can now cope with NA
s