1 Introduction

According to the World Health Organization (WHO), cardiovascular disease (CVD) is the leading cause of death globally, causing about an estimated 17.9 million deaths each year. To reduce the incidence, prevalence, morbidity, and mortality of CVD, WHO joins hands with countries and various healthcare partners to develop cost-effective and feasible innovations for detecting CVD accurately. The widely used and inexpensive diagnostic method to investigate CVD is electrocardiogram (ECG) monitoring. The ability to acquire, process, and transmit ECG in conjunction with the ability to automatically verify and provide decisions based on the remotely perceived ECG, help the medical practitioners to tackle the dangers of CVD considerably. With the rapid advancement in technology, wireless body area networks (WBANs) have become indispensable for IoT-based remote health monitoring (Abiodun et al. 2019; Siddharth et al. 2019; Dong et al. 2021; Manickavasagam and Amutha 2020). The prevalence of CVD has prompted an increased surge in the electrocardiogram (ECG) based monitoring system in WBAN (Tinnakornsrisuphap and Billo 2015). However, the scarcity of resources at the sensor nodes and gateway nodes has hampered the efficient use and implementation of WBAN (Poon et al. 2015).

Atrial fibrillation (AF) is one of the most common CVD among elderly people, especially those who are at risk of strokes (Psaty et al. 1997). It is characterized by uncoordinated atrial activation and contraction resulting in irregularly irregular R peaks, absence of P-waves, and the presence of fibrillatory waves (Harris et al. 2012). Due to its asymptomatic nature and prevalence among people, there raised a need to promote screening of AF using wearable devices (Lip et al. 2016; Petryszyn et al. 2019). In Almusallam and Soudani (2019), the authors presented an embedded solution for AF screening using smart wireless body sensors. However, the screening process comes with many snags (Mandrola et al. 2018). The gold standard for AF confirmation is the standard 12-lead ECG (Harris et al. 2012). False positive findings in the screening of AF and the lack of availability of immediate on-site 12-lead ECG data results in unwanted patient anxiety. In situations like COVID-19 pandemic, various factors such as the fear of getting infected, saturation of clinics/hospitals, travel restriction due to lockdown etc. prevents the patients from visiting the clinics/hospitals to record the standard 12-lead ECG for confirming the screen-detected AF. In paroxysmal AF, episodes of AF persists for a short duration and then vanishes, to return later. In such cases, the delay in confirmation testing may diagnose the condition as non-AF, although AF was present at the time of screening. Hence, there is a strong recommendation for standard 12-lead on-site AF confirmation testing in a WBAN environment (Rosenfeld et al. 2019) that will eventually help physicians to improve the medical care and the treatment made available to the patients.

The acquisition and transmission of 12-lead ECG from ten electrodes in a WBAN environment will considerably reduce the battery lifetime of sensor nodes and gateway nodes; it will also pose discomfort to the patients making them carry more nodes on their body for a long duration. Several data compression techniques have been presented in the literature (Cetin et al. 1993; Miaou and Yen 2001; Eftekharifar et al. 2018; Olmos and Laguna 1999) for addressing these issues, but a reduction in the number of leads ultimately determines the overall compression of the system. There are methods reported in the literature to derive 12-lead ECG from a reduced lead set (RLS) with 3 or 4 leads by exploiting the spatial redundancy (Maheshwari et al. 2014; Nelwan et al. 2004; Maheshwari et al. 2014). RLSs are designed in such a way as to derive the 12-lead ECG that matches the actual recorded 12-lead ECG to the best extent. In diagnosing atrial arrhythmia like AF, the absence of P-waves in all the leads is a reliable indicator. However, due to its low amplitude and the presence of artifacts, faithful reconstruction of P-waves from RLS as well as the P-wave detection from the derived leads are challenging tasks. In the literature, the RLS-based lead derivation methods (Nelwan et al. 2004; Nallikuzhy and Dandapat 2017) are prone to P-wave distortions. Therefore special care needs to be taken to prevent the loss of P-wave information during the derivation of 12-lead ECG from the RLS. So the challenge here is to ensure robust and reliable derivation of standard 12-lead ECG signals with acceptable medical quality from the RLS and efficiently detect AF from the derived ECG signals at the receiver end.

This paper addresses the efficient design of on-site confirmatory testing for AF with 12-lead ECG derived from an RLS in a WBAN environment. The contributions of our paper are as follows:

  1. 1.

    Derivation of 12-lead ECG from the RLS such that the P-waves of the derived leads follow the original signal in all leads. This is achieved by incorporating segment-wise regression together with the best lead selection for the RLS.

  2. 2.

    Design of an efficient method to detect AF from the derived ECG leads. The method involves two parameters, namely, a novel P-wave measure based on three levels of P-wave evidence score and an R-wave measure based on RR irregularity score.

  3. 3.

    Performance analysis of the proposed 12-lead ECG derivation method together with AF detection method, and validation of improved performance by comparing with the existing related methods.

2 Related work

In this section, we outline the significant related works that addressed the reduced ECG lead system and AF detection.

2.1 Reduced ECG lead system

Even though there are several methods for compressing 12-lead ECG signals, the ability to derive all the 12-leads data from a reduced set of leads without affecting the diagnosability will ultimately determine the effectiveness of the system (Maheshwari et al. 2014). The most common method for obtaining coefficients to derive 12-lead ECG from the reduced lead system is by applying linear regression on the learning set. Nelwan et al. (2004) found that the best 3-lead subset consists of (I, II, and V2), which was also recommended by Scherer et al. (1989). Nelwan et al. (2004) focused on continuous ischemia monitoring, and the authors did not include the P-wave in their performance assessment due to its distortion. Scherer et al. (1989) extracted a subset of leads (I, II, and V2) and created a separate set of reconstruction coefficients for PR, QRS, and ST segments. The authors determined that the segmented technique had higher correlations and smaller deviations compared to the non-segmented case. However, their reduced lead set consists of fixed leads and did not employ the selection of best lead for deriving the remaining leads. In Tsouri and Ostertag (2014), the authors reconstructed 12-lead ECG signals using independent component analysis (ICA) from two reduced 3-lead systems, namely (I, II, and V2) and Frank’s XYZ leads. However, the method requires high computational power for implementing ICA. Also, the performance is deteriorated as the ECG recording progresses. The method based on ICA also faces the issue of convergence. Although the principal component analysis (PCA) based lead derivation method in Maheshwari et al. (2015) shows better results, it requires all the leads for computing principal components and is effective only in reducing the transmission costs rather than reducing the number of leads on the body. The patient specific model presented in Nallikuzhy and Dandapat (2017) exploits the frequency domain characteristics of the ECG signal along with the best predictor lead-set to improve the diagnosability from the derived leads. The discrete wavelet transform (DWT) computation in the method requires high computational power and hence, the method is not feasible in a resource-constrained WBAN nodes. Also, the authors have experimentally shown that the P-waves are distorted in most of the leads.

2.2 AF detection

In the literature, various ECG features are employed to detect and characterize AF using single-lead or multi-lead ECG signals. The three cardinal features of AF are (i) RR irregularity, (ii) absence of P-wave, and (iii) presence of fibrillatory waves. Most of the AF detectors are based on RR intervals (Dash et al. 2009; Lee et al. 2013) rather than that based on P-wave (Clavier et al. 2002) and fibrillatory waves (Henriksson et al. 2018), and this is mainly due to the low computational requirement of RR based detectors. P-wave detection has been an open problem due to its low amplitude, presence of noise, as well as the wave segments that mimics the P-waves (Kennedy et al. 2016). The Physionet/CinC challenge 2017 (Clifford et al. 2017) presented a wide range of AF detection algorithms using single lead short ECG recordings. However, most of those algorithms involve high computational processes such as machine learning and neural networks. In the case of AF detection using 12-lead ECGs, most of the methods in the literature are based on deep learning (Cai et al. 2020). It is impractical to consider a computationally intensive method for a WBAN environment where the sensors as well as gateways are battery-powered entities. Hence, in this paper, in order to have an efficient on-site AF detection using multi-lead ECG, we use RR irregularity measure and a P-wave measure based on novel three-level P-wave evidence score.

In the literature, although there are works (Guldenring et al. 2012) evaluating the performance of a reduced lead system for the monitoring of ST segment using continuous 12-lead ECG, there are no work related to the detection of AF using reduced lead system.

3 System model

The proposed system model consists of a reduced lead system, an on-body super node (smartwatch), a gateway node (smartphone), and a remote receiver as shown in Fig. 1. The reduced lead system is activated as soon as AF is detected by a screening device or by the instruction of a physician. The smartwatch will collect the ECG data from reduced lead system and forward them to the gateway node. The gateway node will derive the remaining leads from the reduced set of leads and confirm whether the patient has AF or not. Also, the gateway node can send the ECG data to the remote station for further analysis. The standard 12-lead ECG comprises of 12-leads (I, II,III, aVR, aVL, aVF, V1, V2, V3, V4, V5, V6). Among these leads (III, aVR, aVL, aVF) can be directly derived from leads \(\lbrace I, II\rbrace \) as follows: \(III = II-I, aVR = -(I-II)/2, aVL = (I-III)/2, aVF = (II+III)/2\). The remaining independent ECG leads need to be derived from the RLS through a suitable method. The RLS includes two limb leads I, II, and one or two precordial leads from V1-V6.

Fig. 1
figure 1

Proposed system model for on-site AF confirmatory testing

4 Proposed method

A novel approach to on-site AF detection from RLS is presented in this section. Since the presence or absence of P-wave is significant in AF detection, there is a need to increase the resolution of P-waves in the derived ECG leads. The authors in Scherer et al. (1989) demonstrated that the derivation of leads via segment-wise regression have higher average correlation between the derived and original leads compared to that of regression using the entire beat. But their method used a fixed subset of leads (I, II, V2), and the improvement in signal quality for individual segments were not analyzed and discussed. The lead selective algorithm in Nallikuzhy and Dandapat (2017) selected the best precordial lead for linear regression and it is shown that the lead selection will enhance the signal quality of derived leads compared to the regression using any fixed subset of leads. However, the method in Nallikuzhy and Dandapat (2017) exploits the inter-lead correlation in wavelet domain, and the authors have illustrated that the P-waves are distorted in most of the derived leads. Also, the linear regression in wavelet domain requires the transformation of incoming signals to the wavelet domain which is an energy consuming process, and it will eventually burden the sensor nodes and gateway nodes in a WBAN system. In our proposed method, we integrate the segment-wise regression with lead selective algorithm in time domain and demonstrate the viability in reliable and efficient derivation of ECG leads for on-site AF detection.

The proposed method comprises of different stages, namely preprocessing, lead selection, model learning, signal derivation, and AF detection as shown in Fig. 2. The derivation of 12-lead ECG from a 3-lead/ 4-lead RLS is based on segment-wise regression and patient-specific best lead selection. The segment-wise regression improves the reconstruction quality of each segment of ECG beat. The AF detection procedure involves two measures, namely R-wave measure based on RR irregularity score and P-wave measure based on three levels of P-wave evidence score.

Fig. 2
figure 2

Different stages in the proposed method

4.1 Derivation of 12-lead ECG from RLS

For the derivation of 12-lead ECG from RLS, the preprocessed data is employed to perform model learning, lead selection and signal derivation as shown in Algorithms 1, 2, and 3 respectively. Lead selection and model learning operations are performed in the off-line phase where the eight independent leads of ECG are used to learn the model as well as to select the best lead to be used along with limb leads (I, II) or (I, II, and V1) for deriving the remaining leads. The regression model \(C_s\) containing regression coefficients to derive the different segments of remaining leads is chosen from the model learning stage based on the lead \(V_s\) selected. In the on-line phase, using the regression model \(C_s\) and the lead \(V_s\), the incoming ECG signal from 3/4 RLS of the patient’s body is processed at the on-body super node or gateway node so as to derive the remaining precordial leads. To simplify the usage of notations in algorithms and equations, the precordial leads V1, V2, V3, V4, V5, and V6 are denoted as \(V_1\), \(V_2\), \(V_3\), \(V_4\), \(V_5\), \(V_6\), respectively. The detailed description of each stage is presented in the following subsections.

4.1.1 Preprocessing

