// ============================================================ // bedside/toxicology.js // TOXICOLOGY. // ============================================================ import { S } from './shared.js'; function lookupTox() { var wt = parseFloat(document.getElementById('tox-weight').value); var topic = document.getElementById('tox-topic').value; var el = document.getElementById('tox-result'); var html = ''; if (topic === 'approach') { html += S.stepBox('#3b82f6', '1. Stabilize (ABCDE)', 'Airway, breathing, circulation, disability (glucose, pupils, GCS), exposure. Naloxone if depressed LOC + resp depression. Dextrose if hypoglycemic. Thiamine in select cases.'); html += S.stepBox('#8b5cf6', '2. Identify toxidrome', 'Sympathomimetic: HTN, tachy, mydriasis, diaphoresis (cocaine, meth). Anticholinergic: hot/dry, mydriasis, tachy, delirium (antihistamines, TCAs). Cholinergic: SLUDGE-M, miosis (organophosphates). Opioid: miosis, resp depression, ↓LOC. Sedative-hypnotic: ↓LOC, normal/low vitals.'); html += S.stepBox('#f59e0b', '3. Decontamination', 'Activated charcoal 1 g/kg PO (max 50 g): within 1h of ingestion, intact airway, ingestion adsorbed (not Li, metals, alcohols). Avoid caustics/hydrocarbons. Whole bowel irrigation: PEG for metals/iron/lithium/sustained release. Gastric lavage: rarely indicated. Ipecac: no longer recommended.'); html += S.stepBox('#10b981', '4. Enhance elimination', 'Urinary alkalinization (salicylates, phenobarbital). Hemodialysis (see ISTUMBLE). Lipid emulsion for lipid-soluble drug toxicity (LA, CCB, TCA).'); html += S.stepBox('#ef4444', '5. Antidotes', 'See topic list. Contact Poison Center (US: 1-800-222-1222) early for any significant exposure.'); } else if (topic === 'acetaminophen') { html += '
Acetaminophen overdose
'; html += '

Acute toxic dose: >150 mg/kg (or 7.5 g total) single ingestion. Hepatotoxic after 24h; AST/ALT peak day 3-4.

'; html += '

Diagnosis: Draw level at 4h post-ingestion (or on arrival if >4h). Plot on Rumack-Matthew nomogram (treatment line at 150 mcg/mL at 4h).

'; html += S.drugTable( S.drugRow('N-acetylcysteine (NAC) — IV', '150 mg/kg over 1h → 50 mg/kg over 4h → 100 mg/kg over 16h (21h total)', 'IV', 'Total 300 mg/kg. Most effective if started <8h post-ingestion.') + S.drugRow('N-acetylcysteine — PO', '140 mg/kg load, then 70 mg/kg q4h × 17 doses', 'PO', 'Alternative to IV. Unpleasant taste — often with juice.') + S.drugRow('Activated charcoal', '1 g/kg (max 50 g)', 'PO', 'If within 1-2h of ingestion and airway protected.') ); if (wt) html += '
For ' + wt + ' kg: IV loading = ' + S.d(wt, 150) + ' mg over 1h (150 mg/kg); 2nd bag = ' + S.d(wt, 50) + ' mg over 4h (50 mg/kg); 3rd bag = ' + S.d(wt, 100) + ' mg over 16h (100 mg/kg). Total 300 mg/kg.
'; } else if (topic === 'opioids') { html += '
Opioid overdose
'; html += '

Triad: miosis + respiratory depression + ↓ LOC. Fentanyl / synthetics may require repeated/higher doses.

'; html += S.drugTable( S.drugRow('Naloxone (initial)', '0.01-0.1 mg/kg' + (wt ? ' = ' + S.d(wt, 0.01) + '-' + S.d(wt, 0.1) + ' mg' : ''), 'IV / IM / IN / IO', 'Start low if chronic opioid use (avoid withdrawal). Titrate to respiratory effort, not consciousness.') + S.drugRow('Naloxone (full reversal)', '2 mg IV/IM/IN', 'IV / IM / IN', 'If no chronic use and severe resp depression. Repeat q2-3 min.') + S.drugRow('Naloxone infusion', '2/3 of effective bolus per hour', 'IV', 'For long-acting opioids (methadone, fentanyl patch, sustained release)') ); html += '
Observe ≥4h after last dose; longer for long-acting agents. Duration of naloxone (30-90 min) is shorter than most opioids — re-sedation is common.
'; } else if (topic === 'iron') { html += '
Iron overdose
'; html += '

Toxic dose: elemental Fe ≥20 mg/kg. Severe ≥60 mg/kg. Charcoal does NOT bind iron.

'; html += '

Stages: 1) GI (0-6h: vomiting, bloody diarrhea); 2) Latent (6-24h: deceptive improvement); 3) Shock/metabolic acidosis (12-24h); 4) Hepatotoxicity (2-5d); 5) Gastric scarring (2-8 wk).

'; html += S.drugTable( S.drugRow('Whole bowel irrigation', 'PEG-ES 25-40 mL/kg/hr', 'NG', 'For radiopaque pills on KUB or ingested sustained-release iron.') + S.drugRow('Deferoxamine', '15 mg/kg/hr IV infusion', 'IV', 'Max 6-8 g/day. Indications: shock, metabolic acidosis, Fe level >500 mcg/dL, or severe symptoms. Urine turns "vin rosé" color.') ); html += '
Iron level at 4-6h. <350 usually asymptomatic; 350-500 mild; >500 severe. Consider KUB for radiopaque pills.
'; } else if (topic === 'tca') { html += '
TCA overdose
'; html += '

Anticholinergic + Na-channel blockade. Risks: seizure, VT/VF, hypotension, coma. ECG: QRS >100 ms or R in aVR >3 mm predicts toxicity.

'; html += S.drugTable( S.drugRow('Sodium bicarbonate 8.4%', '1-2 mEq/kg IV bolus → infusion', 'IV', 'Goal pH 7.45-7.55 and narrowing QRS. Repeat bolus for QRS widening, hypotension, or arrhythmia.') + S.drugRow('Mg sulfate', S.dStr(wt || 30, 50, 2000, ' mg'), 'IV over 10 min', 'For torsades.') + S.drugRow('IV lipid emulsion 20%', '1.5 mL/kg bolus → 0.25 mL/kg/min × 30-60 min', 'IV', 'If refractory shock/arrest. Consult toxicology.') ); html += '
Avoid Class IA/IC antiarrhythmics, beta-blockers, physostigmine (risk of asystole with TCAs).
'; } else if (topic === 'bbccb') { html += '
β-blocker / Calcium-channel blocker overdose
'; html += '

Bradycardia + hypotension. CCBs (esp. verapamil, diltiazem, amlodipine) can be lethal in small pediatric doses.

'; html += S.drugTable( S.drugRow('IV fluids', '20 mL/kg NS bolus', 'IV', 'Cautious — avoid volume overload') + S.drugRow('Calcium chloride 10% or gluconate', 'CaCl 20 mg/kg / Ca-glu 60 mg/kg', 'IV', 'First-line for CCB. Repeat q15-20 min.') + S.drugRow('Glucagon', '50 mcg/kg IV bolus → 50-150 mcg/kg/hr', 'IV', 'β-blocker antidote. GI side effects common.') + S.drugRow('High-dose insulin (HIE)', 'Regular insulin 1 U/kg bolus → 0.5-2 U/kg/hr + D25% infusion', 'IV', 'Hyperinsulinemic euglycemia therapy. Monitor K+ and glucose closely.') + S.drugRow('Vasopressors', 'Epi / norepi infusion', 'IV', 'Titrate to MAP.') + S.drugRow('Lipid emulsion 20%', '1.5 mL/kg → 0.25 mL/kg/min', 'IV', 'For lipid-soluble CCBs (verapamil) if refractory.') + S.drugRow('Methylene blue / ECMO', '—', '—', 'Rescue therapy — toxicology/ICU consult.') ); } else if (topic === 'benzo') { html += '
Benzodiazepine overdose
'; html += '

Sedation + resp depression. Usually supportive — intubation rarely needed alone. Flumazenil caution.

'; html += S.drugTable( S.drugRow('Flumazenil', '0.01 mg/kg (max 0.2 mg) IV, may repeat q1 min to max 1 mg', 'IV', 'Only for iatrogenic reversal in a benzo-naive patient with no TCAs, seizure disorder, or chronic benzo use. Can precipitate seizures.') ); html += '
In real-world ingestion, supportive care (airway, monitoring) is usually safer than flumazenil.
'; } else if (topic === 'organo') { html += '
Organophosphate / carbamate poisoning
'; html += '

