Project overview, setup instructions, and architecture summary for the PayBack medical bill analysis and dispute flow.
- frontend/ — React/Vite app: upload bills, view decoded results and flags, build and send dispute emails.
- backend/ — FastAPI app: bill upload, Gemini extraction & analysis, ORIA benchmarks, rules engine, case building, MongoDB persistence.
- Node.js 18+ (for frontend)
- Python 3.11+ (for backend)
- MongoDB (local or Atlas URI)
- Gemini API key (for bill extraction/analysis)
- Optional (backend): Poppler installed on the system for
pdf2image(PDF → images). On Windows you may need to install it (e.g. via conda or poppler-windows); on macOS:brew install poppler. Ifpython-magicfails on Windows, trypip install python-magic-bininstead.
-
Clone and env
- Copy
.env.example→.envin project root. - Copy
frontend/.env.example→frontend/.env. - Fill in
MONGODB_URI,GEMINI_API_KEY; setVITE_API_BASE_URL=http://localhost:8000infrontend/.env.
- Copy
-
Backend
cd backend && pip install -r requirements.txt && uvicorn main:app --reload
- API runs at http://localhost:8000. Check http://localhost:8000/health.
-
Frontend
cd frontend && npm install && npm run dev
- App runs at http://localhost:5173.
-
Docs for teammates
DesignDoc.md(frontend) — UI/UX and design system.Project Structure.md— file layout and responsibilities.
Upload → PDF/image conversion → Gemini extraction → ORIA/hospital matching & rules engine → flagged charges → case builder → dispute letter prompt → email formatter. Bills and cases stored in MongoDB. Users open an email draft or copy to clipboard.
- Backend: FastAPI app runs with CORS and
/health; service modules and routes are stubs — implement inbackend/main.pyandbackend/services/. - Frontend: React app mounts with routes (
/,/results/:billId,/dispute/:caseId); pages and components are stubs — implement perfrontend/DesignDoc.md. - API client:
frontend/src/api/client.js—uploadBill,getAnalysisResult,getPrecedents,searchPrecedents, etc. usingVITE_API_BASE_URL.