@aehrc/smart-forms-renderer 0.36.1 → 0.38.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 (164) 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/{hooks/useQueryClient.js → components/FormComponents/GroupItem/NextPageButton.js} +9 -12
  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/FormComponents/QuantityItem/QuantityComparatorField.d.ts +12 -0
  24. package/lib/components/FormComponents/QuantityItem/QuantityComparatorField.js +13 -0
  25. package/lib/components/FormComponents/QuantityItem/QuantityComparatorField.js.map +1 -0
  26. package/lib/components/FormComponents/QuantityItem/QuantityField.d.ts +15 -0
  27. package/lib/components/FormComponents/QuantityItem/QuantityField.js +14 -0
  28. package/lib/components/FormComponents/QuantityItem/QuantityField.js.map +1 -0
  29. package/lib/components/FormComponents/{DateTimeItem/DateTimeItem.d.ts → QuantityItem/QuantityItem.d.ts} +3 -3
  30. package/lib/components/FormComponents/QuantityItem/QuantityItem.js +144 -0
  31. package/lib/components/FormComponents/QuantityItem/QuantityItem.js.map +1 -0
  32. package/lib/components/FormComponents/QuantityItem/QuantityUnitField.d.ts +12 -0
  33. package/lib/components/FormComponents/QuantityItem/QuantityUnitField.js +10 -0
  34. package/lib/components/FormComponents/QuantityItem/QuantityUnitField.js.map +1 -0
  35. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js +2 -1
  36. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js.map +1 -1
  37. package/lib/components/Renderer/BaseRenderer.js +8 -0
  38. package/lib/components/Renderer/BaseRenderer.js.map +1 -1
  39. package/lib/components/Renderer/FormBodyPage.d.ts +9 -0
  40. package/lib/components/Renderer/FormBodyPage.js +43 -0
  41. package/lib/components/Renderer/FormBodyPage.js.map +1 -0
  42. package/lib/components/Renderer/FormTopLevelItem.js +7 -0
  43. package/lib/components/Renderer/FormTopLevelItem.js.map +1 -1
  44. package/lib/components/Renderer/FormTopLevelPage.d.ts +9 -0
  45. package/lib/components/Renderer/FormTopLevelPage.js +29 -0
  46. package/lib/components/Renderer/FormTopLevelPage.js.map +1 -0
  47. package/lib/hooks/useDecimalCalculatedExpression.d.ts +2 -2
  48. package/lib/hooks/useNextAndPreviousVisiblePages.d.ts +7 -0
  49. package/lib/hooks/useNextAndPreviousVisiblePages.js +47 -0
  50. package/lib/hooks/useNextAndPreviousVisiblePages.js.map +1 -0
  51. package/lib/hooks/useQuantityCalculatedExpression.d.ts +14 -0
  52. package/lib/hooks/useQuantityCalculatedExpression.js +105 -0
  53. package/lib/hooks/useQuantityCalculatedExpression.js.map +1 -0
  54. package/lib/hooks/useRenderingExtensions.d.ts +2 -1
  55. package/lib/hooks/useRenderingExtensions.js +3 -2
  56. package/lib/hooks/useRenderingExtensions.js.map +1 -1
  57. package/lib/hooks/useStringInput.js +1 -0
  58. package/lib/hooks/useStringInput.js.map +1 -1
  59. package/lib/interfaces/page.interface.d.ts +16 -0
  60. package/lib/interfaces/page.interface.js +2 -0
  61. package/lib/interfaces/page.interface.js.map +1 -0
  62. package/lib/interfaces/questionnaireStore.interface.d.ts +2 -0
  63. package/lib/interfaces/valueSet.interface.d.ts +15 -0
  64. package/lib/stores/questionnaireStore.d.ts +13 -0
  65. package/lib/stores/questionnaireStore.js +19 -3
  66. package/lib/stores/questionnaireStore.js.map +1 -1
  67. package/lib/utils/calculatedExpression.js +4 -1
  68. package/lib/utils/calculatedExpression.js.map +1 -1
  69. package/lib/utils/initialise.d.ts +3 -0
  70. package/lib/utils/initialise.js +6 -1
  71. package/lib/utils/initialise.js.map +1 -1
  72. package/lib/utils/itemControl.d.ts +7 -1
  73. package/lib/utils/itemControl.js +14 -0
  74. package/lib/utils/itemControl.js.map +1 -1
  75. package/lib/utils/page.d.ts +43 -0
  76. package/lib/utils/page.js +101 -0
  77. package/lib/utils/page.js.map +1 -0
  78. package/lib/utils/quantity.d.ts +4 -0
  79. package/lib/utils/quantity.js +49 -0
  80. package/lib/utils/quantity.js.map +1 -0
  81. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js +4 -0
  82. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js.map +1 -1
  83. package/lib/utils/questionnaireStoreUtils/extractPages.d.ts +3 -0
  84. package/lib/utils/questionnaireStoreUtils/extractPages.js +18 -0
  85. package/lib/utils/questionnaireStoreUtils/extractPages.js.map +1 -0
  86. package/lib/utils/valueSet.d.ts +2 -1
  87. package/lib/utils/valueSet.js +22 -0
  88. package/lib/utils/valueSet.js.map +1 -1
  89. package/package.json +4 -4
  90. package/src/components/FormComponents/Button.styles.ts +10 -0
  91. package/src/components/FormComponents/GroupItem/GroupHeading.tsx +5 -3
  92. package/src/components/FormComponents/GroupItem/GroupItem.tsx +11 -1
  93. package/src/components/FormComponents/GroupItem/GroupItemView.tsx +12 -0
  94. package/src/components/FormComponents/GroupItem/NextPageButton.tsx +37 -0
  95. package/src/components/FormComponents/GroupItem/PageButtonWrapper.tsx +78 -0
  96. package/src/components/FormComponents/GroupItem/PreviousPageButton.tsx +41 -0
  97. package/src/components/FormComponents/QuantityItem/QuantityComparatorField.tsx +40 -0
  98. package/src/components/FormComponents/QuantityItem/QuantityField.tsx +60 -0
  99. package/src/components/FormComponents/QuantityItem/QuantityItem.tsx +286 -0
  100. package/src/components/FormComponents/QuantityItem/QuantityUnitField.tsx +38 -0
  101. package/src/components/FormComponents/SingleItem/SingleItemSwitcher.tsx +2 -1
  102. package/src/components/Renderer/BaseRenderer.tsx +21 -0
  103. package/src/components/Renderer/FormBodyPage.tsx +93 -0
  104. package/src/components/Renderer/FormTopLevelItem.tsx +17 -0
  105. package/src/components/Renderer/FormTopLevelPage.tsx +70 -0
  106. package/src/hooks/useDecimalCalculatedExpression.ts +2 -2
  107. package/src/hooks/useNextAndPreviousVisiblePages.ts +69 -0
  108. package/src/hooks/useQuantityCalculatedExpression.ts +177 -0
  109. package/src/hooks/useRenderingExtensions.ts +5 -2
  110. package/src/hooks/useStringInput.ts +1 -0
  111. package/src/interfaces/page.interface.ts +13 -0
  112. package/src/interfaces/questionnaireStore.interface.ts +2 -0
  113. package/src/interfaces/valueSet.interface.ts +19 -0
  114. package/src/stores/questionnaireStore.ts +33 -2
  115. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreAllergyIntolerance.json +1 -1
  116. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreCondition.json +1 -1
  117. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreEncounter.json +137 -58
  118. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreImmunization.json +175 -0
  119. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreMedicationRequest.json +229 -0
  120. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationBP.json +359 -0
  121. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationBodyHeight.json +195 -0
  122. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationBodyWeight.json +195 -0
  123. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationHeartRate.json +195 -0
  124. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationSmokingStatus.json +174 -0
  125. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCorePatient.json +495 -0
  126. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCorePractitioner.json +139 -0
  127. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCorePractitionerRole.json +216 -0
  128. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreProcedure.json +199 -0
  129. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreRespirationRate.json +195 -0
  130. package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreWaistCircumference.json +195 -0
  131. package/src/stories/assets/questionnaires/QAuCoreTesting.ts +3342 -1
  132. package/src/stories/assets/questionnaires/QItemControlGroup.ts +673 -0
  133. package/src/stories/assets/questionnaires/QPrePopTester.ts +30 -0
  134. package/src/stories/assets/questionnaires/QQuantity.ts +283 -1
  135. package/src/stories/itemTypes/Quantity.stories.tsx +33 -1
  136. package/src/stories/sdc/ItemControlGroup.stories.tsx +22 -1
  137. package/src/stories/testing/AuCoreTester.stories.tsx +140 -1
  138. package/src/utils/calculatedExpression.ts +5 -1
  139. package/src/utils/initialise.ts +11 -0
  140. package/src/utils/itemControl.ts +19 -1
  141. package/src/utils/page.ts +134 -0
  142. package/src/utils/quantity.ts +62 -0
  143. package/src/utils/questionnaireStoreUtils/createQuestionaireModel.ts +5 -0
  144. package/src/utils/questionnaireStoreUtils/extractPages.ts +24 -0
  145. package/src/utils/valueSet.ts +32 -1
  146. package/lib/components/FormComponents/DateTimeItem/DateTimeField.d.ts +0 -12
  147. package/lib/components/FormComponents/DateTimeItem/DateTimeField.js +0 -34
  148. package/lib/components/FormComponents/DateTimeItem/DateTimeField.js.map +0 -1
  149. package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js +0 -60
  150. package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js.map +0 -1
  151. package/lib/hooks/useDisplayCalculatedExpression.d.ts +0 -3
  152. package/lib/hooks/useDisplayCalculatedExpression.js +0 -40
  153. package/lib/hooks/useDisplayCalculatedExpression.js.map +0 -1
  154. package/lib/hooks/useInitialiseRenderer.d.ts +0 -4
  155. package/lib/hooks/useInitialiseRenderer.js +0 -85
  156. package/lib/hooks/useInitialiseRenderer.js.map +0 -1
  157. package/lib/hooks/useQueryClient.d.ts +0 -3
  158. package/lib/hooks/useQueryClient.js.map +0 -1
  159. package/lib/utils/buildForm.d.ts +0 -8
  160. package/lib/utils/buildForm.js +0 -26
  161. package/lib/utils/buildForm.js.map +0 -1
  162. package/stats.html +0 -4842
  163. package/stats1.html +0 -4842
  164. package/stats3.html +0 -4842
@@ -0,0 +1,134 @@
1
+ import type { Pages } from '../interfaces/page.interface';
2
+ import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces/enableWhen.interface';
3
+ import type { QuestionnaireItem } from 'fhir/r4';
4
+ import { isSpecificItemControl } from './itemControl';
5
+ import { isHiddenByEnableWhen } from './qItem';
6
+ import { structuredDataCapture } from 'fhir-sdc-helpers';
7
+
8
+ export function getFirstVisiblePage(
9
+ pages: Pages,
10
+ enableWhenItems: EnableWhenItems,
11
+ enableWhenExpressions: EnableWhenExpressions
12
+ ) {
13
+ // Only singleEnableWhenItems are relevant for page operations
14
+ const { singleItems } = enableWhenItems;
15
+ const { singleExpressions } = enableWhenExpressions;
16
+
17
+ return Object.entries(pages)
18
+ .sort(([, pageA], [, pageB]) => pageA.pageIndex - pageB.pageIndex)
19
+ .findIndex(([pageLinkId, page]) => {
20
+ if (page.isHidden) {
21
+ return false;
22
+ }
23
+
24
+ const singleItem = singleItems[pageLinkId];
25
+ if (singleItem) {
26
+ return singleItem.isEnabled;
27
+ }
28
+
29
+ const singleExpression = singleExpressions[pageLinkId];
30
+ if (singleExpression) {
31
+ return singleExpression.isEnabled;
32
+ }
33
+
34
+ return true;
35
+ });
36
+ }
37
+
38
+ /**
39
+ * Checks if all of the items in a qItem array is a page item
40
+ * Returns true if all items is page item
41
+ * Returns false if only have one item
42
+ *
43
+ * @author Riza Nafis
44
+ */
45
+ export function everyIsPages(topLevelQItem: QuestionnaireItem[] | undefined): boolean {
46
+ if (!topLevelQItem) return false;
47
+
48
+ if (isPageContainer(topLevelQItem)) return false;
49
+
50
+ return topLevelQItem.every((i: QuestionnaireItem) => isPage(i));
51
+ }
52
+
53
+ export function isPageContainer(topLevelQItem: QuestionnaireItem[] | undefined): boolean {
54
+ const anyPage = topLevelQItem?.filter(isPage);
55
+
56
+ if (!anyPage) return false;
57
+
58
+ return anyPage.some((page) => page.item?.every((i) => i.type === 'group') || false);
59
+ }
60
+
61
+ /**
62
+ * Checks if any of the items in a qItem array is a page item
63
+ * Returns true if there is at least one page item
64
+ *
65
+ * @author Riza Nafis
66
+ */
67
+ export function containsPages(topLevelQItem: QuestionnaireItem): boolean {
68
+ if (!topLevelQItem.item) {
69
+ return false;
70
+ }
71
+
72
+ const pages = topLevelQItem.item.filter((i) => isPage(i));
73
+ return pages.length > 0;
74
+ }
75
+
76
+ /**
77
+ * Check if a qItem is a page item
78
+ *
79
+ * @author Riza Nafis
80
+ */
81
+ export function isPage(item: QuestionnaireItem) {
82
+ return isSpecificItemControl(item, 'page');
83
+ }
84
+
85
+ /**
86
+ * Create a `Record<linkId, Pages>` key-value pair for all page items in a qItem array
87
+ *
88
+ * @author Riza Nafis
89
+ */
90
+ export function constructPagesWithProperties(
91
+ qItems: QuestionnaireItem[] | undefined,
92
+ hasPageContainer: boolean
93
+ ): Pages {
94
+ if (!qItems) return {};
95
+
96
+ const qItemPages = hasPageContainer ? qItems : qItems.filter(isPage);
97
+
98
+ const pages: Pages = {};
99
+ for (const [i, qItem] of qItemPages.entries()) {
100
+ pages[qItem.linkId] = {
101
+ pageIndex: i,
102
+ isComplete: false,
103
+ isHidden: structuredDataCapture.getHidden(qItem) ?? false
104
+ };
105
+ }
106
+ return pages;
107
+ }
108
+
109
+ interface contructPagesWithVisibilityParams {
110
+ pages: Pages;
111
+ enableWhenIsActivated: boolean;
112
+ enableWhenItems: EnableWhenItems;
113
+ enableWhenExpressions: EnableWhenExpressions;
114
+ }
115
+
116
+ export function constructPagesWithVisibility(
117
+ params: contructPagesWithVisibilityParams
118
+ ): { linkId: string; isVisible: boolean }[] {
119
+ const { pages, enableWhenIsActivated, enableWhenItems, enableWhenExpressions } = params;
120
+
121
+ return Object.entries(pages).map(([linkId]) => {
122
+ const isVisible = !isHiddenByEnableWhen({
123
+ linkId,
124
+ enableWhenIsActivated,
125
+ enableWhenItems,
126
+ enableWhenExpressions
127
+ });
128
+
129
+ return {
130
+ linkId,
131
+ isVisible
132
+ };
133
+ });
134
+ }
@@ -0,0 +1,62 @@
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 {
19
+ Quantity,
20
+ QuestionnaireItemAnswerOption,
21
+ QuestionnaireResponseItemAnswer
22
+ } from 'fhir/r4';
23
+ import { parseDecimalStringToFloat } from './parseInputs';
24
+
25
+ export const quantityComparators: Quantity['comparator'][] = ['<', '<=', '>=', '>'];
26
+
27
+ export function stringIsComparator(str: string | undefined): str is Quantity['comparator'] {
28
+ return str === '<' || str === '<=' || str === '>=' || str === '>';
29
+ }
30
+
31
+ export function createQuantityItemAnswer(
32
+ precision: number | null,
33
+ parsedNewInput: string,
34
+ comparatorInput: Quantity['comparator'] | null,
35
+ unitInput: QuestionnaireItemAnswerOption | null
36
+ ): QuestionnaireResponseItemAnswer[] {
37
+ if (precision) {
38
+ return [
39
+ {
40
+ valueQuantity: {
41
+ value: parseDecimalStringToFloat(parsedNewInput, precision),
42
+ comparator: comparatorInput ?? undefined,
43
+ unit: unitInput?.valueCoding?.display,
44
+ system: unitInput?.valueCoding?.system,
45
+ code: unitInput?.valueCoding?.code
46
+ }
47
+ }
48
+ ];
49
+ }
50
+
51
+ return [
52
+ {
53
+ valueQuantity: {
54
+ value: parseFloat(parsedNewInput),
55
+ comparator: comparatorInput ?? undefined,
56
+ unit: unitInput?.valueCoding?.display,
57
+ system: unitInput?.valueCoding?.system,
58
+ code: unitInput?.valueCoding?.code
59
+ }
60
+ }
61
+ ];
62
+ }
@@ -17,11 +17,13 @@
17
17
 
