Intelligent Invoice Reimbursement
Scores invoices against HR policy in parallel processes, then answers questions over the verdicts with metadata filters.

What it is
What it does
Upload an HR policy and a ZIP of employee invoices; every invoice comes back classified Fully Reimbursed, Partially Reimbursed or Declined with a written justification. Both the raw text and the verdict land in ChromaDB, so a follow-up chatbot can answer audit questions like 'which of Amit's invoices were declined in March?' in plain language.
Why it exists
My first reimbursement audit was a zip of 30 PDFs and a policy doc no one had read. I built this so a zip goes in and a clear 'reimbursed / partial / declined + why' comes out, and the whole trail stays searchable afterwards. No spreadsheet archaeology.
Repo Amit-kr26/Intelligent-Invoice-ReimbursementDemo intelligent-invoice-reimbursement.onrender.com/Stack FastAPI · LangChain · Gemini 2.5 Flash · ChromaDB
Hosted on a free tier, so the demo may take about 60s to wake on first load.
How it is built
Batch ZIP intake
POST /analyze-invoices/ validates the policy (.pdf/.docx) and invoice ZIP extensions, extracts to data/<employee>/ and walks it recursively for PDFs.
Process-per-invoice
A ProcessPoolExecutor fans out one analyze_single_invoice future per file; each subprocess re-instantiates its own Gemini client and Chroma handle to stay multiprocessing-safe.
Strict three-key verdicts
An LLMChain over gemini-2.5-flash must emit reimbursement_status (enum), reason and invoice_date. Fenced-JSON regex parsing degrades gracefully to a raw-output record when the model misbehaves.
Double-sided indexing
Each invoice produces two Chroma documents (invoice_text and analysis_result) under deterministic IDs with employee, status, reason, date, filename and type metadata.
Filtered RAG chatbot
A LCEL chain ({context: retriever | format_docs} | prompt | llm) backs POST /chatbot/, supporting exact-match metadata filters on employee_name, reimbursement_status and invoice_date.
Thoughtful little UI
Vanilla HTML/JS with marked-rendered bot replies, a regex-tokenised JSON syntax highlighter, toast notifications and persisted dark/light themes.
How the pieces connect
Drawing is wider than the frame. Drag to pan.
Also filed under LLM / RAG