A detailed description of the apdet algorithm and its application can be found in: Detection of Obstructive Sleep Apnea from Cardiac Interbeat Interval Time Series. This article originally appeared in Computers in Cardiology 2000, vol. 27, pp. 753-756 (Piscataway, NJ: The Institute of Electrical and Electronics Engineers, Inc.). Please cite this publication when referencing this material.
The software described here was developed for the Computers in Cardiology Challenge 2000. Additional information regarding apnea detection from the ECG, as well as data to test the software, can be found at the challenge page.
The apdet software package uses a new automated method to diagnose and quantify obstructive sleep apnea from single-lead electrocardiograms based on detection of the periodic oscillations in cardiac interbeat intervals that are often associated with prolonged cycles of sleep apnea. This technique employs the Hilbert transformation of the sinus interbeat (NN) interval time series to derive the instantaneous amplitudes and frequencies of the series, and calculates their averages and standard deviations over a moving 5-minute window. We then apply a thresholding technique and detect continuous sequences of those windows that lie within threshold limits.
When applied to the training set of the Apnea-ECG Database created for the CinC Challenge 2000, this algorithm correctly classified 26 of 30 subjects (86.6%), and correctly identified the presence or absence of sleep apnea in 13895 of 17045 minutes (82.1%). When applied to the test set of the Apnea-ECG Database, this algorithm performed even better, correctly classifying 28 out of 30 cases (93.3%) of subjects, and 14591 of 17268 minutes (84.5%).
The apdet software package is available in source form and as prebuilt binaries for Linux and MS-Windows.
Before building or using the apdet software, you must install the free WFDB software package. Under MS-Windows, you will also need to install the free Cygwin environment before building or using the apdet software.
Unpacking the apdet package requires tar and gzip, and running the software requires sh (or a compatible shell such as bash), and awk, all of which can be found on all Unix, Linux, and Mac OS/X systems, and in the Cygwin environment for MS-Windows. Cygwin also includes the gcc C compiler and all other utilities needed to compile the apdet package from sources if desired.
Once you have installed the WFDB software package (and, under MS-Windows, the Cygwin environment), download and install the apdet package of your choice:
Open a terminal window (under MS-Windows, a Cygwin/bash window) and type a command such as
get_apdet apnea-ecg/a03 qrsThe first argument is the record name, and the second is the annotator name for a beat annotation file. In the example above, get_apdet will analyze record a03, annotator qrs from the Apnea-ECG Database. (If you have not previously downloaded the input data into a local apnea-ecg directory, get_apdet obtains the data directly from PhysioNet.)
The get_apdet command prints the times of detection of sleep apnea
heart rate oscillations and the total fraction of time with such detections.
For the example above, the output is:
00:05:59 - 00:59:59 01:39:59 - 02:28:59 03:04:59 - 03:52:59 03:57:59 - 04:22:59 04:38:59 - 05:03:59 05:56:59 - 06:48:59 06:58:59 - 07:24:59 07:45:59 - 08:39:59 tot = 05:33:00 / 08:42:25 = 0.637
See an illustration of these detections.
get_apdet relies entirely on normal-to-normal beat interval data, which it normally derives from a beat annotation file. Beat annotation files are available for most of the PhysioBank records that include ECGs. If you wish to study a recording for which no beat annotation file is available, you may be able to create one using sqrs. If you have interbeat interval data but not a beat annotation file, you can modify get_apdet as needed, or you can use rr2ann to put your data into the standard format before processing them.
For information about record and annotation conventions see the PhysioNet FAQ.
This program correctly identifies the presence or absence of apnea in in 82.1% of the data in the CinC test set and 84.5% of the data in the CinC training set.
It is recommended that the accuracy of the oscillation detections be verified by visual inspection of the original RR interval series.