BackgroundElectronic health records (EHR) are useful tools for understanding complex medical phenotypes, but they have been underutilized for opioid use disorders (OUD). Patterns of prescription opioid use might provide an objective measure of OUD risk.MethodsWe extracted data for over 2.6 million patients across three health registries (Vanderbilt University Medical Center, Mass General Brigham, Geisinger) between 2005 and 2018. We defined three groups based on levels of opioid exposure: No Prescription, Minimal Exposure (2 prescriptions within 90 days at least once, but never 3 prescriptions <90 days apart), and Chronic Exposure (≥10 opioid prescriptions in a year), and compared them to the full registries and to patients with OUD diagnostic codes. We extracted demographic and clinical characteristics known to co-occur with OUD, including psychiatric and substance use disorders, pain-related diagnoses, HIV, and hepatitis C.ResultsThe prevalence of substance (alcohol, tobacco, cannabis) use disorders was higher in patients with OUD and Chronic Exposure than those with No Prescription or Minimal Exposure. Patients in the OUD and Chronic Exposure groups had more psychiatric (anxiety, depression, schizophrenia, bipolar disorder) and medical comorbidities (pain, hepatitis C, HIV) than those in the Minimal Exposure group. Notably, patients in the Minimal Exposure group had different comorbidity profiles (higher rates of substance use and psychiatric disorders, more pain conditions) than those in the Unscreened or No Prescription groups, highlighting the value of including opioid exposure in studies of OUD.ConclusionsLong-term opioid prescription use may serve as an additional tool to characterize OUD risk.