Skip to content

RaihanBasha7/ExtractIQ-Engine

Repository files navigation

ExtractIQ Engine

AI-Powered Structured Information Extraction Engine for Noisy Customer Support Data

🌐 Live Demo β€’ πŸ“„ Documentation β€’ ⚑ API Docs β€’ πŸŽ₯ Demo Video

Python FastAPI React Pydantic License

πŸš€ A production-inspired AI extraction platform that transforms noisy customer support tickets into schema-compliant JSON using LLMs, strict Pydantic validation, and an intelligent Model-Driven Repair Loop.

⭐ Built for OneInbox AI Engineer Internship Hackathon 2026

⚑ Production-Inspired Architecture

🧠 Zero Regex Repair Strategy

πŸ“Š Project Highlights

  • βœ… Production-ready deployment
  • πŸ€– AI-Powered Structured Extraction
  • πŸ”„ Model-Driven Repair Loop
  • πŸ“„ Strict Pydantic Schema Validation
  • πŸ›‘οΈ PII Redaction
  • πŸ“¦ Batch Extraction
  • πŸ“ˆ Analytics Dashboard
  • πŸ“œ Extraction History
  • ❀️ Health Monitoring
  • 🌐 Render + Vercel Deployment
  • πŸ—„οΈ Supabase Database
  • ⚑ Featherless AI + Google Gemma 4 31B

Extract structured, schema-valid JSON from messy customer support tickets using LLMs with a Model-Driven Repair Loop.

Built for the OneInbox AI Engineer Internship Hackathon 2026


πŸ“ˆ Project Metrics

Feature Status
AI Extraction βœ…
Model-Driven Repair Loop βœ…
Strict Schema Validation βœ…
Batch Extraction βœ…
Analytics Dashboard βœ…
Health Monitoring βœ…
Version Endpoint βœ…
Structured Logging βœ…
Docker Deployment βœ…
CI/CD Ready βœ…
Request Correlation IDs βœ…
API Documentation βœ…

πŸ“‹ Table of Contents


Short Description

ExtractIQ Engine is a production-inspired AI extraction system that transforms noisy customer support tickets into clean, structured JSON.

Instead of relying on fragile regex patterns, it uses LLMs, strict Pydantic validation, and a Model-Driven Repair Loop to guarantee highly reliable outputs.

πŸ’‘ Why ExtractIQ?

Traditional information extraction systems rely on fragile regular expressions or unconstrained LLM outputs, making them unreliable when processing noisy customer support conversations.

ExtractIQ Engine addresses this challenge through an AI-first extraction pipeline powered by strict schema validation and a Model-Driven Repair Loop. Instead of silently accepting invalid outputs or masking failures with handcrafted regex rules, validation errors are fed back into the LLM, enabling targeted self-correction until a schema-compliant response is produced or the retry limit is reached.

The result is a production-inspired extraction workflow that prioritizes structural integrity, transparency, and maintainability.

Problem Statement

Customer support tickets are messy β€” missing punctuation, broken sentences, mixed languages, typing mistakes, missing fields, and unstructured conversations. Traditional regex-based extraction breaks easily, and even modern LLMs frequently produce invalid JSON or violate predefined schemas.

Solution

ExtractIQ Engine introduces a Model-Driven Repair Loop:

  1. Extract β€” LLM extracts structured data from ticket
  2. Validate β€” Pydantic enforces strict schema compliance
  3. Detect β€” Validation errors are captured with exact field details
  4. Repair β€” Errors are fed back to the LLM for targeted correction
  5. Repeat β€” Loop continues until valid or retry limit reached

⭐ Key Features

πŸ€– AI-Powered Extraction

Extracts structured information from noisy customer support tickets using state-of-the-art LLMs (Featherless AI, Groq).

βœ… Strict Schema Validation

Every response must satisfy nested Pydantic models with enum enforcement, type checking, and required field validation.

πŸ”„ Model-Driven Repair Loop

Automatically repairs invalid outputs by feeding validation errors back to the LLM. No regex fallbacks, no force-fitting.

πŸ›‘οΈ PII Redaction

