🚧 Active development — interface and features change regularly

Automated sleep analysis,
verified by the physician

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.

Scored to AASM v3 12-channel pipeline 4 languages UI + report
Or explore what YASAFlaskified does first ↓

Sign in

Request a demo account

What is YASA?

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.

  • 🧠
    Automated sleep staging — classifies 30-second epochs into Wake, N1, N2, N3, and REM using a gradient-boosting classifier trained on thousands of PSG recordings.
  • 〰️
    Spindle & slow-wave detection — detects sleep spindles and slow oscillations with configurable thresholds, returning per-event statistics.
  • 👁️
    REM detection — identifies REM epochs and computes REM-related metrics including NREM/REM transitions.
  • 📊
    Sleep statistics — computes total sleep time, sleep efficiency, latencies, WASO, and full stage percentages per AASM standards.
  • 📡
    Bandpower analysis — spectral power in delta, theta, alpha, sigma, and beta bands per epoch and per channel.
W REM N1 N2 N3
# Core YASA pipeline import yasa, mne raw = mne.io.read_raw_edf("recording.edf") sls = yasa.SleepStaging(raw, eeg_name="C4-M1") hypno = sls.predict() stats = yasa.sleep_statistics(hypno, sf_hyp=1/30)

What is YASAFlaskified?

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.

📁

EDF Upload

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.

⚡

Async Processing

Powered by Redis Queue (RQ) and background workers, heavy analyses run without blocking the UI. Real-time job status keeps you informed throughout.

📈

Rich Reports

Hypnograms, sleep statistics tables, spindle maps, slow-wave detections, and bandpower charts — all rendered server-side with Matplotlib and downloadable as PNG/CSV.

🩺

Per-channel signal quality

Automatic per-channel grading (good / acceptable / poor), shown on the dashboard and in the PDF — prevents misdiagnosis from poor recordings.

🎯

Staging confidence

Per-epoch confidence score from the YASA model; epochs below 70% are flagged for manual review.

📐

OAHI uncertainty range

3-point sweep (lenient / primary / strict) shows how stable the OSAS diagnosis is across scoring strictness.

🔒

Secure & Hardened

CSRF protection, rate limiting, strong session management, UFW firewall, and Fail2ban — built for clinical environments where data security is non-negotiable.

🐳

Docker Deployment

Fully containerised with Gunicorn + Nginx reverse proxy. One-command deploy on any Linux server, with Nginx Proxy Manager for multi-domain SSL setups.

🧪

Research-Grade

Supports AASM-compliant staging, configurable epoch length, multi-channel selection, and raw µV signal preprocessing — trusted by sleep researchers.

From EDF to insights in four steps

01

Upload EDF

Select your polysomnography recording. The app accepts standard European Data Format files from any PSG device.

02

Configure

Choose your EEG, EOG, and EMG channels by name. Set epoch length and select the analyses you need.

03

Analyse

YASA's gradient-boosting model stages every epoch. Spindle, slow-wave, and bandpower detectors run in the background.

04

Download Report

Receive your hypnogram, statistics table, and event maps. Export to PNG and CSV for further analysis or clinical records.

What's new (autumn 2026)

The most recent clinical additions — each with its measurement behind it:

🎯

Autonomic arousal re-ranking (Pleth/heart rate)

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.

⚖️

Measured in the currency of FDA-cleared systems

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.

🫁

The report tells you how certain it is

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.

🧭

Split-nights in halves

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.

📝

Full provenance of every number

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.

〰️

Dual AHI and physiological burden measures

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

📚
Multiple scoring profiles. Beyond the standard AASM profile, the psgscoring library can also apply historical rule sets (R&K 1968, AASM v1.0 → v3.0) — useful for re-analyzing older studies or comparative research.

What's coming next

YASAFlaskified is a work in progress. The items below are in preparation or under active validation.

🧪

Clinical validation study

Single-centre validation study (n ≥ 50, ethics protocol v7.0) — compares automated scoring to manual scoring by a registered polysomnographer.

📄

Peer-reviewed publication

A peer-reviewed publication on psgscoring is in preparation.

🌐

MESA external validation

Validation on the MESA-SHHS datasets (≥ 2000 nights) to demonstrate generalization of psgscoring beyond a single centre.

🔗

FHIR export

Automatic export of sleep-diagnostic findings to EHR systems via HL7 FHIR resources.

🖥️

Manual scorer interface (beta)

Browser-based hypnogram editor and EDF viewer — lets a clinician correct AI stages or add events ad hoc, no external software needed.

Use it in your own centre

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.

Route 1 — first look

Try it on this instance

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 →
Route 2 — self-hosting

On your own server

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

Deployment runbook →
Route 3 — the library alone

In your own pipeline

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

Documentation →

⚠️Read this first

We have an interest in you adopting this software. That is precisely why the limitations are here, and not in the small print.

  1. Not a medical device. Not CE-marked (MDR 2017/745), not FDA-cleared. This is research software. Every report must be reviewed by a qualified physician before any diagnostic or therapeutic decision. The full disclaimer also appears in every generated report.
  2. Validated on five recordings and one external cohort. PSG-IPA (5 recordings, each scored by 12 scorers) and MESA/NSRR (n=150, fully held out). That is enough to publish, not enough to represent your population. Montages, sensors and scoring habits differ between centres, and the two cohorts contradict each other on some points.
  3. Test it against your own scoring before relying on it. Have at least a few dozen recordings scored that your team has already read, and look at Bland-Altman and weighted κ — not a mean AHI. An average hides exactly the spread that matters.
  4. The AHI is an estimate with an interval. Every study is scored at three stringency levels and receives a robustness grade of A, B or C. A C means the AHI depends heavily on where the threshold is drawn. That is information about the recording, not a defect in the software.
  5. Personal data remains your responsibility. This instance runs in the EU (Hetzner, Germany), but upload only pseudonymised EDFs to it; the repository ships anonymize_edf.py for that. For identifiable data, self-host — your centre then remains the data controller and nothing leaves your own infrastructure.
  6. No support SLA. This is the work of a single clinical team, not a company. GitHub issues are read and usually answered, but no response time is guaranteed. If you need scored values to stay identical over time, pin both the psgscoring version and the profile: only mesa_shhs and chicago_1999 are frozen, the other profiles follow new measurements.

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

Built on proven open-source

Python 3.11
Flask
YASA 0.7
psgscoring 0.38.0
MNE-Python
Redis / RQ
Gunicorn
Nginx
Docker
LightGBM
SQLite
Matplotlib
ReportLab (PDF)
Bootstrap 5.3
Let's Encrypt
Fail2ban
Hetzner Cloud

The people behind YASA

YASAFlaskified builds on the open-source work of sleep researchers who made their tools freely available. Full credit goes to them.

RV
Creator & Maintainer · YASA

Raphael Vallat, PhD

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

MW
Co-author · eLife Paper

Matthew P. Walker, PhD

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.

📄
Peer-reviewed publication · eLife 2021

The validation paper

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.

"An open-source, high-performance tool for automated sleep staging." — Vallat & Walker, eLife 10 (2021)