diff --git a/CLAUDE.md b/CLAUDE.md index 653a60014..eec8c2f86 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -146,7 +146,7 @@ Version format: `major.minor.patch.dev` (e.g., `3.0.1.9021`) - Stable CRAN releases drop the dev suffix (e.g., `3.0.1`) - `NEWS.md` uses sections **New**, **Fixes**, **Updates** with GitHub issue references (`#NNN`) -### Version bump required for every PR +### Version and date bump required for every PR Before opening a pull request, always increment the four-digit dev counter by 1 in **both** of these files: @@ -162,6 +162,12 @@ Before opening a pull request, always increment the four-digit dev counter by 1 Read the current version from `DESCRIPTION`, add 1 to the last numeric component, and write the new version to both files in the same commit as the rest of the PR changes. +Also bump the date to the current date in **`DESCRIPTION`**, where it's in the `Date:` field in ISO format: + +``` +Date: 2025-12-31 +``` + ## Internal State The package uses a private `AMR_env` environment (created in `aa_globals.R`) for caching expensive lookups (e.g., microorganism matching scores, breakpoint tables). This avoids re-computation within a session. diff --git a/DESCRIPTION b/DESCRIPTION index d96888093..79d28bcfe 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 3.0.1.9022 +Version: 3.0.1.9023 Date: 2026-03-03 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) diff --git a/NEWS.md b/NEWS.md index 26195aa1b..fbbdc9da7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 3.0.1.9022 +# AMR 3.0.1.9023 ### New * Integration with the **tidymodels** framework to allow seamless use of SIR, MIC and disk data in modelling pipelines via `recipes` @@ -18,6 +18,7 @@ - `eucast_rules()` has become a wrapper around that function. ### Fixes +* Fixed a bug in `as.ab()` where certain AB codes containing "PH" or "TH" (such as `ETH`, `MTH`, `PHE`, `PHN`, `STH`, `THA`, `THI1`) would incorrectly return `NA` when combined in a vector with any untranslatable value (#245) * Fixed a bug in `antibiogram()` for when no antimicrobials are set * Fixed a bug in `as.sir()` where for numeric input the arguments `S`, `I`, and `R` would not be considered (#244) * Fixed some foreign translations of antimicrobial drugs diff --git a/R/ab.R b/R/ab.R index b72705f44..58b9abaef 100755 --- a/R/ab.R +++ b/R/ab.R @@ -119,7 +119,14 @@ as.ab <- function(x, flag_multiple_results = TRUE, language = get_AMR_locale(), x[x %like_case% "^PENICILLIN" & x %unlike_case% "[ /+-]"] <- "benzylpenicillin" x_bak_clean <- x if (already_regex == FALSE) { + x_bak_clean_before_gen <- x_bak_clean x_bak_clean <- generalise_antibiotic_name(x_bak_clean) + # generalise_antibiotic_name() rewrites "PH"->"F" and "TH"->"T", which + # mangles short valid AB codes (e.g. "ETH"->"ET", "PHN"->"FN", "STH"->"ST") + # making them unrecognisable in the lookup. Restore any values that were + # already valid AB codes before generalisation (#245). + is_valid_ab_code <- x_bak_clean_before_gen %in% AMR_env$AB_lookup$ab + x_bak_clean[is_valid_ab_code] <- x_bak_clean_before_gen[is_valid_ab_code] } x <- unique(x_bak_clean) # this means that every x is in fact generalise_antibiotic_name(x)