This page is part of the Structured Data Capture FHIR IG (v3.0.0: STU 3) based on FHIR R4. This is the current published version. For a full list of available versions, see the Directory of published versions
Page standards status: Informative |
Contents:
Questionnaires are excellent tools for data capture. They allow tight control over what data is gathered and ensure information is gathered consistently across multiple users. However, data gathered using different questionnaires - or even different versions of the same questionnaire - is often not comparable. It is also not very searchable or easily integrated with discrete data sources. Because of this, the general recommendation in FHIR is to use questionnaires for raw data capture but then to convert the resulting QuestionnaireResponse instances into other FHIR resources - Observations, MedicationStatements, FamilyMemberHistories, etc. This allows the data gathered to then be easily combined with other data into FHIR documents and messages and exposed over FHIR REST interfaces.
Such conversion can be done with custom code written on a Questionnaire by Questionnaire basis. However, it makes the process much easier if it's possible to write generic software that can convert any arbitrary QuestionnaireResponse into appropriate FHIR resources leveraging metadata embedded in the Questionnaire. This portion of the SDC guide defines mechanisms for doing so.
entity
reference of type 'source' that points back to the original
QuestionnaireResponse. If Observations are generated, they can also have an explicit derivedFrom
link pointing back to the
QuestionnaireResponse.id
of the resource must be retained through the round-trip process to allow for the update.
This can be supported by storing the id as a hidden question not shown to the
user. This question item would have a type of 'string' and, if using the definition-based extraction approach, a definition that corresponded to the
'id' element of the relevant resource type (e.g. http://hl7.org/fhir/AllergyIntolerance#AllergyIntolerance.id
).
Note that the inclusion of the id as a hidden question is only relevant for the definition-based and StructureMap-based approaches. It is not needed
for the Observation-based approach.Questionnaire.derivedFrom
relationship to the same canonical URL
the QuestionnaireResponse refers to. The derived Questionnaire would contain the same content as the base Questionnaire, but would have additional
extensions inserted to support data extraction.Provenance.entity.what
where the Provenance.entity.role
would be 'source'. Software information would be captured in
Provenance.agent
. If the produced records are Observations, the resulting Observation(s) can also directly point to the
QuestionnaireResponse using Observation.derivedFrom
.Like Questionnaire population, extracting data from a QuestionnaireResponse is a complex process involving querying existing FHIR data and using more advanced technologies such as FHIRPath and StructureMap. It's therefore a function that systems may also wish to offload to a separate system. The QuestionnaireResponse extract has been created for this purpose. It takes in a completed QuestionnaireResponse and returns either an individual FHIR resource or a Bundle of resources, depending on the type of Questionnaire. The operation does not post the created resources to a server. It's up to the client system to determine what action(s) to take with the created content.
NOTE: It's the responsibility of the client system to ensure that any generated resources are valid against necessary profiles, etc. before using content produced by this operation.
This specification defines three different mechanisms to embed information in Questionnaires to support subsequent resource extraction:
Systems are free to experiment with other extraction mechanisms but cannot expect support for those from other SDC-conformant systems.
Each mechanism has its own profile that includes the additional resource elements or extensions relevant for supporting a particular mechanism: SDC Questionnaire Extract - Observation, SDC Questionnaire Extract - Definition, and SDC Questionnaire Extract - Structure Map profiles. Each profile identifies specific 'must support' elements and extensions that systems that claim to support a specific SDC extraction mechanism SHALL be capable of extracting data, as befits the CapabilityStatement(s) they claim conformance to. Each system should choose which approach(es) it wishes to use and support based on the elements specified in that profile.
Some of these mechanisms make use of FHIR-based queries, FHIRPath and/or CQL as well as extensions that include expressions in one of these languages. Implementers should read the Using Expressions page for background and guidance on these technologies and extensions.
This is the simplest of the extraction mechanisms. It leverages the same data elements as are used for the
Observation-based population mechanism. It takes advantage of the fact that most questions in the healthcare space typically
correspond to the value
element of an Observation. It also takes advantage of the Questionnaire.item.code
element that
identifies what a concept each question or group corresponds to. The SDC Questionnaire Extract - Observation profile
has been created to support this mechanism. An example for this profile can be found here.
To use this method:
item.code
element on each question to be extracted. Typically, this will be a LOINC code, but in some
jurisdictions/environments, SNOMED CT or other codes may be relevant.item.code
present - this might represent the code of the panel or the Observation.code of an Observation with no
value but with multiple Observation.component
elements. Child question items can then assert the item.code
of the "member-of"
Observations or the Observation.component.code
values.item.code
elements rather than the item as a whole, then only the specified codes should be propagated rather than all. For example, an item might list codes for "Body weight", "Body weight (clothed)" and "Body weight (unclothed)". In that case, only the "Body weight" code would be appropriate to include in the extracted content, even though all three might be appropriate for population. If any item.codes are tagged with 'true', then only the tagged Codings will propagate. I.e. any sibling item.codes with no extension are considered to have an extension of 'false'. If no extension appears on any of the item.codes but an extension appears on the item, an ancestor item or the Questionnaire as a whole, then all codes are considered to be roughly equivalent translations and to be appropriate to list as sibling Codings within Observation.code.
If an item has the extension flag set to 'true', some descendant items may have the extension with a value of 'false'. If this occurs, then the item tagged with 'false' and its descendants will be excluded from the extraction process.
For example:
<item>
<extension url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract">
<valueBoolean value="true" />
</extension>
<linkId value="code-pop-demo"/>
<code>
<system value="http://loinc.org"/>
<code value="29463-7"/>
<display value="Body weight"/>
</code>
<code>
<system value="http://loinc.org"/>
<code value="3141-9"/>
<display value="Body weight Measured"/>
</code>
<code>
<system value="http://loinc.org"/>
<code value="8341-0"/>
<display value="Dry body weight Measured"/>
</code>
<text value="What is your current weight?"/>
<type value="quantity"/>
<answerOption>
<valueCoding>
<system value="http://unitsofmeasure.org"/>
<code value="kg"/>
</valueCoding>
</answerOption>
<answerOption>
<valueCoding>
<system value="http://unitsofmeasure.org"/>
<code value="[lb_av]"/>
</valueCoding>
</answerOption>
</item>
When performing the extraction process, the system will create a batch that will contain creates or updates of Observation instances. It will go through the QuestionnaireResponse and identify all answers marked for extraction (if the corresponding Questionnaire item or the root Questionnaire has a questionnaire-observationExtract extension). For each of those it will then determine whether to create a new observation, update an existing observation or do nothing. Guidelines for making this decision are as follows:
Take no action if: |
|
---|---|
Update if: |
|
Create a new Observation if: | the conditions in the preceding two rows are not met |
If updating, the original Observation SHALL be adjusted to have the new value or component.value and the status changed to "amended", then PUT to the source system. If creating, data elements SHOULD be populated as follows:
Observation.basedOn
and Observation.partOf
- copy from QuestionnaireResponse elements of the same nameObservation.status
- set to 'final'Observation.category
- if this can be inferred from any of the Questionnaire.item.code
values or from known context of the
Questionnaire itself, then fill it in. It can also be asserted using the
observation-extract-category extension.Observation.code
- add all the Questionnaire.item.code
values as Observation.code.coding
instancesObservation.subject
- set to QuestionnaireResponse.subject
Observation.encounter
- set to QuestionnaireResponse.encounter
(if an Encounter)Observation.effectiveDateTime
- set to QuestionnaireResponse.authored
.Observation.issued
- set to QuestionnaireResponse.authored
Observation.performer
- set to QuestionnaireResponse.author
Observation.value[x]
- set to QuestionnaireResponse.item.answer.value[x]
Observation.derivedFrom
- set to a reference to the QuestionnaireResponseObservation.interpretation
and Observation.referenceRange
- if these can be inferred from the
QuestionnaireResponse.item.code
(and for interpretation the answer value too), they can be populated, otherwise omit
If the Questionnaire.item that is linked to an Observation contains child items that are also linked to Observations, then things get more complex as a
determination will need to be made on whether to link the parent to child as Observation.component
or as Observation.hasMember
.
In the ideal situation, the system will recognize the Observation.item.code and know which approach is correct for that type of Observation. If not, then
the system could query for other records of the child type and see if they appear as components anywhere. If unsure, systems should use "hasMember".
Considerations and rules when using this approach:
Observation.focus
is relevant or for capturing Observation.dataAbsentReason.
Patient.birthDate
), systems MAY take advantage of this knowledge to update the value of resources other than Observations, however such use
is discouraged - using one of the other extraction techniques is likely better and safer.This approach to extraction is more generic. It supports extracting data into any type of FHIR resource rather than being limited to only Observation. It also supports more Observation data elements than can be gathered using the Observation element - for example, explicit effective time ranges, interpretations, comments, etc. The SDC Questionnaire Extract - Definition profile has been created to support this mechanism.
To use this method:
Questionnaire.item.definition
to point to the resource or profile element that Questionnaire
item corresponds to. (Profiles may be relevant for data that is sliced or has fixed values for some properties.). The definition SHALL have the full
canonical URL of the resource (or profile) followed by '#' followed by the snapshot.element.id of the element the Questionnaire item corresponds to.http://hl7.org/fhir/Patient#Patient.name.given
even though the referenced profile's snapshot only contains Patient.name
, not
Patient.name.given
. However, for more complex references (e.g. referring to a particular extension or a particular repetition), it will be necessary to define a
distinct profile where slicing ensures that a single element id corresponds to the desired element. I.e. you would need to use
http://somewhere.org/SomePatient#Patient.name.given:foo
where 'foo' was a slice that referred to the first middle name in order to tie to a definition that specific.http://hl7.org/fhir/Patient#Patient.name
while nested items would have definitions of
http://hl7.org/fhir/Patient#Patient.name.given
and http://hl7.org/fhir/Patient#Patient.name.family
.
Questionnaire.item.initial.value[x]
or that use the
questionnaire-initialExpression extension to define their content to use to populate
resource elements that the user will not be filling in. (The initialExpressions might in turn depend on
variable and
questionnaire-launchContext extensions, used as described in the
Expression-based population
section.To perform the extraction process, first determine whether the context resource should be updated or created:
If updating, the answer values from the questionnaire (including hidden, calculated answers) will be propagated to the context resource. If creating, then for each occurrence of each item asserting a questionnaire-itemExtractionContext, a resource of the context type will be defined. It will be populated with answers to questions (hidden or not) that have a definition that matches the resource type of the context. As well, if the definitions refer to a profile, any child elements of the profile that have fixed values or patterns declared will also be included in the instance with values matching the fixed or pattern values.
An example of a questionnaire using this approach can be found here.
Considerations and rules when using this approach:
The StructureMap approach is the most sophisticated approach of the three - and the most powerful. It allows significant transformation of data, including code translations when generating output resources. It also allows the conversion process between data and Questionnaire to be maintained independently and to draw on shared sources across Questionnaires. This can be an advantage in certain environments where the content of the questionnaire may need tight control, but the data environment can be more dynamic. This comes at the cost of requiring expertise in the FHIR mapping language, which is not (yet?) a common skill. The SDC Questionnaire Extract - StructureMap profile has been created to support this mechanism. An example for this profile can be found here.
To use this method:
To extract data from the completed QuestionnaireResponse, simply invoke the StructureMap on it. A sample Questionnaire and associated StructureMap that shows this approach can be found here.
Considerations when using this approach:
Following are the output expectations of $extract: