help me generate a 20 slide ppt on duodenal ulcer

Reading File
Reading File
Reading File
Finding Sources
Now let me gather detailed medical content from the textbooks in parallel:
Reading File
Reading File
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Reading File
I now have comprehensive medical content. Let me also grab the relevant images and compile everything into the presentation:
Reading File
Reading File
I have enough content now. Let me create the 20-slide presentation:
Running Command

ls /home/daytona/workspace/ 2>/dev/null || echo "workspace empty"

Running Command

mkdir -p /home/daytona/workspace/duodenal-ulcer-ppt

Writing File

~/duodenal-ulcer-ppt/create_ppt.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Duodenal Ulcer";
pres.author = "Medical Education";

// ─── COLOR PALETTE ───────────────────────────────────────────
// Dark navy dominates; accent orange/amber; light cream text
const C = {
  navyDark:  "0D1B2A",   // background dark slides
  navyMid:   "1A2F4A",   // section header bg
  navyLight: "1E3A5F",   // content bg
  amber:     "E8A020",   // accent / headings
  coral:     "E05C3A",   // secondary accent (warnings/complications)
  cream:     "F5F0E8",   // body text
  white:     "FFFFFF",
  lightBlue: "A8C8E8",   // sub-bullets
  paleGreen: "A8D5B5",   // positive points
  paleRed:   "F0A898",   // negative / risks
  grayMid:   "6C8FAA",   // muted text
};

// ─── HELPERS ─────────────────────────────────────────────────
function addBg(slide, color) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: "100%",
    fill: { color },
    line: { color, width: 0 }
  });
}

function sideBar(slide, color) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 0.18, h: "100%",
    fill: { color },
    line: { color, width: 0 }
  });
}

function topBar(slide, color, h = 0.08) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h,
    fill: { color },
    line: { color, width: 0 }
  });
}

function slideNum(slide, n) {
  slide.addText(`${n} / 20`, {
    x: 9.2, y: 5.3, w: 0.7, h: 0.25,
    fontSize: 9, color: C.grayMid, align: "right"
  });
}

function sectionTag(slide, text) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0.28, y: 0.15, w: 2.2, h: 0.32,
    fill: { color: C.amber },
    line: { color: C.amber, width: 0 },
    rounding: true
  });
  slide.addText(text, {
    x: 0.28, y: 0.15, w: 2.2, h: 0.32,
    fontSize: 9, bold: true, color: C.navyDark, align: "center", valign: "middle", margin: 0
  });
}

function slideTitle(slide, text, y = 0.55, color = C.amber) {
  slide.addText(text, {
    x: 0.28, y, w: 9.4, h: 0.55,
    fontSize: 22, bold: true, color,
    fontFace: "Calibri"
  });
}

function divider(slide, y = 1.05, color = C.amber, w = 9.4) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0.28, y, w, h: 0.03,
    fill: { color },
    line: { color, width: 0 }
  });
}

function bullets(slide, items, opts = {}) {
  const defaults = { x: 0.38, y: 1.2, w: 9.2, h: 4.0, fontSize: 14, color: C.cream, fontFace: "Calibri" };
  const cfg = Object.assign({}, defaults, opts);
  const richText = items.map((item, i) => {
    const isLast = i === items.length - 1;
    if (typeof item === "string") {
      return { text: item, options: { bullet: { indent: 14 }, breakLine: !isLast, color: C.cream, fontSize: cfg.fontSize } };
    }
    // object: { text, sub, color, bold }
    const parts = [];
    parts.push({ text: item.text, options: { bullet: { indent: 14 }, breakLine: item.sub ? true : !isLast, color: item.color || C.cream, fontSize: cfg.fontSize, bold: item.bold || false } });
    if (item.sub) {
      item.sub.forEach((s, j) => {
        const subLast = j === item.sub.length - 1 && isLast;
        parts.push({ text: s, options: { bullet: { indent: 28 }, breakLine: !subLast, color: C.lightBlue, fontSize: cfg.fontSize - 1.5 } });
      });
    }
    return parts;
  });
  slide.addText(richText.flat(), { x: cfg.x, y: cfg.y, w: cfg.w, h: cfg.h, fontFace: cfg.fontFace, valign: "top" });
}

function twoCol(slide, leftItems, rightItems, opts = {}) {
  const y = opts.y || 1.2;
  const h = opts.h || 4.1;
  const fs = opts.fontSize || 13;
  // Left column
  const leftRich = leftItems.map((item, i) => {
    const isLast = i === leftItems.length - 1;
    if (typeof item === "string")
      return { text: item, options: { bullet: { indent: 14 }, breakLine: !isLast, color: C.cream, fontSize: fs } };
    const parts = [];
    parts.push({ text: item.text, options: { bullet: { indent: 14 }, breakLine: item.sub ? true : !isLast, color: item.color || C.cream, fontSize: fs, bold: item.bold || false } });
    if (item.sub) item.sub.forEach((s, j) => {
      parts.push({ text: s, options: { bullet: { indent: 28 }, breakLine: !(j === item.sub.length - 1 && isLast), color: C.lightBlue, fontSize: fs - 1.5 } });
    });
    return parts;
  });
  slide.addText(leftRich.flat(), { x: 0.38, y, w: 4.5, h, fontFace: "Calibri", valign: "top" });

  // Right column
  const rightRich = rightItems.map((item, i) => {
    const isLast = i === rightItems.length - 1;
    if (typeof item === "string")
      return { text: item, options: { bullet: { indent: 14 }, breakLine: !isLast, color: C.cream, fontSize: fs } };
    const parts = [];
    parts.push({ text: item.text, options: { bullet: { indent: 14 }, breakLine: item.sub ? true : !isLast, color: item.color || C.amber, fontSize: fs, bold: item.bold || false } });
    if (item.sub) item.sub.forEach((s, j) => {
      parts.push({ text: s, options: { bullet: { indent: 28 }, breakLine: !(j === item.sub.length - 1 && isLast), color: C.lightBlue, fontSize: fs - 1.5 } });
    });
    return parts;
  });
  slide.addText(rightRich.flat(), { x: 5.1, y, w: 4.7, h, fontFace: "Calibri", valign: "top" });

  // vertical divider
  slide.addShape(pres.ShapeType.rect, { x: 4.98, y: y - 0.05, w: 0.025, h, fill: { color: C.navyMid }, line: { color: C.navyMid, width: 0 } });
}

// ─── SLIDE 1: TITLE ──────────────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  // Large amber accent block left
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.55, h: "100%", fill: { color: C.amber }, line: { color: C.amber, width: 0 } });
  // Decorative circles
  s.addShape(pres.ShapeType.ellipse, { x: 7.5, y: -0.6, w: 3.5, h: 3.5, fill: { color: C.navyMid }, line: { color: C.navyMid, width: 0 } });
  s.addShape(pres.ShapeType.ellipse, { x: 8.2, y: 3.8, w: 2.2, h: 2.2, fill: { color: "0A1520" }, line: { color: "0A1520", width: 0 } });

  s.addText("DUODENAL ULCER", {
    x: 0.85, y: 1.4, w: 8.5, h: 1.1,
    fontSize: 40, bold: true, color: C.white,
    fontFace: "Calibri", charSpacing: 3
  });
  s.addText("Pathophysiology · Diagnosis · Management · Complications", {
    x: 0.85, y: 2.6, w: 8.5, h: 0.5,
    fontSize: 16, color: C.amber, fontFace: "Calibri", italic: true
  });
  s.addShape(pres.ShapeType.rect, { x: 0.85, y: 3.2, w: 5.5, h: 0.04, fill: { color: C.amber }, line: { color: C.amber, width: 0 } });
  s.addText("A Comprehensive Clinical Overview", {
    x: 0.85, y: 3.35, w: 8.5, h: 0.4,
    fontSize: 13, color: C.grayMid, fontFace: "Calibri"
  });
  s.addText("Sources: Schwartz's Principles of Surgery · Yamada's Gastroenterology · Current Surgical Therapy · Harrison's Internal Medicine", {
    x: 0.85, y: 4.9, w: 9.0, h: 0.35,
    fontSize: 9, color: C.grayMid, fontFace: "Calibri", italic: true
  });
}

// ─── SLIDE 2: OUTLINE ────────────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  slideNum(s, 2);

  s.addText("PRESENTATION OUTLINE", {
    x: 0.38, y: 0.2, w: 9.3, h: 0.5,
    fontSize: 22, bold: true, color: C.amber, fontFace: "Calibri", charSpacing: 2
  });
  divider(s, 0.72, C.amber);

  const topics = [
    ["01", "Definition & Overview"],
    ["02", "Epidemiology"],
    ["03", "Anatomy of the Duodenum"],
    ["04", "Etiology & Risk Factors"],
    ["05", "Pathophysiology"],
    ["06", "Role of H. pylori"],
    ["07", "NSAIDs & Acid Hypersecretion"],
    ["08", "Clinical Features"],
    ["09", "Diagnosis & Investigations"],
    ["10", "Differential Diagnosis"],
    ["11", "Medical Management"],
    ["12", "H. pylori Eradication Regimens"],
    ["13", "Surgical Indications"],
    ["14", "Complications - Perforation"],
    ["15", "Complications - Bleeding"],
    ["16", "Complications - Obstruction"],
    ["17", "Surgical Procedures"],
    ["18", "Prognosis & Recurrence"],
    ["19", "Prevention & Patient Education"],
    ["20", "Summary & Key Takeaways"],
  ];

  const col1 = topics.slice(0, 10);
  const col2 = topics.slice(10);

  col1.forEach((t, i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.38, y: 0.88 + i * 0.42, w: 0.38, h: 0.3, fill: { color: C.amber }, line: { color: C.amber, width: 0 } });
    s.addText(t[0], { x: 0.38, y: 0.88 + i * 0.42, w: 0.38, h: 0.3, fontSize: 9, bold: true, color: C.navyDark, align: "center", valign: "middle", margin: 0 });
    s.addText(t[1], { x: 0.82, y: 0.9 + i * 0.42, w: 4.1, h: 0.28, fontSize: 12, color: C.cream, fontFace: "Calibri" });
  });

  col2.forEach((t, i) => {
    s.addShape(pres.ShapeType.rect, { x: 5.2, y: 0.88 + i * 0.42, w: 0.38, h: 0.3, fill: { color: C.coral }, line: { color: C.coral, width: 0 } });
    s.addText(t[0], { x: 5.2, y: 0.88 + i * 0.42, w: 0.38, h: 0.3, fontSize: 9, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    s.addText(t[1], { x: 5.64, y: 0.9 + i * 0.42, w: 4.1, h: 0.28, fontSize: 12, color: C.cream, fontFace: "Calibri" });
  });
}

// ─── SLIDE 3: DEFINITION ─────────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "DEFINITION");
  slideTitle(s, "What is a Duodenal Ulcer?");
  divider(s);
  slideNum(s, 3);

  bullets(s, [
    { text: "Peptic ulcer disease (PUD) - a breach in the mucosal lining of the gastrointestinal tract extending through the muscularis mucosae", bold: true },
    { text: "Duodenal ulcer (DU) - ulceration located in the duodenum, most commonly in the duodenal bulb (first part)", color: C.amber },
    { text: "Lifetime cumulative prevalence ~10%, peaking around age 70 years", sub: ["Prevalence approx. 2% in the US at any given time", "Costs exceed $8 billion/year in the US"] },
    { text: "More common than gastric ulcer; duodenal ulcers account for 75-80% of all peptic ulcers" },
    { text: "Final common pathway: acid-peptic injury overwhelming the gastroduodenal mucosal barrier" },
    { text: "Historically viewed as a disease of acid hypersecretion; now understood as multifactorial - H. pylori + NSAIDs + mucosal defense failure" }
  ], { y: 1.15, fontSize: 13.5 });
}

// ─── SLIDE 4: EPIDEMIOLOGY ───────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "EPIDEMIOLOGY");
  slideTitle(s, "Epidemiology");
  divider(s);
  slideNum(s, 4);

  // Stat boxes
  const stats = [
    { val: "~10%", label: "Lifetime prevalence\n(general population)" },
    { val: "~2%", label: "Point prevalence\n(US adults)" },
    { val: "70 yrs", label: "Age of peak\nincidence" },
    { val: "3.7%", label: "Mortality in\nhospitalized DU patients" },
  ];
  stats.forEach((st, i) => {
    const x = 0.38 + i * 2.38;
    s.addShape(pres.ShapeType.rect, { x, y: 1.15, w: 2.15, h: 1.35, fill: { color: C.navyMid }, line: { color: C.amber, width: 1.5 }, rounding: true });
    s.addText(st.val, { x, y: 1.2, w: 2.15, h: 0.65, fontSize: 26, bold: true, color: C.amber, align: "center", fontFace: "Calibri" });
    s.addText(st.label, { x, y: 1.82, w: 2.15, h: 0.6, fontSize: 10, color: C.cream, align: "center", fontFace: "Calibri" });
  });

  bullets(s, [
    { text: "Incidence declining since 1970s due to H. pylori eradication and better acid suppression", color: C.paleGreen },
    { text: "Emergency surgery rates remain high despite medical advances", color: C.paleRed },
    "Hospital admissions declining: age-adjusted rate 56.5/100,000 (down 21% over prior decade)",
    "Rising rates of bleeding and perforation in elderly - driven by NSAIDs/aspirin in aging populations",
    "Male predominance (DU more common in men; gastric ulcer has narrowing sex gap)",
    "H. pylori found in up to 90% of duodenal ulcer patients"
  ], { y: 2.65, fontSize: 13 });
}

// ─── SLIDE 5: ANATOMY ────────────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "ANATOMY");
  slideTitle(s, "Anatomy of the Duodenum");
  divider(s);
  slideNum(s, 5);

  // Left column - parts of duodenum
  s.addText("Parts of the Duodenum", { x: 0.38, y: 1.12, w: 4.5, h: 0.35, fontSize: 14, bold: true, color: C.amber, fontFace: "Calibri" });

  const parts = [
    { part: "D1 (Bulb)", detail: "Site of 95% of DUs; mobile; antrum of Py to upper border of Hd pancreas", color: C.coral },
    { part: "D2 (Descending)", detail: "Fixed; contains ampulla of Vater (hepatopancreatic ampulla); CBD & pancreatic duct open here", color: C.cream },
    { part: "D3 (Horizontal)", detail: "Crosses L3 vertebra; inferior mesenteric vessels cross anteriorly", color: C.cream },
    { part: "D4 (Ascending)", detail: "Rises to duodenojejunal flexure (ligament of Treitz) at L2", color: C.cream },
  ];

  parts.forEach((p, i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.38, y: 1.55 + i * 0.82, w: 0.9, h: 0.6, fill: { color: i === 0 ? C.coral : C.navyMid }, line: { color: i === 0 ? C.coral : C.amber, width: 1 } });
    s.addText(p.part, { x: 0.38, y: 1.55 + i * 0.82, w: 0.9, h: 0.6, fontSize: 10, bold: true, color: C.white, align: "center", valign: "middle", margin: 0, fontFace: "Calibri" });
    s.addText(p.detail, { x: 1.35, y: 1.58 + i * 0.82, w: 3.5, h: 0.56, fontSize: 11, color: p.color, fontFace: "Calibri", valign: "middle" });
  });

  // Right column - clinical relevance
  s.addText("Clinical Relevance", { x: 5.1, y: 1.12, w: 4.7, h: 0.35, fontSize: 14, bold: true, color: C.amber, fontFace: "Calibri" });
  s.addShape(pres.ShapeType.rect, { x: 4.98, y: 1.1, w: 0.025, h: 4.3, fill: { color: C.navyMid }, line: { color: C.navyMid, width: 0 } });

  const rightItems = [
    "Blood supply: gastroduodenal artery (GDA) - erosion causes massive haemorrhage",
    "Posterior DU erodes GDA, causing life-threatening bleed",
    "Anterior DU more likely to perforate (free peritoneal cavity)",
    "Duodenum secretes bicarbonate to buffer gastric acid",
    "Brunner's glands (in submucosa of D1) produce mucus and bicarbonate - protective",
    "C-shaped duodenum embraces head of pancreas - surgical landmark",
    "Vagus nerve innervates parietal cells; vagotomy reduces acid secretion"
  ];
  const rightRich = rightItems.map((item, i) => ({
    text: item,
    options: { bullet: { indent: 14 }, breakLine: i < rightItems.length - 1, color: C.cream, fontSize: 12 }
  }));
  s.addText(rightRich, { x: 5.1, y: 1.55, w: 4.65, h: 4.0, fontFace: "Calibri", valign: "top" });
}

// ─── SLIDE 6: ETIOLOGY ───────────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "ETIOLOGY");
  slideTitle(s, "Etiology & Risk Factors");
  divider(s);
  slideNum(s, 6);

  // Three category boxes
  const cats = [
    {
      title: "PRIMARY CAUSES",
      color: C.coral,
      items: ["H. pylori infection (70-90% of DUs)", "NSAID / aspirin use", "Idiopathic (H. pylori-negative, NSAID-negative)"]
    },
    {
      title: "ACID HYPERSECRETORY STATES",
      color: C.amber,
      items: ["Zollinger-Ellison syndrome (gastrinoma)", "Antral G-cell hyperplasia/hyperfunction", "Systemic mastocytosis", "Multiple endocrine neoplasia type 1 (MEN-1)"]
    },
    {
      title: "MODIFYING RISK FACTORS",
      color: C.lightBlue,
      items: ["Smoking (doubles risk; impairs healing)", "Psychological stress", "Steroids (especially with NSAIDs)", "Cocaine use", "Severe physiologic stress (Curling's ulcer - burns)"]
    }
  ];

  cats.forEach((cat, i) => {
    const x = 0.38 + i * 3.15;
    s.addShape(pres.ShapeType.rect, { x, y: 1.12, w: 3.0, h: 0.38, fill: { color: cat.color }, line: { color: cat.color, width: 0 } });
    s.addText(cat.title, { x, y: 1.12, w: 3.0, h: 0.38, fontSize: 10, bold: true, color: C.navyDark, align: "center", valign: "middle", margin: 0, fontFace: "Calibri" });
    const rich = cat.items.map((item, j) => ({
      text: item,
      options: { bullet: { indent: 12 }, breakLine: j < cat.items.length - 1, color: C.cream, fontSize: 12 }
    }));
    s.addShape(pres.ShapeType.rect, { x, y: 1.5, w: 3.0, h: 3.0, fill: { color: C.navyMid }, line: { color: cat.color, width: 1 } });
    s.addText(rich, { x: x + 0.05, y: 1.6, w: 2.9, h: 2.8, fontFace: "Calibri", valign: "top" });
  });

  bullets(s, [
    { text: "90%+ of serious PUD complications in the US attributable to H. pylori, NSAIDs, and/or cigarette smoking combined", color: C.amber, bold: true },
  ], { y: 4.65, fontSize: 13 });
}

// ─── SLIDE 7: PATHOPHYSIOLOGY ────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "PATHOPHYSIOLOGY");
  slideTitle(s, "Pathophysiology");
  divider(s);
  slideNum(s, 7);

  // Balance concept
  s.addShape(pres.ShapeType.rect, { x: 0.38, y: 1.12, w: 4.1, h: 0.36, fill: { color: C.coral }, line: { color: C.coral, width: 0 } });
  s.addText("AGGRESSIVE FACTORS (Increased)", { x: 0.38, y: 1.12, w: 4.1, h: 0.36, fontSize: 11, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });

  s.addShape(pres.ShapeType.rect, { x: 5.52, y: 1.12, w: 4.2, h: 0.36, fill: { color: C.paleGreen.slice(0, 6) === "A8D5B5" ? "2E6B4A" : "2E6B4A" }, line: { color: "2E6B4A", width: 0 } });
  s.addText("DEFENSIVE FACTORS (Decreased)", { x: 5.52, y: 1.12, w: 4.2, h: 0.36, fontSize: 11, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });

  // vs symbol
  s.addShape(pres.ShapeType.ellipse, { x: 4.6, y: 1.12, w: 0.8, h: 0.8, fill: { color: C.amber }, line: { color: C.amber, width: 0 } });
  s.addText("VS", { x: 4.6, y: 1.12, w: 0.8, h: 0.8, fontSize: 14, bold: true, color: C.navyDark, align: "center", valign: "middle", margin: 0 });

  const aggr = [
    "Excess gastric acid production",
    "Elevated basal acid output (BAO) & maximal acid output (MAO)",
    "Increased parietal cell mass sensitivity to gastrin",
    "Accelerated gastric emptying (increased duodenal acid load)",
    "H. pylori-induced hypergastrinaemia",
    "NSAID-induced prostaglandin suppression",
    "Pepsin activity"
  ];
  const def = [
    "Reduced duodenal bicarbonate secretion",
    "Impaired mucus-bicarbonate barrier",
    "Decreased prostaglandin synthesis (NSAIDs)",
    "Reduced blood flow to mucosa",
    "Disrupted tight junctions (H. pylori VacA toxin)",
    "Impaired restitution and cell renewal"
  ];

  const aRich = aggr.map((t, i) => ({ text: t, options: { bullet: { indent: 12 }, breakLine: i < aggr.length - 1, color: C.cream, fontSize: 12 } }));
  s.addText(aRich, { x: 0.38, y: 1.55, w: 4.1, h: 3.6, fontFace: "Calibri", valign: "top" });

  const dRich = def.map((t, i) => ({ text: t, options: { bullet: { indent: 12 }, breakLine: i < def.length - 1, color: C.cream, fontSize: 12 } }));
  s.addText(dRich, { x: 5.52, y: 1.55, w: 4.2, h: 3.6, fontFace: "Calibri", valign: "top" });

  s.addText("Net result: acid-peptic injury overwhelms the duodenal mucosal barrier → ulceration", {
    x: 0.38, y: 5.1, w: 9.4, h: 0.35,
    fontSize: 12.5, bold: true, color: C.amber, fontFace: "Calibri", italic: true
  });
}

// ─── SLIDE 8: H. PYLORI ──────────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "H. PYLORI");
  slideTitle(s, "Role of Helicobacter pylori");
  divider(s);
  slideNum(s, 8);

  twoCol(s,
    [
      { text: "Prevalence", bold: true, color: C.amber, sub: ["Present in 70-90% of DU patients", "Global prevalence: ~50% of world population infected"] },
      { text: "Mechanism of ulceration", bold: true, color: C.amber, sub: ["Colonises antral mucosa → releases urease, VacA toxin, CagA protein", "Increases gastrin release → acid hypersecretion", "Disrupts mucus-bicarbonate barrier (VacA)", "Induces mucosal inflammation (IL-8, TNF-alpha)"] },
      { text: "Acid secretion changes", bold: true, color: C.amber, sub: ["Decreased somatostatin → disinhibited gastrin release", "DU patients: 2/3 reduction in gastric acid after H. pylori eradication"] },
    ],
    [
      { text: "Why eradication matters", bold: true, color: C.coral, sub: ["Eradication reduces DU recurrence from ~80% to <5% at 1 year", "Ranitidine alone: 80-90% recurrence; Ranitidine + antibiotics: <5%"] },
      { text: "Diagnostic tests", bold: true, color: C.coral, sub: ["Non-invasive: urea breath test (UBT), stool antigen test", "Invasive (EGD-based): rapid urease test, histology, culture, RT-PCR", "All positive patients should be treated"] },
      { text: "Eradication confirmation", bold: true, color: C.coral, sub: ["Test for cure at least 4 weeks after completing treatment", "UBT or stool antigen (not serology)", "Endoscopic biopsy if ulcer follow-up required"] },
    ],
    { y: 1.18, h: 4.2 }
  );
}

// ─── SLIDE 9: NSAIDs & ACID ──────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "ETIOLOGY");
  slideTitle(s, "NSAIDs & Acid Hypersecretion");
  divider(s);
  slideNum(s, 9);

  twoCol(s,
    [
      { text: "NSAIDs - Mechanism", bold: true, color: C.amber, sub: ["Inhibit COX-1 → decreased prostaglandin (PGE2) synthesis", "Prostaglandins are key defenders: stimulate mucus, bicarbonate, blood flow", "Direct mucosal irritation (topical effect)", "Increases risk of PUD ~5-fold; UGI bleeding risk at least 2-fold"] },
      { text: "High-risk NSAID groups", bold: true, color: C.amber, sub: ["Elderly (>65 years)", "Prior history of PUD", "Concurrent corticosteroid use", "High NSAID dose or multiple NSAIDs", "Concomitant anticoagulant/antiplatelet therapy"] },
      { text: "PPI prophylaxis mandatory for high-risk NSAID users", bold: true, color: C.coral },
    ],
    [
      { text: "Acid Hypersecretion - DU profile", bold: true, color: C.amber, sub: ["Higher mean BAO & MAO vs normal controls", "Increased sensitivity of parietal cell mass to gastrin", "Accelerated gastric emptying → increased duodenal acid load", "Reduced duodenal bicarbonate buffering capacity"] },
      { text: "Zollinger-Ellison Syndrome (ZES)", bold: true, color: C.coral, sub: ["Gastrinoma in pancreas/duodenum → extreme acid hypersecretion", "Multiple, atypical, refractory ulcers", "Diarrhoea, malabsorption common", "Fasting gastrin >1000 pg/mL diagnostic; secretin stimulation test"] },
      { text: "Other acid hypersecretory causes", bold: true, color: C.amber, sub: ["Antral G-cell hyperplasia, mastocytosis, short bowel syndrome"] },
    ],
    { y: 1.18, h: 4.3 }
  );
}

