@awell-health/awell-extensions 1.1.14 → 1.1.19
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +5 -1
- package/dist/extensions/elation/actions/findAppointments.d.ts +56 -0
- package/dist/extensions/elation/actions/findAppointments.js +79 -0
- package/dist/extensions/elation/actions/findAppointments.js.map +1 -0
- package/dist/extensions/elation/actions/getAppointment.d.ts +8 -0
- package/dist/extensions/elation/actions/getAppointment.js +28 -71
- package/dist/extensions/elation/actions/getAppointment.js.map +1 -1
- package/dist/extensions/elation/actions/getPatient.d.ts +4 -0
- package/dist/extensions/elation/actions/getPatient.js +35 -83
- package/dist/extensions/elation/actions/getPatient.js.map +1 -1
- package/dist/extensions/elation/actions/index.d.ts +94 -3
- package/dist/extensions/elation/actions/index.js +2 -0
- package/dist/extensions/elation/actions/index.js.map +1 -1
- package/dist/extensions/elation/actions/updatePatient.d.ts +6 -0
- package/dist/extensions/elation/actions/updatePatient.js +43 -86
- package/dist/extensions/elation/actions/updatePatient.js.map +1 -1
- package/dist/extensions/elation/client.d.ts +3 -1
- package/dist/extensions/elation/client.js +12 -0
- package/dist/extensions/elation/client.js.map +1 -1
- package/dist/extensions/elation/types/appointment.d.ts +16 -2
- package/dist/extensions/elation/validation/appointment.zod.d.ts +158 -2
- package/dist/extensions/elation/validation/appointment.zod.js +31 -2
- package/dist/extensions/elation/validation/appointment.zod.js.map +1 -1
- package/dist/extensions/markdown.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -11,6 +11,7 @@ Read about our contributing guidelines [here](https://developers.awellhealth.com
|
|
11
11
|
**Reviews may take between 2-5 business days to complete.** Please review our [contributing guidelines](https://developers.awellhealth.com/awell-extensions/docs/getting-started/contributing-guidelines) for our internal guidelines around PR reviews.
|
12
12
|
|
13
13
|
To help keep the PR process smooth, please try and remember to:
|
14
|
+
|
14
15
|
- Make sure your `settings`, `fields`, and `datapoints` are well defined and documented, including the use of [zod validation](https://zod.dev/);
|
15
16
|
- You have unittest coverage for your extension (see below for more details);
|
16
17
|
- You have included/updated the `README.md` and `CHANGELOG.md` files with your changes;
|
@@ -25,6 +26,7 @@ We encourage you to fork the repo and build custom actions and webhooks to suppo
|
|
25
26
|
## Releasing Extensions
|
26
27
|
|
27
28
|
When updates are made to the public extensions repository, the release process involves:
|
29
|
+
|
28
30
|
- Packaging a new release by merging into the `main` branch (internal engineers can test locally by creating a `release/vX.X.X` branch)
|
29
31
|
- Updating the `@awell-health/awell-extensions` dependency version in our private `awell-extension-server` repository
|
30
32
|
- Publishing a release of our private repository
|
@@ -35,12 +37,13 @@ This process is currently manual, and we ask you to please be patient with our P
|
|
35
37
|
### Testing extension actions
|
36
38
|
|
37
39
|
Extension actions can be tested in three ways. You can:
|
40
|
+
|
38
41
|
1. Create unit tests (recommended);
|
39
42
|
2. Use Cloud Pub/sub emulator ([instructions](https://developers.awellhealth.com/awell-extensions/docs/custom-actions/test-your-custom-actions)); or
|
40
43
|
3. Test deployed extensions in Awell Studio
|
41
44
|
|
42
45
|
Testing extensions in design is a great way to test your extension actions because it allows you to interact with real world components. If you want to test your extension in Awell Studio, be sure to set `previewable: true` in the extension action's settings.
|
43
|
-
Finally, if your extension action requires some sort of asynchronous completion by the user (e.g. cal.com's extension allows a user to book an appointment in Awell Hosted Pages), then you
|
46
|
+
Finally, if your extension action requires some sort of asynchronous completion by the user (e.g. cal.com's extension allows a user to book an appointment in Awell Hosted Pages), then you _will not_ be able to set `previewable: true` and the extension is not testable in this way.
|
44
47
|
|
45
48
|
### Actions and webhooks
|
46
49
|
|
@@ -63,5 +66,6 @@ Datapoints are decided at ![BUILD] time and can be used by the designers as inpu
|
|
63
66
|
Fields and datapoints provide you, the builders and designers, a powerful mechanism to take in variable data at one point in a care flow and use it in another place. The possibilities are endless!
|
64
67
|
|
65
68
|
### Extending OAuth
|
69
|
+
|
66
70
|
For those who require OAuth2.0 in your flows, there is a base client available in `@awell-health/extensions-core`. By extending that base client, you can include more complex authentication flows in your custom actions. Please see `./extensions/elation/client.ts` for an example of how you can create DataWrappers, API Clients, and the necessary datawrapper constructor that must be passed to the API client to create your flows.
|
67
71
|
Currently supported are Resource Owner Password Grant and Client Credentials Grant.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import { FieldType, type Action } from '@awell-health/extensions-core';
|
2
|
+
import { type settings } from '../settings';
|
3
|
+
declare const fields: {
|
4
|
+
patientId: {
|
5
|
+
id: string;
|
6
|
+
label: string;
|
7
|
+
type: FieldType.NUMERIC;
|
8
|
+
description: string;
|
9
|
+
};
|
10
|
+
physicianId: {
|
11
|
+
id: string;
|
12
|
+
label: string;
|
13
|
+
type: FieldType.NUMERIC;
|
14
|
+
description: string;
|
15
|
+
required: false;
|
16
|
+
};
|
17
|
+
practiceId: {
|
18
|
+
id: string;
|
19
|
+
label: string;
|
20
|
+
type: FieldType.NUMERIC;
|
21
|
+
description: string;
|
22
|
+
required: false;
|
23
|
+
};
|
24
|
+
from_date: {
|
25
|
+
id: string;
|
26
|
+
label: string;
|
27
|
+
type: FieldType.DATE;
|
28
|
+
description: string;
|
29
|
+
};
|
30
|
+
to_date: {
|
31
|
+
id: string;
|
32
|
+
label: string;
|
33
|
+
type: FieldType.DATE;
|
34
|
+
description: string;
|
35
|
+
required: false;
|
36
|
+
};
|
37
|
+
event_type: {
|
38
|
+
id: string;
|
39
|
+
label: string;
|
40
|
+
type: FieldType.STRING;
|
41
|
+
description: string;
|
42
|
+
required: false;
|
43
|
+
};
|
44
|
+
};
|
45
|
+
declare const dataPoints: {
|
46
|
+
appointments: {
|
47
|
+
key: string;
|
48
|
+
valueType: "json";
|
49
|
+
};
|
50
|
+
appointment_exists: {
|
51
|
+
key: string;
|
52
|
+
valueType: "boolean";
|
53
|
+
};
|
54
|
+
};
|
55
|
+
export declare const findAppointments: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
|
56
|
+
export {};
|
@@ -0,0 +1,79 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.findAppointments = void 0;
|
4
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
5
|
+
const client_1 = require("../client");
|
6
|
+
const appointment_zod_1 = require("../validation/appointment.zod");
|
7
|
+
const fields = {
|
8
|
+
patientId: {
|
9
|
+
id: 'patientId',
|
10
|
+
label: 'Patient ID',
|
11
|
+
type: extensions_core_1.FieldType.NUMERIC,
|
12
|
+
description: 'Patient ID',
|
13
|
+
},
|
14
|
+
physicianId: {
|
15
|
+
id: 'physicianId',
|
16
|
+
label: 'Physician ID',
|
17
|
+
type: extensions_core_1.FieldType.NUMERIC,
|
18
|
+
description: 'Physician ID',
|
19
|
+
required: false,
|
20
|
+
},
|
21
|
+
practiceId: {
|
22
|
+
id: 'practiceId',
|
23
|
+
label: 'Practice ID',
|
24
|
+
type: extensions_core_1.FieldType.NUMERIC,
|
25
|
+
description: 'Practice ID',
|
26
|
+
required: false,
|
27
|
+
},
|
28
|
+
from_date: {
|
29
|
+
id: 'from_date',
|
30
|
+
label: 'From Date',
|
31
|
+
type: extensions_core_1.FieldType.DATE,
|
32
|
+
description: 'Date from which to filter appointments',
|
33
|
+
},
|
34
|
+
to_date: {
|
35
|
+
id: 'to_date',
|
36
|
+
label: 'To date',
|
37
|
+
type: extensions_core_1.FieldType.DATE,
|
38
|
+
description: 'Date to which appointments are filtered',
|
39
|
+
required: false,
|
40
|
+
},
|
41
|
+
event_type: {
|
42
|
+
id: 'event_type',
|
43
|
+
label: 'Event Type',
|
44
|
+
type: extensions_core_1.FieldType.STRING,
|
45
|
+
description: 'Event Type (`appointment` or leave empty)',
|
46
|
+
required: false,
|
47
|
+
},
|
48
|
+
};
|
49
|
+
const dataPoints = {
|
50
|
+
appointments: {
|
51
|
+
key: 'appointments',
|
52
|
+
valueType: 'json',
|
53
|
+
},
|
54
|
+
appointment_exists: {
|
55
|
+
key: 'appointment_exists',
|
56
|
+
valueType: 'boolean',
|
57
|
+
},
|
58
|
+
};
|
59
|
+
exports.findAppointments = {
|
60
|
+
key: 'findAppointment',
|
61
|
+
category: extensions_core_1.Category.EHR_INTEGRATIONS,
|
62
|
+
title: 'Find Appointment',
|
63
|
+
description: 'Retrieve appointments for a given patient, physician, practice, and/or times',
|
64
|
+
fields,
|
65
|
+
previewable: true,
|
66
|
+
dataPoints,
|
67
|
+
onActivityCreated: async (payload, onComplete, onError) => {
|
68
|
+
const { fields, settings } = appointment_zod_1.FindAppointmentSchema.parse(payload);
|
69
|
+
const client = (0, client_1.makeAPIClient)(settings);
|
70
|
+
const resp = await client.findAppointments(fields);
|
71
|
+
await onComplete({
|
72
|
+
data_points: {
|
73
|
+
appointments: JSON.stringify(resp),
|
74
|
+
appointment_exists: resp.length > 0 ? 'true' : 'false',
|
75
|
+
},
|
76
|
+
});
|
77
|
+
},
|
78
|
+
};
|
79
|
+
//# sourceMappingURL=findAppointments.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"findAppointments.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/findAppointments.ts"],"names":[],"mappings":";;;AAAA,mEAMsC;AAEtC,sCAAyC;AACzC,mEAAqE;AAErE,MAAM,MAAM,GAAG;IACb,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,WAAW,EAAE,YAAY;KAC1B;IACD,WAAW,EAAE;QACX,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,WAAW,EAAE,cAAc;QAC3B,QAAQ,EAAE,KAAK;KAChB;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,WAAW,EAAE,aAAa;QAC1B,QAAQ,EAAE,KAAK;KAChB;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,2BAAS,CAAC,IA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C,CAAC,OAAO;aACvD;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -46,6 +46,14 @@ declare const dataPoints: {
|
|
46
46
|
key: string;
|
47
47
|
valueType: "string";
|
48
48
|
};
|
49
|
+
status: {
|
50
|
+
key: string;
|
51
|
+
valueType: "json";
|
52
|
+
};
|
53
|
+
appointment: {
|
54
|
+
key: string;
|
55
|
+
valueType: "json";
|
56
|
+
};
|
49
57
|
};
|
50
58
|
export declare const getAppointment: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
|
51
59
|
export {};
|
@@ -1,12 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getAppointment = void 0;
|
4
|
-
const zod_1 = require("zod");
|
5
4
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
6
5
|
const extensions_core_2 = require("@awell-health/extensions-core");
|
7
6
|
const client_1 = require("../client");
|
8
|
-
const zod_validation_error_1 = require("zod-validation-error");
|
9
|
-
const axios_1 = require("axios");
|
10
7
|
const fields = {
|
11
8
|
appointmentId: {
|
12
9
|
id: 'appointmentId',
|
@@ -53,6 +50,14 @@ const dataPoints = {
|
|
53
50
|
key: 'telehealthDetails',
|
54
51
|
valueType: 'string',
|
55
52
|
},
|
53
|
+
status: {
|
54
|
+
key: 'status',
|
55
|
+
valueType: 'json',
|
56
|
+
},
|
57
|
+
appointment: {
|
58
|
+
key: 'appointment',
|
59
|
+
valueType: 'json',
|
60
|
+
},
|
56
61
|
};
|
57
62
|
exports.getAppointment = {
|
58
63
|
key: 'getAppointment',
|
@@ -63,74 +68,26 @@ exports.getAppointment = {
|
|
63
68
|
previewable: true,
|
64
69
|
dataPoints,
|
65
70
|
onActivityCreated: async (payload, onComplete, onError) => {
|
66
|
-
var _a
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
}
|
85
|
-
}
|
86
|
-
catch (err) {
|
87
|
-
if (err instanceof zod_1.ZodError) {
|
88
|
-
const error = (0, zod_validation_error_1.fromZodError)(err);
|
89
|
-
await onError({
|
90
|
-
events: [
|
91
|
-
{
|
92
|
-
date: new Date().toISOString(),
|
93
|
-
text: { en: error.message },
|
94
|
-
error: {
|
95
|
-
category: 'SERVER_ERROR',
|
96
|
-
message: error.message,
|
97
|
-
},
|
98
|
-
},
|
99
|
-
],
|
100
|
-
});
|
101
|
-
}
|
102
|
-
else if (err instanceof axios_1.AxiosError) {
|
103
|
-
await onError({
|
104
|
-
events: [
|
105
|
-
{
|
106
|
-
date: new Date().toISOString(),
|
107
|
-
text: {
|
108
|
-
en: `${(_b = err.status) !== null && _b !== void 0 ? _b : '(no status code)'} Error: ${err.message}`,
|
109
|
-
},
|
110
|
-
error: {
|
111
|
-
category: 'BAD_REQUEST',
|
112
|
-
message: `${(_c = err.status) !== null && _c !== void 0 ? _c : '(no status code)'} Error: ${err.message}`,
|
113
|
-
},
|
114
|
-
},
|
115
|
-
],
|
116
|
-
});
|
117
|
-
}
|
118
|
-
else {
|
119
|
-
const message = err.message;
|
120
|
-
await onError({
|
121
|
-
events: [
|
122
|
-
{
|
123
|
-
date: new Date().toISOString(),
|
124
|
-
text: { en: message },
|
125
|
-
error: {
|
126
|
-
category: 'SERVER_ERROR',
|
127
|
-
message,
|
128
|
-
},
|
129
|
-
},
|
130
|
-
],
|
131
|
-
});
|
132
|
-
}
|
133
|
-
}
|
71
|
+
var _a;
|
72
|
+
const appointmentId = extensions_core_1.NumericIdSchema.parse(payload.fields.appointmentId);
|
73
|
+
// API Call should produce AuthError or something dif.
|
74
|
+
const api = (0, client_1.makeAPIClient)(payload.settings);
|
75
|
+
const appointment = await api.getAppointment(appointmentId);
|
76
|
+
await onComplete({
|
77
|
+
data_points: {
|
78
|
+
scheduledDate: appointment.scheduled_date,
|
79
|
+
reason: appointment.reason,
|
80
|
+
patientId: String(appointment.patient),
|
81
|
+
physicianId: String(appointment.physician),
|
82
|
+
practiceId: String(appointment.practice),
|
83
|
+
duration: String(appointment.duration),
|
84
|
+
description: appointment.description,
|
85
|
+
serviceLocationId: String((_a = appointment.service_location) === null || _a === void 0 ? void 0 : _a.id),
|
86
|
+
telehealthDetails: appointment.telehealth_details,
|
87
|
+
status: JSON.stringify(appointment.status),
|
88
|
+
appointment: JSON.stringify(appointment),
|
89
|
+
},
|
90
|
+
});
|
134
91
|
},
|
135
92
|
};
|
136
93
|
//# sourceMappingURL=getAppointment.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getAppointment.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/getAppointment.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"getAppointment.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/getAppointment.ts"],"names":[],"mappings":";;;AAAA,mEAMsC;AACtC,mEAAwD;AAExD,sCAAyC;AAEzC,MAAM,MAAM,GAAG;IACb,aAAa,EAAE;QACb,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,oEAAoE;QACtE,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEjC,MAAM,UAAU,GAAG;IACjB,aAAa,EAAE;QACb,GAAG,EAAE,eAAe;QACpB,SAAS,EAAE,MAAM;KAClB;IACD,MAAM,EAAE;QACN,GAAG,EAAE,QAAQ;QACb,SAAS,EAAE,QAAQ;KACpB;IACD,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,QAAQ;KACpB;IACD,UAAU,EAAE;QACV,GAAG,EAAE,YAAY;QACjB,SAAS,EAAE,QAAQ;KACpB;IACD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W,CAAC,QAAQ,CAAC;gBACxC,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;gBACtC,WAAW,EAAE,WAAW,CAAC,WAAW;gBACpC,iBAAiB,EAAE,MAAM,CAAC,MAAA,WAAW,CAAC,gBAAgB,0CAAE,EAAE,CAAC;gBAC3D,iBAAiB,EAAE,WAAW,CAAC,kBAAkB;gBACjD,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC;gBAC1C,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;aACzC;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -94,6 +94,10 @@ declare const dataPoints: {
|
|
94
94
|
key: string;
|
95
95
|
valueType: "string";
|
96
96
|
};
|
97
|
+
status: {
|
98
|
+
key: string;
|
99
|
+
valueType: "string";
|
100
|
+
};
|
97
101
|
};
|
98
102
|
export declare const getPatient: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
|
99
103
|
export {};
|
@@ -1,12 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getPatient = void 0;
|
4
|
-
const zod_1 = require("zod");
|
5
4
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
6
5
|
const extensions_core_2 = require("@awell-health/extensions-core");
|
7
6
|
const client_1 = require("../client");
|
8
|
-
const zod_validation_error_1 = require("zod-validation-error");
|
9
|
-
const axios_1 = require("axios");
|
10
7
|
const elationMobilePhoneToE164_1 = require("../utils/elationMobilePhoneToE164");
|
11
8
|
const getLastEmail_1 = require("../utils/getLastEmail");
|
12
9
|
const fields = {
|
@@ -103,6 +100,10 @@ const dataPoints = {
|
|
103
100
|
key: 'previousLastName',
|
104
101
|
valueType: 'string',
|
105
102
|
},
|
103
|
+
status: {
|
104
|
+
key: 'status',
|
105
|
+
valueType: 'string',
|
106
|
+
},
|
106
107
|
};
|
107
108
|
exports.getPatient = {
|
108
109
|
key: 'getPatient',
|
@@ -113,86 +114,37 @@ exports.getPatient = {
|
|
113
114
|
previewable: true,
|
114
115
|
dataPoints,
|
115
116
|
onActivityCreated: async (payload, onComplete, onError) => {
|
116
|
-
var _a, _b
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
}
|
148
|
-
catch (err) {
|
149
|
-
if (err instanceof zod_1.ZodError) {
|
150
|
-
const error = (0, zod_validation_error_1.fromZodError)(err);
|
151
|
-
await onError({
|
152
|
-
events: [
|
153
|
-
{
|
154
|
-
date: new Date().toISOString(),
|
155
|
-
text: { en: error.message },
|
156
|
-
error: {
|
157
|
-
category: 'WRONG_INPUT',
|
158
|
-
message: error.message,
|
159
|
-
},
|
160
|
-
},
|
161
|
-
],
|
162
|
-
});
|
163
|
-
}
|
164
|
-
else if (err instanceof axios_1.AxiosError) {
|
165
|
-
await onError({
|
166
|
-
events: [
|
167
|
-
{
|
168
|
-
date: new Date().toISOString(),
|
169
|
-
text: {
|
170
|
-
en: `${(_c = err.status) !== null && _c !== void 0 ? _c : '(no status code)'} Error: ${err.message}`,
|
171
|
-
},
|
172
|
-
error: {
|
173
|
-
category: 'SERVER_ERROR',
|
174
|
-
message: `${(_d = err.status) !== null && _d !== void 0 ? _d : '(no status code)'} Error: ${err.message}`,
|
175
|
-
},
|
176
|
-
},
|
177
|
-
],
|
178
|
-
});
|
179
|
-
}
|
180
|
-
else {
|
181
|
-
const message = err.message;
|
182
|
-
await onError({
|
183
|
-
events: [
|
184
|
-
{
|
185
|
-
date: new Date().toISOString(),
|
186
|
-
text: { en: message },
|
187
|
-
error: {
|
188
|
-
category: 'SERVER_ERROR',
|
189
|
-
message,
|
190
|
-
},
|
191
|
-
},
|
192
|
-
],
|
193
|
-
});
|
194
|
-
}
|
195
|
-
}
|
117
|
+
var _a, _b;
|
118
|
+
const patientId = extensions_core_1.NumericIdSchema.parse(payload.fields.patientId);
|
119
|
+
// API Call should produce AuthError or something dif.
|
120
|
+
const api = (0, client_1.makeAPIClient)(payload.settings);
|
121
|
+
const patientInfo = await api.getPatient(patientId);
|
122
|
+
await onComplete({
|
123
|
+
data_points: {
|
124
|
+
firstName: patientInfo.first_name,
|
125
|
+
lastName: patientInfo.last_name,
|
126
|
+
dob: patientInfo.dob,
|
127
|
+
sex: patientInfo.sex,
|
128
|
+
primaryPhysicianId: String(patientInfo.primary_physician),
|
129
|
+
caregiverPracticeId: String(patientInfo.caregiver_practice),
|
130
|
+
mobilePhone: (0, elationMobilePhoneToE164_1.elationMobilePhoneToE164)((_b = (_a = patientInfo.phones) === null || _a === void 0 ? void 0 : _a.find((p) => p.phone_type === 'Mobile')) === null || _b === void 0 ? void 0 : _b.phone),
|
131
|
+
email: (0, getLastEmail_1.getLastEmail)(patientInfo.emails),
|
132
|
+
middleName: patientInfo.middle_name,
|
133
|
+
actualName: patientInfo.actual_name,
|
134
|
+
genderIdentity: patientInfo.gender_identity,
|
135
|
+
legalGenderMarker: patientInfo.legal_gender_marker,
|
136
|
+
pronouns: patientInfo.pronouns,
|
137
|
+
sexualOrientation: patientInfo.sexual_orientation,
|
138
|
+
ssn: patientInfo.ssn,
|
139
|
+
ethnicity: patientInfo.ethnicity,
|
140
|
+
race: patientInfo.race,
|
141
|
+
preferredLanguage: patientInfo.preferred_language,
|
142
|
+
notes: patientInfo.notes,
|
143
|
+
previousFirstName: patientInfo.previous_first_name,
|
144
|
+
previousLastName: patientInfo.previous_last_name,
|
145
|
+
status: patientInfo.patient_status.status,
|
146
|
+
},
|
147
|
+
});
|
196
148
|
},
|
197
149
|
};
|
198
150
|
//# sourceMappingURL=getPatient.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getPatient.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/getPatient.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"getPatient.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/getPatient.ts"],"names":[],"mappings":";;;AAAA,mEAMsC;AACtC,mEAAwD;AAExD,sCAAyC;AACzC,gFAA4E;AAC5E,wDAAoD;AAEpD,MAAM,MAAM,GAAG;IACb,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,wBAAwB;QACrC,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEjC,MAAM,UAAU,GAAG;IACjB,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,QAAQ,EAAE;QACR,GAAG,EAAE,UAAU;QACf,SAAS,EAAE,QAAQ;KACpB;IACD,GAAG,EAAE;QACH,GAAG,EAAE,KAAK;QACV,SAAS,EAAE,MAAM;KAClB;IACD,GAAG,EAAE;QACH,GAAG,EAAE,KAAK;QACV,SAAS,EAAE,QAAQ;KACpB;IACD,kBAAkB,EAAE;QAClB,GAAG,EAAE,oBAAoB;QACzB,SAAS,EAAE,QAAQ;KACpB;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,qBAAqB;QAC1B,SAAS,EAAE,QAAQ;KACpB;IACD,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,WAAW;KACvB;IACD,KAAK,EAAE;QACL,GAAG,EAAE,OAAO;QACZ,SAAS,EAAE,QAAQ;KACpB;IACD,UAAU,EAAE;QACV,GAAG,EAAE,YAAY;QACjB,SAAS,EAAE,QAAQ;KACpB;IACD,UAAU,EAAE;QACV,GAAG,EAAE,YAAY;QACjB,SAAS,EAAE,Q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EAAE,WAAW,CAAC,kBAAkB;gBAChD,MAAM,EAAE,WAAW,CAAC,cAAc,CAAC,MAAM;aAC1C;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -50,7 +50,7 @@ export declare const actions: {
|
|
50
50
|
description: string;
|
51
51
|
required: true;
|
52
52
|
};
|
53
|
-
}, "email" | "sex" | "firstName" | "lastName" | "mobilePhone" | "preferredLanguage" | "notes" | "pronouns" | "dob" | "ssn" | "race" | "ethnicity" | "primaryPhysicianId" | "caregiverPracticeId" | "middleName" | "actualName" | "genderIdentity" | "legalGenderMarker" | "sexualOrientation" | "previousFirstName" | "previousLastName">;
|
53
|
+
}, "status" | "email" | "sex" | "firstName" | "lastName" | "mobilePhone" | "preferredLanguage" | "notes" | "pronouns" | "dob" | "ssn" | "race" | "ethnicity" | "primaryPhysicianId" | "caregiverPracticeId" | "middleName" | "actualName" | "genderIdentity" | "legalGenderMarker" | "sexualOrientation" | "previousFirstName" | "previousLastName">;
|
54
54
|
createPatient: import("@awell-health/extensions-core").Action<{
|
55
55
|
firstName: {
|
56
56
|
id: string;
|
@@ -359,6 +359,12 @@ export declare const actions: {
|
|
359
359
|
description: string;
|
360
360
|
type: import("@awell-health/extensions-core").FieldType.STRING;
|
361
361
|
};
|
362
|
+
status: {
|
363
|
+
id: string;
|
364
|
+
label: string;
|
365
|
+
description: string;
|
366
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
367
|
+
};
|
362
368
|
}, {
|
363
369
|
base_url: {
|
364
370
|
key: string;
|
@@ -558,7 +564,92 @@ export declare const actions: {
|
|
558
564
|
description: string;
|
559
565
|
required: true;
|
560
566
|
};
|
561
|
-
}, "reason" | "description" | "
|
567
|
+
}, "reason" | "description" | "status" | "duration" | "patientId" | "physicianId" | "practiceId" | "appointment" | "scheduledDate" | "serviceLocationId" | "telehealthDetails">;
|
568
|
+
findAppointments: import("@awell-health/extensions-core").Action<{
|
569
|
+
patientId: {
|
570
|
+
id: string;
|
571
|
+
label: string;
|
572
|
+
type: import("@awell-health/extensions-core").FieldType.NUMERIC;
|
573
|
+
description: string;
|
574
|
+
};
|
575
|
+
physicianId: {
|
576
|
+
id: string;
|
577
|
+
label: string;
|
578
|
+
type: import("@awell-health/extensions-core").FieldType.NUMERIC;
|
579
|
+
description: string;
|
580
|
+
required: false;
|
581
|
+
};
|
582
|
+
practiceId: {
|
583
|
+
id: string;
|
584
|
+
label: string;
|
585
|
+
type: import("@awell-health/extensions-core").FieldType.NUMERIC;
|
586
|
+
description: string;
|
587
|
+
required: false;
|
588
|
+
};
|
589
|
+
from_date: {
|
590
|
+
id: string;
|
591
|
+
label: string;
|
592
|
+
type: import("@awell-health/extensions-core").FieldType.DATE;
|
593
|
+
description: string;
|
594
|
+
};
|
595
|
+
to_date: {
|
596
|
+
id: string;
|
597
|
+
label: string;
|
598
|
+
type: import("@awell-health/extensions-core").FieldType.DATE;
|
599
|
+
description: string;
|
600
|
+
required: false;
|
601
|
+
};
|
602
|
+
event_type: {
|
603
|
+
id: string;
|
604
|
+
label: string;
|
605
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
606
|
+
description: string;
|
607
|
+
required: false;
|
608
|
+
};
|
609
|
+
}, {
|
610
|
+
base_url: {
|
611
|
+
key: string;
|
612
|
+
label: string;
|
613
|
+
obfuscated: false;
|
614
|
+
description: string;
|
615
|
+
required: true;
|
616
|
+
};
|
617
|
+
auth_url: {
|
618
|
+
key: string;
|
619
|
+
label: string;
|
620
|
+
obfuscated: false;
|
621
|
+
description: string;
|
622
|
+
required: true;
|
623
|
+
};
|
624
|
+
client_id: {
|
625
|
+
key: string;
|
626
|
+
label: string;
|
627
|
+
obfuscated: false;
|
628
|
+
description: string;
|
629
|
+
required: true;
|
630
|
+
};
|
631
|
+
client_secret: {
|
632
|
+
key: string;
|
633
|
+
label: string;
|
634
|
+
obfuscated: true;
|
635
|
+
description: string;
|
636
|
+
required: true;
|
637
|
+
};
|
638
|
+
username: {
|
639
|
+
key: string;
|
640
|
+
label: string;
|
641
|
+
obfuscated: false;
|
642
|
+
description: string;
|
643
|
+
required: true;
|
644
|
+
};
|
645
|
+
password: {
|
646
|
+
key: string;
|
647
|
+
label: string;
|
648
|
+
obfuscated: true;
|
649
|
+
description: string;
|
650
|
+
required: true;
|
651
|
+
};
|
652
|
+
}, "appointments" | "appointment_exists">;
|
562
653
|
getPhysician: import("@awell-health/extensions-core").Action<{
|
563
654
|
physicianId: {
|
564
655
|
id: string;
|
@@ -676,7 +767,7 @@ export declare const actions: {
|
|
676
767
|
description: string;
|
677
768
|
required: true;
|
678
769
|
};
|
679
|
-
}, "
|
770
|
+
}, "physicianId" | "caregiverPracticeId" | "physicianFirstName" | "physicianLastName" | "physicianCredentials" | "physicianEmail" | "physicianNPI" | "physicianUserId">;
|
680
771
|
createNonVisitNote: import("@awell-health/extensions-core").Action<{
|
681
772
|
patientId: {
|
682
773
|
id: string;
|
@@ -6,6 +6,7 @@ const updatePatient_1 = require("./updatePatient");
|
|
6
6
|
const createPatient_1 = require("./createPatient");
|
7
7
|
const createAppointment_1 = require("./createAppointment");
|
8
8
|
const getAppointment_1 = require("./getAppointment");
|
9
|
+
const findAppointments_1 = require("./findAppointments");
|
9
10
|
const findPhysician_1 = require("./findPhysician");
|
10
11
|
const createNonVisitNote_1 = require("./createNonVisitNote");
|
11
12
|
// import { updateNonVisitNote } from './updateNonVisitNote'
|
@@ -20,6 +21,7 @@ exports.actions = {
|
|
20
21
|
updatePatient: updatePatient_1.updatePatient,
|
21
22
|
createAppointment: createAppointment_1.createAppointment,
|
22
23
|
getAppointment: getAppointment_1.getAppointment,
|
24
|
+
findAppointments: findAppointments_1.findAppointments,
|
23
25
|
getPhysician: getPhysician_1.getPhysician,
|
24
26
|
findPhysician: findPhysician_1.findPhysician,
|
25
27
|
createNonVisitNote: createNonVisitNote_1.createNonVisitNote,
|