@metriport/shared 0.23.10-alpha.0 → 0.23.10
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/domain/job/types.d.ts +1 -1
- package/dist/domain/job/types.d.ts.map +1 -1
- package/dist/domain/patient/patient-monitoring/__tests__/utils.test.d.ts +2 -0
- package/dist/domain/patient/patient-monitoring/__tests__/utils.test.d.ts.map +1 -0
- package/dist/domain/patient/patient-monitoring/__tests__/utils.test.js +66 -0
- package/dist/domain/patient/patient-monitoring/__tests__/utils.test.js.map +1 -0
- package/dist/domain/patient/patient-monitoring/discharge-requery.d.ts +47 -0
- package/dist/domain/patient/patient-monitoring/discharge-requery.d.ts.map +1 -0
- package/dist/domain/patient/patient-monitoring/discharge-requery.js +32 -0
- package/dist/domain/patient/patient-monitoring/discharge-requery.js.map +1 -0
- package/dist/domain/patient/patient-monitoring/utils.d.ts +11 -0
- package/dist/domain/patient/patient-monitoring/utils.d.ts.map +1 -0
- package/dist/domain/patient/patient-monitoring/utils.js +43 -0
- package/dist/domain/patient/patient-monitoring/utils.js.map +1 -0
- package/dist/interface/external/surescripts/payment-code.d.ts +8 -0
- package/dist/interface/external/surescripts/payment-code.d.ts.map +1 -1
- package/dist/interface/external/surescripts/payment-code.js +54 -1
- package/dist/interface/external/surescripts/payment-code.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export type JobParamsCx = Record<string, string | boolean>;
|
|
3
|
-
export type JobParamsOps = Record<string, string | boolean>;
|
|
3
|
+
export type JobParamsOps = Record<string, string | boolean | number>;
|
|
4
4
|
declare const failed: "failed";
|
|
5
5
|
declare const successful: "successful";
|
|
6
6
|
export type JobEntryStatus = typeof failed | typeof successful;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/domain/job/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/domain/job/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;AAErE,QAAA,MAAM,MAAM,UAAoB,CAAC;AACjC,QAAA,MAAM,UAAU,cAAwB,CAAC;AACzC,MAAM,MAAM,cAAc,GAAG,OAAO,MAAM,GAAG,OAAO,UAAU,CAAC;AAE/D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,cAAc,CAE9E;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;EAG3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../../../../src/domain/patient/patient-monitoring/__tests__/utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
describe("patientMonitoringUtils", () => {
|
|
9
|
+
describe("calculateNextScheduledAt", () => {
|
|
10
|
+
// Mock the current date to ensure consistent test results
|
|
11
|
+
const mockDate = new Date("2024-01-01T12:00:00Z");
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
jest.useFakeTimers();
|
|
14
|
+
jest.setSystemTime(mockDate);
|
|
15
|
+
});
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
jest.useRealTimers();
|
|
18
|
+
});
|
|
19
|
+
afterAll(() => {
|
|
20
|
+
jest.useRealTimers();
|
|
21
|
+
});
|
|
22
|
+
it("should calculate correct time for first attempt (5 minutes)", () => {
|
|
23
|
+
const result = (0, utils_1.calculateScheduledAt)(6);
|
|
24
|
+
expect(result).toEqual((0, dayjs_1.default)(mockDate).add(utils_1.backoffOne).toDate());
|
|
25
|
+
});
|
|
26
|
+
it("should calculate correct time for second attempt (30 minutes)", () => {
|
|
27
|
+
const result = (0, utils_1.calculateScheduledAt)(5);
|
|
28
|
+
expect(result).toEqual((0, dayjs_1.default)(mockDate).add(utils_1.backoffTwo).toDate());
|
|
29
|
+
});
|
|
30
|
+
it("should calculate correct time for third attempt (4 hours)", () => {
|
|
31
|
+
const result = (0, utils_1.calculateScheduledAt)(4);
|
|
32
|
+
expect(result).toEqual((0, dayjs_1.default)(mockDate).add(utils_1.backoffThree).toDate());
|
|
33
|
+
});
|
|
34
|
+
it("should calculate correct time for fourth attempt (1 day)", () => {
|
|
35
|
+
const result = (0, utils_1.calculateScheduledAt)(3);
|
|
36
|
+
expect(result).toEqual((0, dayjs_1.default)(mockDate).add(utils_1.backoffFour).toDate());
|
|
37
|
+
});
|
|
38
|
+
it("should calculate correct time for fifth attempt (2 days)", () => {
|
|
39
|
+
const result = (0, utils_1.calculateScheduledAt)(2);
|
|
40
|
+
expect(result).toEqual((0, dayjs_1.default)(mockDate).add(utils_1.backoffFive).toDate());
|
|
41
|
+
});
|
|
42
|
+
it("should calculate correct time for sixth attempt (4 days)", () => {
|
|
43
|
+
const result = (0, utils_1.calculateScheduledAt)(1);
|
|
44
|
+
expect(result).toEqual((0, dayjs_1.default)(mockDate).add(utils_1.backoffSix).toDate());
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe("pickLargestRemainingAttempts", () => {
|
|
48
|
+
it("should return the largest remaining attempts", () => {
|
|
49
|
+
const result = (0, utils_1.pickLargestRemainingAttempts)(1, 2);
|
|
50
|
+
expect(result).toEqual(2);
|
|
51
|
+
});
|
|
52
|
+
it("should return the largest remaining attempts when both are the same", () => {
|
|
53
|
+
const result = (0, utils_1.pickLargestRemainingAttempts)(2, 2);
|
|
54
|
+
expect(result).toEqual(2);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
describe("pickClosestScheduledAt", () => {
|
|
58
|
+
it("should return the closest scheduled at", () => {
|
|
59
|
+
const date1 = new Date("2024-01-01T12:00:00Z");
|
|
60
|
+
const date2 = new Date("2024-01-01T12:05:00Z");
|
|
61
|
+
const result = (0, utils_1.pickEarliestScheduledAt)(date1, date2);
|
|
62
|
+
expect(result).toEqual(date1);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=utils.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.js","sourceRoot":"","sources":["../../../../../src/domain/patient/patient-monitoring/__tests__/utils.test.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,oCAUkB;AAElB,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACxC,0DAA0D;QAC1D,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAElD,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QAEH,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,CAAC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,IAAI,CAAC,sBAAsB,CAAC,CAAC;YAE/C,MAAM,MAAM,GAAG,IAAA,+BAAuB,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACrD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PatientJob } from "../../../domain/job/patient-job";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const remainingAttemptsSchema: z.ZodNumber;
|
|
4
|
+
export declare const createDischargeRequeryParamsSchema: z.ZodObject<{
|
|
5
|
+
patientId: z.ZodString;
|
|
6
|
+
cxId: z.ZodString;
|
|
7
|
+
remainingAttempts: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
cxId: string;
|
|
10
|
+
patientId: string;
|
|
11
|
+
remainingAttempts?: number | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
cxId: string;
|
|
14
|
+
patientId: string;
|
|
15
|
+
remainingAttempts?: number | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export type CreateDischargeRequeryParams = z.infer<typeof createDischargeRequeryParamsSchema>;
|
|
18
|
+
export declare const dischargeRequeryParamsOpsSchema: z.ZodObject<{
|
|
19
|
+
remainingAttempts: z.ZodNumber;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
remainingAttempts: number;
|
|
22
|
+
}, {
|
|
23
|
+
remainingAttempts: number;
|
|
24
|
+
}>;
|
|
25
|
+
export type DischargeRequeryParamsOps = z.infer<typeof dischargeRequeryParamsOpsSchema>;
|
|
26
|
+
export declare const dischargeRequeryRuntimeDataSchema: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
documentQueryRequestId: z.ZodOptional<z.ZodString>;
|
|
28
|
+
downloadCount: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
convertCount: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
documentQueryRequestId?: string | undefined;
|
|
32
|
+
downloadCount?: number | undefined;
|
|
33
|
+
convertCount?: number | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
documentQueryRequestId?: string | undefined;
|
|
36
|
+
downloadCount?: number | undefined;
|
|
37
|
+
convertCount?: number | undefined;
|
|
38
|
+
}>>;
|
|
39
|
+
export type DischargeRequeryJobRuntimeData = z.infer<typeof dischargeRequeryRuntimeDataSchema>;
|
|
40
|
+
export declare const scheduledAtSchema: z.ZodDate;
|
|
41
|
+
export type DischargeRequeryJob = PatientJob & {
|
|
42
|
+
paramsOps: DischargeRequeryParamsOps;
|
|
43
|
+
scheduledAt: Date;
|
|
44
|
+
runtimeData?: DischargeRequeryJobRuntimeData;
|
|
45
|
+
};
|
|
46
|
+
export declare function parseDischargeRequeryJob(job: PatientJob): DischargeRequeryJob;
|
|
47
|
+
//# sourceMappingURL=discharge-requery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discharge-requery.d.ts","sourceRoot":"","sources":["../../../../src/domain/patient/patient-monitoring/discharge-requery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,uBAAuB,aAA2C,CAAC;AAEhF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;EAI7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAE9F,eAAO,MAAM,+BAA+B;;;;;;EAE1C,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;GAMjC,CAAC;AAEd,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAE/F,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG;IAC7C,SAAS,EAAE,yBAAyB,CAAC;IACrC,WAAW,EAAE,IAAI,CAAC;IAClB,WAAW,CAAC,EAAE,8BAA8B,CAAC;CAC9C,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,UAAU,GAAG,mBAAmB,CAO7E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseDischargeRequeryJob = exports.scheduledAtSchema = exports.dischargeRequeryRuntimeDataSchema = exports.dischargeRequeryParamsOpsSchema = exports.createDischargeRequeryParamsSchema = exports.remainingAttemptsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
exports.remainingAttemptsSchema = zod_1.z.number().max(utils_1.defaultRemainingAttempts);
|
|
7
|
+
exports.createDischargeRequeryParamsSchema = zod_1.z.object({
|
|
8
|
+
patientId: zod_1.z.string(),
|
|
9
|
+
cxId: zod_1.z.string(),
|
|
10
|
+
remainingAttempts: exports.remainingAttemptsSchema.optional(),
|
|
11
|
+
});
|
|
12
|
+
exports.dischargeRequeryParamsOpsSchema = zod_1.z.object({
|
|
13
|
+
remainingAttempts: exports.remainingAttemptsSchema,
|
|
14
|
+
});
|
|
15
|
+
exports.dischargeRequeryRuntimeDataSchema = zod_1.z
|
|
16
|
+
.object({
|
|
17
|
+
documentQueryRequestId: zod_1.z.string().optional(),
|
|
18
|
+
downloadCount: zod_1.z.number().optional(),
|
|
19
|
+
convertCount: zod_1.z.number().optional(),
|
|
20
|
+
})
|
|
21
|
+
.optional();
|
|
22
|
+
exports.scheduledAtSchema = zod_1.z.date();
|
|
23
|
+
function parseDischargeRequeryJob(job) {
|
|
24
|
+
return {
|
|
25
|
+
...job,
|
|
26
|
+
paramsOps: exports.dischargeRequeryParamsOpsSchema.parse(job.paramsOps),
|
|
27
|
+
runtimeData: exports.dischargeRequeryRuntimeDataSchema.parse(job.runtimeData),
|
|
28
|
+
scheduledAt: exports.scheduledAtSchema.parse(job.scheduledAt),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.parseDischargeRequeryJob = parseDischargeRequeryJob;
|
|
32
|
+
//# sourceMappingURL=discharge-requery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discharge-requery.js","sourceRoot":"","sources":["../../../../src/domain/patient/patient-monitoring/discharge-requery.ts"],"names":[],"mappings":";;;AACA,6BAAwB;AACxB,mCAAmD;AAEtC,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,gCAAwB,CAAC,CAAC;AAEnE,QAAA,kCAAkC,GAAG,OAAC,CAAC,MAAM,CAAC;IACzD,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,iBAAiB,EAAE,+BAAuB,CAAC,QAAQ,EAAE;CACtD,CAAC,CAAC;AAIU,QAAA,+BAA+B,GAAG,OAAC,CAAC,MAAM,CAAC;IACtD,iBAAiB,EAAE,+BAAuB;CAC3C,CAAC,CAAC;AAIU,QAAA,iCAAiC,GAAG,OAAC;KAC/C,MAAM,CAAC;IACN,sBAAsB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7C,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC;KACD,QAAQ,EAAE,CAAC;AAID,QAAA,iBAAiB,GAAG,OAAC,CAAC,IAAI,EAAE,CAAC;AAQ1C,SAAgB,wBAAwB,CAAC,GAAe;IACtD,OAAO;QACL,GAAG,GAAG;QACN,SAAS,EAAE,uCAA+B,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC;QAC/D,WAAW,EAAE,yCAAiC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC;QACrE,WAAW,EAAE,yBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC;KACtD,CAAC;AACJ,CAAC;AAPD,4DAOC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const backoffOne: number;
|
|
2
|
+
export declare const backoffTwo: number;
|
|
3
|
+
export declare const backoffThree: number;
|
|
4
|
+
export declare const backoffFour: number;
|
|
5
|
+
export declare const backoffFive: number;
|
|
6
|
+
export declare const backoffSix: number;
|
|
7
|
+
export declare const defaultRemainingAttempts: number;
|
|
8
|
+
export declare function calculateScheduledAt(newAttempts: number): Date;
|
|
9
|
+
export declare function pickLargestRemainingAttempts(existingAttempts: number, newAttempts: number): number;
|
|
10
|
+
export declare function pickEarliestScheduledAt(existingDate: Date, newDate: Date): Date;
|
|
11
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/domain/patient/patient-monitoring/utils.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU,QAAgB,CAAC;AACxC,eAAO,MAAM,UAAU,QAAiB,CAAC;AACzC,eAAO,MAAM,YAAY,QAAqB,CAAC;AAC/C,eAAO,MAAM,WAAW,QAA0B,CAAC;AACnD,eAAO,MAAM,WAAW,QAA0B,CAAC;AACnD,eAAO,MAAM,UAAU,QAA0B,CAAC;AAUlD,eAAO,MAAM,wBAAwB,QAA+C,CAAC;AAErF,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAU9D;AAED,wBAAgB,4BAA4B,CAC1C,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,GAClB,MAAM,CAER;AAED,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,GAAG,IAAI,CAI/E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pickEarliestScheduledAt = exports.pickLargestRemainingAttempts = exports.calculateScheduledAt = exports.defaultRemainingAttempts = exports.backoffSix = exports.backoffFive = exports.backoffFour = exports.backoffThree = exports.backoffTwo = exports.backoffOne = void 0;
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
+
const duration_1 = __importDefault(require("dayjs/plugin/duration"));
|
|
9
|
+
const date_1 = require("../../../common/date");
|
|
10
|
+
dayjs_1.default.extend(duration_1.default);
|
|
11
|
+
exports.backoffOne = 5 * 60 * 1000; // 5 minutes
|
|
12
|
+
exports.backoffTwo = 30 * 60 * 1000; // 30 minutes
|
|
13
|
+
exports.backoffThree = 4 * 60 * 60 * 1000; // 4 hours
|
|
14
|
+
exports.backoffFour = 1 * 24 * 60 * 60 * 1000; // 1 day
|
|
15
|
+
exports.backoffFive = 2 * 24 * 60 * 60 * 1000; // 2 days
|
|
16
|
+
exports.backoffSix = 4 * 24 * 60 * 60 * 1000; // 4 days
|
|
17
|
+
const dischargeRequerySchedule = {
|
|
18
|
+
1: dayjs_1.default.duration({ milliseconds: exports.backoffOne }),
|
|
19
|
+
2: dayjs_1.default.duration({ milliseconds: exports.backoffTwo }),
|
|
20
|
+
3: dayjs_1.default.duration({ milliseconds: exports.backoffThree }),
|
|
21
|
+
4: dayjs_1.default.duration({ milliseconds: exports.backoffFour }),
|
|
22
|
+
5: dayjs_1.default.duration({ milliseconds: exports.backoffFive }),
|
|
23
|
+
6: dayjs_1.default.duration({ milliseconds: exports.backoffSix }),
|
|
24
|
+
};
|
|
25
|
+
exports.defaultRemainingAttempts = Object.keys(dischargeRequerySchedule).length;
|
|
26
|
+
function calculateScheduledAt(newAttempts) {
|
|
27
|
+
const attemptNumber = exports.defaultRemainingAttempts - newAttempts + 1;
|
|
28
|
+
const backoffDurationMs = dischargeRequerySchedule[attemptNumber].asMilliseconds();
|
|
29
|
+
const nextScheduledAt = (0, date_1.buildDayjs)().add(backoffDurationMs, "milliseconds").toDate();
|
|
30
|
+
return nextScheduledAt;
|
|
31
|
+
}
|
|
32
|
+
exports.calculateScheduledAt = calculateScheduledAt;
|
|
33
|
+
function pickLargestRemainingAttempts(existingAttempts, newAttempts) {
|
|
34
|
+
return Math.max(existingAttempts, newAttempts);
|
|
35
|
+
}
|
|
36
|
+
exports.pickLargestRemainingAttempts = pickLargestRemainingAttempts;
|
|
37
|
+
function pickEarliestScheduledAt(existingDate, newDate) {
|
|
38
|
+
const existingDateMs = existingDate.getTime();
|
|
39
|
+
const newDateMs = newDate.getTime();
|
|
40
|
+
return existingDateMs < newDateMs ? existingDate : newDate;
|
|
41
|
+
}
|
|
42
|
+
exports.pickEarliestScheduledAt = pickEarliestScheduledAt;
|
|
43
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/domain/patient/patient-monitoring/utils.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,qEAA6C;AAC7C,+CAAkD;AAElD,eAAK,CAAC,MAAM,CAAC,kBAAQ,CAAC,CAAC;AAEV,QAAA,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;AACxC,QAAA,UAAU,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAC1C,QAAA,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI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AACzB,CAAC;AAVD,oDAUC;AAED,SAAgB,4BAA4B,CAC1C,gBAAwB,EACxB,WAAmB;IAEnB,OAAO,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;AACjD,CAAC;AALD,oEAKC;AAED,SAAgB,uBAAuB,CAAC,YAAkB,EAAE,OAAa;IACvE,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC;IAC9C,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IACpC,OAAO,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC;AAC7D,CAAC;AAJD,0DAIC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
export declare function getPaymentCodeName(paymentCode: string): PaymentCodeName | undefined;
|
|
1
2
|
export declare const PaymentCodes: readonly ["01", "02", "03", "04", "05", "06", "07", "99"];
|
|
2
3
|
export declare const PaymentCodeNames: readonly ["Private Pay", "Medicaid", "Medicare", "Commercial Insurance", "Military Installations and VA", "Workers' Compensation", "Indian Nations", "Other"];
|
|
3
4
|
export type PaymentCode = (typeof PaymentCodes)[number];
|
|
4
5
|
export type PaymentCodeName = (typeof PaymentCodeNames)[number];
|
|
5
6
|
export declare const PaymentCodeName: Record<PaymentCode, PaymentCodeName>;
|
|
7
|
+
export declare function getSourceOfPaymentCode(paymentCode: string): SourceOfPaymentCode | undefined;
|
|
8
|
+
export declare function getSourceOfPaymentName(sourceOfPaymentCode: string): string | undefined;
|
|
9
|
+
declare const SourceOfPaymentCodes: readonly ["1", "2", "3", "312", "33", "4", "5", "6", "7", "8", "89", "95", "99"];
|
|
10
|
+
export type SourceOfPaymentCode = (typeof SourceOfPaymentCodes)[number];
|
|
11
|
+
export declare const SourceOfPaymentName: Record<SourceOfPaymentCode, string>;
|
|
12
|
+
export declare const PaymentCodeToSourceOfPaymentCode: Record<PaymentCode, SourceOfPaymentCode>;
|
|
13
|
+
export {};
|
|
6
14
|
//# sourceMappingURL=payment-code.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-code.d.ts","sourceRoot":"","sources":["../../../../src/interface/external/surescripts/payment-code.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,2DAA4D,CAAC;AACtF,eAAO,MAAM,gBAAgB,+JASnB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AACxD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,eAAe,CAShE,CAAC"}
|
|
1
|
+
{"version":3,"file":"payment-code.d.ts","sourceRoot":"","sources":["../../../../src/interface/external/surescripts/payment-code.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAEnF;AAED,eAAO,MAAM,YAAY,2DAA4D,CAAC;AACtF,eAAO,MAAM,gBAAgB,+JASnB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AACxD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,eAAe,CAShE,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAE3F;AAED,wBAAgB,sBAAsB,CAAC,mBAAmB,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEtF;AAGD,QAAA,MAAM,oBAAoB,kFAchB,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAcnE,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,MAAM,CAAC,WAAW,EAAE,mBAAmB,CASrF,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PaymentCodeName = exports.PaymentCodeNames = exports.PaymentCodes = void 0;
|
|
3
|
+
exports.PaymentCodeToSourceOfPaymentCode = exports.SourceOfPaymentName = exports.getSourceOfPaymentName = exports.getSourceOfPaymentCode = exports.PaymentCodeName = exports.PaymentCodeNames = exports.PaymentCodes = exports.getPaymentCodeName = void 0;
|
|
4
|
+
function getPaymentCodeName(paymentCode) {
|
|
5
|
+
return exports.PaymentCodeName[paymentCode];
|
|
6
|
+
}
|
|
7
|
+
exports.getPaymentCodeName = getPaymentCodeName;
|
|
4
8
|
exports.PaymentCodes = ["01", "02", "03", "04", "05", "06", "07", "99"];
|
|
5
9
|
exports.PaymentCodeNames = [
|
|
6
10
|
"Private Pay",
|
|
@@ -22,4 +26,53 @@ exports.PaymentCodeName = {
|
|
|
22
26
|
"07": "Indian Nations",
|
|
23
27
|
"99": "Other",
|
|
24
28
|
};
|
|
29
|
+
function getSourceOfPaymentCode(paymentCode) {
|
|
30
|
+
return exports.PaymentCodeToSourceOfPaymentCode[paymentCode];
|
|
31
|
+
}
|
|
32
|
+
exports.getSourceOfPaymentCode = getSourceOfPaymentCode;
|
|
33
|
+
function getSourceOfPaymentName(sourceOfPaymentCode) {
|
|
34
|
+
return exports.SourceOfPaymentName[sourceOfPaymentCode];
|
|
35
|
+
}
|
|
36
|
+
exports.getSourceOfPaymentName = getSourceOfPaymentName;
|
|
37
|
+
// https://www.nahdo.org/sopt
|
|
38
|
+
const SourceOfPaymentCodes = [
|
|
39
|
+
"1",
|
|
40
|
+
"2",
|
|
41
|
+
"3",
|
|
42
|
+
"312",
|
|
43
|
+
"33",
|
|
44
|
+
"4",
|
|
45
|
+
"5",
|
|
46
|
+
"6",
|
|
47
|
+
"7",
|
|
48
|
+
"8",
|
|
49
|
+
"89",
|
|
50
|
+
"95",
|
|
51
|
+
"99",
|
|
52
|
+
];
|
|
53
|
+
exports.SourceOfPaymentName = {
|
|
54
|
+
"1": "Medicare",
|
|
55
|
+
"2": "Medicaid",
|
|
56
|
+
"3": "Government",
|
|
57
|
+
"4": "Department of Corrections",
|
|
58
|
+
"5": "Private Health Insurance",
|
|
59
|
+
"6": "Blue Cross/Blue Shield",
|
|
60
|
+
"7": "Managed Care",
|
|
61
|
+
"8": "Private Pay",
|
|
62
|
+
"89": "No Payment",
|
|
63
|
+
"95": "Worker's Compensation",
|
|
64
|
+
"99": "No code available",
|
|
65
|
+
"33": "Indian Health Service",
|
|
66
|
+
"312": "Military Treatment Facility",
|
|
67
|
+
};
|
|
68
|
+
exports.PaymentCodeToSourceOfPaymentCode = {
|
|
69
|
+
"01": "5",
|
|
70
|
+
"02": "2",
|
|
71
|
+
"03": "1",
|
|
72
|
+
"04": "5",
|
|
73
|
+
"05": "312",
|
|
74
|
+
"06": "95",
|
|
75
|
+
"07": "33",
|
|
76
|
+
"99": "99", // other
|
|
77
|
+
};
|
|
25
78
|
//# sourceMappingURL=payment-code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-code.js","sourceRoot":"","sources":["../../../../src/interface/external/surescripts/payment-code.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"payment-code.js","sourceRoot":"","sources":["../../../../src/interface/external/surescripts/payment-code.ts"],"names":[],"mappings":";;;AAAA,SAAgB,kBAAkB,CAAC,WAAmB;IACpD,OAAO,uBAAe,CAAC,WAA0B,CAAC,CAAC;AACrD,CAAC;AAFD,gDAEC;AAEY,QAAA,YAAY,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,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xF,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI,EAAE,QAAQ;CACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metriport/shared",
|
|
3
|
-
"version": "0.23.10
|
|
3
|
+
"version": "0.23.10",
|
|
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/",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"ts-jest": "29.1.1",
|
|
116
116
|
"typescript": "^4.9.5"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "1a6bdb18f5c92f70045a61c1fc0f511a5ca1e6e2"
|
|
119
119
|
}
|