@awell-health/awell-extensions 2.0.155 → 2.0.157
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/extensions/awell/index.js +1 -0
- package/dist/extensions/awell/index.js.map +1 -1
- package/dist/extensions/awell/v1/actions/getDataPointValue/__testdata__/getDataPointValue.mock.d.ts +84 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/__testdata__/getDataPointValue.mock.js +110 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/__testdata__/getDataPointValue.mock.js.map +1 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/config/dataPoints.d.ts +34 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/config/dataPoints.js +38 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/config/dataPoints.js.map +1 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/config/fields.d.ts +28 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/config/fields.js +26 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/config/fields.js.map +1 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/config/index.d.ts +2 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/config/index.js +9 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/config/index.js.map +1 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/getDataPointValue.d.ts +4 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/getDataPointValue.js +90 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/getDataPointValue.js.map +1 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/index.d.ts +1 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/index.js +6 -0
- package/dist/extensions/awell/v1/actions/getDataPointValue/index.js.map +1 -0
- package/dist/extensions/awell/v1/actions/index.d.ts +1 -0
- package/dist/extensions/awell/v1/actions/index.js +3 -1
- package/dist/extensions/awell/v1/actions/index.js.map +1 -1
- package/dist/extensions/awellTasks/api/schema/GetCareflowComments.schema.d.ts +6 -6
- package/dist/extensions/canvasMedical/v1/validation/extension.zod.d.ts +32 -32
- package/dist/extensions/canvasMedical/v1/validation/patient.zod.d.ts +76 -76
- package/dist/extensions/elation/actions/index.d.ts +2 -2
- package/dist/extensions/elation/actions/updatePatientTags/config/dataPoints.d.ts +4 -0
- package/dist/extensions/elation/actions/updatePatientTags/config/dataPoints.js +4 -0
- package/dist/extensions/elation/actions/updatePatientTags/config/dataPoints.js.map +1 -1
- package/dist/extensions/elation/actions/updatePatientTags/config/fields.d.ts +4 -4
- package/dist/extensions/elation/actions/updatePatientTags/config/fields.js +5 -5
- package/dist/extensions/elation/actions/updatePatientTags/config/fields.js.map +1 -1
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/evaluateTags.d.ts +24 -0
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/evaluateTags.js +148 -0
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/evaluateTags.js.map +1 -0
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.d.ts +1 -1
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.js +2 -2
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.js.map +1 -1
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/parser.d.ts +22 -6
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/parser.js +13 -3
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/parser.js.map +1 -1
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/prompt.d.ts +1 -1
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/prompt.js +32 -11
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/prompt.js.map +1 -1
- package/dist/extensions/elation/actions/updatePatientTags/updatePatientTags.js +4 -3
- package/dist/extensions/elation/actions/updatePatientTags/updatePatientTags.js.map +1 -1
- package/dist/extensions/elation/actions/updatePatientTags/updateTags.js +3 -2
- package/dist/extensions/elation/actions/updatePatientTags/updateTags.js.map +1 -1
- package/dist/extensions/markdown.json +1 -1
- package/package.json +1 -1
- package/dist/extensions/elation/actions/updatePatientTags/config/types.d.ts +0 -29
- package/dist/extensions/elation/actions/updatePatientTags/config/types.js +0 -21
- package/dist/extensions/elation/actions/updatePatientTags/config/types.js.map +0 -1
@@ -11,16 +11,16 @@ exports.fields = {
|
|
11
11
|
required: true,
|
12
12
|
description: '',
|
13
13
|
},
|
14
|
-
|
15
|
-
id: '
|
16
|
-
label: '
|
14
|
+
instructions: {
|
15
|
+
id: 'instructions',
|
16
|
+
label: 'Specify tags to add, remove, or modify',
|
17
17
|
type: extensions_core_1.FieldType.TEXT,
|
18
18
|
required: true,
|
19
|
-
description: ''
|
19
|
+
description: 'Provide clear instructions for tag changes and relevant context, especially for uncommon tags. Specify new tags in single quotes (e.g., \'Patient-Tag\').'
|
20
20
|
},
|
21
21
|
};
|
22
22
|
exports.FieldsValidationSchema = zod_1.z.object({
|
23
23
|
patientId: extensions_core_1.NumericIdSchema,
|
24
|
-
|
24
|
+
instructions: zod_1.z.string().min(1),
|
25
25
|
});
|
26
26
|
//# sourceMappingURL=fields.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/updatePatientTags/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,
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/updatePatientTags/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,wCAAwC;QAC/C,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,2JAA2J;KACzK;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"}
|
package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/evaluateTags.d.ts
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* LangSmith Evaluation Script for getTagsFromLLM
|
3
|
+
*
|
4
|
+
* Evaluates the getTagsFromLLM function by:
|
5
|
+
* - Running test cases from LangSmith dataset
|
6
|
+
* - Comparing generated tags against expected tags
|
7
|
+
* - Generating evaluation reports
|
8
|
+
*
|
9
|
+
* Requirements:
|
10
|
+
* - Set environment variables in .env:
|
11
|
+
* - OPENAI_API_KEY
|
12
|
+
* - LANGSMITH_API_KEY
|
13
|
+
* - LANGSMITH_TRACING=true
|
14
|
+
* - LANGSMITH_PROJECT=ai-actions-local
|
15
|
+
*
|
16
|
+
* Usage:
|
17
|
+
* node getTagsFromLLM/evaluateTags.ts
|
18
|
+
*
|
19
|
+
* Results can be viewed in LangSmith dashboard:
|
20
|
+
* https://smith.langchain.com/o/3fffae83-70ff-4574-81ba-aaaedf0b4dc5/datasets/745cea13-3379-463f-9a8a-c6b10e29b8f6
|
21
|
+
*
|
22
|
+
* * ⚠️ **Note:** This script does NOT run in CI/CD. It is meant for **manual evaluation** before merging PRs (for now)
|
23
|
+
*/
|
24
|
+
export {};
|
@@ -0,0 +1,148 @@
|
|
1
|
+
"use strict";
|
2
|
+
/**
|
3
|
+
* LangSmith Evaluation Script for getTagsFromLLM
|
4
|
+
*
|
5
|
+
* Evaluates the getTagsFromLLM function by:
|
6
|
+
* - Running test cases from LangSmith dataset
|
7
|
+
* - Comparing generated tags against expected tags
|
8
|
+
* - Generating evaluation reports
|
9
|
+
*
|
10
|
+
* Requirements:
|
11
|
+
* - Set environment variables in .env:
|
12
|
+
* - OPENAI_API_KEY
|
13
|
+
* - LANGSMITH_API_KEY
|
14
|
+
* - LANGSMITH_TRACING=true
|
15
|
+
* - LANGSMITH_PROJECT=ai-actions-local
|
16
|
+
*
|
17
|
+
* Usage:
|
18
|
+
* node getTagsFromLLM/evaluateTags.ts
|
19
|
+
*
|
20
|
+
* Results can be viewed in LangSmith dashboard:
|
21
|
+
* https://smith.langchain.com/o/3fffae83-70ff-4574-81ba-aaaedf0b4dc5/datasets/745cea13-3379-463f-9a8a-c6b10e29b8f6
|
22
|
+
*
|
23
|
+
* * ⚠️ **Note:** This script does NOT run in CI/CD. It is meant for **manual evaluation** before merging PRs (for now)
|
24
|
+
*/
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
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 getTagsFromLLM_1 = require("./getTagsFromLLM");
|
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-update-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)) { // Explicit null check
|
53
|
+
examples.push(example);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
return examples;
|
57
|
+
}
|
58
|
+
catch (error) {
|
59
|
+
console.error('❌ Error fetching test examples:', error);
|
60
|
+
throw error;
|
61
|
+
}
|
62
|
+
};
|
63
|
+
// Custom evaluator to compare generated tags with expected tags
|
64
|
+
const tagsMatchEvaluator = async ({ outputs, referenceOutputs, }) => {
|
65
|
+
console.log('Evaluator received:', { outputs, referenceOutputs }); // Debug log
|
66
|
+
const generatedTags = outputs === null || outputs === void 0 ? void 0 : outputs.validatedTags;
|
67
|
+
const expectedTags = referenceOutputs === null || referenceOutputs === void 0 ? void 0 : referenceOutputs.expected_updated_tags;
|
68
|
+
// console.log('Comparing tags:', { generatedTags, expectedTags }); // Debug log
|
69
|
+
const isEqual = Array.isArray(generatedTags) &&
|
70
|
+
Array.isArray(expectedTags) &&
|
71
|
+
generatedTags.length === expectedTags.length &&
|
72
|
+
generatedTags.every((tag, index) => tag === expectedTags[index]);
|
73
|
+
return { key: 'tags_match', score: isEqual ? 1 : 0 };
|
74
|
+
};
|
75
|
+
// Wrapper function to adapt getTagsFromLLM for evaluation
|
76
|
+
const getTagsFromLLMWrapper = 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, getTagsFromLLM_1.getTagsFromLLM)({
|
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)(getTagsFromLLMWrapper, {
|
128
|
+
data: testExamples,
|
129
|
+
evaluators: [tagsMatchEvaluator],
|
130
|
+
experimentPrefix: 'GetTagsFromLLM Evaluation',
|
131
|
+
maxConcurrency: 4,
|
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=evaluateTags.js.map
|
package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/evaluateTags.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"evaluateTags.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/evaluateTags.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;AAEH,yCAAiD;AACjD,qDAAgD;AAChD,8FAA2F;AAC3F,qDAAkD;AAClD,8EAA+E;AAE/E,mCAA+B;AAE/B,oDAA4B;AAC5B,gBAAM,CAAC,MAAM,EAAE,CAAC;AAGhB,MAAM,SAAS,GAAG,IAAI,kBAAM,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;IACrC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB;CACvC,CAAC,CAAC;AAEH,0BAA0B;AAC1B,MAAM,WAAW,GAAG,wCAAwC,CAAC;AAiB7D,mDAAmD;AACnD,MAAM,iBAAiB,GAAG,KAAK,IAAwB,EAAE;I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AC,CAAC;QACnD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,yBAAyB;AACzB,KAAK,aAAa,EAAE,CAAC"}
|
package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.d.ts
CHANGED
@@ -5,7 +5,7 @@ import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
|
5
5
|
interface GetTagsFromLLMProps {
|
6
6
|
model: ChatOpenAI;
|
7
7
|
existingTags: string[];
|
8
|
-
|
8
|
+
instructions: string;
|
9
9
|
metadata: AIActionMetadata;
|
10
10
|
callbacks?: BaseCallbackHandler[];
|
11
11
|
}
|
package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.js
CHANGED
@@ -4,12 +4,12 @@ exports.getTagsFromLLM = void 0;
|
|
4
4
|
const prompt_1 = require("./prompt");
|
5
5
|
const parser_1 = require("./parser");
|
6
6
|
const getTagsFromLLM = async (props) => {
|
7
|
-
const { model, existingTags,
|
7
|
+
const { model, existingTags, instructions, metadata, callbacks } = props;
|
8
8
|
try {
|
9
9
|
const chain = model.pipe(parser_1.parser);
|
10
10
|
const formattedPrompt = await prompt_1.systemPrompt.format({
|
11
11
|
existingTags: JSON.stringify(existingTags),
|
12
|
-
|
12
|
+
instructions
|
13
13
|
});
|
14
14
|
const result = await chain.invoke(formattedPrompt, {
|
15
15
|
metadata,
|
package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getTagsFromLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.ts"],"names":[],"mappings":";;;AAEA,qCAAuC;AACvC,qCAAkD;AAW3C,MAAM,cAAc,GAAG,KAAK,EAAE,KAA0B,EAAuB,EAAE;IACtF,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,
|
1
|
+
{"version":3,"file":"getTagsFromLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.ts"],"names":[],"mappings":";;;AAEA,qCAAuC;AACvC,qCAAkD;AAW3C,MAAM,cAAc,GAAG,KAAK,EAAE,KAA0B,EAAuB,EAAE;IACtF,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,0BAA0B;YACnC,SAAS;SACV,CACF,CAAA;QAED,OAAO;YACL,aAAa,EAAE,MAAM,CAAC,WAAW;YACjC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;IACnD,CAAC;AACH,CAAC,CAAA;AAzBY,QAAA,cAAc,kBAyB1B"}
|
@@ -1,13 +1,29 @@
|
|
1
|
+
import { z } from 'zod';
|
1
2
|
import { StructuredOutputParser } from '@langchain/core/output_parsers';
|
2
|
-
|
3
|
-
export declare const
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
export declare const SingleTagSchema: z.ZodString;
|
4
|
+
export declare const TagsSchema: z.ZodArray<z.ZodString, "many">;
|
5
|
+
export declare const TagsOutputSchema: z.ZodObject<{
|
6
|
+
updatedTags: z.ZodArray<z.ZodString, "many">;
|
7
|
+
explanation: z.ZodString;
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
9
|
+
updatedTags: string[];
|
10
|
+
explanation: string;
|
11
|
+
}, {
|
12
|
+
updatedTags: string[];
|
13
|
+
explanation: string;
|
14
|
+
}>;
|
15
|
+
export declare const parser: StructuredOutputParser<z.ZodObject<{
|
16
|
+
updatedTags: z.ZodArray<z.ZodString, "many">;
|
17
|
+
explanation: z.ZodString;
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
7
19
|
updatedTags: string[];
|
8
20
|
explanation: string;
|
9
21
|
}, {
|
10
22
|
updatedTags: string[];
|
11
23
|
explanation: string;
|
12
24
|
}>>;
|
13
|
-
export type
|
25
|
+
export type TagsOutput = z.infer<typeof TagsOutputSchema>;
|
26
|
+
export interface TagsFromAI {
|
27
|
+
validatedTags: string[];
|
28
|
+
explanation: string;
|
29
|
+
}
|
@@ -1,7 +1,17 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.parser = void 0;
|
3
|
+
exports.parser = exports.TagsOutputSchema = exports.TagsSchema = exports.SingleTagSchema = void 0;
|
4
|
+
const zod_1 = require("zod");
|
4
5
|
const output_parsers_1 = require("@langchain/core/output_parsers");
|
5
|
-
|
6
|
-
exports.
|
6
|
+
exports.SingleTagSchema = zod_1.z.string();
|
7
|
+
exports.TagsSchema = zod_1.z
|
8
|
+
.array(exports.SingleTagSchema)
|
9
|
+
.describe('The updated array of tags');
|
10
|
+
exports.TagsOutputSchema = zod_1.z.object({
|
11
|
+
updatedTags: exports.TagsSchema,
|
12
|
+
explanation: zod_1.z
|
13
|
+
.string()
|
14
|
+
.describe('A single, concise sentence summarizing all tag modifications, including the reasoning behind the changes or lack thereof.'),
|
15
|
+
});
|
16
|
+
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(exports.TagsOutputSchema);
|
7
17
|
//# sourceMappingURL=parser.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/parser.ts"],"names":[],"mappings":";;;AAAA,mEAAuE;
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/parser.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mEAAuE;AAE1D,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,EAAE,CAAA;AAE5B,QAAA,UAAU,GAAG,OAAC;KACxB,KAAK,CAAC,uBAAe,CAAC;KACtB,QAAQ,CAAC,2BAA2B,CAAC,CAAA;AAE3B,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,WAAW,EAAE,kBAAU;IACvB,WAAW,EAAE,OAAC;SACX,MAAM,EAAE;SACR,QAAQ,CAAC,2HAA2H,CAAC;CACzI,CAAC,CAAA;AAEW,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CAAC,wBAAgB,CAAC,CAAA"}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
2
|
-
export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\
|
2
|
+
export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are a clinical data manager with expert knowledge of Elation Patient Tags, which help care teams organize patient care (e.g., grouping, reporting, or identifying patients for care).\n\n Your task is to manage a single patient's tags based on the provided instructions.\n\n You will receive:\n - existing_tags: An array of the patient's current tags.\n - instruction: A directive specifying which tags to add, update, or remove. Ensure to follow them diligently.\n\n ### Step-by-Step Approach:\n 1. **Review the Instruction**\n - Identify the required tag modifications: additions, updates, or removals.\n\n 2. **Apply Modifications**\n - **Removing Tags:**\n - Only remove tags if explicitly stated in the instruction.\n - Match existing tags for removal, allowing minor variations (e.g., capitalization, spacing).\n - If unsure, do not remove the tag.\n\n - **Adding Tags:**\n - Use the exact wording and formatting provided in the instruction for new tags. Do not modify, reformat, or adjust them in any way. This is critical.\n - Ensure that the final list does not exceed **10 tags**. If adding a tag would exceed this limit, do not add it and clarify this in the \"explanation\".\n - If a tag exceeds **100 characters**, do not add it and state this in the \"explanation\".\n - Ensure all tags remain **unique** (no duplicates).\n - The updated list should first retain all unchanged tags, followed by any new additions.\n\n - **Unaffected Tags:**\n - Tags that are not affected by the modification instructions must remain unchanged, including spacing and formatting.\n\n 3. **Generate Output**\n - Return a JSON object containing:\n - \"updatedTags\": The final array of tags after modifications.\n - \"explanation\": A single, concise sentence summarizing all tag modifications, including the reasoning behind changes or lack thereof. Do not include statements about the total number of tags.\n\n ### Input\n existingTags: {existingTags}\n instructions: {instructions}\n">, any>;
|
@@ -3,20 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.systemPrompt = void 0;
|
4
4
|
const prompts_1 = require("@langchain/core/prompts");
|
5
5
|
exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
|
6
|
-
You are a clinical data manager
|
7
|
-
|
8
|
-
Important instructions:
|
9
|
-
- The maximum number of tags is 10.
|
10
|
-
- The max length of a single tag is 100 characters.
|
11
|
-
- Ensure tags are unique.
|
6
|
+
You are a clinical data manager with expert knowledge of Elation Patient Tags, which help care teams organize patient care (e.g., grouping, reporting, or identifying patients for care).
|
12
7
|
|
8
|
+
Your task is to manage a single patient's tags based on the provided instructions.
|
13
9
|
|
14
|
-
|
15
|
-
|
10
|
+
You will receive:
|
11
|
+
- existing_tags: An array of the patient's current tags.
|
12
|
+
- instruction: A directive specifying which tags to add, update, or remove. Ensure to follow them diligently.
|
16
13
|
|
14
|
+
### Step-by-Step Approach:
|
15
|
+
1. **Review the Instruction**
|
16
|
+
- Identify the required tag modifications: additions, updates, or removals.
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
2. **Apply Modifications**
|
19
|
+
- **Removing Tags:**
|
20
|
+
- Only remove tags if explicitly stated in the instruction.
|
21
|
+
- Match existing tags for removal, allowing minor variations (e.g., capitalization, spacing).
|
22
|
+
- If unsure, do not remove the tag.
|
23
|
+
|
24
|
+
- **Adding Tags:**
|
25
|
+
- Use the exact wording and formatting provided in the instruction for new tags. Do not modify, reformat, or adjust them in any way. This is critical.
|
26
|
+
- Ensure that the final list does not exceed **10 tags**. If adding a tag would exceed this limit, do not add it and clarify this in the "explanation".
|
27
|
+
- If a tag exceeds **100 characters**, do not add it and state this in the "explanation".
|
28
|
+
- Ensure all tags remain **unique** (no duplicates).
|
29
|
+
- The updated list should first retain all unchanged tags, followed by any new additions.
|
30
|
+
|
31
|
+
- **Unaffected Tags:**
|
32
|
+
- Tags that are not affected by the modification instructions must remain unchanged, including spacing and formatting.
|
33
|
+
|
34
|
+
3. **Generate Output**
|
35
|
+
- Return a JSON object containing:
|
36
|
+
- "updatedTags": The final array of tags after modifications.
|
37
|
+
- "explanation": A single, concise sentence summarizing all tag modifications, including the reasoning behind changes or lack thereof. Do not include statements about the total number of tags.
|
38
|
+
|
39
|
+
### Input
|
40
|
+
existingTags: {existingTags}
|
41
|
+
instructions: {instructions}
|
21
42
|
`);
|
22
43
|
//# sourceMappingURL=prompt.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC3D,CAAC,CAAA"}
|
@@ -20,14 +20,14 @@ const constants_1 = require("../../../../src/lib/llm/openai/constants");
|
|
20
20
|
exports.updatePatientTags = {
|
21
21
|
key: 'updatePatientTags',
|
22
22
|
category: extensions_core_1.Category.EHR_INTEGRATIONS,
|
23
|
-
title: '🪄 Update patient tags
|
23
|
+
title: '🪄 Update patient tags',
|
24
24
|
description: 'Update patient tags in Elation.',
|
25
25
|
fields: config_1.fields,
|
26
26
|
previewable: false,
|
27
27
|
dataPoints: config_1.dataPoints,
|
28
28
|
onEvent: async ({ payload, onComplete, onError, helpers }) => {
|
29
29
|
// 1. Validate input and initialize API client
|
30
|
-
const {
|
30
|
+
const { instructions, patientId } = config_1.FieldsValidationSchema.parse(payload.fields);
|
31
31
|
const api = (0, client_1.makeAPIClient)(payload.settings);
|
32
32
|
// 2. Get existing tags
|
33
33
|
const { tags } = await api.getPatient(patientId);
|
@@ -43,7 +43,7 @@ exports.updatePatientTags = {
|
|
43
43
|
const { validatedTags, explanation } = await (0, getTagsFromLLM_1.getTagsFromLLM)({
|
44
44
|
model,
|
45
45
|
existingTags,
|
46
|
-
|
46
|
+
instructions,
|
47
47
|
metadata,
|
48
48
|
callbacks
|
49
49
|
});
|
@@ -53,6 +53,7 @@ exports.updatePatientTags = {
|
|
53
53
|
await onComplete({
|
54
54
|
data_points: {
|
55
55
|
updatedTags: validatedTags.join(', '),
|
56
|
+
explanation,
|
56
57
|
},
|
57
58
|
events: [
|
58
59
|
(0, addEventLog_1.addActivityEventLog)({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"updatePatientTags.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/updatePatientTags/updatePatientTags.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,uEAA2E;AAE3E,yCAA4C;AAC5C,qCAAqE;AACrE,6CAAgD;AAChD,wEAAoE;AACpE,wFAAoF;AACpF,wEAAwE;AAExE;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAI1B;IACF,GAAG,EAAE,mBAAmB;IACxB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE
|
1
|
+
{"version":3,"file":"updatePatientTags.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/updatePatientTags/updatePatientTags.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,uEAA2E;AAE3E,yCAA4C;AAC5C,qCAAqE;AACrE,6CAAgD;AAChD,wEAAoE;AACpE,wFAAoF;AACpF,wEAAwE;AAExE;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAI1B;IACF,GAAG,EAAE,mBAAmB;IACxB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EAAE,iCAAiC;IAC9C,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAiB,EAAE;QAC1E,8CAA8C;QAC9C,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,+BAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAChF,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,OAAO,CAAC,QAAQ;YAC1B,OAAO;YACP,OAAO;YACP,SAAS,EAAE,yBAAa,CAAC,KAAK;SAC/B,CAAC,CAAA;QAEF,2BAA2B;QAC3B,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,+BAAc,EAAC;YAC1D,KAAK;YACL,YAAY;YACZ,YAAY;YACZ,QAAQ;YACR,SAAS;SACV,CAAC,CAAA;QAEF,4BAA4B;QAC5B,MAAM,IAAA,8BAAiB,EAAC,GAAG,EAAE,SAAS,EAAE,aAAa,CAAC,CAAA;QAEtD,kCAAkC;QAClC,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,WAAW,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;gBACrC,WAAW;aACZ;YACD,MAAM,EAAE;gBACN,IAAA,iCAAmB,EAAC;oBAClB,OAAO,EAAE,0BAA0B,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,IAAG,CAAC,CAAC,CAAC,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,2BAA2B,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,WAAW,EAAE;iBACrL,CAAC;aACH;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -4,8 +4,9 @@ exports.updateElationTags = void 0;
|
|
4
4
|
const updateElationTags = async (api, patientId, tags) => {
|
5
5
|
if (tags.length === 0) {
|
6
6
|
await api.updatePatient(patientId, {
|
7
|
-
//
|
8
|
-
tags
|
7
|
+
// Note: Empty array doesn't clear tags, but [''] does by setting '' as a tag and clearing the rest (so it is not actually removing all tags but setting '' as a tag)
|
8
|
+
// This is also recommended workaround Elation team for clearing tags via API
|
9
|
+
tags: [''],
|
9
10
|
});
|
10
11
|
}
|
11
12
|
else {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"updateTags.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/updatePatientTags/updateTags.ts"],"names":[],"mappings":";;;AAEO,MAAM,iBAAiB,GAAG,KAAK,EAAE,GAAqB,EAAE,SAAiB,EAAE,IAAc,EAAiB,EAAE;IAC/G,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,GAAG,CAAC,aAAa,CAAC,SAAS,EAAE;YACjC,
|
1
|
+
{"version":3,"file":"updateTags.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/updatePatientTags/updateTags.ts"],"names":[],"mappings":";;;AAEO,MAAM,iBAAiB,GAAG,KAAK,EAAE,GAAqB,EAAE,SAAiB,EAAE,IAAc,EAAiB,EAAE;IAC/G,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,GAAG,CAAC,aAAa,CAAC,SAAS,EAAE;YACjC,qKAAqK;YACrK,6EAA6E;YAC7E,IAAI,EAAE,CAAC,EAAE,CAAC;SACX,CAAC,CAAA;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,CAAC,aAAa,CAAC,SAAS,EAAE;YACjC,IAAI;SACL,CAAC,CAAA;IACJ,CAAC;AACH,CAAC,CAAA;AAZU,QAAA,iBAAiB,qBAY3B"}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
"changelog": "# Athena changelog"
|
5
5
|
},
|
6
6
|
"awell": {
|
7
|
-
"readme": "---\ntitle: Awell Workflow\ndescription: Enrich your care flows with powerful Awell actions.\n---\n\n# Awell API extension\n\n## Extension settings\n\nYou will need to provide the [API URL](https://developers.awellhealth.com/awell-orchestration/api-reference/overview/endpoints) and an [API key](https://developers.awellhealth.com/awell-orchestration/api-reference/overview/authorization).\n\n## Custom Actions\n\n### Start care flow\n\nStarts a new care flow for the patient enrolled in your current care flow.\n\n**Passing baseline info:**\nPlease read the documentation on [our developer hub](https://developers.awellhealth.com/awell-orchestration/api-reference/mutations/start-pathway) to learn more about how to pass baseline info.\n\n**Example of how to configure a value for the baseline info action field:**\n\n```json\n[\n {\n \"data_point_definition_id\": \"age\",\n \"value\": \"29\"\n },\n {\n \"data_point_definition_id\": \"dob\",\n \"value\": \"1993-11-30\"\n }\n]\n```\n\n### Stop care flow\n\nStops the care flow the patient is currently enrolled in. A reason is why you are stopping the care flow is mandatory.\n\n### Update patient\n\nAllows updating patient data for the patient currently enrolled in the care flow.\n\n### Is patient already enrolled in care flow\n\nChecks whether the patient is already enrolled in a care flow definition. The care flow the patient is currently enrolled in does not count and is excluded from the results.\n\n**Action fields:**\n\n- pathwayStatus: a comma-separated string of care flow statuses that will be used when looking for care flows the patient is already enrolled in. By default, we only look at active care flows. Options: \"active\", \"completed\", \"missing_baseline_info\", \"starting\", and \"stopped\".\n- careFlowDefinitionIds: a comma-separated string of care flow definition ids that will be used when looking for care flows the patient is already enrolled in. By default, we only search for care flows that match the current care flow definition id (i.e. is the patient already included in the current care flow?).\n\n**Data points:**\n\n- result: a boolean indicating whether the patient is already enrolled in another care flow that matches your criteria (status & care flow definition id)\n- nbrOfResults: the number of care flows found for the patient that match the criteria.\n- careFlowIds: a comma-separated string of care flow ids that matched your search criteria. It will be empty when the result is `false` because then there are no other care flow ids that match your criteria.\n\n### Search patients by patient code\n\nNote that this action is deprecated and we recommend using [identifiers](https://developers.awellhealth.com/awell-orchestration/docs/misc/patient-identifiers) instead.\n\nSearch whether, apart from the patient currently enrolled in the care flow, another patient with the same `patient_code` already exists.\n\n**Data points:**\n\n1. patientAlreadyExists: a boolean which will be true if minimum one patient with the patient code already exists.\n2. numberOfPatientsFound: the number of patients found with the same patient code.\n3. awellPatientIds: a comma-separated string of all Awell patient ids (except the current patient) that have the same patient code as the patient currently enrolled in the care flow. Will return an empty string when there are no other patients with the same patient code.\n\n### Get patient by identifier\n\nThis action lets you check if a patient with a specific identifier already exists in Awell. It's particularly useful when a patient's identity is initially anonymous during the start of the care flow, but later becomes identifiable through the identifiers collected during the care flow. This check ensures whether a patient with that identifier is already present or not.\n\n### Add identifier to patient\n\nThis action allows you to add a unique identifier to the current patient's profile. If the patient already has an identifier with the same system but a different value, this action will update the existing identifier with the new value provided. \n\nFirst, it checks if this identifier (system and value) is already associated with another patient. If it's safe to proceed, it will add or update the identifier as needed. However, if another patient already has this identifier, the action will stop and notify you, preventing duplicates. To avoid conflicts, we recommend first running the \"Get patient by identifier\" action to check for any existing matches.\n\n## Webhooks\n\nWebhooks in the Awell extension offer ways to trigger a care flow based on the end of another care flow, or from any event that happens in your system (via the pathwayStart webhook).\n",
|
7
|
+
"readme": "---\ntitle: Awell Workflow\ndescription: Enrich your care flows with powerful Awell actions.\n---\n\n# Awell API extension\n\n## Extension settings\n\nYou will need to provide the [API URL](https://developers.awellhealth.com/awell-orchestration/api-reference/overview/endpoints) and an [API key](https://developers.awellhealth.com/awell-orchestration/api-reference/overview/authorization).\n\n## Custom Actions\n\n### Start care flow\n\nStarts a new care flow for the patient enrolled in your current care flow.\n\n**Passing baseline info:**\nPlease read the documentation on [our developer hub](https://developers.awellhealth.com/awell-orchestration/api-reference/mutations/start-pathway) to learn more about how to pass baseline info.\n\n**Example of how to configure a value for the baseline info action field:**\n\n```json\n[\n {\n \"data_point_definition_id\": \"age\",\n \"value\": \"29\"\n },\n {\n \"data_point_definition_id\": \"dob\",\n \"value\": \"1993-11-30\"\n }\n]\n```\n\n### Stop care flow\n\nStops the care flow the patient is currently enrolled in. A reason is why you are stopping the care flow is mandatory.\n\n### Update patient\n\nAllows updating patient data for the patient currently enrolled in the care flow.\n\n### Is patient already enrolled in care flow\n\nChecks whether the patient is already enrolled in a care flow definition. The care flow the patient is currently enrolled in does not count and is excluded from the results.\n\n**Action fields:**\n\n- pathwayStatus: a comma-separated string of care flow statuses that will be used when looking for care flows the patient is already enrolled in. By default, we only look at active care flows. Options: \"active\", \"completed\", \"missing_baseline_info\", \"starting\", and \"stopped\".\n- careFlowDefinitionIds: a comma-separated string of care flow definition ids that will be used when looking for care flows the patient is already enrolled in. By default, we only search for care flows that match the current care flow definition id (i.e. is the patient already included in the current care flow?).\n\n**Data points:**\n\n- result: a boolean indicating whether the patient is already enrolled in another care flow that matches your criteria (status & care flow definition id)\n- nbrOfResults: the number of care flows found for the patient that match the criteria.\n- careFlowIds: a comma-separated string of care flow ids that matched your search criteria. It will be empty when the result is `false` because then there are no other care flow ids that match your criteria.\n\n### Search patients by patient code\n\nNote that this action is deprecated and we recommend using [identifiers](https://developers.awellhealth.com/awell-orchestration/docs/misc/patient-identifiers) instead.\n\nSearch whether, apart from the patient currently enrolled in the care flow, another patient with the same `patient_code` already exists.\n\n**Data points:**\n\n1. patientAlreadyExists: a boolean which will be true if minimum one patient with the patient code already exists.\n2. numberOfPatientsFound: the number of patients found with the same patient code.\n3. awellPatientIds: a comma-separated string of all Awell patient ids (except the current patient) that have the same patient code as the patient currently enrolled in the care flow. Will return an empty string when there are no other patients with the same patient code.\n\n### Get patient by identifier\n\nThis action lets you check if a patient with a specific identifier already exists in Awell. It's particularly useful when a patient's identity is initially anonymous during the start of the care flow, but later becomes identifiable through the identifiers collected during the care flow. This check ensures whether a patient with that identifier is already present or not.\n\n### Add identifier to patient\n\nThis action allows you to add a unique identifier to the current patient's profile. If the patient already has an identifier with the same system but a different value, this action will update the existing identifier with the new value provided. \n\nFirst, it checks if this identifier (system and value) is already associated with another patient. If it's safe to proceed, it will add or update the identifier as needed. However, if another patient already has this identifier, the action will stop and notify you, preventing duplicates. To avoid conflicts, we recommend first running the \"Get patient by identifier\" action to check for any existing matches.\n\n### Get data point value\n\nThis action allows you to read the most recent data point value of a given data point definition id from a care flow different from the current one. The action returns multiple data points, each with a different value type. Pick the one you need from the returned data points based on the value type of the data point you want to read the value from.\n\n**Example:**\nIf the data point you want to read the value from is of type `number`, then you should use the `valueNumber` data point.\n\n## Webhooks\n\nWebhooks in the Awell extension offer ways to trigger a care flow based on the end of another care flow, or from any event that happens in your system (via the pathwayStart webhook).\n",
|
8
8
|
"changelog": "# Awell changelog\n\n## April 2024\n\nTwo new action were added: \"Get patient by identifier\" and \"Add identifier to patient\".\n\n## October 26, 2023\n\nGeneric webhook to start a care flow added\n\n## April 19, 2023\n\nStop care flow action added.\nSearch patients by patient code action was added.\n\"Is patient enrolled in care flow\" action added.\n"
|
9
9
|
},
|
10
10
|
"awellTasks": {
|
package/package.json
CHANGED
@@ -1,29 +0,0 @@
|
|
1
|
-
import { z } from 'zod';
|
2
|
-
import { StructuredOutputParser } from '@langchain/core/output_parsers';
|
3
|
-
export declare const SingleTagSchema: z.ZodString;
|
4
|
-
export declare const TagsSchema: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
5
|
-
export declare const TagsOutputSchema: z.ZodObject<{
|
6
|
-
updatedTags: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
7
|
-
explanation: z.ZodString;
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
9
|
-
updatedTags: string[];
|
10
|
-
explanation: string;
|
11
|
-
}, {
|
12
|
-
updatedTags: string[];
|
13
|
-
explanation: string;
|
14
|
-
}>;
|
15
|
-
export declare const parser: StructuredOutputParser<z.ZodObject<{
|
16
|
-
updatedTags: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
17
|
-
explanation: z.ZodString;
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
19
|
-
updatedTags: string[];
|
20
|
-
explanation: string;
|
21
|
-
}, {
|
22
|
-
updatedTags: string[];
|
23
|
-
explanation: string;
|
24
|
-
}>>;
|
25
|
-
export type TagsOutput = z.infer<typeof TagsOutputSchema>;
|
26
|
-
export interface TagsFromAI {
|
27
|
-
validatedTags: string[];
|
28
|
-
explanation: string;
|
29
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.parser = exports.TagsOutputSchema = exports.TagsSchema = exports.SingleTagSchema = void 0;
|
4
|
-
const zod_1 = require("zod");
|
5
|
-
const output_parsers_1 = require("@langchain/core/output_parsers");
|
6
|
-
exports.SingleTagSchema = zod_1.z.string().max(100).describe('A single tag');
|
7
|
-
exports.TagsSchema = zod_1.z
|
8
|
-
.array(exports.SingleTagSchema)
|
9
|
-
.max(10)
|
10
|
-
.refine((items) => new Set(items).size === items.length, {
|
11
|
-
message: 'All items must be unique, no duplicate values allowed',
|
12
|
-
})
|
13
|
-
.describe('The updated array of tags');
|
14
|
-
exports.TagsOutputSchema = zod_1.z.object({
|
15
|
-
updatedTags: exports.TagsSchema,
|
16
|
-
explanation: zod_1.z
|
17
|
-
.string()
|
18
|
-
.describe('A readable explanation of the changes made to the tags and why'),
|
19
|
-
});
|
20
|
-
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(exports.TagsOutputSchema);
|
21
|
-
//# sourceMappingURL=types.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/updatePatientTags/config/types.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mEAAuE;AAE1D,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;AAE9D,QAAA,UAAU,GAAG,OAAC;KACxB,KAAK,CAAC,uBAAe,CAAC;KACtB,GAAG,CAAC,EAAE,CAAC;KACP,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,EAAE;IACvD,OAAO,EAAE,uDAAuD;CACjE,CAAC;KACD,QAAQ,CAAC,2BAA2B,CAAC,CAAA;AAE3B,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,WAAW,EAAE,kBAAU;IACvB,WAAW,EAAE,OAAC;SACX,MAAM,EAAE;SACR,QAAQ,CAAC,gEAAgE,CAAC;CAChF,CAAC,CAAA;AAEW,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CAAC,wBAAgB,CAAC,CAAA"}
|