# Cyber-Secure IoT and Machine Learning Framework for Optimal Emergency Ambulance Allocation
## 3 Methodology
### Variable Design and Data Preprocessing  
This study aims to construct a highly reliable predictive model by implementing a rigorous data preprocessing and validation framework to ensure data consistency and integrity. Rather than merely eliminating basic errors, the validation process is treated as a core component throughout the analytical workflow, serving to ensure both the statistical reliability and logical validity of the variables. These efforts directly contribute to the model's robustness and generalizability. Specific preprocessing steps included identifying and handling missing and outlier values, removing duplicate records, resolving merge conflicts between datasets, standardizing variable formats, and ensuring spatial coherence. All procedures were designed in consultation with the National Fire Agency and regional emergency management agencies to support policy-relevant interpretations. To optimize the predictive performance of the ambulance deployment model while ensuring policy applicability, two distinct datasets were constructed based on the analytical objective. The first dataset was used for training the machine learning models, while the second was designed to support visualization and spatial policy analysis. Both datasets were  
Figure 2: Data cleaning and validation pipeline for ambulance deployment modeling. developed through a systematic pipeline involving raw data collection, preprocessing, variable transformation, and final integration. The overall data processing workflow is illustrated in Figure 3.  
The training dataset was constructed based on operational and demographic data from 229 emergency response centers across South Korea. The collected raw data included ambulance dispatch records, monthly dispatch counts, patient transport times, total and elderly population ratios, daily floating population figures, road traffic volume, and congestion indices, as well as environmental indicators such as alcohol consumption rates and food establishment density. Variable selection was guided by both theoretical relevance--derived from prior studies--and empirical validity, confirmed through expert consultations. To further validate the practical impact of each variable, we incorporated results from a field survey administered to 311 frontline emergency medical personnel affiliated with the National Fire Agency. In response to the question, \"Which factor most significantly affects your on-site workload?\", 87.0% of respondents identified the number of dispatches as the primary determinant. Additional influential factors included \"distance or time to the hospital\" (5.1%), \"availability of medical resources\" (3.3%), and \"proportion of high-acuity emergency cases\" (2.2%). These findings are highly consistent with the variable importance rankings derived from the model, supporting the construct validity of the selected features. Furthermore, frequent inter-jurisdictional ambulance deployments were observed, with certain centers reporting over 100 outbound emergency responses per month. This suggests that structural resource shortages are occurring in specific areas. An analysis of hourly traffic volumes on major roads in 2023 (Figure 4) also revealed recurrent congestion patterns during morning and evening peak periods, highlighting traffic delays as a critical factor contributing to prolonged emergency response times. There was also considerable variation in the frequency of high-acuity emergency dispatches across centers, with some facilities recording over 60 such cases per month. This finding highlights the potential value of implementing severity-based deployment strategies. These statistics align not only with the observed operational data but also with the field experiences reported by emergency personnel, thereby reinforcing the construct validity of the selected variables and the practical relevance of the training dataset.