@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.
- package/.storybook/main.ts +2 -1
- package/.storybook/preview.ts +6 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.d.ts +3 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js +9 -17
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +12 -9
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.d.ts +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js +7 -9
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +12 -8
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.d.ts +2 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +6 -4
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.d.ts +2 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.js +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.d.ts +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +5 -7
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +4 -4
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.d.ts +2 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +2 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +5 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.d.ts +2 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.js +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.js.map +1 -1
- package/lib/components/FormComponents/DecimalItem/DecimalItem.js +1 -1
- package/lib/components/FormComponents/GroupItem/TabButtonsWrapper.js +20 -20
- package/lib/components/FormComponents/GroupItem/TabButtonsWrapper.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.d.ts +3 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js +7 -19
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +40 -40
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js +15 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.d.ts +2 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js +3 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +27 -26
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/StringItem/StringField.js +1 -1
- package/lib/components/FormComponents/StringItem/StringField.js.map +1 -1
- package/lib/hooks/useInitialiseRenderer.js +1 -1
- package/lib/hooks/useInitialiseRenderer.js.map +1 -1
- package/lib/hooks/useNextAndPreviousVisibleTabs.d.ts +7 -0
- package/lib/hooks/useNextAndPreviousVisibleTabs.js +63 -0
- package/lib/hooks/useNextAndPreviousVisibleTabs.js.map +1 -0
- package/lib/hooks/useNextPreviousVisibleTabs.d.ts +6 -0
- package/lib/hooks/useNextPreviousVisibleTabs.js +63 -0
- package/lib/hooks/useNextPreviousVisibleTabs.js.map +1 -0
- package/lib/index.d.ts +0 -7
- package/lib/index.js +0 -24
- package/lib/index.js.map +1 -1
- package/lib/utils/choice.d.ts +1 -7
- package/lib/utils/choice.js +10 -20
- package/lib/utils/choice.js.map +1 -1
- package/lib/utils/enableWhen.js +5 -7
- package/lib/utils/enableWhen.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/openChoice.d.ts +9 -4
- package/lib/utils/openChoice.js +47 -78
- package/lib/utils/openChoice.js.map +1 -1
- package/lib/utils/tabs.d.ts +0 -21
- package/lib/utils/tabs.js +0 -51
- package/lib/utils/tabs.js.map +1 -1
- package/package.json +4 -4
- package/src/components/FormComponents/ChoiceItems/CheckboxOptionList.tsx +82 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.tsx +23 -52
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +15 -9
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.tsx +17 -19
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +13 -8
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +5 -4
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +6 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.tsx +5 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +9 -16
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +4 -4
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +4 -3
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +5 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.tsx +5 -1
- package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +1 -1
- package/src/components/FormComponents/GroupItem/TabButtonsWrapper.tsx +28 -25
- package/src/components/FormComponents/ItemParts/{RadioAnswerOptionButtons.tsx → RadioOptionList.tsx} +7 -7
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.tsx +18 -50
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +70 -68
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerValueSetFields.tsx +110 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerValueSetItem.tsx +188 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx +46 -19
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.tsx +5 -3
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +37 -29
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetFields.tsx +104 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetItem.tsx +156 -0
- package/src/components/FormComponents/StringItem/StringField.tsx +1 -1
- package/src/hooks/useInitialiseRenderer.ts +1 -1
- package/src/hooks/useNextAndPreviousVisibleTabs.ts +86 -0
- package/src/hooks/useOpenLabel.ts +43 -0
- package/src/index.ts +0 -21
- package/src/stories/BuildFormWrapper.tsx +57 -0
- package/src/stories/assets/questionnaires/QAdvancedAdditionalDisplayContent.ts +83 -0
- package/src/stories/assets/questionnaires/QAdvancedControlAppearance.ts +294 -0
- package/src/stories/assets/questionnaires/QAdvancedOther.ts +495 -0
- package/src/stories/assets/questionnaires/QAdvancedTextApperance.ts +188 -0
- package/src/stories/assets/questionnaires/QAttachment.ts +38 -0
- package/src/stories/assets/questionnaires/QBehaviorCalculations.ts +645 -0
- package/src/stories/assets/questionnaires/QBehaviorChoiceRestriction.ts +281 -0
- package/src/stories/assets/questionnaires/QBehaviorOther.ts +1149 -0
- package/src/stories/assets/questionnaires/QBehaviorValueConstraints.ts +508 -0
- package/src/stories/assets/questionnaires/QBoolean.ts +130 -0
- package/src/stories/assets/questionnaires/QChoice.ts +137 -0
- package/src/stories/assets/questionnaires/QDate.ts +56 -0
- package/src/stories/assets/questionnaires/QDateTime.ts +56 -0
- package/src/stories/assets/questionnaires/QDecimal.ts +56 -0
- package/src/stories/assets/questionnaires/QDisplay.ts +38 -0
- package/src/stories/assets/questionnaires/QGroup.ts +52 -0
- package/src/stories/assets/questionnaires/QInteger.ts +119 -0
- package/src/stories/assets/questionnaires/QItemControlDisplay.ts +114 -0
- package/src/stories/assets/questionnaires/QItemControlGroup.ts +419 -0
- package/src/stories/assets/questionnaires/QItemControlQuestion.ts +1271 -0
- package/src/stories/assets/questionnaires/QOpenChoice.ts +151 -0
- package/src/stories/assets/questionnaires/QQuantity.ts +38 -0
- package/src/stories/assets/questionnaires/QReference.ts +38 -0
- package/src/stories/assets/questionnaires/QSingleItems.ts +251 -0
- package/src/stories/assets/questionnaires/QString.ts +131 -0
- package/src/stories/assets/questionnaires/QText.ts +169 -0
- package/src/stories/assets/questionnaires/QTime.ts +38 -0
- package/src/stories/assets/questionnaires/QUrl.ts +38 -0
- package/src/stories/assets/questionnaires/index.ts +44 -0
- package/src/stories/itemTypes/Attachment.stories.tsx +39 -0
- package/src/stories/itemTypes/Boolean.stories.tsx +72 -0
- package/src/stories/{MedicalHistoryTable.stories.tsx → itemTypes/Choice.stories.tsx} +32 -26
- package/src/stories/itemTypes/Date.stories.tsx +46 -0
- package/src/stories/itemTypes/DateTime.stories.tsx +45 -0
- package/src/stories/itemTypes/Decimal.stories.tsx +56 -0
- package/src/stories/itemTypes/Display.stories.tsx +39 -0
- package/src/stories/itemTypes/Group.stories.tsx +39 -0
- package/src/stories/itemTypes/Integer.stories.tsx +55 -0
- package/src/stories/itemTypes/OpenChoice.stories.tsx +64 -0
- package/src/stories/itemTypes/Quantity.stories.tsx +39 -0
- package/src/stories/itemTypes/Reference.stories.tsx +39 -0
- package/src/stories/itemTypes/String.stories.tsx +51 -0
- package/src/stories/itemTypes/Text.stories.tsx +51 -0
- package/src/stories/itemTypes/Time.stories.tsx +39 -0
- package/src/stories/itemTypes/Url.stories.tsx +39 -0
- package/src/stories/sdc/AdvancedAdditionalDisplayContent.stories.tsx +45 -0
- package/src/stories/sdc/AdvancedControlAppearance.stories.tsx +51 -0
- package/src/stories/sdc/AdvancedOther.stories.tsx +76 -0
- package/src/stories/sdc/AdvancedTextAppearance.stories.tsx +69 -0
- package/src/stories/sdc/BehaviorCalculations.stories.tsx +69 -0
- package/src/stories/sdc/BehaviorChoiceRestriction.stories.tsx +76 -0
- package/src/stories/sdc/BehaviorOther.stories.tsx +90 -0
- package/src/stories/sdc/BehaviorValueConstraints.stories.tsx +88 -0
- package/src/stories/sdc/ItemControlDisplay.stories.tsx +39 -0
- package/src/stories/sdc/ItemControlGroup.stories.tsx +55 -0
- package/src/stories/sdc/ItemControlQuestion.stories.tsx +118 -0
- package/src/utils/buildForm.ts +23 -0
- package/src/utils/choice.ts +16 -23
- package/src/utils/enableWhen.ts +5 -7
- package/src/utils/index.ts +1 -0
- package/src/utils/openChoice.ts +83 -98
- package/src/utils/tabs.ts +0 -75
- package/vite.config.ts +23 -0
- package/doctor-storybook.log +0 -18
- package/src/stories/SmartFormsRenderer.stories.ts +0 -139
- package/src/stories/assets/QItems-and-QRItems/QR_GTableMedicalHistory.json +0 -80
- package/src/stories/assets/QItems-and-QRItems/Q_GTableMedicalHistory.json +0 -109
- package/src/stories/assets/Qs-and-QRs/Q715.json +0 -15086
- package/src/stories/assets/Qs-and-QRs/QDev715.json +0 -16081
- package/src/stories/assets/Qs-and-QRs/QTestGrid.json +0 -411
- package/src/stories/assets/Qs-and-QRs/R715.json +0 -311
- package/src/stories/assets/Qs-and-QRs/RTestGrid.json +0 -34
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
19
|
+
|
|
20
|
+
// TODO Add docs on validation is exposed as operationOutcomes
|
|
21
|
+
|
|
22
|
+
// MaxLength
|
|
23
|
+
export const qMaxLength: Questionnaire = {
|
|
24
|
+
resourceType: 'Questionnaire',
|
|
25
|
+
id: 'MaxLength',
|
|
26
|
+
name: 'MaxLength',
|
|
27
|
+
title: 'Max Length',
|
|
28
|
+
version: '0.1.0',
|
|
29
|
+
status: 'draft',
|
|
30
|
+
publisher: 'AEHRC CSIRO',
|
|
31
|
+
date: '2024-05-01',
|
|
32
|
+
url: 'https://smartforms.csiro.au/docs/behavior/value-constraints/max-length',
|
|
33
|
+
item: [
|
|
34
|
+
{
|
|
35
|
+
linkId: 'pensioner-card-number-empty',
|
|
36
|
+
text: 'Pensioner Card Number (empty)',
|
|
37
|
+
type: 'string',
|
|
38
|
+
repeats: false,
|
|
39
|
+
maxLength: 10
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
linkId: 'pensioner-card-number-filled',
|
|
43
|
+
text: 'Pensioner Card Number (filled)',
|
|
44
|
+
type: 'string',
|
|
45
|
+
repeats: false,
|
|
46
|
+
maxLength: 10
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
linkId: 'pensioner-card-number-feedback',
|
|
50
|
+
text: 'Pensioner Card Number (with feedback)',
|
|
51
|
+
type: 'string',
|
|
52
|
+
repeats: false,
|
|
53
|
+
maxLength: 10
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const qrMaxLength: QuestionnaireResponse = {
|
|
59
|
+
resourceType: 'QuestionnaireResponse',
|
|
60
|
+
status: 'in-progress',
|
|
61
|
+
item: [
|
|
62
|
+
{
|
|
63
|
+
linkId: 'pensioner-card-number-filled',
|
|
64
|
+
text: 'Pensioner Card Number (filled)',
|
|
65
|
+
answer: [
|
|
66
|
+
{
|
|
67
|
+
valueString: '111111111A'
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
linkId: 'pensioner-card-number-feedback',
|
|
73
|
+
text: 'Pensioner Card Number (with feedback)',
|
|
74
|
+
answer: [
|
|
75
|
+
{
|
|
76
|
+
valueString: '111111111AA'
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
questionnaire: 'https://smartforms.csiro.au/docs/validation/maxLength|0.1.0'
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// MinLength
|
|
85
|
+
export const qMinLength: Questionnaire = {
|
|
86
|
+
resourceType: 'Questionnaire',
|
|
87
|
+
id: 'MinLength',
|
|
88
|
+
name: 'MinLength',
|
|
89
|
+
title: 'Min Length',
|
|
90
|
+
version: '0.1.0',
|
|
91
|
+
status: 'draft',
|
|
92
|
+
publisher: 'AEHRC CSIRO',
|
|
93
|
+
date: '2024-05-01',
|
|
94
|
+
url: 'https://smartforms.csiro.au/docs/behavior/value-constraints/min-length',
|
|
95
|
+
item: [
|
|
96
|
+
{
|
|
97
|
+
extension: [
|
|
98
|
+
{
|
|
99
|
+
url: 'http://hl7.org/fhir/StructureDefinition/minLength',
|
|
100
|
+
valueInteger: 10
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
linkId: 'phone-empty',
|
|
104
|
+
text: 'Phone/mobile number (empty)',
|
|
105
|
+
type: 'string',
|
|
106
|
+
repeats: false
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
extension: [
|
|
110
|
+
{
|
|
111
|
+
url: 'http://hl7.org/fhir/StructureDefinition/minLength',
|
|
112
|
+
valueInteger: 10
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
linkId: 'phone-filled',
|
|
116
|
+
text: 'Phone/mobile (filled)',
|
|
117
|
+
type: 'string',
|
|
118
|
+
repeats: false
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
extension: [
|
|
122
|
+
{
|
|
123
|
+
url: 'http://hl7.org/fhir/StructureDefinition/minLength',
|
|
124
|
+
valueInteger: 9
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
linkId: 'phone-feedback',
|
|
128
|
+
text: 'Phone/mobile (with feedback)',
|
|
129
|
+
type: 'string',
|
|
130
|
+
repeats: false
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const qrMinLength: QuestionnaireResponse = {
|
|
136
|
+
resourceType: 'QuestionnaireResponse',
|
|
137
|
+
status: 'in-progress',
|
|
138
|
+
item: [
|
|
139
|
+
{
|
|
140
|
+
linkId: 'phone-filled',
|
|
141
|
+
text: 'Phone/mobile number (filled)',
|
|
142
|
+
answer: [
|
|
143
|
+
{
|
|
144
|
+
valueString: '0112345678'
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
linkId: 'phone-feedback',
|
|
150
|
+
text: 'Phone/mobile number (with feedback)',
|
|
151
|
+
answer: [
|
|
152
|
+
{
|
|
153
|
+
valueString: '0112345'
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
questionnaire: 'https://smartforms.csiro.au/docs/behavior/value-constraints/min-length|0.1.0'
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// Regex
|
|
162
|
+
export const qRegex: Questionnaire = {
|
|
163
|
+
resourceType: 'Questionnaire',
|
|
164
|
+
id: 'Regex',
|
|
165
|
+
name: 'Regex',
|
|
166
|
+
title: 'Regex',
|
|
167
|
+
version: '0.1.0',
|
|
168
|
+
status: 'draft',
|
|
169
|
+
publisher: 'AEHRC CSIRO',
|
|
170
|
+
date: '2024-05-01',
|
|
171
|
+
url: 'https://smartforms.csiro.au/docs/behavior/value-constraints/regex',
|
|
172
|
+
item: [
|
|
173
|
+
{
|
|
174
|
+
extension: [
|
|
175
|
+
{
|
|
176
|
+
url: 'http://hl7.org/fhir/StructureDefinition/regex',
|
|
177
|
+
valueString: "matches('^[0-9]{4}$')"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
url: 'http://hl7.org/fhir/StructureDefinition/entryFormat',
|
|
181
|
+
valueString: '####'
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
linkId: 'postcode-au-empty',
|
|
185
|
+
definition: 'http://hl7.org.au/fhir/StructureDefinition/au-address#Address.postalCode',
|
|
186
|
+
text: 'Postcode (empty)',
|
|
187
|
+
type: 'string',
|
|
188
|
+
repeats: false
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
extension: [
|
|
192
|
+
{
|
|
193
|
+
url: 'http://hl7.org/fhir/StructureDefinition/regex',
|
|
194
|
+
valueString: "matches('^[0-9]{4}$')"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
url: 'http://hl7.org/fhir/StructureDefinition/entryFormat',
|
|
198
|
+
valueString: '####'
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
linkId: 'postcode-au-filled',
|
|
202
|
+
definition: 'http://hl7.org.au/fhir/StructureDefinition/au-address#Address.postalCode',
|
|
203
|
+
text: 'Postcode (filled)',
|
|
204
|
+
type: 'string',
|
|
205
|
+
repeats: false
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
extension: [
|
|
209
|
+
{
|
|
210
|
+
url: 'http://hl7.org/fhir/StructureDefinition/regex',
|
|
211
|
+
valueString: "matches('^[0-9]{4}$')"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
url: 'http://hl7.org/fhir/StructureDefinition/entryFormat',
|
|
215
|
+
valueString: '####'
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
linkId: 'postcode-au-feedback',
|
|
219
|
+
definition: 'http://hl7.org.au/fhir/StructureDefinition/au-address#Address.postalCode',
|
|
220
|
+
text: 'Postcode (with feedback)',
|
|
221
|
+
type: 'string',
|
|
222
|
+
repeats: false
|
|
223
|
+
}
|
|
224
|
+
]
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export const qrRegex: QuestionnaireResponse = {
|
|
228
|
+
resourceType: 'QuestionnaireResponse',
|
|
229
|
+
status: 'in-progress',
|
|
230
|
+
item: [
|
|
231
|
+
{
|
|
232
|
+
linkId: 'postcode-au-filled',
|
|
233
|
+
text: 'Postcode (filled)',
|
|
234
|
+
answer: [
|
|
235
|
+
{
|
|
236
|
+
valueString: '2000'
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
linkId: 'postcode-au-feedback',
|
|
242
|
+
text: 'Postcode (with feedback)',
|
|
243
|
+
answer: [
|
|
244
|
+
{
|
|
245
|
+
valueString: '20000'
|
|
246
|
+
}
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
questionnaire: 'https://smartforms.csiro.au/docs/behavior/value-constraints/regex|0.1.0'
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
// MinValue
|
|
254
|
+
// TODO need to add more examples question (where type='date', 'dateTime', 'time', 'decimal', 'integer')
|
|
255
|
+
export const qMinValue: Questionnaire = {
|
|
256
|
+
resourceType: 'Questionnaire',
|
|
257
|
+
id: 'MinValue',
|
|
258
|
+
name: 'MinValue',
|
|
259
|
+
title: 'Min Value',
|
|
260
|
+
version: '0.1.0',
|
|
261
|
+
status: 'draft',
|
|
262
|
+
publisher: 'AEHRC CSIRO',
|
|
263
|
+
date: '2024-05-01',
|
|
264
|
+
url: 'https://smartforms.csiro.au/docs/behavior/value-constraints/min-value',
|
|
265
|
+
item: [
|
|
266
|
+
{
|
|
267
|
+
extension: [
|
|
268
|
+
{
|
|
269
|
+
url: 'http://hl7.org/fhir/StructureDefinition/minValue',
|
|
270
|
+
valueInteger: 18
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
linkId: 'age-empty',
|
|
274
|
+
text: 'Age (>=18) (empty)',
|
|
275
|
+
type: 'integer',
|
|
276
|
+
repeats: false
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
extension: [
|
|
280
|
+
{
|
|
281
|
+
url: 'http://hl7.org/fhir/StructureDefinition/minValue',
|
|
282
|
+
valueInteger: 18
|
|
283
|
+
}
|
|
284
|
+
],
|
|
285
|
+
linkId: 'age-filled',
|
|
286
|
+
text: 'Age (>=18) (filled)',
|
|
287
|
+
type: 'integer',
|
|
288
|
+
repeats: false
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
extension: [
|
|
292
|
+
{
|
|
293
|
+
url: 'http://hl7.org/fhir/StructureDefinition/minValue',
|
|
294
|
+
valueInteger: 18
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
linkId: 'age-feedback',
|
|
298
|
+
text: 'Age (>=18) (with feedback)',
|
|
299
|
+
type: 'integer',
|
|
300
|
+
repeats: false
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
export const qrMinValue: QuestionnaireResponse = {
|
|
306
|
+
resourceType: 'QuestionnaireResponse',
|
|
307
|
+
status: 'in-progress',
|
|
308
|
+
item: [
|
|
309
|
+
{
|
|
310
|
+
linkId: 'age-filled',
|
|
311
|
+
text: 'Age (>=18) (filled)',
|
|
312
|
+
answer: [
|
|
313
|
+
{
|
|
314
|
+
valueInteger: 25
|
|
315
|
+
}
|
|
316
|
+
]
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
linkId: 'age-feedback',
|
|
320
|
+
text: 'Age (>=18) (with feedback)',
|
|
321
|
+
answer: [
|
|
322
|
+
{
|
|
323
|
+
valueInteger: 15
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
],
|
|
328
|
+
questionnaire: 'https://smartforms.csiro.au/docs/behavior/value-constraints/min-value|0.1.0'
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// MaxValue
|
|
332
|
+
export const qMaxValue: Questionnaire = {
|
|
333
|
+
resourceType: 'Questionnaire',
|
|
334
|
+
id: 'MaxValueValidation',
|
|
335
|
+
name: 'MaxValueValidation',
|
|
336
|
+
title: 'Max Value Validation for Integer',
|
|
337
|
+
version: '0.1.0',
|
|
338
|
+
status: 'draft',
|
|
339
|
+
publisher: 'AEHRC CSIRO',
|
|
340
|
+
date: '2024-05-01',
|
|
341
|
+
url: 'https://smartforms.csiro.au/docs/behavior/value-constraints/max-value',
|
|
342
|
+
item: [
|
|
343
|
+
{
|
|
344
|
+
extension: [
|
|
345
|
+
{
|
|
346
|
+
url: 'http://hl7.org/fhir/StructureDefinition/maxValue',
|
|
347
|
+
valueInteger: 65
|
|
348
|
+
}
|
|
349
|
+
],
|
|
350
|
+
linkId: 'age-empty',
|
|
351
|
+
text: 'Age (<=65) (empty)',
|
|
352
|
+
type: 'integer',
|
|
353
|
+
repeats: false
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
extension: [
|
|
357
|
+
{
|
|
358
|
+
url: 'http://hl7.org/fhir/StructureDefinition/maxValue',
|
|
359
|
+
valueInteger: 65 // Example: Maximum age requirement
|
|
360
|
+
}
|
|
361
|
+
],
|
|
362
|
+
linkId: 'age-filled',
|
|
363
|
+
text: 'Age (<=65) (filled)',
|
|
364
|
+
type: 'integer',
|
|
365
|
+
repeats: false
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
extension: [
|
|
369
|
+
{
|
|
370
|
+
url: 'http://hl7.org/fhir/StructureDefinition/maxValue',
|
|
371
|
+
valueInteger: 65
|
|
372
|
+
}
|
|
373
|
+
],
|
|
374
|
+
linkId: 'age-feedback',
|
|
375
|
+
text: 'Age (<=65) (with feedback)',
|
|
376
|
+
type: 'integer',
|
|
377
|
+
repeats: false
|
|
378
|
+
}
|
|
379
|
+
]
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
export const qrMaxValue: QuestionnaireResponse = {
|
|
383
|
+
resourceType: 'QuestionnaireResponse',
|
|
384
|
+
status: 'in-progress',
|
|
385
|
+
item: [
|
|
386
|
+
{
|
|
387
|
+
linkId: 'age-filled',
|
|
388
|
+
text: 'Age (<=65) (filled)',
|
|
389
|
+
answer: [
|
|
390
|
+
{
|
|
391
|
+
valueInteger: 60
|
|
392
|
+
}
|
|
393
|
+
]
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
linkId: 'age-feedback',
|
|
397
|
+
text: 'Age (<=65) (with feedback)',
|
|
398
|
+
answer: [
|
|
399
|
+
{
|
|
400
|
+
valueInteger: 70
|
|
401
|
+
}
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
],
|
|
405
|
+
questionnaire: 'https://smartforms.csiro.au/docs/behavior/value-constraints/max-value|0.1.0'
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
// MaxDecimalPlaces
|
|
409
|
+
export const qMaxDecimalPlaces: Questionnaire = {
|
|
410
|
+
resourceType: 'Questionnaire',
|
|
411
|
+
id: 'MaxDecimalPlaces',
|
|
412
|
+
name: 'MaxDecimalPlaces',
|
|
413
|
+
title: 'Max Decimal Places',
|
|
414
|
+
version: '0.1.0',
|
|
415
|
+
status: 'draft',
|
|
416
|
+
publisher: 'AEHRC CSIRO',
|
|
417
|
+
date: '2024-05-01',
|
|
418
|
+
url: 'https://smartforms.csiro.au/docs/behavior/value-constraints/max-decimal-places',
|
|
419
|
+
item: [
|
|
420
|
+
{
|
|
421
|
+
extension: [
|
|
422
|
+
{
|
|
423
|
+
url: 'http://hl7.org/fhir/StructureDefinition/maxDecimalPlaces',
|
|
424
|
+
valueInteger: 2
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit',
|
|
428
|
+
valueCoding: {
|
|
429
|
+
system: 'http://unitsofmeasure.org',
|
|
430
|
+
code: 'kg',
|
|
431
|
+
display: 'kg'
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
],
|
|
435
|
+
linkId: 'weight-empty',
|
|
436
|
+
text: 'Weight (kg) (empty)',
|
|
437
|
+
type: 'decimal',
|
|
438
|
+
repeats: false
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
extension: [
|
|
442
|
+
{
|
|
443
|
+
url: 'http://hl7.org/fhir/StructureDefinition/maxDecimalPlaces',
|
|
444
|
+
valueInteger: 2
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit',
|
|
448
|
+
valueCoding: {
|
|
449
|
+
system: 'http://unitsofmeasure.org',
|
|
450
|
+
code: 'kg',
|
|
451
|
+
display: 'kg'
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
],
|
|
455
|
+
linkId: 'weight-filled',
|
|
456
|
+
text: 'Weight (kg) (filled)',
|
|
457
|
+
type: 'decimal',
|
|
458
|
+
repeats: false
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
extension: [
|
|
462
|
+
{
|
|
463
|
+
url: 'http://hl7.org/fhir/StructureDefinition/maxDecimalPlaces',
|
|
464
|
+
valueInteger: 2
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit',
|
|
468
|
+
valueCoding: {
|
|
469
|
+
system: 'http://unitsofmeasure.org',
|
|
470
|
+
code: 'kg',
|
|
471
|
+
display: 'kg'
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
],
|
|
475
|
+
linkId: 'weight-feedback',
|
|
476
|
+
text: 'Weight (kg) (with feedback)',
|
|
477
|
+
type: 'decimal',
|
|
478
|
+
repeats: false
|
|
479
|
+
}
|
|
480
|
+
]
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
export const qrMaxDecimalPlaces: QuestionnaireResponse = {
|
|
484
|
+
resourceType: 'QuestionnaireResponse',
|
|
485
|
+
status: 'in-progress',
|
|
486
|
+
item: [
|
|
487
|
+
{
|
|
488
|
+
linkId: 'weight-filled',
|
|
489
|
+
text: 'Weight (kg) (filled)',
|
|
490
|
+
answer: [
|
|
491
|
+
{
|
|
492
|
+
valueDecimal: 72.34
|
|
493
|
+
}
|
|
494
|
+
]
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
linkId: 'weight-feedback',
|
|
498
|
+
text: 'Weight (kg) (with feedback)',
|
|
499
|
+
answer: [
|
|
500
|
+
{
|
|
501
|
+
valueDecimal: 72.345
|
|
502
|
+
}
|
|
503
|
+
]
|
|
504
|
+
}
|
|
505
|
+
],
|
|
506
|
+
questionnaire:
|
|
507
|
+
'https://smartforms.csiro.au/docs/behavior/value-constraints/max-decimal-places|0.1.0'
|
|
508
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
19
|
+
|
|
20
|
+
export const qBooleanBasic: Questionnaire = {
|
|
21
|
+
resourceType: 'Questionnaire',
|
|
22
|
+
id: 'BooleanBasic',
|
|
23
|
+
name: 'BooleanBasic',
|
|
24
|
+
title: 'Boolean Basic',
|
|
25
|
+
version: '0.1.0',
|
|
26
|
+
status: 'draft',
|
|
27
|
+
publisher: 'AEHRC CSIRO',
|
|
28
|
+
date: '2024-05-01',
|
|
29
|
+
url: 'https://smartforms.csiro.au/docs/components/boolean/basic',
|
|
30
|
+
item: [
|
|
31
|
+
{
|
|
32
|
+
linkId: 'eaten',
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
repeats: false,
|
|
35
|
+
text: 'Have you eaten yet?'
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const qrBooleanBasicResponse: QuestionnaireResponse = {
|
|
41
|
+
resourceType: 'QuestionnaireResponse',
|
|
42
|
+
status: 'in-progress',
|
|
43
|
+
item: [
|
|
44
|
+
{
|
|
45
|
+
linkId: 'eaten',
|
|
46
|
+
text: 'Have you eaten yet?',
|
|
47
|
+
answer: [
|
|
48
|
+
{
|
|
49
|
+
valueBoolean: true
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
questionnaire: 'https://smartforms.csiro.au/docs/components/boolean/basic'
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const qBooleanCalculation: Questionnaire = {
|
|
58
|
+
resourceType: 'Questionnaire',
|
|
59
|
+
id: 'BooleanCalculation',
|
|
60
|
+
name: 'BooleanCalculation',
|
|
61
|
+
title: 'Boolean Calculation',
|
|
62
|
+
version: '0.1.0',
|
|
63
|
+
status: 'draft',
|
|
64
|
+
publisher: 'AEHRC CSIRO',
|
|
65
|
+
date: '2024-05-01',
|
|
66
|
+
url: 'https://smartforms.csiro.au/docs/components/boolean',
|
|
67
|
+
extension: [
|
|
68
|
+
{
|
|
69
|
+
url: 'http://hl7.org/fhir/StructureDefinition/variable',
|
|
70
|
+
valueExpression: {
|
|
71
|
+
name: 'gender',
|
|
72
|
+
language: 'text/fhirpath',
|
|
73
|
+
expression: "item.where(linkId = 'gender-controller').answer.valueCoding.code"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
item: [
|
|
78
|
+
{
|
|
79
|
+
linkId: 'gender-controller',
|
|
80
|
+
text: 'Gender',
|
|
81
|
+
type: 'choice',
|
|
82
|
+
repeats: false,
|
|
83
|
+
answerOption: [
|
|
84
|
+
{
|
|
85
|
+
valueCoding: {
|
|
86
|
+
system: 'http://hl7.org/fhir/administrative-gender',
|
|
87
|
+
code: 'female',
|
|
88
|
+
display: 'Female'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
valueCoding: {
|
|
93
|
+
system: 'http://hl7.org/fhir/administrative-gender',
|
|
94
|
+
code: 'male',
|
|
95
|
+
display: 'Male'
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
valueCoding: {
|
|
100
|
+
system: 'http://hl7.org/fhir/administrative-gender',
|
|
101
|
+
code: 'other',
|
|
102
|
+
display: 'Other'
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
valueCoding: {
|
|
107
|
+
system: 'http://hl7.org/fhir/administrative-gender',
|
|
108
|
+
code: 'unknown',
|
|
109
|
+
display: 'Unknown'
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
extension: [
|
|
116
|
+
{
|
|
117
|
+
url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression',
|
|
118
|
+
valueExpression: {
|
|
119
|
+
language: 'text/fhirpath',
|
|
120
|
+
expression: "%gender = 'female'"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
linkId: 'gender-is-female',
|
|
125
|
+
text: 'Gender is female?',
|
|
126
|
+
type: 'boolean',
|
|
127
|
+
readOnly: true
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
};
|