convert into powerpoint slide presentation and add relevant pictures without compromising information as i have presentation in front of my faculties

Reading File
Reading File
Reading File
Running Command

cd /home/daytona/workspace && python3 -c " import pdfplumber with pdfplumber.ope…

Searching the Web

chest pain differential diagnosis ECG STEMI HEART score medical illustration free use

Running Command

mkdir -p /home/daytona/workspace/chest-pain-pptx && ls /home/daytona/workspace/c…

Writing File

~/chest-pain-pptx/build.js

const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");

// ─── THEME ────────────────────────────────────────────────────────────────────
const C = {
  navy:    "0D2B55",   // dominant bg
  darkBg:  "071C3A",   // deeper navy for title/closing slides
  red:     "C0392B",   // accent – danger/must-not-miss
  amber:   "E67E22",   // moderate risk
  green:   "1E8449",   // low risk / benign
  white:   "FFFFFF",
  light:   "EAF0FB",   // light blue tint for content bg
  slate:   "2C3E50",   // dark text on light bg
  gold:    "F39C12",
  teal:    "148F8F",
};

// ─── IMAGE FETCH HELPER ───────────────────────────────────────────────────────
function fetchImages(urls) {
  try {
    const result = execSync(
      `node /home/daytona/skills/shared/scripts/fetch_images.js ${urls.map(u => `"${u}"`).join(" ")}`,
      { timeout: 30000 }
    ).toString();
    return JSON.parse(result);
  } catch(e) {
    console.error("Image fetch error:", e.message);
    return urls.map(u => ({ url: u, base64: null, error: e.message }));
  }
}

// Fetch all images
console.log("Fetching images...");
const imgUrls = [
  "https://nursingcecentral.com/wp-content/uploads/2025/05/Differential-Diagnosis-of-Chest-Pain-Course-Image-2-1024x737.jpg",
  "https://canadiem.org/wp-content/uploads/2017/05/HEART-score-infographic.png",
  "https://www.thecardiologyadvisor.com/wp-content/uploads/sites/17/2024/01/DDI_ChestPain_2000pxwide_FINAL-scaled.jpg",
];
const imgs = fetchImages(imgUrls);
const ddImg    = imgs[0]; // differential diagnosis
const heartImg = imgs[1]; // HEART score
const cardioImg= imgs[2]; // cardiology advisor chest pain

// ─── HELPERS ──────────────────────────────────────────────────────────────────
function addSlideHeader(slide, title, subtitle, bgColor, titleColor, subColor) {
  bgColor    = bgColor    || C.navy;
  titleColor = titleColor || C.white;
  subColor   = subColor   || C.gold;

  slide.background = { color: bgColor };

  // Accent bar
  slide.addShape("rect", { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.red } });

  // Title
  slide.addText(title, {
    x: 0.35, y: 0.28, w: 9.4, h: 0.7,
    fontSize: 28, bold: true, color: titleColor, fontFace: "Calibri",
    valign: "middle"
  });

  if (subtitle) {
    slide.addText(subtitle, {
      x: 0.35, y: 0.95, w: 9.4, h: 0.38,
      fontSize: 13, color: subColor, fontFace: "Calibri", italic: true,
      valign: "middle"
    });
  }

  // Bottom rule
  slide.addShape("rect", { x: 0.35, y: 1.25, w: 9.3, h: 0.04, fill: { color: C.teal } });
}

function bullet(text, bold, color, indent, size) {
  return {
    text,
    options: {
      bullet: { type: "bullet" },
      bold:   bold   || false,
      color:  color  || C.slate,
      indentLevel: indent || 0,
      fontSize: size || 14,
      breakLine: true,
    }
  };
}

function sectionTitle(pres, title, subtitle, icon) {
  let slide = pres.addSlide();
  slide.background = { color: C.darkBg };

  // Decorative gradient strip
  slide.addShape("rect", { x: 0, y: 0, w: 10, h: 1.2, fill: { color: C.navy } });
  slide.addShape("rect", { x: 0, y: 1.2, w: 10, h: 0.05, fill: { color: C.teal } });

  // Centered icon/number
  if (icon) {
    slide.addText(icon, {
      x: 3.5, y: 0.9, w: 3, h: 1.1,
      fontSize: 52, color: C.teal, align: "center", valign: "middle",
      fontFace: "Segoe UI Emoji"
    });
  }

  slide.addText(title, {
    x: 1, y: 2.4, w: 8, h: 1.1,
    fontSize: 38, bold: true, color: C.white, fontFace: "Calibri",
    align: "center", valign: "middle"
  });

  if (subtitle) {
    slide.addText(subtitle, {
      x: 1.5, y: 3.5, w: 7, h: 0.6,
      fontSize: 17, color: C.gold, fontFace: "Calibri", align: "center",
      italic: true
    });
  }
}

// ═══════════════════════════════════════════════════════════════════════════════
const pres = new pptxgen();
pres.layout  = "LAYOUT_16x9";
pres.author  = "Medical Education";
pres.title   = "Approach to Chest Pain";
pres.subject = "Clinical Medicine – Emergency & Cardiology";

// ─── SLIDE 1 — TITLE ─────────────────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.darkBg };

  // Large decorative heart icon top-right
  s.addShape("rect", { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.darkBg } });
  // Diagonal accent strip
  s.addShape("rect", { x: 7.2, y: 0, w: 2.8, h: 5.625, fill: { color: "0A2240" } });
  s.addShape("rect", { x: 0, y: 4.9, w: 10, h: 0.1,  fill: { color: C.teal  } });
  s.addShape("rect", { x: 0, y: 5.0, w: 10, h: 0.625, fill: { color: C.navy } });

  // Red accent left
  s.addShape("rect", { x: 0, y: 0, w: 0.22, h: 5.625, fill: { color: C.red } });

  // Heart symbol
  s.addText("❤", { x: 7.4, y: 0.4, w: 2.2, h: 2.2, fontSize: 110,
    color: C.red, align: "center", valign: "middle", fontFace: "Segoe UI Emoji", transparency: 40 });

  // Title text
  s.addText("APPROACH TO", {
    x: 0.5, y: 0.8, w: 6.5, h: 0.75,
    fontSize: 26, color: C.teal, bold: true, fontFace: "Calibri", charSpacing: 4
  });
  s.addText("CHEST PAIN", {
    x: 0.5, y: 1.5, w: 6.5, h: 1.2,
    fontSize: 56, bold: true, color: C.white, fontFace: "Calibri"
  });

  s.addText([
    { text: "Harrison's 22E  •  Rosen's EM  •  Tintinalli's EM", options: { breakLine: true } },
    { text: "ACC/AHA 2021 Chest Pain Guidelines", options: {} }
  ], {
    x: 0.5, y: 2.75, w: 6.5, h: 0.75,
    fontSize: 13.5, color: C.gold, fontFace: "Calibri", italic: true
  });

  s.addShape("rect", { x: 0.5, y: 3.58, w: 5.5, h: 0.04, fill: { color: C.teal } });

  s.addText("Clinical Medicine — Emergency & Cardiology", {
    x: 0.5, y: 3.7, w: 6.5, h: 0.45,
    fontSize: 13, color: "A9C4E8", fontFace: "Calibri"
  });

  // Footer
  s.addText("July 2026", {
    x: 0, y: 5.05, w: 10, h: 0.55,
    fontSize: 11, color: "7FA8D0", align: "center", fontFace: "Calibri"
  });
}

// ─── SLIDE 2 — LEARNING OBJECTIVES ──────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  s.addShape("rect", { x: 0, y: 0, w: 10, h: 1.38, fill: { color: C.navy } });
  s.addShape("rect", { x: 0, y: 1.38, w: 10, h: 0.05, fill: { color: C.teal } });
  s.addShape("rect", { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.red } });

  s.addText("🎯  Learning Objectives", {
    x: 0.35, y: 0.28, w: 9.4, h: 0.75,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri"
  });
  s.addText("Harrison's 22E, Ch. 15  |  ACC/AHA 2021", {
    x: 0.35, y: 0.95, w: 9.4, h: 0.38,
    fontSize: 12, color: C.gold, fontFace: "Calibri", italic: true
  });

  s.addText([
    bullet("Define chest pain and recognise its broad differential diagnosis", true, C.navy),
    bullet("Apply a systematic history & physical examination approach", false, C.slate),
    bullet("Identify Must-Not-Miss life-threatening diagnoses (ACS, Aortic Dissection, PE)", true, C.red),
    bullet("Select and interpret key investigations: ECG, troponins, imaging", false, C.slate),
    bullet("Apply validated risk stratification tools (HEART Score, TIMI, Wells, ESC 0/1h)", false, C.slate),
    bullet("Outline evidence-based initial management for each major cause", false, C.slate),
    bullet("Distinguish acute vs. subacute/chronic presentations and triage appropriately", false, C.slate),
  ], {
    x: 0.35, y: 1.5, w: 9.3, h: 3.9,
    fontFace: "Calibri", fontSize: 14, color: C.slate, valign: "top",
    lineSpacingMultiple: 1.4
  });
}

// ─── SLIDE 3 — SECTION: EPIDEMIOLOGY ─────────────────────────────────────────
sectionTitle(pres, "Epidemiology & Clinical Importance", "Why chest pain matters in every clinical setting", "📊");

