Skip to content

Latest commit

ย 

History

56 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ‡ฎ๐Ÿ‡ณ MANAK AI (เคฎเคพเคจเค• AI)

Autonomous BIS Standards Intelligence & Regulatory Compliance Platform

Smart India Hackathon (SIH 2026) โ€” Problem Statement SIH26107
Team CodeSmiths โ€ข Empowering Indian MSMEs & Manufacturers with Zero-Hallucination Compliance


Next.js 15 TypeScript Python Google Gemini 2.5 Supabase pgvector Tailwind CSS E2E Tests Bilingual


Executive Overview โ€ข SIH Presentation Deck โ€ข Feature Comparison โ€ข Document Processing (PyMuPDF) โ€ข Architecture & RAG โ€ข UI Showcase โ€ข Quick Start โ€ข Docs


๐Ÿ“Œ Executive Overview

Navigating the Bureau of Indian Standards (BIS) and mandatory Quality Control Orders (QCOs) is daunting for India's 63+ million MSMEs. Technical jargon, complex testing tables, and frequent gazette amendments lead to costly delays, consulting fees, and shipment impoundments.

Manak AI transforms static BIS PDFs into an intelligent, interactive compliance copilot:

  • โšก Instant Regulatory Mapping: Finds applicable Indian Standards (IS), mandatory QCO dates, and testing requirements in seconds.
  • ๐Ÿ›ก๏ธ Zero Hallucination with Proof: Every statement is backed by clause-level citations, section numbers, and verified official excerpts.
  • ๐Ÿ“Š Automated Gap Analysis: Evaluates manufacturing readiness, identifies missing quality tests, and generates a 7-step certification roadmap.
  • ๐ŸŒ Equitable Bilingual Access: Seamless native toggle between English and Hindi (เคนเคฟเคจเฅเคฆเฅ€) for grassroots manufacturers across Tier-2/3 industrial clusters.

๐ŸŽฏ SIH 2026 Presentation Deck

Below are the executive presentation slides submitted for Smart India Hackathon 2026:

Slide 1: Solution Highlights & Pipeline

Overview of core capabilities: End-to-end compliance roadmaps, automated gap analysis, evidence-backed citations, and version awareness. Solution Highlights


Slide 2: Technical Approach & Tech Stack

Full-stack pipeline from user query understanding, dense + sparse hybrid retrieval, and RRF ranking, to Gemini grounding and citation validation. Technical Approach


Slide 3: Feasibility & Business Viability

Demonstrating technical viability on production-ready cloud services and massive business value (faster time-to-market, lower consulting costs, safer products). Feasibility and Viability


Slide 4: Impact & Measurable Benefits

Real-world outcomes: 70%+ time saved, 90%+ accurate answers, empowering MSMEs, consumers, consultants, and regulators. Impact and Benefits


โš–๏ธ Feature Comparison

Capability MANAK AI (Our Solution) Official BIS Portal Generic ChatPDF / RAG Regulatory Consultants
Instant Self-Service Q&A UI ๐ŸŸข Yes (Interactive) ๐Ÿ”ด No ๐ŸŸข Yes ๐Ÿ”ด No
Precise Clause & Page Citations ๐ŸŸข Yes (Clause-level) ๐Ÿ”ด No ๐ŸŸก Basic / Unverified ๐ŸŸข Yes
Automated AI Compliance Pathway ๐ŸŸข Yes (7-Step Roadmap) ๐Ÿ”ด No ๐Ÿ”ด No ๐Ÿ”ด No
Automated Gap Analysis ๐ŸŸข Yes (Instant Audit) ๐Ÿ”ด No ๐Ÿ”ด No ๐Ÿ”ด No
Latest Standards & QCO Version Aware ๐ŸŸข Yes (Active prioritised) ๐ŸŸก Manual Search ๐Ÿ”ด No (Stale/Confused) ๐ŸŸข Human Expertise
Native Bilingual UI (Hindi / English) ๐ŸŸข Yes (Full Localization) ๐ŸŸก Partial ๐Ÿ”ด Weak ๐Ÿ”ด No
Operational Speed & Cost ๐ŸŸข Fast / Low Cost ๐ŸŸก Slow / Free ๐ŸŸข Fast / Low Cost ๐Ÿ”ด Slow / High Cost

๐Ÿ“„ Document Processing Pipeline (Python & PyMuPDF)

BIS standards and gazette notifications are highly complex documents containing nested clauses, technical tables, footnotes, and occasionally scanned pages. Manak AI features a dedicated, production-grade Python ingestion pipeline in ingestion/ powered by PyMuPDF (fitz):

