Make poster chart of emergency drugs labetolol metaplropromide tramdol avil transmic acid tipetodol phtyion lozarpam ondansteron noradrenaline adrenaline doutamine dopamine atropine dopamine nitroglycerin iv fluids mechanism how to use dilute indications contraindications dose maximum dose shelf life and half life Detailed

Checking Date & Time
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or not found"

Writing File

~/emergency-drugs-poster/build.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3" x 7.5"

// ─── Color Palette ───────────────────────────────────────────────────────────
const C = {
  bg:       "0A1628",   // deep navy
  panel:    "0D1F3C",   // card bg
  panelAlt: "0E2445",
  accent1:  "E8383D",   // red
  accent2:  "F4A61A",   // amber
  accent3:  "27AE60",   // green
  accent4:  "2E86DE",   // blue
  accent5:  "9B59B6",   // purple
  accent6:  "E67E22",   // orange
  accent7:  "1ABC9C",   // teal
  accent8:  "E74C3C",   // crimson
  accent9:  "3498DB",   // sky
  accent10: "8E44AD",   // violet
  white:    "FFFFFF",
  lightGray:"C8D6E5",
  yellow:   "F9CA24",
  hdr:      "152744",
};

// ─── Drug Data ────────────────────────────────────────────────────────────────
const drugs = [
  {
    name: "LABETALOL",
    color: C.accent1,
    category: "α/β-Blocker | Antihypertensive",
    mechanism: "Non-selective β-blocker + selective α1-blocker → ↓ HR, ↓ SVR, ↓ BP",
    indications: "Hypertensive emergencies, pre-eclampsia/eclampsia, aortic dissection, phaeochromocytoma crisis",
    contraindications: "Asthma, COPD, 2nd/3rd° AV block, cardiogenic shock, bradycardia <50/min, decompensated HF",
    dose: "IV: 20 mg bolus over 2 min; repeat 40–80 mg q10 min\nInfusion: 1–2 mg/min",
    maxDose: "Bolus max: 300 mg total | Infusion: 300 mg/session",
    dilution: "200 mg in 200 mL NS/D5W (1 mg/mL) or undiluted 5 mg/mL for bolus",
    shelfLife: "Undiluted: 2 years | Diluted: 24 h (room temp) / 48 h (refrigerated)",
    halfLife: "5–8 hours",
  },
  {
    name: "METOCLOPRAMIDE",
    color: C.accent2,
    category: "Prokinetic | Antiemetic | D2-Antagonist",
    mechanism: "Central & peripheral D2-receptor antagonist + 5-HT3 antagonist → ↑ gastric motility, ↑ lower oesophageal tone, antiemetic",
    indications: "Nausea/vomiting, gastroparesis, GORD, post-op ileus, migraine headache (adjunct), pre-procedural gastric emptying",
    contraindications: "GI obstruction/perforation, phaeochromocytoma, Parkinson's disease, seizure disorders, tardive dyskinesia hx",
    dose: "IV/IM: 10 mg over 1–2 min; Oral: 10 mg TDS ac\nCRI: 25–75 mg/24 h",
    maxDose: "30 mg/day (adult) | 0.5 mg/kg/day (paediatric)",
    dilution: "10 mg in 50 mL NS slow IV push or diluted in 50 mL over 15 min",
    shelfLife: "Undiluted: 3 years | Diluted: 48 h protected from light",
    halfLife: "5–6 hours",
  },
  {
    name: "TRAMADOL",
    color: C.accent3,
    category: "Opioid Agonist | SNRI | Analgesic",
    mechanism: "Weak μ-opioid receptor agonist + inhibits reuptake of serotonin & noradrenaline → central analgesia",
    indications: "Moderate–severe pain (acute & chronic), post-op pain, neuropathic pain, labour analgesia (limited)",
    contraindications: "MAOIs (within 14 days), seizure disorder, raised ICP, respiratory depression, serotonin syndrome risk, <12 yrs",
    dose: "IV: 50–100 mg over 10–20 min q4–6 h\nOral: 50–100 mg q6 h\nMax: 400 mg/day",
    maxDose: "400 mg/day (oral); 600 mg/day (IV under supervision)",
    dilution: "100 mg in 100 mL NS over 30 min (to reduce nausea)",
    shelfLife: "Undiluted: 3 years | Diluted: 24 h",
    halfLife: "6–7 h (active metabolite O-desmethyl-tramadol: ~9 h)",
  },
  {
    name: "AVIL (Pheniramine)",
    color: C.accent4,
    category: "H1-Antihistamine | Antiallergic",
    mechanism: "Competitive H1-receptor antagonist → blocks histamine-mediated vasodilation, bronchoconstriction, pruritus, oedema",
    indications: "Allergic reactions, anaphylaxis (adjunct), urticaria, angioedema, pruritus, transfusion reactions, insect bites",
    contraindications: "Acute asthma attack (use with caution), neonates, nursing mothers, MAOIs, glaucoma, BPH",
    dose: "IM/IV: 22.75 mg (1 mL) to 45.5 mg (2 mL) slow IV\nOral: 25–50 mg BD–TDS",
    maxDose: "100 mg/24 h (IV) | 200 mg/24 h (oral)",
    dilution: "Dilute in 10 mL NS and give over 2–3 min IV; IM can be given undiluted",
    shelfLife: "3 years | Diluted: 8 h",
    halfLife: "16–19 hours",
  },
  {
    name: "TRANEXAMIC ACID",
    color: C.accent5,
    category: "Antifibrinolytic | Haemostatic",
    mechanism: "Inhibits conversion of plasminogen → plasmin by blocking lysine binding sites → prevents fibrin clot dissolution",
    indications: "Trauma haemorrhage (within 3 h of injury), PPH, surgical bleeding, epistaxis, haemoptysis, menorrhagia (heavy periods)",
    contraindications: "Active thromboembolic disease (DVT/PE), history of seizures (high dose), subarachnoid haemorrhage (controversial), renal failure (reduce dose)",
    dose: "Trauma/PPH: 1 g IV over 10 min STAT; 2nd dose: 1 g over 8 h\nSurgery: 1–1.5 g IV pre-op",
    maxDose: "2 g per episode (trauma); 3–4 g/day (surgical)",
    dilution: "1 g (10 mL) in 100 mL NS or D5W; give over 10–20 min (NOT rapid bolus → convulsions)",
    shelfLife: "4–5 years | Diluted: 8 h at room temp",
    halfLife: "2–3 hours",
  },
  {
    name: "TAPENTADOL",
    color: C.accent6,
    category: "Opioid Agonist | NRI | Strong Analgesic",
    mechanism: "Dual: μ-opioid receptor agonist + noradrenaline reuptake inhibitor → multimodal central analgesia",
    indications: "Moderate–severe acute pain, chronic musculoskeletal pain, neuropathic pain, post-op pain, diabetic neuropathy",
    contraindications: "MAOIs (within 14 days), severe asthma/COPD, respiratory depression, paralytic ileus, <18 yrs (IR), epilepsy",
    dose: "Oral IR: 50–100 mg q4–6 h; 2nd dose 1 h after 1st if needed\nOral ER: 50–250 mg BD",
    maxDose: "700 mg on day 1; 600 mg/day thereafter (IR) | 500 mg/day (ER)",
    dilution: "Oral form only (no IV preparation); take with or without food",
    shelfLife: "3 years",
    halfLife: "4–5 hours",
  },
  {
    name: "PHENYTOIN",
    color: C.accent7,
    category: "Antiepileptic | Anticonvulsant | Class IB Antiarrhythmic",
    mechanism: "Blocks voltage-gated Na⁺ channels (use-dependent) → ↓ neuronal membrane excitability → suppresses epileptiform firing",
    indications: "Status epilepticus (2nd line), generalised tonic-clonic & partial seizures, post-neurosurgical seizure prophylaxis, digoxin-induced arrhythmia",
    contraindications: "2nd/3rd° AV block, sinus bradycardia, Adams-Stokes syndrome, concurrent delavirdine, hypersensitivity",
    dose: "Loading: 15–20 mg/kg IV at ≤50 mg/min\nMaintenance: 4–6 mg/kg/day divided BD–TDS",
    maxDose: "Loading: 30 mg/kg | Rate: NEVER exceed 50 mg/min (cardiac arrhythmias)",
    dilution: "Dilute in NS ONLY (NOT D5W — precipitates!); final conc ≤6.7 mg/mL; use 0.22 µm in-line filter",
    shelfLife: "2–5 years | Diluted: Use within 1 h",
    halfLife: "7–42 h (dose-dependent, saturation kinetics)",
  },
  {
    name: "LORAZEPAM",
    color: C.accent8,
    category: "Benzodiazepine | Anticonvulsant | Anxiolytic",
    mechanism: "Positive allosteric modulator of GABA-A receptor → ↑ Cl⁻ influx → CNS depression, anticonvulsant, anxiolytic",
    indications: "Status epilepticus (1st line IV), acute anxiety, procedural sedation, alcohol withdrawal seizures, pre-anaesthetic",
    contraindications: "Acute angle-closure glaucoma, myasthenia gravis, severe respiratory depression, sleep apnoea, polysubstance overdose, 1st trimester pregnancy",
    dose: "Seizure: 0.1 mg/kg IV (usual 4 mg); may repeat x1 after 5 min\nAnxiety: 0.5–2 mg IV/IM q6–8 h",
    maxDose: "8 mg total per episode (seizure); 10 mg/day (anxiety)",
    dilution: "Dilute 1:1 with NS, D5W or sterile water for IV; give ≤2 mg/min",
    shelfLife: "2–3 years | Diluted: 24 h refrigerated; expires rapidly at room temp",
    halfLife: "10–20 hours (no active metabolite)",
  },
  {
    name: "ONDANSETRON",
    color: C.accent9,
    category: "5-HT3 Antagonist | Antiemetic",
    mechanism: "Selective 5-HT3 antagonist (peripheral vagal afferents + central CTZ) → blocks serotonin-mediated emetic reflex",
    indications: "Post-op N&V, chemotherapy/radiotherapy-induced N&V, intractable N&V, pre-procedural, gastroenteritis vomiting",
    contraindications: "Congenital long QT syndrome, concurrent apomorphine (fatal hypotension), caution with other QT-prolonging drugs",
    dose: "IV: 4–8 mg over 15 min (PON&V); 8 mg over 15 min (chemo)\nOral: 8 mg BD–TDS",
    maxDose: "32 mg/day (single IV dose ≤16 mg); IV single dose now capped at 32 mg (FDA safety)",
    dilution: "4–8 mg in 50 mL NS or D5W over 15 min; undiluted 2 mg/mL for slow push",
    shelfLife: "3–5 years | Diluted: 48 h (2–8°C) or 24 h (room temp)",
    halfLife: "3–6 hours",
  },
  {
    name: "NORADRENALINE",
    color: C.accent10,
    category: "Vasopressor | α1/α2/β1-Agonist",
    mechanism: "Potent α1 + α2 agonist (↑↑ SVR, vasoconstriction) + mild β1 (slight ↑ HR, ↑ contractility) → ↑↑ MAP, ↑ CO",
    indications: "Septic shock (1st-line vasopressor), neurogenic shock, refractory hypotension, distributive shock",
    contraindications: "Hypovolaemia (correct first), mesenteric/peripheral vascular thrombosis, cyclopropane/halothane anaesthesia",
    dose: "Start: 0.01–0.05 mcg/kg/min; titrate to MAP ≥65 mmHg\nUsual range: 0.1–2 mcg/kg/min",
    maxDose: "3–5 mcg/kg/min (no absolute max; titrate to effect; high dose → excessive vasoconstriction)",
    dilution: "4–8 mg in 250 mL D5W/NS (16–32 mcg/mL); ALWAYS via central line ideally",
    shelfLife: "18 months | Diluted: 24 h protected from light",
    halfLife: "~2–3 minutes",
  },
  {
    name: "ADRENALINE (Epinephrine)",
    color: C.accent1,
    category: "α/β-Agonist | Vasopressor | Bronchodilator",
    mechanism: "α1: vasoconstriction (↑ MAP); β1: ↑ HR, ↑ contractility; β2: bronchodilation, ↓ mast cell mediators",
    indications: "Anaphylaxis (1st-line IM), cardiac arrest (VF/pVT/PEA), cardiogenic shock, severe bronchospasm, croup (nebulised)",
    contraindications: "No absolute contraindications in life-threatening emergencies; relative: arrhythmias, coronary artery disease, thyrotoxicosis",
    dose: "Anaphylaxis: 0.5 mg IM (0.5 mL 1:1,000) thigh\nCardiac arrest: 1 mg IV q3–5 min (1:10,000)\nInfusion: 0.01–1 mcg/kg/min",
    maxDose: "No fixed max in cardiac arrest; Anaphylaxis: repeat 0.5 mg IM q5 min PRN",
    dilution: "Infusion: 1 mg (1 mL 1:1,000) in 100 mL NS (10 mcg/mL); Cardiac arrest: 10 mL of 1:10,000 (0.1 mg/mL)",
    shelfLife: "18–24 months | Diluted: 24 h (protect from light); ampoules expire with oxidation",
    halfLife: "~2–3 minutes",
  },
  {
    name: "DOBUTAMINE",
    color: C.accent3,
    category: "β1/β2-Agonist | Inotrope | Cardiogenic Support",
    mechanism: "Selective β1 + mild β2 agonist → ↑ myocardial contractility, ↑ CO, ↓ SVR; minimal chronotropic effect",
    indications: "Cardiogenic shock, acute decompensated HF with ↓ CO, post-cardiac surgery low output, stress echocardiography",
    contraindications: "Hypertrophic obstructive cardiomyopathy (HOCM), uncorrected hypovolaemia, AF/flutter (can worsen), severe aortic stenosis",
    dose: "Start 2.5 mcg/kg/min; usual 2.5–20 mcg/kg/min\nTitrate to CO/clinical response",
    maxDose: "40 mcg/kg/min (rarely needed beyond 20)",
    dilution: "250 mg in 250 mL D5W/NS (1 mg/mL); do NOT mix with sodium bicarbonate (inactivation)",
    shelfLife: "2 years | Diluted: 24 h at room temp (can turn pinkish — stable if mild discolouration)",
    halfLife: "~2 minutes",
  },
  {
    name: "DOPAMINE",
    color: C.accent2,
    category: "Catecholamine | Dose-Dependent Vasopressor/Inotrope",
    mechanism: "Low dose (≤5): D1/D2 → renal/mesenteric vasodilation; Mid (5–10): β1 → ↑ CO; High (>10): α1 → ↑ SVR",
    indications: "Cardiogenic shock, septic shock (2nd-line), haemodynamic support post-cardiac surgery, bradycardia (adjunct)",
    contraindications: "Phaeochromocytoma, uncorrected tachyarrhythmias/VF, hypovolaemia (correct first), MAOIs within 14 days",
    dose: "Low (renal): 1–5 mcg/kg/min | Inotropic: 5–10 mcg/kg/min | Vasopressor: 10–20 mcg/kg/min",
    maxDose: "50 mcg/kg/min (extreme; titrate to response)",
    dilution: "400–800 mg in 250 mL D5W/NS; use infusion pump; extravasation → phentolamine",
    shelfLife: "2–3 years | Diluted: 24 h at room temp",
    halfLife: "~2 minutes",
  },
  {
    name: "ATROPINE",
    color: C.accent4,
    category: "Anticholinergic | Parasympatholytic | Antidote",
    mechanism: "Competitive muscarinic receptor antagonist → ↑ HR (blocks vagal tone), ↓ secretions, bronchodilation, mydriasis, ↓ GI motility",
    indications: "Symptomatic bradycardia (sinus, AV block 2°/3°), organophosphate/nerve agent poisoning, pre-op antisecretory, CPR (historical – now limited)",
    contraindications: "Angle-closure glaucoma, myasthenia gravis, tachycardia, urinary retention, GI obstruction, pyloric stenosis",
    dose: "Bradycardia: 0.5–1 mg IV q3–5 min\nOrganophosphate: 2–4 mg IV q5–10 min (titrate to dry secretions)\nPaeds: 0.02 mg/kg IV",
    maxDose: "Bradycardia: 3 mg total | OP poisoning: no upper limit (titrate secretions)",
    dilution: "Undiluted (0.6 mg/mL or 1 mg/mL ampoule); may dilute in 10 mL NS; give rapid IV push",
    shelfLife: "3–5 years | Diluted: 24 h",
    halfLife: "2–3 hours",
  },
  {
    name: "NITROGLYCERIN (GTN)",
    color: C.accent5,
    category: "Organic Nitrate | Vasodilator | Antianginal",
    mechanism: "Releases NO → activates guanylyl cyclase → ↑ cGMP → smooth muscle relaxation → venodilation (low dose) + arteriodilation (high dose) → ↓ preload, ↓ afterload",
    indications: "Acute angina/ACS, STEMI (adjunct), hypertensive emergency with ACS, decompensated HF (↑ filling pressures), oesophageal spasm",
    contraindications: "Systolic BP <90 mmHg, RV infarct, PDE-5 inhibitors (sildenafil/tadalafil within 24–48 h), severe aortic stenosis, raised ICP",
    dose: "SL: 0.4 mg q5 min × 3 doses\nIV infusion: 5–200 mcg/min (start 5–10 mcg/min, titrate)",
    maxDose: "SL: 3 doses; IV: 400 mcg/min (haemodynamic guidance)",
    dilution: "50 mg in 250 mL D5W (200 mcg/mL); use glass bottles + non-PVC tubing (adsorbs to PVC)",
    shelfLife: "2–3 years | Diluted: 24 h (glass, non-PVC); SL tabs: 6–12 months after opening",
    halfLife: "1–3 minutes (IV); ~20 min (patch)",
  },
  {
    name: "IV FLUIDS",
    color: C.accent7,
    category: "Volume Resuscitation | Electrolyte Balance",
    mechanism: "NS (0.9%): isotonic → expands ECF (limited to 25% intravascular); Hartmann's/LR: balanced crystalloid; Colloids: oncotic expansion; Albumin: oncotic + anti-inflammatory",
    indications: "Hypovolaemia, shock resuscitation, surgical maintenance, electrolyte replacement, drug dilution, DKA, burns, sepsis",
    contraindications: "Pulmonary oedema (excess), NS in hyperchloraemic acidosis, D5W in cerebral oedema/hyponatraemia, hyperaldosteronism",
    dose: "Resuscitation: 500 mL crystalloid bolus IV over 15 min; reassess\nMaintenance: 25–30 mL/kg/day adults\nDKA: 1 L NS over 1st h",
    maxDose: "Goal-directed (avoid fluid overload); limit NS to prevent hyperchloraemic acidosis",
    dilution: "Ready to use; warm to 37°C for large volumes; compatibility check before adding drugs",
    shelfLife: "2–5 years (sealed) | Once opened: use within session",
    halfLife: "NS: t½ intravascular ~1 h; Albumin: ~16–24 h",
  },
];

