Medical Diagnosis Prediction System

Published on 08-09-2025


🩺 Overview

This project is a medical diagnosis prediction system that predicts possible diseases based on patient-reported symptoms. The web interface is built with Flask and the backend logic leverages Python, Pandas, and machine learning models.

⚙️ Tech Stack

🛠️ Implementation Steps

  1. Prepared datasets for symptoms, precautions, diets, workouts, medications, and disease descriptions
  2. Trained an SVC (Support Vector Classifier) to classify diseases based on binary symptom vectors
  3. Pickled the model for later use with Flask
  4. Created Flask routes:
    • / → main page with symptom input form
    • /predict → processes user symptoms and predicts disease
    • Other static pages: /about, /Contact, /Blog, /Developer
  5. On submit, the system returns:
    • Predicted disease
    • Description, precautions, recommended diet, workouts, and medications

📸 UI Previews

Symptom Input Page

Symptom Input Page

Prediction Results Page

Prediction Results Page

Detailed Disease Info Page

Detailed Disease Info Page

📜 Key Code Snippet

@app.route('/predict', methods=['POST'])
def predict():
    symptoms = request.form.get('symptoms')
    user_symptoms = [s.strip() for s in symptoms.split(',')]
    predicted_disease = get_predicted_value(user_symptoms)

    desc, pre, med, die, wrkout = helper(predicted_disease)
    return render_template('index.html',
                           predicted_disease=predicted_disease,
                           dis_des=desc,
                           dis_pre=pre,
                           dis_med=med,
                           dis_diet=die,
                           dis_wrkout=wrkout)
      

This route takes user input symptoms, predicts the disease, and displays all related information.

💡 Lessons Learned

🚀 Conclusion

This Medical Diagnosis System demonstrates how machine learning can assist in predicting diseases based on symptoms. Future improvements could include more advanced ML models, natural language symptom input, and integration with patient medical records.


← Back to Portfolio