// ─── SLIDE 10: CLINICAL FEATURES ─────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "CLINICAL FEATURES");
  slideTitle(s, "Clinical Features");
  divider(s);
  slideNum(s, 10);

  twoCol(s,
    [
      { text: "Classic Symptoms", bold: true, color: C.amber, sub: ["Epigastric pain/burning (61-86% of DU patients)", "Pain relieved by food and antacids (classically)", "Hunger pain, night pain (waking patient 1-3 AM)", "Pain typically 2-3 hours after meals (postprandial delay)", "Nausea, vomiting, belching"] },
      { text: "The 'Pointing Sign'", bold: true, color: C.amber, sub: ["Patient points to discrete epigastric site", "Moderately predictive of DU; LR+ 2.2", "Physical exam otherwise rarely diagnostic"] },
      { text: "IMPORTANT: Symptoms are unreliable", bold: true, color: C.coral, sub: ["Cannot reliably diagnose DU from history alone", "Cannot distinguish DU from gastric ulcer or functional dyspepsia on symptoms", "Prevalence of dyspeptic symptoms similar in patients with and without ulcers"] },
    ],
    [
      { text: "Symptom Comparison", bold: true, color: C.amber, sub: ["Pain within 30 min of food: DU 5% vs GU 20%", "Increased by food: DU 40% vs GU 20%", "Relieved by food: DU 60% vs GU 20%", "Night pain: more common in DU than GU"] },
      { text: "Alarm Features (Red Flags)", bold: true, color: C.coral, sub: ["Unintentional weight loss", "Haematemesis or melaena", "Dysphagia / odynophagia", "Persistent vomiting", "Iron deficiency anaemia", "Palpable epigastric mass", "Age >55 with new-onset dyspepsia"] },
      { text: "Asymptomatic DU", bold: true, color: C.amber, sub: ["Up to 40% of NSAID-induced ulcers are silent", "May present first with a complication (bleed, perforation)"] },
    ],
    { y: 1.18, h: 4.3 }
  );
}

// ─── SLIDE 11: DIAGNOSIS ─────────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "DIAGNOSIS");
  slideTitle(s, "Diagnosis & Investigations");
  divider(s);
  slideNum(s, 11);

  // Investigation cards
  const invx = [
    { title: "OGD / EGD", color: C.amber, detail: "Gold standard. Confirms ulcer site, size, depth. Biopsy gastric mucosa for H. pylori (duodenal biopsy not needed). Rules out malignancy." },
    { title: "H. pylori Tests", color: C.coral, detail: "UBT (urea breath), stool antigen (non-invasive). Rapid urease test, histology, culture (invasive). All positive = treat." },
    { title: "Barium Studies", color: C.lightBlue, detail: "Double-contrast barium meal: 'niche sign' or crater. Now largely replaced by EGD. Used if EGD unavailable/contraindicated." },
    { title: "Lab Tests", color: C.paleGreen, detail: "FBC (anaemia), serum gastrin (if ZES suspected). LFTs, coagulation if bleeding. Urea: elevated in upper GI bleed." },
  ];

  invx.forEach((inv, i) => {
    const x = 0.38 + (i % 2) * 4.75;
    const y = 1.1 + Math.floor(i / 2) * 2.0;
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.55, h: 1.85, fill: { color: C.navyMid }, line: { color: inv.color, width: 1.5 } });
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.55, h: 0.38, fill: { color: inv.color }, line: { color: inv.color, width: 0 } });
    s.addText(inv.title, { x, y, w: 4.55, h: 0.38, fontSize: 13, bold: true, color: C.navyDark, align: "center", valign: "middle", margin: 0, fontFace: "Calibri" });
    s.addText(inv.detail, { x: x + 0.1, y: y + 0.42, w: 4.35, h: 1.35, fontSize: 11.5, color: C.cream, fontFace: "Calibri", valign: "top" });
  });

  bullets(s, [
    { text: "Test-and-treat strategy: for uncomplicated dyspepsia <55y without alarm features - test for H. pylori non-invasively and treat if positive (no EGD required initially)", color: C.amber, bold: true }
  ], { y: 5.1, fontSize: 12.5 });
}

// ─── SLIDE 12: DIFFERENTIAL DIAGNOSIS ───────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "DIFFERENTIAL");
  slideTitle(s, "Differential Diagnosis");
  divider(s);
  slideNum(s, 12);

  const diffs = [
    { dx: "Functional Dyspepsia", clue: "Most common cause of dyspepsia (60-75%). No ulcer on endoscopy. Rome IV criteria.", color: C.cream },
    { dx: "Gastric Ulcer", clue: "Pain worsened by food. Must biopsy to exclude malignancy. Helicobacter-linked but different acid profile.", color: C.cream },
    { dx: "GERD", clue: "Burning in chest/throat. Worse with lying, acid reflux. No ulcer crater unless severe oesophagitis.", color: C.cream },
    { dx: "Acute Pancreatitis", clue: "Elevated amylase/lipase. Epigastric pain radiating to back. Alcohol/gallstone history.", color: C.paleRed },
    { dx: "Biliary Colic / Cholecystitis", clue: "RUQ pain, fatty food intolerance. Murphy's sign. Ultrasound shows gallstones.", color: C.paleRed },
    { dx: "Zollinger-Ellison Syndrome", clue: "Multiple / refractory ulcers. Diarrhoea. Fasting gastrin >1000 pg/mL. Secretin test.", color: C.amber },
    { dx: "Gastric Malignancy", clue: "Weight loss, anorexia, alarm features. Age >55. Always biopsy gastric ulcer.", color: C.coral },
    { dx: "Mesenteric Ischaemia", clue: "Pain out of proportion, post-prandial, elderly with AF/atherosclerosis.", color: C.paleRed },
  ];

  diffs.forEach((d, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.38 : 5.15;
    const y = 1.1 + row * 1.05;
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.6, h: 0.95, fill: { color: C.navyMid }, line: { color: d.color, width: 1 }, rounding: true });
    s.addText(d.dx, { x: x + 0.1, y: y + 0.04, w: 4.4, h: 0.32, fontSize: 12, bold: true, color: d.color, fontFace: "Calibri" });
    s.addText(d.clue, { x: x + 0.1, y: y + 0.34, w: 4.4, h: 0.58, fontSize: 10.5, color: C.cream, fontFace: "Calibri", valign: "top" });
  });
}

