Skip to content

Appian Hackathon project implementing context-aware policy intelligence using Docling + PageIndex for structure-based retrieval (no vector search) with verifiable citations.

License

Notifications You must be signed in to change notification settings

Nithin0306/appian

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Context-Aware Policy Intelligence System

Just-in-Time, Verifiable Policy Guidance for High-Stakes Case Management

This project demonstrates a compliance-safe, proactive intelligence layer that delivers exact policy clauses with real page citations based on structured case context — no chat, no search bar, no hallucinations.

Built for seamless integration with Appian (or any case management system).

Problem Solved

Agents handling insurance claims, regulatory compliance, or government benefits must consult fragmented, frequently updated policy documents. Current process:

  • Alt-Tab to multiple systems
  • Manual keyword search
  • Risk of missing updates or wrong clauses
  • High average handling time (AHT) + compliance errors

Our system eliminates this by automatically providing the exact relevant clause with page citation when a case is opened.

Key Features

  • Proactive Guidance: Receives structured case context (claim_type, jurisdiction, etc.) via POST request
  • Exact Retrieval: Uses hierarchical PageIndex reasoning on pre-loaded policies
  • Real PDF Page Citations: Shows actual page numbers from the original document
  • Compliance-Safe: LLM only summarizes retrieved text — no external knowledge
  • Versioning & Updates: Hash-based change detection; new versions created only when content changes
  • Manual + Auto Ingestion:
    • Local trusted PDFs (sample_pdfs/)
    • Optional auto-fetch from authorized sources (config/sources.json)
  • Audit-Ready: Full provenance (policy name, version, section, page)

System Architecture

Appian / Frontend
↓ (POST /retrieve)
FastAPI Backend
↓
In-Memory + Supabase Storage
↓
PageIndex Tree Traversal → Relevant Clauses → Gemini Summary → Citations 

How It Works

  1. On Startup:

    • Loads PDFs from sample_pdfs/
    • Optionally fetches latest versions from sources.json
    • Parses with Docling → builds tree with real page numbers
    • Stores versioned trees in Supabase (persists across restarts)
  2. On Case Open:

    • Appian sends structured context:
      {
        "claim_type": "flood damage",
        "jurisdiction": "Florida"
      }
    • Backend filters latest policy versions
    • Traverses PageIndex tree to find matching sections
    • Summarizes clauses (Gemini 2.5 Flash, restricted prompt)
    • Returns guidance with real PDF page citations
  3. On Case Open:

    • Admin clicks Settings → /admin
    • Uploads new/internal PDFs
    • Indexed immediately and available for retrieval

Tech Stack

  • Backend: FastAPI (Python)
  • PDF Parsing: Docling (real page numbers + structure)
  • Storage: Supabase (PostgreSQL + JSONB for trees)
  • Summarization: Gemini 2.5 Flash (restricted prompt)
  • Frontend: React + TypeScript + ShadCN UI
  • Routing: React Router

Setup & Run

  1. Backend
cd backend
pip install -r requirements.txt

# Create .env
cp .env.example .env
# Add your SUPABASE_URL, SUPABASE_KEY, GEMINI_API_KEY

uvicorn main:app --reload
  1. Frontend
cd frontend
npm install
npm start

Open http://localhost:3000

  1. Supabase Setup
    1. Create free project at https://supabase.com
    2. Run this SQL in SQL Editor:
       CREATE TABLE policy_versions (
       id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
       policy_id TEXT NOT NULL,
       policy_name TEXT,
       jurisdiction TEXT,
       policy_type TEXT,
       version_num INTEGER NOT NULL,
       hash TEXT NOT NULL,
       effective_date DATE,
       index_tree JSONB NOT NULL,
       created_at TIMESTAMP DEFAULT NOW(),
       UNIQUE(policy_id, version_num)
       );
       CREATE INDEX idx_latest_version ON policy_versions (policy_id, version_num DESC);

Demo Flow

  1. Start backend → watches PDFs load
  2. Open frontend → dashboard
  3. Edit case context (e.g., "flood damage", "India")
  4. Click "Analyze Case" → guidance appears with real page citations
  5. Click Settings icon → /admin → upload new policy PDF
  6. Query again → new policy available

Compliance Guarantees

  • No hallucinations (LLM only sees retrieved text)
  • Verifiable citations (real PDF pages)
  • Full audit trail (versioning + hashes)
  • No data stored beyond policy documents

📑 Presentation


No Alt-Tab. No Search. Just the Right Clause - Instantly.

About

Appian Hackathon project implementing context-aware policy intelligence using Docling + PageIndex for structure-based retrieval (no vector search) with verifiable citations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published