18
18
  import type { Questionnaire } from 'fhir/r4';
19
19
  import type { Tabs } from '../../interfaces/tab.interface';
20
+ import type { Pages } from '../../interfaces/page.interface';
20
21
  import type { LaunchContext } from '../../interfaces/populate.interface';
21
22
  import type { QuestionnaireModel } from '../../interfaces/questionnaireStore.interface';
22
23
  import { extractLaunchContexts } from './extractLaunchContext';
23
24
  import { extractQuestionnaireLevelVariables } from './extractVariables';
24
25
  import { extractTabs } from './extractTabs';
26
+ import { extractPages } from './extractPages';
25
27
  import { extractContainedValueSets } from './extractContainedValueSets';
26
28
  import { extractOtherExtensions } from './extractOtherExtensions';
27
29
  import type { Variables } from '../../interfaces/variables.interface';
@@ -41,6 +43,7 @@ export async function createQuestionnaireModel(
41
43
 
42
44
  const itemTypes: Record<string, string> = Object.fromEntries(getLinkIdTypeTuples(questionnaire));
43
45
  const tabs: Tabs = extractTabs(questionnaire);
46
+ const pages: Pages = extractPages(questionnaire);
44
47
 
45
48
  const launchContexts: Record<string, LaunchContext> = extractLaunchContexts(questionnaire);
46
49
 
@@ -98,6 +101,7 @@ export async function createQuestionnaireModel(
98
101
  return {
99
102
  itemTypes,
100
103
  tabs,
104
+ pages,
101
105
  variables,
102
106
  launchContexts,
103
107
  enableWhenItems,
@@ -116,6 +120,7 @@ function createEmptyModel(): QuestionnaireModel {
116
120
  return {
117
121
  itemTypes: {},
118
122
  tabs: {},
123
+ pages: {},
119
124
  variables: { fhirPathVariables: {}, xFhirQueryVariables: {} },
120
125
  launchContexts: {},
121
126
  calculatedExpressions: {},
@@ -0,0 +1,24 @@
1
+ import type { Questionnaire } from 'fhir/r4';
2
+ import type { Pages } from '../../interfaces/page.interface';
3
+ import { constructPagesWithProperties, isPage, isPageContainer } from '../page';
4
+
5
+ export function extractPages(questionnaire: Questionnaire): Pages {
6
+ if (!questionnaire.item || questionnaire.item.length === 0) {
7
+ return {};
8
+ }
9
+
10
+ if (!isPageContainer(questionnaire.item)) {
11
+ return constructPagesWithProperties(questionnaire.item, false);
12
+ }
13
+
14
+ let totalPages = {};
15
+ for (const topLevelItem of questionnaire.item) {
16
+ const items = topLevelItem.item;
17
+ const topLevelItemIsPageContainer = isPage(topLevelItem);
18
+
19
+ const pages = constructPagesWithProperties(items, topLevelItemIsPageContainer);
20
+ totalPages = { ...totalPages, ...pages };
21
+ }
22
+
23
+ return totalPages;
24
+ }
@@ -29,7 +29,7 @@ import type {
29
29
  import * as FHIR from 'fhirclient';
30
30
  import type { FhirResourceString } from '../interfaces/populate.interface';
31
31
  import type { VariableXFhirQuery } from '../interfaces/variables.interface';
32
- import type { ValueSetPromise } from '../interfaces/valueSet.interface';
32
+ import type { ValidateCodeResponse, ValueSetPromise } from '../interfaces/valueSet.interface';
33
33
 
34
34
  const VALID_VALUE_SET_URL_REGEX =
35
35
  /https?:\/\/(www\.)?[-\w@:%.+~#=]{2,256}\.[a-z]{2,4}\b([-@\w:%+.~#?&/=]*ValueSet[-@\w:%+.~#?&/=]*)/;
@@ -65,6 +65,37 @@ export function getValueSetPromise(url: string, terminologyServerUrl: string): P
65
65
  });
66
66
  }
67
67
 
68
+ function validateCodeResponseIsValid(response: any): response is ValidateCodeResponse {
69
+ return (
70
+ response &&
71
+ response.resourceType === 'Parameters' &&
72
+ response.parameter &&
73
+ response.parameter.find((p: any) => p.name === 'code') &&
74
+ response.parameter.find((p: any) => p.name === 'code').valueCode &&
75
+ response.parameter.find((p: any) => p.name === 'system') &&
76
+ response.parameter.find((p: any) => p.name === 'system').valueUri &&
77
+ response.parameter.find((p: any) => p.name === 'display') &&
78
+ response.parameter.find((p: any) => p.name === 'display').valueString
79
+ );
80
+ }
81
+
82
+ export async function validateCodePromise(
83
+ url: string,
84
+ system: string,
85
+ code: string,
86
+ terminologyServerUrl: string
87
+ ): Promise<ValidateCodeResponse | null> {
88
+ const validateCodeResponse = await FHIR.client({ serverUrl: terminologyServerUrl }).request({
89
+ url: `ValueSet/$validate-code?url=${url}&system=${system}&code=${code}`
90
+ });
91
+
92
+ if (validateCodeResponse && validateCodeResponseIsValid(validateCodeResponse)) {
93
+ return validateCodeResponse;
94
+ }
95
+
96
+ return null;
97
+ }
98
+
68
99
  async function addTimeoutToPromise(promise: Promise<any>, timeoutMs: number) {
69
100
  const timeoutPromise = new Promise((_, reject) => {
70
101
  setTimeout(() => {
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { PropsWithIsTabledAttribute } from '../../../interfaces/renderProps.interface';
3
- import type { Dayjs } from 'dayjs';
4
- interface DateTimeFieldProps extends PropsWithIsTabledAttribute {
5
- value: Dayjs | null;
6
- displayPrompt: string;
7
- entryFormat: string;
8
- readOnly: boolean;
9
- onDateTimeChange: (newValue: Dayjs | null) => unknown;
10
- }
11
- declare function DateTimeField(props: DateTimeFieldProps): React.JSX.Element;
12
- export default DateTimeField;
@@ -1,34 +0,0 @@
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
- import React from 'react';
18
- import { DateTimePicker as MuiDateTimePicker, LocalizationProvider } from '@mui/x-date-pickers';
19
- import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
20
- import Box from '@mui/material/Box';
21
- import { TEXT_FIELD_WIDTH } from '../Textfield.styles';
22
- function DateTimeField(props) {
23
- const { value, displayPrompt, entryFormat, readOnly, isTabled, onDateTimeChange } = props;
24
- return (React.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs },
25
- React.createElement(Box, { "data-test": "q-item-date-time-field" },
26
- React.createElement(MuiDateTimePicker, { format: entryFormat !== '' ? entryFormat : 'DD/MM/YYYY hh:mm A', value: value, disabled: readOnly, label: displayPrompt, sx: { maxWidth: !isTabled ? TEXT_FIELD_WIDTH : 3000, minWidth: 160 }, onChange: onDateTimeChange, slotProps: {
27
- textField: {
28
- size: 'small',
29
- fullWidth: true
30
- }
31
- } }))));
32
- }
33
- export default DateTimeField;
34
- //# sourceMappingURL=DateTimeField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DateTimeField.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/DateTimeItem/DateTimeField.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAUvD,SAAS,aAAa,CAAC,KAAyB;IAC9C,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IAE1F,OAAO,CACL,oBAAC,oBAAoB,IAAC,WAAW,EAAE,YAAY;QAC7C,oBAAC,GAAG,iBAAW,wBAAwB;YACrC,oBAAC,iBAAiB,IAChB,MAAM,EAAE,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,oBAAoB,EAC/D,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,aAAa,EACpB,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,EACpE,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE;oBACT,SAAS,EAAE;wBACT,IAAI,EAAE,OAAO;wBACb,SAAS,EAAE,IAAI;qBAChB;iBACF,GACD,CACE,CACe,CACxB,CAAC;AACJ,CAAC;AAED,eAAe,aAAa,CAAC"}
@@ -1,60 +0,0 @@
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
- import React from 'react';
18
- import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
19
- import { createEmptyQrItem } from '../../../utils/qrItem';
20
- import { FullWidthFormComponentBox } from '../../Box.styles';
21
- import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
22
- import DateTimeField from './DateTimeField';
23
- import dayjs from 'dayjs';
24
- import useReadOnly from '../../../hooks/useReadOnly';
25
- import { useQuestionnaireStore } from '../../../stores';
26
- function DateTimeItem(props) {
27
- const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
28
- const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
29
- const readOnly = useReadOnly(qItem, parentIsReadOnly);
30
- const { displayPrompt, entryFormat } = useRenderingExtensions(qItem);
31
- // Init input value
32
- let dateTimeString = null;
33
- if (qrItem === null || qrItem === void 0 ? void 0 : qrItem.answer) {
34
- if (qrItem === null || qrItem === void 0 ? void 0 : qrItem.answer[0].valueDate) {
35
- dateTimeString = qrItem.answer[0].valueDate;
36
- }
37
- else if (qrItem === null || qrItem === void 0 ? void 0 : qrItem.answer[0].valueDateTime) {
38
- dateTimeString = qrItem.answer[0].valueDateTime;
39
- }
40
- }
41
- const dateTimeDayJs = dateTimeString ? dayjs(dateTimeString) : null;
42
- // Event handlers
43
- function handleDateTimeChange(newValue) {
44
- const emptyQrItem = createEmptyQrItem(qItem);
45
- if (newValue) {
46
- onQrItemChange(Object.assign(Object.assign({}, emptyQrItem), { answer: [{ valueDateTime: newValue.format() }] }));
47
- }
48
- else {
49
- onQrItemChange(emptyQrItem);
50
- }
51
- }
52
- if (isRepeated) {
53
- return (React.createElement(DateTimeField, { value: dateTimeDayJs, displayPrompt: displayPrompt, entryFormat: entryFormat, readOnly: readOnly, onDateTimeChange: handleDateTimeChange, isTabled: isTabled }));
54
- }
55
- return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-date-time-box", "data-linkid": qItem.linkId, onClick: () => onFocusLinkId(qItem.linkId) },
56
- React.createElement(ItemFieldGrid, { qItem: qItem, readOnly: readOnly },
57
- React.createElement(DateTimeField, { value: dateTimeDayJs, displayPrompt: displayPrompt, entryFormat: entryFormat, readOnly: readOnly, onDateTimeChange: handleDateTimeChange, isTabled: isTabled }))));
58
- }
59
- export default DateTimeItem;
60
- //# sourceMappingURL=DateTimeItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DateTimeItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/DateTimeItem/DateTimeItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAWxD,SAAS,YAAY,CAAC,KAAwB;IAC5C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAExF,MAAM,aAAa,GAAG,qBAAqB,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;IAEhE,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;IACtD,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAErE,mBAAmB;IACnB,IAAI,cAAc,GAAkB,IAAI,CAAC;IACzC,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE;QAClB,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE;YAC/B,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SAC7C;aAAM,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAC,CAAC,EAAE,aAAa,EAAE;YAC1C,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;SACjD;KACF;IACD,MAAM,aAAa,GAAG,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEpE,iBAAiB;IACjB,SAAS,oBAAoB,CAAC,QAAsB;QAClD,MAAM,WAAW,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,QAAQ,EAAE;YACZ,cAAc,iCAAM,WAAW,KAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,IAAG,CAAC;SACpF;aAAM;YACL,cAAc,CAAC,WAAW,CAAC,CAAC;SAC7B;IACH,CAAC;IAED,IAAI,UAAU,EAAE;QACd,OAAO,CACL,oBAAC,aAAa,IACZ,KAAK,EAAE,aAAa,EACpB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,oBAAoB,EACtC,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;KACH;IAED,OAAO,CACL,oBAAC,yBAAyB,iBACd,sBAAsB,iBACnB,KAAK,CAAC,MAAM,EACzB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;QAC1C,oBAAC,aAAa,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ;YAC7C,oBAAC,aAAa,IACZ,KAAK,EAAE,aAAa,EACpB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,oBAAoB,EACtC,QAAQ,EAAE,QAAQ,GAClB,CACY,CACU,CAC7B,CAAC;AACJ,CAAC;AAED,eAAe,YAAY,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { QuestionnaireItem } from 'fhir/r4';
2
- declare function useDisplayCalculatedExpression(qItem: QuestionnaireItem): string | null;
3
- export default useDisplayCalculatedExpression;
@@ -1,40 +0,0 @@
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
- import { useQuestionnaireStore } from '../stores';
18
- function useDisplayCalculatedExpression(qItem) {
19
- var _a;
20
- const calculatedExpressions = useQuestionnaireStore.use.calculatedExpressions();
21
- const calcExpression = (_a = calculatedExpressions[qItem.linkId]) === null || _a === void 0 ? void 0 : _a.find((exp) => exp.from === 'item._text');
22
- if (!calcExpression) {
23
- return null;
24
- }
25
- if (typeof calcExpression.value === 'string' ||
26
- typeof calcExpression.value === 'number' ||
27
- calcExpression.value === null) {
28
- // calculatedExpression value is null
29
- if (calcExpression.value === null) {
30
- return '';
31
- }
32
- // calculatedExpression value is string or number
33
- return typeof calcExpression.value === 'string'
34
- ? calcExpression.value
35
- : calcExpression.value.toString();
36
- }
37
- return null;
38
- }
39
- export default useDisplayCalculatedExpression;
40
- //# sourceMappingURL=useDisplayCalculatedExpression.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDisplayCalculatedExpression.js","sourceRoot":"","sources":["../../src/hooks/useDisplayCalculatedExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAGlD,SAAS,8BAA8B,CAAC,KAAwB;;IAC9D,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAEhF,MAAM,cAAc,GAAG,MAAA,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,0CAAE,IAAI,CAC9D,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY,CACnC,CAAC;IAEF,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,IAAI,CAAC;KACb;IAED,IACE,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ;QACxC,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ;QACxC,cAAc,CAAC,KAAK,KAAK,IAAI,EAC7B;QACA,qCAAqC;QACrC,IAAI,cAAc,CAAC,KAAK,KAAK,IAAI,EAAE;YACjC,OAAO,EAAE,CAAC;SACX;QAED,iDAAiD;QACjD,OAAO,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ;YAC7C,CAAC,CAAC,cAAc,CAAC,KAAK;YACtB,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;KACrC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,eAAe,8BAA8B,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
2
- import type Client from 'fhirclient/lib/Client';
3
- declare function useInitialiseRenderer(questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, additionalVariables?: Record<string, object>, terminologyServerUrl?: string, fhirClient?: Client, readOnly?: boolean): boolean;
4
- export default useInitialiseRenderer;
@@ -1,85 +0,0 @@
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
- import { useLayoutEffect, useState } from 'react';
18
- import { initialiseQuestionnaireResponse } from '../utils';
19
- import { readEncounter, readPatient, readUser } from '../api/smartClient';
20
- import { useQuestionnaireResponseStore, useQuestionnaireStore, useSmartConfigStore, useTerminologyServerStore } from '../stores';
21
- function useInitialiseRenderer(questionnaire, questionnaireResponse, additionalVariables, terminologyServerUrl, fhirClient, readOnly) {
22
- const buildSourceQuestionnaire = useQuestionnaireStore.use.buildSourceQuestionnaire();
23
- const updatePopulatedProperties = useQuestionnaireStore.use.updatePopulatedProperties();
24
- const buildSourceResponse = useQuestionnaireResponseStore.use.buildSourceResponse();
25
- const setUpdatableResponseAsPopulated = useQuestionnaireResponseStore.use.setUpdatableResponseAsPopulated();
26
- const setTerminologyServerUrl = useTerminologyServerStore.use.setUrl();
27
- const resetTerminologyServerUrl = useTerminologyServerStore.use.resetUrl();
28
- const setSmartClient = useSmartConfigStore.use.setClient();
29
- const setPatient = useSmartConfigStore.use.setPatient();
30
- const setUser = useSmartConfigStore.use.setUser();
31
- const setEncounter = useSmartConfigStore.use.setEncounter();
32
- const [loading, setLoading] = useState(true);
33
- useLayoutEffect(() => {
34
- setLoading(true);
35
- // set fhirClient if provided
36
- if (fhirClient) {
37
- setSmartClient(fhirClient);
38
- readPatient(fhirClient).then((patient) => {
39
- setPatient(patient);
40
- });
41
- readUser(fhirClient).then((user) => {
42
- setUser(user);
43
- });
44
- readEncounter(fhirClient).then((encounter) => {
45
- setEncounter(encounter);
46
- });
47
- }
48
- // set terminology server url if provided, otherwise reset it back to ontoserver
49
- if (terminologyServerUrl) {
50
- setTerminologyServerUrl(terminologyServerUrl);
51
- }
52
- else {
53
- resetTerminologyServerUrl();
54
- }
55
- // initialise form including enableWhen, enableWhenExpressions, calculatedExpressions, initialExpressions, answerExpressions, cache answerValueSets
56
- buildSourceQuestionnaire(questionnaire, questionnaireResponse, additionalVariables, terminologyServerUrl, readOnly).then(() => {
57
- buildSourceResponse(initialiseQuestionnaireResponse(questionnaire));
58
- if (questionnaireResponse) {
59
- const updatedResponse = updatePopulatedProperties(questionnaireResponse);
60
- setUpdatableResponseAsPopulated(updatedResponse);
61
- }
62
- setLoading(false);
63
- });
64
- }, [
65
- questionnaire,
66
- questionnaireResponse,
67
- buildSourceQuestionnaire,
68
- buildSourceResponse,
69
- setUpdatableResponseAsPopulated,
70
- updatePopulatedProperties,
71
- additionalVariables,
72
- fhirClient,
73
- setSmartClient,
74
- setPatient,
75
- setUser,
76
- setEncounter,
77
- terminologyServerUrl,
78
- setTerminologyServerUrl,
79
- resetTerminologyServerUrl,
80
- readOnly
81
- ]);
82
- return loading;
83
- }
84
- export default useInitialiseRenderer;
85
- //# sourceMappingURL=useInitialiseRenderer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useInitialiseRenderer.js","sourceRoot":"","sources":["../../src/hooks/useInitialiseRenderer.ts"],"names":[],"mappings":"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"}
@@ -1,3 +0,0 @@
1
- import { QueryClient } from '@tanstack/react-query';
2
- declare function useQueryClient(): QueryClient;
3
- export default useQueryClient;
@@ -1 +0,0 @@
1
- {"version":3,"file":"useQueryClient.js","sourceRoot":"","sources":["../../src/hooks/useQueryClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,SAAS,cAAc;IACrB,OAAO,IAAI,WAAW,CAAC;QACrB,cAAc,EAAE;YACd,OAAO,EAAE;gBACP,oBAAoB,EAAE,KAAK;gBAC3B,gBAAgB,EAAE,IAAI;aACvB;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,eAAe,cAAc,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
2
- /**
3
- * Build the form with an initial Questionnaire and an optional filled QuestionnaireResponse.
4
- * If a QuestionnaireResponse is not provided, an empty QuestionnaireResponse is set as the initial QuestionnaireResponse.
5
- *
6
- * @author Sean Fong
7
- */
8
- export declare function buildForm(questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse): Promise<void>;
@@ -1,26 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { questionnaireResponseStore, questionnaireStore } from '../stores';
11
- import { initialiseQuestionnaireResponse } from './initialise';
12
- /**
13
- * Build the form with an initial Questionnaire and an optional filled QuestionnaireResponse.
14
- * If a QuestionnaireResponse is not provided, an empty QuestionnaireResponse is set as the initial QuestionnaireResponse.
15
- *
16
- * @author Sean Fong
17
- */
18
- export function buildForm(questionnaire, questionnaireResponse) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- yield questionnaireStore.getState().buildSourceQuestionnaire(questionnaire);
21
- const initialisedQuestionnaireResponse = initialiseQuestionnaireResponse(questionnaire, questionnaireResponse);
22
- questionnaireResponseStore.getState().buildSourceResponse(initialisedQuestionnaireResponse);
23
- questionnaireStore.getState().updatePopulatedProperties(initialisedQuestionnaireResponse);
24
- });
25
- }
26
- //# sourceMappingURL=buildForm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildForm.js","sourceRoot":"","sources":["../../src/utils/buildForm.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,UAAgB,SAAS,CAC7B,aAA4B,EAC5B,qBAA6C;;QAE7C,MAAM,kBAAkB,CAAC,QAAQ,EAAE,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;QAE5E,MAAM,gCAAgC,GAAG,+BAA+B,CACtE,aAAa,EACb,qBAAqB,CACtB,CAAC;QACF,0BAA0B,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,gCAAgC,CAAC,CAAC;QAC5F,kBAAkB,CAAC,QAAQ,EAAE,CAAC,yBAAyB,CAAC,gCAAgC,CAAC,CAAC;IAC5F,CAAC;CAAA"}