Skip to main content

Anniversary starting prices are live.

See Pricing
ZENERA LABS
Zenera Labs Engineering PortfolioInternally developed · MVP

AI Contract Analysis & Risk Detection

Faster document review with traceable evidence — upload a contract and get risk findings with source-verified citations.

Document IntelligenceAI AutomationEnterprise Software

Built by naman · AI Developer Intern

AI Contract Analysis landing page with drag-and-drop upload
01See It In Action

The system, up close

Real captures from the running system — the demo, screenshots and architecture come first, then the deep dive.

Demo

A walkthrough of the reviewer dashboard: contract upload, automatic analysis and evidence inspection.

Upload → analysis → evidence walkthrough

Demo shows the landing page, contract upload, risk findings and source-passage inspection.

Screenshots

1 / 4

AI Contract Analysis landing page with drag-and-drop upload
AI Contract Analysis landing page with drag-and-drop upload

Architecture

System architecture of the AI contract analysis system: reviewer → frontend → backend API → document pipeline, retrieval system and risk detection
Reviewer → React frontend → FastAPI backend → document pipeline, retrieval system and risk detection over extraction, vector store and LLM analysis.
02The Problem

Why this needed to be built

Contract review is one of the most time-consuming and repetitive tasks in legal practice. Reviewers must manually read dense legal documents to identify unfavorable or one-sided terms, missing critical protections, ambiguous liability or IP clauses, unfavourable governing law or jurisdiction terms, and payment and termination risks.

An AI-assisted system can accelerate this process by automatically extracting key information, identifying common risk patterns, and providing evidence-backed findings — all while maintaining traceability to the original source document.

03The Zenera Solution

What we built, and how it changes the workflow

We built a full-stack document-intelligence system — FastAPI backend with a React reviewer dashboard — that turns a raw contract PDF into a structured, evidence-backed analysis.

A reviewer uploads a PDF. The system validates the file, extracts page-preserving text, normalizes and chunks the document, identifies clauses and sections, indexes it into a vector store, detects up to 12 predefined risk categories, and verifies every finding against the source.

A built-in retrieval-based Q&A lets reviewers ask questions about the contract and get evidence-grounded answers that cite the exact page, section and chunk. Every risk finding carries its evidence quote, page number, section and confidence score, so the human makes the final call.

04Key Capabilities

What it can do

A focused set of capabilities that define the system — no marketable filler, only what actually runs.

01

PDF upload with validation

Drag-and-drop upload with type, size and MIME checks, filename sanitization and safe temporary storage.

02

Page-preserving extraction

Text extraction via pdfplumber with a PyPDF2 fallback, keeping page boundaries intact.

03

Normalization & chunking

Clause-aware text normalization and chunking (size 500 / overlap 100) for reliable retrieval.

04

Vector retrieval

ChromaDB vector store with sentence-transformers (all-MiniLM-L6-v2) embeddings for semantic search.

05

Retrieval-based Q&A

Evidence-grounded question answering over the contract via an OpenRouter LLM, with source references.

06

12 risk categories

Termination, automatic renewal, indemnification, liability, IP, confidentiality, governing law, payment, notice and data privacy risks with severity levels.

07

Evidence tracing

Every finding links back to its source with page, section and chunk references for full traceability.

08

Security hardening

Path-traversal prevention, safe temp storage, prompt-injection defence and environment-only secrets.

05How It Works

The end-to-end workflow

The system processing path, in order.

  1. 1

    Upload

    Reviewer uploads a PDF contract through the dashboard.

  2. 2

    Document validation

    Type, size and MIME are checked before anything is processed.

  3. 3

    Text extraction

    Page numbers and document structure are preserved during extraction.

  4. 4

    Normalization & chunking

    Text is cleaned and split into clause-aware chunks.

  5. 5

    Clause identification

    Sections and standard contract clauses are detected.

  6. 6

    Vector indexing

    Chunks are embedded and stored in ChromaDB for retrieval.

  7. 7

    Risk detection

    12 predefined risk categories are checked against retrieved evidence.

  8. 8

    Evidence verification

    Each finding is verified against the source passage before output.

  9. 9

    Structured analysis

    A Pydantic-validated summary, severity breakdown and findings are rendered for the reviewer.

06Technology

Stack & tech choices

Language
Python 3.11+
Backend
FastAPI, Uvicorn
Document processing
pdfplumber, PyPDF2
Embeddings
sentence-transformers (all-MiniLM-L6-v2)
Vector database
ChromaDB
LLM provider
OpenRouter API
Validation
Pydantic v2
Frontend
React 18, TypeScript, Vite, Tailwind CSS, Axios, React Router v6
Testing
pytest, pytest-asyncio, httpx
Deployment
Docker, Docker Compose
07Validation

Tested, verified and honestly scoped

Validation & tests

A reproducible test suite (32 tests) covers unit, integration, security and edge-case scenarios across the full pipeline.

  • Unit — text normalization, chunking, document validation, clause detection and hallucination checks
  • Integration — health check, upload validation, analysis pipeline and question answering
  • Security — path traversal, malicious filenames, unsupported extensions, oversized uploads, prompt injection and sensitive-data leakage
  • Edge cases — valid / empty / corrupted PDFs and missing document handling
  • Severity model — HIGH / MEDIUM / LOW findings based on financial and legal exposure

Security & hardening

  • File validation: type, size and MIME before processing
  • Safe storage: random, non-guessable names in temporary directories
  • Path traversal prevention and strict filename sanitization
  • Prompt-injection defence with clear separation of instructions, content and questions
  • Secrets stored in environment variables only — never in version control
  • Structured logging with sensitive data excluded
  • All API endpoints validated via Pydantic schemas

Honest limitations

AI Contract Analysis & Risk Detection is an internally developed engineering prototype. We state limitations rather than overclaim production readiness.

  • Provides contract analysis assistance — not legal advice
  • Analysis is limited to the uploaded document(s)
  • Risk detection covers the 12 predefined categories only
  • LLM-based analysis should be verified by a human reviewer
  • PDF is the only supported format in the current MVP
09Future Extensions

Where this can go next

Realistic next steps we've scoped — not aspirational marketing copy.

  • Multi-contract search and comparison
  • Contract version diffing
  • Clause rewrite suggestions
  • Export analysis as PDF and JSON
  • Additional risk categories and severity tuning
  • Multi-language support
  • OCR for scanned PDFs, multi-user collaboration and CLM platform integration (stretch)

Have a similar workflow?
Zenera Labs can build a custom version for your business.

This is one of naman's internally developed systems. Tell us about your requirement and we'll scope a tailored build around it.