The preprocessing block performs the conditioning of 12-lead ECG for further analysis. It mainly involves the removal of baseline wandering, normalization of amplitude, and removal of the mean.

4.1.2 Model learning

The model learning unit determines the regression coefficients for the derivation of different segments in the derived leads. As mentioned in Sect. 3, two limb leads I and II are readily included in the reduced lead system. Lead II is seen as one of the best leads to verify P-waves. From the precordial leads \(V_1\) to \(V_6\), different leads can give best results for verification of P-wave depending upon the statistical properties of ECG signal which vary from person to person. So the best practice will be to check for P-waves in all leads.

figure a

To design a reduced 3-lead set, we have to select one of the best precordial lead from \(V_1-V_6\) along with limb leads I and II. The model learning algorithm is summarized in Algorithm 1. The model learning unit takes 8-lead ECG as its input. Initially the beat interval of each lead is segmented into three: (i) segment \(S_1\) (containing P-wave), (ii) segment \(S_2\) (containing QRS) and (iii) segment \(S_3\) (containing T-wave). N is the total number of beats taken for model learning. For each beat, different precordial leads are taken as the predictor lead along with the limb leads I and II, and the regression coefficients are determined for different segments to derive the other precordial leads. i.e., the separate regression coefficients are determined for each segment corresponding to various lead combinations \(\lbrace I, II, V_i \mid i \in 1, 2, 3, 4, 5, 6 \rbrace \) by applying the regression analysis based on least square optimization technique as shown in (1).

$$\begin{aligned} C_{ijkn} = ({G_{ikn}}^{T} G_{ikn})^{-1} {G_{ikn}}^{T} S_k(V_{jn}) \end{aligned}$$
(1)

Here, \(C_{ijkn}\) represents the regression coefficients for deriving the segment \(S_k\) of lead \(V_{j}\) using leads \(\lbrace I, II, V_i \rbrace \) for the nth beat interval and \({G_{ikn}}\) is an \(N_k\) \(\times \) 3 matrix, where \(N_k\) is the length of segment \(S_k\). For the nth beat interval,

$$\begin{aligned} G_{ikn} \longleftarrow [S_k(I_n) S_k(II_n) S_k(V_{in})] \end{aligned}$$
(2)

The final regression coefficients \(C_{i}(jk)\) are obtained for each model by taking the mean of regression coefficients computed for N beats. At the end of model learning stage, each model \( C_i,~i \in \lbrace 1, 2, 3, 4, 5, 6 \rbrace \) consist of five set of regression coefficients [\( j \in \lbrace \lbrace 1, 2, 3, 4, 5, 6 \rbrace - \lbrace i \rbrace \rbrace \)] corresponding to each precordial lead i for deriving the other five precordial leads j, and in total there will be six learned models.

In similar lines, there are three different ways to determine a reduced 4-lead set: (i) Fix the popular combination \(\lbrace I , I I ,V_2,V_5 \rbrace \) (ii) Select the two precordial leads from the set \(V_1\)-\(V_6\) which give best reconstruction quality (iii) Fix three leads as \(\lbrace I, II, V_1 \rbrace \) and then select the best lead from \(V_2\)-\(V_6\) using the lead selection algorithm. The reason for fixing lead \(V_1\) lies in the fact that P-waves are best seen in \(V_1\), and information loss in the P-waves will lead to error in detecting AF. In order to learn the model for a 4-lead RLS, the lead combination \(\lbrace I, II, V_1, V_p \rbrace \) is considered in the proposed work, where \(V_p\) corresponds to any one of the five precordial leads \(V_2\)-\(V_6\), and each model contains four sets of segment-wise regression coefficients to derive the four other precordial leads.

4.1.3 Lead selection

The lead selection unit selects the precordial lead that is used to derive other leads in such a way as to retrieve P-wave with the best accuracy levels. The learned model \(C_s\) corresponding to the selected precordial lead \(V_s\) is picked out, which holds the segment-wise regression coefficients for deriving the other precordial leads. Here, diagnostic similarity score (DSS) used in Nallikuzhy and Dandapat (2017) is incorporated to select the best precordial lead. The procedure for lead selection is depicted in Algorithm 2. The 8-lead ECG and the models \(C_i\) learned via model learning, where i varies from 1 to 6, are taken as input in the lead selection algorithm. For each lead combination, the corresponding regression model obtained via model learning is used to derive the other leads. The three segments in each beat interval are derived using the segment-wise regression coefficients as shown in (3).

$$\begin{aligned} \widehat{S_k(V_{ijn})} \longleftarrow G_{ikn} C_{i}(jk) \end{aligned}$$
(3)

Here, \(\widehat{S_k(V_{ijn})}\) denotes the derived kth segment in the nth beat interval of precordial lead \(V_j\) for the lead combination \(\lbrace I, II, V_i\rbrace \). The performance of each precordial lead in deriving other leads is then quantified by using the following metrics: (1) M(1), inverse of percent root mean square difference (PRD), (2) M(2), inverse of wavelet energy based diagnostic distortion (WEDD) measure, and (3) M(3), correlation coefficient (CC).

figure b

Inverse of PRD: PRD (Zigel et al. 2000) indicates the signal quality between the reconstructed/derived signal \(x^{\prime }\) and the original signal x. Lower the PRD, higher the reconstruction quality. This inturn implies that higher the inverse of PRD, higher the reconstruction quality.

$$\begin{aligned} \mathrm{PRD} (\%) = \frac{{\Vert x - x '\Vert }}{\Vert x \Vert }\times 100 \end{aligned}$$
(4)
$$\begin{aligned} \mathrm{M(1)} = \frac{1}{PRD} \end{aligned}$$
(5)

Inverse of Wavelet energy based diagnostic distortion(WEDD): WEDD (Manikandan and Dandapat 2007) is determined from the Wavelet coefficients of the original and the reconstructed/derived ECG signals. The inverse of WEDD value is higher for the reconstructed signal with less distortion in diagnostic features.

$$\begin{aligned} WEDD = \sum _{i=1}^{L+1} w_i.WPRD_i \end{aligned}$$
(6)
$$\begin{aligned} w_{i}=\frac{\sum _{h=1}^{H_i} t_{i}^{2}(h)}{\sum _{k=1}^{L+1}\sum _{h=1}^{H_i} t_{k}^{2}(h)},~~~i = 1,2,....(L+1)) \end{aligned}$$
(7)
$$\begin{aligned} WPRD_i = \sqrt{\frac{ \sum _{h=1}^{H_i} [ t_{i}{(h)}-\widehat{ t_{i}{(h)}}]^{2} }{\sum _{h=1}^{H_i}{[ t_{i}(h)]^{2}}}} \times 100 \end{aligned}$$
(8)

The \(w_i\) in (6) is the weight for ith sub-band and it is given by (7). The wavelet PRD for ith sub-band is given by (8). The \(t_{i}{(h)}\) and \(\widehat{ t_{i}{(h)}}\) represents the hth wavelet coefficients in ith sub-band for original and derived bands respectively.

$$\begin{aligned} \mathrm{M(2)} = \frac{1}{WEDD} \end{aligned}$$
(9)

Correlation coefficient (CC): It is a measure of linear dependence between two signals (say, x and y). Higher the correlation coefficient, better the correlation between the signals.

$$\begin{aligned} M(3) = CC = \frac{ \sum _{i=1}^{n}(x_i-{\bar{x}})(y_i-{\bar{y}}) }{ \sqrt{\sum _{i=1}^{n}(x_i-{\bar{x}})^2}\sqrt{\sum _{i=1}^{n}(y_i-{\bar{y}})^2}} \end{aligned}$$
(10)

where, \({\bar{x}}\) and \({\bar{y}}\) denote mean of x and y respectively.

The DSS function specified in Algorithm 2 takes as input, the mean values of metrics denoted as MM. Let \(M_{ij}(k)\) where k \(\in \) \(\lbrace 1, 2, 3 \rbrace \) be the kth metric for deriving jth precordial lead using (I, II, \(V_i\)). Then \(MM_i(k)\) denotes the average of metric \(M_j(k)\) where j \(\in \) \(\lbrace \lbrace 1,2,3,4,5,6 \rbrace - \lbrace i \rbrace \rbrace \). Thus MM is a 6 \(\times \) 3 matrix where the ith row [\(MM_i(1)\) \(MM_i(2)\) \(MM_i(3)\)] corresponds to the ith precordial lead \(V_i\). The function DSS calculates the sum of metrics \(SUM_i\) for each precordial lead i for different combinations as given in Eq. (11) where [\(a_1\), \(a_2\), \(a_3\)] range from [0 0 1] to [1 1 1], and picks the ith lead that gives maximum \(SUM_i\) value for each combination.

$$\begin{aligned} SUM_i~=~ a_{1}.MM_{i}(1)+a_{2}.MM_{i}(2)+a_{3}.MM_{i}(3) \end{aligned}$$
(11)

Out of the different leads assigned to 7 combinations using DSS function, the lead that occurs most frequently is selected as the best lead \(V_s\) by the function FQ. The function FQ selects the precordial lead that occurs frequently in DSS(MM). The learned model \(C_s\) corresponding to the best lead \(V_s\) is then used to derive the signals through linear regression.

figure c

4.1.4 Lead derivation

The lead derivation is the on-line real-time operation in the proposed scheme, whereas the model learning and lead selection operations are off-line procedures. In the lead derivation stage, the selected lead and the set of regression coefficients from the corresponding learned model are employed to derive the remaining precordial leads as shown in Algorithm 3. Here, the precordial lead \(V_s\) selected via lead selection algorithm is used along with the limb leads I and II to derive the remaining precordial leads. The learned model \(C_s\) corresponding to the lead \(V_s\) equips the lead derivation stage with the required segment-wise regression coefficients. i.e., the kth segment of the precordial lead \(V_j\) for the nth beat interval is derived via linear regression as follows.

$$\begin{aligned} \widehat{S_k(V_{jn})} \longleftarrow G_{skn} {C_{sjk}} \end{aligned}$$
(12)

where \(G_{skn}\) denotes the arrangement of kth segment of leads \( \lbrace I, II, V_s \rbrace \) as given in Eq. (2), and \(C_{sjk}\) denotes the regression coefficients for the derivation of kth segment of precordial lead \(V_j\). The derived three segments are concatenated to form \(\widehat{V_{jn}}\) for the nth beat interval. Then the N beats are concatenated to form the derived lead \(\widehat{V_j}\). In this way, all the remaining precordial leads are derived from the reduced lead set \( \lbrace I, II, V_s \rbrace \).

4.2 On-site confirmatory testing for AF

A new approach to on-site AF detection from the RLS is presented in this section. Since the presence or absence of P-wave is significant in AF detection, there is a need to increase the resolution of P-waves in the derived ECG leads. The proposed method for lead derivation derivation which is designed in such a way as to ensure improvement in the reconstruction quality of all the three segments of the ECG signal can be used to confirm the AF, since it gives excellent reconstruction quality for P-waves. Therefore, the 12-lead ECG derived from the RLS is applied to AF detector as shown in Fig. 2. The proposed AF detection procedure involves two measure scores, namely RR irregularity score and three levels of P-wave evidence score. The derived signal at the gateway node can be verified for AF directly at the gateway node, or it can be sent to the hospitals for the physicians to confirm the same. For the AF detection at the gateway node, a simple algorithm is developed to detect AF from the 12-lead ECG derived from RLS using the proposed method.

4.2.1 Parameters employed for AF detection

To develop the energy-efficient on-site AF detector, two parameters are employed namely RR irregularity score and P-wave evidence score as shown in Fig. 3. RR irregularity score is based on the number of consecutive R–R intervals extracted that differ by more than 50 ms, and P-wave evidence score is based on three levels of P-wave evidence. The objectives of three levels of P-wave evidence are summarized in Table 1.

Fig. 3
figure 3

Block diagram for AF detection

Table 1 Objectives of three levels of P-wave evidence
figure d

RR irregularity: Heart rate variability (HRV) analysis, a noninvasive method for assessing cardiac autonomic control, provides useful information about the variation between consecutive heartbeats (TFESC/NASPE 1996). The HRV analysis on ECG signal can be done in time domain and frequency domain. A decreased HRV is a predictor of ventricular arrhythmias and sudden death in different patient populations (Sessa et al. 2018). In the proposed AF detection scheme, RR irregularity score employed is pNN50 (Mietus et al. 2002), and it is determined by the ratio of number of consecutive RR intervals that differ by more than 50 ms to the total number of RR intervals. RR irregularity score is significantly higher for AF compared to normal sinus rhythm (Khan et al. 2021).

First level P-wave evidence: In this level, P-wave detection of individual leads is performed and the lead having P-wave detection as 80% of the total number of beats is identified. The procedure to determine the first level P-wave evidence score is summarized in Algorithm 4. Initially, R-peaks are detected and the corresponding RR intervals are determined. The detected P-waves that have duration atleast 0.12 times the respective RR interval (Kimura-Medorima et al. 2018) are considered as valid P-waves. If this condition is not met, then the respective P-wave locations are skipped. The ratio of P-waves detected initially to the number of beat intervals in each lead is referred as the initial P-wave score. The initial ratio of P-waves detected in 8 leads is referred to as the initial P-wave score. If none of the leads have more than 50% P-wave detection, then the new onset and offset locations of P-wave are found based on the slope variation in maximas (continuously reducing maximas from the peak P value is included in P-wave duration) as shown in Fig. 4 and the corresponding P-wave duration (PWD) are checked for validity. Finally, the ratio of P-waves detected in each lead to the total number of beat intervals defines the first level P-wave evidence score. The lead having the highest first level P-wave evidence score is selected as the best lead for the spatial comparison in the second level.

Fig. 4
figure 4

Adjusting P-wave duration based on the variation in maxima

Second level P-wave evidence: This level performs correlation between the PWD in different leads and the PWD of best lead selected in the first level as depicted in Algorithm 5. If the correlation between PWDs of best lead and other lead is greater than a threshold (say, 0.7), then that PWD with a maxima is designated as a P-wave; otherwise the PWD is ignored in those leads. Finally, the enhanced P-wave count is determined, and the ratio of P-waves detected in 8 leads is taken as the second level P-wave evidence score.

figure e
figure f

Third level P-wave evidence: This level determines the final P-wave count in spatial domain based on the P-waves detected in various leads as shown in Algorithm 6. In this level, the P-wave position (PWP) in each lead for a particular time beat is compared, and the PWP is validated accordingly. PWPs of 8 leads are compared for each beat interval, and if the PWP is within a range ( ± 0.2 times the mean of the positions), then the P-wave count is incremented. The final P-wave count denotes the number of leads in which the PWPs are validated. If the final P-wave count is greater than a threshold T (say, six leads), then the P-wave in that particular beat interval is validated. The ratio of number of P-waves validated to the total number of beat intervals gives the net P-wave count. The net P-wave count thus obtained is referred to as the third level P-wave evidence score.

4.2.2 AF detection algorithm

The architecture of the proposed AF detection algorithm is depicted in Fig. 5. Initially, RR irregularity is determined using a score that measures the number of consecutive RR intervals which differ by 50 ms and more. If the RR score is greater than a threshold (Thr), then the system proceeds to determine the three levels of P-wave evidence score. The P-wave evidence score is measured in three levels as explained in Algorithms 4, 5, and 6. The thresholds are determined experimentally, and the four rules in Fig. 5 are formulated as follows, where N(score > z) denotes the number of leads in which ’score’ has a value greater than z, and \(\lbrace AND, OR \rbrace \) denote the logical operators:

Fig. 5
figure 5

Architecture of proposed AF detection algorithm

Rule 1: RR irregularity score < 0.35

If RR irregularity score is less than a threshold Thr, then the detection algorithm can rule out the presence of AF. Otherwise, the next rule is carried out. The authors in Christov et al. (2018) have shown that the RR irregularity for the normal ECG ranges from 0-0.2, whereas it ranges from 0.4-1 for AF. So, we varied Thr from 0.2 to 0.4 in steps of 0.05 in the simulation study and validated that Thr = 0.35 yields good results.

Rule 2: [N(First level P-wave evidence score > 0.8) \(\ge \) 5] OR [N(First level P-wave evidence score > 0.9) \(\ge \) 3]

After the first level detection, if 5 or more number of leads have more than 80% P-wave detection OR at least 3 leads have more than 90% P-wave detection, then the detection algorithm will ascertain that P-waves are present and rule out the possibility of AF. Otherwise, the algorithm passes to Rule 3. This rule is formulated after experimentally validating that the probability of falsely detecting more than 80% P-waves in more than 4 leads is very low.

Rule 3: [N(Second level P-wave evidence score > 0.8) \(\ge \) 4] AND [N(Initial P-wave score > 0.5) \(\ne \) 0]

Since second level search improves the confidence level of P-wave detection, the possibility of AF is ruled out if 4 or more leads have 80% P-wave detection. But here, an additional condition that at least one lead has more than 50% P-wave detection in the initial P-wave score is included to avoid the effect of false detected P-waves. This is because, we observed during our experiments that some subjects with none of the leads having an initial P-wave score greater than 0.5 exhibit very good second-level P-wave evidence score due to the falsely detected P-waves.

Rule 4: Third level P-wave evidence score < 0.5

The highest level of scrutiny is at the third level, where P-wave positions of 8 leads are compared and the presence or absence of P-waves in each beat interval is confirmed. If the ratio of number of P-waves validated to the total number of beat intervals considered is greater than 0.5, then the detection algorithm can rule out the possibility of AF. Otherwise, the algorithm confirms that the particular subject has AF.

5 Results

The experiments are performed on two different databases, namely the most commonly used PTB (Physikalisch-Technische Bundesanstalt) ECG database Goldberger et al. (2000) and China Physiological Signal Challenge (CPSC) 2018 database (Liu et al. 2018). Since the number of AF subjects in PTB database is very low, the performance of RLS in AF detection is determined using the CPSC 2018 database. There are nine classes/categories of ECG signal records in CPSC 2018 database that include one normal class and eight abnormal classes. AF is one of the abnormal classes in the database. All the experiments are carried out in the MATLAB platform using a 3.3 GHz Intel Xeon processor. The ECG data from the datasets are downloaded in MATLAB format.

5.1 Experiment 1: Effect of RLS on the P-wave analysis

The PTB database contains 549 records from 290 subjects with each record having the conventional 12 leads (I, II,III, aVR, aVL, aVF, \(V_1\), \(V_2\), \(V_3\), \(V_4\), \(V_5\), \(V_6\)) and the 3 Frank lead ECGs (vx, vy, vz). The signals are recorded at a sampling frequency of 1000 Hz. In the case of a reduced lead system with three leads, two leads I and II are fixed, and one of the precordial lead is selected from \(V_1\)-\(V_6\). The reduced lead system having four leads includes I, II, \(V_1\) and one of the leads from \(V_2\)-\(V_6\).

Fig. 6 shows the distortion in ECG signal of lead \(V_1\) compared with the original signal when the lead \(V_1\) is derived from a 3-lead RLS with the method mentioned in Nallikuzhy and Dandapat (2017). Similarly, Fig. 7 depicts the effect of using separate regression coefficients for different segments of ECG compared to the same coefficients. Although the P-wave can be detected, the morphology is completely changed when the method in Nallikuzhy and Dandapat (2017), or the method with same regression coefficients is applied for lead derivation. The proposed lead derivation method with separate regression coefficients shows an excellent reconstruction quality for the P-wave as shown in Fig. 7.

Fig. 6
figure 6

Original and derived \(V_1\) lead using the method in Nallikuzhy and Dandapat (2017) in a 3-lead reduced system for PTB database subject ’\(s0460\_rem\)

Fig. 7
figure 7

Original and derived \(V_1\) lead using separate coefficients and same coefficients for different segments in a 3-lead reduced system for PTB database subject ’\(s0460\_rem\)

Table 2 shows the significance of lead selective approach compared to the fixed lead combinations for a 4-lead reduced system in terms of PRDs (Mean ± Standard deviation). The PRDs are averaged over the entire subjects in PTB database. As the reconstruction quality increases with the decrease in PRDs, the lead selective approach has better reconstruction quality compared to other fixed lead combinations. Tables 3 and 4 show the average PRDs and correlation coefficients corresponding to different segments \(\lbrace S_1, S_2, S_3 \rbrace \) with same regression coefficients as \(P_s\), \(R_s\) and \(T_s\), and with different coefficients as \(P_d\), \(R_d\) and \(T_d\) for a 3-lead RLS. The PRDs as well as correlation coefficients are improved drastically by segment-wise regression (i.e., different regression coefficients for different segments). Also, it can be seen that the improvement is very significant in the case of P-wave. Entire beat\(_d\) denotes the PRD or correlation coefficient for the entire beat when each segment in the beat are regressed using different coefficients. The signal quality of each segment particularly P-wave segments are improved significantly by the different coefficients. Similarly, Tables 5 and 6 show the performance of 4-lead reduced system with different coefficients for different segments and with same coefficients for different segments. The performance of 4-lead reduced system is superior compared to 3-lead RLS.

Table 2 PRDs corresponding to different lead combinations for a 4-lead reduced system
Table 3 Average PRDs corresponding to different segments with same regression coefficients ((\(P_s\), \(R_s\) and \(T_s\))) and with different regression coefficients (\(P_d\), \(R_d\) and \(T_d\)) for 3-lead reduced system
Table 4 Average correlation coefficients corresponding to different segments with same regression coefficients ((\(P_s\), \(R_s\) and \(T_s\))) and with different regression coefficients (\(P_d\), \(R_d\) and \(T_d\)) for 3-lead reduced system
Table 5 Average PRDs corresponding to different segments with same regression coefficients (\(P_{s}\), \(R_s\) and \(T_s\)) and with different regression coefficients (\(P_d\), \(R_d\) and \(T_d\)) for 4-lead reduced system
Table 6 Average correlation coefficients corresponding to different segments with same regression coefficients (\(P_{s}\), \(R_s\) and \(T_s\)) and with different regression coefficients (\(P_d\), \(R_d\) and \(T_d\)) for 4-lead reduced system

Figs. 8 and 9 present the boxplots of overall PRD values for P-waves with same regression coefficients and with different regression coefficients respectively in a 3-lead reduced system. Similarly, Figs. 10 and 11 show the boxplots corresponding to 4-lead reduced system. The performance of system with different regression coefficients is superior and is clearly visible from figures. The performance of the proposed system compared to the method in Nallikuzhy and Dandapat (2017) in terms of different performance metrics is shown in Table 7. The performance evaluation using metrics such as PRD, correlation coefficient, WEDD, and \(R^2\) statistics indicate that the proposed system outperforms the system presented in Nallikuzhy and Dandapat (2017) for both the 3-lead and 4-lead reduced systems.

Table 7 Comparison of proposed system with the system presented in Nallikuzhy and Dandapat (2017) in terms of different performance metrics
Fig. 8
figure 8

Boxplot showing PRD of P-waves with same regression coefficients in a 3-lead reduced system

Fig. 9
figure 9

Boxplot showing PRD of P-waves with separate regression coefficients in a 3-lead reduced system

Fig. 10
figure 10

Boxplot showing PRD of P-waves with same regression coefficients in a 4-lead reduced system

Fig. 11
figure 11

Boxplot showing PRD of P-waves with separate regression coefficients in a 4-lead reduced system

The important observations from the experimental results are the following: (i) The lead selective approach has better reconstruction quality for the complete ECG signal compared to other fixed lead combinations as shown in Table 2. This clearly demonstrates that the proposed method outweighs the state-of-the-art methods presented in Nelwan et al. (2004) and Scherer et al. (1989) (ii) The proposed method shows an excellent reconstruction quality for the P-wave compared to other existing methods in Nelwan et al. (2004) and Nallikuzhy and Dandapat (2017) as illustrated in Figs. 6 and 7. (iii) By analyzing Table 7, we can conclude that the proposed method has better performance in terms of various performance metrics compared to the method in Nallikuzhy and Dandapat (2017) that exploits frequency domain characteristics of ECG signal along with best lead selection.

The power efficiency of the proposed system is evaluated by following a power model reported in Abdulghani et al. (2009) and employed in earlier studies (Majumdar et al. 2014; Shukla and Majumdar 2015a, b; Majumdar and Ward 2015); Singh et al. 2017) for comparative power consumption analysis in remote monitoring applications. The total power (\(P_{tot}\)) is given by the sum of three different types of power.

$$\begin{aligned} P_{tot} = P_{sen} + P_{proc} + P_{trans} \end{aligned}$$
(13)

The power consumed for signal sensing (\(P_{sen}\)) includes two stages, namely amplification (\(P_{amp}\)) and analog-to-digital conversion (\(P_{ADC}\)). For C number of channels,

$$\begin{aligned} P_{sen} = C(P_{amp} + P_{ADC}) \end{aligned}$$
(14)

The processing power (\(P_{proc}\)) involves power needed for different operations like regression (\(P_{reg}\)) or principal component analysis (\(P_{PCA}\)) or discrete wavelet transform (\(P_{DWT}\)). The transmission power (\(P_{trans}\)) is given as

$$\begin{aligned} P_{trans} = CJf_sR \end{aligned}$$
(15)

where C, J, \(f_s\), and R denote the number of channels/leads, transmission energy per bit, sampling frequency, and the number of bits per sample, respectively.

In the proposed method, C = 3 or 4 as reduced number of leads are used to derive the other leads. Also, we consider the entire system of deriving leads for calculating the power efficiency. A CMOS amplifier having a gain of 67.7 dB consumes \(P_{amp}\) = 0.274 \(\mu W\) for ECG signal amplification. An ADC with 12-bit resolution and \(f_s\) = 500 Hz consumes approximately 0.2 \(\mu W\). The transmission energy per bit is 5 nJ. \(P_{reg}\) involves 4\(N_s\) multiplications and 3\(N_s\) additions for deriving a single lead from RLS. As the energy cost for addition is negligible, we consider only the energy cost for 32-bit floating-point multiplication which is 3.7 pJ. The power required for DWT computation, i.e. \(P_{DWT}\) is 100 \(\mu W\) per ECG channel.

