Every field in a sleep record depends on how it was measured. A stage label produced from brain waves is a different kind of evidence from one inferred from wrist movement, even when both read n2. This chapter sets out the physiology and instrumentation behind WIA-MED-021: what the AASM stages are, which signals a polysomnography (PSG) lab records, what a home test gives up, and what a wearable estimates. It also shows how the Phase 1 data format carries each distinction.
The American Academy of Sleep Medicine (AASM) Manual for the Scoring of Sleep and Associated Events divides a night into epochs and assigns each epoch one stage. The standard adopts the manual's token vocabulary for Phase 1 sleep-stage records.
| Token | Stage | Characteristic evidence |
|---|---|---|
wake | Wakefulness | Alpha rhythm with eyes closed, eye movements, higher muscle tone |
n1 | Light transitional sleep | Slowing background EEG, slow rolling eye movements |
n2 | Stable light sleep | Sleep spindles and K-complexes |
n3 | Deep (slow-wave) sleep | High-amplitude slow EEG activity |
rem | REM sleep | Rapid eye movements, low chin muscle tone, mixed-frequency EEG |
An implementation may also emit unscored for an epoch the algorithm could not classify. Receivers should treat this token as missing data, not as a stage. An unscored epoch counted as wake would silently lower total sleep time.
The AASM epoch is 30 seconds, and the standard's overview names that length as the epoch for primary data. A Phase 1 stage record places the epoch on the session timeline explicitly:
{
"wia_sleep_monitoring_version": "1.0.0",
"type": "sleep_stage",
"session_id": "ses_01HXY",
"epoch_index": 142,
"epoch_start": "2026-04-26T23:41:00Z",
"epoch_duration_seconds": 30,
"stage": "n2",
"confidence": 0.92,
"scoring_algorithm": "AASM-2024-default",
"signature": null
}
The index and the timestamp agree. The example session starts at 22:30:00Z, and 142 epochs of 30 seconds is 71 minutes, which lands exactly on 23:41:00Z. A validator can use this arithmetic as a cheap consistency check when epochs are 30 seconds long. Consumer devices may use five-minute epochs at lower confidence, which is why epoch_duration_seconds carries the real granularity instead of assuming 30.
The scoring_algorithm string is there because AASM rules are well defined but vendor implementations differ. Two products can both claim AASM scoring and still disagree on an ambiguous epoch. Recording the algorithm and its version lets a downstream consumer compare like with like, or re-score. The overview cites the AASM manual v2.6 (2020), while Phase 1 refers to the "current edition". Pinning the edition in the algorithm string avoids the ambiguity.
The standard's optional four-stage classification is the wearable-style view: wake, light, deep and REM. It requires accuracy of at least 70% and Cohen's kappa of at least 0.60 against PSG. The usual correspondence is light sleep for N1 plus N2 and deep sleep for N3. Treat that mapping as a convention to document, not a lossless conversion. The four-stage form cannot be turned back into N1, N2 and N3.
Clinical PSG is the reference method. Phase 1 describes the polysomnography session kind as full clinical recording with EEG, EOG, EMG, airflow, pulse oximetry and chest and abdomen belts. Each channel family answers a different question:
The overview sets minimum hardware requirements for the EEG portion of a clinical PSG:
| Parameter | Requirement |
|---|---|
| Channels | At least 3 (F4-M1, C4-M1, O2-M1) |
| Sampling rate | At least 200 Hz, 500 Hz or more recommended |
| Resolution | At least 12 bit |
| Electrode impedance | <5 kΩ |
The listed channels are frontal, central and occipital derivations referenced to the mastoid. Together they cover the frontal slow waves of N3, the central spindles of N2 and the occipital alpha of relaxed wakefulness. The impedance limit matters in practice, because a poorly seated electrode adds noise that a scoring algorithm may read as arousal or wake.
A PSG recording is large, typically hundreds of megabytes. For that reason the session record references the raw signal by pointer and integrity hash instead of embedding it:
{
"wia_sleep_monitoring_version": "1.0.0",
"type": "session",
"session_id": "ses_01HXY",
"patient_id": "did:wia:patient:01HXY",
"session_kind": "polysomnography",
"started_at": "2026-04-26T22:30:00Z",
"ended_at": "2026-04-27T07:00:00Z",
"device_ids": ["did:wia:device:psg-vendor-A"],
"clinical_grade": true,
"edf_url": "https://recordings.example/sessions/ses_01HXY.edf",
"edf_sha256": "7d8f2c…",
"scoring_metadata_id": "scm_01HXY",
"signature": { "alg": "Ed25519", "value": "AY3o…" }
}
For clinical-grade sessions, edf_url and edf_sha256 are mandatory. EDF and EDF+ are the European Data Format files that most PSG software can already read and write. A reviewing physician can re-open the original waveforms and check any epoch or event against them. The hash proves that the file retrieved later is the file that was scored. The scoring_metadata_id links the session to the algorithm and scorer that produced its stage labels, so a human-edited hypnogram can be told apart from an automatic one.
A home sleep apnoea test is a reduced-channel study. Phase 1 describes it as typically airflow plus SpO2 only, and gives it its own session kind, home_sleep_apnoea_test.
| Session kind | Typical signals | What it can support |
|---|---|---|
polysomnography | EEG, EOG, EMG, airflow, SpO2, belts | Staging, arousals, all event kinds |
home_sleep_apnoea_test | Airflow, SpO2 | Breathing events and desaturation |
consumer_wearable | Heart rate, accelerometer | Estimated sleep stages and wellness metrics |
nap | Depends on device | A short recording instead of a full night |
Without EEG, an HSAT cannot see when the patient fell asleep, how long they slept, or whether an event ended in a cortical arousal. This has two consequences for the data:
Phase 1 lets downstream consumers handle this by recording the session kind on every session. Receivers must treat a kind they do not recognise as unrecognised instead of guessing. An HSAT that sets clinical_grade to true falls under the same rule as a PSG, so it must carry the clearance reference and the EDF pointer.
Oxygen metrics suit these devices well. The Phase 2 respiratory metrics include odi (oxygen desaturation index), min_spo2_percent and t90_percent. The last is, by usual definition, the share of the night spent below 90% saturation. All three can be computed from a pulse oximeter alone.
A consumer wearable has no EEG. It estimates sleep from two sources: an accelerometer, which reports movement, and photoplethysmography (PPG), which yields heart rate and, with red and infrared light, SpO2. The overview sets sensor minimums:
| Sensor | Minimums in the standard |
|---|---|
| Accelerometer | At least 32 Hz, 3-axis, at least ±8g range |
| PPG, SpO2 | At least 25 Hz, red plus infrared, ±3% accuracy |
| PPG, heart rate | At least 100 Hz, green, ±5 bpm accuracy |
Movement-based sleep detection has a well-known weakness. A person lying still and awake looks like a person asleep, so these devices tend to overestimate sleep. The standard's accuracy targets show the gap. A sleep-wake classifier is expected to reach at least 85% agreement with PSG, with a mean total sleep time error of at most 30 minutes and a sleep efficiency correlation of at least 0.70. Validation must use at least 100 participants, drawn from varied ages, sexes, ethnicities and body mass indices, and must include people with insomnia and sleep apnoea. A device tested only on healthy young sleepers would not satisfy that.
The wearable-oriented session summary in the API specification carries aggregate metrics and stage minutes:
"metrics": {
"total_sleep_time_minutes": 420,
"sleep_efficiency_percent": 88.4,
"sleep_onset_latency_minutes": 12,
"wake_after_sleep_onset_minutes": 35,
"num_awakenings": 4,
"time_in_bed_minutes": 510
},
"stages": {
"wake_minutes": 55,
"light_minutes": 240,
"deep_minutes": 90,
"rem_minutes": 90
}
Treat this illustrative sample with care. Light, deep and REM minutes sum to the 420-minute sleep time, as they should. But 420 of 510 minutes in bed is about 82%, not 88.4%. Sleep efficiency is total sleep time divided by time in bed, so a receiver should recompute derived metrics from the underlying epochs instead of trusting a stored figure. The sample should not be reused as a test fixture without correcting it.
Because the evidence is weaker, the standard asks wearables to say how good it is. The API specification defines per-sensor quality indicators:
"signal_quality": {
"accelerometer": { "valid_epochs_percent": 98.5, "artifacts_detected": 3 },
"ppg": { "valid_epochs_percent": 95.2, "motion_artifacts": 12 }
}
Wearables may also report heart rate variability (HRV) from the PPG signal. The API data types include RMSSD, SDNN, high- and low-frequency power, and the LF/HF ratio, each as a session summary plus an optional time series.
The overview's certification classes tie claim strength to demonstrated accuracy. Class I (clinical) needs PSG accuracy of at least 90% and regulatory approval. Class II (wellness) needs at least 85%. Class III (research) needs at least 80% and is for research purposes only. A wrist tracker estimating REM minutes is therefore not equivalent to PSG measuring REM from EEG, and the metadata is meant to make the distinction visible.
Phase 1 defines six respiratory event kinds. Each has its own AASM scoring criteria, and the standard keeps per-event metadata so that indices can be recomputed instead of trusted.
| Event kind | Meaning |
|---|---|
obstructive_apnoea | Airflow stops while respiratory effort continues against a blocked airway |
central_apnoea | Airflow stops because respiratory effort stops |
mixed_apnoea | Starts without effort and ends with effort |
hypopnoea | Airflow is reduced but not absent |
rera | Respiratory effort related arousal: rising effort ending in an arousal, without meeting apnoea or hypopnoea criteria |
oxygen_desaturation | A fall in saturation, scored on its own |
A single event record looks like this:
{
"type": "respiratory_event",
"session_id": "ses_01HXY",
"event_id": "re_01HXY-12",
"event_kind": "obstructive_apnoea",
"started_at": "2026-04-26T23:45:12.300Z",
"duration_seconds": 14,
"associated_oxygen_desaturation_pct": 3.5,
"associated_arousal": true,
"scoring_algorithm": "AASM-2024-default",
"scorer_id": "did:wia:scorer:tech-09",
"signature": { "alg": "Ed25519", "value": "Bz9A…" }
}
The timestamp has millisecond precision because Phase 1 requires sub-second precision for events tied to specific waveform samples. With it, a reviewer can jump to the exact place in the EDF file where the event was scored. scorer_id identifies the person or system responsible. Event records carry a signature, and the session as a whole carries one too. Stage records inside a signed session inherit its provenance, but a stage record published alone must be signed.
The Apnoea-Hypopnoea Index (AHI) is the count of apnoeas plus hypopnoeas divided by hours of sleep. The Respiratory Disturbance Index (RDI) additionally counts RERAs. A record that lists events individually can yield either figure, using whichever denominator the study supports. The Phase 2 respiratory summary reports ahi and odi alongside min_spo2_percent and t90_percent.
The API specification's example event differs from the Phase 1 envelope. It uses start_time and the American spelling obstructive_apnea, where Phase 1 uses started_at and obstructive_apnoea. Implementers who emit or validate events should follow the Phase 1 tokens and field names.
An arousal is a brief shift towards lighter sleep or wakefulness that does not by itself end the night's sleep. Phase 1 recognises two sources: EEG-based arousals, scored from the brain-wave tracing, and movement-based arousals, inferred from motion. The distinction matters because the first is clinical evidence and the second is an estimate. A PSG or a clinical-grade device can score arousals from EEG. A wrist tracker can only report that the wearer moved.
Arousals are linked to breathing in two ways. First, an arousal often ends an apnoea or hypopnoea, which is why a respiratory event record carries associated_arousal (the API example uses arousal). Second, a RERA is defined by its ending arousal: without one, the breathing effort is not counted. A stored RERA therefore implies arousal evidence, which a flow-and-oximetry HSAT cannot provide.
Arousals are also not the same as awakenings. The wearable summary counts num_awakenings and wake_after_sleep_onset_minutes. Those are epochs scored as wake, whereas an arousal can occur while the stage remains sleep. A night with many arousals and few awakenings can still be fragmented, which stage totals alone do not show.
clinical_grade flag (2.2, 2.4) depends on the clearance reference defined in the sister standard WIA-MED-020 (Wearable Health).did:wia:patient:… and connect to the consent handling of the Phase 3 federation protocol.The Phase 2 HTTP surface lets a client post a session and read back its scoring. The quick-start in the reference host shows the two calls:
curl -X POST "http://localhost:8080/sm/session" \
-H "Content-Type: application/json" \
-d @session.json
curl "http://localhost:8080/sm/session/{session_id}/scoring"
The API specification also lists session CRUD under /api/v1/sleep/sessions and an export endpoint that takes format=edf or format=csv. The reference command-line tool provides validate, session, event, score, consent and info subcommands. Running validate against a hand-written session is a quick way to test your understanding of this chapter's fields.
For a patient, the main protections are privacy and honesty about evidence. Patient identifiers are meant to be pseudonymous, using the did:wia:patient form so that identity is kept off the wire. The overview calls for GDPR-style consent and, for clinical devices, HIPAA compliance, with AES-256 encryption for stored data and PII removal for research data. Patients who own both a wearable and a lab study should not expect the two to agree epoch by epoch. The wearable estimates from movement and pulse, while the lab scored brain waves.
For a clinician, the practical question is how much weight a record deserves. Check session_kind first, then clinical_grade, then the scoring algorithm and scorer, and the signal-quality indicators when the data came from a wearable. A wearable's "REM minutes" is a wellness estimate, a home test's AHI depends on its denominator, and a lab PSG's events can be traced to the waveform through the EDF file and its hash. Clinical decisions should rest on the strongest of these.
To summarise: the AASM supplies the stage vocabulary and the 30-second epoch. PSG, HSAT and wearables measure different things, and Phase 1 records that difference through session_kind, clinical_grade and the scoring metadata. Respiratory events and arousals keep enough per-event detail for indices to be recomputed. The next chapter moves from this physiology to the data envelopes themselves and to how they are exchanged between devices, dashboards and records systems.