@awell-health/awell-extensions 1.0.190 → 1.0.192
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/extensions/icd/actions/index.d.ts +11 -0
- package/dist/extensions/icd/actions/index.js +7 -0
- package/dist/extensions/icd/actions/index.js.map +1 -0
- package/dist/extensions/icd/actions/tfu/config/dataPoints.d.ts +10 -0
- package/dist/extensions/icd/actions/tfu/config/dataPoints.js +14 -0
- package/dist/extensions/icd/actions/tfu/config/dataPoints.js.map +1 -0
- package/dist/extensions/icd/actions/tfu/config/fields.d.ts +25 -0
- package/dist/extensions/icd/actions/tfu/config/fields.js +44 -0
- package/dist/extensions/icd/actions/tfu/config/fields.js.map +1 -0
- package/dist/extensions/icd/actions/tfu/config/helperFunctions.d.ts +1 -0
- package/dist/extensions/icd/actions/tfu/config/helperFunctions.js +22 -0
- package/dist/extensions/icd/actions/tfu/config/helperFunctions.js.map +1 -0
- package/dist/extensions/icd/actions/tfu/icd.d.ts +6 -0
- package/dist/extensions/icd/actions/tfu/icd.js +56 -0
- package/dist/extensions/icd/actions/tfu/icd.js.map +1 -0
- package/dist/extensions/icd/actions/tfu/index.d.ts +1 -0
- package/dist/extensions/icd/actions/tfu/index.js +18 -0
- package/dist/extensions/icd/actions/tfu/index.js.map +1 -0
- package/dist/extensions/icd/client.d.ts +83 -0
- package/dist/extensions/icd/client.js +74 -0
- package/dist/extensions/icd/client.js.map +1 -0
- package/dist/extensions/icd/index.d.ts +2 -0
- package/dist/extensions/icd/index.js +21 -0
- package/dist/extensions/icd/index.js.map +1 -0
- package/dist/extensions/index.js +2 -0
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/markdown.json +4 -0
- package/package.json +2 -2
@@ -0,0 +1,11 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
icd: import("@awell-health/extensions-core").Action<{
|
3
|
+
icd_codes: {
|
4
|
+
id: string;
|
5
|
+
label: string;
|
6
|
+
description: string;
|
7
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
8
|
+
};
|
9
|
+
}, {}, "codes" | "stringResponse", never>;
|
10
|
+
};
|
11
|
+
export default _default;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/icd/actions/index.ts"],"names":[],"mappings":";;AAAA,+BAA2B;AAE3B,kBAAe;IACb,GAAG,EAAH,SAAG;CACJ,CAAA"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.dataPoints = void 0;
|
4
|
+
exports.dataPoints = {
|
5
|
+
codes: {
|
6
|
+
key: 'codes',
|
7
|
+
valueType: 'strings_array',
|
8
|
+
},
|
9
|
+
stringResponse: {
|
10
|
+
key: 'stringResponse',
|
11
|
+
valueType: 'string',
|
12
|
+
},
|
13
|
+
};
|
14
|
+
//# sourceMappingURL=dataPoints.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../extensions/icd/actions/tfu/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,KAAK,EAAE;QACL,GAAG,EAAE,OAAO;QACZ,SAAS,EAAE,eAAe;KAC3B;IACD,cAAc,EAAE;QACd,GAAG,EAAE,gBAAgB;QACrB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { FieldType } from '@awell-health/extensions-core';
|
2
|
+
import { z } from 'zod';
|
3
|
+
export declare const fields: {
|
4
|
+
icd_codes: {
|
5
|
+
id: string;
|
6
|
+
label: string;
|
7
|
+
description: string;
|
8
|
+
type: FieldType.STRING;
|
9
|
+
};
|
10
|
+
};
|
11
|
+
export declare const FieldSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
12
|
+
icd_codes: z.ZodString;
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
14
|
+
icd_codes: string;
|
15
|
+
}, {
|
16
|
+
icd_codes: string;
|
17
|
+
}>, {
|
18
|
+
icd_codes: any;
|
19
|
+
}, {
|
20
|
+
icd_codes: string;
|
21
|
+
}>, {
|
22
|
+
icd_codes: any;
|
23
|
+
}, {
|
24
|
+
icd_codes: string;
|
25
|
+
}>;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.FieldSchema = exports.fields = void 0;
|
4
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
5
|
+
const zod_1 = require("zod");
|
6
|
+
exports.fields = {
|
7
|
+
icd_codes: {
|
8
|
+
id: 'icd_codes',
|
9
|
+
label: 'ICD Codes',
|
10
|
+
description: "A comma-separated list of ICD-10 codes (e.g. 'E12.1, E14, H10', etc.)",
|
11
|
+
type: extensions_core_1.FieldType.STRING,
|
12
|
+
},
|
13
|
+
};
|
14
|
+
exports.FieldSchema = zod_1.z
|
15
|
+
.object({
|
16
|
+
icd_codes: zod_1.z.string(),
|
17
|
+
})
|
18
|
+
.transform((data) => {
|
19
|
+
const codesArray = JSON.parse(data.icd_codes);
|
20
|
+
const codes = codesArray
|
21
|
+
.map((code) => code.trim().split('.')[0])
|
22
|
+
.filter((code) => code !== '');
|
23
|
+
return {
|
24
|
+
icd_codes: codes,
|
25
|
+
};
|
26
|
+
})
|
27
|
+
.superRefine((data, ctx) => {
|
28
|
+
if (data.icd_codes.length === 0) {
|
29
|
+
return {
|
30
|
+
icd_codes: [],
|
31
|
+
};
|
32
|
+
}
|
33
|
+
data.icd_codes.forEach((c) => {
|
34
|
+
const isValid = c.match(/^[A-Z]\d{2}$/);
|
35
|
+
if (isValid === null) {
|
36
|
+
ctx.addIssue({
|
37
|
+
message: `${c} is an invalid ICD-10 code`,
|
38
|
+
fatal: true,
|
39
|
+
code: 'custom',
|
40
|
+
});
|
41
|
+
}
|
42
|
+
});
|
43
|
+
});
|
44
|
+
//# sourceMappingURL=fields.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/icd/actions/tfu/config/fields.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,6BAAuB;AAEV,QAAA,MAAM,GAAG;IACpB,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,WAAW;QAClB,WAAW,EACT,uEAAuE;QACzE,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;CAC8B,CAAA;AAEpB,QAAA,WAAW,GAAG,OAAC;KACzB,MAAM,CAAC;IACN,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;CACtB,CAAC;KACD,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;IAClB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC7C,MAAM,KAAK,GAAG,UAAU;SACrB,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAChD,MAAM,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAA;IACxC,OAAO;QACL,SAAS,EAAE,KAAK;KACjB,CAAA;AACH,CAAC,CAAC;KACD,WAAW,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;IACzB,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QAC/B,OAAO;YACL,SAAS,EAAE,EAAE;SACd,CAAA;KACF;IACD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAS,EAAE,EAAE;QACnC,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QACvC,IAAI,OAAO,KAAK,IAAI,EAAE;YACpB,GAAG,CAAC,QAAQ,CAAC;gBACX,OAAO,EAAE,GAAG,CAAC,4BAA4B;gBACzC,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,QAAQ;aACf,CAAC,CAAA;SACH;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const checkICDCode: (code: string) => boolean;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.checkICDCode = void 0;
|
4
|
+
const checkICDCode = (code) => {
|
5
|
+
const diseases = [
|
6
|
+
'hypertension',
|
7
|
+
'asthma',
|
8
|
+
'diabetes mellitus',
|
9
|
+
'heart failure',
|
10
|
+
'copd',
|
11
|
+
'cad',
|
12
|
+
'coronary artery disease',
|
13
|
+
];
|
14
|
+
if (diseases.includes(code.toLowerCase())) {
|
15
|
+
return true;
|
16
|
+
}
|
17
|
+
else {
|
18
|
+
return false;
|
19
|
+
}
|
20
|
+
};
|
21
|
+
exports.checkICDCode = checkICDCode;
|
22
|
+
//# sourceMappingURL=helperFunctions.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helperFunctions.js","sourceRoot":"","sources":["../../../../../../extensions/icd/actions/tfu/config/helperFunctions.ts"],"names":[],"mappings":";;;AAAO,MAAM,YAAY,GAAG,CAAC,IAAY,EAAW,EAAE;IACpD,MAAM,QAAQ,GAAG;QACf,cAAc;QACd,QAAQ;QACR,mBAAmB;QACnB,eAAe;QACf,MAAM;QACN,KAAK;QACL,yBAAyB;KAC1B,CAAA;IACD,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE;QACzC,OAAO,IAAI,CAAA;KACZ;SAAM;QACL,OAAO,KAAK,CAAA;KACb;AACH,CAAC,CAAA;AAfY,QAAA,YAAY,gBAexB"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { type Action } from '@awell-health/extensions-core';
|
2
|
+
import { fields } from './config/fields';
|
3
|
+
import { dataPoints } from './config/dataPoints';
|
4
|
+
declare const settings: {};
|
5
|
+
export declare const icd: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
|
6
|
+
export {};
|
@@ -0,0 +1,56 @@
|
|
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.icd = void 0;
|
7
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
8
|
+
const zod_1 = __importDefault(require("zod"));
|
9
|
+
const fields_1 = require("./config/fields");
|
10
|
+
const dataPoints_1 = require("./config/dataPoints");
|
11
|
+
const client_1 = require("../../client");
|
12
|
+
const helperFunctions_1 = require("./config/helperFunctions");
|
13
|
+
const settings = {};
|
14
|
+
const SettingSchema = zod_1.default.unknown();
|
15
|
+
const PayloadSchema = zod_1.default.object({
|
16
|
+
fields: fields_1.FieldSchema,
|
17
|
+
settings: SettingSchema,
|
18
|
+
});
|
19
|
+
exports.icd = {
|
20
|
+
key: 'icd',
|
21
|
+
category: extensions_core_1.Category.DATA,
|
22
|
+
title: 'ICD-10 Code Lookup',
|
23
|
+
description: 'Lookup ICD-10 codes and return the parent disease',
|
24
|
+
fields: fields_1.fields,
|
25
|
+
previewable: true,
|
26
|
+
dataPoints: dataPoints_1.dataPoints,
|
27
|
+
onActivityCreated: async (payload, onComplete) => {
|
28
|
+
const { fields: { icd_codes }, } = PayloadSchema.parse(payload);
|
29
|
+
// if no codes, just return blank
|
30
|
+
if (icd_codes.length === 0) {
|
31
|
+
await onComplete({
|
32
|
+
data_points: {
|
33
|
+
codes: JSON.stringify([]),
|
34
|
+
stringResponse: 'Blank',
|
35
|
+
},
|
36
|
+
});
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
const IDPClient = (0, client_1.makeAPIClient)();
|
40
|
+
const icdCodes = await Promise.all(icd_codes.map(async (code) => {
|
41
|
+
const response = await IDPClient.getCode(code);
|
42
|
+
if (response.parent !== undefined) {
|
43
|
+
const parent = await IDPClient.getCode(response.parent);
|
44
|
+
return parent.title;
|
45
|
+
}
|
46
|
+
}));
|
47
|
+
const resp = icdCodes.some(helperFunctions_1.checkICDCode);
|
48
|
+
await onComplete({
|
49
|
+
data_points: {
|
50
|
+
codes: JSON.stringify(icdCodes),
|
51
|
+
stringResponse: resp ? 'TFU' : 'TCM',
|
52
|
+
},
|
53
|
+
});
|
54
|
+
},
|
55
|
+
};
|
56
|
+
//# sourceMappingURL=icd.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"icd.js","sourceRoot":"","sources":["../../../../../extensions/icd/actions/tfu/icd.ts"],"names":[],"mappings":";;;;;;AACA,mEAAwD;AACxD,8CAAmB;AACnB,4CAAqD;AACrD,oDAAgD;AAChD,yCAA4C;AAC5C,8DAAuD;AAEvD,MAAM,QAAQ,GAAG,EAAoC,CAAA;AACrD,MAAM,aAAa,GAAG,aAAC,CAAC,OAAO,EAAE,CAAA;AAEjC,MAAM,aAAa,GAAG,aAAC,CAAC,MAAM,CAAC;IAC7B,MAAM,EAAE,oBAAW;IACnB,QAAQ,EAAE,aAAa;CACxB,CAAC,CAAA;AAEW,QAAA,GAAG,GAIZ;IACF,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,0BAAQ,CAAC,IAAI;IACvB,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EAAE,mDAAmD;IAChE,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,IAAI;IACjB,UAAU,EAAV,uBAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAiB,EAAE;QAC9D,MAAM,EACJ,MAAM,EAAE,EAAE,SAAS,EAAE,GACtB,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAChC,iCAAiC;QACjC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1B,MAAM,UAAU,CAAC;gBACf,WAAW,EAAE;oBACX,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;oBACzB,cAAc,EAAE,OAAO;iBACxB;aACF,CAAC,CAAA;YACF,OAAM;SACP;QAED,MAAM,SAAS,GAAG,IAAA,sBAAa,GAAE,CAAA;QACjC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAChC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;YACnC,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;YAC9C,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE;gBACjC,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;gBACvD,OAAO,MAAM,CAAC,KAAK,CAAA;aACpB;QACH,CAAC,CAAC,CACH,CAAA;QAED,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,8BAAY,CAAC,CAAA;QAExC,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;gBAC/B,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK;aACrC;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './icd';
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./icd"), exports);
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/icd/actions/tfu/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB"}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { APIClient, DataWrapper, type OAuthGrantClientCredentialsRequest, type DataWrapperCtor } from '@awell-health/extensions-core';
|
2
|
+
import z from 'zod';
|
3
|
+
type ICDOutput = z.output<typeof ICDSchema>;
|
4
|
+
export declare class ICDDataWrapper extends DataWrapper {
|
5
|
+
getCode(code: string): Promise<ICDOutput>;
|
6
|
+
}
|
7
|
+
interface ICDAPIClientConstructorProps {
|
8
|
+
authUrl: string;
|
9
|
+
requestConfig: Omit<OAuthGrantClientCredentialsRequest, 'client_credentials'>;
|
10
|
+
baseUrl: string;
|
11
|
+
headers: Record<string, string>;
|
12
|
+
}
|
13
|
+
export declare class ICDAPIClient extends APIClient<ICDDataWrapper> {
|
14
|
+
readonly ctor: DataWrapperCtor<ICDDataWrapper>;
|
15
|
+
constructor({ authUrl, requestConfig, ...opts }: ICDAPIClientConstructorProps);
|
16
|
+
getCode(code: string): Promise<ICDOutput>;
|
17
|
+
}
|
18
|
+
export declare const makeAPIClient: () => ICDAPIClient;
|
19
|
+
declare const ICDSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
20
|
+
parent: z.ZodArray<z.ZodString, "many">;
|
21
|
+
title: z.ZodObject<{
|
22
|
+
'@language': z.ZodString;
|
23
|
+
'@value': z.ZodString;
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
25
|
+
'@language': string;
|
26
|
+
'@value': string;
|
27
|
+
}, {
|
28
|
+
'@language': string;
|
29
|
+
'@value': string;
|
30
|
+
}>;
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
32
|
+
title: {
|
33
|
+
'@language': string;
|
34
|
+
'@value': string;
|
35
|
+
};
|
36
|
+
parent: string[];
|
37
|
+
}, {
|
38
|
+
title: {
|
39
|
+
'@language': string;
|
40
|
+
'@value': string;
|
41
|
+
};
|
42
|
+
parent: string[];
|
43
|
+
}>, {
|
44
|
+
title: {
|
45
|
+
'@language': string;
|
46
|
+
'@value': string;
|
47
|
+
};
|
48
|
+
parent: string[];
|
49
|
+
}, {
|
50
|
+
title: {
|
51
|
+
'@language': string;
|
52
|
+
'@value': string;
|
53
|
+
};
|
54
|
+
parent: string[];
|
55
|
+
}>, {
|
56
|
+
parent: string | undefined;
|
57
|
+
title: string;
|
58
|
+
}, {
|
59
|
+
title: {
|
60
|
+
'@language': string;
|
61
|
+
'@value': string;
|
62
|
+
};
|
63
|
+
parent: string[];
|
64
|
+
}>, {
|
65
|
+
parent: string | undefined;
|
66
|
+
title: string;
|
67
|
+
}, {
|
68
|
+
title: {
|
69
|
+
'@language': string;
|
70
|
+
'@value': string;
|
71
|
+
};
|
72
|
+
parent: string[];
|
73
|
+
}>, {
|
74
|
+
parent: string | undefined;
|
75
|
+
title: string;
|
76
|
+
}, {
|
77
|
+
title: {
|
78
|
+
'@language': string;
|
79
|
+
'@value': string;
|
80
|
+
};
|
81
|
+
parent: string[];
|
82
|
+
}>;
|
83
|
+
export {};
|
@@ -0,0 +1,74 @@
|
|
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.makeAPIClient = exports.ICDAPIClient = exports.ICDDataWrapper = void 0;
|
7
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
8
|
+
const zod_1 = __importDefault(require("zod"));
|
9
|
+
const lodash_1 = require("lodash");
|
10
|
+
class ICDDataWrapper extends extensions_core_1.DataWrapper {
|
11
|
+
async getCode(code) {
|
12
|
+
const req = this.Request({
|
13
|
+
method: 'GET',
|
14
|
+
url: `release/10/2019/${code}`,
|
15
|
+
headers: {
|
16
|
+
'Accept-Language': 'en',
|
17
|
+
'API-Version': 'v2',
|
18
|
+
},
|
19
|
+
});
|
20
|
+
const res = await req;
|
21
|
+
return ICDSchema.parse(res);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
exports.ICDDataWrapper = ICDDataWrapper;
|
25
|
+
class ICDAPIClient extends extensions_core_1.APIClient {
|
26
|
+
constructor({ authUrl, requestConfig, ...opts }) {
|
27
|
+
super({
|
28
|
+
...opts,
|
29
|
+
auth: new extensions_core_1.OAuthClientCredentials({
|
30
|
+
auth_url: authUrl,
|
31
|
+
request_config: requestConfig,
|
32
|
+
}),
|
33
|
+
});
|
34
|
+
this.ctor = (token, baseUrl) => new ICDDataWrapper(token, baseUrl);
|
35
|
+
}
|
36
|
+
async getCode(code) {
|
37
|
+
return await this.FetchData(async (dw) => await dw.getCode(code));
|
38
|
+
}
|
39
|
+
}
|
40
|
+
exports.ICDAPIClient = ICDAPIClient;
|
41
|
+
const makeAPIClient = () => {
|
42
|
+
return new ICDAPIClient({
|
43
|
+
authUrl: 'https://icdaccessmanagement.who.int/connect/token',
|
44
|
+
requestConfig: {
|
45
|
+
client_id: 'ee7ba0bd-5da7-4c9a-8623-6084fa92d8d0_7a6a5bb2-2dde-4a6b-b104-04aec6387536',
|
46
|
+
client_secret: 'Dz2n/CzI/EYFMKgqgBRZa0zZjkUUZYFEf8lh1EbAS4I=',
|
47
|
+
scope: 'icdapi_access',
|
48
|
+
grant_type: 'client_credentials',
|
49
|
+
},
|
50
|
+
baseUrl: 'https://id.who.int/icd/',
|
51
|
+
headers: {
|
52
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
53
|
+
},
|
54
|
+
});
|
55
|
+
};
|
56
|
+
exports.makeAPIClient = makeAPIClient;
|
57
|
+
const ICDSchema = zod_1.default
|
58
|
+
.object({
|
59
|
+
parent: zod_1.default.array(zod_1.default.string()),
|
60
|
+
title: zod_1.default.object({
|
61
|
+
'@language': zod_1.default.string(),
|
62
|
+
'@value': zod_1.default.string(),
|
63
|
+
}),
|
64
|
+
})
|
65
|
+
.refine(({ parent }) => parent.length !== 0)
|
66
|
+
.transform((data) => {
|
67
|
+
return {
|
68
|
+
parent: data.parent[0].split('/').pop(),
|
69
|
+
title: data.title['@value'],
|
70
|
+
};
|
71
|
+
})
|
72
|
+
.refine(({ parent }) => !(0, lodash_1.isNil)(parent) && !(0, lodash_1.isEmpty)(parent))
|
73
|
+
.refine(({ title }) => !(0, lodash_1.isNil)(title) && !(0, lodash_1.isEmpty)(title));
|
74
|
+
//# sourceMappingURL=client.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../extensions/icd/client.ts"],"names":[],"mappings":";;;;;;AAAA,mEAMsC;AACtC,8CAAmB;AACnB,mCAAuC;AAKvC,MAAa,cAAe,SAAQ,6BAAW;IACtC,KAAK,CAAC,OAAO,CAAC,IAAY;QAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAc;YACpC,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,mBAAmB,IAAI,EAAE;YAC9B,OAAO,EAAE;gBACP,iBAAiB,EAAE,IAAI;gBACvB,aAAa,EAAE,IAAI;aACpB;SACF,CAAC,CAAA;QACF,MAAM,GAAG,GAAG,MAAM,GAAG,CAAA;QACrB,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC7B,CAAC;CACF;AAbD,wCAaC;AASD,MAAa,YAAa,SAAQ,2BAAyB;IAMzD,YAAmB,EACjB,OAAO,EACP,aAAa,EACb,GAAG,IAAI,EACsB;QAC7B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,IAAI,EAAE,IAAI,wCAAsB,CAAC;gBAC/B,QAAQ,EAAE,OAAO;gBACjB,cAAc,EAAE,aAAa;aAC9B,CAAC;SACH,CAAC,CAAA;QAhBK,SAAI,GAAoC,CAC/C,KAAa,EACb,OAAe,EACf,EAAE,CAAC,IAAI,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAcvC,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAY;QAC/B,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IACnE,CAAC;CACF;AAvBD,oCAuBC;AAEM,MAAM,aAAa,GAAG,GAAiB,EAAE;IAC9C,OAAO,IAAI,YAAY,CAAC;QACtB,OAAO,EAAE,mDAAmD;QAC5D,aAAa,EAAE;YACb,SAAS,EACP,2EAA2E;YAC7E,aAAa,EAAE,8CAA8C;YAC7D,KAAK,EAAE,eAAe;YACtB,UAAU,EAAE,oBAAoB;SACjC;QACD,OAAO,EAAE,yBAAyB;QAClC,OAAO,EAAE;YACP,cAAc,EAAE,mCAAmC;SACpD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAfY,QAAA,aAAa,iBAezB;AAED,MAAM,SAAS,GAAG,aAAC;KAChB,MAAM,CAAC;IACN,MAAM,EAAE,aAAC,CAAC,KAAK,CAAC,aAAC,CAAC,MAAM,EAAE,CAAC;IAC3B,KAAK,EAAE,aAAC,CAAC,MAAM,CAAC;QACd,WAAW,EAAE,aAAC,CAAC,MAAM,EAAE;QACvB,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE;KACrB,CAAC;CACH,CAAC;KACD,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;KAC3C,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;IAClB,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;QACvC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;KAC5B,CAAA;AACH,CAAC,CAAC;KACD,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,IAAA,cAAK,EAAC,MAAM,CAAC,IAAI,CAAC,IAAA,gBAAO,EAAC,MAAM,CAAC,CAAC;KAC1D,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,IAAA,cAAK,EAAC,KAAK,CAAC,IAAI,CAAC,IAAA,gBAAO,EAAC,KAAK,CAAC,CAAC,CAAA"}
|
@@ -0,0 +1,21 @@
|
|
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.icd = void 0;
|
7
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
8
|
+
const actions_1 = __importDefault(require("./actions"));
|
9
|
+
exports.icd = {
|
10
|
+
key: 'icd',
|
11
|
+
title: 'An ICD extension!',
|
12
|
+
description: 'An example extension developers can look at to get started with building their first extension.',
|
13
|
+
icon_url: 'https://res.cloudinary.com/da7x4rzl4/image/upload/v1678870116/Awell%20Extensions/Awell_Logo.png',
|
14
|
+
category: extensions_core_1.Category.DATA,
|
15
|
+
author: {
|
16
|
+
authorType: extensions_core_1.AuthorType.AWELL,
|
17
|
+
},
|
18
|
+
settings: {},
|
19
|
+
actions: actions_1.default,
|
20
|
+
};
|
21
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../extensions/icd/index.ts"],"names":[],"mappings":";;;;;;AACA,mEAAoE;AACpE,wDAA+B;AAElB,QAAA,GAAG,GAAc;IAC5B,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EACT,iGAAiG;IACnG,QAAQ,EACN,iGAAiG;IACnG,QAAQ,EAAE,0BAAQ,CAAC,IAAI;IACvB,MAAM,EAAE;QACN,UAAU,EAAE,4BAAU,CAAC,KAAK;KAC7B;IACD,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAP,iBAAO;CACR,CAAA"}
|
package/dist/extensions/index.js
CHANGED
@@ -54,6 +54,7 @@ const westFax_1 = require("./westFax");
|
|
54
54
|
const nexuzhealth_1 = require("./nexuzhealth");
|
55
55
|
const collectData_1 = require("./collectData");
|
56
56
|
const athenahealth_1 = require("./athenahealth");
|
57
|
+
const icd_1 = require("./icd");
|
57
58
|
const json = __importStar(require("./markdown.json"));
|
58
59
|
const external_server_1 = require("./external-server");
|
59
60
|
exports.markdown = json;
|
@@ -76,6 +77,7 @@ exports.extensions = [
|
|
76
77
|
formsort_1.Formsort,
|
77
78
|
healthie_1.Healthie,
|
78
79
|
hello_world_1.HelloWorld,
|
80
|
+
icd_1.icd,
|
79
81
|
infobip_1.Infobip,
|
80
82
|
iterable_1.Iterable,
|
81
83
|
mailchimp_1.Mailchimp,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../extensions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,mCAA+B;AAC/B,2CAAuC;AACvC,yCAAqC;AACrC,mDAA+C;AAC/C,6CAAyC;AACzC,+CAA2C;AAC3C,uCAAmC;AACnC,yCAAqC;AACrC,yCAAqC;AACrC,+CAA0C;AAC1C,2CAAuC;AACvC,uCAAmC;AACnC,iCAAsC;AACtC,+CAA2C;AAC3C,2CAAuC;AACvC,qCAAiC;AACjC,+CAA+C;AAC/C,6DAA+C;AAC/C,yCAAqC;AACrC,yCAAqC;AACrC,yCAAqC;AACrC,2CAAuC;AACvC,yCAAqC;AACrC,uCAAmC;AACnC,uCAAmC;AACnC,uCAAmC;AACnC,+CAA2C;AAC3C,+CAA2C;AAC3C,iDAA6C;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../extensions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,mCAA+B;AAC/B,2CAAuC;AACvC,yCAAqC;AACrC,mDAA+C;AAC/C,6CAAyC;AACzC,+CAA2C;AAC3C,uCAAmC;AACnC,yCAAqC;AACrC,yCAAqC;AACrC,+CAA0C;AAC1C,2CAAuC;AACvC,uCAAmC;AACnC,iCAAsC;AACtC,+CAA2C;AAC3C,2CAAuC;AACvC,qCAAiC;AACjC,+CAA+C;AAC/C,6DAA+C;AAC/C,yCAAqC;AACrC,yCAAqC;AACrC,yCAAqC;AACrC,2CAAuC;AACvC,yCAAqC;AACrC,uCAAmC;AACnC,uCAAmC;AACnC,uCAAmC;AACnC,+CAA2C;AAC3C,+CAA2C;AAC3C,iDAA6C;AAC7C,+BAA2B;AAE3B,sDAAuC;AACvC,uDAAkD;AAGrC,QAAA,QAAQ,GAAa,IAAI,CAAA;AAEzB,QAAA,UAAU,GAAG;IACxB,oFAAoF;IACpF,4CAA4C;IAC5C,aAAa;IACb,aAAK;IACL,2BAAY;IACZ,qBAAS;IACT,mBAAQ;IACR,6BAAa;IACb,uBAAU;IACV,mBAAQ;IACR,yBAAW;IACX,mBAAQ;IACR,yBAAW;IACX,iBAAO;IACP,gCAAc;IACd,mBAAQ;IACR,mBAAQ;IACR,wBAAU;IACV,SAAG;IACH,iBAAO;IACP,mBAAQ;IACR,qBAAS;IACT,iBAAO;IACP,oBAAa;IACb,yBAAW;IACX,qBAAS;IACT,yBAAW;IACX,mBAAQ;IACR,6BAAQ;IACR,qBAAS;IACT,eAAM;IACN,YAAY;IACZ,iBAAO;IACP,iBAAO;CACR,CAAA"}
|
@@ -63,6 +63,10 @@
|
|
63
63
|
"readme": "---\ntitle: Hello world\ndescription: This is an example extension.\n---\n# Hello world extension",
|
64
64
|
"changelog": "# Hello world changelog"
|
65
65
|
},
|
66
|
+
"icd": {
|
67
|
+
"readme": "---\ntitle: ICD-10\ndescription: ICD-10 allows programmatic access to the International Classification of Diseases (ICD).\n---\n\n# ICD-10 API\n\nICD API allows programmatic access to the International Classification of Diseases (ICD). It is an HTTP based REST API. You may use this site to access up to date documentation on using the API as well as managing the keys needed for using the API.\n\nLearn more [here](https://icd.who.int/icdapi)\n\n## ICD-10 x Awell\n\nThis extension allows you to get the name of the diseases based on its ICD.\n\n## Extension settings\n\nThis is a DEMO extension, so no settings are required.\n\n## Custom Actions\n\n## ICD-10 Code Lookup\nLookup ICD-10 codes and return the parent disease\n\n\n\n",
|
68
|
+
"changelog": "# ICD-10 changelog\n\n## v2 2024-02-26\n\n1. Add capability to get name of the diseases from the ICD-10 code.\n"
|
69
|
+
},
|
66
70
|
"infobip": {
|
67
71
|
"readme": "---\ntitle: Infobip\ndescription: Infobip is a global cloud communications platform that provides a wide range of communication and customer engagement solutions for businesses.\n---\n\n# Infobip\n\nInfobip is a global cloud communications platform that provides a wide range of communication and customer engagement solutions for businesses. The company offers a suite of services and tools designed to help organizations connect with their customers, clients, and partners through various communication channels, including SMS, email, voice, chat apps, and more.\n\n## Extension settings\n\nIn order to set up this extension, you will minimally need to provide:\n\n1. Your unique API [base URL](https://www.infobip.com/docs/essentials/base-url)\n2. An [API key](https://www.infobip.com/docs/essentials/api-authentication)\n\nWhen utilizing the Infobip extension for sending emails and text messages, you'll need a 'from email' address and a 'from phone number' respectively.\n\n## Actions\n\n### Send SMS\n\nSend a text message to a recipient.\n\n### Send email\n\nSends a simple email to a recipient.\n\n### Send email with template\n\nSend an email, using a template, to a recipient. You need to create a [Broadcast email template](https://www.infobip.com/docs/email/templates) as that is the only type of template supported by Infobip's API. Templates can be created and managed via the Infobip web portal.\n\nWhen using this action, the from/sender details and subject as specified in the template will be used. However, you can specify a subject if you would like to overwrite the subject specified in the template.\n\nWithin your template, you can harness placeholders using Infobip's `{{` syntax. This feature allows you to craft templates with both static and dynamic content. You can determine the dynamic content's value when configuring the action in Awell Studio. For instance, if your template includes two placeholders, `{{variable_1}}` and `{{variable_2}}`, you can provide the following data in the placeholders action field to set values for these placeholders:\n\n```json\n{\n \"variable_1\": \"Hello\",\n \"variable_2\": \"World\"\n}\n```\n",
|
68
72
|
"changelog": "# Infobip changelog\n"
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@awell-health/awell-extensions",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.192",
|
4
4
|
"packageManager": "yarn@3.4.1",
|
5
5
|
"main": "dist/src/index.js",
|
6
6
|
"repository": {
|
@@ -64,7 +64,7 @@
|
|
64
64
|
"typescript": "4.9.5"
|
65
65
|
},
|
66
66
|
"dependencies": {
|
67
|
-
"@awell-health/extensions-core": "0.1.
|
67
|
+
"@awell-health/extensions-core": "0.1.26",
|
68
68
|
"@dropbox/sign": "^1.1.3",
|
69
69
|
"@mailchimp/mailchimp_transactional": "^1.0.50",
|
70
70
|
"@metriport/api": "^3.1.5",
|