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.
| 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 |
βββββββββββββββββββββββββββββββββββββββββββ
β 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) β
ββββββββββββββββββββββββββββββββββββββββββββ
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
git clone git@github.com:Darsh-8/claimflow.git
cd claimflow# 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 8000The API will be available at http://localhost:8000 with interactive docs at http://localhost:8000/docs.
# From the project root, navigate to frontend
cd frontend
# Install dependencies
npm install
# Start the dev server
npm run devThe frontend will be available at http://localhost:5173.
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) |
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.envfile. It is excluded in.gitignore.
| Method | Endpoint | Description |
|---|---|---|
POST |
/auth/login |
Login and receive JWT cookies |
POST |
/auth/refresh |
Refresh access token |
POST |
/auth/logout |
Clear auth cookies |
| 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 |
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Service info |
GET |
/health |
Health check |
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.
# Backend unit tests
cd backend
pytest
# Frontend lint
cd frontend
npm run lint
# Frontend build check
npm run buildWe 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
This project is licensed under the MIT License β see the LICENSE file for details.