// ─── SLIDE 4 — EPIDEMIOLOGY STATS ────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  s.addShape("rect", { x: 0, y: 0, w: 10, h: 1.38, fill: { color: C.navy } });
  s.addShape("rect", { x: 0, y: 1.38, w: 10, h: 0.05, fill: { color: C.teal } });
  s.addShape("rect", { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.red } });

  s.addText("Epidemiology of Chest Pain", {
    x: 0.35, y: 0.28, w: 9.4, h: 0.75,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri"
  });
  s.addText("Harrison's 22E Fig 15-1; Tintinalli's EM", {
    x: 0.35, y: 0.95, w: 9.4, h: 0.38,
    fontSize: 12, color: C.gold, fontFace: "Calibri", italic: true
  });

  // Stat boxes
  const stats = [
    { val: "~7M",  label: "ED visits/year\n(USA)",        col: C.red   },
    { val: ">50%", label: "Admitted or\nobserved",        col: C.amber },
    { val: "~10%", label: "Ultimately\ndiagnosed ACS",    col: C.teal  },
    { val: "~2%",  label: "AMIs missed on\n1st ED visit", col: C.navy  },
  ];
  stats.forEach((st, i) => {
    let x = 0.35 + i * 2.35;
    s.addShape("rect", { x, y: 1.55, w: 2.15, h: 1.55, fill: { color: st.col }, line: { color: C.white, width: 1 } });
    s.addText(st.val, { x, y: 1.55, w: 2.15, h: 0.85, fontSize: 30, bold: true, color: C.white, align: "center", valign: "bottom", fontFace: "Calibri" });
    s.addText(st.label, { x, y: 2.35, w: 2.15, h: 0.75, fontSize: 11.5, color: C.white, align: "center", valign: "top", fontFace: "Calibri" });
  });

  // Final diagnoses
  s.addText("Most Common Final Diagnoses After Workup:", {
    x: 0.35, y: 3.25, w: 9.4, h: 0.4,
    fontSize: 14, bold: true, color: C.navy, fontFace: "Calibri"
  });

  const dx = [
    ["Musculoskeletal / Chest Wall", "~43%", C.green],
    ["Gastrointestinal (GERD, esophageal)", "~14%", C.teal],
    ["Cardiac Ischemia / ACS", "~12–16%", C.red],
    ["Pulmonary (PE, pleuritis)", "~5%", C.amber],
    ["Psychiatric / Anxiety", "~5%", C.slate],
  ];
  dx.forEach((d, i) => {
    let y = 3.72 + i * 0.36;
    // bar
    let barW = parseFloat(d[1]) / 50 * 3.5;
    s.addShape("rect", { x: 0.35, y: y+0.04, w: barW, h: 0.27, fill: { color: d[2] } });
    s.addText(d[0], { x: 0.45, y, w: 4.5, h: 0.35, fontSize: 12, color: C.slate, fontFace: "Calibri" });
    s.addText(d[1], { x: barW + 0.45, y, w: 1, h: 0.35, fontSize: 12, bold: true, color: d[2], fontFace: "Calibri" });
  });
}

// ─── SLIDE 5 — SECTION: DIFFERENTIAL DIAGNOSIS ───────────────────────────────
sectionTitle(pres, "Differential Diagnosis", "Organised from life-threatening to benign", "🔍");

// ─── SLIDE 6 — DIFFERENTIAL DIAGNOSIS TABLE ──────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  s.addShape("rect", { x: 0, y: 0, w: 10, h: 1.2, fill: { color: C.navy } });
  s.addShape("rect", { x: 0, y: 1.2, w: 10, h: 0.05, fill: { color: C.teal } });
  s.addShape("rect", { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.red } });

  s.addText("Differential Diagnosis of Chest Pain", {
    x: 0.35, y: 0.18, w: 9.4, h: 0.65, fontSize: 24, bold: true, color: C.white, fontFace: "Calibri"
  });
  s.addText("Harrison's 22E Table 15-1  |  Symptom to Diagnosis 4E", {
    x: 0.35, y: 0.82, w: 9.4, h: 0.35, fontSize: 12, color: C.gold, fontFace: "Calibri", italic: true
  });

  // 3 columns
  // Col 1 – Life-threatening
  s.addShape("rect", { x: 0.28, y: 1.3, w: 3.1, h: 0.38, fill: { color: C.red } });
  s.addText("⚠ LIFE-THREATENING", { x: 0.28, y: 1.3, w: 3.1, h: 0.38, fontSize: 11.5, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("Acute Coronary Syndrome (STEMI/NSTEMI/UA)", true, C.red),
    bullet("Acute Aortic Syndrome (Dissection, IMH, Aneurysm)", true, C.red),
    bullet("Pulmonary Embolism", true, C.red),
    bullet("Tension Pneumothorax", true, C.red),
    bullet("Pericarditis with Tamponade", true, C.red),
    bullet("Esophageal Rupture (Boerhaave's)", true, C.red),
  ], { x: 0.28, y: 1.72, w: 3.1, h: 2.5, fontFace: "Calibri", fontSize: 11.5, valign: "top", lineSpacingMultiple: 1.3 });

  // Col 2 – Serious
  s.addShape("rect", { x: 3.55, y: 1.3, w: 3.1, h: 0.38, fill: { color: C.amber } });
  s.addText("⚡ SERIOUS — URGENT", { x: 3.55, y: 1.3, w: 3.1, h: 0.38, fontSize: 11.5, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("Stable Angina / Microvascular disease", true, C.amber),
    bullet("Myocarditis / Acute Pericarditis", false, C.slate),
    bullet("Pneumonia / Pleuritis", false, C.slate),
    bullet("Simple Pneumothorax", false, C.slate),
    bullet("Hypertensive Emergency", false, C.slate),
    bullet("Cardiac Arrhythmia", false, C.slate),
  ], { x: 3.55, y: 1.72, w: 3.1, h: 2.5, fontFace: "Calibri", fontSize: 11.5, valign: "top", lineSpacingMultiple: 1.3 });

  // Col 3 – Benign
  s.addShape("rect", { x: 6.82, y: 1.3, w: 3.0, h: 0.38, fill: { color: C.green } });
  s.addText("✓ BENIGN — COMMON", { x: 6.82, y: 1.3, w: 3.0, h: 0.38, fontSize: 11.5, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("Musculoskeletal / Costochondritis", false, C.slate),
    bullet("GERD / Esophageal Spasm", false, C.slate),
    bullet("Peptic Ulcer Disease", false, C.slate),
    bullet("Anxiety / Panic Disorder", false, C.slate),
    bullet("Biliary Colic / Cholecystitis", false, C.slate),
    bullet("Herpes Zoster", false, C.slate),
  ], { x: 6.82, y: 1.72, w: 3.0, h: 2.5, fontFace: "Calibri", fontSize: 11.5, valign: "top", lineSpacingMultiple: 1.3 });

  // Image (differential diagnosis infographic)
  if (ddImg && ddImg.base64) {
    s.addImage({ data: ddImg.base64, x: 0.28, y: 4.25, w: 9.5, h: 1.25 });
  }
}

// ─── SLIDE 7 — PATHOPHYSIOLOGY ────────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Pathophysiology of Chest Pain", "Harrison's 22E; Tintinalli's EM 9E");

  // Two panels
  // Somatic
  s.addShape("rect", { x: 0.35, y: 1.38, w: 4.4, h: 3.85, fill: { color: C.navy } });
  s.addText("SOMATIC PAIN", { x: 0.35, y: 1.38, w: 4.4, h: 0.45, fontSize: 14, bold: true, color: C.teal, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("Chest wall → dermis to parietal pleura", false, "A9C4E8"),
    bullet("Enter spinal cord at specific dermatome levels", false, "A9C4E8"),
    bullet("Pain is sharp, well-localised, easily described", true, C.white),
    bullet("Example: rib fracture, costochondritis", false, "A9C4E8"),
  ], { x: 0.42, y: 1.88, w: 4.2, h: 2.9, fontSize: 13, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.4 });

  // Visceral
  s.addShape("rect", { x: 5.05, y: 1.38, w: 4.6, h: 3.85, fill: { color: "1A1A3E" } });
  s.addText("VISCERAL PAIN", { x: 5.05, y: 1.38, w: 4.6, h: 0.45, fontSize: 14, bold: true, color: C.red, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("Heart, aorta, esophagus — map to parietal cortex at shared cord levels", false, "A9C4E8"),
    bullet("Pain is vague, heavy, pressure-like — poorly localised", true, C.white),
    bullet("Referred pain: ACS → neck, jaw, left arm via shared T1–T4 pathways", true, C.gold),
    bullet("Ischemia: O₂ demand > supply → adenosine, bradykinin → stimulate afferents", false, "A9C4E8"),
    bullet("Modified by: age, sex, DM, psychiatric disease — women/elderly/diabetics more atypical", true, C.red),
  ], { x: 5.12, y: 1.88, w: 4.4, h: 3.0, fontSize: 12.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.35 });
}

// ─── SLIDE 8 — SECTION: CLINICAL APPROACH ────────────────────────────────────
sectionTitle(pres, "Clinical Approach", "History · Physical Examination · Initial Priorities", "🩺");

