Inspiration
Congestive heart failure (CHF) is one of the leading causes of death in the United States, and affects individuals of many age groups. Given that present treatments have not been sufficient to reduce CHF rates, we have built a user-centered solution to educate users about CHF, and provide personalized support.
What it does
Heartwise is an innovative machine learning platform designed to predict the likelihood of congestive heart failure (CHF) within the next 10 years, with an impressive 85% accuracy. By integrating a comprehensive survey with real-world health data, Heartwise analyzes key factors influencing heart health. Built using React, Python Flask, and scikit-learn, the platform not only provides a personalized risk assessment but also offers recommendations for lifestyle improvements. These actionable insights empower users to make informed decisions that can help reduce their risk of CHF and promote long-term cardiovascular health.
How we built it
- Frontend:
We developed the frontend using React to create a highly interactive, component-based user interface. React enabled us to efficiently capture user input and display real-time health metrics in a dynamic and user-friendly manner. We incorporated Three.js to handle 3D visualizations, allowing us to render interactive GLB models directly in the browser. These models represented patient data in a visual format, offering users a more engaging way to interact with health metrics. The animated GLB files enhanced the user experience by simulating changes in health data over time.
- Backend:
For the backend, we used Flask to manage API requests and handle the logic for our machine learning predictions. Flask provided a lightweight, easy-to-use framework that allowed us to quickly build out our API and ensure smooth communication with the frontend. Our machine learning model was implemented using a Random Forest classifier from scikit-learn. We trained this model on a dataset related to CHF patients, and it achieved an 85% accuracy rate in predicting the likelihood of CHF development based on various health metrics. We serialized the model using pickle and deployed it via the Flask API, allowing the frontend to access and display prediction results in real time.
- Machine Learning Integration:
The Random Forest classifier was trained on patient health data such as heart rate, blood pressure, and other relevant metrics. We chose this model because of its ability to handle complex, non-linear relationships in the data, which is crucial for accurate predictions in medical scenarios. After training the model, we evaluated its performance, achieving an 85% accuracy rate. The trained model was integrated into the backend, allowing for real-time predictions. Users could input their health data, and the backend would return a CHF risk prediction, which was then displayed on the frontend.
- 3D Visualization and Animation:
Using Three.js, we integrated GLB models into our web application, allowing users to visualize their health data in a 3D format. These models were fully interactive, enabling users to explore different aspects of the data by rotating and zooming in on the visualizations. We also incorporated animations into the GLB files to dynamically represent changes in health conditions over time.
- Deployment and Infrastructure:
We deployed the frontend and backend components on separate servers, ensuring smooth interaction between the two. We managed cross-origin resource sharing (CORS) issues to enable seamless communication between the React frontend and Flask backend, ensuring that user requests and data were processed efficiently.
Challenges we ran into
Our largest Bug ~ 3 hours to fix
During the development phase of our project, we encountered a challenge with Cross-Origin Resource Sharing (CORS). The issue arose when our frontend, hosted separately from the backend, was blocked from making API calls due to misconfigured CORS headers. The issue wasn't necessarily CORS, we had the right headers and all. However, we ended up going through a plethora of different solutions till the right one fit, we weren't going to go with No-Cors, and we even tried using a proxy to work around the issue.
What made this particularly challenging was the fraudulent nature of the error messages. Despite setting the correct headers on our API, the browser would block the requests. We discovered that this could be caused by inconsistent behavior between local development environments and production servers, browser caching, or misconfigured preflight requests.
In the end, our teammate Justin miraculously exclaimed " I GOT IT!" and the rest was history.
Accomplishments that we're proud of
We were able to work collaboratively to ensure we made a high quality application that addressed our goals. One of our team members worked online, so we did a good job on making sure he was involved just as much as the rest of the team members.
Everyone had an equal voice in this project, a democracy of sorts where any idea could shine.
What we learned
On the backend, we implemented Flask to manage API requests. Flask's speed and simplicity in handling HTTP methods enabled us to create a robust REST API that connects our frontend to our machine learning models. We had previous experience building REST API via Drogon in C++, Python was a learning curve as we are performance-heavy programmers without much "pythonic" coding experience.
One of the major highlights of our project was learning to integrate a machine learning model for CHF prediction. Using scikit-learn and a random forest classification we trained a predictive model and implemented it in the backend. This model analyzed patient health data, providing risk scores for CHF development. The model was integrated into our backend API, allowing the frontend to request predictions dynamically.
As part of our project, we had the opportunity to dive into Three.js, a powerful JavaScript library used for creating 3D graphics in a web browser. Learning Three.js allowed us to enhance the visual experience of our application by incorporating interactive 3D models, which played a significant role in making the user interface more engaging and informative.
What's next for HeartWise
We believe that the future of healthcare lies in ideas like HeartWise. Open access to reliable and highly accurate diagnosis is important for lower-income families who don't have the insurance to regularly see a physician.
Log in or sign up for Devpost to join the conversation.