biosqi
Transparent, calibrated biomedical signal-quality assessment for ECG, PPG, and EEG recordings.
biosqi turns a long waveform into a window-aligned quality score, a mask a downstream pipeline can consume, and explicit evidence about what may be wrong. Instead of returning an unexplained “bad signal” flag, it exposes the spectral, amplitude, drift, distribution, and periodicity indicators behind each decision.
What makes it useful
- Explainable attribution: identifies evidence consistent with mains interference, baseline wander/motion, clipping, flatline/dropout, unusual amplitude, and poor beat consistency.
- Calibrated, versioned models: logistic fusion followed by a monotone isotonic map. Model name and analysis settings travel with every result.
- Multiple entry points: typed Python library, scriptable CLI, self-contained HTML reports, and a polished local dashboard.
- Research formats: NumPy/NPZ and CSV in the base install; WFDB and EDF/BDF through an optional data extra.
- Reproducible validation: one command downloads public datasets, recomputes nested-CV metrics, fits the release model, and regenerates this README’s result block.
Install
pip install "biosqi[data,ui]"
For development:
git clone https://github.com/akshajbachu/biosqi.git
cd biosqi
uv sync --extra dev
Use the dashboard
biosqi view
Drop a recording into the browser, select ECG/PPG/EEG and its sample rate, then inspect aligned waveform and quality timelines. Selecting a window reveals its power spectrum, indicator evidence, and artifact attribution. Processing stays on the local machine.
Use the CLI
# Human-readable window table
biosqi score recording.csv --sample-rate 250 --signal-type ecg
# Complete machine-readable report
biosqi score recording.npz --signal-type ppg --json > result.json
# Sample-level mask and standalone HTML report
biosqi mask recording.hea --signal-type ecg --output mask.csv
biosqi report recording.hea --signal-type ecg --output report.html
Use Python
from biosqi.analysis import analyze
from biosqi.io import read_recording
from biosqi.types import SignalType
recording = read_recording("recording.npz", signal_type=SignalType.ECG)
result = analyze(recording, threshold=0.70)
print(result.scores) # calibrated score for each window
print(result.mask) # boolean window mask
print(result.windows[0].artifacts)
Reproducible validation
Numbers below are generated by python benchmarks/run_all.py; they are not
hand-entered. The Challenge metric uses nested calibration inside each outer
fold. Set B/C labels remain withheld and are not claimed as test results.
| Benchmark | Result |
|---|---|
| CinC 2011 Set A records | 998 |
| 5-fold ROC AUC (95% bootstrap CI) | 0.819 (0.782-0.855) |
| Balanced accuracy | 0.758 |
| Brier score | 0.101 |
| NSTDB score/SNR correlation | 0.982 |
Reproduce every number
# Fast pipeline check on a balanced subset
uv run python benchmarks/run_all.py --quick
# Full Set A + all MIT-BIH NSTDB conditions
uv run python benchmarks/run_all.py
Public data is cached under ~/.cache/biosqi (override with BIOSQI_CACHE).
The runner records provenance, uses nested calibration inside each outer
validation fold, writes JSON and SVG plots, updates this result block, and
stores the fitted model.
Documentation
Full documentation is at akshajbachu.github.io/biosqi, including the methodology, indicator definitions, validation protocol, limitations, and API reference.
Contributing
Contributions are welcome. See CONTRIBUTING.md for development setup and checks, and the Code of Conduct. Report security issues privately as described in SECURITY.md. Release history is in CHANGELOG.md.
Citation
If you use biosqi in research, please cite it. GitHub's Cite this
repository button (from CITATION.cff) provides APA and
BibTeX entries.
License
biosqi is released under the MIT License. Dataset licenses remain with their original providers.
Metadata
Release files for biosqi 0.1.0
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 | |
|---|---|---|---|---|
| biosqi-0.1.0.tar.gz | 1.2 MB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| biosqi-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.3 MB
Release files / biosqi-0.1.0.tar.gz
| Download URL | biosqi-0.1.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd3dad3af97a02a70fd211b00fde0406915e241a3a3525cf17f7e72443d9e441
|
|
BLAKE2b-256 checksum How to use checksums |
2484f08fe2612656b1bfec6da6ae1ec191a4f997852550fe020680e88c5ab0f8
|
| 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 logRelease files / biosqi-0.1.0-py3-none-any.whl
| Download URL | biosqi-0.1.0-py3-none-any.whl |
|---|---|
| Size | 111.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b93573a7b6e0aa0c92dd9ef04276facebfc55a52319aa2777685078b1ebc0f0
|
|
BLAKE2b-256 checksum How to use checksums |
9f525c96665865dd120d9ceeeb2e4a5a704240cf992a94edd04cba20741a11e5
|
| 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 logSecurity for biosqi 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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for biosqi-0.1.0.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 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.