// ─── SLIDE 9 — STRUCTURED EVALUATION FRAMEWORK ────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Harrison's Structured Evaluation Framework", "Harrison's 22E, Table 15-2 (Thomas H. Lee)");

  const boxes = [
    { label: "Q1", title: "Acute Life-Threatening?", items: ["ACS", "Aortic Dissection", "PE", "Tension Pneumothorax"], col: C.red,   x: 0.28, y: 1.42 },
    { label: "Q2", title: "Chronic Serious Condition?", items: ["Stable Angina", "Aortic Stenosis", "Pulmonary Hypertension"], col: C.amber, x: 5.18, y: 1.42 },
    { label: "Q3", title: "Acute Treatable Condition?", items: ["Pericarditis", "Pneumonia / Pleuritis", "Herpes Zoster"], col: C.teal,  x: 0.28, y: 3.42 },
    { label: "Q4", title: "Chronic Treatable Condition?", items: ["GERD", "Esophageal Spasm", "PUD", "Costochondritis", "Anxiety"], col: C.green, x: 5.18, y: 3.42 },
  ];

  boxes.forEach(b => {
    s.addShape("rect", { x: b.x, y: b.y, w: 4.5, h: 1.88, fill: { color: b.col }, line: { color: C.white, width: 1 } });
    s.addText(`${b.label}: ${b.title}`, { x: b.x+0.1, y: b.y+0.08, w: 4.3, h: 0.42, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri" });
    b.items.forEach((item, i) => {
      s.addText(`• ${item}`, { x: b.x+0.15, y: b.y+0.55+i*0.26, w: 4.2, h: 0.28, fontSize: 12, color: C.white, fontFace: "Calibri" });
    });
  });

  s.addText("These four questions structure EVERY chest pain evaluation — acute or outpatient", {
    x: 0.28, y: 5.3, w: 9.5, h: 0.28,
    fontSize: 12, color: C.navy, bold: true, align: "center", fontFace: "Calibri", italic: true
  });
}

// ─── SLIDE 10 — INITIAL ASSESSMENT ────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Initial Assessment: Immediate Priorities", "Tintinalli's EM 9E; Harrison's 22E; ACC/AHA 2021");

  // Triage triggers
  s.addShape("rect", { x: 0.28, y: 1.38, w: 4.5, h: 1.95, fill: { color: C.red } });
  s.addText("🚨  TRIAGE IMMEDIATELY IF:", { x: 0.28, y: 1.38, w: 4.5, h: 0.42, fontSize: 13.5, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("Abnormal vitals: hypotension, tachycardia, hypoxia", false, C.white),
    bullet("ECG: ST elevation/depression, new LBBB", false, C.white),
    bullet("Prior CAD history or multiple cardiovascular risk factors", false, C.white),
    bullet("Abrupt severe chest pain with diaphoresis / syncope", false, C.white),
  ], { x: 0.35, y: 1.82, w: 4.3, h: 1.5, fontSize: 12.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.3 });

  // Immediate actions
  s.addShape("rect", { x: 5.0, y: 1.38, w: 4.75, h: 1.95, fill: { color: C.navy } });
  s.addText("⚡  IMMEDIATE ACTIONS:", { x: 5.0, y: 1.38, w: 4.75, h: 0.42, fontSize: 13.5, bold: true, color: C.teal, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("ABC + IV access + Cardiac monitoring", false, C.white),
    bullet("12-lead ECG within 10 MINUTES of arrival", true, C.gold),
    bullet("Supplemental O₂ if SpO₂ <94%", false, C.white),
    bullet("Serial vital signs at regular intervals", false, C.white),
    bullet("Chest radiograph (exclude life-threatening processes)", false, C.white),
  ], { x: 5.08, y: 1.82, w: 4.55, h: 1.5, fontSize: 12.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.25 });

  // ECG rule banner
  s.addShape("rect", { x: 0.28, y: 3.4, w: 9.5, h: 0.62, fill: { color: C.gold } });
  s.addText("🕐  ECG within 10 minutes  — A normal ECG does NOT rule out ACS", {
    x: 0.28, y: 3.4, w: 9.5, h: 0.62,
    fontSize: 15, bold: true, color: C.darkBg, align: "center", fontFace: "Calibri"
  });

  s.addText([
    bullet("OPQRST history: Onset, Provocation, Quality, Radiation, Severity, Time"),
    bullet("Sudden onset → dissection, PE, pneumothorax | Gradual → GERD, musculoskeletal", false, C.slate),
    bullet("Crushing/pressure → ACS  |  Tearing/ripping → Aortic Dissection  |  Sharp pleuritic → PE, pericarditis", false, C.slate),
    bullet("Radiation: Left arm/jaw/neck → ACS  |  Interscapular → Dissection  |  Shoulder tip → phrenic irritation", false, C.slate),
  ], { x: 0.35, y: 4.1, w: 9.3, h: 1.4, fontSize: 13, fontFace: "Calibri", color: C.slate, valign: "top", lineSpacingMultiple: 1.3 });
}

// ─── SLIDE 11 — ATYPICAL PRESENTATIONS ────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Atypical Presentations — High-Risk Groups", "Tintinalli's EM 9E; Harrison's 22E");

  s.addShape("rect", { x: 0.28, y: 1.38, w: 9.5, h: 0.48, fill: { color: C.red } });
  s.addText("⚠  22% of AMI patients describe pain as 'sharp or stabbing'  —  Do NOT rule out ACS based on atypical symptoms alone", {
    x: 0.28, y: 1.38, w: 9.5, h: 0.48,
    fontSize: 12.5, bold: true, color: C.white, align: "center", fontFace: "Calibri"
  });

  const groups = [
    { icon: "♀", title: "Women",    pts: ["Pain unrelated to exertion", "Jaw/neck/back pain, fatigue, palpitations", "MINOCA, Takotsubo more common"], col: "#C0392B" },
    { icon: "👴", title: "Elderly",  pts: ["Dyspnea, syncope, AMS", "Silent MI — altered pain perception", "Multiple comorbidities"], col: C.amber },
    { icon: "💉", title: "Diabetics",pts: ["Autonomic neuropathy → silent ischemia", "Dyspnea may be only symptom"], col: C.teal },
    { icon: "🌍", title: "Minorities",pts: ["More atypical presentations", "Subject to diagnostic delays"], col: C.navy },
  ];

  groups.forEach((g, i) => {
    let x = 0.28 + (i % 2) * 4.85;
    let y = 1.95 + Math.floor(i / 2) * 1.82;
    s.addShape("rect", { x, y, w: 4.65, h: 1.72, fill: { color: g.col } });
    s.addText(`${g.icon} ${g.title}`, { x: x+0.1, y: y+0.06, w: 4.4, h: 0.42, fontSize: 14, bold: true, color: C.white, fontFace: "Calibri" });
    g.pts.forEach((pt, pi) => {
      s.addText(`• ${pt}`, { x: x+0.15, y: y+0.52+pi*0.33, w: 4.3, h: 0.35, fontSize: 11.5, color: C.white, fontFace: "Calibri" });
    });
  });

  s.addShape("rect", { x: 0.28, y: 5.2, w: 9.5, h: 0.38, fill: { color: C.gold } });
  s.addText("47% of 721 consecutive MI patients presented WITHOUT chest pain — anginal equivalents: dyspnea, nausea, diaphoresis, jaw/arm discomfort", {
    x: 0.28, y: 5.2, w: 9.5, h: 0.38, fontSize: 11, bold: true, color: C.darkBg, align: "center", fontFace: "Calibri"
  });
}

