# Integrating Environmental Data for Mental Health Monitoring: A Data-Driven IoT-Based Approach
## 3 Methodology
### Data Collection and Preprocessing  
Data were collected using IoT-enabled devices, including temperature and humidity sensors, which transmitted real-time readings to central servers. These IoT devices were distributed across the environments. They collected data at different intervals depending on the dataset, as described in Section 3.1.  
Environmental factors, particularly temperature and humidity, significantly influence emotional well-being and stress levels. Extreme temperatures and high humidity have been linked to increased stress, discomfort, and negative emotional states, while moderate conditions are generally more conducive to emotional balance and reduced stress [25]. Research indicates that high temperatures can negatively affect mental health, leading to increasedhospitalisation for mental illness [26]. Moreover, high humidity levels, particularly when combined with elevated temperatures, can exacerbate stress and discomfort [27]. Conversely, moderate temperatures and humidity levels are associated with better emotional well-being and reduced stress [28]. On the other hand, exposure to cold temperatures can lead to increased stress and negative mental health outcomes. For instance, individuals living in cold homes are at a higher risk of severe mental distress [29].  
High humidity levels, particularly when combined with elevated temperatures, can exacerbate stress and discomfort. [PERSON] et al. [30] found that relative humidity showed a significant correlation with suicide rates, indicating that both temperature and humidity are important factors in mental health.  
Based on findings from prior studies, the relationship between temperature, humidity, and stress levels can be systematically analysed and categorised into distinct categories, as outlined in Table 1. These categories provide a structured framework for associating environmental conditions with stress levels, serving as a foundation for real-time stress monitoring and personalised mental health interventions.The thresholds used for categorising stress levels were informed by a combination of empirical studies and domain-specific knowledge.  
These thresholds represent general boundaries derived from aggregated data, highlighting typical stress responses to specific temperature and humidity levels. However, it is crucial to recognise that these categories may require personalisation to accurately reflect individual experiences and environmental contexts. Factors such as acclimatisation to local climates, cultural variations in comfort levels, and individual health conditions significantly influence how environmental factors impact stress and emotional well-being. Future implementations of these categorisations should consider adaptive mechanisms to fine-tune thresholds based on personal and contextual variables, ensuring more accurate and meaningful assessments.  
The preprocessing steps involved the following:  
* **Data Cleaning**: Missing data points were handled by using interpolation methods based on surrounding values. Outliers were detected using z-scores and were removed if they deviated significantly from the rest of the dataset.
* **Normalisation**: Temperature and humidity readings were normalised to a standard scale to ensure uniformity and improve the performance of machine learning models.
* **Data Labelling**: Emotional states were labelled based on the literature, as mentioned above. This labelling helped establish the ground truth for training the machine learning models.