diff --git a/.github/prehooks/commit-msg b/.github/prehooks/commit-msg index e03202f4..58e83f00 100755 --- a/.github/prehooks/commit-msg +++ b/.github/prehooks/commit-msg @@ -36,7 +36,9 @@ # check the commit message COMMIT_MSG=$(cat "$1") if [[ "$COMMIT_MSG" =~ \(no-check\)|\(no-checks\)|\(no-verify\) ]]; then - echo "Not running pre-commit checks; commit message contains '(no-check)', '(no-checks)', or '(no-verify)." + echo "Not running pre-commit checks:" + echo "Commit message contains '(no-check)', '(no-checks)', or '(no-verify)." + echo "" exit 0 fi diff --git a/NEWS.md b/NEWS.md index 7b36e607..525753fd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -29,6 +29,8 @@ This package now supports not only tools for AMR data analysis in clinical setti * Greatly improved `vctrs` integration, a Tidyverse package working in the background for many Tidyverse functions. For users, this means that functions such as `dplyr`'s `bind_rows()`, `rowwise()` and `c_across()` are now supported for e.g. columns of class `mic`. Despite this, this `AMR` package is still zero-dependent on any other package, including `dplyr` and `vctrs`. * Updated all ATC codes from WHOCC * Updated all antibiotic DDDs from WHOCC +* Fix for using a manual value for `mo_transform` in `antibiogram()` +* Fix for mapping 'high level' antibiotics in `as.ab()` (amphotericin B-high, gentamicin-high, kanamycin-high, streptomycin-high, tobramycin-high) ## Other * Added Jordan Stull, Matthew Saab, and Javier Sanchez as contributors, to thank them for their valuable input diff --git a/R/ab.R b/R/ab.R index 660f7e01..4898a549 100755 --- a/R/ab.R +++ b/R/ab.R @@ -645,6 +645,8 @@ generalise_antibiotic_name <- function(x) { x <- gsub("_(MIC|RSI|SIR|DIS[CK])$", "", x, perl = TRUE) # remove disk concentrations, like LVX_NM -> LVX x <- gsub("_[A-Z]{2}[0-9_.]{0,3}$", "", x, perl = TRUE) + # correct for 'high level' antibiotics + x <- gsub("([^A-Z0-9]+)?(HIGH(.?LEVEL)?|H[^A-Z0-9]?L)([^A-Z0-9]+)?", "-HIGH", x, perl = TRUE) # remove part between brackets if that's followed by another string x <- gsub("(.*)+ [(].*[)]", "\\1", x) # keep only max 1 space diff --git a/inst/tinytest/test-ab.R b/inst/tinytest/test-ab.R index 85f3382f..742b2ec3 100755 --- a/inst/tinytest/test-ab.R +++ b/inst/tinytest/test-ab.R @@ -79,6 +79,16 @@ expect_equal( # based on Levenshtein distance expect_identical(ab_name("ceftazidim/avibactam", language = NULL), "Ceftazidime/avibactam") +expect_identical(as.character(as.ab(c("gentamicine High Level", + "gentamicine High", + "gentamicine (High Level)", + "gentamicine (High)", + "gentamicine HL", + "gentamicine H-L", + "gentamicine (HL)", + "gentamicine (H-L)"))), + rep("GEH", 8)) + # assigning and subsetting x <- antibiotics$ab expect_inherits(x[1], "ab")