Note
This project was created for a college student during freelance work. It is not intended for commercial use or production environments, and is maintained solely for educational and portfolio demonstration purposes.
An intelligent web platform that leverages machine learning to recommend Ayurvedic remedies and pharmaceutical medicines based on user queries. Users can enter natural language descriptions of their symptoms to predict the underlying disease and get recommended Ayurvedic remedies, dosage instructions, and recovery times. Alternatively, users can search for specific diseases to get pharmaceutical drug recommendations.
- AI-Powered Symptom Analysis: Input natural language symptoms to classify the underlying disease using a Support Vector Machine (SVM) classifier.
- Dual Treatment Paradigm: Offers both traditional Ayurvedic home remedies and modern pharmaceutical drug prescriptions.
- Intelligent Query Matching: Fuzzy-string matching to map user queries to known medical conditions.
- Secure Session-Based User Registration & Login: Simple authentication for personalized greeting and dashboard access.
The project follows the standard Model-View-Template (MVT) architecture pattern of Django:
- Machine Learning Backend: Integrated SVM classifier (
predict.py) trained on a symptoms-to-disease corpus with TF-IDF vectorization. - Fuzzy Matching Logic: Built-in similarity metrics to translate imprecise user search terms into clean dataset lookups.
- Database Layer: SQLite database containing user records.
PharmaRecommendation/
├── PharmaReccomenddation/ # Django project configuration settings & URLs
│ ├── settings.py
│ └── urls.py
├── main/ # Main Django web application logic
│ ├── templates/ # HTML frontend templates
│ ├── predict.py # ML classifier & Text cleaning logic
│ ├── views.py # Dashboard & API endpoint views
│ └── models.py # User details schema
├── dataset/ # Reference CSV files for disease recommendations
│ ├── Disease2Symptoms.csv
│ ├── Disease2ayurvedic.csv
│ ├── Disease2medicine.csv
│ └── Symptom2Disease.csv
├── models/ # Saved ML model checkpoint folder
├── requirements.txt # Python dependencies
└── manage.py # Django CLI entry point
- Backend: Django, Python
- Machine Learning & NLP: Scikit-Learn, Pandas, NLTK
- Database: SQLite3
- Frontend: HTML, CSS, JavaScript (Vanilla, Montserrat & Open Sans web typography)
- Python 3.8+
- Pip (Python package manager)
-
Clone the Repository:
git clone https://github.com/harshidkoladara/PharmaRecommendation.git cd PharmaRecommendation -
Create a Virtual Environment:
python -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Configure Environment Variables: Create a
.envfile in the root directory and copy the contents from.env.example:cp .env.example .env
-
Apply Database Migrations:
python manage.py makemigrations python manage.py migrate
-
Run the Development Server:
python manage.py runserver
Open your browser and navigate to
http://127.0.0.1:8000/.
- Create a new user profile using the signup screen (
/regi/). - Log in with your email address to access the dashboard.
- Navigate to the Classification tab.
- Enter a sentence describing how you feel (e.g., I have high fever, chills, and muscle aches).
- Click Predict to view the classified disease and its corresponding Ayurvedic treatment.
- Navigate to the Classification tab.
- In the second input area, enter a disease name (e.g., Malaria or Typhoid).
- Click Predict to query suggested pharmaceutical drug treatments.
- NLTK Data Lookup Errors: The application automatically checks and downloads required NLTK resources (
punktandstopwords) at runtime. If network restrictions prevent this, download them manually via terminal:import nltk nltk.download('punkt') nltk.download('stopwords')
- Database Lock / Constraint Issues: Run
python manage.py migrateto ensure the sqlite schema matches the updated model structures.
