Visual abstractsVisuals
ResearchJournal of Medical Internet Research · Oct 6, 2026

Linking Dispense Data to Electronic Health Orders: Tutorial for Querying Commercial Pharmacy Databases to Support Systemwide Quality Improvement

Michaels B, Pourian J
Digital Health & AI

Study type: Observational study: it can show a link, but not prove that one thing causes another.

Read the full paper free at PubMed Central ↗

Abstract

Background Assessing medication adherence is central to quality care, yet linking electronic health record (EHR) medication orders to outpatient pharmacy dispense data remains technically complex. Objective This study aimed to present a generalized, reproducible tutorial for linking EHR medication orders to pharmacy dispense data that can be used to assess medication dispense proportions. Methods We developed and validated a structured query approach to link EHR medication orders to external pharmacy dispense data using patient identifiers, medication-level identifiers, pharmacy identifiers, and temporal constraints. The tutorial emphasizes key design decisions, including handling multiple triggering events, deduplication across vendors, and managing formulation changes. A retrospective cohort of pediatric acute otitis media encounters (January 1, 2021, to January 1, 2024) was used as an illustrative example. Results Overall, 98.3% (302/307) of pharmacies in the cohort returned at least 1 dispense record during the study period and were therefore classified as reporting pharmacies. Among 3404 orders, 2616 (76.9%) had a recorded dispense. Conclusions EHR-integrated pharmacy data provide a feasible, timely proxy for assessing medication adherence. This tutorial provides a scalable framework for linking EHR and pharmacy data for medication adherence studies, while highlighting key methodological considerations for SQL coding.

Topics

Electronic Health Records; Humans; Quality Improvement; Databases, Factual; Retrospective Studies; Pharmacies

DOI: 10.2196/90954 · PubMed: 42837533

Spotted a mistake? Suggest a correction

More in Digital Health & AI

ResearchLancet Digit Health · Nov 23, 2026 · Digital Health & AI

ClinicalAge biomarker associated with mortality and disease risk in UK datasets

ClinicalAge, a framework for modelling ageing trajectories from longitudinal electronic health records in the UK: a model development and validation study

ResearchLancet Digit Health · Nov 23, 2026 · Digital Health & AI

Facial photographs used to estimate age and predict survival in cancer patients

Foundation artificial intelligence models for health recognition by use of face photographs (FAHR-Face): a model development and validation study

ResearchLancet Digit Health · Nov 23, 2026 · Digital Health & AI

New model predicts severe fetal compromise risk at birth with 33.4% sensitivity

A prognostic model for use at labour onset to estimate the risk of severe fetal compromise at birth: a retrospective, model development and validation study

ResearchNPJ Digit Med · Nov 21, 2026 · Digital Health & AI

ECG foundation models performed well on general data but less so on athletes' data

ECG foundation models for cardiovascular screening in a cohort of young competitive athletes

ResearchJ Med Internet Res · Nov 20, 2026 · Digital Health & AI

Six large language models showed similar question-answering accuracy on medical exam questions

Medical Reasoning in Large Language Models: Development and Evaluation of the MedEvalArena Benchmark