Filling a Questionnaire
A questionnaire job fills a form you define from one clinical document. You
send any FHIR R4 Questionnaire and receive a FHIR R4 QuestionnaireResponse that
answers it.
Submitting
The item text is what the document is searched for, so write it as a clinician
would read it. A group’s text gives context to the items inside it: “Size” in a
“Margins” group is understood as the margin size.
What is supported
Answer types
Choice lists
Coded items (choice, open-choice, and the R5 spelling coding) are answered
only from your list: the answer is constrained to your options, and a
code you did not define never appears in the response. When the document addresses
an item but what it says is not on your list, the item is normally left unanswered
rather than given the nearest option.
The list can be given in any of these ways:
- Inline
answerOptions: codings, orvalueString,valueInteger,valueDateorvalueTimeoptions. The answer echoes the option exactly, with its own type. R5 option lists onstring,integer,dateandtimeitems work the same way. - A ValueSet contained in the Questionnaire, referenced as
"#id". Its codes can be enumerated (compose, withexcludehonoured) or already expanded (expansion.contains, nested groupings allowed):
An external value set (for example
https://fhir.loinc.org/ValueSet/LL2201-3), one defined by a rule (a filter),
or a contained one with more than 200 codes is not expanded: the item is answered
as free text. Give such options inline or as a contained, enumerated ValueSet.
Some lists also accept answers that are not on them:
Form logic
enableWhenwith every operator (exists,=,!=,>,<,>=,<=), against coded, string, number and boolean answers, andenableBehavior. Items your logic disables are left unanswered.- Implied controls. When an item is gated on a yes/no control (“Eye opening not testable” = false) and the document answers the item, the control is recorded too: an eye response was observed, so eye opening was testable. Without it, FHIR’s rules would hide the answered item.
repeats: oneanswerper value; a repeating group gives oneitemper occurrence (one per procedure, say). A value stated once (a single CPT code, for example) is not repeated into later occurrences.
Scores
A score defined with an SDC calculatedExpression that sums the weights of the
options chosen is calculated from those options, not estimated. Weights come
from itemWeight or ordinalValue on your options; both common ways of writing
the expression are recognised:
The total is filled only when every component is answered with a weighted option: a component answered “Not testable” (no weight) leaves it empty. Other kinds of expression are not evaluated.
Instructions on the form
display items and help text are read as instructions for filling
the form (“If a component cannot be tested, record ‘Not testable’”). Display items
with their own enableWhen, such as an interpretation shown for some scores, are
results rather than instructions and are not used.
Items left to your system
These are never filled from the document:
Items pre-filled with initial or an SDC initialExpression (an assessment time of
now(), say) are answered if the document states them, and never count as missing.
Completeness
status is completed when every required item that your form logic enables is
answered, and in-progress otherwise; stats.required_missing lists those items.
An in-progress response is a normal, successful result: the document simply does
not state everything your form requires.
The result
Points to note:
- Unanswered items are omitted.
pni.nerveis absent because the document says perineural invasion was not identified, so yourenableWhendisables it. An item the document says nothing about is omitted in the same way. questionnaireis set to your Questionnaire’surl, when it has one.statusiscompletedhere because the form requires nothing the document leaves out; see Completeness.- Extensions on each answer:
The QuestionnaireResponse carries the evidence quote but not its position. To highlight evidence in the document, find the quote in the text you sent; see Results and evidence.
Stats
stats counts what happened in the fill: answers given, dropped and located, and
the required items left unanswered (required_missing). Every field is described in
Result format.
Large forms
A document and its Questionnaire are read together. If the two together are too
large, the job fails with input_too_large. Split the
document, or the Questionnaire, and submit the parts as separate jobs. See
Limits for the size limits checked when you submit.

