Commit Graph
1187 Commits
Author SHA1 Message Date
Claude 80d5aabed0 Fix stats::setNames, test accessor bug, and version script verification
R/mdro.R:
  Qualify setNames() as stats::setNames() in the drug+inhibitor inference
  block to satisfy R CMD CHECK's global-function checks.

tests/testthat/test-mdro.R:
  mdro() with verbose=FALSE returns an atomic ordered factor, not a
  data.frame. Fix three test errors introduced in the previous commit:
  - Line 320: result_no_pip$MDRO -> result_no_pip (factor, no $ accessor)
  - Line 328: result_tzp_s$MDRO / result_no_pip$MDRO -> direct factor refs
  - Line 347: expect_inherits(..., "data.frame") -> c("factor","ordered")
  Also fix the comment on line 347 to match the actual return type.

Version: confirmed at 3.0.1.9029 (no further bump; one bump already made
this PR). git describe failed (no tags in dev environment) — fallback
applies. The +1 in CLAUDE.md's formula is correct for tagged repos:
currentcommit + 9001 + 1 = 27 + 9001 + 1 = 9029 ✓

https://claude.ai/code/session_01Cp154UtssHg84bw38xiiTG
2026-03-07 14:54:07 +00:00
Claude c500fdb645 Add sir.R/mic.R fixes and mdro() unit tests; bump to 3.0.1.9030
R/sir.R (line 571):
  Guard purely numeric strings (e.g. "1", "8") from the Unicode letter
  filter. Values matching the broad SIR regex but consisting only of digits
  must not be stripped; add `x %unlike% "^[0-9+]$"` predicate.

R/mic.R (lines 220-222):
  Preserve the letter 'e' during Unicode-letter removal so that MIC values
  in scientific notation (e.g. "1e-3", "2.5e-2") survive the cleaning step.
  - Line 220: [\\p{L}] → [^e\\P{L}]  (remove all letters except 'e')
  - Line 222: [^0-9.><= -]+ → [^0-9e.><= -]+  (allow 'e' in whitelist)

