Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

🔒 SecureDoc-LI

AI-Enabled Secure Digital Document Management System for Legal & Investigation Records

Built for Smart India Hackathon (SIH) 2026


🎯 Problem Statement

Legal and investigation agencies handle highly sensitive documents — FIRs, forensic reports, witness statements, bail applications — that are vulnerable to unauthorized access, tampering, and leakage. Traditional file systems offer no AI-powered classification, no tamper detection, and no audit trail.

SecureDoc-LI solves this with a unified platform combining AES-256 encryption, AI document intelligence, blockchain-style audit chains, and semantic search.


✨ Key Features

Feature Description
🔐 AES-256-GCM Encryption Every document encrypted at rest with authenticated encryption
🧠 AI Document Classification Auto-classifies documents (FIR, Forensic Report, Witness Statement, etc.) using trained ML model
🔍 Semantic Search Find documents by meaning using all-MiniLM-L6-v2 sentence embeddings
🕵️ Sensitive Entity Detection Extracts names, phone numbers, Aadhaar, IPs, case IDs using spaCy NLP
📊 Risk Scoring Dynamic risk score per document based on sensitivity and access patterns
🧾 Hash-Chained Audit Trail SHA-256 chained audit log — tamper-evident chain of custody
🚨 Unauthorized Access Alerts Auto-detects cross-user document access, sends AI-analysed HTML email alert
🔐 TOTP MFA Two-factor authentication with Google Authenticator / Authy
📈 AI Classifier Evaluation Live precision, recall, F1, confusion matrix dashboard
👥 Role-Based Access Control Administrator, Investigator, Forensic Officer, Lawyer, Case Supervisor, Auditor

🏗️ Architecture

securedoc_v2/
├── backend/
│   └── app/
│       ├── main.py               # FastAPI app entry point
│       ├── models.py             # SQLAlchemy DB models
│       ├── auth.py               # JWT authentication
│       ├── crypto_utils.py       # AES-256-GCM encrypt/decrypt
│       ├── audit.py              # Hash-chained audit log
│       ├── alert_manager.py      # Unauthorized access email alerts
│       ├── ollama_agent.py       # AI agent for alert analysis
│       ├── risk.py               # Risk scoring engine
│       ├── text_extract.py       # PDF/TXT text extraction
│       ├── ai/
│       │   ├── classify.py       # Document classifier (scikit-learn)
│       │   ├── sensitive_detect.py # NLP entity extraction (spaCy)
│       │   └── train_classifier.py # Model training script
│       └── routes/
│           ├── auth_routes.py    # Login, register, MFA
│           ├── document_routes.py # Upload, download, semantic search
│           ├── audit_routes.py   # Audit log + chain verification
│           ├── dashboard_routes.py # Stats
│           ├── eval_routes.py    # AI metrics endpoint
│           └── mfa_routes.py     # TOTP MFA setup/verify
└── frontend/
    ├── index.html                # Single-page app
    ├── app.js                    # All frontend logic
    └── style.css                 # Styling

🚀 Getting Started

Prerequisites

  • Python 3.11+
  • pip

Installation

# Clone the repo
git clone https://github.com/shrridharshan27/SecureDoc-LI.git
cd SecureDoc-LI/securedoc_v2/backend

# Create virtual environment
python -m venv venv
venv\Scripts\activate        # Windows
# source venv/bin/activate   # Linux/Mac

# Install dependencies
pip install -r requirements.txt

# Start the server
uvicorn app.main:app --reload

Open your browser at http://127.0.0.1:8000

First run: sentence-transformers will download the all-MiniLM-L6-v2 model (~80MB). This is a one-time download.


🔑 Default Roles

Role Permissions
administrator Full access + tamper simulation + alert emails
investigator Upload, download, search
forensic_officer Upload, download, verify integrity
lawyer Read + download only
case_supervisor Read + audit trail
auditor Read-only, no downloads

🧠 AI Stack

  • Document Classifier — scikit-learn TF-IDF + Logistic Regression (trained on legal document corpus)
  • Semantic Search — sentence-transformers/all-MiniLM-L6-v2 (384-dim embeddings, cosine similarity)
  • Entity Extraction — spaCy en_core_web_sm + regex patterns for Aadhaar, phone, IP, case IDs
  • Risk Scoring — Composite score: sensitivity weight + category risk + recent access frequency

🔒 Security Features

  • AES-256-GCM authenticated encryption for all stored files
  • SHA-256 hash chaining on audit log (blockchain-style tamper evidence)
  • TOTP MFA (RFC 6238) with QR code provisioning
  • JWT Bearer tokens for all API endpoints
  • Role-based route guards on both frontend and backend
  • Integrity verification on every download — detects byte-level tampering

📸 Screenshots

Dashboard

Real-time stats: total documents, users, audit records, high-risk count, tampered documents.

Semantic Search

Search documents by meaning — "murder case Hyderabad" finds the FIR, not just keyword matches.

AI Metrics

Live confusion matrix, per-category precision/recall/F1, training vs test sample count.

Audit Chain

Hash-chained audit trail with one-click full chain integrity verification.


👨‍💻 Team

Built for Smart India Hackathon 2026


📄 License

MIT License

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages