🌐 SeroEpi
Precision target selection, stratified JAX/NumPyro hierarchical Bayesian prevalence modelling, LOSO-validated multi-valent formulation design, and interactive genomic surveillance analytics.
Documentation · Web App · Architecture & ADRs · API Reference · Issues
Overview
SeroEpi is the epidemiological modelling and vaccine formulation engine of the SeroVerse suite. Built on scikit-learn estimator contracts, Polars columnar dataframes, and JAX/NumPyro probabilistic inference, SeroEpi transforms pathogen isolate collections and genotype calls into stratified prevalence estimates, spatial choropleths, and cross-validated multi-valent formulations.
Core Capabilities
- 🗂️ Surveillance Cohort Ingestion & Compositional Target Engineering (
Dataset,Variable,Target,Criterion): Ingests Pathogenwatch isolate collections (PathogenwatchClient) and World Bank / UN demographic indicators (CountryData), enforces strict typed variable contracts (Identifier,Spatial,Temporal,Trait,Continuous,Categorical), and composes multi-variable boolean or intersectionalCriteriontargets (&,|,~,@). - 🧬 Stratified Aggregation & Outbreak De-Clonalization (
Aggregator,TransmissionEstimator): Collapses isolate-level cohorts across arbitrary geographic, temporal, and clinical strata (Aggregator), clusters single-linkage SNP transmission complexes (Dataset.cluster), and fits exponential-decay genomic distance models (TransmissionEstimator) to mitigate local outbreak over-sampling bias. - 🧠 Hierarchical Bayesian & Bootstrap Prevalence Modelling (
HierarchicalMCMCEstimator,HierarchicalSVIEstimator,BootstrapEstimator,UnpooledEstimator): Fits closed-form unpooled intervals (wilson,clopper-pearson,jeffreys,wald), Dirichlet-weighted Bayesian Bootstraps (BootstrapEstimator), and partially pooledJAX/NumPyroHierarchical Binomial and Beta-Binomial models via No-U-Turn Sampler MCMC (HierarchicalMCMCEstimator) or Stochastic Variational Inference (HierarchicalSVIEstimator). - 🛡️ LOSO-Validated Multi-Valent Formulation & Differential Enrichment (
Formulation,FormulationComparison): Ranks candidate targets under pooled or macro-averaged equal-stratum weights, evaluates minimum burden exceedance ($H_{0,j}: p_j \le \tau_{\min}$) with Bayesian posterior error probabilities or Benjamini-Hochberg FDR control, quantifies geographic generalizability via Leave-One-Stratum-Out (cv="loso") cross-validation, and contrasts formulations across cohorts (FormulationComparison.differential_enrichment()). - 🗺️ Publication-Ready Altair Visuals & PyShiny Dashboard (
seroepi.plotting,seroepi.app): Generates interactive spatial choropleths (ChoroplethPlotter), cumulative coverage curves, LOSO rank-stability heatmaps, and differential enrichment volcano plots (FormulationPlotter), target co-occurrence UpSet matrices (UpSetPlotter), and demographic pyramids (PyramidPlotter) inside a reactive PyShiny web dashboard (seroepi-app).
Installation
uv add seroepi
# or with pip:
pip install seroepi
To include the interactive PyShiny web application (seroepi-app):
uv add "seroepi[app]"
# or with pip:
pip install "seroepi[app]"
Quickstart
from seroepi.aggregate import Aggregator
from seroepi.dataset import Dataset
from seroepi.estimators.formulation import Formulation
from seroepi.estimators.hierarchical import HierarchicalSVIEstimator
from seroepi.plotting.choropleth import ChoroplethPlotter
from seroepi.plotting.formulation import FormulationPlotter
# 1. Load the bundled KlebNET Neonatal Sepsis benchmark cohort (981 K. pneumoniae isolates)
ds = Dataset.example()
# 2. Aggregate capsule K-locus counts across country strata
agg = Aggregator(target=ds.var("K_locus"), strata=[ds.var("country")]).fit(ds)
# 3. Fit a partially pooled Hierarchical Bayesian SVI Beta-Binomial prevalence model
est = HierarchicalSVIEstimator(likelihood="beta_binomial", num_steps=1500, random_state=42).fit(agg)
# 4. Optimize a 10-valent formulation with Leave-One-Stratum-Out (LOSO) cross-validation
form = Formulation(estimator=est, valency=10, weighting="equal", cv="loso", min_prevalence=0.02).fit(agg)
print(f"Selected 10-valent targets: {form.selected_targets_}")
# 5. Render interactive Altair spatial choropleth and cumulative coverage charts
choropleth = ChoroplethPlotter().plot(est)
coverage_curve = FormulationPlotter(plot_type="coverage").plot(form)
Launch the interactive PyShiny surveillance dashboard locally:
seroepi-app --host 127.0.0.1 --port 8000
Development
# Install all development, test, lint, typing, docs, and app extras
uv sync --all-groups --all-extras
# Run linter and static type checker
uv run ruff check .
uv run ty check src/
# Run test suite
uv run pytest
# Launch the interactive PyShiny app in development mode
uv run seroepi-app --reload
# Build and serve documentation locally with Zensical
uv run zensical serve
License
Released under the GNU General Public License v3.0 (GPLv3).
Metadata
Release files for seroepi 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| seroepi-0.0.2.tar.gz | 3.7 MB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| seroepi-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.2 MB
Release files / seroepi-0.0.2.tar.gz
| Download URL | seroepi-0.0.2.tar.gz |
|---|---|
| Size | 3.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83f7d4690f9d2a80948af5a73da451787af97116289d6eb080ef0c1fbdfa4af6
|
|
BLAKE2b-256 checksum How to use checksums |
5779ff25897eabe010a677434fdd045a87202a404ba97423035d8ba6cacf0a17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logRelease files / seroepi-0.0.2-py3-none-any.whl
| Download URL | seroepi-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0939cd4cd8a177d1a793af427f9f7ed281bd2a870d990844d1e873cabfa4cb6c
|
|
BLAKE2b-256 checksum How to use checksums |
4e5be9d767b2c6e7b865ff16f28010d68e5847e4e11955ac419d9ecda517d80b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logSecurity for seroepi 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for seroepi-0.0.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.