Emails, phone numbers, and zip codes are automatically redacted before any data reaches third-party LLM providers.

πŸ“Š Analytics Dashboard

Real-time Streamlit dashboard showing success rates, repair rates, latency, category distribution, and historical trends.

πŸ“‚ Batch Extraction

Upload and process multiple tickets simultaneously with individual error handling.

πŸ“œ Extraction History

Complete history of all extractions with pagination, search, and detailed repair attempt logging.

❀️ Health Monitoring

Comprehensive health endpoint with per-dependency status checks (API, database, LLM provider, disk).

πŸ“ˆ Metrics API

Live extraction statistics including success rates, average processing time, retry distribution, and failure breakdown.

🧠 MVP Architecture

  • Request IDs with end-to-end correlation
  • Structured JSON logging
  • Version endpoint
  • Error tracking with correlation IDs
  • Global exception handlers
  • CORS configuration

πŸš€ Key Innovations

πŸ”„ Model-Driven Repair Loop

Validation errors generated by Pydantic are automatically used to guide the LLM toward producing corrected, schema-compliant responses.

🧠 AI-First Extraction

Instead of handcrafted parsing rules, the engine leverages modern LLMs for intelligent structured extraction.

πŸ›‘ Privacy-Aware Processing

Sensitive information is redacted before being transmitted to external AI providers.

πŸ“Š Production Observability

Every request is tracked using structured logging, Request IDs, Correlation IDs, metrics, and health endpoints.


πŸ— Architecture

The architecture follows a modular layered design that separates preprocessing, extraction, validation, persistence, and analytics into independent components.

This improves maintainability, simplifies debugging, and allows future scalability without changing the core extraction pipeline.

Architecture

The system follows a modular pipeline architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Raw Ticket  β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Preprocess   β”‚  ← PII redaction, normalization, language detection
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ LLM Extract  β”‚  ← instructor + Groq/Featherless
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Validate    │────→│  Repair Loop β”‚  ← Feed errors back to LLM
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Validated    β”‚  ← Schema-compliant JSON
β”‚    JSON      β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Database    β”‚  ← SQLite (SQLAlchemy)
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Analytics   β”‚  ← Streamlit / React Dashboard
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Component Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    FastAPI Server                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  Routes   β”‚β†’β”‚  Service  β”‚β†’β”‚  Extraction Engine  β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                      β”‚               β”‚               β”‚
β”‚                      β–Ό               β–Ό               β”‚
β”‚               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚               β”‚ Database β”‚  β”‚  LLM Provider       β”‚ β”‚
β”‚               β”‚   (DB)   β”‚  β”‚  (Groq/Featherless) β”‚ β”‚
β”‚               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”„ Workflow Pipeline

User Uploads Ticket
       β”‚
       β–Ό
Text Cleaning & PII Redaction
       β”‚
       β–Ό
LLM Extraction (instructor + Groq/Featherless)
       β”‚
       β–Ό
JSON Validation (Pydantic TicketExtraction)
       β”‚
       β”œβ”€β”€ Valid ──→ Database Storage ──→ Response
       β”‚
       └── Invalid ──→ Repair Loop
                            β”‚
                            β”œβ”€β”€ (≀3 attempts) Re-prompt with errors
                            β”‚
                            └── Max retries exceeded β†’ Return failure

Processing Stages

  1. Ticket Ingestion

  2. Text Cleaning

  3. PII Redaction

  4. LLM Extraction

  5. Schema Validation

  6. Intelligent Repair Loop

  7. Database Storage

  8. Analytics Generation

  9. API Response


βš™ Tech Stack

Backend

Technology Purpose
FastAPI REST API framework
Python 3.12 Runtime
Pydantic v2 Schema validation & settings
SQLAlchemy 2.0 ORM
SQLite Database
instructor Structured LLM output
Uvicorn ASGI server

AI / LLM

Technology Purpose
Featherless AI Primary LLM provider (default: google/gemma-4-31B-it)
Groq Optional alternate provider (llama-3.3-70b-versatile)

Frontend

