Introduction

Cardiovascular diseases (CVDs) are cited as the number one cause of death worldwide by the World Health Organization (WHO)1. Medical researchers have placed significant importance on cardiac health research, leading to a strong focus on technological advances for cardiac function assessment. One such research pathway is the improvement of the conventional cardiovascular-diagnosis technologies used in hospitals/clinics.

Electrocardiogram (ECG) analysis is the most common clinical cardiac test and has proven to be a useful screening tool for a variety of cardiac abnormalities due to its simple, risk-free, and inexpensive application2. The ECG signal contains features that reflect the underlying operation of the heart, and these features represent electrophysiological events that coincide with the sequence of depolarization and repolarization of the atria and ventricles. The signals for each heartbeat contain three main events: the P wave, the QRS complex, and the T wave. Analyzing these events over a short period of time (<30 mins) has been achieved with high accuracy. However, early detection of CVDs requires long-term monitoring using ECG electrodes connected to mobile phones and/or point-of-care devices that rely on wireless communication to improve the development of technological diagnostic devices.

Developing an ECG system that is reliable, scalable, and an effective patient monitoring and medical data management tool is essential for implementing a highly accurate and efficient e-health device for CVD screening and diagnosis. The ECG compression technique proposed in this study leverages current sensors and smartphone technologies for connecting patient networks with a medical infrastructure to facilitate remote patient treatment, as shown in Fig. 1. ECG data aggregators (ECGag) (e.g., mobile phones and point-of-care devices) can be used to acquire, minimally process, and wirelessly transmit ECG signals to an ECG analysis unit (ECGau) (e.g., a device with high computational resources such as a computer). ECGags are usually battery-driven and have limited storage and minimal computational capacity. Thus, a solution that reduces the size of the acquired ECG signals (which are saved, stored, and transmitted by the ECGag) while protecting the integrity of the signal quality (so no information is lost) is needed.

Figure 1
figure 1

A wireless ECG Monitoring System.

A proper compression method can reduce the size of the transmitted ECG signals. However, most of the high-performance ECG compression methods are not suitable for wireless biosensors because of their complexity3,4. Suitable compression methods usually mandate either a low-compression rate or high energy consumption5. Therefore, developing a simple, fast, and efficient compression method that is suitable for long-term (≥30 mins) ECG signals is needed. Moreover, most of the ECG compression methods are discussed separately from the ability to detect main events (e.g., QRS complexes).

Based on a review of current literature, the evaluation of the compression method performance is widely evaluated by PRD6. Since a highly distorted ECG signal can be useless from a clinical point of view, reporting the impact of compression on detecting QRS complexes is vital. In this paper, we evaluate the overall efficiency of ECG signal transmission in terms of CR, PRD, and QRS detection performance.

Another aspect that will be explored is the local analysis of the ECG signal on the ECGag unit. Developing an algorithm that enables the ECG analysis (such as QRS detection and beat-to-beat interval estimation) to be performed locally on the ECGag is also needed7,8. Because the wireless communication between the ECGag and the ECGau unit (cf. Fig. 1) is a major source of power consumption for the ECGag, developing an algorithm that allows for local analysis will reduce the power consumed by the device. Combined with the proposed ECG compression method discussed above, local analysis of the ECG signals will facilitate faster decision making and efficient signal processing with the use of limited resources.

Results

The performance of the proposed algorithm was evaluated using the MIT-BIH arrhythmia and QT databases. For a fair and consistent evaluation of the proposed method (Method III) with all results published in the literature, the performance of the QRS detection algorithms from each method was assessed using two statistical measures: sensitivity (SE) and positive predictivity (+P). The SE and +P were calculated as follows:

$${\rm{SE}}( \% )=\mathrm{TP}/({\rm{TP}}+{\rm{FN}}),$$
(1)
$$+{\rm{P}}( \% )=\mathrm{TP}/({\rm{TP}}+{\rm{FP}}),$$
(2)

In other words, SE reports the percentage of detected true beats out of all true beats, while the +P reports the percentage of detected true beats out of all detected beats. Note, TP stands for true positives (the number of QRS complexes detected as QRS complexes), FN stands for false negatives (the number of QRS complexes which have not been detected), and FP stands for the number of false positives (non-QRS complexes detected as QRS complexes).

Method I demonstrated the performance of the QRS detector with different parameter values. The optimal W and q values were determined by8 after testing various combinations of (W, q) with W ranging from 3 to 6 and q ranging from 9 to 17. It was found that optimal detection QRS accuracy was achieved with W = 3 and q = 15. Note that the optimization step of the QRS detector for Method II was not discussed in ref.9.

For Method III, a rigorous optimization over all parameters was conducted. This step is carried out once on either an ECGau or a PC. As soon as the optimal parameters are determined, the ECGag will be adjusted accordingly without any further tuning. As this step occurs one time, it does not add any complexity to the ECG signal analysis at ECGag or ECGau level. The value of B varied from b min  = 360 Hz to b min  = 500 Hz, while the value of K varied from k min  = 50 Hz to k min  = 360 Hz. As we have multiple objectives, plotting the Pareto frontier (the objective space of possible Pareto solutions) cannot be achieved. Therefore, all Pareto solutions were sorted in descending order according to the overall accuracy (objective function g), as shown in Table 1. The optimal Pareto value of B/K was found to be 4.875, where B = 390 Hz and K = 80 Hz, achieving a maximum value of g = 99.851% with an SE of 99.78% and a +P of 99.92%. It is clear that the highest accuracy of QRS detection was scored using Method III with B/K = 4.875. The results of Method III will be discussed in more detail.

Table 1 Optimal values for Method III based on the QRS detection accuracy.

A summary of the QRS detection results for all recordings using Method III with B/K = 4.875 is shown in Table 2.

Table 2 Performance of Method III using B/K = 4.875 on the MIT-BIH arrhytmia database.

Figures 2, 3 and 4 show the performance of Method III under noisy conditions. The first plot (a) in each figure shows the original ECG signal. The second plot (b) shows the compressed ECG signal using Method III. The third plot (c) shows the QRS detection based on the compressed signal shown in plot (b). Figure 2 shows the performance of the QRS detector on a compressed ECG signal using Method III over T waves with large amplitudes, which are often misidentified as QRS peaks due to their amplitude.

Figure 2
figure 2

QRS detection over Record 117 of the MIT-BIH Arrhythmia Database with large T waves. (a) Original ECG signal (b) Compressed ECG signal using Method III (c) Compressed ECG signal using Method III with adaptive thresholding and detected QRS complexes (green blocks). Signal amplitudes have been manipulated to fit all signals in one figure. Here, the red dotted line represent the first moving average where the black dashed line represents the second moving average.

Figure 3
figure 3

QRS detection over Record 200 of the MIT-BIH Arrhythmia Database with irregular beats (premature ventricular contractions). (a) Original ECG signal (b) Compressed ECG signal using Method III (c) Compressed ECG signal using Method III with adaptive thresholding and detected QRS complexes (green blocks). Signal amplitudes have been manipulated to fit all signals in one figure. Here, the red dotted line represent the first moving average where the black dashed line represents the second moving average.

Figure 4
figure 4

QRS detection over Record 203 of the MIT-BIH Arrhythmia Database with severe baseline drift and noise. (a) Original ECG signal (b) Compressed ECG signal using Method III (c) Compressed ECG signal using Method III with adaptive thresholding and detected QRS complexes (green blocks). Signal amplitudes have been manipulated to fit all signals in one figure. Here, the red dotted line represent the first moving average where the black dashed line represents the second moving average.

Figure 3 shows the QRS detection performance using an ECG signal with premature ventricular contractions, which introduce irregular heartbeats in terms of RR interval and morphology. Figure 4 shows that the QRS detector performed well in the presence of noise and baseline wandering within the compressed ECG signal.

Table 3 compares the QRS detection performance of well-known compression algorithms with the proposed methods. As shown, Method III outperformed all competing lossless algorithms in terms of increasing BCR and decreasing PRD simultaneously. The multiscale morphology technique scored lower in detection accuracy given its high computational complexity. In comparison, Method III was fast and more efficient for analyzing ECG signals making it better suited for e-health applications.

Table 3 Comparison of the QRS detection with other published algorithms on the MIT-BIH arrhythmia database.

