@awell-health/awell-extensions 2.0.206 → 2.0.207

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/generateMockAppointment.d.ts +8 -0
  2. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/generateMockAppointment.js +45 -0
  3. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/generateMockAppointment.js.map +1 -0
  4. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/generatePayload.d.ts +4 -0
  5. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/generatePayload.js +33 -0
  6. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/generatePayload.js.map +1 -0
  7. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/index.d.ts +2 -0
  8. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/index.js +19 -0
  9. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/index.js.map +1 -0
  10. package/dist/extensions/elation/actions/findAppointmentsWithAI/config/fields.js +1 -1
  11. package/dist/extensions/elation/actions/findAppointmentsWithAI/config/fields.js.map +1 -1
  12. package/dist/extensions/elation/actions/findAppointmentsWithAI/findAppointmentsWithAI.d.ts +1 -1
  13. package/dist/extensions/elation/actions/findAppointmentsWithAI/findAppointmentsWithAI.js +59 -29
  14. package/dist/extensions/elation/actions/findAppointmentsWithAI/findAppointmentsWithAI.js.map +1 -1
  15. package/dist/extensions/elation/actions/findAppointmentsWithAI/{getAppoitnmentCountByStatus.js → getAppointmentCountByStatus.js} +1 -1
  16. package/dist/extensions/elation/actions/findAppointmentsWithAI/getAppointmentCountByStatus.js.map +1 -0
  17. package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.js +1 -0
  18. package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.js.map +1 -1
  19. package/dist/extensions/elation/lib/extractDatesFromInstructions/evaluate.d.ts +1 -0
  20. package/dist/extensions/elation/lib/extractDatesFromInstructions/evaluate.js +68 -0
  21. package/dist/extensions/elation/lib/extractDatesFromInstructions/evaluate.js.map +1 -0
  22. package/dist/extensions/elation/lib/extractDatesFromInstructions/extractDatesFromInstructions.d.ts +12 -0
  23. package/dist/extensions/elation/lib/extractDatesFromInstructions/extractDatesFromInstructions.js +28 -0
  24. package/dist/extensions/elation/lib/extractDatesFromInstructions/extractDatesFromInstructions.js.map +1 -0
  25. package/dist/extensions/elation/lib/extractDatesFromInstructions/parser.d.ts +20 -0
  26. package/dist/extensions/elation/lib/extractDatesFromInstructions/parser.js +11 -0
  27. package/dist/extensions/elation/lib/extractDatesFromInstructions/parser.js.map +1 -0
  28. package/dist/extensions/elation/lib/extractDatesFromInstructions/prompt.d.ts +2 -0
  29. package/dist/extensions/elation/lib/extractDatesFromInstructions/prompt.js +33 -0
  30. package/dist/extensions/elation/lib/extractDatesFromInstructions/prompt.js.map +1 -0
  31. package/dist/extensions/elation/lib/findAppointmentsWithLLM/findAppointmentsWithLLM.d.ts +3 -2
  32. package/dist/extensions/elation/lib/findAppointmentsWithLLM/findAppointmentsWithLLM.js +8 -5
  33. package/dist/extensions/elation/lib/findAppointmentsWithLLM/findAppointmentsWithLLM.js.map +1 -1
  34. package/dist/extensions/elation/lib/findAppointmentsWithLLM/parser.js +1 -2
  35. package/dist/extensions/elation/lib/findAppointmentsWithLLM/parser.js.map +1 -1
  36. package/dist/extensions/elation/lib/findAppointmentsWithLLM/prompt.d.ts +2 -1
  37. package/dist/extensions/elation/lib/findAppointmentsWithLLM/prompt.js +55 -2
  38. package/dist/extensions/elation/lib/findAppointmentsWithLLM/prompt.js.map +1 -1
  39. package/package.json +3 -1
  40. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/GetAppointments.mock.d.ts +0 -41
  41. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/GetAppointments.mock.js +0 -93
  42. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/GetAppointments.mock.js.map +0 -1
  43. package/dist/extensions/elation/actions/findAppointmentsWithAI/getAppoitnmentCountByStatus.js.map +0 -1
  44. /package/dist/extensions/elation/actions/findAppointmentsWithAI/{getAppoitnmentCountByStatus.d.ts → getAppointmentCountByStatus.d.ts} +0 -0