[BIS Standard / Gazette PDF]
           โ”‚
           โ–ผ
  [ingestion/parser.py]
  โ”œโ”€โ”€ PyMuPDF (fitz) High-Speed Text & Layout Parsing
  โ”œโ”€โ”€ Scanned Page Detection Heuristic (len(text) < 50 & images > 0)
  โ”‚    โ””โ”€โ”€ Tesseract OCR Fallback (English + Hindi: eng+hin)
  โ”œโ”€โ”€ Structured Table Extraction (`page.find_tables()`) โž” Markdown Tables
  โ””โ”€โ”€ Clause Boundary Regex Engine (`Clause X.X`, `Annexure [A-Z]`)
           โ”‚
           โ–ผ
  [ingestion/chunker.py]
  โ”œโ”€โ”€ Context-Preserving Clause Hierarchy Assembly
  โ””โ”€โ”€ Self-Contained Chunk Generation with Parent Metadata
           โ”‚
           โ–ผ
  [ingestion/embedder.py]
  โ””โ”€โ”€ Gemini Embedding 2 (768-dim Vector Embeddings)
           โ”‚
           โ–ผ
  [Supabase PostgreSQL]
  โ”œโ”€โ”€ pgvector (HNSW Index for Cosine Similarity)
  โ””โ”€โ”€ PostgreSQL FTS (tsvector & trigram matching)

Key Ingestion Highlights:

  1. High-Speed PyMuPDF Parsing: Uses pymupdf (fitz) to extract text and layout coordinates up to 10x faster than traditional PDF parsers.
  2. Native Table Recovery: Identifies tabular data using PyMuPDF's find_tables() API and converts it into structured Markdown tables so the LLM retains exact testing limits, tolerances, and parameter values.
  3. Scanned Page OCR Fallback: If a page is a scanned document (common in older gazette notifications), it automatically invokes Tesseract OCR with bilingual support (lang="eng+hin").
  4. Clause-Aware Segmentation: Rather than arbitrary character chunking, BISDocumentParser segments text by regulatory clauses (e.g., Clause 4.1, Clause 7.2.3), preventing fragmented rules.
  5. Metadata Enrichment: Chunks are enriched with standard number, year, section title, page number, and mandatory QCO enforcement dates before vectorization.

๐Ÿ—๏ธ Technical Architecture & Hybrid RAG

flowchart TD
    subgraph Client ["Client Layer (Next.js 15 App Router)"]
        UI["Web Interface (Bilingual EN/HI)"]
        Chat["Compliance Chat & Split Evidence Drawer"]
        Audit["Gap Analysis & 7-Step Pathway Planner"]
    end

    subgraph API ["Edge & API Layer"]
        Route["Next.js Route Handlers (SSE Streaming)"]
        QueryEngine["Query Preprocessing & Intent Detection"]
    end

    subgraph Retrieval ["Hybrid Retrieval Engine"]
        Dense["Dense Vector Search<br/>(Gemini Embeddings 768-d)"]
        Sparse["Sparse Keyword Search<br/>(PostgreSQL tsvector & trigram)"]
        RRF["Reciprocal Rank Fusion (RRF k=60)<br/>Score = ฮฃ 1/(60 + rank)"]
    end

    subgraph Intelligence ["Inference & Verification"]
        Gemini["Google Gemini 2.5 Flash"]
        Auditor["Dual-Tier Citation & Grounding Auditor"]
    end

    subgraph Storage ["Supabase PostgreSQL"]
        PGV["pgvector (Vector Chunks)"]
        FTS["Full-Text Index"]
        Catalog["Standards & QCO Catalog"]
    end

    UI --> Route
    Chat --> Route
    Audit --> Route
    Route --> QueryEngine
    QueryEngine --> Dense
    QueryEngine --> Sparse
    Dense --> PGV
    Sparse --> FTS
    PGV --> RRF
    FTS --> RRF
    RRF --> Gemini
    Gemini --> Auditor
    Auditor -->|Verified + Cited| Route
Loading

Reciprocal Rank Fusion (RRF)

To ensure both exact standard codes (like IS 16046 (Part 2)) and conceptual queries (like "lithium battery drop test") are retrieved with 100% recall, we combine vector and keyword ranks:

$$\text{RRF Score}(d) = \sum_{m \in {\text{dense}, \text{sparse}}} \frac{1}{60 + r_m(d)}$$

Anti-Hallucination Citation Auditor

Before streaming tokens to the client, the response passes through a verification check that cross-references every cited clause against the retrieved evidence chunk. If a claim lacks supporting text, it is flagged or safely suppressed.


๐Ÿ“ธ Interactive UI Showcase

1. Landing Page & Intelligence Hub 2. Live Standards Explorer
Landing Page Standards Explorer
Hero search launcher, quick metrics, and key features. Searchable catalog with active/withdrawn filters and QCO tags.
3. Deep Clause Dossier Modal 4. Automated Compliance Gap Engine
Clause Dossier Gap Engine
Clause breakdown, testing requirements, and gazette links. Interactive readiness meter, gap checklist, and lab directory.
5. AI Chat with Split Evidence Drawer 6. Native Bilingual Support (เคนเคฟเคจเฅเคฆเฅ€)
AI Chat Hindi UI
Streaming Q&A with side-by-side clause verification. Full Devanagari localization for grassroots industrialists.

๐Ÿ“Š Evaluation & Benchmarks

Benchmarked against official BIS regulatory test scenarios:

Metric Manak AI Generic RAG Methodology
Retrieval Recall@5 100.0% 74.5% Relevant BIS clauses found in top 5 results
Retrieval Precision@5 79.2% 51.0% Proportion of retrieved chunks directly relevant
Faithfulness Score 100.0% 82.3% Claims fully supported by retrieved BIS evidence
Hallucination Rate 0.0% 14.8% Frequency of fabricated standards, clauses, or specs
P95 Response Latency < 1.8s 4.2s End-to-end stream start with citation verification
E2E Test Coverage 100% Passing โ€” Automated Playwright regression test suite

๐Ÿ› ๏ธ Complete Tech Stack

Frontend & UI
โ”œโ”€โ”€ Next.js 15.1.7 (App Router & React 19)
โ”œโ”€โ”€ TypeScript 5.7 (Strict type-checking)
โ”œโ”€โ”€ Tailwind CSS 3.4 (Custom design system)
โ”œโ”€โ”€ Lucide React (Accessible icons)
โ””โ”€โ”€ Zustand 5.0 (Bilingual & filter state management)

Backend & Artificial Intelligence
โ”œโ”€โ”€ Next.js API Route Handlers (Edge & SSE streaming)
โ”œโ”€โ”€ Google Gemini 2.5 Flash (Compliance reasoning & generation)
โ”œโ”€โ”€ Google Gemini Embedding 2 (768-dim semantic vectors)
โ””โ”€โ”€ Reciprocal Rank Fusion (k=60 hybrid re-ranking)

Document Processing Pipeline
โ”œโ”€โ”€ Python 3.11+
โ”œโ”€โ”€ PyMuPDF (fitz >= 1.23.0) (High-speed PDF & table extraction)
โ”œโ”€โ”€ Tesseract OCR (Fallback for scanned gazettes)
โ”œโ”€โ”€ Pillow & Pydantic (Image preprocessing & schema validation)
โ””โ”€โ”€ BIS Structure Chunker (Clause boundary preservation)

Database & Storage
โ”œโ”€โ”€ Supabase PostgreSQL 15
โ”œโ”€โ”€ pgvector (HNSW vector similarity search)
โ”œโ”€โ”€ PostgreSQL FTS (trigram & tsvector keyword search)
โ””โ”€โ”€ Prisma ORM 6.4 (Type-safe database client)

Testing & Deployment
โ”œโ”€โ”€ Playwright (Cross-browser E2E testing)
โ”œโ”€โ”€ Vercel (Edge deployment & CDN)
โ””โ”€โ”€ Automated Screenshot Capture Suite

๐Ÿš€ Quick Start Guide

Prerequisites

  • Node.js: v20.x or higher
  • Python: 3.10+ (for document ingestion pipeline)
  • Google Gemini API Key: Google AI Studio
  • Supabase Database with pgvector enabled

1. Clone the Repository

git clone https://github.com/your-org/manak-ai.git
cd manak-ai

2. Install Dependencies

# Install Web application dependencies
npm install

# Install Document processing pipeline dependencies
pip install -r ingestion/requirements.txt

3. Environment Configuration

Create a .env.local file in the project root:

# Google Gemini API
GEMINI_API_KEY="AIzaSy..."

# Supabase PostgreSQL (pgvector enabled)
DATABASE_URL="postgresql://postgres.[ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres?pgbouncer=true"
DIRECT_URL="postgresql://postgres.[ref]:[password]@aws-0-[region].pooler.supabase.com:5432/postgres"

# Supabase Client Keys
NEXT_PUBLIC_SUPABASE_URL="https://[ref].supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="eyJhbGciOi..."

4. Database Setup & Ingestion

# Push Prisma schema to Supabase
npm run prisma:generate
npm run prisma:push

# (Optional) Run PyMuPDF document ingestion on raw BIS PDFs
python -m ingestion.ingest --embed

5. Start Development Server

npm run dev
# Open http://localhost:3000 in your browser

6. Run Test Suites

# Run Playwright End-to-End browser tests
npm run test:e2e

# Run RAG Retrieval & Faithfulness benchmark evaluation
npm run test:eval

๐Ÿ“ Repository Structure

