Skip to main content

🌐 SeroEpi

Precision target selection, stratified JAX/NumPyro hierarchical Bayesian prevalence modelling, LOSO-validated multi-valent formulation design, and interactive genomic surveillance analytics.

Docs Web App Python 3.13+ Ruff uv License: GPL v3

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 SeroGen / KBank trait 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 (WorldBankClient), enforces strict typed variable contracts (Identifier, Spatial, Temporal, Trait, Continuous, Categorical), and composes multi-variable boolean or intersectional Criterion targets (&, |, ~, @).
  • 🧬 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 pooled JAX/NumPyro Hierarchical 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.estimators.formulation import Formulation
from seroepi.estimators.hierarchical import HierarchicalSVIEstimator
from seroepi.examples import KlebnetNeonatalSepsis
from seroepi.plotting.choropleth import ChoroplethPlotter
from seroepi.plotting.formulation import FormulationPlotter

# 1. Load (or auto-build) the KlebNET Neonatal Sepsis benchmark cohort (981 K. pneumoniae isolates)
ds = KlebnetNeonatalSepsis.ensure()

# 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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for seroepi 0.0.1
File Size Uploaded Provenance
seroepi-0.0.1.tar.gz 493.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for seroepi 0.0.1
File Interpreter ABI Platform
seroepi-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 770.3 kB

Release files / seroepi-0.0.1.tar.gz

Download URL seroepi-0.0.1.tar.gz
Size 493.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b1e32210c1c48f61fd50be2e5e0ac9948efafbc489ce521f768a489f70ab2c5b
BLAKE2b-256 checksum
How to use checksums
0a264062ed98068f5dfd5550ca87bf3507e88fc9a24c8a3c6f18b3b8924f2584
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 22, 2026.

Transparency log

Release files / seroepi-0.0.1-py3-none-any.whl

Download URL seroepi-0.0.1-py3-none-any.whl
Size 277.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3aaa560e18b862b40d6a6cfff7befd73ae8d3f4e37065a8d686b9ad062834c95
BLAKE2b-256 checksum
How to use checksums
7f2bc39c88ffb0f1b6f1aa334dc5d4cc99647500f9bdb85d63669bcf81e71359
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 22, 2026.

Transparency log

Security for seroepi 0.0.1

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.

Select from 2 files

Attestation for seroepi-0.0.1.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 22, 2026.

Transparency log

A 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page