Selected work

Architecture study

Clinical Knowledge Retrieval

A retrieval pipeline designed around source traceability, constrained outputs, and local-first experimentation.

Python · FastAPI · ChromaDB · Ollama · Structured outputs · Evaluation

Clinical knowledge retrieval

What is this answer based on?

An answer is only as traceable as its sources.

source.documentanswer.citations

Source passage

Each statement stays linked to its original document and version.
document_id
chunk_id
source_version
Concept view · Answer and provenance, designed together
Problem

Why this system exists

A fluent answer is not enough in a healthcare knowledge context. Users need to see which source passages informed an answer and where retrieval confidence breaks down.

System context

Boundary and data flow

Documents pass through deterministic parsing and chunking. Retrieval returns source spans with stable identifiers. The model receives a constrained prompt and emits a schema-validated answer with citations and uncertainty states.

Technical decisions

Trade-offs made explicit

  • Store source lineage beside each embedding rather than reconstructing it later.
  • Use schema-constrained outputs for answers, citations, and abstention reasons.
  • Keep local-model support behind the same inference interface used for hosted models.

CHALLENGES

  • Evaluating retrieval separately from answer generation.
  • Maintaining citations when source documents are reprocessed.
  • Designing explicit abstention rather than encouraging plausible completion.
Security

Safe system boundaries

  • Treat documents as untrusted input and strip active content before parsing.
  • Isolate indexes by corpus and avoid logging queries or retrieved passages.
  • Do not position the research surface as a diagnostic or treatment tool.
Outcome & learning

What the build demonstrated

The research build can replay an answer from its retrieved spans and records retrieval, prompt, model, and schema versions for each evaluation case.

LESSONThe useful unit of a clinical RAG system is not an answer; it is an answer plus provenance, evaluation evidence, and an honest failure state.