## 2 Materials and Methods
### Analysing Emergency Department Performance with Process Mining  
To understand the specific drivers of ED overcrowding, we applied the IPM methodology to analyse patient flow and resource utilisation by evaluating the current performance of the emergency department, with a focus on determining the underlying causes of service saturation. With this in mind, an IPI of the ED was defined, following the IPM methodology with the Process Mining Application (PMApp) Toolkit [34]. To carry out this analysis, a multidisciplinary team was created and followed several Data Rodeos sessions until the IPI was totally defined, where information regarding the patient in relation to each of the steps that make up the process in the ED was collected. These steps were admission, triage, first attention, hospitalisation, and discharge destination, where triage and attention are divided into five levels according to the Manchester triage standard [35] and discharge destination into six possible destinations (home, voluntary discharge, exits (when a patient passes away), hospitalisation, administrative admission, and others). Triage is the structured, rapid classification process that allows for clinical risk management and care prioritisation in the ED. A key indicator of its quality is the pre-triage time, the interval from the patient's arrival to their triage classification, the standard of which is \(\leq\)10 min. Five-level structured systems have proven to be the safest, sharing very similar time margins and clinical criteria. In triage, each patient is assigned one of the five levels with maximum times that mark the clinical process: Level I (Resuscitation): a situation that requires immediate attention because there is cardiorespiratory arrest, shock, or an imminent life-threatening condition. At this level, the triage step may occur after clinical care, with this clinical pathway organised without triage due to the extreme urgency of care; Level II (Emergency): a very urgent situation with life-threatening condition, hemodynamic instability, or unbearable pain, which should be assessed in \(\leq\)15 min; Level III (Urgent): a stable patient but at potential risk (e.g., chest pain, suspected sepsis) who will likely require diagnostic testing, requiring medical contact within \(\leq\)60 min; Level IV (Least Urgent): a pathology with no apparent life-threatening condition (sprains, rashes,  
Figure 1: Interactive process indicators of the emergency department. chronic symptom control) that allows for a wait of up to 120 min; and Level V (Not Urgent): administrative procedures or minor, very low-complexity conditions, with a wait time of \(\leq\)240 min (Figure 2). This grading ensures that resources are focused first on critical conditions without neglecting the rest through periodic reassessments [36; 37]. It should be noted that in addition to the standard process, two more circuits were identified in the IPI within the ED. It was derived from the characteristics of the process mining analysis, which allows for the discovery of real processes. Thus, the first was named Level 0 for patients who have not been triaged but have a waiting time until first attention (Wait 0, Attention 0). It occurred because, in this context, external outpatients go through the ED when they visit the hospital. The second circuit corresponds to those Level I patients who have been attended to directly without having registered in the triage system. The representation of this process can be seen in Figure 3, where it is observed that Level I and II patients spend more time in attention (appearing redder than the rest of the steps), which is logical because they are patients who require more care.