manak-ai/
โ”œโ”€โ”€ docs/                             # Engineering documentation & assets
โ”‚   โ”œโ”€โ”€ assets/
โ”‚   โ”‚   โ”œโ”€โ”€ screenshots/              # High-res application screenshots
โ”‚   โ”‚   โ””โ”€โ”€ slides/                   # SIH 2026 presentation slides
โ”‚   โ”œโ”€โ”€ PRD.md                        # Product Requirements Document
โ”‚   โ”œโ”€โ”€ brain.md                      # System Architecture & Algorithms
โ”‚   โ”œโ”€โ”€ Evaluation.md                 # RAG Evaluation & Benchmarks
โ”‚   โ”œโ”€โ”€ APISpec.md                    # REST / SSE API Specifications
โ”‚   โ””โ”€โ”€ Frontend.md                   # Design System & UI Architecture
โ”œโ”€โ”€ ingestion/                        # Python Document Processing Pipeline
โ”‚   โ”œโ”€โ”€ parser.py                     # PyMuPDF parser + OCR fallback + table finder
โ”‚   โ”œโ”€โ”€ chunker.py                    # Clause boundary & hierarchy chunker
โ”‚   โ”œโ”€โ”€ embedder.py                   # Gemini 768-dim batch vector embedder
โ”‚   โ”œโ”€โ”€ ingest.py                     # CLI ingestion orchestrator
โ”‚   โ”œโ”€โ”€ config.py                     # Ingestion path & DB configurations
โ”‚   โ”œโ”€โ”€ requirements.txt              # Python dependencies (pymupdf, pytesseract)
โ”‚   โ””โ”€โ”€ data/                         # Source PDFs, metadata configs & seeds
โ”œโ”€โ”€ evaluation/                       # Benchmark suite & evaluation datasets
โ”‚   โ”œโ”€โ”€ run-evaluation.ts             # Precision, Recall & Faithfulness harness
โ”‚   โ””โ”€โ”€ benchmark.json                # Ground-truth BIS test queries
โ”œโ”€โ”€ prisma/
โ”‚   โ””โ”€โ”€ schema.prisma                 # Supabase PostgreSQL & pgvector schema
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ capture-screenshots.ts        # Automated Retina screenshot capture script
โ”‚   โ””โ”€โ”€ generate-presentation-pdf.ts  # Presentation dossier generator
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/                          # Next.js App Router routes & API endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ api/                      # Standards search & chat streaming handlers
โ”‚   โ”‚   โ”œโ”€โ”€ chat/                     # AI compliance chat with citation drawer
โ”‚   โ”‚   โ”œโ”€โ”€ compliance/               # Gap analysis & 7-step roadmap UI
โ”‚   โ”‚   โ”œโ”€โ”€ explore/                  # Standards explorer & filtering UI
โ”‚   โ”‚   โ””โ”€โ”€ layout.tsx                # Root bilingual layout & navigation
โ”‚   โ”œโ”€โ”€ components/                   # Modular React 19 components
โ”‚   โ”‚   โ”œโ”€โ”€ chat/                     # Messages, citations & split drawer
โ”‚   โ”‚   โ”œโ”€โ”€ compliance/               # Gap gauges, checklist & lab cards
โ”‚   โ”‚   โ”œโ”€โ”€ standards/                # Filter bars, cards & clause modals
โ”‚   โ”‚   โ””โ”€โ”€ layout/                   # Navbar, footer & language switcher
โ”‚   โ”œโ”€โ”€ lib/                          # Core business logic & integrations
โ”‚   โ”‚   โ”œโ”€โ”€ gemini.ts                 # Gemini 2.5 Flash SDK wrapper
โ”‚   โ”‚   โ”œโ”€โ”€ hybrid-search.ts          # Reciprocal Rank Fusion (RRF) search engine
โ”‚   โ”‚   โ””โ”€โ”€ store/                    # Zustand client state (bilingual toggle)
โ”‚   โ””โ”€โ”€ types/                        # Type-safe TypeScript interfaces
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ e2e.ts                        # Playwright automated test suite
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ README.md

๐Ÿ“– Project Documentation


โš–๏ธ Disclaimer

Manak AI is an intelligent reference and regulatory audit copilot created to assist MSMEs, manufacturers, and compliance teams. It provides grounded references to official BIS documentation but does not replace statutory licenses or official audit decisions issued by the Bureau of Indian Standards. For official statutory certifications, visit manakonline.in.


Built with pride by Team CodeSmiths for Smart India Hackathon 2026 ๐Ÿ‡ฎ๐Ÿ‡ณ
Empowering Atmanirbhar Bharat through Quality, Standards & Artificial Intelligence

About

AI-powered Intelligent Assistant for Indian Standards & BIS Services for Industries and Consumers

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages