## 4 Results
### Selection of Variables for the Study  
The IPI obtained through interactive process mining allowed for the visualisation of where, how, and why delays occur in the emergency department. Based on this analysis, the risk rate of each variable recorded in triage was estimated, and three criteria were established to decide its inclusion in the FT formula:  
* Robust statistical association: RR \(\geq\) 1.8 for a stay \(\geq\) 4 h;
* Operational prevalence: presence in \(\geq\)5% of episodes, ensuring a real impact on patient flow;
* Immediate availability and clinical relevance: the variable must be available during triage and be clinically actionable to activate the FT pathway. The variables that simultaneously met these criteria were as follows:
* Age > 65 years: RR 1.77 in 70-89 years and RR 1.95 in \(\geq\)90 years, indicating frailty and greater care complexity;
* Hyperfrequency (\(\leq\) 5 visits/year): RR 1.25, reflecting multimorbidity and risk of intensive resource consumption;
* Triage level II-III (Manchester): RR 2.03, accounting for 51% of prolonged stays;
* Need for a stretcher or wheelchair upon arrival: RR 2.11, identifying patients with functional limitations and a high likelihood of requiring additional testing; \begin{table}
\begin{tabular}{l c c c c c} \hline \hline
**Variables** & \begin{tabular}{c} **Total Sample** \\ **N = 94,489 (\%)** \\ \end{tabular} & \begin{tabular}{c} **Group A \textgreater{} 4 h** \\ **N = 29,621 (\%)** \\ \end{tabular} & \
\begin{tabular}{c} **RR (\textgreater{}4 h)** \\ **N = 64,868 (\%)** \\ \end{tabular} &
\begin{tabular}{c} **Group B \textgreater{} \textless{} 4 h** \\ **RR (\textgreater{}4 h)** \\ \end{tabular} \\ \hline Accident on the Underground & 3 (0\%) & 0 (0\%) & 0.00 (0.00–NaN) & 3 (0\%) & **1.46 (1.45–1.46)** \\ Outpatient S.V.S. & 15,359 (16.25\%) & **5454 (18.41\%)** & **1.16 (1.14–1.19)** & 9905 (15.27\%) & **0.93 (0.92–0.94)** \\ \hline Circuito Cheste & 4 (0\%) & 2 (0.01\%) & 1.60 (0.60–4.25) & 2 (0\%) & 0.73 (0.27–1.94) \\ \hline Comisaria & 1 (0\%) & 0 (0\%) & 0.00 (0.00–NaN) & 1 (0\%) & **1.46 (1.45–1.46)** \\ \hline External consultations & 313 (0.33\%) & **141 (0.48\%)** & **1.44 (1.27–1.63)** & 172 (0.27\%) & **0.80 (0.72–0.88)** \\ \hline Own decision & 53,770 (56.91\%) & **15,537 (52.45\%)** & **0.84 (0.82–0.85)** & 38,233 (58.94\%) & **1.09 (1.08–1.10)** \\ \hline Judicial or governmental order & 6 (0.01\%) & 2 (0.01\%) & 1.06 (0.34–3.30) & 4 (0.01\%) & 0.97 (0.55–1.71) \\ Others & 10,555 (9.62\%) & **4315 (14.57\%)** & **1.36 (1.32–1.39)** & 6240 (9.62\%) & **0.85 (0.83–0.86)** \\ \hline Residence/Assisted living centre & 1281 (1.36\%) & **808 (2.73\%)** & **2.04 (1.95–2.13)** & 473 (0.73\%) & **0.53 (0.50–0.57)** \\ \hline Transfer from another centre & 417 (0.44\%) & **86 (0.29\%)** & **0.66 (0.54–0.79)** & 331 (0.51\%) & **1.16 (1.10–1.22)** \\ \hline A\&E on public roads & 687 (0.73\%) & 238 (0.8\%) & 1.11 (1.00–1.23) & 449 (0.69\%) & 0.95 (0.90–1.01) \\ Unknown & 12,092 (12.8\%) & **3037 (10.25\%)** & **0.78 (0.75–0.80)** & 9055 (13.96\%) & **1.11 (1.09–1.12)** \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Referral to the emergency department values analysed with PMApp.