Medisync / utils /disease_knowledge.py
anique-1's picture
Deploy MediSync AI Backend with APK to Hugging Face
903c699
Raw
History Blame Contribute Delete
50.3 kB
"""
Skin Disease Knowledge Base
Contains disease info, medicines, and recommendations for all CV model classes.
"""
DISEASE_KB = {
"Acne": {
"description": (
"Acne is a skin condition that occurs when hair follicles become plugged "
"with oil and dead skin cells. It causes whiteheads, blackheads, or pimples. "
"Most common in teenagers, but can affect people of all ages."
),
"severity_indicators": {
"Mild": "Few whiteheads or blackheads, occasional small pimples",
"Moderate": "Multiple pimples, some nodules, visible redness",
"Severe": "Many nodules/cysts, widespread inflammation, scarring risk",
"Critical": "Severe cystic acne, deep abscesses, significant scarring",
},
"medicines": [
{"name": "Benzoyl Peroxide 5% Gel", "type": "Topical", "dosage": "Apply thin layer",
"frequency": "Once or twice daily", "duration": "6-8 weeks",
"side_effects": ["Skin dryness", "Peeling", "Redness"], "prescription_required": False},
{"name": "Clindamycin Phosphate Gel 1%", "type": "Topical Antibiotic", "dosage": "Apply thin layer",
"frequency": "Twice daily", "duration": "8-12 weeks",
"side_effects": ["Dryness", "Oiliness", "Burning sensation"], "prescription_required": True},
{"name": "Tretinoin Cream 0.025%", "type": "Retinoid", "dosage": "Pea-sized amount",
"frequency": "Once daily at night", "duration": "3-6 months",
"side_effects": ["Skin peeling", "Redness", "Sun sensitivity"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["Wash face twice daily with gentle cleanser", "Avoid touching or picking pimples",
"Change pillowcases weekly", "Keep hair clean and off face", "Manage stress through exercise"],
"diet": ["Reduce dairy and high glycemic foods", "Increase water intake (8+ glasses daily)",
"Eat more fruits and vegetables", "Limit chocolate and greasy foods"],
"precautions": ["Always use non-comedogenic sunscreen SPF 30+", "Avoid oil-based makeup products",
"Do not share towels or face cloths", "Avoid excessive scrubbing"],
"when_to_see_doctor": ["Acne doesn't improve after 2-3 months of OTC treatment",
"Acne is causing scarring", "You have painful cysts under the skin"],
"home_remedies": ["Apply tea tree oil (diluted) to affected areas", "Use ice pack to reduce inflammation",
"Apply honey mask for antibacterial properties"],
},
},
"Eczema": {
"description": (
"Eczema (atopic dermatitis) makes skin red, itchy, and inflamed. "
"Common in children but can occur at any age. Long lasting and tends to flare periodically."
),
"severity_indicators": {
"Mild": "Dry, itchy patches, minimal redness",
"Moderate": "Red inflamed patches, some oozing, significant itching",
"Severe": "Widespread inflammation, crusting, sleep disruption",
"Critical": "Skin infections, severe weeping, extreme discomfort",
},
"medicines": [
{"name": "Hydrocortisone Cream 1%", "type": "Topical Corticosteroid", "dosage": "Apply thin layer",
"frequency": "1-2 times daily", "duration": "1-2 weeks",
"side_effects": ["Skin thinning with prolonged use", "Stretch marks"], "prescription_required": False},
{"name": "Tacrolimus Ointment 0.1%", "type": "Calcineurin Inhibitor", "dosage": "Apply thin layer",
"frequency": "Twice daily", "duration": "As directed",
"side_effects": ["Burning sensation", "Itching initially", "Skin infection risk"], "prescription_required": True},
{"name": "Cetirizine 10mg", "type": "Oral Antihistamine", "dosage": "10mg tablet",
"frequency": "Once daily", "duration": "During flare-ups",
"side_effects": ["Drowsiness", "Dry mouth", "Dizziness"], "prescription_required": False},
],
"recommendations": {
"lifestyle": ["Moisturize skin at least twice daily", "Take short lukewarm showers",
"Wear soft, breathable fabrics (cotton)", "Identify and avoid personal triggers"],
"diet": ["Identify food triggers through elimination diet", "Increase anti-inflammatory foods",
"Stay well hydrated", "Consider probiotics", "Reduce processed and sugary foods"],
"precautions": ["Avoid harsh soaps or detergents", "Use fragrance-free products",
"Keep nails short to prevent scratching damage"],
"when_to_see_doctor": ["Skin becomes infected (yellow crusting, warmth, pus)",
"OTC treatments not effective after 2 weeks"],
"home_remedies": ["Apply pure coconut oil as moisturizer", "Oatmeal bath to soothe itching",
"Cold compress for immediate itch relief", "Aloe vera gel"],
},
},
"Psoriasis": {
"description": (
"Psoriasis causes red, itchy scaly patches, most commonly on knees, elbows, trunk, and scalp. "
"A chronic disease with no cure, but symptoms can be managed effectively."
),
"severity_indicators": {
"Mild": "Small patches, minimal scaling",
"Moderate": "Multiple patches, moderate scaling and redness",
"Severe": "Large areas affected, thick plaques, significant discomfort",
"Critical": "Widespread coverage, joint involvement (psoriatic arthritis)",
},
"medicines": [
{"name": "Calcipotriene 0.005% Cream", "type": "Vitamin D3 Analogue", "dosage": "Apply thin layer",
"frequency": "Twice daily", "duration": "6-8 weeks",
"side_effects": ["Skin irritation", "Burning", "Peeling"], "prescription_required": True},
{"name": "Betamethasone Dipropionate Cream", "type": "Topical Corticosteroid", "dosage": "Apply thin layer",
"frequency": "Once or twice daily", "duration": "4-6 weeks",
"side_effects": ["Skin atrophy", "Stretch marks", "Rebound effect"], "prescription_required": True},
{"name": "Coal Tar Shampoo 5%", "type": "Topical Keratolytic", "dosage": "Apply to scalp",
"frequency": "2-3 times weekly", "duration": "Long-term maintenance",
"side_effects": ["Skin discoloration", "Odor", "Photosensitivity"], "prescription_required": False},
],
"recommendations": {
"lifestyle": ["Maintain healthy weight", "Quit smoking if applicable", "Limit alcohol consumption",
"Manage stress with yoga or meditation", "Get regular moderate exercise"],
"diet": ["Eat anti-inflammatory foods (berries, leafy greens)", "Increase Omega-3 fatty acids",
"Reduce alcohol consumption"],
"precautions": ["Moisturize daily with thick creams", "Protect skin from cuts and scrapes",
"Avoid skin products with alcohol or fragrances"],
"when_to_see_doctor": ["Sudden widespread outbreak", "Joints become painful or swollen",
"Current treatment stops working"],
"home_remedies": ["Apply aloe vera gel", "Dead sea salt baths", "Apple cider vinegar for scalp psoriasis"],
},
},
"Melanoma": {
"description": (
"Melanoma is the most serious type of skin cancer, developing in melanocytes. "
"Know the ABCDE warning signs: Asymmetry, Border, Color, Diameter, Evolving."
),
"severity_indicators": {
"Mild": "Small lesion, confined, early stage",
"Moderate": "Growing lesion, color variation, irregular borders",
"Severe": "Infiltrating deeper layers, potential lymph node involvement",
"Critical": "Metastatic, spread to distant organs",
},
"medicines": [
{"name": "Imiquimod Cream 5%", "type": "Immunomodulator", "dosage": "Apply once daily",
"frequency": "5 days per week", "duration": "6 weeks",
"side_effects": ["Skin reactions", "Flu-like symptoms", "Erosion"], "prescription_required": True},
{"name": "Pembrolizumab (Keytruda)", "type": "Immunotherapy (specialist only)",
"dosage": "As prescribed by oncologist", "frequency": "Every 3-6 weeks IV", "duration": "As prescribed",
"side_effects": ["Fatigue", "Immune reactions", "Rash"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["🚨 USE SUNSCREEN SPF 50+ DAILY - CRITICAL", "Wear protective clothing and wide-brim hats",
"Avoid tanning beds completely", "Regular skin self-examinations"],
"diet": ["Antioxidant-rich foods (berries, dark leafy greens)", "Green tea polyphenols",
"Selenium-rich foods (Brazil nuts, fish)"],
"precautions": ["🚨 SEEK IMMEDIATE MEDICAL ATTENTION", "Do not attempt home treatment",
"Monitor ABCDE: Asymmetry, Border, Color, Diameter, Evolving"],
"when_to_see_doctor": ["⚠️ IMMEDIATELY - This is a medical emergency",
"Any changing mole or new skin lesion",
"Mole that bleeds, itches, or has irregular borders"],
"home_remedies": ["⚠️ NO HOME REMEDIES - Seek immediate medical care",
"Apply sunscreen to all exposed areas"],
},
},
"Darier's Disease": {
"description": (
"Darier's Disease (keratosis follicularis) is a rare genetic skin disorder characterized by "
"warty, yellowish-brown papules and plaques on seborrheic areas (chest, back, forehead). "
"Caused by mutations in the ATP2A2 gene."
),
"severity_indicators": {
"Mild": "Few isolated papules with mild odor",
"Moderate": "Multiple papules coalescing into plaques",
"Severe": "Extensive plaques, secondary infection, significant odor",
"Critical": "Widespread erosions, secondary bacterial or herpetic infection",
},
"medicines": [
{"name": "Acitretin 25mg", "type": "Oral Retinoid", "dosage": "25mg daily",
"frequency": "Once daily with food", "duration": "Long-term",
"side_effects": ["Dry lips", "Hair loss", "Liver effects", "Teratogenic"], "prescription_required": True},
{"name": "Isotretinoin 0.5mg/kg", "type": "Oral Retinoid", "dosage": "0.5-1mg/kg/day",
"frequency": "Once daily", "duration": "4-6 months",
"side_effects": ["Dry skin", "Photosensitivity", "Elevated triglycerides"], "prescription_required": True},
{"name": "Clindamycin Lotion 1%", "type": "Topical Antibiotic (for secondary infection)",
"dosage": "Apply to affected areas", "frequency": "Twice daily", "duration": "2-4 weeks",
"side_effects": ["Dryness", "Contact dermatitis"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["Avoid heat and sweating (major triggers)", "Wear light, loose-fitting clothing",
"Keep skin cool with air conditioning", "Avoid ultraviolet light exposure"],
"diet": ["Stay well hydrated", "Anti-inflammatory foods", "Avoid foods that cause sweating"],
"precautions": ["Apply sunscreen SPF 50+", "Avoid trauma to skin",
"Prevent secondary infection with good hygiene"],
"when_to_see_doctor": ["Signs of bacterial or viral (herpes) superinfection",
"Condition significantly worsening"],
"home_remedies": ["Cool compresses for comfort", "Gentle cleansing with mild soap",
"Emollients/moisturizers to soften plaques"],
},
},
"Epidermolysis Bullosa Pruriginosa": {
"description": (
"Epidermolysis Bullosa Pruriginosa is a rare sub-type of dystrophic epidermolysis bullosa "
"with intensely pruritic plaques, lichenification, and scarring, predominantly on the limbs. "
"Results from mutations in the COL7A1 gene."
),
"severity_indicators": {
"Mild": "Localized pruritic plaques, minimal blistering",
"Moderate": "Multiple plaques, recurrent blisters, significant itching",
"Severe": "Widespread blistering, severe scarring, milia formation",
"Critical": "Extensive skin loss, secondary infection, contractures",
},
"medicines": [
{"name": "Clobetasol Propionate 0.05%", "type": "Potent Topical Corticosteroid",
"dosage": "Apply thin layer", "frequency": "Once or twice daily", "duration": "2-4 weeks",
"side_effects": ["Skin atrophy", "Stretch marks", "Telangiectasia"], "prescription_required": True},
{"name": "Gabapentin 300mg", "type": "Neuropathic Itch Agent", "dosage": "300mg",
"frequency": "Up to three times daily", "duration": "As prescribed",
"side_effects": ["Drowsiness", "Dizziness", "Weight gain"], "prescription_required": True},
{"name": "Doxycycline 100mg", "type": "Oral Antibiotic (for infection prophylaxis)",
"dosage": "100mg", "frequency": "Once or twice daily", "duration": "As directed",
"side_effects": ["Nausea", "Photosensitivity", "Esophageal irritation"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["Handle skin very gently to prevent blistering", "Use non-adhesive wound dressings",
"Wear protective soft clothing", "Seek specialist care at an EB center"],
"diet": ["High-protein diet to support wound healing", "Iron and zinc supplements as advised",
"Soft foods if oral mucosa is affected"],
"precautions": ["Never pop blisters without guidance", "Keep wounds covered",
"Monitor for signs of infection", "Genetic counseling for family planning"],
"when_to_see_doctor": ["Any signs of wound infection", "Rapidly worsening blisters",
"Difficulty eating (oral involvement)"],
"home_remedies": ["Gentle cool soaks for wound care", "Non-stick silicone wound dressings",
"Petroleum jelly (Vaseline) over wounds"],
},
},
"Hailey-Hailey Disease": {
"description": (
"Hailey-Hailey Disease (benign familial pemphigus) is a rare hereditary blistering skin disorder "
"causing painful erosions and blisters in skin folds (neck, armpits, groin). "
"Caused by mutations in the ATP2C1 gene. Flares triggered by heat, friction, infection."
),
"severity_indicators": {
"Mild": "Occasional small blisters or erosions in skin folds",
"Moderate": "Recurrent erosions with crusting and mild odor",
"Severe": "Extensive erosions, secondary infection, significant discomfort",
"Critical": "Widespread erosions, severe secondary bacterial/fungal infection",
},
"medicines": [
{"name": "Doxycycline 100mg + Nicotinamide 500mg", "type": "Oral Combination",
"dosage": "Standard doses", "frequency": "Twice daily", "duration": "As directed",
"side_effects": ["GI upset", "Photosensitivity", "Flushing"], "prescription_required": True},
{"name": "Ciclosporin 3-5 mg/kg", "type": "Oral Immunosuppressant",
"dosage": "3-5 mg/kg/day", "frequency": "Once or twice daily", "duration": "Maintenance",
"side_effects": ["Hypertension", "Nephrotoxicity", "Increased infection risk"], "prescription_required": True},
{"name": "Clotrimazole + Hydrocortisone Cream", "type": "Combination Topical",
"dosage": "Apply to affected area", "frequency": "Twice daily", "duration": "2-4 weeks",
"side_effects": ["Skin thinning", "Burning"], "prescription_required": False},
],
"recommendations": {
"lifestyle": ["Avoid heat, friction, and sweating", "Use air conditioning to stay cool",
"Wear loose, breathable fabrics", "Keep skin folds dry with absorbent powder"],
"diet": ["Anti-inflammatory diet", "Stay hydrated", "Avoid foods that trigger sweating"],
"precautions": ["Avoid occlusive dressings over erosions", "Keep intertriginous areas clean and dry",
"Monitor for fungal and bacterial superinfection"],
"when_to_see_doctor": ["Signs of secondary infection", "No response to topical treatments",
"Widespread involvement affecting quality of life"],
"home_remedies": ["Gentle cleansing of skin folds", "Cooling compresses", "Drying powders in skin folds"],
},
},
"Hemangioma": {
"description": (
"A hemangioma is a benign growth of blood vessels forming a bright red birthmark. "
"The most common benign tumor in infancy, typically harmless and often shrinks over time."
),
"severity_indicators": {
"Mild": "Small, superficial, stable hemangioma",
"Moderate": "Growing lesion, cosmetically concerning",
"Severe": "Ulcerated hemangioma, functional impairment (near eye/airway)",
"Critical": "Life-threatening involvement (airway blockage, high-output cardiac failure)",
},
"medicines": [
{"name": "Propranolol 1-3 mg/kg/day", "type": "Oral Beta-Blocker",
"dosage": "1-3 mg/kg/day divided", "frequency": "Twice or three times daily", "duration": "6-12 months",
"side_effects": ["Bradycardia", "Hypoglycemia", "Bronchospasm"], "prescription_required": True},
{"name": "Timolol 0.5% Gel", "type": "Topical Beta-Blocker",
"dosage": "1 drop to lesion surface", "frequency": "Twice daily", "duration": "6-12 months",
"side_effects": ["Local skin reactions", "Bradycardia (systemic absorption)"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["Monitor growth pattern with regular photos", "Protect from trauma to prevent bleeding",
"Seek specialist evaluation for periocular or airway lesions",
"Most regress spontaneously by age 7-10"],
"diet": ["No specific dietary changes required", "Maintain healthy general nutrition"],
"precautions": ["Avoid trauma to hemangioma", "Watch for ulceration (bleeding, pain)",
"Annual dermatologist review for large or complex lesions"],
"when_to_see_doctor": ["Located near eyes, nose, or mouth", "Rapid growth",
"Ulceration or bleeding", "Multiple hemangiomas"],
"home_remedies": ["Gentle wound care if ulcerated", "Protect with soft dressings",
"Cool compresses for comfort"],
},
},
"Impetigo": {
"description": (
"Impetigo is a highly contagious bacterial skin infection, most common in children. "
"It causes red sores that rupture, ooze for days, then form a yellow-brown crust. "
"Caused by Staphylococcus aureus or Streptococcus pyogenes."
),
"severity_indicators": {
"Mild": "Few small lesions, no systemic symptoms",
"Moderate": "Multiple lesions, spreading to other areas",
"Severe": "Widespread infection, bullous impetigo, lymphadenopathy",
"Critical": "Secondary complications (cellulitis, septicemia)",
},
"medicines": [
{"name": "Mupirocin Ointment 2%", "type": "Topical Antibiotic",
"dosage": "Apply to lesions", "frequency": "Three times daily", "duration": "5-7 days",
"side_effects": ["Local irritation", "Burning", "Itching"], "prescription_required": True},
{"name": "Flucloxacillin 250-500mg", "type": "Oral Antibiotic",
"dosage": "250-500mg", "frequency": "Four times daily (fasting)", "duration": "5-7 days",
"side_effects": ["GI upset", "Diarrhea", "Allergic reaction"], "prescription_required": True},
{"name": "Amoxicillin-Clavulanate 500mg", "type": "Oral Broad-Spectrum Antibiotic",
"dosage": "500mg", "frequency": "Three times daily", "duration": "7 days",
"side_effects": ["Diarrhea", "Nausea", "Rash"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["Keep lesions covered to prevent spreading", "Wash hands frequently",
"Do not share towels, clothing, or personal items",
"Child should stay home from school until 24-48h on antibiotics"],
"diet": ["Maintain good nutrition to support immune system", "Stay well hydrated"],
"precautions": ["Highly contagious β€” isolate from others", "Disinfect surfaces and bedding",
"Complete full course of antibiotics"],
"when_to_see_doctor": ["No improvement after 48-72h of treatment", "Fever or systemic illness",
"Spreading beyond initial area", "Blistering (bullous) form"],
"home_remedies": ["Soak crusts in warm water to gently remove",
"Gentle cleansing with antiseptic soap", "Keep area clean and dry"],
},
},
"Leishmaniasis": {
"description": (
"Leishmaniasis (Leishmanios) is a parasitic disease transmitted by sandfly bites. "
"Cutaneous leishmaniasis presents as painless ulcers at bite sites, often with a "
"'volcano crater' appearance with raised borders."
),
"severity_indicators": {
"Mild": "Single small, stable ulcer",
"Moderate": "Larger ulcer, satellite lesions, regional lymphadenopathy",
"Severe": "Multiple ulcers, disfiguring lesions, mucocutaneous involvement",
"Critical": "Visceral leishmaniasis with organ involvement",
},
"medicines": [
{"name": "Meglumine Antimoniate injection", "type": "Antiparasitic (systemic)",
"dosage": "20 mg/kg/day IM", "frequency": "Once daily IM injection", "duration": "20-28 days",
"side_effects": ["Pain at injection site", "Nausea", "Cardiotoxicity", "Hepatotoxicity"],
"prescription_required": True},
{"name": "Miltefosine 2.5 mg/kg", "type": "Oral Antiparasitic",
"dosage": "2.5 mg/kg/day", "frequency": "Once or twice daily", "duration": "28 days",
"side_effects": ["Vomiting", "Diarrhea", "Teratogenic - contraindicated in pregnancy"],
"prescription_required": True},
],
"recommendations": {
"lifestyle": ["Use insect repellent with DEET in endemic areas",
"Sleep under permethrin-treated bed nets",
"Wear long sleeves and pants at dusk/dawn",
"Apply wound care to ulcerative lesions"],
"diet": ["High-protein diet to support immune response and healing",
"Vitamin C and zinc for wound healing"],
"precautions": ["Report travel history to endemic regions to your doctor",
"Protect pets (dogs can be reservoir hosts)",
"Monitor for systemic symptoms (fever, weight loss, fatigue)"],
"when_to_see_doctor": ["Any non-healing ulcer after travel to endemic region",
"Development of fever, weight loss, fatigue",
"Mucosal lesions in nose or mouth"],
"home_remedies": ["Keep ulcers clean and covered", "Avoid secondary trauma to lesions",
"Requires medical treatment β€” no effective home cures"],
},
},
"Discoid Lupus Erythematosus": {
"description": (
"Discoid Lupus Erythematosus (DLE) is a chronic autoimmune skin condition causing "
"disc-shaped, scarring plaques on sun-exposed areas (face, scalp, ears). "
"Can cause permanent scarring and alopecia."
),
"severity_indicators": {
"Mild": "Few small, stable discoid lesions",
"Moderate": "Multiple plaques, active inflammation, early scarring",
"Severe": "Widespread plaques, significant scarring, scarring alopecia",
"Critical": "Extensive involvement with systemic progression",
},
"medicines": [
{"name": "Hydroxychloroquine 200-400mg", "type": "Antimalarial (Disease-Modifying)",
"dosage": "200-400mg daily", "frequency": "Once or twice daily with food", "duration": "Long-term",
"side_effects": ["Retinal toxicity (regular eye monitoring needed)", "GI upset", "Skin pigmentation"],
"prescription_required": True},
{"name": "Triamcinolone Acetonide intralesional", "type": "Intralesional Corticosteroid",
"dosage": "2.5-10 mg/mL", "frequency": "Every 4-6 weeks by specialist", "duration": "As needed",
"side_effects": ["Skin atrophy", "Hypopigmentation", "Fat necrosis"], "prescription_required": True},
{"name": "Mometasone Furoate Cream 0.1%", "type": "Potent Topical Corticosteroid",
"dosage": "Apply thin layer", "frequency": "Once daily", "duration": "4-8 weeks",
"side_effects": ["Skin atrophy", "Telangiectasia", "Striae"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["STRICT sun avoidance β€” primary trigger", "Use SPF 50+ broad-spectrum sunscreen daily",
"Wear UV-protective clothing (UPF 50+) and wide-brim hats",
"Avoid tanning beds", "Manage stress"],
"diet": ["Anti-inflammatory diet rich in omega-3s", "Vitamin D supplementation",
"Avoid alfalfa sprouts (may exacerbate lupus)"],
"precautions": ["Monitor for systemic lupus signs (joint pain, fatigue, fever)",
"Regular ophthalmology check-ups if on hydroxychloroquine",
"Annual blood tests (ANA, CBC, kidney function)"],
"when_to_see_doctor": ["Rapidly spreading lesions", "New systemic symptoms",
"No response to treatment after 3 months"],
"home_remedies": ["Consistent daily sunscreen application",
"Aloe vera for soothing non-active areas"],
},
},
"Molluscum Contagiosum": {
"description": (
"Molluscum Contagiosum is a common viral skin infection causing small, dome-shaped, "
"pearly-white bumps with a central dimple (umbilication). Caused by poxvirus MCV. "
"Usually self-limiting in immunocompetent individuals."
),
"severity_indicators": {
"Mild": "Few isolated lesions in one area",
"Moderate": "Multiple lesions, spreading to nearby areas",
"Severe": "Widespread lesions (>100), secondary eczematous reaction",
"Critical": "Extensive disease in immunocompromised individuals",
},
"medicines": [
{"name": "Imiquimod Cream 5%", "type": "Topical Immunomodulator",
"dosage": "Apply to each lesion", "frequency": "3 times per week at night", "duration": "Up to 16 weeks",
"side_effects": ["Skin redness", "Erosion", "Flaking"], "prescription_required": True},
{"name": "Cantharidin 0.7% solution", "type": "Blistering Agent (applied by clinician)",
"dosage": "Applied by dermatologist", "frequency": "Every 2-4 weeks in clinic", "duration": "Until clearance",
"side_effects": ["Blistering", "Scarring risk", "Pain"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["Avoid scratching or picking lesions to prevent spreading", "Cover lesions in public",
"Avoid sharing towels, swimwear, or personal items",
"Usually resolves on its own in 6-18 months"],
"diet": ["Maintain healthy immune function with balanced nutrition", "Vitamin C and zinc"],
"precautions": ["Very contagious via skin-to-skin contact", "Avoid sexual contact if genital lesions",
"Screen for other STIs if sexually transmitted"],
"when_to_see_doctor": ["Lesions near eyes", "Widespread, rapidly spreading lesions",
"Immunocompromised individuals"],
"home_remedies": ["Tea tree oil (diluted) applied carefully",
"Keeping skin moisturized around lesions"],
},
},
"Porokeratosis": {
"description": (
"Porokeratosis is a group of rare disorders of abnormal keratinization, presenting as "
"plaques with a distinct raised ridged border (cornoid lamella). "
"Exacerbated by sun exposure and has a small risk of malignant transformation."
),
"severity_indicators": {
"Mild": "Single, small, stable lesion",
"Moderate": "Multiple lesions, some inflammation",
"Severe": "Widespread lesions, significant cosmetic concern",
"Critical": "Signs of malignant transformation (ulceration, rapid growth)",
},
"medicines": [
{"name": "5-Fluorouracil Cream 5%", "type": "Topical Chemotherapy",
"dosage": "Apply thin layer", "frequency": "Once or twice daily", "duration": "2-4 weeks per course",
"side_effects": ["Significant skin inflammation", "Erosion", "Photosensitivity"],
"prescription_required": True},
{"name": "Imiquimod Cream 5%", "type": "Topical Immunomodulator",
"dosage": "Apply to lesions", "frequency": "3-5 times per week", "duration": "12-16 weeks",
"side_effects": ["Erythema", "Erosions", "Flu-like symptoms"], "prescription_required": True},
{"name": "Acitretin 25mg", "type": "Oral Retinoid (for widespread disease)",
"dosage": "25mg", "frequency": "Once daily", "duration": "Long-term",
"side_effects": ["Dry lips", "Hair loss", "Teratogenic"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["Strict sun protection β€” UV is primary trigger", "Apply SPF 50+ sunscreen daily",
"Wear UV-protective clothing", "Avoid tanning beds",
"Annual skin checks for malignant transformation"],
"diet": ["Antioxidant-rich diet for skin protection", "Vitamin D supplementation"],
"precautions": ["Monitor lesions for malignancy signs (ulceration, rapid growth, bleeding)",
"Annual dermatology review", "Photograph lesions to track changes"],
"when_to_see_doctor": ["Any lesion showing rapid growth, ulceration, or bleeding",
"New lesions appearing rapidly"],
"home_remedies": ["Emollients to soften scale", "Consistent daily sunscreen application"],
},
},
"Tinea Corporis (Ringworm)": {
"description": (
"Tinea Corporis (ringworm) is a superficial fungal infection caused by dermatophytes "
"(Trichophyton, Microsporum). Presents as a ring-shaped, scaly, red patch with central clearing "
"and a raised, well-defined border. Highly contagious."
),
"severity_indicators": {
"Mild": "One small ring-shaped patch",
"Moderate": "Multiple patches, moderate itching and inflammation",
"Severe": "Widespread infection, deep follicular involvement (Majocchi's granuloma)",
"Critical": "Deep fungal infection, secondary bacterial infection",
},
"medicines": [
{"name": "Clotrimazole Cream 1%", "type": "Topical Antifungal",
"dosage": "Apply thin layer", "frequency": "Twice daily", "duration": "2-4 weeks",
"side_effects": ["Skin irritation", "Burning", "Redness"], "prescription_required": False},
{"name": "Terbinafine Cream 1%", "type": "Topical Antifungal",
"dosage": "Apply to affected area and 2cm beyond", "frequency": "Once or twice daily", "duration": "1-2 weeks",
"side_effects": ["Itching", "Burning", "Dryness"], "prescription_required": False},
{"name": "Terbinafine 250mg oral", "type": "Oral Antifungal (for extensive disease)",
"dosage": "250mg", "frequency": "Once daily", "duration": "2-4 weeks",
"side_effects": ["GI upset", "Taste disturbance", "Hepatotoxicity (rare)"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["Keep skin dry and clean", "Do not share personal items",
"Shower immediately after sports or sweating", "Wear loose, breathable clothing",
"Treat affected pets"],
"diet": ["Reduce sugar intake", "Eat probiotic-rich foods (yogurt, kefir)",
"Garlic β€” natural antifungal properties"],
"precautions": ["Avoid sharing clothing, towels, or bedding", "Disinfect shared surfaces",
"Wash bed sheets in hot water", "Complete full treatment course"],
"when_to_see_doctor": ["No improvement after 2 weeks of OTC treatment",
"Infection spreads to scalp or nails",
"Signs of secondary bacterial infection"],
"home_remedies": ["Tea tree oil (diluted with carrier oil)", "Apple cider vinegar compress",
"Coconut oil application"],
},
},
"Tungiasis": {
"description": (
"Tungiasis is a parasitic skin disease caused by the female sand flea (Tunga penetrans), "
"endemic in tropical regions. The flea burrows into skin (usually feet) causing intensely "
"painful, inflammatory lesions that can lead to secondary bacterial infection and tetanus."
),
"severity_indicators": {
"Mild": "1-2 lesions, mild pain and itching",
"Moderate": "Several lesions, moderate inflammation and pain",
"Severe": "Numerous lesions, secondary infection, impaired mobility",
"Critical": "Superinfection with tetanus or necrotizing fasciitis risk",
},
"medicines": [
{"name": "Ivermectin 200mcg/kg", "type": "Oral Antiparasitic",
"dosage": "200 mcg/kg", "frequency": "Single dose or repeat in 2 weeks",
"duration": "Single to 2-week course",
"side_effects": ["Dizziness", "Nausea"], "prescription_required": True},
{"name": "Thiabendazole 10% cream", "type": "Topical Antiparasitic",
"dosage": "Apply to lesion", "frequency": "Twice daily", "duration": "5-7 days",
"side_effects": ["Local irritation"], "prescription_required": True},
{"name": "Amoxicillin-Clavulanate 500mg", "type": "Oral Antibiotic (for secondary infection)",
"dosage": "500mg", "frequency": "Three times daily", "duration": "7 days",
"side_effects": ["Diarrhea", "Nausea"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["Wear closed-toe shoes in endemic areas",
"Avoid walking barefoot outdoors in endemic regions",
"Inspect feet daily when in endemic areas",
"Ensure tetanus vaccination is up to date",
"Seek removal of embedded flea by a healthcare provider"],
"diet": ["Maintain good nutrition to support immune function and wound healing"],
"precautions": ["Do NOT attempt to remove flea with non-sterile instruments",
"Ensure sterile extraction by healthcare professional",
"Monitor for signs of tetanus (jaw stiffness, muscle spasms)"],
"when_to_see_doctor": ["Multiple lesions or rapid spread",
"Signs of secondary infection (pus, redness, fever)",
"Any jaw stiffness or muscle rigidity (tetanus emergency)"],
"home_remedies": ["Do NOT attempt home removal", "Keep feet clean and wounds covered",
"Coconut oil or Vaseline to soften skin around lesion"],
},
},
"Basal Cell Carcinoma": {
"description": (
"Basal Cell Carcinoma (BCC) is the most common type of skin cancer, developing in basal cells. "
"Appears as a pearly, waxy bump or flat flesh-colored scar-like lesion on sun-exposed areas. "
"Rarely metastasizes but causes local tissue destruction if untreated."
),
"severity_indicators": {
"Mild": "Small, superficial BCC, well-defined borders",
"Moderate": "Nodular BCC, pearly border, local invasion",
"Severe": "Ulcerative or infiltrative BCC, large size, recurrence",
"Critical": "Locally advanced, perineural invasion, metastatic (rare)",
},
"medicines": [
{"name": "Imiquimod Cream 5%", "type": "Topical Immunotherapy (superficial BCC only)",
"dosage": "Apply to lesion and 1cm margin", "frequency": "5 days/week", "duration": "6 weeks",
"side_effects": ["Severe skin inflammation", "Ulceration", "Flu-like symptoms"],
"prescription_required": True},
{"name": "Vismodegib 150mg", "type": "Oral Hedgehog Pathway Inhibitor (advanced BCC)",
"dosage": "150mg", "frequency": "Once daily", "duration": "As directed by oncologist",
"side_effects": ["Muscle cramps", "Hair loss", "Taste changes", "Fatigue", "Teratogenic"],
"prescription_required": True},
{"name": "5-Fluorouracil Cream 5%", "type": "Topical Chemotherapy (superficial BCC only)",
"dosage": "Apply twice daily", "frequency": "Twice daily", "duration": "3-6 weeks",
"side_effects": ["Severe inflammation", "Erosion", "Photosensitivity"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["🚨 SEEK DERMATOLOGIST/SURGEON EVALUATION β€” Excision is standard treatment",
"Use SPF 50+ broad-spectrum sunscreen daily",
"Wear UV-protective clothing and wide-brim hat",
"Avoid tanning beds completely", "Annual full-body skin checks"],
"diet": ["Antioxidant-rich diet", "Selenium-rich foods", "Green tea polyphenols"],
"precautions": ["🚨 Do NOT delay treatment β€” local destruction worsens without treatment",
"Monitor surgical scars for recurrence",
"Protect all scar tissue from sun exposure with SPF 50+"],
"when_to_see_doctor": ["🚨 IMMEDIATELY β€” BCC requires diagnosis and surgical excision",
"Any pearly bump that bleeds easily or fails to heal"],
"home_remedies": ["⚠️ No effective home remedies β€” medical treatment is mandatory",
"Apply sunscreen religiously to protect surrounding skin"],
},
},
"Lichen Planus": {
"description": (
"Lichen Planus is an inflammatory autoimmune condition affecting skin, hair, nails, and mucous membranes. "
"Presents with flat-topped, purple, polygonal papules with fine white lines (Wickham's striae). "
"Often intensely pruritic."
),
"severity_indicators": {
"Mild": "Few papules, manageable itching",
"Moderate": "Multiple papules, significant pruritus, oral involvement",
"Severe": "Widespread plaques, bullous lesions, erosive oral/genital disease",
"Critical": "Extensive erosive mucosal lichen planus, esophageal involvement",
},
"medicines": [
{"name": "Clobetasol Propionate 0.05%", "type": "Potent Topical Corticosteroid",
"dosage": "Apply thin layer", "frequency": "Once or twice daily", "duration": "4-8 weeks",
"side_effects": ["Skin atrophy", "Striae", "Telangiectasia"], "prescription_required": True},
{"name": "Prednisolone 30-40mg", "type": "Oral Corticosteroid (for severe/widespread disease)",
"dosage": "30-40mg", "frequency": "Once daily (morning)", "duration": "Tapering course over 4-6 weeks",
"side_effects": ["Weight gain", "Glucose elevation", "Mood changes", "Osteoporosis risk"],
"prescription_required": True},
{"name": "Hydroxychloroquine 200-400mg", "type": "Antimalarial (for chronic disease)",
"dosage": "200-400mg", "frequency": "Once daily", "duration": "Long-term",
"side_effects": ["Retinal toxicity (eye monitoring required)", "GI upset"], "prescription_required": True},
],
"recommendations": {
"lifestyle": ["Manage stress (known trigger for flares)", "Avoid skin trauma (Koebner phenomenon)",
"Practice good oral hygiene for oral lesions", "Moisturize regularly to reduce itch"],
"diet": ["Avoid acidic, spicy, or hard foods if oral involvement",
"Soft diet for painful oral lesions", "Anti-inflammatory foods"],
"precautions": ["Hepatitis C testing recommended (association with lichen planus)",
"Monitor oral lesions for malignant transformation (rare)",
"Regular dental and dermatology follow-ups"],
"when_to_see_doctor": ["No improvement after 4-6 weeks of topical treatment",
"Erosive oral or genital lesions", "Any oral lesion that changes rapidly"],
"home_remedies": ["Aloe vera gel for soothing", "Oatmeal baths for itch relief",
"Cold compresses to reduce inflamed areas"],
},
},
"Nevus (Mole)": {
"description": (
"A nevus (mole) is a common benign growth of melanocytes. Most are harmless and stable, "
"but careful monitoring is essential. ABCDE criteria help identify potentially malignant change: "
"Asymmetry, Border irregularity, Color variation, Diameter >6mm, Evolving."
),
"severity_indicators": {
"Mild": "Small, symmetric, uniform color, stable mole",
"Moderate": "Slightly irregular border or color, needs monitoring",
"Severe": "Multiple atypical features (dysplastic nevus), biopsy recommended",
"Critical": "ABCDE criteria met β€” suspect melanoma, biopsy urgently required",
},
"medicines": [
{"name": "No medication required for benign stable nevi", "type": "Monitoring only",
"dosage": "N/A", "frequency": "N/A", "duration": "Annual review",
"side_effects": [], "prescription_required": False},
],
"recommendations": {
"lifestyle": ["Perform monthly self-examination of all moles",
"Use SPF 50+ sunscreen on all moles",
"Photograph moles regularly with dates to track changes",
"Annual full-body dermatologist review",
"Avoid tanning beds β€” significantly increases melanoma risk"],
"diet": ["Antioxidant-rich diet for general skin health", "Vitamin D through safe dietary sources"],
"precautions": ["Monitor ABCDE: Asymmetry, Border, Color, Diameter, Evolving",
"Never attempt to remove moles yourself"],
"when_to_see_doctor": ["Any mole that changes in size, shape, or color",
"Mole that bleeds, itches, or becomes raised",
"New mole appearing in an adult over 30"],
"home_remedies": ["⚠️ DO NOT attempt home removal of moles",
"Daily sunscreen application is the key protective measure"],
},
},
"Normal Skin": {
"description": (
"The analyzed area appears to show normal, healthy skin without significant pathological findings. "
"No disease condition has been detected. Continue with good general skincare practices."
),
"severity_indicators": {
"Mild": "Healthy skin β€” no concerning findings",
"Moderate": "N/A",
"Severe": "N/A",
"Critical": "N/A",
},
"medicines": [],
"recommendations": {
"lifestyle": ["Cleanse skin gently twice daily", "Apply broad-spectrum SPF 30+ sunscreen daily",
"Stay hydrated (8+ glasses of water per day)", "Get adequate sleep (7-9 hours)"],
"diet": ["Eat a balanced diet rich in fruits, vegetables, and whole grains",
"Include omega-3 fatty acids (fish, flaxseed, walnuts)",
"Foods rich in vitamins A, C, E for skin health"],
"precautions": ["Perform monthly skin self-examinations",
"Protect from sun exposure (main cause of premature aging)",
"Avoid smoking (damages collagen and accelerates aging)"],
"when_to_see_doctor": ["If any new lesion, mole change, or skin abnormality appears",
"Annual preventive dermatology check-up recommended"],
"home_remedies": ["Consistent moisturizer application after showering", "Aloe vera for soothing dry skin",
"Gentle exfoliation 1-2 times per week"],
},
},
# ── Legacy ─────────────────────────────────────────────────────────────
"Ringworm": {
"description": "Ringworm (tinea corporis) is a fungal infection causing ring-shaped, scaly red patches.",
"severity_indicators": {"Mild": "One small ring-shaped patch", "Moderate": "Multiple patches",
"Severe": "Widespread", "Critical": "Deep infection"},
"medicines": [
{"name": "Clotrimazole Cream 1%", "type": "Topical Antifungal", "dosage": "Apply thin layer",
"frequency": "Twice daily", "duration": "2-4 weeks",
"side_effects": ["Skin irritation", "Burning"], "prescription_required": False},
],
"recommendations": {
"lifestyle": ["Keep skin dry and clean", "Do not share towels or clothing"],
"diet": ["Reduce sugar intake", "Eat probiotic-rich foods"],
"precautions": ["Complete full course of treatment", "Wash bedding in hot water"],
"when_to_see_doctor": ["No improvement after 2 weeks"],
"home_remedies": ["Tea tree oil (diluted)", "Apple cider vinegar compress"],
},
},
"Unknown": {
"description": (
"The skin condition could not be clearly identified. "
"Please consult a dermatologist for proper evaluation."
),
"severity_indicators": {
"Mild": "Minor skin change, low concern",
"Moderate": "Noticeable skin change, warrants attention",
"Severe": "Significant skin change, medical attention recommended",
"Critical": "Seek immediate medical care",
},
"medicines": [],
"recommendations": {
"lifestyle": ["Maintain good general skin hygiene", "Keep skin moisturized", "Stay hydrated"],
"diet": ["Eat a balanced, nutritious diet", "Include skin-healthy nutrients (vitamins A, C, E)"],
"precautions": ["⚠️ Please consult a qualified dermatologist for proper diagnosis",
"Avoid self-medicating"],
"when_to_see_doctor": ["As soon as possible for proper diagnosis"],
"home_remedies": ["Keep area clean and moisturized", "Avoid irritating the area"],
},
},
}
# Legacy alias
DISEASE_DATABASE = DISEASE_KB
# Lookup helpers
def _normalize(name: str) -> str:
"""Lowercase + strip for fuzzy matching."""
return name.lower().strip().replace("-", " ").replace("_", " ")
_NORMALIZED_MAP = {_normalize(k): k for k in DISEASE_KB}
def get_disease_info(disease_name: str) -> dict:
"""
Retrieve disease information. Tries exact match first, then
case-insensitive / hyphen-normalized match, then falls back to 'Unknown'.
"""
if disease_name in DISEASE_KB:
return DISEASE_KB[disease_name]
norm = _normalize(disease_name)
key = _NORMALIZED_MAP.get(norm)
if key:
return DISEASE_KB[key]
return DISEASE_KB["Unknown"]
def get_all_disease_names() -> list:
"""Return all disease names in the knowledge base."""
return list(DISEASE_KB.keys())