0% found this document useful (0 votes)
6 views19 pages

Health Bot

The document outlines a Computer Science project titled 'HEALTH BOT' developed by a student at Amrita Vidyalayam for the AISSCE 2024-2025. It details the project's purpose of managing patient records for a hospital using Python and MySQL, along with coding examples and a list of hardware and software used. The project includes a symptom checker with various medical conditions, treatments, and specialist recommendations.

Uploaded by

chamritrnd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views19 pages

Health Bot

The document outlines a Computer Science project titled 'HEALTH BOT' developed by a student at Amrita Vidyalayam for the AISSCE 2024-2025. It details the project's purpose of managing patient records for a hospital using Python and MySQL, along with coding examples and a list of hardware and software used. The project includes a symptom checker with various medical conditions, treatments, and specialist recommendations.

Uploaded by

chamritrnd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

AMRITA VIDYALAYAM

AISSCE
COMPUTER SCIENCE
PROJECT
2024-
2025

NAME:-
CLASS:- ROLL NO:-
TABLE OF CONTENTS:-
 CERTIFICATE
 ACKNOWLEDGEMENT
 INTRODUCTION
HARDWARE
AND SOFTWARE
 CODING
 OUTPUT SCREEN
 BIBLIOGRAPHY
CERTIFICATE

This is to certify that Ms/Mr_______________


of Amrita Vidyalayam School(Juinagar),studying in class
XII-A has successfully completed her/his Computer
Science(083) Project/Practical Journal under the guidance
of concerned subject teacher Mrs.Supriya Awari for the
AISSCE as per the guidelines prescribed by the CBSE in
the year 2024-2025.

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 DATABASE IF NOT EXISTS symptom_checker")


cursor.execute("USE symptom_checker")

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}")

def save_to_database(name, symptoms, age, previous_illnesses, medications, results):


try:
conn = mysql.connector.connect(
host="localhost",
user="root", # change this to your MySQL username
password="root", # replace with your MySQL password
database="symptom_checker"
)
cursor = conn.cursor()
cursor.execute('''
INSERT INTO records (name, symptoms, age, previous_illnesses, medications, results)
VALUES (%s, %s, %s, %s, %s, %s)
''', (name, ', '.join(symptoms), age, ', '.join(previous_illnesses), ', '.join(medications), results))

conn.commit()
conn.close()
print("Data saved successfully!")
except mysql.connector.Error as err:
print(f"Error saving data to the database: {err}")

# Symptom Checker Data


