Skip to content

Commit

Permalink
Add doc about passing answers from Questionnaire A to B (#3272)
Browse files Browse the repository at this point in the history
  • Loading branch information
FikriMilano authored May 17, 2024
1 parent d0833fb commit 69552a7
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions docs/engineering/writing-fhir/form-authoring.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Form Authoring (Things to consider when writing forms)
# Form Authoring

## Things to consider when writing forms
- Make sure that the `enableWhen` expressions are accompanied by the `enableBehaviour` attribute in order to avoid form crashes.
- The `enableBehaviour` defines whether the expressions on the `enableWhen` are to use `and` or `or` logic.
- The `enableBehaviour` options are `any` for `or` & `all` for `and`.
Expand Down Expand Up @@ -34,4 +35,38 @@
],
"enableBehaviour":"all"
}
```
```

## How to pass answers/data from Questionnaire A to B
1. Submit Questionnaire A
2. In Questionnaire B, use X-FHIR-Query variable to search the Questionnaire Response of Questionnaire A that also belongs to the Patient that did the submission
```
{
"url": "http://hl7.org/fhir/StructureDefinition/variable",
"valueExpression": {
"name": "qr-search-phq9",
"language": "application/x-fhir-query",
"expression": "QuestionnaireResponse?subject={{%patient.id.replaceMatches('/_history/.*', '')}}&questionnaire=Questionnaire/57"
}
},
{
"url": "http://hl7.org/fhir/StructureDefinition/variable",
"valueExpression": {
"name": "qr-phq9",
"language": "text/fhirpath",
"expression": "%qr-search-phq9.entry.first().resource"
}
}
```
3. In Questionnaire B, get the answer of Questionnaire A through the variable that contains Questionnaire Response of Questionnaire A
```
{
"url": "http://hl7.org/fhir/StructureDefinition/variable",
"valueExpression": {
"name": "phq9-p1",
"language": "text/fhirpath",
"expression": "%qr-phq9.item.descendants().where(linkId='f1.3.1').answer.value"
}
}
```
4. Call that variable in a calculated-expression so it can be populated into the field

0 comments on commit 69552a7

Please sign in to comment.