How yashraj-sonawane02/contractlens works
ContractLens is a web platform for auditing Maharashtra leave-and-license agreements. A user uploads a contract; the frontend submits it for analysis, which extracts text, masks personal information, classifies clauses, and evaluates statutory risk. Results feed a dashboard for reviewing risks, comparison, and negotiation. Separate capabilities include grounded legal chat and exploration, authentication, history, and document exports. The graph follows documented calls and SOURCE INDEX references; some unsampled implementation details are represented only at their existing service-directory path.
Main entry points: analysis.py Analysis endpoint · RiskDashboard.jsx Risk dashboard · main.py FastAPI application · App.jsx Application shell
Components 34
Web experience
- Application shell
frontend/src/App.jsx - API client
frontend/src/services/api.js - Risk dashboard
frontend/src/components/RiskDashboard.jsx - Clause cards
frontend/src/components/ClauseCard.jsx - Risk heatmap
frontend/src/components/RiskHeatmap.jsx - Contract chat
frontend/src/components/ContractChat.jsx - Contract comparison
frontend/src/components/ContractComparison.jsx - Negotiation generator
frontend/src/components/NegotiationGenerator.jsx - Benchmark view
frontend/src/components/EmpiricalBenchmarkModal.jsx - Legal explorer
frontend/src/components/LegalExplorerModal.jsx - Analysis history
frontend/src/pages/HistoryPage.jsx
API and identity
- FastAPI application
backend/app/main.py - Authentication
backend/app/api/auth.py - Analysis endpoint
backend/app/api/analysis.py - Document endpoints
backend/app/api/document.py - Legal chat endpoint
backend/app/api/chat.py - Legal knowledge endpoint
backend/app/api/legal.py - Negotiation endpoint
backend/app/api/negotiation.py
Contract analysis
- Document parser
backend/app/services/document_parser.py - Document classifier
backend/app/services/document_classifier.py - PII masker
backend/app/services/pii_masker.py - Clause segmentation
backend/app/services/clause_engine.py - Parallel analyzer
backend/app/services/parallel_analyzer.py - Statutory risk engine
backend/app/services/rag_engine.py - Evaluation and benchmarks
backend/app/services/evaluation_suite.py - Empirical benchmark
backend/app/services/empirical_benchmark.py
Legal assistance
- Legal knowledge base
backend/app/services/legal_knowledge_base.py - Legal translation
backend/app/services/translator.py - Negotiation engine
backend/app/services/negotiation_engine.py - Gemini retrieval
backend/app/services/gemini_rag.py
Data and storage
- Relational database
backend/app/db/database.py - User and history models
backend/app/models/models.py - Encrypted object storage
backend/app/services/storage_service.py
Other components
- Contract user
Connections 40
- Contract user → Application shell: uses
README.md - Application shell → API client: submits analysis
frontend/src/App.jsx - Application shell → Risk dashboard: renders results
frontend/src/App.jsx - Risk dashboard → Clause cards: renders clauses
frontend/src/components/RiskDashboard.jsx - Risk dashboard → Risk heatmap: renders risks
frontend/src/components/RiskDashboard.jsx - Risk dashboard → Contract chat: renders chat
frontend/src/components/RiskDashboard.jsx - Risk dashboard → Contract comparison: renders comparison
frontend/src/components/RiskDashboard.jsx - Risk dashboard → Negotiation generator: renders negotiation
frontend/src/components/RiskDashboard.jsx - Risk dashboard → Benchmark view: renders benchmark
frontend/src/components/RiskDashboard.jsx - Application shell → Legal explorer: renders explorer
frontend/src/App.jsx - Application shell → Analysis history: renders history
frontend/src/App.jsx - FastAPI application → Authentication: registers router
backend/app/main.py - FastAPI application → Analysis endpoint: registers router
backend/app/main.py - FastAPI application → Document endpoints: registers router
backend/app/main.py - FastAPI application → Legal chat endpoint: registers router
backend/app/main.py - FastAPI application → Legal knowledge endpoint: registers router
backend/app/main.py - FastAPI application → Negotiation endpoint: registers router
backend/app/main.py - API client → Analysis endpoint: posts analysis
- Authentication → Relational database: gets session
backend/app/api/auth.py - Authentication → User and history models: queries users
backend/app/api/auth.py - Authentication → Relational database: stores user
backend/app/api/auth.py - Analysis endpoint → Document parser: parses upload
backend/app/api/analysis.py - Analysis endpoint → PII masker: masks data
backend/app/api/analysis.py - Analysis endpoint → Clause segmentation: segments clauses
backend/app/api/analysis.py - Analysis endpoint → Parallel analyzer: dispatches analysis
backend/app/api/analysis.py - Analysis endpoint → Evaluation and benchmarks: evaluates results
backend/app/api/analysis.py - Analysis endpoint → Empirical benchmark: runs benchmark
backend/app/api/analysis.py - Analysis endpoint → Document classifier: checks document
backend/app/api/analysis.py - Analysis endpoint → Encrypted object storage: stores upload
backend/app/api/analysis.py - Document parser → Document classifier: detects type
backend/app/services/document_parser.py - Parallel analyzer → Statutory risk engine: dispatches clauses
backend/app/services/parallel_analyzer.py - Statutory risk engine → Legal knowledge base: retrieves statutes
backend/app/services/rag_engine.py - Legal chat endpoint → Legal knowledge base: uses knowledge base
backend/app/api/chat.py - Legal knowledge endpoint → Legal knowledge base: uses knowledge base
backend/app/api/legal.py - Negotiation endpoint → Negotiation engine: generates proposal
backend/app/api/negotiation.py - Document endpoints → Document parser: parses document
backend/app/api/document.py - Document endpoints → Encrypted object storage: uses storage
- Document endpoints → FastAPI application: exports documents
backend/app/main.py - Relational database → User and history models: maps entities
backend/app/models/models.py - Analysis endpoint → Relational database: uses history
backend/app/api/analysis.py