Table 4 compares the compression performance of the four methods with other compression schemes implemented on hardware for wearable applications. Method III outperformed existing well-known lossy and lossless compression methods by scoring the highest BCR at 4.5 while scoring the lowest PRD at 0.53. Note that Methods III and III have already outperformed the state-of-the-art lossless compression methods: delta predictor/Rice-Golomb coding10, adaptive predictor/Huffman coding11, simple predictor/Huffman coding12, and slope predictor/fixed-length packaging methods13 in terms of increasing BCR and decreasing PRD simultaneously. The higher the BCR and the lower PRD values in an algorithm, the better the compression performance However, the detection of QRS has to be considered when choosing the optimal compression algorithm.

Table 4 Compression performance comparison with other algorithms.

In this study, the proposed detector was implemented in MATLAB 2012a (MathWorks, Inc., Natick, MA, USA) on an Intel™ i5 CPU with 2.27 GHz. Figure 5 shows the BCR versus QRS detection performance and processing time. As expected, the processing time decreased as the BCR increased. Method III took an average processing time of 0.029 seconds with a BCR of 4.5 to compress ECG signals and detect the QRS complexes. The time complexity of Method III is O(N) algorithm, which is similar to the lossy-based compression algorithms5, and the complexity is smaller than that of Method I [O(Nlog2N)] and Method II [O(Nlog2N))]. These results indicate that Method III has quick time response and less resource consumption.

Figure 5
figure 5

Compression ratio versus performance. Here, BCR stands for bit compression ratio, PT stands for average processing time, SE stands for sensitivity, and +P stands for positive predictivity.

Discussion

Methods Implementation

To the best of our knowledge, only one ECG compression method category is extensively discussed in current ECG compression literature; this method is referred to as lossless, and can be seen in Method I. The lossless ECG compression methodology recovers the original ECG signal exactly as is. However, a second methodology is found in communication signal processing literature that is referred to as lossy. With the lossy methods, some samples are trimmed off from the original signal. Depending on the type of lossy method being used, the eliminated data may or may not be noticeable to the user. Several lossy compression methods have been reported in the literature14,15,16,17,18,19,20,21,22. These lossy compression methods are strongly embedded in lossless compression methods due to the risk of potential distortion23.

Based on a scan of current literature, the application of the lossy compression method to compress ECG signals, without it being embedded (or part of) in a lossless, has not yet been investigated. We therefore developed a pure lossy method (Method III) and compared it to the most current lossless ECG compression method (Method I) and the most current lossy ECG compression method (Method II). Note that Method II is not a pure lossy compression method, since removal of data bits within a lossless framework is implemented.

In Method I, within the signal regions with steep amplitude variations (such as the QRS complex), the predictor statistics were considerably different and resulted in higher prediction error. Therefore, Deepu et al.8 used prediction error as a marker to locate the QRS complex in ECG signals. By contrast, Method III does not need the linear predictor step used in Method I.

One advantage of using the prediction error in Method I is that the output has low dynamic range (a smaller amplitude than the original ECG signal) and centers around zero amplitude except for the areas corresponding to the QRS complexes. However, a lossless coding scheme is required to preserve the data. The output of the coding step is used to transmit the data instead of transmitting the whole signal to save power/memory resources. It is not required to apply a lossless coding scheme for Methods III, because the number of samples that represent the signal have already been reduced; using a lossless coding scheme would further reduce the quality of the signal and increase the consumption of power/memory resources unnecessarily.

Coding the output of the four methods can be carried out using variable-length coding schemes like Huffman and arithmetic coding24. All four methods are compatible with any of these existing coding schemes. The complexity of encoder/decoder implementation, however, is high for these techniques, although they produced optimal bit representations24.

Method I applied a coding-packaging scheme that gives a practical, fixed-length 16-bit output and has low hardware complexity8. The coding-packaging routine is based on the two’s complement, which is a mathematical operation on binary numbers, representation of the prediction error signal. As most of the error prediction signal is around zero amplitude, it can be represented with only a few bits. Again, Method III does not need this step, as it will increase complexity and render these algorithms less suitable for wearable devices and e-health applications.

Compression Performance

It can be seen in Table 4 that lossless ECG techniques, such as the delta predictor and Rice-Golomb coding scheme10, achieved a maximum BCR of 2.38. However, Rice-Golomb coding is highly complex and requires a dedicated memory8. The two-stage adaptive predictor and the Huffman coding schemes11 achieved a BCR of 2.43, but Huffman coding is highly complex, generates variable-length coded data, and would need further packaging to interface with a standard input/output8. Simple predictor and Huffman coding12 achieved a BCR of 1.92. The slope predictor and a fixed-length packaging scheme12 achieved a BCR of 2.25. Method I (linear predictor and fixed-length packaging) achieved a BCR of 2.28. On the other hand, the proposed lossy compression technique, Method III, achieved a BCR of 4.5.