// ─── Slide dimensions ─────────────────────────────────────────────────────────
const SW = 13.3, SH = 7.5;

// ─── SLIDE 1: COVER ──────────────────────────────────────────────────────────
{
  const slide = pres.addSlide();
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: SW, h: SH, fill: { color: C.bg } });

  // Top accent bar
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: SW, h: 0.08, fill: { color: C.accent1 } });
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0.08, w: SW, h: 0.04, fill: { color: C.accent2 } });

  // Title
  slide.addText("EMERGENCY DRUG", {
    x: 0.5, y: 1.2, w: 12.3, h: 1.2,
    fontSize: 64, bold: true, color: C.white,
    align: "center", fontFace: "Arial",
    charSpacing: 12,
  });
  slide.addText("QUICK REFERENCE CHART", {
    x: 0.5, y: 2.5, w: 12.3, h: 0.9,
    fontSize: 36, bold: true, color: C.accent2,
    align: "center", fontFace: "Arial",
    charSpacing: 6,
  });

  // Subtitle line
  slide.addShape(pres.shapes.RECTANGLE, { x: 3.5, y: 3.6, w: 6.3, h: 0.04, fill: { color: C.accent4 } });

  slide.addText("Mechanism • Indications • Contraindications • Dose • Max Dose • Dilution • Shelf Life • Half-Life", {
    x: 0.5, y: 3.75, w: 12.3, h: 0.6,
    fontSize: 16, color: C.lightGray,
    align: "center", fontFace: "Arial", italic: true,
  });

  // Drug list
  const drugNames = drugs.map(d => d.name).join("  •  ");
  slide.addText(drugNames, {
    x: 0.5, y: 4.55, w: 12.3, h: 0.5,
    fontSize: 11, color: C.accent7,
    align: "center", fontFace: "Arial",
  });

  // Drug count badges
  const badges = ["16 Drugs", "Complete Reference", "ICU / Emergency Use"];
  badges.forEach((b, i) => {
    const bx = 2.2 + i * 3.1;
    slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x: bx, y: 5.3, w: 2.6, h: 0.5,
      fill: { color: C.hdr }, rectRadius: 0.1,
      line: { color: C.accent4, width: 1 },
    });
    slide.addText(b, {
      x: bx, y: 5.3, w: 2.6, h: 0.5,
      fontSize: 12, color: C.accent4, bold: true,
      align: "center", valign: "middle",
    });
  });

  slide.addText("For educational purposes | Always verify local protocols and current guidelines", {
    x: 0.5, y: 7.0, w: 12.3, h: 0.35,
    fontSize: 10, color: "5A7A9C", align: "center", italic: true,
  });
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: SH - 0.08, w: SW, h: 0.08, fill: { color: C.accent3 } });
}

