healthguide / app.py
Muhammadtaha12's picture
Update app.py
163b4b3 verified
raw
history blame
6.72 kB
# Disease Information Dictionary (extended with more diseases)
diseases = {
"flu": {
"symptoms": ["fever", "cough", "sore throat", "body aches", "fatigue"],
"treatment": "Rest, fluids, pain relievers, and anti-viral medications if prescribed."
},
"headache": {
"symptoms": ["head pain", "nausea", "sensitivity to light"],
"treatment": "Rest, hydration, over-the-counter painkillers, and avoid triggers."
},
"diabetes": {
"symptoms": ["increased thirst", "frequent urination", "fatigue", "blurred vision"],
"treatment": "Insulin therapy, lifestyle changes, and dietary management."
},
"asthma": {
"symptoms": ["shortness of breath", "wheezing", "chest tightness", "coughing"],
"treatment": "Inhalers, bronchodilators, corticosteroids, and avoiding triggers."
},
"pneumonia": {
"symptoms": ["cough with mucus", "fever", "shortness of breath", "chest pain"],
"treatment": "Antibiotics for bacterial pneumonia, rest, fluids, and pain relievers."
},
"diabetes type 1": {
"symptoms": ["frequent urination", "increased thirst", "fatigue", "unexplained weight loss"],
"treatment": "Insulin injections, blood sugar monitoring, and a healthy diet."
},
"diabetes type 2": {
"symptoms": ["increased thirst", "frequent urination", "fatigue", "blurred vision"],
"treatment": "Lifestyle changes, oral medications, and insulin therapy if needed."
},
"hypertension": {
"symptoms": ["headaches", "dizziness", "shortness of breath", "nosebleeds"],
"treatment": "Medications like beta-blockers, ACE inhibitors, lifestyle changes including exercise and diet."
},
"arthritis": {
"symptoms": ["joint pain", "swelling", "stiffness", "reduced range of motion"],
"treatment": "Pain relievers, anti-inflammatory drugs, physical therapy, and joint protection."
},
"cancer": {
"symptoms": ["unexplained weight loss", "fatigue", "pain", "skin changes"],
"treatment": "Chemotherapy, radiation, surgery, and immunotherapy."
},
"alzheimer's disease": {
"symptoms": ["memory loss", "confusion", "difficulty performing familiar tasks"],
"treatment": "Cognitive therapy, medications to slow progression, and support for caregivers."
},
"migraine": {
"symptoms": ["severe headache", "nausea", "sensitivity to light and sound"],
"treatment": "Pain relievers, anti-nausea medications, and lifestyle adjustments."
},
"stroke": {
"symptoms": ["sudden numbness", "weakness", "confusion", "difficulty speaking or understanding speech"],
"treatment": "Emergency care, rehabilitation, and medications to prevent further strokes."
},
# Add additional diseases here...
"abdominal aortic aneurysm": {
"symptoms": ["pulsating feeling near the navel", "severe back or abdominal pain"],
"treatment": "Surgery or endovascular aneurysm repair (EVAR)."
},
"acute lymphoblastic leukemia": {
"symptoms": ["fatigue", "fever", "bone pain", "paleness"],
"treatment": "Chemotherapy, radiation, stem cell transplant."
},
"acute myeloid leukemia": {
"symptoms": ["fever", "fatigue", "easy bruising", "shortness of breath"],
"treatment": "Chemotherapy, stem cell transplant, and targeted therapy."
},
"acromegaly": {
"symptoms": ["enlarged hands and feet", "facial changes", "joint pain"],
"treatment": "Surgery, radiation therapy, and medications to control growth hormone."
},
"actinomycosis": {
"symptoms": ["painful lumps", "fever", "abscesses"],
"treatment": "Antibiotics, typically penicillin."
},
"addison's disease": {
"symptoms": ["fatigue", "low blood pressure", "weight loss", "skin darkening"],
"treatment": "Hormone replacement therapy, particularly corticosteroids."
},
"adhd": {
"symptoms": ["difficulty focusing", "impulsiveness", "hyperactivity"],
"treatment": "Medications (stimulants), behavior therapy, and lifestyle changes."
},
"aids": {
"symptoms": ["rapid weight loss", "fever", "night sweats", "fatigue"],
"treatment": "Antiretroviral therapy (ART), supportive care."
},
"albinism": {
"symptoms": ["very light skin", "white or very light hair", "vision problems"],
"treatment": "No cure, but management includes sun protection and corrective lenses."
},
# You can continue adding diseases similarly from the list.
}
# Function to display disease information
def display_disease_info(disease_name):
disease_name = disease_name.lower()
if disease_name in diseases:
disease = diseases[disease_name]
print(f"\nDisease: {disease_name.title()}")
print("Symptoms:")
for symptom in disease["symptoms"]:
print(f" - {symptom}")
print(f"\nTreatment: {disease['treatment']}")
else:
print("Disease not found. Please check the name and try again.")
# Function to handle chat feature
def chat_bot():
print("\nChat Bot is active. Type 'exit' to quit.\n")
while True:
user_input = input("You: ").strip().lower()
# Responding to the "cha hal aa?" query with "khair aa"
if user_input == "cha hal aa?":
print("Bot: khair aa")
# Check if the user wants to know about a disease
elif user_input in diseases:
display_disease_info(user_input)
# Exit the chat bot if the user types 'exit'
elif user_input == "exit":
print("Exiting chat...")
break
# If the input is unrecognized
else:
print("Bot: Sorry, I didn't understand that. Please ask about a disease or type 'exit' to quit.")
# Main menu to choose between disease info or chat
def main():
print("Welcome to the Disease Information and Chat Bot!\n")
while True:
print("\nChoose an option:")
print("1. Disease Information")
print("2. Chat with Bot")
print("3. Exit")
option = input("Enter your choice (1/2/3): ").strip()
if option == "1":
disease_name = input("Enter the name of the disease: ").strip().lower()
display_disease_info(disease_name)
elif option == "2":
chat_bot()
elif option == "3":
print("Exiting the program...")
break
else:
print("Invalid choice. Please try again.")
# Run the program
if __name__ == "__main__":
main()