@awell-health/awell-extensions 2.0.226 → 2.0.228

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 (33) hide show
  1. package/dist/extensions/elation/actions/createPatient/__testdata__/createPatient.mock.d.ts +53 -0
  2. package/dist/extensions/elation/actions/createPatient/__testdata__/createPatient.mock.js +57 -0
  3. package/dist/extensions/elation/actions/createPatient/__testdata__/createPatient.mock.js.map +1 -0
  4. package/dist/extensions/elation/actions/createPatient/config/dataPoints.d.ts +6 -0
  5. package/dist/extensions/elation/actions/createPatient/config/dataPoints.js +10 -0
  6. package/dist/extensions/elation/actions/createPatient/config/dataPoints.js.map +1 -0
  7. package/dist/extensions/elation/actions/createPatient/config/fields.d.ts +258 -0
  8. package/dist/extensions/elation/actions/{createPatient.js → createPatient/config/fields.js} +81 -116
  9. package/dist/extensions/elation/actions/createPatient/config/fields.js.map +1 -0
  10. package/dist/extensions/elation/actions/createPatient/config/index.d.ts +2 -0
  11. package/dist/extensions/elation/actions/createPatient/config/index.js +9 -0
  12. package/dist/extensions/elation/actions/createPatient/config/index.js.map +1 -0
  13. package/dist/extensions/elation/actions/createPatient/createPatient.d.ts +4 -0
  14. package/dist/extensions/elation/actions/createPatient/createPatient.js +79 -0
  15. package/dist/extensions/elation/actions/createPatient/createPatient.js.map +1 -0
  16. package/dist/extensions/elation/actions/createPatient/index.d.ts +1 -0
  17. package/dist/extensions/elation/actions/createPatient/index.js +6 -0
  18. package/dist/extensions/elation/actions/createPatient/index.js.map +1 -0
  19. package/dist/extensions/elation/actions/index.d.ts +42 -0
  20. package/dist/extensions/elation/client.d.ts +2 -2
  21. package/dist/extensions/elation/client.js +1 -1
  22. package/dist/extensions/elation/client.js.map +1 -1
  23. package/dist/extensions/elation/validation/patient.zod.d.ts +8 -0
  24. package/dist/extensions/elation/validation/patient.zod.js +25 -25
  25. package/dist/extensions/elation/validation/patient.zod.js.map +1 -1
  26. package/dist/extensions/elation/webhooks/appointmentCreatedOrUpdated.js +6 -5
  27. package/dist/extensions/elation/webhooks/appointmentCreatedOrUpdated.js.map +1 -1
  28. package/dist/extensions/elation/webhooks/patientCreatedOrUpdated.js +6 -5
  29. package/dist/extensions/elation/webhooks/patientCreatedOrUpdated.js.map +1 -1
  30. package/dist/extensions/markdown.json +1 -1
  31. package/package.json +2 -2
  32. package/dist/extensions/elation/actions/createPatient.d.ts +0 -153
  33. package/dist/extensions/elation/actions/createPatient.js.map +0 -1
@@ -0,0 +1,53 @@
1
+ export declare const CreatePatientSuccessMock: {
2
+ status: number;
3
+ statusText: string;
4
+ data: {
5
+ id: number;
6
+ actual_name: null;
7
+ address: null;
8
+ caregiver_practice: number;
9
+ consents: never[];
10
+ created_date: string;
11
+ deleted_date: null;
12
+ deleted_insurances: never[];
13
+ dob: string;
14
+ emails: never[];
15
+ emergency_contact: null;
16
+ employer: null;
17
+ ethnicity: "No ethnicity specified";
18
+ first_name: string;
19
+ gender_identity: "unknown";
20
+ guarantor: null;
21
+ insurances: never[];
22
+ last_name: string;
23
+ legal_gender_marker: null;
24
+ master_patient: null;
25
+ merged_into_chart: null;
26
+ metadata: null;
27
+ middle_name: string;
28
+ notes: null;
29
+ patient_status: {
30
+ deceased_date: null;
31
+ inactive_reason: null;
32
+ last_status_change: string;
33
+ notes: null;
34
+ status: "active";
35
+ };
36
+ phones: never[];
37
+ preference: null;
38
+ preferred_language: null;
39
+ preferred_service_location: null;
40
+ previous_first_name: null;
41
+ previous_last_name: null;
42
+ primary_care_provider: null;
43
+ primary_care_provider_npi: null;
44
+ primary_physician: number;
45
+ pronouns: null;
46
+ race: "No race specified";
47
+ sex: "Male";
48
+ sexual_orientation: "unknown";
49
+ ssn: null;
50
+ tags: never[];
51
+ vip: false;
52
+ };
53
+ };
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreatePatientSuccessMock = void 0;
4
+ exports.CreatePatientSuccessMock = {
5
+ status: 200,
6
+ statusText: 'OK',
7
+ data: {
8
+ id: 142857632874497,
9
+ actual_name: null,
10
+ address: null,
11
+ caregiver_practice: 141127173275652,
12
+ consents: [],
13
+ created_date: '2025-04-01T09:48:38Z',
14
+ deleted_date: null,
15
+ deleted_insurances: [],
16
+ dob: '1993-11-30',
17
+ emails: [],
18
+ emergency_contact: null,
19
+ employer: null,
20
+ ethnicity: 'No ethnicity specified',
21
+ first_name: 'Nick Test',
22
+ gender_identity: 'unknown',
23
+ guarantor: null,
24
+ insurances: [],
25
+ last_name: 'Test',
26
+ legal_gender_marker: null,
27
+ master_patient: null,
28
+ merged_into_chart: null,
29
+ metadata: null,
30
+ middle_name: '',
31
+ notes: null,
32
+ patient_status: {
33
+ deceased_date: null,
34
+ inactive_reason: null,
35
+ last_status_change: '2025-04-01T09:48:39Z',
36
+ notes: null,
37
+ status: 'active',
38
+ },
39
+ phones: [],
40
+ preference: null,
41
+ preferred_language: null,
42
+ preferred_service_location: null,
43
+ previous_first_name: null,
44
+ previous_last_name: null,
45
+ primary_care_provider: null,
46
+ primary_care_provider_npi: null,
47
+ primary_physician: 141377681883138,
48
+ pronouns: null,
49
+ race: 'No race specified',
50
+ sex: 'Male',
51
+ sexual_orientation: 'unknown',
52
+ ssn: null,
53
+ tags: [],
54
+ vip: false,
55
+ },
56
+ };
57
+ //# sourceMappingURL=createPatient.mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPatient.mock.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/createPatient/__testdata__/createPatient.mock.ts"],"names":[],"mappings":";;;AAIa,QAAA,wBAAwB,GAAG;IACtC,MAAM,EAAE,GAAG;IACX,UAAU,EAAE,IAAI;IAChB,IAAI,EAAE;QACJ,EAAE,EAAE,eAAe;QACnB,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,IAAI;QACb,kBAAkB,EAAE,eAAe;QACnC,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,sBAAsB;QACpC,YAAY,EAAE,IAAI;QAClB,kBAAkB,EAAE,EAAE;QACtB,GAAG,EAAE,YAAY;QACjB,MAAM,EAAE,EAAE;QACV,iBAAiB,EAAE,IAAI;QACvB,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,wBAAwB;QACnC,UAAU,EAAE,WAAW;QACvB,eAAe,EAAE,SAAS;QAC1B,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,MAAM;QACjB,mBAAmB,EAAE,IAAI;QACzB,cAAc,EAAE,IAAI;QACpB,iBAAiB,EAAE,IAAI;QACvB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,EAAE;QACf,KAAK,EAAE,IAAI;QACX,cAAc,EAAE;YACd,aAAa,EAAE,IAAI;YACnB,eAAe,EAAE,IAAI;YACrB,kBAAkB,EAAE,sBAAsB;YAC1C,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,QAAQ;SACjB;QACD,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,IAAI;QAChB,kBAAkB,EAAE,IAAI;QACxB,0BAA0B,EAAE,IAAI;QAChC,mBAAmB,EAAE,IAAI;QACzB,kBAAkB,EAAE,IAAI;QACxB,qBAAqB,EAAE,IAAI;QAC3B,yBAAyB,EAAE,IAAI;QAC/B,iBAAiB,EAAE,eAAe;QAClC,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,mBAAmB;QACzB,GAAG,EAAE,MAAM;QACX,kBAAkB,EAAE,SAAS;QAC7B,GAAG,EAAE,IAAI;QACT,IAAI,EAAE,EAAE;QACR,GAAG,EAAE,KAAK;KACX;CACoD,CAAA"}
@@ -0,0 +1,6 @@
1
+ export declare const dataPoints: {
2
+ patientId: {
3
+ key: string;
4
+ valueType: "number";
5
+ };
6
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataPoints = void 0;
4
+ exports.dataPoints = {
5
+ patientId: {
6
+ key: 'patientId',
7
+ valueType: 'number',
8
+ },
9
+ };
10
+ //# sourceMappingURL=dataPoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/createPatient/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA"}
@@ -0,0 +1,258 @@
1
+ import { z } from 'zod';
2
+ import { FieldType } from '@awell-health/extensions-core';
3
+ import { StringType } from '@awell-health/extensions-core';
4
+ export declare const fields: {
5
+ firstName: {
6
+ id: string;
7
+ label: string;
8
+ description: string;
9
+ type: FieldType.STRING;
10
+ required: true;
11
+ };
12
+ lastName: {
13
+ id: string;
14
+ label: string;
15
+ description: string;
16
+ type: FieldType.STRING;
17
+ required: true;
18
+ };
19
+ dob: {
20
+ id: string;
21
+ label: string;
22
+ description: string;
23
+ type: FieldType.DATE;
24
+ required: true;
25
+ };
26
+ sex: {
27
+ id: string;
28
+ label: string;
29
+ description: string;
30
+ type: FieldType.STRING;
31
+ required: true;
32
+ options: {
33
+ dropdownOptions: {
34
+ label: "Male" | "Female" | "Other" | "Unknown";
35
+ value: "Male" | "Female" | "Other" | "Unknown";
36
+ }[];
37
+ };
38
+ };
39
+ primaryPhysicianId: {
40
+ id: string;
41
+ label: string;
42
+ description: string;
43
+ type: FieldType.NUMERIC;
44
+ required: true;
45
+ };
46
+ caregiverPracticeId: {
47
+ id: string;
48
+ label: string;
49
+ description: string;
50
+ type: FieldType.NUMERIC;
51
+ required: true;
52
+ };
53
+ email: {
54
+ id: string;
55
+ label: string;
56
+ description: string;
57
+ type: FieldType.STRING;
58
+ required: false;
59
+ };
60
+ mobilePhone: {
61
+ id: string;
62
+ label: string;
63
+ description: string;
64
+ type: FieldType.STRING;
65
+ stringType: StringType.PHONE;
66
+ required: false;
67
+ };
68
+ middleName: {
69
+ id: string;
70
+ label: string;
71
+ description: string;
72
+ type: FieldType.STRING;
73
+ };
74
+ actualName: {
75
+ id: string;
76
+ label: string;
77
+ description: string;
78
+ type: FieldType.STRING;
79
+ };
80
+ genderIdentity: {
81
+ id: string;
82
+ label: string;
83
+ description: string;
84
+ type: FieldType.STRING;
85
+ options: {
86
+ dropdownOptions: {
87
+ label: string;
88
+ value: "unknown" | "man" | "woman" | "transgender_man" | "transgender_woman" | "nonbinary" | "option_not_listed" | "prefer_not_to_say" | "two_spirit";
89
+ }[];
90
+ };
91
+ };
92
+ legalGenderMarker: {
93
+ id: string;
94
+ label: string;
95
+ description: string;
96
+ type: FieldType.STRING;
97
+ options: {
98
+ dropdownOptions: {
99
+ label: string;
100
+ value: "M" | "F" | "X" | "U";
101
+ }[];
102
+ };
103
+ };
104
+ pronouns: {
105
+ id: string;
106
+ label: string;
107
+ description: string;
108
+ type: FieldType.STRING;
109
+ options: {
110
+ dropdownOptions: {
111
+ label: string;
112
+ value: "he_him_his" | "she_her_hers" | "they_them_theirs" | "not_listed";
113
+ }[];
114
+ };
115
+ };
116
+ sexualOrientation: {
117
+ id: string;
118
+ label: string;
119
+ description: string;
120
+ type: FieldType.STRING;
121
+ options: {
122
+ dropdownOptions: {
123
+ label: string;
124
+ value: "unknown" | "option_not_listed" | "prefer_not_to_say" | "straight" | "gay" | "bisexual" | "lesbian" | "queer" | "asexual";
125
+ }[];
126
+ };
127
+ };
128
+ ssn: {
129
+ id: string;
130
+ label: string;
131
+ description: string;
132
+ type: FieldType.STRING;
133
+ };
134
+ ethnicity: {
135
+ id: string;
136
+ label: string;
137
+ description: string;
138
+ type: FieldType.STRING;
139
+ options: {
140
+ dropdownOptions: {
141
+ label: string;
142
+ value: "Unknown" | "Declined to specify" | "No ethnicity specified" | "Hispanic or Latino" | "Not Hispanic or Latino";
143
+ }[];
144
+ };
145
+ };
146
+ race: {
147
+ id: string;
148
+ label: string;
149
+ description: string;
150
+ type: FieldType.STRING;
151
+ options: {
152
+ dropdownOptions: {
153
+ label: string;
154
+ value: "Other" | "No race specified" | "American Indian or Alaska Native" | "Asian" | "Black or African American" | "Native Hawaiian or Other Pacific Islander" | "White" | "Declined to specify";
155
+ }[];
156
+ };
157
+ };
158
+ preferredLanguage: {
159
+ id: string;
160
+ label: string;
161
+ description: string;
162
+ type: FieldType.STRING;
163
+ };
164
+ notes: {
165
+ id: string;
166
+ label: string;
167
+ description: string;
168
+ type: FieldType.STRING;
169
+ };
170
+ previousFirstName: {
171
+ id: string;
172
+ label: string;
173
+ description: string;
174
+ type: FieldType.STRING;
175
+ };
176
+ previousLastName: {
177
+ id: string;
178
+ label: string;
179
+ description: string;
180
+ type: FieldType.STRING;
181
+ };
182
+ tags: {
183
+ id: string;
184
+ label: string;
185
+ description: string;
186
+ type: FieldType.STRING;
187
+ };
188
+ };
189
+ export declare const FieldsValidationSchema: z.ZodObject<{
190
+ firstName: z.ZodString;
191
+ lastName: z.ZodString;
192
+ dob: z.ZodEffects<z.ZodDate, string, Date>;
193
+ sex: z.ZodEnum<["Male", "Female", "Other", "Unknown"]>;
194
+ primaryPhysicianId: z.ZodNumber;
195
+ caregiverPracticeId: z.ZodNumber;
196
+ email: z.ZodOptional<z.ZodString>;
197
+ mobilePhone: z.ZodOptional<z.ZodString>;
198
+ middleName: z.ZodOptional<z.ZodString>;
199
+ actualName: z.ZodOptional<z.ZodString>;
200
+ genderIdentity: z.ZodOptional<z.ZodEnum<["unknown", "man", "woman", "transgender_man", "transgender_woman", "nonbinary", "option_not_listed", "prefer_not_to_say", "two_spirit"]>>;
201
+ legalGenderMarker: z.ZodOptional<z.ZodEnum<["M", "F", "X", "U"]>>;
202
+ pronouns: z.ZodOptional<z.ZodEnum<["he_him_his", "she_her_hers", "they_them_theirs", "not_listed"]>>;
203
+ sexualOrientation: z.ZodOptional<z.ZodEnum<["unknown", "straight", "gay", "bisexual", "option_not_listed", "prefer_not_to_say", "lesbian", "queer", "asexual"]>>;
204
+ ssn: z.ZodOptional<z.ZodString>;
205
+ ethnicity: z.ZodOptional<z.ZodEnum<["No ethnicity specified", "Hispanic or Latino", "Not Hispanic or Latino", "Unknown", "Declined to specify"]>>;
206
+ race: z.ZodOptional<z.ZodEnum<["No race specified", "American Indian or Alaska Native", "Asian", "Black or African American", "Native Hawaiian or Other Pacific Islander", "White", "Other", "Declined to specify"]>>;
207
+ preferredLanguage: z.ZodOptional<z.ZodString>;
208
+ notes: z.ZodOptional<z.ZodString>;
209
+ previousFirstName: z.ZodOptional<z.ZodString>;
210
+ previousLastName: z.ZodOptional<z.ZodString>;
211
+ tags: z.ZodEffects<z.ZodOptional<z.ZodString>, string[] | undefined, string | undefined>;
212
+ }, "strip", z.ZodTypeAny, {
213
+ firstName: string;
214
+ lastName: string;
215
+ dob: string;
216
+ sex: "Male" | "Female" | "Other" | "Unknown";
217
+ primaryPhysicianId: number;
218
+ caregiverPracticeId: number;
219
+ email?: string | undefined;
220
+ mobilePhone?: string | undefined;
221
+ preferredLanguage?: string | undefined;
222
+ ssn?: string | undefined;
223
+ tags?: string[] | undefined;
224
+ genderIdentity?: "unknown" | "man" | "woman" | "transgender_man" | "transgender_woman" | "nonbinary" | "option_not_listed" | "prefer_not_to_say" | "two_spirit" | undefined;
225
+ middleName?: string | undefined;
226
+ notes?: string | undefined;
227
+ pronouns?: "he_him_his" | "she_her_hers" | "they_them_theirs" | "not_listed" | undefined;
228
+ race?: "Other" | "No race specified" | "American Indian or Alaska Native" | "Asian" | "Black or African American" | "Native Hawaiian or Other Pacific Islander" | "White" | "Declined to specify" | undefined;
229
+ ethnicity?: "Unknown" | "Declined to specify" | "No ethnicity specified" | "Hispanic or Latino" | "Not Hispanic or Latino" | undefined;
230
+ actualName?: string | undefined;
231
+ legalGenderMarker?: "M" | "F" | "X" | "U" | undefined;
232
+ sexualOrientation?: "unknown" | "option_not_listed" | "prefer_not_to_say" | "straight" | "gay" | "bisexual" | "lesbian" | "queer" | "asexual" | undefined;
233
+ previousFirstName?: string | undefined;
234
+ previousLastName?: string | undefined;
235
+ }, {
236
+ firstName: string;
237
+ lastName: string;
238
+ dob: Date;
239
+ sex: "Male" | "Female" | "Other" | "Unknown";
240
+ primaryPhysicianId: number;
241
+ caregiverPracticeId: number;
242
+ email?: string | undefined;
243
+ mobilePhone?: string | undefined;
244
+ preferredLanguage?: string | undefined;
245
+ ssn?: string | undefined;
246
+ tags?: string | undefined;
247
+ genderIdentity?: "unknown" | "man" | "woman" | "transgender_man" | "transgender_woman" | "nonbinary" | "option_not_listed" | "prefer_not_to_say" | "two_spirit" | undefined;
248
+ middleName?: string | undefined;
249
+ notes?: string | undefined;
250
+ pronouns?: "he_him_his" | "she_her_hers" | "they_them_theirs" | "not_listed" | undefined;
251
+ race?: "Other" | "No race specified" | "American Indian or Alaska Native" | "Asian" | "Black or African American" | "Native Hawaiian or Other Pacific Islander" | "White" | "Declined to specify" | undefined;
252
+ ethnicity?: "Unknown" | "Declined to specify" | "No ethnicity specified" | "Hispanic or Latino" | "Not Hispanic or Latino" | undefined;
253
+ actualName?: string | undefined;
254
+ legalGenderMarker?: "M" | "F" | "X" | "U" | undefined;
255
+ sexualOrientation?: "unknown" | "option_not_listed" | "prefer_not_to_say" | "straight" | "gay" | "bisexual" | "lesbian" | "queer" | "asexual" | undefined;
256
+ previousFirstName?: string | undefined;
257
+ previousLastName?: string | undefined;
258
+ }>;
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPatient = void 0;
4
- /* eslint-disable @typescript-eslint/naming-convention */
3
+ exports.FieldsValidationSchema = exports.fields = void 0;
5
4
  const zod_1 = require("zod");
6
5
  const extensions_core_1 = require("@awell-health/extensions-core");
7
6
  const extensions_core_2 = require("@awell-health/extensions-core");
8
- const client_1 = require("../client");
9
- const zod_validation_error_1 = require("zod-validation-error");
10
- const axios_1 = require("axios");
11
- const patient_zod_1 = require("../validation/patient.zod");
7
+ const patient_zod_1 = require("../../../validation/patient.zod");
12
8
  const lodash_1 = require("lodash");
13
- const fields = {
9
+ exports.fields = {
14
10
  firstName: {
15
11
  id: 'firstName',
16
12
  label: 'First name',
@@ -38,6 +34,12 @@ const fields = {
38
34
  description: "Possible values are 'Male', 'Female', 'Other', 'Unknown'",
39
35
  type: extensions_core_1.FieldType.STRING,
40
36
  required: true,
37
+ options: {
38
+ dropdownOptions: Object.values(patient_zod_1.sexEnum.enum).map((sex) => ({
39
+ label: sex,
40
+ value: sex,
41
+ })),
42
+ },
41
43
  },
42
44
  primaryPhysicianId: {
43
45
  id: 'primaryPhysicianId',
@@ -65,7 +67,7 @@ const fields = {
65
67
  label: 'Mobile phone',
66
68
  description: 'The number will be stored in US national format in Elation',
67
69
  type: extensions_core_1.FieldType.STRING,
68
- stringType: extensions_core_1.StringType.PHONE,
70
+ stringType: extensions_core_2.StringType.PHONE,
69
71
  required: false,
70
72
  },
71
73
  middleName: {
@@ -85,24 +87,48 @@ const fields = {
85
87
  label: 'Gender identity',
86
88
  description: "Possible values are 'unknown', 'man', 'woman', 'transgender_man', 'transgender_woman', 'nonbinary', 'option_not_listed', 'prefer_not_to_say', 'two_spirit'",
87
89
  type: extensions_core_1.FieldType.STRING,
90
+ options: {
91
+ dropdownOptions: Object.values(patient_zod_1.genderIdentityEnum.enum).map((genderIdentity) => ({
92
+ label: (0, lodash_1.startCase)(genderIdentity),
93
+ value: genderIdentity,
94
+ })),
95
+ },
88
96
  },
89
97
  legalGenderMarker: {
90
98
  id: 'legalGenderMarker',
91
99
  label: 'Legal gender marker',
92
100
  description: "Possible values are 'M', 'F', 'X', 'U'",
93
101
  type: extensions_core_1.FieldType.STRING,
102
+ options: {
103
+ dropdownOptions: Object.values(patient_zod_1.legalGenderMarkerEnum.enum).map((legalGenderMarker) => ({
104
+ label: (0, lodash_1.startCase)(legalGenderMarker),
105
+ value: legalGenderMarker,
106
+ })),
107
+ },
94
108
  },
95
109
  pronouns: {
96
110
  id: 'pronouns',
97
111
  label: 'Pronouns',
98
112
  description: "Pronouns by which a patient identifies self. Possible values are 'he_him_his', 'she_her_hers', 'they_them_theirs', 'not_listed'",
99
113
  type: extensions_core_1.FieldType.STRING,
114
+ options: {
115
+ dropdownOptions: Object.values(patient_zod_1.pronounsEnum.enum).map((pronouns) => ({
116
+ label: (0, lodash_1.startCase)(pronouns),
117
+ value: pronouns,
118
+ })),
119
+ },
100
120
  },
101
121
  sexualOrientation: {
102
122
  id: 'sexualOrientation',
103
123
  label: 'Sexual orientation',
104
124
  description: "Possible values are 'unknown', 'straight', 'gay', 'bisexual', 'option_not_listed', 'prefer_not_to_say', 'lesbian', 'queer', 'asexual'",
105
125
  type: extensions_core_1.FieldType.STRING,
126
+ options: {
127
+ dropdownOptions: Object.values(patient_zod_1.sexualOrientationEnum.enum).map((sexualOrientation) => ({
128
+ label: (0, lodash_1.startCase)(sexualOrientation),
129
+ value: sexualOrientation,
130
+ })),
131
+ },
106
132
  },
107
133
  ssn: {
108
134
  id: 'ssn',
@@ -115,12 +141,24 @@ const fields = {
115
141
  label: 'Ethnicity',
116
142
  description: "Possible values are 'No ethnicity specified', 'Hispanic or Latino', 'Not Hispanic or Latino', 'Declined to specify'.",
117
143
  type: extensions_core_1.FieldType.STRING,
144
+ options: {
145
+ dropdownOptions: Object.values(patient_zod_1.ethnicityEnum.enum).map((ethnicity) => ({
146
+ label: (0, lodash_1.startCase)(ethnicity),
147
+ value: ethnicity,
148
+ })),
149
+ },
118
150
  },
119
151
  race: {
120
152
  id: 'race',
121
153
  label: 'Race',
122
154
  description: "Possible values are 'No race specified', 'American Indian or Alaska Native', 'Asian', 'Black or African American', 'Native Hawaiian or Other Pacific Islander', 'White', 'Declined to specify'.",
123
155
  type: extensions_core_1.FieldType.STRING,
156
+ options: {
157
+ dropdownOptions: Object.values(patient_zod_1.raceEnum.enum).map((race) => ({
158
+ label: (0, lodash_1.startCase)(race),
159
+ value: race,
160
+ })),
161
+ },
124
162
  },
125
163
  preferredLanguage: {
126
164
  id: 'preferredLanguage',
@@ -153,112 +191,39 @@ const fields = {
153
191
  type: extensions_core_1.FieldType.STRING,
154
192
  },
155
193
  };
156
- const dataPoints = {
157
- patientId: {
158
- key: 'patientId',
159
- valueType: 'number',
160
- },
161
- };
162
- exports.createPatient = {
163
- key: 'createPatient',
164
- category: extensions_core_2.Category.EHR_INTEGRATIONS,
165
- title: 'Create Patient',
166
- description: "Create a patient profile using Elation's patient API.",
167
- fields,
168
- previewable: true,
169
- dataPoints,
170
- onActivityCreated: async (payload, onComplete, onError) => {
171
- var _a, _b;
172
- try {
173
- const { firstName, lastName, actualName, caregiverPracticeId, genderIdentity, legalGenderMarker, middleName, preferredLanguage, previousFirstName, previousLastName, primaryPhysicianId, sexualOrientation, dob, sex, email, mobilePhone, pronouns, ssn, ethnicity, race, notes, tags, } = payload.fields;
174
- const patientEmail = (0, lodash_1.isNil)(email) || (0, lodash_1.isEmpty)(email) ? undefined : [{ email }];
175
- const patientMobilePhone = (0, lodash_1.isNil)(mobilePhone) || (0, lodash_1.isEmpty)(mobilePhone)
176
- ? undefined
177
- : [{ phone: mobilePhone, phone_type: 'Mobile' }];
178
- const patientTags = (0, lodash_1.isNil)(tags) || (0, lodash_1.isEmpty)(tags)
179
- ? undefined
180
- : tags.split(',').map((tag) => tag.trim());
181
- const patient = patient_zod_1.patientSchema.parse({
182
- first_name: firstName,
183
- last_name: lastName,
184
- primary_physician: primaryPhysicianId,
185
- caregiver_practice: caregiverPracticeId,
186
- middle_name: middleName,
187
- actual_name: actualName,
188
- gender_identity: genderIdentity,
189
- legal_gender_marker: legalGenderMarker,
190
- sexual_orientation: sexualOrientation,
191
- preferred_language: preferredLanguage,
192
- previous_first_name: previousFirstName,
193
- previous_last_name: previousLastName,
194
- emails: patientEmail,
195
- phones: patientMobilePhone,
196
- dob,
197
- sex,
198
- pronouns,
199
- ssn,
200
- ethnicity,
201
- race,
202
- notes,
203
- tags: patientTags,
204
- });
205
- // API Call should produce AuthError or something dif.
206
- const api = (0, client_1.makeAPIClient)(payload.settings);
207
- const { id } = await api.createPatient(patient);
208
- await onComplete({
209
- data_points: {
210
- patientId: String(id),
211
- },
212
- });
213
- }
214
- catch (err) {
215
- if (err instanceof zod_1.ZodError) {
216
- const error = (0, zod_validation_error_1.fromZodError)(err);
217
- await onError({
218
- events: [
219
- {
220
- date: new Date().toISOString(),
221
- text: { en: error.message },
222
- error: {
223
- category: 'WRONG_INPUT',
224
- message: error.message,
225
- },
226
- },
227
- ],
228
- });
229
- }
230
- else if (err instanceof axios_1.AxiosError) {
231
- await onError({
232
- events: [
233
- {
234
- date: new Date().toISOString(),
235
- text: {
236
- en: `${(_a = err.status) !== null && _a !== void 0 ? _a : '(no status code)'} Error: ${err.message}`,
237
- },
238
- error: {
239
- category: 'SERVER_ERROR',
240
- message: `${(_b = err.status) !== null && _b !== void 0 ? _b : '(no status code)'} Error: ${err.message}`,
241
- },
242
- },
243
- ],
244
- });
245
- }
246
- else {
247
- const message = err.message;
248
- await onError({
249
- events: [
250
- {
251
- date: new Date().toISOString(),
252
- text: { en: message },
253
- error: {
254
- category: 'SERVER_ERROR',
255
- message,
256
- },
257
- },
258
- ],
259
- });
260
- }
194
+ exports.FieldsValidationSchema = zod_1.z.object({
195
+ firstName: zod_1.z.string().min(1),
196
+ lastName: zod_1.z.string().min(1),
197
+ dob: extensions_core_1.DateOnlySchema,
198
+ sex: patient_zod_1.sexEnum,
199
+ primaryPhysicianId: extensions_core_1.NumericIdSchema,
200
+ caregiverPracticeId: extensions_core_1.NumericIdSchema,
201
+ email: zod_1.z.string().email().optional(),
202
+ mobilePhone: zod_1.z.string().optional(),
203
+ middleName: zod_1.z.string().optional(),
204
+ actualName: zod_1.z.string().optional(),
205
+ genderIdentity: patient_zod_1.genderIdentityEnum.optional(),
206
+ legalGenderMarker: patient_zod_1.legalGenderMarkerEnum.optional(),
207
+ pronouns: patient_zod_1.pronounsEnum.optional(),
208
+ sexualOrientation: patient_zod_1.sexualOrientationEnum.optional(),
209
+ ssn: zod_1.z.string().optional(),
210
+ ethnicity: patient_zod_1.ethnicityEnum.optional(),
211
+ race: patient_zod_1.raceEnum.optional(),
212
+ preferredLanguage: zod_1.z.string().optional(),
213
+ notes: zod_1.z.string().optional(),
214
+ previousFirstName: zod_1.z.string().optional(),
215
+ previousLastName: zod_1.z.string().optional(),
216
+ tags: zod_1.z
217
+ .string()
218
+ .optional()
219
+ .transform((tags) => {
220
+ if ((0, lodash_1.isNil)(tags) || (0, lodash_1.isEmpty)(tags)) {
221
+ return undefined;
261
222
  }
262
- },
263
- };
264
- //# sourceMappingURL=createPatient.js.map
223
+ return tags
224
+ .trim()
225
+ .split(',')
226
+ .map((tag) => tag.trim());
227
+ }),
228
+ });
229
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/createPatient/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAIsC;AACtC,mEAAsE;AACtE,iEAQwC;AACxC,mCAAkD;AAErC,QAAA,MAAM,GAAG;IACpB,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,GAAG,EAAE;QACH,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;KACf;IACD,GAAG,EAAE;QACH,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,0DAA0D;QACvE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,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