tests/testthat/test-mdro.R:
  New tests for the drug+inhibitor inference added in the previous commit
  (issue #209):
  - TZP=R with no PIP column → PIP inferred R → MDRO class elevated
  - TZP=S with no PIP column → proxy col is NA (not S) → class lower
  - verbose mode emits "Inferring resistance" message
  - AMC=R with no AMX column runs without error (Enterococcus faecium)

https://claude.ai/code/session_01Cp154UtssHg84bw38xiiTG
2026-03-07 13:43:21 +00:00
Claude 485ae25e09 mdro(): infer base drug resistance from drug+inhibitor combination columns (#209)
When a base beta-lactam column (e.g., piperacillin/PIP) is absent but a
corresponding drug+inhibitor combination (e.g., piperacillin/tazobactam/TZP)
is present and resistant, resistance in the base drug is now correctly
inferred. This is clinically sound: resistance in a combination implies the
inhibitor provided no benefit, so the base drug is also resistant.

Susceptibility in a combination is NOT propagated to the base drug (the
inhibitor may be responsible for susceptibility), so only R values are
inferred; missing base drugs remain NA otherwise.

Implementation details:
- Uses AB_BETALACTAMS_WITH_INHIBITOR to identify all beta-lactam+inhibitor
  combinations present in the user's data
- Derives base drug AB codes by stripping the "/inhibitor" part from names
- Creates synthetic proxy columns (.sir_proxy_<AB>) in x, set to "R" when
  any matching combination is R, otherwise NA
- Proxy columns are added to cols_ab before drug variable assignment,
  so all existing guideline logic benefits without any changes
- Multiple combos for the same base drug are OR-ed (any R → R)
- Adds internal ab_without_inhibitor() helper for the name->base mapping
- Verbose mode reports which combinations are used for inference

Bumps version: 3.0.1.9028 -> 3.0.1.9029

https://claude.ai/code/session_01Cp154UtssHg84bw38xiiTG
2026-03-06 19:16:21 +00:00
dr. M.S. (Matthijs) Berends daab605ca4 (v3.0.1.9028) fix unique CIDs 2026-03-06 18:53:42 +01:00
dr. M.S. (Matthijs) Berends c0a394008e (v3.0.1.9027) Fixes #252 and add documentation update regarding #253 2026-03-06 13:10:33 +01:00
dr. M.S. (Matthijs) Berends 60e8f2bae6 (v3.0.1.9026) fix ab_group(NA) 2026-03-06 12:41:27 +01:00
Matthijs BerendsandClaude 4e3ea95fbd Claude/fix issue 245 (#262)
* fix: restore valid AB codes mangled by generalise_antibiotic_name() (#245)

When as.ab() received a vector containing both valid AB codes (like ETH,
PHN, PHE, STH, THA, MTH, THI1) and an untranslatable value, the fast
path at line 100 was skipped. The slow path then applied
generalise_antibiotic_name(), which rewrites "TH"->"T" and "PH"->"F",
mangling these short AB codes (e.g. ETH->"ET", PHN->"FN") so they could
no longer be found in the lookup table.

Fix: save the pre-generalised values before applying
generalise_antibiotic_name(), then restore any elements that were already
valid AB codes in their original form.

https://claude.ai/code/session_01Sujw89qa48NoUmMPDBJLz9

* fix: use toupper() in AB code restoration to handle lowercase input (#245)

Ensures that lowercase user input (e.g. 'eth', 'phn') is matched
case-insensitively against the uppercase AB codes in $ab, and that
the restored value is stored in uppercase to match the lookup table.

https://claude.ai/code/session_01Sujw89qa48NoUmMPDBJLz9

* revert: remove unnecessary toupper() since x is already uppercased

https://claude.ai/code/session_01Sujw89qa48NoUmMPDBJLz9

* Revise versioning and date bump requirements for PRs

Updated versioning instructions for pull requests to include date bump.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 08:59:44 +01:00
dr. M.S. (Matthijs) Berends b6211931f8 (v3.0.1.9022) add ceftibuten/avibactam (CTA), kasugamycin (KAS), ostreogrycin (OST), thiostrepton (THS), xeruborbactam (XER), zorbamycin (ZOR) 2026-03-03 15:41:08 +01:00
dr. M.S. (Matthijs) Berends 12cf144b19 (v3.0.1.9021) add guideline to resistance() and susceptibility() 2026-02-12 20:34:06 +01:00
dr. M.S. (Matthijs) Berends 499c830ee7 (v3.0.1.9020) unit test fixes 2026-02-09 13:16:36 +01:00
dr. M.S. (Matthijs) Berends ba4c159154 (v3.0.1.9019) Wildtype/Non-wildtype support, and start with interpretive_rules()
Fixes #246
Fixes #254
Fixes #255
Fixes #256
2026-02-08 23:15:40 +01:00
dr. M.S. (Matthijs) Berends 2df2911cf4 (v3.0.1.9018) fixes #249
updates AB groups
2026-01-16 10:57:03 +01:00
dr. M.S. (Matthijs) Berends fd50c51543 (v3.0.1.9017) fix documentation 2026-01-08 14:03:02 +01:00
dr. M.S. (Matthijs) Berends 7df28bce28 (v3.0.1.9015) fix translations 2026-01-08 10:21:48 +01:00
dr. M.S. (Matthijs) Berends 7b9c151241 (v3.0.1.9014) try-again fix 2026-01-07 15:10:21 +01:00
dr. M.S. (Matthijs) Berends 85e8e814e8 (v3.0.1.9013) fix translations 2026-01-07 13:30:54 +01:00
dr. M.S. (Matthijs) Berends fa827f27f4 (v3.0.1.9012) fix translations 2026-01-07 11:00:58 +01:00
dr. M.S. (Matthijs) Berends cfbbfb4fa5 (v3.0.1.9007) fix #246 2026-01-06 23:08:50 +01:00
dr. M.S. (Matthijs) Berends 151af21f38 (v3.0.1.9005) re-add tidymodels implementation 2025-12-21 12:19:43 +01:00
dr. M.S. (Matthijs) Berends 225c73f7e7 (v3.0.1.9004) Revamp as.sir() interpretation for capped MICs
Fixes #243
Fixes #244
2025-12-15 13:18:13 +01:00
dr. M.S. (Matthijs) Berends ba30b08f76 (v3.0.1.9003) Add taniborbactam and cefepime/taniborbactam 2025-11-24 11:24:02 +01:00
dr. M.S. (Matthijs) Berends 0b24967b23 (v3.0.1.9001) fix antibiogram 2025-09-30 10:54:07 +02:00
dr. M.S. (Matthijs) Berends adee419f1c v3.0.1 2025-09-20 17:14:07 +01:00
dr. M.S. (Matthijs) Berends 33fb1849eb (v3.0.0.9036) Prepare for v3.0.1 2025-09-19 12:23:59 +01:00
dr. M.S. (Matthijs) Berends 10ba36821e (v3.0.0.9034) fix MycoBank synonyms 2025-09-18 13:58:34 +01:00
dr. M.S. (Matthijs) Berends e8c99f2775 (v3.0.0.9031) fix for ggplot2 2025-09-12 16:52:59 +02:00
dr. M.S. (Matthijs) Berends c7b2acbeb6 (v3.0.0.9029) fix for vignette and envir data 2025-09-10 16:19:30 +02:00
dr. M.S. (Matthijs) Berends 1922fb5ff2 (v3.0.0.9028) fix as.ab() warning 2025-09-10 15:06:51 +02:00
dr. M.S. (Matthijs) Berends 4d7c4ca52c (v3.0.0.9027) skimr update and as.ab warning - fixes #234, fixes #232 2025-09-10 13:32:52 +02:00
dr. M.S. (Matthijs) Berends 3ba1b8a10a (v3.0.0.9022) postpone new features - we like a clearly focussed bugfix release first 2025-09-03 15:39:44 +02:00
dr. M.S. (Matthijs) Berends 60bd631e1a (v3.0.0.9019) Fixes #229, #230, #227, #225 2025-09-01 16:56:55 +02:00
dr. M.S. (Matthijs) Berends 9b07a8573a (v3.0.0.9018) keep all reasons in mdro(), fixed #227 2025-08-07 16:23:47 +02:00
dr. M.S. (Matthijs) Berends 2f866985c9 (v3.0.0.9016) fix for plotting 2025-07-23 22:05:20 +02:00
RUG 6cb724a208 (v3.0.0.9015) plotting fix 2025-07-19 14:06:36 +02:00
dr. M.S. (Matthijs) Berends 49274f010b (v3.0.0.9014) fix plot colours 2025-07-18 15:57:48 +02:00
dr. M.S. (Matthijs) Berends 39ea5f6597 (v3.0.0.9011) allow names for age_groups() 2025-07-17 19:32:46 +02:00
dr. M.S. (Matthijs) Berends 65ec098acf (v3.0.0.9010) in as.sir(), add note when higher taxonomic levels are used 2025-07-17 19:06:12 +02:00
Nick Thomson e9e3de4469 (v3.0.0.9009) fix as.sir when uti = FALSE 2025-07-17 17:15:52 +02:00
dr. M.S. (Matthijs) Berends d94bdd2c6a (v3.0.0.9008) fix ggplot_sir(), support lighter green for SDD 2025-07-17 17:05:41 +02:00
dr. M.S. (Matthijs) Berends 8dab0a3730 (v3.0.0.9007) allow any tidyselect language in as.sir() 2025-07-17 14:29:35 +02:00
dr. M.S. (Matthijs) Berends 8fd8ee508f (v3.0.0.9004) random mic fix 2025-06-13 16:12:28 +02:00
dr. M.S. (Matthijs) Berends 72db2b2562 (v3.0.0.9003) eucast_rules fix, new tidymodels integration 2025-06-13 14:03:21 +02:00
dr. M.S. (Matthijs) Berends 3742e9e994 (v3.0.0.9002) website version nr 2025-06-06 09:37:25 +02:00
dr. M.S. (Matthijs) Berends 753f0e1ef9 (v3.0.0.9001) the first fixes 2025-06-04 13:10:20 +02:00
dr. M.S. (Matthijs) Berends 1710e220dd AMR v3.0\! 2025-06-02 12:11:00 +02:00
dr. M.S. (Matthijs) Berends 79038fed21 (v2.1.1.9290) typo 2025-06-01 16:07:38 +02:00
dr. M.S. (Matthijs) Berends d384b492cf (v2.1.1.9289) unit test fix 2025-06-01 16:00:12 +02:00
dr. M.S. (Matthijs) Berends 46f80b1378 (v2.1.1.9288) mdro fix 2025-06-01 15:35:04 +02:00
dr. M.S. (Matthijs) Berends 5667ce3eae (v2.1.1.9287) fix antibiotics 2025-06-01 12:17:47 +02:00
dr. M.S. (Matthijs) Berends e70f3de02e (v2.1.1.9286) deprecate antibiotics better, add ATC for ceftaroline 2025-06-01 11:54:40 +02:00