← All projects
Published personal app · End-to-end ownershipLegal Lens app icon

Legal Lens

Document-grounded legal research with hybrid retrieval, reranking, source citations and access-controlled workspaces.

Flutter / DartFastAPIPostgreSQL / pgvectorLangChainGroq
Get it on Google PlayiOSComing soonWebsite ↗GitHub ↗
Legal Lens document research interface. Research assistance with source references.
Legal Lens document research interface. Research assistance with source references.

The problem

A useful document assistant needs to retrieve the right clauses and show where an answer came from. I built a research application that connects document processing, retrieval and cited responses.

What I built

  • Designed and developed the Flutter/Dart frontend, FastAPI backend and PostgreSQL/pgvector database end to end.
  • Implemented PDF upload, extraction/OCR, chunking and 384-dimensional SentenceTransformer embeddings.
  • Combined semantic and BM25 retrieval with multi-query expansion, reciprocal rank fusion and cross-encoder reranking.
  • Added Groq-generated answers with source citations, saved conversations, document comparison and user, legal-professional and administrator workspaces.
  • Implemented Firebase authentication, owner-scoped access and duplicate detection, Cloudflare R2 document storage, and role/access tests.

How it fits together

APPLICATION WORKFLOWLegal Lens
On Google Play
  1. 01PDF + OCR
  2. 02Chunks + embeddings
  3. 03Semantic + BM25
  4. 04Fusion + reranking
  5. 05LLM answer + citations

An engineering decision

I combined keyword and semantic retrieval because a legal query can depend on both exact terms and meaning. Reranking and context selection sit before generation, while ownership checks constrain which documents a user can access.

Evaluation & limitations

The project includes access-control and retrieval-related tests. I have not published a comprehensive legal-answer accuracy benchmark. Answers are research assistance and should be checked against the cited source documents.

Next steps

Build a representative retrieval evaluation set, measure citation support, and expand checks for ambiguous or unsupported questions.