Evidence-Grounded Policy Intelligence, Deterministic Rule Evaluation & Pre-Admission Claim Rehearsal
π Replace the link above with your official Google Drive URL. This presentation covers the architectural design, zero-trust citation verifier, deterministic claim simulation, and a full live user journey from document ingestion to pre-hospitalization claim rehearsal.
- π‘οΈ CoverScope β Health Insurance Policy Intelligence Platform
- π½οΈ Project Explanation & Video Walkthrough
- π Table of Contents
- 1. Executive Overview & The Problem
- 2. The CoverScope Zero-Trust Difference
- 3. Workspaces & Core Capabilities
- 4. System Architecture & Data Flow
- 5. Technology Stack
- 6. API Endpoints Reference
- 7. Local Setup & Quick Start
- 8. Production Cloud Deployment
- 9. Testing, Benchmark & Quality Verification
- 10. Project Directory Layout
- 11. Legal Disclaimer
Indian health insurance policies are notoriously dense legal instrumentsβoften 30 to 60 pages of fine print filled with complex room-rent proportionate deductions, pre-existing disease (PED) waiting periods, procedural sublimits, and mandatory co-payments.
- 70% of Claim Reductions occur due to non-medical consumables, unverified room-category upgrades, or premature claims made during waiting periods.
- Generic LLM Chatbots Fail: Standard generative models hallucinate coverage approvals, fabricate policy clauses, or confuse general health tips with active contractual covenants.
- The Financial Shock: Policyholders only discover exclusions at the hospital billing desk when faced with unexpected βΉ50,000 β βΉ2,50,000 out-of-pocket bills.
CoverScope solves this by bridging the gap between natural language policy inquiries and contractual certainty. It combines high-speed Groq AI inference (openai/gpt-oss-120b) with a deterministic Python verification kernel that guarantees every single claim and verdict is backed by verbatim, mathematically verified policy text.
| Feature | Generic AI Wrapper / Chatbot | π‘οΈ CoverScope Platform |
|---|---|---|
| Citation Integrity | Hallucinates quotes or paraphrases clauses | Verbatim Unicode substring matching in Python; rejects ungrounded quotes |
| Coverage Verdicts | Confidently answers "Yes, covered!" | Strict categorical taxonomy (Covered, Excluded, Depends, Not Stated) |
| Waiting Periods & Co-pays | LLM guesses arithmetic and timeframes | Headless deterministic rule engine (zero LLM variance) |
| Room Rent Penalties | Often ignores proportionate deductions | Automatically calculates tariff penalties if room category exceeds policy cap |
| Intent Handling | Blurs specific claims with general advice | 5-Tier Intent Classifier separating policy questions from general health guidance |
| Data Privacy | Stores raw files insecurely or in public buckets | Owner-scoped MongoDB GridFS with cascading erasure and zero plaintext disk exposure |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β COVERSCOPE WORKSPACE SUITE β
ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ€
β π¬ Ask My Policy β π₯ Claim Rehearsal β βοΈ Scenario Analyzer β
β Evidence-grounded Q&A β Pre-admission simulations, β Deterministic PED durations, β
β with verbatim citations β deductions & TPA queries β injury waivers & co-payments β
ββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ€
β βοΈ Policy Comparison β π Policy Explorer β π Document Library β
β Side-by-side dimensions β Verbatim text viewer and β Secure GridFS store with β
β & protection gap alerts β structured candidate facts β owner-scoped data isolation β
ββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββ
- Natural Language Inquiry: Answers complex questions regarding surgical coverage, day-care treatments, AYUSH benefits, and organ donor expenses.
- 5-Way Query Intent Classification:
- Specific Coverage Question ("Is my knee surgery covered?")
- General Policy Overview ("What does my policy cover?")
- Exclusion Summary ("What are the permanent exclusions?")
- Focused Clause Explanation ("Explain the pre-existing disease waiting period")
- General Insurance Education ("How does health insurance portability work?")
- Evidence Integrity & Verification Badge: The "CoverScope Verified" badge is displayed only when all retrieved citations pass rigorous Unicode NFKC substring verification against the original document chunks.
- ChatGPT / Gemini UX: Complete with an obsidian fixed sidebar, session history persistence, collapsible past dialogues, and a floating dock input bar.
- Pre-Hospitalization Stress Test: Simulates planned hospital stays before pre-authorization submission.
- Financial Liability Calculator:
- Predicts estimated bill vs. insurer liability vs. policyholder out-of-pocket expense.
- Accounts for entry-age co-pays, sublimits (e.g. Cataract βΉ40k cap), and proportionate room-rent deductions.
- Interactive Action Checklist: Grouped into Pre-Admission, Medical Records, Financial Clearances, and TPA Coordination.
- Targeted TPA / Insurer Scripts: Generates ready-to-copy contractual questions to ask hospital TPAs to prevent claim settlement disputes.
- Zero-LLM Rule Engine: 100% deterministic evaluation of waiting periods and policy clauses:
- Pre-Existing Disease (PED): Accurately checks elapsed policy tenure against 12, 24, 36, or 48-month waiting periods.
- Initial 30-Day Illness Waiting Period: Validates elapsed policy days and respects statutory accidental injury waivers.
- Specific Ailment Waiting Periods: Resolves 24-month waiting periods for cataracts, joint replacements, hernias, and kidney stones.
- Entry-Age Co-Payments: Evaluates senior citizen co-payment thresholds (e.g., 61+ years) and correctly differentiates 0% base plans.
- 7-Dimension Side-by-Side Analysis: Evaluates Sum Insured, PED Waiting Periods, Initial Waiting Period, Specific Disease Waiting Periods, Co-payments, Bariatric/Obesity Surgery limits, and Modern Treatment allowances.
- Protection Gap Indicator: Flags disadvantageous clauses, restrictive room-rent limits, or extended waiting periods with severity alerts (
Caution,Conditional Gap).
- Page-by-Page Viewer: Inspect extracted text chunks alongside character counts and page indices.
- Candidate Fact Discovery: Automatically extracts structured facts (waiting periods, exclusions, limits, co-payments) with extraction confidence and conditionality flags.
- Drag-and-Drop Ingestion: Upload official policy wordings in PDF format (up to 20MB).
- Owner-Scoped Tenant Isolation: Every document, Q&A session, and simulation is strictly bound to the authenticated user ID.
- Cascading Database Erasure: Deleting a policy cleans up GridFS binary chunks, metadata, conversation threads, and rehearsal records.
βββββββββββββββββββββββββββββββββ
β React 18 + Vite SPA β
β Tailwind CSS β’ Lucide Icons β
βββββββββββββββββ¬ββββββββββββββββ
β HTTPS / REST (JWT Bearer)
βΌ
βββββββββββββββββββββββββββββββββ
β FastAPI REST Gateway β
β Pydantic v2 β’ CORS Guard β
βββββββββ¬ββββββββββββββββ¬ββββββββ
β β
ββββββββββββββββββββββ ββββββββββββββββββββββ
βΌ βΌ
βββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ
β Ingestion & Retrieval β β Deterministic Engines β
β β’ PyMuPDF Text Extractor β β β’ Waiting Period Engine β
β β’ Unicode NFKC Matcher β β β’ Room Rent Calculator β
β β’ Smart Intent Router β β β’ Co-Pay Tariff Engine β
β β’ Lexical BM25 Ranker β β β’ Claim Rehearsal Core β
βββββββββββββββ¬ββββββββββββββ βββββββββββββββ¬ββββββββββββββ
β Retrieved Chunks β
βΌ β
βββββββββββββββββββββββββββββ β
β Groq Cloud LLM β β
β openai/gpt-oss-120b β β
β Structured JSON Schema β β
βββββββββββββββ¬ββββββββββββββ β
β Draft Response & Citations β
βΌ β
βββββββββββββββββββββββββββββ β
β Python Citation Verifier β β
β Verbatim Quote Match? β β
β Chunk & Page Grounded? β β
βββββββββββββββ¬ββββββββββββββ β
β Verified Payload β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββ
β Persistence Layer β
β MongoDB Atlas / GridFS β
β β’ User Profiles (PBKDF2) β
β β’ GridFS PDF Documents β
β β’ Dialogue History Store β
β β’ Simulation Audits β
βββββββββββββββββββββββββββββ
- Framework: React 18 + TypeScript
- Build Tool: Vite 5 (Fast HMR, optimized production chunks)
- Styling: Tailwind CSS with custom medical InsurTech palette (
emerald,slate,amber,rose) - Routing: React Router DOM v6
- Animations & Icons: Lucide React + GSAP
- State Management: Native React Context (
AuthContext) + type-safe REST client
- API Framework: FastAPI 0.115+ (Python 3.11+)
- ASGI Server: Uvicorn
- PDF Engine: PyMuPDF (
fitz/pymupdf < 2.0) - Data Validation: Pydantic v2
- AI Model:
openai/gpt-oss-120bvia Groq Cloud High-Speed Inference - Deterministic Evaluation: Pure Python rule engines for claims, waiting periods, and tariffs
- Database: MongoDB Atlas (GridFS for binary PDF chunks + native collections for metadata)
- Authentication: JWT Bearer tokens with SHA-256 PBKDF2 password hashing
- Local Fallback: Automatically falls back to local data store (
data/local_users.json) if MongoDB URI is omitted, allowing complete offline functionality
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/api/v1/auth/register |
Register new user account (salted PBKDF2) | No |
POST |
/api/v1/auth/login |
Authenticate user & issue JWT Bearer Token | No |
GET |
/api/v1/auth/me |
Retrieve profile of the current authenticated user | Yes |
GET |
/api/v1/policies |
List all uploaded policies for the authenticated user | Yes |
POST |
/api/v1/policies/upload |
Upload policy PDF (ingested into MongoDB GridFS) | Yes |
GET |
/api/v1/policies/{id} |
Retrieve policy details, metadata, and extracted facts | Yes |
DELETE |
/api/v1/policies/{id} |
Cascading deletion of policy, chunks, and chat history | Yes |
POST |
/api/v1/qa/ask |
Ask coverage question (Intent routing + Verbatim quotes) | Yes |
GET |
/api/v1/qa/conversations |
Retrieve past Q&A conversations list | Yes |
GET |
/api/v1/qa/conversations/{id} |
Fetch full message thread for a policy conversation | Yes |
POST |
/api/v1/scenarios/evaluate |
Deterministic evaluation of waiting periods & co-pay | Yes |
POST |
/api/v1/rehearsal/simulate |
Run pre-hospitalization claim rehearsal simulation | Yes |
GET |
/api/v1/rehearsal/history |
Retrieve past claim rehearsal records | Yes |
POST |
/api/v1/comparison/matrix |
Compare two policies across 7 standardized dimensions | Yes |
GET |
/api/v1/dashboard/metrics |
Retrieve aggregated portfolio & policy analytics | Yes |
GET |
/api/v1/health |
System health check (Database, Storage, & AI status) | No |
- Python: 3.11 or higher
- Node.js: 18.0 or higher (with
npm) - Groq API Key: Free API key from console.groq.com
- MongoDB Atlas (Optional): Free M0 cluster URI (runs locally if omitted)
# 1. Clone repository
git clone https://github.com/<your-username>/coverscope.git
cd coverscope
# 2. Create and activate Python virtual environment
python -m venv .venv
# On Windows (PowerShell):
.\.venv\Scripts\Activate.ps1
# On macOS / Linux:
# source .venv/bin/activate
# 3. Upgrade pip and install dependencies
pip install --upgrade pip
pip install -r requirements.txtCreate a .env file in the repository root (or copy from .env.example):
# AI LLM Provider (Required for natural language Q&A)
GROQ_API_KEY=gsk_your_groq_api_key_here
COVERSCOPE_GROQ_MODEL=openai/gpt-oss-120b
# Database Persistence (Optional: falls back to local data store if omitted)
MONGODB_URI=mongodb+srv://<username>:<password>@cluster0.xxxxx.mongodb.net/?retryWrites=true&w=majority&appName=CoverScope
MONGODB_DATABASE=coverscope
# Security & JWT Token Signing
COVERSCOPE_JWT_SECRET=super_secret_production_key_replace_with_32_random_bytesnpm install --prefix frontendIn Terminal 1 (Start FastAPI Backend):
python -m backend.mainBackend runs on http://localhost:8000 (Interactive Swagger docs: http://localhost:8000/docs).
In Terminal 2 (Start React Frontend with Vite HMR):
npm run dev --prefix frontendFrontend will launch at http://localhost:5173.
Because the React single page app compiles directly into frontend/dist/, running python -m backend.main serves the complete React SPA, API routes, and static assets from http://localhost:8000/ in a single command!
CoverScope is engineered for decoupled cloud deployment:
- Docker Runtime: The repository includes a production-ready
Dockerfile. Render auto-detects it. - Set Environment Variables:
GROQ_API_KEY,MONGODB_URI,COVERSCOPE_JWT_SECRET, andPYTHONPATH=.. - Set Health Check path to
/api/v1/health.
- Link your Git repository to Vercel.
- Set Root Directory to
frontend. - Set Framework Preset to
Vite. - Configure Environment Variable:
VITE_API_BASE_URL:https://<your-backend-api-domain>.com
- The included
frontend/vercel.jsonhandles SPA client-side routing automatically.
CoverScope includes a 100% offline-evaluable automated test suite:
# Run the complete test suite
pytest -q........................................................................ [ 25%]
........................................................................ [ 50%]
........................................................s............... [ 75%]
...................................................................... [100%]
===================== 285 passed, 1 skipped in 18.38s =====================
- Evidence Grounding: Mathematical verification of Unicode NFKC normalization and quote boundaries.
- Deterministic Waiting Periods: Pre-existing disease duration conversions (years to months) and 30-day initial illness waivers.
- Claim Rehearsal Accuracy: Correct computation of room-rent proportionate deductions, procedural sublimits, and out-of-pocket liabilities.
- Tenant Isolation: Multi-tenant database boundary verification (users cannot query or delete unowned records).
- Contract Compatibility: Dual-ID resolution (MongoDB
_idvs SHA-256 fingerprint) and cascading resource destruction.
coverscope/
βββ backend/ # Python FastAPI Application Core
β βββ api/ # REST endpoints (auth, policies, qa, scenarios, rehearsal, etc.)
β βββ database/ # MongoDB Atlas client, repositories, GridFS storage, indexes
β βββ document_processing/ # PyMuPDF text extraction, Unicode NFKC normalizer, chunker
β βββ domain/ # Deterministic rule engines, scenario & comparison models
β βββ llm/ # Resilient Groq Cloud SDK client & error handlers
β βββ qa/ # Intent classifier, BM25 retrieval ranker, citation verifier
β βββ services/ # Headless business services (PolicyService, AuthService, etc.)
β βββ config.py # Pydantic application settings & environment schema
β βββ main.py # Server entrypoint, CORS configuration & lifespan events
βββ frontend/ # React 18 + TypeScript + Vite Single Page Application
β βββ src/
β β βββ components/ # Reusable components (Navbar, Footer, CardTilt, Badges)
β β βββ context/ # AuthContext (JWT session state, token persistence)
β β βββ layouts/ # AppLayout (ChatGPT-style dual pane & standard layouts)
β β βββ lib/ # Typed API client, TypeScript definitions, helpers
β β βββ pages/ # AskPolicy, ClaimRehearsal, Explorer, Comparison, Dashboard
β βββ package.json # Frontend dependencies & npm scripts
β βββ tailwind.config.js # Healthcare InsurTech color palette & design tokens
β βββ vite.config.ts # Vite bundler configuration & backend API reverse proxy
βββ evaluation/ # Ground-truth benchmarks & gold fact datasets
β βββ comparison_benchmarks.json # Standardized comparison evaluation dimensions
β βββ gold_facts.json # Verified policy facts for offline evaluation tests
β βββ questions.json # Benchmark QA evaluation suite
β βββ schedule_benchmarks.json # Waiting period & sublimit evaluation benchmarks
βββ pdfs/ # Public benchmark insurance policy schedules
βββ scripts/ # Operational CLI utilities, DB healthcheck, and smoke tests
βββ tests/ # Comprehensive 285-test automated test suite
βββ .env.example # Environment variable template
βββ Dockerfile # Multi-stage production container definition
βββ package.json # Root monorepo workspace orchestration
βββ pytest.ini # Pytest configuration
βββ requirements.txt # Pinned Python backend dependencies
βββ README.md # Platform documentation
Important
CoverScope is an automated informational intelligence and pre-admission simulation tool designed to assist policyholders in understanding dense policy wording and contractual provisions. It does not constitute legal advice, insurance underwriting, or a formal claim settlement guarantee. All final claim settlements, pre-authorizations, and coverage decisions are governed strictly by the respective insurance company and the terms stated in your active Policy Schedule and IRDAI regulations.
Built with β€οΈ for Indian policyholders β’ Engineered for clinical evidence integrity and zero-trust certainty.