Skip to content

Commit 5d0cd61

Browse files
authored
Merge pull request #13 from mlaletina95/separate-enable-when
Separate enable when options
2 parents 3d9a956 + 38a2775 commit 5d0cd61

3 files changed

Lines changed: 141 additions & 0 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
resourceType: Questionnaire
2+
id: enable-when-classic-any
3+
name: enable-when-classic-any
4+
title: EnableWhen / EnableBehavior
5+
status: active
6+
url: "http://example.org/fhir/Questionnaire/enable-when-classic-any"
7+
meta:
8+
profile:
9+
- https://emr-core.beda.software/StructureDefinition/fhir-emr-questionnaire
10+
item:
11+
- linkId: has-allergy
12+
text: Any allergies?
13+
type: choice
14+
answerOption:
15+
- valueCoding:
16+
system: "http://terminology.hl7.org/CodeSystem/v2-0136"
17+
code: "N"
18+
display: "No"
19+
- valueCoding:
20+
system: "http://terminology.hl7.org/CodeSystem/v2-0136"
21+
code: "Y"
22+
display: "Yes"
23+
24+
- linkId: follow-up-needed
25+
text: Follow-up visit needed?
26+
type: choice
27+
answerOption:
28+
- valueCoding:
29+
system: "http://terminology.hl7.org/CodeSystem/v2-0136"
30+
code: "N"
31+
display: "No"
32+
- valueCoding:
33+
system: "http://terminology.hl7.org/CodeSystem/v2-0136"
34+
code: "Y"
35+
display: "Yes"
36+
37+
- linkId: allergy-details
38+
text: Allergy details (classic enableWhen)
39+
type: text
40+
enableWhen:
41+
- question: has-allergy
42+
operator: "="
43+
answerCoding:
44+
system: "http://terminology.hl7.org/CodeSystem/v2-0136"
45+
code: "Y"
46+
display: "Yes"
47+
48+
- linkId: contact-preference
49+
text: Contact preference (shown if allergy Yes OR follow-up Yes)
50+
type: text
51+
enableBehavior: any
52+
enableWhen:
53+
- question: has-allergy
54+
operator: "="
55+
answerCoding:
56+
system: "http://terminology.hl7.org/CodeSystem/v2-0136"
57+
code: "Y"
58+
display: "Yes"
59+
- question: follow-up-needed
60+
operator: "="
61+
answerCoding:
62+
system: "http://terminology.hl7.org/CodeSystem/v2-0136"
63+
code: "Y"
64+
display: "Yes"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
resourceType: Questionnaire
2+
id: enable-when-expression
3+
name: enable-when-expression
4+
title: EnableWhenExpression
5+
status: active
6+
url: "http://example.org/fhir/Questionnaire/enable-when-expression"
7+
meta:
8+
profile:
9+
- https://emr-core.beda.software/StructureDefinition/fhir-emr-questionnaire
10+
item:
11+
- linkId: has-allergy
12+
text: Any allergies?
13+
type: choice
14+
answerOption:
15+
- valueCoding:
16+
system: "http://terminology.hl7.org/CodeSystem/v2-0136"
17+
code: "N"
18+
display: "No"
19+
- valueCoding:
20+
system: "http://terminology.hl7.org/CodeSystem/v2-0136"
21+
code: "Y"
22+
display: "Yes"
23+
24+
- linkId: allergy-details-expression
25+
text: Allergy details (enableWhenExpression)
26+
type: text
27+
enableWhenExpression:
28+
language: text/fhirpath
29+
expression: >-
30+
iif(
31+
%resource.repeat(item).where(linkId='has-allergy').answer.valueCoding.where(code='Y').exists(),
32+
true,
33+
false
34+
)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
resourceType: Questionnaire
2+
id: enable-when-variable
3+
name: enable-when-variable
4+
title: EnableWhenExpression + variable
5+
status: active
6+
url: "http://example.org/fhir/Questionnaire/enable-when-variable"
7+
meta:
8+
profile:
9+
- https://emr-core.beda.software/StructureDefinition/fhir-emr-questionnaire
10+
item:
11+
- linkId: has-allergy
12+
text: Any allergies?
13+
type: choice
14+
answerOption:
15+
- valueCoding:
16+
system: "http://terminology.hl7.org/CodeSystem/v2-0136"
17+
code: "N"
18+
display: "No"
19+
- valueCoding:
20+
system: "http://terminology.hl7.org/CodeSystem/v2-0136"
21+
code: "Y"
22+
display: "Yes"
23+
24+
- linkId: variable-group
25+
text: Expression using parent variable %AllergyYes
26+
type: group
27+
variable:
28+
- name: AllergyYes
29+
language: text/fhirpath
30+
expression: >-
31+
iif(
32+
%resource.repeat(item).where(linkId='has-allergy').answer.valueCoding.where(code='Y').exists(),
33+
true,
34+
false
35+
)
36+
item:
37+
- linkId: details-with-variable
38+
text: Allergy notes (visible when %AllergyYes is true)
39+
type: text
40+
enableWhenExpression:
41+
language: text/fhirpath
42+
expression: >-
43+
iif(%AllergyYes = true, true, false)

0 commit comments

Comments
 (0)