CanHealth: Next-Generation Expense Intelligence
Inspiration
Corporate expense management is broken. Finance teams spend countless hours manually reviewing thousands of transactions, cross-referencing dense policy PDFs, and hunting for anomalies. Traditional rule-based systems catch obvious violations but fail miserably at detecting sophisticated fraud clusters or nuanced edge cases. We realized that by combining deterministic logic with the reasoning capabilities of modern LLMs, we could build a hybrid intelligence pipeline that acts as an impenetrable shield for corporate finances. Thus, CanHealth was born.
What it does
CanHealth is an AI-powered expense intelligence platform that automates the entire financial compliance and approval pipeline.
- Hybrid Fraud Engine: It evaluates transactions in under 2 seconds by passing them through a two-tiered system: rigid deterministic rules (for speed) and an edge-case reasoning LLM (for nuance).
- Conversational Data (Talk to Data): Using ElevenLabs' Voice AI, users can literally speak to their database. Ask, "What did marketing spend on software last quarter?" and CanHealth dynamically writes the SQL, fetches the data, renders an interactive React chart on the screen, and speaks the insights out loud back to you.
- Dynamic Policy Extraction: Upload a dense PDF expense policy, and our AI extracts the constraints, converting them into structured, enforceable JSON rules that are instantly applied against the ledger.
- Automated Approvals: CanHealth calculates a dynamic Risk Score for every transaction and automatically approves safe transactions while flagging high-risk anomalies for manual review in an elegant, responsive dossier.
How we built it
We architected CanHealth with a modern, high-performance stack:
- Frontend: React, Vite, and TailwindCSS for a sleek, premium, and highly responsive user interface. We utilized Framer Motion for micro-animations and Recharts for dynamic data visualization.
- Backend: Python and FastAPI power our high-throughput intelligence engine.
- AI Integration: We heavily leveraged Gemini for the heavy lifting—using it to parse unstructured PDFs, perform text-to-SQL translation, analyze datasets, and dynamically generate UI configurations for our charts.
- Voice Interface: We integrated the ElevenLabs Conversational AI SDK directly into our frontend, utilizing prompt-injection techniques via client tools to force the voice AI to seamlessly read and explain our backend data summaries in real-time.
The Risk Score Model
To determine whether a transaction should be auto-approved or flagged, we developed a weighted scoring algorithm. The total risk score $R$ for a transaction is modeled as:
$$ R = \min\left(100, \sum_{i=1}^{n} w_i \cdot c_i + \alpha \cdot \mathcal{H}(u) + \beta \cdot \mathcal{F}(x) \right) $$
Where: $$w_i \cdot c_i$$ represents the weighted sum of deterministic policy violations. $$\mathcal{H}(u)$$ is a historical deviation penalty based on the user's past spending behavior. $$\mathcal{F}(x)$$ is the probabilistic fraud confidence outputted by the LLM. $$\alpha$$ and $$\beta$$ are tuning parameters for the strictness of the engine.
Challenges we ran into
Getting the Voice AI to natively explain dynamically generated charts was a massive hurdle. Initially, the ElevenLabs agent would trigger the chart generation but stubbornly tell the user, "Look at the graph on your screen," instead of explaining the data. Since we couldn't easily override its core system prompt, we engineered a clever prompt-injection via tool returns. By appending a critical system instruction directly into the JSON data payload returned to the AI, we forced the LLM context window to prioritize reading the data out loud.
Another major challenge was AI Hallucinations in SQL. Relying on an LLM to generate SQL against a relational database led to occasional syntax errors or column mismatches. We solved this by implementing a Chain-of-Trust architecture—a self-healing loop where if the database rejects the SQL query, the error trace is fed back to Gemini to self-correct and try again.
Accomplishments that we're proud of
- Sub-2-Second Pipeline: We successfully engineered a pipeline that runs a transaction through standard validations, a vector search against policy rules, and an LLM fraud evaluation in under two seconds.
- Zero-UI Data Exploration: We built a genuinely magical "Talk to Data" experience. Being able to verbally ask a complex financial question and instantly receive an interactive chart alongside a spoken explanation feels like talking to a real data analyst.
- Beautiful Aesthetics: We didn't settle for a basic dashboard. The UI looks and feels like a premium, enterprise-grade SaaS product, complete with custom typography, glassmorphism, and polished typography.
What we learned
- LLMs as Orchestrators: We learned that LLMs are not just for chatbots; they are incredible orchestrators. Using Gemini to dynamically generate UI configuration JSON that React can parse and render into a chart completely changed how we think about frontend/backend boundaries.
- Tool Calling Constraints: Working with strict AI agents taught us a lot about the limitations and workarounds of function calling and context-window manipulation.
What's next for CanHealth
Moving forward, we want to expand CanHealth beyond just expense intelligence. We plan to integrate directly with corporate credit card APIs (like Stripe or Ramp) to ingest transactions in true real-time. We also want to implement a multi-agent system where a "Policy Agent" can actually draft and suggest new corporate policies based on the historical fraud trends detected by the "Analysis Agent".
Log in or sign up for Devpost to join the conversation.