// ─── SLIDE 13: MEDICAL MANAGEMENT ───────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "MANAGEMENT");
  slideTitle(s, "Medical Management");
  divider(s);
  slideNum(s, 13);

  twoCol(s,
    [
      { text: "Proton Pump Inhibitors (PPIs)", bold: true, color: C.amber, sub: ["First-line acid suppression (omeprazole, lansoprazole, pantoprazole, esomeprazole)", "Standard course: 4-8 weeks", "Heal up to 95% of DUs when compliant", "Long-term: only if recurrent ulcers, cannot ensure H. pylori eradication, or ongoing NSAID/aspirin use"] },
      { text: "H2 Receptor Antagonists", bold: true, color: C.amber, sub: ["Ranitidine, famotidine (secondary role)", "Less effective than PPIs", "Useful in mild cases or cost-constrained settings"] },
      { text: "Antacids", bold: true, color: C.amber, sub: ["Symptom relief only; no role in definitive healing", "Sodium bicarbonate, aluminium hydroxide, magnesium hydroxide"] },
    ],
    [
      { text: "Adjunctive Measures", bold: true, color: C.coral, sub: ["Stop NSAIDs if possible", "Smoking cessation (slows healing, increases recurrence)", "Alcohol moderation", "Stress reduction"] },
      { text: "Cytoprotective Agents", bold: true, color: C.coral, sub: ["Sucralfate: forms protective coating; useful adjunct", "Misoprostol (PGE1 analogue): prophylaxis for NSAID ulcers; poorly tolerated (diarrhoea)", "Bismuth: adjunct in H. pylori regimens"] },
      { text: "Aspirin & Cardiovascular Prophylaxis", bold: true, color: C.coral, sub: ["Daily aspirin permissible if daily PPI co-prescribed", "Do NOT stop aspirin abruptly in high cardiovascular risk patients"] },
    ],
    { y: 1.18, h: 4.3 }
  );
}

// ─── SLIDE 14: H. PYLORI ERADICATION ────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "H. PYLORI TREATMENT");
  slideTitle(s, "H. pylori Eradication Regimens");
  divider(s);
  slideNum(s, 14);

  const regimens = [
    {
      name: "Triple Therapy (Clarithromycin-based)", duration: "10-14 days",
      drugs: "PPI (BD) + Clarithromycin (500mg BD) + Amoxicillin (1g BD) or Metronidazole (400mg BD)",
      note: "1st-line where clarithromycin resistance <15%", color: C.amber
    },
    {
      name: "Bismuth Quadruple Therapy", duration: "10-14 days",
      drugs: "PPI (BD) + Bismuth (4x/day) + Tetracycline (500mg QDS) + Nitroimidazole (Metronidazole/Tinidazole)",
      note: "Preferred where clarithromycin resistance high; salvage therapy", color: C.coral
    },
    {
      name: "Sequential Therapy", duration: "10-14 days",
      drugs: "Days 1-7: PPI + Amoxicillin → Days 8-14: PPI + Clarithromycin + Nitroimidazole",
      note: "Overcomes amoxicillin-clarithromycin cross-resistance", color: C.lightBlue
    },
    {
      name: "Hybrid Therapy", duration: "14 days",
      drugs: "Days 1-7: PPI + Amoxicillin → Days 8-14: PPI + Amoxicillin + Clarithromycin + Nitroimidazole",
      note: "High eradication rates; best for areas with dual resistance", color: C.paleGreen
    },
  ];

  regimens.forEach((r, i) => {
    const y = 1.1 + i * 1.08;
    s.addShape(pres.ShapeType.rect, { x: 0.38, y, w: 9.35, h: 1.0, fill: { color: C.navyMid }, line: { color: r.color, width: 1.5 }, rounding: true });
    s.addShape(pres.ShapeType.rect, { x: 0.38, y, w: 0.18, h: 1.0, fill: { color: r.color }, line: { color: r.color, width: 0 } });
    s.addText(r.name, { x: 0.65, y: y + 0.03, w: 6.2, h: 0.3, fontSize: 12, bold: true, color: r.color, fontFace: "Calibri" });
    s.addText(r.duration, { x: 8.3, y: y + 0.03, w: 1.35, h: 0.3, fontSize: 11, color: C.amber, fontFace: "Calibri", align: "right" });
    s.addText(r.drugs, { x: 0.65, y: y + 0.32, w: 7.5, h: 0.32, fontSize: 10.5, color: C.cream, fontFace: "Calibri" });
    s.addText(r.note, { x: 0.65, y: y + 0.62, w: 8.6, h: 0.28, fontSize: 10, color: C.grayMid, fontFace: "Calibri", italic: true });
  });

  s.addText("Confirm eradication with UBT or stool antigen ≥4 weeks post-treatment (avoid PPIs 2 weeks before testing)", {
    x: 0.38, y: 5.4, w: 9.35, h: 0.3,
    fontSize: 11, bold: true, color: C.amber, fontFace: "Calibri", italic: true
  });
}

// ─── SLIDE 15: SURGICAL INDICATIONS ─────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "SURGERY");
  slideTitle(s, "Surgical Indications");
  divider(s);
  slideNum(s, 15);

  s.addText("Indications for Surgery (in decreasing frequency)", {
    x: 0.38, y: 1.12, w: 9.3, h: 0.35,
    fontSize: 14, bold: true, color: C.amber, fontFace: "Calibri"
  });

  const indications = [
    { rank: "1st", label: "Upper GI Bleeding", detail: "Failed endoscopic haemostasis x2; haemodynamic instability; posterior ulcer eroding GDA", color: C.coral },
    { rank: "2nd", label: "Perforation", detail: "Acute abdomen; pneumoperitoneum; peritonitis; surgery within hours reduces mortality", color: C.coral },
    { rank: "3rd", label: "Obstruction (Gastric Outlet)", detail: "Pyloric stenosis from chronic scarring; persistent vomiting; balloon dilatation first-line if suitable", color: C.amber },
    { rank: "4th", label: "Intractability", detail: "Failure to heal after 3 months of maximal medical therapy; now rare with PPIs", color: C.lightBlue },
  ];

  indications.forEach((ind, i) => {
    const y = 1.55 + i * 0.92;
    s.addShape(pres.ShapeType.rect, { x: 0.38, y, w: 0.7, h: 0.72, fill: { color: ind.color }, line: { color: ind.color, width: 0 } });
    s.addText(ind.rank, { x: 0.38, y, w: 0.7, h: 0.72, fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle", margin: 0, fontFace: "Calibri" });
    s.addShape(pres.ShapeType.rect, { x: 1.15, y, w: 8.55, h: 0.72, fill: { color: C.navyMid }, line: { color: ind.color, width: 0 } });
    s.addText(ind.label, { x: 1.25, y: y + 0.04, w: 3.5, h: 0.3, fontSize: 13, bold: true, color: ind.color, fontFace: "Calibri" });
    s.addText(ind.detail, { x: 1.25, y: y + 0.35, w: 8.35, h: 0.32, fontSize: 11, color: C.cream, fontFace: "Calibri" });
  });

  s.addText("Medical therapy (PPIs + H. pylori eradication) has greatly reduced elective ulcer surgery. Emergency surgery is now the dominant surgical scenario.", {
    x: 0.38, y: 5.3, w: 9.35, h: 0.35,
    fontSize: 11, bold: false, color: C.grayMid, fontFace: "Calibri", italic: true
  });
}

// ─── SLIDE 16: PERFORATION ───────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.coral);
  sectionTag(s, "COMPLICATIONS");
  slideTitle(s, "Complication: Perforation", 0.55, C.coral);
  divider(s, 1.05, C.coral);
  slideNum(s, 16);

  twoCol(s,
    [
      { text: "Presentation", bold: true, color: C.coral, sub: ["Sudden-onset severe epigastric pain (patient can pinpoint onset)", "Board-like rigid abdomen, generalised peritonitis", "Tachycardia (early), hypotension (late)", "Fever and tachypnoea follow", "May or may not have prior ulcer history"] },
      { text: "Investigations", bold: true, color: C.amber, sub: ["Erect CXR: pneumoperitoneum (absent in 10-15%)", "CT abdomen (nearly always shows extraluminal air and free fluid)", "Leukocytosis; raised CRP", "'Kissing ulcers' (anterior + posterior): consider EGD intraoperatively"] },
    ],
    [
      { text: "Management", bold: true, color: C.coral, sub: ["IV fluid resuscitation + IV antibiotics URGENTLY", "NGT, urinary catheter", "Prompt surgery - delay increases mortality (up to 30% in modern series)", "Laparotomy or laparoscopy + thorough peritoneal washout (5-10 L)", "Omental patch closure (Graham patch) - most common repair", "Post-op: chronic PPI + empiric H. pylori eradication", "Advise avoid NSAIDs, aspirin, smoking"] },
      { text: "Prognosis", bold: true, color: C.amber, sub: ["Mortality up to 30% in some series", "Abdominal reintervention needed in ~25%", "Frailty, delayed presentation, sepsis worsen outcomes"] },
    ],
    { y: 1.18, h: 4.25 }
  );
}

// ─── SLIDE 17: BLEEDING ──────────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.coral);
  sectionTag(s, "COMPLICATIONS");
  slideTitle(s, "Complication: Upper GI Bleeding", 0.55, C.coral);
  divider(s, 1.05, C.coral);
  slideNum(s, 17);

  // Risk score boxes
  s.addText("Risk Stratification Scores", { x: 0.38, y: 1.12, w: 9.3, h: 0.32, fontSize: 14, bold: true, color: C.amber, fontFace: "Calibri" });

  const scores = [
    { name: "Glasgow-Blatchford Score", max: "Max 23", items: "BUN, Hgb, SBP, HR, melaena, syncope, hepatic disease, cardiac failure. Score 0 = can discharge.", color: C.amber },
    { name: "Rockall Score", max: "Max 11", items: "Age, shock, comorbidities + endoscopic findings (stigmata). Score ≤2 = low risk.", color: C.coral },
  ];
  scores.forEach((sc, i) => {
    const x = 0.38 + i * 4.75;
    s.addShape(pres.ShapeType.rect, { x, y: 1.48, w: 4.55, h: 1.45, fill: { color: C.navyMid }, line: { color: sc.color, width: 1.5 }, rounding: true });
    s.addText(sc.name, { x: x + 0.1, y: 1.52, w: 3.5, h: 0.3, fontSize: 12, bold: true, color: sc.color, fontFace: "Calibri" });
    s.addText(sc.max, { x: x + 3.7, y: 1.52, w: 0.8, h: 0.3, fontSize: 11, color: C.amber, fontFace: "Calibri", align: "right" });
    s.addText(sc.items, { x: x + 0.1, y: 1.82, w: 4.35, h: 1.05, fontSize: 11, color: C.cream, fontFace: "Calibri", valign: "top" });
  });

  bullets(s, [
    { text: "75% of DU bleeds stop spontaneously with IV fluids + IV PPIs (conservative management)", color: C.paleGreen, bold: true },
    { text: "25% continue or rebleed - essentially all deaths occur in this group", color: C.paleRed, bold: true },
    { text: "High-risk features: hematemesis, hypotension, >4 units transfusion, visible vessel / active bleeding on OGD" },
    { text: "Endoscopic haemostasis: epinephrine injection + electrocautery/APC + clips (haemoclips for visible vessels)" },
    { text: "Failed endoscopy x2: consider angiographic embolisation or surgery (oversewing of ulcer; posterior DU may need GDA ligation)" },
    { text: "Posterior DU bleeds erode GDA - deep, high-risk lesions; early surgery consideration warranted" }
  ], { y: 2.98, fontSize: 12.5 });
}

// ─── SLIDE 18: OBSTRUCTION ───────────────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.coral);
  sectionTag(s, "COMPLICATIONS");
  slideTitle(s, "Complication: Gastric Outlet Obstruction", 0.55, C.coral);
  divider(s, 1.05, C.coral);
  slideNum(s, 18);

  twoCol(s,
    [
      { text: "Causes", bold: true, color: C.amber, sub: ["Chronic scarring and fibrosis of pylorus/duodenal bulb", "Acute oedema and spasm during active ulceration", "Rarely: carcinoma of pylorus / proximal duodenum (must be excluded)"] },
      { text: "Clinical Features", bold: true, color: C.amber, sub: ["Persistent vomiting (large volume, foul-smelling, undigested food)", "Succussion splash", "Weight loss, dehydration", "Hypokalaemic, hypochloraemic metabolic alkalosis", "Visible gastric peristalsis"] },
      { text: "Investigations", bold: true, color: C.amber, sub: ["EGD: confirms stenosis, biopsies to exclude malignancy", "Barium meal: 'bird beak' appearance", "CT: degree of obstruction, rules out cancer", "Electrolytes (classic: low K+, low Cl-, high HCO3-, low Na+)"] },
    ],
    [
      { text: "Conservative / Endoscopic", bold: true, color: C.coral, sub: ["Nasogastric tube decompression", "IV fluids + electrolyte correction", "IV PPI + H. pylori eradication", "Endoscopic balloon dilatation: first-line for fibrotic stenosis", "Success 70-80%; restenosis common requiring repeat dilatation"] },
      { text: "Surgical Management", bold: true, color: C.coral, sub: ["Vagotomy + Antrectomy (V/A): gold standard - lowest recurrence", "Vagotomy + Gastrojejunostomy (V/GJ): simpler, laparoscopic-friendly", "Avoid gastrectomy in malnourished/thin patients", "Exclude malignancy intraoperatively (especially pyloric channel/proximal D2 cancer)"] },
    ],
    { y: 1.18, h: 4.3 }
  );
}

