Skip to main content

Open-source Python library for AASM 2.6-compliant automated polysomnography scoring

Project description

psgscoring

PyPI License: BSD-3 Tests Python Validated

Open-source Python library for AASM 2.6-compliant automated polysomnography scoring.

psgscoring extracts the core respiratory scoring algorithms from YASAFlaskified into a standalone, pip-installable library for the research community.

Validation (v0.2.8)

External validation on the PSG-IPA dataset (PhysioNet, 5 recordings, 47 independent scorer sessions):

PSG Scorers Median AHI psgscoring AHI ΔAHI Severity
SN1 11 6.0 8.1 +2.1 Mild ✓
SN2 4 4.4 9.3 +4.9 Mild / Normal
SN3 12 54.0 53.8 −0.2 Severe ✓
SN4 12 3.5 4.3 +0.8 Normal ✓
SN5 12 9.9 11.4 +1.5 Mild ✓
Mean 1.9 4/5 concordant

Details: Online Supplement (Wiki)

Features

  • AASM 2.6 respiratory scoring: apnea/hypopnea detection with dual-sensor support
  • 12 systematic bias corrections: 6 over-counting + 6 under-counting (details)
  • Breath-amplitude stability filter (v0.2.8): rejects false-positive hypopneas during normal breathing
  • AHI confidence interval: strict/standard/sensitive profiles with robustness grade (A/B/C)
  • Configurable scoring profiles: strict (research), standard (AASM 2.6), sensitive (UARS)
  • ECG-derived effort classification: spectral + TECG for central apnea detection
  • PLM, SpO₂, RERA/RDI, signal quality assessment

Installation

pip install psgscoring

Quick start

from psgscoring import run_pneumo_analysis
import mne

raw = mne.io.read_raw_edf("recording.edf", preload=True)
hypno = ["W", "N1", "N2", "N3", "R", ...]  # 30-s epochs

results = run_pneumo_analysis(raw, hypno, scoring_profile="standard")

# AHI
print(f"AHI: {results['respiratory']['summary']['ahi_total']}")

# AHI confidence interval (v0.2.8)
iv = results["ahi_interval"]
print(f"Interval: [{iv['interval'][0]}{iv['interval'][1]}] Grade: {iv['robustness_grade']}")

What's new in v0.2.8

  • Removed flow smoothing from standard profile (root cause: +54 false hypopneas)
  • Stability filter: rejects hypopneas during stable breathing (CV < 0.45)
  • AHI confidence interval: 3-profile analysis with robustness A/B/C
  • PSG-IPA validation: mean |ΔAHI| = 1.9/h, severity concordance 4/5

Documentation

📖 Online Supplement (Wiki) — signal processing, corrections, validation
📖 Technical Handbook (PDF) — 26-page guide

Live platform

slaapkliniek.be — upload EDF, receive complete PSG report. No installation required.

Citation

Rombaut B, Rombaut B, Rombaut C. psgscoring: An Open-Source Python Library for AASM 2.6-Compliant Automated Polysomnography Scoring. 2026. https://github.com/bartromb/psgscoring

This library builds on YASA:

Vallat R, Walker MP. An open-source, high-performance tool for automated sleep staging. eLife. 2021;10:e70092.

License

BSD-3-Clause. See LICENSE.

Disclaimer: Research use only. Not CE-marked or FDA-cleared. See DISCLAIMER.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psgscoring-0.2.91.tar.gz (67.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

psgscoring-0.2.91-py3-none-any.whl (70.9 kB view details)

Uploaded Python 3

File details

Details for the file psgscoring-0.2.91.tar.gz.

File metadata

  • Download URL: psgscoring-0.2.91.tar.gz
  • Upload date:
  • Size: 67.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for psgscoring-0.2.91.tar.gz
Algorithm Hash digest
SHA256 90b521825a2b4e84dfcc9dabd07c8c03715ad9db0fa0d1739a192d3e2973ab9e
MD5 3b7b0b5553b66afb304e8b2cc6a94b15
BLAKE2b-256 2f97c9a19d9d259a7058aaa009b855493ffa1e2341d5e3ea7cd64366aed3bdea

See more details on using hashes here.

File details

Details for the file psgscoring-0.2.91-py3-none-any.whl.

File metadata

  • Download URL: psgscoring-0.2.91-py3-none-any.whl
  • Upload date:
  • Size: 70.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for psgscoring-0.2.91-py3-none-any.whl
Algorithm Hash digest
SHA256 6ba1a1eaa441e8b212280338e65eb511b6dd328760a691f4de984b23bf448a7b
MD5 0166d9ff05f6efbcc5485cc98905fbf8
BLAKE2b-256 2a1bae9b3fce7e08ec9d3000ae8445c9a34d8ed882892b948f35fabff1d94ff0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page