Uses of nitrate in biliary colic

Reading File
Nitrates relax smooth muscle in the biliary tract, reducing spasm and intra-ductal pressure - this is the core mechanism behind their use in biliary colic. They are used as a short-term measure to relieve acute pain.
Searching sources...
Finding Sources
Finding Sources
Searching PubMed

nitrates "biliary colic" sphincter Oddi

Finding Sources
Finding Sources
Searching PubMed

nitrates biliary tract smooth muscle relaxation

Reading File
Finding Sources
Finding Sources
Finding Sources
Searching the Web

nitrates glyceryl trinitrate biliary colic mechanism uses sublingual

Finding Sources
Searching the Web

sublingual glyceryl trinitrate GTN biliary colic acute pain relief mechanism sphincter Oddi

Here is a thorough summary of the uses of nitrates in biliary colic, drawing from pharmacology textbooks and published clinical evidence.

Nitrates in Biliary Colic

Mechanism of Action

Nitrates (primarily glyceryl trinitrate / GTN / nitroglycerin) are organic nitrates that release nitric oxide (NO) after enzymatic conversion by mitochondrial aldehyde dehydrogenase (ALDH2). NO activates guanylyl cyclase, raises intracellular cGMP, and causes smooth muscle relaxation. This effect is well established in vascular smooth muscle and extends to the smooth muscle of the biliary tract, including:
  • The sphincter of Oddi (SO) - the key gatekeeper at the choledochoduodenal junction
  • The common bile duct
  • The gallbladder wall (to a lesser degree)
In a manometry study (Staritz et al., Gut 1985, PMID 3917965), sublingual GTN 1.2 mg caused, within 3 minutes:
  • Papillary contraction amplitude fell from ~69 to ~37 mmHg (p < 0.005)
  • Sphincter of Oddi baseline pressure fell from ~8.9 to ~2.9 mmHg (p < 0.005)
  • Contraction frequency was unchanged
This confirms GTN relaxes the sphincter of Oddi muscle effectively without broadly disrupting its motility pattern.

Clinical Uses in Biliary Colic

1. Acute Pain Relief

  • Sublingual GTN acts within 1-3 minutes, providing rapid smooth muscle relaxation of the cystic duct, common bile duct, and sphincter of Oddi.
  • This relieves the obstructive/spasmodic component of biliary colic pain - particularly useful when the pain is driven by ductal spasm or a temporarily impacted small stone.
  • It is used as an adjunct to NSAIDs (the first-line analgesics) and antispasmodics when faster biliary decompression is needed.

2. Facilitation of Spontaneous Stone Passage

  • In patients with small common bile duct (CBD) stones causing biliary colic, sublingual GTN can relax the sphincter of Oddi enough to allow spontaneous passage of the stone, potentially avoiding ERCP or endoscopic papillary dilation.
  • A clinical study (Mansour et al., EC Gastroenterology 2020) demonstrated GTN's efficacy in managing small CBD stones in patients with chronic calcular cholecystitis due to sphincter of Oddi spasm - stones passed medically with GTN in a subset of patients.

3. Pre-procedure Aid for Endoscopic Stone Removal

  • GTN has been used as premedication before ERCP to relax the sphincter, facilitating removal of small-to-medium CBD stones through the intact papilla without sphincterotomy.
  • This is particularly valuable when sphincterotomy carries higher risk (e.g., bleeding diathesis, anticoagulation).

4. Sphincter of Oddi Dysfunction (SOD)

  • In SOD (post-cholecystectomy biliary-type pain with elevated SO pressure), GTN is used - often in combination with nifedipine and/or tricyclic antidepressants - as a non-invasive medical therapy.
  • About 51% of SOD patients improve with medical therapy (GTN + nifedipine + low-dose TCA) before needing sphincterotomy.
  • A 2023 MDPI review on SO dysfunction classifies GTN among Level 5 evidence interventions for SOD types 1, 2, and 3 - the mechanism being direct relaxation of SO musculature.

Drug and Dose

PreparationDoseRouteOnset
Glyceryl trinitrate (GTN)0.3-0.6 mg (acute) or 1.2 mg (research dose)Sublingual tablet or spray1-3 min
Isosorbide dinitrate5-10 mgSublingual / oral5-10 min
Sublingual GTN is preferred for acute biliary colic due to its rapid onset.

Limitations and Side Effects

  • Hypotension - the most significant concern; nitrates can cause marked systemic vasodilation and reflex tachycardia, especially in volume-depleted patients (common with vomiting in biliary colic).
  • Headache and flushing - due to meningeal vessel dilation.
  • Tolerance develops with prolonged/repeated use (sulfhydryl group depletion, ROS generation).
  • Long-term studies specifically for biliary colic are lacking; evidence remains primarily short-term.
  • GTN is not a primary analgesic - it does not replace NSAIDs or opioids for pain control, but complements them by relieving the spasmodic/obstructive component.

Position in Current Management

Current guidelines (Tintinalli, Yamada's Gastroenterology) place NSAIDs as first-line for biliary colic analgesia, with antispasmodics (hyoscine butylbromide) and antiemetics as adjuncts. Nitrates occupy a secondary/adjunctive role, most useful when:
  • Rapid biliary decompression is desired
  • Small CBD stone passage is being attempted medically
  • ERCP premedication is needed
  • Standard analgesics are insufficient or contraindicated

Ppt on approach to chest pain

Asking for Preferences
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
I now have rich content. Let me build the presentation.
Running Command

mkdir -p /home/daytona/workspace/chest-pain-ppt && ls /home/daytona/workspace/chest-pain-ppt/

Writing File

~/chest-pain-ppt/build.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Approach to Chest Pain";
pres.author = "Emergency Medicine";

// ── PALETTE ──────────────────────────────────────────────────────────────────
const RED    = "C0392B";   // danger / critical
const DARK   = "1A1A2E";   // deep navy – dominant background
const MID    = "16213E";   // slightly lighter navy
const CARD   = "0F3460";   // card / panel colour
const ACCENT = "E94560";   // hot-red accent
const WHITE  = "FFFFFF";
const LGREY  = "E8EAF6";
const YELLOW = "F1C40F";
const GREEN  = "27AE60";
const ORANGE = "E67E22";

// ── HELPERS ──────────────────────────────────────────────────────────────────
function darkBg(slide) {
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: DARK }, line: { type: "none" } });
}
function midBg(slide) {
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: MID }, line: { type: "none" } });
}
function accentBar(slide, y = 0.55, w = 10) {
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y, w, h: 0.04, fill: { color: ACCENT }, line: { type: "none" } });
}
function sectionTitle(slide, title, subtitle = "") {
  darkBg(slide);
  // large accent stripe left
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.22, h: 5.625, fill: { color: ACCENT }, line: { type: "none" } });
  slide.addText(title, { x: 0.55, y: 1.6, w: 9.1, h: 1.0, fontSize: 36, bold: true, color: WHITE, fontFace: "Calibri" });
  if (subtitle) slide.addText(subtitle, { x: 0.55, y: 2.7, w: 8.5, h: 0.6, fontSize: 18, color: LGREY, fontFace: "Calibri" });
}
function slideHeader(slide, title) {
  midBg(slide);
  accentBar(slide, 0, 10);
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.62, fill: { color: CARD }, line: { type: "none" } });
  slide.addText(title, { x: 0.3, y: 0.06, w: 9.4, h: 0.5, fontSize: 20, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
}
function card(slide, x, y, w, h, color = CARD) {
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y, w, h, fill: { color }, line: { type: "none" }, rectRadius: 0.08 });
}
function bullets(slide, items, x, y, w, h, opts = {}) {
  const defaultOpts = { fontSize: 13, color: WHITE, fontFace: "Calibri", valign: "top" };
  const merged = { ...defaultOpts, ...opts };
  slide.addText(
    items.map((t, i) => ({ text: t, options: { bullet: { type: "bullet" }, breakLine: i < items.length - 1 } })),
    { x, y, w, h, ...merged }
  );
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);
  // Diagonal accent shape
  s.addShape(pres.shapes.RECTANGLE, { x: 6.5, y: 0, w: 3.5, h: 5.625, fill: { color: ACCENT }, line: { type: "none" }, rotate: 0 });
  s.addShape(pres.shapes.RECTANGLE, { x: 5.8, y: 0, w: 1.2, h: 5.625, fill: { color: "B03030" }, line: { type: "none" } });
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 4.5, w: 5.8, h: 0.06, fill: { color: YELLOW }, line: { type: "none" } });

  s.addText("APPROACH TO", { x: 0.5, y: 0.9, w: 5.5, h: 0.7, fontSize: 22, color: LGREY, bold: false, fontFace: "Calibri", charSpacing: 8 });
  s.addText("CHEST PAIN", { x: 0.5, y: 1.55, w: 5.5, h: 1.4, fontSize: 52, bold: true, color: WHITE, fontFace: "Calibri" });
  s.addText("Emergency Physician's Guide", { x: 0.5, y: 3.05, w: 5.5, h: 0.5, fontSize: 17, color: YELLOW, fontFace: "Calibri", italic: true });
  s.addText("Systematic Evaluation · Risk Stratification · Management", { x: 0.5, y: 3.65, w: 5.5, h: 0.4, fontSize: 12, color: LGREY, fontFace: "Calibri" });

  s.addText("❤", { x: 7.2, y: 1.8, w: 2, h: 2, fontSize: 80, color: WHITE, align: "center", fontFace: "Segoe UI Emoji" });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 2 – EPIDEMIOLOGY
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Epidemiology & Importance");

  // 3 stat cards
  const stats = [
    { num: "7.5M", label: "ED visits / year\nin the USA", col: ACCENT },
    { num: "5%", label: "of all ED\npresentations", col: "1565C0" },
    { num: "#2", label: "Leading cause of\nED presentation", col: "6A1B9A" },
  ];
  stats.forEach((st, i) => {
    const x = 0.4 + i * 3.1;
    card(s, x, 0.85, 2.8, 1.7, st.col);
    s.addText(st.num, { x, y: 0.95, w: 2.8, h: 0.9, fontSize: 38, bold: true, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
    s.addText(st.label, { x, y: 1.75, w: 2.8, h: 0.6, fontSize: 11, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
  });

  // Key points
  card(s, 0.4, 2.75, 9.2, 2.5, CARD);
  s.addText("Why it Matters", { x: 0.65, y: 2.9, w: 8.8, h: 0.35, fontSize: 14, bold: true, color: YELLOW, fontFace: "Calibri", margin: 0 });
  bullets(s, [
    "Chest pain intensity does NOT correlate with underlying severity — a benign complaint can mask a catastrophic diagnosis",
    "Broad differential: from life-threatening (ACS, aortic dissection, PE) to benign (musculoskeletal, GERD)",
    "Visceral afferents from heart, lungs, great vessels & esophagus converge on the same thoracic dorsal ganglia → similar pain character",
    "Pain can radiate anywhere from the jaw to the epigastrium due to overlapping dorsal root ganglia (3 segments above and below)",
  ], 0.65, 3.3, 8.8, 1.8, { fontSize: 12 });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 3 – DIFFERENTIAL DIAGNOSIS TABLE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Differential Diagnosis — Anatomical Framework");

  const rows = [
    { sys: "Cardiovascular", crit: "STEMI / ACS, Aortic Dissection, Cardiac Tamponade", emerg: "Unstable Angina, Myocarditis", nonemerg: "Stable Angina, Pericarditis, MVP" },
    { sys: "Pulmonary", crit: "Tension Pneumothorax, Massive PE", emerg: "Pneumothorax, PE, Pneumonia, Pleuritis", nonemerg: "Pleuritis, Asthma, COPD" },
    { sys: "Vascular", crit: "Thoracic Aortic Dissection, Rupture", emerg: "Aortic Aneurysm", nonemerg: "" },
    { sys: "GI / Esophageal", crit: "Boerhaave Syndrome (esophageal rupture)", emerg: "Esophageal spasm", nonemerg: "GERD, Peptic Ulcer, Pancreatitis, Biliary" },
    { sys: "Musculoskeletal", crit: "", emerg: "", nonemerg: "Costochondritis, Rib fracture, Tietze syndrome" },
    { sys: "Neurological", crit: "", emerg: "", nonemerg: "Herpes Zoster, Intercostal neuritis" },
    { sys: "Psychiatric", crit: "", emerg: "", nonemerg: "Panic Disorder, Anxiety" },
  ];

  const colW = [1.8, 3.0, 2.6, 2.4];
  const headers = ["System", "Critical ⚠", "Emergent", "Non-Emergent"];
  const hColors = [CARD, RED, ORANGE, GREEN];
  let startX = 0.2;
  headers.forEach((h, i) => {
    s.addShape(pres.shapes.RECTANGLE, { x: startX, y: 0.68, w: colW[i], h: 0.38, fill: { color: hColors[i] }, line: { type: "none" } });
    s.addText(h, { x: startX + 0.05, y: 0.72, w: colW[i] - 0.1, h: 0.3, fontSize: 11, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
    startX += colW[i];
  });

  rows.forEach((r, ri) => {
    const y = 1.1 + ri * 0.63;
    const rowColor = ri % 2 === 0 ? "0D2A4A" : "112E52";
    s.addShape(pres.shapes.RECTANGLE, { x: 0.2, y, w: 9.6, h: 0.6, fill: { color: rowColor }, line: { type: "none" } });
    const vals = [r.sys, r.crit, r.emerg, r.nonemerg];
    let cx = 0.2;
    vals.forEach((v, ci) => {
      const fc = ci === 1 && v ? YELLOW : ci === 0 ? LGREY : WHITE;
      s.addText(v, { x: cx + 0.06, y: y + 0.05, w: colW[ci] - 0.12, h: 0.52, fontSize: 9.5, color: fc, fontFace: "Calibri", valign: "middle", margin: 0 });
      cx += colW[ci];
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 4 – HISTORY TAKING: OPQRST + RED FLAGS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "History Taking — OPQRST Framework");

  const opqrst = [
    { letter: "O", word: "Onset", detail: "Sudden (dissection, PTX) vs gradual (pericarditis, GERD)" },
    { letter: "P", word: "Provocation/Palliation", detail: "Exertion → ACS; position → pericarditis; food → GERD" },
    { letter: "Q", word: "Quality", detail: "Pressure/squeezing → ACS; tearing/ripping → dissection; sharp/pleuritic → PTX/PE" },
    { letter: "R", word: "Radiation", detail: "Jaw/left arm → ACS; interscapular → dissection; shoulder → diaphragmatic irritation" },
    { letter: "S", word: "Severity", detail: "Score 1–10; does NOT predict severity of disease" },
    { letter: "T", word: "Time", detail: "> 20 min rest pain → ACS until proven otherwise; duration, prior episodes" },
  ];

  opqrst.forEach((item, i) => {
    const col = i < 3 ? 0 : 1;
    const row = i % 3;
    const x = 0.3 + col * 4.85;
    const y = 0.78 + row * 1.55;
    card(s, x, y, 4.6, 1.4, CARD);
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: x + 0.12, y: y + 0.12, w: 0.52, h: 0.52, fill: { color: ACCENT }, line: { type: "none" }, rectRadius: 0.05 });
    s.addText(item.letter, { x: x + 0.12, y: y + 0.12, w: 0.52, h: 0.52, fontSize: 20, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri", margin: 0 });
    s.addText(item.word, { x: x + 0.75, y: y + 0.12, w: 3.7, h: 0.35, fontSize: 12, bold: true, color: YELLOW, fontFace: "Calibri", margin: 0 });
    s.addText(item.detail, { x: x + 0.12, y: y + 0.6, w: 4.32, h: 0.65, fontSize: 10.5, color: LGREY, fontFace: "Calibri", margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 5 – RED FLAGS & ASSOCIATED SYMPTOMS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Red Flags & Associated Symptoms");

  // Left panel – Red flags
  card(s, 0.3, 0.75, 4.5, 4.5, "3B0A0A");
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 0.75, w: 4.5, h: 0.45, fill: { color: RED }, line: { type: "none" } });
  s.addText("🚨  RED FLAGS — Act Immediately", { x: 0.35, y: 0.76, w: 4.4, h: 0.43, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 4 });
  bullets(s, [
    "Diaphoresis with chest pain",
    "Syncope or near-syncope",
    "Severe tearing / ripping pain radiating to back",
    "Haemodynamic instability (hypotension, shock)",
    "O₂ saturation < 94% or respiratory distress",
    "Unequal blood pressure in both arms (> 20 mmHg)",
    "New neurological deficit with chest pain",
    "Sudden onset maximal severity pain",
    "Chest pain + unilateral leg swelling",
  ], 0.45, 1.25, 4.2, 3.8, { fontSize: 11.5, color: WHITE });

  // Right panel – Associated symptoms
  card(s, 5.1, 0.75, 4.6, 4.5, CARD);
  s.addShape(pres.shapes.RECTANGLE, { x: 5.1, y: 0.75, w: 4.6, h: 0.45, fill: { color: "1565C0" }, line: { type: "none" } });
  s.addText("🔍  Associated Symptoms & Clues", { x: 5.15, y: 0.76, w: 4.5, h: 0.43, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 4 });
  const assoc = [
    { sym: "Nausea / vomiting, diaphoresis", dx: "→ ACS" },
    { sym: "Dyspnoea, haemoptysis, leg oedema", dx: "→ PE" },
    { sym: "Fever, friction rub, positional relief", dx: "→ Pericarditis" },
    { sym: "Dysphagia, food regurgitation", dx: "→ Oesophageal" },
    { sym: "Neurological deficits, pulse deficit", dx: "→ Aortic dissection" },
    { sym: "Pleuritic pain, cough, absent breath sounds", dx: "→ Pneumothorax" },
    { sym: "Heartburn, water-brash, meal-related", dx: "→ GERD" },
    { sym: "Localised tenderness, reproduced on palpation", dx: "→ MSK" },
  ];
  assoc.forEach((a, i) => {
    const y = 1.26 + i * 0.47;
    s.addText([
      { text: a.sym, options: { color: LGREY } },
      { text: "  " + a.dx, options: { color: YELLOW, bold: true } },
    ], { x: 5.2, y, w: 4.3, h: 0.42, fontSize: 10.5, fontFace: "Calibri", bullet: { type: "bullet" } });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 6 – PHYSICAL EXAMINATION
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Physical Examination");

  const sections = [
    {
      title: "Vital Signs — Always First",
      color: RED,
      items: ["HR, BP (both arms — >20 mmHg difference → dissection)", "RR, SpO₂ — Hypoxia narrows differential immediately", "Temperature — Fever → infectious aetiology", "Pulsus paradoxus > 10 mmHg → tamponade"],
    },
    {
      title: "Inspection & Palpation",
      color: "1565C0",
      items: ["JVD → RV failure, tamponade, tension PTX", "Reproducible chest wall tenderness → MSK (but does NOT rule out ACS)", "Unequal breath sounds → pneumothorax", "Tracheal deviation → tension pneumothorax (late sign)"],
    },
    {
      title: "Auscultation",
      color: "6A1B9A",
      items: ["Muffled heart sounds → tamponade (Beck's triad)", "Pericardial friction rub → pericarditis", "Pleural rub → pleuritis or infarction", "S3/S4 gallop → LV dysfunction / ACS"],
    },
    {
      title: "Peripheral Examination",
      color: GREEN,
      items: ["Unilateral leg swelling / calf tenderness → DVT/PE", "Pulse deficit → aortic dissection", "Marfanoid features → high risk dissection", "Track marks / drug signs → cocaine-related ACS"],
    },
  ];

  sections.forEach((sec, i) => {
    const x = i < 2 ? 0.25 + i * 4.85 : 0.25 + (i - 2) * 4.85;
    const y = i < 2 ? 0.75 : 3.1;
    card(s, x, y, 4.65, 2.1, CARD);
    s.addShape(pres.shapes.RECTANGLE, { x, y, w: 4.65, h: 0.38, fill: { color: sec.color }, line: { type: "none" } });
    s.addText(sec.title, { x: x + 0.1, y: y + 0.04, w: 4.45, h: 0.3, fontSize: 11, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
    bullets(s, sec.items, x + 0.1, y + 0.43, 4.45, 1.6, { fontSize: 10.5 });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 7 – ECG INTERPRETATION
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "ECG — The Single Most Important Test");

  s.addText("Obtain within 10 minutes of arrival. Repeat if initial ECG is non-diagnostic and symptoms persist.", {
    x: 0.3, y: 0.72, w: 9.4, h: 0.38, fontSize: 12, color: YELLOW, fontFace: "Calibri", italic: true, margin: 0
  });

  const ecgFindings = [
    { find: "ST Elevation", detail: "STEMI — territory-based: II, III, aVF (inferior); V1–V4 (anterior); I, aVL (lateral)", col: RED },
    { find: "ST Depression / T-wave inversion", detail: "NSTEMI / Unstable angina — Posterior MI (ST elevation in V1–V2 as mirror)", col: ORANGE },
    { find: "Sinus tachycardia + S1Q3T3", detail: "Pulmonary embolism — also: RBBB, right axis deviation, T-wave inversion V1–V4", col: "8B008B" },
    { find: "Low voltage + electrical alternans", detail: "Cardiac tamponade — beat-to-beat QRS alternation classic", col: "1565C0" },
    { find: "Diffuse saddle-shaped ST elevation", detail: "Pericarditis — PR depression is pathognomonic; spares aVR", col: GREEN },
    { find: "Widened mediastinum on CXR + normal ECG", detail: "Aortic dissection — ECG may be normal or show inferior ischaemia if RCA involved", col: "795548" },
    { find: "De Winter T-waves", detail: "LAD occlusion equivalent — upsloping ST depression with tall symmetric T-waves in precordial leads", col: "D32F2F" },
  ];

  ecgFindings.forEach((ef, i) => {
    const y = 1.18 + i * 0.6;
    card(s, 0.25, y, 9.5, 0.56, i % 2 === 0 ? "0D2A4A" : "0A2238");
    s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y, w: 0.22, h: 0.56, fill: { color: ef.col }, line: { type: "none" } });
    s.addText(ef.find, { x: 0.6, y: y + 0.05, w: 2.8, h: 0.46, fontSize: 11.5, bold: true, color: YELLOW, fontFace: "Calibri", valign: "middle", margin: 0 });
    s.addText(ef.detail, { x: 3.5, y: y + 0.05, w: 6.1, h: 0.46, fontSize: 10.5, color: LGREY, fontFace: "Calibri", valign: "middle", margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 8 – INVESTIGATIONS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Investigations — Targeted & Sequential");

  const tests = [
    { test: "12-lead ECG", timing: "≤10 min", finding: "STEMI, arrhythmia, tamponade, PE pattern", col: RED },
    { test: "High-sensitivity Troponin (hsTnI/T)", timing: "0h & 1–2h", finding: "Myocardial injury — 0h/1h rule-in/rule-out algorithm", col: ACCENT },
    { test: "Chest X-Ray (PA/AP)", timing: "Immediate", finding: "Pneumothorax, mediastinal widening, pulmonary oedema, effusion", col: ORANGE },
    { test: "D-dimer (if low/moderate PTP)", timing: "Immediate", finding: "PE rule-out if negative with low Wells score; dissection screening", col: "8B008B" },
    { test: "CT Pulmonary Angiography (CTPA)", timing: "When indicated", finding: "Definitive PE diagnosis; sensitivity > 95%", col: "1565C0" },
    { test: "CT Aortogram", timing: "When indicated", finding: "Aortic dissection — widened mediastinum, BP differential, pulse deficit", col: "00695C" },
    { test: "Bedside Echo / POCUS", timing: "Immediate in unstable", finding: "Effusion, wall motion abnormality, RV strain, aortic root, tamponade", col: GREEN },
    { test: "ABG + Lactate", timing: "Immediate if hypoxic", finding: "Hypoxia (PE, PTX), acidosis, hyperlactataemia in shock states", col: "795548" },
    { test: "BMP / FBC / Lipase", timing: "Routine", finding: "Anaemia (demand ischaemia), renal function, lipase (GI causes)", col: CARD },
  ];

  // Header row
  ["Test", "Timing", "Key Finding / Indication"].forEach((h, i) => {
    const xs = [0.25, 2.85, 4.45];
    const ws = [2.5, 1.5, 5.3];
    s.addShape(pres.shapes.RECTANGLE, { x: xs[i], y: 0.68, w: ws[i], h: 0.36, fill: { color: CARD }, line: { type: "none" } });
    s.addText(h, { x: xs[i] + 0.06, y: 0.7, w: ws[i], h: 0.3, fontSize: 11, bold: true, color: YELLOW, fontFace: "Calibri", margin: 0 });
  });

  tests.forEach((t, i) => {
    const y = 1.08 + i * 0.5;
    const rc = i % 2 === 0 ? "0D2A4A" : "0A2238";
    s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y, w: 9.5, h: 0.47, fill: { color: rc }, line: { type: "none" } });
    s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y, w: 0.18, h: 0.47, fill: { color: t.col }, line: { type: "none" } });
    s.addText(t.test, { x: 0.55, y: y + 0.04, w: 2.22, h: 0.39, fontSize: 10.5, bold: true, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 0 });
    s.addText(t.timing, { x: 2.85, y: y + 0.04, w: 1.5, h: 0.39, fontSize: 10, color: YELLOW, fontFace: "Calibri", valign: "middle", margin: 0 });
    s.addText(t.finding, { x: 4.45, y: y + 0.04, w: 5.25, h: 0.39, fontSize: 10, color: LGREY, fontFace: "Calibri", valign: "middle", margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 9 – ACS APPROACH (Risk Stratification)
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "ACS — Risk Stratification & Management");

  // Top ribbon
  s.addText("ACS is the must-not-miss diagnosis. Treat with the highest suspicion until excluded.", {
    x: 0.3, y: 0.72, w: 9.4, h: 0.32, fontSize: 11.5, color: YELLOW, italic: true, fontFace: "Calibri", margin: 0
  });

  const tiers = [
    {
      label: "STEMI",
      color: RED,
      ecg: "ST elevation ≥ 1mm (2 contiguous leads)",
      action: "Activate Cath Lab — door-to-balloon < 90 min\nPCI is first-line; fibrinolysis if PCI unavailable within 120 min\nAspirin 300 mg + P2Y12 inhibitor + anticoagulation",
    },
    {
      label: "NSTEMI",
      color: ORANGE,
      ecg: "ST depression / T-wave inversion + Troponin ↑",
      action: "GRACE/TIMI risk score\nHigh-risk → early invasive strategy (< 24h)\nDual antiplatelet + anticoagulation\nMonitor in CCU",
    },
    {
      label: "Unstable Angina",
      color: YELLOW,
      ecg: "Dynamic ECG changes OR new onset rest pain — Troponin negative",
      action: "Treat as NSTEMI protocol\nRepeat Troponin at 1h and 3h\nRisk stratify (HEART score) for admission vs discharge",
    },
  ];

  tiers.forEach((tier, i) => {
    const y = 1.12 + i * 1.48;
    card(s, 0.25, y, 9.5, 1.35, CARD);
    s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y, w: 1.5, h: 1.35, fill: { color: tier.color }, line: { type: "none" } });
    s.addText(tier.label, { x: 0.25, y, w: 1.5, h: 1.35, fontSize: 15, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri", margin: 0 });
    s.addText("ECG:", { x: 1.85, y: y + 0.1, w: 0.55, h: 0.25, fontSize: 10, bold: true, color: YELLOW, fontFace: "Calibri", margin: 0 });
    s.addText(tier.ecg, { x: 2.4, y: y + 0.1, w: 7.1, h: 0.25, fontSize: 10, color: LGREY, fontFace: "Calibri", margin: 0 });
    s.addText("Action:", { x: 1.85, y: y + 0.42, w: 0.65, h: 0.82, fontSize: 10, bold: true, color: YELLOW, fontFace: "Calibri", valign: "top", margin: 0 });
    s.addText(tier.action, { x: 2.5, y: y + 0.42, w: 7.0, h: 0.82, fontSize: 10, color: WHITE, fontFace: "Calibri", valign: "top", margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 10 – AORTIC DISSECTION
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Aortic Dissection — High-Stakes Diagnosis");

  // Classification
  card(s, 0.25, 0.72, 4.55, 2.0, CARD);
  s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 0.72, w: 4.55, h: 0.38, fill: { color: RED }, line: { type: "none" } });
  s.addText("Stanford Classification", { x: 0.35, y: 0.74, w: 4.35, h: 0.3, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
  bullets(s, [
    "Type A — involves ascending aorta → SURGICAL EMERGENCY",
    "Type B — descending aorta only → Medical management (unless complications)",
    "DeBakey: Type I (whole aorta), Type II (ascending only), Type III (descending)",
  ], 0.35, 1.15, 4.3, 1.45, { fontSize: 11 });

  // Clinical features
  card(s, 5.05, 0.72, 4.7, 2.0, CARD);
  s.addShape(pres.shapes.RECTANGLE, { x: 5.05, y: 0.72, w: 4.7, h: 0.38, fill: { color: ORANGE }, line: { type: "none" } });
  s.addText("Classic Presentation", { x: 5.15, y: 0.74, w: 4.5, h: 0.3, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
  bullets(s, [
    "Sudden onset severe tearing / ripping chest pain → back",
    "Pain maximal at onset (vs ACS which builds)",
    "BP differential > 20 mmHg between arms",
    "Pulse deficit / aortic regurgitation murmur",
    "Marfan syndrome, hypertension, bicuspid aortic valve",
  ], 5.15, 1.15, 4.45, 1.45, { fontSize: 11 });

  // Diagnosis & management
  card(s, 0.25, 2.82, 4.55, 2.55, CARD);
  s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 2.82, w: 4.55, h: 0.38, fill: { color: "1565C0" }, line: { type: "none" } });
  s.addText("Diagnosis", { x: 0.35, y: 2.84, w: 4.35, h: 0.3, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
  bullets(s, [
    "CT Aortogram: gold standard (sensitivity ~100%)",
    "CXR: widened mediastinum > 8 cm (screening only)",
    "Bedside echo: assess aortic root, pericardial effusion",
    "ADD Score / aortic dissection detection risk score",
  ], 0.35, 3.25, 4.3, 2.0, { fontSize: 11 });

  card(s, 5.05, 2.82, 4.7, 2.55, CARD);
  s.addShape(pres.shapes.RECTANGLE, { x: 5.05, y: 2.82, w: 4.7, h: 0.38, fill: { color: GREEN }, line: { type: "none" } });
  s.addText("Management", { x: 5.15, y: 2.84, w: 4.5, h: 0.3, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
  bullets(s, [
    "Pain control: IV opioid analgesia",
    "Rate control FIRST: IV esmolol or labetalol (HR < 60)",
    "Then BP control: target SBP 100–120 mmHg",
    "Type A → Emergency cardiothoracic surgery",
    "Type B → Intensive care, IV antihypertensives; TEVAR if complicated",
  ], 5.15, 3.25, 4.45, 2.0, { fontSize: 11 });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 11 – PULMONARY EMBOLISM
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Pulmonary Embolism — Diagnostic Algorithm");

  // Wells score
  card(s, 0.25, 0.72, 4.0, 4.5, CARD);
  s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 0.72, w: 4.0, h: 0.38, fill: { color: "8B008B" }, line: { type: "none" } });
  s.addText("Wells Score for PE", { x: 0.35, y: 0.74, w: 3.8, h: 0.3, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
  const wells = [
    ["Clinical signs/symptoms DVT", "+3"],
    ["PE most likely diagnosis", "+3"],
    ["HR > 100 bpm", "+1.5"],
    ["Immobility > 3 days / surgery < 4 wks", "+1.5"],
    ["Prior DVT/PE", "+1.5"],
    ["Haemoptysis", "+1"],
    ["Active malignancy", "+1"],
  ];
  wells.forEach((w, i) => {
    const y = 1.15 + i * 0.48;
    s.addText(w[0], { x: 0.4, y, w: 2.9, h: 0.42, fontSize: 10.5, color: LGREY, fontFace: "Calibri", margin: 0, valign: "middle" });
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 3.5, y: y + 0.04, w: 0.6, h: 0.33, fill: { color: ACCENT }, line: { type: "none" }, rectRadius: 0.06 });
    s.addText(w[1], { x: 3.5, y: y + 0.04, w: 0.6, h: 0.33, fontSize: 10, bold: true, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
  });
  s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 4.52, w: 4.0, h: 0.5, fill: { color: "2C0040" }, line: { type: "none" } });
  s.addText("Score ≤4: Low/moderate → D-dimer\nScore >4: High → CTPA directly", { x: 0.35, y: 4.55, w: 3.8, h: 0.42, fontSize: 10, color: YELLOW, fontFace: "Calibri", margin: 0 });

  // Management
  card(s, 4.55, 0.72, 5.2, 4.5, CARD);
  s.addShape(pres.shapes.RECTANGLE, { x: 4.55, y: 0.72, w: 5.2, h: 0.38, fill: { color: "1565C0" }, line: { type: "none" } });
  s.addText("Management by Severity", { x: 4.65, y: 0.74, w: 5.0, h: 0.3, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });

  const peMgmt = [
    { label: "Massive PE (obstructive shock / SBP < 90)", color: RED, items: ["Systemic thrombolysis: alteplase 100 mg over 2h", "Heparin UFH before and after lysis", "Surgical embolectomy if lysis contraindicated", "Catheter-directed thrombolysis (EKOS)"] },
    { label: "Sub-massive PE (RV dysfunction, troponin ↑)", color: ORANGE, items: ["Anticoagulation: LMWH / UFH / DOAC", "Consider thrombolysis if deteriorating", "Admit for monitoring (risk of deterioration)"] },
    { label: "Low-risk PE (haemodynamically stable)", color: GREEN, items: ["DOAC: rivaroxaban or apixaban (first-line)", "Consider PESI score for outpatient treatment", "Investigate for underlying thrombophilia / malignancy"] },
  ];
  let py = 1.16;
  peMgmt.forEach((pm) => {
    card(s, 4.65, py, 5.0, pm.items.length * 0.42 + 0.5, "0D2A4A");
    s.addShape(pres.shapes.RECTANGLE, { x: 4.65, y: py, w: 5.0, h: 0.33, fill: { color: pm.color }, line: { type: "none" } });
    s.addText(pm.label, { x: 4.75, y: py + 0.02, w: 4.8, h: 0.29, fontSize: 10, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
    bullets(s, pm.items, 4.75, py + 0.38, 4.8, pm.items.length * 0.42, { fontSize: 10 });
    py += pm.items.length * 0.42 + 0.56;
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 12 – PERICARDITIS & MYOCARDITIS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Pericarditis & Myocarditis");

  const twoPanel = [
    {
      title: "Acute Pericarditis",
      color: "1565C0",
      content: [
        "Diagnosis (≥2 of 4): Chest pain (pleuritic, improved leaning forward), Pericardial friction rub, Diffuse saddle-shaped ST elevation + PR depression, New pericardial effusion",
        "ECG: PR depression in multiple leads is pathognomonic; diffuse ST elevation sparing aVR",
        "Aetiology: Viral (most common — enterovirus, EBV, CMV), autoimmune, tuberculosis, post-MI (Dressler), uraemia",
        "Treatment: NSAIDs (ibuprofen/aspirin) + colchicine 0.5 mg BD × 3 months; restrict activity; steroids only if refractory",
        "Admit if: fever > 38°C, large effusion, immunosuppressed, troponin ↑, not responsive to 1 week NSAIDs",
      ],
    },
    {
      title: "Myocarditis",
      color: RED,
      content: [
        "Presentation: Chest pain + dyspnoea + palpitations; often in young patients post-viral illness",
        "ECG: Non-specific ST-T changes, may mimic STEMI (global ST elevation), bundle branch blocks",
        "Troponin: Elevated — confirms myocardial injury; degree correlates with extent",
        "Diagnosis: Cardiac MRI (gold standard) — shows late gadolinium enhancement; biopsy in refractory",
        "Treatment: Supportive; avoid NSAIDs (worsen myocarditis); treat arrhythmias; IVIG in selected cases; heart failure therapy if LV dysfunction",
      ],
    },
  ];

  twoPanel.forEach((p, i) => {
    const x = 0.25 + i * 4.85;
    card(s, x, 0.72, 4.65, 4.6, CARD);
    s.addShape(pres.shapes.RECTANGLE, { x, y: 0.72, w: 4.65, h: 0.42, fill: { color: p.color }, line: { type: "none" } });
    s.addText(p.title, { x: x + 0.1, y: 0.74, w: 4.45, h: 0.36, fontSize: 14, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
    bullets(s, p.content, x + 0.15, 1.2, 4.35, 4.0, { fontSize: 10.5 });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 13 – PNEUMOTHORAX & OESOPHAGEAL RUPTURE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Pneumothorax & Oesophageal Rupture");

  // PTX
  card(s, 0.25, 0.72, 4.55, 4.6, CARD);
  s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 0.72, w: 4.55, h: 0.38, fill: { color: ORANGE }, line: { type: "none" } });
  s.addText("Pneumothorax", { x: 0.35, y: 0.74, w: 4.35, h: 0.3, fontSize: 13, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
  bullets(s, [
    "Primary spontaneous: tall, thin, young males; no underlying disease",
    "Secondary spontaneous: COPD, asthma, Marfan, cystic fibrosis",
    "Tension PTX: Clinical diagnosis — hypotension + absent breath sounds + tracheal deviation; do NOT wait for CXR",
    "Diagnosis: CXR (upright expiratory); POCUS (absent sliding sign, barcode sign) beats CXR in ED",
    "Treatment:",
    "  – Small (< 2 cm rim): Observe or simple aspiration",
    "  – Large (> 2 cm rim): Chest drain insertion",
    "  – Tension: Immediate needle decompression (2nd ICS MCL) → chest drain",
  ], 0.35, 1.16, 4.3, 4.0, { fontSize: 10.5 });

  // Boerhaave
  card(s, 5.05, 0.72, 4.7, 4.6, CARD);
  s.addShape(pres.shapes.RECTANGLE, { x: 5.05, y: 0.72, w: 4.7, h: 0.38, fill: { color: RED }, line: { type: "none" } });
  s.addText("Oesophageal Rupture (Boerhaave Syndrome)", { x: 5.15, y: 0.74, w: 4.5, h: 0.3, fontSize: 11, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
  bullets(s, [
    "Rare but lethal — mortality > 50% if diagnosis delayed beyond 24h",
    "Mackler's Triad: vomiting + chest pain + subcutaneous emphysema",
    "Mechanism: Sudden rise in oesophageal pressure (forceful vomiting, Valsalva)",
    "Spontaneous vs iatrogenic (post-endoscopy, post-dilation)",
    "CXR: mediastinal widening, pleural effusion (left), pneumomediastinum, hydropneumothorax",
    "CT chest with oral contrast: diagnostic — shows extravasation",
    "Management:",
    "  – Nil by mouth, IV fluids, broad-spectrum antibiotics",
    "  – Surgical repair (within 24h) — primary closure ± mediastinal washout",
    "  – Endoscopic stenting in selected stable patients",
  ], 5.15, 1.16, 4.45, 4.0, { fontSize: 10.5 });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 14 – NON-CARDIAC CAUSES
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Non-Cardiac Causes of Chest Pain");

  const causes = [
    {
      cat: "Musculoskeletal",
      color: GREEN,
      pts: [
        "Costochondritis: reproducible tenderness at costochondral junction; Tietze syndrome if swelling present",
        "Rib fracture: point tenderness + positive squeeze test; CXR / CT for confirmation",
        "Treatment: NSAIDs, ice, activity modification; NEVER exclude ACS based on reproducibility alone",
      ],
    },
    {
      cat: "Gastrointestinal",
      color: ORANGE,
      pts: [
        "GERD: burning, worse after meals, lying down; water-brash; responds to antacids/PPI",
        "Oesophageal spasm: sudden severe chest pain, may mimic ACS; relieved by nitrates and calcium channel blockers",
        "Peptic ulcer / gastritis: epigastric pain, may radiate to chest; Helicobacter pylori",
        "Pancreatitis: radiates to back, elevated lipase; biliary colic — RUQ, post-prandial",
      ],
    },
    {
      cat: "Neurological / Dermatological",
      color: "8B008B",
      pts: [
        "Herpes Zoster (Shingles): burning dermatomal pain, precedes rash by 2–3 days; diagnose clinically",
        "Intercostal neuritis: lancinating pain along intercostal distribution",
      ],
    },
    {
      cat: "Psychiatric / Functional",
      color: "1565C0",
      pts: [
        "Panic disorder: chest tightness, palpitations, hyperventilation, tremor, fear of death",
        "Diagnosis of exclusion — always rule out organic cause first",
        "Treatment: CBT, SSRIs, benzodiazepines acutely",
      ],
    },
  ];

  let cy = 0.72;
  causes.forEach((c, i) => {
    const col = i < 2 ? 0 : 1;
    const resetY = i === 2;
    if (resetY) cy = 0.72;
    const x = col === 0 ? 0.25 : 5.05;
    const h = c.pts.length * 0.5 + 0.9;
    card(s, x, cy, 4.65, h, CARD);
    s.addShape(pres.shapes.RECTANGLE, { x, y: cy, w: 4.65, h: 0.36, fill: { color: c.color }, line: { type: "none" } });
    s.addText(c.cat, { x: x + 0.1, y: cy + 0.03, w: 4.45, h: 0.3, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
    bullets(s, c.pts, x + 0.15, cy + 0.42, 4.35, h - 0.48, { fontSize: 10.5 });
    cy += h + 0.22;
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 15 – RISK SCORES (HEART, TIMI, GRACE)
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Clinical Risk Scores");

  // HEART score
  card(s, 0.25, 0.72, 4.45, 4.6, CARD);
  s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 0.72, w: 4.45, h: 0.38, fill: { color: RED }, line: { type: "none" } });
  s.addText("HEART Score (ACS Risk)", { x: 0.35, y: 0.74, w: 4.25, h: 0.3, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
  const heartRows = [
    ["H", "History", "Highly suspicious = 2, Moderate = 1, Slightly suspicious = 0"],
    ["E", "ECG", "Significant deviation = 2, Non-specific repolarisation = 1, Normal = 0"],
    ["A", "Age", "≥65 = 2, 45–64 = 1, <45 = 0"],
    ["R", "Risk Factors", "≥3 factors or Hx atherosclerosis = 2, 1–2 = 1, None = 0"],
    ["T", "Troponin", "> 3× normal = 2, 1–3× normal = 1, ≤ normal = 0"],
  ];
  heartRows.forEach((r, i) => {
    const y = 1.16 + i * 0.55;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.35, y: y + 0.06, w: 0.38, h: 0.38, fill: { color: RED }, line: { type: "none" }, rectRadius: 0.05 });
    s.addText(r[0], { x: 0.35, y: y + 0.06, w: 0.38, h: 0.38, fontSize: 14, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri", margin: 0 });
    s.addText(r[1], { x: 0.82, y, w: 0.9, h: 0.5, fontSize: 10, bold: true, color: YELLOW, fontFace: "Calibri", valign: "middle", margin: 0 });
    s.addText(r[2], { x: 1.75, y, w: 2.8, h: 0.5, fontSize: 9.5, color: LGREY, fontFace: "Calibri", valign: "middle", margin: 0 });
  });
  s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 4.0, w: 4.45, h: 1.12, fill: { color: "0D1F2D" }, line: { type: "none" } });
  s.addText([
    { text: "Score 0–3: ", options: { bold: true, color: GREEN } }, { text: "Low risk — discharge with outpatient follow-up\n", options: { color: LGREY } },
    { text: "Score 4–6: ", options: { bold: true, color: YELLOW } }, { text: "Intermediate — observation + repeat troponin\n", options: { color: LGREY } },
    { text: "Score 7–10: ", options: { bold: true, color: RED } }, { text: "High risk — admit, early invasive strategy", options: { color: LGREY } },
  ], { x: 0.35, y: 4.04, w: 4.25, h: 1.04, fontSize: 10, fontFace: "Calibri" });

  // Right panel - TIMI + GRACE
  card(s, 4.95, 0.72, 4.8, 2.15, CARD);
  s.addShape(pres.shapes.RECTANGLE, { x: 4.95, y: 0.72, w: 4.8, h: 0.38, fill: { color: ORANGE }, line: { type: "none" } });
  s.addText("TIMI Score (UA/NSTEMI)", { x: 5.05, y: 0.74, w: 4.6, h: 0.3, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
  bullets(s, [
    "Age ≥ 65 yrs | ≥ 3 CAD risk factors | Known CAD (stenosis ≥ 50%)",
    "Aspirin use in past 7 days | Severe angina (≥ 2 in 24h)",
    "ST deviation ≥ 0.5 mm | Positive troponin",
    "Score 0–2: Low; 3–4: Intermediate; 5–7: High",
  ], 5.05, 1.15, 4.6, 1.6, { fontSize: 10.5 });

  card(s, 4.95, 3.1, 4.8, 2.22, CARD);
  s.addShape(pres.shapes.RECTANGLE, { x: 4.95, y: 3.1, w: 4.8, h: 0.38, fill: { color: "1565C0" }, line: { type: "none" } });
  s.addText("GRACE Score (NSTEMI / ACS)", { x: 5.05, y: 3.12, w: 4.6, h: 0.3, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
  bullets(s, [
    "Includes: age, heart rate, SBP, creatinine, Killip class, ST changes, troponin, cardiac arrest",
    "Best predictor of in-hospital and 6-month mortality",
    "High risk (> 140): early invasive strategy within 24h",
    "Low risk (< 109): can consider early discharge or late intervention",
  ], 5.05, 3.53, 4.6, 1.72, { fontSize: 10.5 });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 16 – MANAGEMENT ALGORITHM
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "ED Management Algorithm — Chest Pain");

  const steps = [
    { step: "1", title: "Immediate Stabilisation", detail: "IV access × 2 | O₂ if SpO₂ < 94% | Cardiac monitoring | 12-lead ECG within 10 min", col: RED },
    { step: "2", title: "Is Patient Haemodynamically Unstable?", detail: "YES → Activate resuscitation: STEMI → cath lab | Tension PTX → needle decompression | Tamponade → pericardiocentesis | Massive PE → thrombolysis | Dissection → surgery", col: ACCENT },
    { step: "3", title: "Focused History & Examination", detail: "OPQRST | Red flags | Associated symptoms | Risk factors | Vital signs both arms | Auscultation | Peripheral exam", col: ORANGE },
    { step: "4", title: "Targeted Investigations", detail: "ECG → Troponin (0h/1h) → CXR → D-dimer (if PE suspected, low PTP) → CTPA / CT Aortogram (if high suspicion)", col: YELLOW },
    { step: "5", title: "Risk Stratification", detail: "HEART Score (ACS) | Wells Score (PE) | ADD Score (Dissection) | GRACE/TIMI (ACS risk) | Decide: Admit/Discharge/Refer", col: GREEN },
    { step: "6", title: "Diagnosis-Specific Treatment & Disposition", detail: "STEMI: PCI | NSTEMI/UA: Anticoagulate + risk-stratify | Dissection: Surgery/TEVAR | PE: Anticoagulate ± thrombolysis | PTX: Drain | Pericarditis: NSAIDs | Benign: discharge + follow-up", col: "1565C0" },
  ];

  steps.forEach((step, i) => {
    const y = 0.72 + i * 0.82;
    card(s, 0.25, y, 9.5, 0.76, i % 2 === 0 ? "0D2A4A" : "0A2238");
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.3, y: y + 0.1, w: 0.55, h: 0.55, fill: { color: step.col }, line: { type: "none" }, rectRadius: 0.06 });
    s.addText(step.step, { x: 0.3, y: y + 0.1, w: 0.55, h: 0.55, fontSize: 18, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri", margin: 0 });
    s.addText(step.title, { x: 1.0, y: y + 0.06, w: 3.2, h: 0.3, fontSize: 11, bold: true, color: YELLOW, fontFace: "Calibri", margin: 0 });
    s.addText(step.detail, { x: 1.0, y: y + 0.38, w: 8.6, h: 0.32, fontSize: 9.5, color: LGREY, fontFace: "Calibri", margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 17 – SPECIAL POPULATIONS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Special Populations & Pitfalls");

  const pops = [
    { title: "Women", color: ACCENT, items: ["Atypical presentations common: fatigue, nausea, dyspnoea, jaw pain WITHOUT classic chest pain", "Higher rate of MINOCA (MI with non-obstructive coronary arteries)", "Spontaneous coronary artery dissection (SCAD) — young women, no risk factors", "Lower index of suspicion leads to delayed diagnosis — maintain high vigilance"] },
    { title: "Elderly (> 65 yrs)", color: ORANGE, items: ["Atypical presentation in > 50%: silent MI, dyspnoea only, confusion, weakness", "Higher baseline troponin — interpret with serial measurements", "Multiple co-morbidities; polypharmacy may mask pain (beta-blockers, opioids)", "Higher pre-test probability for serious pathology"] },
    { title: "Diabetics", color: "8B008B", items: ["Autonomic neuropathy → painless MI (up to 40% silent)", "Present with fatigue, dyspnoea, nausea, vomiting", "Lower threshold for troponin and ECG monitoring", "More extensive CAD with multivessel disease"] },
    { title: "Young Adults (< 40 yrs)", color: "1565C0", items: ["Cocaine-induced vasospasm / ACS — ask specifically about drug use", "Spontaneous dissection, Prinzmetal angina", "Consider myocarditis (post-viral, typically male 20–40 yrs)", "WPW, long QT, Brugada in palpitations + chest pain"] },
  ];

  pops.forEach((p, i) => {
    const x = i < 2 ? 0.25 + i * 4.85 : 0.25 + (i - 2) * 4.85;
    const y = i < 2 ? 0.72 : 3.1;
    card(s, x, y, 4.65, 2.2, CARD);
    s.addShape(pres.shapes.RECTANGLE, { x, y, w: 4.65, h: 0.36, fill: { color: p.color }, line: { type: "none" } });
    s.addText(p.title, { x: x + 0.1, y: y + 0.03, w: 4.45, h: 0.3, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
    bullets(s, p.items, x + 0.15, y + 0.42, 4.35, 1.7, { fontSize: 10.5 });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 18 – DISPOSITION DECISION
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideHeader(s, "Disposition — Admit, Observe, or Discharge?");

  const disp = [
    {
      decision: "ADMIT",
      color: RED,
      items: ["STEMI / NSTEMI confirmed", "High-risk HEART Score (≥7)", "Haemodynamic instability", "Confirmed PE (submassive or massive)", "Aortic dissection", "Pericarditis with large effusion or troponin elevation", "Ongoing unexplained severe chest pain"],
    },
    {
      decision: "OBSERVE (6–12 h)",
      color: ORANGE,
      items: ["Intermediate HEART score (4–6)", "Single negative troponin — await 2nd sample", "Atypical features, multiple risk factors", "New ECG changes requiring serial monitoring", "Equivocal D-dimer / PE workup pending"],
    },
    {
      decision: "DISCHARGE",
      color: GREEN,
      items: ["Low HEART Score (0–3) + 2 negative troponins", "Low-risk PE (treated with DOAC, outpatient PESI low risk)", "Primary spontaneous pneumothorax (small, stable, aspiration successful)", "Confirmed musculoskeletal / GERD cause with pain controlled", "Arrange GP/cardiology follow-up within 72 hours"],
    },
  ];

  disp.forEach((d, i) => {
    const x = 0.22 + i * 3.22;
    card(s, x, 0.72, 3.12, 4.6, CARD);
    s.addShape(pres.shapes.RECTANGLE, { x, y: 0.72, w: 3.12, h: 0.46, fill: { color: d.color }, line: { type: "none" } });
    s.addText(d.decision, { x: x + 0.08, y: 0.74, w: 2.96, h: 0.4, fontSize: 14, bold: true, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
    bullets(s, d.items, x + 0.12, 1.24, 2.9, 3.9, { fontSize: 10.5 });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 19 – KEY TAKEAWAYS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.22, h: 5.625, fill: { color: ACCENT }, line: { type: "none" } });
  s.addText("KEY TAKEAWAYS", { x: 0.55, y: 0.25, w: 9.1, h: 0.55, fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri", charSpacing: 6 });
  accentBar(s, 0.82, 9.4);
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 0.82, w: 9.4, h: 0.04, fill: { color: YELLOW }, line: { type: "none" } });

  const takeaways = [
    ["🚨", "Pain intensity does NOT correlate with disease severity — never dismiss chest pain based on how mild it seems"],
    ["⏱️", "ECG within 10 minutes is non-negotiable — STEMI diagnosis changes everything, door-to-balloon < 90 min"],
    ["🔬", "High-sensitivity troponin 0h/1h algorithm has transformed ACS rule-out — use paired sampling"],
    ["🩸", "D-dimer is only useful in low-intermediate pre-test probability — do not use as a screening test in all chest pain"],
    ["🔪", "Sudden maximal onset tearing pain → aortic dissection until proven otherwise — do NOT give thrombolytics"],
    ["💨", "Tension pneumothorax is a CLINICAL diagnosis — treat immediately, do not wait for X-ray confirmation"],
    ["👩", "Women, elderly and diabetics frequently present atypically — maintain high index of suspicion"],
    ["📊", "Use risk scores (HEART, Wells, GRACE) to guide disposition — they outperform clinical gestalt alone"],
  ];

  takeaways.forEach((t, i) => {
    const y = 0.98 + i * 0.56;
    const col = i % 2 === 0 ? "0D2A4A" : "0A2238";
    card(s, 0.35, y, 9.3, 0.5, col);
    s.addText(t[0], { x: 0.42, y: y + 0.04, w: 0.5, h: 0.42, fontSize: 18, align: "center", fontFace: "Segoe UI Emoji", margin: 0 });
    s.addText(t[1], { x: 0.98, y: y + 0.07, w: 8.55, h: 0.38, fontSize: 11, color: LGREY, fontFace: "Calibri", valign: "middle", margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 20 – CLOSING
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);
  s.addShape(pres.shapes.RECTANGLE, { x: 6.5, y: 0, w: 3.5, h: 5.625, fill: { color: ACCENT }, line: { type: "none" } });
  s.addShape(pres.shapes.RECTANGLE, { x: 5.8, y: 0, w: 1.2, h: 5.625, fill: { color: "B03030" }, line: { type: "none" } });

  s.addText("QUESTIONS?", { x: 0.5, y: 1.2, w: 5.0, h: 1.0, fontSize: 46, bold: true, color: WHITE, fontFace: "Calibri" });
  s.addText("Approach to Chest Pain", { x: 0.5, y: 2.35, w: 5.0, h: 0.5, fontSize: 18, color: YELLOW, fontFace: "Calibri", italic: true });
  s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 2.95, w: 4.8, h: 0.04, fill: { color: YELLOW }, line: { type: "none" } });
  s.addText("Emergency Medicine Department", { x: 0.5, y: 3.1, w: 5.0, h: 0.4, fontSize: 14, color: LGREY, fontFace: "Calibri" });
  s.addText("Sources: Rosen's Emergency Medicine | Tintinalli's EM | Murray & Nadel's | Braunwald's Heart Disease | Symptom to Diagnosis", {
    x: 0.5, y: 4.8, w: 9.1, h: 0.4, fontSize: 8.5, color: "9E9E9E", fontFace: "Calibri", italic: true
  });

  s.addText("❤", { x: 7.2, y: 1.8, w: 2, h: 2, fontSize: 80, color: WHITE, align: "center", fontFace: "Segoe UI Emoji" });
}

// WRITE FILE
pres.writeFile({ fileName: "/home/daytona/workspace/chest-pain-ppt/Approach_to_Chest_Pain.pptx" })
  .then(() => console.log("Done: Approach_to_Chest_Pain.pptx"))
  .catch(e => { console.error(e); process.exit(1); });
Running Command

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

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.

Search for latest ACS guidelines and society recommendations

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.

Search PubMed for 2024–2025 ACS guidelines

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.
This is a shared conversation. Sign in to Orris to start your own chat.