@awell-health/awell-extensions 2.0.181 → 2.0.183

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 (75) hide show
  1. package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/__testdata__/GetAppointments.mock.js +2 -2
  2. package/dist/extensions/elation/actions/findAppointmentsWithAI/__testdata__/GetAppointments.mock.js.map +1 -0
  3. package/dist/extensions/elation/actions/findAppointmentsWithAI/config/dataPoints.js.map +1 -0
  4. package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/config/fields.js +2 -2
  5. package/dist/extensions/elation/actions/findAppointmentsWithAI/config/fields.js.map +1 -0
  6. package/dist/extensions/elation/actions/findAppointmentsWithAI/config/index.js.map +1 -0
  7. package/dist/extensions/elation/actions/{findAppointmentsByPrompt/findAppointmentsByPrompt.d.ts → findAppointmentsWithAI/findAppointmentsWithAI.d.ts} +1 -1
  8. package/dist/extensions/elation/actions/{findAppointmentsByPrompt/findAppointmentsByPrompt.js → findAppointmentsWithAI/findAppointmentsWithAI.js} +15 -8
  9. package/dist/extensions/elation/actions/findAppointmentsWithAI/findAppointmentsWithAI.js.map +1 -0
  10. package/dist/extensions/elation/actions/findAppointmentsWithAI/getAppoitnmentCountByStatus.js.map +1 -0
  11. package/dist/extensions/elation/actions/findAppointmentsWithAI/index.d.ts +1 -0
  12. package/dist/extensions/elation/actions/findAppointmentsWithAI/index.js +6 -0
  13. package/dist/extensions/elation/actions/findAppointmentsWithAI/index.js.map +1 -0
  14. package/dist/extensions/elation/actions/findFutureAppointment/__testdata__/GetAppointments.mock.js +44 -1
  15. package/dist/extensions/elation/actions/findFutureAppointment/__testdata__/GetAppointments.mock.js.map +1 -1
  16. package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.js +33 -13
  17. package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.js.map +1 -1
  18. package/dist/extensions/elation/actions/findFutureAppointment/{getFutureAppoitnments.js → getFutureAppointments.js} +1 -1
  19. package/dist/extensions/elation/actions/findFutureAppointment/{getFutureAppoitnments.js.map → getFutureAppointments.js.map} +1 -1
  20. package/dist/extensions/elation/actions/index.d.ts +1 -1
  21. package/dist/extensions/elation/actions/index.js +2 -2
  22. package/dist/extensions/elation/actions/index.js.map +1 -1
  23. package/dist/extensions/elation/actions/updatePatientTags/updatePatientTags.js +1 -1
  24. package/dist/extensions/elation/actions/updatePatientTags/updatePatientTags.js.map +1 -1
  25. package/dist/extensions/elation/lib/findAppointmentsWithLLM/FindAppointmentsWithLLM.evaluate.d.ts +1 -0
  26. package/dist/extensions/elation/lib/findAppointmentsWithLLM/FindAppointmentsWithLLM.evaluate.js +152 -0
  27. package/dist/extensions/elation/lib/findAppointmentsWithLLM/FindAppointmentsWithLLM.evaluate.js.map +1 -0
  28. package/dist/extensions/elation/lib/findAppointmentsWithLLM/findAppointmentsWithLLM.d.ts +14 -0
  29. package/dist/extensions/elation/lib/findAppointmentsWithLLM/findAppointmentsWithLLM.js +29 -0
  30. package/dist/extensions/elation/lib/findAppointmentsWithLLM/findAppointmentsWithLLM.js.map +1 -0
  31. package/dist/extensions/elation/{actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM → lib/findAppointmentsWithLLM}/parser.d.ts +1 -1
  32. package/dist/extensions/elation/{actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM → lib/findAppointmentsWithLLM}/parser.js +1 -3
  33. package/dist/extensions/elation/lib/findAppointmentsWithLLM/parser.js.map +1 -0
  34. package/dist/extensions/elation/lib/findAppointmentsWithLLM/prompt.d.ts +2 -0
  35. package/dist/extensions/elation/lib/findAppointmentsWithLLM/prompt.js +66 -0
  36. package/dist/extensions/elation/lib/findAppointmentsWithLLM/prompt.js.map +1 -0
  37. package/dist/extensions/markdown.json +1 -1
  38. package/package.json +1 -1
  39. package/dist/extensions/elation/actions/findAppointmentsByPrompt/__testdata__/GetAppointments.mock.js.map +0 -1
  40. package/dist/extensions/elation/actions/findAppointmentsByPrompt/config/dataPoints.js.map +0 -1
  41. package/dist/extensions/elation/actions/findAppointmentsByPrompt/config/fields.js.map +0 -1
  42. package/dist/extensions/elation/actions/findAppointmentsByPrompt/config/index.js.map +0 -1
  43. package/dist/extensions/elation/actions/findAppointmentsByPrompt/findAppointmentsByPrompt.js.map +0 -1
  44. package/dist/extensions/elation/actions/findAppointmentsByPrompt/getAppoitnmentCountByStatus.js.map +0 -1
  45. package/dist/extensions/elation/actions/findAppointmentsByPrompt/index.d.ts +0 -1
  46. package/dist/extensions/elation/actions/findAppointmentsByPrompt/index.js +0 -6
  47. package/dist/extensions/elation/actions/findAppointmentsByPrompt/index.js.map +0 -1
  48. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.d.ts +0 -14
  49. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.js +0 -36
  50. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.js.map +0 -1
  51. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/parser.js.map +0 -1
  52. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.d.ts +0 -2
  53. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.js +0 -24
  54. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.js.map +0 -1
  55. package/dist/extensions/elation/actions/findFutureAppointment/formatAppointments.d.ts +0 -2
  56. package/dist/extensions/elation/actions/findFutureAppointment/formatAppointments.js +0 -18
  57. package/dist/extensions/elation/actions/findFutureAppointment/formatAppointments.js.map +0 -1
  58. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.d.ts +0 -14
  59. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.js +0 -29
  60. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.js.map +0 -1
  61. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.d.ts +0 -17
  62. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.js +0 -16
  63. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.js.map +0 -1
  64. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.d.ts +0 -2
  65. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.js +0 -20
  66. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.js.map +0 -1
  67. /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/__testdata__/GetAppointments.mock.d.ts +0 -0
  68. /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/config/dataPoints.d.ts +0 -0
  69. /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/config/dataPoints.js +0 -0
  70. /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/config/fields.d.ts +0 -0
  71. /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/config/index.d.ts +0 -0
  72. /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/config/index.js +0 -0
  73. /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/getAppoitnmentCountByStatus.d.ts +0 -0
  74. /package/dist/extensions/elation/actions/{findAppointmentsByPrompt → findAppointmentsWithAI}/getAppoitnmentCountByStatus.js +0 -0
  75. /package/dist/extensions/elation/actions/findFutureAppointment/{getFutureAppoitnments.d.ts → getFutureAppointments.d.ts} +0 -0
@@ -5,7 +5,7 @@ const date_fns_1 = require("date-fns");
5
5
  exports.appointmentsMock = [
6
6
  {
7
7
  id: 123,
8
- scheduled_date: (0, date_fns_1.addDays)(new Date(), 1).toISOString(),
8
+ scheduled_date: (0, date_fns_1.addHours)(new Date(), 12).toISOString(),
9
9
  duration: 60,
10
10
  billing_details: null,
11
11
  payment: null,
@@ -48,7 +48,7 @@ exports.appointmentsMock = [
48
48
  },
49
49
  {
50
50
  id: 456,
51
- scheduled_date: (0, date_fns_1.addDays)(new Date(), 2).toISOString(),
51
+ scheduled_date: (0, date_fns_1.addHours)(new Date(), 25).toISOString(),
52
52
  duration: 60,
53
53
  billing_details: null,
54
54
  payment: null,
@@ -0,0 +1 @@
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,aAAa,EAAE;YACb,yBAAyB,EAAE,IAAI;YAC/B,aAAa,EACX,iJAAiJ;YACnJ,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,IAAI;YAChB,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,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 what appointments you would like to find',
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 findAppointmentsByPrompt: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
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.findAppointmentsByPrompt = void 0;
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 findAppointmentsByPromptWithLLM_1 = require("./lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM");
12
- exports.findAppointmentsByPrompt = {
13
- key: 'findAppointmentsByPrompt',
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: '🪄 Find Appointments by Prompt (Beta)',
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
- const { appointmentIds, explanation } = await (0, findAppointmentsByPromptWithLLM_1.findAppointmentsByPromptWithLLM)({
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=findAppointmentsByPrompt.js.map
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,OAA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D,MAAM,EAAE;oBACN,IAAA,iCAAmB,EAAC;wBAClB,OAAO,EAAE,SAAS,oBAAoB,CAAC,MAAM,6BAA6B,SAAS,EAAE;qBACtF,CAAC;iBACH;aACF,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"}
@@ -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"}
@@ -48,7 +48,50 @@ exports.appointmentsMock = [
48
48
  },
49
49
  {
50
50
  id: 456,
51
- scheduled_date: (0, date_fns_1.addDays)(new Date(), 2).toISOString(),
51
+ scheduled_date: (0, date_fns_1.addDays)(new Date(), 3).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
+ id: 789,
94
+ scheduled_date: (0, date_fns_1.addHours)(new Date(), 1).toISOString(),
52
95
  duration: 60,
53
96
  billing_details: null,
54
97
  payment: null,
@@ -1 +1 @@
1
- {"version":3,"file":"GetAppointments.mock.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findFutureAppointment/__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,wB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AE,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"}
@@ -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 getFutureAppoitnments_1 = require("./getFutureAppoitnments");
9
- const parser_1 = require("./lib/findAppointmentWithLLM/parser");
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: '🪄 Find future appointment (Beta)',
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, getFutureAppoitnments_1.getFutureAppointments)(payload.settings, patientId);
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 appointment
44
- const { appointmentId, explanation } = await (0, findAppointmentWithLLM_1.findAppointmentWithLLM)({
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 matchedAppointmentId = parser_1.AppointmentIdSchema.parse(appointmentId);
52
- const foundAppointment = appointments.find((appointment) => appointment.id === Number(matchedAppointmentId));
53
- // 5. Complete action with results
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: ${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,gEAAyE;AACzE,gGAA4F;AAC5F,wFAAoF;AACpF,wEAAwE;AAE3D,QAAA,qBAAqB,GAI9B;IACF,GAAG,EAAE,uBAAuB;IAC5B,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,mCAAmC;IAC1C,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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,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,WAAW,EAAE;iBAC7B,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,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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BAAgB,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=getFutureAppoitnments.js.map
15
+ //# sourceMappingURL=getFutureAppointments.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFutureAppoitnments.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findFutureAppointment/getFutureAppoitnments.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"}
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
- findAppointmentsByPrompt: import("@awell-health/extensions-core").Action<{
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 findAppointmentsByPrompt_1 = require("./findAppointmentsByPrompt");
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
- findAppointmentsByPrompt: findAppointmentsByPrompt_1.findAppointmentsByPrompt,
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,mEAA+D;AAC/D,yEAAqE;AACrE,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,wBAAwB,EAAxB,mDAAwB;IACxB,gBAAgB,EAAhB,mCAAgB;IAChB,6BAA6B,EAA7B,6DAA6B;CAC9B,CAAA"}
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: '🪄 Update patient tags',
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,wBAAwB;IAC/B,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"}
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,UAA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AAC,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"}
@@ -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
@@ -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,iBAAiB,GAAG,KAAK,IAAwB,EAAE;IACvD,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC;YAC1C,WAAW;YACX,MAAM,EAAE,CAAC,MAAM,CAAC;SACjB,CAAC,CAAA;QACF,MAAM,QAAQ,GAAc,EAAE,CAAA;QAC9B,IAAI,KAAK,EAAE,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;YACzC,IAAI,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBACtD,sBAAsB;gBACtB,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YACxB,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC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BAAgB,EAAE,oCAAoC;YACtD,cAAc,EAAE,EAAE;SACnB,CAAC,CAAA;QAEF,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,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,CAAA;AAED,yBAAyB;AACzB,KAAK,aAAa,EAAE,CAAA"}
@@ -0,0 +1,14 @@
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 {};
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findAppointmentsWithLLM = void 0;
4
+ const prompt_1 = require("./prompt");
5
+ const parser_1 = require("./parser");
6
+ const findAppointmentsWithLLM = async ({ model, appointments, prompt, metadata, callbacks, }) => {
7
+ const chain = model.pipe(parser_1.parser);
8
+ try {
9
+ const formattedAppointments = JSON.stringify(appointments);
10
+ const result = await chain.invoke(await prompt_1.systemPrompt.format({
11
+ currentDateTime: new Date().toISOString(),
12
+ appointments: formattedAppointments,
13
+ prompt,
14
+ }), {
15
+ metadata,
16
+ runName: 'ElationFindAppointmentsWithLLM',
17
+ callbacks
18
+ });
19
+ return {
20
+ appointmentIds: result.appointmentIds,
21
+ explanation: result.explanation
22
+ };
23
+ }
24
+ catch (error) {
25
+ throw new Error('Failed to find matching appointments.');
26
+ }
27
+ };
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,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"}