# Cyber-Secure IoT and Machine Learning Framework for Optimal Emergency Ambulance Allocation
## 3 Methodology
### Variable Design and Data Preprocessing
In cases where missing data occurred for specific centers or time periods, the cause was investigated in collaboration with the Gyeonggi Fire and Disaster Headquarters, as such gaps were often due to administrative reporting delays or system transitions. The treatment methods were then adjusted accordingly, depending on the identified cause. Outlier detection followed both statistical and logical criteria. Statistically, values were considered outliers if they exceeded 3 standard deviations from the mean or fell outside 1.5 times the interquartile range. Logically implausible values, such as dispatch durations longer than 10 h or response times exceeding 1 h, were also excluded on the basis of operational infeasibility. The overall removal of outliers was kept below two percent of the dataset, in order to preserve the stability of model training and avoid distortion in inter-variable relationships. For extreme values that could plausibly occur during exceptional events such as large-scale disasters, removal decisions were made only after further review with the National Fire Agency. To ensure compliance with international and national data protection regulations, including the General Data Protection Regulation (GDPR) and the Health Insurance Portability and Accountability Act (HIPAA), rigorous data anonymization and de-identification procedures were applied prior to model training. All personally identifiable information (PII) and protected health information (PHI) were removed or transformed through a multi-step process in accordance with the guidelines provided by relevant authorities. Specifically, the dataset underwent structured de-identification using suppression, generalization, and pseudonymization techniques. Geolocation data were truncated to administrative units (e.g., district-level codes) to prevent re-identification of individuals or specific sites. Temporal data, such as timestamps of emergency incidents, were generalized to daily granularity to mitigate temporal linkage risks. In addition, all unique identifiers (e.g., patient IDs, call numbers) were replaced with random hashes and were not recoverable. Duplicate values were identified not only based on exact record matches but also by accounting for partially blank fields and inconsistent formatting. In addition to identifying record-level duplicates, logical redundancies--such as repeated registration of the same hospital within a single jurisdiction--were carefully reviewed during the data integration process. Common issues such as mismatched key fields, typographical errors in location names, and inconsistencies in temporal granularity were resolved through the normalization of administrative district codes and the unification of jurisdictional naming conventions. For instance, geographic names such as \"Jeongja-dong, Jangan-gu, Suwonsi, Gyeonggi-do\" were sometimes confused with \"Jeongja-dong\" in Seongnam-si due to naming overlap. These cases were standardized using the Vworld administrative code system to ensure consistent merge keys across datasets. During the merging of each center's jurisdictional boundaries with population data from Statistics Korea, several records were found to be missing. Further investigation revealed that these omissions were primarily due to historical changes in administrative boundaries and naming conventions. To address this issue, the temporal reference points for data aggregation were adjusted and historical administrative codes were matched to restore the missing data. After merging, any remaining logical duplicates were removed using key-based filtering, and an additional validation procedure was performed to ensure integrity. Following these refinement procedures, data formatting consistency and unit harmonization across variables were carried out. For example, traffic flow data, originally reported as vehicles per hour, were aggregated and converted into daily averages for model compatibility.