@awell-health/awell-extensions 1.1.13 → 1.1.18
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/awell/v1/actions/updateBaselineInfo/updateBaselineInfo.js +1 -1
- package/dist/extensions/awell/v1/actions/updateBaselineInfo/updateBaselineInfo.js.map +1 -1
- 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 +8 -2
- 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/types/appointment.d.ts +5 -1
- package/dist/extensions/elation/validation/appointment.zod.d.ts +28 -2
- package/dist/extensions/elation/validation/appointment.zod.js +5 -1
- 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.
|
@@ -16,7 +16,7 @@ exports.updateBaselineInfo = {
|
|
16
16
|
description: 'Update some (or all) of the baseline datapoints for the patient currently enrolled in the care flow.',
|
17
17
|
fields: config_1.fields,
|
18
18
|
dataPoints: config_1.dataPoints,
|
19
|
-
previewable:
|
19
|
+
previewable: false,
|
20
20
|
onActivityCreated: async (payload, onComplete, onError) => {
|
21
21
|
const { settings: { apiUrl, apiKey }, fields: { baselineInfo }, pathway: { id: pathwayId }, } = (0, extensions_core_1.validate)({
|
22
22
|
schema: zod_1.default.object({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"updateBaselineInfo.js","sourceRoot":"","sources":["../../../../../../extensions/awell/v1/actions/updateBaselineInfo/updateBaselineInfo.ts"],"names":[],"mappings":";;;;;;AACA,gDAA2E;AAC3E,mEAAkE;AAClE,qCAKiB;AACjB,8CAAmB;AACnB,kEAAyC;AAE5B,QAAA,kBAAkB,GAA2C;IACxE,GAAG,EAAE,oBAAoB;IACzB,QAAQ,EAAE,0BAAQ,CAAC,QAAQ;IAC3B,KAAK,EAAE,4BAA4B;IACnC,WAAW,EACT,sGAAsG;IACxG,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,WAAW,EAAE,
|
1
|
+
{"version":3,"file":"updateBaselineInfo.js","sourceRoot":"","sources":["../../../../../../extensions/awell/v1/actions/updateBaselineInfo/updateBaselineInfo.ts"],"names":[],"mappings":";;;;;;AACA,gDAA2E;AAC3E,mEAAkE;AAClE,qCAKiB;AACjB,8CAAmB;AACnB,kEAAyC;AAE5B,QAAA,kBAAkB,GAA2C;IACxE,GAAG,EAAE,oBAAoB;IACzB,QAAQ,EAAE,0BAAQ,CAAC,QAAQ;IAC3B,KAAK,EAAE,4BAA4B;IACnC,WAAW,EACT,sGAAsG;IACxG,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,WAAW,EAAE,KAAK;IAClB,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,EAAE;QACvE,MAAM,EACJ,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAC5B,MAAM,EAAE,EAAE,YAAY,EAAE,EACxB,OAAO,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,GAC3B,GAAG,IAAA,0BAAQ,EAAC;YACX,MAAM,EAAE,aAAC,CAAC,MAAM,CAAC;gBACf,MAAM,EAAE,+BAAsB;gBAC9B,QAAQ,EAAE,mCAAwB;gBAClC,OAAO,EAAE,gCAAuB;aACjC,CAAC;YACF,OAAO;SACR,CAAC,CAAA;QAEF,MAAM,GAAG,GAAG,IAAI,kBAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;QAE5C,MAAM,GAAG,CAAC,kBAAkB,CAAC;YAC3B,UAAU,EAAE,SAAS;YACrB,aAAa,EAAE,YAAY;SAC5B,CAAC,CAAA;QAEF,MAAM,UAAU,EAAE,CAAA;IACpB,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,g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G,iCAAe,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;QAEzE,sDAAsD;QACtD,MAAM,GAAG,GAAG,IAAA,sBAAa,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QAC3C,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,cAAc,CAAC,aAAa,CAAC,CAAA;QAC3D,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,aAAa,EAAE,WAAW,CAAC,cAAc;gBACzC,MAAM,EAAE,WAAW,CAAC,MAAM;gBAC1B,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC;gBACtC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC;gBAC1C,UAAU,EAAE,MAAM,CAAC,WAAW,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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AM,CAAC;gBACvC,UAAU,EAAE,WAAW,CAAC,WAAW;gBACnC,UAAU,EAAE,WAAW,CAAC,WAAW;gBACnC,cAAc,EAAE,WAAW,CAAC,eAAe;gBAC3C,iBAAiB,EAAE,WAAW,CAAC,mBAAmB;gBAClD,QAAQ,EAAE,WAAW,CAAC,QAAQ;gBAC9B,iBAAiB,EAAE,WAAW,CAAC,kBAAkB;gBACjD,GAAG,EAAE,WAAW,CAAC,GAAG;gBACpB,SAAS,EAAE,WAAW,CAAC,SAAS;gBAChC,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,iBAAiB,EAAE,WAAW,CAAC,kBAAkB;gBACjD,KAAK,EAAE,WAAW,CAAC,KAAK;gBACxB,iBAAiB,EAAE,WAAW,CAAC,mBAAmB;gBAClD,gBAAgB,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,7 @@ export declare const actions: {
|
|
558
564
|
description: string;
|
559
565
|
required: true;
|
560
566
|
};
|
561
|
-
}, "reason" | "description" | "duration" | "patientId" | "scheduledDate" | "physicianId" | "practiceId" | "serviceLocationId" | "telehealthDetails">;
|
567
|
+
}, "reason" | "description" | "status" | "duration" | "patientId" | "scheduledDate" | "physicianId" | "practiceId" | "serviceLocationId" | "telehealthDetails" | "appointment">;
|
562
568
|
getPhysician: import("@awell-health/extensions-core").Action<{
|
563
569
|
physicianId: {
|
564
570
|
id: string;
|
@@ -128,6 +128,12 @@ declare const fields: {
|
|
128
128
|
description: string;
|
129
129
|
type: FieldType.STRING;
|
130
130
|
};
|
131
|
+
status: {
|
132
|
+
id: string;
|
133
|
+
label: string;
|
134
|
+
description: string;
|
135
|
+
type: FieldType.STRING;
|
136
|
+
};
|
131
137
|
};
|
132
138
|
declare const dataPoints: {};
|
133
139
|
export declare const updatePatient: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
|
@@ -1,14 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.updatePatient = void 0;
|
4
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
5
|
-
const zod_1 = require("zod");
|
6
4
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
7
5
|
const extensions_core_2 = require("@awell-health/extensions-core");
|
8
6
|
const client_1 = require("../client");
|
9
|
-
const zod_validation_error_1 = require("zod-validation-error");
|
10
|
-
const axios_1 = require("axios");
|
11
7
|
const patient_zod_1 = require("../validation/patient.zod");
|
8
|
+
const lodash_1 = require("lodash");
|
12
9
|
const fields = {
|
13
10
|
patientId: {
|
14
11
|
id: 'patientId',
|
@@ -137,6 +134,12 @@ const fields = {
|
|
137
134
|
description: 'The previous last name of the patient',
|
138
135
|
type: extensions_core_1.FieldType.STRING,
|
139
136
|
},
|
137
|
+
status: {
|
138
|
+
id: 'status',
|
139
|
+
label: 'Status',
|
140
|
+
description: 'The status of the patient (active, deceased, inactive, prospect)',
|
141
|
+
type: extensions_core_1.FieldType.STRING,
|
142
|
+
},
|
140
143
|
};
|
141
144
|
const dataPoints = {};
|
142
145
|
exports.updatePatient = {
|
@@ -148,89 +151,43 @@ exports.updatePatient = {
|
|
148
151
|
previewable: true,
|
149
152
|
dataPoints,
|
150
153
|
onActivityCreated: async (payload, onComplete, onError) => {
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
const api = (0, client_1.makeAPIClient)(payload.settings);
|
183
|
-
await api.updatePatient(id, updatedPatientFields);
|
184
|
-
await onComplete();
|
185
|
-
}
|
186
|
-
catch (err) {
|
187
|
-
if (err instanceof zod_1.ZodError) {
|
188
|
-
const error = (0, zod_validation_error_1.fromZodError)(err);
|
189
|
-
await onError({
|
190
|
-
events: [
|
191
|
-
{
|
192
|
-
date: new Date().toISOString(),
|
193
|
-
text: { en: error.message },
|
194
|
-
error: {
|
195
|
-
category: 'WRONG_INPUT',
|
196
|
-
message: error.message,
|
197
|
-
},
|
198
|
-
},
|
199
|
-
],
|
200
|
-
});
|
201
|
-
}
|
202
|
-
else if (err instanceof axios_1.AxiosError) {
|
203
|
-
await onError({
|
204
|
-
events: [
|
205
|
-
{
|
206
|
-
date: new Date().toISOString(),
|
207
|
-
text: {
|
208
|
-
en: `${(_a = err.status) !== null && _a !== void 0 ? _a : '(no status code)'} Error: ${err.message}`,
|
209
|
-
},
|
210
|
-
error: {
|
211
|
-
category: 'SERVER_ERROR',
|
212
|
-
message: `${(_b = err.status) !== null && _b !== void 0 ? _b : '(no status code)'} Error: ${err.message}`,
|
213
|
-
},
|
214
|
-
},
|
215
|
-
],
|
216
|
-
});
|
217
|
-
}
|
218
|
-
else {
|
219
|
-
const message = err.message;
|
220
|
-
await onError({
|
221
|
-
events: [
|
222
|
-
{
|
223
|
-
date: new Date().toISOString(),
|
224
|
-
text: { en: message },
|
225
|
-
error: {
|
226
|
-
category: 'SERVER_ERROR',
|
227
|
-
message,
|
228
|
-
},
|
229
|
-
},
|
230
|
-
],
|
231
|
-
});
|
154
|
+
const { patientId, firstName, lastName, actualName, caregiverPracticeId, genderIdentity, legalGenderMarker, middleName, preferredLanguage, previousFirstName, previousLastName, primaryPhysicianId, sexualOrientation, status, ...fields } = payload.fields;
|
155
|
+
const patient = patient_zod_1.updatePatientSchema.parse({
|
156
|
+
...fields,
|
157
|
+
first_name: firstName,
|
158
|
+
last_name: lastName,
|
159
|
+
primary_physician: primaryPhysicianId,
|
160
|
+
caregiver_practice: caregiverPracticeId,
|
161
|
+
middle_name: middleName,
|
162
|
+
actual_name: actualName,
|
163
|
+
gender_identity: genderIdentity,
|
164
|
+
legal_gender_marker: legalGenderMarker,
|
165
|
+
sexual_orientation: sexualOrientation,
|
166
|
+
preferred_language: preferredLanguage,
|
167
|
+
previous_first_name: previousFirstName,
|
168
|
+
previous_last_name: previousLastName,
|
169
|
+
...(!(0, lodash_1.isNil)(status) && {
|
170
|
+
patient_status: {
|
171
|
+
status,
|
172
|
+
...(status === 'inactive' && { inactive_reason: 'other' }),
|
173
|
+
},
|
174
|
+
}),
|
175
|
+
});
|
176
|
+
const id = extensions_core_1.NumericIdSchema.parse(patientId);
|
177
|
+
/** We only want to patch the fields that are not undefined or null so
|
178
|
+
* we know the update is intentional. I.e. if the builder doesn't set
|
179
|
+
* a value for any action field besides the patient ID (which is required)
|
180
|
+
* then we are updating nothing.
|
181
|
+
**/
|
182
|
+
const updatedPatientFields = Object.entries(patient).reduce((acc, [key, value]) => {
|
183
|
+
if (!(0, lodash_1.isNil)(value) && !(0, lodash_1.isEmpty)(value)) {
|
184
|
+
acc[key] = value;
|
232
185
|
}
|
233
|
-
|
186
|
+
return acc;
|
187
|
+
}, {});
|
188
|
+
const api = (0, client_1.makeAPIClient)(payload.settings);
|
189
|
+
await api.updatePatient(id, updatedPatientFields);
|
190
|
+
await onComplete();
|
234
191
|
},
|
235
192
|
};
|
236
193
|
//# sourceMappingURL=updatePatient.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"updatePatient.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/updatePatient.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"updatePatient.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/updatePatient.ts"],"names":[],"mappings":";;;AAEA,mEAMsC;AACtC,mEAAwD;AAExD,sCAAyC;AAGzC,2DAA+D;AAC/D,mCAAuC;AAEvC,MAAM,MAAM,GAAG;IACb,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,kCAAkC;QAC/C,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE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F,CAAC;SACH,CAAC,CAAA;QAEF,MAAM,EAAE,GAAG,iCAAe,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;QAE3C;;;;YAII;QACJ,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CACzD,CAAC,GAA4B,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC7C,IAAI,CAAC,IAAA,cAAK,EAAC,KAAK,CAAC,IAAI,CAAC,IAAA,gBAAO,EAAC,KAAK,CAAC,EAAE;gBACpC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;aACjB;YACD,OAAO,GAAG,CAAA;QACZ,CAAC,EACD,EAAE,CACH,CAAA;QAED,MAAM,GAAG,GAAG,IAAA,sBAAa,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QAC3C,MAAM,GAAG,CAAC,aAAa,CAAC,EAAE,EAAE,oBAAoB,CAAC,CAAA;QACjD,MAAM,UAAU,EAAE,CAAA;IACpB,CAAC;CACF,CAAA"}
|
@@ -10,7 +10,7 @@ export interface AppointmentResponse extends Omit<AppointmentInput, 'service_loc
|
|
10
10
|
id: number;
|
11
11
|
time_slot_type: string;
|
12
12
|
time_slot_status: string;
|
13
|
-
status:
|
13
|
+
status: AnyStatus;
|
14
14
|
service_location?: ServiceLocation;
|
15
15
|
recurring_event_schedule: unknown;
|
16
16
|
billing?: BillingDetails;
|
@@ -22,6 +22,10 @@ export interface AppointmentResponse extends Omit<AppointmentInput, 'service_loc
|
|
22
22
|
interface Status extends z.infer<typeof statusSchema> {
|
23
23
|
status_date: string;
|
24
24
|
}
|
25
|
+
interface NotSeenStatus extends Status {
|
26
|
+
status_detail: string;
|
27
|
+
}
|
28
|
+
type AnyStatus = Status | NotSeenStatus;
|
25
29
|
interface ServiceLocation {
|
26
30
|
id: number;
|
27
31
|
name: string;
|
@@ -14,7 +14,23 @@ export declare const appointmentSchema: z.ZodObject<{
|
|
14
14
|
duration: z.ZodOptional<z.ZodNumber>;
|
15
15
|
reason: z.ZodString;
|
16
16
|
description: z.ZodOptional<z.ZodString>;
|
17
|
-
status: z.ZodOptional<z.ZodObject<{
|
17
|
+
status: z.ZodOptional<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
18
|
+
status: z.ZodEnum<["Scheduled", "Confirmed", "Checked Out", "Cancelled", "With Doctor", "In Room", "Checked In", "In Room - Vitals Taken", "Not Seen", "Billed"]>;
|
19
|
+
room: z.ZodOptional<z.ZodString>;
|
20
|
+
}, {
|
21
|
+
status_date: z.ZodString;
|
22
|
+
status_detail: z.ZodString;
|
23
|
+
}>, "strip", z.ZodTypeAny, {
|
24
|
+
status: "Scheduled" | "Confirmed" | "Checked Out" | "Cancelled" | "With Doctor" | "In Room" | "Checked In" | "In Room - Vitals Taken" | "Not Seen" | "Billed";
|
25
|
+
status_date: string;
|
26
|
+
status_detail: string;
|
27
|
+
room?: string | undefined;
|
28
|
+
}, {
|
29
|
+
status: "Scheduled" | "Confirmed" | "Checked Out" | "Cancelled" | "With Doctor" | "In Room" | "Checked In" | "In Room - Vitals Taken" | "Not Seen" | "Billed";
|
30
|
+
status_date: string;
|
31
|
+
status_detail: string;
|
32
|
+
room?: string | undefined;
|
33
|
+
}>, z.ZodObject<{
|
18
34
|
status: z.ZodEnum<["Scheduled", "Confirmed", "Checked Out", "Cancelled", "With Doctor", "In Room", "Checked In", "In Room - Vitals Taken", "Not Seen", "Billed"]>;
|
19
35
|
room: z.ZodOptional<z.ZodString>;
|
20
36
|
}, "strip", z.ZodTypeAny, {
|
@@ -23,7 +39,7 @@ export declare const appointmentSchema: z.ZodObject<{
|
|
23
39
|
}, {
|
24
40
|
status: "Scheduled" | "Confirmed" | "Checked Out" | "Cancelled" | "With Doctor" | "In Room" | "Checked In" | "In Room - Vitals Taken" | "Not Seen" | "Billed";
|
25
41
|
room?: string | undefined;
|
26
|
-
}>>;
|
42
|
+
}>]>>;
|
27
43
|
service_location: z.ZodOptional<z.ZodNumber>;
|
28
44
|
telehealth_details: z.ZodOptional<z.ZodString>;
|
29
45
|
patient: z.ZodNumber;
|
@@ -41,6 +57,11 @@ export declare const appointmentSchema: z.ZodObject<{
|
|
41
57
|
status?: {
|
42
58
|
status: "Scheduled" | "Confirmed" | "Checked Out" | "Cancelled" | "With Doctor" | "In Room" | "Checked In" | "In Room - Vitals Taken" | "Not Seen" | "Billed";
|
43
59
|
room?: string | undefined;
|
60
|
+
} | {
|
61
|
+
status: "Scheduled" | "Confirmed" | "Checked Out" | "Cancelled" | "With Doctor" | "In Room" | "Checked In" | "In Room - Vitals Taken" | "Not Seen" | "Billed";
|
62
|
+
status_date: string;
|
63
|
+
status_detail: string;
|
64
|
+
room?: string | undefined;
|
44
65
|
} | undefined;
|
45
66
|
duration?: number | undefined;
|
46
67
|
service_location?: number | undefined;
|
@@ -56,6 +77,11 @@ export declare const appointmentSchema: z.ZodObject<{
|
|
56
77
|
status?: {
|
57
78
|
status: "Scheduled" | "Confirmed" | "Checked Out" | "Cancelled" | "With Doctor" | "In Room" | "Checked In" | "In Room - Vitals Taken" | "Not Seen" | "Billed";
|
58
79
|
room?: string | undefined;
|
80
|
+
} | {
|
81
|
+
status: "Scheduled" | "Confirmed" | "Checked Out" | "Cancelled" | "With Doctor" | "In Room" | "Checked In" | "In Room - Vitals Taken" | "Not Seen" | "Billed";
|
82
|
+
status_date: string;
|
83
|
+
status_detail: string;
|
84
|
+
room?: string | undefined;
|
59
85
|
} | undefined;
|
60
86
|
duration?: number | undefined;
|
61
87
|
service_location?: number | undefined;
|
@@ -42,13 +42,17 @@ exports.statusSchema = z.object({
|
|
42
42
|
status: statusEnum,
|
43
43
|
room: z.string().optional(),
|
44
44
|
});
|
45
|
+
const statusReturnSchema = exports.statusSchema.extend({
|
46
|
+
status_date: z.string().datetime(),
|
47
|
+
status_detail: z.string(),
|
48
|
+
});
|
45
49
|
exports.appointmentSchema = z
|
46
50
|
.object({
|
47
51
|
scheduled_date: extensions_core_1.DateTimeSchema,
|
48
52
|
duration: z.coerce.number().int().min(1).max(1440).optional(),
|
49
53
|
reason: z.string().max(50).nonempty(),
|
50
54
|
description: z.string().max(500).optional(),
|
51
|
-
status: exports.statusSchema.optional(),
|
55
|
+
status: z.union([statusReturnSchema, exports.statusSchema]).optional(),
|
52
56
|
service_location: z.coerce.number().int().min(1).optional(),
|
53
57
|
telehealth_details: z.string().optional(),
|
54
58
|
patient: extensions_core_1.NumericIdSchema,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"appointment.zod.js","sourceRoot":"","sources":["../../../../extensions/elation/validation/appointment.zod.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAA+E;AAC/E,uCAAwB;AAExB,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC;IACxB,WAAW;IACX,WAAW;IACX,aAAa;IACb,WAAW;IACX,aAAa;IACb,SAAS;IACT,YAAY;IACZ,wBAAwB;IACxB,UAAU;IACV,QAAQ;CACT,CAAC,CAAA;AAEW,QAAA,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAA;AAEW,QAAA,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,cAAc,EAAE,gCAAc;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;IAC7D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IACrC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAC3C,MAAM,EAAE,oB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AC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3D,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzC,OAAO,EAAE,iCAAe;IACxB,SAAS,EAAE,iCAAe;IAC1B,QAAQ,EAAE,iCAAe;IACzB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE;CAC/C,CAAC;KACD,MAAM,EAAE,CAAA"}
|
@@ -45,7 +45,7 @@
|
|
45
45
|
},
|
46
46
|
"elation": {
|
47
47
|
"readme": "---\ntitle: Elation\ndescription: Elation is a cloud-based health record system designed for healthcare providers, clinics, and medical practices.\n---\n# Elation\n\nElation is a cloud-based health record system designed for healthcare providers, clinics, and medical practices. It offers a range of features including patient scheduling, charting, e-prescribing, billing, and telemedicine. Overall, Elation is designed to streamline the workflow of medical practices, improve patient care, and increase efficiency.\n\n## Setup\n\n### Webhooks\n\nThe integration of webhooks with Elation presents unique challenges and considerations:\n\n- **Non-Discriminative Triggers**: Elation does not differentiate between the creation or update of a resource. Both actions will set off webhook with action `saved`, which might not provide enough discriminative information for some use cases.\n- **Programmatic Setup**: Elation webhooks can only be configured programmatically, as there's no dedicated user interface in Elation to set up webhooks. View [this demo video](https://youtu.be/v8u6E8MEI8E) for a step-by-step guide on how to set up your webhooks in Elation.\n- **Limitation on user-triggered actions**: Elation has a concept called \"Preventing echo\". This means that that any action carried out by the user affiliated with the API credentials that created the subscription doesn't trigger a webhook. You can read more about this behaviour [here](https://docs.elationhealth.com/reference/webhooks). If you are not receiving any webhooks from Elation after setting up your subscription, then this is the reason. A feasible workaround to the above limitation is creating a dedicated user not meant for human interactions but serves the sole purpose of facilitating M2M communication.\n\nIf you need help setting up your webhooks in Elation, reach out! We are happy to help you.\n\n### Extension settings\n\nIn order to use this extension you will need to provide the extension with the following settings:\n\n- Base URL / endpoint URL of the API\n- Authorization URL\n- Client ID for OAuth2 Password authentication\n- Client Secret for OAuth2 Password authentication\n- API Username for OAuth2 Password authentication\n- API Password for OAuth2 Password authentication\n\nNot sure where you can find all of this information? Click [here](https://docs.elationhealth.com/reference/introduction) to have a look at Elation's Developer documentation.\n\n## Actions\n\nThe following actions are supported with Elation today:\n\n### Create Patient\n\nThis action creates a patient in Elation.\n\n**When creating a patient, you will have to specifiy the primary physician and caregiver practice ID:**\n- Primary physician ID: you can retrieve this ID by using the [Find Physicians](https://docs.elationhealth.com/reference/find-physicians) API call, or by using the `Find Physician` action\n- Caregiver Practice ID: similar to the primary physician ID, you can find this ID by using the same API call or action\n\n### Get Patient\n\nUsing a patient identifier, retrieve a patient object from Elation. \n\nNote that when retrieve the mobile phone number, we are tranforming the number to an international format. We apply a heuristic and assume all mobile numbers in Elation are in US national format so we prepend the number with the +1 country code. Having the number in international format unlocks more powerful functionality like sending text messages with 3rd party services like Twilio and MessageBird.\n\n### Update Patient\n\nUpdate a patient in Elation using any fields available in create patient. We use Elation's `PATCH` method to apply partial modifications to a the patient resource (i.e. update only what is needed).\n\n### Create Appointment\n\nEasily create a patient appointment in Elation.\n\nCreating an appointment requires a few strings to be well-formulated:\n- `Scheduled date` must be a datetime string (ISO-8601). For example, January 1, 2023 at noon, Pacific Time (-8 hours) would be shown as such: `2023-01-01T12:00:00.000-08:00`\n- `Reason` must not be free text. This value comes from the following list of appointment types (`Follow-Up`, `Office Visit`, `Physical Exam`, etc.):\n![Appointment types](./assets/elation-appointment-reason.png?raw=true \"Elation Appointment Types\")\n- `Patient` is the patient ID.\n- `Physician` is the physician ID (see `Find Physician`)\n- `Practice` is the practice ID (again, see `Find Physician`)\n\nYou can also include a duration (default to 15 minutes, or whatever has been set in your EHR)\n\n### Get Appointment\n\nRetrieve appointment details using an appointment ID. \n\n### Create Non-Visit Note\n\nThe non-visit note is a special kind of note that, as the name suggests, is not associated with a visit. These notes, in their simplest form, provide a chronological account of information about the patient.\n\n**Additional documentation for some of the action fields:**\n1. Category: The default category is \"Problem\" but you can choose any of \"Past\", \"Family\", \"Social\", \"Instr\", \"PE\", \"ROS\", \"Med\", \"Data\", \"Assessment\", \"Test\", \"Tx\", \"Narrative\", \"Followup\", \"Reason\", \"Plan\", \"Objective\", \"Hpi\", \"Allergies\", \"Habits\", \"Assessplan\", \"Consultant\", \"Attending\", \"Dateprocedure\", \"Surgical\", \"Orders\", \"Referenced\", \"Procedure\".\n2. Chart and document date automatically get set to the current date, i.e. the date when the action is orchestrated.\n\n### Delete Non-Visit Note\n\nDeletes the non-visit note identified by an ID.\n\n### Get Non-Visit Note\n\nRetrieve the details of a non-visit note identified by an ID.\n### Get physician\n\nUsing a physician identifier, retrieve a physician object from Elation.\n\n### Find physicians\n\nSearch a physician based on a set of parameters. The ID of the physician matching the search parameters will be returned. To retrieve the details of the physician, you can use the the \"Get physician\" action.\n\nNote that this action can only support finding one physician so if your search criteria match multiple physicians the action will throw an error.\n\n",
|
48
|
-
"changelog": "# Elation Changelog\n\n## January 30, 2024\n\n- New actions\n - Post letter: Using patient and practice identifier, post a new letter to either Provider, Patient or associate it with an existing Referral.\n\n## October 3, 2023\n\n- The README is now more concise with less unneeded detail. A section on the particularities of Elation subscriptions (webhooks) was added.\n- Misc. updates to labels, descriptions, action fields order\n- Action updates\n - Create Non-Visit Note:\n - Simplify the action by removing some optional action fields (we can always expand later)\n - `document_date` and `chart_date` are now automatically set to the date of today so that the corresponding action fields could be removed\n - Create patient\n - `dob` is now a `date` field type (was a string)\n - You can pass a mobile phone number and email when creating a patient
|
48
|
+
"changelog": "# Elation Changelog\n\n## January 30, 2024\n\n- New actions\n - Post letter: Using patient and practice identifier, post a new letter to either Provider, Patient or associate it with an existing Referral.\n\n## October 3, 2023\n\n- The README is now more concise with less unneeded detail. A section on the particularities of Elation subscriptions (webhooks) was added.\n- Misc. updates to labels, descriptions, action fields order\n- Action updates\n - Create Non-Visit Note:\n - Simplify the action by removing some optional action fields (we can always expand later)\n - `document_date` and `chart_date` are now automatically set to the date of today so that the corresponding action fields could be removed\n - Create patient\n - `dob` is now a `date` field type (was a string)\n - You can pass a mobile phone number and email when creating a patient\n - Find physician\n - Only returns the physician ID instead of all the details of the physician. To retrieve the details one can use the new `Get physician` action\n - Update patient\n - `dob` is now a `date` field type (was a string)\n - We are now using `PATCH` instead of `PUT` which allows for a partial update, i.e. only update the fields that are needed.\n- New actions\n - Get physician: Using a physician identifier, retrieve a physician object from Elation.\n- Removed actions\n - Update Non-Visit Note\n- Webhooks\n - Fix the type of `patientId` in `patientCreatedOrUpdated` webhook\n - Added `appointmentCreatedOrUpdated` webhook\n\n## September 4, 2023\n\n- rename `onCreatePatient` webhook to `patientCreatedOrUpdated`\n- filter non `saved` actions for this webhook\n\n## August 21, 2023\n\n- make non-visit note text a large input (`StringType.TEXT`)\n\n## May 23, 2024\n\n- add patient_status.status to patient object in getPatient action\n- add status to updatePatient action\n"
|
49
49
|
},
|
50
50
|
"experimental": {
|
51
51
|
"readme": "---\ntitle: Experimental extension\ndescription: Extension for experimental purposes\n---\n\n# Experimental extension\n",
|