@metriport/shared 0.14.0-alpha.0 → 0.14.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/dist/common/date.d.ts +2 -2
- package/dist/common/date.d.ts.map +1 -1
- package/dist/common/date.js +7 -7
- package/dist/common/date.js.map +1 -1
- package/dist/medical/webhook/webhook-request.d.ts +29 -29
- package/package.json +4 -3
- package/dist/common/__tests__/number.test.d.ts +0 -2
- package/dist/common/__tests__/number.test.d.ts.map +0 -1
- package/dist/common/__tests__/number.test.js +0 -10
- package/dist/common/__tests__/number.test.js.map +0 -1
- package/dist/common/__tests__/string.test copy.d.ts +0 -2
- package/dist/common/__tests__/string.test copy.d.ts.map +0 -1
- package/dist/common/__tests__/string.test copy.js +0 -10
- package/dist/common/__tests__/string.test copy.js.map +0 -1
- package/dist/common/__tests__/validate-npi.d.ts +0 -10
- package/dist/common/__tests__/validate-npi.d.ts.map +0 -1
- package/dist/common/__tests__/validate-npi.js +0 -35
- package/dist/common/__tests__/validate-npi.js.map +0 -1
- package/dist/core/src/command/patient-import/patient-import-shared.d.ts +0 -18
- package/dist/core/src/command/patient-import/patient-import-shared.d.ts.map +0 -1
- package/dist/core/src/command/patient-import/patient-import-shared.js +0 -137
- package/dist/core/src/command/patient-import/patient-import-shared.js.map +0 -1
- package/dist/core/src/command/patient-import/patient-import.d.ts +0 -60
- package/dist/core/src/command/patient-import/patient-import.d.ts.map +0 -1
- package/dist/core/src/command/patient-import/patient-import.js +0 -3
- package/dist/core/src/command/patient-import/patient-import.js.map +0 -1
- package/dist/core/src/domain/address.d.ts +0 -17
- package/dist/core/src/domain/address.d.ts.map +0 -1
- package/dist/core/src/domain/address.js +0 -20
- package/dist/core/src/domain/address.js.map +0 -1
- package/dist/core/src/domain/base-domain.d.ts +0 -14
- package/dist/core/src/domain/base-domain.d.ts.map +0 -1
- package/dist/core/src/domain/base-domain.js +0 -3
- package/dist/core/src/domain/base-domain.js.map +0 -1
- package/dist/core/src/domain/bulk-get-document-url.d.ts +0 -8
- package/dist/core/src/domain/bulk-get-document-url.d.ts.map +0 -1
- package/dist/core/src/domain/bulk-get-document-url.js +0 -9
- package/dist/core/src/domain/bulk-get-document-url.js.map +0 -1
- package/dist/core/src/domain/contact.d.ts +0 -3
- package/dist/core/src/domain/contact.d.ts.map +0 -1
- package/dist/core/src/domain/contact.js +0 -3
- package/dist/core/src/domain/contact.js.map +0 -1
- package/dist/core/src/domain/document-query.d.ts +0 -24
- package/dist/core/src/domain/document-query.d.ts.map +0 -1
- package/dist/core/src/domain/document-query.js +0 -27
- package/dist/core/src/domain/document-query.js.map +0 -1
- package/dist/core/src/domain/patient-demographics.d.ts +0 -33
- package/dist/core/src/domain/patient-demographics.d.ts.map +0 -1
- package/dist/core/src/domain/patient-demographics.js +0 -3
- package/dist/core/src/domain/patient-demographics.js.map +0 -1
- package/dist/core/src/domain/patient-discovery.d.ts +0 -15
- package/dist/core/src/domain/patient-discovery.d.ts.map +0 -1
- package/dist/core/src/domain/patient-discovery.js +0 -3
- package/dist/core/src/domain/patient-discovery.js.map +0 -1
- package/dist/core/src/domain/patient.d.ts +0 -78
- package/dist/core/src/domain/patient.d.ts.map +0 -1
- package/dist/core/src/domain/patient.js +0 -38
- package/dist/core/src/domain/patient.js.map +0 -1
- package/dist/core/src/external/index.d.ts +0 -14
- package/dist/core/src/external/index.d.ts.map +0 -1
- package/dist/core/src/external/index.js +0 -24
- package/dist/core/src/external/index.js.map +0 -1
- package/dist/domain/address/USStateForAddress.d.ts +0 -3
- package/dist/domain/address/USStateForAddress.d.ts.map +0 -1
- package/dist/domain/address/USStateForAddress.js +0 -3
- package/dist/domain/address/USStateForAddress.js.map +0 -1
- package/dist/domain/address/__tests__/normalize-zip.test copy.d.ts +0 -2
- package/dist/domain/address/__tests__/normalize-zip.test copy.d.ts.map +0 -1
- package/dist/domain/address/__tests__/normalize-zip.test copy.js +0 -117
- package/dist/domain/address/__tests__/normalize-zip.test copy.js.map +0 -1
- package/dist/domain/address/__tests__/state.test copy.d.ts +0 -2
- package/dist/domain/address/__tests__/state.test copy.d.ts.map +0 -1
- package/dist/domain/address/__tests__/state.test copy.js +0 -33
- package/dist/domain/address/__tests__/state.test copy.js.map +0 -1
- package/dist/domain/address/state copy.d.ts +0 -62
- package/dist/domain/address/state copy.d.ts.map +0 -1
- package/dist/domain/address/state copy.js +0 -136
- package/dist/domain/address/state copy.js.map +0 -1
- package/dist/domain/address/state-for-address.d.ts +0 -4
- package/dist/domain/address/state-for-address.d.ts.map +0 -1
- package/dist/domain/address/state-for-address.js +0 -17
- package/dist/domain/address/state-for-address.js.map +0 -1
- package/dist/domain/patient/__tests__/normalize-zip.test.d.ts +0 -1
- package/dist/domain/patient/__tests__/normalize-zip.test.d.ts.map +0 -1
- package/dist/domain/patient/__tests__/normalize-zip.test.js +0 -2
- package/dist/domain/patient/__tests__/normalize-zip.test.js.map +0 -1
- package/dist/shared/src/domain/patient/__tests__/normalize-zip.test.d.ts +0 -2
- package/dist/shared/src/domain/patient/__tests__/normalize-zip.test.d.ts.map +0 -1
- package/dist/shared/src/domain/patient/__tests__/normalize-zip.test.js +0 -81
- package/dist/shared/src/domain/patient/__tests__/normalize-zip.test.js.map +0 -1
package/dist/common/date.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import dayjs, { ConfigType } from "dayjs";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export declare const ISO_DATE = "YYYY-MM-DD";
|
|
4
4
|
export declare function isValidISODate(date: string): boolean;
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
5
|
+
export declare function validateIsPastOrPresent(date: string): boolean;
|
|
6
|
+
export declare function validateIsPastOrPresentSafe(date: string): boolean;
|
|
7
7
|
export declare function validateDateRange(start: string, end: string): boolean;
|
|
8
8
|
export declare const optionalDateSchema: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, string | null | undefined>;
|
|
9
9
|
export declare const dateSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/common/date.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAqB,CAAC,EAAE,MAAM,KAAK,CAAC;AAK3C,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAMD,wBAAgB,
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/common/date.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAqB,CAAC,EAAE,MAAM,KAAK,CAAC;AAK3C,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAMD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAK7D;AACD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGjE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAQrE;AAID,eAAO,MAAM,kBAAkB,+GAIiB,CAAC;AAEjD,eAAO,MAAM,UAAU,2CAA0D,CAAC;AAElF,wBAAgB,kBAAkB,CAChC,IAAI,CAAC,EAAE,IAAI,EACX,MAAM,GAAE,KAAK,CAAC,YAA4B,GACzC,MAAM,CAER;AAED,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,KAAK,CAE5F"}
|
package/dist/common/date.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.buildDayjs = exports.elapsedTimeFromNow = exports.dateSchema = exports.optionalDateSchema = exports.validateDateRange = exports.
|
|
6
|
+
exports.buildDayjs = exports.elapsedTimeFromNow = exports.dateSchema = exports.optionalDateSchema = exports.validateDateRange = exports.validateIsPastOrPresentSafe = exports.validateIsPastOrPresent = exports.isValidISODate = exports.ISO_DATE = void 0;
|
|
7
7
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
8
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
9
9
|
const zod_1 = require("zod");
|
|
@@ -17,19 +17,19 @@ exports.isValidISODate = isValidISODate;
|
|
|
17
17
|
function isValidISODateOptional(date) {
|
|
18
18
|
return date ? isValidISODate(date) : true;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
if ((
|
|
22
|
-
throw new bad_request_1.BadRequestError(`Date
|
|
20
|
+
function validateIsPastOrPresent(date) {
|
|
21
|
+
if (!validateIsPastOrPresentSafe(date)) {
|
|
22
|
+
throw new bad_request_1.BadRequestError(`Date can't be in the future`, undefined, { date });
|
|
23
23
|
}
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
|
-
exports.
|
|
27
|
-
function
|
|
26
|
+
exports.validateIsPastOrPresent = validateIsPastOrPresent;
|
|
27
|
+
function validateIsPastOrPresentSafe(date) {
|
|
28
28
|
if ((0, dayjs_1.default)(date).isAfter((0, dayjs_1.default)()))
|
|
29
29
|
return false;
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
|
-
exports.
|
|
32
|
+
exports.validateIsPastOrPresentSafe = validateIsPastOrPresentSafe;
|
|
33
33
|
function validateDateRange(start, end) {
|
|
34
34
|
if ((0, dayjs_1.default)(start).isAfter(end)) {
|
|
35
35
|
throw new bad_request_1.BadRequestError(`Invalid date range: 'start' must be before 'end'`, undefined, {
|
package/dist/common/date.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/common/date.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,2DAAmC;AAEnC,6BAA2C;AAC3C,sDAAuD;AAEvD,eAAK,CAAC,MAAM,CAAC,aAAG,CAAC,CAAC;AAEL,QAAA,QAAQ,GAAG,YAAY,CAAC;AAErC,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,UAAU,CAAC,IAAI,EAAE,gBAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AACpD,CAAC;AAFD,wCAEC;AAED,SAAS,sBAAsB,CAAC,IAA+B;IAC7D,OAAO,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC;AAED,SAAgB,
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/common/date.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,2DAAmC;AAEnC,6BAA2C;AAC3C,sDAAuD;AAEvD,eAAK,CAAC,MAAM,CAAC,aAAG,CAAC,CAAC;AAEL,QAAA,QAAQ,GAAG,YAAY,CAAC;AAErC,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,UAAU,CAAC,IAAI,EAAE,gBAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AACpD,CAAC;AAFD,wCAEC;AAED,SAAS,sBAAsB,CAAC,IAA+B;IAC7D,OAAO,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC;AAED,SAAgB,uBAAuB,CAAC,IAAY;IAClD,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,EAAE;QACtC,MAAM,IAAI,6BAAe,CAAC,6BAA6B,E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 export declare const baseWebhookMetadataSchema: z.ZodObject<{
|
|
|
33
33
|
data?: unknown;
|
|
34
34
|
}>;
|
|
35
35
|
export declare const webhookMetadataSchema: z.ZodObject<{
|
|
36
|
-
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
37
36
|
messageId: z.ZodString;
|
|
38
37
|
when: z.ZodEffects<z.ZodString, string, string>;
|
|
38
|
+
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
39
39
|
type: z.ZodString;
|
|
40
40
|
}, "strip", z.ZodTypeAny, {
|
|
41
41
|
type: string;
|
|
@@ -51,9 +51,9 @@ export declare const webhookMetadataSchema: z.ZodObject<{
|
|
|
51
51
|
export type WebhookMetadata = z.infer<typeof webhookMetadataSchema>;
|
|
52
52
|
export declare const pingWebhookRequestDataSchema: z.ZodObject<{
|
|
53
53
|
meta: z.ZodObject<{
|
|
54
|
-
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
55
54
|
messageId: z.ZodString;
|
|
56
55
|
when: z.ZodEffects<z.ZodString, string, string>;
|
|
56
|
+
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
57
57
|
type: z.ZodLiteral<"ping">;
|
|
58
58
|
}, "strip", z.ZodTypeAny, {
|
|
59
59
|
type: "ping";
|
|
@@ -68,21 +68,21 @@ export declare const pingWebhookRequestDataSchema: z.ZodObject<{
|
|
|
68
68
|
}>;
|
|
69
69
|
ping: z.ZodString;
|
|
70
70
|
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
ping: string;
|
|
71
72
|
meta: {
|
|
72
73
|
type: "ping";
|
|
73
74
|
messageId: string;
|
|
74
75
|
when: string;
|
|
75
76
|
data?: unknown;
|
|
76
77
|
};
|
|
77
|
-
ping: string;
|
|
78
78
|
}, {
|
|
79
|
+
ping: string;
|
|
79
80
|
meta: {
|
|
80
81
|
type: "ping";
|
|
81
82
|
messageId: string;
|
|
82
83
|
when: string;
|
|
83
84
|
data?: unknown;
|
|
84
85
|
};
|
|
85
|
-
ping: string;
|
|
86
86
|
}>;
|
|
87
87
|
export type PingWebhookRequest = z.infer<typeof pingWebhookRequestDataSchema>;
|
|
88
88
|
export declare const filtersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodOptional<z.ZodNullable<z.ZodBoolean>>]>>;
|
|
@@ -105,9 +105,9 @@ export declare const consolidatedWebhookPatientSchema: z.ZodObject<{
|
|
|
105
105
|
export type ConsolidatedWebhookPatient = z.infer<typeof consolidatedWebhookPatientSchema>;
|
|
106
106
|
export declare const consolidatedWebhookRequestSchema: z.ZodObject<{
|
|
107
107
|
meta: z.ZodObject<{
|
|
108
|
-
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
109
108
|
messageId: z.ZodString;
|
|
110
109
|
when: z.ZodEffects<z.ZodString, string, string>;
|
|
110
|
+
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
111
111
|
type: z.ZodLiteral<"medical.consolidated-data">;
|
|
112
112
|
}, "strip", z.ZodTypeAny, {
|
|
113
113
|
type: "medical.consolidated-data";
|
|
@@ -137,38 +137,38 @@ export declare const consolidatedWebhookRequestSchema: z.ZodObject<{
|
|
|
137
137
|
filters?: Record<string, string | boolean | null | undefined> | null | undefined;
|
|
138
138
|
}>, "many">;
|
|
139
139
|
}, "strip", z.ZodTypeAny, {
|
|
140
|
-
patients: {
|
|
141
|
-
status: "completed" | "failed";
|
|
142
|
-
patientId: string;
|
|
143
|
-
bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
|
|
144
|
-
filters?: Record<string, string | boolean | null | undefined> | null | undefined;
|
|
145
|
-
}[];
|
|
146
140
|
meta: {
|
|
147
141
|
type: "medical.consolidated-data";
|
|
148
142
|
messageId: string;
|
|
149
143
|
when: string;
|
|
150
144
|
data?: unknown;
|
|
151
145
|
};
|
|
152
|
-
}, {
|
|
153
146
|
patients: {
|
|
154
147
|
status: "completed" | "failed";
|
|
155
148
|
patientId: string;
|
|
156
149
|
bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
|
|
157
150
|
filters?: Record<string, string | boolean | null | undefined> | null | undefined;
|
|
158
151
|
}[];
|
|
152
|
+
}, {
|
|
159
153
|
meta: {
|
|
160
154
|
type: "medical.consolidated-data";
|
|
161
155
|
messageId: string;
|
|
162
156
|
when: string;
|
|
163
157
|
data?: unknown;
|
|
164
158
|
};
|
|
159
|
+
patients: {
|
|
160
|
+
status: "completed" | "failed";
|
|
161
|
+
patientId: string;
|
|
162
|
+
bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
|
|
163
|
+
filters?: Record<string, string | boolean | null | undefined> | null | undefined;
|
|
164
|
+
}[];
|
|
165
165
|
}>;
|
|
166
166
|
export type ConsolidatedWebhookRequest = z.infer<typeof consolidatedWebhookRequestSchema>;
|
|
167
167
|
export declare const documentDownloadWebhookRequestSchema: z.ZodObject<{
|
|
168
168
|
meta: z.ZodObject<{
|
|
169
|
-
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
170
169
|
messageId: z.ZodString;
|
|
171
170
|
when: z.ZodEffects<z.ZodString, string, string>;
|
|
171
|
+
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
172
172
|
type: z.ZodLiteral<"medical.document-download">;
|
|
173
173
|
}, "strip", z.ZodTypeAny, {
|
|
174
174
|
type: "medical.document-download";
|
|
@@ -199,9 +199,9 @@ export declare const documentDownloadWebhookRequestSchema: z.ZodObject<{
|
|
|
199
199
|
export type DocumentDownloadWebhookRequest = z.infer<typeof documentDownloadWebhookRequestSchema>;
|
|
200
200
|
export declare const documentConversionWebhookRequestSchema: z.ZodObject<{
|
|
201
201
|
meta: z.ZodObject<{
|
|
202
|
-
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
203
202
|
messageId: z.ZodString;
|
|
204
203
|
when: z.ZodEffects<z.ZodString, string, string>;
|
|
204
|
+
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
205
205
|
type: z.ZodLiteral<"medical.document-conversion">;
|
|
206
206
|
}, "strip", z.ZodTypeAny, {
|
|
207
207
|
type: "medical.document-conversion";
|
|
@@ -232,9 +232,9 @@ export declare const documentConversionWebhookRequestSchema: z.ZodObject<{
|
|
|
232
232
|
export type DocumentConversionWebhookRequest = z.infer<typeof documentConversionWebhookRequestSchema>;
|
|
233
233
|
export declare const documentBulkDownloadWebhookRequestSchema: z.ZodObject<{
|
|
234
234
|
meta: z.ZodObject<{
|
|
235
|
-
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
236
235
|
messageId: z.ZodString;
|
|
237
236
|
when: z.ZodEffects<z.ZodString, string, string>;
|
|
237
|
+
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
238
238
|
type: z.ZodLiteral<"medical.document-bulk-download-urls">;
|
|
239
239
|
}, "strip", z.ZodTypeAny, {
|
|
240
240
|
type: "medical.document-bulk-download-urls";
|
|
@@ -265,9 +265,9 @@ export declare const documentBulkDownloadWebhookRequestSchema: z.ZodObject<{
|
|
|
265
265
|
export type DocumentBulkDownloadWebhookRequest = z.infer<typeof documentBulkDownloadWebhookRequestSchema>;
|
|
266
266
|
export declare const webhookRequestSchema: z.ZodUnion<[z.ZodObject<{
|
|
267
267
|
meta: z.ZodObject<{
|
|
268
|
-
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
269
268
|
messageId: z.ZodString;
|
|
270
269
|
when: z.ZodEffects<z.ZodString, string, string>;
|
|
270
|
+
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
271
271
|
type: z.ZodLiteral<"ping">;
|
|
272
272
|
}, "strip", z.ZodTypeAny, {
|
|
273
273
|
type: "ping";
|
|
@@ -282,26 +282,26 @@ export declare const webhookRequestSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
282
282
|
}>;
|
|
283
283
|
ping: z.ZodString;
|
|
284
284
|
}, "strip", z.ZodTypeAny, {
|
|
285
|
+
ping: string;
|
|
285
286
|
meta: {
|
|
286
287
|
type: "ping";
|
|
287
288
|
messageId: string;
|
|
288
289
|
when: string;
|
|
289
290
|
data?: unknown;
|
|
290
291
|
};
|
|
291
|
-
ping: string;
|
|
292
292
|
}, {
|
|
293
|
+
ping: string;
|
|
293
294
|
meta: {
|
|
294
295
|
type: "ping";
|
|
295
296
|
messageId: string;
|
|
296
297
|
when: string;
|
|
297
298
|
data?: unknown;
|
|
298
299
|
};
|
|
299
|
-
ping: string;
|
|
300
300
|
}>, z.ZodObject<{
|
|
301
301
|
meta: z.ZodObject<{
|
|
302
|
-
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
303
302
|
messageId: z.ZodString;
|
|
304
303
|
when: z.ZodEffects<z.ZodString, string, string>;
|
|
304
|
+
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
305
305
|
type: z.ZodLiteral<"medical.consolidated-data">;
|
|
306
306
|
}, "strip", z.ZodTypeAny, {
|
|
307
307
|
type: "medical.consolidated-data";
|
|
@@ -331,36 +331,36 @@ export declare const webhookRequestSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
331
331
|
filters?: Record<string, string | boolean | null | undefined> | null | undefined;
|
|
332
332
|
}>, "many">;
|
|
333
333
|
}, "strip", z.ZodTypeAny, {
|
|
334
|
-
patients: {
|
|
335
|
-
status: "completed" | "failed";
|
|
336
|
-
patientId: string;
|
|
337
|
-
bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
|
|
338
|
-
filters?: Record<string, string | boolean | null | undefined> | null | undefined;
|
|
339
|
-
}[];
|
|
340
334
|
meta: {
|
|
341
335
|
type: "medical.consolidated-data";
|
|
342
336
|
messageId: string;
|
|
343
337
|
when: string;
|
|
344
338
|
data?: unknown;
|
|
345
339
|
};
|
|
346
|
-
}, {
|
|
347
340
|
patients: {
|
|
348
341
|
status: "completed" | "failed";
|
|
349
342
|
patientId: string;
|
|
350
343
|
bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
|
|
351
344
|
filters?: Record<string, string | boolean | null | undefined> | null | undefined;
|
|
352
345
|
}[];
|
|
346
|
+
}, {
|
|
353
347
|
meta: {
|
|
354
348
|
type: "medical.consolidated-data";
|
|
355
349
|
messageId: string;
|
|
356
350
|
when: string;
|
|
357
351
|
data?: unknown;
|
|
358
352
|
};
|
|
353
|
+
patients: {
|
|
354
|
+
status: "completed" | "failed";
|
|
355
|
+
patientId: string;
|
|
356
|
+
bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
|
|
357
|
+
filters?: Record<string, string | boolean | null | undefined> | null | undefined;
|
|
358
|
+
}[];
|
|
359
359
|
}>, z.ZodObject<{
|
|
360
360
|
meta: z.ZodObject<{
|
|
361
|
-
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
362
361
|
messageId: z.ZodString;
|
|
363
362
|
when: z.ZodEffects<z.ZodString, string, string>;
|
|
363
|
+
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
364
364
|
type: z.ZodLiteral<"medical.document-download">;
|
|
365
365
|
}, "strip", z.ZodTypeAny, {
|
|
366
366
|
type: "medical.document-download";
|
|
@@ -389,9 +389,9 @@ export declare const webhookRequestSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
389
389
|
};
|
|
390
390
|
}>, z.ZodObject<{
|
|
391
391
|
meta: z.ZodObject<{
|
|
392
|
-
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
393
392
|
messageId: z.ZodString;
|
|
394
393
|
when: z.ZodEffects<z.ZodString, string, string>;
|
|
394
|
+
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
395
395
|
type: z.ZodLiteral<"medical.document-conversion">;
|
|
396
396
|
}, "strip", z.ZodTypeAny, {
|
|
397
397
|
type: "medical.document-conversion";
|
|
@@ -420,9 +420,9 @@ export declare const webhookRequestSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
420
420
|
};
|
|
421
421
|
}>, z.ZodObject<{
|
|
422
422
|
meta: z.ZodObject<{
|
|
423
|
-
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
424
423
|
messageId: z.ZodString;
|
|
425
424
|
when: z.ZodEffects<z.ZodString, string, string>;
|
|
425
|
+
data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
426
426
|
type: z.ZodLiteral<"medical.document-bulk-download-urls">;
|
|
427
427
|
}, "strip", z.ZodTypeAny, {
|
|
428
428
|
type: "medical.document-bulk-download-urls";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metriport/shared",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.1",
|
|
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/",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"url": "https://github.com/metriport/metriport/issues"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
|
-
"clean": "rimraf dist
|
|
53
|
+
"clean": "rimraf dist",
|
|
54
|
+
"deepclean": "npm run clean && rimraf node_modules",
|
|
54
55
|
"tsc": "tsc",
|
|
55
56
|
"watch": "tsc --watch",
|
|
56
57
|
"build": "tsc -p .",
|
|
@@ -65,5 +66,5 @@
|
|
|
65
66
|
"devDependencies": {
|
|
66
67
|
"@faker-js/faker": "^8.0.2"
|
|
67
68
|
},
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "09a06299b2c6ecf0a8a1500e0dcf2a40dff23edd"
|
|
69
70
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number.test.d.ts","sourceRoot":"","sources":["../../../src/common/__tests__/number.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const numbers_1 = require("../numbers");
|
|
4
|
-
describe("numbers", () => {
|
|
5
|
-
it("returns undefined when it gets undefined", async () => {
|
|
6
|
-
const resp = (0, numbers_1.formatNumber)(12.23454616);
|
|
7
|
-
console.log(resp);
|
|
8
|
-
});
|
|
9
|
-
});
|
|
10
|
-
//# sourceMappingURL=number.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number.test.js","sourceRoot":"","sources":["../../../src/common/__tests__/number.test.ts"],"names":[],"mappings":";;AAAA,wCAA0C;AAE1C,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;QACxD,MAAM,IAAI,GAAG,IAAA,sBAAY,EAAC,WAAW,CAAC,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string.test copy.d.ts","sourceRoot":"","sources":["../../../src/common/__tests__/string.test copy.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const numbers_1 = require("../numbers");
|
|
4
|
-
describe("numbers", () => {
|
|
5
|
-
it("returns undefined when it gets undefined", async () => {
|
|
6
|
-
const resp = (0, numbers_1.formatNumber)(12.23454616);
|
|
7
|
-
console.log(resp);
|
|
8
|
-
});
|
|
9
|
-
});
|
|
10
|
-
//# sourceMappingURL=string.test%20copy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string.test copy.js","sourceRoot":"","sources":["../../../src/common/__tests__/string.test copy.ts"],"names":[],"mappings":";;AAAA,wCAA0C;AAE1C,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;QACxD,MAAM,IAAI,GAAG,IAAA,sBAAY,EAAC,WAAW,CAAC,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a valid NPI number that passes the validateNPI() function.
|
|
3
|
-
*
|
|
4
|
-
* Generated with by Anthropic's Claude 3.5.
|
|
5
|
-
* Slightly updated by human.
|
|
6
|
-
*
|
|
7
|
-
* @returns A valid 10-digit NPI number as a string.
|
|
8
|
-
*/
|
|
9
|
-
export declare function makeNPI(): string;
|
|
10
|
-
//# sourceMappingURL=validate-npi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-npi.d.ts","sourceRoot":"","sources":["../../../src/common/__tests__/validate-npi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,OAAO,IAAI,MAAM,CAyBhC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeNPI = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Generates a valid NPI number that passes the validateNPI() function.
|
|
6
|
-
*
|
|
7
|
-
* Generated with by Anthropic's Claude 3.5.
|
|
8
|
-
* Slightly updated by human.
|
|
9
|
-
*
|
|
10
|
-
* @returns A valid 10-digit NPI number as a string.
|
|
11
|
-
*/
|
|
12
|
-
function makeNPI() {
|
|
13
|
-
const digits = [];
|
|
14
|
-
// Generate the first 9 digits
|
|
15
|
-
digits.push(Math.random() < 0.5 ? 1 : 2); // First digit is either 1 or 2
|
|
16
|
-
for (let i = 1; i < 9; i++) {
|
|
17
|
-
digits.push(Math.floor(Math.random() * 10));
|
|
18
|
-
}
|
|
19
|
-
let sum = 24; // Account for NPI prefix (80840)
|
|
20
|
-
let shouldDouble = true;
|
|
21
|
-
digits.forEach(digit => {
|
|
22
|
-
if (shouldDouble) {
|
|
23
|
-
digit *= 2;
|
|
24
|
-
if (digit > 9)
|
|
25
|
-
digit -= 9;
|
|
26
|
-
}
|
|
27
|
-
sum += digit;
|
|
28
|
-
shouldDouble = !shouldDouble;
|
|
29
|
-
});
|
|
30
|
-
const checkDigit = (10 - (sum % 10)) % 10;
|
|
31
|
-
digits.push(checkDigit);
|
|
32
|
-
return digits.join("");
|
|
33
|
-
}
|
|
34
|
-
exports.makeNPI = makeNPI;
|
|
35
|
-
//# sourceMappingURL=validate-npi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-npi.js","sourceRoot":"","sources":["../../../src/common/__tests__/validate-npi.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,SAAgB,OAAO;IACrB,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,8BAA8B;IAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,+BAA+B;IACzE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;KAC7C;IAED,IAAI,GAAG,GAAG,EAAE,CAAC,CAAC,iCAAiC;IAC/C,IAAI,YAAY,GAAG,IAAI,CAAC;IAExB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACrB,IAAI,YAAY,EAAE;YAChB,KAAK,IAAI,CAAC,CAAC;YACX,IAAI,KAAK,GAAG,CAAC;gBAAE,KAAK,IAAI,CAAC,CAAC;SAC3B;QACD,GAAG,IAAI,KAAK,CAAC;QACb,YAAY,GAAG,CAAC,YAAY,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;IAC1C,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAExB,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzB,CAAC;AAzBD,0BAyBC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { PatientImportPatient } from "@metriport/shared";
|
|
2
|
-
import { PatientPayload } from "./patient-import";
|
|
3
|
-
export type FileStages = "raw" | "valid" | "invalid";
|
|
4
|
-
export declare function createFileKeyJob(cxId: string, jobId: string): string;
|
|
5
|
-
export declare function createFileKeyPatient(cxId: string, jobId: string, patientId: string): string;
|
|
6
|
-
export declare function createFileKeyFiles(cxId: string, jobId: string, stage: FileStages): string;
|
|
7
|
-
export declare const patientImportCsvHeaders: string[];
|
|
8
|
-
export declare function normalizeHeaders(headers: string[]): string[];
|
|
9
|
-
export declare function compareCsvHeaders(headers: string[], input: string[], exact?: boolean): boolean;
|
|
10
|
-
export type GenericObject = {
|
|
11
|
-
[key: string]: string | undefined;
|
|
12
|
-
};
|
|
13
|
-
export declare function createObjectFromCsv({ rowColumns, headers, }: {
|
|
14
|
-
rowColumns: string[];
|
|
15
|
-
headers: string[];
|
|
16
|
-
}): GenericObject;
|
|
17
|
-
export declare function createPatientPayload(patient: PatientImportPatient): PatientPayload;
|
|
18
|
-
//# sourceMappingURL=patient-import-shared.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patient-import-shared.d.ts","sourceRoot":"","sources":["../../../../../../core/src/command/patient-import/patient-import-shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,oBAAoB,EAErB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;AAcrD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAI3F;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAIzF;AAED,eAAO,MAAM,uBAAuB,UAenC,CAAC;AAKF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAM5D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,UAAQ,GAAG,OAAO,CAM5F;AAED,MAAM,MAAM,aAAa,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAElE,wBAAgB,mBAAmB,CAAC,EAClC,UAAU,EACV,OAAO,GACR,EAAE;IACD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,aAAa,CAQhB;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,cAAc,CA2BlF"}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPatientPayload = exports.createObjectFromCsv = exports.compareCsvHeaders = exports.normalizeHeaders = exports.patientImportCsvHeaders = exports.createFileKeyFiles = exports.createFileKeyPatient = exports.createFileKeyJob = void 0;
|
|
4
|
-
const shared_1 = require("@metriport/shared");
|
|
5
|
-
const globalPrefix = "patient-import";
|
|
6
|
-
function createCxJobPrefix(cxId, jobId) {
|
|
7
|
-
return `cxid=${cxId}/jobid=${jobId}`;
|
|
8
|
-
}
|
|
9
|
-
function createFilePathPatients(cxId, jobId, patientId) {
|
|
10
|
-
return `${createCxJobPrefix(cxId, jobId)}/patients/patientid=${patientId}/status.json`;
|
|
11
|
-
}
|
|
12
|
-
function createFilePathFiles(cxId, jobId, stage) {
|
|
13
|
-
return `${createCxJobPrefix(cxId, jobId)}/files/${stage}.csv`;
|
|
14
|
-
}
|
|
15
|
-
function createFileKeyJob(cxId, jobId) {
|
|
16
|
-
return `${globalPrefix}/${createCxJobPrefix(cxId, jobId)}/status.json`;
|
|
17
|
-
}
|
|
18
|
-
exports.createFileKeyJob = createFileKeyJob;
|
|
19
|
-
function createFileKeyPatient(cxId, jobId, patientId) {
|
|
20
|
-
const fileName = createFilePathPatients(cxId, jobId, patientId);
|
|
21
|
-
const key = `${globalPrefix}/${fileName}`;
|
|
22
|
-
return key;
|
|
23
|
-
}
|
|
24
|
-
exports.createFileKeyPatient = createFileKeyPatient;
|
|
25
|
-
function createFileKeyFiles(cxId, jobId, stage) {
|
|
26
|
-
const fileName = createFilePathFiles(cxId, jobId, stage);
|
|
27
|
-
const key = `${globalPrefix}/${fileName}`;
|
|
28
|
-
return key;
|
|
29
|
-
}
|
|
30
|
-
exports.createFileKeyFiles = createFileKeyFiles;
|
|
31
|
-
exports.patientImportCsvHeaders = [
|
|
32
|
-
"externalid",
|
|
33
|
-
"firstname",
|
|
34
|
-
"lastname",
|
|
35
|
-
"dob",
|
|
36
|
-
"gender",
|
|
37
|
-
"zip",
|
|
38
|
-
"city",
|
|
39
|
-
"state",
|
|
40
|
-
"addressline1",
|
|
41
|
-
"addressline2",
|
|
42
|
-
"phone1",
|
|
43
|
-
"email1",
|
|
44
|
-
// "phone2",
|
|
45
|
-
// "email2",
|
|
46
|
-
];
|
|
47
|
-
const replaceCharacters = ["*"];
|
|
48
|
-
// TODO gotta accept email, email1, phone, phone1, etc
|
|
49
|
-
function normalizeHeaders(headers) {
|
|
50
|
-
let newHeaders = headers;
|
|
51
|
-
replaceCharacters.map(char => {
|
|
52
|
-
newHeaders = newHeaders.map(h => h.replace(char, "").toLowerCase());
|
|
53
|
-
});
|
|
54
|
-
return newHeaders;
|
|
55
|
-
}
|
|
56
|
-
exports.normalizeHeaders = normalizeHeaders;
|
|
57
|
-
function compareCsvHeaders(headers, input, exact = false) {
|
|
58
|
-
let newInput = input;
|
|
59
|
-
if (!exact) {
|
|
60
|
-
newInput = newInput.slice(0, headers.length);
|
|
61
|
-
}
|
|
62
|
-
return headers.toString() === newInput.toString();
|
|
63
|
-
}
|
|
64
|
-
exports.compareCsvHeaders = compareCsvHeaders;
|
|
65
|
-
function createObjectFromCsv({ rowColumns, headers, }) {
|
|
66
|
-
const object = {};
|
|
67
|
-
headers.forEach((header, columnIndex) => {
|
|
68
|
-
const value = rowColumns[columnIndex];
|
|
69
|
-
if (value === undefined)
|
|
70
|
-
throw Error("rowColumns and headers have different sizes");
|
|
71
|
-
object[header] = value.trim() === "" ? undefined : value;
|
|
72
|
-
});
|
|
73
|
-
return object;
|
|
74
|
-
}
|
|
75
|
-
exports.createObjectFromCsv = createObjectFromCsv;
|
|
76
|
-
function createPatientPayload(patient) {
|
|
77
|
-
const phone1 = patient.phone1 ? (0, shared_1.normalizePhoneNumberStrict)(patient.phone1) : undefined;
|
|
78
|
-
const email1 = patient.email1 ? (0, shared_1.normalizeEmailStrict)(patient.email1) : undefined;
|
|
79
|
-
const phone2 = patient.phone2 ? (0, shared_1.normalizePhoneNumberStrict)(patient.phone2) : undefined;
|
|
80
|
-
const email2 = patient.email2 ? (0, shared_1.normalizeEmailStrict)(patient.email2) : undefined;
|
|
81
|
-
const contact1 = phone1 || email1 ? { phone: phone1, email: email1 } : undefined;
|
|
82
|
-
const contact2 = phone2 || email2 ? { phone: phone2, email: email2 } : undefined;
|
|
83
|
-
const contact = [contact1, contact2].flatMap(c => c ?? []);
|
|
84
|
-
const externalId = patient.externalid ? (0, shared_1.normalizeExternalId)(patient.externalid) : undefined;
|
|
85
|
-
return {
|
|
86
|
-
externalId,
|
|
87
|
-
firstName: (0, shared_1.toTitleCase)(patient.firstname),
|
|
88
|
-
lastName: (0, shared_1.toTitleCase)(patient.lastname),
|
|
89
|
-
dob: (0, shared_1.normalizeDate)(patient.dob),
|
|
90
|
-
genderAtBirth: (0, shared_1.normalizeGender)(patient.gender),
|
|
91
|
-
address: [
|
|
92
|
-
{
|
|
93
|
-
addressLine1: (0, shared_1.toTitleCase)(patient.addressline1),
|
|
94
|
-
...(patient.addressline2 ? { addressLine2: (0, shared_1.toTitleCase)(patient.addressline2) } : undefined),
|
|
95
|
-
city: (0, shared_1.toTitleCase)(patient.city),
|
|
96
|
-
state: (0, shared_1.normalizeState)(patient.state),
|
|
97
|
-
zip: (0, shared_1.normalizeZipCode)(patient.zip),
|
|
98
|
-
country: "USA",
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
contact,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
exports.createPatientPayload = createPatientPayload;
|
|
105
|
-
// // TODO 2330 Move/merge this to shared's zip.ts
|
|
106
|
-
// export function normalizeZipCode(
|
|
107
|
-
// zipCode: string,
|
|
108
|
-
// // strict = false,
|
|
109
|
-
// normalizeFn = normalizeZipCodeSafe
|
|
110
|
-
// ): string {
|
|
111
|
-
// const zipOrUndefined = normalizeFn(zipCode);
|
|
112
|
-
// if (!zipOrUndefined) {
|
|
113
|
-
// throw new Error("Invalid Zip.");
|
|
114
|
-
// }
|
|
115
|
-
// return zipOrUndefined;
|
|
116
|
-
// }
|
|
117
|
-
// // TODO 2330 Move/merge this to shared's zip.ts
|
|
118
|
-
// // export function normalizeZipCodeSafe(zipCode: string, strict = false): string | undefined {
|
|
119
|
-
// export function normalizeZipCodeSafe(zipCode: string): string | undefined {
|
|
120
|
-
// // trim
|
|
121
|
-
// const trimmedZip = zipCode.trim();
|
|
122
|
-
// // if its empty, return undefined
|
|
123
|
-
// if (trimmedZip === "") return undefined;
|
|
124
|
-
// // validate zipCode has only numbers and dashes
|
|
125
|
-
// if (!trimmedZip.match(/^[0-9-]+$/)) return undefined;
|
|
126
|
-
// // if it has a dash, it should only have one dash
|
|
127
|
-
// if (trimmedZip.includes("-") && trimmedZip.split("-").length !== 2) return undefined;
|
|
128
|
-
// const mainPart = trimmedZip.split("-")[0];
|
|
129
|
-
// if (!mainPart) return trimmedZip;
|
|
130
|
-
// // if it has 5 digits, return
|
|
131
|
-
// if (mainPart.length === 5) return mainPart;
|
|
132
|
-
// // if it has less than 5 digits, left pad with 0s
|
|
133
|
-
// if (mainPart.length < 5) return mainPart.padStart(5, "0");
|
|
134
|
-
// // if it has more than 5 digits, return the first 5
|
|
135
|
-
// return mainPart.slice(0, 5);
|
|
136
|
-
// }
|
|
137
|
-
//# sourceMappingURL=patient-import-shared.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patient-import-shared.js","sourceRoot":"","sources":["../../../../../../core/src/command/patient-import/patient-import-shared.ts"],"names":[],"mappings":";;;AAAA,8CAU2B;AAG3B,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAItC,SAAS,iBAAiB,CAAC,IAAY,EAAE,KAAa;IACpD,OAAO,QAAQ,IAAI,UAAU,KAAK,EAAE,CAAC;AACvC,CAAC;AAED,SAAS,sBAAsB,CAAC,IAAY,EAAE,KAAa,EAAE,SAAiB;IAC5E,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,uBAAuB,SAAS,cAAc,CAAC;AACzF,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAY,EAAE,KAAa,EAAE,KAAiB;IACzE,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU,KAAK,MAAM,CAAC;AAChE,CAAC;AAED,SAAgB,gBAAgB,CAAC,IAAY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