Written and maintained by CASRAI Editorial Board
Last updated
An HL7 FHIR `Questionnaire` is a definitional metadata resource in the HL7 FHIR resource hierarchy that specifies the structure, item data types, terminology bindings, validation constraints, and conditional branching logic of a digital clinical assessment, patient intake form, prior authorization checklist, or clinical trial electronic Case Report Form (eCRF). When a patient, clinician, or clinical research coordinator fills out a `Questionnaire`, the submitted answers are persisted in a companion event resource—`QuestionnaireResponse`—and processed through the HL7 FHIR Structured Data Capture (SDC) specification (`$populate` and `$extract`) to synchronize form data with discrete EHR integration timelines.
How Do FHIR `Questionnaire` and `QuestionnaireResponse` Work Together?
HL7 FHIR strictly separates the immutable form template (`Questionnaire`, a Workflow/Definitional resource) from the patient-specific submission (`QuestionnaireResponse`, an Event resource). The structural bridge connecting the two resources is the mandatory `linkId` attribute assigned to every nested `item` element:
| Architectural Dimension | FHIR Questionnaire (Form Definition) |
FHIR QuestionnaireResponse (Completed Instance) |
|---|---|---|
| Primary Role | Defines the blank form schema, item prompts, value sets, and conditional skip logic | Records the actual answers supplied for a specific `subject` (`Patient`) and `encounter` |
| Canonical Identification | Versioned canonical URI (`url`: e.g., `http://example.org/Questionnaire/phq-9|1.0.0`) | References the template via `questionnaire` canonical URI and carries instance `status` (`in-progress`, `completed`, `amended`, `entered-in-error`) |
| Item Linking (`linkId`) | Every group, display banner, or question has a unique `item.linkId` (e.g., `”1.1″` or `”gad7-q1″`) | Each `item` echoes the exact `linkId` and `text` from the `Questionnaire` and stores values in `item.answer[]` |
| Data Types (`item.type`) | Declares expected type: `group`, `display`, `boolean`, `decimal`, `integer`, `date`, `dateTime`, `time`, `string`, `text`, `url`, `choice`, `open-choice`, `attachment`, `reference`, `quantity` | Stores typed value inside `answer[x]`: `valueBoolean`, `valueDecimal`, `valueInteger`, `valueDate`, `valueString`, `valueCoding`, `valueQuantity`, or `valueReference` |
| Terminology Binding | Binds questions to LOINC panel/question codes (`item.code`) and answers to `answerValueSet` or `answerOption` | Stores the selected `Coding` (`system`, `code`, `display`) plus optional ordinal score extension (`ordinalValue`) |
Conditional Branching (`enableWhen`) and Validation Rules
Within a `Questionnaire`, dynamic skip logic is declared declaratively using `item.enableWhen[]` and `item.enableBehavior` (`all` vs. `any`), allowing any standards-compliant form renderer (such as the National Library of Medicine’s open-source LHC-Forms widget) to hide or reveal follow-up questions without custom JavaScript:
- `enableWhen.question`: The `linkId` of the upstream controlling question (e.g., `”phq2-total”` or `”pregnancy-status”`).
- `enableWhen.operator`: Comparison operator (`exists`, `=`, `!=`, `>`, `<`, `>=`, `<=`).
- `enableWhen.answer[x]`: The threshold value that activates the dependent item (for example, enabling PHQ-9 items 3–9 only when the PHQ-2 prescreen total is `>= 3`).
What Is HL7 FHIR Structured Data Capture (SDC)? `$populate`, Calculated Expressions, and `$extract`
A raw `QuestionnaireResponse` is an archival snapshot of a form: if a patient enters their blood pressure or active medications on an intake `QuestionnaireResponse`, those values remain locked inside nested JSON arrays unless mapped to discrete clinical resources. The HL7 FHIR Structured Data Capture (SDC) Implementation Guide (`http://hl7.org/fhir/uv/sdc/`) solves this “locked-in-a-form” problem through three standardized operations and extensions:
1. Automated Form Pre-Population (`$populate`)
When a clinician or trial coordinator opens a complex form (such as a prior authorization DTR checklist or an oncology trial baseline eCRF), the client invokes `POST [base]/Questionnaire/$populate` passing the `Questionnaire` identifier and the `subject` (`Patient/123`). SDC supports three mechanisms embedded inside the `Questionnaire` definition to query the EHR FHIR server and pre-fill known answers:
- Observation-Based Population: Matches `item.code` (such as LOINC `29463-7` Body weight) against recent FHIR `Observation` resources within an allowed lookback window (`sdc-questionnaire-observationLinkPeriod`).
- Expression-Based Population: Evaluates embedded FHIRPath or Clinical Quality Language (CQL) queries (`sdc-questionnaire-initialExpression` and `sdc-questionnaire-itemPopulationContext`) against the patient’s chart to pre-fill demographics, ICD-10-CM `Condition` codes, or laboratory values.
- StructureMap-Based Population: Executes a formal FHIR Mapping Language `StructureMap` transformation.
2. Real-Time Calculated Scoring (`calculatedExpression`)
Using the `sdc-questionnaire-calculatedExpression` extension, a `Questionnaire` embeds a live FHIRPath formula that automatically sums ordinal item weights (`http://hl7.org/fhir/StructureDefinition/ordinalValue`) as the user selects answers—computing total scores for instruments like the PHQ-9 (LOINC `44261-6`), GAD-7 (`69737-5`), or NIHSS in real time.
3. Automated Data Extraction (`$extract`)
Once the user submits the completed `QuestionnaireResponse`, invoking `POST [base]/QuestionnaireResponse/$extract` converts the form answers into a FHIR transaction `Bundle` of discrete, queryable clinical resources (`Observation`, `Condition`, `AllergyIntolerance`, `MedicationStatement`, `FamilyMemberHistory`) linked back to the source `QuestionnaireResponse` via `derivedFrom` provenance pointers.
Working JSON Example: LOINC-Coded FHIR R4 `Questionnaire` and `QuestionnaireResponse`
The side-by-side JSON snippet below illustrates an SDC-enabled clinical screening item using LOINC codes, `ordinalValue` scoring weights, and a FHIRPath `calculatedExpression`, followed by its corresponding `QuestionnaireResponse`:
{
"resourceType": "Questionnaire",
"id": "phq2-sdc-example",
"url": "http://example.org/fhir/Questionnaire/phq2-sdc-example",
"status": "active",
"title": "PHQ-2 Depression Prescreen (LOINC 55758-7)",
"code": [{ "system": "http://loinc.org", "code": "55758-7", "display": "Patient Health Questionnaire 2 item (PHQ-2) [Reported]" }],
"item": [
{
"linkId": "q1-anhedonia",
"code": [{ "system": "http://loinc.org", "code": "44250-9" }],
"text": "Little interest or pleasure in doing things over the last 2 weeks",
"type": "choice",
"required": true,
"answerValueSet": "http://loinc.org/vs/LL358-3"
},
{
"linkId": "phq2-follow-up",
"text": "Specify duration of depressive symptoms",
"type": "string",
"enableWhen": [
{
"question": "q1-anhedonia",
"operator": "=",
"answerCoding": { "system": "http://loinc.org", "code": "LA6570-1" }
}
]
}
]
}
How Can Clinical Trials Use FHIR Questionnaires for eCRF and ePRO Data Collection?
In regulated clinical research (including HL7 Vulcan EHR-to-EDC initiatives and FDA eSource guidance workflows), FHIR `Questionnaire` and SDC bridge the long-standing gap between hospital EHRs and clinical trial Electronic Data Capture (EDC) systems:
- Standardized LOINC Form Libraries: The National Library of Medicine (NLM) publishes thousands of validated clinical assessment instruments and NIH Common Data Elements (CDEs) as downloadable FHIR R4 `Questionnaire` JSON definitions via the NLM Clinical Table Search Service and LHC-Forms.
- SMART on FHIR eSource Pre-Population: When a clinical research coordinator launches an EDC eCRF form inside the hospital EHR via SMART on FHIR, SDC `$populate` pulls verified vital signs, concomitant medications, and central lab results directly into the eCRF, preserving an FDA 21 CFR Part 11 `Provenance` link to the originating EHR `Observation` and eliminating transcription errors.
- ePRO & Decentralized Clinical Trials (DCTs): Participant mobile apps render the exact same FHIR `Questionnaire` JSON definition across iOS, Android, and web browsers, guaranteeing identical item wording, `enableWhen` branching, and CDISC ODM/SDTM variable mapping across multi-center international trials.
Frequently Asked Questions
How do FHIR Questionnaire and QuestionnaireResponse work together?
In HL7 FHIR Release 4, `Questionnaire` is the canonical metadata definition (the blank form template) specifying the nested hierarchy of groups and questions, data types, LOINC/SNOMED terminology bindings, and `enableWhen` skip logic, with every item identified by a unique `linkId`. `QuestionnaireResponse` is the completed instance resource capturing a specific patient’s or clinician’s answers at a point in time, referencing the canonical `Questionnaire` URL and pairing each recorded `answer[]` array to the corresponding `linkId`.
What is HL7 FHIR Structured Data Capture (SDC)?
HL7 FHIR Structured Data Capture (SDC) is an official HL7 Implementation Guide (`http://hl7.org/fhir/uv/sdc/`) that extends the base FHIR `Questionnaire` and `QuestionnaireResponse` resources with advanced rendering controls, FHIRPath/CQL calculated expressions (for automatic score summation), automated form pre-population from existing EHR data via the `$populate` operation, and automated post-submission conversion of form answers into discrete clinical FHIR resources (`Observation`, `Condition`, `MedicationStatement`) via the `$extract` operation.
How can clinical trials use FHIR Questionnaires for eCRF data collection?
Clinical trial Electronic Data Capture (EDC) and ePRO platforms represent electronic Case Report Forms (eCRFs) and validated Patient-Reported Outcome instruments (such as PHQ-9 or PROMIS) as LOINC-coded FHIR `Questionnaire` resources. Using the FHIR SDC `$populate` operation during an EHR-integrated SMART on FHIR launch, the eCRF automatically pre-populates patient demographics, vital signs, and laboratory results from the hospital EHR (eliminating manual coordinator transcription), and stores the verified submission as an auditable `QuestionnaireResponse` mapped to CDISC ODM/SDTM variables.
Sources
- HL7 International. HL7 FHIR Release 4 — Questionnaire Resource Specification.
- HL7 International. HL7 FHIR Release 4 — QuestionnaireResponse Resource Specification.
- HL7 International. HL7 FHIR Structured Data Capture (SDC) Implementation Guide (`$populate`, `$extract`, and Adaptive Forms).
- National Library of Medicine (NLM). LHC-Forms: NLM FHIR Questionnaire Rendering Widget and LOINC Form Library.