symptom_checker = {
"fever": {
"conditions": ["cold", "flu", "COVID-19", "pneumonia", "typhoid", "malaria"],
"treatment": "Rest, stay hydrated, and consider over-the-counter fever reducers like acetaminophen.",
"specialist": "Consult your primary care physician."
},
"cough": {
"conditions": ["cold", "flu", "COVID-19", "bronchitis", "pneumonia", "tuberculosis"],
"treatment": "Stay hydrated, use a humidifier, and consider over-the-counter cough syrup or lozenges.",
"specialist": "Consult your primary care physician."
},
"headache": {
"conditions": ["migraine", "tension headache", "sinusitis", "meningitis", "hypertension"],
"treatment": "Rest in a quiet, dark room, and consider over-the-counter pain relievers like ibuprofen.",
"specialist": "Consult a neurologist for severe or recurring headaches."
},
"nausea": {
"conditions": ["food poisoning", "stomach flu", "migraine", "appendicitis", "gastroenteritis"],
"treatment": "Avoid heavy or spicy foods, sip clear fluids, and consider over-the-counter anti-nausea
medications.",
"specialist": "Consult a gastroenterologist for persistent nausea and digestive issues."
},
"fatigue": {
"conditions": ["anemia", "chronic fatigue syndrome", "hypothyroidism", "sleep apnea"],
"treatment": "Ensure you get enough rest, maintain a balanced diet, and consult a doctor for underlying
conditions.",
"specialist": "Consult an internist or endocrinologist for persistent fatigue."
},
"shortness of breath": {
"conditions": ["asthma", "COPD", "pneumonia", "pulmonary embolism", "anxiety"],
"treatment": "Stay calm, sit upright, and use a rescue inhaler if prescribed. Seek medical help if severe.",
"specialist": "Consult a pulmonologist for chronic shortness of breath."
},
"chest pain": {
"conditions": ["heart attack", "angina", "acid reflux", "costochondritis", "pneumothorax"],
"treatment": "If it might be a heart-related issue, call emergency services. For other causes, rest and consult a
doctor.",
"specialist": "Consult a cardiologist for persistent or severe chest pain."
},
"joint pain": {
"conditions": ["arthritis", "gout", "rheumatoid arthritis", "lupus"],
"treatment": "Rest the affected joint, use ice or heat packs, and consider over-the-counter pain relievers.",
"specialist": "Consult a rheumatologist for chronic joint pain."
},
"abdominal pain": {
"conditions": ["appendicitis", "gastritis", "irritable bowel syndrome", "pancreatitis"],
"treatment": "Avoid solid foods, drink clear fluids, and consult a doctor for severe or persistent pain.",
"specialist": "Consult a gastroenterologist for persistent abdominal pain."
},
"skin rash": {
"conditions": ["eczema", "psoriasis", "contact dermatitis", "allergic reaction"],
"treatment": "Keep the area clean, apply an over-the-counter hydrocortisone cream, and avoid irritants.",
"specialist": "Consult a dermatologist for persistent or severe skin rashes."
},
"sore throat": {
"conditions": ["cold", "flu", "strep throat", "tonsillitis", "pharyngitis"],
"treatment": "Stay hydrated, rest, and consider lozenges or gargling with warm salt water.",
"specialist": "Consult an otolaryngologist for recurring or severe sore throats."
},
"diarrhea": {
"conditions": ["food poisoning", "stomach flu", "irritable bowel syndrome", "gastroenteritis"],
"treatment": "Drink clear fluids, avoid solid foods, and consult a doctor if it persists.",
"specialist": "Consult a gastroenterologist for chronic diarrhea."
},
"vomiting": {
"conditions": ["food poisoning", "stomach flu", "migraine", "appendicitis", "gastroenteritis"],
"treatment": "Sip clear fluids, avoid heavy meals, and consult a doctor if vomiting is severe or prolonged.",
"specialist": "Consult a gastroenterologist for persistent or severe vomiting."
},
"dizziness": {
"conditions": ["vertigo", "dehydration", "low blood pressure", "anxiety", "inner ear infection"],
"treatment": "Sit or lie down, drink water, and avoid sudden movements. Consult a doctor if recurrent.",
"specialist": "Consult an ENT specialist or neurologist for persistent dizziness."
},
"back pain": {
"conditions": ["muscle strain", "herniated disc", "kidney stones", "osteoporosis"],
"treatment": "Apply ice or heat, rest, and consider over-the-counter pain relievers.",
"specialist": "Consult an orthopedic specialist for chronic back pain."
},
"frequent urination": {
"conditions": ["urinary tract infection", "diabetes", "prostate issues", "interstitial cystitis"],
"treatment": "Stay hydrated, avoid caffeine and alcohol, and consult a doctor for underlying conditions.",
"specialist": "Consult a urologist or endocrinologist for frequent urination issues."
},
"sneezing": {
"conditions": ["allergies", "common cold", "hay fever"],
"treatment": "Avoid allergens, use antihistamines, and consider a nasal saline rinse.",
"specialist": "Consult an allergist for persistent sneezing due to allergies."
},
"swollen ankles": {
"conditions": ["edema", "heart failure", "kidney disease", "varicose veins"],
"treatment": "Elevate your legs, reduce salt intake, and consult a doctor for underlying causes.",
"specialist": "Consult a cardiologist or nephrologist for persistent ankle swelling."
},
"dry cough": {
"conditions": ["allergies", "asthma", "acid reflux", "pneumonia", "bronchitis"],
"treatment": "Stay hydrated, use a humidifier, and consider over-the-counter cough syrup or lozenges.",
"specialist": "Consult your primary care physician or pulmonologist for persistent dry cough."
},
"toothache": {
"conditions": ["cavities", "gum disease", "abscessed tooth", "sinusitis"],
"treatment": "Rinse with warm salt water, use over-the-counter pain relievers, and see a dentist for tooth
problems.",
"specialist": "Consult a dentist for persistent toothaches."
},
"upset stomach": {
"conditions": ["indigestion", "gastritis", "food poisoning", "ulcers"],
"treatment": "Avoid heavy or spicy foods, sip clear fluids, and consider over-the-counter antacids.",
"specialist": "Consult a gastroenterologist for persistent upset stomach."
},
"sore muscles": {
"conditions": ["muscle strain", "overexertion", "fibromyalgia"],
"treatment": "Rest, apply ice, and consider over-the-counter pain relievers like ibuprofen.",
"specialist": "Consult a physical therapist for persistent sore muscles."
},

"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."
},

