1. Detection target and rule boundaries
1.1 Leg movement, periodic series and disease are different levels
This entry belongs to WSIC 4.4.1, sleep signal processing algorithms. A periodic leg movement detection algorithm primarily uses left and right anterior tibialis surface electromyography (leg EMG) from overnight polysomnography (PSG). It first locates individual candidate leg movements, applies a declared interval and sequence convention to identify periodic leg movements during sleep (PLMS), and produces an event list and nightly summary. Periodic leg movements during wakefulness (PLMW), nonperiodic leg movements and other large body movements need separate labels. Any leg activity should not automatically be counted as PLMS.[1][2][3]
PLMS are PSG events. Periodic limb movement disorder (PLMD) additionally requires clinical symptoms and exclusion of other explanations. The AASM clinical practice guideline describes PLMD diagnosis in terms of frequent PLMS, significant sleep disturbance or daytime impairment, and consideration of other sleep and medical conditions. An algorithmic PLMS index cannot by itself diagnose PLMD or restless legs syndrome (RLS).[4] Temporal proximity between a leg movement and an EEG arousal does not by itself prove that the movement caused the arousal.
1.2 State the scoring convention
| Scoring step | Public AASM teaching example | WASM/IRLSSG 2016 revision |
|---|---|---|
| Single candidate | Leg movement of about 0.5-10 seconds; simultaneous bilateral activity is merged under that convention | Unilateral candidate 0.5-10 seconds; bilateral candidate may last up to 15 seconds |
| Periodic series | At least four movements with onset-to-onset intervals of 5-90 seconds | At least four candidates with onset-to-onset intervals of 10-90 seconds; a candidate after an interval below 10 seconds may interrupt a series |
| Breathing association | Movements during respiratory events and a stated surrounding window are not counted | A periodic rate for all candidates may be reported first, then a rate excluding respiratory-related candidates |
| Wake and sleep | Movements in sleep enter the PLMS count | Sleep and wake activity may be described separately, with consistent denominators and definitions |
The table highlights differences; it does not replace either complete manual. AASM Sleep ISR public help illustrates a 0.5-10 second movement, at least four movements and 5-90 second intervals. The 2016 WASM expert standards revised candidate and periodic-series definitions.[2][3] A project must record the exact manual edition, amplitude and ending criteria, bilateral merging, respiratory exclusion window and whether an interval is measured onset-to-onset or another way. Combining the AASM five-second lower bound with the other WASM rules without disclosure creates an untraceable hybrid.
2. Signals and detection chain
2.1 Recorded inputs and synchronization
The key full-PSG inputs are raw left and right anterior tibialis EMG, channel sampling rates and physical units, montage and gain, hardware and software filtering, timestamps, sleep stages, and respiratory event onset and offset annotations. EEG, EOG and chin EMG support stage and arousal review. ECG can help identify cardiac interference in leg EMG; video and motion channels can explain larger activity. If only wrist activity, mattress pressure or radar is available, results should be named as movement candidates from those sensors until comparison with PSG supports a claim of anterior-tibialis-EMG-scored PLMS.[1][5]
Keep the two leg EMG channels separately. A single fused trace makes simultaneous bilateral activity and one-sided artifact harder to audit. Acquisition high-pass, low-pass and notch filters, rectification and smoothing affect burst amplitude and boundaries. Developers should retain raw waveforms, device settings and resampling steps, and check swapped channels, clock drift, clipping, poor contact, sustained noise elevation and overnight gaps. Misaligned stages or respiratory annotations propagate into exclusions and the final index.
2.2 From EMG burst to periodic series
| Stage | Algorithm choice to freeze | Likely error |
|---|---|---|
| Quality gate | Valid amplitude, baseline noise, saturation and missing intervals | Spikes from a bad electrode become movements |
| Unilateral candidate | Local resting baseline, onset/offset amplitude, duration and morphology | ECG leakage or fragmentary myoclonus is detected |
| Bilateral integration | Temporal coincidence and merge/split rules for the two legs | One bilateral movement is counted twice |
| Rule filter | Sleep/wake, candidate duration and onset intervals | Isolated activity enters a PLMS series |
| Respiratory and arousal association | Event windows, sequence of events and handling of absent annotations | Respiratory activity or arousal relation is misattributed |
| Human review | Raw bilateral EMG, context, version and edit reasons | Only the PLMS index remains, without traceable events |
A conventional implementation may use a local baseline and amplitude gate on rectified EMG, followed by duration, sustained-activity morphology and a rule-based state machine. Machine learning can identify waveform candidates and still use explicit sequence rules to form PLMS. Engineering implementations of older AASM rules commonly use a rise of about 8 µV above resting EMG to start a movement and a return to lower activity for a defined period to end it. These values must be checked against the selected edition, physical units and device calibration; they cannot be pasted onto uncalibrated digital amplitudes.[1][5] Model complexity does not remove the need to disclose rule versions and quality status.
2.3 Series, exclusions and output levels
An individual candidate should carry side, onset, offset, duration, baseline and peak, and signal quality. A series should carry its member list, consecutive onset intervals and interruption reason. Stage, respiratory-event and arousal associations should be stored separately from the waveform detection so reviewers can recompute different exclusion conventions. A system should not discard every movement near breathing events and then claim excellent raw leg-movement detection; waveform detection and final PLMS counting require separate validation.
The nightly PLMS index (PLMI) is generally the number of qualifying PLMS in sleep divided by total sleep time in hours. Reports should show the numerator, sleep-time denominator, analyzable EMG duration, number excluded as respiratory-related, wake activity and gaps. If a PLMS-with-arousal index is also reported, disclose the arousal scoring edition, temporal association rule and denominator; it differs from the PLMI for all PLMS. Changing the scoring convention or exclusion window can alter the index for the same night, so comparisons first need aligned definitions.[1][2][3]
3. Distortion and population boundaries
3.1 EMG artifact and other movements
ECG leakage can create rhythmic spikes on leg EMG, while a changing noise floor makes a fixed amplitude threshold overdetect or miss bursts. The original detector validation explicitly identified both as error sources.[5] Electrode loss, touching or reattachment, body movements, scratching, cramps, fragmentary myoclonus and other REM movements can also resemble a single candidate. Waveform morphology, left/right comparison, other channels and video help adjudicate them. Provide an “unscorable” state instead of silently treating poor-quality segments as movement-free.
Leg movements near respiratory events are especially consequential for PLMI. Scoring systems differ in the way they exclude breathing-related movements. An original detector study found that changing the exclusion window materially changed periodic-movement counts among people with sleep-disordered breathing.[5] Reports should retain the respiratory annotation source, window definition and counts before and after exclusion. Temporal proximity indicates association, not proven cause. If flow or respiratory-effort channels are missing, mark breathing association as incomplete.
3.2 Limits of extrapolation and public data
Children, older adults, people with neurological conditions or medication effects, sleep-disordered breathing, weak leg EMG or difficult electrode placement may have different signals and error patterns. An external validation study found that differences in manual scoring and artifacts from abnormal motor activity affect transfer across clinics; a single-laboratory average cannot establish broad applicability.[6] Adult and pediatric clinical interpretation should remain separate, as should event detection and a claim to diagnose PLMD.[4]
PhysioNet PSG-IPA includes lower-limb anterior tibialis EMG and an expert leg-movement scoring task. It can support inter-rater analysis, but its task and sample scope alone do not support broad claims about clinics or devices.[8] The CAP Sleep Database offers bilateral leg EMG, respiration and staging research signals. Users still need to inspect each record's event labels, scoring convention and license; the mere presence of leg EMG does not make it a ready-made PLMS ground-truth set.[9]
4. Validation and continuing quality control
4.1 Validate each level of the chain
Trained scorers should annotate raw PSG independently using one frozen rule edition. A second scorer should review at least a portion of recordings, with disagreement adjudicated. Test data should be split by participant and include independent equipment or sites. Report excluded nights and unscorable duration; fragments from one subject or night must not reappear in a purportedly independent test. A multi-expert study shows that comparison with one scorer is affected by inter-scorer variability, so agreement and adjudication deserve reporting alongside model performance.[7]
| Validation level | Suggested measure | Conditions to disclose |
|---|---|---|
| Single leg movement | Event sensitivity, positive predictive value, false positives per hour, onset/offset error | Matching tolerance, bilateral merging and invalid segments |
| Periodic series | Series detection, split/merge errors and interval distribution | AASM or WASM edition and short-interval interruption rule |
| Nightly summary | PLMI bias, agreement and error distribution by night | Total sleep time, respiratory exclusion and outlier handling |
| Associated labels | Differences in breathing-related and arousal-related movement identification | Respiratory/arousal scoring editions, timing and windows |
| Generalization | Device, site, age, RLS/OSA and low-quality signal strata | Sample size, confidence intervals and unscorable fraction |
High correlation does not make two nightly PLMI values interchangeable. Alongside pooled metrics, inspect high-index and low-index nights, severe respiratory events, REM and NREM, and the most artifact-heavy cases. Freeze algorithm thresholds before the independent test; do not repeatedly tune them on its manual labels. If reduced scoring time is the intended benefit, measure the human work required to accept, reject and edit candidates, rather than reporting classification scores alone.
4.2 Review interface and version changes
A reviewer should see synchronized left and right leg EMG, stages, respiratory events, relevant EEG arousals and video, navigate to a series, inspect member intervals and record reasons for edits. Exports should include event times, side, series ID, scoring convention, quality state, exclusion reason, PLMI numerator and denominator, and edit history. An automatic PLMI alone, without waveform evidence, is difficult to audit professionally.
After deployment, monitor invalid duration, candidate rate, respiratory exclusion rate and human edit rate by device, firmware, montage, electrode, sampling/filter setting and setting. Any change to a threshold, model, stage source or respiratory-event detector calls for rerunning a frozen test set and checking PLMI bias. For unvalidated groups or failed required channels, display “review required / complete scoring unavailable.” Raw PSG and linked health information need access controls, a retention period and a stated purpose.
5. Procurement and use checks
5.1 Eight questions before delivery
| Question | Evidence to obtain |
|---|---|
| Which PLMS convention is implemented? | Manual edition, single-movement and series settings, bilateral rule |
| Are the inputs sufficient? | Left/right anterior tibialis EMG, stage, breathing and arousal channels and synchronization |
| Which periods cannot be scored? | Noise, dropout and gaps, with analyzable duration |
| How are breathing-related movements excluded? | Respiratory annotation source, exclusion window and counts before/after |
| How is PLMI calculated? | Event numerator, total-sleep-time denominator and wake handling |
| Who scored the test data? | Human raters, disagreement adjudication and independent split |
| In whom has it been validated? | External sites, devices, age and disease strata |
| Can review and updates be traced? | Raw waveforms, event edits, model version and regression tests |
5.2 How to use the result
Research software can shorten manual searching while retaining original PSG and its scoring convention. Clinical scoring assistance must match the target laboratory's channels, manual edition and review process. A low-channel or non-EMG consumer product can offer a movement trend; without validation against full PSG for its claim, it should not present that trend as convention-scored PLMS. No automatic PLMI alone can determine PLMD, RLS or sleep-disordered breathing diagnosis or treatment.[4]
This guide supports algorithm design, procurement and quality control. It gives no individual diagnosis or treatment advice. Whether software is a medical device depends on intended use and applicable market rules.
6. Sources
[1] AASM, The Manual for the Scoring of Sleep and Associated Events. Official entry point for PSG stages, movements, respiration and technical scoring.
[2] AASM Sleep ISR, Scoring Limb Movements. Public teaching example; projects should still check the edition they use.
[3] Ferri et al., WASM 2016 standards for recording and scoring leg movements. WASM/IRLSSG revision of candidates, series and breathing association.
[4] AASM, Treatment of Restless Legs Syndrome and Periodic Limb Movement Disorder. Clinical PLMD criteria and disease boundary.
[5] Moore et al., Design and Validation of a Periodic Leg Movement Detector. Original study of automatic detection, noise and respiratory exclusion.
[6] Cesari et al., External validation of a data-driven algorithm for muscular activity identification during sleep. Cross-center validation of automatic EMG scoring.
[7] Carvelli et al., Design of a deep learning model for automatic scoring of periodic and non-periodic leg movements during sleep. Original multi-cohort and multirater comparison.
[8] PhysioNet, Polysomnography Inter-rater Performance Assessment. Lower-limb EMG and inter-rater research material.
[9] PhysioNet, CAP Sleep Database. Research recordings with bilateral leg EMG and associated annotations.
The processing chain and checklists are editorial recommendations, not certification of any algorithm or harmonization of scoring systems by the cited organizations.