Skip to main content

poolguard

A practical tool to detect, measure, and manage patient pool differences in clinical AI.


A common challenge in clinical AI

You train a model on patients from one hospital, one trial, one region, or one time period.
It performs well on that data.

When you apply the same model to a new patient pool, performance often drops — sometimes significantly — because the populations differ in important ways.

poolguard helps you see these differences clearly, quantify them statistically, and produce auditable results that support better decision-making and regulatory readiness.


What poolguard does

It treats each patient pool (hospital, site, region, time window, demographic group, etc.) as its own distinct statistical population and provides:

  • Population shift detection — clear statistical metrics (SMD, MMD, KS-test, etc.) with p-values
  • Per-pool performance evaluation — AUC, calibration, sensitivity, specificity, and confidence intervals for every pool
  • Heterogeneity testing — statistical assessment of whether model performance differs meaningfully across pools
  • Transportability estimates — practical prediction of expected performance drop when moving to a new pool
  • Immutable audit trail — hash-chained, inspection-ready provenance for every analysis run

All outputs are designed to be clear, statistically sound, and easy to include in regulatory or quality documentation.


Installation

pip install poolguard

Quickstart

from poolguard import PoolGuard
import pandas as pd

# 1. Initialize
guard = PoolGuard(pool_column="site_id")   # or "hospital", "region", etc.

# 2. Learn pool fingerprints from your training data
guard.fit(X_train, y_train)

# 3. Evaluate any model on new data
report = guard.evaluate(
    model=your_model,
    X=X_test,
    y=y_test
)

# 4. View results
print(report.summary())

# 5. Export for review or submission
report.to_pdf("pool_analysis_for_submission.pdf")
report.to_json("audit_bundle.json")

When to use poolguard

Use it whenever you need to:

  • Move a model from one patient population to another
  • Demonstrate to regulators or QA teams that your model is robust across different sites or cohorts
  • Understand exactly where and why model performance changes
  • Generate auditable, inspection-ready documentation of model behavior across populations

How it works

You specify which column defines the patient pool (e.g. site_id, hospital, region).

It automatically fingerprints each pool and measures how different they are using established statistical methods.

It evaluates your model separately on every pool and returns clear performance metrics with uncertainty.

It tells you whether the differences are statistically meaningful.

It logs everything with full provenance so the results are transparent and defensible.

No black boxes. Just practical, defensible statistics.

Why this matters

Most clinical AI models are evaluated on random splits from the same dataset.

poolguard helps you account for real-world differences between patient populations in a structured and auditable way.

It bridges the gap between promising prototypes and tools that can be trusted in clinical and regulatory settings.

Repository: github.com/BouncyMolecules/poolguard
Author: Ela Halilovic

Metadata

Release files for poolguard 0.1.0

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

Source distribution (sdist)

Source distribution for poolguard 0.1.0
File Size Uploaded Provenance Actions
poolguard-0.1.0.tar.gz 25.5 kB Without provenance Details for poolguard-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 51.1 kB

Release files / poolguard-0.1.0.tar.gz

Download URL poolguard-0.1.0.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
809d4d9714d68400afefce511be47738040eb95b2914492678973a72def13b5c
BLAKE2b-256 checksum
How to use checksums
e7f8a5dfa49c7f01f4a09030ffc331fca80b1649abee95ad1de09b30e1dd1302
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / poolguard-0.1.0-py3-none-any.whl

Download URL poolguard-0.1.0-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c0817a18bccb2624c40b39d5d6251f3e348f0bb058ee84d6f957c21a294a31b
BLAKE2b-256 checksum
How to use checksums
dae663dc9d628b71b2a39ced44cc05bd69ec957a81832fad626f732eccabfebe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for poolguard 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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