@metriport/shared 0.21.0-alpha.0 → 0.21.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.
Files changed (43) hide show
  1. package/dist/domain/patient/patient-import.d.ts +6 -6
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/interface/external/ehr/athenahealth/appointment.d.ts +26 -4
  7. package/dist/interface/external/ehr/athenahealth/appointment.d.ts.map +1 -1
  8. package/dist/interface/external/ehr/athenahealth/appointment.js +7 -3
  9. package/dist/interface/external/ehr/athenahealth/appointment.js.map +1 -1
  10. package/dist/interface/external/ehr/athenahealth/cx-mapping.d.ts +6 -0
  11. package/dist/interface/external/ehr/athenahealth/cx-mapping.d.ts.map +1 -1
  12. package/dist/interface/external/ehr/athenahealth/cx-mapping.js +2 -0
  13. package/dist/interface/external/ehr/athenahealth/cx-mapping.js.map +1 -1
  14. package/dist/interface/external/ehr/canvas/appointment.d.ts +38 -20
  15. package/dist/interface/external/ehr/canvas/appointment.d.ts.map +1 -1
  16. package/dist/interface/external/ehr/canvas/appointment.js +6 -5
  17. package/dist/interface/external/ehr/canvas/appointment.js.map +1 -1
  18. package/dist/interface/external/ehr/elation/appointment.d.ts +5 -2
  19. package/dist/interface/external/ehr/elation/appointment.d.ts.map +1 -1
  20. package/dist/interface/external/ehr/elation/appointment.js +3 -2
  21. package/dist/interface/external/ehr/elation/appointment.js.map +1 -1
  22. package/dist/interface/external/ehr/elation/cx-mapping.d.ts +3 -3
  23. package/dist/interface/external/ehr/elation/cx-mapping.js +1 -1
  24. package/dist/interface/external/ehr/elation/cx-mapping.js.map +1 -1
  25. package/dist/interface/external/ehr/elation/patient.d.ts +6 -6
  26. package/dist/interface/external/ehr/patient.d.ts +12 -12
  27. package/dist/medical/webhook/webhook-request.d.ts +59 -72
  28. package/dist/medical/webhook/webhook-request.d.ts.map +1 -1
  29. package/dist/medical/webhook/webhook-request.js +2 -11
  30. package/dist/medical/webhook/webhook-request.js.map +1 -1
  31. package/package.json +2 -2
  32. package/dist/domain/patient/patient-import/schemas.d.ts +0 -19
  33. package/dist/domain/patient/patient-import/schemas.d.ts.map +0 -1
  34. package/dist/domain/patient/patient-import/schemas.js +0 -35
  35. package/dist/domain/patient/patient-import/schemas.js.map +0 -1
  36. package/dist/domain/patient/patient-import/status.d.ts +0 -11
  37. package/dist/domain/patient/patient-import/status.d.ts.map +0 -1
  38. package/dist/domain/patient/patient-import/status.js +0 -48
  39. package/dist/domain/patient/patient-import/status.js.map +0 -1
  40. package/dist/domain/patient/patient-import/types.d.ts +0 -48
  41. package/dist/domain/patient/patient-import/types.d.ts.map +0 -1
  42. package/dist/domain/patient/patient-import/types.js +0 -24
  43. package/dist/domain/patient/patient-import/types.js.map +0 -1
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateJobSchema = void 0;
4
- const zod_1 = require("zod");
5
- const types_1 = require("./types");
6
- // TODO 2330 Review this as part of POST /internal/patient/bulk/coverage-assessment
7
- // export const patientImportPatientSchema = z.object({
8
- // dob: z.string().refine(normalizeDobSafe, { message: "Invalid dob" }),
9
- // gender: z.string().refine(normalizeGenderSafe, { message: "Invalid gender" }),
10
- // firstname: z.string().min(1, { message: "First name must be defined" }),
11
- // lastname: z.string().min(1, { message: "Last name must be defined" }),
12
- // zip: z.string().refine(normalizeZipCodeNewSafe, { message: "Invalid zip" }),
13
- // city: z.string().min(1, { message: "City must be defined" }),
14
- // state: z
15
- // .string()
16
- // .refine(normalizeUSStateForAddressSafe, { message: "Invalid state or territory" }),
17
- // addressline1: z.string().min(1, { message: "Address line must be defined" }),
18
- // addressline2: z.string().optional(),
19
- // phone1: z.string().refine(isPhoneValid, { message: "Invalid phone" }).optional(),
20
- // phone2: z.string().refine(isPhoneValid, { message: "Invalid phone" }).optional(),
21
- // email1: z.string().refine(isEmailValid, { message: "Invalid email" }).optional(),
22
- // email2: z.string().refine(isEmailValid, { message: "Invalid email" }).optional(),
23
- // externalid: z.string().optional(),
24
- // });
25
- // export type PatientImportPatient = z.infer<typeof patientImportPatientSchema>;
26
- // export const patientImportSchema = z.object({
27
- // patients: patientImportPatientSchema.array(),
28
- // });
29
- exports.updateJobSchema = zod_1.z.object({
30
- status: zod_1.z.enum(types_1.patientImportStatus),
31
- total: zod_1.z.number().optional(),
32
- failed: zod_1.z.number().optional(),
33
- forceStatusUpdate: zod_1.z.boolean().optional(),
34
- });
35
- //# sourceMappingURL=schemas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../../src/domain/patient/patient-import/schemas.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,mCAA8C;AAE9C,mFAAmF;AACnF,uDAAuD;AACvD,0EAA0E;AAC1E,mFAAmF;AACnF,6EAA6E;AAC7E,2EAA2E;AAC3E,iFAAiF;AACjF,kEAAkE;AAClE,aAAa;AACb,gBAAgB;AAChB,0FAA0F;AAC1F,kFAAkF;AAClF,yCAAyC;AACzC,sFAAsF;AACtF,sFAAsF;AACtF,sFAAsF;AACtF,sFAAsF;AACtF,uCAAuC;AACvC,MAAM;AACN,iFAAiF;AAEjF,gDAAgD;AAChD,kDAAkD;AAClD,MAAM;AAEO,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,2BAAmB,CAAC;IACnC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,iBAAiB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- import { PatientImportStatus } from "./types";
2
- /**
3
- * Validates that a new status is valid based on the current status.
4
- *
5
- * @param currentStatus - The current status of the patient import job.
6
- * @param newStatus - The new status to validate.
7
- * @returns The validated new status.
8
- * @throws BadRequestError if the new status is not valid.
9
- */
10
- export declare function validateNewStatus(currentStatus: PatientImportStatus, newStatus: PatientImportStatus, dryRun?: boolean): PatientImportStatus;
11
- //# sourceMappingURL=status.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/domain/patient/patient-import/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAM9C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,mBAAmB,EAClC,SAAS,EAAE,mBAAmB,EAC9B,MAAM,CAAC,EAAE,OAAO,GACf,mBAAmB,CAkCrB"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateNewStatus = void 0;
4
- const bad_request_1 = require("../../../error/bad-request");
5
- // TODO 2330 Unit test this
6
- // TODO 2330 Unit test this
7
- // TODO 2330 Unit test this
8
- /**
9
- * Validates that a new status is valid based on the current status.
10
- *
11
- * @param currentStatus - The current status of the patient import job.
12
- * @param newStatus - The new status to validate.
13
- * @returns The validated new status.
14
- * @throws BadRequestError if the new status is not valid.
15
- */
16
- function validateNewStatus(currentStatus, newStatus, dryRun) {
17
- const validStatusForProcessing = ["waiting", "processing"];
18
- switch (newStatus) {
19
- case "waiting":
20
- throw new bad_request_1.BadRequestError(`Waiting is not a valid status to update`);
21
- case "processing":
22
- if (!validStatusForProcessing.includes(currentStatus)) {
23
- throw new bad_request_1.BadRequestError(`Import job is not in [${validStatusForProcessing.join(",")}], cannot update to processing`);
24
- }
25
- break;
26
- case "completed":
27
- if (dryRun && currentStatus === "processing") {
28
- // When dry-run, we don't want to set the status to completed so (1) the cx can tell
29
- // whether the patients were imported or not, and (2) we can dry-run a job before we
30
- // actually import the patients
31
- return "waiting";
32
- }
33
- if (currentStatus !== "processing") {
34
- throw new bad_request_1.BadRequestError(`Import job is not processing, cannot update to completed`);
35
- }
36
- break;
37
- case "failed":
38
- if (currentStatus !== "processing") {
39
- throw new bad_request_1.BadRequestError(`Import job is not processing, cannot update to failed`);
40
- }
41
- break;
42
- default:
43
- throw new bad_request_1.BadRequestError(`Invalid status ${newStatus}`);
44
- }
45
- return newStatus;
46
- }
47
- exports.validateNewStatus = validateNewStatus;
48
- //# sourceMappingURL=status.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/domain/patient/patient-import/status.ts"],"names":[],"mappings":";;;AAAA,4DAA6D;AAG7D,2BAA2B;AAC3B,2BAA2B;AAC3B,2BAA2B;AAE3B;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,aAAkC,EAClC,SAA8B,EAC9B,MAAgB;IAEhB,MAAM,wBAAwB,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAC3D,QAAQ,SAAS,EAAE;QACjB,KAAK,SAAS;YACZ,MAAM,IAAI,6BAAe,CAAC,yCAAyC,CAAC,CAAC;QACvE,KAAK,YAAY;YACf,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;gBACrD,MAAM,IAAI,6BAAe,CACvB,yBAAyB,wBAAwB,CAAC,IAAI,CACpD,GAAG,CACJ,gCAAgC,CAClC,CAAC;aACH;YACD,MAAM;QACR,KAAK,WAAW;YACd,IAAI,MAAM,IAAI,aAAa,KAAK,YAAY,EAAE;gBAC5C,oFAAoF;gBACpF,oFAAoF;gBACpF,+BAA+B;gBAC/B,OAAO,SAAS,CAAC;aAClB;YACD,IAAI,aAAa,KAAK,YAAY,EAAE;gBAClC,MAAM,IAAI,6BAAe,CAAC,0DAA0D,CAAC,CAAC;aACvF;YACD,MAAM;QACR,KAAK,QAAQ;YACX,IAAI,aAAa,KAAK,YAAY,EAAE;gBAClC,MAAM,IAAI,6BAAe,CAAC,uDAAuD,CAAC,CAAC;aACpF;YACD,MAAM;QACR;YACE,MAAM,IAAI,6BAAe,CAAC,kBAAkB,SAAS,EAAE,CAAC,CAAC;KAC5D;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAtCD,8CAsCC"}
@@ -1,48 +0,0 @@
1
- export declare const patientImportStatus: readonly ["waiting", "processing", "completed", "failed"];
2
- export type PatientImportStatus = (typeof patientImportStatus)[number];
3
- export type GetPatientImport = {
4
- id: string;
5
- cxId: string;
6
- };
7
- export type PatientImportParamsCx = {
8
- dryRun: boolean;
9
- };
10
- export type PatientImportParamsOps = {
11
- dryRun: boolean;
12
- rerunPdOnNewDemographics: boolean;
13
- triggerConsolidated: boolean;
14
- disableWebhooks: boolean;
15
- };
16
- export type PatientImport = {
17
- id: string;
18
- cxId: string;
19
- facilityId: string;
20
- status: PatientImportStatus;
21
- reason: string | undefined;
22
- /** When the job was created, when the jobId was generated. */
23
- createdAt: Date;
24
- /** When the job was actually started, after parsing and patient creates started to be sent to the queue for processing. */
25
- startedAt: Date | undefined;
26
- /** When the job was finished, when the last data pipeline of the last patient was completed. */
27
- finishedAt: Date | undefined;
28
- total: number | undefined;
29
- successful: number | undefined;
30
- failed: number | undefined;
31
- paramsCx: PatientImportParamsCx;
32
- paramsOps: PatientImportParamsOps;
33
- };
34
- export type PatientImportEntryStatusFailed = "failed";
35
- export type PatientImportEntryStatusParsed = "waiting" | "processing" | "successful";
36
- export type PatientImportEntryStatus = PatientImportEntryStatusFailed | PatientImportEntryStatusParsed;
37
- declare const isDevKey = "isDev";
38
- /**
39
- * Used to store metadata on the upload URL.
40
- */
41
- export type PatientImportUploadMetadata = {
42
- [isDevKey]?: boolean;
43
- };
44
- export declare function metaToRecord(metadata: PatientImportUploadMetadata): Record<keyof PatientImportUploadMetadata, string>;
45
- export declare function recordToMeta(record: Record<string, string>): PatientImportUploadMetadata;
46
- export declare function isPatientImportRunningOnDev(metadata: PatientImportUploadMetadata | undefined): boolean;
47
- export {};
48
- //# sourceMapp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G,SAAS,GAAG,YAAY,GAAG,YAAY,CAAC;AACrF,MAAM,MAAM,wBAAwB,GAChC,8BAA8B,GAC9B,8BAA8B,CAAC;AAEnC,QAAA,MAAM,QAAQ,UAAU,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,2BAA2B,GACpC,MAAM,CAAC,MAAM,2BAA2B,EAAE,MAAM,CAAC,CAInD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,2BAA2B,CAIxF;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,2BAA2B,GAAG,SAAS,GAChD,OAAO,CAGT"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPatientImportRunningOnDev = exports.recordToMeta = exports.metaToRecord = exports.patientImportStatus = void 0;
4
- // TODO 2330 add expired
5
- exports.patientImportStatus = ["waiting", "processing", "completed", "failed"];
6
- const isDevKey = "isDev";
7
- function metaToRecord(metadata) {
8
- return {
9
- [isDevKey]: metadata[isDevKey] ? "true" : "false",
10
- };
11
- }
12
- exports.metaToRecord = metaToRecord;
13
- function recordToMeta(record) {
14
- return {
15
- ...(record[isDevKey] ? { [isDevKey]: record[isDevKey] === "true" } : {}),
16
- };
17
- }
18
- exports.recordToMeta = recordToMeta;
19
- function isPatientImportRunningOnDev(metadata) {
20
- const isDevProp = metadata?.[isDevKey];
21
- return isDevProp ? [true, "true"].includes(isDevProp) : false;
22
- }
23
- exports.isPatientImportRunningOnDev = isPatientImportRunningOnDev;
24
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/domain/patient/patient-import/types.ts"],"names":[],"mappings":";;;AAAA,wBAAwB;AACX,QAAA,mBAAmB,GAAG,CAAC,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,CAAU,CAAC;AAmD7F,MAAM,QAAQ,GAAG,OAAO,CAAC;AASzB,SAAgB,YAAY,CAC1B,QAAqC;IAErC,OAAO;QACL,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;KAClD,CAAC;AACJ,CAAC;AAND,oCAMC;AAED,SAAgB,YAAY,CAAC,MAA8B;IACzD,OAAO;QACL,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzE,CAAC;AACJ,CAAC;AAJD,oCAIC;AAED,SAAgB,2BAA2B,CACzC,QAAiD;IAEjD,MAAM,SAAS,GAAG,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;IACvC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAChE,CAAC;AALD,kEAKC"}