// ─── SLIDES 2–17: One drug per slide ─────────────────────────────────────────
drugs.forEach((drug, idx) => {
  const slide = pres.addSlide();
  const col = drug.color;

  // Background
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: SW, h: SH, fill: { color: C.bg } });

  // Top colour bar
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: SW, h: 0.55, fill: { color: col } });

  // Drug number badge
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 0.18, y: 0.08, w: 0.4, h: 0.38,
    fill: { color: C.bg }, rectRadius: 0.05,
  });
  slide.addText(`${idx + 1}`, {
    x: 0.18, y: 0.08, w: 0.4, h: 0.38,
    fontSize: 12, bold: true, color: col,
    align: "center", valign: "middle",
  });

  // Drug name
  slide.addText(drug.name, {
    x: 0.7, y: 0.04, w: 9.5, h: 0.5,
    fontSize: 26, bold: true, color: C.white,
    fontFace: "Arial", valign: "middle", margin: 0,
  });

  // Category badge
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 10.25, y: 0.08, w: 2.85, h: 0.38,
    fill: { color: C.bg }, rectRadius: 0.05,
  });
  slide.addText(drug.category, {
    x: 10.25, y: 0.08, w: 2.85, h: 0.38,
    fontSize: 9, color: col, bold: true,
    align: "center", valign: "middle", wrap: true,
  });

  // ── Grid layout: 4 columns × 2 rows of info cards
  const cards = [
    { label: "⚙️ MECHANISM",           value: drug.mechanism,          col: C.accent4 },
    { label: "✅ INDICATIONS",          value: drug.indications,        col: C.accent3 },
    { label: "🚫 CONTRAINDICATIONS",   value: drug.contraindications,  col: C.accent1 },
    { label: "💊 DOSE",                 value: drug.dose,               col: C.accent2 },
    { label: "⚠️ MAX DOSE",            value: drug.maxDose,            col: C.accent6 },
    { label: "🧪 DILUTION / HOW TO USE",value: drug.dilution,          col: C.accent5 },
    { label: "🗓️ SHELF LIFE",          value: drug.shelfLife,          col: C.accent7 },
    { label: "⏱️ HALF-LIFE",           value: drug.halfLife,           col: C.accent9 },
  ];

  const cols4 = 4, rows2 = 2;
  const cardW = 3.15, cardH = 2.9;
  const gapX = 0.1, gapY = 0.12;
  const startX = 0.1, startY = 0.65;

  cards.forEach((card, i) => {
    const col2 = i % cols4;
    const row2 = Math.floor(i / cols4);
    const x = startX + col2 * (cardW + gapX);
    const y = startY + row2 * (cardH + gapY);

    // Card bg
    slide.addShape(pres.shapes.RECTANGLE, {
      x, y, w: cardW, h: cardH,
      fill: { color: C.panel },
      shadow: { type: "outer", color: "000000", blur: 4, offset: 2, angle: 135, opacity: 0.2 },
    });

    // Label bar
    slide.addShape(pres.shapes.RECTANGLE, {
      x, y, w: cardW, h: 0.32,
      fill: { color: card.col },
    });
    slide.addText(card.label, {
      x: x + 0.07, y, w: cardW - 0.07, h: 0.32,
      fontSize: 9.5, bold: true, color: C.white,
      valign: "middle", fontFace: "Arial", margin: 0,
    });

    // Content
    slide.addText(card.value, {
      x: x + 0.1, y: y + 0.34, w: cardW - 0.2, h: cardH - 0.44,
      fontSize: 9.5, color: C.lightGray,
      valign: "top", fontFace: "Arial",
      wrap: true, autoFit: true,
    });
  });

  // Footer
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: SH - 0.22, w: SW, h: 0.22, fill: { color: C.hdr } });
  slide.addText(`Drug ${idx + 1} of ${drugs.length}  |  ${drug.name}  |  Educational Reference Chart`, {
    x: 0.2, y: SH - 0.22, w: 12.9, h: 0.22,
    fontSize: 8, color: "4A6A8A", align: "center", valign: "middle",
  });
});

// ─── SLIDE 18: SUMMARY TABLE ─────────────────────────────────────────────────
{
  const slide = pres.addSlide();
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: SW, h: SH, fill: { color: C.bg } });
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: SW, h: 0.55, fill: { color: C.accent4 } });
  slide.addText("EMERGENCY DRUGS — AT A GLANCE SUMMARY", {
    x: 0.3, y: 0.06, w: 12.7, h: 0.43,
    fontSize: 22, bold: true, color: C.white, fontFace: "Arial", valign: "middle",
  });

  const headers = ["DRUG", "CATEGORY", "DOSE", "HALF-LIFE", "KEY NOTE"];
  const rows = drugs.map(d => [
    d.name,
    d.category.split("|")[0].trim(),
    d.dose.split("\n")[0],
    d.halfLife,
    d.contraindications.split(",")[0],
  ]);

  const colWidths = [2.2, 2.4, 3.8, 1.3, 3.3];
  const rowH = 0.365;
  const startY = 0.65;
  const startX = 0.1;

  // Header row
  headers.forEach((h, ci) => {
    let cx = startX;
    for (let k = 0; k < ci; k++) cx += colWidths[k];
    slide.addShape(pres.shapes.RECTANGLE, {
      x: cx, y: startY, w: colWidths[ci], h: rowH,
      fill: { color: C.accent4 },
    });
    slide.addText(h, {
      x: cx + 0.05, y: startY, w: colWidths[ci] - 0.1, h: rowH,
      fontSize: 9, bold: true, color: C.white, valign: "middle",
    });
  });

  // Data rows
  rows.forEach((row, ri) => {
    const ry = startY + (ri + 1) * rowH;
    const rowColor = ri % 2 === 0 ? C.panel : C.panelAlt;
    const dotColor = drugs[ri].color;
    row.forEach((cell, ci) => {
      let cx = startX;
      for (let k = 0; k < ci; k++) cx += colWidths[k];
      slide.addShape(pres.shapes.RECTANGLE, {
        x: cx, y: ry, w: colWidths[ci], h: rowH,
        fill: { color: rowColor },
        line: { color: C.bg, width: 0.5 },
      });
      if (ci === 0) {
        slide.addShape(pres.shapes.RECTANGLE, {
          x: cx, y: ry, w: 0.05, h: rowH,
          fill: { color: dotColor },
        });
      }
      slide.addText(cell, {
        x: cx + (ci === 0 ? 0.1 : 0.05), y: ry, w: colWidths[ci] - 0.15, h: rowH,
        fontSize: 8, color: C.lightGray, valign: "middle", wrap: true, autoFit: true,
      });
    });
  });

  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: SH - 0.22, w: SW, h: 0.22, fill: { color: C.hdr } });
  slide.addText("Emergency Drug Reference | For educational purposes only | Always verify with current local formulary", {
    x: 0.2, y: SH - 0.22, w: 12.9, h: 0.22,
    fontSize: 8, color: "4A6A8A", align: "center", valign: "middle",
  });
}

// ─── Write file ───────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/emergency-drugs-poster/Emergency_Drug_Chart.pptx" })
  .then(() => console.log("SUCCESS: File written"))
  .catch(e => console.error("ERROR:", e));
Reading File
Writing File

~/emergency-drugs-poster/build_v2.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3" x 7.5"

// ─── Color Palette ───────────────────────────────────────────────────────────
const C = {
  bg:       "0A1628",
  panel:    "0D1F3C",
  panelAlt: "0E2445",
  accent1:  "E8383D",
  accent2:  "F4A61A",
  accent3:  "27AE60",
  accent4:  "2E86DE",
  accent5:  "9B59B6",
  accent6:  "E67E22",
  accent7:  "1ABC9C",
  accent8:  "E74C3C",
  accent9:  "3498DB",
  accent10: "8E44AD",
  white:    "FFFFFF",
  lightGray:"C8D6E5",
  yellow:   "F9CA24",
  hdr:      "152744",
};

// ─── Drug Data ────────────────────────────────────────────────────────────────
const drugs = [
  {
    name: "LABETALOL",
    color: C.accent1,
    category: "Alpha/Beta-Blocker | Antihypertensive",
    mechanism: "Non-selective beta-blocker + selective alpha-1 blocker. Reduces heart rate, SVR and BP simultaneously. Ratio alpha:beta block = 1:7 (IV).",
    indications: "Hypertensive emergencies, pre-eclampsia/eclampsia, aortic dissection, phaeochromocytoma crisis, hypertension post-stroke",
    contraindications: "Asthma/COPD, 2nd/3rd degree AV block, cardiogenic shock, bradycardia <50/min, decompensated heart failure",
    dose: "IV bolus: 20 mg over 2 min; repeat 40-80 mg every 10 min\nInfusion: 1-2 mg/min titrated\nOral: 100-400 mg BD",
    maxDose: "Bolus total: 300 mg per session | Infusion: 300 mg/session",
    dilution: "200 mg in 200 mL NS/D5W (1 mg/mL); for bolus use undiluted 5 mg/mL ampoule",
    shelfLife: "Undiluted: 2 years | Diluted: 24 h room temp / 48 h refrigerated",
    halfLife: "5 to 8 hours",
  },
  {
    name: "METOCLOPRAMIDE",
    color: C.accent2,
    category: "D2-Antagonist | Prokinetic | Antiemetic",
    mechanism: "Central and peripheral D2-receptor antagonist + 5-HT3 antagonist. Increases gastric motility, raises lower oesophageal sphincter tone, blocks CTZ.",
    indications: "Nausea/vomiting (all causes), gastroparesis, GORD, post-op ileus, migraine (adjunct), pre-procedure gastric emptying",
    contraindications: "GI obstruction or perforation, phaeochromocytoma, Parkinson's disease, seizure disorders, history of tardive dyskinesia",
    dose: "IV/IM: 10 mg over 1-2 min; Oral: 10 mg TDS before meals\nCRI: 25-75 mg/24 h",
    maxDose: "30 mg/day (adult) | 0.5 mg/kg/day (paediatric)",
    dilution: "10 mg in 50 mL NS, give over 15 min IV (reduces extrapyramidal side effects)",
    shelfLife: "Undiluted: 3 years | Diluted: 48 h protected from light",
    halfLife: "5 to 6 hours",
  },
  {
    name: "TRAMADOL",
    color: C.accent3,
    category: "Weak Opioid Agonist | SNRI | Analgesic",
    mechanism: "Weak mu-opioid receptor agonist + inhibits reuptake of serotonin and noradrenaline in descending pain pathways. Dual central analgesic action.",
    indications: "Moderate to severe acute/chronic pain, post-operative pain, neuropathic pain, musculoskeletal pain",
    contraindications: "MAOIs within 14 days, active seizure disorder, raised ICP, severe respiratory depression, serotonin syndrome risk, children <12 years",
    dose: "IV: 50-100 mg over 10-20 min every 4-6 h\nOral: 50-100 mg every 6 h\nMax: 400 mg/day",
    maxDose: "400 mg/day (oral) | 600 mg/day (IV, monitored setting)",
    dilution: "100 mg diluted in 100 mL NS, infuse over 30 min (slow infusion reduces nausea/vomiting)",
    shelfLife: "Undiluted: 3 years | Diluted: 24 h",
    halfLife: "6-7 h (active metabolite O-desmethyltramadol: ~9 h)",
  },
  {
    name: "AVIL (Pheniramine)",
    color: C.accent4,
    category: "H1-Antihistamine | Antiallergic",
    mechanism: "Competitive H1-receptor antagonist. Blocks histamine-mediated vasodilation, bronchoconstriction, pruritus and oedema. Also mild CNS sedation.",
    indications: "Allergic reactions, anaphylaxis (adjunct to adrenaline), urticaria, angioedema, pruritus, transfusion reactions, insect bites/stings",
    contraindications: "Acute asthma (use cautiously), neonates, nursing mothers, concurrent MAOIs, narrow-angle glaucoma, benign prostatic hypertrophy",
    dose: "IM/IV: 22.75 mg (1 mL) to 45.5 mg (2 mL) slow IV\nOral: 25-50 mg twice to three times daily",
    maxDose: "100 mg/24 h (IV) | 200 mg/24 h (oral)",
    dilution: "Dilute in 10 mL NS, give over 2-3 min slow IV. IM can be given undiluted.",
    shelfLife: "3 years | Diluted: 8 h",
    halfLife: "16 to 19 hours",
  },
  {
    name: "TRANEXAMIC ACID",
    color: C.accent5,
    category: "Antifibrinolytic | Haemostatic",
    mechanism: "Inhibits conversion of plasminogen to plasmin by occupying lysine binding sites on plasminogen. Prevents fibrin clot dissolution (antifibrinolysis).",
    indications: "Trauma haemorrhage (within 3 h), postpartum haemorrhage (PPH), surgical bleeding, menorrhagia, epistaxis, haemoptysis, dental extraction in haemophiliacs",
    contraindications: "Active thromboembolic disease (DVT/PE), subarachnoid haemorrhage (controversial), renal failure (reduce dose), history of seizures (high dose IV)",
    dose: "Trauma/PPH: 1 g IV over 10 min STAT; then 1 g over 8 h\nSurgery: 1-1.5 g IV pre-op",
    maxDose: "2 g per episode (trauma); 3-4 g/day (surgical/gynaecological)",
    dilution: "1 g (10 mL) in 100 mL NS or D5W; infuse over 10-20 min. NEVER rapid IV bolus (causes convulsions).",
    shelfLife: "4-5 years | Diluted: 8 h at room temperature",
    halfLife: "2 to 3 hours",
  },
  {
    name: "TAPENTADOL",
    color: C.accent6,
    category: "Strong Opioid | NRI | Dual Mechanism Analgesic",
    mechanism: "Dual mechanism: mu-opioid receptor agonist (like morphine) + noradrenaline reuptake inhibitor (like SNRIs). Multimodal central analgesia with less opioid burden.",
    indications: "Moderate-severe acute pain, chronic musculoskeletal/neuropathic pain, post-operative pain, diabetic peripheral neuropathy",
    contraindications: "MAOIs within 14 days, severe asthma/respiratory depression, paralytic ileus, patients <18 yrs (IR form), uncontrolled epilepsy",
    dose: "Oral IR: 50-100 mg every 4-6 h; 2nd dose 1 h after 1st if needed\nOral ER: 50-250 mg BD",
    maxDose: "Day 1: 700 mg; thereafter 600 mg/day (IR) | ER: 500 mg/day",
    dilution: "Oral formulation only (no IV preparation available). Take with or without food.",
    shelfLife: "3 years",
    halfLife: "4 to 5 hours",
  },
  {
    name: "PHENYTOIN",
    color: C.accent7,
    category: "Antiepileptic | Na-Channel Blocker | Class IB Antiarrhythmic",
    mechanism: "Blocks voltage-gated Na+ channels (use-dependent blockade). Decreases neuronal membrane excitability and suppresses epileptiform firing without CNS depression.",
    indications: "Status epilepticus (2nd line after BZDs), generalised tonic-clonic seizures, partial seizures, post-neurosurgical prophylaxis, digoxin-induced arrhythmia",
    contraindications: "2nd/3rd degree AV block, sinus bradycardia, Adams-Stokes syndrome, concurrent delavirdine use, hypersensitivity to hydantoins",
    dose: "Loading: 15-20 mg/kg IV at max 50 mg/min\nMaintenance: 4-6 mg/kg/day divided BD-TDS\nTherapeutic level: 10-20 mcg/mL",
    maxDose: "Loading dose max 30 mg/kg | Rate NEVER exceed 50 mg/min (risk: cardiac arrhythmia, hypotension)",
    dilution: "Dilute in NS ONLY (precipitates in D5W!); final conc <=6.7 mg/mL. Use 0.22 micron in-line filter. Flush line with NS.",
    shelfLife: "2-5 years | Diluted: use within 1 hour (precipitates rapidly)",
    halfLife: "7-42 h (dose-dependent, saturable/Michaelis-Menten kinetics)",
  },
  {
    name: "LORAZEPAM",
    color: C.accent8,
    category: "Benzodiazepine | Anticonvulsant | Anxiolytic",
    mechanism: "Positive allosteric modulator of GABA-A receptor. Increases frequency of Cl- channel opening, enhancing inhibitory neurotransmission. No active metabolites.",
    indications: "Status epilepticus (1st-line IV), acute severe anxiety/agitation, procedural sedation, alcohol withdrawal seizures, pre-anaesthetic, acute mania",
    contraindications: "Acute angle-closure glaucoma, myasthenia gravis, severe respiratory depression, obstructive sleep apnoea, 1st trimester pregnancy",
    dose: "Seizure: 0.1 mg/kg IV (usual 4 mg adult); may repeat x1 after 5 min\nAnxiety: 0.5-2 mg IV/IM every 6-8 h",
    maxDose: "8 mg total per seizure episode | 10 mg/day (anxiety)",
    dilution: "Dilute 1:1 with NS, D5W or sterile water for IV use. Rate <=2 mg/min. IM can be given undiluted.",
    shelfLife: "2-3 years | Diluted: 24 h refrigerated (expires rapidly at room temp)",
    halfLife: "10 to 20 hours (no active metabolite - advantageous in elderly/hepatic)",
  },
  {
    name: "ONDANSETRON",
    color: C.accent9,
    category: "5-HT3 Receptor Antagonist | Antiemetic",
    mechanism: "Selective 5-HT3 receptor antagonist at peripheral vagal nerve terminals and central chemoreceptor trigger zone (CTZ). Blocks serotonin-mediated emetic reflex.",
    indications: "Post-operative nausea/vomiting (PONV), chemotherapy/radiotherapy-induced N&V, intractable vomiting, gastroenteritis, pre-procedure antiemetic",
    contraindications: "Congenital long QT syndrome, concurrent apomorphine (severe hypotension/loss of consciousness), caution with other QT-prolonging drugs",
    dose: "IV: 4-8 mg over 15 min (PONV); 8 mg over 15 min (chemo-induced)\nOral: 8 mg BD-TDS\nODT: 8 mg sublingual",
    maxDose: "32 mg/day; single IV dose capped at 16 mg (FDA 2012 safety advisory re: QT prolongation)",
    dilution: "4-8 mg in 50 mL NS or D5W, infuse over 15 min. Undiluted 2 mg/mL for slow IV push.",
    shelfLife: "3-5 years | Diluted: 48 h at 2-8 degrees C or 24 h room temperature",
    halfLife: "3 to 6 hours",
  },
  {
    name: "NORADRENALINE",
    color: C.accent10,
    category: "Vasopressor | Alpha-1/Alpha-2/Beta-1 Agonist",
    mechanism: "Potent alpha-1 and alpha-2 agonist (vasoconstriction, increases SVR) + mild beta-1 agonism (mild inotropy). Increases MAP without major tachycardia.",
    indications: "Septic shock (1st-line vasopressor per Surviving Sepsis Guidelines), neurogenic shock, refractory hypotension, distributive shock states",
    contraindications: "Hypovolaemia (correct first before starting), mesenteric/peripheral vascular thrombosis, cyclopropane or halothane anaesthesia",
    dose: "Start: 0.01-0.05 mcg/kg/min; titrate to MAP >=65 mmHg\nUsual range: 0.1-2 mcg/kg/min",
    maxDose: "Up to 3-5 mcg/kg/min; no absolute maximum - titrate to haemodynamic targets. High dose causes excessive vasoconstriction.",
    dilution: "4-8 mg in 250 mL D5W or NS (16-32 mcg/mL). Preferably via central line. Peripheral extravasation causes tissue necrosis.",
    shelfLife: "18 months | Diluted: 24 h protected from light (oxidises rapidly)",
    halfLife: "Approx 2-3 minutes (ultra-short; requires continuous infusion)",
  },
  {
    name: "ADRENALINE (Epinephrine)",
    color: C.accent1,
    category: "Alpha/Beta Agonist | Vasopressor | First-Line Anaphylaxis",
    mechanism: "Alpha-1: vasoconstriction (increases MAP, reduces mucosal oedema); Beta-1: increases HR and contractility; Beta-2: bronchodilation, inhibits mast cell mediator release.",
    indications: "Anaphylaxis (1st-line IM), cardiac arrest (VF/pVT/PEA/asystole), cardiogenic shock, severe bronchospasm, croup (nebulised), septic shock adjunct",
    contraindications: "No absolute contraindications in life-threatening emergencies. Relative: arrhythmias, severe coronary artery disease, thyrotoxicosis.",
    dose: "Anaphylaxis: 0.5 mg IM (0.5 mL of 1:1000) into anterolateral thigh\nCardiac arrest: 1 mg IV every 3-5 min (1:10,000)\nInfusion: 0.01-1 mcg/kg/min",
    maxDose: "Cardiac arrest: no fixed maximum; Anaphylaxis: repeat 0.5 mg IM every 5 min as needed",
    dilution: "Infusion: 1 mg in 100 mL NS (10 mcg/mL). Cardiac arrest: 10 mL of 1:10,000 solution (0.1 mg/mL). IM anaphylaxis: undiluted 1:1000.",
    shelfLife: "18-24 months | Diluted: 24 h (protect from light). Discard if discoloured/brown.",
    halfLife: "Approx 2-3 minutes (continuous infusion required for sustained effect)",
  },
  {
    name: "DOBUTAMINE",
    color: C.accent3,
    category: "Beta-1/Beta-2 Agonist | Inotrope | Cardiogenic Support",
    mechanism: "Selective beta-1 agonist + mild beta-2 agonism. Increases myocardial contractility and cardiac output. Modest chronotropy. Reduces SVR (afterload reduction).",
    indications: "Cardiogenic shock, acute decompensated heart failure with reduced CO, post-cardiac surgery low output syndrome, pharmacological stress echocardiography",
    contraindications: "Hypertrophic obstructive cardiomyopathy (HOCM), uncorrected hypovolaemia, AF/flutter (may increase ventricular rate), severe aortic stenosis",
    dose: "Start 2.5 mcg/kg/min; usual range 2.5-20 mcg/kg/min\nTitrate to cardiac output, BP and clinical response",
    maxDose: "40 mcg/kg/min (rarely needed; most effect achieved by 20 mcg/kg/min)",
    dilution: "250 mg in 250 mL D5W or NS (1 mg/mL). Do NOT mix with sodium bicarbonate (inactivation). Use infusion pump.",
    shelfLife: "2 years | Diluted: 24 h at room temperature (mild pinkish discolouration - stable if slight)",
    halfLife: "Approx 2 minutes (requires continuous infusion)",
  },
  {
    name: "DOPAMINE",
    color: C.accent2,
    category: "Catecholamine | Dose-Dependent Vasopressor/Inotrope",
    mechanism: "Dose-dependent: Low (1-5 mcg/kg/min): D1/D2 dopaminergic - renal/mesenteric vasodilation; Mid (5-10): beta-1 - increases CO; High (>10): alpha-1 - vasoconstriction.",
    indications: "Cardiogenic shock, septic shock (2nd-line to noradrenaline), haemodynamic support post-cardiac surgery, symptomatic bradycardia (adjunct)",
    contraindications: "Phaeochromocytoma, uncorrected tachyarrhythmias or VF, hypovolaemia (correct first), MAOIs within 14 days, sulphite sensitivity",
    dose: "Renal dose: 1-5 mcg/kg/min | Inotropic: 5-10 mcg/kg/min | Vasopressor: 10-20 mcg/kg/min",
    maxDose: "50 mcg/kg/min (extreme cases); titrate to haemodynamic response",
    dilution: "400-800 mg in 250 mL D5W or NS. Use infusion pump only. Extravasation: phentolamine 5-10 mg local injection.",
    shelfLife: "2-3 years | Diluted: 24 h at room temperature",
    halfLife: "Approx 2 minutes (requires continuous infusion)",
  },
  {
    name: "ATROPINE",
    color: C.accent4,
    category: "Anticholinergic | Parasympatholytic | Antidote",
    mechanism: "Competitive muscarinic receptor antagonist. Blocks vagal tone: increases HR, decreases secretions (salivary/bronchial), bronchodilation, mydriasis, decreases GI motility.",
    indications: "Symptomatic bradycardia (sinus, 1st/2nd degree AV block), organophosphate/nerve agent poisoning, pre-op antisecretory, bradycardia during anaesthesia",
    contraindications: "Angle-closure glaucoma, myasthenia gravis, existing tachycardia, urinary retention/BPH, GI obstruction, pyloric stenosis",
    dose: "Bradycardia: 0.5-1 mg IV every 3-5 min (max 3 mg)\nOrganophosphate: 2-4 mg IV every 5-10 min (titrate to dry secretions)\nPaeds: 0.02 mg/kg IV",
    maxDose: "Bradycardia: 3 mg total | OP poisoning: no upper limit (clinical titration to secretion drying)",
    dilution: "Available as 0.6 mg/mL or 1 mg/mL. May dilute in 10 mL NS. For bradycardia: give as rapid IV push.",
    shelfLife: "3-5 years | Diluted: 24 h",
    halfLife: "2 to 3 hours",
  },
  {
    name: "NITROGLYCERIN (GTN)",
    color: C.accent5,
    category: "Organic Nitrate | Vasodilator | Antianginal",
    mechanism: "Converted to nitric oxide (NO) -> activates guanylyl cyclase -> increases cGMP -> smooth muscle relaxation. Low dose: venodilation (decreases preload). High dose: arteriodilation (decreases afterload).",
    indications: "Acute angina/ACS (SL), STEMI adjunct, hypertensive emergency with ACS, acute decompensated HF (high filling pressures), oesophageal spasm",
    contraindications: "Systolic BP <90 mmHg, right ventricular infarction, PDE-5 inhibitors (sildenafil/tadalafil within 24-48 h), severe aortic stenosis, raised ICP",
    dose: "SL: 0.3-0.4 mg every 5 min x 3 doses\nIV infusion: Start 5-10 mcg/min; titrate up to 200 mcg/min",
    maxDose: "SL: 3 doses; IV: up to 400 mcg/min (haemodynamic-guided); tolerance develops after 24 h",
    dilution: "50 mg in 250 mL D5W (200 mcg/mL). Use glass bottles and non-PVC tubing (adsorbs to PVC). Protect from light.",
    shelfLife: "2-3 years | Diluted: 24 h (glass, non-PVC only). SL tablets: 6-12 months after opening.",
    halfLife: "1-3 minutes (IV); patch ~20 min; tolerance with continuous infusion >24 h",
  },
  {
    name: "IV FLUIDS",
    color: C.accent7,
    category: "Crystalloids/Colloids | Volume Resuscitation | Electrolyte Replacement",
    mechanism: "NS 0.9%: isotonic crystalloid, expands ECF (only 25% stays intravascular after 1 h). Hartmann's/LR: balanced electrolyte, less hyperchloraemic acidosis. Colloids: oncotic pressure expansion.",
    indications: "Hypovolaemia, shock resuscitation, surgical maintenance fluids, electrolyte replacement, drug dilution vehicle, DKA protocol, burns resuscitation, sepsis",
    contraindications: "Pulmonary oedema (excess administration), NS in hyperchloraemic acidosis or renal failure, D5W in cerebral oedema or hyponatraemia",
    dose: "Resuscitation: 500 mL crystalloid bolus over 15 min; reassess and repeat\nMaintenance: 25-30 mL/kg/day\nDKA: 1 L NS in first hour",
    maxDose: "Goal-directed therapy. Avoid fluid overload. Limit NS to prevent hyperchloraemic acidosis. TISS/SOFA monitoring.",
    dilution: "Ready to use. Warm to 37 degrees C for large volume resuscitation. Always check drug compatibility before adding.",
    shelfLife: "2-5 years (sealed) | Once opened: single-use session only",
    halfLife: "NS intravascular t1/2: ~1 h; Albumin 5%: ~16 h; Hartmann's: ~30 min",
  },
];

const SW = 13.3, SH = 7.5;

// ─── SLIDE 1: COVER ──────────────────────────────────────────────────────────
{
  const slide = pres.addSlide();
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: SW, h: SH, fill: { color: C.bg } });

  // Decorative bars
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: SW, h: 0.1, fill: { color: C.accent1 } });
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0.1, w: SW, h: 0.05, fill: { color: C.accent2 } });
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: SH - 0.1, w: SW, h: 0.1, fill: { color: C.accent3 } });

  // Side accent
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.12, h: SH, fill: { color: C.accent4 } });

  // Main title
  slide.addText("EMERGENCY DRUG", {
    x: 0.3, y: 1.0, w: 12.7, h: 1.4,
    fontSize: 72, bold: true, color: C.white,
    align: "center", fontFace: "Arial",
  });
  slide.addText("QUICK REFERENCE CHART", {
    x: 0.3, y: 2.5, w: 12.7, h: 0.9,
    fontSize: 38, bold: true, color: C.accent2,
    align: "center", fontFace: "Arial",
  });

  // Divider
  slide.addShape(pres.shapes.RECTANGLE, { x: 2.5, y: 3.55, w: 8.3, h: 0.05, fill: { color: C.accent4 } });

  slide.addText("Mechanism  |  Indications  |  Contraindications  |  Dose  |  Max Dose  |  Dilution  |  Shelf Life  |  Half-Life", {
    x: 0.3, y: 3.7, w: 12.7, h: 0.55,
    fontSize: 15, color: C.lightGray,
    align: "center", fontFace: "Arial", italic: true,
  });

  // Drug names
  const drugList1 = drugs.slice(0,8).map(d => d.name).join("   |   ");
  const drugList2 = drugs.slice(8).map(d => d.name).join("   |   ");
  slide.addText(drugList1, {
    x: 0.3, y: 4.4, w: 12.7, h: 0.4,
    fontSize: 10, color: C.accent7, align: "center", fontFace: "Arial",
  });
  slide.addText(drugList2, {
    x: 0.3, y: 4.82, w: 12.7, h: 0.4,
    fontSize: 10, color: C.accent7, align: "center", fontFace: "Arial",
  });

  // Badges
  const badges = ["16 Emergency Drugs", "Complete Reference", "ICU / Emergency Use"];
  const bColors = [C.accent1, C.accent4, C.accent3];
  badges.forEach((b, i) => {
    const bx = 1.8 + i * 3.3;
    slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x: bx, y: 5.45, w: 2.8, h: 0.55,
      fill: { color: bColors[i] }, rectRadius: 0.08,
    });
    slide.addText(b, {
      x: bx, y: 5.45, w: 2.8, h: 0.55,
      fontSize: 13, color: C.white, bold: true,
      align: "center", valign: "middle",
    });
  });

  slide.addText("For educational and clinical reference purposes | Always verify with current local formulary and guidelines", {
    x: 0.3, y: 7.05, w: 12.7, h: 0.3,
    fontSize: 9, color: "4A6A8A", align: "center", italic: true,
  });
}

