Skip to content

SynapCores / Recipe

Find Clinically Similar Patients by Meaning

Retrieve patients whose presentation is clinically similar to an index case, for cohorting and case comparison — semantic similarity over the presentation summary, self-hosted.

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

Install free with one command, then open Find Clinically Similar Patients by Meaning in your instance. It's staged for a preview — nothing runs until you click Run. New to SynapCores? The quickstart covers install to first query.

Share

Objective

"Show me patients like this one" powers cohorting, case comparison, and outcome review. Structured filters miss the clinical resemblance that lives in the narrative. This recipe finds patients whose presentation is clinically similar to an index case by meaning — inside your environment, so no PHI leaves.

Step 1: Patient presentation summaries with embeddings

DROP TABLE IF EXISTS patient_summary;

CREATE TABLE patient_summary (
    patient_id TEXT PRIMARY KEY,
    summary    TEXT,
    emb        VECTOR(384)
);

INSERT INTO patient_summary VALUES
 ('P-001','65M with exertional chest pain, dyspnea, and troponin elevation; history of hypertension.',
  EMBED('65M with exertional chest pain, dyspnea, and troponin elevation; history of hypertension.')),
 ('P-002','29F with migraine, photophobia, and nausea; no focal deficits.',
  EMBED('29F with migraine, photophobia, and nausea; no focal deficits.'));

Step 2: Retrieve patients similar to an index presentation

SELECT patient_id,
       COSINE_SIMILARITY(
         emb,
         EMBED('Older man with chest pressure on exertion, shortness of breath, and elevated cardiac enzymes.')
       ) AS sim
FROM   patient_summary
ORDER  BY sim DESC
LIMIT  1;

Result — the cardiac index case matches the cardiac patient, not the migraine one:

patient_id sim
P-001 0.67

Why it matters

Semantic patient similarity powers cohort discovery, similar-case review, and outcome comparison — over the same store that holds the records, inside your HIPAA scope. Combine it with grounded clinical retrieval for evidence, and log any decision it informs to a tamper-evident CDS lineage.

Tags

healthcarepatient-similaritycohortvectorembeddingssimilarityclinicalself-hosted