@metriport/shared 0.32.1 → 0.32.2

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.
Files changed (59) hide show
  1. package/dist/common/date.d.ts +1 -0
  2. package/dist/common/date.d.ts.map +1 -1
  3. package/dist/common/date.js +5 -1
  4. package/dist/common/date.js.map +1 -1
  5. package/dist/domain/patient/patient-import/schemas.js +1 -1
  6. package/dist/domain/patient/patient-import/schemas.js.map +1 -1
  7. package/dist/external/hl7v2/constants.d.ts +1 -1
  8. package/dist/external/hl7v2/constants.d.ts.map +1 -1
  9. package/dist/external/hl7v2/constants.js +2 -2
  10. package/dist/external/hl7v2/constants.js.map +1 -1
  11. package/dist/interface/external/ehr/canvas/cx-mapping.d.ts +3 -0
  12. package/dist/interface/external/ehr/canvas/cx-mapping.d.ts.map +1 -1
  13. package/dist/interface/external/ehr/canvas/cx-mapping.js +1 -0
  14. package/dist/interface/external/ehr/canvas/cx-mapping.js.map +1 -1
  15. package/dist/interface/external/ehr/canvas/external-event.d.ts +67 -0
  16. package/dist/interface/external/ehr/canvas/external-event.d.ts.map +1 -0
  17. package/dist/interface/external/ehr/canvas/external-event.js +48 -0
  18. package/dist/interface/external/ehr/canvas/external-event.js.map +1 -0
  19. package/dist/interface/external/ehr/canvas/index.d.ts +1 -0
  20. package/dist/interface/external/ehr/canvas/index.d.ts.map +1 -1
  21. package/dist/interface/external/ehr/canvas/index.js +1 -0
  22. package/dist/interface/external/ehr/canvas/index.js.map +1 -1
  23. package/dist/interface/external/ehr/canvas/jwt-token.d.ts +15 -0
  24. package/dist/interface/external/ehr/canvas/jwt-token.d.ts.map +1 -1
  25. package/dist/interface/external/ehr/canvas/jwt-token.js +7 -1
  26. package/dist/interface/external/ehr/canvas/jwt-token.js.map +1 -1
  27. package/dist/interface/external/ehr/healthie/allergy.d.ts +18 -18
  28. package/dist/interface/external/ehr/source.d.ts +2 -0
  29. package/dist/interface/external/ehr/source.d.ts.map +1 -1
  30. package/dist/interface/external/ehr/source.js +6 -1
  31. package/dist/interface/external/ehr/source.js.map +1 -1
  32. package/dist/medical/fhir/coding.d.ts +11 -0
  33. package/dist/medical/fhir/coding.d.ts.map +1 -1
  34. package/dist/medical/fhir/coding.js +27 -1
  35. package/dist/medical/fhir/coding.js.map +1 -1
  36. package/dist/medical/fhir/imaging-detection.d.ts +706 -0
  37. package/dist/medical/fhir/imaging-detection.d.ts.map +1 -0
  38. package/dist/medical/fhir/imaging-detection.js +361 -0
  39. package/dist/medical/fhir/imaging-detection.js.map +1 -0
  40. package/dist/medical/fhir/loinc/loinc-class-display-lookup.json +1730 -0
  41. package/dist/medical/fhir/loinc/loinc-code-class-lookup.json +432994 -0
  42. package/dist/medical/fhir/procedure-type.d.ts +1316 -0
  43. package/dist/medical/fhir/procedure-type.d.ts.map +1 -0
  44. package/dist/medical/fhir/procedure-type.js +263 -0
  45. package/dist/medical/fhir/procedure-type.js.map +1 -0
  46. package/dist/medical/index.d.ts +1 -0
  47. package/dist/medical/index.d.ts.map +1 -1
  48. package/dist/medical/index.js +1 -0
  49. package/dist/medical/index.js.map +1 -1
  50. package/dist/medical/webhook/webhook-request.d.ts +56 -56
  51. package/dist/util/index.d.ts +1 -0
  52. package/dist/util/index.d.ts.map +1 -1
  53. package/dist/util/index.js +1 -0
  54. package/dist/util/index.js.map +1 -1
  55. package/dist/util/sqs-delay-from-uuid.d.ts +11 -0
  56. package/dist/util/sqs-delay-from-uuid.d.ts.map +1 -0
  57. package/dist/util/sqs-delay-from-uuid.js +21 -0
  58. package/dist/util/sqs-delay-from-uuid.js.map +1 -0
  59. package/package.json +2 -2
