🏥 AI-Powered Medical Billing Platform

Claim Cruncher

A production-ready medical billing intake platform with Claude AI, streaming intelligence, Tesseract OCR, HIPAA-ready architecture, and real-time denial analysis. Built from scratch in 11 days.

🎁  A wedding gift · built by Shane · for Gavin Brazelton · May 2, 2026
~5k
Lines of Code
22
New Files
7
Claude AI Modes
14
DB Migrations
11
Days Built
Claim Cruncher — Cruncher AI · Claim #CLM-2024-0847
Cruncher AI
Claude claude-sonnet-4-6 · Claim #CLM-2024-0847 loaded
● Streaming
G
What CPT codes are billed on this claim? Any potential issues?
🔧 get_claim 🔧 get_claim_lines

This claim bills 99213 (Office visit, est. patient, moderate complexity) and 93000 (ECG with interpretation). A few flags worth noting:

⚠️ Modifier 25 is missing on 99213 — required when billed same-day as a procedure. Payer may bundle and deny the E&M.

⚠️ ICD-10 I10 (HTN) doesn't directly support 93000 — consider adding R00.1 (bradycardia) or Z82.49 (family cardiac history).
G
This claim was denied. Generate an appeal letter.
🔧 flag_claim 🔧 search_similar_claims
Ask about this claim…

A Real Company's Software Stack

This isn't a tutorial project. It's a full production architecture — the same stack that medical billing SaaS companies charge $300/month per seat to run.

🏗️
FastAPI Backend
Async Python API with SQLAlchemy ORM, JWT auth, role-based access control (6 roles), HIPAA audit middleware that logs every request, and soft deletes throughout.
FastAPISQLAlchemyJWTRBACAsync
🤖
Claude AI — 4 Modes
Streaming agentic chat with tool use (Claude calls your DB live). Auto-flag billing errors with Haiku. Denial analysis with dispute likelihood scores. EOB document parsing.
claude-sonnet-4-6Tool UseSSE StreamHIPAA Guard
🔍
Tesseract OCR Pipeline
Upload a PDF or image → Tesseract extracts text at 300 DPI with per-page confidence scoring → structured JSON via Claude → auto-flag billing issues → RAG indexed. All async via arq queue.
Tesseractpdf2imagearqRedis
🧠
pgvector RAG
Every claim is vectorized and stored in PostgreSQL with the pgvector extension. Claude can search semantically similar historical claims to surface patterns and catch repeat denials.
pgvectorEmbeddingsCosine SearchLocal 128-dim
⚛️
React Frontend
TypeScript + Vite + Tailwind. Dashboard, claims list, claim detail with Cruncher AI panel, patients, facilities, tickets, credentials, reports. Full auth flow with token refresh.
ReactTypeScriptViteTailwind
🔒
HIPAA-Ready Architecture
PHI de-identification regex strips SSN, phone, email before every Claude API call. Audit middleware logs every request. Soft deletes preserve data lineage. BAA flag bypasses guard if signed.
PHI GuardAudit LogSoft DeleteBAA Flag

5-Layer Production Stack

Every layer chosen for real-world scale — not just to make it work, but to make it grow.

Frontend
React + Vite
TypeScript, Tailwind, SSE streaming, token refresh interceptor
API
FastAPI
Async Python, 10 routers, RBAC, audit middleware, JWT
AI Layer
Claude API
Tool use agentic loop, 4 system prompts, streaming SSE
Database
PostgreSQL
14 migrations, pgvector extension, ivfflat ANN index
Worker
arq + Redis
Async job queue, Tesseract OCR, cloud fallback hooks

Running in Under 10 Minutes

Full stack — database, API, worker, and frontend — with one terminal each. You need Docker, Node 20, and Python 3.11.

1

Clone and configure

Copy the env template and drop in your Claude API key. Get one free at console.anthropic.com.

bash
# Clone the repo
$git clone https://github.com/thebardchat/Greenfield.git && cd Greenfield
$cp .env.example .env
# Open .env and set these two values:
ANTHROPIC_API_KEY=sk-ant-api03-...
JWT_SECRET=some-long-random-string-here
2

Start infrastructure

