@aehrc/smart-forms-renderer 1.2.14 → 1.3.1

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 (212) hide show
  1. package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.js +1 -1
  2. package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.js.map +1 -1
  3. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +1 -1
  4. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -1
  5. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js +1 -1
  6. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js.map +1 -1
  7. package/lib/components/FormComponents/GridGroup/GridRow.js +1 -1
  8. package/lib/components/FormComponents/GridGroup/GridRow.js.map +1 -1
  9. package/lib/components/FormComponents/GroupItem/GroupAccordion.d.ts +10 -0
  10. package/lib/components/FormComponents/GroupItem/GroupAccordion.js +71 -0
  11. package/lib/components/FormComponents/GroupItem/GroupAccordion.js.map +1 -0
  12. package/lib/components/FormComponents/GroupItem/GroupAccordion.styles.d.ts +1 -1
  13. package/lib/components/FormComponents/GroupItem/GroupAccordion.styles.js +1 -1
  14. package/lib/components/FormComponents/GroupItem/GroupAccordion.styles.js.map +1 -1
  15. package/lib/components/FormComponents/GroupItem/GroupItemView.js +1 -1
  16. package/lib/components/FormComponents/GroupItem/GroupItemView.js.map +1 -1
  17. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js +1 -1
  18. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js.map +1 -1
  19. package/lib/components/FormComponents/RepeatGroup/RepeatGroupView.js +1 -1
  20. package/lib/components/FormComponents/RepeatGroup/RepeatGroupView.js.map +1 -1
  21. package/lib/components/FormComponents/Tables/GroupTableView.js +1 -1
  22. package/lib/components/FormComponents/Tables/GroupTableView.js.map +1 -1
  23. package/lib/components/Renderer/FormBodySingleCollapsible.js +1 -1
  24. package/lib/components/Renderer/FormBodySingleCollapsible.js.map +1 -1
  25. package/lib/components/Renderer/FormBodyTabbed.js +57 -4
  26. package/lib/components/Renderer/FormBodyTabbed.js.map +1 -1
  27. package/lib/components/Tabs/FormBodyTabListWrapper.d.ts +1 -0
  28. package/lib/components/Tabs/FormBodyTabListWrapper.js +2 -2
  29. package/lib/components/Tabs/FormBodyTabListWrapper.js.map +1 -1
  30. package/lib/hooks/index.d.ts +1 -0
  31. package/lib/hooks/index.js +2 -0
  32. package/lib/hooks/index.js.map +1 -1
  33. package/lib/hooks/useValueSetCodings.js +2 -1
  34. package/lib/hooks/useValueSetCodings.js.map +1 -1
  35. package/lib/stores/rendererConfigStore.d.ts +7 -0
  36. package/lib/stores/rendererConfigStore.js +2 -0
  37. package/lib/stores/rendererConfigStore.js.map +1 -1
  38. package/lib/stores/smartConfigStore.d.ts +7 -1
  39. package/lib/stores/smartConfigStore.js +3 -1
  40. package/lib/stores/smartConfigStore.js.map +1 -1
  41. package/lib/utils/populateContexts.js +2 -14
  42. package/lib/utils/populateContexts.js.map +1 -1
  43. package/lib/utils/valueSet.d.ts +1 -1
  44. package/lib/utils/valueSet.js +2 -2
  45. package/lib/utils/valueSet.js.map +1 -1
  46. package/package.json +3 -3
  47. package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.tsx +1 -1
  48. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +1 -1
  49. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.tsx +1 -1
  50. package/src/components/FormComponents/GridGroup/GridRow.tsx +6 -1
  51. package/src/components/FormComponents/GroupItem/GroupAccordion.styles.ts +1 -1
  52. package/src/components/FormComponents/GroupItem/GroupAccordion.tsx +93 -0
  53. package/src/components/FormComponents/GroupItem/GroupItemView.tsx +1 -1
  54. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.tsx +1 -1
  55. package/src/components/FormComponents/RepeatGroup/RepeatGroupView.tsx +1 -1
  56. package/src/components/FormComponents/Tables/GroupTableView.tsx +1 -1
  57. package/src/components/Renderer/FormBodySingleCollapsible.tsx +2 -1
  58. package/src/components/Renderer/FormBodyTabbed.tsx +67 -5
  59. package/src/components/Tabs/FormBodyTabListWrapper.tsx +3 -2
  60. package/src/hooks/index.ts +3 -0
  61. package/src/hooks/useValueSetCodings.ts +8 -1
  62. package/src/stores/rendererConfigStore.ts +8 -0
  63. package/src/stores/smartConfigStore.ts +11 -2
  64. package/src/utils/populateContexts.ts +2 -16
  65. package/src/utils/valueSet.ts +3 -2
  66. package/lib/components/FormComponents/ItemParts/FadingCheckIcon.d.ts +0 -7
  67. package/lib/components/FormComponents/ItemParts/FadingCheckIcon.js +0 -26
  68. package/lib/components/FormComponents/ItemParts/FadingCheckIcon.js.map +0 -1
  69. package/lib/components/FormComponents/ItemParts/ItemLabelText.d.ts +0 -8
  70. package/lib/components/FormComponents/ItemParts/ItemLabelText.js +0 -63
  71. package/lib/components/FormComponents/ItemParts/ItemLabelText.js.map +0 -1
  72. package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.d.ts +0 -8
  73. package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js +0 -53
  74. package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js.map +0 -1
  75. package/lib/components/FormComponents/ItemParts/ItemTextSwitcher copy.d.ts +0 -7
  76. package/lib/components/FormComponents/ItemParts/ItemTextSwitcher copy.js +0 -39
  77. package/lib/components/FormComponents/ItemParts/ItemTextSwitcher copy.js.map +0 -1
  78. package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.d.ts +0 -10
  79. package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.js +0 -30
  80. package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.js.map +0 -1
  81. package/lib/components/Iconify/Iconify.d.ts +0 -10
  82. package/lib/components/Iconify/Iconify.js +0 -26
  83. package/lib/components/Iconify/Iconify.js.map +0 -1
  84. package/lib/components/Renderer/FormBodyPage.d.ts +0 -9
  85. package/lib/components/Renderer/FormBodyPage.js +0 -43
  86. package/lib/components/Renderer/FormBodyPage.js.map +0 -1
  87. package/lib/components/Renderer/FormTitle.d.ts +0 -7
  88. package/lib/components/Renderer/FormTitle.js +0 -30
  89. package/lib/components/Renderer/FormTitle.js.map +0 -1
  90. package/lib/components/Renderer/FormTopLevelPage.d.ts +0 -9
  91. package/lib/components/Renderer/FormTopLevelPage.js +0 -29
  92. package/lib/components/Renderer/FormTopLevelPage.js.map +0 -1
  93. package/lib/hooks/useBooleanCalculatedExpression.d.ts +0 -12
  94. package/lib/hooks/useBooleanCalculatedExpression.js +0 -52
  95. package/lib/hooks/useBooleanCalculatedExpression.js.map +0 -1
  96. package/lib/hooks/useCalculatedExpressionAnimating.d.ts +0 -1
  97. package/lib/hooks/useCalculatedExpressionAnimating.js +0 -18
  98. package/lib/hooks/useCalculatedExpressionAnimating.js.map +0 -1
  99. package/lib/hooks/useDecimalCalculatedExpression.d.ts +0 -13
  100. package/lib/hooks/useDecimalCalculatedExpression.js +0 -58
  101. package/lib/hooks/useDecimalCalculatedExpression.js.map +0 -1
  102. package/lib/hooks/useInitialiseGroupTable.d.ts +0 -4
  103. package/lib/hooks/useInitialiseGroupTable.js +0 -36
  104. package/lib/hooks/useInitialiseGroupTable.js.map +0 -1
  105. package/lib/hooks/useIntegerCalculatedExpression.d.ts +0 -12
  106. package/lib/hooks/useIntegerCalculatedExpression.js +0 -55
  107. package/lib/hooks/useIntegerCalculatedExpression.js.map +0 -1
  108. package/lib/hooks/useNumberInput.d.ts +0 -3
  109. package/lib/hooks/useNumberInput.js +0 -31
  110. package/lib/hooks/useNumberInput.js.map +0 -1
  111. package/lib/hooks/useRepeatAnswers.d.ts +0 -4
  112. package/lib/hooks/useRepeatAnswers.js +0 -34
  113. package/lib/hooks/useRepeatAnswers.js.map +0 -1
  114. package/lib/hooks/useRepeatGroups.d.ts +0 -4
  115. package/lib/hooks/useRepeatGroups.js +0 -34
  116. package/lib/hooks/useRepeatGroups.js.map +0 -1
  117. package/lib/hooks/useShowFeedback.d.ts +0 -11
  118. package/lib/hooks/useShowFeedback.js +0 -33
  119. package/lib/hooks/useShowFeedback.js.map +0 -1
  120. package/lib/hooks/useStringCalculatedExpression.d.ts +0 -14
  121. package/lib/hooks/useStringCalculatedExpression.js +0 -69
  122. package/lib/hooks/useStringCalculatedExpression.js.map +0 -1
  123. package/lib/hooks/useStringInput.d.ts +0 -3
  124. package/lib/hooks/useStringInput.js +0 -31
  125. package/lib/hooks/useStringInput.js.map +0 -1
  126. package/lib/interfaces/itemPath.interface.d.ts +0 -31
  127. package/lib/interfaces/itemPath.interface.js +0 -2
  128. package/lib/interfaces/itemPath.interface.js.map +0 -1
  129. package/lib/interfaces/repeatItem.interface.d.ts +0 -5
  130. package/lib/interfaces/repeatItem.interface.js +0 -2
  131. package/lib/interfaces/repeatItem.interface.js.map +0 -1
  132. package/lib/stores/rendererStylingStore.d.ts +0 -144
  133. package/lib/stores/rendererStylingStore.js +0 -68
  134. package/lib/stores/rendererStylingStore.js.map +0 -1
  135. package/lib/stories/storybookWrappers/InitialiseFormWrapperForStorybook.d.ts +0 -30
  136. package/lib/stories/storybookWrappers/InitialiseFormWrapperForStorybook.js +0 -46
  137. package/lib/stories/storybookWrappers/InitialiseFormWrapperForStorybook.js.map +0 -1
  138. package/lib/stories/storybookWrappers/index.d.ts +0 -2
  139. package/lib/stories/storybookWrappers/index.js +0 -18
  140. package/lib/stories/storybookWrappers/index.js.map +0 -1
  141. package/lib/stories/testUtils.d.ts +0 -23
  142. package/lib/stories/testUtils.js +0 -249
  143. package/lib/stories/testUtils.js.map +0 -1
  144. package/lib/theme/Theme.d.ts +0 -44
  145. package/lib/theme/Theme.js +0 -45
  146. package/lib/theme/Theme.js.map +0 -1
  147. package/lib/theme/customGlobalStyles.d.ts +0 -2
  148. package/lib/theme/customGlobalStyles.js +0 -61
  149. package/lib/theme/customGlobalStyles.js.map +0 -1
  150. package/lib/theme/overrides/Accordion.d.ts +0 -14
  151. package/lib/theme/overrides/Accordion.js +0 -32
  152. package/lib/theme/overrides/Accordion.js.map +0 -1
  153. package/lib/theme/overrides/Autocomplete.d.ts +0 -10
  154. package/lib/theme/overrides/Autocomplete.js +0 -28
  155. package/lib/theme/overrides/Autocomplete.js.map +0 -1
  156. package/lib/theme/overrides/Button.d.ts +0 -33
  157. package/lib/theme/overrides/Button.js +0 -52
  158. package/lib/theme/overrides/Button.js.map +0 -1
  159. package/lib/theme/overrides/Card.d.ts +0 -35
  160. package/lib/theme/overrides/Card.js +0 -49
  161. package/lib/theme/overrides/Card.js.map +0 -1
  162. package/lib/theme/overrides/Input.d.ts +0 -64
  163. package/lib/theme/overrides/Input.js +0 -81
  164. package/lib/theme/overrides/Input.js.map +0 -1
  165. package/lib/theme/overrides/Overrides.d.ts +0 -3
  166. package/lib/theme/overrides/Overrides.js +0 -29
  167. package/lib/theme/overrides/Overrides.js.map +0 -1
  168. package/lib/theme/overrides/Paper.d.ts +0 -12
  169. package/lib/theme/overrides/Paper.js +0 -31
  170. package/lib/theme/overrides/Paper.js.map +0 -1
  171. package/lib/theme/overrides/SpeedDial.d.ts +0 -16
  172. package/lib/theme/overrides/SpeedDial.js +0 -34
  173. package/lib/theme/overrides/SpeedDial.js.map +0 -1
  174. package/lib/theme/overrides/Table.d.ts +0 -12
  175. package/lib/theme/overrides/Table.js +0 -30
  176. package/lib/theme/overrides/Table.js.map +0 -1
  177. package/lib/theme/palette.d.ts +0 -27
  178. package/lib/theme/palette.js +0 -67
  179. package/lib/theme/palette.js.map +0 -1
  180. package/lib/theme/shadows.d.ts +0 -2
  181. package/lib/theme/shadows.js +0 -52
  182. package/lib/theme/shadows.js.map +0 -1
  183. package/lib/utils/answerExpression.d.ts +0 -18
  184. package/lib/utils/answerExpression.js +0 -133
  185. package/lib/utils/answerExpression.js.map +0 -1
  186. package/lib/utils/dayjsExtend.d.ts +0 -1
  187. package/lib/utils/dayjsExtend.js +0 -22
  188. package/lib/utils/dayjsExtend.js.map +0 -1
  189. package/lib/utils/dynamicValueSet.d.ts +0 -5
  190. package/lib/utils/dynamicValueSet.js +0 -96
  191. package/lib/utils/dynamicValueSet.js.map +0 -1
  192. package/lib/utils/fhirpathAsyncUtils/fhirpath-async.d.ts +0 -14
  193. package/lib/utils/fhirpathAsyncUtils/fhirpath-async.js +0 -639
  194. package/lib/utils/fhirpathAsyncUtils/fhirpath-async.js.map +0 -1
  195. package/lib/utils/fhirpathAsyncUtils/outcome-utils.d.ts +0 -3
  196. package/lib/utils/fhirpathAsyncUtils/outcome-utils.js +0 -41
  197. package/lib/utils/fhirpathAsyncUtils/outcome-utils.js.map +0 -1
  198. package/lib/utils/itemControl.d.ts +0 -97
  199. package/lib/utils/itemControl.js +0 -336
  200. package/lib/utils/itemControl.js.map +0 -1
  201. package/lib/utils/itemPath.d.ts +0 -57
  202. package/lib/utils/itemPath.js +0 -75
  203. package/lib/utils/itemPath.js.map +0 -1
  204. package/lib/utils/questionnaireStoreUtils/addAdditionalVariables.d.ts +0 -2
  205. package/lib/utils/questionnaireStoreUtils/addAdditionalVariables.js +0 -43
  206. package/lib/utils/questionnaireStoreUtils/addAdditionalVariables.js.map +0 -1
  207. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.d.ts +0 -3
  208. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js +0 -101
  209. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js.map +0 -1
  210. package/lib/utils/validateQuestionnaire.d.ts +0 -66
  211. package/lib/utils/validateQuestionnaire.js +0 -559
  212. package/lib/utils/validateQuestionnaire.js.map +0 -1
