@aehrc/smart-forms-renderer 0.35.5 → 0.35.6

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.
@@ -0,0 +1,383 @@
1
+ import { Questionnaire } from 'fhir/r4';
2
+
3
+ const testQuestionnaire: Questionnaire = {
4
+ resourceType: 'Questionnaire',
5
+ id: 'CalculatedExpressionCvdRiskCalculatorPrepop',
6
+ meta: {
7
+ versionId: '1',
8
+ lastUpdated: '2024-06-11T10:15:22.026+00:00',
9
+ source: '#CwlqsoGwV8CY9l7l'
10
+ },
11
+ extension: [
12
+ {
13
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
14
+ valueExpression: {
15
+ name: 'Condition',
16
+ language: 'application/x-fhir-query',
17
+ expression: 'Condition?patient={{%patient.id}}'
18
+ }
19
+ },
20
+ {
21
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
22
+ valueExpression: {
23
+ name: 'ObsTobaccoSmokingStatus',
24
+ language: 'application/x-fhir-query',
25
+ expression: 'Observation?code=72166-2&_count=1&_sort=-date&patient={{%patient.id}}'
26
+ }
27
+ },
28
+ {
29
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
30
+ valueExpression: {
31
+ name: 'ObsBodyHeight',
32
+ language: 'application/x-fhir-query',
33
+ expression: 'Observation?code=8302-2&_count=1&_sort=-date&patient={{%patient.id}}'
34
+ }
35
+ },
36
+ {
37
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
38
+ valueExpression: {
39
+ name: 'ObsBodyWeight',
40
+ language: 'application/x-fhir-query',
41
+ expression: 'Observation?code=29463-7&_count=1&_sort=-date&patient={{%patient.id}}'
42
+ }
43
+ },
44
+ {
45
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
46
+ valueExpression: {
47
+ name: 'ObsHeadCircumference',
48
+ language: 'application/x-fhir-query',
49
+ expression: 'Observation?code=9843-4&_count=1&_sort=-date&patient={{%patient.id}}'
50
+ }
51
+ },
52
+ {
53
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
54
+ valueExpression: {
55
+ name: 'ObsWaistCircumference',
56
+ language: 'application/x-fhir-query',
57
+ expression: 'Observation?code=8280-0&_count=1&_sort=-date&patient={{%patient.id}}'
58
+ }
59
+ },
60
+ {
61
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
62
+ valueExpression: {
63
+ name: 'ObsBloodPressure',
64
+ language: 'application/x-fhir-query',
65
+ expression: 'Observation?code=85354-9&_count=1&_sort=-date&patient={{%patient.id}}'
66
+ }
67
+ },
68
+ {
69
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
70
+ valueExpression: {
71
+ name: 'ObsHeartRate',
72
+ language: 'application/x-fhir-query',
73
+ expression: 'Observation?code=8867-4&_count=1&_sort=-date&patient={{%patient.id}}'
74
+ }
75
+ },
76
+ {
77
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
78
+ valueExpression: {
79
+ name: 'ObsTotalCholesterol',
80
+ language: 'application/x-fhir-query',
81
+ expression: 'Observation?code=14647-2&_count=1&_sort=-date&patient={{%patient.id}}'
82
+ }
83
+ },
84
+ {
85
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
86
+ valueExpression: {
87
+ name: 'ObsHDLCholesterol',
88
+ language: 'application/x-fhir-query',
89
+ expression: 'Observation?code=14646-4&_count=1&_sort=-date&patient={{%patient.id}}'
90
+ }
91
+ },
92
+ {
93
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext',
94
+ extension: [
95
+ {
96
+ url: 'name',
97
+ valueCoding: {
98
+ system: 'http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext',
99
+ code: 'patient'
100
+ }
101
+ },
102
+ {
103
+ url: 'type',
104
+ valueCode: 'Patient'
105
+ },
106
+ {
107
+ url: 'description',
108
+ valueString: 'The patient that is to be used to pre-populate the form'
109
+ }
110
+ ]
111
+ }
112
+ ],
113
+ contained: [
114
+ {
115
+ resourceType: 'ValueSet',
116
+ id: 'MedicalHistory',
117
+ url: 'https://smartforms.csiro.au/ig/ValueSet/MedicalHistory',
118
+ name: 'MedicalHistory',
119
+ title: 'Medical History',
120
+ status: 'draft',
121
+ experimental: false,
122
+ description:
123
+ 'The Medical History value set includes values that may be used to represent medical history, operations and hospital admissions.',
124
+ compose: {
125
+ include: [
126
+ {
127
+ system: 'http://snomed.info/sct',
128
+ filter: [
129
+ {
130
+ property: 'constraint',
131
+ op: '=',
132
+ value:
133
+ '^32570581000036105|Problem/Diagnosis reference set| OR ^32570141000036105|Procedure foundation reference set|'
134
+ }
135
+ ]
136
+ }
137
+ ]
138
+ }
139
+ }
140
+ ],
141
+ url: 'https://smartforms.csiro.au/docs/sdc/population/calculated-expression-2',
142
+ version: '0.1.0',
143
+ name: 'CalculatedExpressionCvdRiskCalculatorPrepop',
144
+ title: 'Calculated Expression CVD Risk Calculator - Pre-population',
145
+ status: 'draft',
146
+ date: '2024-05-01',
147
+ publisher: 'AEHRC CSIRO',
148
+ item: [
149
+ {
150
+ extension: [
151
+ {
152
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
153
+ valueExpression: {
154
+ name: 'female',
155
+ language: 'text/fhirpath',
156
+ expression: "iif(item.where(linkId='gender').answer.value.code='female', 1, 0)"
157
+ }
158
+ },
159
+ {
160
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
161
+ valueExpression: {
162
+ name: 'age',
163
+ language: 'text/fhirpath',
164
+ expression: "item.where(linkId='patient-age').answer.value"
165
+ }
166
+ },
167
+ {
168
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
169
+ valueExpression: {
170
+ name: 'cvdAge',
171
+ language: 'text/fhirpath',
172
+ expression: 'iif(%age > 74, 74, iif(%age < 35, 35, %age))'
173
+ }
174
+ },
175
+ {
176
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
177
+ valueExpression: {
178
+ name: 'systolicBP',
179
+ language: 'text/fhirpath',
180
+ expression: "item.where(linkId='systolic-blood-pressure').answer.value"
181
+ }
182
+ },
183
+ {
184
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
185
+ valueExpression: {
186
+ name: 'smoker',
187
+ language: 'text/fhirpath',
188
+ expression:
189
+ "iif(item.where(linkId='smoking-status').answer.value.code='77176002', 1, 0)"
190
+ }
191
+ },
192
+ {
193
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
194
+ valueExpression: {
195
+ name: 'totalCh',
196
+ language: 'text/fhirpath',
197
+ expression: "item.where(linkId='total-cholesterol').answer.value"
198
+ }
199
+ },
200
+ {
201
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
202
+ valueExpression: {
203
+ name: 'hdl',
204
+ language: 'text/fhirpath',
205
+ expression: "item.where(linkId='hdl-cholesterol').answer.value"
206
+ }
207
+ },
208
+ {
209
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
210
+ valueExpression: {
211
+ name: 'diabetes',
212
+ language: 'text/fhirpath',
213
+ expression: "iif(item.where(linkId='has-diabetes').answer.value = true,1,0)"
214
+ }
215
+ },
216
+ {
217
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
218
+ valueExpression: {
219
+ name: 'ecgLvh',
220
+ language: 'text/fhirpath',
221
+ expression: "iif(item.where(linkId='ecg-lvh').answer.value = true,1,0)"
222
+ }
223
+ },
224
+ {
225
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
226
+ valueExpression: {
227
+ name: 'cBase',
228
+ language: 'text/fhirpath',
229
+ expression: '18.8144'
230
+ }
231
+ },
232
+ {
233
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
234
+ valueExpression: {
235
+ name: 'cFemale',
236
+ language: 'text/fhirpath',
237
+ expression: '%female * -1.2146'
238
+ }
239
+ },
240
+ {
241
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
242
+ valueExpression: {
243
+ name: 'cAge',
244
+ language: 'text/fhirpath',
245
+ expression: '%cvdAge.ln() * -1.8443'
246
+ }
247
+ },
248
+ {
249
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
250
+ valueExpression: {
251
+ name: 'cAgeFemale',
252
+ language: 'text/fhirpath',
253
+ expression: '%female * %cvdAge.ln() * 0.3668'
254
+ }
255
+ },
256
+ {
257
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
258
+ valueExpression: {
259
+ name: 'cSBP',
260
+ language: 'text/fhirpath',
261
+ expression: '%systolicBP.ln() * -1.4032'
262
+ }
263
+ },
264
+ {
265
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
266
+ valueExpression: {
267
+ name: 'cSmoker',
268
+ language: 'text/fhirpath',
269
+ expression: '%smoker * -0.3899'
270
+ }
271
+ },
272
+ {
273
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
274
+ valueExpression: {
275
+ name: 'cTcHdl',
276
+ language: 'text/fhirpath',
277
+ expression: '(%totalCh / %hdl).ln() * -0.539'
278
+ }
279
+ },
280
+ {
281
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
282
+ valueExpression: {
283
+ name: 'cDiabetes',
284
+ language: 'text/fhirpath',
285
+ expression: '%diabetes * -0.3036'
286
+ }
287
+ },
288
+ {
289
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
290
+ valueExpression: {
291
+ name: 'cDiabetesFemale',
292
+ language: 'text/fhirpath',
293
+ expression: '%female * %diabetes * -0.1697'
294
+ }
295
+ },
296
+ {
297
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
298
+ valueExpression: {
299
+ name: 'cEcgLvh',
300
+ language: 'text/fhirpath',
301
+ expression: '%ecgLvh * -0.3362'
302
+ }
303
+ },
304
+ {
305
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
306
+ valueExpression: {
307
+ name: 'sumOfCoeffs',
308
+ language: 'text/fhirpath',
309
+ expression:
310
+ '%cBase + %cFemale + %cAge + %cAgeFemale + %cSBP + %cSmoker + %cTcHdl + %cDiabetes + %cDiabetesFemale + %cEcgLvh'
311
+ }
312
+ },
313
+ {
314
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
315
+ valueExpression: {
316
+ name: 'cvdScale',
317
+ language: 'text/fhirpath',
318
+ expression: '(0.6536 + (%sumOfCoeffs * -0.2402)).exp()'
319
+ }
320
+ },
321
+ {
322
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
323
+ valueExpression: {
324
+ name: 'cvdU',
325
+ language: 'text/fhirpath',
326
+ expression: '(5.ln()-%sumOfCoeffs)/%cvdScale'
327
+ }
328
+ },
329
+ {
330
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
331
+ valueExpression: {
332
+ name: 'cvdScore',
333
+ language: 'text/fhirpath',
334
+ expression: '(1 - (%cvdU.exp()*-1).exp()) * 100'
335
+ }
336
+ }
337
+ ],
338
+ linkId: 'scenario-2',
339
+ text: "Request for X-Ray Right Foot as 'Procedure + Laterality'",
340
+ type: 'group',
341
+ item: [
342
+ {
343
+ extension: [
344
+ {
345
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
346
+ valueCodeableConcept: {
347
+ coding: [
348
+ {
349
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
350
+ code: 'autocomplete'
351
+ }
352
+ ]
353
+ }
354
+ }
355
+ ],
356
+ linkId: 'medical-history-condition',
357
+ text: 'Medical History Condition',
358
+ type: 'open-choice',
359
+ answerValueSet: '#MedicalHistory'
360
+ },
361
+ {
362
+ extension: [
363
+ {
364
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
365
+ valueCodeableConcept: {
366
+ coding: [
367
+ {
368
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
369
+ code: 'autocomplete'
370
+ }
371
+ ]
372
+ }
373
+ }
374
+ ],
375
+ linkId: 'medical-history-condition',
376
+ text: 'Medical History Condition',
377
+ type: 'open-choice',
378
+ answerValueSet: '#MedicalHistory'
379
+ }
380
+ ]
381
+ }
382
+ ]
383
+ };