@aehrc/smart-forms-renderer 0.27.4 → 0.29.0

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 (83) hide show
  1. package/.swcrc +2 -2
  2. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.d.ts +1 -0
  3. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +12 -2
  4. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js.map +1 -1
  5. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +5 -2
  6. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
  7. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.d.ts +1 -0
  8. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.js +3 -3
  9. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.js.map +1 -1
  10. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.d.ts +1 -0
  11. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +12 -2
  12. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js.map +1 -1
  13. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +5 -2
  14. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
  15. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +4 -1
  16. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
  17. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.d.ts +1 -0
  18. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.js +1 -1
  19. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.js.map +1 -1
  20. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/DateTimeField.d.ts +2 -1
  21. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/DateTimeField.js.map +1 -1
  22. package/lib/components/FormComponents/DecimalItem/DecimalItem.js +3 -1
  23. package/lib/components/FormComponents/DecimalItem/DecimalItem.js.map +1 -1
  24. package/lib/hooks/useValidationFeedback.js +1 -1
  25. package/lib/utils/calculatedExpression.js +3 -3
  26. package/lib/utils/calculatedExpression.js.map +1 -1
  27. package/lib/utils/validateQuestionnaire.js.map +1 -1
  28. package/package.json +7 -3
  29. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +28 -1
  30. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +6 -0
  31. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.tsx +5 -1
  32. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +20 -1
  33. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +6 -0
  34. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +5 -0
  35. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.tsx +3 -1
  36. package/src/components/FormComponents/DateTimeItems/CustomDateTimeItem/DateTimeField.tsx +2 -1
  37. package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +15 -12
  38. package/src/hooks/useValidationFeedback.ts +1 -1
  39. package/src/stories/BuildFormWrapper.tsx +6 -11
  40. package/src/stories/PrePopButtonForStorybook.tsx +54 -0
  41. package/src/stories/PrePopWrapper.tsx +92 -0
  42. package/src/stories/assets/fhirClient/mockFhirClient.ts +52 -0
  43. package/src/stories/assets/patients/PatSmartForm.ts +281 -0
  44. package/src/stories/assets/practitioners/PracPrimaryPeter.ts +38 -0
  45. package/src/stories/assets/questionnaires/QAdvancedAdditionalDisplayContent.ts +30 -0
  46. package/src/stories/assets/questionnaires/QAdvancedOther.ts +1 -2
  47. package/src/stories/assets/questionnaires/QAdvancedTextApperance.ts +28 -0
  48. package/src/stories/assets/questionnaires/QBehaviorCalculations.ts +17 -19
  49. package/src/stories/assets/questionnaires/QBehaviorValueConstraints.ts +1 -1
  50. package/src/stories/assets/questionnaires/QBoolean.ts +1 -1
  51. package/src/stories/assets/questionnaires/QChoice.ts +357 -1
  52. package/src/stories/assets/questionnaires/QDate.ts +1 -1
  53. package/src/stories/assets/questionnaires/QDateTime.ts +1 -1
  54. package/src/stories/assets/questionnaires/QDecimal.ts +1 -1
  55. package/src/stories/assets/questionnaires/QFormPopulation.ts +1349 -0
  56. package/src/stories/assets/questionnaires/QInteger.ts +1 -1
  57. package/src/stories/assets/questionnaires/QItemControlDisplay.ts +460 -17
  58. package/src/stories/assets/questionnaires/QItemControlGroup.ts +220 -6
  59. package/src/stories/assets/questionnaires/QOpenChoice.ts +1 -1
  60. package/src/stories/assets/questionnaires/QQuantity.ts +6 -0
  61. package/src/stories/assets/questionnaires/QString.ts +1 -1
  62. package/src/stories/assets/questionnaires/QText.ts +2 -2
  63. package/src/stories/itemTypes/Boolean.stories.tsx +0 -17
  64. package/src/stories/itemTypes/Choice.stories.tsx +15 -0
  65. package/src/stories/itemTypes/Url.stories.tsx +2 -2
  66. package/src/stories/populateCallbackForStorybook.ts +56 -0
  67. package/src/stories/populateUtilsForStorybook.ts +545 -0
  68. package/src/stories/sdc/AdvancedAdditionalDisplayContent.stories.tsx +7 -1
  69. package/src/stories/sdc/AdvancedTextAppearance.stories.tsx +7 -0
  70. package/src/stories/sdc/BehaviorChoiceRestriction.stories.tsx +1 -1
  71. package/src/stories/sdc/FormPopulation.stories.tsx +97 -0
  72. package/src/stories/sdc/ItemControlDisplay.stories.tsx +31 -1
  73. package/src/stories/sdc/ItemControlGroup.stories.tsx +10 -3
  74. package/src/stories/useBuildFormForStorybook.ts +37 -0
  75. package/src/tests/enableWhen.test.ts +112 -0
  76. package/src/tests/test-data/enable-when-items-sample.json +3848 -0
  77. package/src/tests/test-data/initial-answers-sample.json +16 -0
  78. package/src/tests/test-data/linked-questions-map.json +217 -0
  79. package/src/tests/test-data/questionnaire-response-sample.json +650 -0
  80. package/src/utils/calculatedExpression.ts +3 -2
  81. package/src/utils/validateQuestionnaire.ts +18 -6
  82. package/storybook.log +6 -0
  83. package/vite.config.ts +9 -1
@@ -0,0 +1,650 @@
1
+ {
2
+ "resourceType": "QuestionnaireResponse",
3
+ "status": "in-progress",
4
+ "questionnaire": "http://www.health.gov.au/assessments/mbs/715",
5
+ "item": [
6
+ {
7
+ "linkId": "fd5af92e-c248-497a-8007-ee0952ccd4d9",
8
+ "text": "Aboriginal and Torres Strait Islander health check",
9
+ "item": [
10
+ {
11
+ "linkId": "1016f79d-9756-4daf-b6ee-29add134b34f",
12
+ "text": "Consent",
13
+ "item": [
14
+ {
15
+ "linkId": "84162f36-f4af-4509-b178-ef2a3849d0b6",
16
+ "text": "Date",
17
+ "answer": [
18
+ {
19
+ "valueDate": "2023-02-20"
20
+ }
21
+ ]
22
+ }
23
+ ]
24
+ },
25
+ {
26
+ "linkId": "5b224753-9365-44e3-823b-9c17e7394005",
27
+ "text": "Patient Details",
28
+ "item": [
29
+ {
30
+ "linkId": "17596726-34cf-4133-9960-7081e1d63558",
31
+ "text": "Name",
32
+ "answer": [
33
+ {
34
+ "valueString": "Benito Lucio"
35
+ }
36
+ ]
37
+ },
38
+ {
39
+ "linkId": "90ad8f16-16e4-4438-a7aa-b3189f510da2",
40
+ "text": "Date of birth",
41
+ "answer": [
42
+ {
43
+ "valueDate": "1936-08-18"
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "linkId": "e2a16e4d-2765-4b61-b286-82cfc6356b30",
49
+ "text": "Age",
50
+ "answer": [
51
+ {
52
+ "valueInteger": 86
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "linkId": "418e4a02-de77-48a0-a92a-fe8fcc52b1aa",
58
+ "text": "Gender",
59
+ "answer": [
60
+ {
61
+ "valueCoding": {
62
+ "system": "http://hl7.org/fhir/administrative-gender",
63
+ "code": "male",
64
+ "display": "Male"
65
+ }
66
+ }
67
+ ]
68
+ },
69
+ {
70
+ "linkId": "f1262ade-843c-4eba-a86d-51a9c97d134b",
71
+ "text": "Home address",
72
+ "item": [
73
+ {
74
+ "linkId": "2fee2d51-7828-4178-b8c1-35edd32ba338",
75
+ "text": "Street address",
76
+ "answer": [
77
+ {
78
+ "valueString": "320 Ritchie Byway "
79
+ }
80
+ ]
81
+ },
82
+ {
83
+ "linkId": "ddb65ed1-f4b2-4730-af2a-2f98bc73c76f",
84
+ "text": "City",
85
+ "answer": [
86
+ {
87
+ "valueString": "Boston"
88
+ }
89
+ ]
90
+ },
91
+ {
92
+ "linkId": "d9a1236c-8d6e-4f20-a12a-9d5de5a1d0f6",
93
+ "text": "State",
94
+ "answer": [
95
+ {
96
+ "valueString": "Massachusetts"
97
+ }
98
+ ]
99
+ },
100
+ {
101
+ "linkId": "3f61a1ea-1c74-4f52-8519-432ce861a74f",
102
+ "text": "Postcode",
103
+ "answer": [
104
+ {
105
+ "valueString": "02108"
106
+ }
107
+ ]
108
+ }
109
+ ]
110
+ },
111
+ {
112
+ "linkId": "9541f0b0-f5ba-4fe7-a8e9-ad003cef897b",
113
+ "text": "Home phone",
114
+ "answer": [
115
+ {
116
+ "valueString": "555-913-5055"
117
+ }
118
+ ]
119
+ }
120
+ ]
121
+ },
122
+ {
123
+ "linkId": "28d5dbe4-1e65-487c-847a-847f544a6a91",
124
+ "text": "Medical history and current problems",
125
+ "item": [
126
+ {
127
+ "linkId": "736f2a51-e04d-4e7f-aef1-c47f3a1f4e3c",
128
+ "text": "Other relevant medical history, operations, hospital admissions, etc",
129
+ "answer": [
130
+ {
131
+ "valueCoding": {
132
+ "system": "http://snomed.info/sct",
133
+ "code": "162864005",
134
+ "display": "Body mass index 30+ - obesity (finding)"
135
+ }
136
+ },
137
+ {
138
+ "valueCoding": {
139
+ "system": "http://snomed.info/sct",
140
+ "code": "444814009",
141
+ "display": "Viral sinusitis (disorder)"
142
+ }
143
+ },
144
+ {
145
+ "valueCoding": {
146
+ "system": "http://snomed.info/sct",
147
+ "code": "26929004",
148
+ "display": "Alzheimer's disease (disorder)"
149
+ }
150
+ },
151
+ {
152
+ "valueCoding": {
153
+ "system": "http://snomed.info/sct",
154
+ "code": "444814009",
155
+ "display": "Viral sinusitis (disorder)"
156
+ }
157
+ },
158
+ {
159
+ "valueCoding": {
160
+ "system": "http://snomed.info/sct",
161
+ "code": "62564004",
162
+ "display": "Concussion with loss of consciousness"
163
+ }
164
+ },
165
+ {
166
+ "valueCoding": {
167
+ "system": "http://snomed.info/sct",
168
+ "code": "444814009",
169
+ "display": "Viral sinusitis (disorder)"
170
+ }
171
+ },
172
+ {
173
+ "valueCoding": {
174
+ "system": "http://snomed.info/sct",
175
+ "code": "55822004",
176
+ "display": "Hyperlipidemia"
177
+ }
178
+ },
179
+ {
180
+ "valueCoding": {
181
+ "system": "http://snomed.info/sct",
182
+ "code": "68496003",
183
+ "display": "Polyp of colon"
184
+ }
185
+ }
186
+ ]
187
+ },
188
+ {
189
+ "linkId": "92bd7d05-9b5e-4cf9-900b-703f361dad9d",
190
+ "text": "Medical history and current problems list",
191
+ "item": [
192
+ {
193
+ "linkId": "59b1900a-4f85-4a8c-b9cd-3fe2fd76f27e",
194
+ "text": "Condition",
195
+ "answer": [
196
+ {
197
+ "valueCoding": {
198
+ "system": "http://snomed.info/sct",
199
+ "code": "162864005",
200
+ "display": "Body mass index 30+ - obesity (finding)"
201
+ }
202
+ }
203
+ ]
204
+ },
205
+ {
206
+ "linkId": "88bcfad7-386b-4d87-b34b-2e50482e4d2c",
207
+ "text": "Clinical Status",
208
+ "answer": [
209
+ {
210
+ "valueCoding": {
211
+ "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
212
+ "code": "active"
213
+ }
214
+ }
215
+ ]
216
+ },
217
+ {
218
+ "linkId": "6ae641ad-95bb-4cdc-8910-5a52077e492c",
219
+ "text": "Onset Date",
220
+ "answer": [
221
+ {
222
+ "valueDateTime": "1986-08-19T19:08:38+00:00"
223
+ }
224
+ ]
225
+ },
226
+ {
227
+ "linkId": "18b9e159-2ed7-4047-82b7-deb2a171de4f",
228
+ "text": "Recorded Date",
229
+ "answer": [
230
+ {
231
+ "valueDateTime": "1986-08-19T19:08:38+00:00"
232
+ }
233
+ ]
234
+ }
235
+ ]
236
+ },
237
+ {
238
+ "linkId": "92bd7d05-9b5e-4cf9-900b-703f361dad9d",
239
+ "text": "Medical history and current problems list",
240
+ "item": [
241
+ {
242
+ "linkId": "59b1900a-4f85-4a8c-b9cd-3fe2fd76f27e",
243
+ "text": "Condition",
244
+ "answer": [
245
+ {
246
+ "valueCoding": {
247
+ "system": "http://snomed.info/sct",
248
+ "code": "444814009",
249
+ "display": "Viral sinusitis (disorder)"
250
+ }
251
+ }
252
+ ]
253
+ },
254
+ {
255
+ "linkId": "88bcfad7-386b-4d87-b34b-2e50482e4d2c",
256
+ "text": "Clinical Status",
257
+ "answer": [
258
+ {
259
+ "valueCoding": {
260
+ "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
261
+ "code": "resolved"
262
+ }
263
+ }
264
+ ]
265
+ },
266
+ {
267
+ "linkId": "6ae641ad-95bb-4cdc-8910-5a52077e492c",
268
+ "text": "Onset Date",
269
+ "answer": [
270
+ {
271
+ "valueDateTime": "2018-04-10T19:08:38+00:00"
272
+ }
273
+ ]
274
+ },
275
+ {
276
+ "linkId": "18b9e159-2ed7-4047-82b7-deb2a171de4f",
277
+ "text": "Recorded Date",
278
+ "answer": [
279
+ {
280
+ "valueDateTime": "2018-04-10T19:08:38+00:00"
281
+ }
282
+ ]
283
+ }
284
+ ]
285
+ },
286
+ {
287
+ "linkId": "92bd7d05-9b5e-4cf9-900b-703f361dad9d",
288
+ "text": "Medical history and current problems list",
289
+ "item": [
290
+ {
291
+ "linkId": "59b1900a-4f85-4a8c-b9cd-3fe2fd76f27e",
292
+ "text": "Condition",
293
+ "answer": [
294
+ {
295
+ "valueCoding": {
296
+ "system": "http://snomed.info/sct",
297
+ "code": "26929004",
298
+ "display": "Alzheimer's disease (disorder)"
299
+ }
300
+ }
301
+ ]
302
+ },
303
+ {
304
+ "linkId": "88bcfad7-386b-4d87-b34b-2e50482e4d2c",
305
+ "text": "Clinical Status",
306
+ "answer": [
307
+ {
308
+ "valueCoding": {
309
+ "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
310
+ "code": "active"
311
+ }
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ "linkId": "6ae641ad-95bb-4cdc-8910-5a52077e492c",
317
+ "text": "Onset Date",
318
+ "answer": [
319
+ {
320
+ "valueDateTime": "2017-01-03T19:08:38+00:00"
321
+ }
322
+ ]
323
+ },
324
+ {
325
+ "linkId": "18b9e159-2ed7-4047-82b7-deb2a171de4f",
326
+ "text": "Recorded Date",
327
+ "answer": [
328
+ {
329
+ "valueDateTime": "2017-01-03T19:08:38+00:00"
330
+ }
331
+ ]
332
+ }
333
+ ]
334
+ },
335
+ {
336
+ "linkId": "92bd7d05-9b5e-4cf9-900b-703f361dad9d",
337
+ "text": "Medical history and current problems list",
338
+ "item": [
339
+ {
340
+ "linkId": "59b1900a-4f85-4a8c-b9cd-3fe2fd76f27e",
341
+ "text": "Condition",
342
+ "answer": [
343
+ {
344
+ "valueCoding": {
345
+ "system": "http://snomed.info/sct",
346
+ "code": "444814009",
347
+ "display": "Viral sinusitis (disorder)"
348
+ }
349
+ }
350
+ ]
351
+ },
352
+ {
353
+ "linkId": "88bcfad7-386b-4d87-b34b-2e50482e4d2c",
354
+ "text": "Clinical Status",
355
+ "answer": [
356
+ {
357
+ "valueCoding": {
358
+ "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
359
+ "code": "resolved"
360
+ }
361
+ }
362
+ ]
363
+ },
364
+ {
365
+ "linkId": "6ae641ad-95bb-4cdc-8910-5a52077e492c",
366
+ "text": "Onset Date",
367
+ "answer": [
368
+ {
369
+ "valueDateTime": "2019-06-01T19:08:38+00:00"
370
+ }
371
+ ]
372
+ },
373
+ {
374
+ "linkId": "18b9e159-2ed7-4047-82b7-deb2a171de4f",
375
+ "text": "Recorded Date",
376
+ "answer": [
377
+ {
378
+ "valueDateTime": "2019-06-01T19:08:38+00:00"
379
+ }
380
+ ]
381
+ }
382
+ ]
383
+ },
384
+ {
385
+ "linkId": "92bd7d05-9b5e-4cf9-900b-703f361dad9d",
386
+ "text": "Medical history and current problems list",
387
+ "item": [
388
+ {
389
+ "linkId": "59b1900a-4f85-4a8c-b9cd-3fe2fd76f27e",
390
+ "text": "Condition",
391
+ "answer": [
392
+ {
393
+ "valueCoding": {
394
+ "system": "http://snomed.info/sct",
395
+ "code": "62564004",
396
+ "display": "Concussion with loss of consciousness"
397
+ }
398
+ }
399
+ ]
400
+ },
401
+ {
402
+ "linkId": "88bcfad7-386b-4d87-b34b-2e50482e4d2c",
403
+ "text": "Clinical Status",
404
+ "answer": [
405
+ {
406
+ "valueCoding": {
407
+ "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
408
+ "code": "resolved"
409
+ }
410
+ }
411
+ ]
412
+ },
413
+ {
414
+ "linkId": "6ae641ad-95bb-4cdc-8910-5a52077e492c",
415
+ "text": "Onset Date",
416
+ "answer": [
417
+ {
418
+ "valueDateTime": "2011-12-18T19:08:38+00:00"
419
+ }
420
+ ]
421
+ },
422
+ {
423
+ "linkId": "18b9e159-2ed7-4047-82b7-deb2a171de4f",
424
+ "text": "Recorded Date",
425
+ "answer": [
426
+ {
427
+ "valueDateTime": "2011-12-18T19:08:38+00:00"
428
+ }
429
+ ]
430
+ }
431
+ ]
432
+ },
433
+ {
434
+ "linkId": "92bd7d05-9b5e-4cf9-900b-703f361dad9d",
435
+ "text": "Medical history and current problems list",
436
+ "item": [
437
+ {
438
+ "linkId": "59b1900a-4f85-4a8c-b9cd-3fe2fd76f27e",
439
+ "text": "Condition",
440
+ "answer": [
441
+ {
442
+ "valueCoding": {
443
+ "system": "http://snomed.info/sct",
444
+ "code": "444814009",
445
+ "display": "Viral sinusitis (disorder)"
446
+ }
447
+ }
448
+ ]
449
+ },
450
+ {
451
+ "linkId": "88bcfad7-386b-4d87-b34b-2e50482e4d2c",
452
+ "text": "Clinical Status",
453
+ "answer": [
454
+ {
455
+ "valueCoding": {
456
+ "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
457
+ "code": "resolved"
458
+ }
459
+ }
460
+ ]
461
+ },
462
+ {
463
+ "linkId": "6ae641ad-95bb-4cdc-8910-5a52077e492c",
464
+ "text": "Onset Date",
465
+ "answer": [
466
+ {
467
+ "valueDateTime": "2017-12-15T19:08:38+00:00"
468
+ }
469
+ ]
470
+ },
471
+ {
472
+ "linkId": "18b9e159-2ed7-4047-82b7-deb2a171de4f",
473
+ "text": "Recorded Date",
474
+ "answer": [
475
+ {
476
+ "valueDateTime": "2017-12-15T19:08:38+00:00"
477
+ }
478
+ ]
479
+ }
480
+ ]
481
+ },
482
+ {
483
+ "linkId": "92bd7d05-9b5e-4cf9-900b-703f361dad9d",
484
+ "text": "Medical history and current problems list",
485
+ "item": [
486
+ {
487
+ "linkId": "59b1900a-4f85-4a8c-b9cd-3fe2fd76f27e",
488
+ "text": "Condition",
489
+ "answer": [
490
+ {
491
+ "valueCoding": {
492
+ "system": "http://snomed.info/sct",
493
+ "code": "55822004",
494
+ "display": "Hyperlipidemia"
495
+ }
496
+ }
497
+ ]
498
+ },
499
+ {
500
+ "linkId": "88bcfad7-386b-4d87-b34b-2e50482e4d2c",
501
+ "text": "Clinical Status",
502
+ "answer": [
503
+ {
504
+ "valueCoding": {
505
+ "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
506
+ "code": "active"
507
+ }
508
+ }
509
+ ]
510
+ },
511
+ {
512
+ "linkId": "6ae641ad-95bb-4cdc-8910-5a52077e492c",
513
+ "text": "Onset Date",
514
+ "answer": [
515
+ {
516
+ "valueDateTime": "1995-09-05T19:08:38+00:00"
517
+ }
518
+ ]
519
+ },
520
+ {
521
+ "linkId": "18b9e159-2ed7-4047-82b7-deb2a171de4f",
522
+ "text": "Recorded Date",
523
+ "answer": [
524
+ {
525
+ "valueDateTime": "1995-09-05T19:08:38+00:00"
526
+ }
527
+ ]
528
+ }
529
+ ]
530
+ },
531
+ {
532
+ "linkId": "92bd7d05-9b5e-4cf9-900b-703f361dad9d",
533
+ "text": "Medical history and current problems list",
534
+ "item": [
535
+ {
536
+ "linkId": "59b1900a-4f85-4a8c-b9cd-3fe2fd76f27e",
537
+ "text": "Condition",
538
+ "answer": [
539
+ {
540
+ "valueCoding": {
541
+ "system": "http://snomed.info/sct",
542
+ "code": "68496003",
543
+ "display": "Polyp of colon"
544
+ }
545
+ }
546
+ ]
547
+ },
548
+ {
549
+ "linkId": "88bcfad7-386b-4d87-b34b-2e50482e4d2c",
550
+ "text": "Clinical Status",
551
+ "answer": [
552
+ {
553
+ "valueCoding": {
554
+ "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
555
+ "code": "resolved"
556
+ }
557
+ }
558
+ ]
559
+ },
560
+ {
561
+ "linkId": "6ae641ad-95bb-4cdc-8910-5a52077e492c",
562
+ "text": "Onset Date",
563
+ "answer": [
564
+ {
565
+ "valueDateTime": "2014-11-02T19:08:38+00:00"
566
+ }
567
+ ]
568
+ },
569
+ {
570
+ "linkId": "18b9e159-2ed7-4047-82b7-deb2a171de4f",
571
+ "text": "Recorded Date",
572
+ "answer": [
573
+ {
574
+ "valueDateTime": "2014-11-02T19:08:38+00:00"
575
+ }
576
+ ]
577
+ }
578
+ ]
579
+ }
580
+ ]
581
+ },
582
+ {
583
+ "linkId": "14a9fb5f-5b0e-4862-b143-08a11cd3ebf0",
584
+ "text": "Substance use, including tobacco",
585
+ "item": [
586
+ {
587
+ "linkId": "515eda6e-973a-4b10-910a-0d4bf4f2efff",
588
+ "text": "Smoking",
589
+ "item": [
590
+ {
591
+ "linkId": "b639a3a8-f476-4cc8-b5c7-f5d2abb23511",
592
+ "text": "Smoking status",
593
+ "answer": [
594
+ {
595
+ "valueCoding": {
596
+ "system": "http://snomed.info/sct",
597
+ "code": "8517006",
598
+ "display": "Former smoker"
599
+ }
600
+ }
601
+ ]
602
+ }
603
+ ]
604
+ }
605
+ ]
606
+ },
607
+ {
608
+ "linkId": "d95abe99-8ef2-4b97-bc88-a2901e2ebc9c",
609
+ "text": "Absolute cardiovascular risk calculation",
610
+ "item": [
611
+ {
612
+ "linkId": "e8fed84e-6c15-4f62-bc95-cd08033af3f7",
613
+ "text": "Diabetes",
614
+ "answer": [
615
+ {
616
+ "valueBoolean": false
617
+ }
618
+ ]
619
+ }
620
+ ]
621
+ },
622
+ {
623
+ "linkId": "16971bd2-5494-483d-9713-eda182c47f02",
624
+ "text": "Finalising the health check",
625
+ "item": [
626
+ {
627
+ "linkId": "a400fe69-c99f-47ed-bee1-083c3e4be467",
628
+ "text": "Recalls entered (eg clinical review, investigations, influenza vaccination, asthma plan/cycle of care, diabetes cycle of care, care plan review, cervical screening, investigations)",
629
+ "item": [
630
+ {
631
+ "linkId": "40e3933d-77bb-40f3-8609-0c38ebb4421e",
632
+ "text": "recall-subject",
633
+ "answer": [
634
+ {
635
+ "valueString": "d64b37f5-d3b5-4c25-abe8-23ebe8f5a04e"
636
+ }
637
+ ]
638
+ }
639
+ ]
640
+ }
641
+ ]
642
+ }
643
+ ]
644
+ }
645
+ ],
646
+ "subject": {
647
+ "type": "Patient",
648
+ "reference": "Patient/d64b37f5-d3b5-4c25-abe8-23ebe8f5a04e"
649
+ }
650
+ }
@@ -267,7 +267,7 @@ function initialiseItemCalculatedExpressionValueRecursive(
267
267
  return constructGroupItem(qItem, qrItem, calculatedExpressions);
268
268
  }
269
269
 
270
- return constructSingleItem(qItem, calculatedExpressions);
270
+ return constructSingleItem(qItem, qrItem, calculatedExpressions);
271
271
  }
272
272
 
273
273
  function getCalculatedExpressionAnswer(
@@ -317,11 +317,12 @@ function constructGroupItem(
317
317
 
318
318
  function constructSingleItem(
319
319
  qItem: QuestionnaireItem,
320
+ qrItem: QuestionnaireResponseItem | undefined,
320
321
  calculatedExpressions: Record<string, CalculatedExpression[]>
321
322
  ): QuestionnaireResponseItem | null {
322
323
  const calculatedExpressionAnswer = getCalculatedExpressionAnswer(qItem, calculatedExpressions);
323
324
  if (!calculatedExpressionAnswer) {
324
- return null;
325
+ return qrItem ?? null;
325
326
  }
326
327
 
327
328
  return {