// ─── SLIDES 2-17: One drug per slide ─────────────────────────────────────────
drugs.forEach((drug, idx) => {
  const slide = pres.addSlide();

  // Background
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: SW, h: SH, fill: { color: C.bg } });

  // Top header bar
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: SW, h: 0.58, fill: { color: drug.color } });

  // Number badge
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 0.15, y: 0.09, w: 0.4, h: 0.38,
    fill: { color: "00000040" }, rectRadius: 0.05,
  });
  slide.addText(String(idx + 1), {
    x: 0.15, y: 0.09, w: 0.4, h: 0.38,
    fontSize: 14, bold: true, color: C.white,
    align: "center", valign: "middle",
  });

  // Drug name
  slide.addText(drug.name, {
    x: 0.65, y: 0.06, w: 9.5, h: 0.48,
    fontSize: 28, bold: true, color: C.white,
    fontFace: "Arial", valign: "middle", margin: 0,
  });

  // Category tag
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 10.3, y: 0.1, w: 2.85, h: 0.38,
    fill: { color: "00000050" }, rectRadius: 0.06,
  });
  slide.addText(drug.category, {
    x: 10.3, y: 0.1, w: 2.85, h: 0.38,
    fontSize: 8.5, color: C.white, bold: true,
    align: "center", valign: "middle", wrap: true,
  });

  // 8 cards in 4x2 grid
  const cardData = [
    { label: "MECHANISM OF ACTION",         value: drug.mechanism,          accent: C.accent4 },
    { label: "INDICATIONS",                  value: drug.indications,        accent: C.accent3 },
    { label: "CONTRAINDICATIONS",            value: drug.contraindications,  accent: C.accent1 },
    { label: "DOSE",                         value: drug.dose,               accent: C.accent2 },
    { label: "MAXIMUM DOSE",                 value: drug.maxDose,            accent: C.accent6 },
    { label: "DILUTION / HOW TO USE",        value: drug.dilution,           accent: C.accent5 },
    { label: "SHELF LIFE",                   value: drug.shelfLife,          accent: C.accent7 },
    { label: "HALF-LIFE",                    value: drug.halfLife,           accent: C.accent9 },
  ];

  const cardW = 3.17;
  const cardH = 2.88;
  const gapX = 0.09;
  const gapY = 0.1;
  const startX = 0.08;
  const startY = 0.67;

  cardData.forEach((card, i) => {
    const col = i % 4;
    const row = Math.floor(i / 4);
    const x = startX + col * (cardW + gapX);
    const y = startY + row * (cardH + gapY);

    // Card background
    slide.addShape(pres.shapes.RECTANGLE, {
      x, y, w: cardW, h: cardH,
      fill: { color: C.panel },
      shadow: { type: "outer", color: "000000", blur: 5, offset: 2, angle: 135, opacity: 0.25 },
    });

    // Left accent stripe
    slide.addShape(pres.shapes.RECTANGLE, {
      x, y, w: 0.06, h: cardH,
      fill: { color: card.accent },
    });

    // Label bar
    slide.addShape(pres.shapes.RECTANGLE, {
      x: x + 0.06, y, w: cardW - 0.06, h: 0.3,
      fill: { color: card.accent },
    });
    slide.addText(card.label, {
      x: x + 0.12, y, w: cardW - 0.18, h: 0.3,
      fontSize: 9, bold: true, color: C.white,
      valign: "middle", fontFace: "Arial", margin: 0,
    });

    // Value text
    slide.addText(card.value, {
      x: x + 0.1, y: y + 0.32, w: cardW - 0.2, h: cardH - 0.42,
      fontSize: 9.5, color: C.lightGray,
      valign: "top", fontFace: "Arial",
      wrap: true, autoFit: true,
    });
  });

  // Footer
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: SH - 0.2, w: SW, h: 0.2, fill: { color: C.hdr } });
  slide.addText(`Drug ${idx + 1} of ${drugs.length}  |  ${drug.name}  |  Emergency Drug Reference Chart`, {
    x: 0.2, y: SH - 0.2, w: 12.9, h: 0.2,
    fontSize: 7.5, color: "4A6A8A", align: "center", valign: "middle",
  });
});

