@awell-health/awell-extensions 2.0.288 → 2.0.289
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/medplum/constants.d.ts +1 -0
- package/dist/extensions/medplum/constants.js +5 -0
- package/dist/extensions/medplum/constants.js.map +1 -0
- package/dist/extensions/medplum/webhooks/ObservationCreated/ObservationCreated.d.ts +16 -0
- package/dist/extensions/medplum/webhooks/ObservationCreated/ObservationCreated.js +53 -0
- package/dist/extensions/medplum/webhooks/ObservationCreated/ObservationCreated.js.map +1 -0
- package/dist/extensions/medplum/webhooks/ObservationCreated/__testdata__/payloadExample.d.ts +28 -0
- package/dist/extensions/medplum/webhooks/ObservationCreated/__testdata__/payloadExample.js +39 -0
- package/dist/extensions/medplum/webhooks/ObservationCreated/__testdata__/payloadExample.js.map +1 -0
- package/dist/extensions/medplum/webhooks/ObservationCreated/index.d.ts +1 -0
- package/dist/extensions/medplum/webhooks/ObservationCreated/index.js +18 -0
- package/dist/extensions/medplum/webhooks/ObservationCreated/index.js.map +1 -0
- package/dist/extensions/medplum/webhooks/index.d.ts +23 -1
- package/dist/extensions/medplum/webhooks/index.js +2 -1
- package/dist/extensions/medplum/webhooks/index.js.map +1 -1
- package/package.json +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
export declare const MEDPLUM_IDENTIFIER = "https://www.medplum.com/docs/api/fhir/resources/patient";
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../extensions/medplum/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAC7B,yDAAyD,CAAA"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { type Webhook } from '@awell-health/extensions-core';
|
2
|
+
import { type settings } from '../../settings';
|
3
|
+
import { type Observation } from '@medplum/fhirtypes';
|
4
|
+
declare const dataPoints: {
|
5
|
+
observation: {
|
6
|
+
key: string;
|
7
|
+
valueType: "json";
|
8
|
+
};
|
9
|
+
observationId: {
|
10
|
+
key: string;
|
11
|
+
valueType: "string";
|
12
|
+
};
|
13
|
+
};
|
14
|
+
export declare const observationCreated: Webhook<keyof typeof dataPoints, Observation, typeof settings>;
|
15
|
+
export type ObservationCreated = typeof observationCreated;
|
16
|
+
export {};
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.observationCreated = void 0;
|
4
|
+
const lodash_1 = require("lodash");
|
5
|
+
const constants_1 = require("../../constants");
|
6
|
+
const dataPoints = {
|
7
|
+
observation: {
|
8
|
+
key: 'observation',
|
9
|
+
valueType: 'json',
|
10
|
+
},
|
11
|
+
observationId: {
|
12
|
+
key: 'observationId',
|
13
|
+
valueType: 'string',
|
14
|
+
},
|
15
|
+
};
|
16
|
+
exports.observationCreated = {
|
17
|
+
key: 'observationCreated',
|
18
|
+
dataPoints,
|
19
|
+
onEvent: async ({ payload: { payload, rawBody, headers, settings }, onSuccess, onError, }) => {
|
20
|
+
var _a, _b, _c, _d;
|
21
|
+
const observation = payload;
|
22
|
+
const subject = observation === null || observation === void 0 ? void 0 : observation.subject;
|
23
|
+
const isPatientSubject = (_b = (_a = subject === null || subject === void 0 ? void 0 : subject.reference) === null || _a === void 0 ? void 0 : _a.startsWith('Patient/')) !== null && _b !== void 0 ? _b : false;
|
24
|
+
/**
|
25
|
+
* Observations not attached to a patient don't make much sense to us.
|
26
|
+
* So I'm discarding them.
|
27
|
+
*/
|
28
|
+
if ((0, lodash_1.isNil)(subject) || !isPatientSubject) {
|
29
|
+
await onError({
|
30
|
+
response: {
|
31
|
+
statusCode: 400,
|
32
|
+
message: 'Missing patient subject reference in Observation payload. Only observations attached to a patient are processed.',
|
33
|
+
},
|
34
|
+
});
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
const subjectAsPatient = subject;
|
38
|
+
const patientId = (_c = subjectAsPatient.reference) === null || _c === void 0 ? void 0 : _c.split('/')[1];
|
39
|
+
await onSuccess({
|
40
|
+
data_points: {
|
41
|
+
observation: JSON.stringify(observation),
|
42
|
+
observationId: (_d = observation.id) !== null && _d !== void 0 ? _d : '',
|
43
|
+
},
|
44
|
+
...(!(0, lodash_1.isNil)(patientId) && {
|
45
|
+
patient_identifier: {
|
46
|
+
system: constants_1.MEDPLUM_IDENTIFIER,
|
47
|
+
value: patientId,
|
48
|
+
},
|
49
|
+
}),
|
50
|
+
});
|
51
|
+
},
|
52
|
+
};
|
53
|
+
//# sourceMappingURL=ObservationCreated.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ObservationCreated.js","sourceRoot":"","sources":["../../../../../extensions/medplum/webhooks/ObservationCreated/ObservationCreated.ts"],"names":[],"mappings":";;;AAUA,mCAA8B;AAC9B,+CAAoD;AAEpD,MAAM,UAAU,GAAG;IACjB,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,MAAM;KAClB;IACD,aAAa,EAAE;QACb,GAAG,EAAE,eAAe;QACpB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,kBAAkB,GAI3B;IACF,GAAG,EAAE,oBAAoB;IACzB,UAAU;IACV,OAAO,EAAE,KAAK,EAAE,EACd,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAChD,SAAS,EACT,OAAO,GACR,EAAE,EAAE;;QACH,MAAM,WAAW,GAAG,OAAO,CAAA;QAC3B,MAAM,OAAO,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAA;QACpC,MAAM,gBAAgB,GAAG,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,0CAAE,UAAU,CAAC,UAAU,CAAC,mCAAI,KAAK,CAAA;QAE5E;;;WAGG;QACH,IAAI,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxC,MAAM,OAAO,CAAC;gBACZ,QAAQ,EAAE;oBACR,UAAU,EAAE,GAAG;oBACf,OAAO,EACL,kHAAkH;iBACrH;aACF,CAAC,CAAA;YACF,OAAM;QACR,CAAC;QAED,MAAM,gBAAgB,GAAG,OAA6B,CAAA;QACtD,MAAM,SAAS,GAAG,MAAA,gBAAgB,CAAC,SAAS,0CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QAE3D,MAAM,SAAS,CAAC;YACd,WAAW,EAAE;gBACX,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;gBACxC,aAAa,EAAE,MAAA,WAAW,CAAC,EAAE,mCAAI,EAAE;aACpC;YACD,GAAG,CAAC,CAAC,IAAA,cAAK,EAAC,SAAS,CAAC,IAAI;gBACvB,kBAAkB,EAAE;oBAClB,MAAM,EAAE,8BAAkB;oBAC1B,KAAK,EAAE,SAAS;iBACjB;aACF,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
export declare const ObservationCreatedPayloadExample: {
|
2
|
+
resourceType: "Observation";
|
3
|
+
status: "final";
|
4
|
+
code: {
|
5
|
+
coding: {
|
6
|
+
system: string;
|
7
|
+
code: string;
|
8
|
+
display: string;
|
9
|
+
}[];
|
10
|
+
};
|
11
|
+
subject: {
|
12
|
+
reference: string;
|
13
|
+
display: string;
|
14
|
+
};
|
15
|
+
id: string;
|
16
|
+
meta: {
|
17
|
+
versionId: string;
|
18
|
+
lastUpdated: string;
|
19
|
+
author: {
|
20
|
+
reference: string;
|
21
|
+
display: string;
|
22
|
+
};
|
23
|
+
project: string;
|
24
|
+
compartment: {
|
25
|
+
reference: string;
|
26
|
+
}[];
|
27
|
+
};
|
28
|
+
};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ObservationCreatedPayloadExample = void 0;
|
4
|
+
exports.ObservationCreatedPayloadExample = {
|
5
|
+
resourceType: 'Observation',
|
6
|
+
status: 'final',
|
7
|
+
code: {
|
8
|
+
coding: [
|
9
|
+
{
|
10
|
+
system: 'http://loinc.org',
|
11
|
+
code: '2708-6',
|
12
|
+
display: 'Oxygen saturation in Arterial blood',
|
13
|
+
},
|
14
|
+
],
|
15
|
+
},
|
16
|
+
subject: {
|
17
|
+
reference: 'Patient/9385c25c-1b28-477e-a986-4f8e008caa14',
|
18
|
+
display: 'John Ceena',
|
19
|
+
},
|
20
|
+
id: '0197eafb-19a2-71ad-b368-912ed2ed92fd',
|
21
|
+
meta: {
|
22
|
+
versionId: '0197eafb-19a2-71ad-b368-9584b8ecee5d',
|
23
|
+
lastUpdated: '2025-07-08T17:00:14.114Z',
|
24
|
+
author: {
|
25
|
+
reference: 'Practitioner/f1fe291d-c035-47e3-aaec-613b794f5502',
|
26
|
+
display: 'Nick Hellemans',
|
27
|
+
},
|
28
|
+
project: 'c87cc95a-849d-48b5-9a1c-8a51b66defb7',
|
29
|
+
compartment: [
|
30
|
+
{
|
31
|
+
reference: 'Project/c87cc95a-849d-48b5-9a1c-8a51b66defb7',
|
32
|
+
},
|
33
|
+
{
|
34
|
+
reference: 'Patient/9385c25c-1b28-477e-a986-4f8e008caa14',
|
35
|
+
},
|
36
|
+
],
|
37
|
+
},
|
38
|
+
};
|
39
|
+
//# sourceMappingURL=payloadExample.js.map
|
package/dist/extensions/medplum/webhooks/ObservationCreated/__testdata__/payloadExample.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"payloadExample.js","sourceRoot":"","sources":["../../../../../../extensions/medplum/webhooks/ObservationCreated/__testdata__/payloadExample.ts"],"names":[],"mappings":";;;AAEa,QAAA,gCAAgC,GAAG;IAC9C,YAAY,EAAE,aAAa;IAC3B,MAAM,EAAE,OAAO;IACf,IAAI,EAAE;QACJ,MAAM,EAAE;YACN;gBACE,MAAM,EAAE,kBAAkB;gBAC1B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,qCAAqC;aAC/C;SACF;KACF;IACD,OAAO,EAAE;QACP,SAAS,EAAE,8CAA8C;QACzD,OAAO,EAAE,YAAY;KACtB;IACD,EAAE,EAAE,sCAAsC;IAC1C,IAAI,EAAE;QACJ,SAAS,EAAE,sCAAsC;QACjD,WAAW,EAAE,0BAA0B;QACvC,MAAM,EAAE;YACN,SAAS,EAAE,mDAAmD;YAC9D,OAAO,EAAE,gBAAgB;SAC1B;QACD,OAAO,EAAE,sCAAsC;QAC/C,WAAW,EAAE;YACX;gBACE,SAAS,EAAE,8CAA8C;aAC1D;YACD;gBACE,SAAS,EAAE,8CAA8C;aAC1D;SACF;KACF;CACoB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './ObservationCreated';
|
@@ -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("./ObservationCreated"), exports);
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/medplum/webhooks/ObservationCreated/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC"}
|
@@ -1 +1,23 @@
|
|
1
|
-
export declare const webhooks: import("@awell-health/extensions-core").Webhook<"patientId", import("@medplum/fhirtypes").Patient, Record<string, import("@awell-health/extensions-core").Setting>>
|
1
|
+
export declare const webhooks: (import("@awell-health/extensions-core").Webhook<"patientId", import("@medplum/fhirtypes").Patient, Record<string, import("@awell-health/extensions-core").Setting>> | import("@awell-health/extensions-core").Webhook<"observationId" | "observation", import("@medplum/fhirtypes").Observation, {
|
2
|
+
clientId: {
|
3
|
+
key: string;
|
4
|
+
label: string;
|
5
|
+
obfuscated: true;
|
6
|
+
required: true;
|
7
|
+
description: string;
|
8
|
+
};
|
9
|
+
clientSecret: {
|
10
|
+
key: string;
|
11
|
+
label: string;
|
12
|
+
obfuscated: true;
|
13
|
+
required: true;
|
14
|
+
description: string;
|
15
|
+
};
|
16
|
+
baseUrl: {
|
17
|
+
key: string;
|
18
|
+
label: string;
|
19
|
+
obfuscated: false;
|
20
|
+
required: false;
|
21
|
+
description: string;
|
22
|
+
};
|
23
|
+
}>)[];
|
@@ -2,5 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.webhooks = void 0;
|
4
4
|
const patientCreated_1 = require("./patientCreated");
|
5
|
-
|
5
|
+
const ObservationCreated_1 = require("./ObservationCreated/ObservationCreated");
|
6
|
+
exports.webhooks = [patientCreated_1.patientCreated, ObservationCreated_1.observationCreated];
|
6
7
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/medplum/webhooks/index.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/medplum/webhooks/index.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AACjD,gFAA4E;AAE/D,QAAA,QAAQ,GAAG,CAAC,+BAAc,EAAE,uCAAkB,CAAC,CAAA"}
|