Diabetic Retinopathy Predictor System is Django-based web application designed to assist users in predicting the likelihood of developing diabetes-related complications, specifically the presence of diabetic retinopathy (damage to the eyes due to diabetes). The project utilizes machine learning techniques to make predictions based on user-provided health and lifestyle information. Here's an overview of the project:
- Data Source:
- The project collects diabetes-related data from the CDC NHANES website. This data serves as the basis for training the machine learning model.
- Project Structure:
- The project is organized into three main folders and two files:
- 'dataset_and_machine_learning_files': Contains the dataset ('data.csv') and machine learning code ('Diabetes_affected_eyes_had_retinopathy.ipynb').
- 'healthFitness' (Main App): Contains the Django application's settings, URLs, and other configurations.
- 'myApp' (Another App): Contains models, views, URLs, and other components for handling user interactions and predictions.
- 'db.sqlite3': The SQLite database used by the Django application.
- 'manage.py': Django management script.
- The project is organized into three main folders and two files:
- Machine Learning Model:
- The heart of the system is a machine learning model for diabetes prediction. The model is trained using the provided dataset and is loaded into the Django application using joblib.
- User Interface:
- The web interface is designed using HTML templates extended from a base template ('base.html') that includes Bootstrap for styling.
- The main user interface ('index.html') offers a form where users can input various health and lifestyle-related parameters.
- Prediction Process:
- Users provide information such as alcohol consumption, smoking habits, BMI, sleep patterns, and more via the form.
- When the user submits the form, the data is sent to the Django backend for processing.
- The input data is converted into a feature vector and passed to the machine learning model.
- The model makes predictions about whether the user is likely to have diabetic retinopathy based on the provided information.
- The prediction result is displayed on the web page.
- Result Presentation:
- The prediction result is presented as a message indicating whether the user is predicted to be at risk for diabetic retinopathy.
- Project Workflow:
- The user accesses the application's home page, where they find a form for inputting health-related data.
- After submitting the form, the user receives an instant prediction regarding diabetic retinopathy risk.
- Technology Stack:
- Django: A Python web framework for building web applications.
- Joblib: Used to load the pre-trained machine learning model.
- HTML/CSS: For creating the user interface.
- Bootstrap: For styling the web pages.
- Use Case:
- This project can be valuable for individuals interested in assessing their risk of developing diabetic retinopathy based on their health and lifestyle choices. It can serve as an early warning system, encouraging users to adopt healthier habits and consult healthcare professionals if necessary.
The Diabetic Retinopathy Predictor System with Django offers a user-friendly platform for individuals to gain insights into their diabetes-related health risks and make informed decisions about their well-being. It showcases the integration of machine learning into a web application for predictive healthcare analysis.
Here are step-by-step instructions on how to run this Django-based Diabetic Retinopathy Predictor System in a user-friendly way:
- Download the Project from GitHub and Unzip: Look for a "Code" button on this GitHub page. Click on it and select "Download ZIP" to download the project as a ZIP archive. And then locate the downloaded ZIP file on your computer (usually in your "Downloads" folder). After that right-click the ZIP file and select "Extract" or "Extract All" (the exact option may vary depending on your operating system). Then choose a destination folder where you want to extract the project files.
- Navigate to Project Directory: Open the command prompt or terminal in this project root directory directly. Or open the command prompt or terminal on your computer and then use the 'cd' command to navigate to the root directory of this Django project. For example:
- cd path/to/this/project
- Create a Virtual Environment: Create a virtual environment to isolate this project dependencies. This helps manage package versions.
- python -m venv myenv
- Activate the Virtual Environment: Activate the virtual environment you just created. This ensures that the project uses the isolated environment.
- myenv\Scripts\activate (Windows)
- source myenv/bin/activate (macOS/Linux)
- Upgrade Pip: Upgrade the 'pip' tool to the latest version to ensure you have the most recent package manager.
- python.exe -m pip install --upgrade pip
- Install Django and Required Packages: Install Django and the necessary Python packages for this project.
- pip install django
- pip install numpy
- pip install pandas
- pip install joblib
- pip install scikit-learn==1.2.2
- Database Setup: Run the following commands to set up the database for this Django project:
- python manage.py makemigrations
- python manage.py migrate
- Run the Development Server: Start the Django development server to run this project locally:
- python manage.py runserver
- Access This Project: After launching the server, simply open your web browser and navigate to 'http://localhost:8000/'. This will take you to the home page of our Diabetes Risk Predictor.
- Interact with the Prediction System: On the home page, you can enter your health and lifestyle information, and upon clicking the "Predict" button, you'll receive an instant assessment of your risk for diabetic retinopathy based on the provided data.