// ─── SLIDE 18: SUMMARY TABLE ─────────────────────────────────────────────────
{
  const slide = pres.addSlide();
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: SW, h: SH, fill: { color: C.bg } });
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: SW, h: 0.58, fill: { color: C.accent4 } });
  slide.addText("EMERGENCY DRUGS  |  AT-A-GLANCE SUMMARY", {
    x: 0.3, y: 0.06, w: 12.7, h: 0.46,
    fontSize: 24, bold: true, color: C.white, fontFace: "Arial", valign: "middle",
  });

  const headers = ["DRUG", "CATEGORY", "STANDARD DOSE", "HALF-LIFE", "KEY CONTRAINDICATION"];
  const colWidths = [2.2, 2.5, 3.6, 1.3, 3.4];
  const rowH = 0.355;
  const startY = 0.66;
  const startX = 0.08;

  // Header
  headers.forEach((h, ci) => {
    let cx = startX;
    for (let k = 0; k < ci; k++) cx += colWidths[k];
    slide.addShape(pres.shapes.RECTANGLE, {
      x: cx, y: startY, w: colWidths[ci], h: rowH,
      fill: { color: C.accent4 },
      line: { color: C.bg, width: 0.5 },
    });
    slide.addText(h, {
      x: cx + 0.06, y: startY, w: colWidths[ci] - 0.12, h: rowH,
      fontSize: 9, bold: true, color: C.white, valign: "middle",
    });
  });

  drugs.forEach((drug, ri) => {
    const ry = startY + (ri + 1) * rowH;
    const rowColor = ri % 2 === 0 ? C.panel : C.panelAlt;
    const row = [
      drug.name,
      drug.category.split("|")[0].trim(),
      drug.dose.split("\n")[0],
      drug.halfLife,
      drug.contraindications.split(",")[0],
    ];
    row.forEach((cell, ci) => {
      let cx = startX;
      for (let k = 0; k < ci; k++) cx += colWidths[k];
      slide.addShape(pres.shapes.RECTANGLE, {
        x: cx, y: ry, w: colWidths[ci], h: rowH,
        fill: { color: rowColor },
        line: { color: C.bg, width: 0.5 },
      });
      // Color dot on drug name column
      if (ci === 0) {
        slide.addShape(pres.shapes.RECTANGLE, {
          x: cx, y: ry, w: 0.06, h: rowH,
          fill: { color: drug.color },
        });
      }
      slide.addText(cell, {
        x: cx + (ci === 0 ? 0.1 : 0.06), y: ry,
        w: colWidths[ci] - (ci === 0 ? 0.16 : 0.12), h: rowH,
        fontSize: 7.8, color: C.lightGray, valign: "middle", wrap: true, autoFit: true,
      });
    });
  });

  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: SH - 0.2, w: SW, h: 0.2, fill: { color: C.hdr } });
  slide.addText("Emergency Drug Reference | For educational purposes only | Always verify with current local formulary and clinical guidelines", {
    x: 0.2, y: SH - 0.2, w: 12.9, h: 0.2,
    fontSize: 7.5, color: "4A6A8A", align: "center", valign: "middle",
  });
}

// ─── Write ─────────────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/emergency-drugs-poster/Emergency_Drug_Chart.pptx" })
  .then(() => console.log("SUCCESS: File written"))
  .catch(e => console.error("ERROR:", e));
Running Command

cd /home/daytona/workspace/emergency-drugs-poster && node build_v2.js 2>&1

Running Command

ls -lh /home/daytona/workspace/emergency-drugs-poster/Emergency_Drug_Chart.pptx

Your emergency drug poster chart is ready!

Emergency Drug Chart

Presentation · PPTX

18 slides | Dark navy theme | 662 KB

What's inside:

SlideContent
1Cover slide with all drug names listed
2–17One dedicated slide per drug — 8 colour-coded cards each
18At-a-glance summary table of all 16 drugs

Drugs covered (spelling corrections applied):

#Your InputCorrect Drug
1LabetololLabetalol
2MetaplropromideMetoclopramide
3TramdolTramadol
4AvilAvil (Pheniramine maleate)
5Transmic acidTranexamic Acid
6TipetodolTapentadol
7PhtyionPhenytoin
8LozarpamLorazepam
9OndansteronOndansetron
10NoradrenalineNoradrenaline
11AdrenalineAdrenaline
12DoutamineDobutamine
13DopamineDopamine
14AtropineAtropine
15NitroglycerinNitroglycerin (GTN)
16IV FluidsIV Fluids

Each drug card includes:

  • Mechanism of Action — how it works at receptor/molecular level
  • Indications — clinical uses
  • Contraindications — absolute and relative
  • Dose — standard dosing regimen
  • Maximum Dose — upper limit with safety note
  • Dilution / How to Use — preparation instructions, compatible fluids
  • Shelf Life — undiluted and diluted
  • Half-Life — duration of action
Note: This is for educational/reference purposes. Always verify against your current local formulary and institutional protocols before clinical use.
This is a shared conversation. Sign in to Orris to start your own chat.