Commit Graph
914 Commits
Author SHA1 Message Date
dr. M.S. (Matthijs) Berends b74501663b Merge branch 'main' into breakpoints 2026-11-09 22:11:08 +01:00
dr. M.S. (Matthijs) Berends 49a0f37713 (v3.1.0.9021) Show the number of tested isolates on susceptible-only bars, and split ggplot_sir() by antimicrobial if it is not shown in the plot 2026-11-09 22:10:01 +01:00
dr. M.S. (Matthijs) Berends 591c044b13 Merge branch 'main' into breakpoints 2026-11-09 21:59:09 +01:00
dr. M.S. (Matthijs) Berends 035c7e7871 (v3.1.0.9020) Plot only the susceptible proportion in ggplot_sir() and geom_sir() if the interpretation is not shown, following the guideline 2026-11-09 21:57:55 +01:00
dr. M.S. (Matthijs) Berends af344f58f1 Merge branch 'main' into breakpoints 2026-11-09 21:53:58 +01:00
dr. M.S. (Matthijs) Berends 054066b855 (v3.1.0.9019) Fix the data labels of labels_sir_count() being placed on the wrong bars with position = "dodge" or "stack" 2026-11-09 21:52:40 +01:00
dr. M.S. (Matthijs) Berends fdc31345a6 Merge branch 'main' into breakpoints
# Conflicts:
#	NEWS.md
2026-11-09 21:30:10 +01:00
dr. M.S. (Matthijs) Berends 77b6cb1713 (v3.1.0.9018) Italicise taxonomic names in all plotting functions using labels_taxonomy(), and fix ggplot_pca() with explicit groups 2026-11-09 21:28:37 +01:00
dr. M.S. (Matthijs) Berends 95756d224d Merge branch 'main' into breakpoints
# Conflicts:
#	DESCRIPTION
#	NEWS.md
#	R/sysdata.rda
#	data/antibiotics.rda
#	data/antimicrobials.rda
2026-11-09 20:46:50 +01:00
dr. M.S. (Matthijs) Berends cfb55a4c3e (v3.1.0.9017) Add labels_taxonomy() for taxonomic names in italics in plot labels, add type = "plotmath" to italicise_taxonomy(), and only italicise species names after a genus 2026-11-09 20:45:07 +01:00
dr. M.S. (Matthijs) Berends a108548cd4 Merge remote-tracking branch 'origin/main' into breakpoints 2026-11-04 19:26:35 +01:00
dr. M.S. (Matthijs) Berends 3b8b213616 Return the serovar in mo_shortname() for Salmonella, keep Salmonella groups apart from streptococci, abbreviate all Lancefield groups, and apply the Typhi rule in mdro() (#341) 2026-11-04 07:57:20 +01:00
dr. M.S. (Matthijs) Berends 361dfc28f7 Apply the EUCAST breakpoints of Vibrio to the species that EUCAST states only
The Vibrio sheet (v12.0 to v16.1) states: "Breakpoints are valid for V. alginolyticus, V. cholerae, V. fluvialis, V. parahaemolyticus and V. vulnificus." The rows of the genus are therefore replaced by rows of these species, with the statement in the note. Other species and isolates identified at genus level give NA, or use PK/PD breakpoints in EUCAST 2022-2023. CLSI is unchanged.

Any other wording of "breakpoints are valid for" now stops the script, so that a new statement cannot be missed.
2026-11-03 17:14:15 +01:00
dr. M.S. (Matthijs) Berends 81f5aaa7b8 Make anaerobes more specific than a Gram stain in rank_index
Anaerobes now have rank_index 5.5 (5.6 for a blocking row), and a Gram stain stays at 6. They had the same rank, so the order of sites could make the Gram-negative row with site Parenteral (CLSI Table 2B-5) precede the anaerobe row without a site (CLSI Table 2J), e.g., for ceftriaxone in B. fragilis.

A rebuild changes rank_index in 884 rows and nothing else.
2026-11-03 08:37:55 +01:00
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 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 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 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) 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 052edc4761 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 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 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 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 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
dr. M.S. (Matthijs) Berends 9ebc33a59d (v3.0.1.9129) Add guideline argument to random_mic() and random_disk() so that values are based on one guideline version, make guideline years in examples, vignettes and website always the latest, and reword NEWS 2026-10-13 21:43:19 +02:00
dr. M.S. (Matthijs) Berends bf12e3abe7 (v3.0.1.9123) Add method argument to sir_combine() for resistance within a group (most_resistant), and restore the AMR 3.0.1 behaviour of count_*() and proportion_*() for multiple antimicrobials (#321) 2026-10-12 21:37:13 +02:00
dr. M.S. (Matthijs) Berends 0293d296aa (v3.0.1.9121) styler 2026-10-12 11:42:06 +02:00
dr. M.S. (Matthijs) Berends e19eabe828 (v3.0.1.9119) update doc 2026-10-11 23:03:06 +02:00
dr. M.S. (Matthijs) Berends 36e6388868 (v3.0.1.9118) update doc 2026-10-11 22:32:15 +02:00
dr. M.S. (Matthijs) Berends 53d0704271 (v3.0.1.9116) New sir_combine() for combination therapy as one engine for antibiogram(), wisca(), count_*() and proportion_*() (#321), and make all suggested packages runtime-only with a new CI workflow without dplyr
- New sir_combine() to combine SIR results of multiple antimicrobials into one variable; antibiogram(), wisca() and the count/proportion functions now use the same engine (antibiogram() and wisca() output unchanged)
- With multiple antimicrobials, count_*() and proportion_*() now follow the documented combination therapy rules: resistance() is the proportion of failing combinations, count_all() excludes isolates with an unknown combination result, and WT/NWT/NS/NI are handled correctly
- where() is now decided at runtime instead of at installation, fixing antibiogram() and wisca() without tidyselect (e.g. CRAN binaries without dplyr)
- Imports from data.table and cli moved to .onLoad(); data.table functions are only used while it is loaded; the like() example no longer unloads data.table, which crashed R
- Static test that fails on code outside functions depending on suggested packages
- New check-without-dplyr workflow: installs AMR with all suggested packages, removes dplyr (and tidyselect), then runs all unit tests and examples against the installed package
- g.test() now returns the degrees of freedom as 'parameter', so they are printed
- Fix R CMD check NOTEs (hidden .claude folder, lost braces in inherited g.test and ggplot_pca docs)
2026-10-11 20:36:31 +02:00
dr. M.S. (Matthijs) Berends 80afedeb8c (v3.0.1.9115) Fix interpretation of capped MICs without an S category (off-scale S breakpoint) or without breakpoints in as.sir(), and correct the documented default of capped_mic_handling (#295) 2026-10-11 15:40:09 +02:00
dr. M.S. (Matthijs) Berends 9e609dae83 (v3.0.1.9114) Fix errors without cli and on R 3.0, and make the tinytest pipeline actually run the unit tests
Package:
- stop_() called cli::ansi_has_hyperlink_support() before checking that cli is available, so without cli every error became "there is no package called 'cli'"
- interpretive_rules() failed on R 3.0 for guidelines without AmpC rules (assignment to zero rows)
- Guard the ggplot2 example of wisca_plot()

CI:
- check-old: R 3.0 could not install tinytest over HTTPS, so no unit tests ran; install it with curl, and fail when tinytest is missing or any test fails
- tinytest shim: record expectations in the test file environment, support skips and errors per test_that() block, add missing testthat equivalents, source helper files
- Add R 4.0 (oldrel-6) to check-old, and oldrel-5 to check-recent
2026-10-10 14:54:15 +02:00
dr. M.S. (Matthijs) Berends 16a13ba81f (v3.0.1.9109) Fix WHONET codes SUD and ROX in clinical_breakpoints, and add sulbactam/durlobactam (#308) 2026-10-10 09:42:25 +02:00
tori0513 3eeabf542a Add add_custom_antimicrobial_synonyms() (#307) (#311)
Adds add_custom_antimicrobial_synonyms() to add local names, such as trade names, to existing antimicrobials, also via the AMR_custom_ab option. Matching is language-independent; as.ab() now returns NA with a warning for input that is not valid UTF-8.
2026-10-10 09:14:07 +02:00