Skip to content

DrugPredictor πŸ’Š is an AI-powered web app built with Django + Machine Learning. It predicts suitable drugs based on a patient's health details like age, sex, BP, cholesterol, and Na/K ratio. Fast, smart, and easy to use! πŸš€

License

Notifications You must be signed in to change notification settings

ShrishMaruge/drug-prediction-django

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’Š Drug Prediction using Machine Learning (Django)

A Django-based web application that predicts the most suitable drug for a patient based on their medical information. Powered by a trained machine learning model, this app demonstrates the real-world application of AI in healthcare.


πŸ“Έ Interface Preview Demo of prediction form: Screenshot 2025-06-12 215311


πŸš€ Features

  • 🧾 Patient Data Form: User-friendly form to collect:
    • Age
    • Gender (Sex)
    • Blood Pressure
    • Cholesterol
    • Sodium-to-Potassium Ratio (Na_to_K)
  • πŸ€– ML Drug Prediction: Predicts the most effective drug using a pre-trained ML model.
  • πŸ” Admin Panel: Manage entries and oversee patient predictions with Django’s built-in admin interface.
  • πŸ“ˆ Model Integration: Seamlessly integrates a trained scikit-learn model into the Django backend.
  • 🎯 Accurate Predictions: Based on well-curated training data and effective preprocessing.

🧠 Machine Learning Model

  • Algorithm Used: (e.g., Decision Tree Classifier / Random Forest / Logistic Regression)
  • Training Data: [Include dataset source or summary if applicable]
  • Target Classes: Drug A, Drug B, Drug C, Drug X, Drug Y (example)
  • Input Features:
    • Age (Integer)
    • Sex (Male/Female)
    • Blood Pressure (Low/Normal/High)
    • Cholesterol (Normal/High)
    • Na_to_K (Float – Sodium-to-Potassium Ratio)

πŸ–₯️ Tech Stack

  • Backend: Django (Python)
  • Machine Learning: scikit-learn, pandas, joblib
  • Frontend: HTML5, CSS3, Bootstrap (Optional)
  • Database: SQLite3 (default Django DB)
  • Model Deployment: Integrated with Django views

βš™οΈ Setup Instructions

1. Clone the Repository

git clone https://github.com/your-username/drug-prediction-django.git
cd drug-prediction-django

2. Install Dependencies

pip install -r requirements.txt

3. Apply Migrations

python manage.py migrate

4. Run the Development Server

python manage.py runserver

5. Access the App

Open your browser and go to:

http://127.0.0.1:8000/

πŸ§ͺ Model Training (Optional for Developers)

If you want to retrain or improve the model:

# train_model.py
# Uses scikit-learn to train a model and saves it as 'model.pkl' using joblib

πŸ“Έ Screenshots

Add screenshots of your:

  • 🧾 Patient input form
  • πŸ“ˆ Prediction result page
  • πŸ” Admin panel view

πŸ“ Project Structure

drug-prediction/
β”œβ”€β”€ core/                 # Django app
β”‚   β”œβ”€β”€ models.py         # Patient model
β”‚   β”œβ”€β”€ views.py          # Prediction logic
β”‚   β”œβ”€β”€ forms.py          # Input form
β”‚   └── templates/        # HTML templates
β”œβ”€β”€ static/               # CSS/JS assets
β”œβ”€β”€ model/                # Trained ML model (model.pkl)
β”œβ”€β”€ train_model.py        # (Optional) Script to train and save model
β”œβ”€β”€ db.sqlite3
β”œβ”€β”€ manage.py
└── requirements.txt

βœ… Example Input & Output

Input Field Sample Value
Age 35
Gender Male
Blood Pressure High
Cholesterol High
Na_to_K 14.2

Predicted Drug: DrugX


πŸ” Admin Credentials

To access the admin panel:

python manage.py createsuperuser

Then visit:

http://127.0.0.1:8000/admin

πŸ“œ License

MIT License. Feel free to use, modify, and distribute this project.


πŸ™Œ Acknowledgements

  • scikit-learn
  • Django
  • UCI Drug Dataset (if applicable)
  • Bootstrap (for styling)

About

DrugPredictor πŸ’Š is an AI-powered web app built with Django + Machine Learning. It predicts suitable drugs based on a patient's health details like age, sex, BP, cholesterol, and Na/K ratio. Fast, smart, and easy to use! πŸš€

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published