Learning the Graphical Structure of Electronic Health Records with Graph Convolutional Transformer

Edward Choi, Zhen Xu, Yujia Li, Michael Dusenberry, Gerardo Flores, Emily Xue, Andrew M. Dai

Abstract

Effective modeling of electronic health records (EHR) is rapidly becoming an important topic in both academia and industry. A recent study showed that using the graphical structure underlying EHR data (e.g. relationship between diagnoses and treatments) improves the performance of prediction tasks such as heart failure prediction. However, EHR data do not always contain complete structure information. Moreover, when it comes to claims data, structure information is completely unavailable to begin with. Under such circumstances, can we still do better than just treating EHR data as a flat-structured bag-of-features? In this paper, we study the possibility of jointly learning the hidden structure of EHR while performing supervised prediction tasks on EHR data. Specifically, we discuss that Transformer is a suitable basis model to learn the hidden EHR structure, and propose Graph Convolutional Transformer, which uses data statistics to guide the structure learning process. The proposed model consistently outperformed previous approaches empirically, on both synthetic data and publicly available EHR data, for various prediction tasks such as graph reconstruction and readmission prediction, indicating that it can serve as an effective general-purpose representation learning algorithm for EHR data.

Introduction

Electronic Health Records (EHR) are naturally hierarchical and relational. A single patient visit typically involves a sequence of clinical decisions: a visit leads to diagnoses, which then drive treatments and subsequent laboratory tests. This underlying "graphical structure" captures the physician's reasoning process.

Hierarchical structure of EHR data showing relationships between visits, diagnoses, treatments, and lab results.

However, most machine learning models treat EHR data as a "bag of features"—a flat list of codes that ignores these vital connections. While specialized models can utilize this structure if it is explicitly recorded, real-world data (especially insurance claims) often lack these explicit links. The challenge addressed in this research is whether we can learn this hidden structure and perform medical predictions simultaneously.

The Graph Convolutional Transformer (GCT)

The core idea behind the Graph Convolutional Transformer (GCT) is that a Transformer can be viewed as a general-purpose graph learner that assumes a fully connected graph and learns to prune it. However, standard self-attention often fails in the noisy, high-dimensional space of medical codes. GCT introduces three key innovations to guide this learning process:

  1. Statistical Guidance: It leverages conditional probabilities derived from the entire dataset (e.g., how often drug X follows diagnosis Y) to initialize and guide the attention mechanism.
  2. Domain-Specific Masking: A mask $M$ is used to prevent medically "impossible" connections, such as one treatment code pointing to another treatment code.
  3. KL-Divergence Regularization: The model is penalized if its learned attention deviates excessively from the underlying data statistics, ensuring it remains grounded in medical reality.
The GCT uses a conditional probability matrix derived from data statistics to guide the encounter graph.

Experimental Results

The model was evaluated on both synthetic encounter records and the real-world eICU Collaborative Research Dataset (containing over 41,000 ICU encounters).

  • Graph Reconstruction: On synthetic data, GCT achieved a 0.5965 AUCPR, significantly higher than a standard Transformer (0.5752) or a GCN using only raw statistics (0.5800).
  • Readmission Prediction: On real-world eICU data, GCT outperformed all baselines, including standard Transformers and deep feed-forward networks, achieving the highest AUCPR (0.5244).
  • Masked Diagnosis Prediction: GCT showed a clear lead in predicting missing diagnosis codes, reaching 77.04% accuracy on eICU data, compared to ~71-73% for other neural architectures.

Conclusion

GCT demonstrates that jointly learning the hidden structure of EHR while performing prediction tasks significantly improves model performance. By guiding the Transformer's attention with data statistics, the model can move beyond simple "bag of features" representations even when explicit structural information is missing. Future work aims to extend this approach to capture long-term patient history across multiple visits.

Summary updated

BibTeX
@inproceedings{choi2020learning,
  author = {Edward Choi and Zhen Xu and Yujia Li and Michael Dusenberry and Gerardo Flores and Emily Xue and Andrew M. Dai},
  title = {{Learning the Graphical Structure of Electronic Health Records with Graph Convolutional Transformer}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2020},
  url = {https://openreview.net/forum?id=UOUGgHEsrUs},
}
Figure