# Detection of Arrhythmias Using Heart Rate Signals from Smartwatches
## 3 Materials and Methods  
### Arrhythmia Data Set Collection  
For our work, two data sets were collected: one for training and testing the model (the \"arrhythmia data set\") and another for model validation (the \"validation data set\") Both data sets were implemented based on solid clinical work for patient differentiation and obtaining statistics.  
For the \"arrhythmia data set\", the cardiologist on our team was in charge of enrolling 252 patients over 20 years of age, including 184 patients with a normal diagnosis and 68 with arrhythmia. Then, three-channel Holter ECG monitors (model TLC9803, CONTEC, Melbourne, FL, USA) were installed on the patients for 24 h and typical reports were extracted. Initially, the data were tabulated in a spreadsheet with 24 characteristics, including the expanded diagnosis and the final diagnosis, patient data, heart rate, variability, and type of arrhythmia. The data set was generated from these data, extracting only characteristics that can be obtained using a smartwatch.  
In the case of the \"validation data set\", the cardiologist and our research team enrolled 25 patients, including 12 patients with a normal diagnosis and 13 patients with previously diagnosed arrhythmia (labeled). The smartwatches, which were Samsung Galaxy Watch 4 models, were installed for 20 h and the heart rates of each patient were extracted. These data were tabulated in the spreadsheet, and the statistics of each patient were calculated, including the minimum, maximum, and average heart rates.  
Both data sets are available via GitHub at [[https://github.com/hhuillcen/HRArhythmiaDetection](https://github.com/hhuillcen/HRArhythmiaDetection)]([https://github.com/hhuillcen/HRArhythmiaDetection](https://github.com/hhuillcen/HRArhythmiaDetection)) (accessed 20 June 2024), and they contain the following characteristics:  
1. Age;
2. Sex;
3. Minimum heart rate;
4. Maximum heart rate;
5. Average heart rate;
6. Diagnosis.  
These features are the only ones that can be extracted in a scenario in which a patient was a smartwatch. The user knows their age and sex, and the smartwatch provides heart rates continuously for 20 h in 1-second intervals. It is challenging to conduct adequate arrhythmia detection with only these features.  
The reason for extracting data from smartwatches for only 20 h was a technical issue. Smartwatches operating in standard mode consume more power; mainly when their sensor use increases and when patients use them for other purposes. Therefore, according to our study, the appropriate time to carry out tests to guarantee correct data capture and downloading was defined as 20 h given that, when tests were conducted over 24 h, not all watches had the power to support the entire capture and download process.  
To extract heart rate data from the smartwatches, an application called \"MiCardio\" was constructed, which was developed in the Android environment using the Java programming language and uses the heart rate sensors provided in Samsung Galaxy 4 smartwatches (Samsung, Suwon, Republic of Korea). After capturing data for 20 h, the data were stored in the cloud and subsequently extracted in CSV format. The recommendations of the proposed general structure of healthcare applications for smartwatches on Wear OS were followed [46].  
The capture process begins with installing \"MiCardio\" on the smartwatch. When the application is started, a welcome screen and a menu showing the type of data that can be captured are displayed. Finally, the capture start button is displayed (see Figure 1).