ArogyaAI is a comprehensive Clinical Decision Support System (CDSS) that bridges the gap between traditional Ayurvedic medicine and modern Artificial Intelligence. It provides both accurate disease diagnosis and personalized Ayurvedic treatment recommendations.
By utilizing a Dual-Engine AI Architecture (Deterministic Machine Learning + Generative AI) and strict Role-Based Access Control (RBAC), ArogyaAI provides a secure, end-to-end ecosystem for both patients and medical practitioners. The system can be run completely offline via command-line interface (CLI) or as a fully deployed cloud web platform.
Arogya-AI.mp4
Traditional Ayurvedic diagnostics rely heavily on practitioner intuition, while modern medical AI models act as "black boxes" that ignore holistic factors like Doshas (Prakriti) and seasonality. Exposing raw, low-confidence ML predictions directly to patients poses a severe psychological risk.
ArogyaAI solves this by:
- Combining mathematical Random Forest predictions (99%+ accuracy) with Generative LLM contextual reasoning.
- Utilizing Explainable AI (XAI) so doctors can see why the AI made its decision.
- Implementing strict Clinical Safety Guardrails that mask low-confidence predictions to prevent patient panic.
graph TD
subgraph "Frontend / Client Edge"
UI_P[Patient Dashboard] -->|Log Symptoms| React[React / Vite Frontend]
UI_D[Doctor Dashboard] -->|Review Patient| React
end
subgraph "Backend / ML Engine"
API[FastAPI Gateway / CLI]
ML[Scikit-learn RF Model]
Gemini[Google Gemini 2.5]
end
React <-->|REST API| API
API -->|TF-IDF + Vectorization| ML
ML -->|Diagnosis Prediction| API
API -->|Condition Routing| Router{Confidence > 35%?}
Router -- Yes --> Gemini
Router -- No --> Fail[Return 'Inconclusive Data']
Gemini -->|Ayurvedic Treatment| API
API -->|Deliver Hybrid Payload| React
- High-Accuracy ML Model: Over 99% accuracy using a Random Forest Classifier trained on 819 features (12 basic + 807 TF-IDF symptom NLP tokens).
- SMOTE Class Balancing: Up-sampled dataset from 4,201 to 20,748 samples for robust predictions across 399 potential diseases.
- LLM Contextual Validation: Evaluates symptoms against season, weather, and dosha using Gemini 2.5 Pro.
- Comprehensive Dosha Selection: Detailed assessment supporting Vata, Pitta, Kapha, and mixed body constitutions.
- Granular Treatment Plans: Provides Sanskrit and English herb names, precise dietary recommendations, and Ayurvedic therapies (Abhyanga, Nasya, Panchakarma).
- Role-Based Portals: Secure Practitioner and Patient views with Clinic ID siloing.
- Safety Guardrails: Masks raw Western disease labels for patients, preferring comforting actionable lifestyle advice while keeping clinical diagnostics for the doctor.
You can run ArogyaAI in two distinct modes: Web Mode (for full UI/UX) or CLI Mode (offline, terminal testing).
git clone https://github.com/gaur-avvv/Arogya-AI.git
cd Arogya-AI
pip install -r requirements.txt(Optional) Train the model if the random_forest_model.pkl is missing:
python train_model.pyRun the modern React + FastAPI ecosystem.
Start the Backend (FastAPI):
uvicorn backend.index:app --reload
# Runs on http://127.0.0.1:8000Start the Frontend (React): Open a new terminal:
cd frontend
npm install
npm run dev
# Runs on http://localhost:5173For developers or offline scenarios wanting to talk directly to the model.
python arogya_predict.pyFollow the interactive prompts to enter symptoms (e.g., "joint pain, morning stiffness"), age, dosha, etc., and get a brilliant console printout of your predicted disease and Ayurvedic protocol.
Due to Vercel's 500MB serverless constraints and the heavy Scikit-Learn payload, this infrastructure is decoupled for the cloud:
- Frontend (Vercel): The React
frontendfolder is individually deployed on Vercel. Set the environment variableVITE_API_URLto point to the secure Render backend. - Backend (Render): The FastAPI Python backend is deployed via Render using the configured
render.yamlBlueprint. It effortlessly handles the heavynumpyandpandasmemory footprints on a persistent web service.
High-Accuracy Disease Prediction: 100% accuracy using Random Forest ML model
TF-IDF Symptom Analysis: Processes 807 symptom features using natural language processing
SMOTE Class Balancing: Handles imbalanced datasets for better prediction accuracy
Comprehensive Ayurvedic Recommendations: Complete treatment plans including herbs, therapies, and dietary advice
Personalized Body Type (Dosha) Recommendations: Customized treatments based on individual constitution
Interactive Assessment Mode: User-friendly symptom and health data collection
Integrated ML + LLM System: Combines machine learning predictions with LLM-powered Ayurvedic analysis
Offline Fallback Mode: Works completely offline when LLM/internet is unavailable
Contextual Diagnosis: Considers all symptoms, lifestyle, and environmental factors for accurate diagnosis
Detailed Treatment Plans: Includes herbs, dietary recommendations, lifestyle advice, and home remedies
Privacy-First Design: Option to run entirely offline with local Ayurvedic database
Each prediction provides all the requested fields:
- Ayurvedic_Herbs_Sanskrit: Traditional Sanskrit names of recommended herbs
- Ayurvedic_Herbs_English: English names and descriptions of herbs
- Herbs_Effects: Detailed benefits and effects of recommended herbs
- Ayurvedic_Therapies_Sanskrit: Traditional Sanskrit therapy names
- Ayurvedic_Therapies_English: Modern descriptions of therapeutic treatments
- Therapies_Effects: How therapies work and their benefits
- Dietary_Recommendations: Personalized dietary guidance
- How_Treatment_Affects_Your_Body_Type: Detailed explanation of how treatments specifically benefit your Ayurvedic constitution
pip install -r requirements.txtpython train_model.pyThis creates random_forest_model.pkl with all necessary components.
python arogya_predict.pyFor personalized assessment, run the script and choose interactive mode when prompted:
python arogya_predict.pyThe system now includes a detailed Ayurvedic body type assessment with 6 constitution types:
- Vata (Air_Space_Constitution) - Thin/Lean: Naturally thin build, difficulty gaining weight, dry skin, cold hands/feet
- Pitta (Fire_Water_Constitution) - Medium: Medium build, good muscle tone, warm body, strong appetite
- Kapha (Earth_Water_Constitution) - Heavy/Large: Naturally larger build, gains weight easily, cool moist skin, steady energy
- Vata-Pitta (Air_Fire_Mixed_Constitution) - Thin to Medium: Variable build, creative energy, moderate body temperature
- Vata-Kapha (Air_Earth_Mixed_Constitution) - Thin to Heavy: Variable patterns, irregular tendencies, sensitive to changes
- Pitta-Kapha (Fire_Earth_Mixed_Constitution) - Medium to Heavy: Strong stable build, good strength, balanced metabolism
The system now uses sophisticated confidence calibration that considers the gap between the top prediction and second-best prediction to provide more realistic confidence estimates:
- Large gap between predictions: Higher confidence possible (up to 98%)
- Medium gap: Moderate confidence (up to 95%)
- Small gap: Conservative confidence (up to 85%)
The system combines machine learning predictions with advanced LLM-powered contextual analysis. The ML model provides an initial prediction, which the LLM then evaluates against all symptoms, lifestyle factors, and environmental conditions to provide a more accurate, contextualized diagnosis with comprehensive Ayurvedic treatment plans.
============================================================
AROGYA AI - Integrated ML + LLM Prediction System
============================================================
Please provide your details to receive a personalized analysis.
------------------------------------------------------------
Enter your symptoms (comma-separated): joint pain, stiffness, swelling, difficulty walking, morning stiffness
Enter your age: 52
Enter your height (cm): 168
Enter your weight (kg): 78
Enter your gender: Female
Enter your general body type (e.g., Thin, Medium, Heavy): Medium
Enter your food habits (e.g., Vegetarian, Non-Vegetarian, Mixed): Vegetarian
Enter your current medication (if any, otherwise type 'None'): None
Enter any allergies (if any, otherwise type 'None'): None
Enter the current season (e.g., Summer, Monsoon, Winter): Winter
Enter the current weather (e.g., Hot, Humid, Cold): Cold
Analyzing your information...
=> ML Model Prediction: 'Arthritis' (Confidence: 96.50%)
============================================================
πΏ Arogya AI - Personalized Ayurvedic Analysis πΏ
============================================================
π Your Ayurvedic Diagnosis
Predicted Disease: Arthritis (Sandhivata) [Confidence Level: 97%]
Based on your profile and symptoms, you are experiencing Arthritis (Sandhivata in Ayurveda),
primarily caused by Vata dosha aggravation. The combination of joint pain, stiffness, swelling,
difficulty walking, and morning stiffness are classic symptoms of this condition, especially
prevalent during cold weather which naturally aggravates Vata.
πΏ Your Personalized Ayurvedic Plan
π©Ί Condition Explained
Sandhivata (Arthritis) occurs when Vata dosha accumulates in the joints (Sandhi), causing
pain, stiffness, and inflammation. The cold, dry qualities of Vata are particularly aggravated
during winter, leading to reduced flexibility and increased discomfort. Ama (toxins) may also
accumulate in the joints, further worsening the condition.
Ayurvedic Medicinal Herbs
- Sanskrit: Shallaki, Guggulu, Ashwagandha, Nirgundi
- English: Boswellia, Indian Bdellium, Winter Cherry, Vitex
- Effects: Anti-inflammatory, reduces joint pain, strengthens bones and tissues, improves
mobility, reduces Vata aggravation
π Ayurvedic Therapies
- Sanskrit: Abhyanga, Pinda Sweda, Janu Basti, Swedana
- English: Warm oil massage, Herbal bolus therapy, Knee pooling therapy, Steam therapy
- Effects: Lubricates joints, reduces stiffness, improves circulation, removes toxins,
alleviates pain, nourishes tissues
π₯ Dietary Recommendations
Eat This:
- Warm, cooked, and easily digestible foods
- Ghee, sesame oil, and healthy fats
- Ginger, turmeric, and warming spices
- Cooked vegetables like carrots, sweet potatoes, and squash
- Warm milk with turmeric before bed
- Moong dal and whole grains like rice and wheat
Avoid This:
- Cold, raw, and frozen foods
- Excess sour, salty foods (can increase inflammation)
- Refined sugars and processed foods
- Nightshade vegetables (tomatoes, potatoes, eggplant) which may aggravate inflammation
- Heavy, oily, and deep-fried foods
π Lifestyle Advice
- Practice gentle yoga and stretching exercises daily to maintain flexibility
- Keep joints warm, especially during cold weather
- Apply warm sesame oil massage to affected joints before bathing
- Maintain regular sleep schedule (sleep before 10 PM, wake before 6 AM)
- Stay active but avoid overexertion
- Practice stress management through meditation and pranayama
πΏ Home Remedies & Precautions
- Drink warm water with ginger throughout the day
- Apply warm sesame or castor oil to painful joints
- Use heating pads or warm compresses on affected areas
- Take turmeric milk (1 tsp turmeric in warm milk) before bed
- Gentle massage with warm oils improves circulation
- Epsom salt bath can provide relief
π€ How Treatment Affects Your Body Type
These Ayurvedic treatments specifically address Vata imbalance by providing warmth,
lubrication, and nourishment to your joints. The warm, oily therapies counteract the
cold, dry nature of aggravated Vata, helping restore balance and mobility. Regular
practice will strengthen your tissues, reduce inflammation, and improve overall joint health.
β οΈ Important Note: This is a complementary Ayurvedic approach. For severe arthritis,
persistent pain, or worsening symptoms, please consult with a qualified healthcare
professional or rheumatologist for comprehensive medical evaluation and treatment.
---
π‘ This analysis combines ML prediction (96.50% confidence) with traditional Ayurvedic
wisdom to provide personalized recommendations based on your unique constitution and symptoms.
- Data Processing: TF-IDF vectorization of symptoms (807 features)
- Feature Engineering: 12 basic health features + 807 symptom features = 819 total features
- Class Balancing: SMOTE applied for balanced training dataset (4201 β 20748 samples)
- Model Training: Random Forest/Logistic Regression/SVM with ensemble approach
- ML Prediction: Initial disease prediction using trained Random Forest model
- LLM Analysis: Advanced contextual analysis considering all symptoms and lifestyle factors
- Ayurvedic Integration: Comprehensive traditional medicine database with personalized recommendations
- Confidence Calibration: Intelligent assessment of prediction confidence based on symptom patterns
- Random Forest Accuracy: 1.0000 (100%)
- Logistic Regression Accuracy: 0.9964 (99.64%)
- SVM Accuracy: 0.9417 (94.17%)
- Feature Set: 819 features (12 basic + 807 TF-IDF)
- Training Dataset: 4,201 samples across 399 diseases
- SMOTE Augmentation: 20,748 balanced samples
- Diseases Supported: 399 disease categories with full Ayurvedic treatment plans
- Data Processing: TF-IDF vectorization of symptoms (807 features)
- Feature Engineering: 12 basic health features + 807 symptom features = 819 total features
- Class Balancing: SMOTE applied for balanced training dataset (4,201 β 20,748 samples)
- Model Training: Ensemble logic utilizing Random Forest alongside dynamic feature loading.
- LLM Analysis: Live contextual generation mapping inference to traditional Sanskrit/English medicine databases.
- Random Forest Accuracy: 1.0000 (100%)
- Logistic Regression Accuracy: 0.9964 (99.64%)
- SVM Accuracy: 0.9417 (94.17%)
The robust deterministic logic maps accurately to over 399 unique conditions spanning categories like:
- Infectious Diseases: Dengue, Tuberculosis, Malaria, Hepatitis
- Metabolic & Endocrine: Diabetes, Hypertension, Thyroid, PCOS
- Cardiovascular & Digestive: Stroke, Heart Disease, Gastroenteritis, Peptic Ulcers
- Neurological & Mental Health: Migraine, Depression, Insomnia, Epilepsy
- Musculoskeletal: Arthritis, Spondylosis, Osteoporosis
- And hundreds more!
π¨βπ» Academic Integrity: ArogyaAI is a prototype Clinical Decision Support System exhibiting full-stack engineering logic, robust backend integrations, and modern AI implementations. It is designed stringently to assist, not replace, licensed medical professionals.
- Chronic Pain Syndromes
The complete system supports 399+ diseases in total, with comprehensive Ayurvedic treatment recommendations for each condition.
Runs sample predictions with pre-defined test cases demonstrating the system capabilities.
Collects user symptoms and health information through an intuitive questionnaire:
- Symptoms input
- Age, height, weight
- Gender and age group
- Enhanced dosha selection with detailed descriptions
- Lifestyle factors (food habits, medication, allergies)
- Environmental factors (season, weather)
The system is designed to be easily integrated into web applications or APIs.
NEW: The system now works completely offline when internet/LLM is unavailable:
- Automatic detection of LLM availability
- Graceful fallback to local Ayurvedic database
- Same ML prediction accuracy (100%)
- Comprehensive offline recommendations from 4,201+ disease database
- No API key required for basic operation
- Perfect for privacy-sensitive deployments
See FALLBACK_MECHANISM.md for detailed documentation.
- ML Framework: Scikit-learn
- Text Processing: TF-IDF Vectorization
- Class Balancing: SMOTE (Synthetic Minority Oversampling)
- Feature Scaling: StandardScaler
- Model Persistence: Joblib
- Data Processing: Pandas, NumPy
- Confidence Calibration: Advanced prediction gap analysis
βββ train_model.py # Model training script
βββ arogya_predict.py # Main prediction system with interactive mode
βββ disease_prediction_system.py # Alternative comprehensive implementation
βββ demo.py # Detailed system demonstration
βββ test_fallback.py # Fallback mechanism testing script
βββ requirements.txt # Python dependencies
βββ random_forest_model.pkl # Trained model (generated)
βββ enhanced_ayurvedic_treatment_dataset.csv # Comprehensive Ayurvedic treatment database (4,201+ diseases)
βββ FALLBACK_MECHANISM.md # Detailed offline mode documentation
βββ AyurCore.ipynb # Original research notebook
The system includes an expanded database of traditional Ayurvedic treatments with:
- 50+ traditional herbs with Sanskrit and English names
- 30+ therapeutic treatments and procedures
- Dosha-specific recommendations for Vata, Pitta, and Kapha constitutions
- Personalized dietary guidelines
- Treatment effects explanation for different body types
- Advanced disease-to-treatment mapping with fallback options
- Dynamic treatment personalization based on body constitution
Integration with real medical datasetsβ DONEEnhanced confidence scoringβ DONEInteractive assessment modeβ DONETop-5 predictionsβ DONEComprehensive dosha selectionβ DONE- Web interface for easier access
- Mobile application
- Multi-language support
- Advanced NLP for symptom processing
- Telemedicine integration
- User authentication and history
- Dashboard for healthcare providers
This system is for educational and research purposes. Always consult with qualified healthcare professionals for medical advice and treatment.
Stay healthy with the wisdom of Ayurveda! πΏ