All work

MEDIQUERY / INDEPENDENT PROJECT

Clinical RAG & Document Retrieval Platform

An answer is only as good as its evidence.

I built a React and FastAPI biomedical research application to search literature and return answers with source references. The question behind it: how do you keep the evidence connected as information moves through the system?

Python / FastAPI / React / LangChain / ChromaDB / BioBERT / Docker

Explore document selection ↓
Actual MediQuery React landing screen with a question box and example prompts; no generated answer.
Actual React interface, captured locally in its initial state. No backend or model request. A research prototype, not a clinically validated tool.

01 / BUILDING THE EVIDENCE PIPELINE

Keep the source
with the text.

  1. 01

    Collect

    PubMed search and abstract records through Entrez. Articles without an abstract are skipped.

  2. 02

    Prepare

    Title + abstract split into character chunks: 512 characters, with 64-character overlap. Source metadata stays attached.

  3. 03

    Embed & store

    dmis-lab/biobert-base-cased-v1.2 through HuggingFaceEmbeddings, CPU and normalised embeddings, stored in ChromaDB.

  4. 04

    Retrieve & answer

    MMR requests up to five chunks, considering up to fifteen candidates. A LangChain chain supplies labelled context to Llama-3.1-8B-Instruct via Hugging Face.

Ingestion, search and generation are separate modules. The API queues ingestion as a FastAPI background task; this does not establish a durable job service.

02 / RETRIEVAL EXPLORER

Similar is useful.
Different can be useful, too.

BioBERT supplies a biomedical language representation. Maximum Marginal Relevance adds a selection trade-off: query similarity versus similarity to documents already chosen. That trade-off does not guarantee a better answer.

SYNTHETIC RETRIEVAL DEMONSTRATION / k = 3

Five fictional documents, two-dimensional vectors. No biomedical findings or original MediQuery pipeline are executed.

Without JavaScript: similarity selects A, B, C. The same MMR calculation at λ = 0.5 selects A, D, B.

Directions on a unit circle, simplified for this demonstration. This is not actual BioBERT embedding space.
Fictional documents and computed cosine similarity
DocumentCosineSelected
A Cohort notes0.999#1
B Cohort summary0.995#2
C Sampling appendix0.800#3
D Measurement notes0.600—
E Archive index0.000—
SELECTED IN ORDERA → B → C

A and B both point close to the query. Similarity alone does not penalise how close they are to each other.

The calculation, in plain sight

λ × similarity(query, candidate) − (1 − λ) × max similarity(candidate, selected)

The first choice is the most query-similar document. Exact ties retain fixture order. Scores are not probabilities or evidence quality.

  1. A: query-similar seed
  2. B: cosine 0.995
  3. C: cosine 0.800

03 / ANSWERS AND ATTRIBUTION

A citation is
a place to check.

The generation prompt asks for [Source: title] citations and supplies retrieved, source-labelled chunks. The model is configured with 512 new tokens and temperature 0.1.

THE IMPORTANT BOUNDARY

The code retrieves again to build the displayed sources, deduplicating titles and returning a 200-character snippet with each source record. That list is not a guaranteed record of the exact context used for generation.

A citation makes inspection possible. It does not prove that an answer is supported, complete or clinically correct. The reviewed code does not automatically validate every citation against the generated text.

04 / WHAT I CAN VERIFY

Grounding needs
its own checks.

Four existing API tests passed in an isolated review with vector, ingestion and generation boundaries stubbed. They check health, a stats response and invalid short requests; they do not establish retrieval quality or live model behaviour.

This project demonstrates my work connecting ingestion, retrieval and generation across a full-stack application. Next, I would reuse the same retrieved context for both the answer and source list, then evaluate citation support and retrieval choices on a defined dataset.

Explore the MediQuery source ↗