@awell-health/awell-extensions 1.0.167 → 1.0.169
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/extensions/elation/actions/createLabOrder.d.ts +72 -0
- package/dist/extensions/elation/actions/createLabOrder.js +160 -0
- package/dist/extensions/elation/actions/createLabOrder.js.map +1 -0
- package/dist/extensions/elation/actions/index.d.ts +195 -0
- package/dist/extensions/elation/actions/index.js +4 -0
- package/dist/extensions/elation/actions/index.js.map +1 -1
- package/dist/extensions/elation/actions/postLetter.d.ts +61 -0
- package/dist/extensions/elation/actions/postLetter.js +150 -0
- package/dist/extensions/elation/actions/postLetter.js.map +1 -0
- package/dist/extensions/elation/client.d.ts +6 -0
- package/dist/extensions/elation/client.js +20 -0
- package/dist/extensions/elation/client.js.map +1 -1
- package/dist/extensions/elation/types/labOrder.d.ts +7 -0
- package/dist/extensions/elation/types/labOrder.js +3 -0
- package/dist/extensions/elation/types/labOrder.js.map +1 -0
- package/dist/extensions/elation/types/letter.d.ts +6 -0
- package/dist/extensions/elation/types/letter.js +3 -0
- package/dist/extensions/elation/types/letter.js.map +1 -0
- package/dist/extensions/elation/validation/labOrder.zod.d.ts +29 -0
- package/dist/extensions/elation/validation/labOrder.zod.js +68 -0
- package/dist/extensions/elation/validation/labOrder.zod.js.map +1 -0
- package/dist/extensions/elation/validation/letter.zod.d.ts +63 -0
- package/dist/extensions/elation/validation/letter.zod.js +55 -0
- package/dist/extensions/elation/validation/letter.zod.js.map +1 -0
- package/dist/extensions/markdown.json +1 -1
- package/package.json +1 -1
@@ -0,0 +1,72 @@
|
|
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
|
+
description: string;
|
8
|
+
type: FieldType.NUMERIC;
|
9
|
+
required: true;
|
10
|
+
};
|
11
|
+
practiceId: {
|
12
|
+
id: string;
|
13
|
+
label: string;
|
14
|
+
description: string;
|
15
|
+
type: FieldType.NUMERIC;
|
16
|
+
required: true;
|
17
|
+
};
|
18
|
+
documentDate: {
|
19
|
+
id: string;
|
20
|
+
label: string;
|
21
|
+
description: string;
|
22
|
+
type: FieldType.DATE;
|
23
|
+
required: true;
|
24
|
+
};
|
25
|
+
orderingPhysicianId: {
|
26
|
+
id: string;
|
27
|
+
label: string;
|
28
|
+
description: string;
|
29
|
+
type: FieldType.NUMERIC;
|
30
|
+
required: true;
|
31
|
+
};
|
32
|
+
vendorId: {
|
33
|
+
id: string;
|
34
|
+
label: string;
|
35
|
+
description: string;
|
36
|
+
type: FieldType.NUMERIC;
|
37
|
+
required: false;
|
38
|
+
};
|
39
|
+
content: {
|
40
|
+
id: string;
|
41
|
+
label: string;
|
42
|
+
description: string;
|
43
|
+
type: FieldType.JSON;
|
44
|
+
required: false;
|
45
|
+
};
|
46
|
+
siteId: {
|
47
|
+
id: string;
|
48
|
+
label: string;
|
49
|
+
description: string;
|
50
|
+
type: FieldType.NUMERIC;
|
51
|
+
required: false;
|
52
|
+
};
|
53
|
+
confidential: {
|
54
|
+
id: string;
|
55
|
+
label: string;
|
56
|
+
description: string;
|
57
|
+
type: FieldType.BOOLEAN;
|
58
|
+
required: false;
|
59
|
+
};
|
60
|
+
};
|
61
|
+
declare const dataPoints: {
|
62
|
+
labOrderId: {
|
63
|
+
key: string;
|
64
|
+
valueType: "number";
|
65
|
+
};
|
66
|
+
printableLabOrderView: {
|
67
|
+
key: string;
|
68
|
+
valueType: "string";
|
69
|
+
};
|
70
|
+
};
|
71
|
+
export declare const createLabOrder: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
|
72
|
+
export {};
|
@@ -0,0 +1,160 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createLabOrder = void 0;
|
4
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
5
|
+
const zod_1 = require("zod");
|
6
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
7
|
+
const client_1 = require("../client");
|
8
|
+
const zod_validation_error_1 = require("zod-validation-error");
|
9
|
+
const axios_1 = require("axios");
|
10
|
+
const labOrder_zod_1 = require("../validation/labOrder.zod");
|
11
|
+
const fields = {
|
12
|
+
patientId: {
|
13
|
+
id: 'patientId',
|
14
|
+
label: 'Patient ID',
|
15
|
+
description: 'The ID of the patient for whom the lab order is being created.',
|
16
|
+
type: extensions_core_1.FieldType.NUMERIC,
|
17
|
+
required: true,
|
18
|
+
},
|
19
|
+
practiceId: {
|
20
|
+
id: 'practiceId',
|
21
|
+
label: 'Practice',
|
22
|
+
description: 'The ID of the practice for which the lab order is being created.',
|
23
|
+
type: extensions_core_1.FieldType.NUMERIC,
|
24
|
+
required: true,
|
25
|
+
},
|
26
|
+
documentDate: {
|
27
|
+
id: 'documentDate',
|
28
|
+
label: 'Document Date',
|
29
|
+
description: 'The date and time of the lab order document.',
|
30
|
+
type: extensions_core_1.FieldType.DATE,
|
31
|
+
required: true,
|
32
|
+
},
|
33
|
+
orderingPhysicianId: {
|
34
|
+
id: 'orderingPhysicianId',
|
35
|
+
label: 'Ordering Physician ID',
|
36
|
+
description: 'The ID of the physician who is creating the order.',
|
37
|
+
type: extensions_core_1.FieldType.NUMERIC,
|
38
|
+
required: true,
|
39
|
+
},
|
40
|
+
vendorId: {
|
41
|
+
id: 'vendorId',
|
42
|
+
label: 'Vendor ID',
|
43
|
+
description: 'The ID of the vendor (or Lab) associated with the lab order.',
|
44
|
+
type: extensions_core_1.FieldType.NUMERIC,
|
45
|
+
required: false,
|
46
|
+
},
|
47
|
+
content: {
|
48
|
+
id: 'content',
|
49
|
+
label: 'Content',
|
50
|
+
description: 'Represents the content of the lab order report. Should be in JSON format. See https://docs.elationhealth.com/reference/the-lab-order-content-object',
|
51
|
+
type: extensions_core_1.FieldType.JSON,
|
52
|
+
required: false,
|
53
|
+
},
|
54
|
+
siteId: {
|
55
|
+
id: 'siteId',
|
56
|
+
label: 'Site ID',
|
57
|
+
description: 'The location where the patient will have the lab performed. Sites are specific to their lab vendor',
|
58
|
+
type: extensions_core_1.FieldType.NUMERIC,
|
59
|
+
required: false,
|
60
|
+
},
|
61
|
+
confidential: {
|
62
|
+
id: 'confidential',
|
63
|
+
label: 'Confidential',
|
64
|
+
description: 'Defaults to false. Whether the provider has marked the order as confidential. Should not be shared with a patient.',
|
65
|
+
type: extensions_core_1.FieldType.BOOLEAN,
|
66
|
+
required: false,
|
67
|
+
},
|
68
|
+
};
|
69
|
+
const dataPoints = {
|
70
|
+
labOrderId: {
|
71
|
+
key: 'labOrderId',
|
72
|
+
valueType: 'number',
|
73
|
+
},
|
74
|
+
printableLabOrderView: {
|
75
|
+
key: 'printableLabOrderView',
|
76
|
+
valueType: 'string',
|
77
|
+
},
|
78
|
+
};
|
79
|
+
exports.createLabOrder = {
|
80
|
+
key: 'createLabOrder',
|
81
|
+
category: extensions_core_1.Category.EHR_INTEGRATIONS,
|
82
|
+
title: 'Create lab order',
|
83
|
+
description: 'A lab order represents an order for a patient to perform some lab tests for a vendor.',
|
84
|
+
fields,
|
85
|
+
previewable: false,
|
86
|
+
dataPoints,
|
87
|
+
onActivityCreated: async (payload, onComplete, onError) => {
|
88
|
+
var _a, _b;
|
89
|
+
try {
|
90
|
+
const { patientId, practiceId, orderingPhysicianId, documentDate, vendorId, content, siteId, confidential, } = payload.fields;
|
91
|
+
const labOrder = labOrder_zod_1.labOrderSchema.parse({
|
92
|
+
practice: practiceId,
|
93
|
+
patient: patientId,
|
94
|
+
document_date: documentDate,
|
95
|
+
ordering_physician: orderingPhysicianId,
|
96
|
+
vendor: vendorId,
|
97
|
+
content,
|
98
|
+
confidential,
|
99
|
+
site: siteId,
|
100
|
+
});
|
101
|
+
const api = (0, client_1.makeAPIClient)(payload.settings);
|
102
|
+
const { id, printable_view } = await api.createLabOrder(labOrder);
|
103
|
+
await onComplete({
|
104
|
+
data_points: {
|
105
|
+
labOrderId: String(id),
|
106
|
+
printableLabOrderView: printable_view,
|
107
|
+
},
|
108
|
+
});
|
109
|
+
}
|
110
|
+
catch (err) {
|
111
|
+
if (err instanceof zod_1.ZodError) {
|
112
|
+
const error = (0, zod_validation_error_1.fromZodError)(err);
|
113
|
+
await onError({
|
114
|
+
events: [
|
115
|
+
{
|
116
|
+
date: new Date().toISOString(),
|
117
|
+
text: { en: error.message },
|
118
|
+
error: {
|
119
|
+
category: 'WRONG_INPUT',
|
120
|
+
message: error.message,
|
121
|
+
},
|
122
|
+
},
|
123
|
+
],
|
124
|
+
});
|
125
|
+
}
|
126
|
+
else if (err instanceof axios_1.AxiosError) {
|
127
|
+
await onError({
|
128
|
+
events: [
|
129
|
+
{
|
130
|
+
date: new Date().toISOString(),
|
131
|
+
text: {
|
132
|
+
en: `${(_a = err.status) !== null && _a !== void 0 ? _a : '(no status code)'} Error: ${err.message}`,
|
133
|
+
},
|
134
|
+
error: {
|
135
|
+
category: 'SERVER_ERROR',
|
136
|
+
message: `${(_b = err.status) !== null && _b !== void 0 ? _b : '(no status code)'} Error: ${err.message}`,
|
137
|
+
},
|
138
|
+
},
|
139
|
+
],
|
140
|
+
});
|
141
|
+
}
|
142
|
+
else {
|
143
|
+
const message = err.message;
|
144
|
+
await onError({
|
145
|
+
events: [
|
146
|
+
{
|
147
|
+
date: new Date().toISOString(),
|
148
|
+
text: { en: message },
|
149
|
+
error: {
|
150
|
+
category: 'SERVER_ERROR',
|
151
|
+
message,
|
152
|
+
},
|
153
|
+
},
|
154
|
+
],
|
155
|
+
});
|
156
|
+
}
|
157
|
+
}
|
158
|
+
},
|
159
|
+
};
|
160
|
+
//# sourceMappingURL=createLabOrder.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createLabOrder.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/createLabOrder.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,6BAA8B;AAC9B,mEAMsC;AAEtC,sCAAyC;AACzC,+DAAmD;AACnD,iCAAkC;AAClC,6DAA2D;AAE3D,MAAM,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@ export declare const actions: {
|
|
861
861
|
required: true;
|
862
862
|
};
|
863
863
|
}, string, never>;
|
864
|
+
postLetter: import("@awell-health/extensions-core").Action<{
|
865
|
+
patientId: {
|
866
|
+
id: string;
|
867
|
+
label: string;
|
868
|
+
description: string;
|
869
|
+
type: import("@awell-health/extensions-core").FieldType.NUMERIC;
|
870
|
+
required: true;
|
871
|
+
};
|
872
|
+
practiceId: {
|
873
|
+
id: string;
|
874
|
+
label: string;
|
875
|
+
description: string;
|
876
|
+
type: import("@awell-health/extensions-core").FieldType.NUMERIC;
|
877
|
+
required: true;
|
878
|
+
};
|
879
|
+
referralOrderId: {
|
880
|
+
id: string;
|
881
|
+
label: string;
|
882
|
+
description: string;
|
883
|
+
type: import("@awell-health/extensions-core").FieldType.NUMERIC;
|
884
|
+
required: false;
|
885
|
+
};
|
886
|
+
subject: {
|
887
|
+
id: string;
|
888
|
+
label: string;
|
889
|
+
description: string;
|
890
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
891
|
+
required: false;
|
892
|
+
};
|
893
|
+
body: {
|
894
|
+
id: string;
|
895
|
+
label: string;
|
896
|
+
description: string;
|
897
|
+
type: import("@awell-health/extensions-core").FieldType.TEXT;
|
898
|
+
required: true;
|
899
|
+
};
|
900
|
+
contactId: {
|
901
|
+
id: string;
|
902
|
+
label: string;
|
903
|
+
description: string;
|
904
|
+
type: import("@awell-health/extensions-core").FieldType.NUMERIC;
|
905
|
+
required: true;
|
906
|
+
};
|
907
|
+
letterType: {
|
908
|
+
id: string;
|
909
|
+
label: string;
|
910
|
+
description: string;
|
911
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
912
|
+
required: false;
|
913
|
+
};
|
914
|
+
}, {
|
915
|
+
base_url: {
|
916
|
+
key: string;
|
917
|
+
label: string;
|
918
|
+
obfuscated: false;
|
919
|
+
description: string;
|
920
|
+
required: true;
|
921
|
+
};
|
922
|
+
auth_url: {
|
923
|
+
key: string;
|
924
|
+
label: string;
|
925
|
+
obfuscated: false;
|
926
|
+
description: string;
|
927
|
+
required: true;
|
928
|
+
};
|
929
|
+
client_id: {
|
930
|
+
key: string;
|
931
|
+
label: string;
|
932
|
+
obfuscated: false;
|
933
|
+
description: string;
|
934
|
+
required: true;
|
935
|
+
};
|
936
|
+
client_secret: {
|
937
|
+
key: string;
|
938
|
+
label: string;
|
939
|
+
obfuscated: true;
|
940
|
+
description: string;
|
941
|
+
required: true;
|
942
|
+
};
|
943
|
+
username: {
|
944
|
+
key: string;
|
945
|
+
label: string;
|
946
|
+
obfuscated: false;
|
947
|
+
description: string;
|
948
|
+
required: true;
|
949
|
+
};
|
950
|
+
password: {
|
951
|
+
key: string;
|
952
|
+
label: string;
|
953
|
+
obfuscated: true;
|
954
|
+
description: string;
|
955
|
+
required: true;
|
956
|
+
};
|
957
|
+
}, "letterId", never>;
|
958
|
+
createLabOrder: import("@awell-health/extensions-core").Action<{
|
959
|
+
patientId: {
|
960
|
+
id: string;
|
961
|
+
label: string;
|
962
|
+
description: string;
|
963
|
+
type: import("@awell-health/extensions-core").FieldType.NUMERIC;
|
964
|
+
required: true;
|
965
|
+
};
|
966
|
+
practiceId: {
|
967
|
+
id: string;
|
968
|
+
label: string;
|
969
|
+
description: string;
|
970
|
+
type: import("@awell-health/extensions-core").FieldType.NUMERIC;
|
971
|
+
required: true;
|
972
|
+
};
|
973
|
+
documentDate: {
|
974
|
+
id: string;
|
975
|
+
label: string;
|
976
|
+
description: string;
|
977
|
+
type: import("@awell-health/extensions-core").FieldType.DATE;
|
978
|
+
required: true;
|
979
|
+
};
|
980
|
+
orderingPhysicianId: {
|
981
|
+
id: string;
|
982
|
+
label: string;
|
983
|
+
description: string;
|
984
|
+
type: import("@awell-health/extensions-core").FieldType.NUMERIC;
|
985
|
+
required: true;
|
986
|
+
};
|
987
|
+
vendorId: {
|
988
|
+
id: string;
|
989
|
+
label: string;
|
990
|
+
description: string;
|
991
|
+
type: import("@awell-health/extensions-core").FieldType.NUMERIC;
|
992
|
+
required: false;
|
993
|
+
};
|
994
|
+
content: {
|
995
|
+
id: string;
|
996
|
+
label: string;
|
997
|
+
description: string;
|
998
|
+
type: import("@awell-health/extensions-core").FieldType.JSON;
|
999
|
+
required: false;
|
1000
|
+
};
|
1001
|
+
siteId: {
|
1002
|
+
id: string;
|
1003
|
+
label: string;
|
1004
|
+
description: string;
|
1005
|
+
type: import("@awell-health/extensions-core").FieldType.NUMERIC;
|
1006
|
+
required: false;
|
1007
|
+
};
|
1008
|
+
confidential: {
|
1009
|
+
id: string;
|
1010
|
+
label: string;
|
1011
|
+
description: string;
|
1012
|
+
type: import("@awell-health/extensions-core").FieldType.BOOLEAN;
|
1013
|
+
required: false;
|
1014
|
+
};
|
1015
|
+
}, {
|
1016
|
+
base_url: {
|
1017
|
+
key: string;
|
1018
|
+
label: string;
|
1019
|
+
obfuscated: false;
|
1020
|
+
description: string;
|
1021
|
+
required: true;
|
1022
|
+
};
|
1023
|
+
auth_url: {
|
1024
|
+
key: string;
|
1025
|
+
label: string;
|
1026
|
+
obfuscated: false;
|
1027
|
+
description: string;
|
1028
|
+
required: true;
|
1029
|
+
};
|
1030
|
+
client_id: {
|
1031
|
+
key: string;
|
1032
|
+
label: string;
|
1033
|
+
obfuscated: false;
|
1034
|
+
description: string;
|
1035
|
+
required: true;
|
1036
|
+
};
|
1037
|
+
client_secret: {
|
1038
|
+
key: string;
|
1039
|
+
label: string;
|
1040
|
+
obfuscated: true;
|
1041
|
+
description: string;
|
1042
|
+
required: true;
|
1043
|
+
};
|
1044
|
+
username: {
|
1045
|
+
key: string;
|
1046
|
+
label: string;
|
1047
|
+
obfuscated: false;
|
1048
|
+
description: string;
|
1049
|
+
required: true;
|
1050
|
+
};
|
1051
|
+
password: {
|
1052
|
+
key: string;
|
1053
|
+
label: string;
|
1054
|
+
obfuscated: true;
|
1055
|
+
description: string;
|
1056
|
+
required: true;
|
1057
|
+
};
|
1058
|
+
}, "labOrderId" | "printableLabOrderView", never>;
|
864
1059
|
};
|
@@ -12,6 +12,8 @@ const createNonVisitNote_1 = require("./createNonVisitNote");
|
|
12
12
|
const getNonVisitNote_1 = require("./getNonVisitNote");
|
13
13
|
const deleteNonVisitNote_1 = require("./deleteNonVisitNote");
|
14
14
|
const getPhysician_1 = require("./getPhysician");
|
15
|
+
const postLetter_1 = require("./postLetter");
|
16
|
+
const createLabOrder_1 = require("./createLabOrder");
|
15
17
|
exports.actions = {
|
16
18
|
getPatient: getPatient_1.getPatient,
|
17
19
|
createPatient: createPatient_1.createPatient,
|
@@ -24,5 +26,7 @@ exports.actions = {
|
|
24
26
|
// updateNonVisitNote, // Disable for now, don't immediately see a use case for this action.
|
25
27
|
getNonVisitNote: getNonVisitNote_1.getNonVisitNote,
|
26
28
|
deleteNonVisitNote: deleteNonVisitNote_1.deleteNonVisitNote,
|
29
|
+
postLetter: postLetter_1.postLetter,
|
30
|
+
createLabOrder: createLabOrder_1.createLabOrder,
|
27
31
|
};
|
28
32
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/index.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,mDAA+C;AAC/C,mDAA+C;AAC/C,2DAAuD;AACvD,qDAAiD;AACjD,mDAA+C;AAC/C,6DAAyD;AACzD,4DAA4D;AAC5D,uDAAmD;AACnD,6DAAyD;AACzD,iDAA6C;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/index.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,mDAA+C;AAC/C,mDAA+C;AAC/C,2DAAuD;AACvD,qDAAiD;AACjD,mDAA+C;AAC/C,6DAAyD;AACzD,4DAA4D;AAC5D,uDAAmD;AACnD,6DAAyD;AACzD,iDAA6C;AAC7C,6CAAyC;AACzC,qDAAiD;AAEpC,QAAA,OAAO,GAAG;IACrB,UAAU,EAAV,uBAAU;IACV,aAAa,EAAb,6BAAa;IACb,aAAa,EAAb,6BAAa;IACb,iBAAiB,EAAjB,qCAAiB;IACjB,cAAc,EAAd,+BAAc;IACd,YAAY,EAAZ,2BAAY;IACZ,aAAa,EAAb,6BAAa;IACb,kBAAkB,EAAlB,uCAAkB;IAClB,4FAA4F;IAC5F,eAAe,EAAf,iCAAe;IACf,kBAAkB,EAAlB,uCAAkB;IAClB,UAAU,EAAV,uBAAU;IACV,cAAc,EAAd,+BAAc;CACf,CAAA"}
|
@@ -0,0 +1,61 @@
|
|
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
|
+
description: string;
|
8
|
+
type: FieldType.NUMERIC;
|
9
|
+
required: true;
|
10
|
+
};
|
11
|
+
practiceId: {
|
12
|
+
id: string;
|
13
|
+
label: string;
|
14
|
+
description: string;
|
15
|
+
type: FieldType.NUMERIC;
|
16
|
+
required: true;
|
17
|
+
};
|
18
|
+
referralOrderId: {
|
19
|
+
id: string;
|
20
|
+
label: string;
|
21
|
+
description: string;
|
22
|
+
type: FieldType.NUMERIC;
|
23
|
+
required: false;
|
24
|
+
};
|
25
|
+
subject: {
|
26
|
+
id: string;
|
27
|
+
label: string;
|
28
|
+
description: string;
|
29
|
+
type: FieldType.STRING;
|
30
|
+
required: false;
|
31
|
+
};
|
32
|
+
body: {
|
33
|
+
id: string;
|
34
|
+
label: string;
|
35
|
+
description: string;
|
36
|
+
type: FieldType.TEXT;
|
37
|
+
required: true;
|
38
|
+
};
|
39
|
+
contactId: {
|
40
|
+
id: string;
|
41
|
+
label: string;
|
42
|
+
description: string;
|
43
|
+
type: FieldType.NUMERIC;
|
44
|
+
required: true;
|
45
|
+
};
|
46
|
+
letterType: {
|
47
|
+
id: string;
|
48
|
+
label: string;
|
49
|
+
description: string;
|
50
|
+
type: FieldType.STRING;
|
51
|
+
required: false;
|
52
|
+
};
|
53
|
+
};
|
54
|
+
declare const dataPoints: {
|
55
|
+
letterId: {
|
56
|
+
key: string;
|
57
|
+
valueType: "number";
|
58
|
+
};
|
59
|
+
};
|
60
|
+
export declare const postLetter: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
|
61
|
+
export {};
|
@@ -0,0 +1,150 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.postLetter = void 0;
|
4
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
5
|
+
const zod_1 = require("zod");
|
6
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
7
|
+
const client_1 = require("../client");
|
8
|
+
const zod_validation_error_1 = require("zod-validation-error");
|
9
|
+
const axios_1 = require("axios");
|
10
|
+
const letter_zod_1 = require("../validation/letter.zod");
|
11
|
+
const fields = {
|
12
|
+
patientId: {
|
13
|
+
id: 'patientId',
|
14
|
+
label: 'Patient ID',
|
15
|
+
description: 'ID of the patient',
|
16
|
+
type: extensions_core_1.FieldType.NUMERIC,
|
17
|
+
required: true,
|
18
|
+
},
|
19
|
+
practiceId: {
|
20
|
+
id: 'practiceId',
|
21
|
+
label: 'Practice',
|
22
|
+
description: 'ID of a Practice',
|
23
|
+
type: extensions_core_1.FieldType.NUMERIC,
|
24
|
+
required: true,
|
25
|
+
},
|
26
|
+
referralOrderId: {
|
27
|
+
id: 'referralOrderId',
|
28
|
+
label: 'Referral Order ID',
|
29
|
+
description: 'Id of the Referral Order (Not needed with subject)',
|
30
|
+
type: extensions_core_1.FieldType.NUMERIC,
|
31
|
+
required: false,
|
32
|
+
},
|
33
|
+
subject: {
|
34
|
+
id: 'subject',
|
35
|
+
label: 'Subject',
|
36
|
+
description: 'Subject of the letter (Not needed with referral order)',
|
37
|
+
type: extensions_core_1.FieldType.STRING,
|
38
|
+
required: false,
|
39
|
+
},
|
40
|
+
body: {
|
41
|
+
id: 'body',
|
42
|
+
label: 'Body',
|
43
|
+
description: 'Body of the letter',
|
44
|
+
type: extensions_core_1.FieldType.TEXT,
|
45
|
+
required: true,
|
46
|
+
},
|
47
|
+
// the following is called `send_to_contact.id` in elation api docs
|
48
|
+
contactId: {
|
49
|
+
id: 'contactId',
|
50
|
+
label: 'Contact ID',
|
51
|
+
description: 'ID of the contact whom you want to send this letter',
|
52
|
+
type: extensions_core_1.FieldType.NUMERIC,
|
53
|
+
required: true,
|
54
|
+
},
|
55
|
+
letterType: {
|
56
|
+
id: 'letterType',
|
57
|
+
label: 'Type of letter',
|
58
|
+
description: 'Type of letter. Defaults to "provider". The type can be one of the following: "patient", "referral", "provider" or "patient_initiated".',
|
59
|
+
type: extensions_core_1.FieldType.STRING,
|
60
|
+
required: false,
|
61
|
+
},
|
62
|
+
};
|
63
|
+
const dataPoints = {
|
64
|
+
letterId: {
|
65
|
+
key: 'letterId',
|
66
|
+
valueType: 'number',
|
67
|
+
},
|
68
|
+
};
|
69
|
+
exports.postLetter = {
|
70
|
+
key: 'postLetter',
|
71
|
+
category: extensions_core_1.Category.EHR_INTEGRATIONS,
|
72
|
+
title: 'Post letter',
|
73
|
+
description: "Post a letter using Elation's patient API.",
|
74
|
+
fields,
|
75
|
+
previewable: false,
|
76
|
+
dataPoints,
|
77
|
+
onActivityCreated: async (payload, onComplete, onError) => {
|
78
|
+
var _a, _b;
|
79
|
+
try {
|
80
|
+
const { patientId, practiceId, referralOrderId, subject, body, contactId, letterType, } = payload.fields;
|
81
|
+
const letter = letter_zod_1.letterSchema.parse({
|
82
|
+
patient: patientId,
|
83
|
+
practice: practiceId,
|
84
|
+
referral_order: referralOrderId,
|
85
|
+
subject,
|
86
|
+
body,
|
87
|
+
letter_type: letterType,
|
88
|
+
send_to_contact: {
|
89
|
+
id: contactId,
|
90
|
+
},
|
91
|
+
});
|
92
|
+
const api = (0, client_1.makeAPIClient)(payload.settings);
|
93
|
+
const { id } = await api.postNewLetter(letter);
|
94
|
+
await onComplete({
|
95
|
+
data_points: {
|
96
|
+
letterId: String(id),
|
97
|
+
},
|
98
|
+
});
|
99
|
+
}
|
100
|
+
catch (err) {
|
101
|
+
if (err instanceof zod_1.ZodError) {
|
102
|
+
const error = (0, zod_validation_error_1.fromZodError)(err);
|
103
|
+
await onError({
|
104
|
+
events: [
|
105
|
+
{
|
106
|
+
date: new Date().toISOString(),
|
107
|
+
text: { en: error.message },
|
108
|
+
error: {
|
109
|
+
category: 'WRONG_INPUT',
|
110
|
+
message: error.message,
|
111
|
+
},
|
112
|
+
},
|
113
|
+
],
|
114
|
+
});
|
115
|
+
}
|
116
|
+
else if (err instanceof axios_1.AxiosError) {
|
117
|
+
await onError({
|
118
|
+
events: [
|
119
|
+
{
|
120
|
+
date: new Date().toISOString(),
|
121
|
+
text: {
|
122
|
+
en: `${(_a = err.status) !== null && _a !== void 0 ? _a : '(no status code)'} Error: ${err.message}`,
|
123
|
+
},
|
124
|
+
error: {
|
125
|
+
category: 'SERVER_ERROR',
|
126
|
+
message: `${(_b = err.status) !== null && _b !== void 0 ? _b : '(no status code)'} Error: ${err.message}`,
|
127
|
+
},
|
128
|
+
},
|
129
|
+
],
|
130
|
+
});
|
131
|
+
}
|
132
|
+
else {
|
133
|
+
const message = err.message;
|
134
|
+
await onError({
|
135
|
+
events: [
|
136
|
+
{
|
137
|
+
date: new Date().toISOString(),
|
138
|
+
text: { en: message },
|
139
|
+
error: {
|
140
|
+
category: 'SERVER_ERROR',
|
141
|
+
message,
|
142
|
+
},
|
143
|
+
},
|
144
|
+
],
|
145
|
+
});
|
146
|
+
}
|
147
|
+
}
|
148
|
+
},
|
149
|
+
};
|
150
|
+
//# sourceMappingURL=postLetter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"postLetter.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/postLetter.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,6BAA8B;AAC9B,mEAMsC;AAEtC,sCAAyC;AACzC,+DAAmD;AACnD,iCAAkC;AAClC,yDAAuD;AAEvD,MAAM,MAAM,GAAG;IAC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3B,KAAK,EAAE;gCACL,QAAQ,EAAE,aAAa;gCACvB,OAAO,EAAE,KAAK,CAAC,OAAO;6BACvB;yBACF;qBACF;iBACF,CAAC,CAAA;aACH;iBAAM,IAAI,GAAG,YAAY,kBAAU,EAAE;gBACpC,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;4BAC9B,IAAI,EAAE;gCACJ,EAAE,EAAE,GAAG,MAAA,GAAG,CAAC,MAAM,mCAAI,kBAAkB,WAAW,GAAG,CAAC,OAAO,EAAE;6BAChE;4BACD,KAAK,EAAE;gCACL,QAAQ,EAAE,cAAc;gCACxB,OAAO,EAAE,GAAG,MAAA,GAAG,CAAC,MAAM,mCAAI,kBAAkB,WAC1C,GAAG,CAAC,OACN,EAAE;6BACH;yBACF;qBACF;iBACF,CAAC,CAAA;aACH;iBAAM;gBACL,MAAM,OAAO,GAAI,GAAa,CAAC,OAAO,CAAA;gBACtC,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;4BAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;4BACrB,KAAK,EAAE;gCACL,QAAQ,EAAE,cAAc;gCACxB,OAAO;6BACR;yBACF;qBACF;iBACF,CAAC,CAAA;aACH;SACF;IACH,CAAC;CACF,CAAA"}
|
@@ -6,6 +6,8 @@ import { type PatientInput, type PatientResponse, type UpdatePatientInput } from
|
|
6
6
|
import { type Subscription, type SubscriptionRequest } from './types/subscription';
|
7
7
|
import { type PhysicianResponse } from './types/physician';
|
8
8
|
import { type NonVisitNoteInput, type NonVisitNoteResponse } from './types/nonVisitNote';
|
9
|
+
import { type PostLetterInput, type PostLetterResponse } from './types/letter';
|
10
|
+
import type { CreateLabOrderInput, CreateLabOrderResponse } from './types/labOrder';
|
9
11
|
export declare class ElationDataWrapper extends DataWrapper {
|
10
12
|
getAppointment(id: number): Promise<AppointmentResponse>;
|
11
13
|
createAppointment(obj: Partial<AppointmentInput>): Promise<AppointmentResponse>;
|
@@ -27,6 +29,8 @@ export declare class ElationDataWrapper extends DataWrapper {
|
|
27
29
|
createNonVisitNote(obj: NonVisitNoteInput): Promise<NonVisitNoteResponse>;
|
28
30
|
updateNonVisitNote(id: number, obj: Partial<NonVisitNoteInput>): Promise<NonVisitNoteResponse>;
|
29
31
|
deleteNonVisitNote(id: number): Promise<void>;
|
32
|
+
postLetter(obj: PostLetterInput): Promise<PostLetterResponse>;
|
33
|
+
createLabOrder(obj: CreateLabOrderInput): Promise<CreateLabOrderResponse>;
|
30
34
|
}
|
31
35
|
interface ElationAPIClientConstructorProps {
|
32
36
|
authUrl: string;
|
@@ -56,6 +60,8 @@ export declare class ElationAPIClient extends APIClient<ElationDataWrapper> {
|
|
56
60
|
createNonVisitNote(obj: NonVisitNoteInput): Promise<NonVisitNoteResponse>;
|
57
61
|
updateNonVisitNote(id: number, obj: Partial<NonVisitNoteInput>): Promise<NonVisitNoteResponse>;
|
58
62
|
deleteNonVisitNote(id: number): Promise<void>;
|
63
|
+
postNewLetter(obj: PostLetterInput): Promise<PostLetterResponse>;
|
64
|
+
createLabOrder(obj: CreateLabOrderInput): Promise<CreateLabOrderResponse>;
|
59
65
|
}
|
60
66
|
export declare const makeAPIClient: (payloadSettings: Record<keyof typeof settings, string | undefined>) => ElationAPIClient;
|
61
67
|
export {};
|
@@ -114,6 +114,20 @@ class ElationDataWrapper extends extensions_core_1.DataWrapper {
|
|
114
114
|
url: `/non_visit_notes/${id}`,
|
115
115
|
});
|
116
116
|
}
|
117
|
+
async postLetter(obj) {
|
118
|
+
return await this.Request({
|
119
|
+
method: 'POST',
|
120
|
+
url: '/letters',
|
121
|
+
data: obj,
|
122
|
+
});
|
123
|
+
}
|
124
|
+
async createLabOrder(obj) {
|
125
|
+
return await this.Request({
|
126
|
+
method: 'POST',
|
127
|
+
url: '/lab_orders',
|
128
|
+
data: obj,
|
129
|
+
});
|
130
|
+
}
|
117
131
|
}
|
118
132
|
exports.ElationDataWrapper = ElationDataWrapper;
|
119
133
|
class ElationAPIClient extends extensions_core_1.APIClient {
|
@@ -174,6 +188,12 @@ class ElationAPIClient extends extensions_core_1.APIClient {
|
|
174
188
|
await dw.deleteNonVisitNote(id);
|
175
189
|
});
|
176
190
|
}
|
191
|
+
async postNewLetter(obj) {
|
192
|
+
return await this.FetchData(async (dw) => await dw.postLetter(obj));
|
193
|
+
}
|
194
|
+
async createLabOrder(obj) {
|
195
|
+
return await this.FetchData(async (dw) => await dw.createLabOrder(obj));
|
196
|
+
}
|
177
197
|
}
|
178
198
|
exports.ElationAPIClient = ElationAPIClient;
|
179
199
|
const makeAPIClient = (payloadSettings) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../extensions/elation/client.ts"],"names":[],"mappings":";;;AAAA,mEAMsC;AAgBtC,4DAA0D;AAC1D,mCAA6C;
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../extensions/elation/client.ts"],"names":[],"mappings":";;;AAAA,mEAMsC;AAgBtC,4DAA0D;AAC1D,mCAA6C;AAY7C,MAAa,kBAAmB,SAAQ,6BAAW;IAC1C,KAAK,CAAC,cAAc,CAAC,EAAU;QACpC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAsB;YAC5C,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,iBAAiB,EAAE,EAAE;SAC3B,CAAC,CAAA;QACF,MAAM,GAAG,GAAG,MAAM,GAAG,CAAA;QACrB,OAAO,GAAG,CAAA;IACZ,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAC5B,GAA8B;QAE9B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAsB;YAC5C,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,eAAe;YACpB,IAAI,EAAE,GAAG;SACV,CAAC,CAAA;QACF,MAAM,GAAG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AoB;QAEpB,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;IACrE,CAAC;IAEM,KAAK,CAAC,cAAc,CACzB,GAAwB;QAExB,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAA;IACzE,CAAC;CACF;AAtHD,4CAsHC;AAEM,MAAM,aAAa,GAAG,CAC3B,eAAkE,EAChD,EAAE;IACpB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,qBAAqB,EAAE,GACpD,6BAAc,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;IAEvC,OAAO,IAAI,gBAAgB,CAAC;QAC1B,OAAO,EAAE,QAAQ;QACjB,aAAa,EAAE,qBAAqB;QACpC,OAAO,EAAE,QAAQ;KAClB,CAAC,CAAA;AACJ,CAAC,CAAA;AAXY,QAAA,aAAa,iBAWzB"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { type z } from 'zod';
|
2
|
+
import { type labOrderSchema } from '../validation/labOrder.zod';
|
3
|
+
export type CreateLabOrderInput = z.infer<typeof labOrderSchema>;
|
4
|
+
export interface CreateLabOrderResponse extends CreateLabOrderInput {
|
5
|
+
id: number;
|
6
|
+
printable_view: string;
|
7
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"labOrder.js","sourceRoot":"","sources":["../../../../extensions/elation/types/labOrder.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"letter.js","sourceRoot":"","sources":["../../../../extensions/elation/types/letter.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import * as z from 'zod';
|
2
|
+
export declare const labOrderSchema: z.ZodObject<{
|
3
|
+
practice: z.ZodNumber;
|
4
|
+
patient: z.ZodNumber;
|
5
|
+
document_date: z.ZodEffects<z.ZodDate, string, Date>;
|
6
|
+
ordering_physician: z.ZodNumber;
|
7
|
+
vendor: z.ZodOptional<z.ZodNumber>;
|
8
|
+
content: z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodString>>, any, string | null | undefined>, any, string | null | undefined>, z.ZodUndefined]>, any, string | null | undefined>;
|
9
|
+
site: z.ZodOptional<z.ZodNumber>;
|
10
|
+
confidential: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
11
|
+
}, "strict", z.ZodTypeAny, {
|
12
|
+
patient: number;
|
13
|
+
practice: number;
|
14
|
+
document_date: string;
|
15
|
+
ordering_physician: number;
|
16
|
+
confidential: boolean;
|
17
|
+
vendor?: number | undefined;
|
18
|
+
content?: any;
|
19
|
+
site?: number | undefined;
|
20
|
+
}, {
|
21
|
+
patient: number;
|
22
|
+
practice: number;
|
23
|
+
document_date: Date;
|
24
|
+
ordering_physician: number;
|
25
|
+
vendor?: number | undefined;
|
26
|
+
content?: string | null | undefined;
|
27
|
+
site?: number | undefined;
|
28
|
+
confidential?: boolean | undefined;
|
29
|
+
}>;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.labOrderSchema = void 0;
|
27
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
28
|
+
const z = __importStar(require("zod"));
|
29
|
+
const testSchema = z.object({
|
30
|
+
id: extensions_core_1.NumericIdSchema,
|
31
|
+
});
|
32
|
+
const contentSchema = z.object({
|
33
|
+
patient_instructions: z.string().optional(),
|
34
|
+
test_center_notes: z.string().optional(),
|
35
|
+
tests: z.array(testSchema).nonempty(),
|
36
|
+
});
|
37
|
+
const jsonParseableContentSchema = z
|
38
|
+
.string()
|
39
|
+
.optional()
|
40
|
+
.nullable()
|
41
|
+
.transform((val) => {
|
42
|
+
if (typeof val === 'string' && val.trim() !== '') {
|
43
|
+
try {
|
44
|
+
return JSON.parse(val);
|
45
|
+
}
|
46
|
+
catch (_a) {
|
47
|
+
throw new Error('Validation error: The content field must be JSON parseable and an object after JSON parsing.');
|
48
|
+
}
|
49
|
+
}
|
50
|
+
return val;
|
51
|
+
})
|
52
|
+
.refine((data) => typeof data === 'object')
|
53
|
+
.or(z.undefined());
|
54
|
+
exports.labOrderSchema = z
|
55
|
+
.object({
|
56
|
+
practice: extensions_core_1.NumericIdSchema,
|
57
|
+
patient: extensions_core_1.NumericIdSchema,
|
58
|
+
document_date: extensions_core_1.DateOnlySchema,
|
59
|
+
ordering_physician: extensions_core_1.NumericIdSchema,
|
60
|
+
vendor: extensions_core_1.NumericIdSchema.optional(),
|
61
|
+
content: jsonParseableContentSchema.refine((data) => contentSchema.safeParse(data).success, {
|
62
|
+
message: 'Validation error: The content field must conform to the Lab Order Content schema. See https://docs.elationhealth.com/reference/the-lab-order-content-object',
|
63
|
+
}),
|
64
|
+
site: extensions_core_1.NumericIdSchema.optional(),
|
65
|
+
confidential: z.boolean().optional().default(false),
|
66
|
+
})
|
67
|
+
.strict();
|
68
|
+
//# sourceMappingURL=labOrder.zod.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"labOrder.zod.js","sourceRoot":"","sources":["../../../../extensions/elation/validation/labOrder.zod.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAA+E;AAC/E,uCAAwB;AAExB,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,EAAE,EAAE,iCAAe;CACpB,CAAC,CAAA;AAEF,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3C,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAA;AAEF,MAAM,0BAA0B,GAAG,CAAC;KACjC,MAAM,EAAE;KACR,QAAQ,EAAE;KACV,QAAQ,EAAE;KACV,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE;IACjB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAChD,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;SACvB;QAAC,WAAM;YACN,MAAM,IAAI,KAAK,CACb,8FAA8F,CAC/F,CAAA;SACF;KACF;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAC;KACD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC;KAC1C,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAA;AAEP,QAAA,cAAc,GAAG,CAAC;KAC5B,MAAM,CAAC;IACN,QAAQ,EAAE,iCAAe;IACzB,OAAO,EAAE,iCAAe;IACxB,aAAa,EAAE,gCAAc;IAC7B,kBAAkB,EAAE,iCAAe;IACnC,MAAM,EAAE,iCAAe,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,0BAA0B,CAAC,MAAM,CACxC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,EAC/C;QACE,OAAO,EACL,6JAA6J;KAChK,CACF;IACD,IAAI,EAAE,iCAAe,CAAC,QAAQ,EAAE;IAChC,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CACpD,CAAC;KACD,MAAM,EAAE,CAAA"}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import * as z from 'zod';
|
2
|
+
export declare const contactSchema: z.ZodObject<{
|
3
|
+
id: z.ZodNumber;
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
5
|
+
id: number;
|
6
|
+
}, {
|
7
|
+
id: number;
|
8
|
+
}>;
|
9
|
+
export declare const letterSchema: z.ZodEffects<z.ZodObject<{
|
10
|
+
patient: z.ZodNumber;
|
11
|
+
practice: z.ZodNumber;
|
12
|
+
body: z.ZodString;
|
13
|
+
send_to_contact: z.ZodObject<{
|
14
|
+
id: z.ZodNumber;
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
16
|
+
id: number;
|
17
|
+
}, {
|
18
|
+
id: number;
|
19
|
+
}>;
|
20
|
+
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
21
|
+
referral_order: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
22
|
+
letter_type: z.ZodDefault<z.ZodEnum<["patient_initiated", "patient", "referral", "provider"]>>;
|
23
|
+
}, "strict", z.ZodTypeAny, {
|
24
|
+
body: string;
|
25
|
+
patient: number;
|
26
|
+
practice: number;
|
27
|
+
send_to_contact: {
|
28
|
+
id: number;
|
29
|
+
};
|
30
|
+
letter_type: "patient" | "provider" | "patient_initiated" | "referral";
|
31
|
+
subject?: string | null | undefined;
|
32
|
+
referral_order?: number | null | undefined;
|
33
|
+
}, {
|
34
|
+
body: string;
|
35
|
+
patient: number;
|
36
|
+
practice: number;
|
37
|
+
send_to_contact: {
|
38
|
+
id: number;
|
39
|
+
};
|
40
|
+
subject?: string | null | undefined;
|
41
|
+
referral_order?: number | null | undefined;
|
42
|
+
letter_type?: "patient" | "provider" | "patient_initiated" | "referral" | undefined;
|
43
|
+
}>, {
|
44
|
+
body: string;
|
45
|
+
patient: number;
|
46
|
+
practice: number;
|
47
|
+
send_to_contact: {
|
48
|
+
id: number;
|
49
|
+
};
|
50
|
+
letter_type: "patient" | "provider" | "patient_initiated" | "referral";
|
51
|
+
subject?: string | null | undefined;
|
52
|
+
referral_order?: number | null | undefined;
|
53
|
+
}, {
|
54
|
+
body: string;
|
55
|
+
patient: number;
|
56
|
+
practice: number;
|
57
|
+
send_to_contact: {
|
58
|
+
id: number;
|
59
|
+
};
|
60
|
+
subject?: string | null | undefined;
|
61
|
+
referral_order?: number | null | undefined;
|
62
|
+
letter_type?: "patient" | "provider" | "patient_initiated" | "referral" | undefined;
|
63
|
+
}>;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.letterSchema = exports.contactSchema = void 0;
|
27
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
28
|
+
const lodash_1 = require("lodash");
|
29
|
+
const z = __importStar(require("zod"));
|
30
|
+
// All values taken from Elation's API
|
31
|
+
const letterTypeEnum = z.enum([
|
32
|
+
'patient_initiated',
|
33
|
+
'patient',
|
34
|
+
'referral',
|
35
|
+
'provider',
|
36
|
+
]);
|
37
|
+
exports.contactSchema = z.object({
|
38
|
+
id: extensions_core_1.NumericIdSchema,
|
39
|
+
});
|
40
|
+
exports.letterSchema = z
|
41
|
+
.object({
|
42
|
+
patient: extensions_core_1.NumericIdSchema,
|
43
|
+
practice: extensions_core_1.NumericIdSchema,
|
44
|
+
body: z.string(),
|
45
|
+
send_to_contact: exports.contactSchema,
|
46
|
+
subject: z.string().nonempty().optional().nullable(),
|
47
|
+
referral_order: extensions_core_1.NumericIdSchema.optional().nullable(),
|
48
|
+
letter_type: letterTypeEnum.default(letterTypeEnum.enum.provider),
|
49
|
+
})
|
50
|
+
.strict()
|
51
|
+
// subject and referral_order cannot be empty at the same time
|
52
|
+
.refine((input) => !((0, lodash_1.isNil)(input.subject) && (0, lodash_1.isNil)(input.referral_order)), {
|
53
|
+
message: "One of either 'subject' or 'referral order' is required.",
|
54
|
+
});
|
55
|
+
//# sourceMappingURL=letter.zod.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"letter.zod.js","sourceRoot":"","sources":["../../../../extensions/elation/validation/letter.zod.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAA+D;AAC/D,mCAA8B;AAC9B,uCAAwB;AAExB,sCAAsC;AACtC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC;IAC5B,mBAAmB;IACnB,SAAS;IACT,UAAU;IACV,UAAU;CACX,CAAC,CAAA;AAEW,QAAA,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,iCAAe;CACpB,CAAC,CAAA;AAEW,QAAA,YAAY,GAAG,CAAC;KAC1B,MAAM,CAAC;IACN,OAAO,EAAE,iCAAe;IACxB,QAAQ,EAAE,iCAAe;IACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,eAAe,EAAE,qBAAa;IAC9B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACpD,cAAc,EAAE,iCAAe,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACrD,WAAW,EAAE,cAAc,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC;CAClE,CAAC;KACD,MAAM,EAAE;IACT,8DAA8D;KAC7D,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,KAAK,CAAC,OAAO,CAAC,IAAI,IAAA,cAAK,EAAC,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE;IACzE,OAAO,EAAE,0DAA0D;CACpE,CAAC,CAAA"}
|
@@ -41,7 +41,7 @@
|
|
41
41
|
},
|
42
42
|
"elation": {
|
43
43
|
"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",
|
44
|
-
"changelog": "# Elation Changelog\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"
|
44
|
+
"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"
|
45
45
|
},
|
46
46
|
"external-server": {
|
47
47
|
"readme": "# External Server\n\nHere will be some instructions.",
|