Who we built this for and why they need it Doctors at underserved and under-resourced clinics see dozens of patients a day with no specialists to consult, no clinical decision support tools, and no time. They must decide — often within minutes — who needs attention first, whether a drug is safe for a specific patient, and how to explain a diagnosis in plain language to a patient who may not be health-literate.

ClinIQ is built for those doctors. It gives them an AI-powered triage layer that automatically ranks patients by clinical severity, surfaces dangerous lab values and vital sign anomalies instantly, and checks prescription safety against a real medical knowledge base — all running locally, with no subscription fees or internet dependency for core features.

How we used AI in this project AI is used across four core workflows:

Triage scoring — A rule-based engine scores every patient across adverse events, lab results, vital signs, and chronic condition burden. This produces an objective severity ranking updated in real time.

Clinical summaries — A local LLM (llama3.1 via Ollama) generates structured, physician-facing narrative reports by summarizing all five SDTM data domains in parallel using a thread pool.

Plain-language patient summaries — The same LLM rewrites clinical findings in simple, jargon-free language directed at the patient, so they can understand their own health.

Prescription safety engine (RAG pipeline) — When a doctor enters a drug order, the system:

Checks whether it is a valid prescription request (gatekeeper) Retrieves relevant drug protocols from a ChromaDB knowledge base seeded with the Gale Encyclopedia of Medicine and real FDA drug labels Runs a patient-specific safety check against their labs, vitals, and adverse events Flags contraindications and generates a safe alternative if needed Strict RAG chat — The AI chat assistant retrieves relevant context from the medical knowledge base before every response and is instructed to answer only from that context — preventing hallucinated medical advice.

What could go wrong and how we addressed it Risk Mitigation LLM hallucinating medical facts Strict RAG: every AI answer is grounded in retrieved KB chunks. System prompt explicitly forbids outside knowledge. Prescription engine authorizing unsafe drugs 3-step pipeline with a dedicated patient safety check against actual lab values before any order is authorized JSON parsing failures from LLM _safe_json() wrapper with fallback defaults on every LLM call that expects structured output Knowledge base not loaded App checks KB availability at startup; AI buttons are disabled with a clear message if KB is missing Wrong patient data shown after switching patients All patient-specific session state (summaries, chat, plain summary) is cleared on patient switch ChromaDB hashing errors with Streamlit cache Used _dfs underscore prefix to skip unhashable DataFrame dict from Streamlit's cache hash What we'd build next with more time Claude API integration — Replace local Ollama with Claude claude-sonnet-4-6 for significantly better clinical reasoning and faster responses Real patient data pipeline — Connect to MIMIC-III or HL7 FHIR feeds for real de-identified clinical data Nurse/patient portal — A separate view where patients can read their own summary and ask questions in their language Alert notifications — Push urgent triage alerts to the doctor's phone when a HIGH-priority patient is checked in Expanded knowledge base — Ingest clinical guidelines (WHO, CDC, NICE) and drug interaction databases (DrugBank, RxNorm) Audit trail — Log every AI recommendation with the knowledge base sources used, for clinical accountability

Built With

Share this project:

Updates