@awell-health/awell-extensions 2.0.180 → 2.0.182
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/GetAppointments.mock.js.map +1 -0
- package/dist/extensions/elation/actions/findAppointmentsWithAI/config/dataPoints.js.map +1 -0
- package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/config/fields.js +2 -2
- package/dist/extensions/elation/actions/findAppointmentsWithAI/config/fields.js.map +1 -0
- package/dist/extensions/elation/actions/findAppointmentsWithAI/config/index.js.map +1 -0
- package/dist/extensions/elation/actions/{findAppointmentsByPrompt/findAppointmentsByPrompt.d.ts → findAppointmentsWithAI/findAppointmentsWithAI.d.ts} +1 -1
- package/dist/extensions/elation/actions/{findAppointmentsByPrompt/findAppointmentsByPrompt.js → findAppointmentsWithAI/findAppointmentsWithAI.js} +15 -8
- package/dist/extensions/elation/actions/findAppointmentsWithAI/findAppointmentsWithAI.js.map +1 -0
- package/dist/extensions/elation/actions/findAppointmentsWithAI/getAppoitnmentCountByStatus.js.map +1 -0
- package/dist/extensions/elation/actions/findAppointmentsWithAI/index.d.ts +1 -0
- package/dist/extensions/elation/actions/findAppointmentsWithAI/index.js +6 -0
- package/dist/extensions/elation/actions/findAppointmentsWithAI/index.js.map +1 -0
- package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.js +33 -13
- package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.js.map +1 -1
- package/dist/extensions/elation/actions/findFutureAppointment/{getFutureAppoitnments.js → getFutureAppointments.js} +1 -1
- package/dist/extensions/elation/actions/findFutureAppointment/{getFutureAppoitnments.js.map → getFutureAppointments.js.map} +1 -1
- package/dist/extensions/elation/actions/index.d.ts +1 -1
- package/dist/extensions/elation/actions/index.js +2 -2
- package/dist/extensions/elation/actions/index.js.map +1 -1
- package/dist/extensions/elation/actions/updatePatientTags/updatePatientTags.js +1 -1
- package/dist/extensions/elation/actions/updatePatientTags/updatePatientTags.js.map +1 -1
- package/dist/extensions/elation/lib/findAppointmentsWithLLM/FindAppointmentsWithLLM.evaluate.d.ts +1 -0
- package/dist/extensions/elation/lib/findAppointmentsWithLLM/FindAppointmentsWithLLM.evaluate.js +152 -0
- package/dist/extensions/elation/lib/findAppointmentsWithLLM/FindAppointmentsWithLLM.evaluate.js.map +1 -0
- package/dist/extensions/elation/lib/findAppointmentsWithLLM/findAppointmentsWithLLM.d.ts +14 -0
- package/dist/extensions/elation/{actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.js → lib/findAppointmentsWithLLM/findAppointmentsWithLLM.js} +6 -13
- package/dist/extensions/elation/lib/findAppointmentsWithLLM/findAppointmentsWithLLM.js.map +1 -0
- package/dist/extensions/elation/{actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM → lib/findAppointmentsWithLLM}/parser.d.ts +1 -1
- package/dist/extensions/elation/{actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM → lib/findAppointmentsWithLLM}/parser.js +1 -3
- package/dist/extensions/elation/lib/findAppointmentsWithLLM/parser.js.map +1 -0
- package/dist/extensions/elation/lib/findAppointmentsWithLLM/prompt.d.ts +2 -0
- package/dist/extensions/elation/lib/findAppointmentsWithLLM/prompt.js +61 -0
- package/dist/extensions/elation/lib/findAppointmentsWithLLM/prompt.js.map +1 -0
- package/dist/extensions/markdown.json +1 -1
- package/dist/extensions/shelly/actions/index.d.ts +1 -1
- package/dist/extensions/shelly/actions/medicationFromImage/config/datapoints.d.ts +4 -0
- package/dist/extensions/shelly/actions/medicationFromImage/config/datapoints.js +4 -0
- package/dist/extensions/shelly/actions/medicationFromImage/config/datapoints.js.map +1 -1
- package/dist/extensions/shelly/actions/medicationFromImage/medicationFromImage.js +11 -0
- package/dist/extensions/shelly/actions/medicationFromImage/medicationFromImage.js.map +1 -1
- package/package.json +1 -1
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/__testdata__/GetAppointments.mock.js.map +0 -1
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/config/dataPoints.js.map +0 -1
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/config/fields.js.map +0 -1
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/config/index.js.map +0 -1
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/findAppointmentsByPrompt.js.map +0 -1
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/getAppoitnmentCountByStatus.js.map +0 -1
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/index.d.ts +0 -1
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/index.js +0 -6
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/index.js.map +0 -1
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.d.ts +0 -14
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.js.map +0 -1
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/parser.js.map +0 -1
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.d.ts +0 -2
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.js +0 -24
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.js.map +0 -1
- package/dist/extensions/elation/actions/findFutureAppointment/formatAppointments.d.ts +0 -2
- package/dist/extensions/elation/actions/findFutureAppointment/formatAppointments.js +0 -18
- package/dist/extensions/elation/actions/findFutureAppointment/formatAppointments.js.map +0 -1
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.d.ts +0 -14
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.js +0 -29
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.js.map +0 -1
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.d.ts +0 -17
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.js +0 -16
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.js.map +0 -1
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.d.ts +0 -2
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.js +0 -20
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.js.map +0 -1
- /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/__testdata__/GetAppointments.mock.d.ts +0 -0
- /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/__testdata__/GetAppointments.mock.js +0 -0
- /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/config/dataPoints.d.ts +0 -0
- /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/config/dataPoints.js +0 -0
- /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/config/fields.d.ts +0 -0
- /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/config/index.d.ts +0 -0
- /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/config/index.js +0 -0
- /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/getAppoitnmentCountByStatus.d.ts +0 -0
- /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/getAppoitnmentCountByStatus.js +0 -0
- /package/dist/extensions/elation/actions/findFutureAppointment/{getFutureAppoitnments.d.ts → getFutureAppointments.d.ts} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"GetAppointments.mock.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsWithAI/__testdata__/GetAppointments.mock.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAErB,QAAA,gBAAgB,GAAG;IAC9B;QACE,EAAE,EAAE,GAAG;QACP,cAAc,EAAE,IAAA,kBAAO,EAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;QACpD,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,IAAI;QACrB,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,aAAa;QAC7B,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,0BAA0B;QAClC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,EAAE;QACf,MAAM,EAAE;YACN,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,sBAAsB;YACnC,aAAa,EAAE,IAAI;SACpB;QACD,OAAO,EAAE,KAAK;QACd,aAAa,EAAE;YACb,yBAAyB,EAAE,IAAI;YAC/B,aAAa,EACX,iJAAiJ;YACnJ,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE;gBACR;oBACE,EAAE,EAAE,GAAG;oBACP,IAAI,EAAE,yBAAyB;oBAC/B,MAAM,EAAE,YAAY;iBACrB;aACF;YACD,WAAW,EAAE,CAAC;SACf;QACD,SAAS,EAAE,eAAe;QAC1B,QAAQ,EAAE,eAAe;QACzB,YAAY,EAAE,EAAE;QAChB,wBAAwB,EAAE,IAAI;QAC9B,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,sBAAsB;QACpC,kBAAkB,EAAE,sBAAsB;QAC1C,YAAY,EAAE,IAAI;QAClB,gBAAgB,EAAE,IAAI;QACtB,kBAAkB,EAAE,EAAE;KACvB;IACD;QACE,EAAE,EAAE,GAAG;QACP,cAAc,EAAE,IAAA,kBAAO,EAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;QACpD,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,IAAI;QACrB,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,aAAa;QAC7B,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,0BAA0B;QAClC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,EAAE;QACf,MAAM,EAAE;YACN,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,sBAAsB;YACnC,aAAa,EAAE,IAAI;SACpB;QACD,OAAO,EAAE,KAAK;QACd,aAAa,EAAE;YACb,yBAAyB,EAAE,IAAI;YAC/B,aAAa,EACX,iJAAiJ;YACnJ,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE;gBACR;oBACE,EAAE,EAAE,GAAG;oBACP,IAAI,EAAE,yBAAyB;oBAC/B,MAAM,EAAE,YAAY;iBACrB;aACF;YACD,WAAW,EAAE,CAAC;SACf;QACD,SAAS,EAAE,eAAe;QAC1B,QAAQ,EAAE,eAAe;QACzB,YAAY,EAAE,EAAE;QAChB,wBAAwB,EAAE,IAAI;QAC9B,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,sBAAsB;QACpC,kBAAkB,EAAE,sBAAsB;QAC1C,YAAY,EAAE,IAAI;QAClB,gBAAgB,EAAE,IAAI;QACtB,kBAAkB,EAAE,EAAE;KACvB;CACF,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsWithAI/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,YAAY,EAAE;QACZ,GAAG,EAAE,cAAc;QACnB,SAAS,EAAE,MAAM;KAClB;IACD,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,QAAQ;KACpB;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,2BAA2B;QAChC,SAAS,EAAE,MAAM;KAClB;CAC4C,CAAA"}
|
@@ -13,10 +13,10 @@ exports.fields = {
|
|
13
13
|
},
|
14
14
|
prompt: {
|
15
15
|
id: 'prompt',
|
16
|
-
label: 'Describe
|
16
|
+
label: 'Describe the appointments to search for',
|
17
17
|
type: extensions_core_1.FieldType.TEXT,
|
18
18
|
required: true,
|
19
|
-
description: '',
|
19
|
+
description: 'Provide clear instructions about what appointments you want to find. You can search by appointment type (e.g., "Find all PCP visits"), status (e.g., "Find scheduled appointments"), or other criteria. Be as specific as possible for best results.',
|
20
20
|
},
|
21
21
|
};
|
22
22
|
exports.FieldsValidationSchema = zod_1.z.object({
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsWithAI/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAIsC;AAEzB,QAAA,MAAM,GAAG;IACpB,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,EAAE;KAChB;IACD,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,yCAAyC;QAChD,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,sPAAsP;KACpQ;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,iCAAe;IAC1B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACwB,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsWithAI/config/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,mCAAyD;AAAhD,gGAAA,MAAM,OAAA;AAAE,gHAAA,sBAAsB,OAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { type Action } from '@awell-health/extensions-core';
|
2
2
|
import { type settings } from '../../settings';
|
3
3
|
import { fields, dataPoints } from './config';
|
4
|
-
export declare const
|
4
|
+
export declare const findAppointmentsWithAI: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.findAppointmentsWithAI = void 0;
|
4
4
|
const lodash_1 = require("lodash");
|
5
5
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
6
6
|
const addEventLog_1 = require("../../../../src/lib/awell/addEventLog");
|
@@ -8,11 +8,12 @@ const client_1 = require("../../client");
|
|
8
8
|
const createOpenAIModel_1 = require("../../../../src/lib/llm/openai/createOpenAIModel");
|
9
9
|
const config_1 = require("./config");
|
10
10
|
const getAppoitnmentCountByStatus_1 = require("./getAppoitnmentCountByStatus");
|
11
|
-
const
|
12
|
-
|
13
|
-
|
11
|
+
const findAppointmentsWithLLM_1 = require("../../lib/findAppointmentsWithLLM/findAppointmentsWithLLM");
|
12
|
+
const utils_1 = require("../../../../src/utils");
|
13
|
+
exports.findAppointmentsWithAI = {
|
14
|
+
key: 'findAppointmentsWithAI',
|
14
15
|
category: extensions_core_1.Category.EHR_INTEGRATIONS,
|
15
|
-
title: '
|
16
|
+
title: '✨ Find Appointments',
|
16
17
|
description: 'Find all appointments for a patient using natural language.',
|
17
18
|
fields: config_1.fields,
|
18
19
|
previewable: false,
|
@@ -20,9 +21,11 @@ exports.findAppointmentsByPrompt = {
|
|
20
21
|
onEvent: async ({ payload, onComplete, onError, helpers }) => {
|
21
22
|
const { prompt, patientId } = config_1.FieldsValidationSchema.parse(payload.fields);
|
22
23
|
const api = (0, client_1.makeAPIClient)(payload.settings);
|
24
|
+
// First fetch all appointments for the patient
|
23
25
|
const appointments = await api.findAppointments({
|
24
26
|
patient: patientId,
|
25
27
|
});
|
28
|
+
// Early return if no appointments found
|
26
29
|
if ((0, lodash_1.isNil)(appointments) || appointments.length === 0) {
|
27
30
|
await onComplete({
|
28
31
|
data_points: {
|
@@ -34,24 +37,28 @@ exports.findAppointmentsByPrompt = {
|
|
34
37
|
return;
|
35
38
|
}
|
36
39
|
try {
|
40
|
+
// Initialize OpenAI model for natural language processing
|
37
41
|
const { model, metadata, callbacks } = await (0, createOpenAIModel_1.createOpenAIModel)({
|
38
42
|
settings: {}, // we use built-in API key for OpenAI
|
39
43
|
helpers,
|
40
44
|
payload,
|
41
45
|
});
|
42
|
-
|
46
|
+
// Use LLM to find appointments matching the user's natural language prompt
|
47
|
+
const { appointmentIds, explanation } = await (0, findAppointmentsWithLLM_1.findAppointmentsWithLLM)({
|
43
48
|
model,
|
44
49
|
appointments,
|
45
50
|
prompt,
|
46
51
|
metadata,
|
47
52
|
callbacks,
|
48
53
|
});
|
54
|
+
const htmlExplanation = await (0, utils_1.markdownToHtml)(explanation);
|
55
|
+
// Filter appointments based on LLM's selection
|
49
56
|
const selectedAppointments = appointments.filter((appointment) => appointmentIds.includes(appointment.id));
|
50
57
|
const appointmentCountsByStatus = (0, getAppoitnmentCountByStatus_1.getAppointmentCountsByStatus)(selectedAppointments);
|
51
58
|
await onComplete({
|
52
59
|
data_points: {
|
53
60
|
appointments: JSON.stringify(selectedAppointments),
|
54
|
-
explanation,
|
61
|
+
explanation: htmlExplanation,
|
55
62
|
appointmentCountsByStatus: JSON.stringify(appointmentCountsByStatus),
|
56
63
|
},
|
57
64
|
events: [
|
@@ -77,4 +84,4 @@ exports.findAppointmentsByPrompt = {
|
|
77
84
|
}
|
78
85
|
},
|
79
86
|
};
|
80
|
-
//# sourceMappingURL=
|
87
|
+
//# sourceMappingURL=findAppointmentsWithAI.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"findAppointmentsWithAI.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findAppointmentsWithAI/findAppointmentsWithAI.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,mEAAqE;AACrE,uEAA2E;AAE3E,yCAA4C;AAC5C,wFAAoF;AACpF,qCAAqE;AACrE,+EAA4E;AAC5E,uGAAmG;AACnG,iDAAsD;AAGzC,QAAA,sBAAsB,GAI/B;IACF,GAAG,EAAE,wBAAwB;IAC7B,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EAAE,6DAA6D;IAC1E,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAiB,EAAE;QAC1E,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,+BAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC1E,MAAM,GAAG,GAAG,IAAA,sBAAa,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QAE3C,+CAA+C;QAC/C,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,gBAAgB,CAAC;YAC9C,OAAO,EAAE,SAAS;SACnB,CAAC,CAAA;QAEF,wCAAwC;QACxC,IAAI,IAAA,cAAK,EAAC,YAAY,CAAC,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrD,MAAM,UAAU,CAAC;gBACf,WAAW,EAAE;oBACX,WAAW,EAAE,uBAAuB;oBACpC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;oBAChC,yBAAyB,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;iBAC9C;aACF,CAAC,CAAA;YACF,OA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AK,EAAE;4BACL,QAAQ,EAAE,cAAc;4BACxB,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;yBAClE;qBACF;iBACF;aACF,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA"}
|
package/dist/extensions/elation/actions/findAppointmentsWithAI/getAppoitnmentCountByStatus.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getAppoitnmentCountByStatus.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findAppointmentsWithAI/getAppoitnmentCountByStatus.ts"],"names":[],"mappings":";;;AAGA,sEAA6D;AAEtD,MAAM,4BAA4B,GAAG,CACxC,YAAmC,EACX,EAAE;IAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,4BAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACrF,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAC7B,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,CAAC,MAAM,MAAK,MAAM,CACvD,CAAC,MAAM,CAAA;QACR,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;YACZ,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,CAAA;QACnB,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC,CAAA;AAZU,QAAA,4BAA4B,gCAYtC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { findAppointmentsWithAI } from './findAppointmentsWithAI';
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.findAppointmentsWithAI = void 0;
|
4
|
+
var findAppointmentsWithAI_1 = require("./findAppointmentsWithAI");
|
5
|
+
Object.defineProperty(exports, "findAppointmentsWithAI", { enumerable: true, get: function () { return findAppointmentsWithAI_1.findAppointmentsWithAI; } });
|
6
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findAppointmentsWithAI/index.ts"],"names":[],"mappings":";;;AAAA,mEAAiE;AAAxD,gIAAA,sBAAsB,OAAA"}
|
@@ -5,15 +5,15 @@ const lodash_1 = require("lodash");
|
|
5
5
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
6
6
|
const addEventLog_1 = require("../../../../src/lib/awell/addEventLog");
|
7
7
|
const config_1 = require("./config");
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const findAppointmentWithLLM_1 = require("./lib/findAppointmentWithLLM/findAppointmentWithLLM");
|
8
|
+
const getFutureAppointments_1 = require("./getFutureAppointments");
|
9
|
+
const findAppointmentsWithLLM_1 = require("../../lib/findAppointmentsWithLLM/findAppointmentsWithLLM");
|
11
10
|
const createOpenAIModel_1 = require("../../../../src/lib/llm/openai/createOpenAIModel");
|
12
11
|
const constants_1 = require("../../../../src/lib/llm/openai/constants");
|
12
|
+
const utils_1 = require("../../../../src/utils");
|
13
13
|
exports.findFutureAppointment = {
|
14
14
|
key: 'findFutureAppointment',
|
15
15
|
category: extensions_core_1.Category.EHR_INTEGRATIONS,
|
16
|
-
title: '
|
16
|
+
title: '✨ Find Future Appointment',
|
17
17
|
description: 'Find a future appointment in Elation.',
|
18
18
|
fields: config_1.fields,
|
19
19
|
previewable: false,
|
@@ -21,8 +21,8 @@ exports.findFutureAppointment = {
|
|
21
21
|
onEvent: async ({ payload, onComplete, onError, helpers }) => {
|
22
22
|
// 1. Validate input
|
23
23
|
const { prompt, patientId } = config_1.FieldsValidationSchema.parse(payload.fields);
|
24
|
-
// 2. Get future appointments
|
25
|
-
const appointments = await (0,
|
24
|
+
// 2. Get future appointments (scheduled or confirmed)
|
25
|
+
const appointments = await (0, getFutureAppointments_1.getFutureAppointments)(payload.settings, patientId);
|
26
26
|
if (appointments.length === 0) {
|
27
27
|
await onComplete({
|
28
28
|
data_points: {
|
@@ -40,23 +40,43 @@ exports.findFutureAppointment = {
|
|
40
40
|
payload,
|
41
41
|
modelType: constants_1.OPENAI_MODELS.GPT4o,
|
42
42
|
});
|
43
|
-
// 4. Find matching
|
44
|
-
const {
|
43
|
+
// 4. Find matching appointments
|
44
|
+
const { appointmentIds, explanation } = await (0, findAppointmentsWithLLM_1.findAppointmentsWithLLM)({
|
45
45
|
model,
|
46
46
|
appointments,
|
47
47
|
prompt,
|
48
48
|
metadata,
|
49
49
|
callbacks,
|
50
50
|
});
|
51
|
-
const
|
52
|
-
|
53
|
-
|
51
|
+
const htmlExplanation = await (0, utils_1.markdownToHtml)(explanation);
|
52
|
+
// Handle case where no appointments were found by LLM
|
53
|
+
if (appointmentIds.length === 0) {
|
54
|
+
await onComplete({
|
55
|
+
data_points: {
|
56
|
+
appointment: undefined,
|
57
|
+
appointmentExists: 'false',
|
58
|
+
explanation: htmlExplanation,
|
59
|
+
},
|
60
|
+
events: [
|
61
|
+
(0, addEventLog_1.addActivityEventLog)({
|
62
|
+
message: `Number of future scheduled or confirmed appointments: ${appointments.length}\n
|
63
|
+
Appointments data: ${JSON.stringify(appointments, null, 2)}\n
|
64
|
+
Found appointment: none\n
|
65
|
+
Explanation: ${htmlExplanation}`,
|
66
|
+
}),
|
67
|
+
],
|
68
|
+
});
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
// 5. If appointments were found by LLM, return the first matching appointment
|
72
|
+
const matchedAppointmentId = appointmentIds[0];
|
73
|
+
const foundAppointment = appointments.find((appointment) => appointment.id === matchedAppointmentId);
|
54
74
|
await onComplete({
|
55
75
|
data_points: {
|
56
76
|
appointment: !(0, lodash_1.isNil)(matchedAppointmentId)
|
57
77
|
? JSON.stringify(foundAppointment)
|
58
78
|
: undefined,
|
59
|
-
explanation,
|
79
|
+
explanation: htmlExplanation,
|
60
80
|
appointmentExists: !(0, lodash_1.isNil)(matchedAppointmentId) ? 'true' : 'false',
|
61
81
|
},
|
62
82
|
events: [
|
@@ -64,7 +84,7 @@ exports.findFutureAppointment = {
|
|
64
84
|
message: `Number of future scheduled or confirmed appointments: ${appointments.length}\n
|
65
85
|
Appointments data: ${JSON.stringify(appointments, null, 2)}\n
|
66
86
|
Found appointment: ${(0, lodash_1.isNil)(foundAppointment) ? 'none' : foundAppointment === null || foundAppointment === void 0 ? void 0 : foundAppointment.id}\n
|
67
|
-
Explanation: ${
|
87
|
+
Explanation: ${htmlExplanation}`,
|
68
88
|
}),
|
69
89
|
],
|
70
90
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"findFutureAppointment.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findFutureAppointment/findFutureAppointment.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,mEAAqE;AAErE,uEAA2E;AAE3E,qCAAqE;AACrE,mEAA+D;AAC/D,
|
1
|
+
{"version":3,"file":"findFutureAppointment.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findFutureAppointment/findFutureAppointment.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,mEAAqE;AAErE,uEAA2E;AAE3E,qCAAqE;AACrE,mEAA+D;AAC/D,uGAAmG;AACnG,wFAAoF;AACpF,wEAAwE;AACxE,iDAAsD;AAEzC,QAAA,qBAAqB,GAI9B;IACF,GAAG,EAAE,uBAAuB;IAC5B,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,2BAA2B;IAClC,WAAW,EAAE,uCAAuC;IACpD,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAiB,EAAE;QAC1E,oBAAoB;QACpB,MAAM,EAAE,MAAM,EAAE,SAAS,EAA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,CAAC;iBACH;aACF,CAAC,CAAA;YACF,OAAM;QACR,CAAC;QAED,8EAA8E;QAC9E,MAAM,oBAAoB,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;QAC9C,MAAM,gBAAgB,GAAG,YAAY,CAAC,IAAI,CACxC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,KAAK,oBAAoB,CACzD,CAAA;QAED,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,WAAW,EAAE,CAAC,IAAA,cAAK,EAAC,oBAAoB,CAAC;oBACvC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;oBAClC,CAAC,CAAC,SAAS;gBACb,WAAW,EAAE,eAAe;gBAC5B,iBAAiB,EAAE,CAAC,IAAA,cAAK,EAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;aACnE;YACD,MAAM,EAAE;gBACN,IAAA,iCAAmB,EAAC;oBAClB,OAAO,EAAE,yDAAyD,YAAY,CAAC,MAAM;+BAChE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;+BACrC,IAAA,cAAK,EAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,EAAE;yBAC7D,eAAe,EAAE;iBACjC,CAAC;aACH;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -12,4 +12,4 @@ const getFutureAppointments = async (elationSettings, patientId) => {
|
|
12
12
|
appointment.status.status === 'Confirmed');
|
13
13
|
};
|
14
14
|
exports.getFutureAppointments = getFutureAppointments;
|
15
|
-
//# sourceMappingURL=
|
15
|
+
//# sourceMappingURL=getFutureAppointments.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"
|
1
|
+
{"version":3,"file":"getFutureAppointments.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findFutureAppointment/getFutureAppointments.ts"],"names":[],"mappings":";;;AAEA,yCAA4C;AAKrC,MAAM,qBAAqB,GAAG,KAAK,EAAE,eAA6B,EAAE,SAAiB,EAAkC,EAAE;IAC9H,MAAM,GAAG,GAAG,IAAA,sBAAa,EAAC,eAAe,CAAC,CAAA;IAE1C,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,gBAAgB,CAAC;QAC9C,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC,CAAA;IACF,OAAO,YAAY,CAAC,MAAM,CACxB,CAAC,WAAW,EAAE,EAAE,CACd,WAAW,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW;QACzC,WAAW,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CAC5C,CAAA;AACH,CAAC,CAAA;AAZY,QAAA,qBAAqB,yBAYjC"}
|
@@ -2697,7 +2697,7 @@ export declare const actions: {
|
|
2697
2697
|
required: false;
|
2698
2698
|
};
|
2699
2699
|
}, "appointment" | "explanation" | "appointmentExists">;
|
2700
|
-
|
2700
|
+
findAppointmentsWithAI: import("@awell-health/extensions-core").Action<{
|
2701
2701
|
patientId: {
|
2702
2702
|
id: string;
|
2703
2703
|
label: string;
|
@@ -29,7 +29,7 @@ const closeCareGap_1 = require("./closeCareGap");
|
|
29
29
|
const updatePatientTags_1 = require("./updatePatientTags");
|
30
30
|
const getReferralOrder_1 = require("./getReferralOrder");
|
31
31
|
const findFutureAppointment_1 = require("./findFutureAppointment");
|
32
|
-
const
|
32
|
+
const findAppointmentsWithAI_1 = require("./findAppointmentsWithAI");
|
33
33
|
const signNonVisitNote_1 = require("./signNonVisitNote/signNonVisitNote");
|
34
34
|
const updateReferralOrderResolution_1 = require("./updateReferralOrderResolution");
|
35
35
|
exports.actions = {
|
@@ -61,7 +61,7 @@ exports.actions = {
|
|
61
61
|
updatePatientTags: updatePatientTags_1.updatePatientTags,
|
62
62
|
getReferralOrder: getReferralOrder_1.getReferralOrder,
|
63
63
|
findFutureAppointment: findFutureAppointment_1.findFutureAppointment,
|
64
|
-
|
64
|
+
findAppointmentsWithAI: findAppointmentsWithAI_1.findAppointmentsWithAI,
|
65
65
|
signNonVisitNote: signNonVisitNote_1.signNonVisitNote,
|
66
66
|
updateReferralOrderResolution: updateReferralOrderResolution_1.updateReferralOrderResolution,
|
67
67
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/index.ts"],"names":[],"mappings":";;;AAAA,wDAAoD;AACpD,mDAA+C;AAC/C,mDAA+C;AAC/C,2DAAuD;AACvD,qDAAiD;AACjD,+CAA2C;AAC3C,yDAAqD;AACrD,mDAA+C;AAC/C,6DAAyD;AACzD,6DAAyD;AACzD,uDAAmD;AACnD,6DAAyD;AACzD,iDAA6C;AAC7C,6CAAyC;AACzC,qDAAiD;AACjD,+DAA2D;AAC3D,6DAAyD;AACzD,wDAAoD;AACpD,wDAAoD;AACpD,uEAAmE;AACnE,qDAAiD;AACjD,2CAAuC;AACvC,+DAA2D;AAC3D,mDAA+C;AAC/C,iDAA6C;AAC7C,2DAAuD;AACvD,yDAAqD;AACrD,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/index.ts"],"names":[],"mappings":";;;AAAA,wDAAoD;AACpD,mDAA+C;AAC/C,mDAA+C;AAC/C,2DAAuD;AACvD,qDAAiD;AACjD,+CAA2C;AAC3C,yDAAqD;AACrD,mDAA+C;AAC/C,6DAAyD;AACzD,6DAAyD;AACzD,uDAAmD;AACnD,6DAAyD;AACzD,iDAA6C;AAC7C,6CAAyC;AACzC,qDAAiD;AACjD,+DAA2D;AAC3D,6DAAyD;AACzD,wDAAoD;AACpD,wDAAoD;AACpD,uEAAmE;AACnE,qDAAiD;AACjD,2CAAuC;AACvC,+DAA2D;AAC3D,mDAA+C;AAC/C,iDAA6C;AAC7C,2DAAuD;AACvD,yDAAqD;AACrD,mEAA8D;AAC9D,qEAAiE;AACjE,0EAAsE;AACtE,mFAA+E;AAElE,QAAA,OAAO,GAAG;IACrB,UAAU,EAAV,uBAAU;IACV,aAAa,EAAb,6BAAa;IACb,aAAa,EAAb,6BAAa;IACb,iBAAiB,EAAjB,qCAAiB;IACjB,cAAc,EAAd,+BAAc;IACd,gBAAgB,EAAhB,mCAAgB;IAChB,WAAW,EAAX,yBAAW;IACX,YAAY,EAAZ,2BAAY;IACZ,aAAa,EAAb,6BAAa;IACb,kBAAkB,EAAlB,uCAAkB;IAClB,kBAAkB,EAAlB,uCAAkB;IAClB,eAAe,EAAf,iCAAe;IACf,kBAAkB,EAAlB,uCAAkB;IAClB,eAAe,EAAf,iCAAe;IACf,SAAS,EAAT,qBAAS;IACT,UAAU,EAAV,uBAAU;IACV,UAAU,EAAV,uBAAU;IACV,UAAU,EAAV,uBAAU;IACV,cAAc,EAAd,+BAAc;IACd,mBAAmB,EAAnB,yCAAmB;IACnB,kBAAkB,EAAlB,uCAAkB;IAClB,SAAS,EAAT,qBAAS;IACT,mBAAmB,EAAnB,yCAAmB;IACnB,aAAa,EAAb,6BAAa;IACb,YAAY,EAAZ,2BAAY;IACZ,iBAAiB,EAAjB,qCAAiB;IACjB,gBAAgB,EAAhB,mCAAgB;IAChB,qBAAqB,EAArB,6CAAqB;IACrB,sBAAsB,EAAtB,+CAAsB;IACtB,gBAAgB,EAAhB,mCAAgB;IAChB,6BAA6B,EAA7B,6DAA6B;CAC9B,CAAA"}
|
@@ -20,7 +20,7 @@ const constants_1 = require("../../../../src/lib/llm/openai/constants");
|
|
20
20
|
exports.updatePatientTags = {
|
21
21
|
key: 'updatePatientTags',
|
22
22
|
category: extensions_core_1.Category.EHR_INTEGRATIONS,
|
23
|
-
title: '
|
23
|
+
title: '✨ Update Patient Tags',
|
24
24
|
description: 'Update patient tags in Elation.',
|
25
25
|
fields: config_1.fields,
|
26
26
|
previewable: false,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"updatePatientTags.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/updatePatientTags/updatePatientTags.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,uEAA2E;AAE3E,yCAA4C;AAC5C,qCAAqE;AACrE,6CAAgD;AAChD,wEAAoE;AACpE,wFAAoF;AACpF,wEAAwE;AAExE;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAI1B;IACF,GAAG,EAAE,mBAAmB;IACxB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"updatePatientTags.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/updatePatientTags/updatePatientTags.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,uEAA2E;AAE3E,yCAA4C;AAC5C,qCAAqE;AACrE,6CAAgD;AAChD,wEAAoE;AACpE,wFAAoF;AACpF,wEAAwE;AAExE;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAI1B;IACF,GAAG,EAAE,mBAAmB;IACxB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EAAE,iCAAiC;IAC9C,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAiB,EAAE;QAC1E,8CAA8C;QAC9C,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,+BAAsB,CAAC,KAAK,CAC9D,OAAO,CAAC,MAAM,CACf,CAAA;QACD,MAAM,GAAG,GAAG,IAAA,sBAAa,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QAE3C,uBAAuB;QACvB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;QAChD,MAAM,YAAY,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAA;QAE/B,yDAAyD;QACzD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,qCAAiB,EAAC;YAC7D,QAAQ,EAAE,EAAE,EAAE,qCAAqC;YACnD,OAAO;YACP,OAAO;YACP,SAAS,EAAE,yBAAa,CAAC,KAAK;SAC/B,CAAC,CAAA;QAEF,2BAA2B;QAC3B,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,+BAAc,EAAC;YAC1D,KAAK;YACL,YAAY;YACZ,YAAY;YACZ,QAAQ;YACR,SAAS;SACV,CAAC,CAAA;QAEF,4BAA4B;QAC5B,MAAM,IAAA,8BAAiB,EAAC,GAAG,EAAE,SAAS,EAAE,aAAa,CAAC,CAAA;QAEtD,kCAAkC;QAClC,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,WAAW,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;gBACrC,WAAW;aACZ;YACD,MAAM,EAAE;gBACN,IAAA,iCAAmB,EAAC;oBAClB,OAAO,EAAE,0BAA0B,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,IAAG,CAAC,CAAC,CAAC,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,2BAA2B,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,WAAW,EAAE;iBACrL,CAAC;aACH;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
package/dist/extensions/elation/lib/findAppointmentsWithLLM/FindAppointmentsWithLLM.evaluate.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/dist/extensions/elation/lib/findAppointmentsWithLLM/FindAppointmentsWithLLM.evaluate.js
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
/**
|
7
|
+
* LangSmith Evaluation Script for findAppointmentsWithLLM
|
8
|
+
*
|
9
|
+
* Evaluates the findAppointmentsWithLLM function by:
|
10
|
+
* - Running test cases from LangSmith dataset
|
11
|
+
* - Comparing generated appointments against expected appointments
|
12
|
+
* - Generating evaluation reports
|
13
|
+
*
|
14
|
+
* Requirements:
|
15
|
+
* - Set environment variables in .env:
|
16
|
+
* - OPENAI_API_KEY
|
17
|
+
* - LANGSMITH_API_KEY
|
18
|
+
* - LANGSMITH_TRACING=true
|
19
|
+
* - LANGSMITH_PROJECT=ai-actions-local
|
20
|
+
*
|
21
|
+
* Usage:
|
22
|
+
* yarn ts-node extensions/elation/lib/findAppointmentsWithLLM/findAppointmentsWithLLM.evaluate.ts
|
23
|
+
*
|
24
|
+
* Results can be viewed in LangSmith dashboard:
|
25
|
+
* https://smith.langchain.com/o/3fffae83-70ff-4574-81ba-aaaedf0b4dc5/datasets/745cea13-3379-463f-9a8a-c6b10e29b8f6
|
26
|
+
*
|
27
|
+
* * ⚠️ **Note:** This script does NOT run in CI/CD. It is meant for **manual evaluation** before merging PRs (for now)
|
28
|
+
*/
|
29
|
+
const langsmith_1 = require("langsmith");
|
30
|
+
const evaluation_1 = require("langsmith/evaluation");
|
31
|
+
const createOpenAIModel_1 = require("../../../../src/lib/llm/openai/createOpenAIModel");
|
32
|
+
const findAppointmentsWithLLM_1 = require("./findAppointmentsWithLLM");
|
33
|
+
const constants_1 = require("../../../../src/lib/llm/openai/constants");
|
34
|
+
const lodash_1 = require("lodash");
|
35
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
36
|
+
dotenv_1.default.config();
|
37
|
+
const langsmith = new langsmith_1.Client({
|
38
|
+
apiKey: process.env.LANGSMITH_API_KEY,
|
39
|
+
apiUrl: process.env.LANGSMITH_ENDPOINT,
|
40
|
+
});
|
41
|
+
// Define the dataset name
|
42
|
+
const datasetName = 'ai-actions-find-appointments-elation';
|
43
|
+
// Fetch the 'test' split examples from the dataset
|
44
|
+
const fetchTestExamples = async () => {
|
45
|
+
try {
|
46
|
+
const testExamples = langsmith.listExamples({
|
47
|
+
datasetName,
|
48
|
+
splits: ['test'],
|
49
|
+
});
|
50
|
+
const examples = [];
|
51
|
+
for await (const example of testExamples) {
|
52
|
+
if (!(0, lodash_1.isNil)(example.inputs) && !(0, lodash_1.isNil)(example.outputs)) {
|
53
|
+
// Explicit null check
|
54
|
+
examples.push(example);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
return examples;
|
58
|
+
}
|
59
|
+
catch (error) {
|
60
|
+
console.error('❌ Error fetching test examples:', error);
|
61
|
+
throw error;
|
62
|
+
}
|
63
|
+
};
|
64
|
+
// Custom evaluator to compare generated appointments with expected appointments
|
65
|
+
const appointmentsMatchEvaluator = async ({ outputs, referenceOutputs, }) => {
|
66
|
+
const generatedAppointmentIds = outputs === null || outputs === void 0 ? void 0 : outputs.appointmentIds;
|
67
|
+
const expectedAppointmentIds = referenceOutputs === null || referenceOutputs === void 0 ? void 0 : referenceOutputs.expected_output_appointment_ids;
|
68
|
+
const isEqual = Array.isArray(generatedAppointmentIds) &&
|
69
|
+
Array.isArray(expectedAppointmentIds) &&
|
70
|
+
generatedAppointmentIds.length === expectedAppointmentIds.length &&
|
71
|
+
generatedAppointmentIds.every((id, index) => id === expectedAppointmentIds[index]);
|
72
|
+
return {
|
73
|
+
key: 'appointments_match',
|
74
|
+
score: isEqual ? 1 : 0,
|
75
|
+
metadata: {
|
76
|
+
generatedIds: generatedAppointmentIds,
|
77
|
+
expectedIds: expectedAppointmentIds
|
78
|
+
}
|
79
|
+
};
|
80
|
+
};
|
81
|
+
// Wrapper function to adapt findAppointmentsWithLLM for evaluation
|
82
|
+
const findAppointmentsWithLLMWrapper = async (input) => {
|
83
|
+
const payload = {
|
84
|
+
activity: {
|
85
|
+
id: 'test-activity-id',
|
86
|
+
},
|
87
|
+
pathway: {
|
88
|
+
tenant_id: 'test-tenant',
|
89
|
+
definition_id: 'test-definition',
|
90
|
+
id: 'test-pathway',
|
91
|
+
org_slug: 'test-org',
|
92
|
+
org_id: 'test-org-id',
|
93
|
+
},
|
94
|
+
fields: {
|
95
|
+
instructions: input.instruction,
|
96
|
+
patientId: 'test-patient',
|
97
|
+
},
|
98
|
+
settings: {
|
99
|
+
openAiApiKey: process.env.OPENAI_API_KEY,
|
100
|
+
},
|
101
|
+
};
|
102
|
+
const helpers = {
|
103
|
+
getOpenAIConfig: () => {
|
104
|
+
const apiKey = process.env.OPENAI_API_KEY;
|
105
|
+
if ((0, lodash_1.isNil)(apiKey) || apiKey.trim() === '') {
|
106
|
+
throw new Error('OPENAI_API_KEY is required but not set');
|
107
|
+
}
|
108
|
+
return { apiKey };
|
109
|
+
},
|
110
|
+
};
|
111
|
+
const { model, metadata, callbacks } = await (0, createOpenAIModel_1.createOpenAIModel)({
|
112
|
+
settings: payload.settings,
|
113
|
+
helpers,
|
114
|
+
payload,
|
115
|
+
modelType: constants_1.OPENAI_MODELS.GPT4o,
|
116
|
+
});
|
117
|
+
return await (0, findAppointmentsWithLLM_1.findAppointmentsWithLLM)({
|
118
|
+
model,
|
119
|
+
appointments: input.input_appointments,
|
120
|
+
prompt: input.instruction,
|
121
|
+
metadata,
|
122
|
+
callbacks,
|
123
|
+
});
|
124
|
+
};
|
125
|
+
// Main function to run the evaluation and print results
|
126
|
+
const runEvaluation = async () => {
|
127
|
+
var _a, _b;
|
128
|
+
try {
|
129
|
+
console.log('📡 Fetching test dataset from LangSmith...');
|
130
|
+
const testExamples = await fetchTestExamples();
|
131
|
+
console.log(`✅ Loaded ${testExamples.length} test examples\n`);
|
132
|
+
console.log('🚀 Running evaluation...\n');
|
133
|
+
const results = await (0, evaluation_1.evaluate)(findAppointmentsWithLLMWrapper, {
|
134
|
+
data: testExamples,
|
135
|
+
evaluators: [appointmentsMatchEvaluator],
|
136
|
+
experimentPrefix: 'FindAppointmentsWithLLM Evaluation',
|
137
|
+
maxConcurrency: 16,
|
138
|
+
});
|
139
|
+
const resultsArray = Array.isArray(results) ? results : [results];
|
140
|
+
const experimentId = (_b = (_a = resultsArray[0]) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.run_id;
|
141
|
+
console.log('\n✨ Evaluation Complete!');
|
142
|
+
console.log('View detailed results in LangSmith:');
|
143
|
+
console.log(`https://smith.langchain.com/runs/${experimentId}`);
|
144
|
+
}
|
145
|
+
catch (error) {
|
146
|
+
console.error('❌ Error during evaluation:', error);
|
147
|
+
throw error;
|
148
|
+
}
|
149
|
+
};
|
150
|
+
// Execute the evaluation
|
151
|
+
void runEvaluation();
|
152
|
+
//# sourceMappingURL=FindAppointmentsWithLLM.evaluate.js.map
|
package/dist/extensions/elation/lib/findAppointmentsWithLLM/FindAppointmentsWithLLM.evaluate.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FindAppointmentsWithLLM.evaluate.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/findAppointmentsWithLLM/FindAppointmentsWithLLM.evaluate.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,yCAAgD;AAChD,qDAA+C;AAC/C,wFAAoF;AACpF,uEAAmE;AACnE,wEAAwE;AAExE,mCAA8B;AAG9B,oDAA2B;AAC3B,gBAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,SAAS,GAAG,IAAI,kBAAM,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;IACrC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB;CACvC,CAAC,CAAA;AAEF,0BAA0B;AAC1B,MAAM,WAAW,GAAG,sCAAsC,CAAA;AAkB1D,mDAAmD;AACnD,MAAM,iBAAi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 @@
|
|
1
|
+
import { type ChatOpenAI } from '@langchain/openai';
|
2
|
+
import { type AIActionMetadata } from '../../../../src/lib/llm/openai/types';
|
3
|
+
import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
4
|
+
import { type AppointmentsFromLLM } from './parser';
|
5
|
+
import { type AppointmentResponse } from '../../types';
|
6
|
+
interface FindAppointmentsWithLLMProps {
|
7
|
+
model: ChatOpenAI;
|
8
|
+
appointments: AppointmentResponse[];
|
9
|
+
prompt: string;
|
10
|
+
metadata: AIActionMetadata;
|
11
|
+
callbacks?: BaseCallbackHandler[];
|
12
|
+
}
|
13
|
+
export declare const findAppointmentsWithLLM: ({ model, appointments, prompt, metadata, callbacks, }: FindAppointmentsWithLLMProps) => Promise<AppointmentsFromLLM>;
|
14
|
+
export {};
|
@@ -1,26 +1,19 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.findAppointmentsWithLLM = void 0;
|
4
4
|
const prompt_1 = require("./prompt");
|
5
5
|
const parser_1 = require("./parser");
|
6
|
-
const
|
6
|
+
const findAppointmentsWithLLM = async ({ model, appointments, prompt, metadata, callbacks, }) => {
|
7
7
|
const chain = model.pipe(parser_1.parser);
|
8
8
|
try {
|
9
|
-
const formattedAppointments = appointments
|
10
|
-
.map((appointment) => ({
|
11
|
-
id: appointment.id,
|
12
|
-
reason: appointment.reason,
|
13
|
-
scheduled_date: appointment.scheduled_date,
|
14
|
-
}))
|
15
|
-
.map((appointment) => JSON.stringify(appointment))
|
16
|
-
.join('\n\n');
|
9
|
+
const formattedAppointments = JSON.stringify(appointments);
|
17
10
|
const result = await chain.invoke(await prompt_1.systemPrompt.format({
|
18
11
|
currentDate: new Date().toISOString().split('T')[0],
|
19
12
|
appointments: formattedAppointments,
|
20
13
|
prompt,
|
21
14
|
}), {
|
22
15
|
metadata,
|
23
|
-
runName: '
|
16
|
+
runName: 'ElationFindAppointmentsWithLLM',
|
24
17
|
callbacks
|
25
18
|
});
|
26
19
|
return {
|
@@ -32,5 +25,5 @@ const findAppointmentsByPromptWithLLM = async ({ model, appointments, prompt, me
|
|
32
25
|
throw new Error('Failed to find matching appointments.');
|
33
26
|
}
|
34
27
|
};
|
35
|
-
exports.
|
36
|
-
//# sourceMappingURL=
|
28
|
+
exports.findAppointmentsWithLLM = findAppointmentsWithLLM;
|
29
|
+
//# sourceMappingURL=findAppointmentsWithLLM.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"findAppointmentsWithLLM.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/findAppointmentsWithLLM/findAppointmentsWithLLM.ts"],"names":[],"mappings":";;;AAGA,qCAAuC;AACvC,qCAA2D;AAUpD,MAAM,uBAAuB,GAAG,KAAK,EAAE,EAC5C,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,SAAS,GACoB,EAAgC,EAAE;IAC/D,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,CAAA;IAEhC,IAAI,CAAC;QACH,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;QAE1D,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAC/B,MAAM,qBAAY,CAAC,MAAM,CAAC;YACxB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACnD,YAAY,EAAE,qBAAqB;YACnC,MAAM;SACP,CAAC,EACF;YACE,QAAQ;YACR,OAAO,EAAE,gCAAgC;YACzC,SAAS;SACV,CACF,CAAA;QAED,OAAO;YACL,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAC1D,CAAC;AACH,CAAC,CAAA;AAhCY,QAAA,uBAAuB,2BAgCnC"}
|
@@ -11,7 +11,7 @@ export declare const parser: StructuredOutputParser<z.ZodObject<{
|
|
11
11
|
explanation: string;
|
12
12
|
appointmentIds: number[];
|
13
13
|
}>>;
|
14
|
-
export interface
|
14
|
+
export interface AppointmentsFromLLM {
|
15
15
|
appointmentIds: number[];
|
16
16
|
explanation: string;
|
17
17
|
}
|
@@ -3,12 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parser = exports.AppointmentsSchema = void 0;
|
4
4
|
const zod_1 = require("zod");
|
5
5
|
const output_parsers_1 = require("@langchain/core/output_parsers");
|
6
|
-
exports.AppointmentsSchema = zod_1.z.array(zod_1.z.coerce.number())
|
7
|
-
.describe('Array of appointment IDs that match the criteria');
|
6
|
+
exports.AppointmentsSchema = zod_1.z.array(zod_1.z.coerce.number());
|
8
7
|
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(zod_1.z.object({
|
9
8
|
appointmentIds: exports.AppointmentsSchema,
|
10
9
|
explanation: zod_1.z
|
11
10
|
.string()
|
12
|
-
.describe('A readable explanation of how the appointments were found and why'),
|
13
11
|
}));
|
14
12
|
//# sourceMappingURL=parser.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/findAppointmentsWithLLM/parser.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mEAAuE;AAE1D,QAAA,kBAAkB,GAAG,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;AAE/C,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,OAAC,CAAC,MAAM,CAAC;IACP,cAAc,EAAE,0BAAkB;IAClC,WAAW,EAAE,OAAC;SACX,MAAM,EAAE;CACZ,CAAC,CACH,CAAA"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
2
|
+
export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\nYou are a **thorough and precise** medical assistant.\nYou will receive:\n1. A list (array) of **appointments** for a single patient (in JSON format).\n2. A set of **instructions** (written by a clinician, for a clinician) specifying which types of appointments to find.\n\n---\n### **Your Task**\nYour goal is to carefully analyze the provided instructions and the list of appointments to **identify only those that match the instructions**.\n\n- You must be **thorough** in your search but only return results when you are **certain** that they match.\n- If multiple appointments match, return **all** their IDs.\n- If no appointments match, return an empty array—this is a valid outcome.\n- Be **meticulous when evaluating time-based criteria**, ensuring all matches are **precise** relative to ${currentDate}.\n\n---\n### **Important Instructions**\n- **Interpret clinically**: Instructions are written by a clinician for a clinician. Understand medical terminology correctly.\n - Example: \"Rx\" relates to prescription or medication follow-up, \"PT\" refers to physical therapy, \"f/u\" means follow-up. 2x/wk means 2 times a week while 2:1 means two patients per one clinician.\n- **Only return matches when you are certain**:\n - Use your expertise for matching but do not assume connections—appointments must explicitly fit the given instructions.\n - If an instruction is vague or ambiguous, only match appointments if the data supports it directly.\n- **Evaluate time constraints precisely**:\n - If the instruction mentions \"past\" appointments, **only include** those scheduled **before** ${currentDate}.\n - If \"future\" appointments are requested, **only include** those scheduled **after** ${currentDate}.\n - If an exact date is specified, match it **precisely**.\n- **Only include appointment IDs that exist in the provided input array**.\n- **Do not fabricate matches**—returning an empty array is preferable to an incorrect match.\n\n\n----------\nPatient Appointments:\n${appointments}\n----------\nInstructions:\n${prompt}\n\nYour output must be a valid JSON object with the following fields:\n\n- appointmentIds: An array containing the IDs of appointments that match the given criteria. If no appointments meet the criteria, this array must be empty.\n- explanation: A concise, human-readable explanation that clearly describes:\n - How and why the selected appointments match the input criteria.\n - Why any appointments were excluded, if relevant.\n - Any edge cases or specific reasoning behind your selection.\n\n## Critical Requirements\n### Ensure that the explanation strictly matches the appointmentIds:\n- If appointmentIds contains **selected appointments**, the explanation must accurately describe **why they were chosen**.\n- If appointmentIds is **empty**, the explanation must clearly state **why no matches were found**.\n- **Do not contradict yourself**: The explanation must always align with the selected appointments.\n\n### Be thorough and precise:\n- Carefully **analyze all appointments** before making a decision.\n- **Double-check** your reasoning to confirm that **only valid matches** are included.\n- Ensure that no appointments that **do not meet the criteria** are selected.\n- **Maintain strict consistency** between appointmentIds and explanation.">, any>;
|
@@ -0,0 +1,61 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.systemPrompt = void 0;
|
4
|
+
const prompts_1 = require("@langchain/core/prompts");
|
5
|
+
exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
|
6
|
+
You are a **thorough and precise** medical assistant.
|
7
|
+
You will receive:
|
8
|
+
1. A list (array) of **appointments** for a single patient (in JSON format).
|
9
|
+
2. A set of **instructions** (written by a clinician, for a clinician) specifying which types of appointments to find.
|
10
|
+
|
11
|
+
---
|
12
|
+
### **Your Task**
|
13
|
+
Your goal is to carefully analyze the provided instructions and the list of appointments to **identify only those that match the instructions**.
|
14
|
+
|
15
|
+
- You must be **thorough** in your search but only return results when you are **certain** that they match.
|
16
|
+
- If multiple appointments match, return **all** their IDs.
|
17
|
+
- If no appointments match, return an empty array—this is a valid outcome.
|
18
|
+
- Be **meticulous when evaluating time-based criteria**, ensuring all matches are **precise** relative to \${currentDate}.
|
19
|
+
|
20
|
+
---
|
21
|
+
### **Important Instructions**
|
22
|
+
- **Interpret clinically**: Instructions are written by a clinician for a clinician. Understand medical terminology correctly.
|
23
|
+
- Example: "Rx" relates to prescription or medication follow-up, "PT" refers to physical therapy, "f/u" means follow-up. 2x/wk means 2 times a week while 2:1 means two patients per one clinician.
|
24
|
+
- **Only return matches when you are certain**:
|
25
|
+
- Use your expertise for matching but do not assume connections—appointments must explicitly fit the given instructions.
|
26
|
+
- If an instruction is vague or ambiguous, only match appointments if the data supports it directly.
|
27
|
+
- **Evaluate time constraints precisely**:
|
28
|
+
- If the instruction mentions "past" appointments, **only include** those scheduled **before** \${currentDate}.
|
29
|
+
- If "future" appointments are requested, **only include** those scheduled **after** \${currentDate}.
|
30
|
+
- If an exact date is specified, match it **precisely**.
|
31
|
+
- **Only include appointment IDs that exist in the provided input array**.
|
32
|
+
- **Do not fabricate matches**—returning an empty array is preferable to an incorrect match.
|
33
|
+
|
34
|
+
|
35
|
+
----------
|
36
|
+
Patient Appointments:
|
37
|
+
\${appointments}
|
38
|
+
----------
|
39
|
+
Instructions:
|
40
|
+
\${prompt}
|
41
|
+
|
42
|
+
Your output must be a valid JSON object with the following fields:
|
43
|
+
|
44
|
+
- appointmentIds: An array containing the IDs of appointments that match the given criteria. If no appointments meet the criteria, this array must be empty.
|
45
|
+
- explanation: A concise, human-readable explanation that clearly describes:
|
46
|
+
- How and why the selected appointments match the input criteria.
|
47
|
+
- Why any appointments were excluded, if relevant.
|
48
|
+
- Any edge cases or specific reasoning behind your selection.
|
49
|
+
|
50
|
+
## Critical Requirements
|
51
|
+
### Ensure that the explanation strictly matches the appointmentIds:
|
52
|
+
- If appointmentIds contains **selected appointments**, the explanation must accurately describe **why they were chosen**.
|
53
|
+
- If appointmentIds is **empty**, the explanation must clearly state **why no matches were found**.
|
54
|
+
- **Do not contradict yourself**: The explanation must always align with the selected appointments.
|
55
|
+
|
56
|
+
### Be thorough and precise:
|
57
|
+
- Carefully **analyze all appointments** before making a decision.
|
58
|
+
- **Double-check** your reasoning to confirm that **only valid matches** are included.
|
59
|
+
- Ensure that no appointments that **do not meet the criteria** are selected.
|
60
|
+
- **Maintain strict consistency** between appointmentIds and explanation.`);
|
61
|
+
//# sourceMappingURL=prompt.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/findAppointmentsWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0EAuDc,CAAC,CAAA"}
|
@@ -56,7 +56,7 @@
|
|
56
56
|
"changelog": "# Dropbox Sign changelog"
|
57
57
|
},
|
58
58
|
"elation": {
|
59
|
-
"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\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###
|
59
|
+
"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\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### ✨ Find Future Appointment\n\nTries to find a **single future appointment** for a patient based on a prompt in natural language. These are the steps executed by the action:\n\n1. All future appointments with status `Scheduled` or `Confirmed` for the patient are retrieved from Elation.\n2. Based on the provided prompt, an LLM tries to find a single appointment from the list of future appointments that matches the prompt.\n3. If multiple appointments exist that match the instructions, only the first one is returned.\n\nIf a matching appointment is found, the action returns the full appointment resource and an explanation of why the LLM chose this appointment.\n\n### ✨ Find Appointments\n\nTries to find **all appointments** for a patient based on a prompt in natural language. These are the steps executed by the action:\n\n1. All appointments, independent their date or status, for the patient are retrieved from Elation.\n2. Based on the provided prompt, an LLM tries to find all appointments from the list appointments that matches the prompt.\n\nThe action returns the full appointment resources of all appointments matching the prompt and an explanation of why the LLM chose these appointments. Additionally, the action returns a count of appointments by status.\n\nExample data points output below.\n\nAppointments (note: only displaying a partial appointment resource)```json\n[\n {\n \"id\": 456,\n \"scheduled_date\": \"2023-07-12T20:44:22Z\",\n \"status\": {\n \"status\": \"Scheduled\",\n },\n },\n {\n \"id\": 456,\n \"scheduled_date\": \"2023-08-12T20:44:22Z\",\n \"status\": {\n \"status\": \"Confirmed\",\n },\n }\n]```\n\nAppointment counts by status\n```json\n{\n \"Scheduled\": 1,\n \"Confirmed\": 1,\n}\n```\n\n### ✨ Update Patient Tags\n\nUses AI to manage patient tags in Elation based on natural language instructions. The action executes the following steps:\n\n1. Retrieves existing patient tags from Elation\n2. Uses an LLM to interpret natural language instructions and determine required tag changes\n3. Updates patient tags in Elation according to the interpreted changes\n\nThe action returns:\n- Complete list of updated tags after changes\n- Detailed explanation of what changes were made and why\n\n**Important Notes:**\n- When adding new tags, specify them in single quotes (e.g., 'Diabetes', 'High-Risk'). Tags must exist in your Elation database\n- Due to Elation API limitations, clearing all tags is implemented by setting a single space tag (' '). This is the recommended workaround from Elation's team\n\n",
|
60
60
|
"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"
|
61
61
|
},
|
62
62
|
"epic": {
|
@@ -107,7 +107,7 @@ declare const actions: {
|
|
107
107
|
type: import("@awell-health/extensions-core").FieldType.STRING;
|
108
108
|
required: true;
|
109
109
|
};
|
110
|
-
}, Record<string, never>, "data">;
|
110
|
+
}, Record<string, never>, "data" | "medicationAsText">;
|
111
111
|
reviewMedicationExtraction: import("@awell-health/extensions-core").Action<{
|
112
112
|
imageUrl: {
|
113
113
|
id: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"datapoints.js","sourceRoot":"","sources":["../../../../../../extensions/shelly/actions/medicationFromImage/config/datapoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM;QACX,SAAS,EAAE,MAAM;KAClB;CAC4C,CAAA"}
|
1
|
+
{"version":3,"file":"datapoints.js","sourceRoot":"","sources":["../../../../../../extensions/shelly/actions/medicationFromImage/config/datapoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM;QACX,SAAS,EAAE,MAAM;KAClB;IACD,gBAAgB,EAAE;QAChB,GAAG,EAAE,kBAAkB;QACvB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA"}
|
@@ -6,6 +6,7 @@ const lib_1 = require("../../lib");
|
|
6
6
|
const config_1 = require("./config");
|
7
7
|
const api_1 = require("../../lib/api");
|
8
8
|
const medicationExtractorApi_1 = require("../../lib/api/medicationExtractorApi");
|
9
|
+
const lodash_1 = require("lodash");
|
9
10
|
exports.medicationFromImage = {
|
10
11
|
key: 'medicationFromImage',
|
11
12
|
category: extensions_core_1.Category.WORKFLOW,
|
@@ -25,11 +26,21 @@ exports.medicationFromImage = {
|
|
25
26
|
imageUrl,
|
26
27
|
context: { pathwayId, activityId },
|
27
28
|
});
|
29
|
+
const medicationAsText = data.medications
|
30
|
+
.map((medication) => {
|
31
|
+
return Object.entries(medication)
|
32
|
+
.map(([key, value]) => {
|
33
|
+
return `${(0, lodash_1.startCase)(key)}: ${value}`;
|
34
|
+
})
|
35
|
+
.join('\n');
|
36
|
+
})
|
37
|
+
.join('\n\n-------\n\n');
|
28
38
|
await onComplete({
|
29
39
|
data_points: {
|
30
40
|
data: JSON.stringify({
|
31
41
|
medications: data.medications,
|
32
42
|
}),
|
43
|
+
medicationAsText,
|
33
44
|
},
|
34
45
|
});
|
35
46
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"medicationFromImage.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/medicationFromImage/medicationFromImage.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,mCAAuD;AACvD,qCAAqE;AACrE,uCAAsD;AACtD,iFAAiE;
|
1
|
+
{"version":3,"file":"medicationFromImage.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/medicationFromImage/medicationFromImage.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,mCAAuD;AACvD,qCAAqE;AACrE,uCAAsD;AACtD,iFAAiE;AACjE,mCAAkC;AAErB,QAAA,mBAAmB,GAI5B;IACF,GAAG,EAAE,qBAAqB;IAC1B,QAAQ,EAAE,0BAAQ,CAAC,QAAQ;IAC3B,KAAK,EAAE,+BAA+B;IACtC,WAAW,EAAE,oDAAoD;IACjE,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAiB,EAAE;QAC1E,MAAM,EACJ,MAAM,EAAE,EAAE,QAAQ,EAAE,EACpB,OAAO,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAC1B,QAAQ,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,GAC7B,GAAG,MAAM,IAAA,iCAA2B,EAAC;YACpC,YAAY,EAAE,+BAAsB;YACpC,OAAO;SACR,CAAC,CAAA;QAEF,IAAI,CAAC;YACH,MAAM,sBAAsB,GAAG,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,OAAM;YACR,CAAC;YAED,gDAAgD;YAChD,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;CACF,CAAA"}
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"GetAppointments.mock.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsByPrompt/__testdata__/GetAppointments.mock.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAErB,QAAA,gBAAgB,GAAG;IAC9B;QACE,EAAE,EAAE,GAAG;QACP,cAAc,EAAE,IAAA,kBAAO,EAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;QACpD,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,IAAI;QACrB,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,aAAa;QAC7B,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,0BAA0B;QAClC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,EAAE;QACf,MAAM,EAAE;YACN,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,sBAAsB;YACnC,aAAa,EAAE,IAAI;SACpB;QACD,OAAO,EAAE,KAAK;QACd,aAAa,EAAE;YACb,yBAAyB,EAAE,IAAI;YAC/B,aAAa,EACX,iJAAiJ;YACnJ,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE;gBACR;oBACE,EAAE,EAAE,GAAG;oBACP,IAAI,EAAE,yBAAyB;oBAC/B,MAAM,EAAE,YAAY;iBACrB;aACF;YACD,WAAW,EAAE,CAAC;SACf;QACD,SAAS,EAAE,eAAe;QAC1B,QAAQ,EAAE,eAAe;QACzB,YAAY,EAAE,EAAE;QAChB,wBAAwB,EAAE,IAAI;QAC9B,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,sBAAsB;QACpC,kBAAkB,EAAE,sBAAsB;QAC1C,YAAY,EAAE,IAAI;QAClB,gBAAgB,EAAE,IAAI;QACtB,kBAAkB,EAAE,EAAE;KACvB;IACD;QACE,EAAE,EAAE,GAAG;QACP,cAAc,EAAE,IAAA,kBAAO,EAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;QACpD,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,IAAI;QACrB,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,aAAa;QAC7B,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,0BAA0B;QAClC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,EAAE;QACf,MAAM,EAAE;YACN,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,sBAAsB;YACnC,aAAa,EAAE,IAAI;SACpB;QACD,OAAO,EAAE,KAAK;QACd,aAAa,EAAE;YACb,yBAAyB,EAAE,IAAI;YAC/B,aAAa,EACX,iJAAiJ;YACnJ,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE;gBACR;oBACE,EAAE,EAAE,GAAG;oBACP,IAAI,EAAE,yBAAyB;oBAC/B,MAAM,EAAE,YAAY;iBACrB;aACF;YACD,WAAW,EAAE,CAAC;SACf;QACD,SAAS,EAAE,eAAe;QAC1B,QAAQ,EAAE,eAAe;QACzB,YAAY,EAAE,EAAE;QAChB,wBAAwB,EAAE,IAAI;QAC9B,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,sBAAsB;QACpC,kBAAkB,EAAE,sBAAsB;QAC1C,YAAY,EAAE,IAAI;QAClB,gBAAgB,EAAE,IAAI;QACtB,kBAAkB,EAAE,EAAE;KACvB;CACF,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsByPrompt/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,YAAY,EAAE;QACZ,GAAG,EAAE,cAAc;QACnB,SAAS,EAAE,MAAM;KAClB;IACD,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,QAAQ;KACpB;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,2BAA2B;QAChC,SAAS,EAAE,MAAM;KAClB;CAC4C,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsByPrompt/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAIsC;AAEzB,QAAA,MAAM,GAAG;IACpB,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,EAAE;KAChB;IACD,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,mDAAmD;QAC1D,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,EAAE;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,iCAAe;IAC1B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACwB,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsByPrompt/config/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,mCAAyD;AAAhD,gGAAA,MAAM,OAAA;AAAE,gHAAA,sBAAsB,OAAA"}
|
package/dist/extensions/elation/actions/findAppointmentsByPrompt/findAppointmentsByPrompt.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"findAppointment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rompt/getAppoitnmentCountByStatus.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"getAppoitnmentCountByStatus.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findAppointmentsByPrompt/getAppoitnmentCountByStatus.ts"],"names":[],"mappings":";;;AAGA,sEAA6D;AAEtD,MAAM,4BAA4B,GAAG,CACxC,YAAmC,EACX,EAAE;IAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,4BAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACrF,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAC7B,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,CAAC,MAAM,MAAK,MAAM,CACvD,CAAC,MAAM,CAAA;QACR,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;YACZ,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,CAAA;QACnB,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC,CAAA;AAZU,QAAA,4BAA4B,gCAYtC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export { findAppointmentsByPrompt } from './findAppointmentsByPrompt';
|
@@ -1,6 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.findAppointmentsByPrompt = void 0;
|
4
|
-
var findAppointmentsByPrompt_1 = require("./findAppointmentsByPrompt");
|
5
|
-
Object.defineProperty(exports, "findAppointmentsByPrompt", { enumerable: true, get: function () { return findAppointmentsByPrompt_1.findAppointmentsByPrompt; } });
|
6
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findAppointmentsByPrompt/index.ts"],"names":[],"mappings":";;;AAAA,uEAAqE;AAA5D,oIAAA,wBAAwB,OAAA"}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { type ChatOpenAI } from '@langchain/openai';
|
2
|
-
import { type AIActionMetadata } from '../../../../../../src/lib/llm/openai/types';
|
3
|
-
import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
4
|
-
import { type AppointmentsFromAI } from './parser';
|
5
|
-
import { type AppointmentResponse } from '../../../../types';
|
6
|
-
interface FindAppointmentsByPromptWithLLMProps {
|
7
|
-
model: ChatOpenAI;
|
8
|
-
appointments: AppointmentResponse[];
|
9
|
-
prompt: string;
|
10
|
-
metadata: AIActionMetadata;
|
11
|
-
callbacks?: BaseCallbackHandler[];
|
12
|
-
}
|
13
|
-
export declare const findAppointmentsByPromptWithLLM: ({ model, appointments, prompt, metadata, callbacks, }: FindAppointmentsByPromptWithLLMProps) => Promise<AppointmentsFromAI>;
|
14
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"findAppointmentsByPromptWithLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.ts"],"names":[],"mappings":";;;AAGA,qCAAuC;AACvC,qCAA0D;AAWnD,MAAM,+BAA+B,GAAG,KAAK,EAAE,EACpD,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,SAAS,GAC4B,EAA+B,EAAE;IACtE,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,CAAA;IAEhC,IAAI,CAAC;QACH,MAAM,qBAAqB,GAAG,YAAY;aACvC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YACrB,EAAE,EAAE,WAAW,CAAC,EAAE;YAClB,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,cAAc,EAAE,WAAW,CAAC,cAAc;SAC3C,CAAC,CAAC;aACF,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;aACjD,IAAI,CAAC,MAAM,CAAC,CAAA;QAEf,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAC/B,MAAM,qBAAY,CAAC,MAAM,CAAC;YACxB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACnD,YAAY,EAAE,qBAAqB;YACnC,MAAM;SACP,CAAC,EACF;YACE,QAAQ;YACR,OAAO,EAAE,iCAAiC;YAC1C,SAAS;SACV,CACF,CAAA;QAED,OAAO;YACL,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAC1D,CAAC;AACH,CAAC,CAAA;AAvCY,QAAA,+BAA+B,mCAuC3C"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/parser.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mEAAuE;AAE1D,QAAA,kBAAkB,GAAG,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;KACzD,QAAQ,CAAC,kDAAkD,CAAC,CAAA;AAElD,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,OAAC,CAAC,MAAM,CAAC;IACP,cAAc,EAAE,0BAAkB;IAClC,WAAW,EAAE,OAAC;SACX,MAAM,EAAE;SACR,QAAQ,CACP,mEAAmE,CACpE;CACJ,CAAC,CACH,CAAA"}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
2
|
-
export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"You are a helpful medical assistant. You will receive a list (array) of appointments for a single patient and instructions about which types of appointments to find. You're supposed to use the information in the list to find appointments that match, if any exist. If no appointments exists that obviously match the instructions, that's a perfectly acceptable outcome. If multiple appointments exist that match the instructions, you should return all of them.\n \nImportant instructions:\n- The appointment \"reason\" is the appointment type.\n- Only include appointment ids that exist in the input array. If no appointments exist that match the instructions, return an empty array.\n- Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.\n- Think like a clinician. In other words, \"Rx\" should match a prescription appointment or follow-up related to a prescription, and \"PT\" would match physical therapy.\n- The current date is {currentDate}.\n----------\nInput array: \n{appointments}\n----------\nInstruction: \n{prompt}\n----------\n\nOutput a JSON object with the following keys:\n1. appointmentIds: array of numbers representing appointment IDs that match the instructions (or an empty array if no appointments exist that match the instructions).\n2. explanation: A readable explanation of how the appointments were found and why. Or, if no appointments exist that match the instructions, an explanation of why.">, any>;
|
@@ -1,24 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.systemPrompt = void 0;
|
4
|
-
const prompts_1 = require("@langchain/core/prompts");
|
5
|
-
exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`You are a helpful medical assistant. You will receive a list (array) of appointments for a single patient and instructions about which types of appointments to find. You're supposed to use the information in the list to find appointments that match, if any exist. If no appointments exists that obviously match the instructions, that's a perfectly acceptable outcome. If multiple appointments exist that match the instructions, you should return all of them.
|
6
|
-
|
7
|
-
Important instructions:
|
8
|
-
- The appointment "reason" is the appointment type.
|
9
|
-
- Only include appointment ids that exist in the input array. If no appointments exist that match the instructions, return an empty array.
|
10
|
-
- Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.
|
11
|
-
- Think like a clinician. In other words, "Rx" should match a prescription appointment or follow-up related to a prescription, and "PT" would match physical therapy.
|
12
|
-
- The current date is {currentDate}.
|
13
|
-
----------
|
14
|
-
Input array:
|
15
|
-
{appointments}
|
16
|
-
----------
|
17
|
-
Instruction:
|
18
|
-
{prompt}
|
19
|
-
----------
|
20
|
-
|
21
|
-
Output a JSON object with the following keys:
|
22
|
-
1. appointmentIds: array of numbers representing appointment IDs that match the instructions (or an empty array if no appointments exist that match the instructions).
|
23
|
-
2. explanation: A readable explanation of how the appointments were found and why. Or, if no appointments exist that match the instructions, an explanation of why.`);
|
24
|
-
//# sourceMappingURL=prompt.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,YAAY,GACvB,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;oKAkBkI,CAAC,CAAA"}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.formatAppointments = void 0;
|
4
|
-
const formatAppointments = (appointments) => {
|
5
|
-
return appointments
|
6
|
-
.map((appointment) => {
|
7
|
-
const relevantInfo = {
|
8
|
-
id: appointment.id,
|
9
|
-
reason: appointment.reason,
|
10
|
-
duration: appointment.duration,
|
11
|
-
scheduled_date: appointment.scheduled_date,
|
12
|
-
};
|
13
|
-
return JSON.stringify(relevantInfo);
|
14
|
-
})
|
15
|
-
.join('\n\n');
|
16
|
-
};
|
17
|
-
exports.formatAppointments = formatAppointments;
|
18
|
-
//# sourceMappingURL=formatAppointments.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"formatAppointments.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findFutureAppointment/formatAppointments.ts"],"names":[],"mappings":";;;AAEO,MAAM,kBAAkB,GAAG,CAAC,YAAmC,EAAU,EAAE;IAC9E,OAAO,YAAY;SAChB,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;QACnB,MAAM,YAAY,GAAG;YACnB,EAAE,EAAE,WAAW,CAAC,EAAE;YAClB,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,cAAc,EAAE,WAAW,CAAC,cAAc;SAC3C,CAAA;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;IACrC,CAAC,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAA;AACjB,CAAC,CAAA;AAZU,QAAA,kBAAkB,sBAY5B"}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { type ChatOpenAI } from '@langchain/openai';
|
2
|
-
import { type AIActionMetadata } from '../../../../../../src/lib/llm/openai/types';
|
3
|
-
import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
4
|
-
import { type AppointmentFromAI } from './parser';
|
5
|
-
import { type AppointmentResponse } from '../../../../types';
|
6
|
-
interface FindAppointmentWithLLMProps {
|
7
|
-
model: ChatOpenAI;
|
8
|
-
appointments: AppointmentResponse[];
|
9
|
-
prompt: string;
|
10
|
-
metadata: AIActionMetadata;
|
11
|
-
callbacks?: BaseCallbackHandler[];
|
12
|
-
}
|
13
|
-
export declare const findAppointmentWithLLM: ({ model, appointments, prompt, metadata, callbacks, }: FindAppointmentWithLLMProps) => Promise<AppointmentFromAI>;
|
14
|
-
export {};
|
@@ -1,29 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.findAppointmentWithLLM = void 0;
|
4
|
-
const prompt_1 = require("./prompt");
|
5
|
-
const parser_1 = require("./parser");
|
6
|
-
const formatAppointments_1 = require("../../formatAppointments");
|
7
|
-
const findAppointmentWithLLM = async ({ model, appointments, prompt, metadata, callbacks, }) => {
|
8
|
-
const chain = model.pipe(parser_1.parser);
|
9
|
-
try {
|
10
|
-
const result = await chain.invoke(await prompt_1.systemPrompt.format({
|
11
|
-
format_instructions: parser_1.parser.getFormatInstructions(),
|
12
|
-
appointments: (0, formatAppointments_1.formatAppointments)(appointments),
|
13
|
-
prompt,
|
14
|
-
}), {
|
15
|
-
metadata,
|
16
|
-
runName: 'ElationFindAppointment',
|
17
|
-
callbacks
|
18
|
-
});
|
19
|
-
return {
|
20
|
-
appointmentId: result.appointmentId,
|
21
|
-
explanation: result.explanation
|
22
|
-
};
|
23
|
-
}
|
24
|
-
catch (error) {
|
25
|
-
throw new Error('Failed to find matching appointment.');
|
26
|
-
}
|
27
|
-
};
|
28
|
-
exports.findAppointmentWithLLM = findAppointmentWithLLM;
|
29
|
-
//# sourceMappingURL=findAppointmentWithLLM.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"findAppointmentWithLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.ts"],"names":[],"mappings":";;;AAGA,qCAAuC;AACvC,qCAAyD;AAEzD,iEAA6D;AAUtD,MAAM,sBAAsB,GAAG,KAAK,EAAE,EAC3C,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,SAAS,GACmB,EAA8B,EAAE;IAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,CAAA;IAEhC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAC/B,MAAM,qBAAY,CAAC,MAAM,CAAC;YACxB,mBAAmB,EAAE,eAAM,CAAC,qBAAqB,EAAE;YACnD,YAAY,EAAE,IAAA,uCAAkB,EAAC,YAAY,CAAC;YAC9C,MAAM;SACP,CAAC,EACF;YACE,QAAQ;YACR,OAAO,EAAE,wBAAwB;YACjC,SAAS;SACV,CACF,CAAA;QAED,OAAO;YACL,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;IACzD,CAAC;AACH,CAAC,CAAA;AA9BY,QAAA,sBAAsB,0BA8BlC"}
|
package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.d.ts
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import { z } from 'zod';
|
2
|
-
import { StructuredOutputParser } from '@langchain/core/output_parsers';
|
3
|
-
export declare const AppointmentIdSchema: z.ZodNullable<z.ZodNumber>;
|
4
|
-
export declare const parser: StructuredOutputParser<z.ZodObject<{
|
5
|
-
appointmentId: z.ZodNullable<z.ZodNumber>;
|
6
|
-
explanation: z.ZodString;
|
7
|
-
}, "strip", z.ZodTypeAny, {
|
8
|
-
appointmentId: number | null;
|
9
|
-
explanation: string;
|
10
|
-
}, {
|
11
|
-
appointmentId: number | null;
|
12
|
-
explanation: string;
|
13
|
-
}>>;
|
14
|
-
export interface AppointmentFromAI {
|
15
|
-
appointmentId: number | null;
|
16
|
-
explanation: string;
|
17
|
-
}
|
package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.js
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.parser = exports.AppointmentIdSchema = void 0;
|
4
|
-
const zod_1 = require("zod");
|
5
|
-
const output_parsers_1 = require("@langchain/core/output_parsers");
|
6
|
-
exports.AppointmentIdSchema = zod_1.z.coerce
|
7
|
-
.number()
|
8
|
-
.nullable()
|
9
|
-
.describe('A single appointment');
|
10
|
-
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(zod_1.z.object({
|
11
|
-
appointmentId: exports.AppointmentIdSchema,
|
12
|
-
explanation: zod_1.z
|
13
|
-
.string()
|
14
|
-
.describe('A readable explanation of how the appointment was found and why'),
|
15
|
-
}));
|
16
|
-
//# sourceMappingURL=parser.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mEAAuE;AAE1D,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM;KACxC,MAAM,EAAE;KACR,QAAQ,EAAE;KACV,QAAQ,CAAC,sBAAsB,CAAC,CAAA;AAEtB,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,OAAC,CAAC,MAAM,CAAC;IACP,aAAa,EAAE,2BAAmB;IAClC,WAAW,EAAE,OAAC;SACX,MAAM,EAAE;SACR,QAAQ,CACP,iEAAiE,CAClE;CACJ,CAAC,CACH,CAAA"}
|
package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.d.ts
DELETED
@@ -1,2 +0,0 @@
|
|
1
|
-
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
2
|
-
export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are a helpful medical assistant. You will receive a list (array) of future appointments for a single patient and instructions about which appointment to find. You're supposed to use the information in the list to find an appointment that matches, if one exists.\n \n Important instructions:\n - The appointment \"reason\" is the appointment type.\n - Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.\n - Think like a clinician. In other words, \"Rx\" should match a prescription appointment or follow-up related to a prescription.\n - If no appointment exists that obviously matches the instructions, that's a perfectly acceptable outcome.\n - If multiple appointments exist that match the instructions, you should return the first one.\n - Return your response in the following JSON format:\n {format_instructions}\n\n Input array: {appointments}\n Instruction: {prompt}\n">, any>;
|
package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.js
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.systemPrompt = void 0;
|
4
|
-
const prompts_1 = require("@langchain/core/prompts");
|
5
|
-
exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
|
6
|
-
You are a helpful medical assistant. You will receive a list (array) of future appointments for a single patient and instructions about which appointment to find. You're supposed to use the information in the list to find an appointment that matches, if one exists.
|
7
|
-
|
8
|
-
Important instructions:
|
9
|
-
- The appointment "reason" is the appointment type.
|
10
|
-
- Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.
|
11
|
-
- Think like a clinician. In other words, "Rx" should match a prescription appointment or follow-up related to a prescription.
|
12
|
-
- If no appointment exists that obviously matches the instructions, that's a perfectly acceptable outcome.
|
13
|
-
- If multiple appointments exist that match the instructions, you should return the first one.
|
14
|
-
- Return your response in the following JSON format:
|
15
|
-
{format_instructions}
|
16
|
-
|
17
|
-
Input array: {appointments}
|
18
|
-
Instruction: {prompt}
|
19
|
-
`);
|
20
|
-
//# sourceMappingURL=prompt.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;CAc3D,CAAC,CAAA"}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|