Health Bot
Health Bot
AISSCE
COMPUTER SCIENCE
PROJECT
2024-
2025
NAME:-
CLASS:- ROLL NO:-
TABLE OF CONTENTS:-
CERTIFICATE
ACKNOWLEDGEMENT
INTRODUCTION
HARDWARE
AND SOFTWARE
CODING
OUTPUT SCREEN
BIBLIOGRAPHY
CERTIFICATE
Date :
Registration No :
_________________ __________________
Signature of Internal Signature of External
Examiner Examiner
_________________
Signature of Principal
ACKNOWLEDGEMENT
We express our sincere thanks and
gratitude to Principal Mam and our
Computer Science teacher, who
guided us and helped us to
complete our Informatics Practices
Project titled:-
“HEALTH BOT” using Python.
INTRODUCTION
This project is basically for users
who want to develop Python Driven
programs and building real life
application. I assume in this
example, Hospital named “City
Hospital”. This python project helps
the hospital to keep the records of
the patients. It makes easier for
them to manage their records and
saves the firm’s time and energy.
It accepts the details of the patients
and saves it in the MYSQL Database
at the back end. The data entry
operator makes it easier for them to
add and search for the records of the
patients which are already saved in
the table.
HARDWARE AND SOFTWARE:-
MYSQL COMMAND LINE CLIENT
SPYDER/PYTHON IDLE
MICROSOFT WORD 2010
CODING
import tkinter as tk
from tkinter import messagebox
import mysql.connector
from tkinter import ttk
def create_database():
try:
# Connect to MySQL (update user and password accordingly)
conn = mysql.connector.connect(
host="localhost",
user="root", # change this to your MySQL username
password="root", # replace with your MySQL password
)
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS records (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
symptoms TEXT NOT NULL,
age INT,
previous_illnesses TEXT,
medications TEXT,
results TEXT
)
''')
conn.commit()
conn.close()
print("Database and table created successfully!")
except mysql.connector.Error as err:
print(f"Error creating database: {err}")
conn.commit()
conn.close()
print("Data saved successfully!")
except mysql.connector.Error as err:
print(f"Error saving data to the database: {err}")
"earache": {
"conditions": ["ear infection", "earwax blockage", "sinus infection"],
"treatment": "Use over-the-counter pain relievers and consult a doctor if it persists.",
"specialist": "Consult an ENT specialist for persistent earaches."
},
"itchy eyes": {
"conditions": ["allergies", "conjunctivitis (pink eye)", "dry eye"],
"treatment": "Use antihistamine eye drops and avoid allergens.",
"specialist": "Consult an ophthalmologist for persistent eye issues."
},
"blurred vision": {
"conditions": ["myopia", "hyperopia", "astigmatism", "cataracts"],
"treatment": "Wear corrective lenses if needed and consult an optometrist or ophthalmologist for vision issues.",
"specialist": "Consult an optometrist or ophthalmologist for persistent blurred vision."
},
"dizziness": {
"conditions": ["vertigo", "dehydration", "low blood pressure", "inner ear infection", "anemia"],
"treatment": "Sit or lie down, drink water, avoid sudden movements. Seek medical attention if persistent.",
"specialist": "Consult a neurologist or ENT specialist."
},
"high blood pressure": {
"conditions": ["hypertension", "kidney disease", "Cushing's syndrome", "thyroid problems"],
"treatment": "Monitor blood pressure, maintain a healthy diet, and take prescribed medication.",
"specialist": "Consult a cardiologist or nephrologist."
},
"low blood pressure": {
"conditions": ["hypotension", "dehydration", "heart problems", "endocrine disorders"],
"treatment": "Increase fluid intake, avoid alcohol, and wear compression stockings if advised.",
"specialist": "Consult a cardiologist or endocrinologist."
},
"tingling or numbness": {
"conditions": ["peripheral neuropathy", "diabetes", "multiple sclerosis", "carpal tunnel syndrome"],
"treatment": "Rest the affected area, apply heat, and manage underlying health conditions.",
"specialist": "Consult a neurologist."
},
"vision loss": {
"conditions": ["glaucoma", "macular degeneration", "diabetic retinopathy", "retinal detachment"],
"treatment": "Seek immediate medical help for sudden vision loss. Use prescribed medication or surgery for
chronic conditions.",
"specialist": "Consult an ophthalmologist."
},
"swollen lymph nodes": {
"conditions": ["infection", "mononucleosis", "Hodgkin's lymphoma", "HIV"],
"treatment": "Rest, use warm compresses, and take antibiotics if prescribed.",
"specialist": "Consult a hematologist or infectious disease specialist."
},
"swollen hands": {
"conditions": ["allergies", "arthritis", "kidney disease", "lymphedema"],
"treatment": "Elevate the hands, avoid salty foods, and take anti-inflammatory medications.",
"specialist": "Consult a rheumatologist or nephrologist."
},
"excessive sweating": {
"conditions": ["hyperhidrosis", "thyroid disorder", "menopause", "diabetes"],
"treatment": "Use antiperspirants, avoid triggers like caffeine, and seek prescription medications if necessary.",
"specialist": "Consult a dermatologist or endocrinologist."
},
"memory loss": {
"conditions": ["Alzheimer's disease", "dementia", "stroke", "brain injury"],
"treatment": "Engage in mental exercises, maintain a healthy lifestyle, and take prescribed medications.",
"specialist": "Consult a neurologist or geriatric specialist."
},
"hearing loss": {
"conditions": ["age-related hearing loss", "ear infection", "noise-induced hearing loss", "Meniere’s disease"],
"treatment": "Use hearing aids, avoid loud noises, and consult a doctor for corrective procedures.",
"specialist": "Consult an ENT specialist or audiologist."
},
"yellowing of skin (jaundice)": {
"conditions": ["hepatitis", "liver disease", "gallstones", "pancreatic cancer"],
"treatment": "Seek medical attention for liver function tests and take prescribed medications.",
"specialist": "Consult a hepatologist or gastroenterologist."
},
"nail discoloration": {
"conditions": ["fungal infection", "psoriasis", "anemia", "liver disease"],
"treatment": "Use antifungal medications, maintain proper nail hygiene, and manage underlying conditions.",
"specialist": "Consult a dermatologist."
},
"puffy eyes": {
"conditions": ["allergies", "conjunctivitis", "fluid retention", "lack of sleep"],
"treatment": "Apply cold compresses, use antihistamines, and get enough rest.",
"specialist": "Consult an allergist or ophthalmologist."
},
"dry mouth": {
"conditions": ["dehydration", "diabetes", "Sjogren's syndrome", "medication side effects"],
"treatment": "Increase water intake, use saliva substitutes, and avoid caffeine.",
"specialist": "Consult a dentist or endocrinologist."
},
"weight loss": {
"conditions": ["hyperthyroidism", "diabetes", "cancer", "malabsorption"],
"treatment": "Eat a balanced diet, consult a dietitian, and address underlying conditions.",
"specialist": "Consult an endocrinologist or oncologist."
},
"weight gain": {
"conditions": ["hypothyroidism", "polycystic ovary syndrome (PCOS)", "heart failure", "Cushing's syndrome"],
"treatment": "Follow a balanced diet, exercise regularly, and address underlying medical conditions.",
"specialist": "Consult an endocrinologist or cardiologist."
},
"cold hands and feet": {
"conditions": ["Raynaud's disease", "hypothyroidism", "poor circulation", "anemia"],
"treatment": "Keep warm, manage stress, and consult a doctor if symptoms persist.",
"specialist": "Consult a vascular specialist or endocrinologist."
},
"red or bloodshot eyes": {
"conditions": ["conjunctivitis", "dry eyes", "eye strain", "glaucoma"],
"treatment": "Use artificial tears, avoid eye strain, and consult a doctor if it persists.",
"specialist": "Consult an ophthalmologist."
},
"itchy skin": {
"conditions": ["allergies", "eczema", "psoriasis", "liver disease"],
"treatment": "Use moisturizers, avoid irritants, and consider antihistamines for allergic causes.",
"specialist": "Consult a dermatologist."
},
"palpitations": {
"conditions": ["anxiety", "hyperthyroidism", "arrhythmia", "heart disease"],
"treatment": "Reduce caffeine intake, practice relaxation techniques, and consult a doctor if frequent.",
"specialist": "Consult a cardiologist or endocrinologist."
},
"confusion": {
"conditions": ["stroke", "hypoglycemia", "dehydration", "dementia", "brain injury"],
"treatment": "Seek immediate medical attention for sudden confusion. Maintain proper hydration and blood sugar
levels.",
"specialist": "Consult a neurologist."
},
"swollen gums": {
"conditions": ["gingivitis", "periodontitis", "vitamin deficiency", "hormonal changes"],
"treatment": "Practice good oral hygiene, use antiseptic mouthwash, and consult a dentist for persistent issues.",
"specialist": "Consult a dentist."
},
"numbness in fingers": {
"conditions": ["carpal tunnel syndrome", "diabetes", "nerve compression", "peripheral neuropathy"],
"treatment": "Rest the affected area, apply cold compresses, and manage underlying conditions.",
"specialist": "Consult a neurologist or orthopedic specialist."
},
"muscle cramps": {
"conditions": ["dehydration", "electrolyte imbalance", "poor circulation", "muscle strain"],
"treatment": "Stay hydrated, stretch the muscles, and consider electrolyte supplements.",
"specialist": "Consult a physical therapist or primary care physician."
},
"frequent infections": {
"conditions": ["immunodeficiency", "HIV", "diabetes", "autoimmune disorders"],
"treatment": "Manage underlying health conditions, improve personal hygiene, and take prescribed medications.",
"specialist": "Consult an immunologist or infectious disease specialist."
},
"burning sensation during urination": {
"conditions": ["urinary tract infection", "sexually transmitted infection", "kidney stones", "bladder infection"],
"treatment": "Stay hydrated, avoid irritants, and consult a doctor for antibiotics if needed.",
"specialist": "Consult a urologist."
}
}
def print_symptom_list():
print("Welcome to the Symptom Checker")
print("List of symptoms:")
symptom_list = list(symptom_checker.keys())
num_symptoms = len(symptom_list)
columns = 3
rows = (num_symptoms + columns - 1) // columns
for i in range(rows):
row_text = ""
for j in range(columns):
index = i + j * rows
if index < num_symptoms:
row_text += f"{symptom_list[index]:<25}"
print(row_text)
if not symptoms:
messagebox.showwarning("Input Error", "Please enter at least one symptom.")
return None
possible_conditions = list(set(possible_conditions))
if not possible_conditions:
return "No specific condition found based on the provided symptoms."
else:
result = f"Possible conditions based on symptoms:\n - {', '.join(possible_conditions)}\n"
if treatments:
result += "Temporary treatments or self-care measures:\n"
result += "\n".join(f" - {treatment}" for treatment in treatments) + "\n"
if specialist_info:
result += "Specialist recommendations:\n"
result += "\n".join(f" - {specialist}" for specialist in specialist_info)
return result
def submit_data():
name = name_entry.get().strip()
age = age_entry.get().strip()
selected_indices = symptoms_listbox.curselection()
symptoms = [symptoms_listbox.get(i) for i in selected_indices]
previous_illnesses = previous_illnesses_entry.get().strip().split(',')
medications = medications_entry.get().strip().split(',')
age = int(age)
result = ai_doctor(name, symptoms, age, previous_illnesses, medications)
if result:
result_text.delete(1.0, tk.END)
result_text.insert(tk.END, result)
create_database()
root = tk.Tk()
root.title("🤙Symptom Checker🤙")
root.configure(bg='#ADD8E6')
# Add the heading for "Health Bot" with a boundary
heading_label = tk.Label(root, text="Health Bot", font=("Times New Roman", 28, "bold"), bg='#FFCCCB', fg='#333',
relief="solid", bd=2, padx=10, pady=10)
heading_label.grid(row=0, column=0, columnspan=2, pady=10) # Adjusted for spacing and centered
tk.Label(root, text="Name:", bg='#ADD8E6', fg='#333', font=("Comic Sans", 12, )).grid(row=1, column=0) # Customize
colors
name_entry = tk.Entry(root)
name_entry.grid(row=1, column=1)
tk.Label(root, text="Age:", bg='#ADD8E6', fg='#333', font=("Comic Sans", 12, )).grid(row=2, column=0)
age_entry = tk.Entry(root)
age_entry.grid(row=2, column=1)
tk.Label(root, text="Select Symptoms (comma-separated):", bg='#ADD8E6', fg='#333', font=("Comic Sans",
12, )).grid(row=3, column=0)
symptoms_listbox = tk.Listbox(root, selectmode=tk.MULTIPLE, height=10, width=40, bg='white', fg='black')
symptoms_listbox.grid(row=3, column=1)
scrollbar = tk.Scrollbar(root)
scrollbar.grid(row=2, column=2, sticky='ns')
symptoms_listbox.config(yscrollcommand=scrollbar.set)
scrollbar.config(command=symptoms_listbox.yview)
# Submit button
submit_button = tk.Button(root, text="Submit", command=submit_data, bg='#4CAF50', fg='white') # Green button
submit_button.grid(row=6, column=0, columnspan=2)
root.mainloop()
OUTPUT SCREEN:
1. Home Page
2. Output
BIBLIOGRAPHY