@awell-health/awell-extensions 2.0.18 → 2.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. package/dist/extensions/shelly/actions/index.d.ts +24 -0
  2. package/dist/extensions/shelly/actions/index.js +2 -0
  3. package/dist/extensions/shelly/actions/index.js.map +1 -1
  4. package/dist/extensions/shelly/actions/reviewMedicationExtraction/config/datapoints.d.ts +6 -0
  5. package/dist/extensions/shelly/actions/reviewMedicationExtraction/config/datapoints.js +10 -0
  6. package/dist/extensions/shelly/actions/reviewMedicationExtraction/config/datapoints.js.map +1 -0
  7. package/dist/extensions/shelly/actions/reviewMedicationExtraction/config/fields.d.ts +28 -0
  8. package/dist/extensions/shelly/actions/reviewMedicationExtraction/config/fields.js +40 -0
  9. package/dist/extensions/shelly/actions/reviewMedicationExtraction/config/fields.js.map +1 -0
  10. package/dist/extensions/shelly/actions/reviewMedicationExtraction/config/index.d.ts +2 -0
  11. package/dist/extensions/shelly/actions/reviewMedicationExtraction/config/index.js +9 -0
  12. package/dist/extensions/shelly/actions/reviewMedicationExtraction/config/index.js.map +1 -0
  13. package/dist/extensions/shelly/actions/reviewMedicationExtraction/index.d.ts +1 -0
  14. package/dist/extensions/shelly/actions/reviewMedicationExtraction/index.js +6 -0
  15. package/dist/extensions/shelly/actions/reviewMedicationExtraction/index.js.map +1 -0
  16. package/dist/extensions/shelly/actions/reviewMedicationExtraction/reviewMedicationExtraction.d.ts +4 -0
  17. package/dist/extensions/shelly/actions/reviewMedicationExtraction/reviewMedicationExtraction.js +30 -0
  18. package/dist/extensions/shelly/actions/reviewMedicationExtraction/reviewMedicationExtraction.js.map +1 -0
  19. package/dist/extensions/shelly/actions/reviewMedicationExtraction/reviewMedicationExtraction.test.d.ts +1 -0
  20. package/dist/extensions/shelly/actions/reviewMedicationExtraction/reviewMedicationExtraction.test.js +30 -0
  21. package/dist/extensions/shelly/actions/reviewMedicationExtraction/reviewMedicationExtraction.test.js.map +1 -0
  22. package/package.json +1 -1
@@ -74,5 +74,29 @@ declare const actions: {
74
74
  description: string;
75
75
  };
76
76
  }, "data">;
77
+ reviewMedicationExtraction: import("@awell-health/extensions-core").Action<{
78
+ imageUrl: {
79
+ id: string;
80
+ label: string;
81
+ description: string;
82
+ type: import("@awell-health/extensions-core").FieldType.STRING;
83
+ required: true;
84
+ };
85
+ medicationData: {
86
+ id: string;
87
+ label: string;
88
+ description: string;
89
+ type: import("@awell-health/extensions-core").FieldType.JSON;
90
+ required: true;
91
+ };
92
+ }, {
93
+ openAiApiKey: {
94
+ key: string;
95
+ label: string;
96
+ obfuscated: true;
97
+ required: true;
98
+ description: string;
99
+ };
100
+ }, "validatedData">;
77
101
  };
78
102
  export default actions;
@@ -4,11 +4,13 @@ const summarizeForm_1 = require("./summarizeForm");
4
4
  const categorizeMessage_1 = require("./categorizeMessage");
5
5
  const summarizeCareFlow_1 = require("./summarizeCareFlow");
6
6
  const medicationFromImage_1 = require("./medicationFromImage");
7
+ const reviewMedicationExtraction_1 = require("./reviewMedicationExtraction");
7
8
  const actions = {
8
9
  summarizeForm: summarizeForm_1.summarizeForm,
9
10
  summarizeCareFlow: summarizeCareFlow_1.summarizeCareFlow,
10
11
  categorizeMessage: categorizeMessage_1.categorizeMessage,
11
12
  medicationFromImage: medicationFromImage_1.medicationFromImage,
13
+ reviewMedicationExtraction: reviewMedicationExtraction_1.reviewMedicationExtraction,
12
14
  };
13
15
  exports.default = actions;
14
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/shelly/actions/index.ts"],"names":[],"mappings":";;AAAA,mDAA+C;AAC/C,2DAAuD;AACvD,2DAAuD;AACvD,+DAA2D;AAE3D,MAAM,OAAO,GAAG;IACd,aAAa,EAAb,6BAAa;IACb,iBAAiB,EAAjB,qCAAiB;IACjB,iBAAiB,EAAjB,qCAAiB;IACjB,mBAAmB,EAAnB,yCAAmB;CACpB,CAAA;AAED,kBAAe,OAAO,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/shelly/actions/index.ts"],"names":[],"mappings":";;AAAA,mDAA+C;AAC/C,2DAAuD;AACvD,2DAAuD;AACvD,+DAA2D;AAC3D,6EAAyE;AAEzE,MAAM,OAAO,GAAG;IACd,aAAa,EAAb,6BAAa;IACb,iBAAiB,EAAjB,qCAAiB;IACjB,iBAAiB,EAAjB,qCAAiB;IACjB,mBAAmB,EAAnB,yCAAmB;IACnB,0BAA0B,EAA1B,uDAA0B;CAC3B,CAAA;AAED,kBAAe,OAAO,CAAA"}
@@ -0,0 +1,6 @@
1
+ export declare const dataPoints: {
2
+ validatedData: {
3
+ key: string;
4
+ valueType: "json";
5
+ };
6
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataPoints = void 0;
4
+ exports.dataPoints = {
5
+ validatedData: {
6
+ key: 'validatedData',
7
+ valueType: 'json',
8
+ },
9
+ };
10
+ //# sourceMappingURL=datapoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datapoints.js","sourceRoot":"","sources":["../../../../../../extensions/shelly/actions/reviewMedicationExtraction/config/datapoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,aAAa,EAAE;QACb,GAAG,EAAE,eAAe;QACpB,SAAS,EAAE,MAAM;KAClB;CAC4C,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { FieldType } from '@awell-health/extensions-core';
2
+ import z from 'zod';
3
+ export declare const fields: {
4
+ imageUrl: {
5
+ id: string;
6
+ label: string;
7
+ description: string;
8
+ type: FieldType.STRING;
9
+ required: true;
10
+ };
11
+ medicationData: {
12
+ id: string;
13
+ label: string;
14
+ description: string;
15
+ type: FieldType.JSON;
16
+ required: true;
17
+ };
18
+ };
19
+ export declare const FieldsValidationSchema: z.ZodObject<{
20
+ imageUrl: z.ZodString;
21
+ medicationData: z.ZodEffects<z.ZodString, Record<string, unknown>, string>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ medicationData: Record<string, unknown>;
24
+ imageUrl: string;
25
+ }, {
26
+ medicationData: string;
27
+ imageUrl: string;
28
+ }>;
@@ -0,0 +1,40 @@
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
+ exports.FieldsValidationSchema = exports.fields = void 0;
7
+ const extensions_core_1 = require("@awell-health/extensions-core");
8
+ const core_1 = require("@medplum/core");
9
+ const zod_1 = __importDefault(require("zod"));
10
+ exports.fields = {
11
+ imageUrl: {
12
+ id: 'imageUrl',
13
+ label: 'Image URL',
14
+ description: 'The URL to the uploaded image',
15
+ type: extensions_core_1.FieldType.STRING,
16
+ required: true,
17
+ },
18
+ medicationData: {
19
+ id: 'medicationData',
20
+ label: 'Medication data',
21
+ description: 'The medication data to review',
22
+ type: extensions_core_1.FieldType.JSON,
23
+ required: true,
24
+ },
25
+ };
26
+ exports.FieldsValidationSchema = zod_1.default.object({
27
+ imageUrl: zod_1.default.string().url(),
28
+ medicationData: zod_1.default.string().transform((str, ctx) => {
29
+ if ((0, core_1.isEmpty)(str))
30
+ return {};
31
+ try {
32
+ return JSON.parse(str);
33
+ }
34
+ catch (e) {
35
+ ctx.addIssue({ code: 'custom', message: 'Invalid JSON' });
36
+ return zod_1.default.NEVER;
37
+ }
38
+ }),
39
+ });
40
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/shelly/actions/reviewMedicationExtraction/config/fields.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,wCAAuC;AACvC,8CAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,+BAA+B;QAC5C,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,cAAc,EAAE;QACd,EAAE,EAAE,gBAAgB;QACpB,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,+BAA+B;QAC5C,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC7C,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC1B,cAAc,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,GAAG,EAA2B,EAAE;QACzE,IAAI,IAAA,cAAO,EAAC,GAAG,CAAC;YAAE,OAAO,EAAE,CAAA;QAE3B,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;SACvB;QAAC,OAAO,CAAC,EAAE;YACV,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAA;YACzD,OAAO,aAAC,CAAC,KAAK,CAAA;SACf;IACH,CAAC,CAAC;CAC+C,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { fields, FieldsValidationSchema } from './fields';
2
+ export { dataPoints } from './datapoints';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataPoints = exports.FieldsValidationSchema = exports.fields = void 0;
4
+ var fields_1 = require("./fields");
5
+ Object.defineProperty(exports, "fields", { enumerable: true, get: function () { return fields_1.fields; } });
6
+ Object.defineProperty(exports, "FieldsValidationSchema", { enumerable: true, get: function () { return fields_1.FieldsValidationSchema; } });
7
+ var datapoints_1 = require("./datapoints");
8
+ Object.defineProperty(exports, "dataPoints", { enumerable: true, get: function () { return datapoints_1.dataPoints; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/shelly/actions/reviewMedicationExtraction/config/index.ts"],"names":[],"mappings":";;;AAAA,mCAAyD;AAAhD,gGAAA,MAAM,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AACvC,2CAAyC;AAAhC,wGAAA,UAAU,OAAA"}
@@ -0,0 +1 @@
1
+ export { reviewMedicationExtraction } from './reviewMedicationExtraction';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reviewMedicationExtraction = void 0;
4
+ var reviewMedicationExtraction_1 = require("./reviewMedicationExtraction");
5
+ Object.defineProperty(exports, "reviewMedicationExtraction", { enumerable: true, get: function () { return reviewMedicationExtraction_1.reviewMedicationExtraction; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/reviewMedicationExtraction/index.ts"],"names":[],"mappings":";;;AAAA,2EAAyE;AAAhE,wIAAA,0BAA0B,OAAA"}
@@ -0,0 +1,4 @@
1
+ import { type Action } from '@awell-health/extensions-core';
2
+ import { type settings } from '../../settings';
3
+ import { fields, dataPoints } from './config';
4
+ export declare const reviewMedicationExtraction: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reviewMedicationExtraction = void 0;
4
+ // import { AwellSdk } from '@awell-health/awell-sdk'
5
+ const extensions_core_1 = require("@awell-health/extensions-core");
6
+ const lib_1 = require("../../lib");
7
+ const config_1 = require("./config");
8
+ exports.reviewMedicationExtraction = {
9
+ key: 'reviewMedicationExtraction',
10
+ category: extensions_core_1.Category.WORKFLOW,
11
+ title: 'Review medication extraction',
12
+ description: 'Allow a stakeholder to review the medication extraction',
13
+ fields: config_1.fields,
14
+ previewable: false,
15
+ dataPoints: config_1.dataPoints,
16
+ options: {
17
+ stakeholders: {
18
+ label: 'Stakeholder',
19
+ mode: 'single',
20
+ },
21
+ },
22
+ onEvent: async ({ payload, onComplete, onError, helpers }) => {
23
+ await (0, lib_1.validatePayloadAndCreateSdk)({
24
+ fieldsSchema: config_1.FieldsValidationSchema,
25
+ payload,
26
+ });
27
+ // Completion in Hosted Pages
28
+ },
29
+ };
30
+ //# sourceMappingURL=reviewMedicationExtraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reviewMedicationExtraction.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/reviewMedicationExtraction/reviewMedicationExtraction.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,mEAAqE;AACrE,mCAAuD;AAEvD,qCAAqE;AAExD,QAAA,0BAA0B,GAInC;IACF,GAAG,EAAE,4BAA4B;IACjC,QAAQ,EAAE,0BAAQ,CAAC,QAAQ;IAC3B,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,yDAAyD;IACtE,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,OAAO,EAAE;QACP,YAAY,EAAE;YACZ,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,QAAQ;SACf;KACF;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAiB,EAAE;QAC1E,MAAM,IAAA,iCAA2B,EAAC;YAChC,YAAY,EAAE,+BAAsB;YACpC,OAAO;SACR,CAAC,CAAA;QAEF,6BAA6B;IAC/B,CAAC;CACF,CAAA"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const extensions_core_1 = require("@awell-health/extensions-core");
4
+ const tests_1 = require("@/tests");
5
+ const _1 = require(".");
6
+ describe('Shelly - Review medication extraction', () => {
7
+ const { onComplete, onError, helpers, extensionAction, clearMocks } = extensions_core_1.TestHelpers.fromAction(_1.reviewMedicationExtraction);
8
+ beforeEach(() => {
9
+ clearMocks();
10
+ });
11
+ test('Should work', async () => {
12
+ await extensionAction.onEvent({
13
+ payload: (0, tests_1.generateTestPayload)({
14
+ fields: {
15
+ imageUrl: 'https://res.cloudinary.com/da7x4rzl4/image/upload/v1726601981/hackathon-sep-2024/seqn5izsagvs5nlferlf.png',
16
+ medicationData: JSON.stringify({}),
17
+ },
18
+ settings: {
19
+ openAiApiKey: 'a',
20
+ },
21
+ }),
22
+ onComplete,
23
+ onError,
24
+ helpers,
25
+ });
26
+ expect(onError).not.toHaveBeenCalled();
27
+ expect(onComplete).not.toHaveBeenCalled();
28
+ });
29
+ });
30
+ //# sourceMappingURL=reviewMedicationExtraction.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reviewMedicationExtraction.test.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/reviewMedicationExtraction/reviewMedicationExtraction.test.ts"],"names":[],"mappings":";;AAAA,mEAA2D;AAC3D,mCAA6C;AAC7C,wBAA8C;AAE9C,QAAQ,CAAC,uCAAuC,EAAE,GAAG,EAAE;IACrD,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,GACjE,6BAAW,CAAC,UAAU,CAAC,6BAA0B,CAAC,CAAA;IAEpD,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,EAAE,CAAA;IACd,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE;QAC7B,MAAM,eAAe,CAAC,OAAO,CAAC;YAC5B,OAAO,EAAE,IAAA,2BAAmB,EAAC;gBAC3B,MAAM,EAAE;oBACN,QAAQ,EACN,2GAA2G;oBAC7G,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;iBACnC;gBACD,QAAQ,EAAE;oBACR,YAAY,EAAE,GAAG;iBAClB;aACF,CAAC;YACF,UAAU;YACV,OAAO;YACP,OAAO;SACR,CAAC,CAAA;QAEF,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;QACtC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IAC3C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "2.0.18",
3
+ "version": "2.0.19",
4
4
  "packageManager": "yarn@3.4.1",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {