Abstract
Introduction
The market for medical electronics is expected to reach a size of about $191.1 billion by 2015. 1 Telemonitoring is expected to make up a significant point of this growth, and diverse applications have been proposed. 2,3 It has been suggested 4 that, by these data, 30% of mobile device users will transmit health data to a remote location, and 42% will use their device to improve their fitness, manage health records, plan training, and obtain advice on nutrition. One important application is the monitoring of electrocardiogram (ECG) signals using mobile medical devices. This has become increasingly practical due to the development and miniaturization of consumer electronics.
An ECG measures the electrical activity of the heart. Different cardiac diseases have different effects on the electrical activity of the heart, and clinicians use ECG traces to detect and study many heart problems, including heart attacks, arrhythmia, and heart failure. For example, arrhythmia is an irregular heartbeat or abnormal heart rhythm. The symptoms of arrhythmia occur spasmodically, and diagnosis is only possible if an ECG is obtained during a period of arrhythmia. Unfortunately, most people are unaware of their symptoms or are unwilling to visit a hospital; even those who seek medical help may show normal cardiac behavior during their visit.
Several successful mobile ECG monitoring systems have been developed. 5 –13 These systems provide many benefits, especially the reduced need for hospitalization, but the interpretation of ECG signals remains a time-consuming task for medical personnel. Therefore, considerable attention 14 –21 has recently been paid to the automatic analysis of heart activity, including the feature extraction and classification of heartbeat types from ECG traces. Features include the amplitudes of the P, Q, R, and S and the lengths of the RR and PR intervals. Most applications of ECG monitoring require accurate detection of the QRS complex. Heartbeat classification requires the training and testing of a classifier, using manually extracted features. During training, the classifier identifies repeated occurrence of the patterns comprising the features and builds a model that describes them. This model can then be tested on future ECG data, and the results are compared with features recognized manually. Such a classifier can be used for arrhythmia detection. However, current approaches have some basic limitations, including a reliance on public databases 22 of ECG data and a simplistic clarification of heart activity.
We propose a smart system called Pit-a-Pat for monitoring ECG signals and providing real-time analysis of cardiac activity, with the specific goal of detecting arrhythmia. Pit-a-Pat receives ECG signals, extracts features, and classifies the heartbeats by type, while the patient can continue with his or her normal daily activities. Figure 1 is an overview of Pit-a-Pat.

Overview of Pit-a-Pat telemonitoring.
Pit-a-Pat can monitor ECG signals, while running on a device that is also performing other functions. Thus, Pit-a-Pat can be directly integrated into mobile phones and tablets. It provides a means of heartbeat monitoring and facilitates timely access to ECG data by clinicians. The design of the Pit-a-Pat system also offers a template for future developments in smart and economical ECG telemonitoring.
Materials and Methods
The Pit-a-Pat software has two components: the Pit-a-Pat Watch runs on a mobile device, and the Pit-a-Pat Classifier runs on a server for decision support. Figure 2 depicts the Pit-a-Pat system architecture. The sensed ECG signal is transmitted to the Pit-a-Pat Watch using Bluetooth® (Bluetooth SIG, Kirkland, WA). The Pit-a-Pat Watch also forwards the ECG data to the Pit-a-Pat Classifier using longer-range wireless technologies, such as IEEE 802.11 or long-term evolution (LTE). The Pit-a-Pat Classifier does the following: saves and analyzes the signal; extracts features, such as the QRS complex and P-wave; detects the heartbeats; saves the signal, together with the extracted features, in its database; builds a model; classifies the heartbeat; verifies the classification results; and finally transmits them. The Pit-a-Pat Watch keeps the user and clinicians informed and allows the latter to provide feedback to the user.

System architecture of the Pit-a-Pat. The Pit-a-Pat Watch runs on a mobile device, and the Pit-a-Pat Classifier is server-based software. ECG, electrocardiogram.
Pit-a-Pat Watch
The Pit-a-Pat Watch receives ECG signals arriving from a sensor attached to the user's body through a Bluetooth module and displays them in real time. The user can then view the raw ECG signal through a graphical interface, although this waveform is largely meaningless to the average patient.
The Pit-a-Pat Watch also provides two modes of feedback: one for the user and one for clinicians. In both modes, the Pit-a-Pat Watch transmits the results of heartbeat classification, but verification is only available in expert mode. A clinician can confirm or modify classification results to tailor arrhythmia detection to a specific user. The verified results are transmitted back to the Pit-a-Pat Classifier and are used to retrain the classifier.
Pit-a-Pat Classifier
The Pit-a-Pat Classifier builds a classifier based on a decision tree or a random forest. 23 The classifier is modified by the feedback from clinicians and routed through the Pit-a-Pat Watch, via a wireless network. As the Pit-a-Pat Classifier accumulates more data relating to a specific user in its database, classification becomes more accurate.
During feature extraction, the QRS complex is considered to be ventricular activity and the P-wave to be atrial activity, and the analysis presented in Table 1 reflects this classification. The QRS complex is extracted using the Pan–Tomkins algorithm, 24 which is fast enough for real-time analysis. This algorithm performs band-pass filtering, differentiation, squaring, and integration over a moving window. Figure 3 is a block diagram that depicts the heartbeat detection and feature extraction process used in the Pit-a-Pat Classifier. Heartbeats are detected from the R-wave feature and classified using a decision tree or random forest.