Technology Purpose
React 19 UI framework
Vite Build tool
TailwindCSS Styling
Recharts Charts
Framer Motion Animations
TypeScript Type safety

Dashboard

Technology Purpose
Streamlit Analytics dashboard
Plotly Interactive charts
Pandas Data processing

DevOps

Technology Purpose
Docker Containerization
GitHub Actions CI/CD
pytest Testing
Black Code formatting
isort Import sorting
Flake8 Linting
mypy Type checking
pre-commit Git hooks

🎯 Design Principles

  • Modular Architecture
  • AI-First Engineering
  • Production-Inspired Design
  • Strict Validation
  • Privacy by Default
  • Scalable Components
  • Observable APIs

πŸ“ Project Structure

ExtractIQ-Engine/
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/              # API routes, models, middleware, error models
β”‚   β”‚   β”‚   β”œβ”€β”€ routes.py     # FastAPI route handlers
β”‚   β”‚   β”‚   β”œβ”€β”€ models.py     # Request/response Pydantic models
β”‚   β”‚   β”‚   β”œβ”€β”€ service.py    # Business logic orchestrator
β”‚   β”‚   β”‚   β”œβ”€β”€ middleware.py # Request ID & correlation middleware
β”‚   β”‚   β”‚   └── error_models.py  # Standard error response model
β”‚   β”‚   β”œβ”€β”€ database/
β”‚   β”‚   β”‚   β”œβ”€β”€ database.py   # SQLAlchemy engine & session
β”‚   β”‚   β”‚   β”œβ”€β”€ models.py     # ORM models
β”‚   β”‚   β”‚   └── repository.py # Data access layer
β”‚   β”‚   β”œβ”€β”€ evaluation/
β”‚   β”‚   β”‚   β”œβ”€β”€ collector.py  # Evaluation record collector
β”‚   β”‚   β”‚   β”œβ”€β”€ metrics.py    # Evaluation metrics calculations
β”‚   β”‚   β”‚   β”œβ”€β”€ models.py     # Evaluation record schema
β”‚   β”‚   β”‚   └── repository.py # JSONL-backed evaluation persistence
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   β”œβ”€β”€ health_service.py  # Dependency health checks
β”‚   β”‚   β”‚   β”œβ”€β”€ metrics_service.py # Metrics aggregation
β”‚   β”‚   β”‚   └── version_service.py # Version info
β”‚   β”‚   β”œβ”€β”€ config.py         # Configuration (backward-compatible)
β”‚   β”‚   β”œβ”€β”€ settings.py       # Pydantic Settings (centralized config)
β”‚   β”‚   β”œβ”€β”€ schema.py         # TicketExtraction Pydantic schema
β”‚   β”‚   β”œβ”€β”€ extraction.py     # Extraction & repair loop
β”‚   β”‚   β”œβ”€β”€ preprocessing.py  # Text cleaning & PII redaction
β”‚   β”‚   β”œβ”€β”€ confidence.py     # Confidence scoring
β”‚   β”‚   β”œβ”€β”€ metadata.py       # Extraction metadata builder
β”‚   β”‚   β”œβ”€β”€ logging.py        # Structured JSON logging
β”‚   β”‚   └── repair_logging.py # Repair attempt logging
β”‚   β”œβ”€β”€ tests/
β”‚   β”‚   β”œβ”€β”€ conftest.py       # Shared fixtures & test configuration
β”‚   β”‚   β”œβ”€β”€ test_api.py       # API endpoint tests
β”‚   β”‚   β”œβ”€β”€ test_schema.py    # Schema validation tests
β”‚   β”‚   β”œβ”€β”€ test_repair_loop.py  # Repair loop tests
β”‚   β”‚   β”œβ”€β”€ test_database.py  # Database operation tests
β”‚   β”‚   β”œβ”€β”€ test_utilities.py # Utility module tests
β”‚   β”‚   β”œβ”€β”€ test_error_handling.py  # Error handling tests
β”‚   β”‚   β”œβ”€β”€ test_integration_mocked.py  # Mocked integration tests
β”‚   β”‚   └── test_evaluation.py  # Evaluation module tests
β”‚   β”œβ”€β”€ scripts/              # Utility scripts
β”‚   β”œβ”€β”€ data/                 # Data files (CSV, JSONL, SQLite)
β”‚   β”œβ”€β”€ reports/              # Evaluation reports
β”‚   β”œβ”€β”€ Dockerfile            # Multi-stage Docker build
β”‚   β”œβ”€β”€ requirements.txt      # Production dependencies
β”‚   β”œβ”€β”€ requirements-dev.txt  # Development dependencies
β”‚   β”œβ”€β”€ pyproject.toml        # Tool configuration
β”‚   └── pytest.ini            # Pytest configuration
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/       # React components
β”‚   β”‚   β”œβ”€β”€ pages/            # Page components
β”‚   β”‚   β”œβ”€β”€ lib/              # API client & utilities
β”‚   β”‚   └── assets/           # Static assets
β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ vite.config.ts
β”‚   └── tailwind.config.js
β”‚
β”œβ”€β”€ dashboard/
β”‚   β”œβ”€β”€ app.py                # Streamlit app
β”‚   β”œβ”€β”€ analytics.py          # Analytics components
β”‚   β”œβ”€β”€ charts.py             # Chart components
β”‚   └── config.py             # Dashboard config
β”‚
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ architecture.png      # Architecture diagram
β”‚   β”œβ”€β”€ architecture.md       # Architecture documentation
β”‚   β”œβ”€β”€ api.md                # API documentation
β”‚   β”œβ”€β”€ api_examples.md       # API examples
β”‚   β”œβ”€β”€ banner.png            # Project banner
β”‚   β”œβ”€β”€ changelog.md          # Release history
β”‚   β”œβ”€β”€ code_of_conduct.md    # Code of conduct
β”‚   β”œβ”€β”€ contributing.md       # Contributing guide
β”‚   β”œβ”€β”€ deployment.md         # Deployment guide
β”‚   β”œβ”€β”€ logo.png              # Project logo
β”‚   β”œβ”€β”€ model-card.md         # Model card
β”‚   β”œβ”€β”€ observability.md      # Observability guide
β”‚   β”œβ”€β”€ roadmap.md            # Roadmap
β”‚   β”œβ”€β”€ screenshots/          # Application screenshots
β”‚   β”œβ”€β”€ security.md           # Security guide
β”‚   β”œβ”€β”€ workflow.md           # Workflow documentation
β”‚   β”œβ”€β”€ adr/                  # Architecture decision records
β”‚   └── reports/              # Documentation reports
β”‚       β”œβ”€β”€ audit_report.md
β”‚       β”œβ”€β”€ benchmark.md
β”‚       β”œβ”€β”€ evaluation.md
β”‚       β”œβ”€β”€ failure_analysis.md
β”‚       β”œβ”€β”€ metric_verification_report.md
β”‚       β”œβ”€β”€ performance.md
β”‚       └── project_metrics.md
β”‚
β”œβ”€β”€ reports/                  # Generated outputs
β”‚
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── ci.yml            # GitHub Actions CI pipeline
β”‚
β”œβ”€β”€ docker-compose.yml        # Multi-service orchestration
β”œβ”€β”€ .pre-commit-config.yaml   # Pre-commit hooks
β”œβ”€β”€ .editorconfig             # Editor configuration
β”œβ”€β”€ .gitignore                # Git ignore rules
β”œβ”€β”€ .dockerignore             # Docker ignore rules
β”œβ”€β”€ README.md                 # This file
└── LICENSE                   # MIT License

πŸ† Production Engineering

βœ” Global Exception Handling

βœ” Request IDs

βœ” Correlation IDs

βœ” Structured Logging

βœ” Environment Configuration

βœ” Health Monitoring

βœ” Version Endpoint

βœ” Metrics API

βœ” Batch Processing

βœ” Docker Support

βœ” REST API Documentation

πŸš€ Quick Start

Prerequisites

  • Python 3.12+
  • Node.js 20+
  • An API key from Groq or Featherless AI

1. Clone the Repository

git clone https://github.com/RaihanBasha7/ExtractIQ-Engine.git
cd ExtractIQ-Engine

2. Backend Setup

cd backend
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

pip install -r requirements.txt

3. Configure Environment

cp .env.example .env

Edit .env and add your API key:

LLM_PROVIDER=featherless
FEATHERLESS_API_KEY=fl_your_key_here
FEATHERLESS_MODEL=deepseek-ai/DeepSeek-V4-Pro
FEATHERLESS_BASE_URL=https://api.featherless.ai/v1
MAX_REPAIR_RETRIES=3

To switch to Groq as the provider, change LLM_PROVIDER=groq and set GROQ_API_KEY and GROQ_MODEL instead.

4. Run the Backend

uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

5. Run the Frontend

cd frontend
npm install
npm run dev

