03 · What You Need to Know
Building Defensible Exposure and Outcome Definitions from Routine Data
Start with the Concept, Not the Available Database Field
An exposure is a characteristic, experience, condition, intervention, or event whose relationship with an outcome is being investigated. An outcome is the event, condition, measurement, or state the study seeks to explain, predict, or compare.
These terms describe analytical roles rather than fixed properties of particular variables. Hospital admission might be an outcome in one study and an exposure in another.
Before examining available codes, state precisely what the exposure and outcome mean in the research question.
For example, "medication use" could mean a prescription was written, a prescription was dispensed, a medication was administered, or a patient actually consumed it. These are different constructs, even though each may be represented by a medication-related record.
Similarly, "academic engagement" might refer to class attendance, interaction with learning resources, participation in activities, or a broader psychological construct. Login counts alone do not necessarily represent all these dimensions.
First define the intended construct. Then assess whether the available data can support an appropriate operational measurement.
Identify the Records That Could Represent the Exposure or Outcome
Routine databases contain different forms of evidence. Their suitability depends partly on why the information was originally recorded.
| Record type |
Possible research use |
Important limitation |
| Diagnosis codes |
Identify recorded conditions or clinical events |
Coding may reflect suspected diagnoses, reimbursement, or documentation practices |
| Prescription records |
Identify prescribing decisions |
A prescription does not establish dispensing or consumption |
| Pharmacy dispensing claims |
Identify medications supplied through covered channels |
Dispensing does not establish actual ingestion |
| Laboratory results |
Define outcomes using measured biological indicators |
Testing may be selective, and thresholds or assays may differ |
| Hospital admission records |
Identify documented admissions |
Events outside the contributing system may be unobserved |
| Learning-platform activity logs |
Identify recorded online participation |
Offline activity and meaningful engagement may not be captured |
| Administrative status records |
Identify eligibility, enrollment, or program participation |
Status may not establish actual receipt of the intended service |
Researchers should inspect the underlying data dictionary and collection procedures rather than assume that a familiar variable name has a universally consistent meaning.
Choose Between Single-Record and Algorithm-Based Definitions
Some exposures and outcomes can reasonably be identified using one record. Others require a combination of observations.
A single-record definition might classify a patient as having a recorded diagnosis when a specified diagnostic code appears at least once. A more restrictive algorithm might require repeated qualifying codes, a particular care setting, or supporting laboratory evidence.
In routine health-data research, such rules are often described as phenotype algorithms or computable phenotypes. They translate a clinical concept into executable criteria that can be applied consistently to records.
More restrictive definitions may improve positive predictive value in some settings, but they can also exclude genuine cases. Requiring repeated diagnoses, for example, may systematically omit patients with limited healthcare access or those who experience only one documented encounter.
There is no universal rule that two codes are better than one. The appropriate algorithm depends on the condition, data source, research purpose, and empirical validation evidence.
The Observational Health Data Sciences and Informatics (OHDSI) framework illustrates how computable cohort definitions can combine concept sets, domain-specific attributes, and temporal criteria.
Specify Codes and Classification Rules Completely
If a definition uses diagnostic, procedure, medication, or administrative codes, identify the applicable coding system and its version where relevant.
Examples include ICD classifications for diagnoses and standardized terminology systems used within particular electronic health record environments. Administrative and educational systems may use institution-specific categories instead.
Document whether the algorithm includes:
- Exact codes or a defined code set.
- Broader categories and their included subcategories.
- Required numbers or combinations of records.
- Qualifying care settings, departments, or record sources.
- Measurement thresholds and units.
- Exclusions and exceptions.
- Applicable dates and temporal relationships.
Code selection should follow the substantive definition rather than simply include every available code with a similar description.
Where coding systems changed, determine whether historical codes represent the same concept. The implications of coding changes over time may be particularly important for longitudinal analyses.
Establish the Index Date and Observation Windows
The index date is a reference date used to organize eligibility, exposure assessment, baseline characteristics, and follow-up. Depending on the design, it may be the date of treatment initiation, enrollment, diagnosis, or another qualifying event.
Researchers must distinguish at least three temporal questions:
- When is an individual eligible to enter the study?
- During which period is exposure status determined?
- During which period can the outcome be observed?
For a study comparing new users of two medications, the index date might be the first qualifying dispensing date after a prespecified period without either medication. The period before index could be used to establish prior medication history and baseline characteristics. Outcomes would then be evaluated during a defined follow-up period.
The required length of prior observation depends on the research question, data availability, and the likelihood of misclassifying prevalent exposure as new exposure.
Importantly, a patient's first recorded event is not necessarily their first event in reality. It may simply be the first event visible within the database.
Prevent Temporal Misclassification and Immortal Time Bias
Exposure definitions can introduce serious bias when they use information that becomes available only after follow-up has begun.
Suppose patients are classified as exposed if they receive a treatment at any point during the first six months after hospital admission. If follow-up begins at admission and patients are classified as treated from that date, the period before actual treatment may be incorrectly assigned to the treated group.
Depending on the design, this can create immortal time bias because patients must remain alive or otherwise event-free long enough to qualify for the exposure classification.
Potential solutions include defining exposure at a common baseline, using time-varying exposure methods, or designing an appropriate target-trial emulation. These approaches require their own assumptions and should be selected according to the causal question.
Watch Out
Do not classify participants using future exposure information while treating them as exposed from an earlier date unless the design and analysis explicitly accommodate that timing. Correct temporal alignment is essential even when the recorded codes themselves are accurate.
Distinguish Recorded Events from Actual Events
Routine records generally establish that something was documented within a particular system. They may not establish that the underlying event occurred exactly as recorded, or that an undocumented event did not occur.
A diagnosis code may represent a confirmed condition, a working diagnosis, or a billing-related classification. A recorded absence of treatment may mean no treatment occurred, or that treatment occurred outside the available system.
For outcomes, distinguish between incident events, prevalent conditions, repeated events, and administrative recording dates.
For example, the date a diagnosis was entered may not equal the date symptoms began. A researcher studying time to disease onset should not automatically substitute the first available diagnosis date without explaining what that date represents.
Likewise, the absence of a recorded diagnosis should not automatically be interpreted as evidence that a person does not have the condition.
Evaluate Exposure and Outcome Misclassification
Misclassification occurs when an operational definition assigns an incorrect exposure or outcome category.
False positives occur when a record-based algorithm identifies an event or condition that is not present according to the chosen reference standard. False negatives occur when genuine events are not identified.
Four familiar validation measures can help characterize binary definitions:
| Measure |
Question answered |
| Sensitivity |
Among true cases, what proportion does the algorithm identify? |
| Specificity |
Among true noncases, what proportion does the algorithm correctly exclude? |
| Positive predictive value |
Among algorithm-positive records, what proportion are true cases? |
| Negative predictive value |
Among algorithm-negative records, what proportion are true noncases? |
Predictive values depend partly on the prevalence of the condition in the population being evaluated. A definition with favorable performance in one setting may perform differently in another.
Misclassification may also differ between exposure groups, institutions, or periods. For instance, patients receiving a particular treatment may undergo more frequent monitoring, increasing the probability that an outcome is detected and recorded.
Such differential ascertainment can distort estimated associations. Misclassification does not invariably weaken an association toward the null, and the direction of bias should not be assumed without considering the study design and error structure.
Validate Definitions Against Appropriate Evidence
Validation should examine whether the operational definition identifies the intended concept with sufficient accuracy for the research purpose.
Potential reference sources include adjudicated clinical records, independently reviewed charts, registries, laboratory evidence, or other sufficiently credible sources.
Where possible, evaluate validation performance in the same population and recording environment used for the study.
A validation study from another country, institution, or period may be informative, but its transportability requires consideration. Differences in coding incentives, clinical practice, disease prevalence, and data coverage can change algorithm performance.
When validation is unavailable, researchers should explain the basis for the definition, assess face and construct validity where appropriate, compare alternative definitions, and acknowledge unresolved uncertainty.
Reproducibility alone is not validation. An algorithm can produce identical classifications every time it is run and still identify the wrong construct.
Use Sensitivity Analyses to Examine Definition Dependence
Researchers can often assess whether substantive conclusions depend heavily on particular operational choices.
For example, an outcome might be defined using one qualifying diagnosis, two diagnoses within a specified period, or a diagnosis combined with a relevant laboratory result.
Comparing these definitions can show how estimated event counts and associations change under alternative assumptions.
However, agreement across several imperfect definitions does not establish that any of them is correct. Alternative algorithms may share the same systematic errors.
Where feasible, prespecify a primary definition and justify secondary definitions before examining their associations with the main exposure.
Make the Operational Definitions Reproducible
Another researcher should be able to understand exactly how exposure and outcome status were assigned, even when the underlying individual-level records cannot be shared.
Document the source tables, code sets, inclusion and exclusion criteria, thresholds, date rules, observation windows, handling of repeated events, and software logic used to construct each variable.
Where permitted, provide executable code or detailed pseudocode. Maintain versioned definitions when algorithms change during study development.
The RECORD reporting statement specifically addresses the disclosure of codes and algorithms used to classify exposures, outcomes, and other analytical variables in studies using routinely collected health data.
Transparent definitions make it possible for readers to evaluate methodological choices rather than treating derived variables as unexplained properties of the database.