// ─── SLIDE 19: SURGICAL PROCEDURES ──────────────────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  sideBar(s, C.amber);
  sectionTag(s, "SURGERY");
  slideTitle(s, "Surgical Procedures");
  divider(s);
  slideNum(s, 19);

  const procs = [
    {
      name: "Omental Patch (Graham Patch)",
      use: "Perforated DU",
      detail: "Omentum placed over perforation; secured with interrupted Lembert sutures. Test seal with air/methylene blue via NGT. Most common repair.",
      color: C.amber
    },
    {
      name: "Oversewing of Bleeding Vessel",
      use: "Bleeding DU",
      detail: "Duodenotomy; U-sutures proximal and distal to vessel + transfix the vessel (figure-of-8). GDA ligation if posterior ulcer. Highly selective vagotomy may be added.",
      color: C.coral
    },
    {
      name: "Vagotomy + Antrectomy (V/A)",
      use: "Obstruction / Intractability",
      detail: "Gold standard for elective DU surgery. Truncal vagotomy + distal gastrectomy. Reconstruction: Billroth II (gastrojejunostomy) preferred. Lowest ulcer recurrence rate. Mortality 2%.",
      color: C.lightBlue
    },
    {
      name: "Vagotomy + Drainage (V/D)",
      use: "Perforation + Definitive",
      detail: "Truncal or posterior truncal vagotomy + pyloroplasty or gastrojejunostomy (drainage). Simpler, applicable laparoscopically. Modified Taylor procedure (post truncal + ant. highly selective) preserves gastropyloric innervation.",
      color: C.paleGreen
    },
  ];

  procs.forEach((p, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.38 + col * 4.75;
    const y = 1.1 + row * 2.1;
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.55, h: 2.0, fill: { color: C.navyMid }, line: { color: p.color, width: 1.5 }, rounding: true });
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.55, h: 0.4, fill: { color: p.color }, line: { color: p.color, width: 0 }, rounding: true });
    s.addText(p.name, { x: x + 0.1, y: y + 0.03, w: 4.35, h: 0.34, fontSize: 11.5, bold: true, color: C.navyDark, fontFace: "Calibri", valign: "middle" });
    s.addText("For: " + p.use, { x: x + 0.1, y: y + 0.44, w: 4.35, h: 0.28, fontSize: 10.5, bold: true, color: p.color, fontFace: "Calibri" });
    s.addText(p.detail, { x: x + 0.1, y: y + 0.72, w: 4.35, h: 1.22, fontSize: 11, color: C.cream, fontFace: "Calibri", valign: "top" });
  });
}

// ─── SLIDE 20: PROGNOSIS / PREVENTION / SUMMARY ──────────────
{
  const s = pres.addSlide();
  addBg(s, C.navyDark);
  // left bold amber bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.55, h: "100%", fill: { color: C.amber }, line: { color: C.amber, width: 0 } });
  s.addText("PROGNOSIS, PREVENTION & SUMMARY", {
    x: 0.75, y: 0.2, w: 9.0, h: 0.45,
    fontSize: 20, bold: true, color: C.amber, fontFace: "Calibri", charSpacing: 1
  });
  divider(s, 0.68, C.amber);
  slideNum(s, 20);

  // Three panels
  const panels = [
    {
      title: "Prognosis & Recurrence", color: C.amber,
      items: [
        "H. pylori eradication: recurrence drops from 80-90% to <5%",
        "With PPI alone: recurrence 15-20% per year",
        "Surgery (vagotomy): <5% recurrence but declining elective use",
        "Hospital mortality: 3.7% (DU) vs 2.1% (gastric ulcer)",
        "Perforation mortality: up to 30% in modern series",
        "Early presentation and treatment dramatically improve outcomes"
      ]
    },
    {
      title: "Prevention", color: C.paleGreen,
      items: [
        "Test and treat H. pylori in all at-risk patients",
        "PPI co-prescription with NSAIDs / long-term aspirin",
        "Smoking cessation - smoking doubles risk and impairs healing",
        "Avoid unnecessary NSAIDs; use minimum effective dose",
        "Post-hospitalization: chronic PPI + H. pylori eradication",
        "Low-dose aspirin permissible with concomitant PPI"
      ]
    },
    {
      title: "Key Takeaways", color: C.coral,
      items: [
        "H. pylori + NSAIDs cause >90% of DUs - address both",
        "PPIs are the cornerstone of acid suppression",
        "Eradicate H. pylori - confirm with UBT post-treatment",
        "Alarm features → urgent EGD",
        "Perforated DU: emergency surgery (Graham patch)",
        "Bleeding DU: endoscopic haemostasis first; surgery if failed x2",
        "Avoid gastrectomy in malnourished patients"
      ]
    }
  ];

  panels.forEach((p, i) => {
    const x = 0.75 + i * 3.12;
    s.addShape(pres.ShapeType.rect, { x, y: 0.75, w: 3.0, h: 0.38, fill: { color: p.color }, line: { color: p.color, width: 0 } });
    s.addText(p.title, { x, y: 0.75, w: 3.0, h: 0.38, fontSize: 11, bold: true, color: C.navyDark, align: "center", valign: "middle", margin: 0, fontFace: "Calibri" });
    s.addShape(pres.ShapeType.rect, { x, y: 1.13, w: 3.0, h: 4.3, fill: { color: C.navyMid }, line: { color: p.color, width: 1 } });
    const rich = p.items.map((item, j) => ({
      text: item,
      options: { bullet: { indent: 12 }, breakLine: j < p.items.length - 1, color: C.cream, fontSize: 11.5 }
    }));
    s.addText(rich, { x: x + 0.08, y: 1.18, w: 2.84, h: 4.2, fontFace: "Calibri", valign: "top" });
  });

  s.addText("Sources: Schwartz's Principles of Surgery 11e • Yamada's Textbook of Gastroenterology 7e • Current Surgical Therapy 14e • Harrison's Principles of Internal Medicine 22e", {
    x: 0.75, y: 5.38, w: 9.1, h: 0.25,
    fontSize: 8.5, color: C.grayMid, fontFace: "Calibri", italic: true
  });
}

// ─── WRITE FILE ──────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/duodenal-ulcer-ppt/Duodenal_Ulcer.pptx" })
  .then(() => console.log("SUCCESS: Duodenal_Ulcer.pptx created"))
  .catch(err => { console.error("ERROR:", err); process.exit(1); });
You've run out of free credits. Sign up for a free account to continue using Orris.
This is a shared conversation. Sign in to Orris to start your own chat.