@metriport/fhir-sdk 0.30.0-alpha.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/LICENSE +21 -0
- package/README.md +564 -0
- package/dist/__tests__/careplan.test.d.ts +2 -0
- package/dist/__tests__/careplan.test.d.ts.map +1 -0
- package/dist/__tests__/careplan.test.js +544 -0
- package/dist/__tests__/careplan.test.js.map +1 -0
- package/dist/__tests__/clinical-dates.test.d.ts +2 -0
- package/dist/__tests__/clinical-dates.test.d.ts.map +1 -0
- package/dist/__tests__/clinical-dates.test.js +341 -0
- package/dist/__tests__/clinical-dates.test.js.map +1 -0
- package/dist/__tests__/coding-utilities.test.d.ts +2 -0
- package/dist/__tests__/coding-utilities.test.d.ts.map +1 -0
- package/dist/__tests__/coding-utilities.test.js +482 -0
- package/dist/__tests__/coding-utilities.test.js.map +1 -0
- package/dist/__tests__/date-range-performance.test.d.ts +2 -0
- package/dist/__tests__/date-range-performance.test.d.ts.map +1 -0
- package/dist/__tests__/date-range-performance.test.js +218 -0
- package/dist/__tests__/date-range-performance.test.js.map +1 -0
- package/dist/__tests__/date-range-search.test.d.ts +2 -0
- package/dist/__tests__/date-range-search.test.d.ts.map +1 -0
- package/dist/__tests__/date-range-search.test.js +215 -0
- package/dist/__tests__/date-range-search.test.js.map +1 -0
- package/dist/__tests__/env-setup.d.ts +2 -0
- package/dist/__tests__/env-setup.d.ts.map +1 -0
- package/dist/__tests__/env-setup.js +37 -0
- package/dist/__tests__/env-setup.js.map +1 -0
- package/dist/__tests__/fhir-bundle-sdk-basic.test.d.ts +2 -0
- package/dist/__tests__/fhir-bundle-sdk-basic.test.d.ts.map +1 -0
- package/dist/__tests__/fhir-bundle-sdk-basic.test.js +19 -0
- package/dist/__tests__/fhir-bundle-sdk-basic.test.js.map +1 -0
- package/dist/__tests__/fhir-bundle-sdk.test.d.ts +2 -0
- package/dist/__tests__/fhir-bundle-sdk.test.d.ts.map +1 -0
- package/dist/__tests__/fhir-bundle-sdk.test.js +953 -0
- package/dist/__tests__/fhir-bundle-sdk.test.js.map +1 -0
- package/dist/__tests__/fixtures/fhir-bundles.d.ts +31 -0
- package/dist/__tests__/fixtures/fhir-bundles.d.ts.map +1 -0
- package/dist/__tests__/fixtures/fhir-bundles.js +487 -0
- package/dist/__tests__/fixtures/fhir-bundles.js.map +1 -0
- package/dist/__tests__/phase1-verification.test.d.ts +2 -0
- package/dist/__tests__/phase1-verification.test.d.ts.map +1 -0
- package/dist/__tests__/phase1-verification.test.js +141 -0
- package/dist/__tests__/phase1-verification.test.js.map +1 -0
- package/dist/__tests__/phase2-verification.test.d.ts +2 -0
- package/dist/__tests__/phase2-verification.test.d.ts.map +1 -0
- package/dist/__tests__/phase2-verification.test.js +234 -0
- package/dist/__tests__/phase2-verification.test.js.map +1 -0
- package/dist/__tests__/phase3-verification.test.d.ts +2 -0
- package/dist/__tests__/phase3-verification.test.d.ts.map +1 -0
- package/dist/__tests__/phase3-verification.test.js +121 -0
- package/dist/__tests__/phase3-verification.test.js.map +1 -0
- package/dist/__tests__/phase4-verification.test.d.ts +2 -0
- package/dist/__tests__/phase4-verification.test.d.ts.map +1 -0
- package/dist/__tests__/phase4-verification.test.js +168 -0
- package/dist/__tests__/phase4-verification.test.js.map +1 -0
- package/dist/__tests__/phase5-verification.test.d.ts +2 -0
- package/dist/__tests__/phase5-verification.test.d.ts.map +1 -0
- package/dist/__tests__/phase5-verification.test.js +397 -0
- package/dist/__tests__/phase5-verification.test.js.map +1 -0
- package/dist/__tests__/reverse-references.test.d.ts +2 -0
- package/dist/__tests__/reverse-references.test.d.ts.map +1 -0
- package/dist/__tests__/reverse-references.test.js +294 -0
- package/dist/__tests__/reverse-references.test.js.map +1 -0
- package/dist/__tests__/type-guards.test.d.ts +2 -0
- package/dist/__tests__/type-guards.test.d.ts.map +1 -0
- package/dist/__tests__/type-guards.test.js +163 -0
- package/dist/__tests__/type-guards.test.js.map +1 -0
- package/dist/clinical-dates.d.ts +26 -0
- package/dist/clinical-dates.d.ts.map +1 -0
- package/dist/clinical-dates.js +571 -0
- package/dist/clinical-dates.js.map +1 -0
- package/dist/fhir-bundle-sdk.d.ts +233 -0
- package/dist/fhir-bundle-sdk.d.ts.map +1 -0
- package/dist/fhir-bundle-sdk.js +545 -0
- package/dist/fhir-bundle-sdk.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/bundle-operations.d.ts +14 -0
- package/dist/internal/bundle-operations.d.ts.map +1 -0
- package/dist/internal/bundle-operations.js +55 -0
- package/dist/internal/bundle-operations.js.map +1 -0
- package/dist/internal/coding-systems.d.ts +48 -0
- package/dist/internal/coding-systems.d.ts.map +1 -0
- package/dist/internal/coding-systems.js +55 -0
- package/dist/internal/coding-systems.js.map +1 -0
- package/dist/internal/coding-utilities.d.ts +27 -0
- package/dist/internal/coding-utilities.d.ts.map +1 -0
- package/dist/internal/coding-utilities.js +297 -0
- package/dist/internal/coding-utilities.js.map +1 -0
- package/dist/internal/date-extraction.d.ts +12 -0
- package/dist/internal/date-extraction.d.ts.map +1 -0
- package/dist/internal/date-extraction.js +629 -0
- package/dist/internal/date-extraction.js.map +1 -0
- package/dist/internal/graph-traversal.d.ts +13 -0
- package/dist/internal/graph-traversal.d.ts.map +1 -0
- package/dist/internal/graph-traversal.js +89 -0
- package/dist/internal/graph-traversal.js.map +1 -0
- package/dist/internal/indexing.d.ts +17 -0
- package/dist/internal/indexing.d.ts.map +1 -0
- package/dist/internal/indexing.js +129 -0
- package/dist/internal/indexing.js.map +1 -0
- package/dist/internal/llm-context.d.ts +40 -0
- package/dist/internal/llm-context.d.ts.map +1 -0
- package/dist/internal/llm-context.js +214 -0
- package/dist/internal/llm-context.js.map +1 -0
- package/dist/internal/reference-resolution.d.ts +29 -0
- package/dist/internal/reference-resolution.d.ts.map +1 -0
- package/dist/internal/reference-resolution.js +338 -0
- package/dist/internal/reference-resolution.js.map +1 -0
- package/dist/internal/reference-utils.d.ts +26 -0
- package/dist/internal/reference-utils.d.ts.map +1 -0
- package/dist/internal/reference-utils.js +89 -0
- package/dist/internal/reference-utils.js.map +1 -0
- package/dist/internal/transparent-proxy.d.ts +12 -0
- package/dist/internal/transparent-proxy.d.ts.map +1 -0
- package/dist/internal/transparent-proxy.js +81 -0
- package/dist/internal/transparent-proxy.js.map +1 -0
- package/dist/internal/validation.d.ts +16 -0
- package/dist/internal/validation.d.ts.map +1 -0
- package/dist/internal/validation.js +45 -0
- package/dist/internal/validation.js.map +1 -0
- package/dist/type-guards.d.ts +212 -0
- package/dist/type-guards.d.ts.map +1 -0
- package/dist/type-guards.js +375 -0
- package/dist/type-guards.js.map +1 -0
- package/dist/types/coding-fields.d.ts +311 -0
- package/dist/types/coding-fields.d.ts.map +1 -0
- package/dist/types/coding-fields.js +3 -0
- package/dist/types/coding-fields.js.map +1 -0
- package/dist/types/sdk-types.d.ts +107 -0
- package/dist/types/sdk-types.d.ts.map +1 -0
- package/dist/types/sdk-types.js +17 -0
- package/dist/types/sdk-types.js.map +1 -0
- package/dist/types/smart-resources.d.ts +470 -0
- package/dist/types/smart-resources.d.ts.map +1 -0
- package/dist/types/smart-resources.js +249 -0
- package/dist/types/smart-resources.js.map +1 -0
- package/dist/utils/interval-tree/index.d.ts +87 -0
- package/dist/utils/interval-tree/index.d.ts.map +1 -0
- package/dist/utils/interval-tree/index.js +774 -0
- package/dist/utils/interval-tree/index.js.map +1 -0
- package/dist/utils/interval-tree/shallowequal/arrays.d.ts +3 -0
- package/dist/utils/interval-tree/shallowequal/arrays.d.ts.map +1 -0
- package/dist/utils/interval-tree/shallowequal/arrays.js +25 -0
- package/dist/utils/interval-tree/shallowequal/arrays.js.map +1 -0
- package/dist/utils/interval-tree/shallowequal/index.d.ts +6 -0
- package/dist/utils/interval-tree/shallowequal/index.d.ts.map +1 -0
- package/dist/utils/interval-tree/shallowequal/index.js +28 -0
- package/dist/utils/interval-tree/shallowequal/index.js.map +1 -0
- package/dist/utils/interval-tree/shallowequal/objects.d.ts +3 -0
- package/dist/utils/interval-tree/shallowequal/objects.d.ts.map +1 -0
- package/dist/utils/interval-tree/shallowequal/objects.js +28 -0
- package/dist/utils/interval-tree/shallowequal/objects.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findOriginalEntry = exports.createExportBundle = exports.createBundleEntry = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Create a new bundle entry from an existing entry, preserving fullUrl
|
|
6
|
+
*/
|
|
7
|
+
function createBundleEntry(originalEntry, resource) {
|
|
8
|
+
if (originalEntry.fullUrl) {
|
|
9
|
+
return {
|
|
10
|
+
fullUrl: originalEntry.fullUrl,
|
|
11
|
+
resource: resource,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
resource: resource,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.createBundleEntry = createBundleEntry;
|
|
19
|
+
/**
|
|
20
|
+
* Create a new bundle with specified entries, maintaining original metadata
|
|
21
|
+
*/
|
|
22
|
+
function createExportBundle(originalBundle, entries) {
|
|
23
|
+
const exportBundle = {
|
|
24
|
+
resourceType: "Bundle",
|
|
25
|
+
type: originalBundle.type || "collection",
|
|
26
|
+
total: entries.length,
|
|
27
|
+
entry: entries,
|
|
28
|
+
};
|
|
29
|
+
// Preserve original bundle metadata (FR-6.4)
|
|
30
|
+
if (originalBundle.id) {
|
|
31
|
+
exportBundle.id = originalBundle.id;
|
|
32
|
+
}
|
|
33
|
+
if (originalBundle.meta) {
|
|
34
|
+
exportBundle.meta = { ...originalBundle.meta };
|
|
35
|
+
}
|
|
36
|
+
if (originalBundle.identifier) {
|
|
37
|
+
exportBundle.identifier = originalBundle.identifier;
|
|
38
|
+
}
|
|
39
|
+
if (originalBundle.timestamp) {
|
|
40
|
+
exportBundle.timestamp = originalBundle.timestamp;
|
|
41
|
+
}
|
|
42
|
+
return exportBundle;
|
|
43
|
+
}
|
|
44
|
+
exports.createExportBundle = createExportBundle;
|
|
45
|
+
/**
|
|
46
|
+
* Find original bundle entry for a given resource
|
|
47
|
+
*/
|
|
48
|
+
function findOriginalEntry(bundle, resource) {
|
|
49
|
+
if (!bundle.entry) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return bundle.entry.find(entry => entry.resource === resource || (entry.resource?.id && entry.resource.id === resource.id));
|
|
53
|
+
}
|
|
54
|
+
exports.findOriginalEntry = findOriginalEntry;
|
|
55
|
+
//# sourceMappingURL=bundle-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-operations.js","sourceRoot":"","sources":["../../src/internal/bundle-operations.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,iBAAiB,CAAC,aAA0B,EAAE,QAAkB;IAC9E,IAAI,aAAa,CAAC,OAAO,EAAE;QACzB,OAAO;YACL,OAAO,EAAE,aAAa,CAAC,OAAO;YAC9B,QAAQ,EAAE,QAAQ;SACnB,CAAC;KACH;IAED,OAAO;QACL,QAAQ,EAAE,QAAQ;KACnB,CAAC;AACJ,CAAC;AAXD,8CAWC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,cAAsB,EAAE,OAAsB;IAC/E,MAAM,YAAY,GAAW;QAC3B,YAAY,EAAE,QAAQ;QACtB,IAAI,EAAE,cAAc,CAAC,IAAI,IAAI,YAAY;QACzC,KAAK,EAAE,OAAO,CAAC,MAAM;QACrB,KAAK,EAAE,OAAO;KACf,CAAC;IAEF,6CAA6C;IAC7C,IAAI,cAAc,CAAC,EAAE,EAAE;QACrB,YAAY,CAAC,EAAE,GAAG,cAAc,CAAC,EAAE,CAAC;KACrC;IACD,IAAI,cAAc,CAAC,IAAI,EAAE;QACvB,YAAY,CAAC,IAAI,GAAG,EAAE,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC;KAChD;IACD,IAAI,cAAc,CAAC,UAAU,EAAE;QAC7B,YAAY,CAAC,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC;KACrD;IACD,IAAI,cAAc,CAAC,SAAS,EAAE;QAC5B,YAAY,CAAC,SAAS,GAAG,cAAc,CAAC,SAAS,CAAC;KACnD;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAvBD,gDAuBC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,MAAc,EAAE,QAAkB;IAClE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;QACjB,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CACtB,KAAK,CAAC,EAAE,CACN,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,CAAC,CAC3F,CAAC;AACJ,CAAC;AATD,8CASC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FHIR Coding System URLs and configuration for common coding systems
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Standard FHIR coding system URLs
|
|
6
|
+
*
|
|
7
|
+
* TODO: Add CPT, CVX, and many others.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CODING_SYSTEMS: {
|
|
10
|
+
readonly LOINC: "http://loinc.org";
|
|
11
|
+
readonly ICD10: "http://hl7.org/fhir/sid/icd-10-cm";
|
|
12
|
+
readonly SNOMED: "http://snomed.info/sct";
|
|
13
|
+
readonly RXNORM: "http://www.nlm.nih.gov/research/umls/rxnorm";
|
|
14
|
+
readonly NDC: "http://hl7.org/fhir/sid/ndc";
|
|
15
|
+
readonly CCSR: "https://hcup-us.ahrq.gov/toolssoftware/ccsr/ccs_refined.jsp";
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Configuration for dynamically generated coding system methods.
|
|
19
|
+
* Similar to RESOURCE_METHODS pattern in FhirBundleSdk.
|
|
20
|
+
*
|
|
21
|
+
* Each entry generates methods for both Coding and CodeableConcept:
|
|
22
|
+
* - Coding: is{System}()
|
|
23
|
+
* - CodeableConcept: get{System}(), get{System}Codings(), get{System}Code(), etc.
|
|
24
|
+
*/
|
|
25
|
+
export declare const CODING_SYSTEM_CONFIG: readonly [{
|
|
26
|
+
readonly systemName: "Loinc";
|
|
27
|
+
readonly systemUrl: "http://loinc.org";
|
|
28
|
+
}, {
|
|
29
|
+
readonly systemName: "Icd10";
|
|
30
|
+
readonly systemUrl: "http://hl7.org/fhir/sid/icd-10-cm";
|
|
31
|
+
}, {
|
|
32
|
+
readonly systemName: "Snomed";
|
|
33
|
+
readonly systemUrl: "http://snomed.info/sct";
|
|
34
|
+
}, {
|
|
35
|
+
readonly systemName: "RxNorm";
|
|
36
|
+
readonly systemUrl: "http://www.nlm.nih.gov/research/umls/rxnorm";
|
|
37
|
+
}, {
|
|
38
|
+
readonly systemName: "Ndc";
|
|
39
|
+
readonly systemUrl: "http://hl7.org/fhir/sid/ndc";
|
|
40
|
+
}, {
|
|
41
|
+
readonly systemName: "Ccsr";
|
|
42
|
+
readonly systemUrl: "https://hcup-us.ahrq.gov/toolssoftware/ccsr/ccs_refined.jsp";
|
|
43
|
+
}];
|
|
44
|
+
/**
|
|
45
|
+
* Type helper to extract system names from configuration
|
|
46
|
+
*/
|
|
47
|
+
export type CodingSystemName = (typeof CODING_SYSTEM_CONFIG)[number]["systemName"];
|
|
48
|
+
//# sourceMappingURL=coding-systems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-systems.d.ts","sourceRoot":"","sources":["../../src/internal/coding-systems.ts"],"names":[],"mappings":"AASA;;GAEG;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;CAOjB,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;EAyBvB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CODING_SYSTEM_CONFIG = exports.CODING_SYSTEMS = void 0;
|
|
4
|
+
const constants_1 = require("@metriport/shared/medical/fhir/constants");
|
|
5
|
+
/**
|
|
6
|
+
* FHIR Coding System URLs and configuration for common coding systems
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Standard FHIR coding system URLs
|
|
10
|
+
*
|
|
11
|
+
* TODO: Add CPT, CVX, and many others.
|
|
12
|
+
*/
|
|
13
|
+
exports.CODING_SYSTEMS = {
|
|
14
|
+
LOINC: constants_1.LOINC_URL,
|
|
15
|
+
ICD10: constants_1.ICD_10_URL,
|
|
16
|
+
SNOMED: constants_1.SNOMED_URL,
|
|
17
|
+
RXNORM: constants_1.RXNORM_URL,
|
|
18
|
+
NDC: constants_1.NDC_URL,
|
|
19
|
+
CCSR: constants_1.CONDITION_CCSR_CATEGORY_SYSTEM_URL,
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Configuration for dynamically generated coding system methods.
|
|
23
|
+
* Similar to RESOURCE_METHODS pattern in FhirBundleSdk.
|
|
24
|
+
*
|
|
25
|
+
* Each entry generates methods for both Coding and CodeableConcept:
|
|
26
|
+
* - Coding: is{System}()
|
|
27
|
+
* - CodeableConcept: get{System}(), get{System}Codings(), get{System}Code(), etc.
|
|
28
|
+
*/
|
|
29
|
+
exports.CODING_SYSTEM_CONFIG = [
|
|
30
|
+
{
|
|
31
|
+
systemName: "Loinc",
|
|
32
|
+
systemUrl: exports.CODING_SYSTEMS.LOINC,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
systemName: "Icd10",
|
|
36
|
+
systemUrl: exports.CODING_SYSTEMS.ICD10,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
systemName: "Snomed",
|
|
40
|
+
systemUrl: exports.CODING_SYSTEMS.SNOMED,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
systemName: "RxNorm",
|
|
44
|
+
systemUrl: exports.CODING_SYSTEMS.RXNORM,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
systemName: "Ndc",
|
|
48
|
+
systemUrl: exports.CODING_SYSTEMS.NDC,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
systemName: "Ccsr",
|
|
52
|
+
systemUrl: exports.CODING_SYSTEMS.CCSR,
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
//# sourceMappingURL=coding-systems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-systems.js","sourceRoot":"","sources":["../../src/internal/coding-systems.ts"],"names":[],"mappings":";;;AAAA,wEAOkD;AAElD;;GAEG;AAEH;;;;GAIG;AACU,QAAA,cAAc,GAAG;IAC5B,KAAK,EAAE,qBAAS;IAChB,KAAK,EAAE,sBAAU;IACjB,MAAM,EAAE,sBAAU;IAClB,MAAM,EAAE,sBAAU;IAClB,GAAG,EAAE,mBAAO;IACZ,IAAI,EAAE,8CAAkC;CAChC,CAAC;AAEX;;;;;;;GAOG;AACU,QAAA,oBAAoB,GAAG;IAClC;QACE,UAAU,EAAE,OAAO;QACnB,SAAS,EAAE,sBAAc,CAAC,KAAK;KAChC;IACD;QACE,UAAU,EAAE,OAAO;QACnB,SAAS,EAAE,sBAAc,CAAC,KAAK;KAChC;IACD;QACE,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,sBAAc,CAAC,MAAM;KACjC;IACD;QACE,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,sBAAc,CAAC,MAAM;KACjC;IACD;QACE,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,sBAAc,CAAC,GAAG;KAC9B;IACD;QACE,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,sBAAc,CAAC,IAAI;KAC/B;CACO,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Coding, CodeableConcept } from "@medplum/fhirtypes";
|
|
2
|
+
import { SmartCoding, SmartCodeableConcept } from "../types/smart-resources";
|
|
3
|
+
/**
|
|
4
|
+
* Type guard to check if a value is an Identifier object
|
|
5
|
+
* Identifiers have system like Coding, but also have use/value/period/assigner
|
|
6
|
+
* We check for system AND at least one Identifier-specific property to avoid false positives
|
|
7
|
+
*/
|
|
8
|
+
export declare function isIdentifier(value: unknown): value is import("@medplum/fhirtypes").Identifier;
|
|
9
|
+
/**
|
|
10
|
+
* Type guard to check if a value is a CodeableConcept object
|
|
11
|
+
* Must check this BEFORE isCoding since both can have overlapping properties
|
|
12
|
+
*/
|
|
13
|
+
export declare function isCodeableConcept(value: unknown): value is CodeableConcept;
|
|
14
|
+
/**
|
|
15
|
+
* Type guard to check if a value is a Coding object
|
|
16
|
+
* Check for Coding-specific properties and exclude CodeableConcept and Identifier
|
|
17
|
+
*/
|
|
18
|
+
export declare function isCoding(value: unknown): value is Coding;
|
|
19
|
+
/**
|
|
20
|
+
* Create a SmartCoding proxy with enhanced methods for checking coding systems
|
|
21
|
+
*/
|
|
22
|
+
export declare function createSmartCoding(coding: Coding): SmartCoding;
|
|
23
|
+
/**
|
|
24
|
+
* Create a SmartCodeableConcept proxy with enhanced methods for working with coding systems
|
|
25
|
+
*/
|
|
26
|
+
export declare function createSmartCodeableConcept(concept: CodeableConcept): SmartCodeableConcept;
|
|
27
|
+
//# sourceMappingURL=coding-utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-utilities.d.ts","sourceRoot":"","sources":["../../src/internal/coding-utilities.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAa7E;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,oBAAoB,EAAE,UAAU,CAO7F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAW1E;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAWxD;AAuDD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAsE7D;AAyFD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,eAAe,GAAG,oBAAoB,CAwFzF"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSmartCodeableConcept = exports.createSmartCoding = exports.isCoding = exports.isCodeableConcept = exports.isIdentifier = void 0;
|
|
4
|
+
const util_1 = require("util");
|
|
5
|
+
const coding_systems_1 = require("./coding-systems");
|
|
6
|
+
/**
|
|
7
|
+
* Cache for smart coding objects to maintain object identity
|
|
8
|
+
*/
|
|
9
|
+
const smartCodingCache = new WeakMap();
|
|
10
|
+
/**
|
|
11
|
+
* Cache for smart codeable concept objects to maintain object identity
|
|
12
|
+
*/
|
|
13
|
+
const smartCodeableConceptCache = new WeakMap();
|
|
14
|
+
/**
|
|
15
|
+
* Type guard to check if a value is an Identifier object
|
|
16
|
+
* Identifiers have system like Coding, but also have use/value/period/assigner
|
|
17
|
+
* We check for system AND at least one Identifier-specific property to avoid false positives
|
|
18
|
+
*/
|
|
19
|
+
function isIdentifier(value) {
|
|
20
|
+
if (typeof value !== "object" || value === null || Array.isArray(value) || !("system" in value)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
// Must have system (shared with Coding) AND at least one Identifier-specific property
|
|
24
|
+
return "use" in value || "assigner" in value || ("value" in value && "period" in value);
|
|
25
|
+
}
|
|
26
|
+
exports.isIdentifier = isIdentifier;
|
|
27
|
+
/**
|
|
28
|
+
* Type guard to check if a value is a CodeableConcept object
|
|
29
|
+
* Must check this BEFORE isCoding since both can have overlapping properties
|
|
30
|
+
*/
|
|
31
|
+
function isCodeableConcept(value) {
|
|
32
|
+
return (typeof value === "object" &&
|
|
33
|
+
value !== null &&
|
|
34
|
+
!Array.isArray(value) &&
|
|
35
|
+
("coding" in value || "text" in value) &&
|
|
36
|
+
// Exclude Reference objects which also have optional text
|
|
37
|
+
!("reference" in value) &&
|
|
38
|
+
// Exclude Identifier objects
|
|
39
|
+
!isIdentifier(value));
|
|
40
|
+
}
|
|
41
|
+
exports.isCodeableConcept = isCodeableConcept;
|
|
42
|
+
/**
|
|
43
|
+
* Type guard to check if a value is a Coding object
|
|
44
|
+
* Check for Coding-specific properties and exclude CodeableConcept and Identifier
|
|
45
|
+
*/
|
|
46
|
+
function isCoding(value) {
|
|
47
|
+
return (typeof value === "object" &&
|
|
48
|
+
value !== null &&
|
|
49
|
+
!Array.isArray(value) &&
|
|
50
|
+
("system" in value || "display" in value) &&
|
|
51
|
+
// Make sure it's not a CodeableConcept
|
|
52
|
+
!("coding" in value || "text" in value) &&
|
|
53
|
+
// Make sure it's not an Identifier (which also has system)
|
|
54
|
+
!isIdentifier(value));
|
|
55
|
+
}
|
|
56
|
+
exports.isCoding = isCoding;
|
|
57
|
+
/**
|
|
58
|
+
* Helper function to check if a coding belongs to a specific system
|
|
59
|
+
*/
|
|
60
|
+
function isSystem(coding, systemUrl) {
|
|
61
|
+
return coding.system === systemUrl;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Helper function to check if a coding's code matches a specific value
|
|
65
|
+
*/
|
|
66
|
+
function matchesCode(coding, code) {
|
|
67
|
+
return coding.code === code;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Helper function to check if a coding's code matches any of the provided values
|
|
71
|
+
*/
|
|
72
|
+
function matchesCodes(coding, codes) {
|
|
73
|
+
return coding.code !== undefined && codes.includes(coding.code);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get all virtual method names for SmartCoding
|
|
77
|
+
*/
|
|
78
|
+
function getSmartCodingVirtualMethods() {
|
|
79
|
+
const methods = [];
|
|
80
|
+
for (const { systemName } of coding_systems_1.CODING_SYSTEM_CONFIG) {
|
|
81
|
+
methods.push(`is${systemName}`);
|
|
82
|
+
}
|
|
83
|
+
methods.push("matchesCode", "matchesCodes");
|
|
84
|
+
return methods;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get all virtual method names for SmartCodeableConcept
|
|
88
|
+
*/
|
|
89
|
+
function getSmartCodeableConceptVirtualMethods() {
|
|
90
|
+
const methods = [];
|
|
91
|
+
for (const { systemName } of coding_systems_1.CODING_SYSTEM_CONFIG) {
|
|
92
|
+
methods.push(`get${systemName}`, `get${systemName}Codings`, `get${systemName}Code`, `get${systemName}Codes`, `has${systemName}`, `has${systemName}Code`, `hasSome${systemName}`, `find${systemName}Coding`);
|
|
93
|
+
}
|
|
94
|
+
return methods;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Create a SmartCoding proxy with enhanced methods for checking coding systems
|
|
98
|
+
*/
|
|
99
|
+
function createSmartCoding(coding) {
|
|
100
|
+
// Check cache first to maintain object identity
|
|
101
|
+
const cached = smartCodingCache.get(coding);
|
|
102
|
+
if (cached) {
|
|
103
|
+
return cached;
|
|
104
|
+
}
|
|
105
|
+
const virtualMethods = getSmartCodingVirtualMethods();
|
|
106
|
+
const smartCoding = new Proxy(coding, {
|
|
107
|
+
get: (target, prop, receiver) => {
|
|
108
|
+
// Handle system checking methods
|
|
109
|
+
for (const { systemName, systemUrl } of coding_systems_1.CODING_SYSTEM_CONFIG) {
|
|
110
|
+
if (prop === `is${systemName}`) {
|
|
111
|
+
return () => isSystem(target, systemUrl);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Handle code matching methods
|
|
115
|
+
if (prop === "matchesCode") {
|
|
116
|
+
return (code) => matchesCode(target, code);
|
|
117
|
+
}
|
|
118
|
+
if (prop === "matchesCodes") {
|
|
119
|
+
return (codes) => matchesCodes(target, codes);
|
|
120
|
+
}
|
|
121
|
+
// Handle Symbol.toStringTag for better console display
|
|
122
|
+
if (prop === Symbol.toStringTag) {
|
|
123
|
+
return "SmartCoding";
|
|
124
|
+
}
|
|
125
|
+
// Handle toJSON for serialization
|
|
126
|
+
if (prop === "toJSON") {
|
|
127
|
+
return () => target;
|
|
128
|
+
}
|
|
129
|
+
// Handle Node.js util.inspect.custom for console.log
|
|
130
|
+
if (prop === util_1.inspect.custom) {
|
|
131
|
+
return () => target;
|
|
132
|
+
}
|
|
133
|
+
// Return original property
|
|
134
|
+
return Reflect.get(target, prop, receiver);
|
|
135
|
+
},
|
|
136
|
+
ownKeys: target => {
|
|
137
|
+
const keys = Reflect.ownKeys(target);
|
|
138
|
+
return [...keys, ...virtualMethods];
|
|
139
|
+
},
|
|
140
|
+
getOwnPropertyDescriptor: (target, prop) => {
|
|
141
|
+
if (typeof prop === "string" && virtualMethods.includes(prop)) {
|
|
142
|
+
return {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
configurable: true,
|
|
145
|
+
writable: false,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (prop === Symbol.toStringTag || prop === "toJSON" || prop === util_1.inspect.custom) {
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
// Cache the smart coding
|
|
155
|
+
smartCodingCache.set(coding, smartCoding);
|
|
156
|
+
return smartCoding;
|
|
157
|
+
}
|
|
158
|
+
exports.createSmartCoding = createSmartCoding;
|
|
159
|
+
/**
|
|
160
|
+
* Helper functions for CodeableConcept methods
|
|
161
|
+
*/
|
|
162
|
+
function getFirstCodingForSystem(codings, systemUrl) {
|
|
163
|
+
if (!codings) {
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
const coding = codings.find(c => c.system === systemUrl);
|
|
167
|
+
return coding ? createSmartCoding(coding) : undefined;
|
|
168
|
+
}
|
|
169
|
+
function getAllCodingsForSystem(codings, systemUrl) {
|
|
170
|
+
if (!codings) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
return codings.filter(c => c.system === systemUrl).map(c => createSmartCoding(c));
|
|
174
|
+
}
|
|
175
|
+
function getFirstCodeForSystem(codings, systemUrl) {
|
|
176
|
+
if (!codings) {
|
|
177
|
+
return undefined;
|
|
178
|
+
}
|
|
179
|
+
const coding = codings.find(c => c.system === systemUrl);
|
|
180
|
+
return coding?.code;
|
|
181
|
+
}
|
|
182
|
+
function getAllCodesForSystem(codings, systemUrl) {
|
|
183
|
+
if (!codings) {
|
|
184
|
+
return [];
|
|
185
|
+
}
|
|
186
|
+
return codings
|
|
187
|
+
.filter(c => c.system === systemUrl)
|
|
188
|
+
.map(c => c.code)
|
|
189
|
+
.filter((c) => c !== undefined);
|
|
190
|
+
}
|
|
191
|
+
function hasAnyForSystem(codings, systemUrl) {
|
|
192
|
+
if (!codings) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
return codings.some(c => c.system === systemUrl);
|
|
196
|
+
}
|
|
197
|
+
function hasSpecificCodeForSystem(codings, systemUrl, code) {
|
|
198
|
+
if (!codings) {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
return codings.some(c => c.system === systemUrl && c.code === code);
|
|
202
|
+
}
|
|
203
|
+
function hasSomeCodesForSystem(codings, systemUrl, codes) {
|
|
204
|
+
if (!codings) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
return codings.some(c => c.system === systemUrl && c.code !== undefined && codes.includes(c.code));
|
|
208
|
+
}
|
|
209
|
+
function findCodingForSystem(codings, systemUrl, predicate) {
|
|
210
|
+
if (!codings) {
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
const coding = codings.find(c => c.system === systemUrl && c.code !== undefined && predicate(c.code));
|
|
214
|
+
return coding ? createSmartCoding(coding) : undefined;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Create a SmartCodeableConcept proxy with enhanced methods for working with coding systems
|
|
218
|
+
*/
|
|
219
|
+
function createSmartCodeableConcept(concept) {
|
|
220
|
+
// Check cache first to maintain object identity
|
|
221
|
+
const cached = smartCodeableConceptCache.get(concept);
|
|
222
|
+
if (cached) {
|
|
223
|
+
return cached;
|
|
224
|
+
}
|
|
225
|
+
const virtualMethods = getSmartCodeableConceptVirtualMethods();
|
|
226
|
+
const smartConcept = new Proxy(concept, {
|
|
227
|
+
get: (target, prop, receiver) => {
|
|
228
|
+
// Handle coding array - wrap each Coding in SmartCoding
|
|
229
|
+
if (prop === "coding" && target.coding) {
|
|
230
|
+
return target.coding.map(c => createSmartCoding(c));
|
|
231
|
+
}
|
|
232
|
+
// Generate methods for each coding system
|
|
233
|
+
for (const { systemName, systemUrl } of coding_systems_1.CODING_SYSTEM_CONFIG) {
|
|
234
|
+
if (prop === `get${systemName}`) {
|
|
235
|
+
return () => getFirstCodingForSystem(target.coding, systemUrl);
|
|
236
|
+
}
|
|
237
|
+
if (prop === `get${systemName}Codings`) {
|
|
238
|
+
return () => getAllCodingsForSystem(target.coding, systemUrl);
|
|
239
|
+
}
|
|
240
|
+
if (prop === `get${systemName}Code`) {
|
|
241
|
+
return () => getFirstCodeForSystem(target.coding, systemUrl);
|
|
242
|
+
}
|
|
243
|
+
if (prop === `get${systemName}Codes`) {
|
|
244
|
+
return () => getAllCodesForSystem(target.coding, systemUrl);
|
|
245
|
+
}
|
|
246
|
+
if (prop === `has${systemName}`) {
|
|
247
|
+
return () => hasAnyForSystem(target.coding, systemUrl);
|
|
248
|
+
}
|
|
249
|
+
if (prop === `has${systemName}Code`) {
|
|
250
|
+
return (code) => hasSpecificCodeForSystem(target.coding, systemUrl, code);
|
|
251
|
+
}
|
|
252
|
+
if (prop === `hasSome${systemName}`) {
|
|
253
|
+
return (codes) => hasSomeCodesForSystem(target.coding, systemUrl, codes);
|
|
254
|
+
}
|
|
255
|
+
if (prop === `find${systemName}Coding`) {
|
|
256
|
+
return (predicate) => findCodingForSystem(target.coding, systemUrl, predicate);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
// Handle Symbol.toStringTag for better console display
|
|
260
|
+
if (prop === Symbol.toStringTag) {
|
|
261
|
+
return "SmartCodeableConcept";
|
|
262
|
+
}
|
|
263
|
+
// Handle toJSON for serialization
|
|
264
|
+
if (prop === "toJSON") {
|
|
265
|
+
return () => target;
|
|
266
|
+
}
|
|
267
|
+
// Handle Node.js util.inspect.custom for console.log
|
|
268
|
+
if (prop === util_1.inspect.custom) {
|
|
269
|
+
return () => target;
|
|
270
|
+
}
|
|
271
|
+
// Return original property
|
|
272
|
+
return Reflect.get(target, prop, receiver);
|
|
273
|
+
},
|
|
274
|
+
ownKeys: target => {
|
|
275
|
+
const keys = Reflect.ownKeys(target);
|
|
276
|
+
return [...keys, ...virtualMethods];
|
|
277
|
+
},
|
|
278
|
+
getOwnPropertyDescriptor: (target, prop) => {
|
|
279
|
+
if (typeof prop === "string" && virtualMethods.includes(prop)) {
|
|
280
|
+
return {
|
|
281
|
+
enumerable: true,
|
|
282
|
+
configurable: true,
|
|
283
|
+
writable: false,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
if (prop === Symbol.toStringTag || prop === "toJSON" || prop === util_1.inspect.custom) {
|
|
287
|
+
return undefined;
|
|
288
|
+
}
|
|
289
|
+
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
// Cache the smart codeable concept
|
|
293
|
+
smartCodeableConceptCache.set(concept, smartConcept);
|
|
294
|
+
return smartConcept;
|
|
295
|
+
}
|
|
296
|
+
exports.createSmartCodeableConcept = createSmartCodeableConcept;
|
|
297
|
+
//# sourceMappingURL=coding-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-utilities.js","sourceRoot":"","sources":["../../src/internal/coding-utilities.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAG/B,qDAAwD;AAExD;;GAEG;AACH,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAuB,CAAC;AAE5D;;GAEG;AACH,MAAM,yBAAyB,GAAG,IAAI,OAAO,EAAyC,CAAC;AAEvF;;;;GAIG;AACH,SAAgB,YAAY,CAAC,KAAc;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC,EAAE;QAC/F,OAAO,KAAK,CAAC;KACd;IAED,sFAAsF;IACtF,OAAO,KAAK,IAAI,KAAK,IAAI,UAAU,IAAI,KAAK,IAAI,CAAC,OAAO,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC,CAAC;AAC1F,CAAC;AAPD,oCAOC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,KAAc;IAC9C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrB,CAAC,QAAQ,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC;QACtC,0DAA0D;QAC1D,CAAC,CAAC,WAAW,IAAI,KAAK,CAAC;QACvB,6BAA6B;QAC7B,CAAC,YAAY,CAAC,KAAK,CAAC,CACrB,CAAC;AACJ,CAAC;AAXD,8CAWC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,CACL,OAAO,KAAK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;aACH;YACD,IAAI,IAAI,KAAK,MAAM,CAAC,WAAW,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,cAAO,CAAC,MAAM,EAAE;gBAC/E,OAAO,SAAS,CAAC;aAClB;YACD,OAAO,OAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACxD,CAAC;KACF,CAAyB,CAAC;IAE3B,mCAAmC;IACnC,yBAAyB,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAErD,OAAO,YAAY,CAAC;AACtB,CAAC;AAxFD,gEAwFC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Resource } from "@medplum/fhirtypes";
|
|
2
|
+
import { DateIndexRecord } from "../types/sdk-types";
|
|
3
|
+
/**
|
|
4
|
+
* Parse date string to milliseconds timestamp, with validation
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseDate(dateString: string | undefined): number | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Extract date intervals from a resource based on its type
|
|
9
|
+
* Returns array of date intervals with metadata
|
|
10
|
+
*/
|
|
11
|
+
export declare function extractDateIntervalsFromResource(resource: Resource): DateIndexRecord[];
|
|
12
|
+
//# sourceMappingURL=date-extraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-extraction.d.ts","sourceRoot":"","sources":["../../src/internal/date-extraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgDT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;GAEG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAkB5E;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe,EAAE,CA8nBtF"}
|