A large-scale multi-label 12-lead electrocardiogram database with standardized diagnostic statements

Deep learning approaches have exhibited a great ability on automatic interpretation of the electrocardiogram (ECG). However, large-scale public 12-lead ECG data are still limited, and the diagnostic labels are not uniform, which increases the semantic gap between clinical practice. In this study, we present a large-scale multi-label 12-lead ECG database with standardized diagnostic statements. The dataset contains 25770 ECG records from 24666 patients, which were acquired from Shandong Provincial Hospital (SPH) between 2019/08 and 2020/08. The record length is between 10 and 60 seconds. The diagnostic statements of all ECG records are in full compliance with the AHA/ACC/HRS recommendations, which aims for the standardization and interpretation of the electrocardiogram, and consist of 44 primary statements and 15 modifiers as per the standard. 46.04% records in the dataset contain ECG abnormalities, and 14.45% records have multiple diagnostic statements. The dataset also contains additional patient demographics.

In this study, we present a large 12-lead ECG dataset 18 with standardized diagnostic statements conforming to the AHA/ACC/HRS (i.e., the American Heart Association, the American College of Cardiology, and the Heart Rhythm Society) recommendations (hereinafter referred to as "AHA standard") 19 . Our dataset contains 25770 12-lead clinical ECG records from 24666 patients (55.36% male and 44.64% female) and, to our best knowledge, this is the largest accessible single-source ECG dataset. The data were collected from Shandong Provincial Hospital from 2019/08 to 2020/08. The sampling frequency is 500 Hz and the length of records ranges from 10 to 60 seconds. Patient demographics such as age and sex are also included. 46.04% records in the dataset contain ECG abnormalities, which are described in Chinese. The original Chinese diagnostic statements were checked by cardiologists and then converted to standardized diagnostic statements as per the AHA standard, including primary statements, modifiers and pairing rules.
The AHA standard aims for the standardization and interpretation of the ECG. It has been widely adopted in clinical scenario across the world. Compared with SNOMED-CT or SCP-ECG, which are mainly designed for medical information interchange and hence involve redundant or uncertain terms, the AHA recommendation mainly presents clinically useful statements and excludes unnecessary overlapping or vague terminology 19 . As supervised learning depends on accurate ECG labels to distinguish different ECG classes, a clearly organized and non-overlapping system of statements helps the deep learning models to efficiently learn the intrinsic ECG characteristics. Using the AHA terminology uniformly also enables valid model comparison and real-world clinical assessment.
The Shandong Provincial Hospital (SPH) database covers a wide range of ECG abnormalities and includes 44 primary statements and 15 modifiers as per the AHA standard. Especially, the separation of statements and modifiers as well as the pairing rules between them can characterize ECG more thoroughly, which is of great value to explore precise ECG analysis. 14.45% records in the database and 31.39% abnormal records have multiple diagnostic statements, providing the opportunity to develop and evaluate multi-label classification methods.

Methods
Data acquisition. This study was approved by the Institutional review board of Shandong Provincial Hospital. Requirement for individual patient consent was waived and the database is allowed to be shared publicly after the data were de-identified.
Original ECG records were generated at Shandong Provincial Hospital, Jinan, China during 2019/08∼2020/08. The ECG signal was recorded by the MedEx MECG-200 machine, where the A/D converter has 24-bit resolution and the unit is mV. The ECG signal has 16-bit precision and the sampling frequency is 500 Hz. Noises caused by the power line interference, baseline wander, and muscle contraction have been removed by the machine. Next, the filtered ECG signal was presented to a responsible cardiologist belonging to the department of electrocardiogram for clinical diagnosis. All cardiologists have at least three-year clinical experience before they are qualified to conduct ECG diagnosis. The ECG analysis system can automatically calculate nine ECG features for reference, which include heart rate, P wave duration, P-R interval, QRS duration, QT interval, corrected QT (QTc) interval, QRS axis, the amplitude of the R wave in lead V5 (RV5), and the amplitude of the S wave in lead V1 (SV1). The features might be inaccurate, especially when the ECG signal is abnormal. The responsible cardiologist made the final diagnosis in consideration of the patient health record.
Under the limitations that the record length should be between 10 and 60 seconds and the patient age should be larger than 18, the filtered signal and the diagnostic statements made by the doctor were then exported from the MedEx MECG-200 ECG analysis system together with the following related information from the health record database of the hospital: • unique ID of the patient • age and sex of the patient • acquisition date Data processing. Since ECG signals have been filtered by the ECG machine and were mostly of good quality, we did not make additional processing to the signals. The ID of ECG records and patients were generated randomly, where ECG records from the same patient were still associated with the same patient ID. In order to protect the privacy of patients, the acquisition date of ECG records were shifted by a random offset for each patient 10 . www.nature.com/scientificdata www.nature.com/scientificdata/ When there are multiple records for the same patient, the chronological order was kept unchanged during date randomization. ECG records with missing age or sex information were excluded.
The original diagnostic statements, which were written in Chinese, mainly follow the proprietary statement set of ECG machine vendor, and also contain many inconsistent use of idioms and punctuation due to manual input. The AHA standard has 117 primary diagnostic statements under 14 categories. Each primary statement can be paired with one or more secondary statements or modifiers, which cannot be used alone. The steps to convert the original diagnostic statements to standardized AHA terminology are as follows.
1. An experienced cardiologist re-checked all original diagnostic statements and made corrections (also in Chinese). ECG records of poor quality were excluded by visual inspection at the same time. 2. We eliminated inconsistent use of idioms and punctuation as much as possible by manually converting them to uniform terminology. 3. We developed a series of translation rules mapping Chinese statements to standardized statements conforming to the AHA standard, where each original statement may correspond to multiple AHA diagnostic statements. The rules do not cover all cases since there still exists vague or clinically useless statements. The rules were revised by the cardiologist and are described in the Supplemental File 1. 4. We applied the rules to all records with original diagnostic statements. Any ECG record with untranslatable statements was excluded.
Finally, there were 25770 12-lead ECG records with standardized diagnostic statements after all steps.

