Manuscript Offprint

arXiv:2610.22014

GraphBEAT: Graph-based Bucketized Event Aggregation Over Time for Early Risk Stratification of Gastrointestinal Cancers

Leo Y. Li-Han, Chris Varghese, Elizabeth B. Habermann, Mark J. Truty, William R. G. Perry, Cornelius A. Thiels, Hojjat Salehinejad

Leo Y. Li-Han, Chris Varghese, Elizabeth B. Habermann, Mark J. Truty, William R.G. Perry, Cornelius A. Thiels, and Hojjat Salehinejad, Senior Member, IEEE

Abstract—Longitudinal electronic health records (EHRs) contain complementary diagnostic and laboratory information about patient health. However, irregularity, sparsity, heterogeneity, and incompleteness in documentation complicate EHR modeling. To address the problem, we introduce GraphBEAT (Graph-based Bucketized Event Aggregation over Time), a temporal graph representation learning framework that groups clinical events into time buckets and transforms observed features into patient-specific, temporally directed graphs to enable early risk stratification for gastrointestinal cancers. Each node in an EHR graph encodes feature identity, observed value, and temporal position of clinical events. A context-aware, time-decay message-passing mechanism models transitions between successive buckets, followed by multi-head attention pooling to generate patient-level representations. GraphBEAT was trained and evaluated on multi-site longitudinal diagnosis codes and laboratory tests to predict pancreatic, liver, and intestinal cancer at 12-, 24-, and 36-month diagnostic lead times. In all experimental setups, GraphBEAT consistently outperformed baseline graph neural networks (GraphSAGE, GAT, and GCN) and sequence modeling approaches (Transformer and long short-term memory [LSTM]). GraphBEAT also required over 250×250\times fewer floating-point operations per patient and over 20×20\times fewer parameters than the Transformer and LSTM baselines. These results support GraphBEAT as an accurate and computationally efficient approach for cancer risk stratification from sparse, heterogeneous longitudinal health records.

Index Terms—Cancer risk prediction, electronic health records, graph representation learning, graph neural network, irregular time series.

I. INTRODUCTION

LONGITUDINAL electronic health records (EHRs) contain extensive and complementary information on the evolution of patient health, including diagnostic trajectories, laboratory measurements, healthcare utilization patterns, and other routinely collected clinical data [1]. Diagnosis codes provide standardized documentation of diseases, symptoms, and comorbidities, while laboratory measurements record quantitative observations of physiological state. An integrated assessment of heterogeneous EHR data could reveal subtle interactions among symptoms, conditions, and measurements that may not be apparent from either modality alone, thereby supporting clinical tasks such as disease-onset prediction, patient triage, and early risk stratification [1], [2].

This opportunity is particularly relevant to gastrointestinal malignancies that may present at a younger age or remain clinically occult until advanced stages [3], [4], [5], [6]. For instance, population-wide screening for pancreatic cancer is economically impractical given its low prevalence and potential harms of invasive screening [3], [7]. Meanwhile, established surveillance programs are limited to selected high-risk subgroups that account for only a minority of future cases [8], [9], [10]. Recent studies suggest that deep learning models can enhance pancreatic cancer risk prediction from routinely collected longitudinal clinical records [11], [12], [13], [14], [15], [16]. Although screening pathways may differ between pancreatic, liver, and intestinal cancers, a scalable modeling method that identifies a manageable high-risk subgroup from routine EHR data could complement existing methods by prioritizing patients for further diagnostic assessment [15].

Modeling longitudinal EHR data is nevertheless challenging because clinical encounters/events are irregular and heterogeneous, and the records may be repeated or inaccurate [1]. Diagnosis codes are categorical and sparse, and the accuracy and completeness vary depending on coding and billing practices [17]. Laboratory measurements are continuous, have category-specific value distributions, and are collected selectively according to clinical need [18]. Patients also differ in their healthcare utilization patterns, observation duration, and record completeness. Therefore, an effective and generalizable modeling approach should preserve event identity, value, and timing in data representation while learning clinically meaningful dependencies across heterogeneous measurements over long temporal horizons [1].

Existing methods have primarily represented clinical histories as temporal token sequences or graphs [13], [19]. Sequence models capture temporal dependencies but often encode repeated or miscoded events as separate tokens and leave relationships among heterogeneous clinical variables implicit. Graph-based models make relational structure explicit, but many organize time through event hierarchies by involving external ontologies, knowledge graphs, and auxiliary temporal encoders [19], [20], [21], [22], [23], [24]. Relatively less attention has been given to a patient-specific graph in which heterogeneous clinical observations share a common temporal

Leo Y. Li-Han, Chris Varghese, Mark J. Truty, William R.G. Perry, and Cornelius A. Thiels are with the Department of Surgery, Mayo Clinic, Rochester, MN, USA.

Elizabeth B. Habermann is with the Kern Center for the Science of Health Care Delivery and the Department of Surgery, Mayo Clinic, Rochester, MN, USA.

Hojjat Salehinejad is with the Kern Center for the Science of Health Care Delivery and the Department of Artificial Intelligence and Informatics, Mayo Clinic, Rochester, MN, USA.

(A) Irregular EHR Time Series

Figure

(B) Time-Bucketized EHR Encoding

Figure

(C) Patient-Level Temporally Directed EHR Graph

Figure

(D) Graph Feature Learning

Figure

Fig. 1. The graph representation learning framework for cancer risk prediction from heterogeneous EHR time series. (A) An example of irregular diagnosis and laboratory trajectories for one patient. The task is to predict the risk of pancreatic, liver, and intestinal cancer using up to 20 years of clinical history, with diagnostic lead times of 12, 24, and 36 months. (B) Heatmap of the matrix representations of the diagnostic codes (blue) and laboratory results (red) for the patient. Two matrices are concatenated along the feature dimension to form the heterogeneous EHR matrix. (C) The patient-specific temporally directed EHR graph constructed from the matrix representation by retaining observed clinical events. The node feature is determined by clinical feature identity, observed values, and temporal position, while the edge weights are dynamically calculated from the context of the transition. (D) The end-to-end patient-level graph learning for cancer risk prediction. The context-aware, time-decay message passing updates node features, while the multi-head attention feature pooling aggregates a varying number of node features into a fixed-length graph feature vector for downstream classification.

topology and allow direct feature interaction across different time intervals. To approach this, our previous proof-of-concept study, GraD-IBD [25], investigated time-bucketized graphs for inflammatory bowel disease detection using diagnosis histories alone. Its initial node representations used categorical diagnosis embeddings, while diagnosis frequencies and elapsed time informed temporally weighted message passing.

Following this philosophy, we introduce GraphBEAT, the Graph-based Bucketized Event Aggregation over Time framework for irregular longitudinal EHR modeling for risk stratification of gastrointestinal cancers. GraphBEAT extends data representation to heterogeneous EHR trajectories (i.e., diagnosis and laboratory) by jointly encoding clinical feature identity, observed value, and temporal position in a shared latent space, enabling direct heterogeneous feature extraction through a common temporal graph topology. The framework retains the context-aware, time-decay message-passing principle while introducing adaptive multi-head attention pooling to integrate evidence across the complete clinical history.

We evaluate GraphBEAT for pancreatic, liver, and intestinal cancer risk prediction at three diagnostic lead times using geographic holdout experiments across four Mayo Clinic care sites. The main contributions of the work include:

• Unified representation of irregular EHR data:

We introduce a clinically motivated time-bucketized encoding paradigm that transforms heterogeneous diagnosis codes and laboratory measurements into a patient-specific temporally directed EHR graph, preserving event identity, observation, and temporal position.

• Context-aware, time-decay graph learning:

We develop a three-component node representation and a message passing mechanism that encodes event context, source–target transition relevance, and temporal recency into the graph representation learning. An adaptive multi-head attention feature pooling subsequently integrates updated node representations over time into a fixed-dimensional patient representation.

• Multi-site and multi-cancer evaluation:

We evaluate the framework across four geographically and operationally distinct care settings, three cancer types, and three diagnostic lead times using geographic internal-external validation, and compare it with established graph- and sequence-based architectures.

References (44)

  • Deep learning prediction models based on EHR trajectories: A systematic review
  • BEHRT: Transformer for electronic health records
  • Screening for pancreatic cancer: US preventive services task force reaffirmation recommendation statement
  • Hepatocellular carcinoma
  • Small bowel adenocarcinomas—existing evidence and evolving paradigms
  • Colorectal cancer
  • The multicenter cancer of pancreas screening study: Impact on stage and survival
  • Model to determine risk of pancreatic cancer in patients with new-onset diabetes
  • Management of patients with increased risk for familial pancreatic cancer: Updated recommendations from the international cancer of the pancreas screening (CAPS) consortium
  • AGA clinical practice update on pancreas cancer screening in high-risk individuals: Expert review
  • A pancreatic cancer risk prediction model (Prism) developed and validated on large-scale US clinical data
  • Development and validation of a parsimonious risk stratification model for pancreatic cancer
  • A deep learning algorithm to predict risk of pancreatic cancer from disease trajectories
  • Pancreatic cancer risk prediction using deep sequential modeling of longitudinal diagnostic and medication records
  • Digitally enriching a screening population for pancreatic cancer using routine blood-based measures and clinical histories
  • Enhancing EHR-based pancreatic cancer prediction with LLM-derived embeddings
  • Next-generation phenotyping of electronic health records
  • The EuBIVAS: Within- and between-subject biological variation data for electrolytes, lipids, urea, uric acid, total protein, total bilirubin, direct bilirubin, and glucose
  • GRAM: Graph-based attention model for healthcare representation learning
  • Learning the graphical structure of electronic health records with graph convolutional transformer
  • GraphCare: Enhancing healthcare predictions with personalized knowledge graphs
  • Predictive modeling with temporal graphical representation on electronic health records
  • InfEHR: Clinical phenotype resolution through deep geometric learning on electronic health records
  • Temporal graph transformer for next visit diagnosis prediction on electronic health records
  • GraD-IBD: Graph representation learning from diagnosis trajectories for early detection of inflammatory bowel disease
  • Long short-term memory
  • Empirical evaluation of gated recurrent neural networks on sequence modeling (opens arXiv in a new tab)
  • Recent advances in recurrent neural networks (opens arXiv in a new tab)
  • Doctor ai: Predicting clinical events via recurrent neural networks
  • Attention is all you need
  • MUFASA: Multimodal fusion architecture search for electronic health records
  • A survey on graph neural networks for time series: Forecasting, classification, imputation, and anomaly detection
  • Graph representation of postoperative patients for opioids refill prediction: A real-world case study
  • Time2Graph+: Bridging time series and graph representation learning via multiple attentions
  • Gaussian Error Linear Units (GELUs)
  • Accelerating ai innovation in healthcare: real-world clinical research applications on the mayo clinic platform
  • Inductive representation learning on large graphs
  • Graph attention networks (opens arXiv in a new tab)
  • Semi-Supervised Classification with Graph Convolutional Networks
  • Decoupled weight decay regularization
  • Fast graph representation learning with PyTorch Geometric
  • GN-NExplainer: Generating explanations for graph neural networks
  • Visualizing data using t-SNE
  • The foundations of cost-sensitive learning