تفاصيل العمل

Medical AI Disease Prediction System

What the project does:

This is a web-based clinical decision support tool that predicts the likelihood of 3 diseases — diabetes, heart disease, and chronic kidney disease — using machine learning models trained on real medical datasets. The user enters patient lab values and vitals, and the system instantly returns a prediction, a probability score, a risk level (low / medium / high), and personalized medical recommendations — all in Arabic.

How it was built — step by step:

**1. Machine Learning Models**

Three separate models were trained using scikit-learn, one per disease. The diabetes model required custom feature engineering: the 8 raw inputs (glucose, BMI, insulin, etc.) were transformed into 18 features by categorizing each value into clinically meaningful ranges — for example, BMI was split into underweight / overweight / obesity classes 1–3. All three models were serialized with joblib so they could be loaded and reused outside the notebook.

2. Streamlit Prototype

The first working interface was built in Streamlit. It handled user input, ran the predictions, generated matplotlib charts, and produced downloadable PDF reports per patient. It also included a rule-based recommendation engine that checked individual biomarker thresholds and assigned a risk score based on how many values fell outside normal ranges.

3. FastAPI Backend

To make the models accessible to any frontend or mobile app, a REST API was built with FastAPI. Each disease has its own POST endpoint (`/predict/diabetes`, `/predict/heart`, `/predict/kidney`). The API uses Pydantic models for automatic input validation, runs the same feature engineering logic as the notebook, calls `predict_proba` to return a confidence percentage rather than just a binary result, classifies the output into a risk level, and returns a full structured Arabic report in the JSON response. CORS was enabled so any frontend on any domain can call the API freely.

4. Deployment on Render

The FastAPI app was pushed to GitHub and connected to Render as a web service. Render auto-detected the Python environment, installed dependencies from `requirements.txt`, and served the API on a stable public URL. The interactive docs are live at `/docs` via FastAPI's built-in Swagger UI.

5. Frontend

Three HTML pages were built with Tailwind CSS — one per disease, each with its own color theme (gold for diabetes, red for heart, green for kidney). Each page collects patient inputs, sends a POST request to the Render API using the Fetch API, and dynamically renders the result card with the confidence score, risk badge, and full Arabic report — all without any page reload.

بطاقة العمل

اسم المستقل
عدد الإعجابات
0
عدد المشاهدات
1
تاريخ الإضافة
تاريخ الإنجاز
المهارات