@aehrc/smart-forms-renderer 0.36.0 → 0.37.2

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 (106) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/lib/components/FormComponents/Button.styles.d.ts +4 -0
  3. package/lib/components/FormComponents/Button.styles.js +10 -0
  4. package/lib/components/FormComponents/Button.styles.js.map +1 -0
  5. package/lib/components/FormComponents/GroupItem/GroupHeading.d.ts +1 -0
  6. package/lib/components/FormComponents/GroupItem/GroupHeading.js +3 -2
  7. package/lib/components/FormComponents/GroupItem/GroupHeading.js.map +1 -1
  8. package/lib/components/FormComponents/GroupItem/GroupItem.d.ts +4 -0
  9. package/lib/components/FormComponents/GroupItem/GroupItem.js +3 -3
  10. package/lib/components/FormComponents/GroupItem/GroupItem.js.map +1 -1
  11. package/lib/components/FormComponents/GroupItem/GroupItemView.d.ts +4 -0
  12. package/lib/components/FormComponents/GroupItem/GroupItemView.js +8 -5
  13. package/lib/components/FormComponents/GroupItem/GroupItemView.js.map +1 -1
  14. package/lib/components/FormComponents/GroupItem/NextPageButton.d.ts +7 -0
  15. package/lib/components/FormComponents/GroupItem/NextPageButton.js +26 -0
  16. package/lib/components/FormComponents/GroupItem/NextPageButton.js.map +1 -0
  17. package/lib/components/FormComponents/GroupItem/PageButtonWrapper.d.ts +8 -0
  18. package/lib/components/FormComponents/GroupItem/PageButtonWrapper.js +46 -0
  19. package/lib/components/FormComponents/GroupItem/PageButtonWrapper.js.map +1 -0
  20. package/lib/components/FormComponents/GroupItem/PreviousPageButton.d.ts +7 -0
  21. package/lib/components/FormComponents/GroupItem/PreviousPageButton.js +26 -0
  22. package/lib/components/FormComponents/GroupItem/PreviousPageButton.js.map +1 -0
  23. package/lib/components/Renderer/BaseRenderer.js +8 -0
  24. package/lib/components/Renderer/BaseRenderer.js.map +1 -1
  25. package/lib/components/Renderer/FormBodyPage.d.ts +9 -0
  26. package/lib/components/Renderer/FormBodyPage.js +43 -0
  27. package/lib/components/Renderer/FormBodyPage.js.map +1 -0
  28. package/lib/components/Renderer/FormTopLevelItem.js +7 -0
  29. package/lib/components/Renderer/FormTopLevelItem.js.map +1 -1
  30. package/lib/components/Renderer/FormTopLevelPage.d.ts +9 -0
  31. package/lib/components/Renderer/FormTopLevelPage.js +29 -0
  32. package/lib/components/Renderer/FormTopLevelPage.js.map +1 -0
  33. package/lib/hooks/useCodingCalculatedExpression.js +11 -0
  34. package/lib/hooks/useCodingCalculatedExpression.js.map +1 -1
  35. package/lib/hooks/useNextAndPreviousVisiblePages.d.ts +7 -0
  36. package/lib/hooks/useNextAndPreviousVisiblePages.js +47 -0
  37. package/lib/hooks/useNextAndPreviousVisiblePages.js.map +1 -0
  38. package/lib/interfaces/page.interface.d.ts +16 -0
  39. package/lib/interfaces/page.interface.js +2 -0
  40. package/lib/interfaces/page.interface.js.map +1 -0
  41. package/lib/interfaces/questionnaireStore.interface.d.ts +2 -0
  42. package/lib/stores/questionnaireStore.d.ts +13 -0
  43. package/lib/stores/questionnaireStore.js +19 -3
  44. package/lib/stores/questionnaireStore.js.map +1 -1
  45. package/lib/utils/calculatedExpression.js +1 -1
  46. package/lib/utils/calculatedExpression.js.map +1 -1
  47. package/lib/utils/fhirpath.js +0 -4
  48. package/lib/utils/fhirpath.js.map +1 -1
  49. package/lib/utils/initialise.d.ts +3 -0
  50. package/lib/utils/initialise.js +6 -1
  51. package/lib/utils/initialise.js.map +1 -1
  52. package/lib/utils/page.d.ts +43 -0
  53. package/lib/utils/page.js +101 -0
  54. package/lib/utils/page.js.map +1 -0
  55. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js +4 -0
  56. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js.map +1 -1
  57. package/lib/utils/questionnaireStoreUtils/extractPages.d.ts +3 -0
  58. package/lib/utils/questionnaireStoreUtils/extractPages.js +18 -0
  59. package/lib/utils/questionnaireStoreUtils/extractPages.js.map +1 -0
  60. package/package.json +4 -4
  61. package/src/components/FormComponents/Button.styles.ts +10 -0
  62. package/src/components/FormComponents/GroupItem/GroupHeading.tsx +5 -3
  63. package/src/components/FormComponents/GroupItem/GroupItem.tsx +11 -1
  64. package/src/components/FormComponents/GroupItem/GroupItemView.tsx +12 -0
  65. package/src/components/FormComponents/GroupItem/NextPageButton.tsx +37 -0
  66. package/src/components/FormComponents/GroupItem/PageButtonWrapper.tsx +78 -0
  67. package/src/components/FormComponents/GroupItem/PreviousPageButton.tsx +41 -0
  68. package/src/components/Renderer/BaseRenderer.tsx +21 -0
  69. package/src/components/Renderer/FormBodyPage.tsx +93 -0
  70. package/src/components/Renderer/FormTopLevelItem.tsx +17 -0
  71. package/src/components/Renderer/FormTopLevelPage.tsx +70 -0
  72. package/src/hooks/useCodingCalculatedExpression.ts +14 -1
  73. package/src/hooks/useNextAndPreviousVisiblePages.ts +69 -0
  74. package/src/interfaces/page.interface.ts +13 -0
  75. package/src/interfaces/questionnaireStore.interface.ts +2 -0
  76. package/src/stores/questionnaireStore.ts +33 -2
  77. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreAllergyIntolerance.json +209 -0
  78. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreCondition.json +220 -0
  79. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreEncounter.json +299 -0
  80. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreImmunization.json +175 -0
  81. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreMedicationRequest.json +229 -0
  82. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationBP.json +359 -0
  83. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationBodyHeight.json +195 -0
  84. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationBodyWeight.json +195 -0
  85. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationHeartRate.json +195 -0
  86. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationSmokingStatus.json +174 -0
  87. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCorePatient.json +495 -0
  88. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCorePractitioner.json +139 -0
  89. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCorePractitionerRole.json +216 -0
  90. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreProcedure.json +199 -0
  91. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreRespirationRate.json +195 -0
  92. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreWaistCircumference.json +195 -0
  93. package/src/stories/assets/questionnaires/QAuCoreTesting.ts +3796 -0
  94. package/src/stories/assets/questionnaires/QItemControlGroup.ts +673 -0
  95. package/src/stories/assets/questionnaires/QPrePopTester.ts +266 -71
  96. package/src/stories/sdc/ItemControlGroup.stories.tsx +22 -1
  97. package/src/stories/testing/AuCoreTester.stories.tsx +196 -0
  98. package/src/utils/calculatedExpression.ts +1 -1
  99. package/src/utils/fhirpath.ts +0 -5
  100. package/src/utils/initialise.ts +11 -0
  101. package/src/utils/page.ts +134 -0
  102. package/src/utils/questionnaireStoreUtils/createQuestionaireModel.ts +5 -0
  103. package/src/utils/questionnaireStoreUtils/extractPages.ts +24 -0
  104. package/stats.html +0 -4842
  105. package/stats1.html +0 -4842
  106. package/stats3.html +0 -4842
@@ -183,108 +183,246 @@ export const qSelectivePrePopTester: Questionnaire = {
183
183
  valueString: 'The patient that is to be used to pre-populate the form'
184
184
  }
185
185
  ]
186
+ },
187
+ {
188
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
189
+ valueExpression: {
190
+ name: 'ObsTobaccoSmokingStatus',
191
+ language: 'application/x-fhir-query',
192
+ expression: 'Observation?code=72166-2&_count=1&_sort=-date&patient={{%patient.id}}'
193
+ }
186
194
  }
187
195
  ],
188
196
  item: [
189
197
  {
190
- linkId: 'display-description',
198
+ linkId: 'container',
191
199
  extension: [
192
200
  {
193
- url: 'http://hl7.org/fhir/StructureDefinition/rendering-xhtml',
194
- valueString:
195
- '<div xmlns="http://www.w3.org/1999/xhtml">\r\n <div style="font-size:0.875em"> This questionnaire is used by Playwright to do regression testing of the <pre style="display: inline">@aehrc/sdc-populate</pre> library\'s pre-population logic. Items will be incrementally added as needed.</div><br/></div>'
196
- }
197
- ],
198
- text: "This questionnaire is used by Playwright to do regression testing of the @aehrc/sdc-populate library's pre-population logic. Items will be incrementally added as needed.",
199
- type: 'display',
200
- repeats: false
201
- },
202
- {
203
- extension: [
204
- {
205
- url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression',
201
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
206
202
  valueExpression: {
203
+ name: 'sex',
207
204
  language: 'text/fhirpath',
208
- expression: '%patient.gender'
205
+ expression: "item.where(linkId='sex-at-birth-initial-expression').answer.value"
209
206
  }
210
- }
211
- ],
212
- linkId: 'gender-avs-url',
213
- text: 'Administrative gender (answerValueSet url)',
214
- type: 'choice',
215
- repeats: false,
216
- answerValueSet: 'http://hl7.org/fhir/ValueSet/administrative-gender'
217
- },
218
- {
219
- extension: [
207
+ },
220
208
  {
221
- url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression',
209
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
222
210
  valueExpression: {
211
+ name: 'smoker',
223
212
  language: 'text/fhirpath',
224
- expression: '%patient.gender'
213
+ expression: "item.where(linkId='smoking-status-initial-expression').answer.value"
225
214
  }
226
215
  }
227
216
  ],
228
- linkId: 'gender-avs-contained',
229
- text: 'Administrative gender (answerValueSet contained)',
230
- type: 'choice',
231
- repeats: false,
232
- answerValueSet: 'http://hl7.org/fhir/ValueSet/administrative-gender'
233
- },
234
- {
235
- extension: [
217
+ text: '',
218
+ type: 'group',
219
+ item: [
236
220
  {
237
- url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
238
- valueCodeableConcept: {
239
- coding: [
240
- {
241
- system: 'http://hl7.org/fhir/questionnaire-item-control',
242
- code: 'gtable'
221
+ linkId: 'display-description',
222
+ extension: [
223
+ {
224
+ url: 'http://hl7.org/fhir/StructureDefinition/rendering-xhtml',
225
+ valueString:
226
+ '<div xmlns="http://www.w3.org/1999/xhtml">\r\n <div style="font-size:0.875em"> This questionnaire is used by Playwright to do regression testing of the <pre style="display: inline">@aehrc/sdc-populate</pre> library\'s pre-population logic. Items will be incrementally added as needed.</div><br/></div>'
227
+ }
228
+ ],
229
+ text: "This questionnaire is used by Playwright to do regression testing of the @aehrc/sdc-populate library's pre-population logic. Items will be incrementally added as needed.",
230
+ type: 'display',
231
+ repeats: false
232
+ },
233
+ {
234
+ extension: [
235
+ {
236
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression',
237
+ valueExpression: {
238
+ language: 'text/fhirpath',
239
+ expression: '%patient.gender'
243
240
  }
244
- ]
245
- }
241
+ }
242
+ ],
243
+ linkId: 'gender-avs-url',
244
+ text: 'Administrative gender (answerValueSet url)',
245
+ type: 'choice',
246
+ repeats: false,
247
+ answerValueSet: 'http://hl7.org/fhir/ValueSet/administrative-gender'
246
248
  },
247
249
  {
248
- url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemPopulationContext',
249
- valueExpression: {
250
- name: 'ConditionRepeat',
251
- language: 'text/fhirpath',
252
- expression:
253
- "%Condition.entry.resource.where(category.coding.exists(code='problem-list-item'))"
254
- }
255
- }
256
- ],
257
- linkId: 'medical-history',
258
- text: 'Medical history and current problems list',
259
- type: 'group',
260
- repeats: true,
261
- item: [
250
+ extension: [
251
+ {
252
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression',
253
+ valueExpression: {
254
+ language: 'text/fhirpath',
255
+ expression: '%patient.gender'
256
+ }
257
+ }
258
+ ],
259
+ linkId: 'gender-avs-contained',
260
+ text: 'Administrative gender (answerValueSet contained)',
261
+ type: 'choice',
262
+ repeats: false,
263
+ answerValueSet: 'http://hl7.org/fhir/ValueSet/administrative-gender'
264
+ },
262
265
  {
263
266
  extension: [
267
+ {
268
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression',
269
+ valueExpression: {
270
+ language: 'text/fhirpath',
271
+ expression:
272
+ "%patient.extension.where(exists(url='http://hl7.org/fhir/StructureDefinition/individual-recordedSexOrGender' and extension.where(exists(url='type' and value.coding.code='1515311000168102')) and extension.where(url='effectivePeriod').value.end.empty())).extension.where(url='value').value.coding"
273
+ }
274
+ },
264
275
  {
265
276
  url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
266
277
  valueCodeableConcept: {
267
278
  coding: [
268
279
  {
269
280
  system: 'http://hl7.org/fhir/questionnaire-item-control',
270
- code: 'autocomplete'
281
+ code: 'drop-down'
271
282
  }
272
283
  ]
273
284
  }
274
- },
285
+ }
286
+ ],
287
+ linkId: 'sex-at-birth-initial-expression',
288
+ text: 'Sex assigned at birth (initialExpression)',
289
+ type: 'choice',
290
+ repeats: false,
291
+ answerValueSet: 'https://healthterminologies.gov.au/fhir/ValueSet/biological-sex-1'
292
+ },
293
+ {
294
+ extension: [
295
+ {
296
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression',
297
+ valueExpression: {
298
+ description: 'Calculated Sex At Birth',
299
+ language: 'text/fhirpath',
300
+ expression: '%sex'
301
+ }
302
+ }
303
+ ],
304
+ linkId: 'sex-at-birth-calculated',
305
+ text: 'Sex assigned at birth (calculatedExpression)',
306
+ type: 'choice',
307
+ repeats: false,
308
+ readOnly: true,
309
+ answerValueSet: 'https://healthterminologies.gov.au/fhir/ValueSet/biological-sex-1'
310
+ },
311
+ {
312
+ extension: [
275
313
  {
276
314
  url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression',
277
315
  valueExpression: {
278
316
  language: 'text/fhirpath',
279
317
  expression:
280
- "%ConditionRepeat.code.select((coding.where(system='http://snomed.info/sct') | coding.where(system!='http://snomed.info/sct').first() | text ).first())"
318
+ "%ObsTobaccoSmokingStatus.entry.resource.value.coding.where(system='http://snomed.info/sct')"
319
+ }
320
+ },
321
+ {
322
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
323
+ valueCodeableConcept: {
324
+ coding: [
325
+ {
326
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
327
+ code: 'radio-button'
328
+ }
329
+ ]
281
330
  }
282
331
  }
283
332
  ],
284
- linkId: 'medical-history-condition',
285
- text: 'Condition',
286
- type: 'open-choice',
287
- answerValueSet: '#MedicalHistory'
333
+ linkId: 'smoking-status-initial-expression',
334
+ text: 'Smoking status (initialExpression)',
335
+ type: 'choice',
336
+ repeats: false,
337
+ answerOption: [
338
+ {
339
+ valueCoding: {
340
+ system: 'http://snomed.info/sct',
341
+ code: '266919005',
342
+ display: 'Never smoked'
343
+ }
344
+ },
345
+ {
346
+ valueCoding: {
347
+ system: 'http://snomed.info/sct',
348
+ code: '77176002',
349
+ display: 'Smoker'
350
+ }
351
+ },
352
+ {
353
+ valueCoding: {
354
+ system: 'http://snomed.info/sct',
355
+ code: '8517006',
356
+ display: 'Ex-smoker'
357
+ }
358
+ },
359
+ {
360
+ valueCoding: {
361
+ system: 'http://snomed.info/sct',
362
+ code: '16090371000119103',
363
+ display: 'Exposure to second hand tobacco smoke'
364
+ }
365
+ },
366
+ {
367
+ valueString: 'Wants to quit'
368
+ },
369
+ {
370
+ valueString: 'Other tobacco use'
371
+ }
372
+ ]
373
+ },
374
+ {
375
+ extension: [
376
+ {
377
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression',
378
+ valueExpression: {
379
+ description: 'Calculated Smoking Status',
380
+ language: 'text/fhirpath',
381
+ expression: '%smoker'
382
+ }
383
+ }
384
+ ],
385
+ linkId: 'smoking-status-calculated',
386
+ text: 'Smoking status (calculatedExpression)',
387
+ type: 'choice',
388
+ repeats: false,
389
+ readOnly: true,
390
+ answerOption: [
391
+ {
392
+ valueCoding: {
393
+ system: 'http://snomed.info/sct',
394
+ code: '266919005',
395
+ display: 'Never smoked'
396
+ }
397
+ },
398
+ {
399
+ valueCoding: {
400
+ system: 'http://snomed.info/sct',
401
+ code: '77176002',
402
+ display: 'Smoker'
403
+ }
404
+ },
405
+ {
406
+ valueCoding: {
407
+ system: 'http://snomed.info/sct',
408
+ code: '8517006',
409
+ display: 'Ex-smoker'
410
+ }
411
+ },
412
+ {
413
+ valueCoding: {
414
+ system: 'http://snomed.info/sct',
415
+ code: '16090371000119103',
416
+ display: 'Exposure to second hand tobacco smoke'
417
+ }
418
+ },
419
+ {
420
+ valueString: 'Wants to quit'
421
+ },
422
+ {
423
+ valueString: 'Other tobacco use'
424
+ }
425
+ ]
288
426
  },
289
427
  {
290
428
  extension: [
@@ -294,23 +432,80 @@ export const qSelectivePrePopTester: Questionnaire = {
294
432
  coding: [
295
433
  {
296
434
  system: 'http://hl7.org/fhir/questionnaire-item-control',
297
- code: 'drop-down'
435
+ code: 'gtable'
298
436
  }
299
437
  ]
300
438
  }
301
439
  },
302
440
  {
303
- url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression',
441
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemPopulationContext',
304
442
  valueExpression: {
443
+ name: 'ConditionRepeat',
305
444
  language: 'text/fhirpath',
306
- expression: '%ConditionRepeat.clinicalStatus.coding'
445
+ expression:
446
+ "%Condition.entry.resource.where(category.coding.exists(code='problem-list-item'))"
307
447
  }
308
448
  }
309
449
  ],
310
- linkId: 'medical-history-status',
311
- text: 'Clinical Status',
312
- type: 'choice',
313
- answerValueSet: 'http://hl7.org/fhir/ValueSet/condition-clinical'
450
+ linkId: 'medical-history',
451
+ text: 'Medical history and current problems list',
452
+ type: 'group',
453
+ repeats: true,
454
+ item: [
455
+ {
456
+ extension: [
457
+ {
458
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
459
+ valueCodeableConcept: {
460
+ coding: [
461
+ {
462
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
463
+ code: 'autocomplete'
464
+ }
465
+ ]
466
+ }
467
+ },
468
+ {
469
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression',
470
+ valueExpression: {
471
+ language: 'text/fhirpath',
472
+ expression:
473
+ "%ConditionRepeat.code.select((coding.where(system='http://snomed.info/sct') | coding.where(system!='http://snomed.info/sct').first() | text ).first())"
474
+ }
475
+ }
476
+ ],
477
+ linkId: 'medical-history-condition',
478
+ text: 'Condition',
479
+ type: 'open-choice',
480
+ answerValueSet: '#MedicalHistory'
481
+ },
482
+ {
483
+ extension: [
484
+ {
485
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
486
+ valueCodeableConcept: {
487
+ coding: [
488
+ {
489
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
490
+ code: 'drop-down'
491
+ }
492
+ ]
493
+ }
494
+ },
495
+ {
496
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression',
497
+ valueExpression: {
498
+ language: 'text/fhirpath',
499
+ expression: '%ConditionRepeat.clinicalStatus.coding'
500
+ }
501
+ }
502
+ ],
503
+ linkId: 'medical-history-status',
504
+ text: 'Clinical Status',
505
+ type: 'choice',
506
+ answerValueSet: 'http://hl7.org/fhir/ValueSet/condition-clinical'
507
+ }
508
+ ]
314
509
  }
315
510
  ]
