@aehrc/smart-forms-renderer 0.35.8 → 0.36.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.
- package/README.md +1 -1
- package/lib/components/FormComponents/DateTimeItem/DateTimeField.d.ts +12 -0
- package/lib/components/FormComponents/DateTimeItem/DateTimeField.js +34 -0
- package/lib/components/FormComponents/DateTimeItem/DateTimeField.js.map +1 -0
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.d.ts +9 -0
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js +60 -0
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js.map +1 -0
- package/lib/hooks/useCodingCalculatedExpression.js +11 -0
- package/lib/hooks/useCodingCalculatedExpression.js.map +1 -1
- package/lib/hooks/useDisplayCalculatedExpression.d.ts +3 -0
- package/lib/hooks/useDisplayCalculatedExpression.js +40 -0
- package/lib/hooks/useDisplayCalculatedExpression.js.map +1 -0
- package/lib/hooks/useInitialiseRenderer.d.ts +4 -0
- package/lib/hooks/useInitialiseRenderer.js +85 -0
- package/lib/hooks/useInitialiseRenderer.js.map +1 -0
- package/lib/hooks/useQueryClient.d.ts +3 -0
- package/lib/hooks/useQueryClient.js +29 -0
- package/lib/hooks/useQueryClient.js.map +1 -0
- package/lib/utils/buildForm.d.ts +8 -0
- package/lib/utils/buildForm.js +26 -0
- package/lib/utils/buildForm.js.map +1 -0
- package/lib/utils/calculatedExpression.js +15 -43
- package/lib/utils/calculatedExpression.js.map +1 -1
- package/lib/utils/fhirpath.js +0 -4
- package/lib/utils/fhirpath.js.map +1 -1
- package/lib/utils/manageForm.d.ts +7 -1
- package/lib/utils/manageForm.js +9 -0
- package/lib/utils/manageForm.js.map +1 -1
- package/lib/utils/questionnaireStoreUtils/resolveValueSets.js +8 -3
- package/lib/utils/questionnaireStoreUtils/resolveValueSets.js.map +1 -1
- package/lib/utils/removeEmptyAnswers.js +19 -6
- package/lib/utils/removeEmptyAnswers.js.map +1 -1
- package/lib/utils/repopulateIntoResponse.d.ts +1 -3
- package/lib/utils/repopulateIntoResponse.js +2 -31
- package/lib/utils/repopulateIntoResponse.js.map +1 -1
- package/lib/utils/tabs.js +6 -4
- package/lib/utils/tabs.js.map +1 -1
- package/lib/utils/updateQr.d.ts +9 -0
- package/lib/utils/updateQr.js +55 -0
- package/lib/utils/updateQr.js.map +1 -0
- package/lib/utils/valueSet.js +4 -2
- package/lib/utils/valueSet.js.map +1 -1
- package/package.json +5 -4
- package/src/hooks/useCodingCalculatedExpression.ts +14 -1
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreAllergyIntolerance.json +209 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreCondition.json +220 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreEncounter.json +220 -0
- package/src/stories/assets/questionnaires/QAuCoreTesting.ts +455 -0
- package/src/stories/assets/questionnaires/QPrePopTester.ts +266 -71
- package/src/stories/testing/AuCoreTester.stories.tsx +57 -0
- package/src/utils/calculatedExpression.ts +25 -59
- package/src/utils/fhirpath.ts +0 -5
- package/src/utils/manageForm.ts +11 -1
- package/src/utils/questionnaireStoreUtils/resolveValueSets.ts +10 -6
- package/src/utils/removeEmptyAnswers.ts +22 -6
- package/src/utils/repopulateIntoResponse.ts +5 -58
- package/src/utils/tabs.ts +6 -4
- package/src/utils/updateQr.ts +88 -0
- package/src/utils/valueSet.ts +4 -2
- package/stats.html +4842 -0
- package/stats1.html +4842 -0
- package/stats3.html +4842 -0
- package/lib/utils/answerExpression.d.ts +0 -5
- package/lib/utils/answerExpression.js +0 -52
- package/lib/utils/answerExpression.js.map +0 -1
- package/lib/utils/dynamicValueSet.d.ts +0 -5
- package/lib/utils/dynamicValueSet.js +0 -96
- package/lib/utils/dynamicValueSet.js.map +0 -1
- package/lib/utils/fhirpathAsyncUtils/fhirpath-async.d.ts +0 -14
- package/lib/utils/fhirpathAsyncUtils/fhirpath-async.js +0 -431
- package/lib/utils/fhirpathAsyncUtils/fhirpath-async.js.map +0 -1
- package/lib/utils/fhirpathAsyncUtils/outcome-utils.d.ts +0 -3
- package/lib/utils/fhirpathAsyncUtils/outcome-utils.js +0 -41
- package/lib/utils/fhirpathAsyncUtils/outcome-utils.js.map +0 -1
- package/lib/utils/fhirpathAsyncUtils/test-questionnaire.d.ts +0 -1
- package/lib/utils/fhirpathAsyncUtils/test-questionnaire.js +0 -379
- package/lib/utils/fhirpathAsyncUtils/test-questionnaire.js.map +0 -1
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { AnswerExpression } from '../interfaces/answerExpression.interface';
|
|
2
|
-
export declare function evaluateAnswerExpressions(fhirPathContext: Record<string, any>, answerExpressions: Record<string, AnswerExpression>): {
|
|
3
|
-
answerExpsIsUpdated: boolean;
|
|
4
|
-
updatedAnswerExpressions: Record<string, AnswerExpression>;
|
|
5
|
-
};
|
|
@@ -1,52 +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 _isEqual from 'lodash/isEqual';
|
|
20
|
-
export function evaluateAnswerExpressions(fhirPathContext, answerExpressions) {
|
|
21
|
-
const updatedAnswerExpressions = Object.assign({}, answerExpressions);
|
|
22
|
-
let isUpdated = false;
|
|
23
|
-
for (const linkId in answerExpressions) {
|
|
24
|
-
const answerExpression = answerExpressions[linkId];
|
|
25
|
-
try {
|
|
26
|
-
const result = fhirpath.evaluate({}, answerExpression.expression, fhirPathContext, fhirpath_r4_model);
|
|
27
|
-
// Update calculatedExpressions if length of result array > 0
|
|
28
|
-
// Only update when current calcExpression value is different from the result, otherwise it will result in an infinite loop as per issue #733
|
|
29
|
-
if (result.length > 0 && !_isEqual(answerExpression.options, result)) {
|
|
30
|
-
isUpdated = true;
|
|
31
|
-
answerExpression.options = result;
|
|
32
|
-
answerExpression.version = answerExpression.version + 1;
|
|
33
|
-
}
|
|
34
|
-
// Update calculatedExpression value to null if no result is returned
|
|
35
|
-
if (result.length === 0 && answerExpression.options !== null) {
|
|
36
|
-
isUpdated = true;
|
|
37
|
-
answerExpression.options = [];
|
|
38
|
-
answerExpression.version = answerExpression.version + 1;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
catch (e) {
|
|
42
|
-
console.warn(e.message, `LinkId: ${linkId}\nExpression: ${answerExpression.options}`);
|
|
43
|
-
}
|
|
44
|
-
console.log(answerExpression);
|
|
45
|
-
updatedAnswerExpressions[linkId] = answerExpression;
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
answerExpsIsUpdated: isUpdated,
|
|
49
|
-
updatedAnswerExpressions: updatedAnswerExpressions
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
//# 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,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E,SAAS;QAC9B,wBAAwB,EAAE,wBAAwB;KACnD,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { 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":[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pC,0CAA0C;IAC1C,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QACvD,IAAI;YACF,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,SAAS,EAAE,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;YAE7F,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,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[]>;
|
|
@@ -1,431 +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 type { Model, Path, UserInvocationTable } from 'fhirpath';
|
|
11
|
-
import fhirpath from 'fhirpath';
|
|
12
|
-
import { CreateOperationOutcome, logMessage } from './outcome-utils';
|
|
13
|
-
// --------------------------------------------------------------------------
|
|
14
|
-
// From: https://github.com/brianpos/fhirpathjs-async-poc/commit/950475900d09bf399574c24f142f3eeae1552fe6
|
|
15
|
-
// Forked from: https://github.com/brianpos/fhirpathjs-async-poc
|
|
16
|
-
// --------------------------------------------------------------------------
|
|
17
|
-
// The concept of this POC is to demonstrate an approach to perform some
|
|
18
|
-
// async based methods as functions inside the fhirpath engine without
|
|
19
|
-
// converting the entire engine to process things asynchronously.
|
|
20
|
-
// e.g. Terminology functions such as memberOf, subsumes, or resolve()
|
|
21
|
-
//
|
|
22
|
-
// The basic gist is:
|
|
23
|
-
// * Perform an initial evaluation in sync mode
|
|
24
|
-
// * when encountering any method that requires async execution
|
|
25
|
-
// - queue the required call
|
|
26
|
-
// - return a null result
|
|
27
|
-
// - continue processing the rest of the expression.
|
|
28
|
-
// * If no async calls where encountered the result is returned immediately.
|
|
29
|
-
// * Process all the encountered async calls and stash the results.
|
|
30
|
-
// * Re-evaluate the expression from the start
|
|
31
|
-
// - when encountering the async methods again, inject the resolved results and continue processing.
|
|
32
|
-
// If there were no additional async methods encountered, return the result.
|
|
33
|
-
// otherwise, repeat the process until all async calls are resolved.
|
|
34
|
-
// --------------------------------------------------------------------------
|
|
35
|
-
// Open question: Should the async requests have access to the other potential results?
|
|
36
|
-
// Reason: That would enable the result from one function to be accessed in another function.
|
|
37
|
-
// --------------------------------------------------------------------------
|
|
38
|
-
/** Global debug variable to permit the logger to write information messages
|
|
39
|
-
to the OperationOutcome and console
|
|
40
|
-
*/
|
|
41
|
-
export const debugAsyncFhirpath = true;
|
|
42
|
-
/**
|
|
43
|
-
* Evaluate a FHIRPath expression asynchronously
|
|
44
|
-
* @param fhirData FHIR resource to run the FHIRPath expression against
|
|
45
|
-
* @param path FHIRPath expression to evaluate (string or Path object)
|
|
46
|
-
* @param context Environment to evaluate the expression in, mostly variables
|
|
47
|
-
* @param model which fhir version to use (r4/r4b/r5)
|
|
48
|
-
* @returns the result of the evaluation
|
|
49
|
-
*/
|
|
50
|
-
export function evaluateFhirpathAsync(fhirData, path, context, model) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
let results = [];
|
|
53
|
-
const outcome = {
|
|
54
|
-
resourceType: 'OperationOutcome',
|
|
55
|
-
issue: []
|
|
56
|
-
};
|
|
57
|
-
const asyncCallsRequired = new Map();
|
|
58
|
-
let requiresAsyncProcessing = false;
|
|
59
|
-
// introduce a custom function for resolve into the options
|
|
60
|
-
// https://github.com/HL7/fhirpath.js/?tab=readme-ov-file#user-defined-functions
|
|
61
|
-
// https://github.com/HL7/fhirpath.js/blob/5428ef8be766301658215ef7ed241c8a1666a980/index.d.ts#L86
|
|
62
|
-
const userInvocationTable = {
|
|
63
|
-
expand: {
|
|
64
|
-
fn: (inputs, valueSet, params) => inputs
|
|
65
|
-
.map((value) => {
|
|
66
|
-
var _a, _b;
|
|
67
|
-
if (Array.isArray(valueSet)) {
|
|
68
|
-
valueSet = valueSet[0];
|
|
69
|
-
}
|
|
70
|
-
let key = createIndexKeyExpand(valueSet, params);
|
|
71
|
-
if (key) {
|
|
72
|
-
key = 'Expand:' + key;
|
|
73
|
-
if ((_a = asyncCallsRequired.get(key)) === null || _a === void 0 ? void 0 : _a.evaluationCompleted) {
|
|
74
|
-
logMessage(debugAsyncFhirpath, outcome, ' using cached result for: ', key);
|
|
75
|
-
return (_b = asyncCallsRequired.get(key)) === null || _b === void 0 ? void 0 : _b.result;
|
|
76
|
-
}
|
|
77
|
-
const details = {
|
|
78
|
-
evaluationCompleted: false,
|
|
79
|
-
asyncFunction: expandAsync,
|
|
80
|
-
value: value,
|
|
81
|
-
valueSet: valueSet,
|
|
82
|
-
params: params
|
|
83
|
-
};
|
|
84
|
-
asyncCallsRequired.set(key, details);
|
|
85
|
-
logMessage(debugAsyncFhirpath, outcome, ' requires async evaluation for: ', key);
|
|
86
|
-
requiresAsyncProcessing = true;
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
.filter((v) => v !== undefined),
|
|
91
|
-
arity: { 1: ['Any'], 2: ['Any', 'String'] }
|
|
92
|
-
},
|
|
93
|
-
resolve: {
|
|
94
|
-
fn: (inputs) => inputs
|
|
95
|
-
.map((reference) => {
|
|
96
|
-
var _a, _b;
|
|
97
|
-
let key = createIndexKeyResolve(reference);
|
|
98
|
-
if (key) {
|
|
99
|
-
key = 'Resolve:' + key;
|
|
100
|
-
if ((_a = asyncCallsRequired.get(key)) === null || _a === void 0 ? void 0 : _a.evaluationCompleted) {
|
|
101
|
-
logMessage(debugAsyncFhirpath, outcome, ' using cached result for: ', key);
|
|
102
|
-
return (_b = asyncCallsRequired.get(key)) === null || _b === void 0 ? void 0 : _b.result;
|
|
103
|
-
}
|
|
104
|
-
const details = {
|
|
105
|
-
evaluationCompleted: false,
|
|
106
|
-
asyncFunction: resolveAsync,
|
|
107
|
-
value: reference
|
|
108
|
-
};
|
|
109
|
-
asyncCallsRequired.set(key, details);
|
|
110
|
-
logMessage(debugAsyncFhirpath, outcome, ' requires async evaluation for: ', key);
|
|
111
|
-
requiresAsyncProcessing = true;
|
|
112
|
-
}
|
|
113
|
-
return undefined;
|
|
114
|
-
})
|
|
115
|
-
.filter((v) => v !== undefined),
|
|
116
|
-
arity: { 0: [] }
|
|
117
|
-
},
|
|
118
|
-
memberOf: {
|
|
119
|
-
fn: (inputs, valueSet) => {
|
|
120
|
-
const output = inputs
|
|
121
|
-
.map((codeData) => {
|
|
122
|
-
var _a, _b;
|
|
123
|
-
let key = createIndexKeyMemberOf(codeData, valueSet);
|
|
124
|
-
if (key) {
|
|
125
|
-
key = 'MemberOf:' + key;
|
|
126
|
-
if ((_a = asyncCallsRequired.get(key)) === null || _a === void 0 ? void 0 : _a.evaluationCompleted) {
|
|
127
|
-
logMessage(debugAsyncFhirpath, outcome, ' using cached result for: ', key);
|
|
128
|
-
return (_b = asyncCallsRequired.get(key)) === null || _b === void 0 ? void 0 : _b.result;
|
|
129
|
-
}
|
|
130
|
-
const details = {
|
|
131
|
-
evaluationCompleted: false,
|
|
132
|
-
asyncFunction: memberOfAsync,
|
|
133
|
-
value: codeData,
|
|
134
|
-
valueSet: valueSet
|
|
135
|
-
};
|
|
136
|
-
asyncCallsRequired.set(key, details);
|
|
137
|
-
logMessage(debugAsyncFhirpath, outcome, ' requires async evaluation for: ', key);
|
|
138
|
-
requiresAsyncProcessing = true;
|
|
139
|
-
}
|
|
140
|
-
return undefined;
|
|
141
|
-
})
|
|
142
|
-
.filter((v) => v !== undefined);
|
|
143
|
-
return output;
|
|
144
|
-
},
|
|
145
|
-
arity: { 1: ['String'] }
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
const options = {
|
|
149
|
-
userInvocationTable: userInvocationTable
|
|
150
|
-
};
|
|
151
|
-
let iterations = 0;
|
|
152
|
-
do {
|
|
153
|
-
context = Object.assign(Object.assign({}, context), { resource: fhirData, rootResource: fhirData, terminologies: {} });
|
|
154
|
-
iterations++;
|
|
155
|
-
// Perform the async calls required (none first time in)
|
|
156
|
-
if (asyncCallsRequired.size > 0) {
|
|
157
|
-
// resolve the async calls
|
|
158
|
-
const asyncPromises = [];
|
|
159
|
-
for (const key of asyncCallsRequired.keys()) {
|
|
160
|
-
const details = asyncCallsRequired.get(key);
|
|
161
|
-
if (details && !details.evaluationCompleted) {
|
|
162
|
-
// perform the async call to check for the memberOf status
|
|
163
|
-
logMessage(debugAsyncFhirpath, outcome, ' performing async request for: ', key);
|
|
164
|
-
asyncPromises.push(details.asyncFunction(outcome, details));
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
if (asyncPromises.length > 0)
|
|
168
|
-
yield Promise.all(asyncPromises);
|
|
169
|
-
requiresAsyncProcessing = false;
|
|
170
|
-
}
|
|
171
|
-
// Evaluate the expression
|
|
172
|
-
try {
|
|
173
|
-
results = fhirpath.evaluate(fhirData, path, context, model, options);
|
|
174
|
-
}
|
|
175
|
-
catch (err) {
|
|
176
|
-
console.log(err);
|
|
177
|
-
if (err.message) {
|
|
178
|
-
throw CreateOperationOutcome('fatal', 'exception', err.message);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
} while (requiresAsyncProcessing && iterations < 10); // bound the number of iterations
|
|
182
|
-
if (iterations > 1) {
|
|
183
|
-
logMessage(debugAsyncFhirpath, outcome, 'total iterations', iterations);
|
|
184
|
-
}
|
|
185
|
-
return results;
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Create an Index Key for the expand function
|
|
190
|
-
* @param valueSet
|
|
191
|
-
* @param params
|
|
192
|
-
* @returns
|
|
193
|
-
*/
|
|
194
|
-
function createIndexKeyExpand(valueSet, params) {
|
|
195
|
-
var _a, _b;
|
|
196
|
-
// input value is ignored since expand() is supposed to be called with a %terminologies fhirpath object
|
|
197
|
-
const vs = valueSet;
|
|
198
|
-
if (vs.resourceType === 'ValueSet') {
|
|
199
|
-
const valueSetId = (_b = (_a = vs.id) !== null && _a !== void 0 ? _a : vs.url) !== null && _b !== void 0 ? _b : '';
|
|
200
|
-
return params
|
|
201
|
-
? ' terminologies - ' + valueSetId + ' - ' + params
|
|
202
|
-
: 'terminologies - ' + valueSetId;
|
|
203
|
-
}
|
|
204
|
-
if (typeof valueSet === 'string') {
|
|
205
|
-
return params ? ' terminologies - ' + valueSet + ' - ' + params : 'terminologies - ' + valueSet;
|
|
206
|
-
}
|
|
207
|
-
return undefined;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Perform the actual async expand evaluation
|
|
211
|
-
* @param details parameters which is actually a ExpandUserData structure
|
|
212
|
-
*/
|
|
213
|
-
function expandAsync(outcome, details) {
|
|
214
|
-
var _a;
|
|
215
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
216
|
-
// perform the async call to check for the memberOf status
|
|
217
|
-
const typedData = details;
|
|
218
|
-
try {
|
|
219
|
-
const httpHeaders = {
|
|
220
|
-
Accept: 'application/fhir+json; charset=utf-8'
|
|
221
|
-
};
|
|
222
|
-
const httpPostHeaders = {
|
|
223
|
-
Accept: 'application/fhir+json; charset=utf-8',
|
|
224
|
-
'Content-Type': 'application/fhir+json; charset=utf-8'
|
|
225
|
-
};
|
|
226
|
-
let myHeaders = new Headers(httpHeaders);
|
|
227
|
-
const requestUrl = 'https://r4.ontoserver.csiro.au/fhir/ValueSet/$expand';
|
|
228
|
-
let response;
|
|
229
|
-
const valueSet = typedData.valueSet;
|
|
230
|
-
if (valueSet.resourceType === 'ValueSet') {
|
|
231
|
-
const parameters = {
|
|
232
|
-
resourceType: 'Parameters',
|
|
233
|
-
parameter: [
|
|
234
|
-
{
|
|
235
|
-
name: 'valueSet',
|
|
236
|
-
resource: valueSet
|
|
237
|
-
}
|
|
238
|
-
]
|
|
239
|
-
};
|
|
240
|
-
// TODO turn typedData.params into a URLSearchParams object and into $expand params
|
|
241
|
-
myHeaders = new Headers(httpPostHeaders);
|
|
242
|
-
response = yield fetch(requestUrl, {
|
|
243
|
-
method: 'POST',
|
|
244
|
-
headers: myHeaders,
|
|
245
|
-
body: JSON.stringify(parameters)
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
else if (typeof typedData.valueSet === 'string') {
|
|
249
|
-
const additionalParams = (_a = typedData.params) !== null && _a !== void 0 ? _a : '';
|
|
250
|
-
response = yield fetch(`${requestUrl}?url=${typedData.valueSet}&${additionalParams}`, {
|
|
251
|
-
headers: myHeaders
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
if (response) {
|
|
255
|
-
const resultJson = yield response.json();
|
|
256
|
-
const valueSet = resultJson;
|
|
257
|
-
if (valueSet.resourceType === 'ValueSet') {
|
|
258
|
-
details.evaluationCompleted = true;
|
|
259
|
-
details.result = valueSet;
|
|
260
|
-
}
|
|
261
|
-
const outcomeResult = resultJson;
|
|
262
|
-
if (outcomeResult && outcomeResult.issue) {
|
|
263
|
-
details.evaluationCompleted = true;
|
|
264
|
-
throw outcomeResult; // should we be throwing here?
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
catch (err) {
|
|
269
|
-
console.log(err);
|
|
270
|
-
if (err.resourceType === 'OperationOutcome') {
|
|
271
|
-
throw err;
|
|
272
|
-
}
|
|
273
|
-
details.evaluationCompleted = true;
|
|
274
|
-
const key = createIndexKeyExpand(typedData.valueSet, typedData.params);
|
|
275
|
-
throw CreateOperationOutcome('error', 'exception', 'Failed to check membership: ' + key, undefined, err.message);
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Create an Index Key for the memberOf function
|
|
281
|
-
* @param value
|
|
282
|
-
* @returns
|
|
283
|
-
*/
|
|
284
|
-
function createIndexKeyResolve(value) {
|
|
285
|
-
if (typeof value === 'string')
|
|
286
|
-
return value;
|
|
287
|
-
if (valueIsReference(value))
|
|
288
|
-
return value.reference;
|
|
289
|
-
return value;
|
|
290
|
-
}
|
|
291
|
-
function valueIsReference(value) {
|
|
292
|
-
return !!value.reference;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Perform the actual async member of evaluation
|
|
296
|
-
* @param details parameters which is actually a MemberOfUserData structure
|
|
297
|
-
*/
|
|
298
|
-
function resolveAsync(outcome, details) {
|
|
299
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
300
|
-
// perform the async call to check for the memberOf status
|
|
301
|
-
const typedData = details;
|
|
302
|
-
const URL = createIndexKeyResolve(typedData.value);
|
|
303
|
-
if (URL) {
|
|
304
|
-
try {
|
|
305
|
-
const httpHeaders = {
|
|
306
|
-
Accept: 'application/fhir+json; charset=utf-8'
|
|
307
|
-
};
|
|
308
|
-
const myHeaders = new Headers(httpHeaders);
|
|
309
|
-
const response = yield fetch(URL, { headers: myHeaders });
|
|
310
|
-
const resultJson = yield response.json();
|
|
311
|
-
console.log(resultJson);
|
|
312
|
-
details.result = resultJson;
|
|
313
|
-
details.evaluationCompleted = true;
|
|
314
|
-
}
|
|
315
|
-
catch (err) {
|
|
316
|
-
console.log(err);
|
|
317
|
-
details.result = undefined; // not found!
|
|
318
|
-
details.evaluationCompleted = true;
|
|
319
|
-
const newOutcome = CreateOperationOutcome('error', 'exception', 'Failed to resolve reference: ' + URL, undefined, err.message);
|
|
320
|
-
throw newOutcome;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Create an Index Key for the memberOf function
|
|
327
|
-
* @param value
|
|
328
|
-
* @param valueset
|
|
329
|
-
* @returns
|
|
330
|
-
*/
|
|
331
|
-
function createIndexKeyMemberOf(value, valueset) {
|
|
332
|
-
if (typeof value === 'string') {
|
|
333
|
-
return value + ' - ' + valueset;
|
|
334
|
-
}
|
|
335
|
-
const coding = value;
|
|
336
|
-
if (coding.code) {
|
|
337
|
-
return coding.system + '|' + coding.code + ' - ' + valueset;
|
|
338
|
-
}
|
|
339
|
-
const cc = value;
|
|
340
|
-
if (cc.coding) {
|
|
341
|
-
// return the same as for coding by joining each of the codings with a comma
|
|
342
|
-
return cc.coding.map((c) => c.system + '|' + c.code).join(',') + ' - ' + valueset;
|
|
343
|
-
}
|
|
344
|
-
return undefined;
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Perform the actual async member of evaluation
|
|
348
|
-
* @param details parameters which is actually a MemberOfUserData structure
|
|
349
|
-
*/
|
|
350
|
-
function memberOfAsync(outcome, details) {
|
|
351
|
-
var _a, _b;
|
|
352
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
353
|
-
// perform the async call to check for the memberOf status
|
|
354
|
-
const typedData = details;
|
|
355
|
-
try {
|
|
356
|
-
const httpHeaders = {
|
|
357
|
-
Accept: 'application/fhir+json; charset=utf-8'
|
|
358
|
-
};
|
|
359
|
-
const httpPostHeaders = {
|
|
360
|
-
Accept: 'application/fhir+json; charset=utf-8',
|
|
361
|
-
'Content-Type': 'application/fhir+json; charset=utf-8'
|
|
362
|
-
};
|
|
363
|
-
let myHeaders = new Headers(httpHeaders);
|
|
364
|
-
const requestUrl = 'https://r4.ontoserver.csiro.au/fhir/ValueSet/$validate-code';
|
|
365
|
-
let response;
|
|
366
|
-
let cc = typedData.value;
|
|
367
|
-
if (cc.coding) {
|
|
368
|
-
const parameters = {
|
|
369
|
-
resourceType: 'Parameters',
|
|
370
|
-
parameter: [
|
|
371
|
-
{
|
|
372
|
-
name: 'url',
|
|
373
|
-
valueUri: typedData.valueSet
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
name: 'codeableConcept',
|
|
377
|
-
valueCodeableConcept: cc
|
|
378
|
-
}
|
|
379
|
-
]
|
|
380
|
-
};
|
|
381
|
-
myHeaders = new Headers(httpPostHeaders);
|
|
382
|
-
response = yield fetch(requestUrl, {
|
|
383
|
-
method: 'POST',
|
|
384
|
-
headers: myHeaders,
|
|
385
|
-
body: JSON.stringify(parameters)
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
else if (typeof typedData.value === 'string') {
|
|
389
|
-
const queryParams = new URLSearchParams({
|
|
390
|
-
url: typedData.valueSet,
|
|
391
|
-
code: typedData.value
|
|
392
|
-
});
|
|
393
|
-
response = yield fetch(`${requestUrl}?${queryParams.toString()}`, { headers: myHeaders });
|
|
394
|
-
}
|
|
395
|
-
else {
|
|
396
|
-
const coding = typedData.value;
|
|
397
|
-
if (coding.code) {
|
|
398
|
-
const queryParams = new URLSearchParams({
|
|
399
|
-
url: (_a = typedData.valueSet) !== null && _a !== void 0 ? _a : '',
|
|
400
|
-
system: (_b = coding.system) !== null && _b !== void 0 ? _b : '',
|
|
401
|
-
code: coding.code
|
|
402
|
-
});
|
|
403
|
-
response = yield fetch(`${requestUrl}?${queryParams.toString()}`, { headers: myHeaders });
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
if (response) {
|
|
407
|
-
const resultJson = yield response.json();
|
|
408
|
-
const params = resultJson;
|
|
409
|
-
if (params && params.parameter) {
|
|
410
|
-
const param = params.parameter.find((p) => p.name === 'result');
|
|
411
|
-
if (param) {
|
|
412
|
-
details.evaluationCompleted = true;
|
|
413
|
-
details.result = param.valueBoolean;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
const outcomeResult = resultJson;
|
|
417
|
-
if (outcomeResult && outcomeResult.issue) {
|
|
418
|
-
details.evaluationCompleted = true;
|
|
419
|
-
throw outcomeResult; // should we be throwing here?
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
catch (err) {
|
|
424
|
-
console.log(err);
|
|
425
|
-
details.evaluationCompleted = true;
|
|
426
|
-
const key = createIndexKeyMemberOf(typedData.value, typedData.valueSet);
|
|
427
|
-
throw CreateOperationOutcome('error', 'exception', 'Failed to check membership: ' + key, undefined, err.message);
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
//# sourceMappingURL=fhirpath-async.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fhirpath-async.js","sourceRoot":"","sources":["../../../src/utils/fhirpathAsyncUtils/fhirpath-async.ts"],"names":[],"mappings":";;;;;;;;;AAUA,oEAAoE;AACpE,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAErE,6EAA6E;AAC7E,yGAAyG;AACzG,gEAAgE;AAChE,6EAA6E;AAC7E,wEAAwE;AACxE,sEAAsE;AACtE,iEAAiE;AACjE,sEAAsE;AACtE,EAAE;AACF,qBAAqB;AACrB,+CAA+C;AAC/C,+DAA+D;AAC/D,+BAA+B;AAC/B,4BAA4B;AAC5B,uDAAuD;AACvD,4EAA4E;AAC5E,mEAAmE;AACnE,8CAA8C;AAC9C,uGAAuG;AACvG,4EAA4E;AAC5E,oEAAoE;AACpE,6EAA6E;AAC7E,uFAAuF;AACvF,6FAA6F;AAC7F,6EAA6E;AAE7E;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAY,IAAI,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,UAAgB,qBAAqB,CACzC,QAAwB,EACxB,IAAmB,EACnB,OAA6B,EAC7B,KAAa;;QAEb,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB,MAAM,OAAO,GAAqB;YAChC,YAAY,EAAE,kBAAkB;YAChC,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,MAAM,kBAAkB,GAAuC,IAAI,GAAG,EAGnE,CAAC;QACJ,IAAI,uBAAuB,GAAG,KAAK,CAAC;QACpC,2DAA2D;QAC3D,gFAAgF;QAChF,kGAAkG;QAClG,MAAM,mBAAmB,GAAwB;YAC/C,MAAM,EAAE;gBACN,EAAE,EAAE,CAAC,MAAa,EAAE,QAAwC,EAAE,MAAe,EAAE,EAAE,CAC/E,MAAM;qBACH,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE;;oBAClB,IAAI,KAAK,CAAC,OAAO,CAAC,Q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EAAE,CAAC;gBACzC,MAAM,MAAM,GAAG,UAAwB,CAAC;gBACxC,IAAI,MAAM,IAAI,MAAM,CAAC,SAAS,EAAE;oBAC9B,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;oBAChE,IAAI,KAAK,EAAE;wBACT,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;wBACnC,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;qBACrC;iBACF;gBACD,MAAM,aAAa,GAAG,UAA8B,CAAC;gBACrD,IAAI,aAAa,IAAI,aAAa,CAAC,KAAK,EAAE;oBACxC,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;oBACnC,MAAM,aAAa,CAAC,CAAC,8BAA8B;iBACpD;aACF;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACjB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;YACnC,MAAM,GAAG,GAAG,sBAAsB,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;YACxE,MAAM,sBAAsB,CAC1B,OAAO,EACP,WAAW,EACX,8BAA8B,GAAG,GAAG,EACpC,SAAS,EACT,GAAG,CAAC,OAAO,CACZ,CAAC;SACH;;CACF"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { Coding, OperationOutcome } from 'fhir/r4b';
|
|
2
|
-
export declare function CreateOperationOutcome(severity: 'error' | 'fatal' | 'warning' | 'information', code: 'invalid' | 'structure' | 'required' | 'value' | 'invariant' | 'security' | 'login' | 'unknown' | 'expired' | 'forbidden' | 'suppressed' | 'processing' | 'not-supported' | 'duplicate' | 'multiple-matches' | 'not-found' | 'deleted' | 'too-long' | 'code-invalid' | 'extension' | 'too-costly' | 'business-rule' | 'conflict' | 'transient' | 'lock-error' | 'no-store' | 'exception' | 'timeout' | 'incomplete' | 'throttled' | 'informational', message: string, coding?: Coding, diagnostics?: string): fhir4b.OperationOutcome;
|
|
3
|
-
export declare function logMessage(enabled: boolean, outcome: OperationOutcome, message: string, data?: any): void;
|