6. Access the Application

Service URL
Frontend http://localhost:5173
API Docs http://localhost:8000/docs
Dashboard http://localhost:8501

πŸ”Œ API Reference

Note on example responses: The JSON response bodies below show the expected structure and field types. Numeric values (response times, latency, confidence) are illustrative and will vary based on provider, network conditions, and input complexity. See docs/reports/benchmark.md for actual measured values.

Health Check

GET /health

Response:

{
  "status": "healthy",
  "timestamp": "2026-07-20T10:30:00Z",
  "response_time_ms": 12.34,
  "checks": {
    "api": { "status": "ok", "response_time_ms": 0.1 },
    "database": { "status": "ok", "response_time_ms": 1.2 },
    "llm_provider": { "status": "ok", "response_time_ms": 5.0, "provider": "featherless", "model": "deepseek-ai/DeepSeek-V4-Pro" },
    "disk": { "status": "ok", "response_time_ms": 0.3 }
  }
}

Version Info

GET /version

Response:

{
  "service": "OneInbox API",
  "version": "0.1.0",
  "api_version": "v1",
  "provider": "featherless",
  "model": "google/gemma-4-31B-it",
  "environment": "development",
  "python_version": "3.12.4",
  "timestamp": "2026-07-20T10:30:00Z"
}

Single Extraction

POST /v1/extract
Content-Type: application/json

{
  "ticket_id": "TKT-001",
  "raw_text": "From: John Doe <[email protected]>\nSubject: Need help\n\nI can't log into my account. It says 'invalid password'. Help!"
}

Response:

{
  "ticket_id": "TKT-001",
  "success": true,
  "data": {
    "ticket_id": "TKT-001",
    "customer": { "name": "John Doe", "account_id": null },
    "issue": {
      "category": "account",
      "subcategory": "login failure",
      "product_or_service": null,
      "urgency": "high"
    },
    "sentiment": "frustrated",
    "entities": { "order_ids": [], "dates_mentioned": [], "amounts_mentioned": [] },
    "requested_action": "help with login",
    "resolution_status": "unresolved"
  },
  "confidence": 0.85,
  "metadata": {
    "repair_attempts": 0,
    "latency_ms": 450,
    "provider": "featherless",
    "model": "deepseek-ai/DeepSeek-V4-Pro",
    "validation": "passed",
    "timestamp": "2026-07-20T10:30:00Z"
  },
  "retry_count": 0,
  "latency_seconds": 0.45,
  "language": "en",
  "request_id": "REQ-000001",
  "cleaned_text": "From: John Doe <[REDACTED_EMAIL]>\nSubject: Need help\n\nI can't log into my account...",
  "repair_attempts": []
}

Batch Extraction

POST /v1/extract/batch
Content-Type: application/json

{
  "tickets": [
    { "ticket_id": "TKT-001", "raw_text": "Need help with my order" },
    { "ticket_id": "TKT-002", "raw_text": "Account locked, please help" }
  ]
}

Extraction History

GET /v1/history?limit=10&offset=0

Metrics

GET /v1/metrics

Combined System Status

GET /v1/system

πŸ§ͺ Testing

The project uses pytest for testing.

Running Tests

cd backend

# Run all tests
python -m pytest

# With coverage report
python -m pytest --cov=app --cov-report=term

