MediWallet: Revolutionizing Health Finance in 24 Hours

What Inspired Me

The healthcare system is notoriously complex, and when medical emergencies strike, the last thing anyone should have to worry about is navigating convoluted financing, obscure insurance plans, or language barriers. I noticed that patients often struggle to accurately estimate their out-of-pocket hospital costs and pair them with the right government or private health schemes.

This realization sparked the idea for MediWallet: an AI-powered, multilingual health finance platform designed to bring absolute transparency to healthcare costs. I decided to bring this idea to life during a grueling 24-hour hackathon, aiming to create an end-to-end tool that would confidently guide users from their initial cost estimation all the way to insurance onboarding.

How I Built It

choosing the right stack and working efficiently was critical. I structured the application into several core systems:

  • The Frontend (React & Vercel): I wanted the app to feel trustworthy but incredibly modern. I built a mobile-first UI leaning heavily into a premium dark glassmorphism theme, utilizing deep visual hierarchy and fluid micro-animations.
  • The Backend (FastAPI & GCP): Speed is critical for financial apps. I spun up a robust, asynchronous Python backend using FastAPI to handle our conversational logic, data processing, and integrations.
  • Database & Auth (Firebase): Used for quick, reliable authentication and user data storage.
  • Live Payments (Razorpay): To ensure MediWallet wasn't just a toy, I integrated live payment processing via Razorpay so users could securely "purchase" or opt into health schemes right on the platform.

The AI Engine & Mathematical Core

At the heart of MediWallet is an AI engine built around Gemini (for multilingual conversational abilities and intent extraction).

To match users to the best health schemes, I implemented a similarity-based ranking algorithm. By vectorizing the user's health/financial profile and the scheme's criteria, we calculate the optimal match using cosine similarity. If the user's normalized feature vector is $\mathbf{u}$ and a scheme's vector is $\mathbf{s}_i$, the matching score is:

$$ \text{Score}i = \frac{\mathbf{u} \cdot \mathbf{s}_i}{|\mathbf{u}| |\mathbf{s}_i|} = \frac{\sum{j=1}^{n} u_j s_{j,i}}{\sqrt{\sum_{j=1}^{n} u_j^2} \sqrt{\sum_{j=1}^{n} s_{j,i}^2}} $$

Additionally, the Cost Prediction logic factors in base treatment costs mapped against hospital tiers. Total estimated cost $C_{est}$ is defined as a function of the base cost $C_{base}$, a hospital tier multiplier $\tau$, and a dynamic risk variance $\sigma^2$ generated by our AI agent based on historical outlier data:

$$ C_{est} = \left( C_{base} \times \tau \right) + \mathcal{N}(0, \sigma^2) $$

The Challenges I Faced

When you're building a full-stack, AI-driven application in a day, bugs are your closest companions.

  1. The AI Quota Nightmares: Right in the middle of development, I hit a massive wall: "Current quota exceeded" on the Gemini API. This threatened to break my core chat and parsing features. I had to pivot rapidly, swapping the conversational backend over to Groq. Even then, I ran into model_decommissioned errors (specifically with the llama-3.1-70b-versatile model) and had to dynamically update my configurations to live endpoints on the fly.
  2. Ghost Routes & 404s: Connecting my React frontend to my FastAPI backend resulted in frustrating 404 errors during chat message delivery. I had to carefully trace the data flow between server/main.py and server/agent.py to fix a mismatch in how my chat endpoints were defined and consumed.
  3. Complex State Synchronization: Designing an entire flow—from the user conversing with the AI, predicting a cost, matching a scheme, and finally triggering a Razorpay checkout—required managing complex, asynchronous state across the web app to ensure nothing crashed mid-payment.

What I Learned

This hackathon was a trial by fire. I learned that abstraction is key—by the end of the project, I realized the importance of abstracting AI providers so that swapping out Gemini for Groq could be seamless rather than a stressful rewrite.

I also gained immense confidence in building premium UI/UX under pressure. Achieving a beautiful design aesthetic isn't just about CSS; it's about giving users a feeling of control over their data, which is paramount in FinTech and HealthTech.

MediWallet taught me that with the right architecture, we have the tools right now to solve massively complex, real-world problems like healthcare access, simply by connecting data to conversational AI.

Built With

Share this project:

Updates