Health Semantic Search — Cited Medical Retrieval
Health AI
A self-hostable search system over public health documents with access-aware retrieval, hybrid ranking, source citations and refusal when evidence is insufficient.
Repository overview
Permission-aware, cited semantic search over public health documents. Built stage by stage, with every design decision and measurement logged. The goal is a product a health system could adopt: self-hostable, answers always cite their source, and "no supported answer" beats a guess. Live app: https://health-semantic-search.onrender.com (free tier: it sleeps when idle, so the first load can take a minute; search only, no cited answers, see below) Research write-up: docs/PAPER.md, a workshop-style draft with every number traced to ENGINEERING LOG.md Full app with cited answers: https://huggingface.co/spaces/Vaibhavbansal26/health-semantic-search-app (same React app, reranker and cited answers; free CPU, so answers take 3-6 s) Original Gradio demo: the Space Vaibhavbansal26/health-semantic-search (reranker, no accounts)
Project features
- Health Semantic Search
- What it is
- Stack
- Status
- Results so far
- Architecture
- Data
Documented architecture and workflow
Layer Choice Notes --- --- --- Front end React 18, Vite 5, plain CSS about 52 kB gzipped; served by the API process, no separate host API FastAPI, uvicorn search, accounts, admin; security headers, per-request access mask Accounts and tokens SQLite, scrypt, PyJWT (RS256) one-hour tokens with a jti , sign-out and admin revocation, login rate limit Keyword search bm25s with a Snowball stemmer index built once, loaded memory-mapped Dense search BAAI/bge-small-en-v1.5 PyTorch in the full engine, ONNX Runtime (fastembed) in the lite one Fusion and routing weighted reciprocal rank fusion, identifier router NDC, CAS and imprint queries go to keyword search only Reranker and answers bge-reranker-base, extractive answers with a refusal threshold full engine only (about 2 GB) Access control boolean mask inside every retriever, mask-keyed cache document, tenant and section rules Corpus, sync Postgres 16 + pgvector, DailyMed, openFDA, ClinicalTrials.gov connectors kill-safe incremental sync, versioned index publishing Evaluation recall@k, MRR, nDCG, paired bootstrap five model-written question sets, tooling for a real-query set Packaging Docker (multi-stage), Render Blueprint ( render.yaml ) image about 700 MB; runs in under 250 MB of RAM CI GitHub Actions pytest on Python 3.11 and 3.13 (PR 15) Two engines share one API. The full engine ( HSS ENGINE=full ) has the reranker and cited answers and needs about 2 GB. The lite engine ( hss.lite , the default) fits 512 MB: chunk text in SQLite, memory-mapped BM25 and float16 vectors, an ONNX query encoder. On 60 questions it returned the same
Technology
FastAPI · Hybrid retrieval · BGE embeddings · pgvector
Repository snapshot
Python · 0 stars · 0 forks · updated 2026-11-02T05:20:30Z
Demos and evidence
- The full app on the free Hugging Face Space: sign in with a demo account, pick Hybrid + reranker, ask a question, get a cited answer, then an off-topic question is refused — documentation
- Project demo — portfolio
- Live project — portfolio
- Source and implementation — repository