MedMij FHIR Implementation Guide: Questionnaires 2.0.25
Work in progress - See official publication here. |
1 Introduction
This page describes the exchange of questionnaires and questionnaire responses within MedMij. A questionnaire is an organized collection of questions intended to solicit information from patients, providers or other individuals involved in the healthcare domain. A questionnaire may take the form of a straightforward flat list of questions, but may also be hierarchically organized in groups and sub-groups. Likewise, it can contain a wide range of question types, varying from simple fill-out fields to multiple-choice questions, scales and questions with dependency's to previous answers.
These questionnaires are captured using the FHIR Questionnaire resource, which defines the questions to be asked, their ordering and grouping, instructional text and the constraints on the answers. The results of a Questionnaire are communicated using the QuestionnaireResponse resource. To support the logistics of assigning and answering a questionnaire, a Task resource is used. In this IG, it will be referred to as "QuestionnaireProvisioningTask".
This information standard is inspired by the international Structured Data Capture (SDC) implementation guide and tries to follow it where possible. However, the first version of this information standard is more restricted than SDC; specifically, the possibility for a XIS to pre-populate the questionnaire response is omitted in this first version. Also, contrary to most other use cases for MedMij, no specific HCIM models have been identified for prescribing and answering questionnaires.
This IG is a technical representation of the functional design and follows the principles of the general MedMij FHIR IG.
2 Actors involved
The table shows the relevant actors, systems and FHIR CapabilityStatements. The CapabilityStatements demonstrate the minimum conformance requirements for the described use cases.
A XIS may choose to host the Questionnaire resource or may refer to an external repository, as long as this Questionnaire doesn't contain any personally identifiable information and this external repository adheres to the overarching principles in the MedMij IG.
Actors | Systems | FHIR CapabilityStatements | |||
---|---|---|---|---|---|
Name | Description | Name | Description | Name | Description |
Patient | The user of a personal healthcare environment | PHR | Personal health record
|
CapabilityStatement: Client | FHIR Client requirements |
Healthcare professional | The user of a XIS | XIS | Healthcare information system
|
CapabilityStatement: Server | FHIR Server requirements |
3 Boundaries and relationships
The MedMij use case for questionnaires overlaps partially with the uses cases described in the Structured Data Capture (SDC) IG. Therefore, this IG tries to align as close as possible to the SDC IG. However, there are key differences that prevent the verbatim use of the SDC IG:
- The current use case is more restricted.
- The profiles for the MedMij use case reference HCIM based profiles for common resources like Patient, Practitioner, PractitionerRole and Organization.
- The interpretation of
mustSupport
and the use ofisModifier
in SDC differs fundamentally from other MedMij IG's and are therefore ignored in this IG. - The
QuestionnaireResponse.author
tells who the person is that provided the answers. For the current MedMij use case it is restricted to a patient. TheQuestionnaireResponse.subject
tells who the answers apply to. For the current MedMij use case it may be a patient, organization, practitioner, medical device or a payer.
4 Use case: retrieve questionnaire reference
4.1 List of invocations
The order of invocations follows the functional design. At first the questionnaire is assigned to the patient by a QuestionnaireProvisioningTask. The PHR extracts the reference to the Questionnaire resource from the "Questionnaire" slice in Task.input
and retrieves it from the XIS or from an external server.
This FHIR implementation guide assumes that the PHR system is able to make a connection to search Task resources at the XIS. It does not provide information on finding the right XIS nor does it provide information about security. These infrastructure and interface specifications are described in the 'MedMij Afsprakenstelsel'.
4.1.1 Client searches QuestionnaireProvisioningTask - PHR
Using a search operation, the PHR retrieves a QuestionnaireProvisioningTask containing a reference to the questionnaire from the XIS. The Task resource SHALL conform to the vl-QuestionnaireProvisioningTask profile and SHALL initially have Task.status
set to "requested" (see #QuestionnaireProvisioningTask state machine). The Questionnaire resource SHALL be referenced using valueReference.reference
of the "Questionnaire" slice in Task.input
.
GET [base]/Task/?code=http://loinc.org|74468-0&status=requested
If the search operation fails (cannot be executed, not that there are no matches), the return value is a status code 4xx or 5xx with an OperationOutcome (see the FHIR documentation on search).
5 Use case: retrieve questionnaire
5.1 List of invocations
5.1.1 Client retrieves the Questionnaire resource - PHR
Upon retrieving the QuestionnaireProvisioningTask, the PHR retrieves the Questionnaire resource referenced in the QuestionnaireProvisioningTask using a read operation. This reference may live on the same base as the XIS or may be an external server.
GET Task.input:Questionnaire.valueReference.reference
The Questionnaire resource SHALL conform to the Questionnaire profile.
If this operation fails (after repeated attempts), the PHR should close the QuestionnaireProvisioningTask with status "failed" (see #Updating the QuestionnaireProvisioningTask). This closes the QuestionnaireProvisioningTask and ends the workflow (see #QuestionnaireProvisioningTask state machine).
6 Use case: send questionnaire response
6.1 Client renders questionnaire form - PHR
The PHR should present the questions defined in the retrieved Questionnaire resource to the user, in accordance with their type, overall structure of the questionnaire, and restrictions on the answers. MedMij defines the following minimal subset of Questionnaire item types that a PHR MUST support:
- Group
- Display
- Boolean
- Decimal
- Integer
- Date / dateTime / time
- String / text
- Choice / open-choice, where the possible answers are defined using
option
elements - Quantity
The following elements of the Questionnaire.item
element MUST be supported:
Questionnaire.item.enableWhen
Questionnaire.item.required
Questionnaire.item.option
In addition, the following extensions MUST be supported:
A PHR MAY support other Questionnaire item types as well. However, if a PHR is unable to process any one part in the Questionnaire, it MUST reject the Questionnaire altogether, see below.
Note: for known questionnaires, a PHR may choose to use hardcoded over generated forms. However:
- A PHR implementing this information standard should always be able to generate a form for the minimal Questionnaire requirements.
- Currently, no coding system exists to identify known questionnaires. Known questionnaires might be recognized by the reference in the QuestionnaireProvisioningTask or by the Questionnaire.url field, which presents the canonical URL for the Questionnaire resource (even if it served elsewhere). Although the URL in the XIS reference or Questionnaire.url MUST be version specific, the PHR MUST check whether the referenced Questionnaire resource matches the one it has hardcoded
6.1.1 Multiple-choice questions in FHIR
Unfortunately, the FHIR core documention for the Questionnaire and QuestionnaireResponse resources is somewhat confusing and actually contains an error in the topic of multiple-choice questions. This section is meant to clarify the use of multiple-choice type questions in FHIR STU3.
In FHIR STU3 there are two scenarios for multiple-choice questions: in the first scenario, the answer MUST come from a list of predefined options, while in the second scenario, the user MAY alternatively provide a custom answer. In a Questionnaire resource, to define a multiple-choice question, item.type
MUST be set to "choice" for the first scenario, or "open-choice" for the second scenario. The answer options MUST be defined using either:
- The
Questionnaire.item.options
element, which contains a reference to a ValueSet with the possible answers. Note: support for this mechanism is not required for this information standard. - Using one or more
Questionnaire.item.option
elements, with possible answers defined asvalueCode
. Note: although the Questionnaire resource definesitem.option.value[x]
as a polymorphic element with multiple types, only coding is actually allowed. In the relevant profile, this element is therefore restricted to the coding type.
Likewise, the QuestionnaireResponse resource should capture the answer using QuestionnaireResponse.item.answer.valueCode
:
- If the user selects one of the predefined answers, it should be captured in the answer using the
code
(and if present,system
) elements of thevalueCode
. - If the question is of type "open-choice" and the user provides an alternative answer, it should be captured using the
display
element of thevalueCode
.
Questionnaire example:
<item>
<linkId value="example"/>
<text value="Example question"/>
<type value="choice"/>
<option>
<valueCoding>
<code value="EO1"/>
<display value="Example option 1"/>
</valueCoding>
</option>
<option>
<valueCoding>
<code value="EO2"/>
<display value="Example option 2"/>
</valueCoding>
</option>
</item>
QuestionnaireResponse example:
<item>
<linkId value="example"/>
<answer>
<valueCoding>
<code value="EO1"/>
<display value="Example option 1"/>
</valueCoding>
</answer>
</item>
6.2 List of invocations
This FHIR implementation guide assumes that the PHR system is able to make a connection to update the Task resource at the XIS and send the QuestionnaireResponse resource to the XIS. It does not provide information on finding the right XIS nor does it provide information about security. These infrastructure and interface specifications are described in the 'MedMij Afsprakenstelsel'.
6.2.1 Client accepts or rejects the Questionnaire
Upon retrieving the Questionnaire resource, the PHR SHOULD check if it is able to present a form that completely covers all the questions and structure and subsequently update the QuestionnaireProvisioningTask resource (see #Updating the QuestionnaireProvisioningTask):
- If the Questionnaire can be processed, Task.status SHALL be set to "accepted".
- If the Questionnaire cannot be processed, Task.status SHALL be set to "rejected". This closes the QuestionnaireProvisioningTask and ends the process (see #QuestionnaireProvisioningTask state machine).
6.2.2 Client provides QuestionnaireResponse - PHR
The answers to the questions in the Questionnaire resource are captured using an instance of the QuestionnaireResponse resource, which SHALL conform to the QuestionnaireResponse profile. If the PHR is unable to process the user response or in some other way is unable to create a QuestionnaireResponse resource, it should close the QuestionnaireProvisioningTask with status "failed" (see #Updating the QuestionnaireProvisioningTask). This closes the QuestionnaireProvisioningTask and ends the process (see #QuestionnaireProvisioningTask state machine).
Upon completion of the questionnaire by the user, the PHR system uses a transaction operation to simultaneously:
- Send the QuestionnaireResponse resource to the XIS.
- Update the QuestionnaireProvisioningTask at the XIS to set
Task.output.valueReference
to the QuestionnaireResponse. - Update the QuestionnaireProvisioningTask at the XIS to set
Task.status
to "completed".
A FHIR transaction is a POST command to the XIS endpoint:
POST [base]
The body of the POST operation SHALL be a Bundle resource with Bundle.type set to "transaction" that SHALL contain
- The QuestionnaireResponse resource as a
create
interaction. - The original Task resource with the required changes in
Task.status
andTask.output
as anupdate
interaction (see #Updating the QuestionnaireProvisioningTask).
Example:
<Bundle xmlns="http://hl7.org/fhir">
<type value="transaction"/>
<entry>
<resource>
<Task>
<id value="ORIGINAL_ID"/><!-- where ORIGINAL_ID is the Task.id as received from the XIS -->
<meta>
<profile value="http://nictiz.nl/fhir/StructureDefinition/vl-QuestionnaireProvisioningTask"/>
</meta>
<status value="completed"/>
...
<output>
<type>
<text value="QuestionnaireResponse"/>
</type>
<valueReference>
<!-- Reference to QuestionnaireRespones in the same Bundle -->
<reference value="urn:uuid:e607a55c-194d-447a-8cc7-7ab90e3660c3"/>
<display value="Response to questionnaire XXX">
</valueReference>
</output>
</Task>
</resource>
<request>
<method value="PUT"/>
<url value="Task/ORIGINAL_ID"/><!-- where ORIGINAL_ID is the Task.id as received from the XIS -->
</request>
</entry>
<entry>
<!-- Transient URL since the QuestionnaireRepsonse has no identity on the server yet -->
<fullUrl value="urn:uuid:e607a55c-194d-447a-8cc7-7ab90e3660c3"/>
<resource>
<QuestionnaireResponse>
<meta>
<profile value="http://nictiz.nl/fhir/StructureDefinition/vl-QuestionnaireResponse"/>
</meta>
...
<subject>
<!-- Relative references can't be used with an transient fullUrl, so all references should be
absolute URL's to the resource on the server -->
<reference value="http://server-base/Patient/..."/>
...
</subject>
...
</QuestionnaireResponse>
</resource>
</entry>
<request>
<method value="POST"/>
<url value="QuestionnaireResponse"/>
</request>
</Bundle>
If the server is able to process both resources, it SHALL return a HTTP 200 OK status code and SHALL also return a Bundle of type transaction-response
, that contains one entry for each entry in the request, in the same order, with the outcome of processing the entry. If the server is unable to process either of the resources, it SHALL not process any one of them and SHALL return an HTTP 400 or HTTP 500 type response. Also see the FHIR specification on transaction response.
Note: updating the QuestionnaireResponse is not supported in the use case.
7 Tracking the status using the QuestionnaireProvisioningTask
7.1 Introduction
Retrieving the questionnaire and sending the answers are two separate use cases, but they are meant to be used back-to-back; the XIS that prescribes the questionnaire ultimately expects a response to it (and a questionnaire response is only sent in response to a prescription, at least in the current version of this information standard). To track the status of the prescription fulfillment, a Task resource at the XIS server is used, which transitions through various stages until completion.
It is the responsibility of the PHR to update the QuestionnaireProvisioningTask at the different stages in the life cycle of the questionnaire, using an update operation (see #Updating the QuestionnaireProvisioningTask). This implies that the the Task resource should be made accessible by the XIS server for these updates, at least for the expected lifetime of the fullfillment cycle. Additionally, the PHR may perform a read operation of the Task resource at any time.
It is primarilly the responsibility of the PHR to bring the QuestionnaireProvisioningTask to a closed state. However, it is not guaranteed that the required update operation succeeds. If the PHR is unable to bring the QuestionnaireProvisioningTask to a closed state, the server may eventually close it because of business rules.
7.2 QuestionnaireProvisioningTask state machine
The Task resource can transition through the following states:
/----------------/-------------------\ | | | requested +--+-> accepted -+---> completed ----+---> X | | | | | \-------------\--> failed --------| | | \--> rejected -----------------------/
Only the transitions shown here are allowed. The server SHOULD reject any update that attempts to perform an illegal transition. See #Updating the QuestionnaireProvisioningTask.
7.3 Updating the QuestionnaireProvisioningTask
The Task resource at the XIS can be updated by the PHR using the FHIR update operation. To perform this operation, the modified Task resource should be sent using a PUT operation:
PUT [base]/Task/ORIGINAL_ID
Where ORIGINAL_ID is the Task.id
from the QuestionnaireProvisioningTask originally received from the XIS.
Note: the Task resource SHOULD be sent completely and without changes, apart from the relevant modifications.
The server may be unable to accept an update to the Task resource due to errors or because of business rules (e.g. because of an illegal status transition). In this case, the server SHOULD respond with a 400 type status code, accompanied by an OperationOutcome resource providing additional details (see the FHIR documentation on rejecting updates).
The PHR should try to recover from this response. If this is not possible, the PHR SHOULD attempt to update the status of the QuestionnaireProvisioningTask on the server to "failed" and stop further processing. If it is not possible to perform this update, the QuestionnaireProvisioningTask effectively remains in a stalled position. The server may eventually close it because of business rules.
8 FHIR profiles
MedMij uses the FHIR Packaging mechanism. This conveniently bundles all profiles, terminology, example material and other conformance resources you need into a single archive, which can be downloaded or installed using the appropriate FHIR tooling. This version of the information standard uses the following packages:
Note: packages use Semantic Versioning. Other versions can be used at will as long as they have the same major.minor number or a minor number higher than the stated version. |
Canonical URL | FHIR resource | HCIM EN |
---|---|---|
http://fhir.nl/fhir/StructureDefinition/nl-core-patient | Patient | Patient |
http://fhir.nl/fhir/StructureDefinition/nl-core-practitioner | Practitioner | HealthProfessional |
http://fhir.nl/fhir/StructureDefinition/nl-core-practitionerrole | PractitionerRole | |
http://fhir.nl/fhir/StructureDefinition/nl-core-organization | Organization | HealthcareProvider |
http://nictiz.nl/fhir/StructureDefinition/zib-Payer | Coverage | Payer |
http://nictiz.nl/fhir/StructureDefinition/zib-MedicalDevice | DeviceUseStatement | MedicalDevice |
http://nictiz.nl/fhir/StructureDefinition/vl-Questionnaire | Questionnaire | |
http://nictiz.nl/fhir/StructureDefinition/vl-QuestionnaireResponse | QuestionnaireResponse | |
http://nictiz.nl/fhir/StructureDefinition/vl-QuestionnaireProvisioningTask | Task |
9 Release notes
Release notes can be found on the functional design page.