@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
@@ -11,7 +11,7 @@ export declare const parser: StructuredOutputParser<z.ZodObject<{
11
11
  explanation: string;
12
12
  appointmentIds: number[];
13
13
  }>>;
14
- export interface AppointmentsFromAI {
14
+ export interface AppointmentsFromLLM {
15
15
  appointmentIds: number[];
16
16
  explanation: string;
17
17
  }
@@ -3,12 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parser = exports.AppointmentsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const output_parsers_1 = require("@langchain/core/output_parsers");
6
- exports.AppointmentsSchema = zod_1.z.array(zod_1.z.coerce.number())
7
- .describe('Array of appointment IDs that match the criteria');
6
+ exports.AppointmentsSchema = zod_1.z.array(zod_1.z.coerce.number());
8
7
  exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(zod_1.z.object({
9
8
  appointmentIds: exports.AppointmentsSchema,
10
9
  explanation: zod_1.z
11
10
  .string()
12
- .describe('A readable explanation of how the appointments were found and why'),
13
11
  }));
14
12
  //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/findAppointmentsWithLLM/parser.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mEAAuE;AAE1D,QAAA,kBAAkB,GAAG,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;AAE/C,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,OAAC,CAAC,MAAM,CAAC;IACP,cAAc,EAAE,0BAAkB;IAClC,WAAW,EAAE,OAAC;SACX,MAAM,EAAE;CACZ,CAAC,CACH,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { ChatPromptTemplate } from '@langchain/core/prompts';
2
+ export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\nYou are a **thorough and precise** medical assistant.\nYou will receive:\n1. A list (array) of **appointments** for a single patient (in JSON format).\n2. A set of **instructions** (written by a clinician, for a clinician) specifying which types of appointments to find.\n\n---\n### **Your Task**\nYour goal is to carefully analyze the provided instructions and the list of appointments to **identify only those that match the instructions**.\n\n- You must be **thorough** in your search but only return results when you are **certain** that they match.\n- If multiple appointments match, return **all** their IDs.\n- If no appointments match, return an empty array—this is a valid outcome.\n- Be **meticulous when evaluating time-based criteria**, ensuring all matches are **precise** relative to ${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>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.systemPrompt = void 0;
4
+ const prompts_1 = require("@langchain/core/prompts");
5
+ exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
6
+ You are a **thorough and precise** medical assistant.
7
+ You will receive:
8
+ 1. A list (array) of **appointments** for a single patient (in JSON format).
9
+ 2. A set of **instructions** (written by a clinician, for a clinician) specifying which types of appointments to find.
10
+
11
+ ---
12
+ ### **Your Task**
13
+ Your goal is to carefully analyze the provided instructions and the list of appointments to **identify only those that match the instructions**.
14
+
15
+ - You must be **thorough** in your search but only return results when you are **certain** that they match.
16
+ - If multiple appointments match, return **all** their IDs.
17
+ - If no appointments match, return an empty array—this is a valid outcome.
18
+ - Be **meticulous when evaluating time-based criteria**, ensuring all matches are **precise** relative to \${currentDateTime}.
19
+
20
+ ---
21
+ ### **Important Instructions**
22
+ - **Interpret clinically**: Instructions are written by a clinician for a clinician. Understand medical terminology correctly.
23
+ - Example: "Rx" relates to prescription or medication follow-up, "PT" refers to physical therapy, "f/u" means follow-up. 2x/wk means 2 times a week while 2:1 means two patients per one clinician.
24
+ - **Only return matches when you are certain**:
25
+ - Use your expertise for matching but do not assume connections—appointments must explicitly fit the given instructions.
26
+ - If an instruction is vague or ambiguous, only match appointments if the data supports it directly.
27
+ - **Evaluate time constraints precisely**:
28
+ - If the instruction mentions "past" appointments, **only include** those scheduled **before** \${currentDateTime}.
29
+ - If "future" appointments are requested, **only include** those scheduled **after** \${currentDateTime}.
30
+ - If an exact date is specified, match it **precisely**.
31
+ - For relative time windows (e.g., “within the next 12 hours”):
32
+ - Calculate the exact time difference between an appointment's scheduled date/time and \${currentDateTime}.
33
+ - 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.
34
+ - It is critical to ensure the accuracy of your time comparison. Double check your calculation and reasoning.
35
+ - **Only include appointment IDs that exist in the provided input array**.
36
+ - **Do not fabricate matches**—returning an empty array is preferable to an incorrect match.
37
+
38
+
39
+ ----------
40
+ Patient Appointments:
41
+ \${appointments}
42
+ ----------
43
+ Instructions:
44
+ \${prompt}
45
+
46
+ Your output must be a valid JSON object with the following fields:
47
+
48
+ - appointmentIds: An array containing the IDs of appointments that match the given criteria. If no appointments meet the criteria, this array must be empty.
49
+ - explanation: A concise, human-readable explanation that clearly describes:
50
+ - How and why the selected appointments match the input criteria.
51
+ - Why any appointments were excluded, if relevant.
52
+ - Any edge cases or specific reasoning behind your selection.
53
+
54
+ ## Critical Requirements
55
+ ### Ensure that the explanation strictly matches the appointmentIds:
56
+ - If appointmentIds contains **selected appointments**, the explanation must accurately describe **why they were chosen**.
57
+ - If appointmentIds is **empty**, the explanation must clearly state **why no matches were found**.
58
+
59
+ ### Be thorough and precise:
60
+ - Carefully **analyze all appointments** before making a decision.
61
+ - **Double-check** your reasoning to confirm that **only valid matches** are included.
62
+ - Ensure that no appointments that **do not meet the criteria** are selected.
63
+ - **Maintain strict consistency** between appointmentIds and explanation.
64
+ - **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.
65
+ `);
66
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/findAppointmentsWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4D3D,CAAC,CAAA"}
@@ -56,7 +56,7 @@
56
56
  "changelog": "# Dropbox Sign changelog"
57
57
  },
58
58
  "elation": {
59
- "readme": "---\ntitle: Elation\ndescription: Elation is a cloud-based health record system designed for healthcare providers, clinics, and medical practices.\n---\n# Elation\n\nElation is a cloud-based health record system designed for healthcare providers, clinics, and medical practices. It offers a range of features including patient scheduling, charting, e-prescribing, billing, and telemedicine. Overall, Elation is designed to streamline the workflow of medical practices, improve patient care, and increase efficiency.\n\n## Setup\n\n### Webhooks\n\nThe integration of webhooks with Elation presents unique challenges and considerations:\n\n- **Non-Discriminative Triggers**: Elation does not differentiate between the creation or update of a resource. Both actions will set off webhook with action `saved`, which might not provide enough discriminative information for some use cases.\n- **Programmatic Setup**: Elation webhooks can only be configured programmatically, as there's no dedicated user interface in Elation to set up webhooks. View [this demo video](https://youtu.be/v8u6E8MEI8E) for a step-by-step guide on how to set up your webhooks in Elation.\n- **Limitation on user-triggered actions**: Elation has a concept called \"Preventing echo\". This means that that any action carried out by the user affiliated with the API credentials that created the subscription doesn't trigger a webhook. You can read more about this behaviour [here](https://docs.elationhealth.com/reference/webhooks). If you are not receiving any webhooks from Elation after setting up your subscription, then this is the reason. A feasible workaround to the above limitation is creating a dedicated user not meant for human interactions but serves the sole purpose of facilitating M2M communication.\n\nIf you need help setting up your webhooks in Elation, reach out! We are happy to help you.\n\n### Extension settings\n\nIn order to use this extension you will need to provide the extension with the following settings:\n\n- Base URL / endpoint URL of the API\n- Authorization URL\n- Client ID for OAuth2 Password authentication\n- Client Secret for OAuth2 Password authentication\n- API Username for OAuth2 Password authentication\n- API Password for OAuth2 Password authentication\n\nNot sure where you can find all of this information? Click [here](https://docs.elationhealth.com/reference/introduction) to have a look at Elation's Developer documentation.\n\n## Actions\n\nThe following actions are supported with Elation today:\n\n### Create Patient\n\nThis action creates a patient in Elation.\n\n**When creating a patient, you will have to specifiy the primary physician and caregiver practice ID:**\n- Primary physician ID: you can retrieve this ID by using the [Find Physicians](https://docs.elationhealth.com/reference/find-physicians) API call, or by using the `Find Physician` action\n- Caregiver Practice ID: similar to the primary physician ID, you can find this ID by using the same API call or action\n\n### Get Patient\n\nUsing a patient identifier, retrieve a patient object from Elation. \n\nNote that when retrieve the mobile phone number, we are tranforming the number to an international format. We apply a heuristic and assume all mobile numbers in Elation are in US national format so we prepend the number with the +1 country code. Having the number in international format unlocks more powerful functionality like sending text messages with 3rd party services like Twilio and MessageBird.\n\n### Update Patient\n\nUpdate a patient in Elation using any fields available in create patient. We use Elation's `PATCH` method to apply partial modifications to a the patient resource (i.e. update only what is needed).\n\n### Create Appointment\n\nEasily create a patient appointment in Elation.\n\nCreating an appointment requires a few strings to be well-formulated:\n- `Scheduled date` must be a datetime string (ISO-8601). For example, January 1, 2023 at noon, Pacific Time (-8 hours) would be shown as such: `2023-01-01T12:00:00.000-08:00`\n- `Reason` must not be free text. This value comes from the following list of appointment types (`Follow-Up`, `Office Visit`, `Physical Exam`, etc.):\n![Appointment types](./assets/elation-appointment-reason.png?raw=true \"Elation Appointment Types\")\n- `Patient` is the patient ID.\n- `Physician` is the physician ID (see `Find Physician`)\n- `Practice` is the practice ID (again, see `Find Physician`)\n\nYou can also include a duration (default to 15 minutes, or whatever has been set in your EHR)\n\n### Get Appointment\n\nRetrieve appointment details using an appointment ID. \n\n### Create Non-Visit Note\n\nThe non-visit note is a special kind of note that, as the name suggests, is not associated with a visit. These notes, in their simplest form, provide a chronological account of information about the patient.\n\n**Additional documentation for some of the action fields:**\n1. Category: The default category is \"Problem\" but you can choose any of \"Past\", \"Family\", \"Social\", \"Instr\", \"PE\", \"ROS\", \"Med\", \"Data\", \"Assessment\", \"Test\", \"Tx\", \"Narrative\", \"Followup\", \"Reason\", \"Plan\", \"Objective\", \"Hpi\", \"Allergies\", \"Habits\", \"Assessplan\", \"Consultant\", \"Attending\", \"Dateprocedure\", \"Surgical\", \"Orders\", \"Referenced\", \"Procedure\".\n2. Chart and document date automatically get set to the current date, i.e. the date when the action is orchestrated.\n\n### Delete Non-Visit Note\n\nDeletes the non-visit note identified by an ID.\n\n### Get Non-Visit Note\n\nRetrieve the details of a non-visit note identified by an ID.\n### Get physician\n\nUsing a physician identifier, retrieve a physician object from Elation.\n\n### Find physicians\n\nSearch a physician based on a set of parameters. The ID of the physician matching the search parameters will be returned. To retrieve the details of the physician, you can use the the \"Get physician\" action.\n\nNote that this action can only support finding one physician so if your search criteria match multiple physicians the action will throw an error.\n\n### 🪄 Find future appointment\n\nTries to find a **single future appointment** for a patient based on a prompt in natural language. These are the steps executed by the action:\n\n1. All future appointments with status `Scheduled` or `Confirmed` for the patient are retrieved from Elation.\n2. Based on the provided prompt, an LLM tries to find a single appointment from the list of future appointments that matches the prompt.\n3. If multiple appointments exist that match the instructions, only the first one is returned.\n\nIf a matching appointment is found, the action returns the full appointment resource and an explanation of why the LLM chose this appointment.\n\n### 🪄 Find appointments by prompt\n\nTries to find **all appointments** for a patient based on a prompt in natural language. These are the steps executed by the action:\n\n1. All appointments, independent their date or status, for the patient are retrieved from Elation.\n2. Based on the provided prompt, an LLM tries to find all appointments from the list appointments that matches the prompt.\n\nThe action returns the full appointment resources of all appointments matching the prompt and an explanation of why the LLM chose these appointments. Additionally, the action returns a count of appointments by status.\n\nExample data points output below.\n\nAppointments (note: only displaying a partial appointment resource)\n```json\n[\n {\n \"id\": 456,\n \"scheduled_date\": \"2023-07-12T20:44:22Z\",\n \"status\": {\n \"status\": \"Scheduled\",\n },\n },\n {\n \"id\": 456,\n \"scheduled_date\": \"2023-08-12T20:44:22Z\",\n \"status\": {\n \"status\": \"Confirmed\",\n },\n }\n]\n```\n\nAppointment counts by status\n```json\n{\n \"Scheduled\": 1,\n \"Confirmed\": 1,\n}\n```",
59
+ "readme": "---\ntitle: Elation\ndescription: Elation is a cloud-based health record system designed for healthcare providers, clinics, and medical practices.\n---\n# Elation\n\nElation is a cloud-based health record system designed for healthcare providers, clinics, and medical practices. It offers a range of features including patient scheduling, charting, e-prescribing, billing, and telemedicine. Overall, Elation is designed to streamline the workflow of medical practices, improve patient care, and increase efficiency.\n\n## Setup\n\n### Webhooks\n\nThe integration of webhooks with Elation presents unique challenges and considerations:\n\n- **Non-Discriminative Triggers**: Elation does not differentiate between the creation or update of a resource. Both actions will set off webhook with action `saved`, which might not provide enough discriminative information for some use cases.\n- **Programmatic Setup**: Elation webhooks can only be configured programmatically, as there's no dedicated user interface in Elation to set up webhooks. View [this demo video](https://youtu.be/v8u6E8MEI8E) for a step-by-step guide on how to set up your webhooks in Elation.\n- **Limitation on user-triggered actions**: Elation has a concept called \"Preventing echo\". This means that that any action carried out by the user affiliated with the API credentials that created the subscription doesn't trigger a webhook. You can read more about this behaviour [here](https://docs.elationhealth.com/reference/webhooks). If you are not receiving any webhooks from Elation after setting up your subscription, then this is the reason. A feasible workaround to the above limitation is creating a dedicated user not meant for human interactions but serves the sole purpose of facilitating M2M communication.\n\nIf you need help setting up your webhooks in Elation, reach out! We are happy to help you.\n\n### Extension settings\n\nIn order to use this extension you will need to provide the extension with the following settings:\n\n- Base URL / endpoint URL of the API\n- Authorization URL\n- Client ID for OAuth2 Password authentication\n- Client Secret for OAuth2 Password authentication\n- API Username for OAuth2 Password authentication\n- API Password for OAuth2 Password authentication\n\nNot sure where you can find all of this information? Click [here](https://docs.elationhealth.com/reference/introduction) to have a look at Elation's Developer documentation.\n\n## Actions\n\nThe following actions are supported with Elation today:\n\n### Create Patient\n\nThis action creates a patient in Elation.\n\n**When creating a patient, you will have to specifiy the primary physician and caregiver practice ID:**\n- Primary physician ID: you can retrieve this ID by using the [Find Physicians](https://docs.elationhealth.com/reference/find-physicians) API call, or by using the `Find Physician` action\n- Caregiver Practice ID: similar to the primary physician ID, you can find this ID by using the same API call or action\n\n### Get Patient\n\nUsing a patient identifier, retrieve a patient object from Elation. \n\nNote that when retrieve the mobile phone number, we are tranforming the number to an international format. We apply a heuristic and assume all mobile numbers in Elation are in US national format so we prepend the number with the +1 country code. Having the number in international format unlocks more powerful functionality like sending text messages with 3rd party services like Twilio and MessageBird.\n\n### Update Patient\n\nUpdate a patient in Elation using any fields available in create patient. We use Elation's `PATCH` method to apply partial modifications to a the patient resource (i.e. update only what is needed).\n\n### Create Appointment\n\nEasily create a patient appointment in Elation.\n\nCreating an appointment requires a few strings to be well-formulated:\n- `Scheduled date` must be a datetime string (ISO-8601). For example, January 1, 2023 at noon, Pacific Time (-8 hours) would be shown as such: `2023-01-01T12:00:00.000-08:00`\n- `Reason` must not be free text. This value comes from the following list of appointment types (`Follow-Up`, `Office Visit`, `Physical Exam`, etc.):\n![Appointment types](./assets/elation-appointment-reason.png?raw=true \"Elation Appointment Types\")\n- `Patient` is the patient ID.\n- `Physician` is the physician ID (see `Find Physician`)\n- `Practice` is the practice ID (again, see `Find Physician`)\n\nYou can also include a duration (default to 15 minutes, or whatever has been set in your EHR)\n\n### Get Appointment\n\nRetrieve appointment details using an appointment ID. \n\n### Create Non-Visit Note\n\nThe non-visit note is a special kind of note that, as the name suggests, is not associated with a visit. These notes, in their simplest form, provide a chronological account of information about the patient.\n\n**Additional documentation for some of the action fields:**\n1. Category: The default category is \"Problem\" but you can choose any of \"Past\", \"Family\", \"Social\", \"Instr\", \"PE\", \"ROS\", \"Med\", \"Data\", \"Assessment\", \"Test\", \"Tx\", \"Narrative\", \"Followup\", \"Reason\", \"Plan\", \"Objective\", \"Hpi\", \"Allergies\", \"Habits\", \"Assessplan\", \"Consultant\", \"Attending\", \"Dateprocedure\", \"Surgical\", \"Orders\", \"Referenced\", \"Procedure\".\n2. Chart and document date automatically get set to the current date, i.e. the date when the action is orchestrated.\n\n### Delete Non-Visit Note\n\nDeletes the non-visit note identified by an ID.\n\n### Get Non-Visit Note\n\nRetrieve the details of a non-visit note identified by an ID.\n### Get physician\n\nUsing a physician identifier, retrieve a physician object from Elation.\n\n### Find physicians\n\nSearch a physician based on a set of parameters. The ID of the physician matching the search parameters will be returned. To retrieve the details of the physician, you can use the the \"Get physician\" action.\n\nNote that this action can only support finding one physician so if your search criteria match multiple physicians the action will throw an error.\n\n### Find Future Appointment\n\nTries to find a **single future appointment** for a patient based on a prompt in natural language. These are the steps executed by the action:\n\n1. All future appointments with status `Scheduled` or `Confirmed` for the patient are retrieved from Elation.\n2. Based on the provided prompt, an LLM tries to find a single appointment from the list of future appointments that matches the prompt.\n3. If multiple appointments exist that match the instructions, only the first one is returned.\n\nIf a matching appointment is found, the action returns the full appointment resource and an explanation of why the LLM chose this appointment.\n\n### Find Appointments\n\nTries to find **all appointments** for a patient based on a prompt in natural language. These are the steps executed by the action:\n\n1. All appointments, independent their date or status, for the patient are retrieved from Elation.\n2. Based on the provided prompt, an LLM tries to find all appointments from the list appointments that matches the prompt.\n\nThe action returns the full appointment resources of all appointments matching the prompt and an explanation of why the LLM chose these appointments. Additionally, the action returns a count of appointments by status.\n\nExample data points output below.\n\nAppointments (note: only displaying a partial appointment resource)```json\n[\n {\n \"id\": 456,\n \"scheduled_date\": \"2023-07-12T20:44:22Z\",\n \"status\": {\n \"status\": \"Scheduled\",\n },\n },\n {\n \"id\": 456,\n \"scheduled_date\": \"2023-08-12T20:44:22Z\",\n \"status\": {\n \"status\": \"Confirmed\",\n },\n }\n]```\n\nAppointment counts by status\n```json\n{\n \"Scheduled\": 1,\n \"Confirmed\": 1,\n}\n```\n\n### ✨ Update Patient Tags\n\nUses AI to manage patient tags in Elation based on natural language instructions. The action executes the following steps:\n\n1. Retrieves existing patient tags from Elation\n2. Uses an LLM to interpret natural language instructions and determine required tag changes\n3. Updates patient tags in Elation according to the interpreted changes\n\nThe action returns:\n- Complete list of updated tags after changes\n- Detailed explanation of what changes were made and why\n\n**Important Notes:**\n- When adding new tags, specify them in single quotes (e.g., 'Diabetes', 'High-Risk'). Tags must exist in your Elation database\n- Due to Elation API limitations, clearing all tags is implemented by setting a single space tag (' '). This is the recommended workaround from Elation's team\n\n",
60
60
  "changelog": "# Elation Changelog\n\n## January 30, 2024\n\n- New actions\n - Post letter: Using patient and practice identifier, post a new letter to either Provider, Patient or associate it with an existing Referral.\n\n## October 3, 2023\n\n- The README is now more concise with less unneeded detail. A section on the particularities of Elation subscriptions (webhooks) was added.\n- Misc. updates to labels, descriptions, action fields order\n- Action updates\n - Create Non-Visit Note:\n - Simplify the action by removing some optional action fields (we can always expand later)\n - `document_date` and `chart_date` are now automatically set to the date of today so that the corresponding action fields could be removed\n - Create patient\n - `dob` is now a `date` field type (was a string)\n - You can pass a mobile phone number and email when creating a patient\n - Find physician\n - Only returns the physician ID instead of all the details of the physician. To retrieve the details one can use the new `Get physician` action\n - Update patient\n - `dob` is now a `date` field type (was a string)\n - We are now using `PATCH` instead of `PUT` which allows for a partial update, i.e. only update the fields that are needed.\n- New actions\n - Get physician: Using a physician identifier, retrieve a physician object from Elation.\n- Removed actions\n - Update Non-Visit Note\n- Webhooks\n - Fix the type of `patientId` in `patientCreatedOrUpdated` webhook\n - Added `appointmentCreatedOrUpdated` webhook\n\n## September 4, 2023\n\n- rename `onCreatePatient` webhook to `patientCreatedOrUpdated`\n- filter non `saved` actions for this webhook\n\n## August 21, 2023\n\n- make non-visit note text a large input (`StringType.TEXT`)\n\n## May 23, 2024\n\n- add patient_status.status to patient object in getPatient action\n- add status to updatePatient action\n"
61
61
  },
62
62
  "epic": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "2.0.181",
3
+ "version": "2.0.183",
4
4
  "packageManager": "yarn@4.5.3",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"GetAppointments.mock.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsByPrompt/__testdata__/GetAppointments.mock.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAErB,QAAA,gBAAgB,GAAG;IAC9B;QACE,EAAE,EAAE,GAAG;QACP,cAAc,EAAE,IAAA,kBAAO,EAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;QACpD,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,IAAI;QACrB,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,aAAa;QAC7B,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,0BAA0B;QAClC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,EAAE;QACf,MAAM,EAAE;YACN,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,sBAAsB;YACnC,aAAa,EAAE,IAAI;SACpB;QACD,OAAO,EAAE,KAAK;QACd,aAAa,EAAE;YACb,yBAAyB,EAAE,IAAI;YAC/B,aAAa,EACX,iJAAiJ;YACnJ,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE;gBACR;oBACE,EAAE,EAAE,GAAG;oBACP,IAAI,EAAE,yBAAyB;oBAC/B,MAAM,EAAE,YAAY;iBACrB;aACF;YACD,WAAW,EAAE,CAAC;SACf;QACD,SAAS,EAAE,eAAe;QAC1B,QAAQ,EAAE,eAAe;QACzB,YAAY,EAAE,EAAE;QAChB,wBAAwB,EAAE,IAAI;QAC9B,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,sBAAsB;QACpC,kBAAkB,EAAE,sBAAsB;QAC1C,YAAY,EAAE,IAAI;QAClB,gBAAgB,EAAE,IAAI;QACtB,kBAAkB,EAAE,EAAE;KACvB;IACD;QACE,EAAE,EAAE,GAAG;QACP,cAAc,EAAE,IAAA,kBAAO,EAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;QACpD,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,IAAI;QACrB,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,aAAa;QAC7B,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,0BAA0B;QAClC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,EAAE;QACf,MAAM,EAAE;YACN,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,sBAAsB;YACnC,aAAa,EAAE,IAAI;SACpB;QACD,OAAO,EAAE,KAAK;QACd,aAAa,EAAE;YACb,yBAAyB,EAAE,IAAI;YAC/B,aAAa,EACX,iJAAiJ;YACnJ,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE;gBACR;oBACE,EAAE,EAAE,GAAG;oBACP,IAAI,EAAE,yBAAyB;oBAC/B,MAAM,EAAE,YAAY;iBACrB;aACF;YACD,WAAW,EAAE,CAAC;SACf;QACD,SAAS,EAAE,eAAe;QAC1B,QAAQ,EAAE,eAAe;QACzB,YAAY,EAAE,EAAE;QAChB,wBAAwB,EAAE,IAAI;QAC9B,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,sBAAsB;QACpC,kBAAkB,EAAE,sBAAsB;QAC1C,YAAY,EAAE,IAAI;QAClB,gBAAgB,EAAE,IAAI;QACtB,kBAAkB,EAAE,EAAE;KACvB;CACF,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsByPrompt/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,YAAY,EAAE;QACZ,GAAG,EAAE,cAAc;QACnB,SAAS,EAAE,MAAM;KAClB;IACD,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,QAAQ;KACpB;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,2BAA2B;QAChC,SAAS,EAAE,MAAM;KAClB;CAC4C,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsByPrompt/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAIsC;AAEzB,QAAA,MAAM,GAAG;IACpB,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,EAAE;KAChB;IACD,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,mDAAmD;QAC1D,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,EAAE;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,iCAAe;IAC1B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACwB,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findAppointmentsByPrompt/config/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,mCAAyD;AAAhD,gGAAA,MAAM,OAAA;AAAE,gHAAA,sBAAsB,OAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"findAppointmentsByPrompt.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findAppointmentsByPrompt/findAppointmentsByPrompt.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,mEAAqE;AACrE,uEAA2E;AAE3E,yCAA4C;AAC5C,wFAAoF;AACpF,qCAAqE;AACrE,+EAA4E;AAC5E,2HAAuH;AAE1G,QAAA,wBAAwB,GAIjC;IACF,GAAG,EAAE,0BAA0B;IAC/B,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,uCAAuC;IAC9C,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,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,gBAAgB,CAAC;YAC9C,OAAO,EAAE,SAAS;SACnB,CAAC,CAAA;QAEF,IAAI,IAAA,cAAK,EAAC,YAAY,CAAC,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrD,MAAM,UAAU,CAAC;gBACf,WAAW,EAAE;oBACX,WAAW,EAAE,uBAAuB;oBACpC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;oBAChC,yBAAyB,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;iBAC9C;aACF,CAAC,CAAA;YACF,OAAM;QACR,CAAC;QAED,IAAI,CAAC;YACH,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,qCAAiB,EAAC;gBAC7D,QAAQ,EAAE,EAAE,EAAE,qCAAqC;gBACnD,OAAO;gBACP,OAAO;aACR,CAAC,CAAA;YAEF,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,GACnC,MAAM,IAAA,iEAA+B,EAAC;gBACpC,KAAK;gBACL,YAAY;gBACZ,MAAM;gBACN,QAAQ;gBACR,SAAS;aACV,CAAC,CAAA;YAEJ,MAAM,oBAAoB,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAC/D,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CACxC,CAAA;YAED,MAAM,yBAAyB,GAC7B,IAAA,0DAA4B,EAAC,oBAAoB,CAAC,CAAA;YAEpD,MAAM,UAAU,CAAC;gBACf,WAAW,EAAE;oBACX,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;oBAClD,WAAW;oBACX,yBAAyB,EAAE,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC;iBACrE;gBACD,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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getAppoitnmentCountByStatus.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findAppointmentsByPrompt/getAppoitnmentCountByStatus.ts"],"names":[],"mappings":";;;AAGA,sEAA6D;AAEtD,MAAM,4BAA4B,GAAG,CACxC,YAAmC,EACX,EAAE;IAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,4BAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACrF,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAC7B,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,CAAC,MAAM,MAAK,MAAM,CACvD,CAAC,MAAM,CAAA;QACR,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;YACZ,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,CAAA;QACnB,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC,CAAA;AAZU,QAAA,4BAA4B,gCAYtC"}
@@ -1 +0,0 @@
1
- export { findAppointmentsByPrompt } from './findAppointmentsByPrompt';
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findAppointmentsByPrompt = void 0;
4
- var findAppointmentsByPrompt_1 = require("./findAppointmentsByPrompt");
5
- Object.defineProperty(exports, "findAppointmentsByPrompt", { enumerable: true, get: function () { return findAppointmentsByPrompt_1.findAppointmentsByPrompt; } });
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findAppointmentsByPrompt/index.ts"],"names":[],"mappings":";;;AAAA,uEAAqE;AAA5D,oIAAA,wBAAwB,OAAA"}
@@ -1,14 +0,0 @@
1
- import { type ChatOpenAI } from '@langchain/openai';
2
- import { type AIActionMetadata } from '../../../../../../src/lib/llm/openai/types';
3
- import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
4
- import { type AppointmentsFromAI } from './parser';
5
- import { type AppointmentResponse } from '../../../../types';
6
- interface FindAppointmentsByPromptWithLLMProps {
7
- model: ChatOpenAI;
8
- appointments: AppointmentResponse[];
9
- prompt: string;
10
- metadata: AIActionMetadata;
11
- callbacks?: BaseCallbackHandler[];
12
- }
13
- export declare const findAppointmentsByPromptWithLLM: ({ model, appointments, prompt, metadata, callbacks, }: FindAppointmentsByPromptWithLLMProps) => Promise<AppointmentsFromAI>;
14
- export {};
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findAppointmentsByPromptWithLLM = void 0;
4
- const prompt_1 = require("./prompt");
5
- const parser_1 = require("./parser");
6
- const findAppointmentsByPromptWithLLM = async ({ model, appointments, prompt, metadata, callbacks, }) => {
7
- const chain = model.pipe(parser_1.parser);
8
- try {
9
- const formattedAppointments = appointments
10
- .map((appointment) => ({
11
- id: appointment.id,
12
- reason: appointment.reason,
13
- scheduled_date: appointment.scheduled_date,
14
- }))
15
- .map((appointment) => JSON.stringify(appointment))
16
- .join('\n\n');
17
- const result = await chain.invoke(await prompt_1.systemPrompt.format({
18
- currentDate: new Date().toISOString().split('T')[0],
19
- appointments: formattedAppointments,
20
- prompt,
21
- }), {
22
- metadata,
23
- runName: 'ElationFindAppointmentsByPrompt',
24
- callbacks
25
- });
26
- return {
27
- appointmentIds: result.appointmentIds,
28
- explanation: result.explanation
29
- };
30
- }
31
- catch (error) {
32
- throw new Error('Failed to find matching appointments.');
33
- }
34
- };
35
- exports.findAppointmentsByPromptWithLLM = findAppointmentsByPromptWithLLM;
36
- //# sourceMappingURL=findAppointmentsByPromptWithLLM.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"findAppointmentsByPromptWithLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.ts"],"names":[],"mappings":";;;AAGA,qCAAuC;AACvC,qCAA0D;AAWnD,MAAM,+BAA+B,GAAG,KAAK,EAAE,EACpD,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,SAAS,GAC4B,EAA+B,EAAE;IACtE,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,CAAA;IAEhC,IAAI,CAAC;QACH,MAAM,qBAAqB,GAAG,YAAY;aACvC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YACrB,EAAE,EAAE,WAAW,CAAC,EAAE;YAClB,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,cAAc,EAAE,WAAW,CAAC,cAAc;SAC3C,CAAC,CAAC;aACF,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;aACjD,IAAI,CAAC,MAAM,CAAC,CAAA;QAEf,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAC/B,MAAM,qBAAY,CAAC,MAAM,CAAC;YACxB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACnD,YAAY,EAAE,qBAAqB;YACnC,MAAM;SACP,CAAC,EACF;YACE,QAAQ;YACR,OAAO,EAAE,iCAAiC;YAC1C,SAAS;SACV,CACF,CAAA;QAED,OAAO;YACL,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAC1D,CAAC;AACH,CAAC,CAAA;AAvCY,QAAA,+BAA+B,mCAuC3C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/parser.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mEAAuE;AAE1D,QAAA,kBAAkB,GAAG,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;KACzD,QAAQ,CAAC,kDAAkD,CAAC,CAAA;AAElD,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,OAAC,CAAC,MAAM,CAAC;IACP,cAAc,EAAE,0BAAkB;IAClC,WAAW,EAAE,OAAC;SACX,MAAM,EAAE;SACR,QAAQ,CACP,mEAAmE,CACpE;CACJ,CAAC,CACH,CAAA"}
@@ -1,2 +0,0 @@
1
- import { ChatPromptTemplate } from '@langchain/core/prompts';
2
- export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"You are a helpful medical assistant. You will receive a list (array) of appointments for a single patient and instructions about which types of appointments to find. You're supposed to use the information in the list to find appointments that match, if any exist. If no appointments exists that obviously match the instructions, that's a perfectly acceptable outcome. If multiple appointments exist that match the instructions, you should return all of them.\n \nImportant instructions:\n- The appointment \"reason\" is the appointment type.\n- Only include appointment ids that exist in the input array. If no appointments exist that match the instructions, return an empty array.\n- Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.\n- Think like a clinician. In other words, \"Rx\" should match a prescription appointment or follow-up related to a prescription, and \"PT\" would match physical therapy.\n- The current date is {currentDate}.\n----------\nInput array: \n{appointments}\n----------\nInstruction: \n{prompt}\n----------\n\nOutput a JSON object with the following keys:\n1. appointmentIds: array of numbers representing appointment IDs that match the instructions (or an empty array if no appointments exist that match the instructions).\n2. explanation: A readable explanation of how the appointments were found and why. Or, if no appointments exist that match the instructions, an explanation of why.">, any>;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.systemPrompt = void 0;
4
- const prompts_1 = require("@langchain/core/prompts");
5
- exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`You are a helpful medical assistant. You will receive a list (array) of appointments for a single patient and instructions about which types of appointments to find. You're supposed to use the information in the list to find appointments that match, if any exist. If no appointments exists that obviously match the instructions, that's a perfectly acceptable outcome. If multiple appointments exist that match the instructions, you should return all of them.
6
-
7
- Important instructions:
8
- - The appointment "reason" is the appointment type.
9
- - Only include appointment ids that exist in the input array. If no appointments exist that match the instructions, return an empty array.
10
- - Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.
11
- - Think like a clinician. In other words, "Rx" should match a prescription appointment or follow-up related to a prescription, and "PT" would match physical therapy.
12
- - The current date is {currentDate}.
13
- ----------
14
- Input array:
15
- {appointments}
16
- ----------
17
- Instruction:
18
- {prompt}
19
- ----------
20
-
21
- Output a JSON object with the following keys:
22
- 1. appointmentIds: array of numbers representing appointment IDs that match the instructions (or an empty array if no appointments exist that match the instructions).
23
- 2. explanation: A readable explanation of how the appointments were found and why. Or, if no appointments exist that match the instructions, an explanation of why.`);
24
- //# sourceMappingURL=prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,YAAY,GACvB,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;oKAkBkI,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- import { type AppointmentResponse } from "extensions/elation/types";
2
- export declare const formatAppointments: (appointments: AppointmentResponse[]) => string;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatAppointments = void 0;
4
- const formatAppointments = (appointments) => {
5
- return appointments
6
- .map((appointment) => {
7
- const relevantInfo = {
8
- id: appointment.id,
9
- reason: appointment.reason,
10
- duration: appointment.duration,
11
- scheduled_date: appointment.scheduled_date,
12
- };
13
- return JSON.stringify(relevantInfo);
14
- })
15
- .join('\n\n');
16
- };
17
- exports.formatAppointments = formatAppointments;
18
- //# sourceMappingURL=formatAppointments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatAppointments.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findFutureAppointment/formatAppointments.ts"],"names":[],"mappings":";;;AAEO,MAAM,kBAAkB,GAAG,CAAC,YAAmC,EAAU,EAAE;IAC9E,OAAO,YAAY;SAChB,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;QACnB,MAAM,YAAY,GAAG;YACnB,EAAE,EAAE,WAAW,CAAC,EAAE;YAClB,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,cAAc,EAAE,WAAW,CAAC,cAAc;SAC3C,CAAA;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;IACrC,CAAC,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAA;AACjB,CAAC,CAAA;AAZU,QAAA,kBAAkB,sBAY5B"}
@@ -1,14 +0,0 @@
1
- import { type ChatOpenAI } from '@langchain/openai';
2
- import { type AIActionMetadata } from '../../../../../../src/lib/llm/openai/types';
3
- import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
4
- import { type AppointmentFromAI } from './parser';
5
- import { type AppointmentResponse } from '../../../../types';
6
- interface FindAppointmentWithLLMProps {
7
- model: ChatOpenAI;
8
- appointments: AppointmentResponse[];
9
- prompt: string;
10
- metadata: AIActionMetadata;
11
- callbacks?: BaseCallbackHandler[];
12
- }
13
- export declare const findAppointmentWithLLM: ({ model, appointments, prompt, metadata, callbacks, }: FindAppointmentWithLLMProps) => Promise<AppointmentFromAI>;
14
- export {};
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findAppointmentWithLLM = void 0;
4
- const prompt_1 = require("./prompt");
5
- const parser_1 = require("./parser");
6
- const formatAppointments_1 = require("../../formatAppointments");
7
- const findAppointmentWithLLM = async ({ model, appointments, prompt, metadata, callbacks, }) => {
8
- const chain = model.pipe(parser_1.parser);
9
- try {
10
- const result = await chain.invoke(await prompt_1.systemPrompt.format({
11
- format_instructions: parser_1.parser.getFormatInstructions(),
12
- appointments: (0, formatAppointments_1.formatAppointments)(appointments),
13
- prompt,
14
- }), {
15
- metadata,
16
- runName: 'ElationFindAppointment',
17
- callbacks
18
- });
19
- return {
20
- appointmentId: result.appointmentId,
21
- explanation: result.explanation
22
- };
23
- }
24
- catch (error) {
25
- throw new Error('Failed to find matching appointment.');
26
- }
27
- };
28
- exports.findAppointmentWithLLM = findAppointmentWithLLM;
29
- //# sourceMappingURL=findAppointmentWithLLM.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"findAppointmentWithLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.ts"],"names":[],"mappings":";;;AAGA,qCAAuC;AACvC,qCAAyD;AAEzD,iEAA6D;AAUtD,MAAM,sBAAsB,GAAG,KAAK,EAAE,EAC3C,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,SAAS,GACmB,EAA8B,EAAE;IAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,CAAA;IAEhC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAC/B,MAAM,qBAAY,CAAC,MAAM,CAAC;YACxB,mBAAmB,EAAE,eAAM,CAAC,qBAAqB,EAAE;YACnD,YAAY,EAAE,IAAA,uCAAkB,EAAC,YAAY,CAAC;YAC9C,MAAM;SACP,CAAC,EACF;YACE,QAAQ;YACR,OAAO,EAAE,wBAAwB;YACjC,SAAS;SACV,CACF,CAAA;QAED,OAAO;YACL,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;IACzD,CAAC;AACH,CAAC,CAAA;AA9BY,QAAA,sBAAsB,0BA8BlC"}
@@ -1,17 +0,0 @@
1
- import { z } from 'zod';
2
- import { StructuredOutputParser } from '@langchain/core/output_parsers';
3
- export declare const AppointmentIdSchema: z.ZodNullable<z.ZodNumber>;
4
- export declare const parser: StructuredOutputParser<z.ZodObject<{
5
- appointmentId: z.ZodNullable<z.ZodNumber>;
6
- explanation: z.ZodString;
7
- }, "strip", z.ZodTypeAny, {
8
- appointmentId: number | null;
9
- explanation: string;
10
- }, {
11
- appointmentId: number | null;
12
- explanation: string;
13
- }>>;
14
- export interface AppointmentFromAI {
15
- appointmentId: number | null;
16
- explanation: string;
17
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parser = exports.AppointmentIdSchema = void 0;
4
- const zod_1 = require("zod");
5
- const output_parsers_1 = require("@langchain/core/output_parsers");
6
- exports.AppointmentIdSchema = zod_1.z.coerce
7
- .number()
8
- .nullable()
9
- .describe('A single appointment');
10
- exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(zod_1.z.object({
11
- appointmentId: exports.AppointmentIdSchema,
12
- explanation: zod_1.z
13
- .string()
14
- .describe('A readable explanation of how the appointment was found and why'),
15
- }));
16
- //# sourceMappingURL=parser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mEAAuE;AAE1D,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM;KACxC,MAAM,EAAE;KACR,QAAQ,EAAE;KACV,QAAQ,CAAC,sBAAsB,CAAC,CAAA;AAEtB,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,OAAC,CAAC,MAAM,CAAC;IACP,aAAa,EAAE,2BAAmB;IAClC,WAAW,EAAE,OAAC;SACX,MAAM,EAAE;SACR,QAAQ,CACP,iEAAiE,CAClE;CACJ,CAAC,CACH,CAAA"}
@@ -1,2 +0,0 @@
1
- import { ChatPromptTemplate } from '@langchain/core/prompts';
2
- export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are a helpful medical assistant. You will receive a list (array) of future appointments for a single patient and instructions about which appointment to find. You're supposed to use the information in the list to find an appointment that matches, if one exists.\n \n Important instructions:\n - The appointment \"reason\" is the appointment type.\n - Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.\n - Think like a clinician. In other words, \"Rx\" should match a prescription appointment or follow-up related to a prescription.\n - If no appointment exists that obviously matches the instructions, that's a perfectly acceptable outcome.\n - If multiple appointments exist that match the instructions, you should return the first one.\n - Return your response in the following JSON format:\n {format_instructions}\n\n Input array: {appointments}\n Instruction: {prompt}\n">, any>;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.systemPrompt = void 0;
4
- const prompts_1 = require("@langchain/core/prompts");
5
- exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
6
- You are a helpful medical assistant. You will receive a list (array) of future appointments for a single patient and instructions about which appointment to find. You're supposed to use the information in the list to find an appointment that matches, if one exists.
7
-
8
- Important instructions:
9
- - The appointment "reason" is the appointment type.
10
- - Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.
11
- - Think like a clinician. In other words, "Rx" should match a prescription appointment or follow-up related to a prescription.
12
- - If no appointment exists that obviously matches the instructions, that's a perfectly acceptable outcome.
13
- - If multiple appointments exist that match the instructions, you should return the first one.
14
- - Return your response in the following JSON format:
15
- {format_instructions}
16
-
17
- Input array: {appointments}
18
- Instruction: {prompt}
19
- `);
20
- //# sourceMappingURL=prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;CAc3D,CAAC,CAAA"}