DiaGuide: Diabetes Risk Prediction App
๐ Introduction
Hi there!
Last week, I built my first fully functional website, implementing AI to predict diabetes risk using historical data. This was my first time publishing a real, working websiteโand I am honestly proud of the result. And I built all this during 48-hour hackathon, working solo.
I used Streamlit for the UI, scikit-learn for the AI training, and a model. Here is how:
๐ก The Idea
When the project topic was first released, I was slightly surprised to see healthcare ๐ โ most of the hackathons I had joined previously allowed more open-ended, general tech solutions. But then I started thinking ๐ค, and this pushed me to research more deeply.
Since I was good at data analysis and developing ML models, I decided to focus on those areas. I spent all of Friday and Saturday morning brainstorming ideas. I actually came up with a couple ๐ง :
-
๐ Medication Tracker App
- An app to keep track of daily medication while allowing users to note how effective each medication is.
- โ Easy to implement
- โ The idea wasn't original enough
- โ I wasnโt sure how to keep track of the data on a web server
- โ I didnโt have enough time to learn and build a mobile app
-
โSymptom-Based Doctor Recommendation
- A questionnaire to determine whether the person needs to go to the doctor.
- โ Useful in real life
- โ Too broad
- โ Hard to implement with all the parameters and questions
- โ Hard to find a reliable database to use
Because of the reasons I mentioned above, I decided to pivot. But I still liked the idea of using a questionnaire to determine something important.
So I shifted gears to something more specific โ a disease or mental health condition. I was very indecisive at first, but then I found a very useful diabetes dataset, and the parameters made sense to me. Thatโs when I committed to building DiaGuide.
โ๏ธ Tools & Stack
๐ Language(s): Python
๐ป Frontend
- ๐จ Tools & Libraries: Streamlit
- โ Why I chose it: I needed a simple library that I could use to create layout and I needed it fast ๐โโ๏ธ๐จ. As someone who doesn't have much experience in frontend design, Streamlit helped me a lot with being beginner-friendly and having a good documentation ๐ and tutorials. It was the perfect tool to create data-heavy app that requires minimal UI design.
- ๐ ๏ธ How I used it: It was basically the cornerstone of my UI. Everythingโfrom layout to interactivityโwas built using ๐ Python. No HTML, no CSS, just clean Python code.
๐ค Machine Learning
- ๐จ Tools & Libraries: scikit-learn
- ๐ Model Type(s): Logistic Regression, Random Forest, Gradient Boosting
- ๐งน Data Cleaning Libraries: Pandas, Numpy
- ๐ช Performance/Evaluation: I created 3 different models and evaluated each one of them by getting their ROC curve. This evaluation checks how successful the model is using the test sample when 1 = exact, 0.5 = same as randomly choosing:
- Logistic Regression: 0.81, very fast โก
- Gradient Boosting: 0.82, okay speed โ
- Random Forest: 0.77, slows down the code significantly ๐ข and slower server response
- ๐ Result: Logistic Regressionโit didn't have much accuracy difference with Gradient Boosting but was significantly faster.
๐ Dataset
- ๐ Source: Kaggle / UCI Machine Learning Repository
- ๐ Link: https://www.kaggle.com/datasets/alexteboul/diabetes-health-indicators-dataset/data
- ๐ข Features Used: BMI, Age, Blood Pressure, etc.
- ๐ค Why this dataset: โ Clean, ๐ท๏ธ labeled, ๐ง interpretable
- ๐ Additional Notes: I didn't use two of the columns in the databaseโeducation level and incomeโbecause I thought they were more personal. Also, I evaluated with and without them and they only increased the accuracy by 1%, which is not significant.
๐ Hosting & Deployment
- ๐ Where I deployed: Streamlit Cloud
- ๐งโ๐ป GitHub Repository: SuleymanSade/DiaGuide
- ๐ Streamlit App: DiaGuide App
- ๐ ๏ธ How I did it: I put all the libraries I used into
requirements.txt
โก๏ธ Configured Git LFS to fit my models (since some of them were bigger than 100MB) โก๏ธ Created a GitHub repo & pushed the code โก๏ธ Set up Streamlit Cloud and it was ready to go - โ Why I used Streamlit Cloud: It was free-to-use and really simple to set up. It also connected to the repository, so if I make a change in the future, the website is going to update too.
Top comments (0)