Cholinergic toxidrome: SLUDGE-M (salivation, lacrimation, urination, defecation, GI distress, emesis, miosis) + muscle fasciculation, bradycardia, bronchorrhea. Decontamination critical (PPE for providers).

'; html += S.drugTable( S.drugRow('Atropine', '0.05 mg/kg IV, double q3-5 min until bronchial secretions dry', 'IV', 'Endpoint = dry lungs, not dry mouth or heart rate. Can require huge doses.') + S.drugRow('Pralidoxime (2-PAM)', '25-50 mg/kg IV over 30 min (max 2 g) → 10-20 mg/kg/hr', 'IV', 'Only for organophosphates (not carbamates). Regenerates acetylcholinesterase.') + S.drugRow('Diazepam / midazolam', 'Standard seizure doses', 'IV', 'For seizures or severe fasciculations.') ); } else if (topic === 'salicylate') { html += '
Salicylate overdose
'; html += '

Mixed respiratory alkalosis + anion gap metabolic acidosis. Tinnitus, tachypnea, diaphoresis, hyperthermia. Severe: CNS depression, seizures, pulmonary edema, cerebral edema.

'; html += S.drugTable( S.drugRow('Fluids', 'Aggressive resuscitation', 'IV', 'Dehydration common. Avoid fluid overload (risk of pulmonary edema).') + S.drugRow('Sodium bicarb', '1-2 mEq/kg IV bolus → drip', 'IV', 'Urinary alkalinization (goal urine pH >7.5). Prevents CNS entry.') + S.drugRow('Glucose', 'Maintain euglycemia even if BG normal', 'IV', 'CNS hypoglycemia despite normal serum glucose.') + S.drugRow('Hemodialysis', '—', '—', 'For severe: altered MS, pulmonary edema, renal failure, refractory acidosis, or level >100 mg/dL acute / >60 chronic.') ); } else if (topic === 'etoh') { html += '
Toxic alcohols (methanol / ethylene glycol)
'; html += '

Anion gap metabolic acidosis + osmolar gap. Methanol → visual changes, blindness. Ethylene glycol → calcium oxalate crystals in urine, renal failure.

'; html += S.drugTable( S.drugRow('Fomepizole', '15 mg/kg IV load → 10 mg/kg q12h × 4 → 15 mg/kg q12h', 'IV', 'First-line. Inhibits alcohol dehydrogenase.') + S.drugRow('Ethanol (alternative)', 'Load 600 mg/kg → maintain level 100-150 mg/dL', 'IV / PO', 'If fomepizole unavailable. Monitor closely.') + S.drugRow('Hemodialysis', '—', '—', 'For severe acidosis, end-organ damage, or high levels.') + S.drugRow('Folate / thiamine / pyridoxine', 'Standard doses', 'IV', 'Methanol: folate. EG: thiamine + pyridoxine (divert to non-toxic metabolites).') ); } else if (topic === 'dialyzable') { html += '
Dialyzable drugs (ISTUMBLE)
'; html += '

Commonly dialyzable in overdose:

'; html += '
'; [['I','Isopropyl alcohol, INH'],['S','Salicylates'],['T','Theophylline, Toxic alcohols'],['U','Uremia-related drugs'],['M','Methanol, Metformin, Methotrexate'],['B','Barbiturates (long-acting)'],['L','Lithium'],['E','Ethylene glycol']].forEach(function(x) { html += '
' + x[0] + ': ' + x[1] + '
'; }); html += '
'; html += '
Poor candidates for HD: Large Vd (TCAs, digoxin, BBs), highly protein-bound (benzos, CCBs), lipid-soluble (opioids, phenothiazines). EXTRIP recommendations are evidence-based — consult toxicology.
'; } html += S.ref('Call Poison Control early: 1-800-222-1222 (US). Refs: Goldfrank\'s Toxicologic Emergencies, EXTRIP workgroup.'); el.innerHTML = html; } export function init() { document.addEventListener('click', function(e) { if (e.target.id === 'btn-tox-lookup' || e.target.closest('#btn-tox-lookup')) lookupTox(); }); }