Commit Graph
1881 Commits
Author SHA1 Message Date
dr. M.S. (Matthijs) Berends e7077081b9 Set the order of sites in as.sir(), and add the veterinary sites
Sites now go from systemic, IV, meningitis, endocarditis, pneumonia and mastitis to UTI, topical and screen. A breakpoint without a site takes the position of "other", as both mean any site that is not listed next to it. A second site breaks a tie on the first one.

The veterinary sites are now fixed codes as well: mastitis (includes Mammary gland), respiratory, metritis, genital, soft tissue and wounds (includes Abscesses). Sites that are part of each other do not contradict.

site = "other" now leaves out every breakpoint limited to an indication, and prefers a breakpoint without a site.

A rebuild of clinical_breakpoints with this order gives the same data, so the same blocking rows stay.
2026-11-02 20:20:05 +01:00
dr. M.S. (Matthijs) Berends 414f41ba22 Rebuild clinical_breakpoints, and add the NEWS entries and version bump for this PR
The rebuild uses the WHONET files of today, and holds the changes of #326, #327, #328, #329 and #331. The files in data-raw/datasets are not regenerated yet.
2026-11-02 18:27:17 +01:00
dr. M.S. (Matthijs) Berends d904ea5afb Merge remote-tracking branch 'origin/main' into breakpoints 2026-11-02 18:26:08 +01:00
dr. M.S. (Matthijs) Berends fbdfb0a071 Keep only EUCAST blocking rows that have an effect on as.sir() (#326)
The new internal blocking_row_is_needed() defines this: as.sir() must give another result without the row, so the definition follows the fallback path of as.sir() itself. The build removes all rows without an effect, and the new strict test checks all rows of the latest guideline, and for all years that a blocking row has a breakpoint to block.

This replaces the separate taxonomic comparison, handles the points of the review on this pruning, and keeps the sites of blocking rows, which `site` in as.sir() now uses.
2026-11-02 18:26:08 +01:00
dr. M.S. (Matthijs) Berends 472c84d20d Capture more EUCAST breakpoints from the Notes, using regular expressions only (#329)
Added: the oxacillin disk for S. pseudintermedius and related species, the oxacillin MIC for coagulase-negative staphylococci, mupirocin for nasal decolonisation, and meropenem in other infections for N. meningitidis. The Bacteroides statement is now matched as a pattern, and other wording stops the script.

The script documents why statements are left out, e.g., the oxacillin statements for S. aureus, S. lugdunensis and S. saprophyticus are hedged ("mostly methicillin resistant"), unlike those for cefoxitin.
2026-11-02 17:47:28 +01:00
dr. M.S. (Matthijs) Berends 2c98dac7ae Store all screening breakpoints under screening agents, and add these agents to antimicrobials (#328)
Implements the decisions ticked in #328, and the behaviour specified in https://github.com/msberends/AMR/pull/339#issuecomment-6577438074: `include_screening` now defaults to NULL, using screening breakpoints for screening agents only. With TRUE, a regular agent also takes these breakpoints, and with FALSE a screening agent gives NA with a note.

- antimicrobials gains 13 screening agents, e.g. GEN-S, ERY-S and STR1-S
- GEH and STH rows move to GEN-S and STR1-S, and as.sir() keeps accepting both codes
- Topical cut-off values move to -S agents with site "Topical"
- WHONET-based rows move as ticked, including CLSI cefoxitin for staphylococci and pefloxacin for Salmonella, and EUCAST 2012-2018 cefoxitin MIC
- Clinical breakpoints that EUCAST also allows as a screening test get a copy under the -S agent
2026-11-02 17:31:46 +01:00
dr. M.S. (Matthijs) Berends fab20c5eaa Leave EUCAST breakpoints in brackets out of clinical_breakpoints, and document where they are kept (#327)
as.sir() treats them as absent, so it can use PK/PD breakpoints or, for unknown `uti`, UTI breakpoints. The values stay available in data-raw/breakpoints_eucast_raw.csv, to which the manual now points. Organisms that a table excludes stay excluded, since these have their own blocking rows.

This also fixes the change for unknown `uti` of the previous commit: a blocking row only gives way to an actual UTI breakpoint, not to a UTI row without breakpoints.
2026-11-02 17:03:47 +01:00
dr. M.S. (Matthijs) Berends 4c4a7d4392 Add site to as.sir(), and use UTI breakpoints for unknown uti if no other breakpoint exists
`site` takes fixed codes, e.g. "meningitis" or "iv", and can be a column. With `site = NA`, any fitting breakpoint can apply, from most to least systemic. With a site set, breakpoints for contradicting sites are left out, while a breakpoint without a site still applies, and the result is NA if only contradicting sites exist, without falling back to PK/PD. `uti = TRUE` stays available and equals `site = "uti"`. Every choice is noted in sir_interpretation_history(), including the site that was used.

For unknown `uti`, a blocking row without a UTI status no longer overrides a UTI breakpoint at the same taxonomic level. A `uti` vector mixing NA with TRUE or FALSE no longer gives an error.

Veterinary sites are not part of the fixed codes yet, and are treated as breakpoints without a site.
2026-11-02 16:59:07 +01:00
dr. M.S. (Matthijs) Berends 5eed396dce Store EUCAST MIC breakpoints exactly as published, and compare dilutions in as.sir() (#331)
The reproduction script no longer maps MIC breakpoints to AMR:::COMMON_MIC_VALUES, and also keeps the off-scale S breakpoint of 0.001 mg/L. as.sir() compares through the new internal mic_dilution_level(), so that e.g. an MIC of 0.032 and a breakpoint of 0.03 are the same dilution, and shows the published breakpoints in sir_interpretation_history().

Every parsed breakpoint now holds the address of its workbook cell in breakpoints_eucast_raw, and the script stops if a second reading of the workbooks with readxl does not find the value in that cell.

The data sets are rebuilt once, at the end of this PR.
2026-11-02 16:56:51 +01:00
dr. M.S. (Matthijs) Berends 844e2581ee Test that Morganella is interpreted as reported, not as M. morganii (#330)
No code change was needed. Morganella follows Enterobacterales, except for imipenem and imipenem-relebactam, for which EUCAST gives rows for Morganellaceae or Morganella.
2026-11-02 16:55:36 +01:00
dr. M.S. (Matthijs) Berends 724a94a48f Add a tool to compare as.sir() results between builds, and apply the Bacteroides extension to zone diameters
The new compare_clinical_breakpoints.R compares the interpretations of two builds, and fails on any change that is not explained. A rebuild of main with pinned WHONET files reproduces all rows of clinical_breakpoints and microorganisms.codes.

The filter on MIC rows in the scope extensions is removed, since these now join on the method of each statement. It kept the DISK rows of the Bacteroides statement from being copied.
2026-11-02 16:55:36 +01:00
Erwin Hassing 3132811fd2 Fix EUCAST bracket handling, redundant blockers and Bacteroides scope 2026-10-30 15:38:14 +01:00
dr. M.S. (Matthijs) Berends 08fd165a60 (v3.1.0.9014) Fix the CI: replace a test unsupported by tinytest, run R 3.0 on Ubuntu 24.04, and use Python 3.12 for the PyPI package, since ubuntu-latest moved to Ubuntu 26.04 2026-10-30 14:55:00 +01:00
dr. M.S. (Matthijs) Berends 7f3c75ece7 (v3.1.0.9013) Add species groups and complexes to the intrinsic_resistant data set for every antimicrobial to which all their species are intrinsically resistant (fixes #338) 2026-10-30 13:37:25 +01:00
dr. M.S. (Matthijs) Berends aab0fcc479 (v3.1.0.9012) Use the native R pipe throughout the examples on the website home page, and fix a typo 2026-10-30 12:52:30 +01:00
dr. M.S. (Matthijs) Berends 944078c4bc (v3.1.0.9011) Use top_n_microorganisms() in the WISCA examples of the index, manual and vignette, and reword the WISCA prior weight warning to also cover small groups (#337) 2026-10-30 12:45:56 +01:00
dr. M.S. (Matthijs) Berends fdfdadae14 (v3.1.0.9010) Fix the systematic underestimation of WISCA coverage by only including pathogens that occur in a group and were tested for the regimen, and warn when the prior weight of rare pathogens is large (fixes #337) 2026-10-30 12:35:12 +01:00
dr. M.S. (Matthijs) Berends 92bb8931c5 (v3.1.0.9009) Fix the misaligned arrows in the message on taxonomically renamed microorganisms in colour-supporting consoles, by padding on the visible width instead of using format() (fixes #336) 2026-10-30 09:59:01 +01:00
Matthijs Berends 08e68037db Merge pull request #333 from uzumakienes/uzumakienes-patch-1
Fix copyright link and add MycoBank to the welcome vignette
2026-10-23 19:42:19 +02:00
uzumakienes 904656241f Bump version and add NEWS entry 2026-10-23 16:46:42 +03:00
uzumakienes da44c3a569 Fix copyright link and add MycoBank in vignette 2026-10-23 16:46:27 +03:00
dr. M.S. (Matthijs) Berends 4e806b3d40 (v3.1.0.9005) Fix the CI check on R-oldrel-5 by letting pak ignore readxl on R versions older than 4.2, and by not forcing suggested packages in R CMD check 2026-10-23 14:15:49 +02:00
dr. M.S. (Matthijs) BerendsandClaude Sonnet 5.5 5fc152ae94 (v3.1.0.9004) Document the columns argument of the tidymodels steps to fix the Rd usage warning in R CMD check
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 18:23:06 +02:00
dr. M.S. (Matthijs) Berends bd208429cd (v3.1.0.9003) Rewrite the manual index on the website for findability: sections ordered by task (cleaning data, interpreting results as SIR, analysing data), titles before function names, a filter field that also finds topics mentioning a term, and colours prepared for dark mode; also make the tidymodels extensions public in the manual and use consistent help page titles 2026-10-17 09:36:10 +02:00
dr. M.S. (Matthijs) Berends 52d9c4a9e7 (v3.1.0.9002) Add a release checklist (release.md) with all steps of a regular CRAN release 2026-10-16 14:23:01 +02:00
dr. M.S. (Matthijs) Berends 5a4387a141 (v3.1.0.9001) Update the MO code registry with the codes of release v3.1.0, and the versions in the bug report template 2026-10-16 14:19:48 +02:00
dr. M.S. (Matthijs) Berends 052edc4761 v3.1.0 v3.1.0 2026-10-16 14:11:02 +02:00
dr. M.S. (Matthijs) Berends 6898472c8a (v3.0.1.9154) Shorten an example comment of wisca() to fix the Rd line widths NOTE 2026-10-16 06:32:46 +02:00
dr. M.S. (Matthijs) Berends 30021a9831 (v3.0.1.9153) Speed up mdro(), as.sir(), wisca() and wisca_plot() and the binding of mo vectors, fix PDR in the CMI 2012 guideline of mdro() being assigned to the wrong rows, and limit the stratified WISCA example to the 5 most common species 2026-10-16 06:08:26 +02:00
dr. M.S. (Matthijs) Berends 08aa47842e (v3.0.1.9152) Let a named colours_SIR without S, I or R use the default colours for these, which fixes the example of ggplot_sir() with colours = c(SI = "yellow"), let ggplot_sir() pass the facet as a value to facet_sir(), and make the test of the eucast_I default independent of the AMR_guideline option 2026-10-16 04:34:52 +02:00
dr. M.S. (Matthijs) Berends 43accd35d1 (v3.0.1.9151) Fix inconsistencies in the plotting functions and correct the translations of the interpretation categories
Plotting:
- Base colours and legends of interpreted MIC and disk values on the interpretation itself instead of matching colours
- Fix SDD in autoplot() for disks, the colours of barplot() for SIR values, and barplot() for MICs ignoring language and expand
- Match a named colours_SIR by name; let keep_operators = TRUE/FALSE in scale_*_mic() behave as "all"/"none"
- Let a named values in scale_*_sir() replace the colours it names, warn in scale_x_sir(), and pass other arguments on
- Let the default of eucast_I follow the guideline option, also for EUCAST before 2019
- Support unquoted column names in facet_sir() without evaluating them
- Correct the documentation and examples

Translations:
- Add SDD, NS, WT and NWT, and correct S, I, R and NI in 18 languages
- Sources of the terms for 'I': NAK via German laboratories (de), SZU national reference laboratory (cs), lex.dk (da), Karolinska University Hospital (sv), COESANT (es), Nordlab (fi), CA-SFM (fr); no by analogy with da and sv
- Not verified against an official source: ar, bn, el, hi, id, ja, ko, pl, ro, ru, sw, tr, uk, ur, vi, zh

Tests:
- Let the grouped antibiogram test use English so it passes in other locales
2026-10-15 22:25:20 +02:00
dr. M.S. (Matthijs) Berends b63263cc56 (v3.0.1.9150) Add the open issues found while correcting the WHONET codes to the taxonomy report 2026-10-15 21:31:28 +02:00
dr. M.S. (Matthijs) Berends eb9a9c2fa5 (v3.0.1.9149) Fix WHONET codes in microorganisms.codes that referred to unrelated microorganisms, let codes refer to the name they were named after and add a source column, and replace the fuzzy matching of WHONET names by exact matching with a guard against unreviewed remaps
WHONET names are now matched exactly (also outdated names, after removing qualifiers), then on GBIF identifier, and fuzzy results are only kept if consistent with that; otherwise the genus or UNKNOWN is used. A code refers to the record of the name it was named after (e.g. EAE is Enterobacter aerogenes) if that name refers to the same taxon. Every remap of an existing code to another taxon must be listed in data-raw/whonet_remaps_reviewed.csv; the 198 remaps of this rebuild were reviewed.
2026-10-15 21:08:04 +02:00
dr. M.S. (Matthijs) Berends 179eec584f (v3.0.1.9148) Store zone diameters without S category as blocking rows for EUCAST and as R-only rows for CLSI instead of capping them at 50 mm, let as.mo() return the complex for names such as 'Acinetobacter calcoaceticus-baumannii complex', make the breakpoint reproduction scripts stop on unchecked data defects and year-independent, and document that as.disk() returns NA above 50 mm
The full rebuild of clinical_breakpoints also assigns Salmonella serovars and the Bacteroides fragilis complex correctly and adds ECOFFs for Neocosmospora solani. The rebuilt microorganisms.codes is not included, since it remaps WHONET codes that need review first.
2026-10-15 17:05:41 +02:00
dr. M.S. (Matthijs) Berends fcfaa87f5d (v3.0.1.9147) Keep EUCAST blocking rows for infections other than UTI where EUCAST only gives a UTI breakpoint, e.g. breakpoints in brackets for aminoglycosides in Acinetobacter, and let as.sir() with unknown uti consistently prefer non-UTI breakpoints, use UTI breakpoints only if no others exist and note this in sir_interpretation_history() every time
The pruning of blocking rows in the EUCAST reproduction script now compares UTI status too, and the script is fixed for the renamed column of the as.ab() coercion cache. In clinical_breakpoints, only the blocking rows were replaced (356 organism/agent/method combinations newly blocked, none unblocked); other changes of a full rebuild, caused by taxonomy updates in the WHONET-based rows, are not included.
2026-10-15 14:55:57 +02:00
dr. M.S. (Matthijs) Berends d69e7fa740 (v3.0.1.9146) Correct the comment in the EUCAST reproduction script stating that breakpoints in brackets are excluded from clinical_breakpoints: they are kept as blocking rows without values 2026-10-15 12:13:56 +02:00
Matthijs Berends 499b0396d9 Merge pull request #324 from msberends/guideline-aggregation
Let aggregated analyses follow the guideline for the 'I' category and deprecate `combine_SI`
2026-10-15 11:52:00 +02:00
dr. M.S. (Matthijs) Berends 38ae865a07 Document all values of rank_index in the clinical_breakpoints data set, including species groups, and the stored value of EUCAST's off-scale S breakpoint 2026-10-15 10:37:40 +02:00
dr. M.S. (Matthijs) Berends 859b99e596 Format the month of the taxonomy update in English regardless of the system locale 2026-10-15 10:34:06 +02:00
dr. M.S. (Matthijs) Berends b3ecc01657 Show translated pathogen names instead of microorganism codes in grouped traditional antibiograms, including for unknown species 2026-10-15 10:31:07 +02:00
dr. M.S. (Matthijs) Berends 3db586a110 update logo to be perfect hexagon 2026-10-15 10:24:08 +02:00
dr. M.S. (Matthijs) Berends eb6d07e1fe Include isolates of unknown species in grouped antibiograms and in wisca(), which were silently excluded with the warning 'invalid microorganism code, NA generated' 2026-10-15 10:21:44 +02:00
dr. M.S. (Matthijs) Berends 3a87075ad3 Make the version formula for PRs in CLAUDE.md consistent with the pre-commit hook, which counts the commits before the new commit 2026-10-15 10:11:09 +02:00
dr. M.S. (Matthijs) Berends 0efc8826c8 Let aggregated analyses follow the guideline for the 'I' category in count_df(), proportion_df(), sir_df(), the plotting functions, antibiogram(), wisca(), and bug_drug_combinations(), deprecate combine_SI in favour of guideline, fix format() on bug_drug_combinations() counting I as resistant, and add a shared section 'Interpretation of SIR' 2026-10-15 09:58:21 +02:00
dr. M.S. (Matthijs) Berends dbd95ffa46 (v3.0.1.9137) Add the guideline argument to count_df(), proportion_df(), sir_df(), ggplot_sir(), geom_sir(), and labels_sir_count(), so that with CLSI the 'I' category is merged with R, and describe in the documentation of get_AMR_locale() that LANG takes precedence over LANGUAGE 2026-10-15 08:25:37 +02:00
dr. M.S. (Matthijs) Berends 46f5de1d36 (v3.0.1.9136) Fix the CI entry with a Dutch locale by using a UTF-8 locale that is installed on the runner, and skip the mo_source tests with skip_if() so that the tinytest harness for old R versions supports them 2026-10-15 00:11:07 +02:00
dr. M.S. (Matthijs) Berends 8b01bcb23c (v3.0.1.9135) Fix get_mo_source() removing the mo_source file at the default location, returning the wrong mo_source, and throwing an error after the original file was moved, and run the unit tests in CI also in a real interactive session and with a user setup, a Dutch locale, and CLSI as default guideline, with tests that no longer assume an English locale or EUCAST 2026-10-14 23:34:45 +02:00
dr. M.S. (Matthijs) Berends 4be7352843 (v3.0.1.9134) Add session cache assertions for separate as.ab() and as.mo() calls, for get_mo_source() without a file, and for real cache hits, which detect the cache being emptied in interactive sessions 2026-10-14 22:49:00 +02:00
dr. M.S. (Matthijs) Berends e88faf8d40 (v3.0.1.9133) Fix the as.mo() session cache being cleared on every call in interactive sessions without an mo_source file 2026-10-14 21:59:02 +02:00
dr. M.S. (Matthijs) Berends 1a1a3abed1 (v3.0.1.9132) Make translating around 50 times faster and coercion of unknown input in as.ab() up to 70 times faster with identical results, use DOIs instead of PubMed URLs, shorten an example line, and reword cran-comments.md 2026-10-14 20:17:28 +02:00