"rash on the hands": {


"conditions": ["eczema", "contact dermatitis", "psoriasis"],
"treatment": "Apply moisturizing cream and avoid irritants.",
"specialist": "Consult a dermatologist for persistent hand rashes."
},
"stomach bloating": {
"conditions": ["indigestion", "gastrointestinal issues", "food intolerance"],
"treatment": "Avoid gas-producing foods, eat slowly, and consider over-the-counter gas relief medications.",
"specialist": "Consult a gastroenterologist for persistent stomach bloating."
},

"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)

def ai_doctor(name, symptoms, age, previous_illnesses, medications):


possible_conditions = []
treatments = []
specialist_info = []

if not symptoms:
messagebox.showwarning("Input Error", "Please enter at least one symptom.")
return None

for symptom in symptoms:


if symptom in symptom_checker:
condition_data = symptom_checker[symptom]
possible_conditions.extend(condition_data["conditions"])
treatments.append(condition_data["treatment"])
specialist_info.append(condition_data["specialist"])

possible_conditions = list(set(possible_conditions))

if age > 60:


possible_conditions.append("Age-related factors")
if not previous_illnesses:
previous_illnesses = ["None"]
if not medications:
medications = ["None"]

for illness in previous_illnesses:


illness = illness.strip()
if illness in ["diabetes", "heart disease", "cancer"]:
possible_conditions.append(f"Previous {illness} may be a risk factor.")

if "blood thinners" in medications:


possible_conditions.append("Medication-related factors (blood thinners)")

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)

save_to_database(name, symptoms, age, previous_illnesses, medications, result)

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(',')

if not name or not age.isdigit() or not symptoms:


messagebox.showwarning("Input Error", "Please provide valid inputs for name, age, and symptoms.")
return

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')

for symptom in symptom_checker.keys():


symptoms_listbox.insert(tk.END, symptom)

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)

tk.Label(root, text="Previous Illnesses (comma-separated):", bg='#ADD8E6', fg='#333', font=("Comic Sans",


12, )).grid(row=4, column=0)
previous_illnesses_entry = tk.Entry(root)
previous_illnesses_entry.grid(row=4, column=1)

tk.Label(root, text="Medications (comma-separated):", bg='#ADD8E6', fg='#333', font=("Comic Sans",


12, )).grid(row=5, column=0)
medications_entry = tk.Entry(root)
medications_entry.grid(row=5, column=1)

# 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)

# Result display with scrollbar


result_frame = tk.Frame(root)
result_frame.grid(row=7, column=0, columnspan=2)

result_text = tk.Text(result_frame, height=10, width=50, bg='white', fg='black')


result_text.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)

root.mainloop()
OUTPUT SCREEN:
1. Home Page
2. Output
BIBLIOGRAPHY

 IP Textbook by Sumita Arora.


 NCERT Book of Imformation Pratices.
 https://www.geeksforgeeks.org/python
-gui-tkinter/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy