@awell-health/awell-extensions 1.0.103 → 1.0.104
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.
- package/dist/extensions/index.js +2 -0
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/markdown.json +4 -0
- package/dist/extensions/zusHealth/client/client.d.ts +12 -0
- package/dist/extensions/zusHealth/client/client.js +42 -0
- package/dist/extensions/zusHealth/client/client.js.map +1 -0
- package/dist/extensions/zusHealth/client/index.d.ts +1 -0
- package/dist/extensions/zusHealth/client/index.js +6 -0
- package/dist/extensions/zusHealth/client/index.js.map +1 -0
- package/dist/extensions/zusHealth/client/type.d.ts +6 -0
- package/dist/extensions/zusHealth/client/type.js +3 -0
- package/dist/extensions/zusHealth/client/type.js.map +1 -0
- package/dist/extensions/zusHealth/index.d.ts +2 -0
- package/dist/extensions/zusHealth/index.js +20 -0
- package/dist/extensions/zusHealth/index.js.map +1 -0
- package/dist/extensions/zusHealth/settings.d.ts +37 -0
- package/dist/extensions/zusHealth/settings.js +41 -0
- package/dist/extensions/zusHealth/settings.js.map +1 -0
- package/dist/extensions/zusHealth/utils/error.d.ts +6 -0
- package/dist/extensions/zusHealth/utils/error.js +53 -0
- package/dist/extensions/zusHealth/utils/error.js.map +1 -0
- package/dist/extensions/zusHealth/utils/index.d.ts +1 -0
- package/dist/extensions/zusHealth/utils/index.js +18 -0
- package/dist/extensions/zusHealth/utils/index.js.map +1 -0
- package/dist/extensions/zusHealth/validation/encounter.zod.d.ts +2 -0
- package/dist/extensions/zusHealth/validation/encounter.zod.js +9 -0
- package/dist/extensions/zusHealth/validation/encounter.zod.js.map +1 -0
- package/dist/extensions/zusHealth/validation/index.d.ts +2 -0
- package/dist/extensions/zusHealth/validation/index.js +19 -0
- package/dist/extensions/zusHealth/validation/index.js.map +1 -0
- package/dist/extensions/zusHealth/validation/settings.zod.d.ts +20 -0
- package/dist/extensions/zusHealth/validation/settings.zod.js +22 -0
- package/dist/extensions/zusHealth/validation/settings.zod.js.map +1 -0
- package/dist/extensions/zusHealth/webhooks/index.d.ts +3 -0
- package/dist/extensions/zusHealth/webhooks/index.js +7 -0
- package/dist/extensions/zusHealth/webhooks/index.js.map +1 -0
- package/dist/extensions/zusHealth/webhooks/patientAdmitted.d.ts +43 -0
- package/dist/extensions/zusHealth/webhooks/patientAdmitted.js +93 -0
- package/dist/extensions/zusHealth/webhooks/patientAdmitted.js.map +1 -0
- package/dist/extensions/zusHealth/webhooks/patientDischarged.d.ts +47 -0
- package/dist/extensions/zusHealth/webhooks/patientDischarged.js +98 -0
- package/dist/extensions/zusHealth/webhooks/patientDischarged.js.map +1 -0
- package/dist/extensions/zusHealth/webhooks/types.d.ts +28 -0
- package/dist/extensions/zusHealth/webhooks/types.js +22 -0
- package/dist/extensions/zusHealth/webhooks/types.js.map +1 -0
- package/package.json +1 -1
package/dist/extensions/index.js
CHANGED
@@ -45,6 +45,7 @@ const sendgrid_extension_1 = require("./sendgrid-extension");
|
|
45
45
|
const cmDotCom_1 = require("./cmDotCom");
|
46
46
|
const docuSign_1 = require("./docuSign");
|
47
47
|
const sendbird_1 = require("./sendbird");
|
48
|
+
const zusHealth_1 = require("./zusHealth");
|
48
49
|
const json = __importStar(require("./markdown.json"));
|
49
50
|
exports.markdown = json;
|
50
51
|
exports.extensions = [
|
@@ -69,5 +70,6 @@ exports.extensions = [
|
|
69
70
|
cmDotCom_1.CmDotCom,
|
70
71
|
docuSign_1.DocuSign,
|
71
72
|
sendbird_1.Sendbird,
|
73
|
+
zusHealth_1.ZusHealth,
|
72
74
|
];
|
73
75
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../extensions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,mCAA+B;AAC/B,2CAAuC;AACvC,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,yCAAqC;AACrC,6DAA+C;AAC/C,yCAAqC;AACrC,yCAAqC;AACrC,yCAAqC;AACrC,sDAAuC;AAG1B,QAAA,QAAQ,GAAa,IAAI,CAAA;AAEzB,QAAA,UAAU,GAAG;IACxB,oFAAoF;IACpF,aAAK;IACL,qBAAS;IACT,6BAAa;IACb,uBAAU;IACV,yBAAW;IACX,iBAAO;IACP,mBAAQ;IACR,mBAAQ;IACR,wBAAU;IACV,qBAAS;IACT,iBAAO;IACP,oBAAa;IACb,yBAAW;IACX,qBAAS;IACT,eAAM;IACN,mBAAQ;IACR,6BAAQ;IACR,mBAAQ;IACR,mBAAQ;IACR,mBAAQ;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../extensions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,mCAA+B;AAC/B,2CAAuC;AACvC,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,yCAAqC;AACrC,6DAA+C;AAC/C,yCAAqC;AACrC,yCAAqC;AACrC,yCAAqC;AACrC,2CAAuC;AAEvC,sDAAuC;AAG1B,QAAA,QAAQ,GAAa,IAAI,CAAA;AAEzB,QAAA,UAAU,GAAG;IACxB,oFAAoF;IACpF,aAAK;IACL,qBAAS;IACT,6BAAa;IACb,uBAAU;IACV,yBAAW;IACX,iBAAO;IACP,mBAAQ;IACR,mBAAQ;IACR,wBAAU;IACV,qBAAS;IACT,iBAAO;IACP,oBAAa;IACb,yBAAW;IACX,qBAAS;IACT,eAAM;IACN,mBAAQ;IACR,6BAAQ;IACR,mBAAQ;IACR,mBAAQ;IACR,mBAAQ;IACR,qBAAS;CACV,CAAA"}
|
@@ -82,5 +82,9 @@
|
|
82
82
|
"wellinks": {
|
83
83
|
"readme": "---\ntitle: Wellinks\ndescription: The purpose of this extension is to keep application logic out of the Pathways and Tracks. Some actions require interactions with the Healthie API, hence the need for the API URL and Key in the settings.\n---\n# Wellinks Extension\n\nThe purpose of this extension is to keep application logic out of the Pathways and Tracks. Some actions require interactions with the Healthie API, hence the need for the API URL and Key in the settings.\n\n## Extension Settings\n\nYou will need to provide the API URL and Key for the Wellinks Healthie instance.\n\n# Custom Actions\n\n## Check for Override\n\nChecks to see if the patient in Healthie has an active Override form.\n\n## Check for Scheduled Appointments\n\nChecks to see if the patient in Healthie has an appointment of a specific type scheduled in the future.\n\n## Check for Chat\n\nChecks that a Chat message (either to or from a patient and coach) has happened at least 24 hours after an appointment\n\n## Insert Member List Event\n\nAdds an Insert Member List Event to the Platform Database.\n\n## Check for Flourish Customer\n\nQueries Flourish to see if there is a record that has a matching ThirdPartyIdentifier. Returns True/False.\n\n## Submit a PAM Survey\n\nSubmits a PAM 13 Survey (completed in the Careflow) to Flourish and returns the PAM Score and Levl.",
|
84
84
|
"changelog": "# Wellinks Changelog\n\n## May 18th, 2023\n\nAdded the checkForOverride action.\n\n## May 19th, 2023\n\nAdded the checkForScheduledAppointment action.\n\n## May 25th, 2023\n\nAdded datapoints for actions\n\n\n## July 6th, 2023\n\nAdded new action to unenroll user from Sendgrid.\n\n## July 16th, 2023\n\nAdded a new action to insert a Member Event List to the Platform DB. This requires setting the platform API URL and API Key values for the extension.\n\n## September 12th, 2023\n\nAdds a new action to check Flourish for a customer with a matching ThirdPartyIdentifier.\n\n## September 18th, 2023\n\nAdds a new action to submit a PAM13 survey to Flourish, returning a PAM Score, level, and whether or not the submission was a success.\n\n## September 19th, 2023\n\nAdds a new action to create a customer in Flourish, returning true or false based on whether or not the creation was a success."
|
85
|
+
},
|
86
|
+
"zusHealth": {
|
87
|
+
"readme": "---\ntitle: Zus Health\ndescription: Zus is the only shared health data platform designed to accelerate healthcare data interoperability by providing easy-to-use patient data at the point of care via API, embedded components, and direct EHR integrations.\n---\n\n# Zus Health\n\n[Zus Health](https://zushealth.com/) is the only shared health data platform designed to accelerate healthcare data interoperability by providing easy-to-use patient data at the point of care via API, embedded components, and direct EHR integrations.\n\n## Zus Health x Awell\n\nThis extension allows you to fetch resource via webhooks\n\n## Extension settings\n\nFor the extension to function correctly, you must include the following elements in your settings:\n\n`client_id` and `client_secret`: These values are generated on the Zus Health platform.\n`base_url`: This determines the base URL for your FHIR endpoint, for example, https://api.sandbox.zusapi.com/fhir.\n`auth_url`: This determines the base URL for your authorization endpoint, for example, https://zus-sandbox.us.auth0.com/oauth/token.\n`audience`: This determines the API hostname, for example, https://api.sandbox.zusapi.com.\n\n## Webhooks\n\nWebhooks offer a great way to listen to updates to resources in Zus and trigger Awell care flows. These updates include ADT feed events for your patient population, and the relevant Encounter data can then be incorporated in the new flow.\n",
|
88
|
+
"changelog": "# Zus Health changelog\n"
|
85
89
|
}
|
86
90
|
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { DataWrapper, APIClient, type DataWrapperCtor } from '@awell-health/extensions-core';
|
2
|
+
import { type ZusAPIClientConstrutorProps } from './type';
|
3
|
+
import { type settings } from '../settings';
|
4
|
+
export declare class ZusHealthDataWrapper extends DataWrapper {
|
5
|
+
getResource(resourceId: string): Promise<any>;
|
6
|
+
}
|
7
|
+
export declare class ZusHealthAPIClient extends APIClient<ZusHealthDataWrapper> {
|
8
|
+
readonly ctor: DataWrapperCtor<ZusHealthDataWrapper>;
|
9
|
+
constructor({ authUrl, requestConfig, ...opts }: ZusAPIClientConstrutorProps);
|
10
|
+
getResource(resourceId: string): Promise<any>;
|
11
|
+
}
|
12
|
+
export declare const makeAPIClient: (payloadSettings: Record<keyof typeof settings, string | undefined>) => ZusHealthAPIClient;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.makeAPIClient = exports.ZusHealthAPIClient = exports.ZusHealthDataWrapper = void 0;
|
4
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
5
|
+
const validation_1 = require("../validation");
|
6
|
+
class ZusHealthDataWrapper extends extensions_core_1.DataWrapper {
|
7
|
+
async getResource(resourceId) {
|
8
|
+
const response = await this.RequestRaw({
|
9
|
+
method: 'GET',
|
10
|
+
url: `/${resourceId}`,
|
11
|
+
});
|
12
|
+
return response;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
exports.ZusHealthDataWrapper = ZusHealthDataWrapper;
|
16
|
+
class ZusHealthAPIClient extends extensions_core_1.APIClient {
|
17
|
+
constructor({ authUrl, requestConfig, ...opts }) {
|
18
|
+
super({
|
19
|
+
...opts,
|
20
|
+
auth: new extensions_core_1.OAuthClientCredentials({
|
21
|
+
auth_url: authUrl,
|
22
|
+
request_config: requestConfig,
|
23
|
+
}),
|
24
|
+
});
|
25
|
+
this.ctor = (token, baseUrl) => new ZusHealthDataWrapper(token, baseUrl);
|
26
|
+
}
|
27
|
+
async getResource(resourceId) {
|
28
|
+
const response = await this.FetchData(async (dw) => await dw.getResource(resourceId));
|
29
|
+
return response.data;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
exports.ZusHealthAPIClient = ZusHealthAPIClient;
|
33
|
+
const makeAPIClient = (payloadSettings) => {
|
34
|
+
const { auth_url, base_url, ...authRquestSettings } = validation_1.settingsSchema.parse(payloadSettings);
|
35
|
+
return new ZusHealthAPIClient({
|
36
|
+
authUrl: auth_url,
|
37
|
+
requestConfig: authRquestSettings,
|
38
|
+
baseUrl: base_url,
|
39
|
+
});
|
40
|
+
};
|
41
|
+
exports.makeAPIClient = makeAPIClient;
|
42
|
+
//# sourceMappingURL=client.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"client.js","s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C,OAAO,EAAE,QAAQ;KAClB,CAAC,CAAA;AACJ,CAAC,CAAA;AAXY,QAAA,aAAa,iBAWzB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { makeAPIClient } from './client';
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.makeAPIClient = void 0;
|
4
|
+
var client_1 = require("./client");
|
5
|
+
Object.defineProperty(exports, "makeAPIClient", { enumerable: true, get: function () { return client_1.makeAPIClient; } });
|
6
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/zusHealth/client/index.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAA/B,uGAAA,aAAa,OAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../../extensions/zusHealth/client/type.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ZusHealth = void 0;
|
4
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
5
|
+
const settings_1 = require("./settings");
|
6
|
+
const webhooks_1 = require("./webhooks");
|
7
|
+
exports.ZusHealth = {
|
8
|
+
key: 'zusHealth',
|
9
|
+
title: 'Zus Health',
|
10
|
+
icon_url: 'https://zushealth.com/wp-content/themes/zus/assets/static/img/zus-logo.svg',
|
11
|
+
description: 'Simplify healthcare data interoperability with Zus, the shared health data platform, providing seamless access to patient data through APIs, embedded components, and EHR integrations',
|
12
|
+
category: extensions_core_1.Category.EHR_INTEGRATIONS,
|
13
|
+
author: {
|
14
|
+
authorType: extensions_core_1.AuthorType.HTD,
|
15
|
+
},
|
16
|
+
actions: {},
|
17
|
+
settings: settings_1.settings,
|
18
|
+
webhooks: webhooks_1.webhooks,
|
19
|
+
};
|
20
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../extensions/zusHealth/index.ts"],"names":[],"mappings":";;;AACA,mEAAoE;AACpE,yCAAqC;AACrC,yCAAqC;AAExB,QAAA,SAAS,GAAc;IAClC,GAAG,EAAE,WAAW;IAChB,KAAK,EAAE,YAAY;IACnB,QAAQ,EACN,4EAA4E;IAC9E,WAAW,EACT,wLAAwL;IAC1L,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,MAAM,EAAE;QACN,UAAU,EAAE,4BAAU,CAAC,GAAG;KAC3B;IACD,OAAO,EAAE,EAAE;IACX,QAAQ,EAAR,mBAAQ;IACR,QAAQ,EAAR,mBAAQ;CACT,CAAA"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
export declare const settings: {
|
2
|
+
base_url: {
|
3
|
+
key: string;
|
4
|
+
label: string;
|
5
|
+
obfuscated: false;
|
6
|
+
description: string;
|
7
|
+
required: true;
|
8
|
+
};
|
9
|
+
auth_url: {
|
10
|
+
key: string;
|
11
|
+
label: string;
|
12
|
+
obfuscated: false;
|
13
|
+
description: string;
|
14
|
+
required: true;
|
15
|
+
};
|
16
|
+
client_id: {
|
17
|
+
key: string;
|
18
|
+
label: string;
|
19
|
+
obfuscated: false;
|
20
|
+
description: string;
|
21
|
+
required: true;
|
22
|
+
};
|
23
|
+
client_secret: {
|
24
|
+
key: string;
|
25
|
+
label: string;
|
26
|
+
obfuscated: false;
|
27
|
+
description: string;
|
28
|
+
required: true;
|
29
|
+
};
|
30
|
+
audience: {
|
31
|
+
key: string;
|
32
|
+
label: string;
|
33
|
+
obfuscated: false;
|
34
|
+
description: string;
|
35
|
+
required: true;
|
36
|
+
};
|
37
|
+
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.settings = void 0;
|
4
|
+
exports.settings = {
|
5
|
+
base_url: {
|
6
|
+
key: 'base_url',
|
7
|
+
label: 'Base URL',
|
8
|
+
obfuscated: false,
|
9
|
+
description: 'The base URL of Zus Health API.',
|
10
|
+
required: true,
|
11
|
+
},
|
12
|
+
auth_url: {
|
13
|
+
key: 'auth_url',
|
14
|
+
label: 'Auth URL',
|
15
|
+
obfuscated: false,
|
16
|
+
description: 'The base URL of authorization API',
|
17
|
+
required: true,
|
18
|
+
},
|
19
|
+
client_id: {
|
20
|
+
key: 'client_id',
|
21
|
+
label: 'Client ID',
|
22
|
+
obfuscated: false,
|
23
|
+
description: '',
|
24
|
+
required: true,
|
25
|
+
},
|
26
|
+
client_secret: {
|
27
|
+
key: 'client_secret',
|
28
|
+
label: 'Client Secret',
|
29
|
+
obfuscated: false,
|
30
|
+
description: '',
|
31
|
+
required: true,
|
32
|
+
},
|
33
|
+
audience: {
|
34
|
+
key: 'audience',
|
35
|
+
label: 'Audience',
|
36
|
+
obfuscated: false,
|
37
|
+
description: '',
|
38
|
+
required: true,
|
39
|
+
},
|
40
|
+
};
|
41
|
+
//# sourceMappingURL=settings.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../extensions/zusHealth/settings.ts"],"names":[],"mappings":";;;AAEa,QAAA,QAAQ,GAAG;IACtB,QAAQ,EAAE;QACR,GAAG,EAAE,UAAU;QACf,KAAK,EAAE,UAAU;QACjB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,iCAAiC;QAC9C,QAAQ,EAAE,IAAI;KACf;IACD,QAAQ,EAAE;QACR,GAAG,EAAE,UAAU;QACf,KAAK,EAAE,UAAU;QACjB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,mCAAmC;QAChD,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,KAAK,EAAE,WAAW;QAClB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,EAAE;QACf,QAAQ,EAAE,IAAI;KACf;IACD,aAAa,EAAE;QACb,GAAG,EAAE,eAAe;QACpB,KAAK,EAAE,eAAe;QACtB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,EAAE;QACf,QAAQ,EAAE,IAAI;KACf;IACD,QAAQ,EAAE;QACR,GAAG,EAAE,UAAU;QACf,KAAK,EAAE,UAAU;QACjB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,EAAE;QACf,QAAQ,EAAE,IAAI;KACf;CACgC,CAAA"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { AxiosError } from 'axios';
|
2
|
+
export declare const isZodError: (error: any) => boolean;
|
3
|
+
export declare const isAxiosError: (error: any) => boolean;
|
4
|
+
export declare const parseZodError: (error: any) => any;
|
5
|
+
export declare const parseAxiosError: (error: AxiosError) => any;
|
6
|
+
export declare const parseUnknowError: (error: Error) => any;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.parseUnknowError = exports.parseAxiosError = exports.parseZodError = exports.isAxiosError = exports.isZodError = void 0;
|
4
|
+
const axios_1 = require("axios");
|
5
|
+
const zod_1 = require("zod");
|
6
|
+
const zod_validation_error_1 = require("zod-validation-error");
|
7
|
+
const isZodError = (error) => {
|
8
|
+
return error instanceof zod_1.ZodError;
|
9
|
+
};
|
10
|
+
exports.isZodError = isZodError;
|
11
|
+
const isAxiosError = (error) => {
|
12
|
+
return error instanceof axios_1.AxiosError;
|
13
|
+
};
|
14
|
+
exports.isAxiosError = isAxiosError;
|
15
|
+
const parseZodError = (error) => {
|
16
|
+
const parsedError = (0, zod_validation_error_1.fromZodError)(error);
|
17
|
+
return {
|
18
|
+
date: new Date().toISOString(),
|
19
|
+
text: { en: parsedError.message },
|
20
|
+
error: {
|
21
|
+
category: 'SERVER_ERROR',
|
22
|
+
message: parsedError.message,
|
23
|
+
},
|
24
|
+
};
|
25
|
+
};
|
26
|
+
exports.parseZodError = parseZodError;
|
27
|
+
const parseAxiosError = (error) => {
|
28
|
+
var _a, _b;
|
29
|
+
return {
|
30
|
+
date: new Date().toISOString(),
|
31
|
+
text: {
|
32
|
+
en: `${(_a = error.status) !== null && _a !== void 0 ? _a : '(no status code)'} Error: ${error.message}`,
|
33
|
+
},
|
34
|
+
error: {
|
35
|
+
category: 'BAD_REQUEST',
|
36
|
+
message: `${(_b = error.status) !== null && _b !== void 0 ? _b : '(no status code)'} Error: ${error.message}`,
|
37
|
+
},
|
38
|
+
};
|
39
|
+
};
|
40
|
+
exports.parseAxiosError = parseAxiosError;
|
41
|
+
const parseUnknowError = (error) => {
|
42
|
+
const message = error.message;
|
43
|
+
return {
|
44
|
+
date: new Date().toISOString(),
|
45
|
+
text: { en: message },
|
46
|
+
error: {
|
47
|
+
category: 'SERVER_ERROR',
|
48
|
+
message,
|
49
|
+
},
|
50
|
+
};
|
51
|
+
};
|
52
|
+
exports.parseUnknowError = parseUnknowError;
|
53
|
+
//# sourceMappingURL=error.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../extensions/zusHealth/utils/error.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAClC,6BAA8B;AAC9B,+DAAmD;AAE5C,MAAM,UAAU,GAAG,CAAC,KAAU,EAAW,EAAE;IAChD,OAAO,KAAK,YAAY,cAAQ,CAAA;AAClC,CAAC,CAAA;AAFY,QAAA,UAAU,cAEtB;AAEM,MAAM,YAAY,GAAG,CAAC,KAAU,EAAW,EAAE;IAClD,OAAO,KAAK,YAAY,kBAAU,CAAA;AACpC,CAAC,CAAA;AAFY,QAAA,YAAY,gBAExB;AAEM,MAAM,aAAa,GAAG,CAAC,KAAU,EAAO,EAAE;IAC/C,MAAM,WAAW,GAAG,IAAA,mCAAY,EAAC,KAAK,CAAC,CAAA;IACvC,OAAO;QACL,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,WAAW,CAAC,OAAO,EAAE;QACjC,KAAK,EAAE;YACL,QAAQ,EAAE,cAAc;YACxB,OAAO,EAAE,WAAW,CAAC,OAAO;SAC7B;KACF,CAAA;AACH,CAAC,CAAA;AAVY,QAAA,aAAa,iBAUzB;AAEM,MAAM,eAAe,GAAG,CAAC,KAAiB,EAAO,EAAE;;IACxD,OAAO;QACL,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC9B,IAAI,EAAE;YACJ,EAAE,EAAE,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,kBAAkB,WAAW,KAAK,CAAC,OAAO,EAAE;SACpE;QACD,KAAK,EAAE;YACL,QAAQ,EAAE,aAAa;YACvB,OAAO,EAAE,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,kBAAkB,WAAW,KAAK,CAAC,OAAO,EAAE;SACzE;KACF,CAAA;AACH,CAAC,CAAA;AAXY,QAAA,eAAe,mBAW3B;AAEM,MAAM,gBAAgB,GAAG,CAAC,KAAY,EAAO,EAAE;IACpD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;IAC7B,OAAO;QACL,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;QACrB,KAAK,EAAE;YACL,QAAQ,EAAE,cAAc;YACxB,OAAO;SACR;KACF,CAAA;AACH,CAAC,CAAA;AAVY,QAAA,gBAAgB,oBAU5B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './error';
|
@@ -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("./error"), exports);
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/zusHealth/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB"}
|
@@ -0,0 +1,9 @@
|
|
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.startsWithEncounter = void 0;
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
8
|
+
exports.startsWithEncounter = zod_1.default.string().startsWith('Encounter/');
|
9
|
+
//# sourceMappingURL=encounter.zod.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"encounter.zod.js","sourceRoot":"","sources":["../../../../extensions/zusHealth/validation/encounter.zod.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAmB;AAEN,QAAA,mBAAmB,GAAG,aAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA"}
|
@@ -0,0 +1,19 @@
|
|
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("./settings.zod"), exports);
|
18
|
+
__exportStar(require("./encounter.zod"), exports);
|
19
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/zusHealth/validation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,kDAA+B"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
export declare const settingsSchema: z.ZodObject<{
|
3
|
+
base_url: z.ZodString;
|
4
|
+
auth_url: z.ZodString;
|
5
|
+
client_id: z.ZodString;
|
6
|
+
client_secret: z.ZodString;
|
7
|
+
audience: z.ZodString;
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
9
|
+
auth_url: string;
|
10
|
+
audience: string;
|
11
|
+
client_id: string;
|
12
|
+
client_secret: string;
|
13
|
+
base_url: string;
|
14
|
+
}, {
|
15
|
+
auth_url: string;
|
16
|
+
audience: string;
|
17
|
+
client_id: string;
|
18
|
+
client_secret: string;
|
19
|
+
base_url: string;
|
20
|
+
}>;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.settingsSchema = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
exports.settingsSchema = zod_1.z.object({
|
6
|
+
base_url: zod_1.z
|
7
|
+
.string({ errorMap: () => ({ message: 'Missing base URL' }) })
|
8
|
+
.min(1),
|
9
|
+
auth_url: zod_1.z
|
10
|
+
.string({ errorMap: () => ({ message: 'Missing auth URL' }) })
|
11
|
+
.min(1),
|
12
|
+
client_id: zod_1.z
|
13
|
+
.string({ errorMap: () => ({ message: 'Missing client ID' }) })
|
14
|
+
.min(1),
|
15
|
+
client_secret: zod_1.z
|
16
|
+
.string({ errorMap: () => ({ message: 'Missing client secret' }) })
|
17
|
+
.min(1),
|
18
|
+
audience: zod_1.z
|
19
|
+
.string({ errorMap: () => ({ message: 'Missing audience' }) })
|
20
|
+
.min(1),
|
21
|
+
});
|
22
|
+
//# sourceMappingURL=settings.zod.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"settings.zod.js","sourceRoot":"","sources":["../../../../extensions/zusHealth/validation/settings.zod.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEV,QAAA,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,QAAQ,EAAE,OAAC;SACR,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,EAAE,CAAC;SAC7D,GAAG,CAAC,CAAC,CAAC;IACT,QAAQ,EAAE,OAAC;SACR,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,EAAE,CAAC;SAC7D,GAAG,CAAC,CAAC,CAAC;IACT,SAAS,EAAE,OAAC;SACT,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,EAAE,CAAC;SAC9D,GAAG,CAAC,CAAC,CAAC;IACT,aAAa,EAAE,OAAC;SACb,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC,EAAE,CAAC;SAClE,GAAG,CAAC,CAAC,CAAC;IACT,QAAQ,EAAE,OAAC;SACR,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,EAAE,CAAC;SAC7D,GAAG,CAAC,CAAC,CAAC;CACV,CAAC,CAAA"}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
export type { PatientAdmitted } from './patientAdmitted';
|
2
|
+
export type { PatientDischarged } from './patientDischarged';
|
3
|
+
export declare const webhooks: import("@awell-health/extensions-core").Webhook<"eventType" | "resourceId" | "UPID" | "ownerId" | "encounterStatus" | "encounterStart" | "HL7EventType" | "HL7EventTypeDescription" | "HL7EventTypeFull", import("./types").AdtEventWebhookPayload>[];
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.webhooks = void 0;
|
4
|
+
const patientAdmitted_1 = require("./patientAdmitted");
|
5
|
+
const patientDischarged_1 = require("./patientDischarged");
|
6
|
+
exports.webhooks = [patientAdmitted_1.patientAdmitted, patientDischarged_1.patientDischarged];
|
7
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/zusHealth/webhooks/index.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,2DAAuD;AAI1C,QAAA,QAAQ,GAAG,CAAC,iCAAe,EAAE,qCAAiB,CAAC,CAAA"}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { type Webhook } from '@awell-health/extensions-core';
|
2
|
+
import { type AdtEventWebhookPayload } from './types';
|
3
|
+
declare const dataPoints: {
|
4
|
+
resourceId: {
|
5
|
+
key: string;
|
6
|
+
valueType: "string";
|
7
|
+
};
|
8
|
+
UPID: {
|
9
|
+
key: string;
|
10
|
+
valueType: "string";
|
11
|
+
};
|
12
|
+
ownerId: {
|
13
|
+
key: string;
|
14
|
+
valueType: "string";
|
15
|
+
};
|
16
|
+
eventType: {
|
17
|
+
key: string;
|
18
|
+
valueType: "string";
|
19
|
+
};
|
20
|
+
encounterStatus: {
|
21
|
+
key: string;
|
22
|
+
valueType: "string";
|
23
|
+
};
|
24
|
+
encounterStart: {
|
25
|
+
key: string;
|
26
|
+
valueType: "date";
|
27
|
+
};
|
28
|
+
HL7EventType: {
|
29
|
+
key: string;
|
30
|
+
valueType: "string";
|
31
|
+
};
|
32
|
+
HL7EventTypeDescription: {
|
33
|
+
key: string;
|
34
|
+
valueType: "string";
|
35
|
+
};
|
36
|
+
HL7EventTypeFull: {
|
37
|
+
key: string;
|
38
|
+
valueType: "string";
|
39
|
+
};
|
40
|
+
};
|
41
|
+
export declare const patientAdmitted: Webhook<keyof typeof dataPoints, AdtEventWebhookPayload>;
|
42
|
+
export type PatientAdmitted = typeof patientAdmitted;
|
43
|
+
export {};
|
@@ -0,0 +1,93 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.patientAdmitted = void 0;
|
4
|
+
const lodash_1 = require("lodash");
|
5
|
+
const types_1 = require("./types");
|
6
|
+
const client_1 = require("../client");
|
7
|
+
const validation_1 = require("../validation");
|
8
|
+
const utils_1 = require("../utils");
|
9
|
+
const dataPoints = {
|
10
|
+
resourceId: {
|
11
|
+
key: 'resourceId',
|
12
|
+
valueType: 'string',
|
13
|
+
},
|
14
|
+
UPID: {
|
15
|
+
key: 'UPID',
|
16
|
+
valueType: 'string',
|
17
|
+
},
|
18
|
+
ownerId: {
|
19
|
+
key: 'ownerId',
|
20
|
+
valueType: 'string',
|
21
|
+
},
|
22
|
+
eventType: {
|
23
|
+
key: 'eventType',
|
24
|
+
valueType: 'string',
|
25
|
+
},
|
26
|
+
encounterStatus: {
|
27
|
+
key: 'encounterStatus',
|
28
|
+
valueType: 'string',
|
29
|
+
},
|
30
|
+
encounterStart: {
|
31
|
+
key: 'encounterStart',
|
32
|
+
valueType: 'date',
|
33
|
+
},
|
34
|
+
HL7EventType: {
|
35
|
+
key: 'HL7EventType',
|
36
|
+
valueType: 'string',
|
37
|
+
},
|
38
|
+
HL7EventTypeDescription: {
|
39
|
+
key: 'HL7EventTypeDescription',
|
40
|
+
valueType: 'string',
|
41
|
+
},
|
42
|
+
HL7EventTypeFull: {
|
43
|
+
key: 'HL7EventTypeFull',
|
44
|
+
valueType: 'string',
|
45
|
+
},
|
46
|
+
};
|
47
|
+
exports.patientAdmitted = {
|
48
|
+
key: 'patientAdmitted',
|
49
|
+
dataPoints,
|
50
|
+
onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
|
51
|
+
try {
|
52
|
+
let { resourceId } = payload;
|
53
|
+
if ((0, lodash_1.isNil)(resourceId)) {
|
54
|
+
await onError({});
|
55
|
+
}
|
56
|
+
resourceId = validation_1.startsWithEncounter.parse(payload.resourceId);
|
57
|
+
const api = (0, client_1.makeAPIClient)(settings);
|
58
|
+
const resource = await api.getResource(resourceId);
|
59
|
+
if (resource.status === types_1.EncounterStatus.InProgress &&
|
60
|
+
!(0, lodash_1.isNil)(resource.period.start)) {
|
61
|
+
await onSuccess({
|
62
|
+
data_points: {
|
63
|
+
resourceId,
|
64
|
+
UPID: payload.resource.UPID,
|
65
|
+
ownerId: payload.ownerId,
|
66
|
+
encounterStatus: resource.status,
|
67
|
+
encounterStart: resource.period.start,
|
68
|
+
eventType: types_1.EncounterStatus.Admitted,
|
69
|
+
HL7EventType: types_1.HL7EventType.A01.code,
|
70
|
+
HL7EventTypeFull: types_1.HL7EventType.A01.fullCode,
|
71
|
+
HL7EventTypeDescription: types_1.HL7EventType.A01.description,
|
72
|
+
},
|
73
|
+
});
|
74
|
+
}
|
75
|
+
}
|
76
|
+
catch (error) {
|
77
|
+
let parsedError;
|
78
|
+
if ((0, utils_1.isZodError)(error)) {
|
79
|
+
parsedError = (0, utils_1.parseZodError)(error);
|
80
|
+
}
|
81
|
+
else if ((0, utils_1.isAxiosError)(error)) {
|
82
|
+
parsedError = (0, utils_1.parseAxiosError)(error);
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
parsedError = (0, utils_1.parseUnknowError)(error);
|
86
|
+
}
|
87
|
+
await onError({
|
88
|
+
events: [parsedError],
|
89
|
+
});
|
90
|
+
}
|
91
|
+
},
|
92
|
+
};
|
93
|
+
//# sourceMappingURL=patientAdmitted.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"patientAdmitted.js","sourceRoot":"","sources":["../../../../extensions/zusHealth/webhooks/patientAdmitted.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAK9B,mCAIgB;AAChB,sCAAyC;AACzC,8CAAmD;AACnD,oCAMiB;AAGjB,MAAM,UAAU,GAAG;IACjB,UAAU,EAAE;QACV,GAAG,EAAE,YAAY;QACjB,SAAS,EAAE,QAAQ;KACpB;IACD,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM;QACX,SAAS,EAAE,QAAQ;KACpB;IACD,OAAO,EAAE;QACP,GAAG,EAAE,SAAS;QACd,SAAS,EAAE,QAAQ;KACpB;IACD,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,eAAe,EAAE;QACf,GAAG,EAAE,iBAAiB;QACtB,SAAS,EAAE,QAAQ;KACpB;IACD,cAAc,EAAE;QACd,GAAG,EAAE,gBAAgB;QACrB,SAAS,EAAE,MAAM;KAClB;IACD,YAAY,EAAE;QACZ,GAAG,EAAE,cAAc;QACnB,SAAS,EAAE,QAAQ;KACpB;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,yBAAyB;QAC9B,SAAS,EAAE,QAAQ;KACpB;IACD,gBAAgB,EAAE;QAChB,GAAG,EAAE,kBAAkB;QACvB,SAAS,EAAE,QAAQ;KACpB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AAE;gBACrB,WAAW,GAAG,IAAA,qBAAa,EAAC,KAAK,CAAC,CAAA;aACnC;iBAAM,IAAI,IAAA,oBAAY,EAAC,KAAK,CAAC,EAAE;gBAC9B,WAAW,GAAG,IAAA,uBAAe,EAAC,KAAmB,CAAC,CAAA;aACnD;iBAAM;gBACL,WAAW,GAAG,IAAA,wBAAgB,EAAC,KAAc,CAAC,CAAA;aAC/C;YACD,MAAM,OAAO,CAAC;gBACZ,MAAM,EAAE,CAAC,WAAW,CAAC;aACtB,CAAC,CAAA;SACH;IACH,CAAC;CACF,CAAA"}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { type Webhook } from '@awell-health/extensions-core';
|
2
|
+
import { type AdtEventWebhookPayload } from './types';
|
3
|
+
declare const dataPoints: {
|
4
|
+
resourceId: {
|
5
|
+
key: string;
|
6
|
+
valueType: "string";
|
7
|
+
};
|
8
|
+
UPID: {
|
9
|
+
key: string;
|
10
|
+
valueType: "string";
|
11
|
+
};
|
12
|
+
ownerId: {
|
13
|
+
key: string;
|
14
|
+
valueType: "string";
|
15
|
+
};
|
16
|
+
eventType: {
|
17
|
+
key: string;
|
18
|
+
valueType: "string";
|
19
|
+
};
|
20
|
+
encounterStatus: {
|
21
|
+
key: string;
|
22
|
+
valueType: "string";
|
23
|
+
};
|
24
|
+
encounterStart: {
|
25
|
+
key: string;
|
26
|
+
valueType: "date";
|
27
|
+
};
|
28
|
+
encounterEnd: {
|
29
|
+
key: string;
|
30
|
+
valueType: "date";
|
31
|
+
};
|
32
|
+
HL7EventType: {
|
33
|
+
key: string;
|
34
|
+
valueType: "string";
|
35
|
+
};
|
36
|
+
HL7EventTypeDescription: {
|
37
|
+
key: string;
|
38
|
+
valueType: "string";
|
39
|
+
};
|
40
|
+
HL7EventTypeFull: {
|
41
|
+
key: string;
|
42
|
+
valueType: "string";
|
43
|
+
};
|
44
|
+
};
|
45
|
+
export declare const patientDischarged: Webhook<keyof typeof dataPoints, AdtEventWebhookPayload>;
|
46
|
+
export type PatientDischarged = typeof patientDischarged;
|
47
|
+
export {};
|
@@ -0,0 +1,98 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.patientDischarged = void 0;
|
4
|
+
const lodash_1 = require("lodash");
|
5
|
+
const types_1 = require("./types");
|
6
|
+
const client_1 = require("../client");
|
7
|
+
const validation_1 = require("../validation");
|
8
|
+
const utils_1 = require("../utils");
|
9
|
+
const dataPoints = {
|
10
|
+
resourceId: {
|
11
|
+
key: 'resourceId',
|
12
|
+
valueType: 'string',
|
13
|
+
},
|
14
|
+
UPID: {
|
15
|
+
key: 'UPID',
|
16
|
+
valueType: 'string',
|
17
|
+
},
|
18
|
+
ownerId: {
|
19
|
+
key: 'ownerId',
|
20
|
+
valueType: 'string',
|
21
|
+
},
|
22
|
+
eventType: {
|
23
|
+
key: 'eventType',
|
24
|
+
valueType: 'string',
|
25
|
+
},
|
26
|
+
encounterStatus: {
|
27
|
+
key: 'encounterStatus',
|
28
|
+
valueType: 'string',
|
29
|
+
},
|
30
|
+
encounterStart: {
|
31
|
+
key: 'encounterStart',
|
32
|
+
valueType: 'date',
|
33
|
+
},
|
34
|
+
encounterEnd: {
|
35
|
+
key: 'encounterEnd',
|
36
|
+
valueType: 'date',
|
37
|
+
},
|
38
|
+
HL7EventType: {
|
39
|
+
key: 'HL7EventType',
|
40
|
+
valueType: 'string',
|
41
|
+
},
|
42
|
+
HL7EventTypeDescription: {
|
43
|
+
key: 'HL7EventTypeDescription',
|
44
|
+
valueType: 'string',
|
45
|
+
},
|
46
|
+
HL7EventTypeFull: {
|
47
|
+
key: 'HL7EventTypeFull',
|
48
|
+
valueType: 'string',
|
49
|
+
},
|
50
|
+
};
|
51
|
+
exports.patientDischarged = {
|
52
|
+
key: 'patientDischarged',
|
53
|
+
dataPoints,
|
54
|
+
onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
|
55
|
+
try {
|
56
|
+
let { resourceId } = payload;
|
57
|
+
if ((0, lodash_1.isNil)(resourceId)) {
|
58
|
+
await onError({});
|
59
|
+
}
|
60
|
+
resourceId = validation_1.startsWithEncounter.parse(resourceId);
|
61
|
+
const api = (0, client_1.makeAPIClient)(settings);
|
62
|
+
const resource = await api.getResource(resourceId);
|
63
|
+
if (resource.status === types_1.EncounterStatus.Discharged &&
|
64
|
+
!(0, lodash_1.isNil)(resource.period.end)) {
|
65
|
+
await onSuccess({
|
66
|
+
data_points: {
|
67
|
+
resourceId,
|
68
|
+
UPID: payload.resource.UPID,
|
69
|
+
ownerId: payload.ownerId,
|
70
|
+
eventType: types_1.EncounterStatus.Discharged,
|
71
|
+
encounterStatus: resource.status,
|
72
|
+
encounterStart: resource.period.start,
|
73
|
+
encounterEnd: resource.period.end,
|
74
|
+
HL7EventType: types_1.HL7EventType.A03.code,
|
75
|
+
HL7EventTypeFull: types_1.HL7EventType.A03.fullCode,
|
76
|
+
HL7EventTypeDescription: types_1.HL7EventType.A03.description,
|
77
|
+
},
|
78
|
+
});
|
79
|
+
}
|
80
|
+
}
|
81
|
+
catch (error) {
|
82
|
+
let parsedError;
|
83
|
+
if ((0, utils_1.isZodError)(error)) {
|
84
|
+
parsedError = (0, utils_1.parseZodError)(error);
|
85
|
+
}
|
86
|
+
else if ((0, utils_1.isAxiosError)(error)) {
|
87
|
+
parsedError = (0, utils_1.parseAxiosError)(error);
|
88
|
+
}
|
89
|
+
else {
|
90
|
+
parsedError = (0, utils_1.parseUnknowError)(error);
|
91
|
+
}
|
92
|
+
await onError({
|
93
|
+
events: [parsedError],
|
94
|
+
});
|
95
|
+
}
|
96
|
+
},
|
97
|
+
};
|
98
|
+
//# sourceMappingURL=patientDischarged.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"patientDischarged.js","sourceRoot":"","sources":["../../../../extensions/zusHealth/webhooks/patientDischarged.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAK9B,mCAIgB;AAChB,sCAAyC;AACzC,8CAAmD;A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: string;
|
3
|
+
source: string;
|
4
|
+
time: string;
|
5
|
+
resourceId: string;
|
6
|
+
ownerId: string;
|
7
|
+
resourceIncluded: boolean;
|
8
|
+
resource: {
|
9
|
+
UPID: string;
|
10
|
+
};
|
11
|
+
}
|
12
|
+
export declare enum EncounterStatus {
|
13
|
+
Admitted = "admitted",
|
14
|
+
Discharged = "discharged",
|
15
|
+
InProgress = "in-progress"
|
16
|
+
}
|
17
|
+
export declare const HL7EventType: {
|
18
|
+
A01: {
|
19
|
+
code: string;
|
20
|
+
description: string;
|
21
|
+
fullCode: string;
|
22
|
+
};
|
23
|
+
A03: {
|
24
|
+
code: string;
|
25
|
+
description: string;
|
26
|
+
fullCode: string;
|
27
|
+
};
|
28
|
+
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.HL7EventType = exports.EncounterStatus = void 0;
|
4
|
+
var EncounterStatus;
|
5
|
+
(function (EncounterStatus) {
|
6
|
+
EncounterStatus["Admitted"] = "admitted";
|
7
|
+
EncounterStatus["Discharged"] = "discharged";
|
8
|
+
EncounterStatus["InProgress"] = "in-progress";
|
9
|
+
})(EncounterStatus = exports.EncounterStatus || (exports.EncounterStatus = {}));
|
10
|
+
exports.HL7EventType = {
|
11
|
+
A01: {
|
12
|
+
code: 'A01',
|
13
|
+
description: 'Admit/Visit Notification',
|
14
|
+
fullCode: 'ADT^A01',
|
15
|
+
},
|
16
|
+
A03: {
|
17
|
+
code: 'A03',
|
18
|
+
description: 'Discharge/End Visit',
|
19
|
+
fullCode: 'ADT^A03',
|
20
|
+
},
|
21
|
+
};
|
22
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../extensions/zusHealth/webhooks/types.ts"],"names":[],"mappings":";;;AAUA,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,wCAAqB,CAAA;IACrB,4CAAyB,CAAA;IACzB,6CAA0B,CAAA;AAC5B,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AAEY,QAAA,YAAY,GAAG;IAC1B,GAAG,EAAE;QACH,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,0BAA0B;QACvC,QAAQ,EAAE,SAAS;KACpB;IACD,GAAG,EAAE;QACH,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,qBAAqB;QAClC,QAAQ,EAAE,SAAS;KACpB;CACF,CAAA"}
|