Buscar en
Revista Colombiana de Psiquiatría (English Edition)
Toda la web
Inicio Revista Colombiana de Psiquiatría (English Edition) Identifying sleep apnoea and hypopnoea episodes from respiratory polygraphy sign...
Journal Information
Vol. 46. Issue 2.
Pages 88-94 (April - June 2017)
Vol. 46. Issue 2.
Pages 88-94 (April - June 2017)
Original article
DOI: 10.1016/j.rcpeng.2017.05.006
Full text access
Identifying sleep apnoea and hypopnoea episodes from respiratory polygraphy signals
Identificación automática de episodios de SAHS utilizando señales de poligrafía respiratoria
Dayana Lizethe Guzmán Sierra, Mariano Carreño León, Luz Helena Camargo Casallas
Corresponding author

Corresponding author.
Grupo de investigación Ingeniería y Nanotecnología para la vida, Facultad de Ingeniería, Universidad Distrital Francisco José de Caldas, Bogotá, Colombia
Article information
Full Text
Download PDF
Figures (4)
Show moreShow less
Tables (1)
Table 1. Classification of sleep apnoea–hypopnoea syndrome episodes.

To design a diagnostic support system for sleep apnoea and hypopnoea syndrome (SAHS) using moving average based on knowledge, able to identify SAHS episodes from a respiratory polygraphy (RP) database.


An analysis was made of data obtained from a public database, that included the RP signals, nasobucal airflow, thoracoabdominal movement, and pulse oximetry of 23 patients between 28 and 68 years with suspected SAHS, and with a body mass index (BMI) from 25.1 to 42.5.


The identification and classification of episodes of apnoea and hypopnoea was obtained.


The algorithm designed identified episodes of SAHS using polygraphy signals, which by implementating in a graphical interface allows visualisation of onset, duration, type, oxygen saturation, and pulse oximetry of each episode, and can be used as a support tool for the diagnosis of sleep disorders.


Diseñar un sistema de apoyo diagnóstico para el síndrome de apneas-hipopneas del sueño (SAHS) utilizando conocimientos basados en media móvil, capaz de identificar episodios de SAHS a partir de una base de datos de poligrafía respiratoria (PR).


Se analizaron las señales de poligrafía respiratoria (flujo aéreo nasobucal, movimiento toracoabdominal y pulsioximetría) de 23 pacientes con sospecha de SAHS (edad, 28-68 años; índice de masa corporal, 25,1-42,5), obtenidas de una base de datos pública.


Se identificaron y se clasificaron episodios de apnea y hipopnea.


Se detectaron los episodios de SAHS utilizando señales de poligrafía respiratoria cuya implementación en una interfaz gráfica permite la visualización del inicio, la duración, el tipo, la saturación de oxígeno y la pulsioximetría de cada episodio, y se puede emplear como herramienta de apoyo al diagnóstico del trastorno del sueño.

Palabras clave:
Full Text

Sleep is considered to be one of the necessary phases for the proper functioning of the body, which not only helps to repair the body at the end of the day, but is also associated with the regulation of neuronal processes and other systems, hence why sleep medicine is becoming increasingly important. Sleep disorders in a population are linked to decreased productivity, road traffic accidents,1 mental health problems and other types of illnesses, such as arterial hypertension, cerebrovascular disease, coronary disease and neurocognitive disease.2

Research studies carried out by the American Academy of Sleep Medicine (AASM) indicate that approximately 35% of the US population suffers or has suffered from some form of sleep disorder in their lifetime.3 The most common nocturnal disorder is sleep apnoea-hypopnoea syndrome (SAHS).4 Apnoea is the cessation of the oronasal airflow for more than 10 seconds and, in hypopnoea, airflow is reduced by more than 50% of the baseline value, leading to an oxyhaemoglobin desaturation of 2–4%. Each episode of apnoea lasts for 20–30s, although they can last for 2–3min.5,6

Some studies indicate that SAHS affects 2% of women and 4% of men7; however, on considering patients between the ages of 30–60 years at random, up to 9% of women and 24% of men have been found to be affected.8

At present, the most commonly used method for diagnosing SAHS is polysomnography (PSG),6,9 which includes an electroencephalogram, electrocardiogram and submental electromyogram and measures of respiratory changes such as position changes, snoring, thoracoabdominal movement, pulse oximetry, oxygen saturation, oronasal airflow and electrocardiogram. However, this method is costly and very time-consuming, and the detailed analysis that must be performed by the specialist is complex.10 Various studies have shown that equipment that exclusively records respiratory variables can be used,11–16 thus reducing costs and waiting times, and facilitating the diagnosis of SAHS at sleep centres.14

The objective of this study is to design a diagnostic support system for SAHS using a moving average-based approach that is able to identify episodes from a respiratory polygraphy (RP) database.


The data were extracted from the Physionet database, which contains overnight polysomnograms (mean, 7h) of 25 patients with suspected breathing-related sleep disorders.

The subjects from whom the data were obtained were randomly selected over a period of six months from among the patients of the St Vincent's University Hospital Sleep Disorders Clinic, in Dublin, and were aged between 28 and 68 years, with a body mass index (BMI) of 25.1–42.5 and an apnoea–hypopnoea index (AHI) of 1.7–90.9.

Moreover, the patients were deemed not to suffer from heart disease or autonomic dysfunction, and were not on medication capable of interfering with their heart rate.17 According to the Epworth sleepiness scale,17 76% of the individuals presented mild to severe sleepiness.

RP recordings were obtained in the standard European data format (EDF) used for polysomnography (PSG) recordings, which identified each individual and specified the technical characteristics of the recording. The recordings were characterised, annotated by the specialist and in an open code – conditions that allowed them to be used for this project.

For the signal analysis, two recordings did not meet the inclusion criteria set for this study, and so the recordings of 23 subjects were used (19 men and 4 women). To analyse the signals, three main phases were proposed: signal preprocessing, processing and apnoea episode detection.

Fig. 1 shows a diagram of the general proposal for detecting episodes of SAHS, specifying the procedures considered for each stage.

Fig. 1.

Block diagram of the proposed system.


The American Academy of Sleep Medicine (AASM) classifies RP into four types. Type 1 is conventional PSG, monitored by a sleep laboratory technician (with at least 7 channels); type 2 is PSG performed with a portable device and is not monitored by a technician; type 3 corresponds to what we call RP, where breathing, thoracoabdominal effort and pulse oximetry are recorded (with a total of 4–7 channels); and type 4 corresponds to super-simplified studies with 1- or 2-channel devices (oximetry and/or breathing).18 For this study, airflow (oronasal airflow), respiratory effort (thoracoabdominal movement) and oxygen saturation (pulse oximetry) data were considered, which are recordings obtained by PSG that correspond to type 3 RP.

To view the RP recordings, non-commercial Polyman software was used, which is compatible with the EDF and facilitates PSG signal viewing.19 Segments were found that were eliminated based on the following conditions for each signal: Oronasal airflow, amplitude between –20 and 20l/min, with a dominant frequency of 0.2Hz, reported for the breathing of one relaxed (sleeping) subject20; thoracoabdominal movement, the values of these signals are between 5 and –5; pulse oximetry, normal values of this signal are between 40 and 80p/min; oxygen saturation, normal values are between 90% and 100%.

To eliminate high frequency noise and prevent information loss, a moving average filter was used, which is included in MATLAB® v. 7.1 2011 (MATrix LABoratory), an interactive system designed for matrix calculations that is primarily used in scientific and engineering analyses. The moving average filter is used to smooth the data for trend analysis, as described in Eq. (1):

where M is the number of windows to which the filter is applied, h(k) describes the filter applied and x[nk] are the respiratory polygraphy signals.

RP signal processing

In order to process signals, the moving average was used by setting a 10s window (80 points) that represents the minimum duration of an SAHS episode.

The moving average is an average of the values in an irregular series that moves from one extreme to the other, replacing these values with the average result in order to detect its trend.21 This average was obtained from the root mean square value (RMS) in each segment, as this provides information on the amplitude of the signal and facilitates the determination of the frequency variables, distance between peaks and form of each signal, which are important for detecting episodes of SAHS.

The RMS or root mean square value for a set of N values {x1, x2,…, xN} of a discrete x variable is determined by Eq. (2):

where N is the number of window elements and each of the elements.

The RMS value is proportional to the signal energy and is defined by Eq. (3):

where T is the temporal integration period and a is the immediate signal amplitude.22

A threshold was subsequently set in accordance with the criteria established by the consensus on SAHS episodes (Table 1) and a binary vector was generated where zero corresponds to the threshold value and 1 to the SAHS episode.

Table 1.

Classification of sleep apnoea–hypopnoea syndrome episodes.

Obstructive apnoea  Absence or >90% reduction in the respiratory signal (thermistors, nasal cannula or pneumotachometer) lasting >10s in the presence of ongoing respiratory effort detected by thoracoabdominal bands 
Central apnoea  Absence or >90% reduction in the respiratory signal (thermistors, nasal cannula or pneumotachometer) lasting >10s in the absence of respiratory effort detected by thoracoabdominal bands 
Mixed apnoea  A respiratory event that usually begins with a central component and ends with an obstructive component 
Obstructive hypopnoea  Discernible reduction (>30–90%) in the respiratory signal amplitude lasting >10s (thermistors, nasal cannula or pneumotachometer), accompanied by desaturations (≥3%) in the presence of ongoing respiratory effort 
Central hypopnoea  Discernible reduction (>30–90%) in the respiratory signal amplitude lasting >10s, accompanied by desaturations ≥3% in the absence of respiratory effort 
Mixed hypopnoea  A respiratory event that usually begins with a central hypopnoea component and ends with an obstructive hypopnoea component 

Source: Pita and Pértegas.24

The start and end time was then determined, generating another vector with the start (1) and end (−1) times, taking into account the distance between peaks23 (Table 1).

SAHS detection

For the classification of the SAHS episodes, a comparison of abdominal and thoracic movements was performed, and the points at which these abdominal and thoracic movements incurred the same reductions were considered.

To assess the performance of the classification, sensitivity, specificity, precision (positive predictive values [PPV] and negative predictive values [NPV]24) were assessed with a view to checking the validity and safety of the algorithm. See Eqs. (4)(7):

where VP is true positives; VN is true negatives; FP is false positives; and FN is false negatives.

Graphical interface

The graphical user interface was performed using the MATLAB® GUIDE programming environment (v. 7.1 2011). This environment facilitated the creation and implementation of simulation programmes with a user-friendly interface.

ResultsSignal preprocessing

A polysomnographic study takes 8h and analyses 230,400 samples. Segments corresponding to artefacts at the start and end of the recording were deleted (as presented in Fig. 2). The signal is then filtered for the purpose of smoothing it and to eliminate noise without losing information.

Fig. 2.

Respiratory flow signal (deleted segment in red).

SAHS episode detection

With the RMS value, determined after applying the moving average to oronasal airflow, thoracoabdominal movement and pulse oximetry signals, values proportional to the amplitude variation were detected. Fig. 3 shows a vector of RMS values.

Fig. 3.

(A) Visualisation of RMS values in the respiratory flow signal; RMS values in red. (B) Enlargement.


The decrease in the RMS value of the oronasal airflow, thoracoabdominal movement and pulse oximetry signals facilitates the detection of SAHS episodes.

For the classification of apnoea, thoracoabdominal efforts <10% were considered, while hypopnoeas were defined as a vector of thoracoabdominal effort <70% and >10% (Fig. 4).

Fig. 4.

Possible episode of apnoea. Decrease in peripheral oxygen saturation (SpO2) (green), behaviour of flow signals and thoracoabdominal effort (red) and increase in cardiac pulse (yellow).


Barreiro et al.25 detected episodes of SAHS and compared the manual and automatic analysis of neurological and respiratory signals. With the automatic analysis, they reported sensitivity of 55%, PPV of 100% and NPV of 47%. Karandikary et al. also studied SAHS, but they do not address the problem of classifying the type of episode.

In this study, the evaluation was performed using four recordings in training, with the remaining samples used for the validation (19 recordings). The oronasal airflow, thoracoabdominal movement and pulse oximetry data enabled each and every SAHS episode reported in the specialist's notes to be detected, including episodes that fit the medical criteria established in the Spanish national consensus on apnoea and hypopnoea26 and which were not noted. In the classification of these episodes, sensitivity values of 62.33–96.17% were obtained, along with specificity of 38.19–88.69%, precision of 7.06–68.27% and NPV of 49.71–97.47%.

The user-friendly graphical interface implemented in this study enabled the selection of an RP recording, as well as the detection, analysis and classification of SAHS episodes. It may also be employed to train students, viewing signals in order to better understand the behaviour of SAHS episodes, and the interface thus becomes a tool that may be used to teach specialists undergoing training to improve their skills in detecting such episodes.

As reported by Álvarez et al., PSG studies are valued at approximately 179 euros (645,000 Colombian pesos), while the respiratory polygraph costs just 65 euros (234,000 Colombian pesos)27; in some cases, these costs do not include the patient's hospital stay, the salary of the technicians working at the hospital's sleep disorders unit nor the proportionate expenses of the fixed costs, which include facility depreciation costs, general maintenance costs and the costs of other devices within the sleep disorders unit, video cameras, monitors, etc., which are born directly by the patients and/or relatives. As such, the respiratory polygraph used in this study may reduce the costs and resources required in cases where access to costly methods such as the PSG is not possible or when travelling to centres with this equipment is not an option. Moreover, processing the signals with the implemented strategy takes around 30s per patient, thereby reducing waiting times once the data have been acquired.

The strategy employed in this study would be more suitable for screening in the identification and classification of SAHS episodes in patients with suspicious symptoms, taking into account its low cost and the reduction in time for acquiring and assessing the data that may support the diagnosis; it also enables the duration of each episode and oxygen saturation to be established, which may provide the specialist with more information, and it can be performed in the patient's own home, generating a more comfortable environment with timely detection. In order to implement this strategy, an RP device, computer, software with the implemented algorithm and a trained general practitioner are required.


In this study, episodes of apnoea/hypopnoea were detected and automatically classified as mixed, central or obstructive as diagnostic support, using the moving average with respect to the RMS value and identifying the onset and duration of SAHS. A graphical interface was also designed which may be used for training purposes and to view SAHS signals. Future studies investigating the learning strategies of the machine that could aid classification should be conducted.

Ethical disclosuresProtection of human and animal subjects

The authors declare that no experiments were performed on humans or animals for this study.

Confidentiality of data

The authors declare that no patient data appear in this article.

Right to privacy and informed consent

The authors declare that no patient data appear in this article.

Conflicts of interest

The authors declare that they have no conflicts of interest.


To Dr Diana María Tafur Guzmán, general practitioner at the Military University, for her contributions in assessing the software developed.

S. Garbarino, F. Traversa, F. Spigno.
Sleepiness, safety on the road and management of risk.
G Ital Med Lav Ergon, 34 (2012), pp. 322-325
J. Velayos.
Medicina del sueño. Enfoque multidisciplinario.
Médica Panamericana, (2009),
D. Léger, B. Poursain, D. Neubauer, M. Uchiyama.
An international survey of sleeping problems in the general population.
Curr Med Res Opin, 24 (2008), pp. 307-317
J.M. Monserrat Canal.
Síndrome de apnea del sueño.
Medicina interna, 13a ed., pp. 772-777
A.S. Fauci, E. Braunwuald, K.J. Isselbacher.
Apnea delsueño.
Harrison: principios de medicina interna, 14a ed., pp. 1683-1686
C.A. Kushida, M.R. Littner, T. Morgenthaler, C.A. Alessi, D. Bailey, J. Coleman.
Practice parameters for the indications for polysomnography and related procedures: an update for 2005.
Sleep, 28 (2005), pp. 499-521
T. Young, M. Palta, J. Dempsey, J. Skatrud, S. Weber, S. Badr.
The occurrence of sleep disordered breathing among middle aged adults.
N Engl J Med, 328 (1993), pp. 1230-1235
Aguirre C. Caracterización de pacientes adultos con diagnostico de apnea del sueño. Colombia: Universidad Tecnológica de Pereira; 2012. Available in: http://repositorio.utp.edu.co/dspace/bitstream/11059/2991/1/6168498075M843.pdf
J. Durán-Cantolla, F.J. Puertas-Cuesta, G. Pin-Arboledas, J. Santa María-Cano, el Grupo Español de Sueño (GES).
Documento de consenso nacional sobre el síndrome de apneas-hipopneas del sueño.
Arch Bronconeumol, 41 (2005), pp. 1-110
P. Lloberes, J. Durán, M.A. Martinez, J.M. Marín, A. Ferrer, J. Corral, et al.
Diagnóstico y tratamiento del síndrome de apneas-hipopneas del sueño.
Arch Bronconeumol, 47 (2011), pp. 143-156
W.W. Flemons, M.R. Littner, J.A. Rowley, P. Gay, W.M. Anderson, D.W. Hudgel, et al.
Home diagnosis of sleep apnea: a systematic review of the literature. An evidence review cosponsored by the American Academy of Sleep Medicine, the American College of Chest Physicians, and the American Thoracic Society.
Chest, 124 (2003), pp. 1543-1579
D. Hudgel, W.M. Anderson, A. Boehlecke, D. Claman, R. Goldberg, D.J. Gottlieb, et al.
Portable Monitoring Task Force of the American Academy of Sleep Medicine. Clinical guidelines for the use of unattended portable monitors in the diagnosis of obstructive sleep apnea in adult patients.
J Clin Sleep Med, 3 (2007), pp. 737-747
Decision memo for continuous positive airway pressure (CPAP) therapy for obstructive sleep apnea (OSA) (CAG-00093R2). Centers for Medicare & Medicaid Services; 2008 (from2=viewdecisionmemo.asp&id=204&).
J. Terán Santos.
Acreditaciones en Neumología. Unidades de sueño.
Arch Bronconeumol, 45 (2009), pp. 263-265
J. Durán-Cantolla, F. Aizpuru, C. Egea, N. Pedraza, R. Rubio, C. González, et al.
Validez de un sistema supersimplificado (ApneaLink™) para el diagnóstico de pacientes con sospecha clínica de síndrome de apneas-hipopneas del sueño (SAHS). Resultadospreliminares. (Abstract).
Arch Bronconeumol, 45 (2009), pp. 248
S.S. Ng, T.O. Chan, K.W. To, J. Ngai, A. Tung, F.W. Ko, et al.
Validation of a portable recording device (ApneaLink) for identifying patients with suspected obstructive sleep apnea syndrome (OSAS).
Intern Med J, 39 (2009), pp. 757-762
A.L. Goldberger, L.A.N. Amaral, L. Glass, J.M. Hausdorff, P.Ch. Ivanov, R.G. Mark, et al.
PhysioBank, PhysioToolkit, and PhysioNet: components of a new research resource for complex physiologic signals.
Circulation, 101 (2000), pp. e215-e220
R. Ferber, R. Millman, M. Coppola, J. Fleetham, C.F. Murray, C. Iber, et al.
Portable recording in the assessment of obstructive sleep apnea.
Sleep, 17 (1994), pp. 378-392
B. Kemp, M. Roessen.
Polyman: a free(ing) viewer for standard EDF(+) recordings and scorings.
pp. 71-73
J. Gómez.
Equipo de medición y visualización del flujo aéreo oronasal.
Universidad Nacional de Colombia, (1996),
A. Aguirre.
Introducción al tratamiento de series temporales: aplicación a las ciencias de la salud.
Díaz de Santos, (1994),
Bartí R. Acústica medioambiental. vol. 1. Club Universitario; 2010.
F. Puerta, G. Pin, J. Santa María, J. Duran, Grupo Español de Sueño (GES).
Consenso nacional sobre el Síndrome de Apneas Hipopneas del sueño (SAHS). Definición y concepto, fisiopatología, clínica y exploración del SAHS.
Arch Bronconeumol, 41 (2005), pp. 12-29
F. Pita, S. Pértegas.
Pruebas diagnósticas: sensibilidad y especificidad. Unidad de Epidemiología Clínica y Bioestadística. Complexo Hospitalario Universitario de A Coruña (España).
Aten Prim, 10 (2003), pp. 120-124
Barreiro B, Badosa G, Quintana S, Esteban L, Heredia J. Comparación entre el análisis automático y manual de la PSG convencional en el diagnóstico del síndrome de apnea–hipopnea obstructiva del sueño. 2009.
D. Sánchez.
Procesado y transmisión de señales biomédicas para el diagnóstico de trastornos y enfermedades del sueño [tesis doctoral].
Universidad de Cádiz, (2008),
A. Álvarez, S. Terán, G. Cordero, L. Rodríguez, J. Viejo, A. Marañon.
Reliability of home respiratory polygraphy for the diagnosis of sleep apnea–hypopnea syndrome: analysis of costs.
Arch Bronconeumol, 44 (2008), pp. 22-28

Please cite this article as: Guzmán Sierra DL, Carreño León M, Camargo Casallas LH. Identificación automática de episodios de SAHS utilizando señales de poligrafía respiratoria. Rev Colomb Psiquiat. 2017;46:88–94.

Copyright © 2016. Asociación Colombiana de Psiquiatría
Article options