With the above-mentioned values for different types of power, the total power for the proposed method using 4-lead RLS (i.e., C = 4) is compared with that in Nallikuzhy and Dandapat (2017) as shown in Table 8. The lead derivation using method in Nallikuzhy and Dandapat (2017) involves DWT computation on the four input predictor leads as well as inverse DWT computation on the four regressed output (wavelet coefficients). Therefore, the total \(P_{DWT}\) in Nallikuzhy and Dandapat (2017) is estimated as 800 \(\mu W\). Table 8 shows that the proposed method consumes only 13% power compared to that in Nallikuzhy and Dandapat (2017).

Table 8 Power consumption analysis

5.2 Experiment 2: Performance of RLS in AF detection

The CPSC 2018 database is intended to boost the development of algorithms for the detection of various ECG abnormalities. The 12-lead ECGs used in CPSC 2018 include one normal type and eight abnormal types, namely AF, First-degree atrioventricular block, Left bundle brunch block, Right bundle brunch block, Premature atrial contraction (PAC), Premature ventricular contraction (PVC), ST-segment depression (STD), and ST-segment elevated (STE). The training set contains 6877 recordings sampled at 500 Hz. Out of 6877 records in the first training set, 990 records having number of beats greater than 30 are selected for simulation. Among the 990 records, 229 records are positive class (i.e., having AF) and 761 records are negative class (i.e., having no AF). To evaluate the performance of proposed AF detection algorithm, the metrics used are the following.

$$\begin{aligned}&{Specificity}~(\%) ~= ~\frac{TN}{TN + FP} \times 100 \end{aligned}$$
(16)
$$\begin{aligned}&{Sensitivity} ~(\%)~ =~ \frac{TP}{TP +FN} \times 100 \end{aligned}$$
(17)
$$\begin{aligned}&{Accuracy} ~(\%) ~= ~\frac{TP + TN}{T} \times 100 \end{aligned}$$
(18)
$$\begin{aligned}&{Recall} ~= ~\frac{TP}{TP + FN} \end{aligned}$$
(19)
$$\begin{aligned}&{Precision} ~= ~\frac{TP}{TP + FP} \end{aligned}$$
(20)
$$\begin{aligned} &{F_{1}-score} ~= ~\frac{2 \times Precision \times Recall}{Precision + Recall} \end{aligned}$$
(21)
$$\begin{aligned}&{MCC}~\nonumber \\&\quad =~\frac{(TP \times TN)- (FP \times FN)}{\sqrt{(TP + FP) \times (TP + FN)\times (TN + FP)\times (TN + FN)}} \end{aligned}$$
(22)

where the parameters TP, TN, FP, FN and T denote true positive, true negative, false positive, false negative and total (T = TP + TN + FP + FN) respectively. MCC denotes Matthews correlation coefficient (Boughorbel et al. 2017) and it is a binary classification rate that achieves a high score only if the predictor is able to correctly predict the majority of positive data instances and the majority of negative data instances.

The threshold values for the different rules in the decision tree are determined experimentally. In Table 9, the performance of the proposed algorithm on AF detection is compared with method in Nallikuzhy and Dandapat (2017) and the AF screening method in Almusallam and Soudani (2019). A total of 990 subjects from CPSC 2018 database is used to evaluate the performance. The proposed method performs better as the false positives are reduced significantly. The number of false positives in the screening method (Almusallam and Soudani 2019) is considerably reduced from 356 to 42 by the proposed on-site AF confirmation scheme. Also, the accuracy of the proposed scheme is high compared to other methods. Even though the method in Nallikuzhy and Dandapat (2017) has accuracy in AF detection somewhat closer to the proposed lead derivation method, this is achieved at a much higher power consumption for DWT computation (Acharya and Chakrabarti 2006).

Table 9 Performance comparison of methods in Almusallam and Soudani (2019) and Nallikuzhy and Dandapat (2017) with the proposed method for AF detection in terms of specificity, sensitivity, and accuracy

In order to handle the imbalanced classification problem (Luque et al. 2019), precision, recall, \(F_{1}\)-score, and MCC are considered for comparing the classification performance of the proposed system with the methods in Almusallam and Soudani (2019) and Nallikuzhy and Dandapat (2017). \(F_{1}\)-score, the most common metric employed on imbalanced classification problem, captures the properties of both precision and recall. The F1-score is simply the harmonic mean of precision and recall. Higher the \(F_{1}\)-score, better the performance. The MCC value ranges between –1 (perfect misclassification) and +1 (perfect classification). The proposed method exhibits higher \(F_{1}\)-score and MCC value compared to Almusallam and Soudani (2019) and Nallikuzhy and Dandapat (2017) as shown in Fig. 12 and thus it is evident that the proposed method outweighs the other methods.

Fig. 12
figure 12

Performance comparison of methods in Almusallam and Soudani (2019) and Nallikuzhy and Dandapat (2017) with the proposed method for AF detection in terms of recall, precision, \(F_{1}\)-score, and MCC

The reconstruction quality of the derived ECG leads depends on the quality of the input ECG signal. The recorded ECG signals will have a low amplitude in general, particularly for P-waves. When the noise during signal recording causes the signal-to-noise ratio (SNR) to reduce, the system fails to detect P-waves from the noisy signal, and as a result, false-positive for atrial fibrillation (AF) detection increases. As SNR of the input ECG signal is varied from 20 to 10 dB, the proposed method exhibits robustness to noise till SNR = 11 dB as depicted in Fig. 13 by the effect of noise on the \(F_1\)-score of the proposed method. Only some subjects are adversely affected by the noise, whereas others are robust to noise.

Fig. 13
figure 13

Effect of noise on the \(F_{1}\)-score of the proposed method

Some common types of ECG noises are baseline wander noise, powerline interference noise, electromyographic (EMG) noise, and electrode motion artifact noise. The effect of baseline wander noise can be reduced by using a high pass filter with a cut-off frequency of 0.5 to 0.6 Hz. Powerline interference noise (50 or 60 Hz noise from mains supply) can be removed by using a notch filter of 50 or 60 Hz cut-off frequency. High-frequency noise such as EMG noise can be removed by employing a low pass filter with an appropriate cut-off frequency. Under noisy environment, the ECG signal has to be filtered as a part of preprocessing before proceeding to the detection process.

6 Discussion

This paper discusses the method for confirming AF in a WBAN scenario using the derived standard 12-lead ECG from an RLS. Although there exist several AF detectors using single lead and 12-lead standard ECG, AF confirmation using standard 12-lead ECG in a low-power setting like WBAN is not addressed in the literature. The confirmation using standard 12-lead ECG is vital even for the most reliable existing AF screening/detection methods.

The proposed ECG signal derivation from RLS employs segment-wise regression of ECG and lead selection algorithm. The proposed method improves the reconstruction quality of P-wave signals in almost all leads. From the Tables 3, 4, 5, 6 and 7, it is evident that the reconstruction quality of the derived signals (\(V_1\)-\(V_6\)) are improved significantly with the proposed method. Compared to the reduced lead system with the same regression coefficients, PRD of P-wave segment is reduced to half from 54.46% to 26.21% as well as the correlation coefficient is increased from 0.85 to 0.92 for the system with different regression coefficients. In the proposed ECG lead derivation method, the morphology of P-waves are preserved better than the other methods as clearly depicted in Figs. 6 and 7.

Each on-body sensor node of the RLS senses the ECG signal and sends it to the gateway node for lead derivation. For reduced power consumption at the sensor nodes and gateway node, deterministic binary block diagonal (DBBD) matrix based compressed sensing (CS) can be performed at the sensor nodes as discussed in Mamaghanian et al. (2011) and Koya and Deepthi (2019). The ECG signals of the reduced lead set can be reconstructed from the received measurements at the gateway node through a simple and low complex algorithm (Koya and Deepthi 2019). The proposed lead derivation algorithm is carefully developed with very low number of operations to ensure that the power consumption at gateway node is maintained low. The proposed lead derivation at the gateway node is a simple linear mapping of the reduced leads using the learned model regression coefficients during the online phase. Here, only 4\(N_s\) multiplications and 3\(N_s\) additions are required for the derivation of a lead from the 4-lead reduced set at the gateway node, where \(N_s\) is the number of samples in each lead. This computational complexity is very low when compared with the recent lead derivation method presented in Nallikuzhy and Dandapat (2017), where the online phase involves both DWT and inverse DWT functions in addition to the 4\(N_s\) multiplications and 3\(N_s\) additions required for the lead derivation via regression analysis. The DWT computations are computationally intensive; even the hardware-efficient DWT filter banks that can be employed in embedded platforms for physiological signal monitoring consume reasonable power (Eminaga et al. 2018). Hence the proposed AF detection scheme having lead derivation based on time-domain computation is power-efficient, and it is a suitable candidate for deployment in a resource-constrained WBAN environment.

The proposed AF detection scheme has improved specificity, sensitivity, accuracy, precision, recall, \(F_1\)-score, and MCC as demonstrated in Table 9 and Fig. 12. The few false positives and false negatives in the proposed scheme (Table 9) can be substantially reduced to a minimum by making available the derived 12-lead ECG to a physician via cloud for confirmation. To tackle the effect of mobility artifacts, the patients can rest in a supine position to record the 12-lead ECG using RLS when the AF is detected via screening. Also, the proposed method can be combined with other energy-saving techniques like duty-cycling, protocol optimization, and transmission power adaptation as presented in Xu et al. (2020) and Xu et al. (2020) so as to develop a cross-layer design for resolving the various challenges inherent in remote continuous healthcare monitoring.

7 Conclusion

In this paper, we proposed a scheme for the efficient on-site confirmation testing of AF using standard 12-lead ECG. The proposed lead derivation method improves patient comfort and reduces the power consumption of sensor nodes and gateway nodes. On-site confirmatory testing minimizes the patients’ anxiety and improves the medical care that can be timely provided to the patients. The segment-wise regression approach together with the precordial lead selection improves the reconstruction quality of the signals compared to the entire ECG beat regression using the same regression coefficients. Different performance evaluation metrics such as PRD, correlation coefficient, WEDD and \(R^2\) statistics were used to quantify the improvement in signal quality. AF detection is carried out on the derived ECG signal using a simple scheme that involves only two score measures, namely RR irregularity score and a novel P-wave evidence score specifically designed for AF. The proposed scheme exhibits improved accuracy, \(F_{1}\)-score, and MCC in classifying AF from a dataset containing one normal and 8 abnormal types including AF.

Further research is required to understand the effect of noise and mobility artifacts on the performance of the proposed scheme.