I am a colleague of Eugene’s and I also looked into the problem. I have written a sample form that should satisfy the following requirements:
- The
measure
-field in an instance of the treatment
-group should only be enabled if in that instance of the group
- the medicine is
m2
- and the patient was older than 65 years on the date in the instance.
- The side effect field in an instance of the
treatment
-group should only be
enabled if in that instance of the group
- the medicine is
m2
- and the patient’s weight is more than 100 kilograms.
I wonder if my example is correct according to the standard and if it also satisfies the requirements.
Below the example:
{
"resourceType": "Questionnaire",
"status": "draft",
"extension": [{
"url": "http://hl7.org/fhir/StructureDefinition/variable",
"valueExpression": {
"name": "dateOfBirth",
"language": "text/fhirpath",
"expression": "item.where(linkId='dateOfBirth').answer.value"
}
},
{
"url": "http://hl7.org/fhir/StructureDefinition/variable",
"valueExpression": {
"name": "weight",
"language": "text/fhirpath",
"expression": "item.where(linkId='weight').answer.value"
}
}],
"item": [{
"linkId": "dateOfBirth",
"text": "date of birth",
"type": "date",
"repeats": false
},
{
"linkId": "weight",
"text": "weight (kg)",
"type": "integer",
"repeats": false
},
{
"linkId": "treatment",
"text": "treatment",
"type": "group",
"repeats": true,
"extension": [{
"url": "http://hl7.org/fhir/StructureDefinition/variable",
"valueExpression": {
"name": "dateOfTreatment",
"language": "text/fhirpath",
"expression": "item.where(linkId='dateOfTreatment').answer.value"
}
},
{
"url": "http://hl7.org/fhir/StructureDefinition/variable",
"valueExpression": {
"name": "medicine",
"language": "text/fhirpath",
"expression": "item.where(linkId='medicine').answer.value"
}
}],
"item": [{
"linkId": "dateOfTreatment",
"text": "date",
"type": "date",
"repeats": false
},
{
"linkId": "medicine",
"text": "medicine",
"type": "choice",
"repeats": false,
"answerOption": [
{
"valueCoding" : {
"code":"m1",
"display": "medicine 1"
}
},
{
"valueCoding" : {
"code":"m2",
"display": "medicine 2"
}
},
{
"valueCoding" : {
"code":"m3",
"display": "medicine 3"
}
}
]
},
{
"linkId": "sideEffect",
"text": "side effect",
"type": "string",
"repeats": false,
"extension": [{
"url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression",
"valueExpression": {
"language": "text/fhirpath",
"expression": "%weight>100 and %medicine.code='m2'"
}
}]
},
{
"linkId": "measure",
"text": "measure",
"type": "string",
"repeats": false,
"extension": [{
"url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression",
"valueExpression": {
"language": "text/fhirpath",
"expression": "%dateOfTreatment <= %dateOfBirth + 65 years and %medicine.code='m2'"
}
}]
}]
}]
}