Docker Compose spins up PostgreSQL (with pgvector), Redis, and MinIO. Wait ~10 seconds for Postgres to initialize.

bash
$docker-compose up -d postgres redis minio
✔ Container greenfield-postgres-1 Started
✔ Container greenfield-redis-1 Started
✔ Container greenfield-minio-1 Started
3

Run migrations + seed

14 SQL migrations build the full schema including pgvector embeddings table. The seed loads demo orgs, users, and claims.

bash
# Run all migrations
$for f in db/migrations/*.sql; do docker-compose exec -T postgres psql -U claimcruncher -d claimcruncher < "$f"; done
CREATE TABLE ... CREATE INDEX ... (×14)
$python db/seeds/hash_passwords.py && docker-compose exec -T postgres psql -U claimcruncher -d claimcruncher < db/seeds/seed.sql
✓ Demo data seeded — login: admin@claimcruncher.com / Admin1234!
4

Start the API, worker, and frontend

Three terminals. Once all three are running, Claim Cruncher is live.

Terminal 1 — API
$cd apps/api && pip install -e ".[dev]"
$uvicorn app.main:app --reload --port 8000
INFO: Uvicorn running on http://0.0.0.0:8000
Terminal 2 — OCR Worker
$cd apps/worker && pip install -e ".[dev]"
$arq app.main.WorkerSettings
Worker started. Redis: redis://localhost:6380/0
Terminal 3 — Frontend
$cd apps/web && npm install && npm run dev
➜ Local: http://localhost:5173/
5

Verify Cruncher AI is connected

One curl to confirm Claude is wired up and streaming is ready.

bash
$curl -s http://localhost:8000/api/cruncher/health | python -m json.tool
{
  "status": "ok",
  "cruncher_enabled": true,
  "model": "claude-sonnet-4-6",
  "flag_model": "claude-haiku-4-5-20251001",
  "rag_enabled": true
}
✓ Open http://localhost:5173 → log in → click any claim → Cruncher AI

REST Endpoints

Full OpenAPI docs at http://localhost:8000/docs when running locally.

MethodPathDescription
POST/api/auth/loginLogin, returns JWT access + refresh tokens
GET/api/claimsList claims (org-scoped, paginated, filterable)
POST/api/claimsCreate new claim with patient + payer info
GET/api/claims/{id}Get full claim with lines, documents, tickets
POST/api/documents/uploadUpload PDF/image → SHA-256 dedup → OCR queue
GET/api/documents/{id}/ocrGet OCR status, extracted text, structured JSON
POST/api/cruncher/chatStreaming SSE — Claude tool-use agentic chat ✦ AI
POST/api/cruncher/analyze-claim/{id}Auto-flag billing errors with Haiku ✦ AI
POST/api/cruncher/denial-analysis/{id}Denial reason analysis + appeal letter language ✦ AI
POST/api/cruncher/parse-eobParse EOB document text → structured JSON ✦ AI
GET/api/reports/claims-summaryStatus breakdown, collection rate, denial rate
GET/api/reports/denial-trendsTop denial reasons + appeal success rates
GET/api/reports/exportStreaming CSV export with full filtering
GET/api/cruncher/healthCheck Claude connection, models, RAG status

The Stack

🐍
Python 3.11
Backend runtime
FastAPI
Async API framework
⚛️
React + TypeScript
Frontend
🗃️
PostgreSQL
Primary database
🧩
pgvector
Semantic search
🤖
Claude API
AI intelligence
🔎
Tesseract OCR
Document scanning
📮
arq + Redis
Async job queue
🗄️
MinIO
S3-compatible storage
🐋
Docker Compose
Infrastructure
⚗️
Vite + Tailwind
Frontend build
🔐
JWT + RBAC
Auth + permissions
🎁
For Gavin

This is a real business you can launch. Medical billing offices pay $200–500/month per seat for software with a fraction of these features. You have HIPAA-ready architecture, Claude AI baked in, Tesseract OCR, and a complete React frontend — all built and waiting for you.

The only thing missing is your first customer.

Built with love by Shane Brazelton · Hazel Green, Alabama
Wedding gift · May 2, 2026 · "Best thing I've ever built you."

This entire platform was built with Claude AI — Try Claude free →