@@ -1,133 +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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- import fhirpath from 'fhirpath';
27
- import fhirpath_r4_model from 'fhirpath/fhir-context/r4';
28
- import _isEqual from 'lodash/isEqual';
29
- import cloneDeep from 'lodash.clonedeep';
30
- import { emptyResponse } from './emptyResource';
31
- import { createFhirPathContext, evaluateTerminologyLinkIdVariables } from './fhirpath';
32
- export function evaluateInitialAnswerExpressions(params) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- const { initialResponse, initialResponseItemMap, answerExpressions, variablesFhirPath, existingFhirPathContext } = params;
35
- // Return early if initialResponse is empty or there are no answer expressions to evaluate
36
- if (_isEqual(initialResponse, cloneDeep(emptyResponse)) ||
37
- Object.keys(answerExpressions).length === 0) {
38
- return {
39
- initialAnswerExpressions: answerExpressions,
40
- updatedFhirPathContext: existingFhirPathContext
41
- };
42
- }
43
- const initialAnswerExpressions = Object.assign({}, answerExpressions);
44
- let updatedFhirPathContext = yield createFhirPathContext(initialResponse, initialResponseItemMap, variablesFhirPath, existingFhirPathContext);
45
- // Perform initial evaluation of terminology variables
46
- for (const linkId in variablesFhirPath) {
47
- updatedFhirPathContext = yield evaluateTerminologyLinkIdVariables(linkId, variablesFhirPath, updatedFhirPathContext);
48
- }
49
- for (const linkId in initialAnswerExpressions) {
50
- const answerExpression = initialAnswerExpressions[linkId];
51
- try {
52
- const result = fhirpath.evaluate({}, answerExpression.expression, updatedFhirPathContext, fhirpath_r4_model);
53
- // Update calculatedExpressions if length of result array > 0
54
- // Only update when current calcExpression value is different from the result, otherwise it will result in an infinite loop as per issue #733
55
- if (result.length > 0 && !_isEqual(answerExpression.options, result)) {
56
- answerExpression.options = getAnswerOptionsFromResults(result);
57
- answerExpression.version = answerExpression.version + 1;
58
- }
59
- // Update calculatedExpression value to null if no result is returned
60
- if (result.length === 0 && !!answerExpression.options) {
61
- // Only update if current options is not empty
62
- if (answerExpression.options.length > 0) {
63
- answerExpression.options = [];
64
- answerExpression.version = answerExpression.version + 1;
65
- }
66
- }
67
- }
68
- catch (e) {
69
- console.warn(e.message, `LinkId: ${linkId}\nExpression: ${answerExpression.options}`);
70
- }
71
- initialAnswerExpressions[linkId] = answerExpression;
72
- }
73
- return {
74
- initialAnswerExpressions,
75
- updatedFhirPathContext
76
- };
77
- });
78
- }
79
- export function evaluateAnswerExpressions(fhirPathContext, answerExpressions) {
80
- const updatedAnswerExpressions = Object.assign({}, answerExpressions);
81
- let isUpdated = false;
82
- for (const linkId in answerExpressions) {
83
- const answerExpression = answerExpressions[linkId];
84
- try {
85
- const result = fhirpath.evaluate({}, answerExpression.expression, fhirPathContext, fhirpath_r4_model);
86
- // Update calculatedExpressions if length of result array > 0
87
- // Only update when current calcExpression value is different from the result, otherwise it will result in an infinite loop as per issue #733
88
- if (result.length > 0 && !_isEqual(answerExpression.options, result)) {
89
- isUpdated = true;
90
- answerExpression.options = getAnswerOptionsFromResults(result);
91
- answerExpression.version = answerExpression.version + 1;
92
- }
93
- // Update calculatedExpression value to null if no result is returned
94
- if (result.length === 0 && !!answerExpression.options) {
95
- // Only update if current options is not empty
96
- if (answerExpression.options.length > 0) {
97
- isUpdated = true;
98
- answerExpression.options = [];
99
- answerExpression.version = answerExpression.version + 1;
100
- }
101
- }
102
- }
103
- catch (e) {
104
- console.warn(e.message, `LinkId: ${linkId}\nExpression: ${answerExpression.options}`);
105
- }
106
- updatedAnswerExpressions[linkId] = answerExpression;
107
- }
108
- return {
109
- answerExpsIsUpdated: isUpdated,
110
- updatedAnswerExpressions: updatedAnswerExpressions
111
- };
112
- }
113
- function getAnswerOptionsFromResults(result) {
114
- if (!Array.isArray(result)) {
115
- return [];
116
- }
117
- return result
118
- .map((item) => {
119
- var _a;
120
- if (item.system && item.code) {
121
- return {
122
- valueCoding: {
123
- system: item.system,
124
- code: item.code,
125
- display: (_a = item.display) !== null && _a !== void 0 ? _a : undefined
126
- }
127
- };
128
- }
129
- return item;
130
- })
131
- .filter((item) => typeof item === 'object');
132
- }
133
- //# sourceMappingURL=answerExpression.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"answerExpression.js","sourceRoot":"","sources":["../../src/utils/answerExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;AAGH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AACzD,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAOtC,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,kCAAkC,EAAE,MAAM,YAAY,CAAC;AAUvF,MAAM,UAAgB,gCAAgC,CACpD,MAA8C;;QAK9C,MAAM,EACJ,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACxB,GAAG,MAAM,CAAC;QAEX,0FAA0F;QAC1F,IACE,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;YACnD,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,KAAK,CAAC,EAC3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AE,CAAC;oBAC9B,gBAAgB,CAAC,OAAO,GAAG,gBAAgB,CAAC,OAAO,GAAG,CAAC,CAAC;iBACzD;aACF;SACF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,WAAW,MAAM,iBAAiB,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;SACvF;QAED,wBAAwB,CAAC,MAAM,CAAC,GAAG,gBAAgB,CAAC;KACrD;IAED,OAAO;QACL,mBAAmB,EAAE,SAAS;QAC9B,wBAAwB,EAAE,wBAAwB;KACnD,CAAC;AACJ,CAAC;AAED,SAAS,2BAA2B,CAAC,MAAW;IAC9C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAC1B,OAAO,EAAE,CAAC;KACX;IAED,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;QACZ,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE;YAC5B,OAAO;gBACL,WAAW,EAAE;oBACX,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,OAAO,EAAE,MAAA,IAAI,CAAC,OAAO,mCAAI,SAAS;iBACnC;aACF,CAAC;SACH;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC;AAChD,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +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 dayjs from 'dayjs';
18
- import localizedFormat from 'dayjs/plugin/localizedFormat';
19
- import customParseFormat from 'dayjs/plugin/customParseFormat';
20
- dayjs.extend(localizedFormat);
21
- dayjs.extend(customParseFormat);
22
- //# sourceMappingURL=dayjsExtend.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dayjsExtend.js","sourceRoot":"","sources":["../../src/utils/dayjsExtend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,iBAAiB,MAAM,gCAAgC,CAAC;AAE/D,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;AAC9B,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { DynamicValueSet } from '../interfaces/valueSet.interface';
2
- export declare function evaluateDynamicValueSets(fhirPathContext: Record<string, any>, dynamicValueSets: Record<string, DynamicValueSet>): {
3
- dynamicValueSetsIsUpdated: boolean;
4
- updatedDynamicValueSets: Record<string, DynamicValueSet>;
5
- };
@@ -1,96 +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 fhirpath from 'fhirpath';
18
- import fhirpath_r4_model from 'fhirpath/fhir-context/r4';
19
- import cloneDeep from 'lodash.clonedeep';
20
- import _isEqual from 'lodash/isEqual';
21
- export function evaluateDynamicValueSets(fhirPathContext, dynamicValueSets) {
22
- var _a;
23
- const updatedDynamicValueSets = cloneDeep(dynamicValueSets);
24
- let isUpdated = false;
25
- for (const linkId in updatedDynamicValueSets) {
26
- const dynamicValueSet = updatedDynamicValueSets[linkId];
27
- const completeResource = dynamicValueSet.sourceResource;
28
- const valueSetComposeInclude = (_a = completeResource.compose) === null || _a === void 0 ? void 0 : _a.include;
29
- if (valueSetComposeInclude && valueSetComposeInclude.length > 0) {
30
- for (const include of valueSetComposeInclude) {
31
- if (!include.filter) {
32
- continue;
33
- }
34
- // There are filters present, check for fhirpath embeddings
35
- const fhirPathEmbeddingsMap = {};
36
- for (const filter of include.filter) {
37
- const filterValue = filter.value;
38
- if (filterValue.includes('{{') && filterValue.includes('}}')) {
39
- if (filterValue) {
40
- for (const embedding of readFhirPathEmbeddingsFromStr(filterValue)) {
41
- if (embedding) {
42
- fhirPathEmbeddingsMap[embedding] = '';
43
- }
44
- }
45
- }
46
- }
47
- }
48
- const evaluatedFhirPathEmbeddingsMap = evaluateFhirPathEmbeddings(fhirPathEmbeddingsMap, fhirPathContext);
49
- const evaluatedFhirPathEmbeddingsTuple = Object.entries(evaluatedFhirPathEmbeddingsMap).filter(([, value]) => value != '');
50
- for (const filter of include.filter) {
51
- evaluatedFhirPathEmbeddingsTuple.forEach(([embedding, value]) => {
52
- const filterValue = filter.value;
53
- const pattern = new RegExp(`{{%${embedding}}}`, 'g');
54
- filter.value = filterValue.replace(pattern, value);
55
- });
56
- }
57
- }
58
- }
59
- // Complete resource has been updated, update the dynamicValueSet object
60
- if (!_isEqual(dynamicValueSets[linkId].completeResource, completeResource)) {
61
- isUpdated = true;
62
- // If source response same as the complete resource, embeddings are not replaced, therefore ValueSet is not complete
63
- updatedDynamicValueSets[linkId] = {
64
- sourceResource: dynamicValueSets[linkId].sourceResource,
65
- completeResource: dynamicValueSet.sourceResource,
66
- version: dynamicValueSet.version + 1,
67
- isComplete: !_isEqual(dynamicValueSets[linkId].sourceResource, completeResource)
68
- };
69
- }
70
- }
71
- // after that we need to update the dynamicvalueset object - iscomplete so that we can use it in useMemo - or potentially updated the version of the dynamic updatedcount
72
- return {
73
- dynamicValueSetsIsUpdated: isUpdated,
74
- updatedDynamicValueSets: updatedDynamicValueSets
75
- };
76
- }
77
- function evaluateFhirPathEmbeddings(fhirPathEmbeddingsMap, fhirPathContext) {
78
- // evaluate fhirpath embeddings within map
79
- Object.keys(fhirPathEmbeddingsMap).forEach((embedding) => {
80
- try {
81
- const result = fhirpath.evaluate({}, `%${embedding}`, fhirPathContext, fhirpath_r4_model)[0];
82
- if (result !== undefined && result !== null) {
83
- fhirPathEmbeddingsMap[embedding] = result;
84
- }
85
- }
86
- catch (e) {
87
- console.warn(e);
88
- }
89
- });
90
- return fhirPathEmbeddingsMap;
91
- }
92
- const FHIRPATH_EMBEDDING_REGEX = /{{%(.*?)}}/g;
93
- function readFhirPathEmbeddingsFromStr(expression) {
94
- return [...expression.matchAll(FHIRPATH_EMBEDDING_REGEX)].map((match) => { var _a; return (_a = match[1]) !== null && _a !== void 0 ? _a : ''; });
95
- }
96
- //# sourceMappingURL=dynamicValueSet.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dynamicValueSet.js","sourceRoot":"","sources":["../../src/utils/dynamicValueSet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AACzD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,MAAM,UAAU,wBAAwB,CACtC,eAAoC,EACpC,gBAAiD;;IAKjD,MAAM,uBAAuB,GAAoC,SAAS,CAAC,gBAAgB,CA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,EAAE;gBAC3C,qBAAqB,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;aAC3C;SACF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,MAAM,wBAAwB,GAAG,aAAa,CAAC;AAE/C,SAAS,6BAA6B,CAAC,UAAkB;IACvD,OAAO,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,MAAA,KAAK,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAA,EAAA,CAAC,CAAC;AAC3F,CAAC"}
@@ -1,14 +0,0 @@
1
- import type { DomainResource } from 'fhir/r4b';
2
- /** Global debug variable to permit the logger to write information messages
3
- to the OperationOutcome and console
4
- */
5
- export declare const debugAsyncFhirpath: boolean;
6
- /**
7
- * Evaluate a FHIRPath expression asynchronously
8
- * @param fhirData FHIR resource to run the FHIRPath expression against
9
- * @param path FHIRPath expression to evaluate (string or Path object)
10
- * @param context Environment to evaluate the expression in, mostly variables
11
- * @param model which fhir version to use (r4/r4b/r5)
12
- * @returns the result of the evaluation
13
- */
14
- export declare function evaluateFhirpathAsync(fhirData: DomainResource, path: string | Path, context?: Record<string, any>, model?: Model): Promise<any[]>;