REAFEL – Contextual ECG Monitoring and Atrial Fibrillation Detection in Cardiology

Chronic heart related diseases are a major public health issue and is the leading cause of death and hospitalization for people 65+ years. The goal of the “Reaching the Frail Elderly Patient for Optimizing Diagnosis of Atrial Fibrillation” (REAFEL) project was to design a patient-centric home-monitoring platform for early detection of cardiac rhythm disorders. This would allow for timely intervention and prevention of serious conditions such as stroke and repeated falls.


Globally, cardiovascular diseases (CVD) are the most prevailing diseases causing 17.9 million deaths (nearly 31% of all global deaths) in the year 2016 alone. Amongst cardiovascular diseases (CVD), cardiac arrhythmias are widespread and affect over four million people in the United States, costing up to $67.7 billion annually. Cardiac arrhythmias such as atrial fibrillation (AF) and Atrial Flutter are the most common causes of heart failure, hospitalization, thromboembolic events, and death. Nearly 30% of patients with atrial fibrillation (AF) are unaware of their diagnosis. Therefore, early diagnosis and treatment of such arrhythmias is important to provide timely healthcare and prevent life threatening conditions. Moreover, CVD are chronic diseases, and the provision of chronic care in CVD patients does not reach quality standards in about 50% of cases, which has significant consequences for both patients and society. To meet the demand for high-quality care based on evidence-based principles, organizational care models such as the Chronic Care Model (CCM) have been proposed. Ambulatory technology for continuous CVD monitoring is seen as an essential means for improving chronic care outcome.

We have been addressing these challenges in cardiology as part of the “Reaching the Frail Elderly Patient for Optimizing Diagnosis of Atrial Fibrillation” (REAFEL) project, which had two aims. 

  • To research, design, and implement a telemedicine sensor platform that enables for remote monitoring of patients, providing automated alerts and reminders to the patient and clinicians.
  • To reorganize and improve the diagnostic process of heart rhythm disorders in frail elderly patients by using this telemedicine setup. Timely diagnosis may prevent repeated falls with adequate pacemaker treatment and medical adjustments.

I was mainly responsible and involved in the first part, which resulted in three main results:

  • The mCardia system for ambulatory monitoring of physiological, behavioural, and patient-reported data.
  • The collection of the CACHET-CADB which is a unique dataset of contextual ECG data.
  • Design and performance evaluation of the DeepAware deep learning algorithm for detection of atrial fibrillation (AF) based on the collected data.

Most of these results have been published and this page provides an overview.

mCardia – Ambulatory Collection of Contextual ECG Data

mCardia [1] is a context-aware ECG collection system designed to be used under free-living conditions. In contrast to conventional ECG monitoring, mCardia provides means to collect contextual information such as activities, sleep quantity and quality, body position (sleeping left/right/supine), patient-reported abnormal events (e.g., dizziness, palpitation) and their duration, food intake, and maps them with the raw ECG recordings (see Figure 1). This contextual information can help cardiologists reducing misinterpretation and misclassification of events due to many confounding artifacts when assessing long-term ECG data for arrhythmia screening. In addition, these contextual features associated with the raw ECG data can be utilized as input to machine-learning algorithms for reducing the number of false positives in automatic arrhythmia analysis of ambulatory ECG. Ultimately, mCardia can improve doctor and patient communication in a chronic care model.

Figure 1 – Schematic diagram of mCardia. The ECG device collect raw ECG in combination with a set of other physiological signals (HR, HRV, etc.). Behavioral and contextual data is collected from both the ECG device and the phone. All data is transmitted from the phone to the CACHET Research Platform (CARP), which is a cloud-based data management system. From [1].


The design of the mCardia system followed a user-centered design (UCD) approach and applied the patient-clinician-designer (PCD) framework [2]. This research method seeks to find a good design compromise by considering different, and sometimes conflicting, concerns from the perspective of three stakeholder groups; the patient, the clinician, and the designer. In total, the design activities spanned 16 months and involved 14 participants; 6 patients, 4 clinicians (3 cardiologists (MD) and 1 nurse), and 4 designers.

The mCardia landing page and event details page are shown in Figure 2. The mCardia landing page shows a detailed 24-hour view of the main physiological data of HR, HRV and MET (metabolic level) derived from the ECG recordings. This view was designed in cooperation with the users and was very well received during our subsequent studies.

Figure 2 – The UI design of the mCardia home page and event details page. The main UI element is the “wheel” which shows the detailed recordings of HR, HRV, and MET level in a 24-hour clock.

Table 1 shows the list of data being collected.


We used the Movisens EcgMove4 device for collection of physiological and some behavioral data. The EcgMove4 device is capable of recording continuous ambulatory ECG with adhesive electrodes or a dry electrode textile chest belt; hence, avoiding the need for cables. In addition, it has on-board 3D accelerometer, gyroscope, barometric air pressure, and temperature sensors. Table 1 lists all the data types provided by the sensors, along with their sampling frequencies.

The mCardia app was implemented using Flutter but was only available for Android since the Movisens device only integrates to Android. mCardia was implemented using the CACHET Research Platform (CARP) and make use of most CARP components, including:

All data is uploaded and managed in the CARP Web Service cloud infrastructure hosted by CACHET. Table 1 shows the list of all data being collected.

Table 1 – Data Features Collected in mCardia with Source and Sampling Rate. From [1].

Feasibility Study

Adhering to the best practices in health technology design research, a single- arm feasibility study of mCardia was carried out to obtain a comprehensive understanding of its usability and feasibility under free-living conditions. We applied the CACHET Unified Methodology for Assessment of Clinical Feasibility (CUMACF) method [4]. Specifically, the following three aspects of mCardia system were investigated:

  • Usability evaluation, which includes perceived user engagement, usefulness, and usability of mCardia in longitudinal ECG data collection.
  • Technical robustness and feasibility of mCardia.
  • Clinical usefulness of contextual data in the arrhythmia screening process.
Feasibility study in India. mCardia was used by 12 Indian patients as part of a 2-week study in close collaboration with Mahatma Gandhi University of Medical Sciences & Technology, Jaipur.

Participants were recruited from Denmark and India and the usability and technical feasibility study of mCardia was based on the data collected from 24 participants (8 females, 16 males, the average age of M = 58.79, SD = 10.11) over two weeks.

Figure 3 – Perceived usefulness and usability of mCardia. The list of CUMACF questionnaire (Q1–Q19) is provided in Appendix A [1].

The study results were very positive. As shown in Figure 3, mCardia received very high usability scores and as shown in Figure 4, the so-called “data yield” (i.e., the degree of data collection compared to what is maximally possible) is very high. Much more details – including qualitative data from user interviews – are available in the mCardia paper [1].

Figure 4 – Data collection yield per participant. From [1].

CACHET-CADB – Contextual ECG Dataset

State-of-the-art algorithms for AF detection is typically trained and evaluated using clinical-grade ECG recordings, which are available as public datasets for example in PhysioNet. These include the MIT-BIH AF Database ( AFDB) and MIT-BIH Arrhythmia Database (MITDB).

However, arrhythmia detection algorithms trained on existing public arrhythmia databases show higher false-positive rate (FPR ) when applied to ambulatory ECG recordings, as we are doing in mCardia. It is primarily because the existing public databases are relatively clean as they are recorded using clinical-grade ECG devices in controlled clinical environments. They may not represent the signal quality and artifacts present in ambulatory patient-operated ECG.

To help build and evaluate arrhythmia detection algorithms that can work on ambulatory wearable ECG, we collected and published the CACHET Contextualised Arrhythmia Database (CACHET-CADB) as a multi-site contextualized ECG dataset collected under free-living conditions. Subsequently, a subset of this data was annotated for “ground truth” by a group of cardiologists. Figure 5 shows an overview of the collection and annotation process.

Figure 5 – Data collection and annotation workflow of the CACHET-CADB dataset.

In addition to the ECG recordings, CACHET-CADB also provides the continuous recording of patients’ contextual data such as activities, body positions, movement accelerations, symptoms, stress level, and sleep quality – as shown in Table 1. This contextual data can aid in improving the machine learning-based automated arrhythmia detection algorithms on patient-operated wearable ECG.

