diff --git a/DESCRIPTION b/DESCRIPTION index 54d7f5b90..3cc5ae666 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 2.1.1.9157 +Version: 2.1.1.9158 Date: 2025-02-26 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) diff --git a/NEWS.md b/NEWS.md index c29a0da97..2bc8d05ce 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 2.1.1.9157 +# AMR 2.1.1.9158 *(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://msberends.github.io/AMR/#latest-development-version).)* @@ -80,7 +80,7 @@ This package now supports not only tools for AMR data analysis in clinical setti * Fix for using a manual value for `mo_transform` in `antibiogram()` * Fixed a bug for when `antibiogram()` returns an empty data set * Fix for mapping 'high level' antibiotics in `as.ab()` (amphotericin B-high, gentamicin-high, kanamycin-high, streptomycin-high, tobramycin-high) -* Improved overall algorithm of `as.ab()` for better performance and accuracy +* Improved overall algorithm of `as.ab()` for better performance and accuracy, including the new function `as_reset_session()` to remove earlier coercions. * Improved overall algorithm of `as.mo()` for better performance and accuracy. Specifically: * More weight is given to genus and species combinations in cases where the subspecies is miswritten, so that the result will be the correct genus and species * Genera from the World Health Organization's (WHO) Priority Pathogen List now have the highest prevalence diff --git a/PythonPackage/AMR/AMR.egg-info/PKG-INFO b/PythonPackage/AMR/AMR.egg-info/PKG-INFO index 3881d5d8e..fcb87067a 100644 --- a/PythonPackage/AMR/AMR.egg-info/PKG-INFO +++ b/PythonPackage/AMR/AMR.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.2 Name: AMR -Version: 2.1.1.9157 +Version: 2.1.1.9158 Summary: A Python wrapper for the AMR R package Home-page: https://github.com/msberends/AMR Author: Matthijs Berends diff --git a/PythonPackage/AMR/dist/amr-2.1.1.9157.tar.gz b/PythonPackage/AMR/dist/amr-2.1.1.9157.tar.gz deleted file mode 100644 index 1a7483d81..000000000 Binary files a/PythonPackage/AMR/dist/amr-2.1.1.9157.tar.gz and /dev/null differ diff --git a/PythonPackage/AMR/dist/amr-2.1.1.9157-py3-none-any.whl b/PythonPackage/AMR/dist/amr-2.1.1.9158-py3-none-any.whl similarity index 52% rename from PythonPackage/AMR/dist/amr-2.1.1.9157-py3-none-any.whl rename to PythonPackage/AMR/dist/amr-2.1.1.9158-py3-none-any.whl index 91892640f..495c67175 100644 Binary files a/PythonPackage/AMR/dist/amr-2.1.1.9157-py3-none-any.whl and b/PythonPackage/AMR/dist/amr-2.1.1.9158-py3-none-any.whl differ diff --git a/PythonPackage/AMR/dist/amr-2.1.1.9158.tar.gz b/PythonPackage/AMR/dist/amr-2.1.1.9158.tar.gz new file mode 100644 index 000000000..5a99784af Binary files /dev/null and b/PythonPackage/AMR/dist/amr-2.1.1.9158.tar.gz differ diff --git a/PythonPackage/AMR/setup.py b/PythonPackage/AMR/setup.py index 574208ecf..d798de27a 100644 --- a/PythonPackage/AMR/setup.py +++ b/PythonPackage/AMR/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='AMR', - version='2.1.1.9157', + version='2.1.1.9158', packages=find_packages(), install_requires=[ 'rpy2', diff --git a/R/ab.R b/R/ab.R index 612629265..ec03ccd16 100755 --- a/R/ab.R +++ b/R/ab.R @@ -349,6 +349,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { found <- suppressWarnings(as.ab(gsub(" +", "", x[i], perl = TRUE), loop_time = loop_time + 2)) if (length(found) > 0 && !is.na(found)) { x_new[i] <- note_if_more_than_one_found(found, i, from_text) + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } } @@ -358,6 +359,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { found <- suppressWarnings(as.ab(gsub("[ 0-9]", "", x[i], perl = TRUE), loop_time = loop_time + 2)) if (length(found) > 0 && !is.na(found)) { x_new[i] <- note_if_more_than_one_found(found, i, from_text) + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } } @@ -392,6 +394,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { if (length(found_perms) > 0) { found <- found_perms[order(nchar(found_perms), decreasing = TRUE)][1] x_new[i] <- note_if_more_than_one_found(found, i, from_text) + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } } @@ -418,6 +421,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { x_translated_guess <- suppressWarnings(as.ab(x_translated, loop_time = loop_time + 2)) if (!is.na(x_translated_guess)) { x_new[i] <- x_translated_guess + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } @@ -441,6 +445,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { x_translated_guess <- suppressWarnings(as.ab(x_translated, loop_time = loop_time + 2)) if (!is.na(x_translated_guess)) { x_new[i] <- x_translated_guess + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } @@ -449,6 +454,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { found <- suppressWarnings(as.ab(gsub("[A-Z]+$", "", x[i], perl = TRUE), loop_time = loop_time + 2)) if (!is.na(found)) { x_new[i] <- note_if_more_than_one_found(found, i, from_text) + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } } @@ -457,6 +463,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { found <- suppressWarnings(as.ab(gsub("[^A-Z]", "", x[i], perl = TRUE), loop_time = loop_time + 2)) if (!is.na(found)) { x_new[i] <- note_if_more_than_one_found(found, i, from_text) + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } @@ -471,6 +478,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { } if (!is.na(found)) { x_new[i] <- note_if_more_than_one_found(found, i, from_text) + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } @@ -483,6 +491,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { found <- suppressWarnings(as.ab(substr(x[i], 1, 7), loop_time = loop_time + 2)) if (!is.na(found)) { x_new[i] <- note_if_more_than_one_found(found, i, from_text) + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } @@ -495,6 +504,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { } if (!is.na(found)) { x_new[i] <- note_if_more_than_one_found(found, i, from_text) + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } @@ -507,6 +517,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { } if (!is.na(found)) { x_new[i] <- note_if_more_than_one_found(found, i, from_text) + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } @@ -519,6 +530,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { found <- suppressWarnings(as.ab(x_spelling, loop_time = loop_time + 2, already_regex = TRUE)) if (!is.na(found)) { x_new[i] <- note_if_more_than_one_found(found, i, from_text) + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } @@ -540,6 +552,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { } if (!is.na(found)) { x_new[i] <- found[1L] + x_uncertain <- c(x_uncertain, x_bak[x[i] == x_bak_clean][1]) next } } # end of loop_time <= 2 @@ -590,11 +603,8 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { # Throw note about uncertainties if (isTRUE(info) && length(x_uncertain) > 0 && fast_mode == FALSE) { + x_uncertain <- unique(x_uncertain) if (message_not_thrown_before("as.ab", "uncertainties", x_bak)) { - plural <- c("", "this") - if (length(x_uncertain) > 1) { - plural <- c("s", "these uncertainties") - } if (length(x_uncertain) <= 3) { examples <- vector_and( paste0( @@ -603,7 +613,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) { ", ", AMR_env$ab_previously_coerced$ab[which(AMR_env$ab_previously_coerced$x_bak %in% x_uncertain)], ")"), quotes = FALSE) } else { - examples <- paste0(nr2char(length(x_uncertain)), " antimicrobial", plural[1]) + examples <- paste0(nr2char(length(x_uncertain)), " antimicrobials") } message_("Antimicrobial translation was uncertain for ", examples, ". If required, use `add_custom_antimicrobials()` to add custom entries.") diff --git a/data-raw/gpt_training_text_v2.1.1.9157.txt b/data-raw/gpt_training_text_v2.1.1.9158.txt similarity index 99% rename from data-raw/gpt_training_text_v2.1.1.9157.txt rename to data-raw/gpt_training_text_v2.1.1.9158.txt index 0e4770caa..0ebbcddfa 100644 --- a/data-raw/gpt_training_text_v2.1.1.9157.txt +++ b/data-raw/gpt_training_text_v2.1.1.9158.txt @@ -1,6 +1,6 @@ This knowledge base contains all context you must know about the AMR package for R. You are a GPT trained to be an assistant for the AMR package in R. You are an incredible R specialist, especially trained in this package and in the tidyverse. -First and foremost, you are trained on version 2.1.1.9157. Remember this whenever someone asks which AMR package version you’re at. +First and foremost, you are trained on version 2.1.1.9158. Remember this whenever someone asks which AMR package version you’re at. Below are the contents of the file, the file, and all the files (documentation) in the package. Every file content is split using 100 hypens. ----------------------------------------------------------------------------------------------------