Block diagram of feature extraction and heartbeat detection. ECG, electrocardiogram.
Electrocardiogram Features Identified by Pit-a-Pat
The Pit-a-Pat Classifier builds a J4.8 decision tree and a random forest classifier for Weka's implementation.
23
The J4.8 is the same as the C4.5 decision tree learner due to Quinlan.
25
It determines the uncertainties in attributing a heartbeat to each of the available types, and select the type that best fits the features. Uncertainty, based on entropy, is determined as follows:
where H is a set of detected heartbeats, N is the number of different values permissible for a feature, and Hi
denotes the i types of heartbeat. The expected information gain for each feature is expressed as mutual information, as follows:
where C denotes a feature, Values(C) is the set of all possible values for feature C, and Hv is the subset of H for which feature C has the value v. Unlike other methods, such as a support vector machine or an artificial neural network, the decision tree is simple to understand and interpret, and it provides good results in arrhythmia detection. 26
The random forest 27 is a classifier consisting of a collection of tree-structured classifiers {h(x, Θk), k=1,…}, where the Θk values are independent identically distributed random vectors, and each tree casts a unit vote for the most popular class at input x. Using a random forest has desirable characteristics such as robustness to outliers and noise, and it is simple and easily parallelized.
A random forest is constructed by bagging ensembles of random trees, which generates many combinations of classifiers, independently trained on subsets, by random sampling. Thus, the random forest decision tree learner chooses one of the N best items instead of a single item, and splitting is achieved as a result of the uncertainty.
Results
Implementations
We implemented Pit-a-Pat using an ECG sensor (PSL-ECG 12MD/BD) from the manufacturer PhysioLab (Busan, Republic of Korea). 28 The sensor consists of an ECG module (PSL-ECG 12MD), which connects to a 10-lead ECG cable, and a Bluetooth module. Figure 4 depicts the device, its 10 leads, and the Pit-a-Pat Watch. The 12-channel ECG module is based on ADS1298; it has eight-channel, 24-bit analog-to-digital conversion, only uses 0.75 mW/channel, and has an embedded overvoltage protection circuit and low-pass filter. More details of the ECG module are provided in Table 2.

Specification of the Electrocardiogram Sensor Module (PSL-ECG 12MD)
ADC, analog-to-digital conversion; CMRR, common-mode rejection ratio; ECG, electrocardiogram; SPI, serial peripheral interface.
The Pit-a-Pat Watch was implemented on an Android™ (Google, Mountain View, CA) platform and can be configured to receive ECG data from a Bluetooth connection. The Pit-a-Pat Watch displays the ECG waveform on the mobile device, and Figure 5 shows screenshots. In user mode, the Pit-a-Pat Watch shows “Connection” and “Result” buttons. The ECG signal starts to be received when the Connection button is clicked, and the results of arrhythmia detection are displayed by clicking the Result button. Figure 6 shows screenshots of the Pit-a-Pat Watch in expert mode. The ECG waveform is then displayed, and the Verification button allows a clinician to provide feedback to the Pit-a-Pat Classifier. The results of arrhythmia detection by the system can be modified by the clinician using the Edit-text field (Fig. 6b).

Screenshots from the Pit-a-Pat Watch in user mode:

Screenshots from the Pit-a-Pat Watch in expert mode:
Evaluation
We evaluated Pit-a-Pat using three standard metrics: sensitivity, specificity, and accuracy to quantify its performance.
Sensitivity measure the ability of the system to identify heartbeat correctly:
where TP is the number of true positives and FN is the number of false negatives.
Specificity measures the ability of the system to reject heartbeats of unknown type correctly:
where FP is the number of false positives and TN is the number of true negatives.
Accuracy is the ability of the system to identify both known and unknown types of heartbeat correctly:
We used the well-known MIT-BIH Arrhythmia Database, 29 which contains 48 half-hour recordings, each containing two ECG lead signals (denoted as lead A and lead B). In 45 recordings, lead A is a modified limb lead II (MLII), and lead B is a modified V1 lead. In the other recordings, lead A is a V5 lead, and lead B is a V2 or MLII lead. The arriving signals were band-pass filtered at 0.1–100 Hz and digitized at 360 Hz. The database contains approximately 109,000 heartbeats. In all the recordings, each heartbeat has been manually annotated with the location of the QRS complex and with the heartbeat type. These annotations were used to determine the accuracy of the classification.
We evaluated heartbeat type classification by Pit-a-Pat. The Pit-a-Pat Classifier considers 14 types of heartbeat, as well as a single nonbeat annotation type, which is a ventricular flutter wave. To test the decision-tree and random-forest classifiers, we used 10-fold cross-validation, 30 also called rotation estimation. In this type of validation, a dataset D is randomly split into 10 mutually exclusive subsets, D 1, D 2,…, D 10, of approximately equal size. The decision tree and random forest were trained 10 times, leaving out one of the subsets each time, and then the omitted subset was used to compute the error in prediction. Tables 3 and 4 show the heartbeat types considered by the Pit-a-Pat Classifier, the number of beats of each type, and the resulting sensitivity, specificity, and accuracy. The decision tree classifier achieved a sensitivity of 95.7%, a specificity of 95.8%, and an accuracy of 95.8%, and the random forest classifier achieved a sensitivity of 97.3%, a specificity of 95.6%, and an accuracy of 96.5%. The poor performance achieved on some types of heartbeat can be correlated with the small numbers of beats of those types. This suggests that ECG signals should be monitored over a long period to detect arrhythmias accurately.
Classification Results from the Decision Tree for Each Heartbeat Type
Classification Results from the Random Forest for Each Heartbeat Type
Discussion
The initial development of diagnostic systems that allowed ECG recording and transference of data to medical experts began in the 1970s. Currently, research continues on remote ECG monitoring systems. 5 –13 The classic, remote ECG monitoring systems 5,9,13 proposed a fundamental framework that used an ECG device and recording devices, such as a cordless phone 5 or a personal computer. 9,13 The system extracted ECG signals from a data acquisition module, processed, and transmitted the information to a recording device via a Bluetooth 5 or RS-2329 interface. The system also displayed the ECG signals on the device for remote monitoring. However, the availability of only ECG signals meant that the user could not interpret the signals.
The classic ECG monitoring system was expanded by the addition of a feature extraction function to analyze ECG signals. Recently, many studies have applied the QRS detection algorithm to facilitate the analysis of ECG signals. The QRS complex provides additional data about arrhythmias and fibrillations that are useful in the diagnosis of various heart diseases. Many studies have also proposed systems for the detection of heartbeat using a waveform feature. 7,11,12 Other studies explored the characterization of ECG using the wavelet feature. 10 For example, Winokur et al. 12 proposed a wearable cardiac monitor. This system used a WQRS algorithm 31 that examined datasets and compared them with gold standard annotations. However, these systems provided ancillary diagnoses useful in the prevention of cardiovascular disease. Typically, to provide additional information regarding heart disease, additional methods of classification are required.
Today, a few studies have proposed automatic classification methods to provide detailed analyses of cardiac activity. 6,8 These systems are able to make automated diagnoses, based on ECG waveforms, using an HES algorithm 6 or a decision tree. 8 One system 8 developed an application for mobile devices that allows real-time ECG monitoring and automated arrhythmia detection through ECG waveform analysis. The raw ECG lead signals were processed with digital filters for noise rejection and QRS detection, as proposed by Pan and Tompkins. 24 For subsequent feature extraction, a decision tree is used to classify intervention-free normal/abnormal heartbeats. Although these studies implemented ECG monitoring and automated arrhythmia detection on mobile devices, an accurate analysis for heartbeat classification was still needed.
We proposed a smart ECG system called Pit-a-Pat, which classify heartbeats for automated arrhythmia detection on an Android device. Pit-a-Pat can interpret ECG signals accurately using decision tree and random forests classifier. However, a few difficulties remain to be overcome to allow Pit-a-Pat to be used in a clinical context. First, the patient-worn ECG sensor module should be tiny and lightweight and have a low power requirement to ensure portability. This was the reason Bluetooth was chosen for communication between the sensor and the Pit-a-Pat Watch. However, Pit-a-Pat cannot record ECG signals out of Bluetooth range because the ECG sensor module that it uses has no memory. The ISO/IEEE 11073 Personal Health Device standards 32 enable agents (such as an ECG sensor) to interconnect and interoperate with managers and with computerized healthcare information systems (such as Pit-a-Pat). Within the ISO/IEEE 11073 family of standards, the Part 10406 Device specification provides a normative definition of the communication between personal basic ECG devices and managers, which is manifest as plug-and-play interoperability. An ECG sensor that is a part 10406 device continuously collects and temporarily stores ECG signals using the personal memory–store object (defined in the domain information model) when out of the network or when agent/manager associations cannot be established. After the connection is established, the stored signals are retransmitted. When sensors compliant with the IEEE 11073 Personal Health Device standard become available, they should be able to store the ECG signal when out of Bluetooth range.
Second, data security and invasion of privacy are significant issues with ECG monitoring systems. 33 Pit-a-Pat offers two obvious vulnerabilities: Bluetooth communication and the Pit-a-Pat Classifier. Bluetooth is a convenient technology for communicating ECG signals, but we know it is vulnerable to interference, and it is not secure. Patient-worn ECG sensors are typically resource-constrained battery-powered devices and cannot easily support the extra computation required for full-strength encryption and error control. We plan to address these issues by developing a lightweight privacy-preserving scheme that compromises the integrity of the signal in case of data corruption or loss. The processed data in the Pit-a-Pat Trainer would be more difficult to obtain but are potentially more valuable.
Third, the sensed ECG signal is transmitted to the Pit-a-Pat Watch, which forwards the ECG data to the Pit-a-Pat Classifier using longer-range wireless technologies such as IEEE 802.11 or LTE. Patients using Pit-a-Pat over commercial LTE would probably be responsible for paying for extra data at the rate specified in their data tariff. The good news is that low-cost machine-type communications over LTE are expanding rapidly. 34 Also, we are guessing that the sort of data tariff that allows a user to watch movies and browse the Web on his or her phone would carry ECG data at negligible extra cost. However, charging polices are not the primary concern of this article. Furthermore, telemetry applications require highly reliable transmission and low service latency, as their effectiveness is clearly compromised by the loss, corruption, or late delivery of data. However, guaranteeing those requirements is challenging because wireless channels are subject to errors. Thus designing a suitable protocol for error control is essential. 35,36
Finally, the Pit-a-Pat Watch runs on an Android mobile device. There are many other operating systems (OSs) and platforms for smartphones, in addition to Android, including Symbian (Symbian Foundation, London, United Kingdom) OS, Windows® (Microsoft, Redmond, WA) Mobile OS, iPhone® (Apple, Cupertino, CA) iOS, Palm (Sunnyvale, CA) OS, and Blackberry® (Waterloo, ON, Canada) OS, and this last is compatible with Android. In general, however, smartphone applications are not portable across platforms or OSs. It would hardly be feasible to develop a prototype system such as Pit-a-Pat across several smartphone platforms at once; it is much more usual, and more prudent, to get a new application running on a single OS and then consider porting it to others. We chose Android because it is open source and has a wide user base. Recently, Andrus et al. 37 developed an OS compatibility architecture, named Cider, that can run applications built for different mobile systems, including iOS and Android. Cider is a step toward solving the cross-platform compatibility problem, and we believe that software offering interoperability and compatibility across heterogeneous mobile systems is likely to be developed. It will offer freedom to Pit-a-Pat and many other applications.
Conclusions
We designed and implemented the Pit-a-Pat smart ECG system to run on an existing consumer electronics ECG device. Pit-a-Pat can detect arrhythmia accurately and thus offers a convenient and inexpensive healthcare tool. The experimental results show that Pit-a-Pat is able to monitor ECG signals and successfully detect arrhythmias, in real time, in a mobile patient. Long-term ECG data for a single user can be accumulated, and subsequently accessed, in the Pit-a-Pat Classifier database. Correlation of long-term ECG data with patients' medical histories may provide epidemiological information about heart disease. In the future, we will improve the ability of the system to facilitate these connections, while also improving the safeguards on user privacy.
Footnotes
Acknowledgments
This work was partly supported by a grant from the Institute for Information & Communications Technology Promotion (IITP), funded by the Korean government (MSIP) (No. B0101-15-0557, Resillient Cyber-Physical Systems Research), and partly supported by the Basic Science Research Program through the National Research Foundation of Korea (NRF), funded by the MSIP (NRF-2013R1A1A1059188).
Disclosure Statement
No competing financial interests exist.
