Ground Clinical Answers in Your Own Guidelines — Retrieval by Meaning

Retrieve the most relevant guideline or chart passage for a clinical question by semantic similarity, so a decision-support answer is grounded in a citable source instead of model priors — self-hosted, PHI never leaves.

All recipes· healthcare· 5 minutesbeginnersql
Instance: localhost:8080

Opens your running SynapCores (Ground Clinical Answers in Your Own Guidelines — Retrieval by Meaning will be staged for a preview — nothing runs until you click Run). No instance yet? Install free in ~30s.

Share

Objective

A clinical decision-support answer is only safe if it is grounded in a citable source. This recipe does the retrieval half: given a clinical question, find the most relevant guideline or chart passage by meaning, so the answer (and its citation) trace to a real record rather than to the model's priors. Everything runs self-hosted — the embeddings compute where the PHI already lives.

Step 1: A small guideline corpus with embeddings

DROP TABLE IF EXISTS clinical_kb;

CREATE TABLE clinical_kb (
    doc_id  TEXT PRIMARY KEY,
    source  TEXT,
    passage TEXT,
    emb     VECTOR(384)
);

INSERT INTO clinical_kb VALUES
 ('G-114','Sepsis bundle',
  'For suspected sepsis, obtain blood cultures before antibiotics and start broad-spectrum antibiotics within one hour of recognition.',
  EMBED('For suspected sepsis, obtain blood cultures before antibiotics and start broad-spectrum antibiotics within one hour of recognition.')),
 ('G-233','VTE prophylaxis',
  'Assess VTE risk on admission; offer pharmacologic prophylaxis to high-risk medical inpatients without contraindication.',
  EMBED('Assess VTE risk on admission; offer pharmacologic prophylaxis to high-risk medical inpatients without contraindication.'));

Step 2: Retrieve the passage that grounds the question

SELECT doc_id,
       source,
       COSINE_SIMILARITY(
         emb,
         EMBED('How soon should antibiotics be given when sepsis is suspected?')
       ) AS sim
FROM   clinical_kb
ORDER  BY sim DESC
LIMIT  1;

Result — the sepsis question retrieves the sepsis-bundle guideline as its grounding source:

doc_id source sim
G-114 Sepsis bundle 0.76

Why it matters

The retrieved passage is the citation a clinician verifies and the anchor that keeps a generated answer honest — the grounding step behind hallucination control, running inside your HIPAA scope. Record the suggestion and the clinician's action on a tamper-evident CDS lineage table, and see the agent form in clinical Q&A grounded in your documents.

Tags

healthcareclinical-decision-supportragretrievalvectorembeddingsgroundinghipaaself-hosted

Run this on your own machine

Install SynapCores Community Edition free, paste the SQL or Cypher above into the bundled web UI, and watch it run.

Download Free CE