@@ -0,0 +1,8 @@
1
+ import { type AppointmentResponse } from '../../../types';
2
+ interface RequiredAppointmentProps {
3
+ scheduled_date: string;
4
+ reason: string;
5
+ status: AppointmentResponse['status']['status'];
6
+ }
7
+ export declare const generateMockAppointment: (required: RequiredAppointmentProps, overrides?: Partial<Omit<AppointmentResponse, keyof RequiredAppointmentProps>>) => AppointmentResponse;
8
+ export {};
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateMockAppointment = void 0;
4
+ const faker_1 = require("@faker-js/faker");
5
+ const generateMockAppointment = (required, overrides = {}) => ({
6
+ id: faker_1.faker.number.int({ min: 1, max: 999999 }),
7
+ scheduled_date: required.scheduled_date,
8
+ duration: 60,
9
+ billing: undefined,
10
+ payment: undefined,
11
+ time_slot_type: 'appointment',
12
+ time_slot_status: 'available',
13
+ reason: required.reason,
14
+ mode: faker_1.faker.lorem.word(),
15
+ description: '',
16
+ status: {
17
+ status: required.status,
18
+ room: undefined,
19
+ status_date: faker_1.faker.date.recent().toISOString(),
20
+ status_detail: undefined,
21
+ },
22
+ patient: faker_1.faker.number.int({ min: 10000, max: 99999 }),
23
+ physician: faker_1.faker.number.int({ min: 100000000000000, max: 999999999999999 }),
24
+ practice: faker_1.faker.number.int({ min: 100000000000000, max: 999999999999999 }),
25
+ recurring_event_schedule: undefined,
26
+ metadata: undefined,
27
+ created_date: faker_1.faker.date.recent().toISOString(),
28
+ last_modified_date: faker_1.faker.date.recent().toISOString(),
29
+ deleted_date: undefined,
30
+ service_location: {
31
+ id: faker_1.faker.number.int({ min: 1, max: 999 }),
32
+ name: faker_1.faker.company.name(),
33
+ place_of_service: faker_1.faker.number.int({ min: 1, max: 99 }),
34
+ address_line1: faker_1.faker.location.streetAddress(),
35
+ address_line2: faker_1.faker.location.secondaryAddress(),
36
+ city: faker_1.faker.location.city(),
37
+ state: faker_1.faker.location.state({ abbreviated: true }),
38
+ zip: faker_1.faker.location.zipCode(),
39
+ phone: faker_1.faker.phone.number(),
40
+ },
41
+ telehealth_details: '',
42
+ ...overrides,
43
+ });
44
+ exports.generateMockAppointment = generateMockAppointment;
45
+ //# sourceMappingURL=generateMockAppointment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateMockAppointment.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsWithAI/__testdata__/generateMockAppointment.ts"],"names":[],"mappings":";;;AACA,2CAAuC;AAOhC,MAAM,uBAAuB,GAAG,CACrC,QAAkC,EAClC,YAEI,EAAE,EACe,EAAE,CAAC,CAAC;IACzB,EAAE,EAAE,aAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IAC7C,cAAc,EAAE,QAAQ,CAAC,cAAc;IACvC,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,cAAc,EAAE,aAAa;IAC7B,gBAAgB,EAAE,WAAW;IAC7B,MAAM,EAAE,QAAQ,CAAC,MAAM;IACvB,IAAI,EAAE,aAAK,CAAC,KAAK,CAAC,IAAI,EAAE;IACxB,WAAW,EAAE,EAAE;IACf,MAAM,EAAE;QACN,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,aAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;QAC9C,aAAa,EAAE,SAAS;KACzB;IACD,OAAO,EAAE,aAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE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AA;AA3CW,QAAA,uBAAuB,2BA2ClC"}
@@ -0,0 +1,4 @@
1
+ import { type NewActivityPayload } from '@awell-health/extensions-core';
2
+ import { type fields } from '../config';
3
+ import { type settings } from '../../../settings';
4
+ export declare const generatePayload: (prompt: string) => NewActivityPayload<typeof fields, typeof settings>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generatePayload = void 0;
4
+ const generatePayload = (prompt) => ({
5
+ fields: {
6
+ patientId: 12345,
7
+ prompt,
8
+ },
9
+ settings: {
10
+ client_id: 'clientId',
11
+ client_secret: 'clientSecret',
12
+ username: 'username',
13
+ password: 'password',
14
+ auth_url: 'authUrl',
15
+ base_url: 'baseUrl',
16
+ rateLimitDuration: '',
17
+ },
18
+ pathway: {
19
+ id: 'test-flow-id',
20
+ definition_id: 'whatever',
21
+ tenant_id: '123',
22
+ org_slug: 'test-org-slug',
23
+ org_id: 'test-org-id',
24
+ },
25
+ activity: {
26
+ id: 'test-activity-id',
27
+ },
28
+ patient: {
29
+ id: 'test-patient-id',
30
+ },
31
+ });
32
+ exports.generatePayload = generatePayload;
33
+ //# sourceMappingURL=generatePayload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generatePayload.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsWithAI/__testdata__/generatePayload.ts"],"names":[],"mappings":";;;AAIO,MAAM,eAAe,GAAG,CAC7B,MAAc,EACsC,EAAE,CAAC,CAAC;IACxD,MAAM,EAAE;QACN,SAAS,EAAE,KAAK;QAChB,MAAM;KACP;IACD,QAAQ,EAAE;QACR,SAAS,EAAE,UAAU;QACrB,aAAa,EAAE,cAAc;QAC7B,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,SAAS;QACnB,iBAAiB,EAAE,EAAE;KACtB;IACD,OAAO,EAAE;QACP,EAAE,EAAE,cAAc;QAClB,aAAa,EAAE,UAAU;QACzB,SAAS,EAAE,KAAK;QAChB,QAAQ,EAAE,eAAe;QACzB,MAAM,EAAE,aAAa;KACtB;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,kBAAkB;KACvB;IACD,OAAO,EAAE;QACP,EAAE,EAAE,iBAAiB;KACtB;CACF,CAAC,CAAA;AA7BW,QAAA,eAAe,mBA6B1B"}
@@ -0,0 +1,2 @@
1
+ export * from './generateMockAppointment';
2
+ export * from './generatePayload';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./generateMockAppointment"), exports);
18
+ __exportStar(require("./generatePayload"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsWithAI/__testdata__/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAyC;AACzC,oDAAiC"}
@@ -16,7 +16,7 @@ exports.fields = {
16
16
  label: 'Describe the appointments to search for',
17
17
  type: extensions_core_1.FieldType.TEXT,
18
18
  required: true,
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.',
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({
@@ -1 +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"}
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,EACT,qPAAqP;KACxP;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,4 +1,4 @@
1
1
  import { type Action } from '@awell-health/extensions-core';
2
2
  import { type settings } from '../../settings';
3
- import { fields, dataPoints } from './config';
3
+ import { dataPoints, fields } from './config';
4
4
  export declare const findAppointmentsWithAI: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findAppointmentsWithAI = void 0;
4
- const lodash_1 = require("lodash");
5
4
  const extensions_core_1 = require("@awell-health/extensions-core");
5
+ const date_fns_1 = require("date-fns");
6
+ const lodash_1 = require("lodash");
6
7
  const addEventLog_1 = require("../../../../src/lib/awell/addEventLog");
7
- const client_1 = require("../../client");
8
+ const constants_1 = require("../../../../src/lib/llm/openai/constants");
8
9
  const createOpenAIModel_1 = require("../../../../src/lib/llm/openai/createOpenAIModel");
9
- const config_1 = require("./config");
10
- const getAppoitnmentCountByStatus_1 = require("./getAppoitnmentCountByStatus");
11
- const findAppointmentsWithLLM_1 = require("../../lib/findAppointmentsWithLLM/findAppointmentsWithLLM");
12
10
  const utils_1 = require("../../../../src/utils");
11
+ const client_1 = require("../../client");
12
+ const extractDatesFromInstructions_1 = require("../../lib/extractDatesFromInstructions/extractDatesFromInstructions");
13
+ const findAppointmentsWithLLM_1 = require("../../lib/findAppointmentsWithLLM/findAppointmentsWithLLM");
14
+ const config_1 = require("./config");
15
+ const getAppointmentCountByStatus_1 = require("./getAppointmentCountByStatus");
13
16
  exports.findAppointmentsWithAI = {
14
17
  key: 'findAppointmentsWithAI',
15
18
  category: extensions_core_1.Category.EHR_INTEGRATIONS,
@@ -21,51 +24,78 @@ exports.findAppointmentsWithAI = {
21
24
  onEvent: async ({ payload, onComplete, onError, helpers }) => {
22
25
  const { prompt, patientId } = config_1.FieldsValidationSchema.parse(payload.fields);
23
26
  const api = (0, client_1.makeAPIClient)(payload.settings);
24
- // First fetch all appointments for the patient
25
- const appointments = await api.findAppointments({
26
- patient: patientId,
27
- });
28
- // Early return if no appointments found
29
- if ((0, lodash_1.isNil)(appointments) || appointments.length === 0) {
30
- await onComplete({
31
- data_points: {
32
- explanation: 'No appointments found',
33
- appointments: JSON.stringify([]),
34
- appointmentCountsByStatus: JSON.stringify({}),
35
- },
36
- });
37
- return;
38
- }
39
27
  try {
40
28
  // Initialize OpenAI model for natural language processing
41
29
  const { model, metadata, callbacks } = await (0, createOpenAIModel_1.createOpenAIModel)({
42
- settings: {}, // we use built-in API key for OpenAI
30
+ modelType: constants_1.OPENAI_MODELS.GPT4o, // GPT4oMini is not reliable enough to work with dates.
31
+ settings: {},
43
32
  helpers,
44
33
  payload,
45
34
  });
35
+ const { from, to, instructions } = await (0, extractDatesFromInstructions_1.extractDatesFromInstructions)({
36
+ model,
37
+ prompt,
38
+ metadata,
39
+ callbacks,
40
+ });
41
+ // First fetch all appointments for the patient
42
+ const appointments = await api.findAppointments({
43
+ patient: patientId,
44
+ });
45
+ // Early return if no appointments found
46
+ if ((0, lodash_1.isNil)(appointments) || appointments.length === 0) {
47
+ await onComplete({
48
+ data_points: {
49
+ explanation: 'No appointments found for the given patient',
50
+ appointments: JSON.stringify([]),
51
+ appointmentCountsByStatus: JSON.stringify({}),
52
+ },
53
+ });
54
+ return;
55
+ }
46
56
  // Use LLM to find appointments matching the user's natural language prompt
47
57
  const { appointmentIds, explanation } = await (0, findAppointmentsWithLLM_1.findAppointmentsWithLLM)({
48
58
  model,
49
59
  appointments,
50
- prompt,
60
+ prompt: (0, lodash_1.defaultTo)(instructions, 'Find all appointments'),
51
61
  metadata,
52
62
  callbacks,
53
63
  });
54
64
  const htmlExplanation = await (0, utils_1.markdownToHtml)(explanation);
55
65
  // Filter appointments based on LLM's selection
56
- const selectedAppointments = appointments.filter((appointment) => appointmentIds.includes(appointment.id));
57
- const appointmentCountsByStatus = (0, getAppoitnmentCountByStatus_1.getAppointmentCountsByStatus)(selectedAppointments);
66
+ const selectedAppointments = appointments.filter((appointment) => appointmentIds.includes(appointment.id) &&
67
+ ((0, lodash_1.isNil)(from) ||
68
+ (0, date_fns_1.isAfter)((0, date_fns_1.parseISO)(appointment.scheduled_date), (0, date_fns_1.parseISO)(from))) &&
69
+ ((0, lodash_1.isNil)(to) ||
70
+ (0, date_fns_1.isBefore)((0, date_fns_1.parseISO)(appointment.scheduled_date), (0, date_fns_1.parseISO)(to))));
71
+ const appointmentCountsByStatus = (0, getAppointmentCountByStatus_1.getAppointmentCountsByStatus)(selectedAppointments);
72
+ const events = [
73
+ (0, addEventLog_1.addActivityEventLog)({
74
+ message: `Found ${appointmentIds.length} appointments for patient ${patientId} that match the search instructions.`,
75
+ }),
76
+ ];
77
+ if (!(0, lodash_1.isNil)(from) && !(0, lodash_1.isNil)(to)) {
78
+ events.push((0, addEventLog_1.addActivityEventLog)({
79
+ message: `Narrowed down to ${selectedAppointments.length} appointments scheduled between ${from} and ${to}.`,
80
+ }));
81
+ }
82
+ else if (!(0, lodash_1.isNil)(from)) {
83
+ events.push((0, addEventLog_1.addActivityEventLog)({
84
+ message: `Narrowed down to ${selectedAppointments.length} appointments scheduled after ${from}.`,
85
+ }));
86
+ }
87
+ else if (!(0, lodash_1.isNil)(to)) {
88
+ events.push((0, addEventLog_1.addActivityEventLog)({
89
+ message: `Narrowed down to ${selectedAppointments.length} appointments scheduled before ${to}.`,
90
+ }));
91
+ }
58
92
  await onComplete({
59
93
  data_points: {
60
94
  appointments: JSON.stringify(selectedAppointments),
61
95
  explanation: htmlExplanation,
62
96
  appointmentCountsByStatus: JSON.stringify(appointmentCountsByStatus),
63
97
  },
64
- events: [
65
- (0, addEventLog_1.addActivityEventLog)({
66
- message: `Found ${selectedAppointments.length} appointments for patient ${patientId}`,
67
- }),
68
- ],
98
+ events,
69
99
  });
70
100
  }
71
101
  catch (error) {
@@ -1 +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,SA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IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;wBAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,6BAA6B,EAAE;wBAC3C,KAAK,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"}
1
+ {"version":3,"file":"findAppointmentsWithAI.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findAppointmentsWithAI/findAppointmentsWithAI.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,uCAAsD;AACtD,mCAAyC;AACzC,uEAA2E;AAC3E,wEAAwE;AACxE,wFAAoF;AACpF,iDAAsD;AACtD,yCAA4C;AAC5C,sHAAkH;AAClH,uGAAmG;AAEnG,qCAAqE;AACrE,+EAA4E;AAE/D,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,IAAI,CAAC;YACH,0DAA0D;YAC1D,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,qCAAiB,EAA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BACX,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;oBAClD,WAAW,EAAE,eAAe;oBAC5B,yBAAyB,EAAE,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC;iBACrE;gBACD,MAAM;aACP,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,CAAC;gBACZ,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;wBAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,6BAA6B,EAAE;wBAC3C,KAAK,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"}
@@ -12,4 +12,4 @@ const getAppointmentCountsByStatus = (appointments) => {
12
12
  }, {});
13
13
  };
14
14
  exports.getAppointmentCountsByStatus = getAppointmentCountsByStatus;
15
- //# sourceMappingURL=getAppoitnmentCountByStatus.js.map
15
+ //# sourceMappingURL=getAppointmentCountByStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAppointmentCountByStatus.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findAppointmentsWithAI/getAppointmentCountByStatus.ts"],"names":[],"mappings":";;;AACA,sEAA6D;AAEtD,MAAM,4BAA4B,GAAG,CAC1C,YAAmC,EACX,EAAE;IAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,4BAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAC5C,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACd,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,EACD,EAAE,CACH,CAAA;AACH,CAAC,CAAA;AAfY,QAAA,4BAA4B,gCAexC"}
@@ -47,6 +47,7 @@ exports.findFutureAppointment = {
47
47
  prompt,
48
48
  metadata,
49
49
  callbacks,
50
+ evaluateDates: true,
50
51
  });
51
52
  const htmlExplanation = await (0, utils_1.markdownToHtml)(explanation);
52
53
  // Handle case where no appointments were found by LLM
@@ -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,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,EAAE,GAAG,+BAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAE1E,sDAAsD;QACtD,MAAM,YAAY,GAAG,MAAM,IAAA,6CAAqB,EAC9C,OAAO,CAAC,QAAwB,EAChC,SAAS,CACV,CAAA;QAED,IAAI,Y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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"}
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,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AA,iCAAmB,EAAC;wBAClB,OAAO,EAAE,yDAAyD,YAAY,CAAC,MAAM;iCAChE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;;2BAE3C,eAAe,EAAE;qBACjC,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"}
@@ -0,0 +1,68 @@
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
+ const openai_1 = require("@langchain/openai");
7
+ const langsmith_1 = require("langsmith");
8
+ const evaluation_1 = require("langsmith/evaluation");
9
+ const openai_2 = require("../../../../src/lib/llm/openai");
10
+ const parser_1 = require("./parser");
11
+ const prompt_1 = require("./prompt");
12
+ const date_fns_1 = require("date-fns");
13
+ const dotenv_1 = __importDefault(require("dotenv"));
14
+ dotenv_1.default.config();
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
+ const langsmith = new langsmith_1.Client({
17
+ apiKey: process.env.LANGSMITH_API_KEY,
18
+ apiUrl: process.env.LANGSMITH_ENDPOINT,
19
+ });
20
+ // Define the application logic you want to evaluate inside a target function
21
+ // The SDK will automatically send the inputs from the dataset to your target function
22
+ async function wrapper(inputs) {
23
+ const model = new openai_1.ChatOpenAI({
24
+ modelName: openai_2.OPENAI_MODELS.GPT4o,
25
+ openAIApiKey: process.env.OPENAI_API_KEY,
26
+ });
27
+ const chain = model.pipe(parser_1.parser);
28
+ const result = await chain.invoke(await prompt_1.systemPrompt.format({
29
+ currentDateTime: inputs.reference_date,
30
+ prompt: inputs.instructions,
31
+ }));
32
+ return {
33
+ from: result.from,
34
+ to: result.to,
35
+ };
36
+ }
37
+ const evaluator = async ({ outputs, referenceOutputs, }) => {
38
+ const isCorrect = (0, date_fns_1.differenceInMinutes)((0, date_fns_1.parseISO)(outputs.from), (0, date_fns_1.parseISO)(referenceOutputs === null || referenceOutputs === void 0 ? void 0 : referenceOutputs.from)) < 1 &&
39
+ (0, date_fns_1.differenceInMinutes)((0, date_fns_1.parseISO)(outputs.to), (0, date_fns_1.parseISO)(referenceOutputs === null || referenceOutputs === void 0 ? void 0 : referenceOutputs.to)) <
40
+ 1;
41
+ return {
42
+ key: 'extract_dates_from_instructions',
43
+ score: isCorrect ? 1 : 0,
44
+ };
45
+ };
46
+ async function runEvaluation() {
47
+ var _a, _b;
48
+ try {
49
+ console.log('🚀 Running evaluation...\n');
50
+ const results = await (0, evaluation_1.evaluate)(wrapper, {
51
+ data: 'ai-actions-extract-date-instructions',
52
+ evaluators: [evaluator],
53
+ experimentPrefix: 'ExtractDatesFromInstructions',
54
+ maxConcurrency: 16,
55
+ });
56
+ const resultsArray = Array.isArray(results) ? results : [results];
57
+ const experimentId = (_b = (_a = resultsArray[0]) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.run_id;
58
+ console.log('\n✨ Evaluation Complete!');
59
+ console.log('View detailed results in LangSmith:');
60
+ console.log(`https://smith.langchain.com/runs/${experimentId}`);
61
+ }
62
+ catch (error) {
63
+ console.error('❌ Error during evaluation:', error);
64
+ throw error;
65
+ }
66
+ }
67
+ void runEvaluation();
68
+ //# sourceMappingURL=evaluate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/extractDatesFromInstructions/evaluate.ts"],"names":[],"mappings":";;;;;AAAA,8CAA8C;AAC9C,yCAAkC;AAClC,qDAI6B;AAC7B,2DAA8D;AAC9D,qCAAiC;AACjC,qCAAuC;AAEvC,uCAAwD;AACxD,oDAA2B;AAE3B,gBAAM,CAAC,MAAM,EAAE,CAAA;AAEf,6DAA6D;AAC7D,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;AAYF,6EAA6E;AAC7E,sFAAsF;AACtF,KAAK,UAAU,OAAO,CAAC,MAAc;IACnC,MAAM,KAAK,GAAG,IAAI,mBAAU,CAAC;QAC3B,SAAS,EAAE,sBAAa,CAAC,KAAK;QAC9B,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;KACzC,CAAC,CAAA;IAEF,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,CAAA;IAEhC,MAAM,MAAM,GAAG,MAAM,KAAK,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CAAC,OAAO,CAAC,CAAA;QACjE,MAAM,YAAY,GAAG,MAAA,MAAA,YAAY,CAAC,CAAC,CAAC,0CAAE,GAAG,0CAAE,MAAgB,CAAA;QAE3D,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;QACvC,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;QAClD,OAAO,CAAC,GAAG,CAAC,oCAAoC,YAAY,EAAE,CAAC,CAAA;IACjE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAA;QAClD,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC;AAED,KAAK,aAAa,EAAE,CAAA"}
@@ -0,0 +1,12 @@
1
+ import type { BaseCallbackHandler } from '@langchain/core/callbacks/base';
2
+ import { type ChatOpenAI } from '@langchain/openai';
3
+ import { type AIActionMetadata } from '../../../../src/lib/llm/openai/types';
4
+ import { type InstructionsWithDatesExtracted } from './parser';
5
+ interface ExtractDatesFromInstructionsProps {
6
+ model: ChatOpenAI;
7
+ prompt: string;
8
+ metadata: AIActionMetadata;
9
+ callbacks?: BaseCallbackHandler[];
10
+ }
11
+ export declare const extractDatesFromInstructions: ({ model, prompt, metadata, callbacks, }: ExtractDatesFromInstructionsProps) => Promise<InstructionsWithDatesExtracted>;
12
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractDatesFromInstructions = void 0;
4
+ const parser_1 = require("./parser");
5
+ const prompt_1 = require("./prompt");
6
+ const extractDatesFromInstructions = async ({ model, prompt, metadata, callbacks, }) => {
7
+ const chain = model.pipe(parser_1.parser);
8
+ try {
9
+ const result = await chain.invoke(await prompt_1.systemPrompt.format({
10
+ currentDateTime: new Date().toISOString(),
11
+ prompt,
12
+ }), {
13
+ metadata,
14
+ runName: 'ElationExtractDatesFromInstructions',
15
+ callbacks,
16
+ });
17
+ return {
18
+ from: result.from,
19
+ to: result.to,
20
+ instructions: result.instructions,
21
+ };
22
+ }
23
+ catch (error) {
24
+ throw new Error(`Failed to extract dates from instructions. LLM reported error: ${error instanceof Error ? error.message : 'Unknown error'}`);
25
+ }
26
+ };
27
+ exports.extractDatesFromInstructions = extractDatesFromInstructions;
28
+ //# sourceMappingURL=extractDatesFromInstructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractDatesFromInstructions.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/extractDatesFromInstructions/extractDatesFromInstructions.ts"],"names":[],"mappings":";;;AAGA,qCAAsE;AACtE,qCAAuC;AAShC,MAAM,4BAA4B,GAAG,KAAK,EAAE,EACjD,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,GACyB,EAA2C,EAAE;IAC/E,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,eAAe,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACzC,MAAM;SACP,CAAC,EACF;YACE,QAAQ;YACR,OAAO,EAAE,qCAAqC;YAC9C,SAAS;SACV,CACF,CAAA;QAED,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,kEACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAA;IACH,CAAC;AACH,CAAC,CAAA;AAjCY,QAAA,4BAA4B,gCAiCxC"}
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { StructuredOutputParser } from '@langchain/core/output_parsers';
3
+ export declare const parser: StructuredOutputParser<z.ZodObject<{
4
+ from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
5
+ to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
6
+ instructions: z.ZodNullable<z.ZodOptional<z.ZodString>>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ from?: string | null | undefined;
9
+ to?: string | null | undefined;
10
+ instructions?: string | null | undefined;
11
+ }, {
12
+ from?: string | null | undefined;
13
+ to?: string | null | undefined;
14
+ instructions?: string | null | undefined;
15
+ }>>;
16
+ export interface InstructionsWithDatesExtracted {
17
+ from?: string | null;
18
+ to?: string | null;
19
+ instructions?: string | null;
20
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ const zod_1 = require("zod");
5
+ const output_parsers_1 = require("@langchain/core/output_parsers");
6
+ exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(zod_1.z.object({
7
+ from: zod_1.z.string().optional().nullable(),
8
+ to: zod_1.z.string().optional().nullable(),
9
+ instructions: zod_1.z.string().optional().nullable(),
10
+ }));
11
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/extractDatesFromInstructions/parser.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mEAAuE;AAE1D,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,OAAC,CAAC,MAAM,CAAC;IACP,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACtC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACpC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC/C,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** data analyst.\nYou will receive:\n1. A set of **instructions** written by a non technical clinician.\n\n---\n### **Your Task**\nYour goal is to carefully analyze the provided instructions, assess if they include a description of a date range and **identify the lower and upper boundary of the period that they describe**. Then, reformulate the instructions to remove any reference to the date range.\n\nThe current date is {currentDateTime}.\n\n----------\nInstructions:\n{prompt}\n\nYour output must be a valid JSON object with the following fields:\n\n- from: The lower boundary of the period that the instructions describe.\n- to: The upper boundary of the period that the instructions describe.\n- instructions: The remaining instructions with the date specific content removed.\n\n## Critical Requirements\n- If the original instructions **only** describe a date range, you can return null for the remaining instructions.\n- Use the ISO 8601 format for the dates, with second precision and the UTC timezone. For example: 2025-01-01T00:00:00Z.\n- If the instructions do not require an upper or lower boundary, set the corresponding value to null.\n- If the instructions describe a period relative to the current date but do not explicitly specify if it should be in the past or future, assume that it should be in the future.\n - Example: \"Within 5 minutes\" should be interpreted as \"from now to now + 5 minutes\"\n">, any>;
@@ -0,0 +1,33 @@
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** data analyst.
7
+ You will receive:
8
+ 1. A set of **instructions** written by a non technical clinician.
9
+
10
+ ---
11
+ ### **Your Task**
12
+ Your goal is to carefully analyze the provided instructions, assess if they include a description of a date range and **identify the lower and upper boundary of the period that they describe**. Then, reformulate the instructions to remove any reference to the date range.
13
+
14
+ The current date is {currentDateTime}.
15
+
16
+ ----------
17
+ Instructions:
18
+ {prompt}
19
+
20
+ Your output must be a valid JSON object with the following fields:
21
+
22
+ - from: The lower boundary of the period that the instructions describe.
23
+ - to: The upper boundary of the period that the instructions describe.
24
+ - instructions: The remaining instructions with the date specific content removed.
25
+
26
+ ## Critical Requirements
27
+ - If the original instructions **only** describe a date range, you can return null for the remaining instructions.
28
+ - Use the ISO 8601 format for the dates, with second precision and the UTC timezone. For example: 2025-01-01T00:00:00Z.
29
+ - If the instructions do not require an upper or lower boundary, set the corresponding value to null.
30
+ - If the instructions describe a period relative to the current date but do not explicitly specify if it should be in the past or future, assume that it should be in the future.
31
+ - Example: "Within 5 minutes" should be interpreted as "from now to now + 5 minutes"
32
+ `);
33
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/extractDatesFromInstructions/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B3D,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { type ChatOpenAI } from '@langchain/openai';
2
2
  import { type AIActionMetadata } from '../../../../src/lib/llm/openai/types';
3
- import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
3
+ import type { BaseCallbackHandler } from '@langchain/core/callbacks/base';
4
4
  import { type AppointmentsFromLLM } from './parser';
5
5
  import { type AppointmentResponse } from '../../types';
6
6
  interface FindAppointmentsWithLLMProps {
@@ -9,6 +9,7 @@ interface FindAppointmentsWithLLMProps {
9
9
  prompt: string;
10
10
  metadata: AIActionMetadata;
11
11
  callbacks?: BaseCallbackHandler[];
12
+ evaluateDates?: boolean;
12
13
  }
13
- export declare const findAppointmentsWithLLM: ({ model, appointments, prompt, metadata, callbacks, }: FindAppointmentsWithLLMProps) => Promise<AppointmentsFromLLM>;
14
+ export declare const findAppointmentsWithLLM: ({ model, appointments, prompt, metadata, callbacks, evaluateDates, }: FindAppointmentsWithLLMProps) => Promise<AppointmentsFromLLM>;
14
15
  export {};
@@ -3,26 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findAppointmentsWithLLM = void 0;
4
4
  const prompt_1 = require("./prompt");
5
5
  const parser_1 = require("./parser");
6
- const findAppointmentsWithLLM = async ({ model, appointments, prompt, metadata, callbacks, }) => {
6
+ const findAppointmentsWithLLM = async ({ model, appointments, prompt, metadata, callbacks, evaluateDates = false, }) => {
7
7
  const chain = model.pipe(parser_1.parser);
8
8
  try {
9
9
  const formattedAppointments = JSON.stringify(appointments);
10
- const result = await chain.invoke(await prompt_1.systemPrompt.format({
10
+ const systemPrompt = evaluateDates
11
+ ? prompt_1.systemPromptWithDates
12
+ : prompt_1.systemPromptWithoutDates;
13
+ const result = await chain.invoke(await systemPrompt.format({
11
14
  currentDateTime: new Date().toISOString(),
12
15
  appointments: formattedAppointments,
13
16
  prompt,
14
17
  }), {
15
18
  metadata,
16
19
  runName: 'ElationFindAppointmentsWithLLM',
17
- callbacks
20
+ callbacks,
18
21
  });
19
22
  return {
20
23
  appointmentIds: result.appointmentIds,
21
- explanation: result.explanation
24
+ explanation: result.explanation,
22
25
  };
23
26
  }
24
27
  catch (error) {
25
- throw new Error('Failed to find matching appointments.');
28
+ throw new Error(`Failed to find matching appointments. LLM reported error: ${error instanceof Error ? error.message : 'Unknown error'}`);
26
29
  }
27
30
  };
28
31
  exports.findAppointmentsWithLLM = findAppointmentsWithLLM;
@@ -1 +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,eAAe,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACzC,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"}
1
+ {"version":3,"file":"findAppointmentsWithLLM.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/findAppointmentsWithLLM/findAppointmentsWithLLM.ts"],"names":[],"mappings":";;;AAGA,qCAA0E;AAC1E,qCAA2D;AAWpD,MAAM,uBAAuB,GAAG,KAAK,EAAE,EAC5C,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,SAAS,EACT,aAAa,GAAG,KAAK,GACQ,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;QAC1D,MAAM,YAAY,GAAG,aAAa;YAChC,CAAC,CAAC,8BAAqB;YACvB,CAAC,CAAC,iCAAwB,CAAA;QAE5B,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAC/B,MAAM,YAAY,CAAC,MAAM,CAAC;YACxB,eAAe,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACzC,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,CACb,6DACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAA;IACH,CAAC;AACH,CAAC,CAAA;AAxCY,QAAA,uBAAuB,2BAwCnC"}
@@ -6,7 +6,6 @@ const output_parsers_1 = require("@langchain/core/output_parsers");
6
6
  exports.AppointmentsSchema = zod_1.z.array(zod_1.z.coerce.number());
7
7
  exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(zod_1.z.object({
8
8
  appointmentIds: exports.AppointmentsSchema,
9
- explanation: zod_1.z
10
- .string()
9
+ explanation: zod_1.z.string(),
11
10
  }));
12
11
  //# sourceMappingURL=parser.js.map
@@ -1 +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"}
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,CAAC,MAAM,EAAE;CACxB,CAAC,CACH,CAAA"}
@@ -1,2 +1,3 @@
1
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 ${currentDateTime}.\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** ${currentDateTime}.\n - If \"future\" appointments are requested, **only include** those scheduled **after** ${currentDateTime}.\n - If an exact date is specified, match it **precisely**.\n - For relative time windows (e.g., “within the next 12 hours”):\n - Calculate the exact time difference between an appointment's scheduled date/time and ${currentDateTime}.\n - Example: If an appointment is scheduled at a time such that the time difference from ${currentDateTime} is more than 0 but less than or equal to 12 hours, then it qualifies.\n - It is critical to ensure the accuracy of your time comparison. Double check your calculation and reasoning.\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\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.\n- **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.\n">, any>;
2
+ export declare const systemPromptWithDates: 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 ${currentDateTime}.\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** ${currentDateTime}.\n - If \"future\" appointments are requested, **only include** those scheduled **after** ${currentDateTime}.\n - If an exact date is specified, match it **precisely**.\n - For relative time windows (e.g., “within the next 12 hours”):\n - Calculate the exact time difference between an appointment's scheduled date/time and ${currentDateTime}.\n - Example: If an appointment is scheduled at a time such that the time difference from ${currentDateTime} is more than 0 but less than or equal to 12 hours, then it qualifies.\n - It is critical to ensure the accuracy of your time comparison. Double check your calculation and reasoning.\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\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.\n- **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.\n">, any>;
3
+ export declare const systemPromptWithoutDates: 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**.\nTranslate the instructions into a set of granular criteria, then go through the list of appointments and evaluate each criteria separately, and in a final pass keep only the appointments that meet all of the criteria.\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- The current date is {currentDateTime}\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- **Do not exclude appointments based on their scheduled date**.\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\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- **Maintain strict consistency** between appointmentIds and explanation.\n- **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.">, any>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.systemPrompt = void 0;
3
+ exports.systemPromptWithoutDates = exports.systemPromptWithDates = void 0;
4
4
  const prompts_1 = require("@langchain/core/prompts");
5
- exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
5
+ exports.systemPromptWithDates = prompts_1.ChatPromptTemplate.fromTemplate(`
6
6
  You are a **thorough and precise** medical assistant.
7
7
  You will receive:
8
8
  1. A list (array) of **appointments** for a single patient (in JSON format).
@@ -63,4 +63,57 @@ Your output must be a valid JSON object with the following fields:
63
63
  - **Maintain strict consistency** between appointmentIds and explanation.
64
64
  - **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.
65
65
  `);
66
+ exports.systemPromptWithoutDates = prompts_1.ChatPromptTemplate.fromTemplate(`
67
+ You are a **thorough and precise** medical assistant.
68
+ You will receive:
69
+ 1. A list (array) of **appointments** for a single patient (in JSON format).
70
+ 2. A set of **instructions** (written by a clinician, for a clinician) specifying which types of appointments to find.
71
+
72
+ ---
73
+ ### **Your Task**
74
+ Your goal is to carefully analyze the provided instructions and the list of appointments to **identify only those that match the instructions**.
75
+ Translate the instructions into a set of granular criteria, then go through the list of appointments and evaluate each criteria separately, and in a final pass keep only the appointments that meet all of the criteria.
76
+
77
+ - You must be **thorough** in your search but only return results when you are **certain** that they match.
78
+ - If multiple appointments match, return **all** their IDs.
79
+ - If no appointments match, return an empty array—this is a valid outcome.
80
+ - The current date is {currentDateTime}
81
+
82
+ ---
83
+ ### **Important Instructions**
84
+ - **Interpret clinically**: Instructions are written by a clinician for a clinician. Understand medical terminology correctly.
85
+ - 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.
86
+ - **Only return matches when you are certain**:
87
+ - Use your expertise for matching but do not assume connections—appointments must explicitly fit the given instructions.
88
+ - If an instruction is vague or ambiguous, only match appointments if the data supports it directly.
89
+ - **Do not exclude appointments based on their scheduled date**.
90
+ - **Only include appointment IDs that exist in the provided input array**.
91
+ - **Do not fabricate matches**—returning an empty array is preferable to an incorrect match.
92
+
93
+
94
+ ----------
95
+ Patient Appointments:
96
+ {appointments}
97
+ ----------
98
+ Instructions:
99
+ {prompt}
100
+
101
+ Your output must be a valid JSON object with the following fields:
102
+
103
+ - appointmentIds: An array containing the IDs of appointments that match the given criteria. If no appointments meet the criteria, this array must be empty.
104
+ - explanation: A concise, human-readable explanation that clearly describes:
105
+ - How and why the selected appointments match the input criteria.
106
+ - Why any appointments were excluded, if relevant.
107
+ - Any edge cases or specific reasoning behind your selection.
108
+
109
+ ## Critical Requirements
110
+ ### Ensure that the explanation strictly matches the appointmentIds:
111
+ - If appointmentIds contains **selected appointments**, the explanation must accurately describe **why they were chosen**.
112
+ - If appointmentIds is **empty**, the explanation must clearly state **why no matches were found**.
113
+
114
+ ### Be thorough and precise:
115
+ - Carefully **analyze all appointments** before making a decision.
116
+ - **Double-check** your reasoning to confirm that **only valid matches** are included.
117
+ - **Maintain strict consistency** between appointmentIds and explanation.
118
+ - **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.`);
66
119
  //# sourceMappingURL=prompt.js.map
@@ -1 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4D3D,CAAC,CAAA"}
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/findAppointmentsWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,qBAAqB,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DpE,CAAC,CAAA;AAEW,QAAA,wBAAwB,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6KAoDqG,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "2.0.206",
3
+ "version": "2.0.207",
4
4
  "packageManager": "yarn@4.5.3",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {
@@ -44,6 +44,7 @@
44
44
  "@types/crypto-js": "^4.2.2",
45
45
  "@types/docusign-esign": "^5.19.0",
46
46
  "@types/express": "^4.17.19",
47
+ "@types/faker": "^6",
47
48
  "@types/jest": "^29.5.14",
48
49
  "@types/jsdom": "^21.1.7",
49
50
  "@types/jsonpath": "^0.2.4",
@@ -67,6 +68,7 @@
67
68
  "eslint-plugin-import": "^2.28.1",
68
69
  "eslint-plugin-n": "^15.6.1",
69
70
  "eslint-plugin-promise": "^6.1.1",
71
+ "faker": "^6.6.6",
70
72
  "husky": "^9.1.7",
71
73
  "jest": "29.7.0",
72
74
  "jest-fetch-mock": "^3.0.3",
@@ -1,41 +0,0 @@
1
- export declare const appointmentsMock: {
2
- id: number;
3
- scheduled_date: string;
4
- duration: number;
5
- billing_details: null;
6
- payment: null;
7
- time_slot_type: string;
8
- time_slot_status: null;
9
- reason: string;
10
- mode: string;
11
- description: string;
12
- status: {
13
- status: string;
14
- room: null;
15
- status_date: string;
16
- status_detail: null;
17
- };
18
- patient: number;
19
- patient_forms: {
20
- patient_can_receive_forms: boolean;
21
- anonymous_url: string;
22
- overrides: never[];
23
- short_code: null;
24
- statuses: {
25
- id: number;
26
- name: string;
27
- status: string;
28
- }[];
29
- hours_prior: number;
30
- };
31
- physician: number;
32
- practice: number;
33
- instructions: string;
34
- recurring_event_schedule: null;
35
- metadata: null;
36
- created_date: string;
37
- last_modified_date: string;
38
- deleted_date: null;
39
- service_location: null;
40
- telehealth_details: string;
41
- }[];
@@ -1,93 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.appointmentsMock = void 0;
4
- const date_fns_1 = require("date-fns");
5
- exports.appointmentsMock = [
6
- {
7
- id: 123,
8
- scheduled_date: (0, date_fns_1.addHours)(new Date(), 12).toISOString(),
9
- duration: 60,
10
- billing_details: null,
11
- payment: null,
12
- time_slot_type: 'appointment',
13
- time_slot_status: null,
14
- reason: 'PCP: Est. Patient Office',
15
- mode: 'VIDEO',
16
- description: '',
17
- status: {
18
- status: 'Scheduled',
19
- room: null,
20
- status_date: '2023-07-12T20:44:22Z',
21
- status_detail: null,
22
- },
23
- patient: 12345,
24
- patient_forms: {
25
- patient_can_receive_forms: true,
26
- anonymous_url: 'https://sandbox.elationemr.com/appointments/141701667029082/patient-forms/?key=642301d3930ac1e4d052ff65c093c5f1da1697e6b861a18f43a042b5afca50a1',
27
- overrides: [],
28
- short_code: null,
29
- statuses: [
30
- {
31
- id: 316,
32
- name: 'COVID-19 Screening Form',
33
- status: 'incomplete',
34
- },
35
- ],
36
- hours_prior: 0,
37
- },
38
- physician: 141114870071298,
39
- practice: 141114865745924,
40
- instructions: '',
41
- recurring_event_schedule: null,
42
- metadata: null,
43
- created_date: '2023-07-12T20:44:22Z',
44
- last_modified_date: '2023-07-12T20:44:22Z',
45
- deleted_date: null,
46
- service_location: null,
47
- telehealth_details: '',
48
- },
49
- {
50
- id: 456,
51
- scheduled_date: (0, date_fns_1.addHours)(new Date(), 25).toISOString(),
52
- duration: 60,
53
- billing_details: null,
54
- payment: null,
55
- time_slot_type: 'appointment',
56
- time_slot_status: null,
57
- reason: 'PCP: Est. Patient Office',
58
- mode: 'VIDEO',
59
- description: '',
60
- status: {
61
- status: 'Scheduled',
62
- room: null,
63
- status_date: '2023-07-12T20:44:22Z',
64
- status_detail: null,
65
- },
66
- patient: 12345,
67
- patient_forms: {
68
- patient_can_receive_forms: true,
69
- anonymous_url: 'https://sandbox.elationemr.com/appointments/141701667029082/patient-forms/?key=642301d3930ac1e4d052ff65c093c5f1da1697e6b861a18f43a042b5afca50a1',
70
- overrides: [],
71
- short_code: null,
72
- statuses: [
73
- {
74
- id: 316,
75
- name: 'COVID-19 Screening Form',
76
- status: 'incomplete',
77
- },
78
- ],
79
- hours_prior: 0,
80
- },
81
- physician: 141114870071298,
82
- practice: 141114865745924,
83
- instructions: '',
84
- recurring_event_schedule: null,
85
- metadata: null,
86
- created_date: '2023-07-12T20:44:22Z',
87
- last_modified_date: '2023-07-12T20:44:22Z',
88
- deleted_date: null,
89
- service_location: null,
90
- telehealth_details: '',
91
- },
92
- ];
93
- //# sourceMappingURL=GetAppointments.mock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GetAppointments.mock.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsWithAI/__testdata__/GetAppointments.mock.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AAEtB,QAAA,gBAAgB,GAAG;IAC9B;QACE,EAAE,EAAE,GAAG;QACP,cAAc,EAAE,IAAA,mBAAQ,EAAC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE;QACtD,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,aAA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f;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":"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"}