import React, { useState, useMemo } from 'react'; import { Search, ChevronLeft, AlertCircle, Pill, Stethoscope, Activity, Heart, Droplet, ShieldAlert, Bone, Info, ShieldCheck, Book, Moon, Wand2, Loader2, Send, Zap } from 'lucide-react'; // --- MEDICAL DATABASE (Unchanged) --- const conditionsDB = [ { id: 'leukemia_lymphoma', category: 'Hematologic', icon: Droplet, color: 'text-red-500', bgColor: 'bg-red-100', name: 'Leukemia & Lymphoma', riskLevel: 'High', management: [ 'Request recent Complete Blood Count (CBC) before any invasive procedure.', 'Defer elective surgical treatment if ANC (Absolute Neutrophil Count) < 1,000/mm³ (Normal: 1,500 - 8,000/mm³) or Platelets < 50,000/mm³.', 'Strict aseptic technique is mandatory.', 'Monitor for oral manifestations: gingival enlargement, ulcerations, opportunistic infections (candidiasis).' ], consultation: 'Mandatory consult with hematologist/oncologist for clearance. Inquire about prophylactic platelet transfusions if major surgery is planned.', medicationsToAvoid: [ { drug: 'NSAIDs (Aspirin, Ibuprofen, Ketorolac)', reason: 'Strictly contraindicated. They inhibit platelet aggregation. In patients with chemo-induced or disease-related thrombocytopenia, this dramatically increases the risk of uncontrollable hemorrhage and GI bleeding.' } ], sedation: 'Standard protocols apply. Avoid intramuscular (IM) routes for sedatives if platelets are low (risk of deep muscle hematoma). IV or Inhalation is preferred.', prescriptions: { analgesics: 'Paracetamol (Acetaminophen) is the drug of choice. Weak opioids (Tramadol) or Paracetamol/Codeine combinations for severe pain.', antibiotics: 'Prophylactic antibiotics are highly recommended if ANC is low. Amoxicillin 2g (or Clindamycin 600mg / Azithromycin 500mg if allergic) 1 hour prior. Post-op broad-spectrum may be required.', others: 'Chlorhexidine 0.12% mouthwash bid peri-operatively. Antifungals (Nystatin/Fluconazole) if thrush is present.' } }, { id: 'hemophilia', category: 'Hematologic', icon: Droplet, color: 'text-red-600', bgColor: 'bg-red-100', name: 'Hemophilia & Bleeding Disorders', riskLevel: 'High', management: [ 'Factor replacement therapy is usually required before block anesthesia or surgery.', 'Avoid mandibular block injections if possible without factor replacement (risk of dissecting hematoma). Infiltrations are preferred.', 'Use local hemostatic measures: Gelfoam, Surgicel, bone wax, and primary closure.', 'Instruct patient on soft diet and avoiding trauma to surgical site.' ], consultation: 'Consult hematologist to determine required factor replacement levels (usually aiming for 50-100% factor activity for major surgery).', medicationsToAvoid: [ { drug: 'NSAIDs & Aspirin', reason: 'Irreversibly (Aspirin) or reversibly (Ibuprofen) inhibit COX enzymes, suppressing Thromboxane A2 and platelet function. This destroys the primary hemostatic plug formation in patients who already lack secondary hemostasis (coagulation cascade).' } ], sedation: 'Strictly avoid intramuscular (IM) injections for sedation (e.g., IM Midazolam or Ketamine). Inhalation (Nitrous Oxide) or careful IV sedation is preferred.', prescriptions: { analgesics: 'Paracetamol (Acetaminophen). COX-2 inhibitors (Celecoxib) do not affect platelets and are sometimes used for severe pain, BUT must be weighed against their risk of cardiovascular thrombosis. Standard NSAIDs must be avoided.', antibiotics: 'Standard protocols apply. No specific contraindication unless allergic.', others: 'Tranexamic acid (TXA) 5% mouthwash (10ml rinse for 2 mins, qid for 7 days). Oral TXA (e.g., 1g tid) may be prescribed adjunctively.' } }, { id: 'renal_dialysis', category: 'Renal', icon: Activity, color: 'text-blue-500', bgColor: 'bg-blue-100', name: 'End-Stage Renal Disease (Dialysis)', riskLevel: 'Moderate to High', management: [ 'Schedule dental/surgical treatment on the DAY AFTER dialysis. This ensures heparin has worn off and fluid/electrolyte balance is optimal.', 'Do not take blood pressure on the arm with an AV fistula or shunt.', 'Assess for anemia, prolonged bleeding, and secondary hyperparathyroidism.' ], consultation: 'Consult nephrologist regarding baseline kidney function, exact dialysis schedule, and need for infective endocarditis (IE) prophylaxis for the AV fistula.', medicationsToAvoid: [ { drug: 'NSAIDs', reason: 'They block vasodilatory renal prostaglandins, causing constriction of the afferent arteriole, which drastically reduces GFR and accelerates the complete loss of any remaining kidney function.' }, { drug: 'Tetracyclines (except Doxycycline)', reason: 'Highly renally cleared. Will accumulate to toxic levels and worsen uremia.' } ], sedation: 'Dose-adjust renally cleared sedatives. Midazolam has a markedly prolonged effect. Propofol is hepatically cleared and generally safe for IV sedation.', prescriptions: { analgesics: 'Paracetamol is safe (metabolized by liver). Tramadol requires dose reduction (increased half-life). Avoid NSAIDs.', antibiotics: 'Dosage adjustments required. Amoxicillin: increase interval to every 12-24h instead of 8h. Clindamycin requires NO dose adjustment (hepatically cleared - excellent choice).', others: 'Check if nephrologist recommends IE prophylaxis for the AV graft/fistula before invasive procedures.' } }, { id: 'hepatic_cirrhosis', category: 'Hepatic', icon: Activity, color: 'text-yellow-600', bgColor: 'bg-yellow-100', name: 'Hepatic Disorder / Cirrhosis', riskLevel: 'High', management: [ 'Screen for coagulopathies (request PT/INR and Platelet count). Liver produces clotting factors.', 'Assess for portal hypertension and risk of excessive bleeding.', 'Use local anesthetics with caution (Amide LAs are metabolized in the liver). Articaine is preferred as it is largely metabolized in blood plasma.' ], consultation: 'Consult hepatologist/internist to assess Child-Pugh score. If severe liver disease, hospital setting may be required for surgery.', medicationsToAvoid: [ { drug: 'NSAIDs', reason: 'Patients with portal hypertension have a profound risk of fatal gastrointestinal variceal bleeding. NSAIDs damage the gastric mucosa and inhibit platelets, creating a perfect storm for GI hemorrhage.' }, { drug: 'Erythromycin & Metronidazole', reason: 'Heavily hepatically metabolized. Can accumulate and cause systemic toxicity in a failing liver.' }, { drug: 'High-dose Paracetamol', reason: 'Metabolism uses glutathione. In severe cirrhosis, glutathione is depleted, allowing toxic metabolites (NAPQI) to cause acute liver necrosis.' } ], sedation: 'Hepatically metabolized sedatives (Benzodiazepines, Opioids) will have profoundly prolonged effects. Heavily reduce doses or avoid entirely. Propofol is preferred due to rapid clearance.', prescriptions: { analgesics: 'Paracetamol can be used in MILD liver disease at reduced doses (max 2g/day). Ibuprofen can be used short-term if no portal hypertension, but generally avoid NSAIDs. Tramadol at reduced doses.', antibiotics: 'Penicillins and Cephalosporins are generally safe. Avoid Metronidazole and Tetracyclines.', others: 'Vitamin K supplementation pre-op may be advised by the physician if PT is prolonged.' } }, { id: 'hyperthyroidism', category: 'Endocrine', icon: Activity, color: 'text-orange-500', bgColor: 'bg-orange-100', name: 'Hyperthyroidism (Thyrotoxicosis)', riskLevel: 'Moderate', management: [ 'Defer elective surgery if uncontrolled (risk of life-threatening Thyrotoxic Crisis / Thyroid Storm).', 'Recognize signs of storm: extreme tachycardia, fever, sweating, severe agitation.', 'Manage stress effectively to avoid triggering a crisis.' ], consultation: 'Consult endocrinologist to ensure patient is euthyroid before elective procedures.', medicationsToAvoid: [ { drug: 'Epinephrine (High Dose)', reason: 'Thyrotoxic patients are hypersensitive to catecholamines. Exogenous epinephrine can precipitate a thyroid storm, leading to severe tachycardia, arrhythmias, and cardiovascular collapse.' }, { drug: 'Aspirin', reason: 'Can displace thyroid hormones (T3/T4) from their plasma binding proteins, artificially spiking free active hormone levels in the blood.' } ], sedation: 'Anxiolysis is highly beneficial to prevent stress-induced thyroid storm. Avoid Ketamine or anticholinergics (like Atropine) as they stimulate the sympathetic nervous system.', prescriptions: { analgesics: 'Standard protocols (NSAIDs, Paracetamol) are safe. Avoid Aspirin in severe cases as it can displace thyroid hormones from binding proteins.', antibiotics: 'Standard protocols apply. Monitor for agranulocytosis if patient is taking anti-thyroid drugs (PTU, Methimazole).', others: 'Stress-reduction protocols.' } }, { id: 'hypothyroidism', category: 'Endocrine', icon: Activity, color: 'text-teal-600', bgColor: 'bg-teal-100', name: 'Hypothyroidism', riskLevel: 'Low', management: [ 'Generally safe for routine procedures if well-controlled on levothyroxine.', 'Watch for signs of myxedema coma in uncontrolled patients (bradycardia, hypothermia, severe hypotension).' ], consultation: 'Consult if patient exhibits signs of severe uncontrolled hypothyroidism or non-compliance with medications.', medicationsToAvoid: [ { drug: 'CNS Depressants (Opioids, Sedatives)', reason: 'Decreased metabolic rate leads to slow drug clearance. Patients are highly sensitive and can easily slip into severe, prolonged respiratory depression or myxedema coma.' } ], sedation: 'Patients are exceptionally sensitive to central nervous system (CNS) depressants. Reduce standard doses of all anxiolytics and IV sedatives by at least 50%.', prescriptions: { analgesics: 'NSAIDs and Paracetamol are safe. Reduce doses of any opioid analgesics by 50%.', antibiotics: 'Standard protocols apply.', others: 'None specific.' } }, { id: 'chemotherapy', category: 'Oncology', icon: ShieldCheck, color: 'text-purple-600', bgColor: 'bg-purple-100', name: 'Active Chemotherapy / Radiotherapy', riskLevel: 'High', management: [ 'Ideally, complete all required oral surgery at least 2-3 weeks BEFORE starting chemo/radiation.', 'During active chemo: Defer elective procedures. Treat emergencies only with aggressive antibiotic coverage.', 'Post-Chemotherapy: Defer elective surgery until at least 3-4 weeks after the final cycle. Proceed only after verifying hematological recovery (ANC > 1,500/mm³ and Platelets > 100,000/mm³) and obtaining oncologist clearance.', 'Post-Radiation (Head/Neck): Extreme risk of Osteoradionecrosis (ORN). Avoid extractions in irradiated bone at all costs. Endodontics is preferred.' ], consultation: 'Mandatory consult with oncologist. Request CBC with differential to check ANC and platelets before any emergency intervention.', medicationsToAvoid: [ { drug: 'NSAIDs & Aspirin', reason: 'High risk of hemorrhage during chemo-induced thrombocytopenic phases. Additionally, NSAIDs can mask fever, which is often the only sign of a life-threatening neutropenic sepsis.' } ], sedation: 'Standard sedation protocols apply. Ensure strict asepsis for IV access if the patient is neutropenic (low WBCs).', prescriptions: { analgesics: 'Paracetamol. Avoid NSAIDs during thrombocytopenic phases.', antibiotics: 'Aggressive prophylaxis for any emergency surgical intervention during immunosuppression (e.g., Amoxicillin-Clavulanate or Clindamycin).', others: 'Bland mouthwashes, Chlorhexidine (alcohol-free), topical anesthetics for mucositis.' } }, { id: 'anticoagulants', category: 'Cardiovascular', icon: Heart, color: 'text-rose-500', bgColor: 'bg-rose-100', name: 'Anticoagulant Therapy (Warfarin, DOACs)', riskLevel: 'Moderate', management: [ 'For Warfarin: Obtain INR within 24-48 hours of surgery. Safe to proceed with simple extractions if INR ≤ 3.0 (some guidelines say up to 4.0).', 'DO NOT stop anticoagulants for routine dental surgery without physician consent (risk of stroke/thrombosis is higher than bleeding risk).', 'For DOACs (Apixaban, Rivaroxaban): Usually no alteration needed for minor surgery. For major surgery, defer dose on morning of surgery.', 'Emphasize local hemostatic measures (sutures, sponges, TXA).' ], consultation: 'Consult cardiologist if patient is on multiple blood thinners, has a history of severe bleeding, or requires major maxillofacial surgery.', medicationsToAvoid: [ { drug: 'NSAIDs', reason: 'Causes additive bleeding via platelet inhibition, and can competitively displace Warfarin from plasma proteins, causing a sudden and dangerous spike in INR.' }, { drug: 'Metronidazole & Erythromycin', reason: 'Strongly inhibits hepatic CYP450 enzymes (specifically CYP2C9). This halts the metabolism of Warfarin, causing massive drug accumulation and severe risk of spontaneous hemorrhage.' } ], sedation: 'Avoid intramuscular (IM) routes due to the extreme risk of deep muscle hematoma. Nitrous Oxide, oral, and carefully established IV routes are safe.', prescriptions: { analgesics: 'Paracetamol is the safest choice. Celecoxib (COX-2) avoids platelet inhibition but must be used with extreme caution in this population due to the inherent risk of cardiovascular thrombosis. Avoid standard NSAIDs.', antibiotics: 'Amoxicillin, Clindamycin are safe. If Metronidazole or Erythromycin is absolutely necessary, Warfarin dose must be adjusted by physician.', others: 'Tranexamic Acid (TXA) mouthwash is highly recommended post-op.' } }, { id: 'diabetes', category: 'Endocrine', icon: Activity, color: 'text-indigo-500', bgColor: 'bg-indigo-100', name: 'Diabetes Mellitus', riskLevel: 'Moderate', management: [ 'Schedule early morning appointments to minimize fasting stress and align with endogenous cortisol.', 'Ensure patient has eaten normal meals and taken routine insulin/medications.', 'Check pre-op Blood Glucose. Defer elective surgery if BG < 70 mg/dL (hypoglycemia risk) or > 200-250 mg/dL (poor healing/infection risk).', 'Keep oral glucose/juice readily available in clinic.' ], consultation: 'Consult endocrinologist/PCP if HbA1c > 8.0% or patient has a history of frequent hypoglycemic episodes.', medicationsToAvoid: [ { drug: 'Systemic Corticosteroids', reason: 'Corticosteroids potently induce gluconeogenesis and cause peripheral insulin resistance, reliably triggering massive, difficult-to-control spikes in blood glucose levels.' } ], sedation: 'Use light conscious sedation (Nitrous oxide) to ensure rapid recovery and quick return to normal diet/insulin schedule. Avoid prolonged deep sedation that disrupts feeding.', prescriptions: { analgesics: 'NSAIDs and Paracetamol are safe. Be cautious with NSAIDs if patient has diabetic nephropathy.', antibiotics: 'Routine procedures do not require prophylaxis. For invasive surgery or if poorly controlled, consider prophylaxis (Amoxicillin or Clindamycin) due to impaired immune response.', others: 'Maintain strict post-op follow-up due to delayed healing.' } }, { id: 'bisphosphonates', category: 'Bone & Joint', icon: Bone, color: 'text-slate-600', bgColor: 'bg-slate-200', name: 'Patients on Bisphosphonates/Antiresorptives', riskLevel: 'Moderate to High', management: [ 'Assess risk for Medication-Related Osteonecrosis of the Jaw (MRONJ).', 'IV Bisphosphonates (Zometa, Aredia) for cancer = High Risk. Avoid extractions if possible. Use endodontics.', 'Oral Bisphosphonates (Alendronate) for osteoporosis = Lower Risk. Proceed with caution.', 'Ensure primary closure and meticulous surgical technique if extraction is unavoidable.' ], consultation: 'Consult oncologist/endocrinologist regarding possibility of a "drug holiday" (controversial, requires physician approval) if taking oral meds > 4 years.', medicationsToAvoid: [ { drug: 'Corticosteroids', reason: 'Concomitant use with bisphosphonates exponentially increases the risk of developing MRONJ by further suppressing immune function and bone remodeling capability.' } ], sedation: 'Standard sedation protocols apply. No specific contraindications based on this medication class.', prescriptions: { analgesics: 'Standard protocols (NSAIDs, Paracetamol) apply.', antibiotics: 'Post-op antibiotic coverage (Amoxicillin or Clindamycin) for 7-14 days is frequently recommended following extractions to prevent secondary infection of exposed bone.', others: 'Pre- and post-op Chlorhexidine 0.12% mouthwash until mucosal healing is complete.' } }, { id: 'hypertension', category: 'Cardiovascular', icon: Heart, color: 'text-rose-600', bgColor: 'bg-rose-100', name: 'Hypertension', riskLevel: 'Moderate', management: [ 'Measure BP before the procedure. Defer elective surgery if BP is > 180/110 mmHg.', 'Schedule morning appointments to minimize anxiety.', 'Ensure profound local anesthesia to prevent endogenous catecholamine release from pain.', 'Monitor for orthostatic hypotension when moving the patient out of the chair.' ], consultation: 'Consult PCP or cardiologist if BP is consistently elevated (uncontrolled) or newly discovered.', medicationsToAvoid: [ { drug: 'Epinephrine Retraction Cord', reason: 'Contains highly concentrated epinephrine which can be absorbed systemically through the gingival sulcus, causing a sudden and severe hypertensive crisis.' }, { drug: 'Long-term NSAIDs (>5 days)', reason: 'They promote renal sodium and water retention by blocking prostaglandins, directly antagonizing the effects of anti-hypertensive medications (ACE inhibitors, Diuretics).' } ], sedation: 'Anxiolysis (Nitrous Oxide or oral Benzodiazepines) is highly recommended to mitigate stress-induced catecholamine release and dramatic BP spikes.', prescriptions: { analgesics: 'Paracetamol is preferred. Short-term NSAIDs (< 3 days) are generally acceptable if necessary.', antibiotics: 'Standard protocols apply.', others: 'Consider pre-operative anxiolytics (e.g., Diazepam) for highly anxious patients.' } }, { id: 'ischemic_heart_disease', category: 'Cardiovascular', icon: Heart, color: 'text-red-700', bgColor: 'bg-red-100', name: 'Ischemic Heart Disease (MI / Angina)', riskLevel: 'High', management: [ 'Defer elective surgery for at least 60 days (up to 6 months in complicated cases) following a Myocardial Infarction.', 'Have patient bring their Nitroglycerin spray/tablets. Place on bracket table during the procedure.', 'Provide supplemental oxygen if indicated or if the patient experiences chest discomfort.', 'Limit procedure duration to minimize stress.' ], consultation: 'Consult cardiologist to verify stent status, confirm clearance, and manage dual anti-platelet therapy (DAPT) protocols.', medicationsToAvoid: [ { drug: 'COX-2 Selective NSAIDs (Celecoxib)', reason: 'They selectively inhibit cardioprotective prostacyclin (a vasodilator) without inhibiting thromboxane (a vasoconstrictor/platelet aggregator). This shifts the body toward a pro-thrombotic state, highly increasing the risk of recurrent MI or stroke.' }, { drug: 'Excessive Epinephrine', reason: 'Increases heart rate and contractility (via Beta-1 receptors), dramatically increasing myocardial oxygen demand, which can trigger cardiac ischemia/angina.' } ], sedation: 'Nitrous Oxide is excellent as it provides anxiolysis and supplemental oxygen (reduces cardiac workload). Deep IV sedation requires caution and should ideally be managed by an anesthesiologist.', prescriptions: { analgesics: 'Paracetamol is the drug of choice. If NSAIDs are absolutely required, Naproxen has the lowest cardiovascular risk profile.', antibiotics: 'Standard protocols apply.', others: 'Ensure profound anesthesia.' } }, { id: 'infective_endocarditis', category: 'Cardiovascular', icon: ShieldCheck, color: 'text-pink-600', bgColor: 'bg-pink-100', name: 'Infective Endocarditis Risk', riskLevel: 'High', management: [ 'Identify high-risk conditions requiring prophylaxis: prosthetic cardiac valves, previous IE, congenital heart disease (unrepaired cyanotic, repaired with prosthetic material within 6 mos, or repaired with residual defects), and cardiac transplant with valvulopathy.', 'Antibiotic prophylaxis is required for all dental procedures that involve manipulation of gingival tissue, the periapical region of teeth, or perforation of the oral mucosa.' ], consultation: 'Consult cardiologist to confirm if the patient meets the latest AHA guidelines for antibiotic prophylaxis.', medicationsToAvoid: [ { drug: 'Specific Antibiotics (if allergic)', reason: 'No strict drug class contraindications exist for the heart condition itself, but vigilance regarding penicillin/cephalosporin allergies is crucial when prescribing AHA prophylactic regimens.' } ], sedation: 'Standard sedation protocols apply. Strictly adhere to aseptic technique if establishing IV access to prevent hematogenous spread of bacteria.', prescriptions: { analgesics: 'Standard protocols apply.', antibiotics: 'Adult Prophylaxis (1 hr before procedure): Oral Amoxicillin 2g. If allergic to penicillins: Cephalexin 2g, Azithromycin 500mg, or Clindamycin 600mg.', others: 'Pre-procedural Chlorhexidine mouthrinse.' } }, { id: 'asthma_copd', category: 'Respiratory', icon: Activity, color: 'text-cyan-500', bgColor: 'bg-cyan-100', name: 'Asthma & COPD', riskLevel: 'Moderate', management: [ 'Instruct patient to bring their rescue inhaler (Albuterol) to the appointment.', 'Defer elective treatment if patient is experiencing an active wheeze or acute respiratory infection.', 'For COPD: Avoid placing the chair fully supine (can cause orthopnea) and avoid routine use of rubber dam if it compromises breathing.', 'Use supplemental oxygen with caution in severe COPD patients.' ], consultation: 'Consult pulmonologist if asthma/COPD is poorly controlled or if patient is on chronic systemic corticosteroids.', medicationsToAvoid: [ { drug: 'NSAIDs & Aspirin', reason: 'Can trigger severe, life-threatening bronchospasm in susceptible individuals (~10% of asthmatics) by shunting arachidonic acid breakdown toward the overproduction of bronchoconstricting leukotrienes (Samter’s Triad).' }, { drug: 'Macrolides (Erythromycin)', reason: 'If the patient is taking Theophylline (a bronchodilator), macrolides will inhibit its metabolism, leading to Theophylline toxicity which can cause fatal arrhythmias and seizures.' } ], sedation: 'ASTHMA: Nitrous Oxide is non-irritating and preferred. Avoid heavy opioids/barbiturates. COPD: AVOID Nitrous Oxide (can expand bullae/blebs) and avoid deep IV sedation due to severely blunted hypoxic drive.', prescriptions: { analgesics: 'Paracetamol is the safest choice.', antibiotics: 'Standard protocols apply (verify no Theophylline interaction).', others: 'Ensure inhaler is readily accessible on the tray.' } }, { id: 'adrenal_insufficiency', category: 'Endocrine', icon: Activity, color: 'text-orange-600', bgColor: 'bg-orange-100', name: 'Adrenal Insufficiency', riskLevel: 'High', management: [ 'Identify patients taking chronic systemic corticosteroids or those with Addison’s disease.', 'Monitor BP during the procedure (risk of profound hypotension during an adrenal crisis).', 'Ensure profound local anesthesia and employ excellent anxiety control to reduce the body’s endogenous stress response.', 'Schedule morning appointments when cortisol levels are naturally higher.' ], consultation: 'Consult endocrinologist or physician regarding the need for corticosteroid "stress dosing" prior to major or invasive oral surgeries.', medicationsToAvoid: [ { drug: 'Enzyme Inducers (e.g., Phenobarbital)', reason: 'These drugs accelerate hepatic metabolism of the patient’s replacement corticosteroids. This can drop their systemic cortisol levels dangerously low, risking acute adrenal crisis (hypotensive shock) during surgical stress.' } ], sedation: 'Profound sedation/anxiolysis is highly beneficial to reduce the body\'s endogenous stress requirements. If using deep IV sedation/GA, ensure appropriate stress-dose steroids are administered.', prescriptions: { analgesics: 'Standard protocols apply. Ensure effective pain control post-operatively to prevent delayed stress response.', antibiotics: 'Standard protocols apply.', others: 'Physician may double the normal daily steroid dose on the day of surgery, or prescribe IV hydrocortisone for major procedures.' } }, { id: 'epilepsy', category: 'Neurological', icon: Activity, color: 'text-violet-500', bgColor: 'bg-violet-100', name: 'Epilepsy / Seizure Disorders', riskLevel: 'Moderate', management: [ 'Verify that the patient has taken their anti-seizure medication prior to the appointment.', 'Inquire about seizure triggers, frequency, and presence of an aura.', 'Use a bite block (mouth prop) secured with floss during surgical procedures to prevent jaw closure injuries during a potential seizure.', 'If a seizure occurs: clear the area, support the airway, do not force anything into the mouth, and time the seizure.' ], consultation: 'Consult neurologist if seizures are frequent, poorly controlled, or if major surgery under sedation is planned.', medicationsToAvoid: [ { drug: 'Tramadol & Meperidine', reason: 'These specific opioid analgesics are known to lower the central nervous system seizure threshold, making a spontaneous seizure highly likely during or after the procedure.' }, { drug: 'Metronidazole & Erythromycin', reason: 'They inhibit hepatic CYP450 metabolism of standard antiepileptic drugs (like Carbamazepine and Phenytoin), leading to rapid neurotoxicity, ataxia, and lethargy.' } ], sedation: 'Benzodiazepines (e.g., Midazolam) are the sedatives of choice as they have anticonvulsant properties and raise the seizure threshold. Strictly avoid Ketamine and Methohexital (seizure triggers).', prescriptions: { analgesics: 'Paracetamol and NSAIDs are safe. Avoid Tramadol.', antibiotics: 'Amoxicillin and Clindamycin are safe. Avoid Metronidazole/Erythromycin if interacting with specific anti-epileptic drugs.', others: 'Emergency kit should contain Midazolam or Diazepam for status epilepticus.' } }, { id: 'pregnancy', category: 'Physiological', icon: Activity, color: 'text-fuchsia-500', bgColor: 'bg-fuchsia-100', name: 'Pregnancy', riskLevel: 'Moderate', management: [ 'The second trimester is the safest period for elective oral surgery.', 'In the third trimester, place a pillow or wedge under the patient’s right hip to prevent supine hypotensive syndrome (vena cava compression).', 'Defer purely elective and non-urgent treatments until post-partum.', 'Minimize radiographs; use lead apron with a thyroid collar if imaging is essential.' ], consultation: 'Consult OB/GYN for high-risk pregnancies or if complex surgery/systemic medication is required.', medicationsToAvoid: [ { drug: 'NSAIDs (Ibuprofen)', reason: 'Strictly avoid in the 3rd trimester. NSAIDs block prostaglandins necessary to keep the fetal Ductus Arteriosus open, leading to premature closure and pulmonary hypertension in the fetus. Also associated with oligohydramnios.' }, { drug: 'Tetracyclines', reason: 'Bind tightly to developing fetal calcium matrices, causing irreversible discoloration (yellow-brown) and hypoplasia of fetal bones and primary teeth.' }, { drug: 'Benzodiazepines', reason: 'Known teratogens. Associated with an increased risk of fetal cleft lip/palate if taken during the first trimester.' } ], sedation: 'Nitrous Oxide requires strict scavenging and is largely avoided (especially in 1st trimester). Benzodiazepines (Midazolam/Diazepam) are contraindicated (teratogenic / cleft lip risk). Deep IV sedation should be avoided.', prescriptions: { analgesics: 'Paracetamol is the drug of choice for pain. Use lowest effective dose.', antibiotics: 'Penicillins, Cephalosporins, and Clindamycin are generally safe (Category B). Avoid Tetracyclines.', others: 'Local anesthetics with epinephrine (Lidocaine, Articaine) are safe in normal doses.' } }, { id: 'hiv_aids', category: 'Immunological', icon: ShieldCheck, color: 'text-emerald-600', bgColor: 'bg-emerald-100', name: 'HIV / AIDS', riskLevel: 'Moderate to High', management: [ 'Request recent CD4+ count and Viral Load. CD4+ < 200/mm³ indicates severe immunosuppression and higher risk of post-op infection.', 'Maintain strict standard infection control precautions.', 'Monitor for HIV-related oral lesions (Kaposi’s sarcoma, oral hairy leukoplakia, candidiasis, severe periodontal disease).' ], consultation: 'Consult Infectious Disease specialist regarding current immune status and if prophylactic antibiotics or platelet count checks are needed.', medicationsToAvoid: [ { drug: 'Midazolam & Diazepam', reason: 'CRITICAL WARNING: If the patient is on HAART (specifically Protease Inhibitors like Ritonavir), the PI totally inhibits the CYP3A4 enzyme. This halts the metabolism of benzodiazepines, causing massive drug accumulation and fatal, prolonged respiratory depression.' } ], sedation: 'CRITICAL WARNING: If patient is on Protease Inhibitors (e.g., Ritonavir), Midazolam and Diazepam are STRICTLY CONTRAINDICATED as their metabolism is halted, causing life-threatening prolonged sedation.', prescriptions: { analgesics: 'Paracetamol is preferred. Be cautious with NSAIDs if the patient has HIV-related thrombocytopenia or renal issues.', antibiotics: 'May require prophylactic or prolonged post-op broad-spectrum antibiotics if CD4 count is very low or neutropenia is present.', others: 'Prescribe antifungals (Fluconazole/Nystatin) for oral candidiasis if present.' } }, { id: 'breast_prostate_cancer', category: 'Oncology', icon: ShieldCheck, color: 'text-purple-600', bgColor: 'bg-purple-100', name: 'Breast & Prostate Cancer', riskLevel: 'Moderate to High', management: [ 'High incidence of bone metastasis. Assess if patient is on IV bisphosphonates (Zoledronic acid) or RANKL inhibitors (Denosumab/Xgeva) for bone mets.', 'If on antiresorptives for cancer, treat as EXTREMELY HIGH RISK for MRONJ. Avoid extractions; prefer root canals, coronectomy, or restorative treatments.', 'Evaluate for anemia, immunosuppression, and bleeding risks if currently undergoing systemic chemotherapy.' ], consultation: 'Consult oncologist regarding exact medication list (specifically bone-modifying agents), current chemotherapy cycles, and recent CBC.', medicationsToAvoid: [ { drug: 'NSAIDs', reason: 'Should be avoided if the patient is currently experiencing chemotherapy-induced thrombocytopenia due to the compound risk of uncontrolled hemorrhage.' } ], sedation: 'Standard sedation protocols apply. Use extreme caution with head/neck/spine positioning if spinal or cervical bone metastases are present.', prescriptions: { analgesics: 'Paracetamol is safe. Short-term NSAIDs if platelet counts are normal.', antibiotics: 'Standard protocols unless severely neutropenic. Post-op coverage recommended if invasive bone surgery is unavoidable.', others: 'Chlorhexidine 0.12% mouthwash pre- and post-operatively.' } }, { id: 'lung_cancer', category: 'Oncology / Respiratory', icon: ShieldCheck, color: 'text-purple-700', bgColor: 'bg-purple-200', name: 'Lung Cancer', riskLevel: 'High', management: [ 'Assess respiratory reserve and tolerance to supine positioning (risk of orthopnea/dyspnea).', 'Be highly vigilant of respiratory depression; monitor oxygen saturation continuously.', 'Consider possibility of brain metastasis or paraneoplastic syndromes (e.g., ectopic ACTH causing adrenal issues).', 'Use supplemental oxygen, but titrate carefully if concomitant severe COPD is present.' ], consultation: 'Consult pulmonologist/oncologist regarding pulmonary reserve, clearance for any procedural sedation, and current chemo/immunotherapy status.', medicationsToAvoid: [ { drug: 'Opioids & Barbiturates', reason: 'These powerfully suppress the central respiratory drive. In patients with severely reduced vital capacity and compromised lung parenchyma, this can easily induce fatal hypoxia and hypercapnia.' } ], sedation: 'Extremely high risk for respiratory failure. Deep IV sedation and respiratory depressants should largely be avoided. Nitrous Oxide may be contraindicated depending on lung pathology (bullae/blebs).', prescriptions: { analgesics: 'Paracetamol and NSAIDs are preferred over opioids to completely avoid respiratory depression.', antibiotics: 'Standard protocols apply.', others: 'Ensure rescue inhalers (if prescribed) and oxygen are readily available.' } }, { id: 'gastric_colon_cancer', category: 'Oncology / GI', icon: ShieldCheck, color: 'text-fuchsia-600', bgColor: 'bg-fuchsia-100', name: 'Gastric & Colorectal Cancer', riskLevel: 'Moderate', management: [ 'Assess for chronic anemia, malabsorption, and malnutrition, which can delay oral wound healing.', 'Evaluate for liver metastasis (common in colon cancer), which can severely impact the production of clotting factors and altering drug metabolism.', 'Request recent PT/INR, platelet counts, and liver function tests if liver involvement is suspected.' ], consultation: 'Consult oncologist/gastroenterologist regarding extent of disease (liver function), bleeding risk, and current systemic therapy.', medicationsToAvoid: [ { drug: 'NSAIDs (Ibuprofen, Ketorolac)', reason: 'Directly irritates the gastric mucosa and decreases protective stomach mucus by inhibiting COX-1. In gastric cancer patients, this significantly heightens the risk of massive, life-threatening gastrointestinal perforation and ulcer bleeding.' } ], sedation: 'Standard sedation protocols apply. Monitor for systemic hypovolemia, electrolyte imbalance, or severe anemia prior to initiating IV sedation.', prescriptions: { analgesics: 'Paracetamol is preferred (dose-adjusted if liver metastasis is present). Strictly avoid NSAIDs in gastric cancer.', antibiotics: 'Standard protocols. Dose adjustments may be necessary if severe hepatic impairment exists.', others: 'Consider prescribing anti-emetics if patient is experiencing severe chemo-induced nausea.' } }, { id: 'cervical_gynecologic_cancer', category: 'Oncology', icon: ShieldCheck, color: 'text-pink-500', bgColor: 'bg-pink-100', name: 'Cervical & Gynecologic Cancers', riskLevel: 'Moderate', management: [ 'Clinical Pearl: Radiation therapy for these cancers is localized to the pelvis. There is NO risk of jaw Osteoradionecrosis (ORN) from pelvic radiation.', 'Focus primarily on the systemic effects of current chemotherapy (immunosuppression, anemia, thrombocytopenia).', 'Watch for oral mucosal changes (mucositis) or opportunistic infections secondary to systemic treatments.' ], consultation: 'Consult oncologist for a recent CBC (checking ANC and platelets) if the patient is actively receiving chemotherapy.', medicationsToAvoid: [ { drug: 'NSAIDs', reason: 'Avoid during the nadir (lowest point) of white blood cell and platelet counts following chemotherapy cycles to prevent bleeding and masking of neutropenic fever.' } ], sedation: 'Standard sedation protocols apply.', prescriptions: { analgesics: 'Standard protocols apply. Rely on Paracetamol if platelets are low.', antibiotics: 'Prophylactic antibiotics are indicated only if the patient is actively neutropenic from chemotherapy.', others: 'Topical anesthetics for oral mucositis. Antifungals (Fluconazole/Nystatin) for secondary oral candidiasis if immunocompromised.' } }, { id: 'stroke_cva', category: 'Neurological / Cardiovascular', icon: Activity, color: 'text-red-800', bgColor: 'bg-red-200', name: 'Stroke (CVA / TIA)', riskLevel: 'High', management: [ 'Defer elective surgery for at least 6 months following a stroke or TIA.', 'Monitor blood pressure strictly; hypertension increases the risk of a recurrent stroke.', 'Check for unilateral facial paralysis, dysphagia (aspiration risk), and communication deficits.', 'Keep appointments short, stress-free, and ideally in the mid-morning.' ], consultation: 'Consult neurologist/PCP regarding medical clearance, stability, and management of anticoagulant/antiplatelet therapy.', medicationsToAvoid: [ { drug: 'Standard NSAIDs (Ibuprofen)', reason: 'Their anti-platelet effect increases the risk of hemorrhagic conversion (bleeding into the brain) or generalized bleeding, especially since these patients are usually strictly managed on powerful anticoagulants.' }, { drug: 'COX-2 Inhibitors (Celecoxib)', reason: 'Black Box Warning: They create a highly pro-thrombotic state by suppressing cardioprotective prostacyclin. This dramatically increases the risk of a recurrent ischemic stroke.' }, { drug: 'Epinephrine (High Dose)', reason: 'Systemic absorption spikes blood pressure, severely increasing the risk of a recurrent ischemic or hemorrhagic cerebrovascular accident.' } ], sedation: 'Nitrous Oxide is excellent as it provides anxiolysis and supplemental oxygen. Avoid deep IV sedation due to airway management challenges and risk of hypoxia.', prescriptions: { analgesics: 'Paracetamol is the absolute drug of choice. Strictly avoid both standard NSAIDs (bleeding risk) and COX-2 inhibitors (thrombosis risk).', antibiotics: 'Standard protocols apply.', others: 'Meticulous suctioning required due to potential dysphagia and impaired gag reflex.' } }, { id: 'parkinsons_disease', category: 'Neurological', icon: Activity, color: 'text-amber-700', bgColor: 'bg-amber-100', name: 'Parkinson\'s Disease', riskLevel: 'Moderate', management: [ 'Schedule appointments 2 to 3 hours after the patient takes their antiparkinsonian medication (peak effectiveness, minimum tremors).', 'Use a bite block to protect the airway and the clinician\'s fingers from sudden jaw closing or tremors.', 'Raise the chair slowly to prevent orthostatic hypotension.', 'High risk of aspiration due to excessive salivation (sialorrhea) and impaired swallowing.' ], consultation: 'Consult neurologist if the patient has profound motor fluctuations (on-off phenomenon), severe dementia, or requires major surgery.', medicationsToAvoid: [ { drug: 'Central Dopamine Antagonists (Metoclopramide, Haloperidol)', reason: 'These drugs directly block dopamine receptors in the brain. In a disease characterized by a severe lack of dopamine, giving these agents will precipitously worsen Parkinsonian tremors and muscular rigidity.' }, { drug: 'Macrolides (Erythromycin)', reason: 'Can heavily inhibit the metabolic clearance of certain Parkinson’s medications (like Selegiline), causing systemic toxicity.' } ], sedation: 'Mild anxiolysis is acceptable. IV sedation requires extreme caution due to rigidity of chest wall muscles and severe aspiration risk. Propofol may temporarily worsen dyskinesias.', prescriptions: { analgesics: 'Paracetamol and NSAIDs are safe.', antibiotics: 'Amoxicillin and Clindamycin are safe. Avoid Erythromycin.', others: 'Consider prescribing an anticholinergic (e.g., Glycopyrrolate) if sialorrhea (excessive drooling) heavily compromises the surgical field.' } }, { id: 'cerebral_palsy', category: 'Neurological', icon: Activity, color: 'text-indigo-600', bgColor: 'bg-indigo-200', name: 'Cerebral Palsy', riskLevel: 'Moderate', management: [ 'Accommodate for uncontrolled movements (spasticity, choreoathetosis). Do not force limbs against their spastic patterns.', 'Maintain patient in an upright or semi-supine position to prevent aspiration (high incidence of GERD and dysphagia).', 'Use a sturdy bite block secured with floss.', 'Assess for concomitant seizure disorders (occurs in ~30-50% of CP patients).' ], consultation: 'Consult PCP or neurologist if severe systemic involvement, unmanaged seizures, or if planning deep sedation/general anesthesia.', medicationsToAvoid: [ { drug: 'Heavy CNS Depressants', reason: 'Patients with CP often have poor neuromuscular coordination of their chest wall and diaphragm. Deep sedation can easily overwhelm their breathing mechanism, leading to rapid hypoxia.' } ], sedation: 'Nitrous Oxide is mildly effective for spasticity but can be difficult to administer if the patient cannot tolerate the mask. Deep IV sedation or General Anesthesia in a hospital setting is often required for extensive surgery.', prescriptions: { analgesics: 'Standard protocols apply. Paracetamol and NSAIDs are safe.', antibiotics: 'Standard protocols apply.', others: 'Ensure profound local anesthesia, as pain triggers severe muscle spasms.' } } ]; const drugsDB = [ { id: 'amoxicillin', category: 'Antibiotic', icon: Pill, color: 'text-blue-600', bgColor: 'bg-blue-100', name: 'Amoxicillin', riskLevel: 'Low', indication: 'First-line for odontogenic infections and Infective Endocarditis (IE) prophylaxis.', dosage: 'Infection: 500mg PO tid for 5-7 days. Prophylaxis: 2g PO 1 hour before procedure.', warnings: 'Contraindicated in penicillin allergy. May decrease efficacy of oral contraceptives.' }, { id: 'clindamycin', category: 'Antibiotic', icon: Pill, color: 'text-purple-600', bgColor: 'bg-purple-100', name: 'Clindamycin', riskLevel: 'Moderate', indication: 'Alternative for penicillin-allergic patients (though azithromycin/cephalexin are often preferred now for prophylaxis per newer AHA guidelines).', dosage: 'Infection: 300mg PO qid for 5-7 days. Prophylaxis: 600mg PO 1 hour before procedure.', warnings: 'Black box warning for Clostridium difficile-associated diarrhea (CDAD).' }, { id: 'ibuprofen', category: 'NSAID / Analgesic', icon: Pill, color: 'text-orange-600', bgColor: 'bg-orange-100', name: 'Ibuprofen', riskLevel: 'Moderate', indication: 'Mild to moderate odontogenic pain and inflammation.', dosage: '400-600mg PO q4-6h prn pain. Maximum 3200mg/day.', warnings: 'Avoid in 3rd trimester pregnancy, history of GI bleed, severe renal failure, and bleeding disorders. Monitor asthma patients.' }, { id: 'celecoxib', category: 'NSAID (COX-2 Selective)', icon: Pill, color: 'text-orange-700', bgColor: 'bg-orange-200', name: 'Celecoxib (Celebrex)', riskLevel: 'High', indication: 'Analgesia when standard NSAIDs are contraindicated due to GI ulcers or bleeding risk (as it does not inhibit platelets).', dosage: '400mg PO initially, then 200mg bid.', warnings: 'Black Box Warning: Increases the risk of serious cardiovascular thrombotic events (MI, Stroke). Strictly avoid in patients with ischemic heart disease or recent stroke.' }, { id: 'paracetamol', category: 'Analgesic / Antipyretic', icon: Pill, color: 'text-green-600', bgColor: 'bg-green-100', name: 'Paracetamol (Acetaminophen)', riskLevel: 'Low', indication: 'Mild to moderate pain, especially when NSAIDs are contraindicated.', dosage: '500-1000mg PO q4-6h prn pain. Maximum 4000mg/day (lower in hepatic impairment).', warnings: 'Hepatotoxicity at high doses. Avoid or reduce dose significantly in severe liver cirrhosis.' }, { id: 'midazolam', category: 'Sedative / Benzodiazepine', icon: Moon, color: 'text-indigo-600', bgColor: 'bg-indigo-100', name: 'Midazolam (Versed)', riskLevel: 'High', indication: 'Conscious IV sedation, severe anxiety, status epilepticus.', dosage: 'Titrate IV slowly (e.g., 1mg every 2 mins) until desired sedation level. Oral: 0.25-0.5 mg/kg (pediatric).', warnings: 'Respiratory depression. Strictly contraindicated in pregnancy (teratogenic) and with HIV Protease Inhibitors.' }, { id: 'nitrous_oxide', category: 'Inhalational Anesthetic', icon: Moon, color: 'text-cyan-600', bgColor: 'bg-cyan-100', name: 'Nitrous Oxide (Laughing Gas)', riskLevel: 'Low', indication: 'Mild to moderate anxiolysis and slight analgesia for conscious patients.', dosage: 'Titrate from 100% O2 to a maximum of 50-70% N2O depending on patient response.', warnings: 'Contraindicated in severe COPD, 1st trimester pregnancy, bleomycin therapy, and blocked middle ear/sinuses.' }, { id: 'propofol', category: 'IV General Anesthetic', icon: Moon, color: 'text-slate-700', bgColor: 'bg-slate-200', name: 'Propofol', riskLevel: 'Critical', indication: 'Deep sedation and induction of general anesthesia.', dosage: 'Varies heavily based on age/weight. Administered exclusively by trained anesthesia providers.', warnings: 'Profound respiratory depression and hypotension. No reversal agent exists. Avoid if allergic to egg/soy (depending on emulsion formulation).' }, { id: 'ketamine', category: 'Dissociative Anesthetic', icon: Moon, color: 'text-fuchsia-600', bgColor: 'bg-fuchsia-100', name: 'Ketamine', riskLevel: 'High', indication: 'Procedural sedation (especially pediatric) where preservation of airway reflexes and spontaneous respiration is desired.', dosage: 'IV: 0.25-1 mg/kg. IM: 2-4 mg/kg (often co-administered with midazolam to prevent emergence delirium).', warnings: 'Causes hypersalivation (often requires glycopyrrolate). Risk of emergence delirium/hallucinations. Increases heart rate and blood pressure.' }, { id: 'fentanyl', category: 'Opioid / Sedative Adjunct', icon: Moon, color: 'text-rose-700', bgColor: 'bg-rose-100', name: 'Fentanyl', riskLevel: 'Critical', indication: 'Intraoperative profound analgesia and sedation adjunct (highly synergistic with Midazolam for moderate/deep IV sedation).', dosage: 'IV: 25-50 mcg increments, titrated to effect. Very rapid onset.', warnings: 'Profound respiratory depression. Rapid IV push can cause life-threatening Chest Wall Rigidity (Wooden Chest Syndrome). Have Naloxone ready.' }, { id: 'diazepam', category: 'Sedative / Benzodiazepine', icon: Moon, color: 'text-indigo-500', bgColor: 'bg-indigo-100', name: 'Diazepam (Valium)', riskLevel: 'Moderate', indication: 'Pre-operative oral anxiolysis and skeletal muscle relaxation.', dosage: 'Oral: 5-10 mg taken 1 hour prior to procedure.', warnings: 'Very long half-life with active metabolites (prolonged hangover effect). High risk of phlebitis if given IV. Avoid in the elderly.' }, { id: 'methohexital', category: 'Barbiturate', icon: Moon, color: 'text-stone-600', bgColor: 'bg-stone-200', name: 'Methohexital (Brevital)', riskLevel: 'Critical', indication: 'Classic OMFS agent for deep sedation/induction for very brief, stimulating procedures (e.g., fast extractions).', dosage: 'IV: 1-1.5 mg/kg for induction. Ultra-short acting.', warnings: 'Lowers the seizure threshold (strictly avoid in epileptic patients). Causes profound respiratory depression, apnea, and hiccups/muscle twitching.' } ]; const emergenciesDB = [ { id: 'syncope', category: 'Medical Emergency', icon: Activity, color: 'text-yellow-600', bgColor: 'bg-yellow-100', name: 'Vasovagal Syncope', riskLevel: 'High', signs: 'Pallor, diaphoresis, lightheadedness, loss of consciousness, bradycardia.', management: [ 'Place patient in supine position with legs slightly elevated (Trendelenburg).', 'Ensure patent airway (ABC).', 'Administer 100% Oxygen (4-6 L/min).', 'Crush ammonia inhalant and place under nose if recovery is not immediate.', 'Monitor vital signs (BP and HR).' ] }, { id: 'anaphylaxis', category: 'Medical Emergency', icon: ShieldAlert, color: 'text-red-600', bgColor: 'bg-red-100', name: 'Anaphylaxis', riskLevel: 'Critical', signs: 'Urticaria (hives), respiratory distress/wheezing, swelling of lips/tongue, profound hypotension, tachycardia.', management: [ 'Immediately administer Epinephrine 1:1,000 IM (0.3mg for adults) in the anterolateral thigh.', 'Call Emergency Medical Services (911).', 'Place patient in supine position (unless severe orthopnea/breathing difficulty).', 'Administer 100% Oxygen.', 'Prepare for CPR if cardiac arrest occurs.', 'Can repeat Epinephrine every 5-15 minutes if no clinical improvement.' ] }, { id: 'hypoglycemia', category: 'Medical Emergency', icon: Activity, color: 'text-blue-600', bgColor: 'bg-blue-100', name: 'Hypoglycemia', riskLevel: 'High', signs: 'Confusion, agitation, sweating, tachycardia, tremors, seizures (if severe). Blood glucose usually < 70 mg/dL.', management: [ 'If conscious: Administer oral fast-acting carbohydrates (15-20g) like fruit juice, glucose gel, or sugar water.', 'If unconscious: Do NOT give oral intake. Administer Glucagon 1mg IM or IV Dextrose (50%).', 'Call EMS if patient is unconscious or fails to respond to oral glucose within 15 minutes.', 'Monitor blood glucose and vital signs closely.' ] }, { id: 'last', category: 'Medical Emergency', icon: ShieldAlert, color: 'text-rose-600', bgColor: 'bg-rose-100', name: 'Local Anesthetic Systemic Toxicity (LAST)', riskLevel: 'Critical', signs: 'Perioral numbness, metallic taste, tinnitus, dizziness, visual disturbances, followed by tremors, seizures, and cardiovascular collapse.', management: [ 'Stop local anesthetic injection immediately.', 'Call Emergency Medical Services (911).', 'Manage airway and administer 100% Oxygen.', 'Manage seizures with Benzodiazepines (e.g., Midazolam IM/IV) if they occur.', 'Prepare for ACLS/CPR if cardiovascular collapse occurs.', 'Consider Lipid Emulsion Therapy (Intralipid 20%) if available (usually in hospital setting).' ] } ]; const abbreviationsDB = [ { id: 'abc', name: 'ABC', category: 'Glossary', definition: 'Airway, Breathing, Circulation' }, { id: 'acls', name: 'ACLS', category: 'Glossary', definition: 'Advanced Cardiovascular Life Support' }, { id: 'aha', name: 'AHA', category: 'Glossary', definition: 'American Heart Association' }, { id: 'anc', name: 'ANC', category: 'Glossary', definition: 'Absolute Neutrophil Count (Normal range: 1,500 - 8,000 cells/mm³)' }, { id: 'av', name: 'AV', category: 'Glossary', definition: 'Arteriovenous (e.g., AV Fistula or Graft for dialysis)' }, { id: 'bg', name: 'BG', category: 'Glossary', definition: 'Blood Glucose' }, { id: 'bp', name: 'BP', category: 'Glossary', definition: 'Blood Pressure' }, { id: 'cbc', name: 'CBC', category: 'Glossary', definition: 'Complete Blood Count' }, { id: 'cdad', name: 'CDAD', category: 'Glossary', definition: 'Clostridium Difficile-Associated Diarrhea' }, { id: 'copd', name: 'COPD', category: 'Glossary', definition: 'Chronic Obstructive Pulmonary Disease' }, { id: 'cpr', name: 'CPR', category: 'Glossary', definition: 'Cardiopulmonary Resuscitation' }, { id: 'cox2', name: 'COX-2', category: 'Glossary', definition: 'Cyclooxygenase-2 (enzyme targeted by certain NSAIDs)' }, { id: 'dapt', name: 'DAPT', category: 'Glossary', definition: 'Dual Anti-Platelet Therapy' }, { id: 'doac', name: 'DOAC', category: 'Glossary', definition: 'Direct Oral Anticoagulant (e.g., Apixaban, Rivaroxaban)' }, { id: 'ems', name: 'EMS', category: 'Glossary', definition: 'Emergency Medical Services' }, { id: 'hba1c', name: 'HbA1c', category: 'Glossary', definition: 'Hemoglobin A1c (measure of long-term blood glucose control)' }, { id: 'hr', name: 'HR', category: 'Glossary', definition: 'Heart Rate' }, { id: 'ie', name: 'IE', category: 'Glossary', definition: 'Infective Endocarditis' }, { id: 'im', name: 'IM', category: 'Glossary', definition: 'Intramuscular (injection)' }, { id: 'inr', name: 'INR', category: 'Glossary', definition: 'International Normalized Ratio (measure of blood clotting time)' }, { id: 'iv', name: 'IV', category: 'Glossary', definition: 'Intravenous' }, { id: 'last', name: 'LAST', category: 'Glossary', definition: 'Local Anesthetic Systemic Toxicity' }, { id: 'mi', name: 'MI', category: 'Glossary', definition: 'Myocardial Infarction (Heart Attack)' }, { id: 'mronj', name: 'MRONJ', category: 'Glossary', definition: 'Medication-Related Osteonecrosis of the Jaw' }, { id: 'nsaid', name: 'NSAID', category: 'Glossary', definition: 'Non-Steroidal Anti-Inflammatory Drug (e.g., Ibuprofen)' }, { id: 'orn', name: 'ORN', category: 'Glossary', definition: 'Osteoradionecrosis (bone death due to radiation)' }, { id: 'pcp', name: 'PCP', category: 'Glossary', definition: 'Primary Care Physician' }, { id: 'po', name: 'PO', category: 'Glossary', definition: 'Per Os (by mouth / orally)' }, { id: 'prn', name: 'prn', category: 'Glossary', definition: 'Pro re nata (as needed)' }, { id: 'pt', name: 'PT', category: 'Glossary', definition: 'Prothrombin Time (blood clotting test)' }, { id: 'q46h', name: 'q4-6h', category: 'Glossary', definition: 'Quaque 4-6 hora (every 4 to 6 hours)' }, { id: 'qid', name: 'qid', category: 'Glossary', definition: 'Quater in die (four times a day)' }, { id: 'tid', name: 'tid', category: 'Glossary', definition: 'Ter in die (three times a day)' }, { id: 'txa', name: 'TXA', category: 'Glossary', definition: 'Tranexamic Acid (anti-fibrinolytic used to stop bleeding)' } ]; // --- COMPONENTS --- const DisclaimerModal = ({ onAccept }) => (

Clinical Disclaimer

This application is intended strictly as an educational reference tool for healthcare professionals in Oral and Maxillofacial Surgery.

It does not constitute definitive medical advice, diagnosis, or treatment planning. Patient management must always be individualized based on full clinical assessment, current laboratory values, and direct physician consultation.

By proceeding, you acknowledge that the authors are not liable for clinical decisions made using this quick-reference guide.

); // --- AI HELPER FORMATTER --- const formatMarkdown = (text) => { return text.split('\n').map((line, i) => { const formattedLine = line.replace(/\*\*(.*?)\*\*/g, '$1'); return (

); }); }; // --- TAB THEMES --- const themes = { conditions: { gradient: 'from-blue-600 to-indigo-700', icon: Stethoscope, title: 'OMFS Conditions' }, drugs: { gradient: 'from-purple-600 to-fuchsia-700', icon: Pill, title: 'Pharmacology' }, emergencies: { gradient: 'from-rose-600 to-red-700', icon: Heart, title: 'Emergencies' }, abbreviations: { gradient: 'from-teal-600 to-emerald-700', icon: Book, title: 'Glossary' }, ai: { gradient: 'from-indigo-600 to-violet-700', icon: Wand2, title: 'AI Case Analyzer' }, }; export default function App() { const [disclaimerAccepted, setDisclaimerAccepted] = useState(false); const [searchQuery, setSearchQuery] = useState(''); const [activeTab, setActiveTab] = useState('conditions'); const [selectedItem, setSelectedItem] = useState(null); // AI State const [aiInput, setAiInput] = useState(''); const [aiOutput, setAiOutput] = useState(''); const [isAiLoading, setIsAiLoading] = useState(false); const [aiError, setAiError] = useState(''); const activeTheme = themes[activeTab]; const activeDB = activeTab === 'conditions' ? conditionsDB : activeTab === 'drugs' ? drugsDB : activeTab === 'emergencies' ? emergenciesDB : activeTab === 'abbreviations' ? abbreviationsDB : []; const filteredItems = useMemo(() => { return activeDB.filter(item => { const searchStr = searchQuery.toLowerCase(); if (activeTab === 'abbreviations') { return item.name.toLowerCase().includes(searchStr) || item.definition.toLowerCase().includes(searchStr); } return item.name.toLowerCase().includes(searchStr) || (item.category && item.category.toLowerCase().includes(searchStr)); }); }, [searchQuery, activeDB, activeTab]); const handleTabSwitch = (tab) => { setActiveTab(tab); setSelectedItem(null); setSearchQuery(''); }; const handleAIAnalysis = async () => { if (!aiInput.trim()) return; setIsAiLoading(true); setAiError(''); setAiOutput(''); const apiKey = ""; const url = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-09-2025:generateContent?key=${apiKey}`; const systemPrompt = `You are an expert Oral and Maxillofacial Surgery AI assistant. Analyze the following patient case details or query. Identify key surgical risks, contraindications, and provide concise, evidence-based recommendations for perioperative management, sedation, and pharmacology. Keep it highly clinical, brief, and structured using markdown bullet points and bold text for emphasis. Do not include a lengthy introduction.`; const payload = { contents: [{ parts: [{ text: aiInput }] }], systemInstruction: { parts: [{ text: systemPrompt }] } }; let retries = 5, delay = 1000, finalResponse = "No response generated."; while (retries > 0) { try { const res = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); if (!res.ok) throw new Error(`API Error: ${res.status}`); const data = await res.json(); finalResponse = data.candidates?.[0]?.content?.parts?.[0]?.text || "No response generated."; setAiOutput(finalResponse); break; } catch (error) { retries--; if (retries === 0) { setAiError("Failed to connect to AI assistant. Please verify your connection."); break; } await new Promise(r => setTimeout(r, delay)); delay *= 2; } } setIsAiLoading(false); }; if (!disclaimerAccepted) { return setDisclaimerAccepted(true)} />; } return (

{/* Mobile-styled Container - Adds a "Phone" bezel on desktop, edge-to-edge on mobile */}
{/* Dynamic Header */}
{selectedItem ? (

{selectedItem.name}

) : (

{activeTheme.title}

{activeTab === 'conditions' && ( Conceptualized by Dr. Kezia Rachellea Mustakim )}
{activeTab !== 'ai' && (
setSearchQuery(e.target.value)} />
)}
)}
{/* Scrollable Content Area */}
{/* AI TAB VIEW */} {activeTab === 'ai' && !selectedItem && (

Enter a complex patient profile. The AI will cross-reference OMFS guidelines to output a safe perioperative protocol.