## 2 Materials and Methods
### System Architecture
#### 2.1.1 Modular Layered Design
The concept of a federated fine-tuning for LLMs is introduced: each hospital can refine the LLM on its own notes (adhering to local patient privacy) and contribute to a shared model, as described above. By doing so, the model better adapts to institutional specifics (like shorthand or dialect in notes) while remaining broadly trained. 5. **DSE Layer. ** The DSE is the core analytical brain of the system that generates clinical recommendations (e.g., triage category, likely diagnoses, alerts for abnormal findings). It brings together inputs from the structured data pipelines and the LLM outputs. The engine can utilize a combination of the following: * **Rule-Based Logic. ** Standard clinical triage protocols--such as the ESI or institution-specific guidelines--are encoded into the decision engine. For example, if systolic blood pressure is <90 mmHg and heart rate > 130 bpm, the patient is flagged for immediate attention. These encoded rules serve as safety nets to ensure the system adheres to established clinical norms and provides conservative recommendations when vital signs are critical. * **Machine Learning Models. ** Predictive models trained on historical emergency department data are used to assess the risk of critical outcomes (e.g., ICU admission or deterioration). Models such as gradient boosting machines or neural networks process both structured features (age, vitals, lab results) and encoded clinical narratives to generate risk scores. These scores are mapped to triage levels, supporting clinician decision-making with both statistical and semantic context. * **Guideline Retriever Module. ** This module retrieves relevant clinical guidelines or medical facts from an internal knowledge base and serves as a reference component during the decision-making process. The retrieved content is then provided to the LLM, which integrates this evidence to generate context-aware recommendations. For instance, the system may identify and retrieve similar historical cases--leveraging big data infrastructure and information retrieval techniques--and instruct the LLM to compare those with the current patient presentation. * **Digital Twin Simulation. ** If applicable, the DSE also checks the digital twin of the patient for any active alerts. For example, if the twin (representing a patient with chronic conditions at home) triggers an event \"oxygen saturation dropped below 85%,\" the engine would generate a high-priority alert for that patient, possibly even before they arrive at the hospital. The output of the DSE is typically a set of one or more recommended actions or decision suggestions. For triage, this could be an assigned triage level (e.g., Level 1--Immediate intervention needed, or Level 3--Urgent but not life-threatening). For diagnostic support, it might be a list of probable diagnoses or a checklist of next steps (order a CT scan, perform a certain lab test, etc.). The DSE is designed to be extensible--new rules or models can be plugged in as medical knowledge evolves. It also operates under a safety-first principle: any high-risk condition detected (like signs of sepsis or heart attack) results in an automatic high-severity recommendation, erring on the side of caution. * **MLOps and CI/CD Pipeline Layer. *
* To keep the AI models of the system up-to-date and reliable, we integrate MLOps principles. This layer handles the continuous integration and deployment (CI/CD) of model updates. When new data becomes available or when the FL rounds produce a new global model, the pipeline automatically validates the model on a hold-out set of cases (or in A/B tests within the live system) before deploying it. The pipeline also monitors model performance metrics over time--for example, if the triage recommendations of the model start to drift or degrade (perhaps due to changes in patient population or emergence of new diseases), it can alert data scientists to retrain or recalibrate. This layer encompasses the following:
* **Version Control for Models. *
* Each model (and even each set of rules) is versioned.