Skip to content
ironmark72Public

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ ClaimFlow β€” AI-Powered Medical Claim Processing Engine

Python FastAPI React TypeScript License

ClaimFlow is an intelligent document processing system that automates the lifecycle of hospital insurance claims β€” from document upload and OCR extraction to medical validation and fraud risk scoring.


✨ Features

Feature Description
Document Upload Drag-and-drop multi-file upload (discharge summaries, bills, lab reports, prescriptions)
AI-Powered OCR Extracts text from images and PDFs using the Kimi K2.5 model on AWS Bedrock
Structured Extraction Parses patient, policy, clinical, and financial data into structured fields
Medical Validation Automated rule engine checks ICD code validity, billing consistency, and completeness
Fraud Detection 7-rule fraud engine covering billing, clinical, temporal, pattern, policy, and network analysis
Role-Based Access Hospital users upload and correct; Insurer users review and approve/reject
Audit Trail Immutable log of every action taken on each claim
Field Correction Hospital staff can manually correct extracted data and re-validate

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Frontend (React)            β”‚
β”‚  Login β†’ Dashboard β†’ Upload β†’ Detail     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ REST API
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Backend (FastAPI)              β”‚
β”‚                                          β”‚
β”‚  Auth Controller ──── JWT Cookie Auth    β”‚
β”‚  Claims Controller ── CRUD + Pipeline    β”‚
β”‚                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ Pipeline ───────────────┐  β”‚
β”‚  β”‚ OCR β†’ Extraction β†’ Validation β†’    β”‚  β”‚
β”‚  β”‚ Fraud Scoring                      β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                          β”‚
β”‚  SQLite Database (SQLAlchemy ORM)        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

Claimflow/
β”œβ”€β”€ backend/                    # Python FastAPI server
β”‚   β”œβ”€β”€ main.py                 # App entry point, lifespan events
β”‚   β”œβ”€β”€ config.py               # Environment configuration (pydantic-settings)
β”‚   β”œβ”€β”€ database.py             # SQLAlchemy engine & session factory
β”‚   β”œβ”€β”€ models.py               # 10 ORM models (User, Claim, Document, etc.)
β”‚   β”œβ”€β”€ security.py             # JWT auth, password hashing, role guards
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ auth.py             # /auth β€” login, refresh, logout
β”‚   β”‚   └── claims.py           # /claims β€” upload, list, detail, review
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ ocr_service.py      # AWS Bedrock OCR integration
β”‚   β”‚   β”œβ”€β”€ extraction_service.py  # LLM-based structured field extraction
β”‚   β”‚   β”œβ”€β”€ validation_service.py  # Medical rule validation engine
β”‚   β”‚   β”œβ”€β”€ fraud_service.py    # Fraud risk scoring orchestrator
β”‚   β”‚   β”œβ”€β”€ pipeline.py         # Full claim processing pipeline
β”‚   β”‚   └── fraud_rules/        # 7 pluggable fraud rule modules
β”‚   β”œβ”€β”€ repositories/           # Data access layer
β”‚   β”œβ”€β”€ views/                  # Pydantic request/response schemas
β”‚   β”œβ”€β”€ tests/                  # Unit tests
β”‚   └── .env.example            # Environment variable template
β”œβ”€β”€ frontend/                   # React + TypeScript (Vite)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/              # LoginPage, DashboardPage, UploadPage, ClaimDetailPage
β”‚   β”‚   β”œβ”€β”€ components/         # FieldEditor, FileDropzone, ValidationCard, etc.
β”‚   β”‚   β”œβ”€β”€ context/            # AuthContext (React Context for auth state)
β”‚   β”‚   β”œβ”€β”€ api/                # Axios HTTP client
β”‚   β”‚   └── services/           # AI service integration
β”‚   └── package.json
β”œβ”€β”€ .github/
β”‚   β”œβ”€β”€ pull_request_template.md
β”‚   └── CODEOWNERS
β”œβ”€β”€ .gitignore
└── README.md                   ← You are here

πŸš€ Getting Started

Prerequisites

1. Clone the repository

git clone git@github.com:Darsh-8/claimflow.git
cd claimflow

2. Backend Setup

# Navigate to backend
cd backend

# Create and activate virtual environment
python -m venv venv

# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Configure environment variables
cp .env.example .env
# Edit .env with your actual API keys (see Configuration section below)

# Start the API server
uvicorn main:app --reload --port 8000

The API will be available at http://localhost:8000 with interactive docs at http://localhost:8000/docs.

3. Frontend Setup

# From the project root, navigate to frontend
cd frontend

# Install dependencies
npm install

# Start the dev server
npm run dev

The frontend will be available at http://localhost:5173.

4. Default Test Users

The app auto-seeds two users on first run:

Username Password Role
demo_hospital password123 Hospital (upload & correct claims)
demo_insurer password123 Insurer (review & approve/reject)

βš™οΈ Configuration

Create a backend/.env file from the template:

cp backend/.env.example backend/.env
Variable Description Required
DATABASE_URL SQLAlchemy database URL βœ… (defaults to SQLite)
UPLOAD_DIR Directory for uploaded files βœ… (defaults to ./uploads)
KIMI_API_KEY API key for Kimi K2.5 model βœ…
KIMI_API_URL Bedrock endpoint URL βœ…
KIMI_MODEL_NAME Model identifier βœ…
AWS_ACCESS_KEY_ID AWS access key βœ…
AWS_SECRET_ACCESS_KEY AWS secret key βœ…
AWS_REGION AWS region (e.g., us-west-2) βœ…

⚠️ Never commit the .env file. It is excluded in .gitignore.


πŸ”Œ API Endpoints

Authentication (/auth)

Method Endpoint Description
POST /auth/login Login and receive JWT cookies
POST /auth/refresh Refresh access token
POST /auth/logout Clear auth cookies

Claims (/claims)

Method Endpoint Description Role
POST /claims/upload Upload documents and create a claim Hospital
GET /claims/ List all claims (paginated) Any
GET /claims/{id}/status Get claim processing status Any
GET /claims/{id}/data Get full claim data (fields, validation, alerts) Any
POST /claims/{id}/validate Re-run validation pipeline Hospital, Insurer
PUT /claims/{id}/corrections Submit field corrections Hospital
POST /claims/{id}/documents Upload additional documents Hospital
POST /claims/{id}/review Submit approval/rejection decision Insurer

Health

Method Endpoint Description
GET / Service info
GET /health Health check

πŸ”€ Branching Strategy

We follow a Git Flow model:

Branch Purpose
main Production-ready code (protected β€” PRs required with 1 approval)
develop Integration branch for active development (protected β€” PRs required)
feature/* New features β€” branch from develop, merge back to develop
bugfix/* Bug fixes β€” branch from develop, merge back to develop
hotfix/* Critical production fixes β€” branch from main, merge to main + develop
release/* Release stabilization β€” branch from develop, merge to main + develop

Naming examples: feature/frontend-claim-upload, bugfix/ocr-timeout, hotfix/auth-token-fix

See CONTRIBUTING.md for full workflow details.


πŸ§ͺ Running Tests

# Backend unit tests
cd backend
pytest

# Frontend lint
cd frontend
npm run lint

# Frontend build check
npm run build

🀝 Contributing

We welcome contributions! Please read CONTRIBUTING.md for guidelines on:

  • Setting up your development environment
  • Our branching strategy and commit conventions
  • Code style and standards
  • How to submit a pull request

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages