Abstract
Deep learning-based predictive models for Electronic Health Records (EHR) are increasingly vital in healthcare. Effective patient representation must capture both temporal relationships between visits and the structural information within medical events. Existing methods typically focus on either sequential modeling or graph-structured relationships, often failing to integrate both effectively. We propose TRANS (Temporal gRAph traNSformer), which models EHR as a temporal heterogeneous graph. By propagating information from medical event nodes to time-aware visit nodes, TRANS captures evolving health status alongside complex code-level relationships. Extensive experiments on MIMIC-III, MIMIC-IV, and CCAE datasets demonstrate that TRANS achieves state-of-the-art performance in diagnosis prediction.
Introduction
Predictive modeling in healthcare, such as forecasting future diagnoses, is challenging due to the multi-layered nature of EHR data. A robust model must account for the long-term health trajectory (patient-level), the context of individual clinical encounters (visit-level), and the intricate relationships between medical codes like diagnoses, procedures, and medications (code-level).
Existing approaches generally fall into two categories: sequence-based models (e.g., RNNs, Transformers) and graph-based models. While sequence-based models excel at tracking temporal changes, they often overlook the "web" of connections between medical events within a single visit. Conversely, graph-based models map these connections well but struggle to integrate the temporal dimension effectively. TRANS addresses this gap by treating time and structure as equally important components of a unified graphical representation.
Methodology: The TRANS Framework
The core innovation of TRANS is the construction of a Temporal Heterogeneous Graph. In this structure, "Visit Nodes" are linked chronologically to represent the patient's journey, while "Medical Event Nodes" (representing specific codes) are linked to the visits where they occurred.
Temporal and Spatial Encoding
To make the graph "time-aware," TRANS utilizes Time2Vec to encode absolute timestamps and functional time encoding for edges. This ensures that the influence of a past event on a current prediction is weighted by its temporal distance. Furthermore, the model incorporates spatial encoding via meta-paths (e.g., Medication → Visit → Diagnosis) and Laplacian eigenvectors to capture the global and local geometry of the graph.
Interpretability
To address the "black box" nature of deep learning, TRANS includes a Patient Explainer module. This component identifies the most influential subgraphs—specific past medical events and visits—that contribute to a particular prediction, providing clinicians with actionable insights.
Experimental Results
TRANS was evaluated against several baselines, including RETAIN, HiTANet, and GCT, across three large-scale datasets: MIMIC-III, MIMIC-IV, and the CCAE (MarketScan) dataset.
- Performance: TRANS consistently outperformed all baselines. Notably, on the CCAE dataset—which features longer patient histories—TRANS achieved a visit-level precision@10 of 81.81% and a code-level accuracy@30 of 90.70%.
- Ablation Studies: Results indicated that temporal embedding is the most critical component, as its removal led to the most significant performance drops compared to removing spatial encoding.
- Representation Learning: t-SNE visualizations confirmed that TRANS learns semantically meaningful clusters, with similar medical codes grouping together more effectively than in previous graph-based models.
Conclusion
By decoupling visit-level health status from code-level characteristics within a temporal heterogeneous graph, TRANS provides a more comprehensive representation of patient data. The model's superior performance, especially on complex datasets with long historical records, underscores the importance of integrating temporal and structural information for clinical predictive modeling. Future work will explore the integration of external medical knowledge bases and improving the computational scalability of the graph construction process.
Summary updated