In general, there are many lossy compression techniques to achieve higher BCR but these require complicated signal processing techniques13. These approaches also require the usage of more complex hardware, which is not suitable for low-power wearable applications25,26, and are therefore not included in the comparison.

Method III achieved a BCR of 4.5 without the need for any packaging. The compression performance of Method III is substantially higher than that in refs8,10,11, and Method III validates the compression quality based on the QRS detection accuracy, which is essential for wearable applications. However, ECG compression techniques have typically been applied without being validated based on the QRS detection, making it difficult to assess the quality of the compression technique. Note that although Method III is a lossy compression method, the main features of the ECG signal morphology were preserved, as shown in Figs 2, 3 and 4. This indicates that a lossy compression method can be sufficient for ECG signal compression, in contrast to lossless methods that are more complex and require larger energy consumption.

In a lossy such as Method III, the minimum rate at which the ECG signal can be sampled—without losing the main events, such as the QRS complexes—has to be twice the highest frequency to achieve the Nyquist rate [F s  > 2F max ]. In other words, the ECG sampling frequency has to be greater than or equal to 40 Hz.

Recent research into the implementation of lossy methods in an ambulatory environment faces many challenges27. The current lossy algorithms, including the compressive sensing algorithms, do not compare favorably with other state-of-the-art lossless compression techniques when considering only CR vs. reconstruction quality27. Therefore, the choice of using a lossy algorithm depends on its ability to provide a low-power implementation. However, the implementation of lossy algorithms are included in lossless framework, which adds more complexity to the expected nature of lossy algorithms. The main advantage of the proposed Method III, which is a pure lossy algorithm, is that it accomplishes a higher compression rate, and higher PRD (higher reconstruction signal quality) while achieving the highest QRS detection rate.

QRS Detection

The literature cites many QRS algorithms that have not been tested against a standard database, making the results difficult to compare and evaluate. Furthermore, many algorithms scored a high detection performance using the overall number of detected beats (i.e., QRS complexes), as shown in Table 2. Note that the QRS detector in ref.28 scored a high overall performance with a SE of 99.89% and a +P of 99.94%. However, the study’s authors excluded files 214 and 215 in the MIT-BIH arrhythmia database29, and therefore this algorithm may not be superior in terms of performance. In addition, their algorithm was based on wavelet feature extraction and singularity for classification without applying any compression techniques, which is considered unsuitable for e-health applications.

As noted, some investigators have excluded records from the MIT-BIH arrhythmia database29 for the sake of reducing noise in the processed ECG signals; consequently, their algorithms appeared to achieve improved performance. Other researchers excluded segments with ventricular flutter30 and signals from patients with paced beats31 from their investigations. In contrast, we tested the QRS detector over the compressed ECG signal without excluding any record or particular segment making the results more robust and the algorithm more efficient.

It is worth noting that Method III achieved a higher QRS detection accuracy because it worked as a filter that captured only the QRS complexes. The evidence of this claim can be seen in Fig. 6, where the main frequencies of the QRS complexes lie in the range of 0.5 Hz to 40 Hz. Method III with a sampling frequency of 80 Hz not only captures the main frequencies of the QRS complexes but also confirms the findings in refs32,33,34.

Figure 6
figure 6

Power spectra of ECG signal (first 60 seconds of record #100 from MIT-BIH Arrhythmia Database). The red curve curve represents the power spectra of Method III with a sampling frequency of 80 Hz. Note, the blue curves represent the power spectra of frequencies between 50 Hz and 360 Hz. The green curve represents the power spectra of QRS complexes (sampled at 360 Hz). It is clear that the optimal frequency band to detect QRS complexes is 0.5–40 Hz.

The detection performance of the Method III on the QT database on a record by record basis is shown in Table 5. The overall comparison of our results with the existing QRS detection algorithms on the QT database is demonstrated in Table 6. It summarizes the performances in terms of number of beats, SE, and +P. Note that the proposed algorithm performed higher in terms of SE and +P when compared to the Pan-Tompkins33 and Elgendi33 over the same number of beats. It is clear that Method III succeeds in handling long ECG recordings with high performance over the 111,201 automatically annotated heart beats. Moreover, the proposed QRS detector has not been re-tuned, in other words we applied Method III to the QT database without changing the value of any parameter and without re-training the algorithm. The results are promising, and Method III (with the parameters B = 390 Hz and K = 80 Hz) can be applied over different databases, sampling frequencies, types of arrhythmia, and noise.

Table 5 Performance of Method III using B/K = 4.875 on the QT database.
Table 6 Comparison of the QRS detection with other published algorithms on the QT database.

Battery-driven ECG Devices

Based on the recommendation in ref.35, the better the computational efficiency, the faster the algorithm, and vice versa. Consequently, the faster the algorithm, the more suitable it is for real-time monitoring. In this study we used a computationally efficient QRS detector33 along with an optimal compression technique (Method III) to improve both the processing and transmission time.

With advances in computational power, the emphasis on algorithm complexity is slowly decreasing. However, the demand for computationally efficient algorithms still remains for instances where ECG signals are collected and analyzed locally in hospitals, in the home setting, or in remote/rural areas where patient access to hospitals access is limited. Developing a computationally efficient algorithm to accommodate the new trend toward the use of mobile ECG devices is required for these cases. Moreover, implementing a joint compression and QRS detection algorithm to analyze long-term recorded signals in a time-efficient manner is also needed.

Typically, processing long recorded ECG signals is carried out on PCs with efficient memory and high-speed multi-core processors. This advantage is still not available for battery-operated devices: current wearable devices have limited memory and processing power36,37,38. In general, battery-driven ECG devices follow one of three strategies: 1) collect ECG signals for offline analysis; 2) collect ECG signals for real-time analysis within the device itself; or 3) collect ECG signals in real time and analyze the transmitted signals via a remote connection to a separate server. Each strategy has its own advantages and disadvantages in terms of processing time and power consumption. Our proposed Method III can be implemented in each strategy to improve both analysis time and QRS detection accuracy.

E-health Systems

E-health systems often use ECGags (e.g., mobile phones or personal digital assistants) merely to collect ECG data (either wirelessly or via a wired connection) that are then sent to an ECGau (e.g., a central monitoring station using 4 G mobile telecommunication or internet) for further analysis39,40. Applying the proposed compression Method III at the ECGag level is beneficial as it: reduces the transmission delay, saves bandwidth, saves energy on the battery-drived device, saves memory for storage, and speeds up real-time diagnosis feedback. Although some analysis can be done locally on the ECGags before transmitting the compressed ECG signals, the analysis and the subsequent transmission of the ECG signals require a large a mount of energy that is taxes on the ECGag’s limited battery life. Thus, investigating efficient methods for local analysis and transmission of ECG signals is needed in terms of compression and QRS detection. Overall, there is a need for a computationally efficient compression technique and a computationally efficient QRS detector for real-time analysis that must be robust and improve QRS detection accuracy. Simple compression and QRS detection algorithms offer low-cost hardware implementation in both power and size for body sensor networks41. Method III can be implemented in the hardware of the ECGag device (or the ECG sensor circuit) and also can be embedded in the software (or an app) of the ECGag device. Because of the robustness, performance, efficiency, and simplicity in implementation, Method III is considered ideal for e-health applications, as it can be implemented on both ECGags and ECGaus.

The proposed method could play a major role in the early detection of disease in low- and middle- income countries (LMICs) where there are major challenges with providing high-quality and universally accessible health care. This is because it follows the framework recommended in ref.42 for tackling noncommunicable diseases by achieving simplicity and reliability. Application of the method may increase the capability to develop e-health technologies that significantly impact morbidity and mortality rates, especially for those living in LMICs.

Conclusions

Our proposed lossy compression Method III is a simple yet efficient method that is validated with QRS detection and should be used for wearable, point-of-care, and e-health ECG devices. Method III outperformed existing compression algorithms by achieving a compression ratio of 4.5× with the highest QRS detection accuracy (an SE of 99.78% and a +P of 99.92% using the MIT-BIH arrhythmia database). Results show that Method III is suitable for wearable sensors and processing long-term recordings and large databases as well as for expanding telemedicine capabilities in the near future. To the best of our knowledge, this is the first simple algorithm that improves QRS detection using data compression.

Methods

Data Used

The MIT-BIH arrhythmia database, which contains 109,984 heart beats29, was used to evaluate the performance of the compression methods. This database is widely used to evaluate ECG compression and QRS detection algorithms as it includes different types of noise and various shapes of arrhythmic QRS complexes33. Moreover, the database contains annotation of R peaks for all ECG signals. The benchmark database contains 48 half-hour ambulatory ECG recordings. These recordings have 11-bit resolution over 10 mV and are sampled at 360 Hz. This database is used for training the proposed method and for comparison against the published ECG compression methods.

The QT database with 111,301 beats43 is used for evaluating the performance of our proposed compression algorithm. The QT database contains 105 records of 15-minute recording sampled at 250 Hz.

Compression Method I: Adaptive Linear Prediction

Method I is our benchmark lossless compression method to compare and evaluate our proposed lossy method against. Several forward–prediction based approaches were used for QRS detection as reported in refs8,44,45. Linear forward prediction was used to estimate the current sample x[n] of the ECG signal in these approaches from its past m samples:

$$\hat{x}[n]=\sum _{k=1}^{m}{h}^{k}x[n-k]$$
(3)

where \(\hat{x}[n]\) is the estimate of x[n], and h m is the predictor coefficients. Thus, the prediction error e[n] (the difference between the actual sample and its estimate \(\hat{x}[n]\)) is:

$$e[n]=x[n]-\hat{x}[n\mathrm{].}$$
(4)

In this paper, we evaluated the recently published work by Deepu and Lian8 on ECG compression techniques using adaptive linear prediction. The block diagram representation of this method is shown in Fig. 7(a). The method applied a QRS detector on the prediction error e[n] signal, followed by fixed-length packaging.

Figure 7
figure 7

Compression methods. (a) Lossless Method I (b) Lossy Method II (c) Lossy Method III Here, ECGag stands for ECG data aggregators (e.g., mobile phones and point-of-care devices that have limited computational resources that collect the ECG signal) while ECGau stands for ECG analysis unit (e.g. a device with high computational resources such as a computer).

Compression Method II: Compressive Sampling Matching Pursuit

Method II is our benchmark lossy compression method to compare and evaluate our proposed lossy method against. It is based on compressive sensing for potential implementation in e-health systems as described in ref.9. In Method II the ECG signal goes throw of four processing stages: sampling, redundancy removal module, quantization and Huffman encoding, as shown in Fig. 7(b). The output signal y[n] is then transmitted to a remote ECGau where the reconstruction of original ECG signal is performed. The novelty of this algorithm relies on the reconstruction algorithm that relies on prior knowledge of ECG wavelet coefficient structure to improve reconstruction quality.

Compression Method III: Decimating by a Factor B/K

Method III is our proposed lossy compression method. This method achieved a sampling rate conversion by first applying an interpolation step (upsampling followed by a lowpass Filter [LPF]), by factor B and then decimating (LPF followed by downsampling) the output by factor K as discussed in refs46,47. The two filters can be combined as a single LPF with a frequency response H(ω), which possess the following frequency response characteristic:

