1
0
mirror of https://github.com/msberends/AMR.git synced 2026-05-14 07:10:47 +02:00
Commit Graph

33 Commits

Author SHA1 Message Date
Matthijs Berends
24f24ecaf8 Generalise interpretive rules for multi-guideline support (#268) (#283)
* Generalise interpretive rules for multi-guideline support (#268)

- Rename data-raw/eucast_rules.tsv → interpretive_rules.tsv; add rule.provider
  column (value: "EUCAST") to distinguish future CLSI rows
- Rename EUCAST_RULES_DF → INTERPRETIVE_RULES_DF in _pre_commit_checks.R;
  filter by rule.provider == guideline when applying rules in interpretive_rules()
- Rename custom_eucast_rules() → custom_interpretive_rules() with new S3 class
  "custom_interpretive_rules"; old function becomes a deprecated wrapper in
  zz_deprecated.R; backward-compat S3 dispatch shims added for old class
- Remove stop_if(guideline == "CLSI", ...) so clsi_rules() no longer errors
- Add .onLoad shim in zzz.R to create INTERPRETIVE_RULES_DF from EUCAST_RULES_DF
  for transitional compatibility until sysdata.rda is regenerated

https://claude.ai/code/session_01D46BTsfJSPo3HnLWp3PRkP

* Fix namespace load failure: remove assignInNamespace from .onLoad (#268)

assignInNamespace cannot add NEW bindings to a locked package namespace
(R locks namespace bindings before .onLoad runs). Replace the .onLoad
shim with a runtime fallback inside interpretive_rules(): if
INTERPRETIVE_RULES_DF is absent (pre-regeneration sysdata.rda), derive
it from EUCAST_RULES_DF by adding the rule.provider column. This also
fixes the screening_abx line to reuse the already-resolved
interpretive_rules_df_total instead of a bare INTERPRETIVE_RULES_DF
reference.

https://claude.ai/code/session_01D46BTsfJSPo3HnLWp3PRkP

* fixes

* fixes

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-01 18:38:51 +01:00
Matthijs Berends
f7e9294bea Add parallel computing support to antibiogram() and wisca() (#281) (#282)
* Add parallel computing support to antibiogram() and wisca() (#281)

For WISCA: simulations are distributed across (group, chunk) job pairs
via future.apply::future_lapply(), keeping all workers active even when
the regimen count is smaller than nbrOfWorkers(). Sequential fallback
with progress ticker is preserved when parallel = FALSE or workers = 1.

For grouped antibiograms: each group is processed by a separate worker,
mirroring the row-batch approach in as.sir().

Same gate pattern as as.sir() (PR #280): requires a non-sequential
future::plan() to be active; auto-upgrades to parallel = TRUE when a
parallel plan is detected; throws an informative error otherwise.

https://claude.ai/code/session_01FC43syPbzhGmKgrrVNHjnF

* Fix version to 3.0.1.9055 and update CLAUDE.md version formula

Uses origin/${defaultbranch} (with a fetch) instead of the local
branch ref so the commit count is never stale after a merge.

https://claude.ai/code/session_01FC43syPbzhGmKgrrVNHjnF

* Fix non-ASCII characters in antibiogram.R

Replace en/em dashes and non-breaking spaces with ASCII equivalents
to satisfy R CMD check portability requirement.

https://claude.ai/code/session_01FC43syPbzhGmKgrrVNHjnF

* Update auto-generated Rd files after documentation rebuild

https://claude.ai/code/session_01FC43syPbzhGmKgrrVNHjnF

* Move parallel gate to top of antibiogram.default() like sir.R

The gate was inside the wisca==TRUE block, so parallel=TRUE with a
sequential plan was silently ignored for non-WISCA antibiograms.
Now the gate runs unconditionally at the top of the function,
identical to the as.sir() pattern: error on explicit parallel=TRUE
with sequential plan, auto-upgrade when a non-sequential plan is
already active.

https://claude.ai/code/session_01FC43syPbzhGmKgrrVNHjnF

* Fix parallel WISCA returning all NA; strengthen tests; add sequential hint

Bug: lapply() over a factor yields length-1 factor elements (integer
codes), while for() over a factor yields character strings.  The job
list stored j\$group as a factor integer, but the reassembly loop
compared it with identical(j\$group, g) where g was character -- always
FALSE, so no simulation chunks were ever assembled and coverage stayed
NA throughout.

Fix: convert unique_groups to character before building jobs so both
the job list and the reassembly loop use the same type.

Tests: replaced na.rm = TRUE guards with explicit anyNA() checks so the
test suite would have caught the all-NA result immediately.

Also adds a sequential-mode performance hint (analogous to sir.R
lines 1116-1127) when simulations >= 500 and >= 3 regimens.

https://claude.ai/code/session_01FC43syPbzhGmKgrrVNHjnF

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-30 18:41:56 +01:00
e0f8cf0882 (v3.0.1.9047) fix #272 2026-04-21 22:11:40 +02:00
1fdab84103 (v2.1.1.9233) chore: make all argument texts full sentences 2025-03-31 14:53:24 +02:00
63099cd81e (v2.1.1.9232) is.mic() iteration, documentation cleanup 2025-03-31 10:51:31 +02:00
66833b4f5a (v2.1.1.9126) implemented WISCA! Also added top_n_microorganisms() and fixed Python wrapper 2025-01-26 23:01:17 +01:00
08a27922a8 new SDD and N for as.sir() 2024-05-20 15:27:04 +02:00
830c67f1bf documentation, unit tests 2023-01-24 10:20:27 +01:00
Dr. Matthijs Berends
98e62c9af2 Replace RSI with SIR 2023-01-21 23:47:20 +01:00
593d740b84 documentation, file permissions 2023-01-19 12:54:53 +01:00
7ca44fb756 cleanup and new intro logo 2022-11-13 13:44:25 +01:00
2d90218305 documentation fix 2022-11-05 12:06:40 +01:00
4d050aef7c styled, unit test fix 2022-08-28 10:31:50 +02:00
952d16de33 new, automated website 2022-08-21 16:37:20 +02:00
08d387b5ce (v1.8.0.9005) as.rsi() fix 2022-03-10 19:33:25 +01:00
18e8525d10 (v1.8.0.9001) as.mo improvement, fixes #52 2022-02-26 21:58:23 +01:00
7965468ccd (v1.7.1.9058) vars selection for set_ab_names() 2021-12-05 22:06:45 +01:00
bef0f42f66 (v1.7.0.9001) CLSI 2020 guideline 2021-06-01 15:33:06 +02:00
a13fd98e8b (v1.6.0.9063) prepare new release 2021-05-24 09:00:11 +02:00
29dbfa2f49 (v1.6.0.9021) join functions update 2021-05-12 18:15:03 +02:00
850c123de7 (v1.5.0.9032) All group generics for MICs 2021-03-07 13:52:39 +01:00
2eca8c3f01 (v1.5.0.9014) only_rsi_columns, is.rsi.eligible improvement 2021-02-02 23:57:35 +01:00
20d638c193 (v1.5.0.9013) updated tibble printing colours 2021-01-28 16:09:30 +01:00
286eaa9699 (v1.5.0.9010) MDRO vignette update, get_episode for < day 2021-01-24 14:48:56 +01:00
4eab095306 (v1.5.0.9006) major documentation update 2021-01-18 16:57:56 +01:00
4e0374af29 (v1.3.0.9035) mdro() for EUCAST 3.2, examples cleanup 2020-09-29 23:35:46 +02:00
76fc8e1b14 (v1.2.0.9026) move to github 2020-07-08 14:48:06 +02:00
329a0eb0b6 (v1.2.0.9019) ab_from_text() dose and administration 2020-07-01 11:07:01 +02:00
e467cc103e (v1.1.0.9017) as.ab() update, added ab_url() 2020-05-22 20:15:19 +02:00
7f3da74b17 (v1.1.0.9004) lose dependencies 2020-05-16 13:05:47 +02:00
219cff403f (v1.0.1.9004) Support dplyr 1.0.0 2020-03-14 14:05:43 +01:00
77656a676c (v1.0.1.9002) PCA unit tests 2020-03-08 11:18:59 +01:00
fa0d9c58d9 (v1.0.1.9000) first PCA implementation 2020-03-07 21:48:21 +01:00