# Anomaly Detection in Elderly Health Monitoring via IoT for Timely Interventions
## 4 Discussion
According to the literature, the anomaly corresponds to exceedances of the values considered normal. The methodology used for generating synthetic data is as follows:  
For each of the six datasets, 99% of records were generated to comply with the standard limits for all parameters:  
* AR has values between 60 and 100 bpm;
* mR has a lower value than AR but above 60 bpm;
* MR has a value greater than AR but less than 100 bpm;
* S--between 6000 and 9000;
* DST--between 20 and 120 min;
* SST--between 240 and 300 min. To simulate atypical situations, 1% of records were generated with values that exceeded the normal limits in the literature. In each case, only one column was modified. In this way, a single anomaly is reflected by generating values outside the normal range. The standard and abnormal records were randomly mixed to prevent artificial grouping of the data. This ensures that the model learns a realistic distribution of the data. This approach also prevents the model from learning the positions of anomalies. Finally, the six datasets, each file containing 1000 rows, were saved in text format and used to validate the HADA. Figure 14 presents the accuracy results obtained for executing the HADA using the six synthetic datasets. These results confirm that the model achieves an accuracy of over 98%. The values obtained through the generalization of tests confirm HADA's capacity for early anomaly detection. This behavior helps prevent medical complications. The results presented in Figure 14 confirm that the HADA can be used in real-world scenarios. The authors state that the model cannot be validated for production using such a small number of cases. However, this research does not represent a clinical study but rather a demonstration of integrating an anomaly detection algorithm into a modern cloud infrastructure, represented by the Azure tool suite. From the Results section, the answers to the RQs stated in the introduction are as follows:  
RQ1. The study demonstrates that the Microsoft Azure infrastructure is compatible with implementing a continuous monitoring system for the vital parameters of elderly individuals. This solution uses an integrated data stream that connects IoT sensors to Azure cloud services via ASP.NET APIs. The data collected from the MAX30100 sensors (for heart rate monitoring) and MPU-6050 (for step count and sleep quality) is transmitted in real-time to Azure IoT Hub, where it is processed using Azure Functions. The HADA, implemented in C# using the ML_NET library, analyzes the data via the PCA method to identify anomalies. The results are stored in an Azure SQL Database, and alerts are automatically generated through Azure Communication Services, which sends SMS notifications to the medical staff. The tests conducted showed that the average alert time is approximately 11 s. These results demonstrate HADA's ability to provide support to the elderly through the proposed hardware-software configuration. RQ2. The implementation of the HADA demonstrates that PCA is an appropriate method for anomaly detection in vital parameter monitoring. The algorithm simultaneously analyzes six key parameters: average heart rate (AR), minimum heart rate (mR), maximum heart rate (MR), number of steps (S), time spent in deep sleep (DST), and time spent in light sleep (SST). HADA uses Randomized PCA from the ML_NET library to reduce the dimensionality of the data. This process allows for the detection of complex correlations between parameters, providing a multidimensional analysis that would not be possible through the individual examination of each parameter. The test results show that HADA achieves an accuracy of 98.5% in anomaly detection. For model validation, synthetic datasets were introduced to simulate generalized scenarios. These sets contain normal values and values that exceed the standard limits for vital parameters. Tests conducted on this synthetic data have confirmed that HADA maintains an accuracy of over 98%. These values demonstrate HADA's ability to be applied in real-world scenarios. RQ3.