$$H(\omega )=\{\begin{array}{ll}B, & 0\le |\omega |\le \,{\rm{\min }}(\pi /K,\pi /B)\\ \mathrm{0,} & {\rm{otherwise}}\end{array}$$
(5)

where H(ω) is acting as a LPF for the interpolator and smoothing filter for the decimator. The block diagram for the decimation by a factor B/K method is shown in Fig. 7(c). The interpolation step can be expressed as follows:

$$J[r]=\{\begin{array}{ll}x[r/B], & r=\mathrm{0,}\pm {B},\pm 2{B},\ldots \\ \mathrm{0,} & {\rm{otherwise}}\end{array}$$
(6)

Then, the interpolated signal goes to the LPF as follows:

$$P[r]=\sum _{l=-\infty }^{\infty }h[r-lB]J[l]$$
(7)

After downsampling J[n] by a factor K, the output signal of the decimator is:

$$y[m]=P[mK]=\sum _{l=0}^{\infty }h[mK-lB]x[l],$$
(8)

where m is the data samples of the compressed ECG signals. In other words, if we desire a sampling rate conversion by a ratio B/K (where B and K are integers), we can achieve this by first interpolating by B and then decimating by K. The reason to introduce the interpolation step before the decimation step is to preserve the desired spectral characteristics of the processed signal48.

We have two variables B and K to resample the ECG signal from B to K. An optimization step is needed to determine the optimal values of B and K. Any change in these parameters affects the overall performance of the algorithm proposed in this paper. The two variables are interrelated and cannot be optimized in isolation. Our goal is to find the Pareto optimal point, within all possible Pareto solutions49 for our multi-objective problem. Our aggregate objective function denoted by g is a combination of the three objective functions: TP(B, K), FP(B, K), and FN(B, K) into a scalar function is defined as follows:

$$\begin{array}{cccc} & {\rm{argmax}}\,g(B,K) & = & \frac{2\times {\bf{TP}}(B,K)}{2\times {\bf{TP}}(B,K)+{\bf{FP}}(B,K)+{\bf{FN}}(B,K)}\\ & B,K & & \\ {\rm{subject}}\,{\rm{to}} & {b}_{min}\le B\le {b}_{max}, & & \\ & {k}_{min}\le K\le {k}_{max}, & & \end{array}$$
(9)

where g is the traditional F-measure or balanced F-score, which is the harmonic mean of sensitivity and positive predictivity. TP(B, K), FP(B, K), and FN(B, K) are the three objective functions to be maximized jointly. The Pareto frontier is formed with solutions (the values of two decision variables) that optimizes all parameters. Once the Pareto solutions are achieved, the optimal solution will be used for the implementation. In other words, we are systematically enumerating all possible combinations of B and K that maximizes the value of g. Note, the Pareto optimal solution assures simultaneous improvement of all objectives.

QRS Detection

The detection algorithm of the QRS complex published in refs33,35, a two event-related moving averages (TERMA) algorithm50, was used during the data analysis to capture the QRS complexes. TERMA is a fast (computationally efficient) and suitable algorithm for implementation on battery-operated mobile devices, as recommended in refs33,35. Therefore, the use of TERMA in combination with the proposed compression algorithm is expected to improve the overall ECG signal analysis, storage capacity, processing time, and signal transmission. In other words, an immediate feedback to the user can be achieved at the ECGag level, long recorded ECG signals can be saved at the ECGags, the transmission between the ECGags and ECGaus will be optimized, and the decision making at the ECGau level will speed up.

The TERMA-based QRS detection algorithm50 consists of four stages (filtering, enhancing, generating potential blocks, and thresholding) and uses five parameters (starting frequency [F 1], end frequency [F 2], first moving average [MA event with a window size of W 1], second moving average [MA cycle with a window size of W 2], and rejection threshold [β]). First, the ECG signal was passed through a third-order Butterworth filter with a bandpass filter F 1 − F 2. The resulting signal was then squared, and two moving averages (MA event and MA cycle ) were applied with a rejection threshold (β) to generate blocks of interest. After applying a rigorous optimization step discussed in ref.33, the optimal parameters for the QRS detector were F 1 = 8 Hz, F 2 = 20 Hz, W 1 = 97 ms, W 2 = 611 ms, and β = 8. Therefore, the QRS detector was within these optimal parameters.

The TERMA-based QRS detector will only be applied to proposed Methods III. Since the QRS detection performance was not reported for Method II, Method I is the benchmark to compare the proposed methods against as described in ref.8. Method I will use its already incorporated QRS detector, which removes the high-frequency impulse noise from the prediction error signal. The output will be run through the Savtizky-Golay filter to smooth the incoming signal by approximating the signal within a specified window of size W to a polynomial of order q that best matched the given signal in a least-squares sense.

Compression Ratio

The bit compression ratio (BCR) was calculated as follows:

$${\rm{BCR}}=\frac{{\rm{size}}({{\rm{BW}}}_{{\rm{u}}})}{{\rm{size}}({{\rm{BW}}}_{{\rm{c}}})},$$
(10)

where BWc and BWu refer to the bit widths of compressed and uncompressed samples, respectively. If we evaluate the performance of a compression algorithm based only on BCR, we can conclude that the higher the BCR, the better the compression algorithm.

Percentage Root Means Squared Difference

The percentage root means squared difference (PRD) is used to quantify the recovered signal quality by measuring the error between original and reconstructed signal, as follows:

$${\rm{PRD}}=||x-\hat{x}{||}_{2}\times 100/||\hat{x}{||}_{2},$$
(11)

where x is raw ECG signal while \(\hat{x}\) is the reconstructed ECG signal. If we evaluate the performance of a compression algorithm based only on PRD, we can conclude that the lower the PRD, the better the compression algorithm.