@metriport/shared 0.33.6-alpha.0 → 0.33.7-alpha.0
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/dist/common/__tests__/transliterate.test.d.ts +2 -0
- package/dist/common/__tests__/transliterate.test.d.ts.map +1 -0
- package/dist/common/__tests__/transliterate.test.js +18 -0
- package/dist/common/__tests__/transliterate.test.js.map +1 -0
- package/dist/common/transliterate.d.ts +6 -0
- package/dist/common/transliterate.d.ts.map +1 -0
- package/dist/common/transliterate.js +14 -0
- package/dist/common/transliterate.js.map +1 -0
- package/dist/domain/__tests__/cohort-purpose-of-use-hies.test.d.ts +2 -0
- package/dist/domain/__tests__/cohort-purpose-of-use-hies.test.d.ts.map +1 -0
- package/dist/domain/__tests__/cohort-purpose-of-use-hies.test.js +10 -0
- package/dist/domain/__tests__/cohort-purpose-of-use-hies.test.js.map +1 -0
- package/dist/domain/__tests__/cohort-response-dto.test.d.ts +2 -0
- package/dist/domain/__tests__/cohort-response-dto.test.d.ts.map +1 -0
- package/dist/domain/__tests__/cohort-response-dto.test.js +59 -0
- package/dist/domain/__tests__/cohort-response-dto.test.js.map +1 -0
- package/dist/domain/cohort-purpose-of-use-hies.d.ts +3 -0
- package/dist/domain/cohort-purpose-of-use-hies.d.ts.map +1 -0
- package/dist/domain/cohort-purpose-of-use-hies.js +11 -0
- package/dist/domain/cohort-purpose-of-use-hies.js.map +1 -0
- package/dist/domain/patient/patient-status.d.ts +13 -0
- package/dist/domain/patient/patient-status.d.ts.map +1 -0
- package/dist/domain/patient/patient-status.js +9 -0
- package/dist/domain/patient/patient-status.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transliterate.test.d.ts","sourceRoot":"","sources":["../../../src/common/__tests__/transliterate.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const transliterate_1 = require("../transliterate");
|
|
4
|
+
describe("transliterateAccents", () => {
|
|
5
|
+
it("should strip accents from letters", () => {
|
|
6
|
+
expect((0, transliterate_1.transliterateAccents)("José")).toBe("Jose");
|
|
7
|
+
expect((0, transliterate_1.transliterateAccents)("Muñoz")).toBe("Munoz");
|
|
8
|
+
expect((0, transliterate_1.transliterateAccents)("Española")).toBe("Espanola");
|
|
9
|
+
expect((0, transliterate_1.transliterateAccents)("Vía")).toBe("Via");
|
|
10
|
+
});
|
|
11
|
+
it("should not strip digits, punctuation, or symbols", () => {
|
|
12
|
+
expect((0, transliterate_1.transliterateAccents)("123 Main St")).toBe("123 Main St");
|
|
13
|
+
expect((0, transliterate_1.transliterateAccents)("Mary-Jane")).toBe("Mary-Jane");
|
|
14
|
+
expect((0, transliterate_1.transliterateAccents)("O'Brien")).toBe("O'Brien");
|
|
15
|
+
expect((0, transliterate_1.transliterateAccents)("123 ↑ Main")).toBe("123 ↑ Main");
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=transliterate.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transliterate.test.js","sourceRoot":"","sources":["../../../src/common/__tests__/transliterate.test.ts"],"names":[],"mappings":";;AAAA,oDAAwD;AAExD,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,CAAC,IAAA,oCAAoB,EAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClD,MAAM,CAAC,IAAA,oCAAoB,EAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,CAAC,IAAA,oCAAoB,EAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1D,MAAM,CAAC,IAAA,oCAAoB,EAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,CAAC,IAAA,oCAAoB,EAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAChE,MAAM,CAAC,IAAA,oCAAoB,EAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC5D,MAAM,CAAC,IAAA,oCAAoB,EAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxD,MAAM,CAAC,IAAA,oCAAoB,EAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decomposes accented characters into base letters plus combining marks, then strips the marks.
|
|
3
|
+
* E.g. "José" → "Jose", "Española" → "Espanola".
|
|
4
|
+
*/
|
|
5
|
+
export declare function transliterateAccents(value: string): string;
|
|
6
|
+
//# sourceMappingURL=transliterate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transliterate.d.ts","sourceRoot":"","sources":["../../src/common/transliterate.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transliterateAccents = transliterateAccents;
|
|
4
|
+
// Unicode "Combining Diacritical Marks" block (U+0300–U+036F). After NFD normalization,
|
|
5
|
+
// accents are separate code points (e.g. "é" → "e" + U+0301 acute); this strips them.
|
|
6
|
+
const combiningMarksPattern = /[\u0300-\u036f]/g;
|
|
7
|
+
/**
|
|
8
|
+
* Decomposes accented characters into base letters plus combining marks, then strips the marks.
|
|
9
|
+
* E.g. "José" → "Jose", "Española" → "Espanola".
|
|
10
|
+
*/
|
|
11
|
+
function transliterateAccents(value) {
|
|
12
|
+
return value.normalize("NFD").replace(combiningMarksPattern, "");
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=transliterate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transliterate.js","sourceRoot":"","sources":["../../src/common/transliterate.ts"],"names":[],"mappings":";;;AAAA,wFAAwF;AACxF,sFAAsF;AACtF,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEjD;;;GAGG;AACH,8BAAqC,KAAa;IAChD,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cohort-purpose-of-use-hies.test.d.ts","sourceRoot":"","sources":["../../../src/domain/__tests__/cohort-purpose-of-use-hies.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const constants_1 = require("../../external/hl7v2/constants");
|
|
4
|
+
const cohort_purpose_of_use_hies_1 = require("../cohort-purpose-of-use-hies");
|
|
5
|
+
describe("cohort-purpose-of-use-hies", () => {
|
|
6
|
+
it("defines ops ADT HIE allowlist", () => {
|
|
7
|
+
expect(cohort_purpose_of_use_hies_1.OPS_ADT_HIE_NAMES).toEqual([constants_1.HieName.Bamboo, constants_1.HieName.Riqi, constants_1.HieName.Pcc, constants_1.HieName.Konza]);
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=cohort-purpose-of-use-hies.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cohort-purpose-of-use-hies.test.js","sourceRoot":"","sources":["../../../src/domain/__tests__/cohort-purpose-of-use-hies.test.ts"],"names":[],"mappings":";;AAAA,8DAAyD;AACzD,8EAAkE;AAElE,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,8CAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,mBAAO,CAAC,MAAM,EAAE,mBAAO,CAAC,IAAI,EAAE,mBAAO,CAAC,GAAG,EAAE,mBAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAChG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cohort-response-dto.test.d.ts","sourceRoot":"","sources":["../../../src/domain/__tests__/cohort-response-dto.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cohort_1 = require("../cohort");
|
|
4
|
+
const now = new Date("2024-01-01T12:00:00Z");
|
|
5
|
+
const cohortBase = {
|
|
6
|
+
id: "cohort-id",
|
|
7
|
+
eTag: "1",
|
|
8
|
+
cxId: "cx-id",
|
|
9
|
+
name: "Test Cohort",
|
|
10
|
+
color: "red",
|
|
11
|
+
description: "Test description",
|
|
12
|
+
createdAt: now,
|
|
13
|
+
updatedAt: now,
|
|
14
|
+
};
|
|
15
|
+
describe("resolveCohortPurposeOfUseForResponse", () => {
|
|
16
|
+
it("returns explicit purposeOfUse when set", () => {
|
|
17
|
+
expect((0, cohort_1.resolveCohortPurposeOfUseForResponse)("operations")).toBe("operations");
|
|
18
|
+
});
|
|
19
|
+
it("defaults to treatment when purposeOfUse is missing", () => {
|
|
20
|
+
expect((0, cohort_1.resolveCohortPurposeOfUseForResponse)(undefined)).toBe("treatment");
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
describe("responseDtoFromCohort", () => {
|
|
24
|
+
it("includes purposeOfUse when set on domain cohort", () => {
|
|
25
|
+
const response = (0, cohort_1.responseDtoFromCohort)({
|
|
26
|
+
...cohortBase,
|
|
27
|
+
purposeOfUse: "operations",
|
|
28
|
+
settings: {
|
|
29
|
+
monitoring: cohort_1.DEFAULT_MONITORING,
|
|
30
|
+
overrides: cohort_1.DEFAULT_OVERRIDES,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
expect(response.purposeOfUse).toBe("operations");
|
|
34
|
+
expect(response.settings.monitoring).toEqual(cohort_1.DEFAULT_MONITORING);
|
|
35
|
+
});
|
|
36
|
+
it("defaults purposeOfUse to treatment when missing", () => {
|
|
37
|
+
const response = (0, cohort_1.responseDtoFromCohort)({
|
|
38
|
+
...cohortBase,
|
|
39
|
+
purposeOfUse: "treatment",
|
|
40
|
+
settings: {
|
|
41
|
+
monitoring: cohort_1.DEFAULT_MONITORING,
|
|
42
|
+
overrides: cohort_1.DEFAULT_OVERRIDES,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
expect(response.purposeOfUse).toBe("treatment");
|
|
46
|
+
});
|
|
47
|
+
it("strips overrides from public response", () => {
|
|
48
|
+
const response = (0, cohort_1.responseDtoFromCohort)({
|
|
49
|
+
...cohortBase,
|
|
50
|
+
purposeOfUse: "treatment",
|
|
51
|
+
settings: {
|
|
52
|
+
monitoring: cohort_1.DEFAULT_MONITORING,
|
|
53
|
+
overrides: { [cohort_1.STATE_VALIDATION_OVERRIDE_KEY]: true },
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
expect(response.settings).not.toHaveProperty("overrides");
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=cohort-response-dto.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cohort-response-dto.test.js","sourceRoot":"","sources":["../../../src/domain/__tests__/cohort-response-dto.test.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AAE;QACzD,MAAM,QAAQ,GAAG,IAAA,8BAAqB,EAAC;YACrC,GAAG,UAAU;YACb,YAAY,EAAE,WAAW;YACzB,QAAQ,EAAE;gBACR,UAAU,EAAE,2BAAkB;gBAC9B,SAAS,EAAE,0BAAiB;aAC7B;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,QAAQ,GAAG,IAAA,8BAAqB,EAAC;YACrC,GAAG,UAAU;YACb,YAAY,EAAE,WAAW;YACzB,QAAQ,EAAE;gBACR,UAAU,EAAE,2BAAkB;gBAC9B,SAAS,EAAE,EAAE,CAAC,sCAA6B,CAAC,EAAE,IAAI,EAAE;aACrD;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cohort-purpose-of-use-hies.d.ts","sourceRoot":"","sources":["../../src/domain/cohort-purpose-of-use-hies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,eAAO,MAAM,iBAAiB,EAAE,SAAS,OAAO,EAK/C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OPS_ADT_HIE_NAMES = void 0;
|
|
4
|
+
const constants_1 = require("../external/hl7v2/constants");
|
|
5
|
+
exports.OPS_ADT_HIE_NAMES = [
|
|
6
|
+
constants_1.HieName.Bamboo,
|
|
7
|
+
constants_1.HieName.Riqi,
|
|
8
|
+
constants_1.HieName.Pcc,
|
|
9
|
+
constants_1.HieName.Konza,
|
|
10
|
+
];
|
|
11
|
+
//# sourceMappingURL=cohort-purpose-of-use-hies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cohort-purpose-of-use-hies.js","sourceRoot":"","sources":["../../src/domain/cohort-purpose-of-use-hies.ts"],"names":[],"mappings":";;;AAAA,2DAAsD;AAEzC,QAAA,iBAAiB,GAAuB;IACnD,mBAAO,CAAC,MAAM;IACd,mBAAO,CAAC,IAAI;IACZ,mBAAO,CAAC,GAAG;IACX,mBAAO,CAAC,KAAK;CACd,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const patientStatusSchema: z.ZodObject<{
|
|
3
|
+
hieOptOut: z.ZodOptional<z.ZodBoolean>;
|
|
4
|
+
treatmentRelationship: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
hieOptOut?: boolean | undefined;
|
|
7
|
+
treatmentRelationship?: boolean | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
hieOptOut?: boolean | undefined;
|
|
10
|
+
treatmentRelationship?: boolean | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export type PatientStatus = z.infer<typeof patientStatusSchema>;
|
|
13
|
+
//# sourceMappingURL=patient-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patient-status.d.ts","sourceRoot":"","sources":["../../../src/domain/patient/patient-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;;;;;;;EAG9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.patientStatusSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.patientStatusSchema = zod_1.z.object({
|
|
6
|
+
hieOptOut: zod_1.z.boolean().optional(),
|
|
7
|
+
treatmentRelationship: zod_1.z.boolean().optional(),
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=patient-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patient-status.js","sourceRoot":"","sources":["../../../src/domain/patient/patient-status.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACjC,qBAAqB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC9C,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metriport/shared",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.7-alpha.0",
|
|
4
4
|
"description": "Common code shared across packages - by Metriport Inc.",
|
|
5
5
|
"author": "Metriport Inc. <contact@metriport.com>",
|
|
6
6
|
"homepage": "https://metriport.com/",
|
|
@@ -165,5 +165,5 @@
|
|
|
165
165
|
"ts-jest": "29.4.11",
|
|
166
166
|
"typescript": "6.0.3"
|
|
167
167
|
},
|
|
168
|
-
"gitHead": "
|
|
168
|
+
"gitHead": "d543b33f8f53cba4b3b5ae800899ea775b41af7a"
|
|
169
169
|
}
|