T-Rx: A toolbox for reproducible processing of prescriptions (Rx) from electronic health records

Read the full article See related articles

Discuss this preprint

Start a discussion What are Sciety discussions?

Listed in

This article is not in any list yet, why not save it to one of your lists.
Log in to save this article

Abstract

Linkage between population-wide biobanks and electronic health records (EHRs) opens new opportunities to study the genetic and epidemiological underpinnings of treatment outcomes, a key step forward in delivering precision medicine. However, challenges include complexities in data extraction for longitudinal analyses, and the absence of reproducible phenotyping algorithms. Here, we present T-Rx, an open-source R package to streamline the processing of prescription and dispensing records, to enable reproducible and scalable analysis across EHR databases. T-Rx consists of three modules to derive treatment-related phenotypes from uncleaned prescription records: (1) Extraction and Imputation Module for extracting and imputing prescription details; (2) Exposure Ascertainment Module for converting prescriptions to longitudinal exposure periods; and (3) Phenotyping Module for creating reproducible proxy phenotypes that capture treatment and response patterns. We tested the utility of T-Rx in UK Biobank primary care records, with strength and quantity information extracted and imputed for 2,721,921 antidepressant and 430,705 antipsychotic prescriptions. The extraction functions were validated using oral hypoglycemic agent prescriptions in Clinical Practice Research Datalink Aurum, showing comparable performances to extraction using the NHS Dictionary of Medicines and Devices (dm+d) codes. The Exposure Ascertainment Module of T-Rx converts discrete prescription or dispensing events into longitudinal exposure periods in one-line R commands, with customizable parameters to account for real-world treatment complexities. The Phenotyping Module takes prescriptions as direct user input and returns analysis -ready data frames. Current phenotyping algorithms include antidepressant switching and treatment-resistant depression. The phenotyping functions also allow flexible parameter choices, such as treatment episode windows, definitions for switching and quality control criteria. Researchers can contribute phenotyping algorithms to T-Rx for reproducible use. T-Rx improves the accessibility of prescription information in biobanks, and analysis of dosage- and treatment-patterns across therapeutic areas. T-Rx contributes to open science through harmonized phenotypic definitions and reproducible analyses of proxy treatment outcomes.

Article activity feed