Abstract
Electronic health records data are becoming a key data resource in clinical research. Owing to issues of data efficiency, electronic health records data are being used for clinical trials. This includes both large-scale pragmatic trails and smaller—more focused—point-of-care trials. While electronic health records data open up a number of scientific opportunities, they also present a number of analytic challenges. This article discusses five particular challenges related to organizing electronic health records data for analytic purposes. These are as follows: (1) data are not organized for research purposes, (2) data are both densely and irregularly observed, (3) we don’t have all data elements we may want or need, (4) data are both cross-sectional and longitudinal, and (5) data may be informatively observed. While laying out these challenges, the article notes how many of these challenges can be addressed by careful and thoughtful study design as well as by integration of clinicians and informaticians into the analytic team.
Electronic health records (EHR) data are a ubiquitous source of real-world data used for clinical research. They are currently being used for studies ranging from clinical risk prediction 1 to comparative effectiveness 2 to population health. 3 The appeals of EHR data are numerous. For a single health system, they consist of readily available data on a potentially large number of patients with clinical variables captured over a variety of fields. Finally, as a naturally collected data source, they are relatively cheap to use for research and evaluation purposes.
As the 2019 Conference on Statistical Issues in Clinical Trials highlighted, EHR data are increasingly being used for clinical trials. This includes both small single health system–based trials 4 and large pragmatic multisite trials. 5 A particular appeal, with regard to clinical trials, is that unlike some clinical trial samples, the source population from an EHR is highly representative of an identifiable patient population. 6 There are a number of ways that EHR data can be used to support various stages of clinical trials (Table 1). At the outset, EHR data can be used to inform the design of clinical trials by helping to select study end points or ideal study population. 7 The second is through participant recruitment where EHR systems can be used to detect patients eligible for point-of-care studies. 8 Another is through the use of pragmatic trials. 9 In these studies, the trialist relies on the naturally collected EHR data to adjudicate patient characteristics and outcomes 10 as opposed to purposefully collected clinical research forms. The fourth is through the translation of clinical trials results to clinically meaningful target populations. 11 Finally, EHR data can be used for adverse event reporting and post-market surveillance. 12
Uses of EHR data to support clinical trials.
EHR: electronic health records.
Ultimately, EHR data allow researchers to design cheaper and more efficient studies. 13 While the appeals for using EHR data to support clinical trails are numerous, because the data are not collected for research purposes–but to support clinical care and billing–there are important considerations that statisticians and analysts need to consider when working with EHR data. This article discusses five particular challenges analysts may encounter in organizing EHR data for analytic purposes–both for prospective and retrospective studies–and some design considerations that one can employ to address these challenges (Table 2).
Data challenges and design solutions.
Challenge 1: data are not organized for research purposes
One of the biggest challenges with EHR data is structural: they are not organized for research purposes. In their rawest form, EHR data are typically stored in large relational databases that can have thousands of tables. For example, EPIC, 14 the largest EHR vendor for academic medical centers, has in its base structure, Chronicles, approximately 95,000 data elements. These data are stored nightly into a data warehouse, Clarity, which contains ∼12,000 tables consisting of ∼125,000 columns. Even the simplified version of the EPIC data structure, Caboodle, contains 19 tables and 76 dimensions. 15 This complicated form is designed to maintain the granularity of the data. As such, it is often impossible for statisticians to work with the source data. Instead, one typically needs to partner with an informaticist that has a deep understanding of the back-end system. Once the needed elements are identified—typically in conjunction with the clinical team—the informaticist can write code that pulls the required data.
Once the appropriate data elements are pulled, one still has to do significant data processing. In most analyses, it is necessary to determine which conditions a patient has—for example to indicate study eligibility. However, within the EHR, there is not a single field that indicates a patient’s conditions. While there are designations for “problem lists,” these are often not very reliable. 16 Instead, it is necessary to use the observed data to construct computable phenotypes. Computable phenotypes are Boolean definitions—usually based on a combination of diagnosis codes, testing results, and/or medications—that are used to indicate whether a patient has the condition of interest. For example, a computable phenotype for diabetes may include the presence of a diabetes diagnosis code OR the presence of diabetes medication OR a hemoglobin A1c test > 6.5%. 17 The type of definition used will impact the sensitivity and specificity of the final phenotype. 18 While in the author’s experience the specific phenotype itself does not typically alter model inference, if there is differential amounts of information known about different patients, bias can be induced. 19 Given the number of potential phenotype definitions, it is not generally feasible to compare inference when all different definitions are used. However, it may be advisable to perform sensitivity analyses for a few different versions of the primary outcome and/or exposure. Often times one wants a more specific definition when it comes to exposure or outcome assessment while a more sensitive definition can be used for comorbidity assessment. Overall, the research team a priori defines the primary phenotype definition to be used throughout the analysis.
Solution: use of data models and DataMarts
There are many decisions that need to be made when setting up analytic data. One way that this is often resolved is through the use of Common Data Models (CDMs). CDMs are a set of “rules” that indicate which data elements need to be extracted from the health record and how they ought to be handled. Typical CDMs include the PCORnet CDM 20 and the Observational Medical Outcomes Partnership CDM. 21 While CDMs can be used in a variety of research settings, they provide the greatest benefits when working across multiple centers. Since different sites will often have different and unique back-end EHR systems, a CDM provides a uniform set of standards for how data need to be handled.
The data model can also help define how medications and diagnosis codes may be grouped together. Many data elements are represented in overly granular form. For example, it may not be necessary to know precisely the type of antibiotic a patient received, just simply that they received an antibiotic. Ontologies such as RxNorm and Clinical Classification Software provide a hierarchical system to allow research to “roll” the data elements to the proper level of granularity.
Once the relevant data elements are defined, it is often helpful to organize the data into research DataMarts-focused relational databases. DataMarts can be useful for organizing retrospective data as well as prospectively to track patients enrolled in a study. One particular appeal is that depending on the research environment, the DataMarts can be designed to automatically refresh as patients have more encounters with the EHR system.
Challenge 2: data may be measured repeatedly, infrequently, or not at all
One of the appeals of EHR data is the ability to view data over time. However, this also means that it is typical for many data elements to be observed multiple times, infrequently, or not at all. For example, depending on the length and type of follow-up, it is typical for an individual to have multiple vital signs measurements over time. Conversely, for laboratory values, it is typical for some patients to have multiple measurements while others have none. Moreover, the amount of data a patient has is typically informative of a patient’s health status. 22 Therefore, it is not reasonable to assume the uncollected measurements are missing-at-random, 23 that is, missingness is conditional on observed covariates. As such typical strategies to resolve missingness—like multiple imputation—may not be valid. 24
Solution: flexible analytic models
Depending on the data structure and the particular question, different analytic designs may be necessary. For a study with multiple repeated exposures (e.g. blood pressure) and single time-to-event outcome (e.g. heart disease), a time-varying covariate Cox Model 25 would be appropriate. For questions with a repeated outcome, a longitudinal mixed model may be used. 26 When an exposure variable is measured repeatedly, it is unclear whether it is best to model the variable trajectory (e.g. via joint models), 27 simply the most recent measurement or a summary measurement (e.g. median, min/max). Work within the context of predictive models suggest simpler summarizations do just as well as more complex models,28,29 though more work is needed within the inferential context.
When data are irregularly collected, and the collection mechanism is informative, the absence of the measurement needs to be directly accounted for in the analytic model. This can be achieved by including a count for the number of times a laboratory is measured or by generating a categorical variable that contains levels: “normal,”“high,”“low,” and “not-collected.” All else being equal, such categorization is less efficient than using the continuous variable and can lead to loss of information. 30 However, such categorization captures the informativeness of the collected data while retaining the non-linear relationship that many clinical variables have on outcomes, presenting a worthwhile trade-off.
Challenge 3: we don’t have everything we want
EHR data are appealing because of the depth of information they provide on a patient. However, it is important to be cognizant of which data elements are not well captured. Köpcke et al. 31 noted how many of the components needed to run a clinical trial—particularly data around health status and consent—are not contained within EHRs. Similarly, the general analytic assumption is that the absence of a data element (e.g. a medication prescription, diagnosis code) implies the absence of the event. 24 However, this is not always the case—particularly for patients who make seek care at multiple facilities. 32 A particular weakness in most EHR systems are indicators of social health: socio-economic status, alcohol use, nutrition, and patient-reported outcomes. Depending on the study, these data elements may need to be collected separately or captured via proxy variables. For example, a proxy for individual socio-economic status can be captured based on knowledge of one’s address and characterizing the socio-economic status of their neighborhood. 33 Moreover, it may be desirable to link EHR data with external data such as environmental and geospatial data. 34
A more challenging problem is clinical information that are not captured. Since EHR data are derived from the perspective of the health system (i.e. provider), encounters outside the health system will not be observed. This is one of the biggest differences between EHR data and administrative/billing data. Administrative data, which are collected by the payer, typically follows a patient across different providers. The lack of comprehensive patient encounters is a particular challenge if the health system from which data are derived is primarily a referral center or is in a locale with competition from other systems. This means that a patient may have encounters—indicative of either a changing exposure or outcome—that is not captured in the EHR being analyzed. Moreover, there is typically no indication that these encounters may have occurred—they are truly unobserved.
Solution: defining regular patients
The primary solution to this is to design one’s study to include patients that are regular users of the health system of interest. It is important to note that this will change the target population from which inference is derived. Moreover, it won’t resolve all missed encounter. However, reframing the analytic question around a well-defined patient population will increase the overall capture, on a per-person basis. In practice, for retrospective analyses, this typically requires including “burn-in” periods where a patient is required to have a certain number of visits to the health system before they are eligible for study. It is also possible to use the granular data to require a patient has, for example, a primary care provider within the health system. A more complete, albeit more challenging, solution is to link administrative data with EHR data. 35 In addition, linking in external data sources can help mitigate some missing data challenges. 24 Ultimately, it is important to assess the quality and fit-for-use of the data being used. 36 Sometimes it is important to acknowledge that the data one has is not well suited for answering the desired questions.
Challenge 4: data are both longitudinal and cross-sectional
A challenging aspect of working with EHR data is that the data share characteristics of both cross-sectional and longitudinal data.
EHR data as cross-sectional data
Typically, when working with EHR data one has a limited and often arbitrary temporal selection of data. The beginning date is often based on when the medical system switched on to an integrated EHR platform, while the end date will be based on the most recently available data. This means that the analyst often does not have a complete history or follow-up on patients. This is particularly challenging if she or he wants to know how long a patient has had a given disease to define study eligibility.
EHR data as longitudinal data
At the same time, as discussed above, patients are observed at multiple points over time. This allows one to perform time-to-event and trajectory-based analyses. However, this longitudinal cohort is also dynamic. Patients can enter and leave the catchment of the health system that underlies the record system. This makes defining exposure history challenging because it is not always obvious if a patient lacks an encounter because she or he had no health problems or just recently moved into the catchment.
Solution: definitions of study eligibility
As above, the development of eligibility rules, via burn-in periods, is important. If we want to define the incidence of disease or medication usage, we may want to require a 2-year history where there is no indication of that disease or medication. Borrowing from traditional cohort studies, nested case–control designs become very useful. 37 Here, one can identify people when they have an outcome of interest and then sample a control who had not developed the outcome yet. Another approach is to identify an arbitrary landmark time point (e.g. 1 January of a given year). This cross-sectional point creates a notion of a uniform time 0 as well as a common window across which to define patients’ clinical history. If there is a particular intervention point from which to evaluate, one can also employ “new-user” designs. 38 Employing traditional case–control designs, while occasionally appealing, is more challenging as it can induce selection bias if controls are not properly defined. 39
Challenge 5: the information collected is informative
While the previous challenge concerns data we do not see, we also have to be wary of data we do observe. Since patients are engaging with the health system when they are sick, and doctors are taking measurements on factors for which they are concerned, most measurements can be considered informative. This has been termed “informed-presence.” Related to data Missing Not At Random, informed presence emphasizes the fact that what we observe is informative. Informed presence of data is best expressed by the notion that, with EHR data, we have more information about sicker patients. 22 As such it is important to always consider why certain data elements are being observed. There are a few ways that informed presence can manifest itself:
It is easier to generate computable phenotypes for sicker patients. 40 The fact that we have more data on sicker patients is in itself not surprising. However, what this means is that we also have non-differential misclassification where it is easier to phenotype sicker patients.
The type of care a person seeks is informative. The same data collected on the same person in the emergency department is often significantly different than when it’s collected in the outpatient setting. 32
The type of facility a patient seeks care at is informative. 32 Health systems often consist of a mixture of primary care, community, and tertiary care hospitals. An individual may use a mixture of these facilities. While these encounters will all be captured within the health record, it is important to be aware that the types of services a patient receives at each facility will differ. For example, one is more likely to have the data elements to phenotype a patient for potential cancer at a tertiary care center than a community center.
Non-local or referral patients are often qualitatively different from local patients. 32 Patients that seek care out of their typical locale often have more severe and complicated disease than community patients. Recognizing this potential admixture is important in cohort definitions.
If patients seek care only when they are sick, their biomarker values may be elevated. 41 This can generate feedback loops that induce associations.
The presence of these informative data, which generally can be thought of as a selection process, 42 can impact study inference.
Solution: design with patient selection in mind
First and foremost, it is important to understand the process dictating how patient data are observed and selected into the analytic dataset. This is where clinical partners are most useful since they have a deeper understanding of why patients may or may not have a given encounter and why some information may or may not be collected. While we cannot avoid all aspects of informative selection, many of these effects can be mitigated by careful design. For example, including patients that are local ensures that there is no bias due to admixture. Similarly, mainly using data from outpatient settings avoids the adverse selection effects of being in the emergency department. In a related way, primarily using outpatient data increases the likelihood that some encounters are pre-scheduled and therefore not driven by a patient’s underlying health status. Incorporating such data into the analytic model can mitigate overall bias. 41 Additionally, since many forms of informed presence are driven by the amount of information we have on a patient, analytically conditioning on the number of encounter—that is., the amount of information we have on a patient—can also mitigate the biasing effects of the differential misclassification.40,41 Finally, work has shown that mixed models tend to perform well in these settings as the more important slope parameters are less prone to bias.43,44 When one wants to directly model the informative visit process, more sophisticated joint models have been proposed.45,46
Summary
EHR data have become an important resource for clinical research and are increasingly finding their way to support clinical trials. Not only do they provide cheap access to granular patient data, they also ensure that a truly relevant clinical population is being observed. However, since EHR systems were not designed for research purposes, they present many analytic challenges including setting up the data, accounting for what data were not collected, handling of temporality, and resolving informative visit processes. Thoughtful study design can mitigate many of these challenges. As discussed, fully understanding these challenges requires insight into the analytic design, the source of the data, and the nature of the clinical encounter. As such, resolving these challenges requires the joint contribution of statisticians, informaticians, and clinicians.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) received no financial support for the research, authorship, and/or publication of this article.
