Skip to content

Repository files navigation

Insurance Claim Processing System

A modern web application for automated insurance claim form processing using AI-powered document analysis.

Features

  • Document Upload: Support for PDF and image files (PNG, JPG, JPEG)
  • OCR Processing: Automatic text extraction from scanned documents using EasyOCR
  • AI Analysis: Structured data extraction using Google Gemini API
  • Web Interface: Clean, responsive web interface for easy document processing
  • Real-time Processing: Live status updates during document analysis
  • Multiple API Keys: Automatic rotation between multiple Gemini API keys for better reliability

Technology Stack

  • Backend: FastAPI, Python 3.11+
  • Frontend: HTML5, CSS3, JavaScript
  • OCR: EasyOCR, pdf2image
  • AI: Google Generative AI (Gemini)
  • Document Processing: PyPDF2, Pillow
  • Deployment: Docker, Docker Compose

Prerequisites

  • Python 3.11 or higher
  • Google AI Studio API key
  • poppler-utils (for PDF processing)

macOS Installation

brew install poppler

Ubuntu/Debian Installation

sudo apt-get install poppler-utils

Quick Start

1. Clone and Setup

git clone <repository-url>
cd insurance-claim-processor
./setup.sh

2. Configure API Keys

Create the API key file:

mkdir -p envs
echo "API_KEY_1=your_gemini_api_key_here" > envs/.env.gemini_key

Get your API key from Google AI Studio

3. Run the Application

./run.sh

The application will be available at http://localhost:8000

Manual Installation

Install Dependencies

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Start the Server

python app.py

Docker Deployment

Build and Run

docker-compose up --build

Production Deployment

docker-compose -f docker-compose.yml up -d

API Configuration

The system supports multiple Gemini API keys for better reliability. Add additional keys to the environment file:

API_KEY_1=your_first_api_key
API_KEY_2=your_second_api_key
API_KEY_3=your_third_api_key

Keys are automatically rotated when quotas are exceeded.

API Endpoints

Web Interface

  • GET / - Main application interface

REST API

  • POST /upload - Process uploaded claim document
  • GET /demo-data - Get sample claim data
  • GET /api-status - Check API service status

API Service (claim_api_service.py)

  • POST /process-claim - Process claim data directly
  • POST /upload-claim - Upload and process claim file
  • POST /process-claim-async - Asynchronous claim processing

Supported File Formats

  • PDF: Both text-based and scanned documents
  • Images: PNG, JPG, JPEG formats
  • Maximum file size: 10MB

Project Structure

├── app.py                  # Main web application
├── claim_api_service.py    # REST API service
├── main.py                 # Core processing engine
├── processors/
│   ├── ocr_engine.py       # OCR processing
│   └── claim_processor.py  # AI claim analysis
├── templates/              # Web interface templates
├── requirements.txt        # Python dependencies
├── Dockerfile             # Container configuration
└── docker-compose.yml     # Multi-container setup

Configuration

Environment Variables

  • API_KEY_1, API_KEY_2, API_KEY_3 - Gemini API keys
  • HOST - Server host (default: 0.0.0.0)
  • PORT - Server port (default: 8000)

File Configuration

  • envs/.env.gemini_key - API key configuration file

Development

Running Tests

python -m pytest tests/

Code Formatting

black .
flake8 .

Troubleshooting

Common Issues

OCR not working: Ensure poppler is installed and EasyOCR dependencies are available.

API quota exceeded: Add additional API keys or wait for quota reset (24 hours for free tier).

PDF processing errors: Verify pdf2image and poppler installation.

Logs

Application logs are available in the console output. Set log level using:

export LOG_LEVEL=DEBUG
python app.py

Performance

  • PDF Processing: 20-300 seconds depending on document size and complexity
  • OCR Accuracy: 85-95% for clear scanned documents
  • AI Processing: 2-10 seconds per document
  • Concurrent Users: Supports multiple simultaneous uploads

License

This project is licensed under the MIT License.

Support

For technical support or feature requests, please create an issue in the project repository.

About

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages