Apnea-ECG Database Annotations

DOI for
Apnea-ECG Database Annotations:

doi:10.13026/C23W2R

Two sets of annotations are supplied with the data for the Computers in Cardiology Challenge 2000. These can be identified by the file name suffixes .apn and .qrs.

The .apn files contain apnea annotations. These are currently available for the 35 records in the learning set only; those for the test set will be posted here after the conclusion of the Challenge in September. (To view these annotations, use rdann to convert the binary annotation files into text. If you have not used rdann previously, see the detailed instructions below.) These annotations have been prepared on the basis of expert visual review of simultaneously recorded respiration and oxygen saturation signals. These additional signals can be studied for 8 records (a01er - a04er, b01er, and c01er - c03er; these contain the same ECG data as a01 - a04, b01, and c01 - c03, respectively).

When these files were first posted here, the following (incorrect) description of the .apn annotation files was also posted:

In these files, an "A" annotation indicates that apnea occurs during the following one-minute interval, and an "N" annotation indicates that there is no apnea during the following one-minute interval.

Following is a corrected description:

In each of these files, the first annotation is placed at 0 seconds and is associated with the following one-minute interval (i.e., 0-59.99 seconds elapsed time from the beginning of the record), the second annotation is placed at 60 seconds and is associated with the next one-minute interval (60-119.99 seconds), etc. Each "A" annotation indicates that apnea was in progress at the beginning of the associated minute; each "N" annotation indicates that apnea was not in progress at the beginning of the associated minute. The diagram below may help to clarify this:
|       |       |       |       |       |       |       |       |
        ****************              ********     ********
N       A       A       N       N       A       N       A       N
In this diagram, elapsed time is represented by distance from the left edge. The '*'s mark apneic periods, the '|'s mark the times of the .apn annotations (0, 60, 120, ... seconds), and the "N"s and "A"s are the "no apnea" and "apnea" annotations.

The .qrs files were created using sqrs125, initially with its default threshold (250). In these files, all detected beats (including any abnormal beats that were detected) are marked with "N" annotations, and QRS-like artifacts are marked with "|" annotations. Based on visual review of the heart rate time series (using hrplot), and review of selected portions of the original ECGs and annotations (using WAVE), sqrs125 was run again using its -m option to select lower thresholds on some recordings (in some cases, more than once) to obtain better detection of low-amplitude QRS complexes. In no case were the annotations hand-edited. Only small numbers of annotations were inspected in each recording to determine if the threshold had been set appropriately. If you wish to experiment further with sqrs125 or with your own QRS detector, it may be helpful to know exactly how the .qrs files provided here were made, so here are the commands that are needed to do so:

sqrs125 -r a01
sqrs125 -r a02 -m 125
sqrs125 -r a03
sqrs125 -r a04
sqrs125 -r a05
sqrs125 -r a06 -m 125
sqrs125 -r a07
sqrs125 -r a08
sqrs125 -r a09
sqrs125 -r a10
sqrs125 -r a11
sqrs125 -r a12 -m 125
sqrs125 -r a13
sqrs125 -r a14
sqrs125 -r a15
sqrs125 -r a16
sqrs125 -r a17 -m 100
sqrs125 -r a18
sqrs125 -r a19
sqrs125 -r a20 -m 125
sqrs125 -r b01
sqrs125 -r b02 -m 125
sqrs125 -r b03 -m 125
sqrs125 -r b04 -m 75
sqrs125 -r b05 -m 125
sqrs125 -r b06
sqrs125 -r b07
sqrs125 -r b08
sqrs125 -r b09
sqrs125 -r b10
sqrs125 -r c01 -m 125
sqrs125 -r c02
sqrs125 -r c03
sqrs125 -r c04 -m 125
sqrs125 -r c05 -m 125
sqrs125 -r c06 -m 125
sqrs125 -r c07 -m 100
sqrs125 -r c08 -m 100
sqrs125 -r c09
sqrs125 -r c10
sqrs125 -r x01
sqrs125 -r x02
sqrs125 -r x03
sqrs125 -r x04
sqrs125 -r x05
sqrs125 -r x06
sqrs125 -r x07
sqrs125 -r x08
sqrs125 -r x09
sqrs125 -r x10
sqrs125 -r x11
sqrs125 -r x12
sqrs125 -r x13
sqrs125 -r x14 -m 125
sqrs125 -r x15 -m 125
sqrs125 -r x16
sqrs125 -r x17 -m 50
sqrs125 -r x18
sqrs125 -r x19
sqrs125 -r x20
sqrs125 -r x21
sqrs125 -r x22
sqrs125 -r x23
sqrs125 -r x24
sqrs125 -r x25
sqrs125 -r x26
sqrs125 -r x27
sqrs125 -r x28
sqrs125 -r x29 -m 125
sqrs125 -r x30
sqrs125 -r x31
sqrs125 -r x32
sqrs125 -r x33 -m 125
sqrs125 -r x34 -m 125
sqrs125 -r x35

How to use rdann

Install rdann:

If you haven't already downloaded and installed rdann, do so now. Search for rdann (type rdann into the text box above the Search button in the left margin of this page, then click on Search), and you will find the C-language source as well as a UNIX-style manual page that describes rdann's options in more detail than below. All versions of rdann are compiled from the same source, so you can create a version for your operating system, provided that you have a C compiler. If you do this, you will also need to download and compile the sources for the WFDB library used by rdann. Binaries (executable versions of the program) for several popular operating systems can also be downloaded. Note that rdann is a text-mode application; users of MS-Windows can run the MS-DOS version of rdann in a DOS window.

Locate the files you need:

Each of the data files has a record name (the first part of the file name, before the '.') and a suffix (the second part of the file name, following the '.'). For example, the file a19.apn has the record name a19 and the suffix apn.

Files with qrs or apn suffixes are binary annotation files. For these files, the suffix is the annotator name. Files with the suffix hea are (text) header files containing information about the format of the related files, and those with the suffix dat are binary signal files (containing digitized samples of the ECG and other signals).

In order to read an annotation file successfully, you will need to download both the annotation file itself and the associated header file. For example, to read a19.apn, download a19.apn and a19.hea. (The Linux version of rdann can act as an HTTP client and can read the files directly from the PhysioNet server without the need to store them locally. If you have compiled your own version of the WFDB library with NETFILES support, your version of rdann will also have this capability.)

Use rdann to convert binary annotations to text:

Once you know the record name and the annotator name, you can use rdann to read the file. For example, to read a19.apn, use the command

     rdann -r a19 -a apn -f 0

This command will produce output on the screen that begins:

    0:00.000        0     N    0    0    0
    1:00.000     6000     A    0    0    0
    2:00.000    12000     A    0    0    0
    3:00.000    18000     A    0    0    0
    4:00.000    24000     A    0    0    0
    5:00.000    30000     A    0    0    0
    6:00.000    36000     A    0    0    0
    7:00.000    42000     N    0    0    0
    8:00.000    48000     N    0    0    0
    9:00.000    54000     A    0    0    0
   10:00.000    60000     A    0    0    0
(The '-f 0' option was not required by the version of rdann that was available when this page was written. If omitted, the first annotation, at 0:00.000, will not appear in the output.)

To capture the output of rdann in a file, redirect it using a command such as:

     rdann -r a19 -a apn -f 0 >textfile
In this command, replace textfile with any desired file name. This method works under MS-DOS/Windows as well as under all versions of UNIX.

Each line of rdann's output corresponds to one annotation. The first two columns indicate the elapsed time (i.e., the interval) from the beginning of the record to the sample marked by the annotation. (Column 1 gives this in hours, minutes, and seconds, and column 2 gives the same information in sample intervals. In these records, one sample interval equals 10 milliseconds.) The third column contains a mnemonic code for the annotation type. As noted above, in the apn files, these codes are A for "apnea" and N for "no apnea". In the qrs files, the codes are N for a QRS complex and | for a QRS-like artifact. In these annotation files, the remaining columns can be ignored.

The sample output shown above can therefore be interpreted thus: during the first minute (beginning at 0:00.000, or sample number 0) there is no apnea (N); during each of the next several one-minute periods (beginning at 1:00.000, 2:00.000, 3:00.000, ...), there is apnea (A).