title: rEHR: An R package for manipulating and analysing Electronic Health Record data.
abstract: Research with structured Electronic Health Records (EHRs) is expanding as data becomes more accessible; analytic methods advance; and the scientific validity of such studies is increasingly accepted. However, data science methodology to enable the rapid searching/extraction, cleaning and analysis of these large, often complex, datasets is less well developed. In addition, commonly used software is inadequate, resulting in bottlenecks in research workflows and in obstacles to increased transparency and reproducibility of the research. Preparing a research-ready dataset from EHRs is a complex and time consuming task requiring substantial data science skills, even for simple designs. In addition, certain aspects of the workflow are computationally intensive, for example extraction of longitudinal data and matching controls to a large cohort, which may take days or even weeks to run using standard software. The rEHR package simplifies and accelerates the process of extracting ready-for-analysis datasets from EHR databases. It has a simple import function to a database backend that greatly accelerates data access times. A set of generic query functions allow users to extract data efficiently without needing detailed knowledge of SQL queries. Longitudinal data extractions can also be made in a single command, making use of parallel processing. The package also contains functions for cutting data by time-varying covariates, matching controls to cases, unit conversion and construction of clinical code lists. There are also functions to synthesise dummy EHR. The package has been tested with one for the largest primary care EHRs, the Clinical Practice Research Datalink (CPRD), but allows for a common interface to other EHRs. This simplified and accelerated work flow for EHR data extraction results in simpler, cleaner scripts that are more easily debugged, shared and reproduced.
authors.affiliation: NIHR School for Primary Care Research, University of Manchester, Manchester, United Kingdom.|Centre for Biostatistics, Faculty of Biology, Medicine & Health, University of Manchester, Manchester, United Kingdom.
authors.forename: David A
authors.initials: DA
authors.lastname: Springate
authors.affiliation: Centre for Pharmacoepidemiology & Drug Safety, Faculty of Biology, Medicine & Health, University of Manchester, Manchester, United Kingdom.
authors.forename: Rosa
authors.initials: R
authors.lastname: Parisi
authors.affiliation: Informatics Research Centre, School of Computing Mathematics and Digital Technology, Manchester Metropolitan University, Manchester, United Kingdom.
authors.forename: Ivan
authors.initials: I
authors.lastname: Olier
authors.affiliation: NIHR School for Primary Care Research, University of Manchester, Manchester, United Kingdom.|Centre for Biostatistics, Faculty of Biology, Medicine & Health, University of Manchester, Manchester, United Kingdom.
authors.forename: David
authors.initials: D
authors.lastname: Reeves
authors.affiliation: NIHR School for Primary Care Research, University of Manchester, Manchester, United Kingdom.|The Farr Institute for Health Informatics Research, Faculty of Biology, Medicine & Health, University of Manchester, Manchester, United Kingdom.
authors.forename: Evangelos
authors.identifier: http://orcid.org/0000-0001-6450-5815
authors.initials: E
authors.lastname: Kontopantelis
mesh_terms: D016208:Databases, Factual; D057286:Electronic Health Records / Q000191:economics; D006801:Humans; D016247:Information Storage and Retrieval / Q000191:economics; D012984:Software / Q000191:economics; D013997:Time Factors; D057188:Workflow