@awell-health/awell-extensions 2.1.190 → 2.1.192
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/metriport/actions/patient/validation.js +15 -6
- package/dist/extensions/metriport/actions/patient/validation.js.map +1 -1
- package/dist/extensions/metriport/actions/webhookBundle/bundle/entries.d.ts +9 -1
- package/dist/extensions/metriport/actions/webhookBundle/bundle/entries.js +18 -7
- package/dist/extensions/metriport/actions/webhookBundle/bundle/entries.js.map +1 -1
- package/dist/extensions/metriport/actions/webhookBundle/bundle/index.d.ts +4 -1
- package/dist/extensions/metriport/actions/webhookBundle/bundle/index.js +2 -2
- package/dist/extensions/metriport/actions/webhookBundle/bundle/index.js.map +1 -1
- package/dist/extensions/metriport/actions/webhookBundle/getWebhookBundle.js +2 -1
- package/dist/extensions/metriport/actions/webhookBundle/getWebhookBundle.js.map +1 -1
- package/package.json +1 -1
|
@@ -39,17 +39,21 @@ const extensions_core_1 = require("@awell-health/extensions-core");
|
|
|
39
39
|
const emailValidation_1 = require("../../../../src/utils/emailValidation");
|
|
40
40
|
const api_sdk_1 = require("@metriport/api-sdk");
|
|
41
41
|
/**
|
|
42
|
-
* Awell stores a patient's sex as `Male`, `Female
|
|
43
|
-
* expects a single letter code (`M`, `F`, `O`,
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
42
|
+
* Awell stores a patient's sex as free text (e.g. `Male`, `Female`,
|
|
43
|
+
* `Non-Binary`) while Metriport expects a single letter code (`M`, `F`, `O`,
|
|
44
|
+
* `U`). Anything that maps to `M` or `F` is recognised explicitly, as is
|
|
45
|
+
* anything that explicitly spells out "unknown". Every other given value
|
|
46
|
+
* (including things we've never seen, like `Non-Binary`) becomes `O` rather
|
|
47
|
+
* than being rejected. `U` is otherwise reserved for when no value was given
|
|
48
|
+
* at all.
|
|
47
49
|
*/
|
|
48
50
|
const genderAtBirthAliases = {
|
|
49
51
|
m: 'M',
|
|
50
52
|
male: 'M',
|
|
53
|
+
man: 'M',
|
|
51
54
|
f: 'F',
|
|
52
55
|
female: 'F',
|
|
56
|
+
woman: 'F',
|
|
53
57
|
o: 'O',
|
|
54
58
|
other: 'O',
|
|
55
59
|
u: 'U',
|
|
@@ -58,9 +62,14 @@ const genderAtBirthAliases = {
|
|
|
58
62
|
};
|
|
59
63
|
exports.genderAtBirthTransformSchema = z.preprocess((value) => {
|
|
60
64
|
var _a;
|
|
65
|
+
if (value === undefined || value === null)
|
|
66
|
+
return 'U';
|
|
61
67
|
if (typeof value !== 'string')
|
|
62
68
|
return value;
|
|
63
|
-
|
|
69
|
+
const normalized = value.trim().toLowerCase();
|
|
70
|
+
if (normalized === '')
|
|
71
|
+
return 'U';
|
|
72
|
+
return (_a = genderAtBirthAliases[normalized]) !== null && _a !== void 0 ? _a : 'O';
|
|
64
73
|
}, api_sdk_1.genderAtBirthSchema);
|
|
65
74
|
exports.patientCreateSchema = z.object({
|
|
66
75
|
firstName: z.string().min(1),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../../extensions/metriport/actions/patient/validation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,mEAA8D;AAC9D,2EAA2E;AAC3E,gDAG2B;AAE3B
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../../extensions/metriport/actions/patient/validation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,mEAA8D;AAC9D,2EAA2E;AAC3E,gDAG2B;AAE3B;;;;;;;;GAQG;AACH,MAAM,oBAAoB,GAGtB;IACF,CAAC,EAAE,GAAG;IACN,IAAI,EAAE,GAAG;IACT,GAAG,EAAE,GAAG;IACR,CAAC,EAAE,GAAG;IACN,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;IACV,CAA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AAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,qCAAmB;CAC3B,CAAC,CAAA;AAIW,QAAA,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACtB,CAAC;KACD,KAAK,CAAC,2BAAmB,CAAC,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type BundleEntry, type Resource } from '@medplum/fhirtypes';
|
|
2
|
+
import { type Helpers } from '@awell-health/extensions-core';
|
|
2
3
|
/**
|
|
3
4
|
* Turns a Metriport resource into an executable bundle entry.
|
|
4
5
|
*
|
|
@@ -23,5 +24,12 @@ import { type BundleEntry, type Resource } from '@medplum/fhirtypes';
|
|
|
23
24
|
*
|
|
24
25
|
* Resource types with no `identifier` element in FHIR R4 cannot be addressed by
|
|
25
26
|
* a conditional update, so they fall back to POST.
|
|
27
|
+
*
|
|
28
|
+
* `identifier` is 0..* per the FHIR spec, but Metriport resources have been
|
|
29
|
+
* seen with a single object instead of an array. That's non-conformant data,
|
|
30
|
+
* not a shape we can confidently normalize, so it is left untouched rather
|
|
31
|
+
* than being recast into a list and appended to. The conditional update is
|
|
32
|
+
* still attempted, but since the resource never receives our stamp, it won't
|
|
33
|
+
* be found on redelivery — this case is not reconciled idempotently.
|
|
26
34
|
*/
|
|
27
|
-
export declare const buildResourceEntry: (resource: Resource, fullUrl?: string) => BundleEntry;
|
|
35
|
+
export declare const buildResourceEntry: (resource: Resource, fullUrl?: string, log?: Helpers["log"]) => BundleEntry;
|
|
@@ -26,13 +26,20 @@ const constants_1 = require("./constants");
|
|
|
26
26
|
*
|
|
27
27
|
* Resource types with no `identifier` element in FHIR R4 cannot be addressed by
|
|
28
28
|
* a conditional update, so they fall back to POST.
|
|
29
|
+
*
|
|
30
|
+
* `identifier` is 0..* per the FHIR spec, but Metriport resources have been
|
|
31
|
+
* seen with a single object instead of an array. That's non-conformant data,
|
|
32
|
+
* not a shape we can confidently normalize, so it is left untouched rather
|
|
33
|
+
* than being recast into a list and appended to. The conditional update is
|
|
34
|
+
* still attempted, but since the resource never receives our stamp, it won't
|
|
35
|
+
* be found on redelivery — this case is not reconciled idempotently.
|
|
29
36
|
*/
|
|
30
|
-
const buildResourceEntry = (resource, fullUrl) => {
|
|
31
|
-
var _a;
|
|
37
|
+
const buildResourceEntry = (resource, fullUrl, log) => {
|
|
32
38
|
const { id, resourceType } = resource;
|
|
33
39
|
if (id === undefined) {
|
|
34
40
|
throw new Error(`[Metriport bundle] ${resourceType} entry is missing an id, so it cannot be reconciled`);
|
|
35
41
|
}
|
|
42
|
+
log === null || log === void 0 ? void 0 : log({ resourceType, id }, '[Metriport bundle] Building resource entry');
|
|
36
43
|
// Shallow clone, then drop the two fields Medplum must assign itself. Nested
|
|
37
44
|
// objects are shared with the input, but nothing nested is modified — the
|
|
38
45
|
// identifier list below is replaced rather than appended to in place.
|
|
@@ -49,11 +56,15 @@ const buildResourceEntry = (resource, fullUrl) => {
|
|
|
49
56
|
}
|
|
50
57
|
const system = (0, constants_1.metriportIdentifierSystem)(resourceType);
|
|
51
58
|
const identifiable = stripped;
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
?
|
|
56
|
-
|
|
59
|
+
const rawIdentifier = identifiable.identifier;
|
|
60
|
+
log === null || log === void 0 ? void 0 : log({ resourceType, identifiers: rawIdentifier }, '[Metriport bundle] Existing identifiers on resource');
|
|
61
|
+
if (!rawIdentifier || Array.isArray(rawIdentifier)) {
|
|
62
|
+
const existing = rawIdentifier !== null && rawIdentifier !== void 0 ? rawIdentifier : [];
|
|
63
|
+
const alreadyStamped = existing.some((identifier) => identifier.system === system && identifier.value === id);
|
|
64
|
+
identifiable.identifier = alreadyStamped
|
|
65
|
+
? existing
|
|
66
|
+
: [...existing, { system, value: id }];
|
|
67
|
+
}
|
|
57
68
|
return {
|
|
58
69
|
fullUrl: localIdentity,
|
|
59
70
|
resource: stripped,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entries.js","sourceRoot":"","sources":["../../../../../../extensions/metriport/actions/webhookBundle/bundle/entries.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"entries.js","sourceRoot":"","sources":["../../../../../../extensions/metriport/actions/webhookBundle/bundle/entries.ts"],"names":[],"mappings":";;;AAMA,2CAGoB;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACI,MAAM,kBAAkB,GAAG,CAChC,QAAkB,EAClB,OAAgB,EAChB,GAAoB,EACP,EAAE;IACf,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAA;IAErC,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CACb,sBAAsB,YAAY,qDAAqD,CACxF,CAAA;IACH,CAAC;IAED,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAG,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE,4CAA4C,CAAC,CAAA;IAEzE,6EAA6E;IAC7E,0EAA0E;IAC1E,sEAAsE;IACtE,MAAM,QAAQ,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAA;IAChC,OAAO,QAAQ,CAAC,EAAE,CAAA;IAClB,OAAO,QAAQ,CAAC,IAAI,CAAA;IAEpB,MAAM,aAAa,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,YAAY,EAAE,EAAE,CAAA;IAEjD,IAAI,6CAAiC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC7D,OAAO;YACL,OAAO,EAAE,aAAa;YACtB,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE;SAC/C,CAAA;IACH,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,qCAAyB,EAAC,YAAY,CAAC,CAAA;IACtD,MAAM,YAAY,GAAG,QAAsD,CAAA;IAC3E,MAAM,aAAa,GAAG,YAAY,CAAC,UAAU,CAAA;IAE7C,GAAG,aAAH,GAAG,uBAAH,GAAG,CACD,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,EAC5C,qDAAqD,CACtD,CAAA;IAED,IAAI,CAAC,aAAa,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QACnD,MAAM,QAAQ,GAAG,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,CAAA;QACpC,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAClC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,KAAK,MAAM,IAAI,UAAU,CAAC,KAAK,KAAK,EAAE,CACxE,CAAA;QAED,YAAY,CAAC,UAAU,GAAG,cAAc;YACtC,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAA;IAC1C,CAAC;IAED,OAAO;QACL,OAAO,EAAE,aAAa;QACtB,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE;YACP,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,GAAG,YAAY,eAAe,MAAM,IAAI,EAAE,EAAE;SAClD;KACF,CAAA;AACH,CAAC,CAAA;AA5DY,QAAA,kBAAkB,sBA4D9B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Bundle } from '@medplum/fhirtypes';
|
|
2
|
+
import { type Helpers } from '@awell-health/extensions-core';
|
|
2
3
|
export interface BuildTransactionBundleArgs {
|
|
3
4
|
/** The `collection` bundle fetched from Metriport's pre-signed URL. */
|
|
4
5
|
bundle: Bundle;
|
|
@@ -10,6 +11,8 @@ export interface BuildTransactionBundleArgs {
|
|
|
10
11
|
reason?: string;
|
|
11
12
|
/** Fallback for `Provenance.recorded`; injectable so tests stay deterministic. */
|
|
12
13
|
now?: string;
|
|
14
|
+
/** Structured logger from the action's `helpers`; omitted in tests. */
|
|
15
|
+
log?: Helpers['log'];
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
18
|
* Converts a Metriport Patient Encounter Bundle into a bundle Medplum can
|
|
@@ -32,4 +35,4 @@ export interface BuildTransactionBundleArgs {
|
|
|
32
35
|
*
|
|
33
36
|
* https://docs.metriport.com/medical-api/handling-data/patient-encounter-bundle
|
|
34
37
|
*/
|
|
35
|
-
export declare const buildTransactionBundle: ({ bundle, awellPatientId, eventType, reason, now, }: BuildTransactionBundleArgs) => Bundle | undefined;
|
|
38
|
+
export declare const buildTransactionBundle: ({ bundle, awellPatientId, eventType, reason, now, log, }: BuildTransactionBundleArgs) => Bundle | undefined;
|
|
@@ -26,7 +26,7 @@ const references_1 = require("./references");
|
|
|
26
26
|
*
|
|
27
27
|
* https://docs.metriport.com/medical-api/handling-data/patient-encounter-bundle
|
|
28
28
|
*/
|
|
29
|
-
const buildTransactionBundle = ({ bundle, awellPatientId, eventType, reason, now, }) => {
|
|
29
|
+
const buildTransactionBundle = ({ bundle, awellPatientId, eventType, reason, now, log, }) => {
|
|
30
30
|
var _a, _b, _c;
|
|
31
31
|
if (bundle.type !== 'collection')
|
|
32
32
|
return undefined;
|
|
@@ -48,7 +48,7 @@ const buildTransactionBundle = ({ bundle, awellPatientId, eventType, reason, now
|
|
|
48
48
|
// source of truth for it, so Metriport demographics must not overwrite it.
|
|
49
49
|
const resourceEntries = entries
|
|
50
50
|
.filter((entry) => entry.resource.resourceType !== 'Patient')
|
|
51
|
-
.map((entry) => (0, entries_1.buildResourceEntry)((0, references_1.rewriteReferences)(entry.resource, referenceMap), entry.fullUrl));
|
|
51
|
+
.map((entry) => (0, entries_1.buildResourceEntry)((0, references_1.rewriteReferences)(entry.resource, referenceMap), entry.fullUrl, log));
|
|
52
52
|
const provenance = (0, provenance_1.buildProvenance)({
|
|
53
53
|
targetReferences: resourceEntries
|
|
54
54
|
.map((entry) => entry.fullUrl)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/metriport/actions/webhookBundle/bundle/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/metriport/actions/webhookBundle/bundle/index.ts"],"names":[],"mappings":";;;AAMA,uCAAyD;AACzD,uCAA8C;AAC9C,6CAA8C;AAC9C,6CAAmE;AAiBnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,MAAM,sBAAsB,GAAG,CAAC,EACrC,MAAM,EACN,cAAc,EACd,SAAS,EACT,MAAM,EACN,GAAG,EACH,GAAG,GACwB,EAAsB,EAAE;;IACnD,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,SAAS,CAAA;IAElD,4EAA4E;IAC5E,6EAA6E;IAC7E,sBAAsB;IACtB,MAAM,OAAO,GAAG,CAAC,MAAA,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,MAAM,CACzC,CAAC,KAAK,EAAiD,EAAE,CACvD,KAAK,CAAC,QAAQ,KAAK,SAAS,CAC/B,CAAA;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAC7B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,KAAK,SAAS,CACrD,CAAA;IACD,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAC/B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,KAAK,WAAW,CACvD,CAAA;IAED,MAAM,OAAO,GAAG;QACd,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,C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CAAC;KACzE,CAAA;AACH,CAAC,CAAA;AAnEY,QAAA,sBAAsB,0BAmElC"}
|
|
@@ -18,7 +18,7 @@ exports.getWebhookBundle = {
|
|
|
18
18
|
previewable: true,
|
|
19
19
|
supports_automated_retries: true,
|
|
20
20
|
dataPoints: dataPoints_1.dataPoints,
|
|
21
|
-
|
|
21
|
+
onEvent: async ({ payload, onComplete, onError, helpers }) => {
|
|
22
22
|
try {
|
|
23
23
|
const { url, eventType, provenanceReason } = validation_1.getWebhookBundleSchema.parse(payload.fields);
|
|
24
24
|
const bundle = await (0, fetchBundle_1.fetchBundle)(url);
|
|
@@ -32,6 +32,7 @@ exports.getWebhookBundle = {
|
|
|
32
32
|
awellPatientId: payload.patient.id,
|
|
33
33
|
eventType,
|
|
34
34
|
reason: provenanceReason,
|
|
35
|
+
log: helpers.log,
|
|
35
36
|
});
|
|
36
37
|
const encounterId = (0, encounter_1.findEncounterId)(bundle);
|
|
37
38
|
await onComplete({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWebhookBundle.js","sourceRoot":"","sources":["../../../../../extensions/metriport/actions/webhookBundle/getWebhookBundle.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,4DAA8D;AAC9D,qCAAiC;AACjC,6CAAqD;AACrD,6CAAyC;AACzC,0DAAsD;AACtD,qCAAiD;AACjD,kDAAoD;AAEvC,QAAA,gBAAgB,GAIzB;IACF,GAAG,EAAE,kBAAkB;IACvB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EACT,+PAA+P;IACjQ,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,IAAI;IACjB,0BAA0B,EAAE,IAAI;IAChC,UAAU,EAAV,uBAAU;IACV,
|
|
1
|
+
{"version":3,"file":"getWebhookBundle.js","sourceRoot":"","sources":["../../../../../extensions/metriport/actions/webhookBundle/getWebhookBundle.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;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