316
511
  }
@@ -21,7 +21,10 @@ import {
21
21
  qItemControlDisplayTabContainer,
22
22
  qItemControlGroupGridMultiRow,
23
23
  qItemControlGroupGridSingleRow,
24
- qItemControlGroupGTable
24
+ qItemControlGroupGTable,
25
+ qItemControlGroupPage,
26
+ qItemControlGroupPageContainer,
27
+ qItemControlGroupPageNonTopLevelPageContainer
25
28
  } from '../assets/questionnaires';
26
29
 
27
30
  // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
@@ -60,3 +63,21 @@ export const TabContainer: Story = {
60
63
  questionnaire: qItemControlDisplayTabContainer
61
64
  }
62
65
  };
66
+
67
+ export const Page: Story = {
68
+ args: {
69
+ questionnaire: qItemControlGroupPage
70
+ }
71
+ };
72
+
73
+ export const PageContainer: Story = {
74
+ args: {
75
+ questionnaire: qItemControlGroupPageContainer
76
+ }
77
+ };
78
+
79
+ export const PageContainerNonSingleTopLevel: Story = {
80
+ args: {
81
+ questionnaire: qItemControlGroupPageNonTopLevelPageContainer
82
+ }
83
+ };
@@ -0,0 +1,196 @@
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 { Meta, StoryObj } from '@storybook/react';
19
+ import PrePopWrapperForStorybook from '../storybookWrappers/PrePopWrapperForStorybook';
20
+ import { mockFhirClient } from '../assets/fhirClient/mockFhirClient';
21
+ import { patSmartForm } from '../assets/patients/PatSmartForm';
22
+ import { pracPrimaryPeter } from '../assets/practitioners/PracPrimaryPeter';
23
+ import {
24
+ QAuCoreAllergyIntolerance,
25
+ QAuCoreCondition,
26
+ QAuCoreEncounter,
27
+ QAuCoreImmunization,
28
+ QAuCoreMedicationRequest,
29
+ QAuCoreObservationBodyHeight,
30
+ QAuCoreObservationBodyWeight,
31
+ QAuCoreObservationBP,
32
+ QAuCoreObservationHeartRate,
33
+ QAuCoreObservationRespirationRate,
34
+ QAuCoreObservationSmokingStatus,
35
+ QAuCoreObservationWaistCircumference,
36
+ QAuCorePatient,
37
+ QAuCorePractitioner,
38
+ QAuCorePractitionerRole,
39
+ QAuCoreProcedure
40
+ } from '../assets/questionnaires/QAuCoreTesting';
41
+
42
+ // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
43
+ const meta = {
44
+ title: 'Component/Testing/AU Core Tester',
45
+ component: PrePopWrapperForStorybook,
46
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
47
+ tags: []
48
+ } satisfies Meta<typeof PrePopWrapperForStorybook>;
49
+
50
+ export default meta;
51
+ type Story = StoryObj<typeof meta>;
52
+
53
+ // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
54
+
55
+ export const AuCoreAllergyIntolerance: Story = {
56
+ args: {
57
+ questionnaire: QAuCoreAllergyIntolerance,
58
+ fhirClient: mockFhirClient,
59
+ patient: patSmartForm,
60
+ user: pracPrimaryPeter
61
+ }
62
+ };
63
+
64
+ export const AuCoreCondition: Story = {
65
+ args: {
66
+ questionnaire: QAuCoreCondition,
67
+ fhirClient: mockFhirClient,
68
+ patient: patSmartForm,
69
+ user: pracPrimaryPeter
70
+ }
71
+ };
72
+
73
+ export const AuCoreEncounter: Story = {
74
+ args: {
75
+ questionnaire: QAuCoreEncounter,
76
+ fhirClient: mockFhirClient,
77
+ patient: patSmartForm,
78
+ user: pracPrimaryPeter
79
+ }
80
+ };
81
+
82
+ export const AuCoreImmunization: Story = {
83
+ args: {
84
+ questionnaire: QAuCoreImmunization,
85
+ fhirClient: mockFhirClient,
86
+ patient: patSmartForm,
87
+ user: pracPrimaryPeter
88
+ }
89
+ };
90
+
91
+ export const AuCoreMedicationRequest: Story = {
92
+ args: {
93
+ questionnaire: QAuCoreMedicationRequest,
94
+ fhirClient: mockFhirClient,
95
+ patient: patSmartForm,
96
+ user: pracPrimaryPeter
97
+ }
98
+ };
99
+
100
+ export const AuCorePatient: Story = {
101
+ args: {
102
+ questionnaire: QAuCorePatient,
103
+ fhirClient: mockFhirClient,
104
+ patient: patSmartForm,
105
+ user: pracPrimaryPeter
106
+ }
107
+ };
108
+
109
+ export const AuCorePractitioner: Story = {
110
+ args: {
111
+ questionnaire: QAuCorePractitioner,
112
+ fhirClient: mockFhirClient,
113
+ patient: patSmartForm,
114
+ user: pracPrimaryPeter
115
+ }
116
+ };
117
+
118
+ export const AuCorePractitionerRole: Story = {
119
+ args: {
120
+ questionnaire: QAuCorePractitionerRole,
121
+ fhirClient: mockFhirClient,
122
+ patient: patSmartForm,
123
+ user: pracPrimaryPeter
124
+ }
125
+ };
126
+
127
+ export const AuCoreProcedure: Story = {
128
+ args: {
129
+ questionnaire: QAuCoreProcedure,
130
+ fhirClient: mockFhirClient,
131
+ patient: patSmartForm,
132
+ user: pracPrimaryPeter
133
+ }
134
+ };
135
+
136
+ export const AuCoreObservationBP: Story = {
137
+ args: {
138
+ questionnaire: QAuCoreObservationBP,
139
+ fhirClient: mockFhirClient,
140
+ patient: patSmartForm,
141
+ user: pracPrimaryPeter
142
+ }
143
+ };
144
+
145
+ export const AuCoreObservationBodyHeight: Story = {
146
+ args: {
147
+ questionnaire: QAuCoreObservationBodyHeight,
148
+ fhirClient: mockFhirClient,
149
+ patient: patSmartForm,
150
+ user: pracPrimaryPeter
151
+ }
152
+ };
153
+
154
+ export const AuCoreObservationBodyWeight: Story = {
155
+ args: {
156
+ questionnaire: QAuCoreObservationBodyWeight,
157
+ fhirClient: mockFhirClient,
158
+ patient: patSmartForm,
159
+ user: pracPrimaryPeter
160
+ }
161
+ };
162
+
163
+ export const AuCoreObservationHeartRate: Story = {
164
+ args: {
165
+ questionnaire: QAuCoreObservationHeartRate,
166
+ fhirClient: mockFhirClient,
167
+ patient: patSmartForm,
168
+ user: pracPrimaryPeter
169
+ }
170
+ };
171
+ export const AuCoreObservationRespirationRate: Story = {
172
+ args: {
173
+ questionnaire: QAuCoreObservationRespirationRate,
174
+ fhirClient: mockFhirClient,
175
+ patient: patSmartForm,
176
+ user: pracPrimaryPeter
177
+ }
178
+ };
179
+
180
+ export const AuCoreObservationSmokingStatus: Story = {
181
+ args: {
182
+ questionnaire: QAuCoreObservationSmokingStatus,
183
+ fhirClient: mockFhirClient,
184
+ patient: patSmartForm,
185
+ user: pracPrimaryPeter
186
+ }
187
+ };
188
+
189
+ export const AuCoreObservationWaistCircumference: Story = {
190
+ args: {
191
+ questionnaire: QAuCoreObservationWaistCircumference,
192
+ fhirClient: mockFhirClient,
193
+ patient: patSmartForm,
194
+ user: pracPrimaryPeter
195
+ }
196
+ };
@@ -224,7 +224,7 @@ function initialiseItemCalculatedExpressionValueRecursive(
224
224
  updateQrItemsInGroup(
225
225
  updatedChildQRItem,
226
226
  null,
227
- updatedChildQRItem ?? { linkId: qItem.linkId, text: qItem.text, item: [] },
227
+ qrItem ?? { linkId: qItem.linkId, text: qItem.text, item: [] },
228
228
  indexMap
229
229
  );
230
230
  }
@@ -101,11 +101,6 @@ export function createFhirPathContext(
101
101
  rootResource: questionnaireResponse
102
102
  };
103
103
 
104
- // Exit early if there are no QR items
105
- if (!questionnaireResponse.item) {
106
- return fhirPathContext;
107
- }
108
-
109
104
  // Evaluate resource-level variables
110
105
  fhirPathContext = evaluateQuestionnaireLevelVariables(
111
106
  questionnaireResponse,