Objective
Clinicians spend 16+ hours a week on documentation and recurring questions ("this patient's INR is 2.8 — can I start amiodarone safely?"). Generic chatbots are RAG-only and miss the patient's actual state; raw SQL misses the guideline. In this recipe you set up a tiny EHR-shaped database, embed clinical guidelines, and let a care-assistant persona answer questions by combining both sources via SELECT AGENT_RUN(...). PHI never leaves the database boundary.
Requires: SynapCores v1.6.6.9+. For production use, run a HIPAA-eligible LLM endpoint (local Ollama, or a BAA-covered cloud).
Step 1: Create patient + lab + guideline tables
CREATE TABLE IF NOT EXISTS recipe_hc_patients (
patient_id INTEGER PRIMARY KEY,
initials TEXT,
dob DATE,
active_meds TEXT, -- comma-separated for brevity
comorbidities TEXT
);
CREATE TABLE IF NOT EXISTS recipe_hc_labs (
lab_id INTEGER PRIMARY KEY,
patient_id INTEGER,
test TEXT,
value DOUBLE,
units TEXT,
taken_at TIMESTAMP
);
CREATE TABLE IF NOT EXISTS recipe_hc_guidelines (
guideline_id INTEGER PRIMARY KEY,
topic TEXT,
body TEXT,
embedding VECTOR(384)
);
Step 2: Seed
INSERT INTO recipe_hc_patients VALUES
(1,'J.D.','1958-03-11','warfarin 5mg, lisinopril 10mg','atrial fibrillation, hypertension'),
(2,'M.K.','1972-08-22','metformin 1000mg','type 2 diabetes'),
(3,'L.S.','1945-11-04','warfarin 4mg, atorvastatin 20mg','prior PE, hyperlipidemia');
INSERT INTO recipe_hc_labs VALUES
(1,1,'INR',2.8,'', '2026-05-22 09:10:00'),
(2,1,'eGFR',62,'mL/min', '2026-05-22 09:10:00'),
(3,2,'A1C',7.4,'%', '2026-05-15 11:00:00'),
(4,3,'INR',3.6,'', '2026-05-26 08:45:00'),
(5,3,'Hgb',11.2,'g/dL', '2026-05-26 08:45:00');
INSERT INTO recipe_hc_guidelines (guideline_id, topic, body) VALUES
(1,'Warfarin–Amiodarone Interaction','Amiodarone potentiates warfarin via CYP2C9 inhibition, often doubling the INR within 1–3 weeks. When starting amiodarone in a patient on warfarin, reduce the warfarin dose by 30–50 percent and check INR within 5–7 days, then weekly for 4 weeks.'),
(2,'Warfarin INR Range — AFib','Target INR for non-valvular atrial fibrillation is 2.0–3.0. INR above 3.0 without bleeding: hold one dose and recheck in 24–48 hours; INR above 4.5: consider vitamin K.'),
(3,'Warfarin INR Range — PE','Target INR for venous thromboembolism prophylaxis post-PE is 2.0–3.0. Same management thresholds as for AFib.'),
(4,'Metformin and eGFR','Metformin is contraindicated below eGFR 30. Between 30 and 45, use with dose reduction and lactate monitoring. Hold around iodinated contrast.'),
(5,'A1C Targets — T2DM','For non-frail adults with type 2 diabetes, A1C target is below 7.0 percent. Above 7.0: consider intensification (add second agent, increase metformin dose if eGFR allows, or add GLP-1).');