@awell-health/awell-extensions 2.0.197 → 2.0.198

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 (32) hide show
  1. package/dist/extensions/elation/actions/checkPatientTags/checkPatientTags.d.ts +12 -0
  2. package/dist/extensions/elation/actions/checkPatientTags/checkPatientTags.js +63 -0
  3. package/dist/extensions/elation/actions/checkPatientTags/checkPatientTags.js.map +1 -0
  4. package/dist/extensions/elation/actions/checkPatientTags/config/dataPoints.d.ts +10 -0
  5. package/dist/extensions/elation/actions/checkPatientTags/config/dataPoints.js +14 -0
  6. package/dist/extensions/elation/actions/checkPatientTags/config/dataPoints.js.map +1 -0
  7. package/dist/extensions/elation/actions/checkPatientTags/config/fields.d.ts +28 -0
  8. package/dist/extensions/elation/actions/checkPatientTags/config/fields.js +26 -0
  9. package/dist/extensions/elation/actions/checkPatientTags/config/fields.js.map +1 -0
  10. package/dist/extensions/elation/actions/checkPatientTags/config/index.d.ts +2 -0
  11. package/dist/extensions/elation/actions/checkPatientTags/config/index.js +9 -0
  12. package/dist/extensions/elation/actions/checkPatientTags/config/index.js.map +1 -0
  13. package/dist/extensions/elation/actions/checkPatientTags/index.d.ts +1 -0
  14. package/dist/extensions/elation/actions/checkPatientTags/index.js +6 -0
  15. package/dist/extensions/elation/actions/checkPatientTags/index.js.map +1 -0
  16. package/dist/extensions/elation/actions/checkPatientTags/lib/checkTagsWithLLM/checkTagsWithLLM.d.ts +13 -0
  17. package/dist/extensions/elation/actions/checkPatientTags/lib/checkTagsWithLLM/checkTagsWithLLM.js +29 -0
  18. package/dist/extensions/elation/actions/checkPatientTags/lib/checkTagsWithLLM/checkTagsWithLLM.js.map +1 -0
  19. package/dist/extensions/elation/actions/checkPatientTags/lib/checkTagsWithLLM/parser.d.ts +23 -0
  20. package/dist/extensions/elation/actions/checkPatientTags/lib/checkTagsWithLLM/parser.js +11 -0
  21. package/dist/extensions/elation/actions/checkPatientTags/lib/checkTagsWithLLM/parser.js.map +1 -0
  22. package/dist/extensions/elation/actions/checkPatientTags/lib/checkTagsWithLLM/prompt.d.ts +2 -0
  23. package/dist/extensions/elation/actions/checkPatientTags/lib/checkTagsWithLLM/prompt.js +30 -0
  24. package/dist/extensions/elation/actions/checkPatientTags/lib/checkTagsWithLLM/prompt.js.map +1 -0
  25. package/dist/extensions/elation/actions/checkPatientTags/lib/evaluateCheckTags.d.ts +1 -0
  26. package/dist/extensions/elation/actions/checkPatientTags/lib/evaluateCheckTags.js +148 -0
  27. package/dist/extensions/elation/actions/checkPatientTags/lib/evaluateCheckTags.js.map +1 -0
  28. package/dist/extensions/elation/actions/index.d.ts +66 -0
  29. package/dist/extensions/elation/actions/index.js +2 -0
  30. package/dist/extensions/elation/actions/index.js.map +1 -1
  31. package/dist/extensions/markdown.json +1 -1
  32. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ import { type Action } from '@awell-health/extensions-core';
2
+ import { type settings } from '../../settings';
3
+ import { fields, dataPoints } from './config';
4
+ /**
5
+ * Awell Action: Check Patient Tags
6
+ *
7
+ * Takes existing tags and instructions, uses LLM to:
8
+ * 1. Verify if tags match the given instruction
9
+ * 2. Provide explanation for the verification result
10
+ * 3. Return boolean result indicating if tags exist as specified
11
+ */
12
+ export declare const checkPatientTags: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkPatientTags = void 0;
4
+ const extensions_core_1 = require("@awell-health/extensions-core");
5
+ const addEventLog_1 = require("../../../../src/lib/awell/addEventLog");
6
+ const client_1 = require("../../client");
7
+ const config_1 = require("./config");
8
+ const checkTagsWithLLM_1 = require("./lib/checkTagsWithLLM/checkTagsWithLLM");
9
+ const createOpenAIModel_1 = require("../../../../src/lib/llm/openai/createOpenAIModel");
10
+ const constants_1 = require("../../../../src/lib/llm/openai/constants");
11
+ /**
12
+ * Awell Action: Check Patient Tags
13
+ *
14
+ * Takes existing tags and instructions, uses LLM to:
15
+ * 1. Verify if tags match the given instruction
16
+ * 2. Provide explanation for the verification result
17
+ * 3. Return boolean result indicating if tags exist as specified
18
+ */
19
+ exports.checkPatientTags = {
20
+ key: 'checkPatientTags',
21
+ category: extensions_core_1.Category.EHR_INTEGRATIONS,
22
+ title: '✨ Check Patient Tags',
23
+ description: 'Verify if patient tags in Elation match the given instruction.',
24
+ fields: config_1.fields,
25
+ previewable: false,
26
+ dataPoints: config_1.dataPoints,
27
+ onEvent: async ({ payload, onComplete, onError, helpers }) => {
28
+ // 1. Validate input and initialize API client
29
+ const { instructions, patientId } = config_1.FieldsValidationSchema.parse(payload.fields);
30
+ const api = (0, client_1.makeAPIClient)(payload.settings);
31
+ // 2. Get existing tags
32
+ const { tags } = await api.getPatient(patientId);
33
+ const existingTags = tags !== null && tags !== void 0 ? tags : [];
34
+ // 3. Initialize OpenAI model with metadata and callbacks
35
+ const { model, metadata, callbacks } = await (0, createOpenAIModel_1.createOpenAIModel)({
36
+ settings: {}, // we use built-in API key for OpenAI
37
+ helpers,
38
+ payload,
39
+ modelType: constants_1.OPENAI_MODELS.GPT4o,
40
+ });
41
+ // 4. Check tags against instruction
42
+ const { tagsFound, explanation } = await (0, checkTagsWithLLM_1.checkTagsWithLLM)({
43
+ model,
44
+ existingTags,
45
+ instructions,
46
+ metadata,
47
+ callbacks,
48
+ });
49
+ // 5. Complete action with results
50
+ await onComplete({
51
+ data_points: {
52
+ tagsFound: tagsFound ? 'true' : 'false',
53
+ explanation,
54
+ },
55
+ events: [
56
+ (0, addEventLog_1.addActivityEventLog)({
57
+ message: `Patient tags: ${(existingTags === null || existingTags === void 0 ? void 0 : existingTags.length) > 0 ? existingTags === null || existingTags === void 0 ? void 0 : existingTags.join(', ') : 'No tags'}\nInstruction: ${instructions}\nResult: ${tagsFound ? 'true' : 'false'}\nExplanation: ${explanation}`,
58
+ }),
59
+ ],
60
+ });
61
+ },
62
+ };
63
+ //# sourceMappingURL=checkPatientTags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkPatientTags.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/checkPatientTags/checkPatientTags.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,uEAA2E;AAE3E,yCAA4C;AAC5C,qCAAqE;AACrE,8EAA0E;AAC1E,wFAAoF;AACpF,wEAAwE;AAExE;;;;;;;GAOG;AACU,QAAA,gBAAgB,GAIzB;IACF,GAAG,EAAE,kBAAkB;IACvB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,sBAAsB;IAC7B,WAAW,EAAE,gEAAgE;IAC7E,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,oCAAoC;QACpC,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,mCAAgB,EAAC;YACxD,KAAK;YACL,YAAY;YACZ,YAAY;YACZ,QAAQ;YACR,SAAS;SACV,CAAC,CAAA;QAEF,kCAAkC;QAClC,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;gBACvC,WAAW;aACZ;YACD,MAAM,EAAE;gBACN,IAAA,iCAAmB,EAAC;oBAClB,OAAO,EAAE,iBAAiB,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,kBAAkB,YAAY,aAAa,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,kBAAkB,WAAW,EAAE;iBAChM,CAAC;aACH;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
@@ -0,0 +1,10 @@
1
+ export declare const dataPoints: {
2
+ tagsFound: {
3
+ key: string;
4
+ valueType: "boolean";
5
+ };
6
+ explanation: {
7
+ key: string;
8
+ valueType: "string";
9
+ };
10
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataPoints = void 0;
4
+ exports.dataPoints = {
5
+ tagsFound: {
6
+ key: 'tagsFound',
7
+ valueType: 'boolean',
8
+ },
9
+ explanation: {
10
+ key: 'explanation',
11
+ valueType: 'string',
12
+ }
13
+ };
14
+ //# sourceMappingURL=dataPoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/checkPatientTags/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,SAAS;KACrB;IACD,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { FieldType } from '@awell-health/extensions-core';
3
+ export declare const fields: {
4
+ patientId: {
5
+ id: string;
6
+ label: string;
7
+ type: FieldType.NUMERIC;
8
+ required: true;
9
+ description: string;
10
+ };
11
+ instructions: {
12
+ id: string;
13
+ label: string;
14
+ type: FieldType.TEXT;
15
+ required: true;
16
+ description: string;
17
+ };
18
+ };
19
+ export declare const FieldsValidationSchema: z.ZodObject<{
20
+ patientId: z.ZodNumber;
21
+ instructions: z.ZodString;
22
+ }, "strip", z.ZodTypeAny, {
23
+ patientId: number;
24
+ instructions: string;
25
+ }, {
26
+ patientId: number;
27
+ instructions: string;
28
+ }>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FieldsValidationSchema = exports.fields = void 0;
4
+ const zod_1 = require("zod");
5
+ const extensions_core_1 = require("@awell-health/extensions-core");
6
+ exports.fields = {
7
+ patientId: {
8
+ id: 'patientId',
9
+ label: 'Elation patient ID',
10
+ type: extensions_core_1.FieldType.NUMERIC,
11
+ required: true,
12
+ description: '',
13
+ },
14
+ instructions: {
15
+ id: 'instructions',
16
+ label: 'Instructions for checking tags',
17
+ type: extensions_core_1.FieldType.TEXT,
18
+ required: true,
19
+ description: 'Provide clear instructions for checking presence of absence of tags. For example: "Check if the patient has the tag \'Eligible\'" or "Make sure the patient has tag \'A\' but does not have tag \'B\'"'
20
+ },
21
+ };
22
+ exports.FieldsValidationSchema = zod_1.z.object({
23
+ patientId: extensions_core_1.NumericIdSchema,
24
+ instructions: zod_1.z.string().min(1),
25
+ });
26
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/checkPatientTags/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,YAAY,EAAE;QACZ,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,gCAAgC;QACvC,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,wMAAwM;KACtN;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,iCAAe;IAC1B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACkB,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { dataPoints } from './dataPoints';
2
+ export { fields, FieldsValidationSchema } from './fields';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FieldsValidationSchema = exports.fields = exports.dataPoints = void 0;
4
+ var dataPoints_1 = require("./dataPoints");
5
+ Object.defineProperty(exports, "dataPoints", { enumerable: true, get: function () { return dataPoints_1.dataPoints; } });
6
+ var fields_1 = require("./fields");
7
+ Object.defineProperty(exports, "fields", { enumerable: true, get: function () { return fields_1.fields; } });
8
+ Object.defineProperty(exports, "FieldsValidationSchema", { enumerable: true, get: function () { return fields_1.FieldsValidationSchema; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/checkPatientTags/config/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,mCAAyD;AAAhD,gGAAA,MAAM,OAAA;AAAE,gHAAA,sBAAsB,OAAA"}
@@ -0,0 +1 @@
1
+ export { checkPatientTags } from './checkPatientTags';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkPatientTags = void 0;
4
+ var checkPatientTags_1 = require("./checkPatientTags");
5
+ Object.defineProperty(exports, "checkPatientTags", { enumerable: true, get: function () { return checkPatientTags_1.checkPatientTags; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/checkPatientTags/index.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,13 @@
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 CheckTagsOutput } from './parser';
5
+ interface CheckTagsWithLLMProps {
6
+ model: ChatOpenAI;
7
+ existingTags: string[];
8
+ instructions: string;
9
+ metadata: AIActionMetadata;
10
+ callbacks?: BaseCallbackHandler[];
11
+ }
12
+ export declare const checkTagsWithLLM: (props: CheckTagsWithLLMProps) => Promise<CheckTagsOutput>;
13
+ export {};
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkTagsWithLLM = void 0;
4
+ const prompt_1 = require("./prompt");
5
+ const parser_1 = require("./parser");
6
+ const checkTagsWithLLM = async (props) => {
7
+ const { model, existingTags, instructions, metadata, callbacks } = props;
8
+ try {
9
+ const chain = model.pipe(parser_1.parser);
10
+ const formattedPrompt = await prompt_1.systemPrompt.format({
11
+ existingTags: JSON.stringify(existingTags),
12
+ instructions
13
+ });
14
+ const result = await chain.invoke(formattedPrompt, {
15
+ metadata,
16
+ runName: 'ElationCheckPatientTags',
17
+ callbacks
18
+ });
19
+ return {
20
+ tagsFound: result.tagsFound,
21
+ explanation: result.explanation
22
+ };
23
+ }
24
+ catch (error) {
25
+ throw new Error('Failed to check patient tags.');
26
+ }
27
+ };
28
+ exports.checkTagsWithLLM = checkTagsWithLLM;
29
+ //# sourceMappingURL=checkTagsWithLLM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkTagsWithLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/checkPatientTags/lib/checkTagsWithLLM/checkTagsWithLLM.ts"],"names":[],"mappings":";;;AAGA,qCAAuC;AACvC,qCAAuD;AAUhD,MAAM,gBAAgB,GAAG,KAAK,EAAE,KAA4B,EAA4B,EAAE;IAC/F,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,CAAA;IAExE,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,CAAA;QAChC,MAAM,eAAe,GAAG,MAAM,qBAAY,CAAC,MAAM,CAAC;YAChD,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;YAC1C,YAAY;SACb,CAAC,CAAA;QACF,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAC/B,eAAe,EACf;YACE,QAAQ;YACR,OAAO,EAAE,yBAAyB;YAClC,SAAS;SACV,CACF,CAAA;QAED,OAAO;YACL,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;IAClD,CAAC;AACH,CAAC,CAAA;AAzBY,QAAA,gBAAgB,oBAyB5B"}
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { StructuredOutputParser } from 'langchain/output_parsers';
3
+ export declare const CheckTagsOutputSchema: z.ZodObject<{
4
+ tagsFound: z.ZodBoolean;
5
+ explanation: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ explanation: string;
8
+ tagsFound: boolean;
9
+ }, {
10
+ explanation: string;
11
+ tagsFound: boolean;
12
+ }>;
13
+ export type CheckTagsOutput = z.infer<typeof CheckTagsOutputSchema>;
14
+ export declare const parser: StructuredOutputParser<z.ZodObject<{
15
+ tagsFound: z.ZodBoolean;
16
+ explanation: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ explanation: string;
19
+ tagsFound: boolean;
20
+ }, {
21
+ explanation: string;
22
+ tagsFound: boolean;
23
+ }>>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = exports.CheckTagsOutputSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const output_parsers_1 = require("langchain/output_parsers");
6
+ exports.CheckTagsOutputSchema = zod_1.z.object({
7
+ tagsFound: zod_1.z.boolean(),
8
+ explanation: zod_1.z.string(),
9
+ });
10
+ exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(exports.CheckTagsOutputSchema);
11
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/checkPatientTags/lib/checkTagsWithLLM/parser.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,6DAAiE;AAEpD,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE;IACtB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAA;AAIW,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CAAC,6BAAqB,CAAC,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 **clinical data expert** verifying patient tags against a given instruction.\nAnalyze the provided patient tags to determine if the instruction's conditions are satisfied.\n\n### Input\n- **Existing Patient Tags**: May be empty if no tags are assigned.\n- **Instruction**: Describes which tag(s) to check. It can:\n - Involve a single tag (e.g., \"Check if 'Eligible' is present\").\n - Require multiple tags (e.g., \"Ensure 'A' is present and 'B' is absent\").\n - Specify conditional logic (e.g., \"If 'C' is present, then 'D' must also be present\").\n\n### Rules\n1. **Base conclusions solely on the provided tags** and instructions given.\n2. **Double-check your logic** to avoid false positives or negatives. This is critical.\n\n### Output\nReturn a valid JSON object with:\n1. **tagsFound** (true or false):\n - true if the instruction's condition is met.\n - false otherwise.\n2. **explanation**: A concise, 2 sentence max reason stating which tags were checked and why the result was determined.\n\nExisting Tags: {existingTags}\nInstruction: {instructions}\n">, any>;
@@ -0,0 +1,30 @@
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 **clinical data expert** verifying patient tags against a given instruction.
7
+ Analyze the provided patient tags to determine if the instruction's conditions are satisfied.
8
+
9
+ ### Input
10
+ - **Existing Patient Tags**: May be empty if no tags are assigned.
11
+ - **Instruction**: Describes which tag(s) to check. It can:
12
+ - Involve a single tag (e.g., "Check if 'Eligible' is present").
13
+ - Require multiple tags (e.g., "Ensure 'A' is present and 'B' is absent").
14
+ - Specify conditional logic (e.g., "If 'C' is present, then 'D' must also be present").
15
+
16
+ ### Rules
17
+ 1. **Base conclusions solely on the provided tags** and instructions given.
18
+ 2. **Double-check your logic** to avoid false positives or negatives. This is critical.
19
+
20
+ ### Output
21
+ Return a valid JSON object with:
22
+ 1. **tagsFound** (true or false):
23
+ - true if the instruction's condition is met.
24
+ - false otherwise.
25
+ 2. **explanation**: A concise, 2 sentence max reason stating which tags were checked and why the result was determined.
26
+
27
+ Existing Tags: {existingTags}
28
+ Instruction: {instructions}
29
+ `);
30
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/checkPatientTags/lib/checkTagsWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAwB3D,CAAC,CAAA"}
@@ -0,0 +1,148 @@
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 checkPatientTags
8
+ *
9
+ * Evaluates the checkPatientTags function by:
10
+ * - Running test cases from LangSmith dataset
11
+ * - Comparing generated tag checks against expected results
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/actions/checkPatientTags/lib/evaluateCheckTags.ts
23
+ *
24
+ * Results can be viewed in LangSmith dashboard:
25
+ * https://smith.langchain.com/o/3fffae83-70ff-4574-81ba-aaaedf0b4dc5/datasets/2b3df5fd-6266-43f2-a701-6e5d9981eacc/compare?selectedSessions=2bcc6e49-4087-4051-99f1-6a5d6fce7ac2
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 checkTagsWithLLM_1 = require("./checkTagsWithLLM/checkTagsWithLLM");
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-check-patient-tags-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 tag check results with expected results
65
+ const tagCheckEvaluator = async ({ outputs, referenceOutputs, }) => {
66
+ console.log('Evaluator received:', { outputs, referenceOutputs }); // Debug log
67
+ const generatedResult = outputs === null || outputs === void 0 ? void 0 : outputs.tagsFound;
68
+ const expectedResult = referenceOutputs === null || referenceOutputs === void 0 ? void 0 : referenceOutputs.expected_output;
69
+ // console.log('Comparing results:', { generatedResult, expectedResult }); // Debug log
70
+ return {
71
+ key: 'tag_check_match',
72
+ score: generatedResult === expectedResult ? 1 : 0
73
+ };
74
+ };
75
+ // Wrapper function to adapt checkTagsWithLLM for evaluation
76
+ const checkTagsWithLLMWrapper = async (input) => {
77
+ const payload = {
78
+ activity: {
79
+ id: 'test-activity-id',
80
+ },
81
+ pathway: {
82
+ tenant_id: 'test-tenant',
83
+ definition_id: 'test-definition',
84
+ id: 'test-pathway',
85
+ org_slug: 'test-org',
86
+ org_id: 'test-org-id',
87
+ },
88
+ fields: {
89
+ instructions: input.instruction,
90
+ patientId: 'test-patient',
91
+ },
92
+ settings: {
93
+ openAiApiKey: process.env.OPENAI_API_KEY,
94
+ },
95
+ };
96
+ const helpers = {
97
+ getOpenAIConfig: () => {
98
+ const apiKey = process.env.OPENAI_API_KEY;
99
+ if ((0, lodash_1.isNil)(apiKey) || apiKey.trim() === '') {
100
+ throw new Error('OPENAI_API_KEY is required but not set');
101
+ }
102
+ return { apiKey };
103
+ },
104
+ };
105
+ const { model, metadata, callbacks } = await (0, createOpenAIModel_1.createOpenAIModel)({
106
+ settings: payload.settings,
107
+ helpers,
108
+ payload,
109
+ modelType: constants_1.OPENAI_MODELS.GPT4o,
110
+ });
111
+ return await (0, checkTagsWithLLM_1.checkTagsWithLLM)({
112
+ model,
113
+ existingTags: input.input_patient_tags,
114
+ instructions: input.instruction,
115
+ metadata,
116
+ callbacks,
117
+ });
118
+ };
119
+ // Main function to run the evaluation and print results
120
+ const runEvaluation = async () => {
121
+ var _a, _b;
122
+ try {
123
+ console.log('📡 Fetching test dataset from LangSmith...');
124
+ const testExamples = await fetchTestExamples();
125
+ console.log(`✅ Loaded ${testExamples.length} test examples\n`);
126
+ console.log('🚀 Running evaluation...\n');
127
+ const results = await (0, evaluation_1.evaluate)(checkTagsWithLLMWrapper, {
128
+ data: testExamples,
129
+ evaluators: [tagCheckEvaluator],
130
+ experimentPrefix: 'CheckTagsWithLLM Evaluation',
131
+ maxConcurrency: 16,
132
+ });
133
+ const resultsArray = Array.isArray(results) ? results : [results];
134
+ const experimentId = (_b = (_a = resultsArray[0]) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.run_id;
135
+ if (!(0, lodash_1.isNil)(experimentId) && experimentId.trim() !== '') {
136
+ console.log('\n✨ Evaluation Complete!');
137
+ console.log('View detailed results in LangSmith:');
138
+ console.log(`https://smith.langchain.com/runs/${experimentId}`);
139
+ }
140
+ }
141
+ catch (error) {
142
+ console.error('❌ Error during evaluation:', error);
143
+ throw error;
144
+ }
145
+ };
146
+ // Execute the evaluation
147
+ void runEvaluation();
148
+ //# sourceMappingURL=evaluateCheckTags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluateCheckTags.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/checkPatientTags/lib/evaluateCheckTags.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,yCAAgD;AAChD,qDAA+C;AAC/C,2FAAuF;AACvF,0EAAsE;AACtE,2EAA2E;AAC3E,mCAA8B;AAE9B,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,uCAAuC,CAAA;AAkB3D,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,iCAAiC,EAAE,KAAK,CAAC,CAAA;QACv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E,MAAgB,CAAA;QAE3D,IAAI,CAAC,IAAA,cAAK,EAAC,YAAY,CAAC,IAAI,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACvD,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;YACvC,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;YAClD,OAAO,CAAC,GAAG,CAAC,oCAAoC,YAAY,EAAE,CAAC,CAAA;QACjE,CAAC;IACH,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"}
@@ -2572,6 +2572,72 @@ export declare const actions: {
2572
2572
  required: false;
2573
2573
  };
2574
2574
  }, "updatedTags" | "explanation">;
2575
+ checkPatientTags: import("@awell-health/extensions-core").Action<{
2576
+ patientId: {
2577
+ id: string;
2578
+ label: string;
2579
+ type: import("@awell-health/extensions-core").FieldType.NUMERIC;
2580
+ required: true;
2581
+ description: string;
2582
+ };
2583
+ instructions: {
2584
+ id: string;
2585
+ label: string;
2586
+ type: import("@awell-health/extensions-core").FieldType.TEXT;
2587
+ required: true;
2588
+ description: string;
2589
+ };
2590
+ }, {
2591
+ base_url: {
2592
+ key: string;
2593
+ label: string;
2594
+ obfuscated: false;
2595
+ description: string;
2596
+ required: true;
2597
+ };
2598
+ auth_url: {
2599
+ key: string;
2600
+ label: string;
2601
+ obfuscated: false;
2602
+ description: string;
2603
+ required: true;
2604
+ };
2605
+ client_id: {
2606
+ key: string;
2607
+ label: string;
2608
+ obfuscated: false;
2609
+ description: string;
2610
+ required: true;
2611
+ };
2612
+ client_secret: {
2613
+ key: string;
2614
+ label: string;
2615
+ obfuscated: true;
2616
+ description: string;
2617
+ required: true;
2618
+ };
2619
+ username: {
2620
+ key: string;
2621
+ label: string;
2622
+ obfuscated: false;
2623
+ description: string;
2624
+ required: false;
2625
+ };
2626
+ password: {
2627
+ key: string;
2628
+ label: string;
2629
+ obfuscated: true;
2630
+ description: string;
2631
+ required: false;
2632
+ };
2633
+ rateLimitDuration: {
2634
+ key: string;
2635
+ label: string;
2636
+ obfuscated: false;
2637
+ description: string;
2638
+ required: false;
2639
+ };
2640
+ }, "explanation" | "tagsFound">;
2575
2641
  getReferralOrder: import("@awell-health/extensions-core").Action<{
2576
2642
  referralOrderId: {
2577
2643
  id: string;
@@ -27,6 +27,7 @@ const createReferralOrder_1 = require("./createReferralOrder");
27
27
  const createCareGap_1 = require("./createCareGap");
28
28
  const closeCareGap_1 = require("./closeCareGap");
29
29
  const updatePatientTags_1 = require("./updatePatientTags");
30
+ const checkPatientTags_1 = require("./checkPatientTags");
30
31
  const getReferralOrder_1 = require("./getReferralOrder");
31
32
  const findFutureAppointment_1 = require("./findFutureAppointment");
32
33
  const findAppointmentsWithAI_1 = require("./findAppointmentsWithAI");
@@ -60,6 +61,7 @@ exports.actions = {
60
61
  createCareGap: createCareGap_1.createCareGap,
61
62
  closeCareGap: closeCareGap_1.closeCareGap,
62
63
  updatePatientTags: updatePatientTags_1.updatePatientTags,
64
+ checkPatientTags: checkPatientTags_1.checkPatientTags,
63
65
  getReferralOrder: getReferralOrder_1.getReferralOrder,
64
66
  findFutureAppointment: findFutureAppointment_1.findFutureAppointment,
65
67
  findAppointmentsWithAI: findAppointmentsWithAI_1.findAppointmentsWithAI,
@@ -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,qEAAiE;AACjE,0EAAsE;AACtE,mFAA+E;AAC/E,gFAA4E;AAC/D,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;IAC7B,kBAAkB,EAAlB,uCAAkB;CACnB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/index.ts"],"names":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,mCAAgB;IAChB,gBAAgB,EAAhB,mCAAgB;IAChB,qBAAqB,EAArB,6CAAqB;IACrB,sBAAsB,EAAtB,+CAAsB;IACtB,gBAAgB,EAAhB,mCAAgB;IAChB,6BAA6B,EAA7B,6DAA6B;IAC7B,kBAAkB,EAAlB,uCAAkB;CACnB,CAAA"}
@@ -60,7 +60,7 @@
60
60
  "changelog": "# Dropbox Sign changelog"
61
61
  },
62
62
  "elation": {
63
- "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### ✨ Cancel appointments\n\nGiven a prompt, this action retrieves a patient's upcoming appointments matching the prompt and cancels them.\n",
63
+ "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### ✨ Check Patient Tags\n\nUses AI to check if a patient's tags match given instructions in natural language. The action executes the following steps:\n\n1. Retrieves existing patient tags from Elation\n2. Uses an LLM to interpret natural language instructions and check if the patient's tags match the requirements\n3. Returns a boolean result and explanation of the check\n\nThe action returns:\n- `tagsFound`: Boolean indicating if the patient's tags match the instructions\n- `explanation`: Detailed explanation of why the tags match or don't match the instructions\n\n\n**Important Notes:**\n- When specifying exact tag matches, use double quotes (e.g., \"Diabetes\", \"High-Risk\"). Tags must exist in your Elation database\n- The LLM can understand complex logical conditions like \"either/or\", \"both\", \"not\", \"any of\", \"none of\"\n\n### ✨ Cancel appointments\n\nGiven a prompt, this action retrieves a patient's upcoming appointments matching the prompt and cancels them.\n",
64
64
  "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"
65
65
  },
66
66
  "epic": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "2.0.197",
3
+ "version": "2.0.198",
4
4
  "packageManager": "yarn@4.5.3",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {