Abstract BACKGROUND AND AIMS The United Kingdom (UK) Biobank (UKBB) is a large-scale biomedical database and research resource, containing in-depth health information from half a million participants in UK that have been used for detailed analyses of IBD. Using the UKBB, we examined the lab findings and prescription medication use in IBD subjects to identify trajectory patterns of disease with respect to surgical relapse. METHODS Of the 363 subjects in the UKBB with an established IBD diagnosis (UC, CD, or both) and an initial GI surgery, 116 had a subsequent surgery within 5 years of initial surgery and had follow up lab values of urine and serum creatinine, plasma and serum C-reactive protein, urine and serum albumin, urine albumin-creatinine ratio, total white blood count, urine microalbumin, total white cell count, hemoglobin estimation, and erythrocyte sedimentation rate. Additionally, data for the 9 most used IBD prescription medications: budesonide, sulfasalazine, methotrexate, hydrocortisone, balsalazide, olsalazine, prednisolone, azathioprine, and mesalamine was analyzed as well. Hidden Markov Models (HMM) using these variables and open-source packages were incorporated to label observations of each subject-visit until the subsequent surgery. Interactive visualizations using DPVis open-source package were then applied to identify individual trajectories and explore clinical characteristics. RESULTS Five hidden states were observed from HMM. The five states observed are based on differing prescription medication usage for the treatment of IBD and were assigned a color to allow for comparison (Figure 1). The majority of patients fell within the states labeled “blue” (azathioprine, sulfasalazine, and prednisone) “red” (mesalamine only) or “purple” (azathioprine, balsalazide, and prednisolone). The visualizer showed that while some transitions among states were observed, most patients fell into one of three major trajectory patterns as a factor of time to surgical relapse and were largely segregated by state. Based on the trajectories, a comparison of subjects with prescription of mesalamine-only vs. any immunosuppressive medications (azathioprine + sulfasalazine + balsalazide) in combination with prednisolone showed a significant difference in time to surgical relapse (P < 0.005) (Figure 2), with a shorter time to surgical relapse identified in patients who took mesalamine only. CONCLUSIONS We identified three distinct trajectories leading up to surgical relapse. These trajectories show distinctive medication prescription patterns (5-ASA vs. Azathioprine with steroid use), as well as significantly different times to surgical relapse. Furthermore, heterogeneity is shown within each trajectory pattern in terms of progression time and warrant further investigation. Figure 1 Three Trajectories of time to surgical relapse generated from 5-State HMM using lab values and prescription medications. Note that a patient can traverse multiple states so the summation of the observed subjects of those states exceeds the cohort size (N=116). Figure 2 Kaplan-Meier curves for the UC/CD subgroup with surgical relapse considering events from the first documented lab values and/or planned prescription at most 2 years prior to the baseline surgery up to the subsequent 5 years.