Currently, CACHET-CADB has 259 days of contextualized ECG recordings from 24 patients and 1602 manually annotated 10-seconds heart-rhythm segments. Furthermore, an open-source software toolkit for the use of the CACHET-CADB is also provided. This toolkit is written in Python and enables easy access to the CACHET-CADB dataset in machine learning projects.

CACHET-CADB is rather unique since it is one of the first ECG dataset which is (i) collected under free-living conditions (ambulatory), and (ii) contains additional contextual data. It is our hope that by sharing this dataset and the Python toolkit that more machine learning effort will also address cardiac disease detection and prediction under ambulatory conditions.

DeepAware – Deep Learning Model for Atrial Fibrillation Detection

Atrial fibrillation (AF) is one of the most prevalent cardiac arrhythmias, that is considered as a leading cause of stroke and other heart-related complications in elderly population. Early diagnosis and anti-coagulation medication can help in preventing AF complications and ECG analysis is one of the most inexpensive and non-invasive ways for early detection of AF. However, due to its abrupt and paroxysmal nature, it is challenging to detect AF during infrequent and short-term in-hospital checkups. Therefore, there is a great need for enabling longitudinal ambulatory screening and monitoring as a part of the patient’s everyday life outside the clinic. 

Over the past two decades, several algorithms have been introduced, which can automatically detect AF from ECG recordings. Most of these algorithms are based on classical machine learning (ML) and feature engineering techniques (e.g., temporal intervals, wavelet transform, etc.). More recently a number of end-to-end deep learning (DL) models have been introduced for AF detection, which basically bypass the handcrafted feature engineering step needed by other machine learning methods and show very good results. In the REAFEL project, we have proposed a DL method for AF detection called the DENS-ECG method [5, 6]. This model achieved a sensitivity and specificity of 98.98% and 96.95%, respectively. Additionally, the proposed model was found to be computationally efficient and it was capable of analyzing 24 hours of ECG recordings in less than one second [5].

However, almost all of the existing studies – including our own DENS-ECG model – are designed and trained on clinical-grade ECG datasets (like the AFDB and MITDB mentioned above) and little evidence exists on how they perform on data collected under ambulatory, free-living conditions.

But since we have collected contextual ECG under ambulatory free living conditions in the CACHET-CADB, we have been able to investigate two research questions:

  1. How well does state-of-the-art (DL) methods for AF detection perform in free-living ambulatory conditions?
  2. Can we improve the performance of AF detection methods use in an ambulatory setting by utilizing the additional contextual information?

Performance of AF Detection Methods in Ambulatory Settings

In the first study [7], we took our existing DL method (which have shown a 99% accuracy) and ran it on the ambulatory ECG data in the CACHET-CADB dataset. As illustrated in Figure 6, this resulted in the identification of 41,648 “segments” in the ECG recordings having an AF. All of these segments where subsequently reviewed by a group of biomedical engineers and cardiologist in order to verify them.

Figure 6 – Overview of distribution of false positives (FP) and true positives (TP) of the detected AF segments based on the review process by biomendical engineers and cardiologists in a two-step process. From [7].

This analysis reveals a huge number of non-trivial false positives – actually only 747 out of the 41,648 segments were true AF episodes and 98% of all segments marked by the algorithm to be AF were false positives. Hence;

… in essence the existing algorithms were useless when used on ambulatory recordings.

The analysis, however, also revealed two interesting aspects of the false positives. First, 62% of the segments marked as AF by the model were less than 50 seconds in length. Hence, the duration of a detection AF seems to be important to take into consideration. Second, 78% of all the false positives were associated with three specific contextual events; (1) change in activity, (2) change in body position (especially during the night), and (3) sudden movement acceleration. Therefore, it seems like utilizing information about the context of the user during the collections of the ECG recordings might help improve the performance of the AF detection method.

Improving the Performance of AF Detection Methods by Utilizing Contextual Information