Data Records
The SPH database includes ECG signal data, associated metadata and diagnostic statement dictionary (see Fig. 1), which are all available online at figshare 18 . Each unique ECG record was saved as a 12 × L array in HDF5 format with 16-bit precision, and the file was named by the associated ID (e.g. A00001.h5). The sampling frequency is 500 Hz. L is the number of samples and 12 is the number of leads. The order of leads is I, II, III, aVR, aVL, aVF, V1, V2, V3, V4, V5, V6. There are 25770 ECG data files in total. The diagnostic statement dictionary file (code.csv) describes the AHA statements and codes used in the SPH dataset. As shown in Table 2, there are 44 primary statements spanning across 11 categories (see Table 3). The distribution of primary statements shown in the table is highly unbalanced and should not be viewed as the actual reflection of the population since many records were excluded for various reasons (see Methods Section). There are also 15 modifiers in Table 2, which are used to refine the meaning of core statements and cannot be used alone 19 . There are more than 40 modifiers according to the AHA standard. Some modifiers (e.g. 308 and 310) can be used with a wide range of core statements, and some modifiers can only be used with a specific category, e.g. 330-334 should be paired with statements in category M.
In the metadata file, each line represents a unique ECG record and contains the ECG ID, the patient ID, the AHA code, the age and sex, the record length, and the acquisition date, as described in Table 4. Since an ECG record can have multiple diagnostic statements, we used the semicolon as the separator between them. Besides, each diagnostic statement consists of one primary statement and additional modifiers, and the plus sign is used to joint them. Figure 2 describes the encoded representation of multiple statements, where the order of statements and modifiers is arbitrary. The proportions of male and female in the dataset are 55.36% and 44.64%. Tables 5 and 6 show the overview of patient age and the record length respectively. Most ECG records are between 10 and 15 seconds.
According to Table 2, there are 13905 normal ECG records, i.e., the remaining 11865 records, 46.04% of the SPH dataset, contain ECG abnormalities. Table 7 shows the overview of the number of statements per ECG record. 14.45% records in the dataset and 31.39% abnormal records have multiple diagnostic statements. Table 8 presents the overview of the number of ECG records per patient, and 4.32% patients have more than one ECG record.

Technical Validation
To validate the quality of ECG records, after all the steps described in Methods Section, we conducted signal quality assessment for original ECG records using two signal quality indices 20 , basSQI and pSQI representing the relative power in the baseline and the QRS complex respectively. For each record, the index was first calculated for 12 leads separately and then averaged. Next, we checked ECG records with low SQI values to make sure their quality is still acceptable. Figures 3 and 4 visualize the distributions of basSQI and pSQI of ECG records in the database, which have a minimum of 0.418 and 0.370 respectively. Specifically, ECG records whose SQI values are close to the minimum were reviewed and no significant quality defect was found. Figure 5 shows four records with lowest basSQI values. It is worth pointing out that ECG records containing one or two noisy leads or short corrupted segments, as shown in Fig. 5, were not rejected as long as reliable diagnosis can be made.    Since an ECG record may have multiple diagnostic statements, we computed the co-occurrence matrix for primary statements to show the co-occurrence relationship (see Fig. 6). For a specific primary statement, the diagonal element represents the number of records labeled only by the specified statement, and other element in the same row means the number of records labeled by both statements. If two statements are not likely to happen at the same time in clinical practice, e.g. atrial fibrillation and other sinus rhythms, the matrix can indicate Age [10,20) [      www.nature.com/scientificdata www.nature.com/scientificdata/ whether such records exist in the database intuitively. Since co-existing statements may describe different ECG intervals, the cardiologist revised the suspicious records to make sure the statements are correct. In addition, normal ECG records should not have statements indicating abnormalities, which is verified by the first column, thus the matrix was also used for quality control purposes.
AHA standard includes various pairing rules. As this dataset contains 44 primary statements as well as 15 modifiers, we make sure that each modifier is pairing correctly with the primary statement by checking all 25 combinations (see Table 2).

Usage Notes
The ECG data are stored in HDF5 format, a platform-independent format designed for data storage and widely supported by scientific software and programming languages. Python code for loading the ECG data and processing diagnostic codes as well as the metadata is provided at figshare 18 .
The hierarchy of ECG terminology presented by the AHA standard is well-organized. 117 primary statements belong to core statements, and most ECG classification in the literature focus on this level only. Considering all kinds of AHA statements and various real-world use cases, we suggest four tasks from coarse to fine levels for the usage of SPH dataset (see Fig. 7).
The first task is the classification of normal ECG and abnormal ECG, which account for 53.96% and 46.04% in the dataset respectively. The detection of ECG abnormalities is useful in daily ECG monitoring. The remaining three tasks are at the levels of ECG category, primary statement, and full statement respectively, corresponding to the AHA standard, and all of them are multi-label classification. In addition, to avoid incorrect dataset  www.nature.com/scientificdata www.nature.com/scientificdata/ partition (e.g. records from the same patient included in both training and testing sets) and improve comparability of models trained on the dataset, we provide the Python code at figshare 18 for dataset splitting.

Code availability
The Python code for reading the ECG data, attributes and diagnostic code dictionary, evaluating the signal quality, and dataset partition is available in figshare 18 .