@aehrc/smart-forms-renderer 0.34.0 → 0.34.1
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/lib/components/FormComponents/BooleanItem/BooleanField.d.ts +1 -2
- package/lib/components/FormComponents/BooleanItem/BooleanField.js +1 -1
- package/lib/components/FormComponents/BooleanItem/BooleanField.js.map +1 -1
- package/lib/components/FormComponents/BooleanItem/BooleanItem.js +3 -3
- package/lib/components/FormComponents/BooleanItem/BooleanItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.d.ts +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.d.ts +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.d.ts +1 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +12 -5
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.d.ts +2 -2
- 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 +1 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.d.ts +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.d.ts +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +10 -19
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +11 -8
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.d.ts +1 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.js +6 -4
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItemView.d.ts +1 -1
- package/lib/utils/choice.d.ts +4 -4
- package/lib/utils/choice.js +21 -12
- package/lib/utils/choice.js.map +1 -1
- package/lib/utils/itemControl.js +5 -1
- package/lib/utils/itemControl.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FormComponents/BooleanItem/BooleanField.tsx +2 -4
- package/src/components/FormComponents/BooleanItem/BooleanItem.tsx +0 -3
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +0 -3
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +0 -3
- package/src/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.tsx +0 -3
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +2 -12
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +19 -7
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.tsx +2 -10
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +1 -3
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +1 -5
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +37 -46
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +19 -11
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.tsx +11 -7
- package/src/components/FormComponents/GroupItem/GroupItemSwitcher.tsx +1 -1
- package/src/components/FormComponents/GroupItem/GroupItemView.tsx +1 -1
- package/src/stories/assets/questionnaires/QGroupTableTester.ts +461 -0
- package/src/stories/storybookWrappers/BuildFormButtonForStorybook.tsx +7 -1
- package/src/stories/storybookWrappers/BuildFormButtonTesterWrapperForStorybook.tsx +7 -1
- package/src/stories/storybookWrappers/BuildFormWrapperForStorybook.tsx +7 -1
- package/src/stories/storybookWrappers/FormValidationTesterWrapperForStorybook.tsx +7 -1
- package/src/stories/storybookWrappers/PrePopWrapperForStorybook.tsx +7 -1
- package/src/stories/storybookWrappers/globals.ts +18 -0
- package/src/stories/testing/GroupTableTester.stories.tsx +39 -0
- package/src/utils/choice.ts +28 -16
- package/src/utils/itemControl.ts +9 -1
|
@@ -17,7 +17,11 @@
|
|
|
17
17
|
|
|
18
18
|
import React from 'react';
|
|
19
19
|
|
|
20
|
-
import type {
|
|
20
|
+
import type {
|
|
21
|
+
QuestionnaireItem,
|
|
22
|
+
QuestionnaireItemAnswerOption,
|
|
23
|
+
QuestionnaireResponseItem
|
|
24
|
+
} from 'fhir/r4';
|
|
21
25
|
import { findInAnswerOptions, getQrChoiceValue } from '../../../utils/choice';
|
|
22
26
|
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
23
27
|
import type {
|
|
@@ -66,23 +70,28 @@ function ChoiceSelectAnswerOptionItem(props: ChoiceSelectAnswerOptionItemProps)
|
|
|
66
70
|
}
|
|
67
71
|
});
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (options.length === 0) {
|
|
73
|
+
function handleChange(newValue: QuestionnaireItemAnswerOption | string | null) {
|
|
74
|
+
// No options present or newValue is type null
|
|
75
|
+
if (options.length === 0 || newValue === null) {
|
|
72
76
|
onQrItemChange(createEmptyQrItem(qItem));
|
|
73
77
|
return;
|
|
74
78
|
}
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
// newValue is type string
|
|
81
|
+
if (typeof newValue === 'string') {
|
|
82
|
+
const qrAnswer = findInAnswerOptions(options, newValue);
|
|
83
|
+
onQrItemChange(
|
|
84
|
+
qrAnswer ? { ...createEmptyQrItem(qItem), answer: [qrAnswer] } : createEmptyQrItem(qItem)
|
|
85
|
+
);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// newValue is type QuestionnaireItemAnswerOption
|
|
77
90
|
onQrItemChange(
|
|
78
|
-
|
|
91
|
+
newValue ? { ...createEmptyQrItem(qItem), answer: [newValue] } : createEmptyQrItem(qItem)
|
|
79
92
|
);
|
|
80
93
|
}
|
|
81
94
|
|
|
82
|
-
function handleClear() {
|
|
83
|
-
onQrItemChange(createEmptyQrItem(qItem));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
95
|
return (
|
|
87
96
|
<ChoiceSelectAnswerOptionView
|
|
88
97
|
qItem={qItem}
|
|
@@ -94,7 +103,6 @@ function ChoiceSelectAnswerOptionItem(props: ChoiceSelectAnswerOptionItemProps)
|
|
|
94
103
|
isTabled={isTabled}
|
|
95
104
|
onFocusLinkId={() => onFocusLinkId(qItem.linkId)}
|
|
96
105
|
onSelectChange={handleChange}
|
|
97
|
-
onClear={handleClear}
|
|
98
106
|
/>
|
|
99
107
|
);
|
|
100
108
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import React from 'react';
|
|
18
|
+
import React, { useMemo } from 'react';
|
|
19
19
|
import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
20
20
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
21
21
|
import type {
|
|
@@ -23,6 +23,7 @@ import type {
|
|
|
23
23
|
PropsWithIsTabledAttribute
|
|
24
24
|
} from '../../../interfaces/renderProps.interface';
|
|
25
25
|
import type { QuestionnaireItem, QuestionnaireItemAnswerOption } from 'fhir/r4';
|
|
26
|
+
import { findInAnswerOptions } from '../../../utils/choice';
|
|
26
27
|
import ChoiceSelectAnswerOptionFields from './ChoiceSelectAnswerOptionFields';
|
|
27
28
|
|
|
28
29
|
interface ChoiceSelectAnswerOptionViewProps
|
|
@@ -33,9 +34,8 @@ interface ChoiceSelectAnswerOptionViewProps
|
|
|
33
34
|
valueChoice: string | null;
|
|
34
35
|
readOnly: boolean;
|
|
35
36
|
calcExpUpdated: boolean;
|
|
36
|
-
onSelectChange: (
|
|
37
|
+
onSelectChange: (newValue: QuestionnaireItemAnswerOption | null) => void;
|
|
37
38
|
onFocusLinkId: () => void;
|
|
38
|
-
onClear: () => void;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
function ChoiceSelectAnswerOptionView(props: ChoiceSelectAnswerOptionViewProps) {
|
|
@@ -48,16 +48,20 @@ function ChoiceSelectAnswerOptionView(props: ChoiceSelectAnswerOptionViewProps)
|
|
|
48
48
|
readOnly,
|
|
49
49
|
calcExpUpdated,
|
|
50
50
|
onFocusLinkId,
|
|
51
|
-
onSelectChange
|
|
52
|
-
onClear
|
|
51
|
+
onSelectChange
|
|
53
52
|
} = props;
|
|
54
53
|
|
|
54
|
+
const valueSelect: QuestionnaireItemAnswerOption | null = useMemo(
|
|
55
|
+
() => findInAnswerOptions(options, valueChoice ?? '') ?? null,
|
|
56
|
+
[options, valueChoice]
|
|
57
|
+
);
|
|
58
|
+
|
|
55
59
|
if (isRepeated) {
|
|
56
60
|
return (
|
|
57
61
|
<ChoiceSelectAnswerOptionFields
|
|
58
62
|
qItem={qItem}
|
|
59
63
|
options={options}
|
|
60
|
-
valueSelect={
|
|
64
|
+
valueSelect={valueSelect}
|
|
61
65
|
readOnly={readOnly}
|
|
62
66
|
calcExpUpdated={calcExpUpdated}
|
|
63
67
|
isTabled={isTabled}
|
|
@@ -75,7 +79,7 @@ function ChoiceSelectAnswerOptionView(props: ChoiceSelectAnswerOptionViewProps)
|
|
|
75
79
|
<ChoiceSelectAnswerOptionFields
|
|
76
80
|
qItem={qItem}
|
|
77
81
|
options={options}
|
|
78
|
-
valueSelect={
|
|
82
|
+
valueSelect={valueSelect}
|
|
79
83
|
readOnly={readOnly}
|
|
80
84
|
calcExpUpdated={calcExpUpdated}
|
|
81
85
|
isTabled={isTabled}
|
|
@@ -101,7 +101,7 @@ function GroupItemSwitcher(props: GroupItemSwitcherProps) {
|
|
|
101
101
|
<GridGroup
|
|
102
102
|
qItem={qItem}
|
|
103
103
|
qrItem={qrItem ?? null}
|
|
104
|
-
groupCardElevation={groupCardElevation
|
|
104
|
+
groupCardElevation={groupCardElevation}
|
|
105
105
|
parentIsReadOnly={parentIsReadOnly}
|
|
106
106
|
onQrItemChange={onQrItemChange}
|
|
107
107
|
/>
|
|
@@ -24,7 +24,7 @@ import type {
|
|
|
24
24
|
PropsWithParentIsRepeatGroupAttribute,
|
|
25
25
|
PropsWithQrItemChangeHandler
|
|
26
26
|
} from '../../../interfaces/renderProps.interface';
|
|
27
|
-
import { PropsWithQrRepeatGroupChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
27
|
+
import type { PropsWithQrRepeatGroupChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
28
28
|
import type { Tabs } from '../../../interfaces/tab.interface';
|
|
29
29
|
import GroupHeading from './GroupHeading';
|
|
30
30
|
import { GroupCard } from './GroupItem.styles';
|
|
@@ -0,0 +1,461 @@
|
|
|
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 } from 'fhir/r4';
|
|
19
|
+
|
|
20
|
+
export const qGTableWithBoolean: Questionnaire = {
|
|
21
|
+
resourceType: 'Questionnaire',
|
|
22
|
+
id: 'GTableWithBoolean',
|
|
23
|
+
name: 'GTableWithBoolean',
|
|
24
|
+
title: 'GTable with Boolean',
|
|
25
|
+
version: '0.1.0',
|
|
26
|
+
status: 'draft',
|
|
27
|
+
publisher: 'AEHRC CSIRO',
|
|
28
|
+
date: '2024-05-01',
|
|
29
|
+
url: 'https://smartforms.csiro.au/docs/tester/gtable-1',
|
|
30
|
+
contained: [
|
|
31
|
+
{
|
|
32
|
+
resourceType: 'ValueSet',
|
|
33
|
+
id: 'MedicalHistory',
|
|
34
|
+
url: 'https://smartforms.csiro.au/ig/ValueSet/MedicalHistory',
|
|
35
|
+
name: 'MedicalHistory',
|
|
36
|
+
title: 'Medical History',
|
|
37
|
+
status: 'draft',
|
|
38
|
+
experimental: false,
|
|
39
|
+
description:
|
|
40
|
+
'The Medical History value set includes values that may be used to represent medical history, operations and hospital admissions.',
|
|
41
|
+
compose: {
|
|
42
|
+
include: [
|
|
43
|
+
{
|
|
44
|
+
system: 'http://snomed.info/sct',
|
|
45
|
+
filter: [
|
|
46
|
+
{
|
|
47
|
+
property: 'constraint',
|
|
48
|
+
op: '=',
|
|
49
|
+
value:
|
|
50
|
+
'^32570581000036105|Problem/Diagnosis reference set| OR ^32570141000036105|Procedure foundation reference set|'
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
resourceType: 'ValueSet',
|
|
59
|
+
id: 'condition-clinical',
|
|
60
|
+
extension: [
|
|
61
|
+
{
|
|
62
|
+
url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-wg',
|
|
63
|
+
valueCode: 'pc'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status',
|
|
67
|
+
valueCode: 'trial-use'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm',
|
|
71
|
+
valueInteger: 3
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
url: 'http://hl7.org/fhir/ValueSet/condition-clinical',
|
|
75
|
+
identifier: [
|
|
76
|
+
{
|
|
77
|
+
system: 'urn:ietf:rfc:3986',
|
|
78
|
+
value: 'urn:oid:2.16.840.1.113883.4.642.3.164'
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
version: '4.0.1',
|
|
82
|
+
name: 'ConditionClinicalStatusCodes',
|
|
83
|
+
title: 'Condition Clinical Status Codes',
|
|
84
|
+
status: 'draft',
|
|
85
|
+
experimental: false,
|
|
86
|
+
publisher: 'FHIR Project team',
|
|
87
|
+
contact: [
|
|
88
|
+
{
|
|
89
|
+
telecom: [
|
|
90
|
+
{
|
|
91
|
+
system: 'url',
|
|
92
|
+
value: 'http://hl7.org/fhir'
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
description: 'Preferred value set for Condition Clinical Status.',
|
|
98
|
+
copyright: 'Copyright © 2011+ HL7. Licensed under Creative Commons "No Rights Reserved".',
|
|
99
|
+
compose: {
|
|
100
|
+
include: [
|
|
101
|
+
{
|
|
102
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical'
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
expansion: {
|
|
107
|
+
identifier: 'urn:uuid:79d21cca-9f34-4cfa-9020-17eee95eeed8',
|
|
108
|
+
timestamp: '2024-04-02T14:17:12+10:00',
|
|
109
|
+
total: 6,
|
|
110
|
+
parameter: [
|
|
111
|
+
{
|
|
112
|
+
name: 'version',
|
|
113
|
+
valueUri: 'http://terminology.hl7.org/CodeSystem/condition-clinical|4.0.1'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'used-codesystem',
|
|
117
|
+
valueUri: 'http://terminology.hl7.org/CodeSystem/condition-clinical|4.0.1'
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'warning-draft',
|
|
121
|
+
valueUri: 'http://hl7.org/fhir/ValueSet/condition-clinical|4.0.1'
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'warning-trial-use',
|
|
125
|
+
valueUri: 'http://hl7.org/fhir/ValueSet/condition-clinical|4.0.1'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'warning-trial-use',
|
|
129
|
+
valueUri: 'http://terminology.hl7.org/CodeSystem/condition-clinical|4.0.1'
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: 'warning-draft',
|
|
133
|
+
valueUri: 'http://terminology.hl7.org/CodeSystem/condition-clinical|4.0.1'
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
contains: [
|
|
137
|
+
{
|
|
138
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
139
|
+
code: 'active',
|
|
140
|
+
display: 'Active'
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
144
|
+
code: 'inactive',
|
|
145
|
+
display: 'Inactive'
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
149
|
+
code: 'recurrence',
|
|
150
|
+
display: 'Recurrence'
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
154
|
+
code: 'relapse',
|
|
155
|
+
display: 'Relapse'
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
159
|
+
code: 'remission',
|
|
160
|
+
display: 'Remission'
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
164
|
+
code: 'resolved',
|
|
165
|
+
display: 'Resolved'
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
item: [
|
|
172
|
+
{
|
|
173
|
+
extension: [
|
|
174
|
+
{
|
|
175
|
+
url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
|
|
176
|
+
valueCodeableConcept: {
|
|
177
|
+
coding: [
|
|
178
|
+
{
|
|
179
|
+
system: 'http://hl7.org/fhir/questionnaire-item-control',
|
|
180
|
+
code: 'gtable'
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
linkId: 'medical-history',
|
|
187
|
+
text: 'Medical history and current problems list',
|
|
188
|
+
type: 'group',
|
|
189
|
+
repeats: true,
|
|
190
|
+
item: [
|
|
191
|
+
{
|
|
192
|
+
extension: [
|
|
193
|
+
{
|
|
194
|
+
url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
|
|
195
|
+
valueCodeableConcept: {
|
|
196
|
+
coding: [
|
|
197
|
+
{
|
|
198
|
+
system: 'http://hl7.org/fhir/questionnaire-item-control',
|
|
199
|
+
code: 'autocomplete'
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
linkId: 'medical-history-condition',
|
|
206
|
+
text: 'Condition',
|
|
207
|
+
type: 'open-choice',
|
|
208
|
+
answerValueSet: '#MedicalHistory'
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
extension: [
|
|
212
|
+
{
|
|
213
|
+
url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
|
|
214
|
+
valueCodeableConcept: {
|
|
215
|
+
coding: [
|
|
216
|
+
{
|
|
217
|
+
system: 'http://hl7.org/fhir/questionnaire-item-control',
|
|
218
|
+
code: 'drop-down'
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
linkId: 'medical-history-status',
|
|
225
|
+
text: 'Clinical Status',
|
|
226
|
+
type: 'choice',
|
|
227
|
+
answerValueSet: '#condition-clinical'
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
linkId: 'medical-history-onset',
|
|
231
|
+
text: 'Onset Date',
|
|
232
|
+
type: 'date'
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
linkId: 'medical-history-boolean-tester',
|
|
236
|
+
text: 'Boolean tester',
|
|
237
|
+
type: 'boolean'
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export const qGTableWithChoice: Questionnaire = {
|
|
245
|
+
resourceType: 'Questionnaire',
|
|
246
|
+
id: 'GTableWithChoice',
|
|
247
|
+
name: 'GTableWithChoice',
|
|
248
|
+
title: 'GTable with Choice',
|
|
249
|
+
version: '0.1.0',
|
|
250
|
+
status: 'draft',
|
|
251
|
+
publisher: 'AEHRC CSIRO',
|
|
252
|
+
date: '2024-05-01',
|
|
253
|
+
url: 'https://smartforms.csiro.au/docs/tester/gtable-2',
|
|
254
|
+
contained: [
|
|
255
|
+
{
|
|
256
|
+
resourceType: 'ValueSet',
|
|
257
|
+
id: 'MedicalHistory',
|
|
258
|
+
url: 'https://smartforms.csiro.au/ig/ValueSet/MedicalHistory',
|
|
259
|
+
name: 'MedicalHistory',
|
|
260
|
+
title: 'Medical History',
|
|
261
|
+
status: 'draft',
|
|
262
|
+
experimental: false,
|
|
263
|
+
description:
|
|
264
|
+
'The Medical History value set includes values that may be used to represent medical history, operations and hospital admissions.',
|
|
265
|
+
compose: {
|
|
266
|
+
include: [
|
|
267
|
+
{
|
|
268
|
+
system: 'http://snomed.info/sct',
|
|
269
|
+
filter: [
|
|
270
|
+
{
|
|
271
|
+
property: 'constraint',
|
|
272
|
+
op: '=',
|
|
273
|
+
value:
|
|
274
|
+
'^32570581000036105|Problem/Diagnosis reference set| OR ^32570141000036105|Procedure foundation reference set|'
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
resourceType: 'ValueSet',
|
|
283
|
+
id: 'condition-clinical',
|
|
284
|
+
extension: [
|
|
285
|
+
{
|
|
286
|
+
url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-wg',
|
|
287
|
+
valueCode: 'pc'
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status',
|
|
291
|
+
valueCode: 'trial-use'
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm',
|
|
295
|
+
valueInteger: 3
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
url: 'http://hl7.org/fhir/ValueSet/condition-clinical',
|
|
299
|
+
identifier: [
|
|
300
|
+
{
|
|
301
|
+
system: 'urn:ietf:rfc:3986',
|
|
302
|
+
value: 'urn:oid:2.16.840.1.113883.4.642.3.164'
|
|
303
|
+
}
|
|
304
|
+
],
|
|
305
|
+
version: '4.0.1',
|
|
306
|
+
name: 'ConditionClinicalStatusCodes',
|
|
307
|
+
title: 'Condition Clinical Status Codes',
|
|
308
|
+
status: 'draft',
|
|
309
|
+
experimental: false,
|
|
310
|
+
publisher: 'FHIR Project team',
|
|
311
|
+
contact: [
|
|
312
|
+
{
|
|
313
|
+
telecom: [
|
|
314
|
+
{
|
|
315
|
+
system: 'url',
|
|
316
|
+
value: 'http://hl7.org/fhir'
|
|
317
|
+
}
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
],
|
|
321
|
+
description: 'Preferred value set for Condition Clinical Status.',
|
|
322
|
+
copyright: 'Copyright © 2011+ HL7. Licensed under Creative Commons "No Rights Reserved".',
|
|
323
|
+
compose: {
|
|
324
|
+
include: [
|
|
325
|
+
{
|
|
326
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical'
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
expansion: {
|
|
331
|
+
identifier: 'urn:uuid:79d21cca-9f34-4cfa-9020-17eee95eeed8',
|
|
332
|
+
timestamp: '2024-04-02T14:17:12+10:00',
|
|
333
|
+
total: 6,
|
|
334
|
+
parameter: [
|
|
335
|
+
{
|
|
336
|
+
name: 'version',
|
|
337
|
+
valueUri: 'http://terminology.hl7.org/CodeSystem/condition-clinical|4.0.1'
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: 'used-codesystem',
|
|
341
|
+
valueUri: 'http://terminology.hl7.org/CodeSystem/condition-clinical|4.0.1'
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: 'warning-draft',
|
|
345
|
+
valueUri: 'http://hl7.org/fhir/ValueSet/condition-clinical|4.0.1'
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
name: 'warning-trial-use',
|
|
349
|
+
valueUri: 'http://hl7.org/fhir/ValueSet/condition-clinical|4.0.1'
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
name: 'warning-trial-use',
|
|
353
|
+
valueUri: 'http://terminology.hl7.org/CodeSystem/condition-clinical|4.0.1'
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: 'warning-draft',
|
|
357
|
+
valueUri: 'http://terminology.hl7.org/CodeSystem/condition-clinical|4.0.1'
|
|
358
|
+
}
|
|
359
|
+
],
|
|
360
|
+
contains: [
|
|
361
|
+
{
|
|
362
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
363
|
+
code: 'active',
|
|
364
|
+
display: 'Active'
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
368
|
+
code: 'inactive',
|
|
369
|
+
display: 'Inactive'
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
373
|
+
code: 'recurrence',
|
|
374
|
+
display: 'Recurrence'
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
378
|
+
code: 'relapse',
|
|
379
|
+
display: 'Relapse'
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
383
|
+
code: 'remission',
|
|
384
|
+
display: 'Remission'
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
388
|
+
code: 'resolved',
|
|
389
|
+
display: 'Resolved'
|
|
390
|
+
}
|
|
391
|
+
]
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
],
|
|
395
|
+
item: [
|
|
396
|
+
{
|
|
397
|
+
extension: [
|
|
398
|
+
{
|
|
399
|
+
url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
|
|
400
|
+
valueCodeableConcept: {
|
|
401
|
+
coding: [
|
|
402
|
+
{
|
|
403
|
+
system: 'http://hl7.org/fhir/questionnaire-item-control',
|
|
404
|
+
code: 'gtable'
|
|
405
|
+
}
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
],
|
|
410
|
+
linkId: 'medical-history',
|
|
411
|
+
text: 'Medical history and current problems list',
|
|
412
|
+
type: 'group',
|
|
413
|
+
repeats: true,
|
|
414
|
+
item: [
|
|
415
|
+
{
|
|
416
|
+
extension: [
|
|
417
|
+
{
|
|
418
|
+
url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
|
|
419
|
+
valueCodeableConcept: {
|
|
420
|
+
coding: [
|
|
421
|
+
{
|
|
422
|
+
system: 'http://hl7.org/fhir/questionnaire-item-control',
|
|
423
|
+
code: 'autocomplete'
|
|
424
|
+
}
|
|
425
|
+
]
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
],
|
|
429
|
+
linkId: 'medical-history-condition',
|
|
430
|
+
text: 'Condition',
|
|
431
|
+
type: 'open-choice',
|
|
432
|
+
answerValueSet: '#MedicalHistory'
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
extension: [
|
|
436
|
+
{
|
|
437
|
+
url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
|
|
438
|
+
valueCodeableConcept: {
|
|
439
|
+
coding: [
|
|
440
|
+
{
|
|
441
|
+
system: 'http://hl7.org/fhir/questionnaire-item-control',
|
|
442
|
+
code: 'drop-down'
|
|
443
|
+
}
|
|
444
|
+
]
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
],
|
|
448
|
+
linkId: 'medical-history-status',
|
|
449
|
+
text: 'Clinical Status',
|
|
450
|
+
type: 'choice',
|
|
451
|
+
answerValueSet: '#condition-clinical'
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
linkId: 'medical-history-onset',
|
|
455
|
+
text: 'Onset Date',
|
|
456
|
+
type: 'date'
|
|
457
|
+
}
|
|
458
|
+
]
|
|
459
|
+
}
|
|
460
|
+
]
|
|
461
|
+
};
|
|
@@ -21,6 +21,7 @@ import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
|
21
21
|
import { Box, IconButton, Tooltip } from '@mui/material';
|
|
22
22
|
import Iconify from '../../components/Iconify/Iconify';
|
|
23
23
|
import { buildForm } from '../../utils';
|
|
24
|
+
import { STORYBOOK_TERMINOLOGY_SERVER_URL } from './globals';
|
|
24
25
|
|
|
25
26
|
interface BuildFormButtonProps {
|
|
26
27
|
questionnaire: Questionnaire;
|
|
@@ -31,7 +32,12 @@ function BuildFormButtonForStorybook(props: BuildFormButtonProps) {
|
|
|
31
32
|
const { questionnaire, questionnaireResponse } = props;
|
|
32
33
|
|
|
33
34
|
async function handleBuildForm() {
|
|
34
|
-
await buildForm(
|
|
35
|
+
await buildForm(
|
|
36
|
+
questionnaire,
|
|
37
|
+
questionnaireResponse,
|
|
38
|
+
undefined,
|
|
39
|
+
STORYBOOK_TERMINOLOGY_SERVER_URL
|
|
40
|
+
);
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
return (
|
|
@@ -23,6 +23,7 @@ import { QueryClientProvider } from '@tanstack/react-query';
|
|
|
23
23
|
import { RendererThemeProvider } from '../../theme';
|
|
24
24
|
import { useBuildForm, useRendererQueryClient } from '../../hooks';
|
|
25
25
|
import BuildFormButtonForStorybook from './BuildFormButtonForStorybook';
|
|
26
|
+
import { STORYBOOK_TERMINOLOGY_SERVER_URL } from './globals';
|
|
26
27
|
|
|
27
28
|
interface BuildFormButtonTesterWrapperForStorybookProps {
|
|
28
29
|
questionnaire: Questionnaire;
|
|
@@ -46,7 +47,12 @@ function BuildFormButtonTesterWrapperForStorybook(
|
|
|
46
47
|
|
|
47
48
|
const queryClient = useRendererQueryClient();
|
|
48
49
|
|
|
49
|
-
const isBuilding = useBuildForm(
|
|
50
|
+
const isBuilding = useBuildForm(
|
|
51
|
+
questionnaire,
|
|
52
|
+
undefined,
|
|
53
|
+
undefined,
|
|
54
|
+
STORYBOOK_TERMINOLOGY_SERVER_URL
|
|
55
|
+
);
|
|
50
56
|
|
|
51
57
|
if (isBuilding) {
|
|
52
58
|
return <div>Loading...</div>;
|
|
@@ -23,6 +23,7 @@ import { QueryClientProvider } from '@tanstack/react-query';
|
|
|
23
23
|
import RendererThemeProvider from '../../theme/Theme';
|
|
24
24
|
import { useBuildForm } from '../../hooks';
|
|
25
25
|
import useRendererQueryClient from '../../hooks/useRendererQueryClient';
|
|
26
|
+
import { STORYBOOK_TERMINOLOGY_SERVER_URL } from './globals';
|
|
26
27
|
|
|
27
28
|
interface BuildFormWrapperForStorybookProps {
|
|
28
29
|
questionnaire: Questionnaire;
|
|
@@ -33,7 +34,12 @@ function BuildFormWrapperForStorybook(props: BuildFormWrapperForStorybookProps)
|
|
|
33
34
|
const { questionnaire, questionnaireResponse } = props;
|
|
34
35
|
|
|
35
36
|
const queryClient = useRendererQueryClient();
|
|
36
|
-
const isBuilding = useBuildForm(
|
|
37
|
+
const isBuilding = useBuildForm(
|
|
38
|
+
questionnaire,
|
|
39
|
+
questionnaireResponse,
|
|
40
|
+
undefined,
|
|
41
|
+
STORYBOOK_TERMINOLOGY_SERVER_URL
|
|
42
|
+
);
|
|
37
43
|
|
|
38
44
|
if (isBuilding) {
|
|
39
45
|
return <div>Loading...</div>;
|
|
@@ -24,6 +24,7 @@ import { RendererThemeProvider } from '../../theme';
|
|
|
24
24
|
import { useBuildForm, useRendererQueryClient } from '../../hooks';
|
|
25
25
|
import { Grid } from '@mui/material';
|
|
26
26
|
import FormValidationViewerForStorybook from './FormValidationViewerForStorybook';
|
|
27
|
+
import { STORYBOOK_TERMINOLOGY_SERVER_URL } from './globals';
|
|
27
28
|
|
|
28
29
|
interface FormValidationTesterWrapperForStorybookProps {
|
|
29
30
|
questionnaire: Questionnaire;
|
|
@@ -35,7 +36,12 @@ function FormValidationTesterWrapperForStorybook(
|
|
|
35
36
|
) {
|
|
36
37
|
const { questionnaire, questionnaireResponse } = props;
|
|
37
38
|
|
|
38
|
-
const isBuilding = useBuildForm(
|
|
39
|
+
const isBuilding = useBuildForm(
|
|
40
|
+
questionnaire,
|
|
41
|
+
questionnaireResponse,
|
|
42
|
+
undefined,
|
|
43
|
+
STORYBOOK_TERMINOLOGY_SERVER_URL
|
|
44
|
+
);
|
|
39
45
|
|
|
40
46
|
const queryClient = useRendererQueryClient();
|
|
41
47
|
|