From 09642100dcdff4c4350afb40b4597c5d221db30c Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Tue, 6 Oct 2026 20:53:43 +0000 Subject: [PATCH] Epic tuning: progress notes are notes; CarePlan searches by category Found against Epic's MyChart sandbox: LOINC 11506-3 is a progress note, not an after-visit summary, and Epic refuses CarePlan without a category. Co-Authored-By: Claude Opus 5.5 --- apps/web/src/records.js | 4 ++-- test/records.test.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/src/records.js b/apps/web/src/records.js index dafd543..f792a9b 100644 --- a/apps/web/src/records.js +++ b/apps/web/src/records.js @@ -390,7 +390,7 @@ export function humanName(r) { } const IMAGING = /imaging|radiology|\brad\b|x-?ray|\bct\b|mri|ultrasound|mammo|dicom|18748-4/; -const SUMMARY = /after visit|avs|discharge|visit summary|summary of care|continuity of care|ccd|clinical summary|18842-5|34133-9|11506-3/; +const SUMMARY = /after visit|avs|discharge|visit summary|summary of care|continuity of care|ccd|clinical summary|18842-5|34133-9/; /** Which bucket a resource goes in, a one-line title, and its date. */ export function classify(r) { @@ -539,7 +539,7 @@ const SEARCHES = [ ['Procedure'], ['ImagingStudy'], ['Media'], - ['CarePlan'], + ['CarePlan', ['38717003', '734163000', 'assess-plan']], ['Goal'], ['Coverage'], ['ServiceRequest'], diff --git a/test/records.test.js b/test/records.test.js index ac94834..382c472 100644 --- a/test/records.test.js +++ b/test/records.test.js @@ -39,6 +39,8 @@ describe('records units', () => { const avs = { resourceType: 'DocumentReference', id: '1', type: { text: 'After Visit Summary' }, date: '2026-01-02T10:00:00Z' }; expect(records.classify(avs)).toEqual({ category: 'summaries', title: 'After Visit Summary', recorded_on: '2026-01-02' }); expect(records.classify({ resourceType: 'DocumentReference', id: '2', type: { text: 'Progress Note' } }).category).toBe('notes'); + // Epic's progress notes carry LOINC 11506-3; they are notes, not after-visit summaries. + expect(records.classify({ resourceType: 'DocumentReference', id: '2b', type: { coding: [{ system: 'http://loinc.org', code: '11506-3', display: 'Progress note' }] } }).category).toBe('notes'); expect(records.classify({ resourceType: 'DiagnosticReport', id: '3', category: [{ coding: [{ code: 'RAD' }] }], code: { text: 'Chest X-ray' } }).category).toBe('imaging'); expect(records.classify({ resourceType: 'Observation', id: '4', category: [{ coding: [{ code: 'laboratory' }] }], code: { text: 'A1c' } }).category).toBe('labs'); expect(records.classify({ resourceType: 'Observation', id: '5', category: [{ coding: [{ code: 'vital-signs' }] }], code: { text: 'BP' } }).category).toBe('vitals');