Skip to content

bhargav-abhay/Gen-ai-exchange-hackathon-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›οΈ Legal AI Platform - SPARK182

Build Status License Node.js React Google Cloud Vertex AI

πŸš€ AI-Powered Legal Document Analysis Platform

Transforming complex legal documents into plain English insights using cutting-edge Generative AI


🌟 Overview

The Legal AI Platform revolutionizes legal document analysis by leveraging Google Cloud's advanced AI services to make complex legal documents accessible to everyone. Built for the SPARK182 hackathon, this solution transforms legal jargon into actionable insights through intelligent AI processing.

🎯 Problem Statement

  • Legal documents are complex and intimidating for non-legal professionals
  • Traditional legal consultation is expensive (avg. $300-500/hour)
  • Document review is time-consuming and prone to human error
  • Small businesses and individuals lack access to affordable legal analysis

πŸ’‘ Our Solution

AI-powered platform that democratizes legal document understanding through:

  • Instant Analysis: Upload β†’ AI Processing β†’ Plain English Insights
  • Smart Search: RAG-powered document querying with contextual answers
  • Risk Assessment: Automated compliance and risk factor identification
  • Cost Effective: 95% cost reduction compared to traditional legal consultation

✨ Features

πŸ“„ Document Analysis

  • Multi-format Support: PDF, DOC, DOCX, TXT, RTF
  • AI Text Extraction: Google Cloud Document AI
  • Intelligent Parsing: Clause identification & categorization
  • Risk Assessment: Automated compliance checking
  • Plain English: Legal jargon translation

πŸ” Intelligent Search

  • RAG Architecture: Retrieval-Augmented Generation
  • Semantic Search: Vector similarity matching
  • Contextual Answers: Natural language queries
  • Source Attribution: Clickable references
  • Cross-Document: Search entire corpus

πŸ“Š Analytics Dashboard

  • Real-time Metrics: Processing statistics
  • Visual Charts: Interactive data visualization
  • Performance Tracking: Accuracy & speed monitoring
  • User Insights: Engagement analytics
  • System Health: Uptime & error tracking

🌐 Modern Web App

  • Progressive Web App: Mobile-responsive design
  • Real-time Updates: WebSocket connections
  • Dark Theme: Modern glassmorphism UI
  • Authentication: Secure OAuth integration
  • Export Options: PDF reports & data export

πŸ—οΈ Architecture

graph TB
    A[Client React App] --> B[Express.js API]
    B --> C[Google Cloud Document AI]
    B --> D[Vertex AI - Generative Models]
    B --> E[Google Cloud Storage]
    B --> F[Vector Store]
    
    C --> G[Text Extraction]
    D --> H[Legal Analysis]
    D --> I[Embeddings Generation]
    F --> J[Semantic Search]
    
    subgraph "AI Pipeline"
        G --> H
        H --> I
        I --> J
    end
    
    subgraph "Cloud Infrastructure"
        C
        D
        E
    end
Loading

πŸ› οΈ Tech Stack

Frontend

React 18          # Modern UI framework
Tailwind CSS      # Utility-first styling
Recharts          # Data visualization
Lucide React      # Icon library
Context API       # State management
WebSocket         # Real-time updates

Backend

Node.js           # Runtime environment
Express.js        # Web framework
Multer            # File upload handling
Google Cloud AI   # AI/ML services
WebSocket Server  # Real-time communication
CORS              # Cross-origin security

AI/ML Services

Document AI       # Text extraction
Vertex AI         # Generative models
  β”œβ”€β”€ text-bison@002    # Legal analysis
  └── text-embedding-004 # Vector embeddings
RAG Architecture  # Semantic search
Vector Store      # In-memory similarity

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Google Cloud Project with billing enabled
  • Document AI and Vertex AI APIs activated

1️⃣ Clone Repository

git clone https://github.com/bhargav-abhay/legal-document.git
cd legal-document

2️⃣ Install Dependencies

# Backend dependencies
npm install

# Frontend dependencies
cd frontend
npm install
cd ..

3️⃣ Environment Setup

Create .env file in root directory:

# Google Cloud Configuration
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_APPLICATION_CREDENTIALS=path/to/service-account.json
VERTEX_AI_LOCATION=us-central1
DOCUMENT_AI_LOCATION=us
DOCUMENT_AI_PROCESSOR_ID=your-processor-id
STORAGE_BUCKET_NAME=your-bucket-name

# API Configuration
PORT=8000
FRONTEND_URL=http://localhost:3000

# Optional: Google Search API for legal news
GOOGLE_SEARCH_API_KEY=your-api-key
GOOGLE_SEARCH_ENGINE_ID=your-engine-id

4️⃣ Google Cloud Setup

# Install Google Cloud CLI
curl https://sdk.cloud.google.com | bash
exec -l $SHELL

# Authenticate
gcloud auth login
gcloud config set project YOUR_PROJECT_ID

# Enable required APIs
gcloud services enable documentai.googleapis.com
gcloud services enable aiplatform.googleapis.com
gcloud services enable storage.googleapis.com

# Create service account
gcloud iam service-accounts create legal-ai-service
gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
  --member="serviceAccount:legal-ai-service@YOUR_PROJECT_ID.iam.gserviceaccount.com" \
  --role="roles/documentai.apiUser"
gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
  --member="serviceAccount:legal-ai-service@YOUR_PROJECT_ID.iam.gserviceaccount.com" \
  --role="roles/aiplatform.user"

# Download service account key
gcloud iam service-accounts keys create ./service-account.json \
  --iam-account=legal-ai-service@YOUR_PROJECT_ID.iam.gserviceaccount.com

5️⃣ Start Development Servers

# Terminal 1: Start backend server
npm start

# Terminal 2: Start React development server
cd frontend
npm start

Visit http://localhost:3000 to access the application.


πŸ“š API Documentation

Document Analysis Endpoint

POST /api/analyze-document
Content-Type: multipart/form-data

# Request
- file: Document file (PDF, DOC, DOCX, TXT, RTF)
- userI

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors