Skip to content

Commit d4f568c

Browse files
committed
garotm - add samples for testing and change to gemma4:26b for default model.
1 parent f25b04d commit d4f568c

5 files changed

Lines changed: 317 additions & 1 deletion

File tree

backend/src/llmDefaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/** Defaults aligned with Ollama’s OpenAI-compatible API (`/v1/chat/completions` on port 11434). */
22
export const DEFAULT_LLM_BASE_URL = "http://127.0.0.1:11434/v1";
33
/** Common tag; change in Settings to match `ollama list` (e.g. `llama3.2`, `mistral`, `qwen2.5:14b`). */
4-
export const DEFAULT_LLM_MODEL = "llama3.2";
4+
export const DEFAULT_LLM_MODEL_GEMMA="gemma4:26b"

samples/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Sample records
2+
3+
Three realistic (fictional) clinical records for testing Sift end-to-end.
4+
All patient names, dates, and values are entirely fabricated.
5+
6+
| File | Format | What it contains |
7+
| -------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------ |
8+
| `patient-fhir-bundle.json` | FHIR R4 Bundle | Patient demographics, 3 active conditions, 3 medications, 3 lab observations (A1c, creatinine, BP), 1 allergy |
9+
| `lab-result-hl7.hl7` | HL7 v2.5 ORU^R01 | Comprehensive metabolic panel with critical eGFR, elevated HbA1c, and abnormal lipids — includes NTE warning notes |
10+
| `referral-letter.txt` | Plain text | Cardiology referral letter for a complex patient with new wall motion abnormality, reduced EF, and elevated BNP |
11+
12+
## How to test
13+
14+
1. Start the app: `node sift.mjs run`
15+
2. Open **Settings** → pick any folder as your **Records folder** (or create a
16+
dedicated test folder).
17+
3. Copy one or more files from this `samples/` directory into that folder:
18+
19+
```bash
20+
cp samples/patient-fhir-bundle.json ~/your-watch-folder/
21+
cp samples/lab-result-hl7.hl7 ~/your-watch-folder/
22+
cp samples/referral-letter.txt ~/your-watch-folder/
23+
```
24+
25+
4. Switch to the **Documents** tab — each file should appear within a few
26+
seconds as the watcher picks it up.
27+
5. Click a document to see the **clinical synthesis** (LLM summary) and the
28+
**extracted context** (what was passed to the model).
29+
6. Hit **Print report** to get a printable clinical brief.
30+
31+
## What good output looks like
32+
33+
**FHIR bundle** — Sift should extract patient name, DOB, active diagnoses
34+
(T2DM, hypertension, CKD stage 3), current medications, and recent labs (A1c
35+
8.9%, creatinine 1.8, BP 148/92). The LLM summary should note the poorly
36+
controlled diabetes and the nephrology recommendation.
37+
38+
**HL7 lab result** — Sift should parse the OBX segments and surface the
39+
critical eGFR (36), elevated HbA1c (9.2%), and abnormal lipids. The NTE
40+
fields contain clinical comments that the model will incorporate.
41+
42+
**Referral letter** — plain text, so extraction relies entirely on the LLM.
43+
The summary should capture the new inferior hypokinesis, reduced LVEF (45%),
44+
elevated BNP, and the direct admission plan.

samples/lab-result-hl7.hl7

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
MSH|^~\&|LABSYS|SPRINGFIELD_LAB|CLINIC_EMR|MAIN_CLINIC|20260318143022||ORU^R01|MSG20260318001|P|2.5
2+
PID|1||PT-00456^^^CLINIC^MR||Delgado^Carlos^Miguel||19720905|M|||88 Maple Court^^Chicago^IL^60601||312-555-0847|||||
3+
PV1|1|O|CLINIC^^^MAIN_CLINIC||||DR-0042^Nguyen^Sarah^L^^^MD|||||||||||V-20260318-1
4+
ORC|RE|ORD-20260318-042||||||||||DR-0042^Nguyen^Sarah^L^^^MD
5+
OBR|1|ORD-20260318-042||80053^Comprehensive Metabolic Panel^CPT|||20260318090000|||||||20260318143000||DR-0042^Nguyen^Sarah^L^^^MD||||||F
6+
OBX|1|NM|2951-2^Sodium^LN||138|mmol/L|136-145||||F|||20260318143000
7+
OBX|2|NM|2823-3^Potassium^LN||3.4|mmol/L|3.5-5.1|L|||F|||20260318143000
8+
OBX|3|NM|2075-0^Chloride^LN||101|mmol/L|98-107||||F|||20260318143000
9+
OBX|4|NM|1963-8^Bicarbonate^LN||22|mmol/L|22-29||||F|||20260318143000
10+
OBX|5|NM|3094-0^BUN^LN||28|mg/dL|7-20|H|||F|||20260318143000
11+
OBX|6|NM|2160-0^Creatinine^LN||2.1|mg/dL|0.7-1.3|H|||F|||20260318143000
12+
OBX|7|NM|33914-3^eGFR^LN||36|mL/min/1.73m2|>60|L|||F|||20260318143000
13+
OBX|8|NM|2345-7^Glucose^LN||214|mg/dL|70-100|H|||F|||20260318143000
14+
OBX|9|NM|1742-6^ALT^LN||52|U/L|7-56||||F|||20260318143000
15+
OBX|10|NM|1920-8^AST^LN||48|U/L|10-40|H|||F|||20260318143000
16+
OBX|11|NM|17856-6^HbA1c^LN||9.2|%|<5.7|H|||F|||20260318143000
17+
OBX|12|NM|2093-3^Cholesterol^LN||224|mg/dL|<200|H|||F|||20260318143000
18+
OBX|13|NM|13457-7^LDL^LN||148|mg/dL|<100|H|||F|||20260318143000
19+
OBX|14|NM|2085-9^HDL^LN||38|mg/dL|>40|L|||F|||20260318143000
20+
OBX|15|NM|2571-8^Triglycerides^LN||310|mg/dL|<150|H|||F|||20260318143000
21+
NTE|1||CRITICAL VALUES ALERT: eGFR 36 indicates Stage 3b CKD. Recommend nephrology referral and medication review for renal dosing.
22+
NTE|2||HbA1c 9.2% indicates poorly controlled diabetes. Consider intensification of diabetic regimen.
23+
NTE|3||Lipid panel markedly abnormal. LDL 148 well above goal for diabetic patient. Statin therapy review recommended.

samples/patient-fhir-bundle.json

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
{
2+
"resourceType": "Bundle",
3+
"type": "collection",
4+
"entry": [
5+
{
6+
"resource": {
7+
"resourceType": "Patient",
8+
"id": "pt-00123",
9+
"name": [{ "family": "Hartwell", "given": ["Margaret", "Ann"], "use": "official" }],
10+
"birthDate": "1958-03-14",
11+
"gender": "female",
12+
"telecom": [{ "system": "phone", "value": "555-304-1192", "use": "home" }],
13+
"address": [{ "line": ["44 Birchwood Lane"], "city": "Springfield", "state": "IL", "postalCode": "62704" }]
14+
}
15+
},
16+
{
17+
"resource": {
18+
"resourceType": "Condition",
19+
"id": "cond-001",
20+
"subject": { "reference": "Patient/pt-00123" },
21+
"code": {
22+
"coding": [{ "system": "http://snomed.info/sct", "code": "44054006", "display": "Type 2 diabetes mellitus" }]
23+
},
24+
"clinicalStatus": { "coding": [{ "code": "active" }] },
25+
"onsetDateTime": "2014-07-22",
26+
"note": [{ "text": "Poorly controlled. A1c trending up over last 18 months." }]
27+
}
28+
},
29+
{
30+
"resource": {
31+
"resourceType": "Condition",
32+
"id": "cond-002",
33+
"subject": { "reference": "Patient/pt-00123" },
34+
"code": {
35+
"coding": [{ "system": "http://snomed.info/sct", "code": "38341003", "display": "Hypertension" }]
36+
},
37+
"clinicalStatus": { "coding": [{ "code": "active" }] },
38+
"onsetDateTime": "2011-02-10"
39+
}
40+
},
41+
{
42+
"resource": {
43+
"resourceType": "Condition",
44+
"id": "cond-003",
45+
"subject": { "reference": "Patient/pt-00123" },
46+
"code": {
47+
"coding": [{ "system": "http://snomed.info/sct", "code": "267425008", "display": "Chronic kidney disease stage 3" }]
48+
},
49+
"clinicalStatus": { "coding": [{ "code": "active" }] },
50+
"onsetDateTime": "2021-09-15",
51+
"note": [{ "text": "eGFR 42 on last draw. Nephrology follow-up recommended." }]
52+
}
53+
},
54+
{
55+
"resource": {
56+
"resourceType": "MedicationRequest",
57+
"id": "med-001",
58+
"subject": { "reference": "Patient/pt-00123" },
59+
"status": "active",
60+
"intent": "order",
61+
"medicationCodeableConcept": {
62+
"coding": [{ "system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code": "860975", "display": "Metformin 1000 mg oral tablet" }]
63+
},
64+
"dosageInstruction": [{ "text": "1 tablet twice daily with meals" }]
65+
}
66+
},
67+
{
68+
"resource": {
69+
"resourceType": "MedicationRequest",
70+
"id": "med-002",
71+
"subject": { "reference": "Patient/pt-00123" },
72+
"status": "active",
73+
"intent": "order",
74+
"medicationCodeableConcept": {
75+
"coding": [{ "system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code": "29046", "display": "Lisinopril 10 mg oral tablet" }]
76+
},
77+
"dosageInstruction": [{ "text": "1 tablet once daily" }]
78+
}
79+
},
80+
{
81+
"resource": {
82+
"resourceType": "MedicationRequest",
83+
"id": "med-003",
84+
"subject": { "reference": "Patient/pt-00123" },
85+
"status": "active",
86+
"intent": "order",
87+
"medicationCodeableConcept": {
88+
"coding": [{ "system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code": "83367", "display": "Atorvastatin 40 mg oral tablet" }]
89+
},
90+
"dosageInstruction": [{ "text": "1 tablet at bedtime" }]
91+
}
92+
},
93+
{
94+
"resource": {
95+
"resourceType": "Observation",
96+
"id": "obs-001",
97+
"subject": { "reference": "Patient/pt-00123" },
98+
"status": "final",
99+
"code": {
100+
"coding": [{ "system": "http://loinc.org", "code": "4548-4", "display": "Hemoglobin A1c/Hemoglobin.total in Blood" }]
101+
},
102+
"effectiveDateTime": "2026-01-18",
103+
"valueQuantity": { "value": 8.9, "unit": "%", "system": "http://unitsofmeasure.org" },
104+
"interpretation": [{ "coding": [{ "code": "H", "display": "High" }] }]
105+
}
106+
},
107+
{
108+
"resource": {
109+
"resourceType": "Observation",
110+
"id": "obs-002",
111+
"subject": { "reference": "Patient/pt-00123" },
112+
"status": "final",
113+
"code": {
114+
"coding": [{ "system": "http://loinc.org", "code": "2160-0", "display": "Creatinine [Mass/volume] in Serum or Plasma" }]
115+
},
116+
"effectiveDateTime": "2026-01-18",
117+
"valueQuantity": { "value": 1.8, "unit": "mg/dL", "system": "http://unitsofmeasure.org" },
118+
"interpretation": [{ "coding": [{ "code": "H", "display": "High" }] }]
119+
}
120+
},
121+
{
122+
"resource": {
123+
"resourceType": "Observation",
124+
"id": "obs-003",
125+
"subject": { "reference": "Patient/pt-00123" },
126+
"status": "final",
127+
"code": {
128+
"coding": [{ "system": "http://loinc.org", "code": "55284-4", "display": "Blood pressure systolic and diastolic" }]
129+
},
130+
"effectiveDateTime": "2026-01-18",
131+
"component": [
132+
{
133+
"code": { "coding": [{ "code": "8480-6", "display": "Systolic blood pressure" }] },
134+
"valueQuantity": { "value": 148, "unit": "mmHg" }
135+
},
136+
{
137+
"code": { "coding": [{ "code": "8462-4", "display": "Diastolic blood pressure" }] },
138+
"valueQuantity": { "value": 92, "unit": "mmHg" }
139+
}
140+
]
141+
}
142+
},
143+
{
144+
"resource": {
145+
"resourceType": "AllergyIntolerance",
146+
"id": "allergy-001",
147+
"patient": { "reference": "Patient/pt-00123" },
148+
"clinicalStatus": { "coding": [{ "code": "active" }] },
149+
"code": { "coding": [{ "system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code": "7980", "display": "Penicillin" }] },
150+
"reaction": [{ "manifestation": [{ "coding": [{ "display": "Anaphylaxis" }] }], "severity": "severe" }]
151+
}
152+
}
153+
]
154+
}

samples/referral-letter.txt

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
SPRINGFIELD CARDIOLOGY ASSOCIATES
2+
1200 Medical Plaza Drive, Suite 400
3+
Springfield, IL 62704
4+
Tel: (217) 555-8800 Fax: (217) 555-8801
5+
6+
DATE: March 20, 2026
7+
RE: Patient Referral — Cardiology Consultation
8+
9+
TO: Dr. Patricia Okonkwo, MD
10+
Springfield Internal Medicine Group
11+
12+
FROM: Dr. James Whitfield, MD, FACC
13+
Interventional Cardiology
14+
15+
PATIENT: Thomas R. Beaumont
16+
DOB: 09/14/1951 | MRN: SCA-10392
17+
INSURANCE: Medicare Part B | ID: 1EG4-TE5-MK72
18+
19+
Dear Dr. Okonkwo,
20+
21+
Thank you for referring Mr. Beaumont for cardiology evaluation. I saw him in my
22+
office on March 18, 2026 for a new patient consultation regarding exertional
23+
chest pain and dyspnea on exertion.
24+
25+
PRESENTING COMPLAINT:
26+
Mr. Beaumont is a 74-year-old male with a 3-week history of progressive exertional
27+
chest tightness and shortness of breath occurring with moderate activity (walking
28+
two blocks, climbing one flight of stairs). He denies rest pain, orthopnea, or
29+
paroxysmal nocturnal dyspnea. One episode of near-syncope occurred last Tuesday
30+
while mowing the lawn.
31+
32+
PAST MEDICAL HISTORY:
33+
- Coronary artery disease, 3-vessel (catheterization 2019 — 70% LAD stenosis,
34+
60% RCA stenosis, managed medically)
35+
- Hypertension (15+ years, currently controlled)
36+
- Hyperlipidemia
37+
- Type 2 diabetes mellitus (diet-controlled)
38+
- Prior tobacco use — 30 pack-years, quit 2008
39+
40+
CURRENT MEDICATIONS:
41+
- Aspirin 81 mg daily
42+
- Carvedilol 12.5 mg twice daily
43+
- Lisinopril 20 mg daily
44+
- Atorvastatin 80 mg nightly
45+
- Amlodipine 5 mg daily
46+
- Metformin 500 mg twice daily
47+
48+
ALLERGIES: Clopidogrel (rash), Sulfa drugs (anaphylaxis)
49+
50+
EXAMINATION FINDINGS (03/18/2026):
51+
- BP: 138/84 mmHg (right arm), HR: 68 bpm (regular), SpO2: 96% on room air
52+
- Weight: 201 lbs, BMI: 28.9
53+
- Cardiovascular: Regular rate and rhythm. Grade II/VI systolic murmur at RUSB.
54+
No S3/S4. JVP not elevated.
55+
- Respiratory: Clear to auscultation bilaterally, no crackles.
56+
- Extremities: Trace bilateral ankle edema.
57+
58+
DIAGNOSTIC RESULTS:
59+
- 12-lead ECG (03/18/2026): Normal sinus rhythm. Left ventricular hypertrophy
60+
by voltage. Old inferior Q waves (leads II, III, aVF) consistent with prior
61+
inferior MI — NOTE: this was not documented in prior records. Possible silent MI.
62+
- Echocardiogram (03/18/2026): LVEF 45% (mildly reduced, previously 60% in 2022).
63+
Inferior wall hypokinesis. Mild mitral regurgitation. No pericardial effusion.
64+
- BNP: 410 pg/mL (elevated; reference <100 pg/mL)
65+
- Troponin I (x2, 3h apart): 0.02 ng/mL, 0.02 ng/mL (negative for acute MI)
66+
67+
IMPRESSION:
68+
1. New wall motion abnormality (inferior hypokinesis) with decline in LVEF from
69+
60% to 45% — highly suspicious for interval silent MI or ischemic
70+
cardiomyopathy progression.
71+
2. Exertional symptoms consistent with heart failure with mildly reduced EF
72+
(HFmrEF) and/or active ischemia.
73+
3. Elevated BNP supporting volume overload / early decompensation.
74+
4. Previously undocumented inferior MI pattern on ECG.
75+
76+
PLAN:
77+
1. Admitting Mr. Beaumont directly to Springfield Memorial Hospital for further
78+
evaluation and monitoring. Cardiology team notified.
79+
2. Nuclear stress test scheduled for 03/21/2026 to assess ischemic burden.
80+
3. Coronary angiography likely indicated if stress test confirms ischemia —
81+
previously placed on medical management but clinical picture has changed.
82+
4. Initiating low-dose furosemide 20 mg daily for fluid management.
83+
5. Increasing carvedilol to 25 mg twice daily as tolerated.
84+
6. GDMT optimization per current HFmrEF guidelines.
85+
7. Patient educated on daily weight monitoring, sodium restriction (<2g/day),
86+
and activity limitations. Return to cardiology within 1 week post-discharge.
87+
88+
Please feel free to contact my office directly at (217) 555-8800 with any questions.
89+
We will keep you updated on Mr. Beaumont's hospital course.
90+
91+
Sincerely,
92+
93+
Dr. James Whitfield, MD, FACC
94+
Interventional Cardiology
95+
Springfield Cardiology Associates

0 commit comments

Comments
 (0)