@aehrc/smart-forms-renderer 0.27.2 → 0.27.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/.storybook/main.ts +2 -1
  2. package/.storybook/preview.ts +6 -1
  3. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.d.ts +3 -2
  4. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js +9 -17
  5. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js.map +1 -1
  6. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +12 -9
  7. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
  8. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.d.ts +2 -2
  9. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js +7 -9
  10. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js.map +1 -1
  11. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +12 -8
  12. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
  13. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.d.ts +2 -1
  14. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +3 -3
  15. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js.map +1 -1
  16. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +6 -4
  17. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
  18. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.d.ts +2 -1
  19. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.js +3 -3
  20. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.js.map +1 -1
  21. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.d.ts +2 -2
  22. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +5 -7
  23. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js.map +1 -1
  24. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +4 -4
  25. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
  26. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.d.ts +2 -1
  27. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +2 -3
  28. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -1
  29. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +5 -3
  30. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
  31. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.d.ts +2 -1
  32. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.js +3 -3
  33. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.js.map +1 -1
  34. package/lib/components/FormComponents/DecimalItem/DecimalItem.js +1 -1
  35. package/lib/components/FormComponents/GroupItem/TabButtonsWrapper.js +20 -20
  36. package/lib/components/FormComponents/GroupItem/TabButtonsWrapper.js.map +1 -1
  37. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.d.ts +3 -2
  38. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js +7 -19
  39. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js.map +1 -1
  40. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +40 -40
  41. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js.map +1 -1
  42. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js +15 -3
  43. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js.map +1 -1
  44. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.d.ts +2 -1
  45. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js +3 -3
  46. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js.map +1 -1
  47. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +27 -26
  48. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js.map +1 -1
  49. package/lib/components/FormComponents/StringItem/StringField.js +1 -1
  50. package/lib/components/FormComponents/StringItem/StringField.js.map +1 -1
  51. package/lib/hooks/useInitialiseRenderer.js +1 -1
  52. package/lib/hooks/useInitialiseRenderer.js.map +1 -1
  53. package/lib/hooks/useNextAndPreviousVisibleTabs.d.ts +7 -0
  54. package/lib/hooks/useNextAndPreviousVisibleTabs.js +63 -0
  55. package/lib/hooks/useNextAndPreviousVisibleTabs.js.map +1 -0
  56. package/lib/hooks/useNextPreviousVisibleTabs.d.ts +6 -0
  57. package/lib/hooks/useNextPreviousVisibleTabs.js +63 -0
  58. package/lib/hooks/useNextPreviousVisibleTabs.js.map +1 -0
  59. package/lib/index.d.ts +0 -7
  60. package/lib/index.js +0 -24
  61. package/lib/index.js.map +1 -1
  62. package/lib/utils/choice.d.ts +1 -7
  63. package/lib/utils/choice.js +10 -20
  64. package/lib/utils/choice.js.map +1 -1
  65. package/lib/utils/enableWhen.js +5 -7
  66. package/lib/utils/enableWhen.js.map +1 -1
  67. package/lib/utils/index.d.ts +1 -0
  68. package/lib/utils/index.js +1 -0
  69. package/lib/utils/index.js.map +1 -1
  70. package/lib/utils/openChoice.d.ts +9 -4
  71. package/lib/utils/openChoice.js +47 -78
  72. package/lib/utils/openChoice.js.map +1 -1
  73. package/lib/utils/tabs.d.ts +0 -21
  74. package/lib/utils/tabs.js +0 -51
  75. package/lib/utils/tabs.js.map +1 -1
  76. package/package.json +4 -4
  77. package/src/components/FormComponents/ChoiceItems/CheckboxOptionList.tsx +82 -0
  78. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.tsx +23 -52
  79. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +15 -9
  80. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.tsx +17 -19
  81. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +13 -8
  82. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +5 -4
  83. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +6 -2
  84. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.tsx +5 -1
  85. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +9 -16
  86. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +4 -4
  87. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +4 -3
  88. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +5 -2
  89. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.tsx +5 -1
  90. package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +1 -1
  91. package/src/components/FormComponents/GroupItem/TabButtonsWrapper.tsx +28 -25
  92. package/src/components/FormComponents/ItemParts/{RadioAnswerOptionButtons.tsx → RadioOptionList.tsx} +7 -7
  93. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.tsx +18 -50
  94. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +70 -68
  95. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerValueSetFields.tsx +110 -0
  96. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerValueSetItem.tsx +188 -0
  97. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx +46 -19
  98. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.tsx +5 -3
  99. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +37 -29
  100. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetFields.tsx +104 -0
  101. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetItem.tsx +156 -0
  102. package/src/components/FormComponents/StringItem/StringField.tsx +1 -1
  103. package/src/hooks/useInitialiseRenderer.ts +1 -1
  104. package/src/hooks/useNextAndPreviousVisibleTabs.ts +86 -0
  105. package/src/hooks/useOpenLabel.ts +43 -0
  106. package/src/index.ts +0 -21
  107. package/src/stories/BuildFormWrapper.tsx +57 -0
  108. package/src/stories/assets/questionnaires/QAdvancedAdditionalDisplayContent.ts +83 -0
  109. package/src/stories/assets/questionnaires/QAdvancedControlAppearance.ts +294 -0
  110. package/src/stories/assets/questionnaires/QAdvancedOther.ts +495 -0
  111. package/src/stories/assets/questionnaires/QAdvancedTextApperance.ts +188 -0
  112. package/src/stories/assets/questionnaires/QAttachment.ts +38 -0
  113. package/src/stories/assets/questionnaires/QBehaviorCalculations.ts +645 -0
  114. package/src/stories/assets/questionnaires/QBehaviorChoiceRestriction.ts +281 -0
  115. package/src/stories/assets/questionnaires/QBehaviorOther.ts +1149 -0
  116. package/src/stories/assets/questionnaires/QBehaviorValueConstraints.ts +508 -0
  117. package/src/stories/assets/questionnaires/QBoolean.ts +130 -0
  118. package/src/stories/assets/questionnaires/QChoice.ts +137 -0
  119. package/src/stories/assets/questionnaires/QDate.ts +56 -0
  120. package/src/stories/assets/questionnaires/QDateTime.ts +56 -0
  121. package/src/stories/assets/questionnaires/QDecimal.ts +56 -0
  122. package/src/stories/assets/questionnaires/QDisplay.ts +38 -0
  123. package/src/stories/assets/questionnaires/QGroup.ts +52 -0
  124. package/src/stories/assets/questionnaires/QInteger.ts +119 -0
  125. package/src/stories/assets/questionnaires/QItemControlDisplay.ts +114 -0
  126. package/src/stories/assets/questionnaires/QItemControlGroup.ts +419 -0
  127. package/src/stories/assets/questionnaires/QItemControlQuestion.ts +1271 -0
  128. package/src/stories/assets/questionnaires/QOpenChoice.ts +151 -0
  129. package/src/stories/assets/questionnaires/QQuantity.ts +38 -0
  130. package/src/stories/assets/questionnaires/QReference.ts +38 -0
  131. package/src/stories/assets/questionnaires/QSingleItems.ts +251 -0
  132. package/src/stories/assets/questionnaires/QString.ts +131 -0
  133. package/src/stories/assets/questionnaires/QText.ts +169 -0
  134. package/src/stories/assets/questionnaires/QTime.ts +38 -0
  135. package/src/stories/assets/questionnaires/QUrl.ts +38 -0
  136. package/src/stories/assets/questionnaires/index.ts +44 -0
  137. package/src/stories/itemTypes/Attachment.stories.tsx +39 -0
  138. package/src/stories/itemTypes/Boolean.stories.tsx +72 -0
  139. package/src/stories/{MedicalHistoryTable.stories.tsx → itemTypes/Choice.stories.tsx} +32 -26
  140. package/src/stories/itemTypes/Date.stories.tsx +46 -0
  141. package/src/stories/itemTypes/DateTime.stories.tsx +45 -0
  142. package/src/stories/itemTypes/Decimal.stories.tsx +56 -0
  143. package/src/stories/itemTypes/Display.stories.tsx +39 -0
  144. package/src/stories/itemTypes/Group.stories.tsx +39 -0
  145. package/src/stories/itemTypes/Integer.stories.tsx +55 -0
  146. package/src/stories/itemTypes/OpenChoice.stories.tsx +64 -0
  147. package/src/stories/itemTypes/Quantity.stories.tsx +39 -0
  148. package/src/stories/itemTypes/Reference.stories.tsx +39 -0
  149. package/src/stories/itemTypes/String.stories.tsx +51 -0
  150. package/src/stories/itemTypes/Text.stories.tsx +51 -0
  151. package/src/stories/itemTypes/Time.stories.tsx +39 -0
  152. package/src/stories/itemTypes/Url.stories.tsx +39 -0
  153. package/src/stories/sdc/AdvancedAdditionalDisplayContent.stories.tsx +45 -0
  154. package/src/stories/sdc/AdvancedControlAppearance.stories.tsx +51 -0
  155. package/src/stories/sdc/AdvancedOther.stories.tsx +76 -0
  156. package/src/stories/sdc/AdvancedTextAppearance.stories.tsx +69 -0
  157. package/src/stories/sdc/BehaviorCalculations.stories.tsx +69 -0
  158. package/src/stories/sdc/BehaviorChoiceRestriction.stories.tsx +76 -0
  159. package/src/stories/sdc/BehaviorOther.stories.tsx +90 -0
  160. package/src/stories/sdc/BehaviorValueConstraints.stories.tsx +88 -0
  161. package/src/stories/sdc/ItemControlDisplay.stories.tsx +39 -0
  162. package/src/stories/sdc/ItemControlGroup.stories.tsx +55 -0
  163. package/src/stories/sdc/ItemControlQuestion.stories.tsx +118 -0
  164. package/src/utils/buildForm.ts +23 -0
  165. package/src/utils/choice.ts +16 -23
  166. package/src/utils/enableWhen.ts +5 -7
  167. package/src/utils/index.ts +1 -0
  168. package/src/utils/openChoice.ts +83 -98
  169. package/src/utils/tabs.ts +0 -75
  170. package/vite.config.ts +23 -0
  171. package/doctor-storybook.log +0 -18
  172. package/src/stories/SmartFormsRenderer.stories.ts +0 -139
  173. package/src/stories/assets/QItems-and-QRItems/QR_GTableMedicalHistory.json +0 -80
  174. package/src/stories/assets/QItems-and-QRItems/Q_GTableMedicalHistory.json +0 -109
  175. package/src/stories/assets/Qs-and-QRs/Q715.json +0 -15086
  176. package/src/stories/assets/Qs-and-QRs/QDev715.json +0 -16081
  177. package/src/stories/assets/Qs-and-QRs/QTestGrid.json +0 -411
  178. package/src/stories/assets/Qs-and-QRs/R715.json +0 -311
  179. package/src/stories/assets/Qs-and-QRs/RTestGrid.json +0 -34
@@ -0,0 +1,495 @@
1
+ import type { Questionnaire } from 'fhir/r4';
2
+
3
+ export const qRequired: Questionnaire = {
4
+ resourceType: 'Questionnaire',
5
+ id: 'Required',
6
+ name: 'Required',
7
+ title: 'Required',
8
+ version: '0.1.0',
9
+ status: 'draft',
10
+ publisher: 'AEHRC CSIRO',
11
+ date: '2024-05-01',
12
+ url: 'https://smartforms.csiro.au/docs/advanced/other/required',
13
+ item: [
14
+ {
15
+ linkId: 'required-question',
16
+ text: 'Consent for sharing of health information',
17
+ type: 'boolean',
18
+ repeats: false,
19
+ required: true
20
+ }
21
+ ]
22
+ };
23
+
24
+ // FIXME requires a parent container
25
+ export const qRepeatsAutocomplete: Questionnaire = {
26
+ resourceType: 'Questionnaire',
27
+ id: 'RepeatsAutocomplete',
28
+ name: 'RepeatsAutocomplete',
29
+ title: 'Repeats Autocomplete',
30
+ version: '0.1.0',
31
+ status: 'draft',
32
+ publisher: 'AEHRC CSIRO',
33
+ date: '2024-05-01',
34
+ url: 'https://smartforms.csiro.au/docs/advanced/other/repeats-autocomplete',
35
+ item: [
36
+ {
37
+ linkId: 'parent-container',
38
+ text: 'Parent container',
39
+ type: 'group',
40
+ repeats: false,
41
+ item: [
42
+ {
43
+ extension: [
44
+ {
45
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
46
+ valueCodeableConcept: {
47
+ coding: [
48
+ {
49
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
50
+ code: 'autocomplete'
51
+ }
52
+ ]
53
+ }
54
+ }
55
+ ],
56
+ linkId: 'medical-history-repeat',
57
+ text: 'Medical history and current problems',
58
+ type: 'open-choice',
59
+ repeats: true,
60
+ answerValueSet: 'https://smartforms.csiro.au/ig/ValueSet/MedicalHistory'
61
+ }
62
+ ]
63
+ }
64
+ ]
65
+ };
66
+
67
+ export const qRepeatsCheckbox: Questionnaire = {
68
+ resourceType: 'Questionnaire',
69
+ id: 'RepeatsCheckbox',
70
+ name: 'RepeatsCheckbox',
71
+ title: 'Repeats Checkbox',
72
+ version: '0.1.0',
73
+ status: 'draft',
74
+ publisher: 'AEHRC CSIRO',
75
+ date: '2024-05-01',
76
+ url: 'https://smartforms.csiro.au/docs/advanced/other/repeats-checkbox',
77
+ contained: [
78
+ {
79
+ resourceType: 'ValueSet',
80
+ id: 'PrimaryCarerParentGrandparent',
81
+ url: 'https://smartforms.csiro.au/ig/ValueSet/PrimaryCarerParentGrandparent',
82
+ name: 'PrimaryCarerParentGrandparent',
83
+ title: 'Primary Carer Of Parent Or Grandparent',
84
+ status: 'draft',
85
+ experimental: false,
86
+ description:
87
+ 'The Primary Carer Of Parent Or Grandparent value set includes values that can indicate whether a primary carer is one of the parents or a grandparent.',
88
+ compose: {
89
+ include: [
90
+ {
91
+ system: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode',
92
+ concept: [
93
+ {
94
+ code: 'MTH'
95
+ },
96
+ {
97
+ code: 'FTH'
98
+ },
99
+ {
100
+ code: 'GRPRN'
101
+ }
102
+ ]
103
+ },
104
+ {
105
+ system: 'http://terminology.hl7.org/CodeSystem/v3-NullFlavor',
106
+ concept: [
107
+ {
108
+ code: 'NA'
109
+ }
110
+ ]
111
+ }
112
+ ]
113
+ },
114
+ expansion: {
115
+ identifier: '2809c2fa-28ec-4def-9b16-93a611d29da3',
116
+ timestamp: '2022-10-20T11:42:30+10:00',
117
+ total: 4,
118
+ offset: 0,
119
+ parameter: [
120
+ {
121
+ name: 'version',
122
+ valueUri: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode|2018-08-12'
123
+ },
124
+ {
125
+ name: 'version',
126
+ valueUri: 'http://terminology.hl7.org/CodeSystem/v3-NullFlavor|2018-08-12'
127
+ },
128
+ {
129
+ name: 'count',
130
+ valueInteger: 2147483647
131
+ },
132
+ {
133
+ name: 'offset',
134
+ valueInteger: 0
135
+ }
136
+ ],
137
+ contains: [
138
+ {
139
+ system: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode',
140
+ version: '2018-08-12',
141
+ code: 'MTH',
142
+ display: 'Mother'
143
+ },
144
+ {
145
+ system: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode',
146
+ version: '2018-08-12',
147
+ code: 'FTH',
148
+ display: 'Father'
149
+ },
150
+ {
151
+ system: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode',
152
+ version: '2018-08-12',
153
+ code: 'GRPRN',
154
+ display: 'Grandparent'
155
+ },
156
+ {
157
+ system: 'http://terminology.hl7.org/CodeSystem/v3-NullFlavor',
158
+ version: '2018-08-12',
159
+ code: 'NA',
160
+ display: 'N/A'
161
+ }
162
+ ]
163
+ }
164
+ },
165
+ {
166
+ resourceType: 'ValueSet',
167
+ id: 'administrative-gender',
168
+ meta: {
169
+ profile: ['http://hl7.org/fhir/StructureDefinition/shareablevalueset']
170
+ },
171
+ extension: [
172
+ {
173
+ url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-wg',
174
+ valueCode: 'pa'
175
+ },
176
+ {
177
+ url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status',
178
+ valueCode: 'normative'
179
+ },
180
+ {
181
+ url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm',
182
+ valueInteger: 5
183
+ },
184
+ {
185
+ url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version',
186
+ valueCode: '4.0.0'
187
+ }
188
+ ],
189
+ url: 'http://hl7.org/fhir/ValueSet/administrative-gender',
190
+ identifier: [
191
+ {
192
+ system: 'urn:ietf:rfc:3986',
193
+ value: 'urn:oid:2.16.840.1.113883.4.642.3.1'
194
+ }
195
+ ],
196
+ version: '4.0.1',
197
+ name: 'AdministrativeGender',
198
+ title: 'AdministrativeGender',
199
+ status: 'active',
200
+ experimental: false,
201
+ date: '2019-11-01T09:29:23+11:00',
202
+ publisher: 'HL7 (FHIR Project)',
203
+ contact: [
204
+ {
205
+ telecom: [
206
+ {
207
+ system: 'url',
208
+ value: 'http://hl7.org/fhir'
209
+ },
210
+ {
211
+ system: 'email',
212
+ value: 'fhir@lists.hl7.org'
213
+ }
214
+ ]
215
+ }
216
+ ]
217
+ }
218
+ ],
219
+ item: [
220
+ {
221
+ extension: [
222
+ {
223
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
224
+ valueCodeableConcept: {
225
+ coding: [
226
+ {
227
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
228
+ code: 'check-box'
229
+ }
230
+ ]
231
+ }
232
+ }
233
+ ],
234
+ linkId: 'primary-carers-repeat',
235
+ text: 'Primary carers (multi-select)',
236
+ type: 'choice',
237
+ repeats: true,
238
+ answerValueSet: '#PrimaryCarerParentGrandparent'
239
+ }
240
+ ]
241
+ };
242
+
243
+ export const qRepeatsGroup: Questionnaire = {
244
+ resourceType: 'Questionnaire',
245
+ id: 'RepeatsGroup',
246
+ name: 'RepeatsGroup',
247
+ title: 'Repeats Group',
248
+ version: '0.1.0',
249
+ status: 'draft',
250
+ publisher: 'AEHRC CSIRO',
251
+ date: '2024-05-01',
252
+ url: 'https://smartforms.csiro.au/docs/advanced/other/repeats-group',
253
+ item: [
254
+ {
255
+ linkId: 'home-address-group',
256
+ text: 'Home address',
257
+ type: 'group',
258
+ repeats: true,
259
+ item: [
260
+ {
261
+ linkId: 'home-address-street',
262
+ definition: 'http://hl7.org.au/fhir/StructureDefinition/au-address#Address.line',
263
+ text: 'Street address',
264
+ type: 'string',
265
+ repeats: false
266
+ },
267
+ {
268
+ linkId: 'home-address-city',
269
+ definition: 'http://hl7.org.au/fhir/StructureDefinition/au-address#Address.city',
270
+ text: 'City',
271
+ type: 'string',
272
+ repeats: false
273
+ },
274
+ {
275
+ extension: [
276
+ {
277
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
278
+ valueCodeableConcept: {
279
+ coding: [
280
+ {
281
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
282
+ code: 'drop-down'
283
+ }
284
+ ]
285
+ }
286
+ }
287
+ ],
288
+ linkId: 'home-address-state',
289
+ definition: 'http://hl7.org.au/fhir/StructureDefinition/au-address#Address.state',
290
+ text: 'State',
291
+ type: 'choice',
292
+ repeats: false,
293
+ answerValueSet:
294
+ 'https://healthterminologies.gov.au/fhir/ValueSet/australian-states-territories-2'
295
+ },
296
+ {
297
+ extension: [
298
+ {
299
+ url: 'http://hl7.org/fhir/StructureDefinition/regex',
300
+ valueString: "matches('^[0-9]{4}$')"
301
+ },
302
+ {
303
+ url: 'http://hl7.org/fhir/StructureDefinition/entryFormat',
304
+ valueString: '####'
305
+ }
306
+ ],
307
+ linkId: 'home-address-postcode',
308
+ definition: 'http://hl7.org.au/fhir/StructureDefinition/au-address#Address.postalCode',
309
+ text: 'Postcode',
310
+ type: 'string',
311
+ repeats: false
312
+ }
313
+ ]
314
+ }
315
+ ]
316
+ };
317
+
318
+ export const qRepeatsGroupNested: Questionnaire = {
319
+ resourceType: 'Questionnaire',
320
+ id: 'RepeatsGroupNested',
321
+ name: 'RepeatsGroupNested',
322
+ title: 'Repeats Group with Nested Repeats',
323
+ version: '0.1.0',
324
+ status: 'draft',
325
+ publisher: 'AEHRC CSIRO',
326
+ date: '2024-05-01',
327
+ url: 'https://smartforms.csiro.au/docs/advanced/other/repeats-group-nested',
328
+ item: [
329
+ {
330
+ linkId: 'restrictive-practice',
331
+ text: 'Restrictive practice',
332
+ type: 'group',
333
+ repeats: false,
334
+ item: [
335
+ {
336
+ linkId: 'restrictive-practice-intervention',
337
+ text: 'Restrictive practice intervention',
338
+ type: 'group',
339
+ repeats: true,
340
+ item: [
341
+ {
342
+ extension: [
343
+ {
344
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
345
+ valueCodeableConcept: {
346
+ coding: [
347
+ {
348
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
349
+ code: 'drop-down'
350
+ }
351
+ ]
352
+ }
353
+ }
354
+ ],
355
+ linkId: 'restrictive-practice-intervention-code',
356
+ text: 'Code',
357
+ type: 'choice',
358
+ repeats: false,
359
+ answerOption: [
360
+ {
361
+ valueCoding: {
362
+ system: 'http://snomed.info/sct',
363
+ code: '386423001',
364
+ display: 'Physical restraint'
365
+ }
366
+ },
367
+ {
368
+ valueCoding: {
369
+ system: 'http://snomed.info/sct',
370
+ code: '90278001',
371
+ display: 'Secluding patient'
372
+ }
373
+ },
374
+ {
375
+ valueCoding: {
376
+ system: 'http://snomed.info/sct',
377
+ code: '386517008',
378
+ display: 'Area restriction (Environmental)'
379
+ }
380
+ },
381
+ {
382
+ valueCoding: {
383
+ system: 'http://snomed.info/sct',
384
+ code: '68894007',
385
+ display: 'Placing restraint (Mechanical)'
386
+ }
387
+ }
388
+ ]
389
+ },
390
+ {
391
+ extension: [
392
+ {
393
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
394
+ valueCodeableConcept: {
395
+ coding: [
396
+ {
397
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
398
+ code: 'drop-down'
399
+ }
400
+ ]
401
+ }
402
+ }
403
+ ],
404
+ linkId: 'restrictive-practice-intervention-status',
405
+ text: 'Status',
406
+ type: 'choice',
407
+ repeats: false,
408
+ answerOption: [
409
+ {
410
+ valueCoding: {
411
+ system: 'http://hl7.org/fhir/event-status',
412
+ code: 'in-progress',
413
+ display: 'In Progress'
414
+ }
415
+ },
416
+ {
417
+ valueCoding: {
418
+ system: 'http://hl7.org/fhir/event-status',
419
+ code: 'on-hold',
420
+ display: 'On Hold'
421
+ }
422
+ },
423
+ {
424
+ valueCoding: {
425
+ system: 'http://hl7.org/fhir/event-status',
426
+ code: 'completed',
427
+ display: 'Completed'
428
+ }
429
+ }
430
+ ]
431
+ },
432
+ {
433
+ linkId: 'restrictive-practice-intervention-performedstartdate',
434
+ text: 'Performed start date',
435
+ type: 'dateTime',
436
+ repeats: false
437
+ },
438
+ {
439
+ linkId: 'restrictive-practice-intervention-performedenddate',
440
+ text: 'Performed end date',
441
+ type: 'dateTime',
442
+ repeats: false
443
+ },
444
+ {
445
+ linkId: 'restrictive-practice-intervention-note',
446
+ text: 'Note',
447
+ type: 'group',
448
+ repeats: true,
449
+ item: [
450
+ {
451
+ linkId: 'restrictive-practice-intervention-note-time',
452
+ text: 'Date and time',
453
+ type: 'dateTime',
454
+ repeats: false
455
+ },
456
+ {
457
+ linkId: 'restrictive-practice-intervention-note-text',
458
+ text: 'Text',
459
+ type: 'text',
460
+ repeats: false
461
+ }
462
+ ]
463
+ }
464
+ ]
465
+ }
466
+ ]
467
+ }
468
+ ]
469
+ };
470
+
471
+ export const qReadOnly: Questionnaire = {
472
+ resourceType: 'Questionnaire',
473
+ id: 'ReadOnly',
474
+ name: 'ReadOnly',
475
+ title: 'Read Only Question',
476
+ version: '0.1.0',
477
+ status: 'draft',
478
+ publisher: 'AEHRC CSIRO',
479
+ date: '2024-05-01',
480
+ url: 'https://smartforms.csiro.au/docs/advanced/other/read-only',
481
+ item: [
482
+ {
483
+ linkId: 'read-only',
484
+ text: 'Age',
485
+ type: 'integer',
486
+ initial: [
487
+ {
488
+ valueInteger: 50
489
+ }
490
+ ],
491
+ repeats: false,
492
+ readOnly: true
493
+ }
494
+ ]
495
+ };
@@ -0,0 +1,188 @@
1
+ import type { Questionnaire } from 'fhir/r4';
2
+
3
+ export const qRenderingXhtmlBooleanCheckboxItem: Questionnaire = {
4
+ resourceType: 'Questionnaire',
5
+ id: 'RenderingXhtml-1',
6
+ name: 'RenderingXhtml-1',
7
+ title: 'Rendering XHTML 1',
8
+ version: '0.1.0',
9
+ status: 'draft',
10
+ publisher: 'AEHRC CSIRO',
11
+ date: '2024-05-01',
12
+ url: 'https://smartforms.csiro.au/docs/advanced/text/rendering-xhtml-1',
13
+ item: [
14
+ {
15
+ linkId: 'mark-complete',
16
+ text: 'Mark section as complete',
17
+ _text: {
18
+ extension: [
19
+ {
20
+ url: 'http://hl7.org/fhir/StructureDefinition/rendering-xhtml',
21
+ valueString:
22
+ '<div xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n <style type="text/css">\r\n .alert {\r\n padding: 0.75rem;\r\n margin-bottom: 1rem;\r\n font-size: 0.875rem;\r\n color: #2E7D32;\r\n border-radius: 0.5rem;\r\n background-color: #d5e5d6;\r\n font-weight: 700;\r\n }\r\n </style>\r\n</head>\r\n<body>\r\n<div class="alert">Mark section as complete</div>\r\n</body>\r\n</div>'
23
+ }
24
+ ]
25
+ },
26
+ type: 'boolean',
27
+ repeats: false
28
+ }
29
+ ]
30
+ };
31
+
32
+ export const qRenderingXhtmlDisplayListItem: Questionnaire = {
33
+ resourceType: 'Questionnaire',
34
+ id: 'RenderingXhtml-2',
35
+ name: 'RenderingXhtml-2',
36
+ title: 'Rendering XHTML 2',
37
+ version: '0.1.0',
38
+ status: 'draft',
39
+ publisher: 'AEHRC CSIRO',
40
+ date: '2024-05-01',
41
+ url: 'https://smartforms.csiro.au/docs/advanced/text/rendering-xhtml-2',
42
+ item: [
43
+ {
44
+ linkId: 'record-update-med-history',
45
+ text: 'Important: The patient record may not be updated with information entered here. Information intended for the patient record should be entered there first.',
46
+ _text: {
47
+ extension: [
48
+ {
49
+ url: 'http://hl7.org/fhir/StructureDefinition/rendering-xhtml',
50
+ valueString:
51
+ '<div xmlns="http://www.w3.org/1999/xhtml">\r\n <div>For older people with chronic disease and/or conditions associated with ageing, consider assessing:</div>\r\n <ul>\r\n <li>Osteoporosis risk</li>\r\n <li>Falls risk</li>\r\n <li>Balance, coordination and mobility</li>\r\n <li>Pain</li>\r\n <li>Nutrition</li>\r\n <li>Regularity of chronic disease management and review</li>\r\n </ul>\r\n </div>'
52
+ }
53
+ ]
54
+ },
55
+ type: 'display'
56
+ }
57
+ ]
58
+ };
59
+
60
+ export const qDisplayCategoryInstructions: Questionnaire = {
61
+ resourceType: 'Questionnaire',
62
+ id: 'DisplayCategoryInstructions',
63
+ name: 'DisplayCategoryInstructions',
64
+ title: 'Display Category Instructions',
65
+ version: '0.1.0',
66
+ status: 'draft',
67
+ publisher: 'AEHRC CSIRO',
68
+ date: '2024-05-01',
69
+ url: 'https://smartforms.csiro.au/docs/advanced/text/display-category-1',
70
+ item: [
71
+ {
72
+ linkId: 'eligible-health-check',
73
+ text: 'Eligible for health check',
74
+ type: 'boolean',
75
+ repeats: false,
76
+ item: [
77
+ {
78
+ extension: [
79
+ {
80
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory',
81
+ valueCodeableConcept: {
82
+ coding: [
83
+ {
84
+ system: 'http://hl7.org/fhir/questionnaire-display-category',
85
+ code: 'instructions'
86
+ }
87
+ ]
88
+ }
89
+ }
90
+ ],
91
+ linkId: 'eligible-health-check-instructions',
92
+ text: 'Have not claimed a health check in the past nine months',
93
+ type: 'display'
94
+ }
95
+ ]
96
+ }
97
+ ]
98
+ };
99
+
100
+ export const qOpenLabel: Questionnaire = {
101
+ resourceType: 'Questionnaire',
102
+ id: 'OpenLabel',
103
+ name: 'OpenLabel',
104
+ title: 'Open Label',
105
+ version: '0.1.0',
106
+ status: 'draft',
107
+ publisher: 'AEHRC CSIRO',
108
+ date: '2024-05-01',
109
+ url: 'https://smartforms.csiro.au/docs/advanced/text/open-label',
110
+ item: [
111
+ {
112
+ extension: [
113
+ {
114
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
115
+ valueCodeableConcept: {
116
+ coding: [
117
+ {
118
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
119
+ code: 'radio-button'
120
+ }
121
+ ]
122
+ }
123
+ },
124
+ {
125
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-openLabel',
126
+ valueString: 'Other, please specify'
127
+ }
128
+ ],
129
+ linkId: 'health-check-location',
130
+ text: 'Location of health check',
131
+ type: 'open-choice',
132
+ repeats: false,
133
+ answerOption: [
134
+ {
135
+ valueCoding: {
136
+ system: 'http://snomed.info/sct',
137
+ code: '257585005',
138
+ display: 'Clinic'
139
+ }
140
+ },
141
+ {
142
+ valueCoding: {
143
+ system: 'http://snomed.info/sct',
144
+ code: '264362003',
145
+ display: 'Home'
146
+ }
147
+ },
148
+ {
149
+ valueCoding: {
150
+ system: 'http://snomed.info/sct',
151
+ code: '257698009',
152
+ display: 'School'
153
+ }
154
+ }
155
+ ]
156
+ }
157
+ ]
158
+ };
159
+
160
+ export const qHidden: Questionnaire = {
161
+ resourceType: 'Questionnaire',
162
+ id: 'Hidden',
163
+ name: 'Hidden',
164
+ title: 'Hidden',
165
+ version: '0.1.0',
166
+ status: 'draft',
167
+ publisher: 'AEHRC CSIRO',
168
+ date: '2024-05-01',
169
+ url: 'https://smartforms.csiro.au/docs/advanced/text/hidden',
170
+ item: [
171
+ {
172
+ linkId: 'display-about',
173
+ type: 'display',
174
+ text: "If hidden works, you wouldn't see the question below!"
175
+ },
176
+ {
177
+ extension: [
178
+ {
179
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-hidden',
180
+ valueBoolean: true
181
+ }
182
+ ],
183
+ linkId: 'string-hidden',
184
+ type: 'string',
185
+ text: 'Hidden string field'
186
+ }
187
+ ]
188
+ };