@@ -0,0 +1,361 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.splitDiagnosticReports = exports.isImagingReport = exports.isImagingReportBasedOnDisplayValueParsing = exports.getImagingReportIdsFromProcedures = exports.isImagingCptCode = exports.IMAGING_PROCEDURE_RANGES = void 0;
4
+ const constants_1 = require("./constants");
5
+ const coding_1 = require("./coding");
6
+ const procedure_type_1 = require("./procedure-type");
7
+ /**
8
+ * Imaging procedure ranges - filtered from PROCEDURE_TYPE_RANGES where modality exists
9
+ */
10
+ exports.IMAGING_PROCEDURE_RANGES = procedure_type_1.PROCEDURE_TYPE_RANGES.filter((range) => "modality" in range && !!range.modality);
11
+ /**
12
+ * Check if a CPT code is in the imaging range
13
+ */
14
+ function isImagingCptCode(cptCode) {
15
+ const numericCode = parseInt(cptCode, 10);
16
+ if (isNaN(numericCode))
17
+ return false;
18
+ return exports.IMAGING_PROCEDURE_RANGES.some(range => numericCode >= range.start && numericCode <= range.end);
19
+ }
20
+ exports.isImagingCptCode = isImagingCptCode;
21
+ /**
22
+ * Check if a Procedure is an imaging procedure based on CPT codes
23
+ */
24
+ function isImagingProcedure(procedure) {
25
+ if (!procedure.code?.coding)
26
+ return false;
27
+ for (const c of procedure.code.coding) {
28
+ const isImaging = c.system === constants_1.CPT_URL && c.code && isImagingCptCode(c.code);
29
+ if (isImaging)
30
+ return true;
31
+ }
32
+ return false;
33
+ }
34
+ function isReferenceDiagnosticReport(reference) {
35
+ if (!reference)
36
+ return false;
37
+ return (reference.type === "DiagnosticReport" || !!reference.reference?.startsWith("DiagnosticReport/"));
38
+ }
39
+ /**
40
+ * Extract ID from a reference
41
+ */
42
+ function getReferenceId(reference) {
43
+ return reference.id || reference.reference?.split("/").pop() || "";
44
+ }
45
+ /**
46
+ * Get set of DiagnosticReport IDs that are linked to imaging Procedures
47
+ * This is the PRIMARY method for identifying imaging reports
48
+ */
49
+ function getImagingReportIdsFromProcedures(procedures) {
50
+ if (procedures.length === 0)
51
+ return new Set();
52
+ return new Set(procedures
53
+ .filter(isImagingProcedure)
54
+ .flatMap(p => p.report ?? [])
55
+ .filter(isReferenceDiagnosticReport)
56
+ .map(getReferenceId)
57
+ .filter(id => id.length > 0));
58
+ }
59
+ exports.getImagingReportIdsFromProcedures = getImagingReportIdsFromProcedures;
60
+ // LOINC codes for specific imaging types
61
+ const ECHO_LOINC_CODES = [
62
+ "59282-4",
63
+ "34552-0",
64
+ "18010-9",
65
+ "85475-2",
66
+ "18106-5", // Cardiac echo study Procedure
67
+ ];
68
+ const PFT_LOINC_CODES = [
69
+ "52485-0",
70
+ "81459-0",
71
+ "20080-8",
72
+ "81458-2", // Pulmonary function test panel
73
+ ];
74
+ const CT_LOINC_CODES = [
75
+ "46305-9",
76
+ "24725-4",
77
+ "24627-2",
78
+ "24727-0",
79
+ "41806-1",
80
+ "29252-4",
81
+ "30799-1", // CT Head WO contrast
82
+ ];
83
+ const MRI_LOINC_CODES = [
84
+ "30657-1",
85
+ "30794-2",
86
+ "36046-1",
87
+ "24589-4",
88
+ "24557-1",
89
+ "24587-8",
90
+ "24556-3", // MR Abdomen
91
+ ];
92
+ const XR_LOINC_CODES = [
93
+ "24722-1",
94
+ "24799-9",
95
+ "36643-5",
96
+ "22030-1",
97
+ "24664-5",
98
+ "37616-0", // XR Pelvis Single view
99
+ ];
100
+ const US_LOINC_CODES = [
101
+ "55034-6",
102
+ "24531-6",
103
+ "34813-6",
104
+ "59640-3",
105
+ "46298-6",
106
+ "24857-5", // US Thyroid
107
+ ];
108
+ /**
109
+ * Check if a report is an Echocardiogram imaging report
110
+ */
111
+ function isEchoImagingReport(report) {
112
+ const codings = report.code?.coding ?? [];
113
+ function includesEchoInName(s) {
114
+ const lower = s.toLowerCase();
115
+ return lower.includes("echo") || lower.includes("echocardiogram");
116
+ }
117
+ const hasEchoInName = codings.some(coding => coding.display && includesEchoInName(coding.display));
118
+ const isEchoLoincCode = codings.some(coding => coding.code && ECHO_LOINC_CODES.includes(coding.code));
119
+ return hasEchoInName || isEchoLoincCode;
120
+ }
121
+ /**
122
+ * Check if a report is a PFT (Pulmonary Function Test) imaging report
123
+ */
124
+ function isPFTImagingReport(report) {
125
+ const codings = report.code?.coding ?? [];
126
+ function includesPftInName(s) {
127
+ const lower = s.toLowerCase();
128
+ return lower.includes("pulmonary") || lower.includes("spirometry") || lower.includes("pft");
129
+ }
130
+ const hasPftInName = codings.some(coding => coding.display && includesPftInName(coding.display));
131
+ const isPftLoincCode = codings.some(coding => coding.code && PFT_LOINC_CODES.includes(coding.code));
132
+ return hasPftInName || isPftLoincCode;
133
+ }
134
+ /**
135
+ * Check if a report is a CT (Computed Tomography) imaging report
136
+ */
137
+ function isCTImagingReport(report) {
138
+ const codings = report.code?.coding ?? [];
139
+ function includesCtInName(s) {
140
+ return s.toLowerCase().startsWith("ct ") || s.toLowerCase().includes(" ct ");
141
+ }
142
+ const hasCtInName = codings.some(coding => coding.display && includesCtInName(coding.display));
143
+ const isCtLoincCode = codings.some(coding => coding.code && CT_LOINC_CODES.includes(coding.code));
144
+ return hasCtInName || isCtLoincCode;
145
+ }
146
+ /**
147
+ * Check if a report is an MRI (Magnetic Resonance Imaging) report
148
+ */
149
+ function isMRIImagingReport(report) {
150
+ const codings = report.code?.coding ?? [];
151
+ function includesMriInName(s) {
152
+ return (s.toLowerCase().startsWith("mr ") ||
153
+ s.toLowerCase().includes(" mr ") ||
154
+ s.toLowerCase().includes("mri"));
155
+ }
156
+ const hasMriInName = codings.some(coding => coding.display && includesMriInName(coding.display));
157
+ const isMriLoincCode = codings.some(coding => coding.code && MRI_LOINC_CODES.includes(coding.code));
158
+ return hasMriInName || isMriLoincCode;
159
+ }
160
+ /**
161
+ * Check if a report is an XR (X-Ray) imaging report
162
+ */
163
+ function isXRImagingReport(report) {
164
+ const codings = report.code?.coding ?? [];
165
+ function includesXrInName(s) {
166
+ return s.toLowerCase().startsWith("xr ") || s.toLowerCase().includes(" xr ");
167
+ }
168
+ const hasXrInName = codings.some(coding => coding.display && includesXrInName(coding.display));
169
+ const isXrLoincCode = codings.some(coding => coding.code && XR_LOINC_CODES.includes(coding.code));
170
+ return hasXrInName || isXrLoincCode;
171
+ }
172
+ /**
173
+ * Check if a report is an Ultrasound imaging report
174
+ */
175
+ function isUltrasoundImagingReport(report) {
176
+ const codings = report.code?.coding ?? [];
177
+ function includesUsInName(s) {
178
+ return (s.toLowerCase().startsWith("us ") ||
179
+ s.toLowerCase().includes(" us ") ||
180
+ s.toLowerCase().startsWith("us-") ||
181
+ s.toLowerCase().includes("ultrasound"));
182
+ }
183
+ const hasUsInName = codings.some(coding => coding.display && includesUsInName(coding.display));
184
+ const isUsLoincCode = codings.some(coding => coding.code && US_LOINC_CODES.includes(coding.code));
185
+ return hasUsInName || isUsLoincCode;
186
+ }
187
+ /**
188
+ * Check if a report is an imaging report based on display value parsing
189
+ * This is a fallback for when the report is not categorized by a LOINC code
190
+ */
191
+ function isImagingReportBasedOnDisplayValueParsing(report) {
192
+ return (isEchoImagingReport(report) ||
193
+ isPFTImagingReport(report) ||
194
+ isCTImagingReport(report) ||
195
+ isMRIImagingReport(report) ||
196
+ isXRImagingReport(report) ||
197
+ isUltrasoundImagingReport(report));
198
+ }
199
+ exports.isImagingReportBasedOnDisplayValueParsing = isImagingReportBasedOnDisplayValueParsing;
200
+ /**
201
+ * Get practitioners referenced by a DiagnosticReport
202
+ */
203
+ function getReportPractitioners(report, practitionerMap) {
204
+ const practitioners = [];
205
+ for (const performer of report.performer ?? []) {
206
+ if (performer.reference?.startsWith("Practitioner/")) {
207
+ const id = performer.reference.split("/")[1];
208
+ const practitioner = id ? practitionerMap.get(id) : undefined;
209
+ if (practitioner)
210
+ practitioners.push(practitioner);
211
+ }
212
+ }
213
+ return practitioners;
214
+ }
215
+ /**
216
+ * Get organizations referenced by a DiagnosticReport
217
+ */
218
+ function getReportOrganizations(report, organizationMap) {
219
+ const organizations = [];
220
+ for (const performer of report.performer ?? []) {
221
+ if (performer.reference?.startsWith("Organization/")) {
222
+ const id = performer.reference.split("/")[1];
223
+ const organization = id ? organizationMap.get(id) : undefined;
224
+ if (organization)
225
+ organizations.push(organization);
226
+ }
227
+ }
228
+ return organizations;
229
+ }
230
+ /**
231
+ * Get practitioners from an Encounter
232
+ */
233
+ function getEncounterPractitioners(encounter, practitionerMap) {
234
+ const practitioners = [];
235
+ for (const participant of encounter.participant ?? []) {
236
+ if (participant.individual?.reference?.startsWith("Practitioner/")) {
237
+ const id = participant.individual.reference.split("/")[1];
238
+ const practitioner = id ? practitionerMap.get(id) : undefined;
239
+ if (practitioner)
240
+ practitioners.push(practitioner);
241
+ }
242
+ }
243
+ return practitioners;
244
+ }
245
+ /**
246
+ * Get organizations from an Encounter
247
+ */
248
+ function getEncounterOrganizations(encounter, organizationMap) {
249
+ const organizations = [];
250
+ if (encounter.serviceProvider?.reference?.startsWith("Organization/")) {
251
+ const id = encounter.serviceProvider.reference.split("/")[1];
252
+ const organization = id ? organizationMap.get(id) : undefined;
253
+ if (organization)
254
+ organizations.push(organization);
255
+ }
256
+ return organizations;
257
+ }
258
+ function buildContextMaps(context) {
259
+ const practitionerMap = new Map();
260
+ for (const p of context.practitioners) {
261
+ if (p.id)
262
+ practitionerMap.set(p.id, p);
263
+ }
264
+ const organizationMap = new Map();
265
+ for (const o of context.organizations) {
266
+ if (o.id)
267
+ organizationMap.set(o.id, o);
268
+ }
269
+ const encounterMap = new Map();
270
+ for (const e of context.encounters) {
271
+ if (e.id)
272
+ encounterMap.set(e.id, e);
273
+ }
274
+ return { practitionerMap, organizationMap, encounterMap };
275
+ }
276
+ /**
277
+ * Main function to determine if a DiagnosticReport is an imaging report
278
+ * This is the primary logic used to split DiagnosticReports into Imaging vs Clinical Notes
279
+ */
280
+ function isImagingReport(report, imagingReportIds, context, maps) {
281
+ // 1. Check if report ID is in the set of imaging report IDs (from Procedures)
282
+ if (report.id && imagingReportIds.has(report.id)) {
283
+ return true;
284
+ }
285
+ // 2. Check LOINC code class - if abbreviation is "RAD" (Radiology)
286
+ const loincCoding = report.code?.coding?.find(coding_1.isLoincCoding);
287
+ if (loincCoding && loincCoding.code) {
288
+ const loincClass = (0, coding_1.getLoincCodeClass)(loincCoding.code);
289
+ if (loincClass?.abbreviation === "RAD") {
290
+ return true;
291
+ }
292
+ }
293
+ // 3. Check display value parsing (fallback for uncategorized reports)
294
+ if (isImagingReportBasedOnDisplayValueParsing(report)) {
295
+ return true;
296
+ }
297
+ const { practitionerMap, organizationMap, encounterMap } = maps ?? buildContextMaps(context);
298
+ // Get the encounter for the report
299
+ const encounterId = report.encounter?.reference?.split("/").pop();
300
+ const encounter = encounterId ? encounterMap.get(encounterId) : undefined;
301
+ // 4. Check practitioner qualifications
302
+ const reportPractitioners = getReportPractitioners(report, practitionerMap);
303
+ const encounterPractitioners = encounter
304
+ ? getEncounterPractitioners(encounter, practitionerMap)
305
+ : [];
306
+ const allPractitioners = [...reportPractitioners, ...encounterPractitioners];
307
+ for (const practitioner of allPractitioners) {
308
+ if (practitioner.qualification) {
309
+ for (const qualification of practitioner.qualification) {
310
+ if (qualification.code?.text) {
311
+ const qualificationText = qualification.code.text.toLowerCase();
312
+ if (qualificationText.includes("radiology") || qualificationText.includes("imaging")) {
313
+ return true;
314
+ }
315
+ }
316
+ if (qualification.code?.coding) {
317
+ for (const coding of qualification.code.coding) {
318
+ const display = coding.display?.toLowerCase();
319
+ if (display && (display.includes("radiology") || display.includes("imaging"))) {
320
+ return true;
321
+ }
322
+ }
323
+ }
324
+ }
325
+ }
326
+ }
327
+ // 5. Check organization names
328
+ const reportOrganizations = getReportOrganizations(report, organizationMap);
329
+ const encounterOrganizations = encounter
330
+ ? getEncounterOrganizations(encounter, organizationMap)
331
+ : [];
332
+ const allOrganizations = [...reportOrganizations, ...encounterOrganizations];
333
+ for (const organization of allOrganizations) {
334
+ const name = organization.name?.toLowerCase();
335
+ if (name && (name.includes("radiology") || name.includes("imaging"))) {
336
+ return true;
337
+ }
338
+ }
339
+ return false;
340
+ }
341
+ exports.isImagingReport = isImagingReport;
342
+ /**
343
+ * Split diagnostic reports into imaging reports and clinical notes
344
+ */
345
+ function splitDiagnosticReports(diagnosticReports, procedures, context) {
346
+ const imagingReportIds = getImagingReportIdsFromProcedures(procedures);
347
+ const maps = buildContextMaps(context);
348
+ const imagingReports = [];
349
+ const clinicalNotes = [];
350
+ for (const report of diagnosticReports) {
351
+ if (isImagingReport(report, imagingReportIds, context, maps)) {
352
+ imagingReports.push(report);
353
+ }
354
+ else {
355
+ clinicalNotes.push(report);
356
+ }
357
+ }
358
+ return { imagingReports, clinicalNotes };
359
+ }
360
+ exports.splitDiagnosticReports = splitDiagnosticReports;
361
+ //# sourceMappingURL=imaging-detection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imaging-detection.js","sourceRoot":"","sources":["../../../src/medical/fhir/imaging-detection.ts"],"names":[],"mappings":";;;AAUA,2CAAsC;AACtC,qCAA4D;AAC5D,qDAAyD;AAGzD;;GAEG;AACU,QAAA,wBAAwB,GAAG,sCAAqB,CAAC,MAAM,CAClE,CAAC,KAAK,EAAgD,EAAE,CAAC,UAAU,IAAI,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CACjG,CAAC;AAEF;;GAEG;AACH,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,KAAK,CAAC,WAAW,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,OAAO,gCAAwB,CAAC,IAAI,CAClC,KAAK,CAAC,EAAE,CAAC,WAAW,IAAI,KAAK,CAAC,KAAK,IAAI,WAAW,IAAI,KAAK,CAAC,GAAG,CAChE,CAAC;AACJ,CAAC;AAND,4CAMC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,SAAoB;IAC9C,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1C,KAAK,MAAM,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE;QACrC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,KAAK,mBAAO,IAAI,CAAC,CAAC,IAAI,IAAI,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7E,IAAI,SAAS;YAAE,OAAO,IAAI,CAAC;KAC5B;IACD,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