Abstract
This study aimed to develop a real-time, noninvasive hyperkalemia monitoring system for dialysis patients with chronic kidney disease. Hyperkalemia, common in dialysis patients, can lead to life-threatening arrhythmias or sudden death if untreated. Therefore, real-time monitoring of hyperkalemia in this population is crucial. We propose a wearable single-lead ECG monitoring system, offering enhanced comfort and feasibility for extended use. The key innovation of this system is the design of a compact, multi-channel convolutional neural network. This model offers high stability, strong performance, and exceptional computational efficiency, making it ideal for seamless integration into wearable devices for real-time monitoring applications. The model automatically extracts features from ECG signals at different frequencies through multiple convolutional channels, eliminating the need for manual feature extraction before data input. Data is input using a non-overlapping sliding window approach, reducing preprocessing complexity while maintaining model performance. We investigated the optimal window length and the number of convolution channels for ECG signal input. Experimental results indicate that the model achieves optimal performance with a 1200 ms window length and four parallel convolutional branches, yielding an accuracy of 98.25% (4.52%), F1-score of 98.31% (3.26%), sensitivity of 98.63% (2.41%), and specificity of 97.88% (5.13%). This system holds significant potential for improving patient monitoring comfort and real-time responsiveness.
Similar content being viewed by others
Introduction
Kidney disease is becoming a significant global health concern. It is estimated that around 700 million people worldwide suffer from chronic kidney disease (CKD), a condition characterized by a progressive impairment of kidney function lasting longer than three months due to various causes1. According to the Global Burden of Disease study2, the global prevalence of CKD increased by 33% from 1990 to 2017. Hyperkalemia, a common electrolyte imbalance in patients with CKD, is marked by elevated potassium levels in the blood. In CKD, the kidneys, which play a key role in potassium excretion, lose their ability to effectively eliminate potassium from the body, resulting in its accumulation3,4. This condition is strongly linked to adverse outcomes, including slowed heart rhythm, conduction disturbances, and, in severe cases, cardiac arrest, posing a significant risk to patient survival5. Hyperkalemia is defined as a serum potassium concentration exceeding 5.0 or 5.5 mmol/L, with levels above 6.0 mmol/L classified as severe hyperkalemia6,7,8. Studies have shown that serum potassium levels greater than 6.0 mmol/L are linked to higher rates of complications and an increased risk of death9,10.
Current methods for measuring electrolyte levels, such as blood gas analyzers and serum tests, are invasive and can not be used continuously. This makes them unsuitable for continuous, real-time monitoring during the pre-dialysis phase in CKD patients. In contrast, electrocardiogram (ECG) is non-invasive, easy to use, and suitable for long-term monitoring. Hyperkalemia, especially moderate to severe cases, affects the heart’s electrical activity by disrupting how heart cells depolarize and repolarize. High potassium levels make the resting membrane potential unstable, causing changes in the size and duration of action potentials. These changes appear on an ECG as peaked T waves with increased amplitude, widened QRS complexes, prolonged PR intervals, and reduced P wave amplitude11,12. In recent years, wearable single-lead ECG devices have made real-time monitoring of cardiac activity possible. Research shows that single-lead ECG can reliably assess certain cardiac functions, such as reduced left ventricular ejection fraction13, and detect key indicators like heart rate variability (HRV) using specialized algorithms14,15.
Changes in T-wave shape and QRS width caused by hyperkalemia are also detectable with single-lead ECG, making it a useful tool for identifying this condition. While single-lead ECG provides less information than standard 12-lead systems, its small size and comfort make it ideal for long-term monitoring outside clinical settings. However, wearable devices come with unique challenges, including the need for real-time, low-power signal processing within the limits of their computational resources and battery life.
The use of deep learning algorithms has greatly improved the automated classification of ECG signals. Convolutional neural networks (CNNs), known for their ability to process time-series data16,17,18, have shown significant potential in detecting arrhythmias19,20,21 and identifying atrial fibrillation22,23. In this study, we developed a low-complexity CNN model tailored for wearable single-lead ECG signals. Instead of relying on manual feature extraction, the model learns directly from ECG time series, striking a balance between power efficiency and computational demands to enable real-time hyperkalemia monitoring. Patients with end-stage renal disease (ESRD) present substantial individual variability, including differences in ECG patterns and potassium level fluctuations, which challenges the accuracy of generalized models. To address this issue, we propose a personalized CNN model trained on each patient’s hematological and ECG data. Unlike existing studies that primarily rely on 12-lead ECG data, our single-lead approach enables real-time potassium monitoring during the pre-dialysis phase. The model delivers precise hyperkalemia alerts, supporting timely clinical intervention and reducing the risk of sudden cardiac death.
Method
Data set and wearable prototype
Data for this study were acquired from the West China Biomedical Big Data Center of Sichuan University. The study received approval from the Biomedical Research Ethics Committee of West China Hospital of Sichuan University (NO.2022-1843). This study was conducted in compliance with all relevant guidelines and regulations, and informed consent was obtained from all participants or their legal guardians.
The enrollment period spanned from March 4, 2022, to October 20, 2023, including over 500 hemodialysis patients from West China Hospital of Sichuan University and four hospitals in Jianyang, Meishan, and Longquan district of Sichuan province and Tibet, China. The dataset comprised laboratory tests measuring serum potassium ion concentrations before and after dialysis, along with electrocardiogram (ECG) recordings taken for at least fifteen minutes before and after each blood potassium concentration measurement. Participants were stage 5 chronic kidney disease patients (eGFR ≤ 15 mL/min/1.73 m²) undergoing hemodialysis who voluntarily agreed to participate. Patients who experienced abnormal fluctuations in vital signs during dialysis were excluded from the study. The final analysis included 33 patients who had pre-dialysis serum potassium levels greater than 6.0 mmol/L and post-dialysis serum potassium levels between 3.5 and 5.0 mmol/L. Comprehensive ECGs were systematically collected from these patients, providing valuable data for our research.
A wearable chest strap ECG device was used to acquire ECG data, as shown in Fig. 1. This device consists of a signal collector and a chest strap. The chest strap contains three dry electrodes, positioned at the 7th and 8th rib positions, and the ECG signal was sampled at 500 Hz and digitized with 24-bit precision, obtained.
The Wearable Chest Strap ECG Acquisition Device (a) The wearable chest strap ECG acquisition device, consisting of a chest strap and an ECG patch. (b) A schematic diagram showing the device as worn by a subject. The electrode pads are positioned as per standard practices in ambulatory electrocardiogram equipment used in clinical settings. (c) A real-time waveform display generated from the ECG patch data acquisition. Each ECG patch is linked to a Bluetooth adapter, which connects to a computer via USB, allowing access to an ECG application for viewing real-time waveforms.
Data preprocessing
In order to mitigate the impact of excessively noisy data segments and to reduce the risk of model overfitting, the acquired ECG data were pre-processed using a standard 3rd-order Butterworth band-pass filter with a frequency range of 3–48 Hz. In patients with end-stage chronic kidney disease undergoing dialysis, blood potassium levels typically rise before the start of dialysis and stabilize afterward. The total duration of ECG data for each subject was three minutes (15,000 sampling points) per state, i.e. hyperkalemic (pre-dialysis) and normokalemic (post-dialysis). To ensure accurate labeling, ECG readings corresponding to the hyperkalemia state were taken immediately before the measurement of blood potassium concentration, while those corresponding to the normokalemia state were taken immediately after the measurement.
Currently, existing studies leveraging ECG signals to detect electrolyte imbalances primarily utilize the following data preprocessing methods:
-
(1)
Fixed Window Segmentation: The preprocessed signal is divided into fixed-length, non-overlapping windows as model inputs. This method has low computational complexity, requiring only simple segmentation. However, as no ECG features are extracted, it may lead to reduced classification accuracy24,25,26.
-
(2)
Heartbeat-Based Extraction: Using the R-wave as a reference point, this method extracts complete heartbeats by extending a certain length forward and backward with respect to the peak of R-wave. Following the extraction of heartbeats, parameters highly correlated with target characteristics, such as QRS slope27, T-wave amplitude, T-wave slope, and R-wave amplitude28,29,30, are extracted as features for subsequent processing. This approach can further enhance classification accuracy but significantly increases computational complexity31.
In this study, the preprocessing method combines the characteristics of the first and second approaches. Fixed window segmentation, due to its low computational complexity, meets the real-time requirements of wearable devices and serves as the primary method. Although heartbeat-based extraction enhances classification performance to some extent, we relied on the strong feature extraction capability of deep learning models and chose not to perform additional feature extraction to avoid extra computational overhead.
Subsequently, the ECG data was processed in two distinct approaches, as shown in Fig. 2: (1) based on extracted heartbeat, i.e. QRS complex, and (2) using continuous data stream, i.e. a sliding window without QRS extraction.
(1) Based on extracted heartbeat, i.e. QRS complex. The processing steps are as follows: heartbeat segments are centered on the R-wave peak, with each segment spanning 240 milliseconds, including 40 samples before and 79 samples after the peak (totaling 240 milliseconds, with the peak aligned at the 41st sample). To ensure data quality, aberrant R-wave peaks were discarded according to the following dual criteria:
-
Exceeding 1.5 times the mean peak amplitude or 0.5 times below the average peak magnitude.
-
Exhibiting inter-R-wave peak variability less than half the standard deviation of the mean heart rate.
(2) Using continuous data stream, i.e. a sliding window without QRS extraction. The processing steps are as follows: non-overlapping windows (ranging from 600 to 2800 milliseconds in length, with six options) are directly segmented from the preprocessed ECG signal without performing QRS detection. Windows containing only noise or unrecognizable ECG waveforms are excluded to minimize interference during model training. This method has lower computational complexity, making it highly suitable for wearable devices and, therefore, the primary approach adopted in this study.
Convolutional neural network model
Deep learning is a powerful technique for learning complex hierarchical representations from multilevel abstract data, making it particularly suited for classifying complex graphical data, such as ECG signals24. In this study, we introduce a convolutional neural network (CNN) to automatically learn hidden patterns in ECG data. The proposed CNN architecture, trained using the standard backpropagation algorithm, was designed to be easier to train and optimize compared to traditional deep neural networks. As shown in Fig. 3, the architecture consists of two main blocks with eleven layers. Unlike previous CNN models that use multiple layers of convolutional depth computation, our model employs several convolutional channels in the first block that compute simultaneously.
The architecture of the proposed CNN model. The model input consists of two types of ECG signals. The first block includes multiple convolution channels, each structured as shown in the Conv-Channel. The convolutional layer @ before the number is the number of convolutional output channels and @ after refers to the length of each kernel. The kernel size is set in gradual increments according to the number of convolution channels. \(\oplus\) Denotes the fusion of all features extracted in Block 1. The model classifies ECG signals into hyperkalemia and normokalemia categories.
The first block includes two convolutional processes. Each process comprises multiple 1D convolutional layers, a batch normalization layer, and an activation function layer. In the first convolutional process, we use multi-sets of 1D convolutional kernels of different sizes to capture the multi-frequency features of the input ECG signal, thereby replacing manual feature extraction with automatic computation. The size configurations of the convolution kernels reflect different frequency features of the ECG signals, providing a rich feature representation. The activation function introduces nonlinearity into the deep learning model. We selected the exponential linear unit (ELU) activation function because it improves gradient propagation during training, especially in deep neural networks, and effectively mitigates the gradient vanishing problem. The ELU activation function is defined as follows:
To control the slope of the negative input values, we use as a hyperparameter in the ELU activation function. To prevent the output mean from deviating from zero at the beginning of training, we introduce a batch normalization layer before the activation function layer. In the second layer of the first convolution block, we employ a 64 × 40 convolution kernel to process the output feature maps. This layer also includes batch normalization and ELU activation to ensure the output feature maps remain consistent in size.
In the second block, a 256 × 1 convolution kernel is used to further convolve the feature maps computed from different convolution channels. The multidimensional feature maps are then flattened into one-dimensional vectors through a flatten layer for subsequent classification tasks. Then, we introduce an average pooling layer to reduce noise and smooth the features. Finally, the feature vectors are passed through a fully connected layer to further extract high-level information for identifying ECG signals indicative of high potassium levels. For the loss function, we adopted the cross-entropy loss function. It effectively mitigates the problem of gradient vanishing or explosion. The objective loss function is defined as follows:
where y is the true label and \(\:\widehat{y\:}\)is the model prediction probability. To optimize the model, we apply the argmax function with a threshold of 0.5 to the output values. Further, we will explore the impact of varying the number of convolutional branches in the initial module on model performance. Models will be designed with 1, 2, 4, and 6 initial convolutional channels.
Our model was constructed using the Pytorch framework, trained on a server equipped with RTX4090, and accelerated the CUDA platform training process.
Model evaluation was performed using within-subject five-fold cross-validation. We divided each subject’s post-window-cut ECG dataset into five equal-sized subsets, four of which were used as training data, while the remaining one was used as validation data. Moreover, the ECG data input to the model is not shuffled, which is to avoid data leakage due to temporal correlation32. The convolutional neural network model construction process is shown in Fig. 4.
Convolutional neural network model construction flowchart. Collecting ECG data from hyperkalemic dialysis patients in both hyperkalemic and normokalemic states. After bandpass filtering between 3–48 Hz, two preprocessing methods were applied: extracted heartbeat and continuous data stream. The continuous sliding window approach was used to select the optimal window length and the number of convolutional channels for the convolutional neural network. A comparison was made to assess the advantages and disadvantages of the two preprocessing methods.
Comparison of deep learning tools
In this study, Long Short-Term Memory (LSTM) networks and a combination of Convolutional Neural Networks with Transformers (CNN + Transformer) were selected as benchmark models to compare against our proposed low-complexity CNN model. Both methods are well-suited for sequential data modeling and align with the requirements of single-lead ECG data analysis.
LSTM, a variant of recurrent neural networks, is designed to capture long-term dependencies in sequential data33,34. Its unique gating mechanisms—input, forget, and output gates—help address common challenges in traditional RNNs, such as vanishing and exploding gradients, making it particularly effective for time-dependent tasks like physiological signal processing35,36. In this study, the LSTM model consists of two LSTM layers, each with 128 hidden units, followed by a fully connected layer for classification. This architecture enables the model to extract and represent the temporal patterns present in ECG signals.
The CNN + Transformer model combines the strengths of local feature extraction and global dependency modeling37. Transformers, widely used in natural language processing38 and time-series analysis39, employ a multi-head self-attention mechanism to effectively capture long-range dependencies within sequences. By calculating relationships between different time steps and dynamically adjusting feature importance, Transformers enhance sequence modeling capabilities. In this study, the Transformer’s ability to model global dependencies is well-suited for analyzing the complex waveforms and long-term patterns in single-lead ECG signals. Specifically, two 1D convolutional layers were first used to extract local features, such as waveform morphology and short-term variations. These features were then processed by a Transformer encoder, comprising two layers with four attention heads and a dimensionality of 64, to capture long-term dependencies and integrate relationships across time steps.
In contrast, the proposed low-complexity CNN model adopts a streamlined convolutional architecture that efficiently extracts key features while requiring fewer parameters and lower computational costs. To ensure a fair comparison, all three models were trained and evaluated under identical conditions. The data input, training, and validation processes followed a subject-specific five-fold cross-validation strategy, with consistent epoch settings and optimizer configurations. Additionally, all models utilized the same single-lead ECG input format, with data preprocessing, training, and evaluation conducted on a unified computational platform.
Analysis metrics
In this study, accuracy, specificity, recall(sensitivity), and F1-score were assessed. The formulae are as follows, in true positive (TP) occurs when the model accurately predicts a positive data point, false positive (FP) occurs when the model accurately predicts a negative data point, true negative (TN) occurs when the model predicts a positive data point incorrectly, and false negative (FN) occurs when the model predicts a negative data point incorrectly:
Accuracy denotes the proportion of correctly predicted samples to the total number of samples within the test set.
Specificity quantifies the number of accurately predicted negative samples out of all actual negative samples in the dataset.
Recall quantifies the number of accurately predicted class samples out of all samples belonging to that specific class.
F1-score calculated as the harmonic mean of precision and recall, provides a comprehensive assessment of classification performance.
During model development, we first identified the optimal window length for input data to ensure that sufficient features were captured while minimizing noise. Further, we also systematically explored the ideal number of convolutional channels in the initial network block to enhance feature extraction while preserving model simplicity. Additionally, we compared the performance of other deep learning tools commonly used in ECG signal analysis with that of CNNs to validate our model selection. To optimize ECG data processing, we assessed the impact of two different processing methods on CNN’s performance and selected the approach that most effectively enhanced both model performance and practical applicability. Ultimately, the best combination of ECG data input parameters and CNN architecture was determined based on accuracy, sensitivity, specificity, and F1-score.
Results
Optimal sliding window length of CNN models
We evaluated the impact of varying ECG signal window lengths on the classification performance of the CNN model using the continuous data stream method, as detailed in Table 1. We analyzed the classification accuracy, F1-score, sensitivity, and specificity, finding that the best performance was achieved with a window length of 1200 ms. Specifically, at this window length, the classification accuracy reached 98.25% (4.52%), the F1-score was 98.31% (3.26%), the sensitivity was 98.63% (2.41%), and the specificity was 97.88% (5.13%). These results indicate that the 1200 ms window length not only achieves the highest overall classification performance but also exhibits small inter-individual differences and high robustness.
Unexpectedly, to a certain degree, for window lengths longer than 1200 ms, model performance showed a decreasing trend. Specifically, the accuracy for the 1600 ms window length is 98.21% (4.99%), for the 2000 ms window length is 97.09% (7.52%), and for the 2400 ms window length drops to 95.93% (9.43%). This decline in performance may be attributed to the reduction in the number of samples as the window length increases. Fewer samples lead to less valid information during model training and evaluation, negatively impacting the evaluation metrics.
In contrast, datasets with window lengths shorter than 1200 ms, despite having larger sample sizes, did not perform as well as those with the 1200 ms window length. For instance, the accuracy for the 800 ms window length was 97.57% (4.88%), and for the 600 ms window length, it was even lower at 91.26% (9.37%). The shorter window lengths reduced the amount of critical information within each window, thereby affecting the model’s predictive performance. Notably, the performance decreased most rapidly at a window length of 600 ms, where some windows contained almost no QRS wave clusters, resulting in insufficient important information, consequently poorer performance. The choice of window length and sample size requires a balance between the amount of information captured and the number of samples available. This balance ensures that enough information is captured while maintaining a sufficient sample size to support the training and validation of the model for optimal performance.
Although the CNN model’s performance with the 1200 ms and 1600 ms window lengths is essentially the same, we chose 1200 ms as the optimal window length. A shorter window length enables the monitoring system to respond faster. For hyperkalemia diagnostic models, shorter ECG data windows can more quickly detect the onset of hyperkalemia, leading to timely clinical interventions.
Parallel convolutional channels in CNN models
We employed the continuous data stream method on ECG data, using an optimal window length of 1200 ms, to examine the impact of varying the number of convolutional channels on the classification performance of the CNN model. Table 2 presents the effect of different numbers of convolutional channels on model classification performance, including average accuracy, sensitivity, specificity, and F1-score.
The results indicate that increasing the number of convolutional channels enhances both the overall performance and stability of the CNN model. The model with only one convolutional channel had the poorest performance, with an average accuracy of 89.00% (14.41%), an average F1-score of 88.00% (13.34%), an average sensitivity of 87.52% (13.27%), and an average specificity of 90.48% (15.00%). In contrast, the model with two convolutional channels showed significant improvement, achieving an average accuracy of 95.61% (9.68%) and average F1-scores, sensitivity, and specificity all above 95%. Performance continued to improve with four convolutional channels, reaching an optimal balance. Although the model with six convolutional channels slightly outperformed the four-channel model across all metrics—with an average accuracy of 98.65% (3.18%), an average F1-score of 98.64% (2.56%), an average sensitivity of 98.56% (2.50%), and an average specificity of 98.73% (2.99%)—it required significantly more computational time and resources. Given that low computational cost and fast response time are critical in clinical applications, the four-channel model is more suitable, offering a better balance between performance and computational efficiency.
By introducing a multi-convolutional channel model, we successfully captured different frequency features in the ECG data, which is crucial for accurate classification. The four-channel CNN model achieves an optimal balance between performance and computational cost, making it suitable for real-time monitoring and early detection of hyperkalemia. The details are shown in Fig. 5.
Performance of the four-channel CNN model in terms of accuracy, F1-score, sensitivity, and specificity. The figure filters out the subjects whose mean value of the five-fold cross-validation for each evaluation metric for each subject is less than 95% and plots the full value of the five-fold cross-validation on the basis of the mean value. The legend shows the number of abnormal subjects and the mean value of that evaluation metric.
Comparison of continuous data stream and extracted heartbeat
After the optimal parameters of the continous data streaming method, such as window length and convolution channel numbers, were determined, we compared its performance with the heartbeat extraction method. The continuous data stream method used an optimized window length of 1200 ms, while the extracted heartbeat method utilized heartbeats with a total length of 240 ms. Both methods used the same total length of data samples.
The performance of the two data processing methods in the CNN model is shown in Fig. 6. The results showed that the average accuracy, sensitivity, and F1-scores of the two methods were comparable, with a standard deviation across subjects of less than 6%. Specifically, the mean accuracy of the heartbeat extraction method was 98.06% (3.70%), the mean F1-score was 98.01% (2.57%), the mean sensitivity was 97.71% (2.73%), and the mean specificity was 98.51% (2.92%). Compared with the results of the data streaming method, as described in performance of the four-channel CNN model, it is evident that the heartbeat method performed lower sensitivity, with a slightly higher specificity.
Accuracy, F1-scores, sensitivity and specificity of both CDS and EH beat in CNN model. The left Y-axis represents the probability density estimate of the full outcome of 33 subjects. The subjects whose mean value of the five-fold cross-validation per subject for each evaluation metric of the two modalities is less than 95% are filtered out and the full value of the five-fold cross-validation is plotted on the basis of the mean value. The legend shows the number of the abnormal subjects and the mean value of that evaluation metric. CDS: Continuous Data Stream; EH: Extracted Heartbeat.
The average sensitivity of the data streaming method was 0.92% points higher than that of the heartbeat extraction method, indicating that it can more accurately identify true cases of hyperkalemia and reduce the risk of false negative, which could be fatal. Moreover, the data stream method has practical advantages. It processes data continuously without the need for additional extraction steps after each heartbeat detection, reducing the complexity and computational load of data processing. This lower computational effort allows the sliding window method to utilize resources more efficiently in a real-time monitoring system, enhancing clinical utility. Additionally, because the sliding window method does not depend on specific heartbeat locations, it can better handle noise and variability in the ECG signal, improving the model’s robustness.
In ECG data classification, accuracy and sensitivity are crucial for effectively diagnosing and differentiating hyperkalemia in dialysis patients. While the heartbeat extraction method has a slight edge in specificity, the sliding window method demonstrates superior overall performance in practical applications. It not only excels in accuracy and sensitivity but also reduces computational demands, ensuring a balance between high diagnostic performance and practical feasibility in clinical settings.
Deep learning tools comparison results
The performance of three deep learning models—Long Short-Term Memory (LSTM) networks, Convolutional Neural Networks combined with Transformers (CNN + Transformer), and the proposed low-complexity 1D-CNN model—was evaluated for single-lead ECG classification. Table 3 presents a comparison of their accuracy, F1-score, sensitivity, and specificity.
The LSTM model demonstrated the shortest computation time among the tested approaches but exhibited relatively lower performance. Its mean values across the four evaluation metrics ranged from 90 to 93%, with standard deviations exceeding 10%. Compared to the 1D-CNN model, the LSTM’s average accuracy was 6.57% points lower, and its standard deviation was 6.8% points higher. This result may stem from the model’s reliance on temporal feature extraction, which limits its ability to capture the local and complex spatial patterns inherent in ECG data. Despite its lower classification performance compared to the 1D-CNN, the LSTM model’s efficiency in computation makes it a practical choice for scenarios with limited computational resources.
The CNN + Transformer model showed slightly better performance than the LSTM model in terms of both mean and standard deviation across the four evaluation metrics. However, its performance remained inferior to that of the 1D-CNN model. Specifically, the accuracy, F1-score, sensitivity, and specificity of the CNN + Transformer model were 92.26%(9.54%), 91.97%(10.11%), 91.39%(11.36%), and 93.12%(10.00%), respectively. The Transformer’s self-attention mechanism improved the model’s ability to capture long-range dependencies, but its complex architecture led to significantly longer computation times compared to the 1D-CNN. This suggests that while the CNN + Transformer model effectively captures global features, its computational efficiency is lower for ECG classification tasks.
In contrast, the 1D-CNN model achieved the highest performance across all metrics, with accuracy, sensitivity, specificity, and F1-score consistently around 98%. Additionally, it demonstrated superior computational efficiency, completing training and validation in considerably less time than the other models. These results underscore the 1D-CNN’s advantage in balancing low complexity with high efficiency.
Discussion
Practical applicability of the 1D-CNN model for hyperkalemia monitoring
In the literature, most studies on deep learning classification of hyperkalemia using ECG have focused on classification tasks utilizing standard twelve leads, selecting specific leads, or manually extracting features. Galloway et al.24 trained more than 1.5 million ECG signals from nearly 450,000 patients with chronic kidney disease in the U.S., using leads I, II, V3, V5, and I and II, each recording for 10 s. They trained two deep neural networks and achieved an AUC of 0.853–0.901, with high sensitivity around 90% but specificity between 55 and 65%. Lin et al.25, using standard 12-lead ECG data from 8,000 emergency department patients recorded for 2.5 s per lead, identified hyperkalemia with an 82-layer CNN, achieving an AUC of 0.958, a sensitivity of 83.3%, and a specificity of 97.8%. Chiu et al.31 applied deep transfer learning to over 20,000 ECG recordings from critically ill patients, using leads I, II, and V. They extracted heartbeat data containing 120 samples centered on the R-wave. Initially, they constructed a generalized model using a 1D-CNN before performing individualized active transfer learning, which improved the AUC from 0.729 (0.24) to 0.945 (0.094) after personalized training. Urtnasan et al.40 classified twelve-lead ECG data from nearly 3,000 hyperkalemia patients in emergency medicine, with each ECG recording lasting 2 s. They used a 5-layer 1D-CNN for optimal lead screening and found that lead II signals had the highest performance among the twelve leads. Tzeng et al.41 ECG data from 56 normal and 41 hyperkalemia patients were used, extracting five features, such as T-wave volume, QRS duration, PR interval, and QT interval, from 12-lead ECGs. They achieved a sensitivity of 85% and a specificity of 79% using a K-means-based classifier.
Several studies have demonstrated the great potential of deep learning techniques for ECG in the application of non-invasive hyperkalemia screening. Our 1D-CNN model, characterized by its lightweight design and low computational requirements, is ideally suited for wearable devices, enabling continuous real-time monitoring of dialysis patients with CKD. The learning rate for the CNN model was set to 2.5 × 10 − 6, and the model was trained using 80 calendar elements per fold within a five-fold cross-validation framework, ensuring stability and consistency. The model’s multi-channel design effectively captures multi-frequency information. During the investigation of optimal convolutional branching, the single-channel model achieved an average accuracy of 89.00% (14.41%), which was lower than the 89.32% (8.33%) achieved by the Random Forest algorithm. This result underscores the importance of employing multiple convolutional channels in the CNN model.
Unlike traditional classification methods, our model processes ECG data through an end-to-end structure. For data input, we use a continuous sliding-window method, significantly simplifying the data processing flow and enabling real-time analysis of ECG data to provide immediate diagnostic information. This method outperforms manual feature extraction in terms of accuracy, F1-score, and sensitivity. Its efficient processing power and superior real-time performance make it ideal for clinical applications.
A key aspect of this study is the precise temporal correspondence achieved between blood potassium concentration measurements and ECG data acquisition. Unlike other studies, which often have intervals of 30 min to 4 h between these measurements, our approach ensures a precise match, significantly improving data consistency, labeling accuracy, and diagnostic precision. Given that our study population consists of hemodialysis patients with end-stage chronic kidney disease, it is crucial that the model’s ECG morphology closely matches the pre-dialysis state, necessitating timely dialysis intervention. Thus, fast response time in real-time monitoring is essential. We utilized a short window length of 1200 ms for ECG data classification, which reduces message length and enhances the model’s utility and response efficiency compared to the 2–10 s lengths used in previous studies.
The 1D-CNN model demonstrated superior classification performance from the dataset consisting of 33 CKD patients. Encouragingly, the model achieved an average accuracy of 98.25% (4.52%), with 31 of the subjects attaining an accuracy higher than 90%. The highest accuracy observed was 100%, and the lowest was 84.17%, indicating the model’s robustness across the majority of subjects. Regarding sensitivity, the model achieved a mean of 98.63% (2.37%), with 33 subjects exhibiting a sensitivity of 90% or more, and the highest sensitivity reaching 100%, and the lowest was 91.67%. This underscores the model’s superior reliability and consistency in identifying positive samples, such as high potassium status. Similarly, the model maintained high specificity, with a mean specificity of 97.88% (5.05%). Among the subjects, 31 subjects had a specificity of 90% or higher, with the highest specificity recorded at 100%, the lowest was 76.67%. This indicates the model’s excellent in correctly identifying negative samples. Additionally, the F1-scores further demonstrated the model’s balanced performance. The mean F1-score was 98.31% (3.26%), with 31 subjects achieving F1-scores above 90%. This demonstrates the model’s capability to effectively balance precision and recall, especially in the context of unbalanced datasets, thus ensuring stable and reliable classification outcomes.
Our results not only demonstrate the potential of deep learning for hyperkalemia monitoring but also confirm the robust performance of the proposed 1D-CNN model in classifying ECG data for subjects. The model consistently achieves high accuracy, sensitivity, and specificity, along with balanced F1-scores, highlighting its effectiveness and practicality in potential real-world applications. This performance provides strong support for the future integration of high-precision, low-complexity ECG monitoring in wearable devices.
Research limitations and outlook
While this study demonstrated strong performance in single-lead ECG classification, several limitations must be acknowledged. The limited sample size and significant individual differences in ECG morphology challenge the model’s ability to generalize effectively. Additionally, the absence of cross-subject modeling is a notable limitation, partly due to the variability introduced by factors such as electrode placement, skin resistance, and physiological differences, which affect signal consistency. Furthermore, the model was not validated using long-term dynamic monitoring data; the current findings rely on static data from individual dialysis sessions, making it difficult to evaluate the model’s real-time performance and stability across the per-dialysis process.
Future research should aim to overcome these challenges by increasing the sample size, incorporating data from multiple centers, and applying standardized signal preprocessing methods to reduce variability caused by device placement and individual differences. Validating the model with long-term dynamic data will also be critical for assessing its performance in real-world scenarios. Finally, exploring cross-subject modeling strategies and designing low-power, real-time algorithms will be key steps in enhancing the model’s practical applicability for wearable devices.
Conclusion
This study introduces a deep learning model for continuous monitoring of hyperkalemia in dialysis patients using single-lead ECG signals from a wearable device. This approach addresses the clinical need for non-invasive, versatile, and extended monitoring, surpassing the limitations of traditional 12-lead ECG systems. The model is designed with a 1200 ms input window and four parallel convolutional branches, delivering strong performance. It achieved an accuracy of 98.25% (4.25%), an average F1-score of 98.31% (3.26%), an average sensitivity of 99.63% (2.41%), and an average precision of 97.88% (5.13%). These results meet or exceed those of models using 12-lead ECG data while reducing computational complexity, making the model suitable for wearable devices and telemedicine applications. This research provides a foundation for developing wearable monitoring systems. Future work will focus on expanding the dataset and exploring practical applications to optimize performance. The development of medical wearables could significantly enhance patient comfort and health outcomes.
Data availability
The data comes from the platform of West China Big Data Center of Sichuan University and is not open to the public. It is necessary to reach an agreement with the West China Big Data Center for use. Please contact the corresponding author.
Change history
11 April 2025
A Correction to this paper has been published: https://doi.org/10.1038/s41598-025-95423-x
Abbreviations
- CKD:
-
Chronic kidney disease
- ECG:
-
Electrocardiogram
- CNN:
-
Convolutional neural network
- ESRD:
-
End-stage renal disease
- SVM:
-
Support vector machines
- RF:
-
Random forests
- LDA:
-
Linear discriminant analysis
- NB:
-
Naive bayes
- TP:
-
True positive
- FP:
-
False positive
- TN:
-
True negative
- FN:
-
False negative
References
Francis, A. et al. Chronic kidney disease and the global public health agenda: an international consensus, (in eng). Nat. Rev. Nephrol. 20 (7), 473–485. https://doi.org/10.1038/s41581-024-00820-6 (2024).
Global Regional, and national burden of chronic kidney disease, 1990–2017: a systematic analysis for the global burden of Disease Study 2017. Lancet, 395(10225), 709–733, Feb 29 2020, https://doi.org/10.1016/s0140-6736(20)30045-3
Provenzano, M. et al. Competing-risk analysis of death and end stage kidney disease by Hyperkalaemia Status in Non-dialysis chronic kidney disease patients receiving stable Nephrology Care. J. Clin. Med. 7 (12). https://doi.org/10.3390/jcm7120499 (2018).
Fishbane, S. et al. Consensus-based recommendations for the management of Hyperkalemia in the hemodialysis setting. J. Ren. Nutr. 32 (4), e1–e14. https://doi.org/10.1053/j.jrn.2021.06.003 (2022).
Collins, A. J. et al. Association of Serum Potassium with all-cause mortality in patients with and without heart failure, chronic kidney Disease, and/or diabetes. Am. J. Nephrol. 46 (3), 213–221. https://doi.org/10.1159/000479802 (2017).
Bianchi, S. & Regolisti, G. Pivotal clinical trials, meta-analyses and current guidelines in the treatment of hyperkalemia, (in eng). Nephrol. Dial Transpl. 34 (Suppl 3), iii51–iii61. https://doi.org/10.1093/ndt/gfz213 (2019).
Natale, P., Palmer, S. C., Ruospo, M., Saglimbene, V. M. & Strippoli, G. F. Potassium binders for chronic hyperkalaemia in people with chronic kidney disease. Cochrane Database Syst. Rev. 6 (6). https://doi.org/10.1002/14651858.CD013165.pub2 (Cd013165, 2020).
Beccari, M. V. & Meaney, C. J. Clinical utility of patiromer, sodium zirconium cyclosilicate, and sodium polystyrene sulfonate for the treatment of hyperkalemia: an evidence-based review. Core Evid. 12, 11–24. https://doi.org/10.2147/ce.S129555 (2017).
Lindner, G. et al. Acute hyperkalemia in the emergency department: a summary from a kidney disease: improving global outcomes conference. Eur. J. Emerg. Med. 27 (5), 329–337. https://doi.org/10.1097/mej.0000000000000691 (2020). (in eng).
Brunelli, S. M., Du Mond, C., Oestreicher, N., Rakov, V. & Spiegel, D. M. Serum potassium and short-term clinical outcomes among hemodialysis patients: impact of the long interdialytic interval. Am. J. Kidney Dis. 70 (1), 21–29 (2017).
Littmann, L. & Gibbs, M. A. Electrocardiographic manifestations of severe hyperkalemia. J. Electrocardiol. 51 (5), 814–817. https://doi.org/10.1016/j.jelectrocard.2018.06.018 (2018).
Weiss, J. N., Qu, Z. & Shivkumar, K. Electrophysiology of hypokalemia and hyperkalemia. Circulation: Arrhythmia Electrophysiol., 10(3), e004667, (2017).
Bergquist, J. A. et al. Comparison of Machine Learning Detection of Low Left Ventricular Ejection Fraction Using Individual ECG Leads, in 2023 Computing in Cardiology (CinC), 1–4 Oct. 2023 2023, vol. 50, pp. 1–4. https://doi.org/10.22489/CinC.2023.047
Cai, Z. et al. How Accurate are ECG Parameters from Wearable Single-lead ECG System for 24-hours Monitoring, in 2019 Computing in Cardiology (CinC), 8–11 Sept. pp. Page 1-Page 4, (2019). 2019 https://doi.org/10.22489/CinC.2019.187
Ma, C. et al. Deep Learning-Based Signal Quality Assessment in Wearable ECG Monitoring, in 2023 Computing in Cardiology (CinC), 1–4 Oct. 2023 2023, vol. 50, pp. 1–4. https://doi.org/10.22489/CinC.2023.017
Sakhavi, S., Guan, C. T. & Yan, S. C. Learning temporal information for brain-computer interface using Convolutional neural networks, (in English). Ieee Trans. Neural Networks Learn. Syst. 29 (11), 5619–5629. https://doi.org/10.1109/tnnls.2018.2789927 (2018).
Tsiouris, K. M. et al. A long short-term memory deep learning network for the prediction of epileptic seizures using EEG signals. Comput. Biol. Med. 99, 24–37. https://doi.org/10.1016/j.compbiomed.2018.05.019 (2018).
Chambon, S., Galtier, M. N., Arnal, P. J., Wainrib, G. & Gramfort, A. A Deep Learning Architecture for temporal sleep stage classification using Multivariate and Multimodal Time Series, (in English). IEEE Trans. Neural Syst. Rehabil. Eng. 26 (4), 758–769. https://doi.org/10.1109/tnsre.2018.2813138 (2018).
Yıldırım, Ö., Pławiak, P., Tan, R. S. & Acharya, U. R. Arrhythmia detection using deep convolutional neural network with long duration ECG signals. Comput. Biol. Med. 102, 411–420. https://doi.org/10.1016/j.compbiomed.2018.09.009 (2018).
Madan, P. et al. A Hybrid Deep Learning Approach for ECG-Based arrhythmia classification. Bioeng. (Basel). 9 (4). https://doi.org/10.3390/bioengineering9040152 (2022).
Jamil, S. & Rahman, M. Deep-learning-based Framework for the classification of Cardiac Arrhythmia, (in eng). J. Imaging. 8 (3). https://doi.org/10.3390/jimaging8030070 (2022).
Fan, X. et al. Multiscaled Fusion of Deep Convolutional neural networks for Screening Atrial Fibrillation from single lead short ECG recordings. IEEE J. Biomedical Health Inf. 22 (6), 1744–1753. https://doi.org/10.1109/JBHI.2018.2858789 (2018).
Pourbabaee, B., Roshtkhari, M. J. & Khorasani, K. Deep convolutional neural networks and learning ECG features for screening paroxysmal atrial fibrillation patients. IEEE Transact Syst. Man. Cybernet Syst. 48 (12), 2095–2104. https://doi.org/10.1109/TSMC.2017.2705582 (2018).
Galloway, C. D. et al. Development and validation of a deep-learning model to screen for Hyperkalemia from the Electrocardiogram. JAMA Cardiol. 4 (5), 428–436. https://doi.org/10.1001/jamacardio.2019.0640 (2019).
Lin, C. S. et al. A deep-learning algorithm (ECG12Net) for detecting hypokalemia and Hyperkalemia by Electrocardiography: Algorithm Development. JMIR Med. Inf. 8 (3). https://doi.org/10.2196/15931 (e15931, 2020).
Wang, C. X. et al. Development and validation of a deep learning model to screen hypokalemia from electrocardiogram in emergency patients. Chin. Med. J. 134 (19), 2333–2339 (2021).
Bukhari, H. A. et al. QRS Slopes for Potassium and Calcium Monitoring in End-Stage Renal Disease Patients, in 2021 Computing in Cardiology (CinC), 13–15 Sept. 2021 2021, vol. 48, pp. 1–4. https://doi.org/10.23919/CinC53138.2021.9662720
Severi, S., Corsi, C., Haigney, M., DeBie, J. & Mortara, D. Noninvasive potassium measurements from ECG analysis during hemodialysis sessions, in 36th Annual Computers in Cardiology Conference (CinC), 13–16 Sept. 2009 2009, pp. 821–824. (2009).
Pilia, N., Mesa, M. H., Dössel, O. & Loewe, A. ECG-based Estimation of Potassium and Calcium Concentrations: Proof of Concept with Simulated Data, in 41st Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), 23–27 July 2019 2019, pp. 2610–2613, (2019). https://doi.org/10.1109/EMBC.2019.8857634
Wang, Y. et al. Intelligent Detection of Hypokalemia Based on 12-Lead ECG Using Two-stream Deep Learning Model, in 2022 15th International Congress on Image and Signal Processing, BioMedical Engineering and Informatics (CISP-BMEI), 5–7 Nov. 2022 2022, pp. 1–6. https://doi.org/10.1109/CISP-BMEI56279.2022.9980196
Chiu, I. M. et al. Using deep transfer learning to Detect Hyperkalemia from Ambulatory Electrocardiogram monitors in Intensive Care units: Personalized Medicine Approach. J. Med. Internet Res. 24 (12). https://doi.org/10.2196/41163 (e41163, 2022).
Wu, Y., Xia, M., Wang, X. & Zhang, Y. Schizophrenia Detection Based on EEG Using Recurrent Auto-encoder Framework (Neural Information Processing: 29th International Conference, ICONIP 2022, Virtual Event, Proceedings. Lecture Notes in Computer Science). pp. 62–73. (2023).@@@
Greff, K., Srivastava, R. K., Koutník, J., Steunebrink, B. R. & Schmidhuber, J. LSTM: A search space odyssey, IEEE Transact. Neural Netw. Learn. Syst., 28(10), 2222–2232, (2017). https://doi.org/10.1109/TNNLS.2016.2582924
Karim, F., Majumdar, S., Darabi, H. & Chen, S. LSTM fully convolutional networks for time series classification. IEEE Access. 6, 1662–1669. https://doi.org/10.1109/ACCESS.2017.2779939 (2018).
Chauhan, S. & Vig, L. Anomaly detection in ECG time signals via deep long short-term memory networks, in IEEE International Conference on Data Science and Advanced Analytics (DSAA), 19–21 Oct. 2015 2015, pp. 1–7, (2015). https://doi.org/10.1109/DSAA.2015.7344872
Katikala, U. S. & Ranjith, R. Detecting anomaly in ECG signal using time series forecast approach, in International Conference on Computing, Communication, and Intelligent Systems (ICCCIS), 3–4 Nov. 2023 2023, 323–328, (2023). https://doi.org/10.1109/ICCCIS60361.2023.10425516
Li, C. et al. TFFormer: A time–frequency information fusion-based CNN-transformer model for OSA detection with single-lead ECG. IEEE Trans. Instrum. Meas. 72, 1–17. https://doi.org/10.1109/TIM.2023.3312472 (2023).
Vaswani, A. Attention is all you need. Adv. Neural. Inf. Process. Syst., (2017).
Shin, A. H., Kim, S. T. & Park, G. M. Time series anomaly detection using transformer-based GAN with two-step masking. IEEE Access. 11, 74035–74047. https://doi.org/10.1109/ACCESS.2023.3289921 (2023).
Urtnasan, E. et al. Noninvasive screening tool for hyperkalemia using a single-lead electrocardiogram and deep learning: Development and usability study. JMIR Med. Inf. 10 (6). https://doi.org/10.2196/34724 (e34724, 2022).
Tzeng, W. C., Chan, Y. Z. & Hsieh, J. C. Predicting hyperkalemia by the use of a 12-lead temporal-spatial electrocardiograph: clinical evaluations and model simulations, in Computers in Cardiology, 2005, (pp. 215–218). https://doi.org/10.1109/CIC.2005.1588075
Acknowledgements
Not applicable.
Funding
This work was supported by a 1.3.5 project for disciplines of excellence from West China Hospital (#ZYYC22001) and an NSERC Discovery Grant (#RGPIN-04137-2016), and the Key Research Project Grant form the National Clinical Research Center for Geriatrics (#Z2023YY001).
Author information
Authors and Affiliations
Contributions
Conceptualization, H.J.S., S.B.Y., N.J., and X.X.Z.; methodology, H.J.S., S.B.Y., M.M., X.X.Z., and N.J.; data analysis, H.J.S, Y.H.W. and X.L.; investigation, H.J.S., S.B.Y., N.J., and X.X.Z.; resources, S.B.Y., J.Y.H., N.J., and X.X.Z.; data curation, H.J.S., S.B.Y., and Y.H.W.; original draft preparation, H.J.S. and NJ; review and editing, H.J.S., S.B.Y., N.J., J.Y.H., and X.X.Z.; supervision, N.J., J.Y.H., M.M., and X.X.Z.; project administration, N.J., J.Y.H., and X.X.Z; funding acquisition, M.M, X.X.Z., J.Y.H., and N.J. All authors have read and agreed to the published version of the manuscript.
Corresponding authors
Ethics declarations
Competing interests
The authors declare no competing interests.
Ethics approval and consent to participate
The study received approval from the Biomedical Research Ethics Committee of West China Hospital of Sichuan University (NO.2022 − 1843).
Consent for publication
Not applicable.
Additional information
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
The original online version of this Article was revised: In the original version of this Article, Xiaoxi Zeng and Ning Jiang were omitted as co-corresponding authors. Correspondence and requests for materials should also be addressed to zengxiaoxi@wchscu.cn and jiangning21@wchscu.cn.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
About this article
Cite this article
Shang, H., Yu, S., Wu, Y. et al. A noninvasive hyperkalemia monitoring system for dialysis patients based on a 1D-CNN model and single-lead ECG from wearable devices. Sci Rep 15, 2950 (2025). https://doi.org/10.1038/s41598-025-85722-8
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41598-025-85722-8