Questionnaires and Structured Data Capture
References
- FHIR Structured Data Capture
- NHS England Future NHS Virtual Wards Regional Uploads - LTC Virtual Wards
- NHS England Future NHS Virtual Wards
- Digital Health and Care Wales/Iechyd a Gofal Digidol Cymru -
UKCore Profiles
Note: Forms are not defined via FHIR Profiles, instead completed forms (FHIR QuestionnaireResponse) are defined in FHIR Questionnaires. For example:
Pattern
- Form Manager - see Creating Forms
- Provider (Form Application) and User Application - see Completing the Form
- Retrieve Existing Data - the use of existing patient data is not discussed in this IG but support for retrieving existing patient data is present on the hackathon servers, e.g. Shared Observation Records. For more details see FHIR SDC Form Population
See also Observation Data Capture Reminders
Creating Forms
In order for a form to be used consistently across the healthcare enterprise it must be defined and then stored in a repository.
The US National Laboratory of Medicine - FHIR Tools has several tools to support the curation of forms and a repository of forms.
The NLM Form Builder provides an web app which can be used to generate FHIR Questionnaires. For example:
- Open the form NLM Form Builder
- Select
Start with an existing form
- Then select
Import from LOINC
, enterVital Signs
and select the entry with74728-7
LOINC code. - When the top form is displayed, click on
Edit Questions
which displays the questions the forms contains.
This can then be stored on a central server to be shared with users. In the NLM Form Builder this can be done by using the export function. The address of the UKCore Hackathon Server is
https://3cdzg7kbj4.execute-api.eu-west-2.amazonaws.com/poc/events/FHIR/R4
This server will make a few alterations to the submitted Questionnaire for technical reasons. The most important change is it will create a Questionnaire.url if one is not supplied from the Questionnaire.code.
For the Kansas City Cardiomyopathy Questionnaire - 12 item
from the LOINC server, it will use the code 74728-7
and create a url of:
https://example.fhir.nhs.uk/Questionnaire/86923-0
This url is used in FHIR QuestionnaireResponse and Validation.
To find, update, add or delete Questionnaires stored on the UKCore Hackathon Server please use
Once the Questionnaire has been added to this server, the $validate
function will use it for QuestionnaireResponse conformance checks.
Rendering the Questionnaire
A software supplier will normally build a form/application which implements this Questionnaire definition. It is useful to view what this would look like before this development takes place and this will allow feedback on the form.
The NLM/LHC has a useful application for doing this.
You will need to supply the Questionnaire to this app. For the example we have used above this will be
https://3cdzg7kbj4.execute-api.eu-west-2.amazonaws.com/poc/events/FHIR/R4/Questionnaire/56969434-1980-4262-b6a7-ed1c8aca5ec2
The id
which is the last part of this url can be found in the stored Questionnaires on the UKCore Hackathon server. E.g. When we searched for https://example.fhir.nhs.uk/Questionnaire/86923-0
the response contained an entry like
"entry": [
{
"fullUrl": "https://cnuc9zdola.execute-api.eu-west-2.amazonaws.com/dev/Questionnaire/56969434-1980-4262-b6a7-ed1c8aca5ec2",
"resource": {
"resourceType": "Questionnaire",
"id": "56969434-1980-4262-b6a7-ed1c8aca5ec2",
The id
field is the id we need to use.
Completing the Form
FHIR does not define or dictate how an application should store it's completed forms. It does suggest methods of sharing the completed forms with others providers and applications. The idea here is standardising the API so that the persisted forms can be shared (at scale) within the NHS and Social Services.
The common format of the completed forms in FHIR is a FHIR QuestionnaireResponse.
The XML and JSON schema for this is the same as international FHIR QuestionnaireResponse. Note: UKCore is not a schema, it is data rules which build on top of HL7 FHIR schema.
These QuestionnaireResponses SHOULD follow the definition of the forms in a FHIR Questionnaire. In Structured Data Capture, the management of these definitions is called Form Manager and this has been partly discussed in Creating Forms
To see what the QuestionnaireResponse looks like we will use another application from NLM LHC FHIR Tools.
- Click on
Search LOINC Panels
- Enter
Kansas City Cardiomyopathy Questionnaire - 12 item
- Select the entry and click on show panel
- Enter some data into the form
- Click on
Show Form Data As
and selectSDC QuestionnaireResponse
- Copy the JSON response.
This step is simulating a practitioner or patient completing the form and then the application converting the response to FHIR.
{
"resourceType": "QuestionnaireResponse",
"meta": {
"profile": [
"http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaireresponse|2.7"
],
"tag": [
{
"code": "lformsVersion: 33.1.2"
}
]
},
"status": "completed",
"authored": "2023-02-24T07:29:15.300Z",
"item": [
{
"linkId": "/86483-5",
"text": "Please indicate how much you are limited by heart failure (shortness of breath or fatigue) in your ability to do the following activities over the past 2 weeks. Showering or bathing",
"answer": [
{
"valueCoding": {
"system": "http://loinc.org",
"code": "LA27708-9",
"display": "Limited for other reasons or did not do the activity"
}
}
]
},
{
"linkId": "/86474-4",
"text": "Please indicate how much you are limited by heart failure (shortness of breath or fatigue) in your ability to do the following activities over the past 2 weeks. Walking 1 block on level ground",
"answer": [
{
"valueCoding": {
"system": "http://loinc.org",
"code": "LA6460-5",
"display": "Moderately limited"
}
}
]
},
{
"linkId": "/86477-7",
"text": "Please indicate how much you are limited by heart failure (shortness of breath or fatigue) in your ability to do the following activities over the past 2 weeks. Hurrying or jogging (as if to catch a bus)",
"answer": [
{
"valueCoding": {
"system": "http://loinc.org",
"code": "LA9605-2",
"display": "Slightly limited"
}
}
]
},
{
"linkId": "/86481-9",
"text": "Over the past 2 weeks, on average, how many times has fatigue limited your ability to do what you want?",
"answer": [
{
"valueCoding": {
"system": "http://loinc.org",
"code": "LA27730-3",
"display": "At least once a day"
}
}
]
},
{
"linkId": "/86472-8",
"text": "Over the past 2 weeks, on average, how many times has shortness of breath limited your ability to do what you wanted?",
"answer": [
{
"valueCoding": {
"system": "http://loinc.org",
"code": "LA27770-9",
"display": "3 or more times per week but not every day"
}
}
]
},
{
"linkId": "/86485-0",
"text": "Over the past 2 weeks, on average, how many times have you been forced to sleep sitting up in a chair or with at least 3 pillows to prop you up because of shortness of breath?",
"answer": [
{
"valueCoding": {
"system": "http://loinc.org",
"code": "LA27720-4",
"display": "3 or more times a week, but not every day"
}
}
]
},
{
"linkId": "/86924-8",
"text": "Overall summary score",
"answer": [
{
"valueDecimal": 22
}
]
}
]
}
We need to make some changes to this so that it can be stored on the UKCore Hackathon server.
- Open up the FHIR Validator
- Click 'Try it out`
- Remove the profile entry, we are going to use the default profile configured in the validator.
- Paste in the JSON from the earlier steps and click execute.
The result should look like this
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "processing",
"details": {
"coding": [
{
"system": "http://hl7.org/fhir/java-core-messageId",
"code": "Validation_VAL_Profile_Minimum"
}
]
},
"diagnostics": "QuestionnaireResponse.questionnaire: minimum required = 1, but only found 0 (from https://fhir.nhs.uk/StructureDefinition/NHSDigital-QuestionnaireResponse)",
"location": [
"QuestionnaireResponse",
"Line 1, Col 2"
]
},
{
"severity": "information",
"code": "processing",
"details": {
"coding": [
{
"system": "http://hl7.org/fhir/java-core-messageId",
"code": "Questionnaire_QR_Q_None"
}
]
},
"diagnostics": "No questionnaire is identified, so no validation can be performed against the base questionnaire",
"location": [
"QuestionnaireResponse",
"Line 1, Col 2"
]
}
]
}
This says we need to supply a QuestionnaireResponse.questionnaire entry. From earlier steps when we added the Questionnaire to the server, this is entry is https://example.fhir.nhs.uk/Questionnaire/86923-0
If we amend the JSON (see below) and try validating this passes validation.
{
"resourceType": "QuestionnaireResponse",
"status": "completed",
"authored": "2023-02-24T07:29:15.300Z",
"questionnaire": "https://example.fhir.nhs.uk/Questionnaire/86923-0",
"item": [
The UKCore Hackathon server will now accept this form and store it. If you wish to try this out use POST /QuestionnaireResponse
We have one big omission, it has not been linked to a Patient. To do this we need to add in a reference to the Patient or an identifier for the patient. For this example we are going to use the patients NHS Number which is an identifier. In addition to the patient identifier we add in an identifier for the form itself, the hackathon server uses this identifier to prevent duplicate entries.
{
"resourceType": "QuestionnaireResponse",
"status": "completed",
"authored": "2023-02-24T07:29:15.300Z",
"questionnaire": "https://example.fhir.nhs.uk/Questionnaire/86923-0",
"identifier": {
"system": "https://tools.ietf.org/html/rfc4122",
"value": "56694b60-f3ba-4214-9868-d63d649f4bf0"
},
"subject": {
"identifier": {
"system": "https://fhir.nhs.uk/Id/nhs-number",
"value": "9876543210"
},
"display": "R Kanfeld"
},
"item": [
An example of the finished resource can be found on Github
Add the resource to the server via POST /QuestionnaireResponse
Existing data and FHIR Observations
The previous section described how a form was completed and then stored/sent to a FHIR Server or recipient. This capability will obviously reduce time spent completing forms.
For example: A Questionnaire which asks for the patients weight will query an EPR data source for the data via a query like GET /Observation?patient=073eef49-81ee-4c2e-893b-bc2e4efd2630&code=27113001&date=gt2022-02-15 This returns any body weight observations in the specified time period.
The person completing the form may enter in a new body weight, in this case a body weight Observation should be stored in the EPR so that it can be reused in the next form. This is done by calling POST /QuestionnaireResponse/$extract which will return a FHIR Transaction contain FHIR Observation which can then be used to add the Observations to an EPR server.
These two concepts are described in
- Form Population which uses a FHIR Questionnaire to automatically retrieving existing patient data as a pre-populated FHIR QuestionnaireResponse.
- Form Data Extraction which processes a completed FHIR QuestionnaireResponse into a FHIR Observations for storing on an EPR Server.
Demonstration Application
The US National Library of Medicine has produced a Structured Data Capture Demonstration of this process. This link is configured to use this UKCore Reference Implementation
and can be configured to use other FHIR Servers. Servers will need to implement the following interactions
Interaction | Description |
---|---|
GET /metadata | To interegate the servers capabilities. The application will alter its behaviour based on the interactions supported. Required |
GET /Patient | To search for Patients. Required |
GET /Questionnaire | To retrieve forms definitions. Required |
GET /Questionnaire/$populate |
To automatically populate a FHIR QuestionaireResponse. This endpoint is not currently supported on the UKCore server and so the app uses GET /Observation instead. |
GET /Observation | To support automatic population of form data. |
POST /QuestionnaireResponse | To store the completed form Required |
POST /QuestionnaireResponse/$extract | Processes the completed form and converts answers into FHIR Observation (in a FHIR transaction format) when required |
POST / | To store a series of Observations in a FHIR transaction Bundle |
Ask for Form Completion
Is based on FHIR Workflow and FHIR Structured Data Capture Workflow
Overview
- The organisation or practitioner who wishes a form to be completed, will first find the form on a registry called
Form Manager
. See GET /Questionnaire. If the forms does not exist see Creating Forms - A request is made to the service, patient or practitioner to complete the form. This is assumed to be via a FHIR Task resource, see POST /Task
- The form is completed and the results stored on a repository. See Completing the Form
- The FHIR Task is updated to be completed, see PUT /Task