// ─── SLIDE 12 — PHYSICAL EXAMINATION ──────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Physical Examination", "Harrison's 22E; Rosen's EM 10E");

  // Table-style layout
  const cols = [
    {
      title: "CARDIOVASCULAR", titleCol: C.red,
      items: [
        ["Vital Signs", "BP both arms — >20 mmHg difference → DISSECTION; HR, RR, SpO₂"],
        ["Inspection", "Diaphoresis, pallor, cyanosis, distress level"],
        ["Auscultation", "Murmurs → AS/MR/AR (dissection); S3 gallop; Pericardial friction rub; Distant sounds → tamponade; Pulsus paradoxus → tamponade"],
      ], x: 0.28, w: 3.1
    },
    {
      title: "PULMONARY", titleCol: C.teal,
      items: [
        ["Breath sounds", "Absent + tracheal deviation → TENSION PTX; Unilateral dullness → effusion/hemothorax; Crepitations → pulmonary edema"],
      ], x: 3.52, w: 3.1
    },
    {
      title: "OTHER SYSTEMS", titleCol: C.amber,
      items: [
        ["Abdomen", "Epigastric tenderness → PUD, pancreatitis"],
        ["Chest wall", "Point tenderness → costochondritis (does NOT rule out ACS — 15% of ACS have it)"],
        ["Skin/Neuro", "Vesicular rash → Herpes Zoster; Pulse asymmetry → dissection; Leg swelling → DVT/PE"],
      ], x: 6.76, w: 3.05
    }
  ];

  cols.forEach(col => {
    s.addShape("rect", { x: col.x, y: 1.38, w: col.w, h: 0.42, fill: { color: col.titleCol } });
    s.addText(col.title, { x: col.x, y: 1.38, w: col.w, h: 0.42, fontSize: 12, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
    let y = 1.85;
    col.items.forEach(item => {
      s.addShape("rect", { x: col.x, y, w: col.w, h: 0.28, fill: { color: col.titleCol }, transparency: 80 });
      s.addText(item[0], { x: col.x+0.05, y, w: col.w-0.1, h: 0.28, fontSize: 11.5, bold: true, color: col.titleCol, fontFace: "Calibri" });
      y += 0.28;
      s.addText(item[1], { x: col.x+0.05, y, w: col.w-0.1, h: 0.75, fontSize: 11, color: C.slate, fontFace: "Calibri", valign: "top" });
      y += 0.78;
    });
  });
}

// ─── SLIDE 13 — SECTION: INVESTIGATIONS ──────────────────────────────────────
sectionTitle(pres, "Investigations", "ECG · Biomarkers · Imaging · Laboratory", "🔬");

// ─── SLIDE 14 — 12-LEAD ECG ────────────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "12-Lead ECG — Most Urgent Test", "Harrison's 22E; Rosen's EM 10E; 4th Universal Definition of MI (ESC 2018)");

  s.addShape("rect", { x: 0.28, y: 1.38, w: 9.5, h: 0.48, fill: { color: C.red } });
  s.addText("Perform ECG within 10 MINUTES of ED arrival — ECG is DIAGNOSTIC in STEMI", {
    x: 0.28, y: 1.38, w: 9.5, h: 0.48, fontSize: 14, bold: true, color: C.white, align: "center", fontFace: "Calibri"
  });

  s.addText([
    { text: "STEMI Criteria (4th Universal Definition):", options: { bold: true, color: C.red, breakLine: true, fontSize: 14 } },
    { text: "• ST elevation >1 mm in ≥2 contiguous leads (except V₂–V₃)", options: { color: C.slate, breakLine: true, fontSize: 13 } },
    { text: "• V₂–V₃: ≥1.5 mm women; ≥2.5 mm men <40 yr; ≥2 mm men ≥40 yr", options: { color: C.slate, breakLine: true, fontSize: 13 } },
    { text: "• New LBBB with ACS symptoms → treat as STEMI equivalent", options: { color: C.slate, breakLine: true, fontSize: 13 } },
    { text: " ", options: { breakLine: true } },
    { text: "NSTEMI / UA: ", options: { bold: true, color: C.amber, fontSize: 13 } },
    { text: "ST depression, T-wave inversions, dynamic changes", options: { color: C.slate, breakLine: true, fontSize: 13 } },
    { text: " ", options: { breakLine: true } },
    { text: "High-Risk Patterns:", options: { bold: true, color: C.navy, breakLine: true, fontSize: 13 } },
    { text: "• Wellens' (T-wave inv V₁–V₄) → LAD stenosis", options: { color: C.slate, breakLine: true, fontSize: 12.5 } },
    { text: "• De Winter T waves → anterior STEMI equivalent", options: { color: C.slate, breakLine: true, fontSize: 12.5 } },
    { text: "• Posterior STEMI — STD V₁–V₃ + dominant R → check V₇–V₉", options: { color: C.slate, breakLine: true, fontSize: 12.5 } },
  ], { x: 0.35, y: 1.95, w: 5.5, h: 3.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.3 });

  s.addText([
    { text: "Other ECG Diagnoses:", options: { bold: true, color: C.navy, breakLine: true, fontSize: 13 } },
    { text: "• S1Q3T3 → PE", options: { color: C.teal, breakLine: true, fontSize: 12.5 } },
    { text: "• Diffuse saddle-shaped ST elevation → Pericarditis", options: { color: C.teal, breakLine: true, fontSize: 12.5 } },
    { text: "• PR depression (except aVR) → Pericarditis", options: { color: C.teal, breakLine: true, fontSize: 12.5 } },
    { text: "• Sinus tachycardia → PE / anxiety / sepsis", options: { color: C.teal, breakLine: true, fontSize: 12.5 } },
    { text: " ", options: { breakLine: true } },
    { text: "⚠ A normal ECG does NOT rule out ACS", options: { bold: true, color: C.red, fontSize: 13 } },
  ], { x: 5.95, y: 1.95, w: 3.8, h: 3.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.3 });
}

// ─── SLIDE 15 — CARDIAC BIOMARKERS ───────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Cardiac Biomarkers", "Harrison's 22E; ESC 2020 NSTE-ACS Guidelines; ACC/AHA 2021");

  // hs-cTn box
  s.addShape("rect", { x: 0.28, y: 1.38, w: 9.5, h: 2.35, fill: { color: C.navy } });
  s.addText("High-Sensitivity Troponin (hs-cTn) — PREFERRED Biomarker", {
    x: 0.28, y: 1.38, w: 9.5, h: 0.45, fontSize: 14.5, bold: true, color: C.gold, align: "center", fontFace: "Calibri"
  });
  s.addText([
    bullet("Measure at presentation (0h) + repeat at 1–2h (hs-cTn) or 3–6h (conventional)", false, "A9C4E8"),
    bullet("Patients >2–3h after onset: very low hs-cTn at 0h → NPV >99% for MI", true, C.white),
    bullet("Rising/falling pattern + at least one value >99th percentile = required for MI diagnosis", true, C.gold),
    bullet("Non-ACS troponin elevation: Myocarditis, PE, HF, Sepsis, Renal failure, Takotsubo — clinical context critical", false, C.red),
    bullet("Type 1 MI: coronary atherothrombosis | Type 2 MI: supply-demand mismatch (anemia, tachycardia, sepsis)", false, "A9C4E8"),
  ], { x: 0.38, y: 1.85, w: 9.2, h: 1.85, fontSize: 12.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.3 });

  // Other biomarkers
  const bios = [
    { name: "D-Dimer", desc: "Rule-out PE if Wells ≤4 + negative D-dimer → PE excluded", col: C.teal },
    { name: "BNP / NT-proBNP", desc: "Heart failure evaluation", col: C.amber },
    { name: "CRP / ESR", desc: "Pericarditis, myocarditis", col: C.green },
    { name: "CBC / ABG", desc: "Secondary ischemia (anemia, hypoxia)", col: C.slate },
  ];
  bios.forEach((b, i) => {
    let x = 0.28 + i * 2.38;
    s.addShape("rect", { x, y: 3.82, w: 2.28, h: 1.55, fill: { color: b.col } });
    s.addText(b.name, { x, y: 3.82, w: 2.28, h: 0.42, fontSize: 12.5, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
    s.addText(b.desc, { x, y: 4.27, w: 2.28, h: 1.08, fontSize: 11.5, color: C.white, align: "center", fontFace: "Calibri", valign: "top" });
  });
}

// ─── SLIDE 16 — IMAGING ───────────────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Imaging in Chest Pain", "Harrison's 22E; ACC/AHA 2021 Chest Pain Guidelines");

  const modalities = [
    { name: "CXR", icon: "🫁", desc: "Routine for ALL acute chest pain\n• Mediastinal widening → dissection\n• Hampton's hump / Westermark's → PE\n• Absent lung markings → PTX\n• Pulmonary edema → ACS/myocarditis", col: C.navy },
    { name: "CTPA", icon: "🔬", desc: "Gold standard for PE\nPerform if Wells >4 or clinical suspicion", col: C.red },
    { name: "CT Aorta", icon: "🫀", desc: "Gold standard for Aortic Dissection\n(entire aorta imaged)", col: C.amber },
    { name: "Echo", icon: "📡", desc: "LV function, wall motion abnormalities\nEffusion, tamponade, valvular disease", col: C.teal },
    { name: "CCTA", icon: "💡", desc: "ACC/AHA 2021 first-line for stable chest pain (intermediate pre-test probability)", col: C.green },
    { name: "Stress Tests", icon: "🏃", desc: "ETT / Stress Echo / Nuclear / Stress CMR\nFor stable, low-to-intermediate-risk patients", col: C.slate },
  ];

  modalities.forEach((m, i) => {
    let x = 0.28 + (i % 3) * 3.22;
    let y = 1.42 + Math.floor(i / 3) * 2.02;
    s.addShape("rect", { x, y, w: 3.12, h: 1.92, fill: { color: m.col } });
    s.addText(`${m.icon} ${m.name}`, { x, y: y+0.06, w: 3.12, h: 0.45, fontSize: 14, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
    s.addText(m.desc, { x: x+0.08, y: y+0.55, w: 2.95, h: 1.32, fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top" });
  });
}

// ─── SLIDE 17 — SECTION: RISK STRATIFICATION ─────────────────────────────────
sectionTitle(pres, "Risk Stratification", "HEART Score · TIMI · Wells · ESC 0/1h Protocol", "📈");

// ─── SLIDE 18 — HEART SCORE ───────────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "HEART Score — Risk Stratification for ACS in ED", "Rosen's EM 10E; Six et al. (HEART Pathway)");

  // 5 HEART components
  const comps = [
    { letter: "H", name: "History",     pts: ["0: Slightly suspicious", "1: Moderately suspicious", "2: Highly suspicious"], col: C.navy },
    { letter: "E", name: "ECG",         pts: ["0: Normal", "1: Non-specific repolarisation disturbance", "2: Significant ST deviation"], col: C.teal },
    { letter: "A", name: "Age",         pts: ["0: <45 yr", "1: 45–64 yr", "2: ≥65 yr"], col: C.amber },
    { letter: "R", name: "Risk Factors",pts: ["0: No known risk factors", "1: 1–2 RF / obesity / smoker", "2: Known atherosclerotic disease or ≥3 RF"], col: C.red },
    { letter: "T", name: "Troponin",    pts: ["0: ≤Normal limit", "1: 1–3× normal limit", "2: >3× normal limit"], col: C.slate },
  ];

  comps.forEach((c, i) => {
    let x = 0.28 + i * 1.9;
    s.addShape("rect", { x, y: 1.42, w: 1.82, h: 0.52, fill: { color: c.col } });
    s.addText(c.letter, { x, y: 1.42, w: 1.82, h: 0.52, fontSize: 24, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
    s.addText(c.name, { x, y: 1.96, w: 1.82, h: 0.32, fontSize: 12, bold: true, color: c.col, align: "center", fontFace: "Calibri" });
    c.pts.forEach((pt, pi) => {
      s.addShape("rect", { x, y: 2.32+pi*0.4, w: 1.82, h: 0.38, fill: { color: c.col }, transparency: pi===0?20:40+pi*10 });
      s.addText(pt, { x: x+0.05, y: 2.32+pi*0.4, w: 1.72, h: 0.38, fontSize: 10.5, color: pi===0?C.white:C.slate, fontFace: "Calibri", valign: "middle" });
    });
  });

  // Score bands
  const bands = [
    { range: "0–3  LOW",      mace: "1.7% MACE",    action: "Early discharge + outpatient follow-up", col: C.green },
    { range: "4–6  MODERATE", mace: "12–16.6% MACE", action: "Observation + serial troponins",         col: C.amber },
    { range: "7–10  HIGH",    mace: "50–65% MACE",   action: "Early invasive strategy",                col: C.red   },
  ];
  bands.forEach((b, i) => {
    let x = 0.28 + i * 3.22;
    s.addShape("rect", { x, y: 3.62, w: 3.12, h: 1.85, fill: { color: b.col } });
    s.addText(b.range, { x, y: 3.62, w: 3.12, h: 0.5, fontSize: 14, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
    s.addText(b.mace, { x, y: 4.12, w: 3.12, h: 0.4, fontSize: 13, color: C.white, align: "center", fontFace: "Calibri", bold: true });
    s.addText(b.action, { x: x+0.08, y: 4.52, w: 2.96, h: 0.88, fontSize: 12, color: C.white, align: "center", fontFace: "Calibri" });
  });

  // Fetch heart score image if available
  if (heartImg && heartImg.base64) {
    // Don't use as it could obscure content
  }
}

// ─── SLIDE 19 — ESC RAPID PROTOCOLS ──────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "ESC Rapid Rule-Out Protocols & Risk Scores", "ESC 2020 NSTE-ACS Guidelines; Collet et al. Eur Heart J 2021");

  // ESC 0h/1h
  s.addShape("rect", { x: 0.28, y: 1.42, w: 9.5, h: 0.42, fill: { color: C.teal } });
  s.addText("ESC 0h/1h Algorithm (Preferred — uses hs-cTn)", {
    x: 0.28, y: 1.42, w: 9.5, h: 0.42, fontSize: 13.5, bold: true, color: C.white, align: "center", fontFace: "Calibri"
  });

  const flow = [
    { label: "RULE OUT", desc: "hs-cTnI <5 ng/L at 0h + change <6 ng/L at 1h → DISCHARGE (NPV >99%)", col: C.green },
    { label: "RULE IN",  desc: "hs-cTnI >52 ng/L at 0h OR change >6 ng/L at 1h → NSTEMI Diagnosed", col: C.red   },
    { label: "OBSERVE",  desc: "Intermediate zone → serial testing to 3h", col: C.amber },
  ];
  flow.forEach((f, i) => {
    s.addShape("rect", { x: 0.28+i*3.22, y: 1.9, w: 3.12, h: 1.25, fill: { color: f.col } });
    s.addText(f.label, { x: 0.28+i*3.22, y: 1.9, w: 3.12, h: 0.42, fontSize: 13.5, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
    s.addText(f.desc,  { x: 0.35+i*3.22, y: 2.36, w: 2.98, h: 0.82, fontSize: 11.5, color: C.white, fontFace: "Calibri" });
  });

  // TIMI
  s.addShape("rect", { x: 0.28, y: 3.25, w: 4.55, h: 2.2, fill: { color: C.navy } });
  s.addText("TIMI Score (0–7) — NSTE-ACS", { x: 0.28, y: 3.25, w: 4.55, h: 0.42, fontSize: 13, bold: true, color: C.gold, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("Age ≥65", false, "A9C4E8"),
    bullet("≥3 CAD risk factors", false, "A9C4E8"),
    bullet("Prior coronary stenosis ≥50%", false, "A9C4E8"),
    bullet("ST deviation", false, "A9C4E8"),
    bullet("≥2 anginal events in 24h", false, "A9C4E8"),
    bullet("Prior aspirin use", false, "A9C4E8"),
    bullet("Elevated cardiac markers", false, "A9C4E8"),
    bullet("Score ≥3 → HIGH RISK → early invasive", true, C.gold),
  ], { x: 0.35, y: 3.7, w: 4.4, h: 1.72, fontSize: 11.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.2 });

  // GRACE
  s.addShape("rect", { x: 5.05, y: 3.25, w: 4.7, h: 2.2, fill: { color: "1A1A3E" } });
  s.addText("GRACE Score — NSTE-ACS Mortality", { x: 5.05, y: 3.25, w: 4.7, h: 0.42, fontSize: 13, bold: true, color: C.gold, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("Validated for in-hospital and 6-month mortality", false, "A9C4E8"),
    bullet("High GRACE → early invasive strategy within 24h", true, C.white),
    bullet("Very-high GRACE → immediate (<2h) angiography", true, C.red),
    bullet("Parameters: Age, HR, BP, creatinine, Killip class, cardiac arrest, ST deviation, elevated markers", false, "A9C4E8"),
  ], { x: 5.12, y: 3.7, w: 4.5, h: 1.72, fontSize: 11.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.3 });
}

// ─── SLIDE 20 — SECTION: KEY DIAGNOSES ───────────────────────────────────────
sectionTitle(pres, "Key Diagnoses — In Detail", "ACS · Aortic Dissection · PE · Pneumothorax · Pericarditis", "🫀");

// ─── SLIDE 21 — ACS ────────────────────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Acute Coronary Syndrome (ACS)", "Harrison's 22E; ACC/AHA 2021; ESC 2020");

  s.addShape("rect", { x: 0.28, y: 1.38, w: 9.5, h: 0.42, fill: { color: C.red } });
  s.addText("Plaque rupture → Thrombus → Coronary Occlusion → UA / NSTEMI / STEMI", {
    x: 0.28, y: 1.38, w: 9.5, h: 0.42, fontSize: 13.5, bold: true, color: C.white, align: "center", fontFace: "Calibri"
  });

  // Left: Presentation + Diagnosis
  s.addShape("rect", { x: 0.28, y: 1.88, w: 4.55, h: 3.55, fill: { color: C.navy } });
  s.addText("Presentation & Diagnosis", { x: 0.28, y: 1.88, w: 4.55, h: 0.42, fontSize: 13.5, bold: true, color: C.gold, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("Retrosternal crushing/pressure", false, "A9C4E8"),
    bullet("Radiation to left arm, jaw, neck", false, "A9C4E8"),
    bullet("Diaphoresis, dyspnea, nausea/vomiting", false, "A9C4E8"),
    bullet("ECG: STEMI criteria or dynamic ST/T changes", true, C.gold),
    bullet("Biomarker: Rising hs-cTn (must rise/fall + one >99th %ile)", true, C.gold),
    bullet("⚠ Atypical in women, elderly, diabetics", true, C.red),
  ], { x: 0.35, y: 2.34, w: 4.38, h: 3.0, fontSize: 12.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.3 });

  // Right: Management
  s.addShape("rect", { x: 5.05, y: 1.88, w: 4.7, h: 3.55, fill: { color: "1A1A3E" } });
  s.addText("Management", { x: 5.05, y: 1.88, w: 4.7, h: 0.42, fontSize: 13.5, bold: true, color: C.gold, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("STEMI: Primary PCI ≤90 min door-to-balloon — FIRST-LINE", true, C.red),
    bullet("Fibrinolysis if PCI unavailable within 120 min", false, "A9C4E8"),
    bullet("Antiplatelet: Aspirin 325 mg + P2Y12 inhibitor (Ticagrelor / Prasugrel / Clopidogrel)", true, C.white),
    bullet("Anticoagulation: UFH, LMWH, Bivalirudin, or Fondaparinux", false, "A9C4E8"),
    bullet("NSTEMI/UA: Risk-stratify with HEART/GRACE/TIMI → early invasive vs. conservative", true, C.gold),
    bullet("Beta-blockers, Statins, ACE inhibitors — initiate for MI management", false, "A9C4E8"),
  ], { x: 5.12, y: 2.34, w: 4.52, h: 3.0, fontSize: 12.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.25 });
}

// ─── SLIDE 22 — AORTIC DISSECTION ────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Acute Aortic Syndrome — Aortic Dissection", "Harrison's 22E; Fuster & Hurst's The Heart 15E; Rosen's EM");

  s.addShape("rect", { x: 0.28, y: 1.38, w: 9.5, h: 0.42, fill: { color: C.red } });
  s.addText("⚠  ABRUPT maximal-intensity tearing/ripping pain — chest + back/interscapular", {
    x: 0.28, y: 1.38, w: 9.5, h: 0.42, fontSize: 13.5, bold: true, color: C.white, align: "center", fontFace: "Calibri"
  });

  // Stanford Classification
  s.addShape("rect", { x: 0.28, y: 1.88, w: 4.55, h: 1.85, fill: { color: C.navy } });
  s.addText("Stanford Classification", { x: 0.28, y: 1.88, w: 4.55, h: 0.42, fontSize: 13.5, bold: true, color: C.gold, align: "center", fontFace: "Calibri" });
  s.addShape("rect", { x: 0.35, y: 2.35, w: 2.0, h: 1.28, fill: { color: C.red } });
  s.addText("Type A\n(Ascending)\nSURGICAL EMERGENCY", { x: 0.35, y: 2.35, w: 2.0, h: 1.28, fontSize: 12, bold: true, color: C.white, align: "center", fontFace: "Calibri", valign: "middle" });
  s.addShape("rect", { x: 2.52, y: 2.35, w: 2.18, h: 1.28, fill: { color: C.amber } });
  s.addText("Type B\n(Descending)\nMedical Management\n(unless complicated)", { x: 2.52, y: 2.35, w: 2.18, h: 1.28, fontSize: 11, color: C.white, align: "center", fontFace: "Calibri", valign: "middle" });

  // Risk factors
  s.addShape("rect", { x: 5.05, y: 1.88, w: 4.7, h: 1.85, fill: { color: "1A1A3E" } });
  s.addText("Risk Factors", { x: 5.05, y: 1.88, w: 4.7, h: 0.42, fontSize: 13.5, bold: true, color: C.gold, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("Hypertension (most common)", true, C.white),
    bullet("Marfan syndrome, Ehlers-Danlos syndrome", false, "A9C4E8"),
    bullet("Bicuspid aortic valve, connective tissue disorders", false, "A9C4E8"),
    bullet("Cocaine use, pregnancy (Type B > A)", false, "A9C4E8"),
  ], { x: 5.12, y: 2.35, w: 4.52, h: 1.35, fontSize: 12, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.25 });

  // Investigations + Management
  s.addShape("rect", { x: 0.28, y: 3.82, w: 4.55, h: 1.65, fill: { color: C.teal } });
  s.addText("Investigations", { x: 0.28, y: 3.82, w: 4.55, h: 0.4, fontSize: 13, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("CXR: Widened mediastinum (>8 cm), loss of aortic knuckle", false, C.white),
    bullet("CT Aortography: GOLD STANDARD — entire aorta", true, C.white),
    bullet("TEE: If CT unavailable or haemodynamically unstable", false, C.white),
    bullet("BP difference >20 mmHg between arms → highly suspicious", true, C.white),
  ], { x: 0.35, y: 4.25, w: 4.38, h: 1.2, fontSize: 11.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.2 });

  s.addShape("rect", { x: 5.05, y: 3.82, w: 4.7, h: 1.65, fill: { color: C.red } });
  s.addText("Management", { x: 5.05, y: 3.82, w: 4.7, h: 0.4, fontSize: 13, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("HR <60 bpm + SBP 100–120 mmHg TARGET", true, C.white),
    bullet("IV Beta-blockers (Labetalol/Esmolol) + Vasodilators", false, C.white),
    bullet("Type A → Urgent surgical consult", true, C.white),
    bullet("DO NOT give fibrinolytics — catastrophic haemorrhage risk", true, C.white),
  ], { x: 5.12, y: 4.25, w: 4.52, h: 1.2, fontSize: 11.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.2 });
}

// ─── SLIDE 23 — PE ────────────────────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Pulmonary Embolism (PE)", "Harrison's 22E; ESC 2019 PE Guidelines; Fuster & Hurst's 15E");

  s.addText([
    bullet("Pleuritic chest pain + Dyspnea (most common) + Tachycardia + Hypoxia + Haemoptysis", true, C.navy),
    bullet("Massive PE: Haemodynamic instability, RV strain, syncope — HIGH MORTALITY", true, C.red),
  ], { x: 0.28, y: 1.38, w: 9.5, h: 0.85, fontSize: 13, fontFace: "Calibri", color: C.slate, valign: "top" });

  // Wells + Investigations
  s.addShape("rect", { x: 0.28, y: 2.28, w: 4.55, h: 3.2, fill: { color: C.navy } });
  s.addText("Wells Score for PE", { x: 0.28, y: 2.28, w: 4.55, h: 0.42, fontSize: 13.5, bold: true, color: C.gold, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("DVT signs/symptoms (+3)", false, "A9C4E8"),
    bullet("PE as likely as / more likely (+3)", false, "A9C4E8"),
    bullet("HR >100 (+1.5)", false, "A9C4E8"),
    bullet("Immobilisation / surgery in 4 weeks (+1.5)", false, "A9C4E8"),
    bullet("Prior DVT/PE (+1.5)", false, "A9C4E8"),
    bullet("Haemoptysis (+1)", false, "A9C4E8"),
    bullet("Malignancy (+1)", false, "A9C4E8"),
    bullet("≤4 (Low): D-dimer → if negative, PE EXCLUDED", true, C.green),
    bullet(">4 (High): Proceed directly to CTPA", true, C.red),
  ], { x: 0.35, y: 2.74, w: 4.38, h: 2.7, fontSize: 12, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.25 });

  // Management
  s.addShape("rect", { x: 5.05, y: 2.28, w: 4.7, h: 3.2, fill: { color: "1A1A3E" } });
  s.addText("Investigations & Management", { x: 5.05, y: 2.28, w: 4.7, h: 0.42, fontSize: 13.5, bold: true, color: C.gold, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("ECG: Sinus tachycardia, S1Q3T3, new RBBB, AF (not pathognomonic)", false, "A9C4E8"),
    bullet("CTPA — GOLD STANDARD | V/Q scan if renal impairment or contrast allergy", true, C.white),
    bullet("Echo: RV dilation/strain, McConnell's sign — useful in massive PE", false, "A9C4E8"),
    bullet("Anticoagulation: LMWH/UFH → DOAC/warfarin (DOACs preferred per ESC 2019)", true, C.gold),
    bullet("Massive PE: Thrombolysis (Alteplase) or catheter-directed embolectomy", true, C.red),
  ], { x: 5.12, y: 2.74, w: 4.52, h: 2.7, fontSize: 12, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.3 });
}

// ─── SLIDE 24 — PNEUMOTHORAX & PERICARDITIS ───────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Pneumothorax & Pericarditis", "Harrison's 22E; ESC 2015 Pericardial Diseases Guidelines");

  // Pneumothorax
  s.addShape("rect", { x: 0.28, y: 1.38, w: 4.6, h: 0.42, fill: { color: C.navy } });
  s.addText("🫁  PNEUMOTHORAX", { x: 0.28, y: 1.38, w: 4.6, h: 0.42, fontSize: 14, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("Sudden sharp pleuritic pain + dyspnea", true, C.navy),
    bullet("Tension PTX: Tracheal deviation AWAY, absent sounds, haemodynamic collapse — EMERGENCY", true, C.red),
    bullet("Causes: Spontaneous (young tall male), trauma, iatrogenic, COPD, Marfan's", false, C.slate),
    bullet("Dx: CXR (absent lung markings, pleural line), POCUS (absent lung sliding)", false, C.slate),
    bullet("Tension → Immediate needle decompression (2nd ICS MCL) + chest drain", true, C.red),
    bullet("Simple large → Chest drain | Small/primary → Aspiration or observation", false, C.slate),
  ], { x: 0.35, y: 1.85, w: 4.42, h: 3.62, fontSize: 12.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.3 });

  // Pericarditis
  s.addShape("rect", { x: 5.12, y: 1.38, w: 4.6, h: 0.42, fill: { color: C.teal } });
  s.addText("🫀  PERICARDITIS / TAMPONADE", { x: 5.12, y: 1.38, w: 4.6, h: 0.42, fontSize: 13.5, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
  s.addText([
    bullet("Sharp pleuritic pain — worse supine, relieved leaning forward", true, C.teal),
    bullet("Pericardial friction rub — pathognomonic but transient", true, C.navy),
    bullet("ECG: Diffuse saddle-shaped ST elevation + PR depression (except aVR)", true, C.slate),
    bullet("Causes: Viral (most common), autoimmune, post-MI (Dressler's), malignancy, uremia", false, C.slate),
    bullet("Tamponade: Beck's Triad — JVD + Hypotension + Muffled sounds + Pulsus paradoxus", true, C.red),
    bullet("Rx: NSAIDs + Colchicine — first-line (reduces recurrence)", true, C.green),
    bullet("Avoid NSAIDs in early MI | Pericardiocentesis if tamponade", true, C.red),
  ], { x: 5.19, y: 1.85, w: 4.42, h: 3.62, fontSize: 12.5, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.25 });
}

// ─── SLIDE 25 — BENIGN CAUSES ─────────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Common Benign Causes of Chest Pain", "Harrison's 22E; Symptom to Diagnosis 4E");

  const causes = [
    {
      title: "Musculoskeletal / Costochondritis", icon: "🦴", col: C.amber,
      pts: [
        "Most common cause (~43% of chest pain)",
        "Reproducible with palpation, localised tenderness",
        "Tietze's syndrome: tender swelling at costochondral junction",
        "Rx: NSAIDs, rest, physiotherapy"
      ]
    },
    {
      title: "GERD / Esophageal Spasm", icon: "🔥", col: C.red,
      pts: [
        "Burning retrosternal pain, worse lying, relieved by antacids",
        "Esophageal spasm: severe cramping, mimics ACS — may respond to nitrates",
        "Dx: PPI trial (GERD); manometry/barium swallow (spasm)",
        "⚠ ALWAYS exclude cardiac cause FIRST"
      ]
    },
    {
      title: "Anxiety / Panic Disorder", icon: "🧠", col: C.teal,
      pts: [
        "Atypical pains, often pleuritic or diffuse",
        "Hyperventilation, palpitations, tremor",
        "Diagnosis of EXCLUSION — rule out cardiac cause first"
      ]
    },
    {
      title: "Herpes Zoster", icon: "⚡", col: C.slate,
      pts: [
        "Dermatomal pain precedes vesicular rash by 2–3 days",
        "May mimic ACS or pleurisy — look for rash",
        "Rx: Antivirals (acyclovir/valacyclovir) within 72h"
      ]
    },
  ];

  causes.forEach((c, i) => {
    let x = 0.28 + (i % 2) * 4.87;
    let y = 1.42 + Math.floor(i / 2) * 2.05;
    s.addShape("rect", { x, y, w: 4.67, h: 1.95, fill: { color: c.col } });
    s.addText(`${c.icon} ${c.title}`, { x, y: y+0.05, w: 4.67, h: 0.42, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri" });
    c.pts.forEach((pt, pi) => {
      s.addText(`• ${pt}`, { x: x+0.12, y: y+0.5+pi*0.34, w: 4.42, h: 0.35, fontSize: 11, color: C.white, fontFace: "Calibri" });
    });
  });
}

// ─── SLIDE 26 — SECTION: MANAGEMENT ALGORITHM ────────────────────────────────
sectionTitle(pres, "Management Algorithm", "Acute Chest Pain — Step-by-Step Decision Framework", "📋");

// ─── SLIDE 27 — ACUTE MANAGEMENT ALGORITHM ───────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Acute Chest Pain Management Algorithm", "ACC/AHA 2021; ESC 2020; Harrison's 22E");

  const steps = [
    { n: "1", title: "Immediate Stabilisation",   desc: "ABC + IV access + Cardiac monitoring + O₂ if SpO₂<94% + 12-lead ECG within 10 min",        col: C.navy  },
    { n: "2", title: "STEMI? → Immediate Reperfusion", desc: "Primary PCI (door-to-balloon ≤90 min) — OR fibrinolysis if PCI unavailable within 120 min", col: C.red   },
    { n: "3", title: "Dissection / PE / Tension PTX?", desc: "Dissection: IV β-blockers + urgent CT + surgical consult | PE: Anticoagulation ± thrombolysis | Tension PTX: Needle decompression", col: C.amber },
    { n: "4", title: "NSTE-ACS? → Risk Stratify",  desc: "HEART Score + GRACE + serial hs-cTn (ESC 0h/1h or 0h/3h) | High → invasive <24h | Low → discharge + outpatient FU", col: C.teal  },
    { n: "5", title: "Non-Cardiac Cause? → Targeted Therapy", desc: "GI (PPI, manometry) | Musculoskeletal (NSAIDs, physio) | Psychiatric (anxiolytics) | Infectious (antivirals)", col: C.green },
  ];

  steps.forEach((st, i) => {
    let y = 1.42 + i * 0.82;
    s.addShape("rect", { x: 0.28, y, w: 0.65, h: 0.72, fill: { color: st.col } });
    s.addText(st.n, { x: 0.28, y, w: 0.65, h: 0.72, fontSize: 22, bold: true, color: C.white, align: "center", fontFace: "Calibri", valign: "middle" });
    s.addShape("rect", { x: 0.98, y, w: 8.82, h: 0.72, fill: { color: st.col }, transparency: 75 });
    s.addText(st.title, { x: 1.05, y: y+0.04, w: 2.85, h: 0.32, fontSize: 12.5, bold: true, color: st.col, fontFace: "Calibri" });
    s.addText(st.desc,  { x: 1.05, y: y+0.36, w: 8.65, h: 0.35, fontSize: 11, color: C.slate, fontFace: "Calibri" });
    // Arrow
    if (i < steps.length - 1) {
      s.addShape("rect", { x: 0.42, y: y+0.72, w: 0.38, h: 0.1, fill: { color: C.teal } });
    }
  });
}

// ─── SLIDE 28 — OUTPATIENT EVALUATION ────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Outpatient Evaluation of Chest Discomfort", "ACC/AHA 2021; Harrison's 22E");

  s.addShape("rect", { x: 0.28, y: 1.38, w: 9.5, h: 0.42, fill: { color: C.navy } });
  s.addText("Chronic or resolved chest pain presenting to primary care — systematic stable evaluation", {
    x: 0.28, y: 1.38, w: 9.5, h: 0.42, fontSize: 13, bold: true, color: C.white, align: "center", fontFace: "Calibri"
  });

  s.addText([
    bullet("Assess pre-test probability: clinical history + risk factors (age, sex, DM, HTN, smoking, dyslipidaemia)", true, C.navy),
    bullet("Resting ECG → baseline in all patients", false, C.slate),
  ], { x: 0.35, y: 1.88, w: 9.3, h: 0.88, fontSize: 13, fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.3 });

  const tools = [
    { name: "Exercise Stress Test (ETT)", desc: "First-line for intermediate-risk patients with normal baseline ECG", col: C.navy, rec: "First-line" },
    { name: "CT Coronary Angiography (CCTA)", desc: "ACC/AHA 2021 recommended for stable chest pain with intermediate pre-test probability", col: C.red, rec: "ACC/AHA 2021 Preferred" },
    { name: "Stress Echo / Nuclear", desc: "If ECG uninterpretable or prior revascularisation", col: C.amber, rec: "Alternative" },
    { name: "Cardiac MRI", desc: "Suspected myocarditis or cardiomyopathy", col: C.teal, rec: "Specific Indication" },
  ];

  tools.forEach((t, i) => {
    let x = 0.28 + (i % 2) * 4.87;
    let y = 2.82 + Math.floor(i / 2) * 1.42;
    s.addShape("rect", { x, y, w: 4.67, h: 1.32, fill: { color: t.col } });
    s.addText(t.name, { x, y: y+0.05, w: 4.67, h: 0.4, fontSize: 12.5, bold: true, color: C.white, fontFace: "Calibri" });
    s.addText(`[${t.rec}]`, { x, y: y+0.42, w: 4.67, h: 0.3, fontSize: 11, color: C.gold, italic: true, fontFace: "Calibri", align: "center" });
    s.addText(t.desc, { x: x+0.08, y: y+0.7, w: 4.5, h: 0.6, fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top" });
  });
}

// ─── SLIDE 29 — SPECIAL POPULATIONS ──────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.light };
  addSlideHeader(s, "Special Populations", "Harrison's 22E; Tintinalli's EM 9E; ACC/AHA 2021");

  const pops = [
    { title: "Women", col: "#922B21", pts: ["MINOCA, Takotsubo, microvascular disease", "Jaw/neck/back pain, fatigue, nausea", "Pre/early menopausal: pain not exertional, not relieved by nitrates"] },
    { title: "Elderly", col: C.amber, pts: ["Silent MI, atypical presentations", "Baseline ECG changes, renal impairment", "Higher comorbidity burden"] },
    { title: "Diabetics", col: C.teal, pts: ["Autonomic neuropathy → silent ischemia", "Dyspnea may be the ONLY symptom"] },
    { title: "Cocaine Users", col: C.navy, pts: ["Vasospasm + tachycardia + thrombosis", "Beta-blockers CONTRAINDICATED", "Use labetalol if rate control needed"] },
    { title: "Pregnancy", col: "#7D6608", pts: ["Aortic dissection risk ↑ (Type B > A)", "PE risk ↑ 4-fold", "Peripartum cardiomyopathy; SCAD"] },
  ];

  pops.forEach((p, i) => {
    let x, y, w = 2.9;
    if (i < 3) { x = 0.28 + i * 3.18; y = 1.42; }
    else { x = 0.88 + (i-3) * 4.22; y = 3.25; }
    w = i >= 3 ? 3.72 : 2.9;
    s.addShape("rect", { x, y, w, h: 1.72, fill: { color: p.col } });
    s.addText(p.title, { x, y: y+0.05, w, h: 0.42, fontSize: 14, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
    p.pts.forEach((pt, pi) => {
      s.addText(`• ${pt}`, { x: x+0.1, y: y+0.5+pi*0.38, w: w-0.15, h: 0.4, fontSize: 11, color: C.white, fontFace: "Calibri" });
    });
  });
}

// ─── SLIDE 30 — DIFFERENTIATING LIFE-THREATENING CAUSES ──────────────────────
{
  let s = pres.addSlide();
  s.background = { color: "0A1F3C" }; // dark
  s.addShape("rect", { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.red } });
  s.addShape("rect", { x: 0, y: 5.28, w: 10, h: 0.35, fill: { color: C.teal } });

  s.addText("Differentiating Life-Threatening Causes", {
    x: 0.35, y: 0.12, w: 9.4, h: 0.65,
    fontSize: 24, bold: true, color: C.white, fontFace: "Calibri"
  });
  s.addText("Harrison's 22E Table 15-1; Symptom to Diagnosis 4E", {
    x: 0.35, y: 0.78, w: 9.4, h: 0.3,
    fontSize: 11.5, color: C.gold, italic: true, fontFace: "Calibri"
  });

  const diffs = [
    { dx: "ACS",           pain: "Retrosternal crushing/pressure → arm/jaw", ecg: "ST elevation/depression", bio: "↑ hs-cTn", rx: "PCI / Thrombolysis + Antiplatelets", col: C.red },
    { dx: "Aortic Dissection", pain: "Abrupt maximal tearing, interscapular",  ecg: "Normal or non-specific", bio: "Normal troponin", rx: "BP control; Type A → Surgery", col: "#922B21" },
    { dx: "PE",            pain: "Pleuritic + dyspnea + tachycardia/hypoxia", ecg: "Sinus tachy, S1Q3T3",   bio: "D-dimer, BNP", rx: "Anticoagulation ± Thrombolysis", col: C.amber },
    { dx: "Tension PTX",   pain: "Sudden pleuritic + tracheal deviation",      ecg: "Clinical dx",           bio: "—",            rx: "Needle decompression IMMEDIATELY", col: C.teal },
    { dx: "Pericarditis",  pain: "Sharp pleuritic, worse supine",              ecg: "Diffuse saddle ST ↑, PR↓", bio: "CRP, ESR ↑", rx: "NSAIDs + Colchicine", col: C.navy },
    { dx: "Esophageal Rupture", pain: "Vomiting + severe chest pain",          ecg: "Normal",                bio: "—",            rx: "CXR/CT pneumomediastinum → Surgery", col: C.slate },
  ];

  const cols_h = ["Diagnosis", "Pain Character", "ECG", "Biomarker", "Management"];
  const widths = [1.35, 2.6, 1.78, 1.48, 2.58];
  let xOff = 0.28;
  cols_h.forEach((h, hi) => {
    s.addShape("rect", { x: xOff, y: 1.14, w: widths[hi], h: 0.35, fill: { color: C.teal } });
    s.addText(h, { x: xOff, y: 1.14, w: widths[hi], h: 0.35, fontSize: 11, bold: true, color: C.white, align: "center", fontFace: "Calibri" });
    xOff += widths[hi] + 0.02;
  });

  diffs.forEach((d, di) => {
    let y = 1.52 + di * 0.65;
    let xO = 0.28;
    const rowData = [d.dx, d.pain, d.ecg, d.bio, d.rx];
    rowData.forEach((cell, ci) => {
      s.addShape("rect", { x: xO, y, w: widths[ci], h: 0.62, fill: { color: di%2===0?"0D2040":"091730" } });
      if (ci === 0) {
        s.addShape("rect", { x: xO, y, w: 0.08, h: 0.62, fill: { color: d.col } });
      }
      s.addText(cell, {
        x: xO + (ci===0?0.12:0.05), y, w: widths[ci]-(ci===0?0.15:0.08), h: 0.62,
        fontSize: ci===0?11:10.5,
        bold: ci===0, color: ci===0?d.col:C.white,
        fontFace: "Calibri", valign: "middle"
      });
      xO += widths[ci] + 0.02;
    });
  });
}

// ─── SLIDE 31 — KEY TAKEAWAYS ─────────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.darkBg };
  s.addShape("rect", { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.red } });
  s.addShape("rect", { x: 0, y: 5.3, w: 10, h: 0.325, fill: { color: C.teal } });

  s.addText("🔑  Key Takeaways", {
    x: 0.35, y: 0.18, w: 9.4, h: 0.75,
    fontSize: 28, bold: true, color: C.white, fontFace: "Calibri"
  });
  s.addShape("rect", { x: 0.35, y: 0.92, w: 9.3, h: 0.04, fill: { color: C.teal } });

  const takeaways = [
    { icon: "⚠", text: "Always rule out life-threatening causes FIRST — ACS, Dissection, PE, Tension PTX", col: C.red },
    { icon: "⚡", text: "ECG within 10 minutes — a NORMAL ECG does NOT rule out ACS", col: C.gold },
    { icon: "🔬", text: "High-sensitivity troponin with serial testing is the cornerstone biomarker", col: C.teal },
    { icon: "📊", text: "Use validated tools: HEART Score, ESC 0h/1h protocol, GRACE, Wells Score", col: C.amber },
    { icon: "👥", text: "Recognise atypical presentations — women, elderly, diabetics present differently", col: C.green },
    { icon: "📡", text: "ACC/AHA 2021: CCTA is first-line imaging for stable intermediate-risk chest pain", col: "#7FB3F5" },
  ];

  takeaways.forEach((t, i) => {
    let y = 1.05 + i * 0.75;
    s.addShape("rect", { x: 0.35, y, w: 9.3, h: 0.68, fill: { color: C.navy } });
    s.addShape("rect", { x: 0.35, y, w: 0.5, h: 0.68, fill: { color: t.col } });
    s.addText(t.icon, { x: 0.35, y, w: 0.5, h: 0.68, fontSize: 16, align: "center", valign: "middle", fontFace: "Segoe UI Emoji" });
    s.addText(t.text, { x: 0.9, y: y+0.04, w: 8.65, h: 0.6, fontSize: 14, color: C.white, fontFace: "Calibri", valign: "middle", bold: false });
  });
}

// ─── SLIDE 32 — REFERENCES ────────────────────────────────────────────────────
{
  let s = pres.addSlide();
  s.background = { color: C.navy };
  s.addShape("rect", { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.teal } });
  s.addShape("rect", { x: 0, y: 5.3, w: 10, h: 0.325, fill: { color: C.red } });

  s.addText("References", {
    x: 0.35, y: 0.15, w: 9.4, h: 0.65,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri"
  });
  s.addText("Current as of July 2026", {
    x: 0.35, y: 0.8, w: 9.4, h: 0.32,
    fontSize: 12, color: C.gold, italic: true, fontFace: "Calibri"
  });
  s.addShape("rect", { x: 0.35, y: 1.1, w: 9.3, h: 0.04, fill: { color: C.teal } });

  const refs = [
    "Harrison's Principles of Internal Medicine, 22nd Ed. (2025). McGraw Hill. Chapter 15 (Chest Discomfort)",
    "Tintinalli's Emergency Medicine: A Comprehensive Study Guide, 9th Ed. Chapter 48",
    "Rosen's Emergency Medicine: Concepts and Clinical Practice, 10th Ed. Chapter 64",
    "Symptom to Diagnosis: An Evidence-Based Guide, 4th Ed. Chapter 9",
    "Fuster & Hurst's The Heart, 15th Ed.",
    "ACC/AHA 2021 Guideline for the Evaluation and Diagnosis of Chest Pain. Circulation 2021",
    "ESC 2020 Guidelines for the management of NSTE-ACS. Eur Heart J 2021",
    "ESC 2019 Guidelines on acute pulmonary embolism. Eur Heart J 2020",
    "ESC 2015 Guidelines on pericardial diseases",
    "4th Universal Definition of Myocardial Infarction. Eur Heart J 2019",
    "Six AJ, et al. HEART score: A validated risk stratification tool. Neth Heart J 2010",
  ];
  refs.forEach((r, i) => {
    s.addText(`${i+1}. ${r}`, {
      x: 0.4, y: 1.2 + i * 0.375, w: 9.2, h: 0.37,
      fontSize: 11, color: "A9C4E8", fontFace: "Calibri"
    });
  });
}

// ─── SAVE ─────────────────────────────────────────────────────────────────────
const outPath = "/home/daytona/workspace/chest-pain-pptx/Approach_to_Chest_Pain.pptx";
pres.writeFile({ fileName: outPath })
  .then(() => console.log(`✅  Saved: ${outPath}`))
  .catch(e => { console.error("❌  Error:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/chest-pain-pptx && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/chest-pain-pptx/Approach_to_Chest_Pain.pptx

Your presentation is ready! Download it here:

Approach to Chest Pain

Presentation · PPTX


Here's what was built - 32 slides across a complete faculty-ready presentation:
#SlideContent
1Title SlideBold navy/red theme with heart icon, all source citations
2Learning Objectives7 objectives from Harrison's 22E + ACC/AHA 2021
3-4EpidemiologyStat boxes (7M visits, 50% admitted, 10% ACS, 2% missed), bar chart of final diagnoses
5-6Differential Diagnosis3-column colour-coded table: Life-threatening / Serious / Benign
7PathophysiologySomatic vs visceral pain, referred pain pathways, T1–T4
8-12Clinical ApproachLee's 4-question framework, triage priorities, OPQRST, atypical presentations (women/elderly/diabetics), physical exam table
13-16InvestigationsECG criteria (STEMI/NSTEMI/Wellens/De Winter), hs-cTn protocol, imaging modalities
17-19Risk StratificationFull HEART Score with colour bands, ESC 0h/1h algorithm, TIMI, GRACE
20-25Key DiagnosesACS, Aortic Dissection (Stanford classification), PE (Wells score), Pneumothorax, Pericarditis, Benign causes
26-29Management5-step acute algorithm, outpatient evaluation, special populations
30Comparison TableAll 6 life-threatening diagnoses: pain, ECG, biomarker, management side-by-side
31Key Takeaways6 high-yield points in a branded format
32ReferencesAll 11 sources, current to July 2026
Design choices for faculty presentations: Navy dominant palette with red accents for emergencies, amber for moderate risk, green for benign/low risk — consistent visual language throughout. Stat boxes, colour-coded tables, and multi-column layouts replace plain bullet lists.
This is a shared conversation. Sign in to Orris to start your own chat.