1
0
mirror of https://github.com/msberends/AMR.git synced 2026-02-28 02:19:59 +01:00

Built site for AMR@3.0.1.9021: 2c21eba

This commit is contained in:
github-actions
2026-02-27 16:25:41 +00:00
parent f0ec851466
commit 6f0dc96d0d
12 changed files with 484 additions and 39 deletions

258
CLAUDE.html Normal file
View File

@@ -0,0 +1,258 @@
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>CLAUDE.md — AMR R Package • AMR (for R)</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png"><link rel="icon" sizes="any" href="favicon.ico"><link rel="manifest" href="site.webmanifest"><script src="deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="deps/Lato-0.4.10/font.css" rel="stylesheet"><link href="deps/Fira_Code-0.4.10/font.css" rel="stylesheet"><link href="deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="deps/headroom-0.11.0/headroom.min.js"></script><script src="deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="deps/search-1.0.0/fuse.min.js"></script><script src="deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="pkgdown.js"></script><link href="extra.css" rel="stylesheet"><script src="extra.js"></script><meta property="og:title" content="CLAUDE.md — AMR R Package"><meta property="og:image" content="https://amr-for-r.org/logo.svg"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous"><script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script><script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar navbar-expand-lg fixed-top bg-primary" data-bs-theme="dark" aria-label="Site navigation"><div class="container">
<a class="navbar-brand me-2" href="index.html">AMR (for R)</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9021</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-3">
<ul class="navbar-nav me-auto"><li class="nav-item dropdown">
<button class="nav-link dropdown-toggle" type="button" id="dropdown-how-to" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true"><span class="fa fa-question-circle"></span> How to</button>
<ul class="dropdown-menu" aria-labelledby="dropdown-how-to"><li><a class="dropdown-item" href="articles/AMR.html"><span class="fa fa-directions"></span> Conduct AMR Analysis</a></li>
<li><a class="dropdown-item" href="reference/antibiogram.html"><span class="fa fa-file-prescription"></span> Generate Antibiogram (Trad./Syndromic/WISCA)</a></li>
<li><a class="dropdown-item" href="articles/AMR_with_tidymodels.html"><span class="fa fa-square-root-variable"></span> Use AMR for Predictive Modelling (tidymodels)</a></li>
<li><a class="dropdown-item" href="articles/datasets.html"><span class="fa fa-database"></span> Download Data Sets for Own Use</a></li>
<li><a class="dropdown-item" href="reference/AMR-options.html"><span class="fa fa-gear"></span> Set User- Or Team-specific Package Settings</a></li>
<li><a class="dropdown-item" href="articles/PCA.html"><span class="fa fa-compress"></span> Conduct Principal Component Analysis for AMR</a></li>
<li><a class="dropdown-item" href="reference/mdro.html"><span class="fa fa-skull-crossbones"></span> Determine Multi-Drug Resistance (MDR)</a></li>
<li><a class="dropdown-item" href="articles/WHONET.html"><span class="fa fa-globe-americas"></span> Work with WHONET Data</a></li>
<li><a class="dropdown-item" href="articles/EUCAST.html"><span class="fa fa-exchange-alt"></span> Apply EUCAST Rules</a></li>
<li><a class="dropdown-item" href="reference/mo_property.html"><span class="fa fa-bug"></span> Get Taxonomy of a Microorganism</a></li>
<li><a class="dropdown-item" href="reference/ab_property.html"><span class="fa fa-capsules"></span> Get Properties of an Antibiotic Drug</a></li>
<li><a class="dropdown-item" href="reference/av_property.html"><span class="fa fa-capsules"></span> Get Properties of an Antiviral Drug</a></li>
</ul></li>
<li class="nav-item"><a class="nav-link" href="articles/AMR_for_Python.html"><span class="fa fab fa-python"></span> AMR for Python</a></li>
<li class="nav-item"><a class="nav-link" href="reference/index.html"><span class="fa fa-book-open"></span> Manual</a></li>
<li class="nav-item"><a class="nav-link" href="authors.html"><span class="fa fa-users"></span> Authors</a></li>
</ul><ul class="navbar-nav"><li class="nav-item"><form class="form-inline" role="search">
<input class="form-control" type="search" name="search-input" id="search-input" autocomplete="off" aria-label="Search site" placeholder="Search for" data-search-index="search.json"></form></li>
<li class="nav-item"><a class="nav-link" href="news/index.html"><span class="fa fa-newspaper"></span> Changelog</a></li>
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/msberends/AMR"><span class="fa fa-github"></span> Source Code</a></li>
</ul></div>
</div>
</nav><div class="container template-title-body">
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="logo.svg" class="logo" alt=""><h1>CLAUDE.md — AMR R Package</h1>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/main/CLAUDE.md" class="external-link"><code>CLAUDE.md</code></a></small>
</div>
<div id="claudemd--amr-r-package" class="section level1">
<p>This file provides context for Claude Code when working in this repository.</p>
<div class="section level2">
<h2 id="project-overview">Project Overview<a class="anchor" aria-label="anchor" href="#project-overview"></a></h2>
<p><strong>AMR</strong> is a zero-dependency R package for antimicrobial resistance (AMR) data analysis using a One Health approach. It is peer-reviewed, used in 175+ countries, and supports 28 languages.</p>
<p>Key capabilities: - SIR (Susceptible/Intermediate/Resistant) classification using EUCAST 20112025 and CLSI 20112025 breakpoints - Antibiogram generation: traditional, combined, syndromic, and WISCA - Microorganism taxonomy database (~79,000 species) - Antimicrobial drug database (~620 drugs) - Multi-drug resistant organism (MDRO) classification - First-isolate identification - Minimum Inhibitory Concentration (MIC) and disk diffusion handling - Multilingual output (28 languages)</p>
</div>
<div class="section level2">
<h2 id="common-commands">Common Commands<a class="anchor" aria-label="anchor" href="#common-commands"></a></h2>
<p>All commands run inside an R session:</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Rebuild documentation (roxygen2 → .Rd files + NAMESPACE)</span></span>
<span><span class="fu">devtools</span><span class="fu">::</span><span class="fu">document</span><span class="op">(</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># Run all tests</span></span>
<span><span class="fu">devtools</span><span class="fu">::</span><span class="fu">test</span><span class="op">(</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># Full package check (CRAN-level: docs + tests + checks)</span></span>
<span><span class="fu">devtools</span><span class="fu">::</span><span class="fu">check</span><span class="op">(</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># Build pkgdown website locally</span></span>
<span><span class="fu">pkgdown</span><span class="fu">::</span><span class="fu"><a href="https://pkgdown.r-lib.org/reference/build_site.html" class="external-link">build_site</a></span><span class="op">(</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># Code coverage report</span></span>
<span><span class="fu">covr</span><span class="fu">::</span><span class="fu"><a href="http://covr.r-lib.org/reference/package_coverage.html" class="external-link">package_coverage</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
<p>From the shell:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="co"># CRAN check from parent directory</span></span>
<span id="cb2-2"><a href="#cb2-2" tabindex="-1"></a><span class="ex">R</span> CMD check AMR</span></code></pre></div>
</div>
<div class="section level2">
<h2 id="repository-structure">Repository Structure<a class="anchor" aria-label="anchor" href="#repository-structure"></a></h2>
<pre><code>R/ # All R source files (62 files, ~28,000 lines)
man/ # Auto-generated .Rd documentation (do not edit manually)
tests/testthat/ # testthat test files (test-*.R) and helper-functions.R
data/ # Pre-compiled .rda datasets
data-raw/ # Scripts used to generate data/ files
vignettes/ # Rmd vignette articles
inst/ # Installed files (translations, etc.)
_pkgdown.yml # pkgdown website configuration</code></pre>
</div>
<div class="section level2">
<h2 id="r-source-file-conventions">R Source File Conventions<a class="anchor" aria-label="anchor" href="#r-source-file-conventions"></a></h2>
<p><strong>Naming conventions in <code>R/</code>:</strong></p>
<table class="table"><thead><tr class="header"><th>Prefix/Name</th>
<th>Purpose</th>
</tr></thead><tbody><tr class="odd"><td><code>aa_*.R</code></td>
<td>Loaded first (helpers, globals, options, package docs)</td>
</tr><tr class="even"><td><code>zz_deprecated.R</code></td>
<td>Deprecated function wrappers</td>
</tr><tr class="odd"><td><code>zzz.R</code></td>
<td>
<code>.onLoad</code> / <code>.onAttach</code> initialization</td>
</tr></tbody></table><p><strong>Key source files:</strong></p>
<ul><li>
<code>aa_helper_functions.R</code> / <code>aa_helper_pm_functions.R</code> — internal utility functions (large; ~63 KB and ~37 KB)</li>
<li>
<code>aa_globals.R</code> — global constants and breakpoint lookup structures</li>
<li>
<code>aa_options.R</code><code>amr_options()</code> / <code>get_AMR_option()</code> system</li>
<li>
<code>mo.R</code> / <code>mo_property.R</code> — microorganism lookup and properties</li>
<li>
<code>ab.R</code> / <code>ab_property.R</code> — antimicrobial drug functions</li>
<li>
<code>av.R</code> / <code>av_property.R</code> — antiviral drug functions</li>
<li>
<code>sir.R</code> / <code>sir_calc.R</code> / <code>sir_df.R</code> — SIR classification engine</li>
<li>
<code>mic.R</code> / <code>disk.R</code> — MIC and disk diffusion classes</li>
<li>
<code>antibiogram.R</code> — antibiogram generation (traditional, combined, syndromic, WISCA)</li>
<li>
<code>first_isolate.R</code> — first-isolate identification algorithms</li>
<li>
<code>mdro.R</code> — MDRO classification (EUCAST, CLSI, CDC, custom guidelines)</li>
<li>
<code>amr_selectors.R</code> — tidyselect helpers for selecting AMR columns</li>
<li>
<code>interpretive_rules.R</code> / <code>custom_eucast_rules.R</code> — clinical interpretation rules</li>
<li>
<code>translate.R</code> — 28-language translation system</li>
<li>
<code>ggplot_sir.R</code> / <code>ggplot_pca.R</code> / <code>plotting.R</code> — visualisation functions</li>
</ul></div>
<div class="section level2">
<h2 id="custom-s3-classes">Custom S3 Classes<a class="anchor" aria-label="anchor" href="#custom-s3-classes"></a></h2>
<p>The package defines five S3 classes with full print/format/plot/vctrs support:</p>
<table class="table"><thead><tr class="header"><th>Class</th>
<th>Created by</th>
<th>Represents</th>
</tr></thead><tbody><tr class="odd"><td><code>&lt;mo&gt;</code></td>
<td><code><a href="reference/as.mo.html">as.mo()</a></code></td>
<td>Microorganism code</td>
</tr><tr class="even"><td><code>&lt;ab&gt;</code></td>
<td><code><a href="reference/as.ab.html">as.ab()</a></code></td>
<td>Antimicrobial drug code</td>
</tr><tr class="odd"><td><code>&lt;av&gt;</code></td>
<td><code><a href="reference/as.av.html">as.av()</a></code></td>
<td>Antiviral drug code</td>
</tr><tr class="even"><td><code>&lt;sir&gt;</code></td>
<td><code><a href="reference/as.sir.html">as.sir()</a></code></td>
<td>SIR value (S/I/R/SDD)</td>
</tr><tr class="odd"><td><code>&lt;mic&gt;</code></td>
<td><code><a href="reference/as.mic.html">as.mic()</a></code></td>
<td>Minimum inhibitory concentration</td>
</tr><tr class="even"><td><code>&lt;disk&gt;</code></td>
<td><code><a href="reference/as.disk.html">as.disk()</a></code></td>
<td>Disk diffusion diameter</td>
</tr></tbody></table></div>
<div class="section level2">
<h2 id="data-files">Data Files<a class="anchor" aria-label="anchor" href="#data-files"></a></h2>
<p>Pre-compiled in <code>data/</code> (do not edit directly; regenerate via <code>data-raw/</code> scripts):</p>
<table class="table"><colgroup><col width="50%"><col width="50%"></colgroup><thead><tr class="header"><th>File</th>
<th>Contents</th>
</tr></thead><tbody><tr class="odd"><td><code>microorganisms.rda</code></td>
<td>~79,000 microbial species with full taxonomy</td>
</tr><tr class="even"><td><code>antimicrobials.rda</code></td>
<td>~620 antimicrobial drugs with ATC codes</td>
</tr><tr class="odd"><td><code>antivirals.rda</code></td>
<td>Antiviral drugs</td>
</tr><tr class="even"><td><code>clinical_breakpoints.rda</code></td>
<td>EUCAST + CLSI breakpoints (20112025)</td>
</tr><tr class="odd"><td><code>intrinsic_resistant.rda</code></td>
<td>Intrinsic resistance patterns</td>
</tr><tr class="even"><td><code>example_isolates.rda</code></td>
<td>Example AMR dataset for documentation/testing</td>
</tr><tr class="odd"><td><code>WHONET.rda</code></td>
<td>Example WHONET-format dataset</td>
</tr></tbody></table></div>
<div class="section level2">
<h2 id="zero-dependency-design">Zero-Dependency Design<a class="anchor" aria-label="anchor" href="#zero-dependency-design"></a></h2>
<p>The package has <strong>no <code>Imports</code></strong> in <code>DESCRIPTION</code>. All optional integrations (ggplot2, dplyr, data.table, tidymodels, cli, crayon, etc.) are listed in <code>Suggests</code> and guarded with:</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/ns-load.html" class="external-link">requireNamespace</a></span><span class="op">(</span><span class="st">"pkg"</span>, quietly <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span><span class="op">)</span> <span class="op">{</span> <span class="va">...</span> <span class="op">}</span></span></code></pre></div>
<p>Never add packages to <code>Imports</code>. If new functionality requires an external package, add it to <code>Suggests</code> and guard usage appropriately.</p>
</div>
<div class="section level2">
<h2 id="testing">Testing<a class="anchor" aria-label="anchor" href="#testing"></a></h2>
<ul><li>
<strong>Framework:</strong> <code>testthat</code> (R ≥ 3.1); legacy <code>tinytest</code> used for R 3.03.6 CI</li>
<li>
<strong>Test files:</strong> <code>tests/testthat/test-*.R</code>
</li>
<li>
<strong>Helpers:</strong> <code>tests/testthat/helper-functions.R</code>
</li>
<li>
<strong>CI matrix:</strong> GitHub Actions across Windows / macOS / Linux × R devel / release / oldrel-1 through oldrel-4</li>
<li>
<strong>Coverage:</strong> <code>covr</code> (some files excluded: <code>atc_online.R</code>, <code>mo_source.R</code>, <code>translate.R</code>, <code>resistance_predict.R</code>, <code>zz_deprecated.R</code>, helper files, <code>zzz.R</code>)</li>
</ul></div>
<div class="section level2">
<h2 id="documentation">Documentation<a class="anchor" aria-label="anchor" href="#documentation"></a></h2>
<ul><li>All exported functions use <strong>roxygen2</strong> blocks (<code>RoxygenNote: 7.3.3</code>, markdown enabled)</li>
<li>Run <code>devtools::document()</code> after any change to roxygen comments</li>
<li>Never edit files in <code>man/</code> directly — they are auto-generated</li>
<li>Vignettes live in <code>vignettes/</code> as <code>.Rmd</code> files</li>
<li>The pkgdown website is configured in <code>_pkgdown.yml</code>
</li>
</ul></div>
<div class="section level2">
<h2 id="versioning">Versioning<a class="anchor" aria-label="anchor" href="#versioning"></a></h2>
<p>Version format: <code>major.minor.patch.dev</code> (e.g., <code>3.0.1.9021</code>)</p>
<ul><li>Development versions use a <code>.9xxx</code> suffix</li>
<li>Stable CRAN releases drop the dev suffix (e.g., <code>3.0.1</code>)</li>
<li>
<code>NEWS.md</code> uses sections <strong>New</strong>, <strong>Fixes</strong>, <strong>Updates</strong> with GitHub issue references (<code>#NNN</code>)</li>
</ul><div class="section level3">
<h3 id="version-bump-required-for-every-pr">Version bump required for every PR<a class="anchor" aria-label="anchor" href="#version-bump-required-for-every-pr"></a></h3>
<p>Before opening a pull request, always increment the four-digit dev counter by 1 in <strong>both</strong> of these files:</p>
<ol style="list-style-type: decimal"><li>
<p><strong><code>DESCRIPTION</code></strong> — the <code>Version:</code> field:</p>
<pre><code>Version: 3.0.1.9021 → Version: 3.0.1.9022</code></pre>
</li>
<li>
<p><strong><code>NEWS.md</code></strong> — the top-level heading:</p>
<pre><code><span><span class="co"># AMR 3.0.1.9021 → # AMR 3.0.1.9022</span></span></code></pre>
</li>
</ol><p>Read the current version from <code>DESCRIPTION</code>, add 1 to the last numeric component, and write the new version to both files in the same commit as the rest of the PR changes.</p>
</div>
</div>
<div class="section level2">
<h2 id="internal-state">Internal State<a class="anchor" aria-label="anchor" href="#internal-state"></a></h2>
<p>The package uses a private <code>AMR_env</code> environment (created in <code>aa_globals.R</code>) for caching expensive lookups (e.g., microorganism matching scores, breakpoint tables). This avoids re-computation within a session.</p>
</div>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
</nav></aside></div>
<footer><div class="pkgdown-footer-left">
<p><code>AMR</code> (for R). Free and open-source, licenced under the <a target="_blank" href="https://github.com/msberends/AMR/blob/main/LICENSE" class="external-link">GNU General Public License version 2.0 (GPL-2)</a>.<br>Developed at the <a target="_blank" href="https://www.rug.nl" class="external-link">University of Groningen</a> and <a target="_blank" href="https://www.umcg.nl" class="external-link">University Medical Center Groningen</a> in The Netherlands.</p>
</div>
<div class="pkgdown-footer-right">
<p><a target="_blank" href="https://www.rug.nl" class="external-link"><img src="https://amr-for-r.org/logo_rug.svg" style="max-width: 150px;"></a><a target="_blank" href="https://www.umcg.nl" class="external-link"><img src="https://amr-for-r.org/logo_umcg.svg" style="max-width: 150px;"></a></p>
</div>
</footer></div>
</body></html>

186
CLAUDE.md Normal file
View File

@@ -0,0 +1,186 @@
# CLAUDE.md — AMR R Package
This file provides context for Claude Code when working in this
repository.
## Project Overview
**AMR** is a zero-dependency R package for antimicrobial resistance
(AMR) data analysis using a One Health approach. It is peer-reviewed,
used in 175+ countries, and supports 28 languages.
Key capabilities: - SIR (Susceptible/Intermediate/Resistant)
classification using EUCAST 20112025 and CLSI 20112025 breakpoints -
Antibiogram generation: traditional, combined, syndromic, and WISCA -
Microorganism taxonomy database (~79,000 species) - Antimicrobial drug
database (~620 drugs) - Multi-drug resistant organism (MDRO)
classification - First-isolate identification - Minimum Inhibitory
Concentration (MIC) and disk diffusion handling - Multilingual output
(28 languages)
## Common Commands
All commands run inside an R session:
``` r
# Rebuild documentation (roxygen2 → .Rd files + NAMESPACE)
devtools::document()
# Run all tests
devtools::test()
# Full package check (CRAN-level: docs + tests + checks)
devtools::check()
# Build pkgdown website locally
pkgdown::build_site()
# Code coverage report
covr::package_coverage()
```
From the shell:
``` bash
# CRAN check from parent directory
R CMD check AMR
```
## Repository Structure
R/ # All R source files (62 files, ~28,000 lines)
man/ # Auto-generated .Rd documentation (do not edit manually)
tests/testthat/ # testthat test files (test-*.R) and helper-functions.R
data/ # Pre-compiled .rda datasets
data-raw/ # Scripts used to generate data/ files
vignettes/ # Rmd vignette articles
inst/ # Installed files (translations, etc.)
_pkgdown.yml # pkgdown website configuration
## R Source File Conventions
**Naming conventions in `R/`:**
| Prefix/Name | Purpose |
|-------------------|--------------------------------------------------------|
| `aa_*.R` | Loaded first (helpers, globals, options, package docs) |
| `zz_deprecated.R` | Deprecated function wrappers |
| `zzz.R` | `.onLoad` / `.onAttach` initialization |
**Key source files:**
- `aa_helper_functions.R` / `aa_helper_pm_functions.R` — internal
utility functions (large; ~63 KB and ~37 KB)
- `aa_globals.R` — global constants and breakpoint lookup structures
- `aa_options.R` — `amr_options()` / `get_AMR_option()` system
- `mo.R` / `mo_property.R` — microorganism lookup and properties
- `ab.R` / `ab_property.R` — antimicrobial drug functions
- `av.R` / `av_property.R` — antiviral drug functions
- `sir.R` / `sir_calc.R` / `sir_df.R` — SIR classification engine
- `mic.R` / `disk.R` — MIC and disk diffusion classes
- `antibiogram.R` — antibiogram generation (traditional, combined,
syndromic, WISCA)
- `first_isolate.R` — first-isolate identification algorithms
- `mdro.R` — MDRO classification (EUCAST, CLSI, CDC, custom guidelines)
- `amr_selectors.R` — tidyselect helpers for selecting AMR columns
- `interpretive_rules.R` / `custom_eucast_rules.R` — clinical
interpretation rules
- `translate.R` — 28-language translation system
- `ggplot_sir.R` / `ggplot_pca.R` / `plotting.R` — visualisation
functions
## Custom S3 Classes
The package defines five S3 classes with full print/format/plot/vctrs
support:
| Class | Created by | Represents |
|----------|-----------------------------------------------------------|----------------------------------|
| `<mo>` | [`as.mo()`](https://amr-for-r.org/reference/as.mo.md) | Microorganism code |
| `<ab>` | [`as.ab()`](https://amr-for-r.org/reference/as.ab.md) | Antimicrobial drug code |
| `<av>` | [`as.av()`](https://amr-for-r.org/reference/as.av.md) | Antiviral drug code |
| `<sir>` | [`as.sir()`](https://amr-for-r.org/reference/as.sir.md) | SIR value (S/I/R/SDD) |
| `<mic>` | [`as.mic()`](https://amr-for-r.org/reference/as.mic.md) | Minimum inhibitory concentration |
| `<disk>` | [`as.disk()`](https://amr-for-r.org/reference/as.disk.md) | Disk diffusion diameter |
## Data Files
Pre-compiled in `data/` (do not edit directly; regenerate via
`data-raw/` scripts):
| File | Contents |
|----------------------------|-----------------------------------------------|
| `microorganisms.rda` | ~79,000 microbial species with full taxonomy |
| `antimicrobials.rda` | ~620 antimicrobial drugs with ATC codes |
| `antivirals.rda` | Antiviral drugs |
| `clinical_breakpoints.rda` | EUCAST + CLSI breakpoints (20112025) |
| `intrinsic_resistant.rda` | Intrinsic resistance patterns |
| `example_isolates.rda` | Example AMR dataset for documentation/testing |
| `WHONET.rda` | Example WHONET-format dataset |
## Zero-Dependency Design
The package has **no `Imports`** in `DESCRIPTION`. All optional
integrations (ggplot2, dplyr, data.table, tidymodels, cli, crayon, etc.)
are listed in `Suggests` and guarded with:
``` r
if (requireNamespace("pkg", quietly = TRUE)) { ... }
```
Never add packages to `Imports`. If new functionality requires an
external package, add it to `Suggests` and guard usage appropriately.
## Testing
- **Framework:** `testthat` (R ≥ 3.1); legacy `tinytest` used for R
3.03.6 CI
- **Test files:** `tests/testthat/test-*.R`
- **Helpers:** `tests/testthat/helper-functions.R`
- **CI matrix:** GitHub Actions across Windows / macOS / Linux × R devel
/ release / oldrel-1 through oldrel-4
- **Coverage:** `covr` (some files excluded: `atc_online.R`,
`mo_source.R`, `translate.R`, `resistance_predict.R`,
`zz_deprecated.R`, helper files, `zzz.R`)
## Documentation
- All exported functions use **roxygen2** blocks (`RoxygenNote: 7.3.3`,
markdown enabled)
- Run `devtools::document()` after any change to roxygen comments
- Never edit files in `man/` directly — they are auto-generated
- Vignettes live in `vignettes/` as `.Rmd` files
- The pkgdown website is configured in `_pkgdown.yml`
## Versioning
Version format: `major.minor.patch.dev` (e.g., `3.0.1.9021`)
- Development versions use a `.9xxx` suffix
- Stable CRAN releases drop the dev suffix (e.g., `3.0.1`)
- `NEWS.md` uses sections **New**, **Fixes**, **Updates** with GitHub
issue references (`#NNN`)
### Version bump required for every PR
Before opening a pull request, always increment the four-digit dev
counter by 1 in **both** of these files:
1. **`DESCRIPTION`** — the `Version:` field:
Version: 3.0.1.9021 → Version: 3.0.1.9022
2. **`NEWS.md`** — the top-level heading:
# AMR 3.0.1.9021 → # AMR 3.0.1.9022
Read the current version from `DESCRIPTION`, add 1 to the last numeric
component, and write the new version to both files in the same commit as
the rest of the PR changes.
## Internal State
The package uses a private `AMR_env` environment (created in
`aa_globals.R`) for caching expensive lookups (e.g., microorganism
matching scores, breakpoint tables). This avoids re-computation within a
session.

View File

@@ -91,7 +91,7 @@
website update since they are based on randomly created values and the website update since they are based on randomly created values and the
page was written in <a href="https://rmarkdown.rstudio.com/" class="external-link">R page was written in <a href="https://rmarkdown.rstudio.com/" class="external-link">R
Markdown</a>. However, the methodology remains unchanged. This page was Markdown</a>. However, the methodology remains unchanged. This page was
generated on 12 February 2026.</p> generated on 27 February 2026.</p>
<div class="section level2"> <div class="section level2">
<h2 id="introduction">Introduction<a class="anchor" aria-label="anchor" href="#introduction"></a> <h2 id="introduction">Introduction<a class="anchor" aria-label="anchor" href="#introduction"></a>
</h2> </h2>
@@ -147,21 +147,21 @@ make the structure of your data generally look like this:</p>
</tr></thead> </tr></thead>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">2026-02-12</td> <td align="center">2026-02-27</td>
<td align="center">abcd</td> <td align="center">abcd</td>
<td align="center">Escherichia coli</td> <td align="center">Escherichia coli</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">2026-02-12</td> <td align="center">2026-02-27</td>
<td align="center">abcd</td> <td align="center">abcd</td>
<td align="center">Escherichia coli</td> <td align="center">Escherichia coli</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">R</td> <td align="center">R</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">2026-02-12</td> <td align="center">2026-02-27</td>
<td align="center">efgh</td> <td align="center">efgh</td>
<td align="center">Escherichia coli</td> <td align="center">Escherichia coli</td>
<td align="center">R</td> <td align="center">R</td>

View File

@@ -3,7 +3,7 @@
**Note:** values on this page will change with every website update **Note:** values on this page will change with every website update
since they are based on randomly created values and the page was written since they are based on randomly created values and the page was written
in [R Markdown](https://rmarkdown.rstudio.com/). However, the in [R Markdown](https://rmarkdown.rstudio.com/). However, the
methodology remains unchanged. This page was generated on 12 February methodology remains unchanged. This page was generated on 27 February
2026. 2026.
## Introduction ## Introduction
@@ -52,9 +52,9 @@ structure of your data generally look like this:
| date | patient_id | mo | AMX | CIP | | date | patient_id | mo | AMX | CIP |
|:----------:|:----------:|:----------------:|:---:|:---:| |:----------:|:----------:|:----------------:|:---:|:---:|
| 2026-02-12 | abcd | Escherichia coli | S | S | | 2026-02-27 | abcd | Escherichia coli | S | S |
| 2026-02-12 | abcd | Escherichia coli | S | R | | 2026-02-27 | abcd | Escherichia coli | S | R |
| 2026-02-12 | efgh | Escherichia coli | R | S | | 2026-02-27 | efgh | Escherichia coli | R | S |
### Needed R packages ### Needed R packages

View File

@@ -80,7 +80,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.svg" class="logo" alt=""><h1>Download data sets for download / own use</h1> <img src="../logo.svg" class="logo" alt=""><h1>Download data sets for download / own use</h1>
<h4 data-toc-skip class="date">12 February 2026</h4> <h4 data-toc-skip class="date">27 February 2026</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/main/vignettes/datasets.Rmd" class="external-link"><code>vignettes/datasets.Rmd</code></a></small> <small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/main/vignettes/datasets.Rmd" class="external-link"><code>vignettes/datasets.Rmd</code></a></small>
<div class="d-none name"><code>datasets.Rmd</code></div> <div class="d-none name"><code>datasets.Rmd</code></div>

View File

@@ -10,7 +10,7 @@ articles:
PCA: PCA.html PCA: PCA.html
WHONET: WHONET.html WHONET: WHONET.html
WISCA: WISCA.html WISCA: WISCA.html
last_built: 2026-02-12T19:40Z last_built: 2026-02-27T16:21Z
urls: urls:
reference: https://amr-for-r.org/reference reference: https://amr-for-r.org/reference
article: https://amr-for-r.org/articles article: https://amr-for-r.org/articles

View File

@@ -112,16 +112,16 @@
<span class="r-in"><span></span></span> <span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">df</span></span></span> <span class="r-in"><span><span class="va">df</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> birth_date age age_exact age_at_y2k</span> <span class="r-out co"><span class="r-pr">#&gt;</span> birth_date age age_exact age_at_y2k</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 1980-02-27 45 45.95890 19</span> <span class="r-out co"><span class="r-pr">#&gt;</span> 1 1980-02-27 46 46.00000 19</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 1953-07-26 72 72.55068 46</span> <span class="r-out co"><span class="r-pr">#&gt;</span> 2 1953-07-26 72 72.59178 46</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 1949-09-02 76 76.44658 50</span> <span class="r-out co"><span class="r-pr">#&gt;</span> 3 1949-09-02 76 76.48767 50</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 1986-08-03 39 39.52877 13</span> <span class="r-out co"><span class="r-pr">#&gt;</span> 4 1986-08-03 39 39.56986 13</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 1932-11-19 93 93.23288 67</span> <span class="r-out co"><span class="r-pr">#&gt;</span> 5 1932-11-19 93 93.27397 67</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 1949-03-30 76 76.87397 50</span> <span class="r-out co"><span class="r-pr">#&gt;</span> 6 1949-03-30 76 76.91507 50</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 1996-06-23 29 29.64110 3</span> <span class="r-out co"><span class="r-pr">#&gt;</span> 7 1996-06-23 29 29.68219 3</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 1963-09-16 62 62.40822 36</span> <span class="r-out co"><span class="r-pr">#&gt;</span> 8 1963-09-16 62 62.44932 36</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 1952-05-16 73 73.74521 47</span> <span class="r-out co"><span class="r-pr">#&gt;</span> 9 1952-05-16 73 73.78630 47</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 1952-11-14 73 73.24658 47</span> <span class="r-out co"><span class="r-pr">#&gt;</span> 10 1952-11-14 73 73.28767 47</span>
</code></pre></div> </code></pre></div>
</div> </div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2> </main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>

View File

@@ -81,14 +81,14 @@ df$age_at_y2k <- age(df$birth_date, "2000-01-01")
df df
#> birth_date age age_exact age_at_y2k #> birth_date age age_exact age_at_y2k
#> 1 1980-02-27 45 45.95890 19 #> 1 1980-02-27 46 46.00000 19
#> 2 1953-07-26 72 72.55068 46 #> 2 1953-07-26 72 72.59178 46
#> 3 1949-09-02 76 76.44658 50 #> 3 1949-09-02 76 76.48767 50
#> 4 1986-08-03 39 39.52877 13 #> 4 1986-08-03 39 39.56986 13
#> 5 1932-11-19 93 93.23288 67 #> 5 1932-11-19 93 93.27397 67
#> 6 1949-03-30 76 76.87397 50 #> 6 1949-03-30 76 76.91507 50
#> 7 1996-06-23 29 29.64110 3 #> 7 1996-06-23 29 29.68219 3
#> 8 1963-09-16 62 62.40822 36 #> 8 1963-09-16 62 62.44932 36
#> 9 1952-05-16 73 73.74521 47 #> 9 1952-05-16 73 73.78630 47
#> 10 1952-11-14 73 73.24658 47 #> 10 1952-11-14 73 73.28767 47
``` ```

View File

@@ -424,10 +424,10 @@ Breakpoints are currently implemented from EUCAST 2011-2025 and CLSI 2011-2025,
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 4 × 18</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 4 × 18</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> datetime index method ab_given mo_given host_given input_given</span> <span class="r-out co"><span class="r-pr">#&gt;</span> datetime index method ab_given mo_given host_given input_given</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dttm&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dttm&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> 2026-02-12 <span style="color: #949494;">19:41:27</span> 1 MIC amoxicillin Escherich… human 8 </span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> 2026-02-27 <span style="color: #949494;">16:22:03</span> 1 MIC amoxicillin Escherich… human 8 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> 2026-02-12 <span style="color: #949494;">19:41:27</span> 1 MIC cipro Escherich… human 0.256 </span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> 2026-02-27 <span style="color: #949494;">16:22:03</span> 1 MIC cipro Escherich… human 0.256 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> 2026-02-12 <span style="color: #949494;">19:41:28</span> 1 DISK tobra Escherich… human 16 </span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> 2026-02-27 <span style="color: #949494;">16:22:03</span> 1 DISK tobra Escherich… human 16 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">4</span> 2026-02-12 <span style="color: #949494;">19:41:28</span> 1 DISK genta Escherich… human 18 </span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">4</span> 2026-02-27 <span style="color: #949494;">16:22:03</span> 1 DISK genta Escherich… human 18 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 11 more variables: ab &lt;ab&gt;, mo &lt;mo&gt;, host &lt;chr&gt;, input &lt;chr&gt;,</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 11 more variables: ab &lt;ab&gt;, mo &lt;mo&gt;, host &lt;chr&gt;, input &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># outcome &lt;sir&gt;, notes &lt;chr&gt;, guideline &lt;chr&gt;, ref_table &lt;chr&gt;, uti &lt;lgl&gt;,</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># outcome &lt;sir&gt;, notes &lt;chr&gt;, guideline &lt;chr&gt;, ref_table &lt;chr&gt;, uti &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># breakpoint_S_R &lt;chr&gt;, site &lt;chr&gt;</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># breakpoint_S_R &lt;chr&gt;, site &lt;chr&gt;</span></span>

View File

@@ -660,10 +660,10 @@ sir_interpretation_history()
#> # A tibble: 4 × 18 #> # A tibble: 4 × 18
#> datetime index method ab_given mo_given host_given input_given #> datetime index method ab_given mo_given host_given input_given
#> <dttm> <int> <chr> <chr> <chr> <chr> <chr> #> <dttm> <int> <chr> <chr> <chr> <chr> <chr>
#> 1 2026-02-12 19:41:27 1 MIC amoxicillin Escherich… human 8 #> 1 2026-02-27 16:22:03 1 MIC amoxicillin Escherich… human 8
#> 2 2026-02-12 19:41:27 1 MIC cipro Escherich… human 0.256 #> 2 2026-02-27 16:22:03 1 MIC cipro Escherich… human 0.256
#> 3 2026-02-12 19:41:28 1 DISK tobra Escherich… human 16 #> 3 2026-02-27 16:22:03 1 DISK tobra Escherich… human 16
#> 4 2026-02-12 19:41:28 1 DISK genta Escherich… human 18 #> 4 2026-02-27 16:22:03 1 DISK genta Escherich… human 18
#> # 11 more variables: ab <ab>, mo <mo>, host <chr>, input <chr>, #> # 11 more variables: ab <ab>, mo <mo>, host <chr>, input <chr>,
#> # outcome <sir>, notes <chr>, guideline <chr>, ref_table <chr>, uti <lgl>, #> # outcome <sir>, notes <chr>, guideline <chr>, ref_table <chr>, uti <lgl>,
#> # breakpoint_S_R <chr>, site <chr> #> # breakpoint_S_R <chr>, site <chr>

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,6 @@
<urlset xmlns = 'http://www.sitemaps.org/schemas/sitemap/0.9'> <urlset xmlns = 'http://www.sitemaps.org/schemas/sitemap/0.9'>
<url><loc>https://amr-for-r.org/404.html</loc></url> <url><loc>https://amr-for-r.org/404.html</loc></url>
<url><loc>https://amr-for-r.org/CLAUDE.html</loc></url>
<url><loc>https://amr-for-r.org/LICENSE-text.html</loc></url> <url><loc>https://amr-for-r.org/LICENSE-text.html</loc></url>
<url><loc>https://amr-for-r.org/articles/AMR.html</loc></url> <url><loc>https://amr-for-r.org/articles/AMR.html</loc></url>
<url><loc>https://amr-for-r.org/articles/AMR_for_Python.html</loc></url> <url><loc>https://amr-for-r.org/articles/AMR_for_Python.html</loc></url>