Clinical sleep analysis from a single EDF file — automated staging, respiratory events, signal quality, and PDF report.
A screening tool and second opinion. Not a medical device and not a diagnosis: every result is a proposal that a physician must review.
YASA (Yet Another Spindle Algorithm) is an open-source Python library for automated analysis of polysomnographic recordings, developed by Raphael Vallat. It stages sleep with a machine-learning model directly from raw EEG signals.
YASAFlaskified runs the YASA engine behind a Flask application, so clinicians and researchers can start an analysis from the browser without writing Python. Jobs run asynchronously; a full recording is usually ready in a few minutes, with a PDF and Excel report. The output is a proposal that a physician must review.
Drag-and-drop or select any EDF file from your PSG system. The app validates the recording, extracts available channels, and queues the job immediately.
Powered by Redis Queue (RQ) and background workers, heavy analyses run without blocking the UI. Real-time job status keeps you informed throughout.
Hypnograms, sleep statistics tables, spindle maps, slow-wave detections, and bandpower charts — all rendered server-side with Matplotlib and downloadable as PNG/CSV.
Automatic per-channel grading (good / acceptable / poor), shown on the dashboard and in the PDF — prevents misdiagnosis from poor recordings.
Per-epoch confidence score from the YASA model; epochs below 70% are flagged for manual review.
3-point sweep (lenient / primary / strict) shows how stable the OSAS diagnosis is across scoring strictness.
CSRF protection, rate limiting, strong session management, UFW firewall, and Fail2ban — built for clinical environments where data security is non-negotiable.
Fully containerised with Gunicorn + Nginx reverse proxy. One-command deploy on any Linux server, with Nginx Proxy Manager for multi-domain SSL setups.
Supports AASM-compliant staging, configurable epoch length, multi-channel selection, and raw µV signal preprocessing — trusted by sleep researchers.
Select your polysomnography recording. The app accepts standard European Data Format files from any PSG device.
Choose your EEG, EOG, and EMG channels by name. Set epoch length and select the analyses you need.
YASA's gradient-boosting model stages every epoch. Spindle, slow-wave, and bandpower detectors run in the background.
Receive your hypnogram, statistics table, and event maps. Export to PNG and CSV for further analysis or clinical records.
The most recent clinical additions — each with its measurement behind it:
On montages with a finger plethysmogram and heart rate, arousal candidates are re-ranked by a frozen model over pulse-wave and heart-rate features — pre-registered replication on 40 independent nights; the AHI never changes.
Respiratory events expressed the way 510(k) validations report them: agreement against a 2-of-3 scorer consensus, here across all 220 trios of twelve scorers — at or above the published figures, population caveats stated.
Next to the event table sits the expected agreement between two human scorers at this disease burden — a property of the recording, not the software. Central apneas carry an explicit manual-confirmation advisory.
The transition to titration is detected automatically; diagnosis and therapy each get their own indices. Severity, phenotypes and stage-AHIs are never asserted across two incomparable halves.
Which channel fed each analysis, which sensor was rejected and why, whether the autonomic re-ranking ran (and if not: the reason) — channel choice determines the result, so it lives in the report.
Rule 1A (3 %/arousal) and Rule 1B/CMS (4 %) side by side, plus hypoxic and ventilatory burden and clinical phenotypes (positional OSA — only when position coding is recognised — and REM predominance).
YASAFlaskified is a work in progress. The items below are in preparation or under active validation.
Single-centre validation study (n ≥ 50, ethics protocol v7.0) — compares automated scoring to manual scoring by a registered polysomnographer.
A peer-reviewed publication on psgscoring is in preparation.
Validation on the MESA-SHHS datasets (≥ 2000 nights) to demonstrate generalization of psgscoring beyond a single centre.
Automatic export of sleep-diagnostic findings to EHR systems via HL7 FHIR resources.
Browser-based hypnogram editor and EDF viewer — lets a clinician correct AI stages or add events ad hoc, no external software needed.
psgscoring and YASAFlaskified are open source under BSD-3. Any sleep centre may install them, modify them and test them on its own recordings — no licence fee, no permission needed. We explicitly invite you to do so. What we ask in return is not payment but contradiction: numbers from your own cohort, especially where they disagree with ours.
Request a free account and have a pseudonymised EDF scored. Within five to ten minutes you get the full report, including the visual event review. The fastest way to see what it does — and where it contradicts your own scoring.
Request an account →A single command on a fresh Ubuntu or Debian server installs the whole stack: Docker, Nginx, firewall and a Let's Encrypt certificate. Your recordings never leave your own infrastructure.
curl -sSL https://raw.githubusercontent.com/bartromb/YASAFlaskified/main/deploy.sh | sudo bash
The scoring logic only, without the web application. Run it over recordings your team has already scored and compare event by event rather than the AHI alone.
pip install psgscoring
We have an interest in you adopting this software. That is precisely why the limitations are here, and not in the small print.
Considering it for your centre — or have you already tested it and your numbers differ? The latter is what we most want to hear. bart.rombaut@gmail.com
YASAFlaskified builds on the open-source work of sleep researchers who made their tools freely available. Full credit goes to them.
Postdoctoral researcher at the Center for Human Sleep Science, University of California, Berkeley. Raphael created and maintains YASA as an open-source project, making automated sleep analysis freely accessible to researchers and clinicians. He also develops Pingouin (statistics) and AntroPy (time-series complexity).
Professor of Neuroscience and Psychology and Director of the Center for Human Sleep Science at UC Berkeley. Author of Why We Sleep and co-author of the peer-reviewed validation paper that established YASA's clinical credibility as an automated sleep-staging tool.
Trained and validated on over 30,000 hours of polysomnographic recordings across heterogeneous populations. Median staging accuracy was 87.5% across 585 testing nights, in line with human interscorer agreement. Published in eLife, October 2021.