YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
import time
Example symptom-to-condition mappings
CONDITION_DATABASE = { "fever": ["Flu", "Common Cold", "COVID-19"], "headache": ["Migraine", "Tension Headache", "Sinusitis"], "cough": ["Bronchitis", "Pneumonia", "Asthma"], "fatigue": ["Anemia", "Thyroid Issues", "Depression"], }
Disclaimer
def show_disclaimer(): print("⚠️ HealthBuddy is a symptom-checking assistant.\n") print("This tool is for informational purposes only and does not provide medical advice. " "Always consult a qualified healthcare provider for a proper diagnosis.\n")
Get symptoms from the user
def get_user_symptoms(): print("Please enter your symptoms, separated by commas (e.g., 'fever, cough'):") symptoms = input("Your symptoms: ").lower() return [symptom.strip() for symptom in symptoms.split(",")]
Match symptoms with conditions
def match_symptoms_to_conditions(symptoms): possible_conditions = [] for symptom in symptoms: if symptom in CONDITION_DATABASE: possible_conditions.extend(CONDITION_DATABASE[symptom]) return list(set(possible_conditions))
Main function
def health_buddy(): show_disclaimer() print("Welcome to HealthBuddy! Let's start by understanding your symptoms.\n") symptoms = get_user_symptoms() print("\nAnalyzing symptoms...") time.sleep(2) # Simulate processing time
matched_conditions = match_symptoms_to_conditions(symptoms)
if matched_conditions:
print("\nBased on your symptoms, here are some possible conditions to consider:")
for condition in matched_conditions:
print(f"- {condition}")
print("\nPlease consult a healthcare provider for a proper diagnosis and treatment plan.")
else:
print("\nSorry, I couldn't match your symptoms to any known conditions. Please consult a healthcare provider.")
Run HealthBuddy
if name == "main": health_buddy()