1+ resourceType : Questionnaire
2+ id : score-calculation
3+ name : score-calculation
4+ title : Score Calculation
5+ status : active
6+ url : " http://example.org/fhir/Questionnaire/score-calculation"
7+ meta :
8+ profile :
9+ - https://emr-core.beda.software/StructureDefinition/fhir-emr-questionnaire
10+ item :
11+ - linkId : score-group
12+ text : Score inputs
13+ type : group
14+ item :
15+ - linkId : pain-intensity
16+ text : Pain intensity
17+ type : choice
18+ answerOption :
19+ - valueCoding :
20+ system : " http://example.org/fhir/CodeSystem/score"
21+ code : " 0"
22+ display : No pain
23+ extension :
24+ - url : " http://hl7.org/fhir/StructureDefinition/ordinalValue"
25+ valueDecimal : 0
26+
27+ - linkId : nausea-intensity
28+ text : Nausea intensity
29+ type : choice
30+ answerOption :
31+ - valueCoding :
32+ system : " http://example.org/fhir/CodeSystem/score"
33+ code : " 1"
34+ display : Mild
35+ extension :
36+ - url : " http://hl7.org/fhir/StructureDefinition/ordinalValue"
37+ valueDecimal : 1
38+
39+ - linkId : total-score
40+ text : Total score (0–1)
41+ type : decimal
42+ readOnly : true
43+ variable :
44+ - name : painCode
45+ language : text/fhirpath
46+ expression : " %resource.item.where(linkId='score-group').item.where(linkId='pain-intensity').answer.valueCoding.code.first()"
47+ - name : nauseaCode
48+ language : text/fhirpath
49+ expression : " %resource.item.where(linkId='score-group').item.where(linkId='nausea-intensity').answer.valueCoding.code.first()"
50+ - name : painScore
51+ language : text/fhirpath
52+ expression : " iif(%painCode='0', 0, {})"
53+ - name : nauseaScore
54+ language : text/fhirpath
55+ expression : " iif(%nauseaCode='1', 1, {})"
56+ - name : any_questions_answered
57+ language : text/fhirpath
58+ expression : " %painScore.exists() or %nauseaScore.exists()"
59+ calculatedExpression :
60+ language : text/fhirpath
61+ expression : >-
62+ iif(%any_questions_answered, iif(%painScore.exists(), %painScore, 0) + iif(%nauseaScore.exists(), %nauseaScore, 0), {})
0 commit comments