To reduce the huge 98% false positive rate above and to improve AF detection on ambulatory ECG recordings, we have proposed the DeepAware algorithm [8]. DeepAware is a hybrid multi-fusion and end-to-end AF detection model. The model combines two of our previous algorithms as sub-model [5, 6] and combines them with a new context-aware heuristics model that analyzes and includes the patients’ ambulatory contextual data into the model.

Figure 7 – The architecture of the proposed DeepAware model consists of six sub-components: (1) ECG data pre-processing, (2) segmentation, (3) the RR-Net, which take inputs of the RR interval series, (4) the DENS-ECG, which takes the raw ECG inputs and gives P-wave count, (5) and a CAH model, which takes user context in a case of ambulatory ECG to check if any change in user’s context is detected, and (6) AF decision box for final binary output. From [8].

Figure 7 illustrates the flowchart of the proposed DeepAware algorithm. It comprises of six main components: (1) ECG data preprocessing, (2) segmentation, (3) RR-Net, (4) DENS-ECG, (5) the context-aware heuristic model, and (6) the AF decision box. In the paper, all these six components are described in detail.

In order to evaluate the DeepAware model, we ran a couple of studies.

In the first study, we compared the performance of DeepAware on public datasets and its comparison with the literature. This was done by comparing the performance of DeepAware compared to state-of-the-art methods applied on the AFDB and MITDB. Figure 8 shows the confusion matrices of the DeepAware model on AFDB and MITDB datasets, respectively. This shows that DeepAware performs at par with – or even better than – the state-of-the-art algorithms on the AFDB dataset (Figure8a). Furthermore, when evaluated on unseen data from the MITDB dataset, it seems to be generalized enough to perform well also on unknown data (Figure 8b). Compared to the results presented in Andersen et al. [5] on the MITDB dataset, DeepAware improves the specificity and accuracy by 5.63% and 4.42%, respectively, at the cost of 5.91% reduction in sensitivity. 

Figure 8 – Confusion matrix of the performance DeepAware on clinical datasets: (a) AFDB and (b) MITDB. From [8].

In the second study, we investigated the performance of DeepAware on the contextualised CACHET-CADB dataset. The analysis showed that DeepAware achieved a sensitivity, specificity, and accuracy of 97.94%, 98.39%, 98.06% on the CACHET-CADB dataset, respectively. Figure 9 shows the confusion matrix of the performance of DeepAware when applied on the CACHET-CADB dataset.

Figure 9 – Confusion matrix of the performance DeepAware on the CACHET-CADB. From [8].

The paper contains a lot of details and further analysis of the performance of DeepAware – both on existing clinical datasets as well as on the CACHET-CADB contextualized, ambulatory dataset. But the core conclusions based on our work is that;

… existing AF detection models and methods which are developed and trained on clinical ECG datasets do not translate well to ambulatory settings.

.. the DeepAware algorithm presents a deep-learning-based model that take into consideration the contextual features of ambulatory ECG recording and performs with a very high level of accuracy of 98%.


The REAFEL project has resultet in a set of significant technological contribution in the design and validation of ambulatory ECG monitoring (the mCardia system) and automated AF detection (the DeepAware algorithm). This provides the basis for the design and implementation of a telemedicine sensor platform that enables remote monitoring of patients, which can provide automated alerts and reminders to the patient and clinicians.

The clinical part of the REAFEL project has also been investigating how to reorganize and improve the diagnostic process of heart rhythm disorders in frail elderly patients by using this telemedicine setup. This is, however, not reported here.

The REAFEL project has now received further funding from the Innovation Fund Denmark as part of the CATCH project. The technological goals of this project is to further develop the mCardia and DeepAware technology and integrate it as part of the Cortrium platform.


The REAFEL project was funded by the Innovation Fund Denmark.



[1] [pdf] [doi] D. Kumar, R. Maharjan, A. Maxhuni, H. Dominguez, A. Frølich, and J. E. Bardram, “mCardia: A Context-Aware ECG Collection System for Ambulatory Arrhythmia Screening,” ACM Transactions on Computing for Healthcare (HEALTH), vol. 3, iss. 2, p. 1–28, 2022.
title={mCardia: A Context-Aware ECG Collection System for Ambulatory Arrhythmia Screening},
author={Kumar, Devender and Maharjan, Raju and Maxhuni, Alban and Dominguez, Helena and Frølich, Anne and Bardram, Jakob E},
journal={ACM Transactions on Computing for Healthcare (HEALTH)},
publisher={ACM New York, NY}
[2] [pdf] G. Marcu, J. E. Bardram, and S. Gabrielli, “A Framework for Overcoming Challenges in Designing Persuasive Monitoring Systems for Mental Illness,” in Proceedings of Pervasive Health 2011, 2011, p. 1–10.
author = {Marcu, G. and Bardram, J. E. and Gabrielli, S},
title = {A Framework for Overcoming Challenges in Designing Persuasive Monitoring Systems for Mental Illness},
booktitle = {Proceedings of Pervasive Health 2011},
location = {Dublin, Ireland},
year = {2011},
pages = {1--10},
publisher = {IEEE Press},
[3] [pdf] J. E. Bardram, “The CARP Mobile Sensing Framework–A Cross-platform, Reactive, Programming Framework and Runtime Environment for Digital Phenotyping,” arXiv preprint arXiv:2006.11904, 2020.
title={The CARP Mobile Sensing Framework--A Cross-platform, Reactive, Programming Framework and Runtime Environment for Digital Phenotyping},
author={Bardram, Jakob E},
journal={arXiv preprint arXiv:2006.11904},
arxivId = {cs.HC/2006.11904},
[4] [pdf] J. E. Bardram, “Evaluating Personalized Pervasive Health Technology – But How?,” IEEE Pervasive Computing, vol. 19, iss. 3, pp. 37-44, 2020.
author={Jakob Eyvind Bardram},
journal={IEEE Pervasive Computing},
title={Evaluating Personalized Pervasive Health Technology - But How?},
[5] [doi] R. S. Andersen, A. Peimankar, and S. Puthusserypady, “A deep learning approach for real-time detection of atrial fibrillation,” Expert Systems with Applications, vol. 115, p. 465–473, 2019.
title={A deep learning approach for real-time detection of atrial fibrillation},
author={Andersen, Rasmus S and Peimankar, Abdolrahman and Puthusserypady, Sadasivan},
journal={Expert Systems with Applications},
url = {},
doi = {},
[6] [doi] A. Peimankar and S. Puthusserypady, “DENS-ECG: A deep learning approach for ECG signal delineation,” Expert systems with applications, vol. 165, p. 113911, 2021.
title={DENS-ECG: A deep learning approach for ECG signal delineation},
author={Peimankar, Abdolrahman and Puthusserypady, Sadasivan},
journal={Expert systems with applications},
[7] D. Kumar, S. Puthusserypady, H. Domínguez, K. Sharma, and J. E. Bardram, “An investigation of the contextual distribution of false positives in a deep learning-based atrial fibrillation detection algorithm,” Expert Systems with Applications, vol. In Press, 2022.
title = {An investigation of the contextual distribution of false positives in a deep learning-based atrial fibrillation detection algorithm},
journal={Expert Systems with Applications},
volume={In Press},
year = {2022},
author = {Devender Kumar and Sadasivan Puthusserypady and Helena Domínguez and Kamal Sharma and Jakob E. Bardram},
[8] [pdf] [doi] D. Kumar, A. Peimankar, K. Sharma, H. Domínguez, S. Puthusserypady, and J. E. Bardram, “DeepAware: A hybrid deep learning and context-aware heuristics-based model for atrial fibrillation detection,” Computer Methods and Programs in Biomedicine, vol. 221, p. 106899, 2022.
title = {DeepAware: A hybrid deep learning and context-aware heuristics-based model for atrial fibrillation detection},
journal = {Computer Methods and Programs in Biomedicine},
volume = {221},
pages = {106899},
year = {2022},
issn = {0169-2607},
doi = {},
url = {},
author = {Devender Kumar and Abdolrahman Peimankar and Kamal Sharma and Helena Domínguez and Sadasivan Puthusserypady and Jakob E. Bardram},

Leave a Reply

Your email address will not be published.