Inspiration
We chose to approach this project with a perspective on addressing the issue of accessibility in healthcare. With a passion for bioengineering and machine learning, Moukthika is interested in how biotechnology and predictive analytics can improve health personalization and overall patient outcomes. Madison brings a complementary background shaped by her industry experience in healthcare cybersecurity and data analysis.
While brainstorming for a project idea at HackIllinois, we came to a consensus on a troubling pattern that must be dismantled: innovation in medicine often prioritizes clinical advancement while overlooking accessibility and financial transparency. We reached common ground between our experiences that breakthroughs in medicine mean little if patients cannot afford care or understand their medical costs.
Together, we became excited to address one core issue: healthcare is an essential human need and should not be ``censored'' by complexity, hidden pricing, or institutional barriers. Through MediPay, we wanted to use HackIllinois to jumpstart a product that serves as a solution for those burdened by their medical financial obligations.
What it does
We created MediPay to address a real-world crisis: medical debt, which affects more than half of the American population. From simple doctor visits to complex surgical procedures, medical treatments have become more expensive than ever. Patients, especially those who lack proper insurance, often struggle to keep track of their medical expenses from appointments piling up. Through this project, we hope to mitigate this process in helping patients find the best way to keep track and pay off their medical bills to prevent further worry and financial concern over medical debt.
How we built it
To start this process, we took to the whiteboard to map out the structure and user flow of our website from a UI/UX perspective. We also learned that accessibility is not purely a policy issue; it is a systems design issue. Rather than immediately jumping into code, we prioritized understanding the patient journey. We sketched wireframes of our home dashboard, debt entry forms, and payment tracking pages, asking ourselves what information users would need first and how to reduce cognitive overload.
We identified key design principles: clarity, minimalism, and transparency that puts the patient first. We did this by designing each page to surface essential financial information without overwhelming the user.
We then translated our whiteboard sketches into low-fidelity wireframes and iterated on layout decisions such as navigation hierarchy, button placement, and data visualization structure. We intentionally avoided dense medical terminology and prioritized intuitive labeling. For example, instead of using complex billing language, we structured the interface around simple categories like Total Owed, Upcoming Payments, and Down Payment. This supports our belief that systems should be intuitive, so they redistribute power back to the user.
On the technical side, we built the project in layers. First, we designed a normalized relational database schema to model users, medical debts, and payments with an ER model. We carefully defined foreign key relationships to maintain data integrity and allow future extensibility.
We then developed a RESTful backend using FastAPI, implementing endpoints to create users, log debt entries, retrieve balances, and record payments. We incorporated dependency injection for database sessions and structured our project into modular files from models, schemas, database configuration, and main application logic to maintain scalability and clean architecture.
We also ensured that validation and data consistency were handled through Pydantic schemas, preventing malformed requests from corrupting the database. Error handling was deliberately implemented to provide clear feedback rather than vague failure messages. As we iterated, we continuously tested endpoints, refined data models, and adjusted our UI structure to align with backend logic.
The financial decision engine powering MediPay's recommendations is built on the following formulas:
The financial decision engine powering MediPay's recommendations is built on the following formulas.
Simple Interest: Every debt entry in the database is computed using simple interest: \begin{equation} T = P + I = P(1 + rt) \end{equation} where (T) is the total amount owed, (P) is the principal, (r) is the annual interest rate, and (t) is time in years.
Risk Score: MediPay computes a risk score ([0,1]) using a logistic sigmoid model weighted by the patient's debt-to-income ratio, days past due, and insurance coverage fraction: \begin{equation} \rho = \sigma!\left(\alpha_0 + \alpha_1\,\frac{T}{I_{\text{monthly}}} + \alpha_2\,\frac{D}{D_{\max}} + \alpha_3\,(1 - S)\right), \qquad \sigma(x) = \frac{1}{1+e^{-x}} \end{equation} A score of rho greater than or equal to 0.6 triggers a high-risk alert on the dashboard.
Strategy Recommendation: MediPay evaluates all three payment strategies and recommends the one minimizing expected total cost: \begin{equation} \hat{s} = \arg\min_{s\,\in\,{\text{Lump},\,\text{Install},\,\text{CC}}} \mathbb{E}[C_s], \qquad \mathbb{E}[C_s] = C_s^{\text{base}} + \rho \cdot \pi_s \end{equation} where pi_s is the penalty exposure for strategy (s), scaled by the default risk.
Lump Sum: Paying the full balance immediately incurs no future interest or penalty exposure: \begin{equation} C_{\text{Lump}} = T = P(1 + rt), \qquad \mathbb{E}[C_{\text{Lump}}] = T \end{equation}
Installment Plan: For patients paying over (n) months at monthly rate (r_m = r/12), the fixed monthly payment and total cost are: \begin{equation} M = P\,\frac{r_m(1+r_m)^{n}}{(1+r_m)^{n}-1}, \qquad C_{\text{Install}} = Mn, \qquad I_{\text{Install}} = Mn - P \end{equation}
Credit Card Payoff: For a balance charged at credit card APR with fixed monthly payment, the months to payoff, total cost, total interest, and remaining balance after k payments are: \begin{align} n_{\text{cc}} &= \left\lceil -\frac{\ln!\left(1 - \dfrac{B_0\,r_m^{\text{cc}}}{P_{\text{cc}}}\right)}{\ln(1 + r_m^{\text{cc}})} \right\rceil \ C_{\text{CC}} &= P_{\text{cc}} \cdot n_{\text{cc}}, \qquad I_{\text{CC}} = P_{\text{cc}}\,n_{\text{cc}} - B_0 \ B_k &= B_0\,(1+r_m^{\text{cc}})^k - P_{\text{cc}}\,\frac{(1+r_m^{\text{cc}})^k - 1}{r_m^{\text{cc}}} \end{align} The recurrence (B_k) is wired directly to the Payment table updates, keeping the dashboard balance live after each recorded payment.
Challenges we ran into
On the backend, database modeling proved more challenging than expected. At first, our schema did not properly account for how payments dynamically affect outstanding balances. We had to redesign relationships between the User, MedicalDebt, and Payment tables to ensure data integrity. Misconfigured foreign keys and incorrect relationship mappings in SQLAlchemy led to frustrating runtime errors. Debugging these issues required carefully tracing how objects were being committed to the database and understanding how back-populated relationships functioned.
A significant challenge we faced was maintaining alignment between our frontend design and backend architecture. At times, our UI wireframes assumed certain data structures that did not yet exist in the backend. This forced us to refactor API responses and restructure Pydantic schemas so that the data returned from the server matched what the interface needed. These mismatches highlighted how tightly coupled user experience and data modeling truly are.
Accomplishments that we're proud of
We were able to develop a mathematical debt predictor that determines the financial risk levels of a patient based on their medical debt customized to their patient history. We allowed for itemization of their medical bills through MediPay. This is a great starting point to allow for integration of personal banking accounts with MediPay that permits one-tap payments.
What we learned
We gained hands-on experience with all the aforementioned technical concepts that required us to iterate multiple rounds. We went out of our ways to receive feedback and help from the Help Desk, while understanding the value of refining our skills with many UX and technical components. We learned to prioritize features and manage scope to ensure a functional prototype was completed with a time crunch. Most importantly, this HackIllinois opportunity allowed us to realize how we can combine our personal interests can be combined in healthcare and ML to address a problem. The world's economy only broadens the growing issue of medical bills that remains to be unanswered, so we hope to bring clarity to those who need it the most.
What's next for MediPay
MedLedger began as a hackathon project, but we see it as the start of something much larger. Our next steps would focus on scaling this from a backend prototype into a fully deployable and intelligent platform with agentic abilities to help users.
We would aim to implement authentication and encryption layers to ensure secure user data storage by incorporating best practices from cybersecurity such as token-based authentication and encrypted database fields. By strengthening our security infrastructure, our priority would be to provide a serviceable system that leaves users with confidence.
Beyond security, we plan to containerize the application using Docker and deploy it through a cloud provider to ensure scalability. We also hope to bring this service to mobile devices, such as phones and tablets, to allow for convenience usage along with multilingual interface support.
The API can also forecast potential debt accumulation based on historical payment trends while providing personalized repayment simulations based on user income patterns. Our goal is to expand this interface beyond passive monitoring, so that it becomes a proactive tool that empowers users to strategically plan, and ultimately leave their medical debt behind.
Embedding MediPay into patient portals could fundamentally shift how individuals engage with medical costs. So, in the long term, we aspire to collaborate with healthcare providers and nonprofit organizations that align with this goal of making medical debt an accessible problem to solve.
Built With
- html/css
- javascript
- postgresql/sqlite
- python
- react
- stripe
Log in or sign up for Devpost to join the conversation.