# With HTML coverage report
python -m pytest --cov=app --cov-report=html

# Run specific test file
python -m pytest tests/test_api.py

# Run tests by marker
python -m pytest -m "unit"
python -m pytest -m "integration"

# Verbose output
python -m pytest -v

Test Structure

Test File Coverage
test_api.py API endpoints (health, version, metrics, history, extract, batch)
test_schema.py Schema validation, enums, nested objects, optional fields
test_repair_loop.py Repair loop execution, retry counting, error classification
test_database.py CRUD operations, metrics aggregation, history retrieval
test_utilities.py Text cleaning, PII stripping, request ID, confidence, metadata
test_error_handling.py Error responses, exception handlers, validation errors
test_integration_mocked.py End-to-end pipeline with mocked LLM
test_evaluation.py Evaluation records, metrics, repository

Code Quality

# Format code
black --line-length=120 app/ tests/

# Sort imports
isort --profile=black app/ tests/

# Lint
flake8 app/ tests/

# Type check
mypy app/

🐳 Docker Deployment

Build and Run with Docker

# Build the backend image
docker build -t extractiq-engine -f backend/Dockerfile .

# Run the container
docker run -p 8000:8000 \
  -e LLM_PROVIDER=featherless \
  -e FEATHERLESS_API_KEY=your_key \
  -e FEATHERLESS_MODEL=deepseek-ai/DeepSeek-V4-Pro \
  -e FEATHERLESS_BASE_URL=https://api.featherless.ai/v1 \
  extractiq-engine

Full Stack with Docker Compose

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

This starts:

  • Backend on port 8000
  • Frontend on port 5173
  • Health checks ensure proper startup order

πŸ“Š Deployment Overview

Layer Platform
Frontend Vercel
Backend Render
Database SQLite (PostgreSQL Ready)
API FastAPI
AI Provider Featherless AI

πŸ›£οΈ Roadmap

Short Term

βœ… Completed

  • [βœ…] PostgreSQL support (via SQLAlchemy)
  • [βœ…] Authentication & API keys
  • [βœ…] Rate limiting middleware
  • [βœ…] Request validation improvements

Medium Term

  • Multi-provider LLM routing (LiteLLM)
  • Redis queue + Celery workers
  • Webhook notifications
  • Human review dashboard
  • Export integration (CSV, JSON, PDF)

Long Term

  • Kubernetes deployment
  • AWS/GCP deployment
  • Real-time monitoring (Prometheus + Grafana)
  • Active learning loop
  • Multi-language schema support
  • A/B testing framework

⚠️ Known Limitations

  1. SQLite β€” Suitable for development/small-scale. For production, migrate to PostgreSQL.
  2. Process-local request IDs β€” Current REQ-XXXXXX generator resets on restart. Use UUIDv7 for distributed deployments.
  3. Rate limits β€” Free-tier LLM providers have daily token limits. Consider upgrading or adding provider failover.
  4. Single-worker β€” The repair loop runs synchronously. For high throughput, implement Celery workers.
  5. Language detection β€” Uses langdetect which may not detect all languages accurately.
  6. No authentication β€” API endpoints are currently open. Add authentication before production deployment.

πŸ… Project Highlights

  • Built for OneInbox AI Engineer Internship Hackathon 2026
  • Production-inspired AI extraction architecture
  • Strict Pydantic schema enforcement
  • Model-Driven Repair Loop
  • Interactive analytics dashboard
  • RESTful API with OpenAPI documentation
  • Dockerized deployment
  • Modular FastAPI backend

πŸ‘¨β€πŸ’» Author

Shaik Raihan Basha

B.Tech CSE | AI/ML Engineer


🀝 Contributing

Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.


πŸ“„ License

MIT License β€” Copyright (c) 2026 Shaik Raihan Basha

See LICENSE for full details.

Copyright (c) 2026 Shaik Raihan Basha


⭐ If you found this project useful, consider giving it a star!

Made with ❀️ by Shaik Raihan Basha

About

AI-powered structured information extraction platform with LLM-driven schema validation and automated repair loop.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors