@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
@@ -631,3 +631,676 @@ export const qItemControlDisplayTabContainer: Questionnaire = {
631
631
  }
632
632
  ]
633
633
  };
634
+
635
+ export const qItemControlGroupPage: Questionnaire = {
636
+ resourceType: 'Questionnaire',
637
+ id: 'ItemControlGroupPage',
638
+ name: 'ItemControlGroupPage',
639
+ title: 'Item Control Group Page',
640
+ version: '0.1.0',
641
+ status: 'draft',
642
+ publisher: 'AEHRC CSIRO',
643
+ date: '2024-07-24',
644
+ url: 'https://smartforms.csiro.au/docs/advanced/control/item-control-group-page',
645
+ item: [
646
+ {
647
+ linkId: '1',
648
+ text: 'Page 1',
649
+ type: 'group',
650
+ extension: [
651
+ {
652
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
653
+ valueCodeableConcept: {
654
+ coding: [
655
+ {
656
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
657
+ code: 'page',
658
+ display: 'Page'
659
+ }
660
+ ],
661
+ text: 'Page'
662
+ }
663
+ }
664
+ ],
665
+ item: [
666
+ {
667
+ linkId: '1.1',
668
+ text: 'ANC ID',
669
+ type: 'string',
670
+ required: true,
671
+ maxLength: 8,
672
+ extension: [
673
+ {
674
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-instruction',
675
+ valueString: 'Unique ANC ID'
676
+ }
677
+ ]
678
+ },
679
+ {
680
+ linkId: '1.2',
681
+ text: 'First name',
682
+ type: 'string',
683
+ required: true,
684
+ maxLength: 30,
685
+ extension: [
686
+ {
687
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-instruction',
688
+ valueString: 'Given name'
689
+ }
690
+ ]
691
+ },
692
+ {
693
+ linkId: '1.3',
694
+ text: 'Last name',
695
+ type: 'string',
696
+ required: true,
697
+ maxLength: 50,
698
+ extension: [
699
+ {
700
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-instruction',
701
+ valueString: 'Family name'
702
+ }
703
+ ]
704
+ }
705
+ ]
706
+ },
707
+ {
708
+ linkId: '2',
709
+ text: 'Page 2',
710
+ type: 'group',
711
+ extension: [
712
+ {
713
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
714
+ valueCodeableConcept: {
715
+ coding: [
716
+ {
717
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
718
+ code: 'page',
719
+ display: 'Page'
720
+ }
721
+ ],
722
+ text: 'Page'
723
+ }
724
+ }
725
+ ],
726
+ item: [
727
+ {
728
+ linkId: '2.1',
729
+ text: 'Mobile number',
730
+ type: 'integer',
731
+ maxLength: 8,
732
+ required: true,
733
+ extension: [
734
+ {
735
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-instruction',
736
+ valueString: 'Mobile phone number'
737
+ },
738
+ {
739
+ url: 'http://hl7.org/fhir/StructureDefinition/maxValue',
740
+ valueInteger: 200000
741
+ },
742
+ {
743
+ url: 'http://hl7.org/fhir/StructureDefinition/minValue',
744
+ valueInteger: 10
745
+ }
746
+ ]
747
+ },
748
+ {
749
+ linkId: '2.2',
750
+ text: 'Receive SMS Notifications?',
751
+ type: 'boolean',
752
+ required: true
753
+ }
754
+ ]
755
+ }
756
+ ]
757
+ };
758
+
759
+ export const qItemControlGroupPageContainer: Questionnaire = {
760
+ resourceType: 'Questionnaire',
761
+ id: 'ItemControlGroupPage',
762
+ name: 'ItemControlGroupPage',
763
+ title: 'Item Control Group Page',
764
+ version: '0.1.0',
765
+ status: 'draft',
766
+ publisher: 'AEHRC CSIRO',
767
+ date: '2024-07-24',
768
+ url: 'https://smartforms.csiro.au/docs/advanced/control/item-control-group-page',
769
+ item: [
770
+ {
771
+ extension: [
772
+ {
773
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
774
+ valueCodeableConcept: {
775
+ coding: [
776
+ {
777
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
778
+ version: '1.0.0',
779
+ code: 'page'
780
+ }
781
+ ]
782
+ }
783
+ }
784
+ ],
785
+ linkId: 'page-container',
786
+ type: 'group',
787
+ repeats: false,
788
+ item: [
789
+ {
790
+ linkId: 'page-about-health-check',
791
+ text: 'About the health check',
792
+ type: 'group',
793
+ repeats: false,
794
+ item: [
795
+ {
796
+ linkId: 'health-check-eligible',
797
+ text: 'Eligible for health check',
798
+ type: 'boolean',
799
+ repeats: false
800
+ },
801
+ {
802
+ linkId: 'health-check-in-progress',
803
+ text: 'Health check already in progress?',
804
+ type: 'boolean',
805
+ repeats: false
806
+ },
807
+ {
808
+ linkId: 'health-check-last-completed',
809
+ text: 'Date of last completed health check',
810
+ type: 'date',
811
+ repeats: false
812
+ },
813
+ {
814
+ linkId: 'health-check-this-commenced',
815
+ text: 'Date and time this health check commenced',
816
+ type: 'dateTime',
817
+ repeats: false
818
+ }
819
+ ]
820
+ },
821
+ {
822
+ extension: [
823
+ {
824
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-shortText',
825
+ valueString: 'Current priorities'
826
+ }
827
+ ],
828
+ linkId: 'page-current-priorities',
829
+ text: 'Current health/patient priorities',
830
+ type: 'group',
831
+ repeats: false,
832
+ item: [
833
+ {
834
+ extension: [
835
+ {
836
+ url: 'http://hl7.org/fhir/StructureDefinition/entryFormat',
837
+ valueString: 'Enter details'
838
+ }
839
+ ],
840
+ linkId: 'current-priorities-important-things',
841
+ text: 'What are the important things for you in this health check today?',
842
+ type: 'text',
843
+ repeats: false
844
+ },
845
+ {
846
+ extension: [
847
+ {
848
+ url: 'http://hl7.org/fhir/StructureDefinition/entryFormat',
849
+ valueString: 'Enter details'
850
+ }
851
+ ],
852
+ linkId: 'current-priorities-worried-things',
853
+ text: 'Is there anything you are worried about?',
854
+ type: 'text',
855
+ repeats: false
856
+ }
857
+ ]
858
+ }
859
+ ]
860
+ }
861
+ ]
862
+ };
863
+
864
+ export const qItemControlGroupPageNonTopLevelPageContainer: Questionnaire = {
865
+ resourceType: 'Questionnaire',
866
+ id: 'bit-of-everything',
867
+ status: 'draft',
868
+ title: 'A bit of everything',
869
+ subjectType: ['Patient', 'Person', 'Practitioner'],
870
+ item: [
871
+ {
872
+ linkId: 'summary',
873
+ type: 'display',
874
+ text: 'This questionnaire is a bit of everything. It contains virtually every question type we might need in 80% of most surveys.'
875
+ },
876
+ {
877
+ extension: [
878
+ {
879
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
880
+ valueCodeableConcept: {
881
+ coding: [
882
+ {
883
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
884
+ version: '1.0.0',
885
+ code: 'page'
886
+ }
887
+ ]
888
+ }
889
+ }
890
+ ],
891
+ linkId: 'page-container',
892
+ type: 'group',
893
+ repeats: false,
894
+ item: [
895
+ {
896
+ linkId: 'group-basic1',
897
+ type: 'group',
898
+ text: 'A group of basic questions 1',
899
+ item: [
900
+ {
901
+ linkId: 'radio-choice1',
902
+ type: 'choice',
903
+ text: 'A question with radio button choices',
904
+ answerValueSet: 'http://hl7.org/fhir/ValueSet/yesnodontknow',
905
+ extension: [
906
+ {
907
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
908
+ valueCodeableConcept: {
909
+ coding: [
910
+ {
911
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
912
+ code: 'radio-button'
913
+ }
914
+ ]
915
+ }
916
+ },
917
+ {
918
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation',
919
+ valueCode: 'vertical'
920
+ }
921
+ ]
922
+ },
923
+ {
924
+ linkId: 'dropdown-choice1',
925
+ type: 'choice',
926
+ text: 'A question with dropdown choices',
927
+ answerValueSet: 'http://hl7.org/fhir/ValueSet/yesnodontknow',
928
+ extension: [
929
+ {
930
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
931
+ valueCodeableConcept: {
932
+ coding: [
933
+ {
934
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
935
+ code: 'drop-down'
936
+ }
937
+ ]
938
+ }
939
+ }
940
+ ]
941
+ },
942
+ {
943
+ linkId: 'checkbox-choice1',
944
+ type: 'choice',
945
+ text: 'A question with checkbox choices',
946
+ answerValueSet: 'http://hl7.org/fhir/ValueSet/yesnodontknow',
947
+ repeats: true,
948
+ extension: [
949
+ {
950
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
951
+ valueCodeableConcept: {
952
+ coding: [
953
+ {
954
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
955
+ code: 'check-box'
956
+ }
957
+ ]
958
+ }
959
+ },
960
+ {
961
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation',
962
+ valueCode: 'vertical'
963
+ }
964
+ ]
965
+ }
966
+ ]
967
+ },
968
+ {
969
+ linkId: 'group-basic2',
970
+ type: 'group',
971
+ text: 'A group of basic questions 2',
972
+ item: [
973
+ {
974
+ linkId: 'radio-choice2',
975
+ type: 'choice',
976
+ text: 'A question with radio button choices',
977
+ answerValueSet: 'http://hl7.org/fhir/ValueSet/yesnodontknow',
978
+ extension: [
979
+ {
980
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
981
+ valueCodeableConcept: {
982
+ coding: [
983
+ {
984
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
985
+ code: 'radio-button'
986
+ }
987
+ ]
988
+ }
989
+ },
990
+ {
991
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation',
992
+ valueCode: 'vertical'
993
+ }
994
+ ]
995
+ },
996
+ {
997
+ linkId: 'dropdown-choice2',
998
+ type: 'choice',
999
+ text: 'A question with dropdown choices',
1000
+ answerValueSet: 'http://hl7.org/fhir/ValueSet/yesnodontknow',
1001
+ extension: [
1002
+ {
1003
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
1004
+ valueCodeableConcept: {
1005
+ coding: [
1006
+ {
1007
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
1008
+ code: 'drop-down'
1009
+ }
1010
+ ]
1011
+ }
1012
+ }
1013
+ ]
1014
+ },
1015
+ {
1016
+ linkId: 'checkbox-choice2',
1017
+ type: 'choice',
1018
+ text: 'A question with checkbox choices',
1019
+ answerValueSet: 'http://hl7.org/fhir/ValueSet/yesnodontknow',
1020
+ repeats: true,
1021
+ extension: [
1022
+ {
1023
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
1024
+ valueCodeableConcept: {
1025
+ coding: [
1026
+ {
1027
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
1028
+ code: 'check-box'
1029
+ }
1030
+ ]
1031
+ }
1032
+ },
1033
+ {
1034
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation',
1035
+ valueCode: 'vertical'
1036
+ }
1037
+ ]
1038
+ }
1039
+ ]
1040
+ }
1041
+ ]
1042
+ },
1043
+ {
1044
+ linkId: 'group-conditional',
1045
+ type: 'group',
1046
+ text: 'A group of conditional logic workflow',
1047
+ item: [
1048
+ {
1049
+ linkId: 'condition',
1050
+ text: 'Try to insert a positive/negative number',
1051
+ type: 'decimal',
1052
+ initial: [
1053
+ {
1054
+ valueInteger: 0
1055
+ }
1056
+ ],
1057
+ extension: [
1058
+ {
1059
+ url: 'http://hl7.org/fhir/StructureDefinition/minValue',
1060
+ valueInteger: -10
1061
+ },
1062
+ {
1063
+ url: 'http://hl7.org/fhir/StructureDefinition/maxValue',
1064
+ valueInteger: 10
1065
+ }
1066
+ ]
1067
+ },
1068
+ {
1069
+ linkId: 'conditional-gt5',
1070
+ type: 'display',
1071
+ text: 'An item that appears when the slider entry > 0',
1072
+ enableWhen: [
1073
+ {
1074
+ question: 'condition',
1075
+ operator: '>',
1076
+ answerDecimal: 0
1077
+ }
1078
+ ]
1079
+ },
1080
+ {
1081
+ linkId: 'conditional-lt5',
1082
+ type: 'display',
1083
+ text: 'An item that appears when the slider entry < 0',
1084
+ enableWhen: [
1085
+ {
1086
+ question: 'condition',
1087
+ operator: '<',
1088
+ answerDecimal: 0
1089
+ }
1090
+ ]
1091
+ }
1092
+ ]
1093
+ },
1094
+ {
1095
+ linkId: 'autofill',
1096
+ type: 'group',
1097
+ text: 'A group of questions with autofill options',
1098
+ item: [
1099
+ {
1100
+ linkId: 'diagnosis',
1101
+ text: 'Diagnosis',
1102
+ type: 'open-choice',
1103
+ repeats: true,
1104
+ answerValueSet: 'https://clinicaltables.nlm.nih.gov/fhir/R4/ValueSet/icd10cm',
1105
+ extension: [
1106
+ {
1107
+ url: 'http://hl7.org/fhir/StructureDefinition/terminology-server',
1108
+ valueUrl: 'https://clinicaltables.nlm.nih.gov/fhir/R4'
1109
+ },
1110
+ {
1111
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
1112
+ valueCodeableConcept: {
1113
+ coding: [
1114
+ {
1115
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
1116
+ code: 'autocomplete'
1117
+ }
1118
+ ]
1119
+ }
1120
+ }
1121
+ ]
1122
+ },
1123
+ {
1124
+ linkId: 'medications_table',
1125
+ text: 'Medications',
1126
+ type: 'group',
1127
+ repeats: true,
1128
+ extension: [
1129
+ {
1130
+ url: 'http://hl7.org/fhir/StructureDefinition/terminology-server',
1131
+ valueUrl: 'https://clinicaltables.nlm.nih.gov/fhir/R4'
1132
+ },
1133
+ {
1134
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
1135
+ valueCodeableConcept: {
1136
+ coding: [
1137
+ {
1138
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
1139
+ code: 'gtable'
1140
+ }
1141
+ ]
1142
+ }
1143
+ },
1144
+ {
1145
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
1146
+ valueExpression: {
1147
+ name: 'strengthFormLookup',
1148
+ language: 'application/x-fhir-query',
1149
+ expression:
1150
+ "https://clinicaltables.nlm.nih.gov/fhir/R4/CodeSystem/$lookup?system=https://clinicaltables.nlm.nih.gov/fhir/CodeSystem/rxterms&code={{item.where(linkId='medication').answer.valueCoding.code}}&property=STRENGTHS_AND_FORMS"
1151
+ }
1152
+ }
1153
+ ],
1154
+ item: [
1155
+ {
1156
+ linkId: 'medication',
1157
+ text: 'Medication Name',
1158
+ type: 'choice',
1159
+ answerValueSet: 'https://clinicaltables.nlm.nih.gov/fhir/R4/ValueSet/rxterms',
1160
+ extension: [
1161
+ {
1162
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
1163
+ valueCodeableConcept: {
1164
+ coding: [
1165
+ {
1166
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
1167
+ code: 'autocomplete',
1168
+ display: 'Auto-complete'
1169
+ }
1170
+ ],
1171
+ text: 'Auto-complete'
1172
+ }
1173
+ }
1174
+ ]
1175
+ },
1176
+ {
1177
+ linkId: 'strength',
1178
+ text: 'Strength',
1179
+ type: 'open-choice',
1180
+ extension: [
1181
+ {
1182
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerExpression',
1183
+ valueExpression: {
1184
+ language: 'text/fhirpath',
1185
+ expression:
1186
+ "%strengthFormLookup.parameter.where(name='property' and part.where(name='code' and value='STRENGTHS_AND_FORMS').exists()).part.where(name='value').value"
1187
+ }
1188
+ }
1189
+ ]
1190
+ }
1191
+ ]
1192
+ }
1193
+ ]
1194
+ },
1195
+ {
1196
+ linkId: 'scoring',
1197
+ type: 'group',
1198
+ text: 'A group of questions with automatic scoring',
1199
+ item: [
1200
+ {
1201
+ linkId: 'question-table',
1202
+ text: 'A table with questions in its rows and choices in its columns',
1203
+ type: 'group',
1204
+ item: [
1205
+ {
1206
+ linkId: 'question-1',
1207
+ type: 'choice',
1208
+ text: 'What is it?',
1209
+ answerOption: [
1210
+ {
1211
+ valueCoding: {
1212
+ code: '0',
1213
+ display: 'This'
1214
+ }
1215
+ },
1216
+ {
1217
+ valueCoding: {
1218
+ code: '1',
1219
+ display: 'That'
1220
+ }
1221
+ }
1222
+ ]
1223
+ },
1224
+ {
1225
+ linkId: 'question-2',
1226
+ type: 'choice',
1227
+ text: 'What is it again?',
1228
+ answerOption: [
1229
+ {
1230
+ valueCoding: {
1231
+ code: '0',
1232
+ display: 'This'
1233
+ }
1234
+ },
1235
+ {
1236
+ valueCoding: {
1237
+ code: '1',
1238
+ display: 'That'
1239
+ }
1240
+ }
1241
+ ]
1242
+ }
1243
+ ],
1244
+ extension: [
1245
+ {
1246
+ url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl',
1247
+ valueCodeableConcept: {
1248
+ coding: [
1249
+ {
1250
+ system: 'http://hl7.org/fhir/questionnaire-item-control',
1251
+ code: 'table'
1252
+ }
1253
+ ]
1254
+ }
1255
+ }
1256
+ ]
1257
+ },
1258
+ {
1259
+ linkId: 'scored-items',
1260
+ type: 'decimal',
1261
+ text: 'Score',
1262
+ extension: [
1263
+ {
1264
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
1265
+ valueExpression: {
1266
+ name: 'answer1',
1267
+ language: 'text/fhirpath',
1268
+ expression:
1269
+ "%resource.item.where(linkId='scoring').item.where(linkId='question-table').item.where(linkId='question-1').answer.valueCoding.code.toDecimal()"
1270
+ }
1271
+ },
1272
+ {
1273
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
1274
+ valueExpression: {
1275
+ name: 'answer2',
1276
+ language: 'text/fhirpath',
1277
+ expression:
1278
+ "%resource.item.where(linkId='scoring').item.where(linkId='question-table').item.where(linkId='question-2').answer.valueCoding.code.toDecimal()"
1279
+ }
1280
+ },
1281
+ {
1282
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression',
1283
+ valueExpression: {
1284
+ language: 'text/fhirpath',
1285
+ expression: '%answer1 + %answer2'
1286
+ }
1287
+ }
1288
+ ],
1289
+ enableWhen: [
1290
+ {
1291
+ question: 'question-1',
1292
+ operator: 'exists',
1293
+ answerBoolean: true
1294
+ },
1295
+ {
1296
+ question: 'question-2',
1297
+ operator: 'exists',
1298
+ answerBoolean: true
1299
+ }
1300
+ ],
1301
+ enableBehavior: 'all'
1302
+ }
1303
+ ]
1304
+ }
1305
+ ]
1306
+ };