Make me a detailed presentation on management diagnosis and treatment of acute pancreatitis for postgraduate class

Reading File
Reading File
Reading File
Finding Sources
Searching PubMed

"acute pancreatitis"[MeSH Terms] AND management

Now let me read the main textbook sources in parallel:
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
I now have rich content. Let me read the key severity scoring and management sections:
Reading File
Reading File
Excellent content. Now I have all the material I need. Let me build the comprehensive PPTX:
Running Command

mkdir -p /home/daytona/workspace/acute-pancreatitis-pptx && ls /home/daytona/workspace/acute-pancreatitis-pptx

Writing File

~/acute-pancreatitis-pptx/build.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE";
pres.title = "Acute Pancreatitis: Diagnosis, Management & Treatment";
pres.author = "Postgraduate Medical Education";

// ─── COLOR PALETTE ──────────────────────────────────────────────
// Deep navy dominates, electric teal accent, white text, light slate for cards
const C = {
  navy:      "0A1628",
  navyMid:   "112240",
  teal:      "00C4B4",
  tealDark:  "009E90",
  amber:     "F0A500",
  red:       "E63946",
  white:     "FFFFFF",
  offWhite:  "F0F4F8",
  slate:     "1E3A5F",
  slateLight:"2E4E78",
  gray:      "94A3B8",
  grayLight: "CBD5E1",
};

// ─── HELPERS ────────────────────────────────────────────────────
function darkSlide(pres) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  return s;
}
function lightSlide(pres) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.offWhite } });
  return s;
}
function accentBar(s, pres, y = 1.1) {
  s.addShape(pres.ShapeType.rect, { x: 0.55, y, w: 0.08, h: 0.55, fill: { color: C.teal }, line: { type: "none" } });
}
function sectionHeader(pres, title, subtitle) {
  const s = darkSlide(pres);
  // diagonal accent
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.08, fill: { color: C.teal }, line: { type: "none" } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 7.42, w: "100%", h: 0.08, fill: { color: C.teal }, line: { type: "none" } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.5, h: "100%", fill: { color: C.teal }, line: { type: "none" } });
  s.addText(title, { x: 1.2, y: 2.8, w: 10, h: 1.0, fontSize: 38, bold: true, color: C.white, fontFace: "Calibri" });
  if (subtitle) {
    s.addText(subtitle, { x: 1.2, y: 3.85, w: 10, h: 0.6, fontSize: 20, color: C.teal, fontFace: "Calibri" });
  }
  return s;
}
function slideTitle(s, pres, title, sub) {
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.08, fill: { color: C.teal }, line: { type: "none" } });
  s.addText(title, { x: 0.5, y: 0.18, w: 12.3, h: 0.75, fontSize: 26, bold: true, color: C.navy, fontFace: "Calibri", margin: 2 });
  if (sub) {
    s.addText(sub, { x: 0.5, y: 0.88, w: 12.3, h: 0.35, fontSize: 14, color: C.slateLight, fontFace: "Calibri", italic: true });
  }
  // bottom bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 7.4, w: "100%", h: 0.1, fill: { color: C.grayLight }, line: { type: "none" } });
  s.addText("Acute Pancreatitis | Postgraduate Education", { x: 0.5, y: 7.42, w: 12, h: 0.08, fontSize: 8, color: C.gray, fontFace: "Calibri" });
}
function bulletBox(s, pres, items, opts = {}) {
  const { x = 0.5, y = 1.35, w = 12.3, h = 5.6, fontSize = 16, color = C.navy } = opts;
  const arr = items.map((item, i) => {
    const isHead = item.startsWith("##");
    const isSub  = item.startsWith("  ");
    const text   = item.replace(/^##\s*/, "").replace(/^\s+/, "");
    return {
      text,
      options: {
        bullet: isHead ? false : { type: "bullet", characterCode: isSub ? "2013" : "25B6", indent: isSub ? 40 : 20 },
        bold: isHead,
        fontSize: isHead ? (fontSize + 1) : isSub ? (fontSize - 2) : fontSize,
        color: isHead ? C.teal : isSub ? C.slateLight : color,
        breakLine: true,
        paraSpaceBefore: isHead ? 8 : isSub ? 1 : 3,
      }
    };
  });
  s.addText(arr, { x, y, w, h, fontFace: "Calibri", valign: "top", autoFit: true });
}
function card(s, pres, x, y, w, h, title, items, titleColor = C.teal, bgColor = C.navyMid) {
  s.addShape(pres.ShapeType.roundRect, { x, y, w, h, rectRadius: 0.12, fill: { color: bgColor }, line: { color: C.teal, pt: 1.5 } });
  s.addText(title, { x: x + 0.1, y: y + 0.08, w: w - 0.2, h: 0.4, fontSize: 13, bold: true, color: titleColor, fontFace: "Calibri", margin: 3, align: "center" });
  const arr = items.map(t => ({ text: t, options: { bullet: { type: "bullet", characterCode: "25AA" }, fontSize: 12.5, color: C.white, breakLine: true, paraSpaceBefore: 2 } }));
  s.addText(arr, { x: x + 0.12, y: y + 0.52, w: w - 0.24, h: h - 0.6, fontFace: "Calibri", valign: "top", autoFit: true });
}
function tableSlide(s, pres, data, opts = {}) {
  const { x = 0.5, y = 1.35, w = 12.3, colW } = opts;
  s.addTable(data, {
    x, y, w,
    colW: colW || undefined,
    border: { type: "solid", pt: 0.5, color: C.grayLight },
    fontFace: "Calibri",
    fontSize: 13,
    rowH: 0.38,
    autoPage: false,
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════
{
  const s = darkSlide(pres);
  // large teal circle accent
  s.addShape(pres.ShapeType.ellipse, { x: 9.5, y: -1.2, w: 5.5, h: 5.5, fill: { color: C.teal, transparency: 85 }, line: { type: "none" } });
  s.addShape(pres.ShapeType.ellipse, { x: -1.2, y: 5.5, w: 4.0, h: 4.0, fill: { color: C.teal, transparency: 88 }, line: { type: "none" } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.12, h: "100%", fill: { color: C.teal }, line: { type: "none" } });
  s.addText("ACUTE PANCREATITIS", { x: 0.5, y: 1.3, w: 9, h: 1.1, fontSize: 46, bold: true, color: C.white, fontFace: "Calibri", charSpacing: 4 });
  s.addText("Diagnosis, Severity Assessment & Management", { x: 0.5, y: 2.5, w: 9.5, h: 0.65, fontSize: 22, color: C.teal, fontFace: "Calibri" });
  s.addShape(pres.ShapeType.rect, { x: 0.5, y: 3.25, w: 4.5, h: 0.05, fill: { color: C.amber }, line: { type: "none" } });
  s.addText("Postgraduate Medical Education  |  Gastroenterology & Surgery", { x: 0.5, y: 3.45, w: 9, h: 0.45, fontSize: 16, color: C.gray, fontFace: "Calibri" });
  s.addText("Sources: Goldman-Cecil Medicine | Sleisenger & Fordtran | Robbins & Kumar | Rosen's Emergency Medicine", { x: 0.5, y: 6.8, w: 12.3, h: 0.3, fontSize: 10, color: C.gray, fontFace: "Calibri", italic: true });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 2 — AGENDA
// ═══════════════════════════════════════════════════════════════
{
  const s = darkSlide(pres);
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.08, fill: { color: C.teal }, line: { type: "none" } });
  s.addText("SESSION OUTLINE", { x: 0.5, y: 0.2, w: 12, h: 0.7, fontSize: 28, bold: true, color: C.white, fontFace: "Calibri" });
  const topics = [
    ["01", "Definition & Epidemiology"],
    ["02", "Etiology & Risk Factors"],
    ["03", "Pathogenesis"],
    ["04", "Clinical Features & Diagnosis"],
    ["05", "Severity Scoring & Atlanta Classification"],
    ["06", "Imaging"],
    ["07", "Management — Initial Resuscitation"],
    ["08", "Nutrition & Pharmacotherapy"],
    ["09", "Complications & Interventions"],
    ["10", "Special Scenarios & Follow-Up"],
  ];
  topics.forEach(([num, text], i) => {
    const col = i < 5 ? 0 : 1;
    const row = i < 5 ? i : i - 5;
    const x = col === 0 ? 0.6 : 7.0;
    const y = 1.15 + row * 1.05;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 5.8, h: 0.82, rectRadius: 0.1, fill: { color: C.navyMid }, line: { color: C.teal, pt: 1 } });
    s.addText(num, { x: x + 0.1, y: y + 0.12, w: 0.6, h: 0.55, fontSize: 18, bold: true, color: C.teal, fontFace: "Calibri", align: "center" });
    s.addText(text, { x: x + 0.75, y: y + 0.18, w: 4.9, h: 0.45, fontSize: 15, color: C.white, fontFace: "Calibri" });
  });
}

// ═══════════════════════════════════════════════════════════════
// SECTION 1 — DEFINITION & EPIDEMIOLOGY
// ═══════════════════════════════════════════════════════════════
sectionHeader(pres, "Section 1", "Definition & Epidemiology");

{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Definition of Acute Pancreatitis", "Revised Atlanta Classification 2012");
  s.addShape(pres.ShapeType.roundRect, { x: 0.5, y: 1.35, w: 12.3, h: 1.6, rectRadius: 0.12, fill: { color: C.navy }, line: { color: C.teal, pt: 2 } });
  s.addText([
    { text: "DIAGNOSIS REQUIRES 2 OF 3 CRITERIA:", options: { bold: true, fontSize: 13, color: C.teal, breakLine: true } },
    { text: "1. Acute onset of epigastric pain (often radiating to the back)", options: { fontSize: 15, color: C.white, breakLine: true } },
    { text: "2. Serum amylase or lipase > 3× upper limit of normal", options: { fontSize: 15, color: C.white, breakLine: true } },
    { text: "3. Characteristic findings on cross-sectional imaging (CT/MRI)", options: { fontSize: 15, color: C.white } },
  ], { x: 0.7, y: 1.42, w: 11.8, h: 1.5, fontFace: "Calibri", valign: "middle" });

  // stat boxes
  const stats = [
    { n: "40", unit: "per 100,000", label: "Annual Incidence (USA)" },
    { n: "300K", unit: "admissions/yr", label: "US Hospitalizations" },
    { n: "5%", unit: "overall mortality", label: "Mild-Moderate AP" },
    { n: "30%", unit: "mortality", label: "Severe Necrotizing AP" },
  ];
  stats.forEach((st, i) => {
    const x = 0.5 + i * 3.1;
    s.addShape(pres.ShapeType.roundRect, { x, y: 3.2, w: 2.9, h: 2.0, rectRadius: 0.12, fill: { color: C.slate }, line: { color: C.teal, pt: 1 } });
    s.addText(st.n, { x, y: 3.35, w: 2.9, h: 0.75, fontSize: 34, bold: true, color: C.teal, fontFace: "Calibri", align: "center" });
    s.addText(st.unit, { x, y: 4.1, w: 2.9, h: 0.35, fontSize: 12, color: C.grayLight, fontFace: "Calibri", align: "center" });
    s.addText(st.label, { x, y: 4.45, w: 2.9, h: 0.55, fontSize: 11.5, color: C.white, fontFace: "Calibri", align: "center", bold: true });
  });
  s.addText("Incidence is increasing — driven by obesity epidemic, gallstone prevalence, and improved diagnostics.", { x: 0.5, y: 5.35, w: 12.3, h: 0.4, fontSize: 12.5, color: C.slateLight, fontFace: "Calibri", italic: true });
}

// ═══════════════════════════════════════════════════════════════
// SECTION 2 — ETIOLOGY
// ═══════════════════════════════════════════════════════════════
sectionHeader(pres, "Section 2", "Etiology & Risk Factors");

{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Etiology of Acute Pancreatitis", "Gallstones + Alcohol = ~80% of cases");

  // Two main causes
  s.addShape(pres.ShapeType.roundRect, { x: 0.5, y: 1.35, w: 5.9, h: 2.15, rectRadius: 0.12, fill: { color: C.navy }, line: { color: C.teal, pt: 2 } });
  s.addText("GALLSTONES  (40-70%)", { x: 0.65, y: 1.42, w: 5.6, h: 0.45, fontSize: 14, bold: true, color: C.teal, fontFace: "Calibri" });
  s.addText([
    { text: "• Small stones (≤5 mm) pass cystic duct and reach ampulla\n", options: { fontSize: 13, color: C.white } },
    { text: "• Transient obstruction at ampulla of Vater\n", options: { fontSize: 13, color: C.white } },
    { text: "• Microlithiasis/biliary sludge underdiagnosed\n", options: { fontSize: 13, color: C.white } },
    { text: "• Only 5% of gallstone patients develop pancreatitis", options: { fontSize: 13, color: C.white } },
  ], { x: 0.65, y: 1.87, w: 5.6, h: 1.55, fontFace: "Calibri", valign: "top" });

  s.addShape(pres.ShapeType.roundRect, { x: 6.9, y: 1.35, w: 5.9, h: 2.15, rectRadius: 0.12, fill: { color: C.navy }, line: { color: C.amber, pt: 2 } });
  s.addText("ALCOHOL  (25-35%)", { x: 7.05, y: 1.42, w: 5.6, h: 0.45, fontSize: 14, bold: true, color: C.amber, fontFace: "Calibri" });
  s.addText([
    { text: "• >5 years of heavy use (≥5–8 drinks/day) usually required\n", options: { fontSize: 13, color: C.white } },
    { text: "• Most already have underlying chronic pancreatitis\n", options: { fontSize: 13, color: C.white } },
    { text: "• Cofactors: high-fat diet, smoking, genetic variability\n", options: { fontSize: 13, color: C.white } },
    { text: "• Smoking is the strongest cofactor", options: { fontSize: 13, color: C.white } },
  ], { x: 7.05, y: 1.87, w: 5.6, h: 1.55, fontFace: "Calibri", valign: "top" });

  // Other causes grid
  s.addText("OTHER CAUSES", { x: 0.5, y: 3.65, w: 12, h: 0.4, fontSize: 14, bold: true, color: C.navy, fontFace: "Calibri" });
  const others = [
    ["METABOLIC", "Hypertriglyceridemia (>1000 mg/dL)\nHyperparathyroidism / Hypercalcemia"],
    ["DRUGS", "Azathioprine, valproate, thiazides\nEstrogens, L-asparaginase, steroids"],
    ["MECHANICAL", "Trauma, post-ERCP (2–5%)\nPancreas divisum, periampullary tumors"],
    ["INFECTIOUS", "Mumps, coxsackievirus\nAscaris lumbricoides, Clonorchis sinensis"],
  ];
  others.forEach(([title, text], i) => {
    const x = 0.5 + i * 3.1;
    s.addShape(pres.ShapeType.roundRect, { x, y: 4.1, w: 2.95, h: 2.9, rectRadius: 0.1, fill: { color: C.slateLight }, line: { color: C.grayLight, pt: 1 } });
    s.addText(title, { x, y: 4.15, w: 2.95, h: 0.4, fontSize: 12, bold: true, color: C.teal, fontFace: "Calibri", align: "center" });
    s.addText(text, { x: x + 0.1, y: 4.6, w: 2.75, h: 2.35, fontSize: 12.5, color: C.white, fontFace: "Calibri", valign: "top" });
  });
  s.addText("Idiopathic: 10-20% — many have occult microlithiasis or genetic mutations (PRSS1, SPINK1, CFTR)", { x: 0.5, y: 7.05, w: 12.3, h: 0.3, fontSize: 11, color: C.gray, fontFace: "Calibri", italic: true });
}

// ═══════════════════════════════════════════════════════════════
// SECTION 3 — PATHOGENESIS
// ═══════════════════════════════════════════════════════════════
sectionHeader(pres, "Section 3", "Pathogenesis");

{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Pathogenesis of Acute Pancreatitis", "Premature enzyme activation is the central event");

  // Central concept box
  s.addShape(pres.ShapeType.roundRect, { x: 4.15, y: 1.38, w: 4.9, h: 0.85, rectRadius: 0.15, fill: { color: C.teal }, line: { type: "none" } });
  s.addText("Premature activation of\nTrypsinogen → Trypsin (within acinar cells)", { x: 4.15, y: 1.38, w: 4.9, h: 0.85, fontSize: 13, bold: true, color: C.navy, fontFace: "Calibri", align: "center", valign: "middle" });

  // Three pathways
  const pathways = [
    { title: "1. DUCTAL OBSTRUCTION", color: C.amber, x: 0.4,
      steps: ["Gallstone impaction at ampulla", "↑ Intraductal pressure", "Lipase (active) → Fat necrosis", "Leukocytes release cytokines → Edema", "Edema → Vascular insufficiency → Ischemia"] },
    { title: "2. PRIMARY ACINAR INJURY", color: C.teal, x: 4.65,
      steps: ["Alcohol, hypertriglyceridemia, ischemia, drugs, trauma", "Triglyceride hydrolysis → Toxic free fatty acids", "Intracellular Ca²⁺ rise", "Trypsinogen activation", "Cascade of digestive enzyme activation"] },
    { title: "3. DEFECTIVE TRANSPORT", color: C.red, x: 8.9,
      steps: ["Proenzymes + lysosomal hydrolases co-packaged", "Lysosomal rupture (phospholipases)", "Intracellular zymogen activation", "Local release of activated enzymes", "Cell necrosis and inflammation"] },
  ];
  pathways.forEach(pw => {
    s.addShape(pres.ShapeType.roundRect, { x: pw.x, y: 2.45, w: 3.9, h: 4.65, rectRadius: 0.12, fill: { color: C.navy }, line: { color: pw.color, pt: 2 } });
    s.addText(pw.title, { x: pw.x + 0.1, y: 2.5, w: 3.7, h: 0.5, fontSize: 12.5, bold: true, color: pw.color, fontFace: "Calibri", align: "center" });
    pw.steps.forEach((step, i) => {
      s.addText("→  " + step, { x: pw.x + 0.15, y: 3.1 + i * 0.72, w: 3.6, h: 0.65, fontSize: 12.5, color: C.white, fontFace: "Calibri", valign: "top" });
    });
  });

  // SIRS note
  s.addShape(pres.ShapeType.roundRect, { x: 0.4, y: 7.1, w: 12.4, h: 0.32, rectRadius: 0.08, fill: { color: C.red, transparency: 15 }, line: { type: "none" } });
  s.addText("Systemic spillover of cytokines + activated enzymes → SIRS → Organ failure (lung, kidney, cardiovascular)", { x: 0.5, y: 7.12, w: 12.2, h: 0.28, fontSize: 12, bold: true, color: C.white, fontFace: "Calibri", align: "center" });
}

// ═══════════════════════════════════════════════════════════════
// SECTION 4 — CLINICAL FEATURES & DIAGNOSIS
// ═══════════════════════════════════════════════════════════════
sectionHeader(pres, "Section 4", "Clinical Features & Diagnosis");

{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Clinical Presentation", "Symptoms correlate poorly with severity");

  bulletBox(s, pres, [
    "## SYMPTOMS",
    "Persistent epigastric or LUQ pain — sudden onset, moderate-to-severe",
    "  Radiation to back, chest, or flanks (\"band-like\")",
    "  Pain relieved by sitting forward / bending (partial)",
    "Nausea, vomiting, anorexia — oral intake worsens pain",
    "## SIGNS",
    "Fever, tachycardia (pain / inflammation)",
    "  Severe/complicated: Hypotension, signs of shock",
    "Jaundice → suggests biliary obstruction",
    "Abdominal tenderness ± guarding ± rigidity (peritoneal irritation)",
    "  Cullen's sign (periumbilical bruising) — hemorrhagic pancreatitis",
    "  Grey Turner's sign (flank bruising) — hemorrhagic pancreatitis",
    "Decreased breath sounds — pleural effusion / splinting",
    "## LABS",
    "Lipase: more specific and sensitive than amylase (preferred biomarker)",
    "  Lipase remains elevated longer (days); amylase normalizes in 24–72 h",
    "CBC (leukocytosis), BMP (BUN, Cr, glucose), LFTs (ALP, ALT > 3x → biliary)",
    "CRP > 150 mg/L at 48 h → predictor of severe disease",
    "Hematocrit > 44% (hemoconcentration) → marker of severity",
  ], { fontSize: 14.5 });
}

// Diagnosis Algorithm
{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Diagnostic Workup Algorithm");

  const steps = [
    { label: "HISTORY & EXAM", detail: "Pain character, alcohol, medications, prior attacks, family history, gallstone risk" },
    { label: "LABS", detail: "Lipase (≥3× ULN confirms), Amylase, LFTs, CBC, BMP, Triglycerides, Ca²⁺, CRP" },
    { label: "ABDOMINAL ULTRASOUND", detail: "1st line — gallstones, CBD dilation, biliary sludge. Limited by bowel gas/obesity." },
    { label: "CECT ABDOMEN", detail: "Gold standard for necrosis, peripancreatic collections, complications. Perform if diagnosis unclear or severe disease. Best at 48–72 h." },
    { label: "MRI/MRCP", detail: "If CT contraindicated. Superior for stones, ductal anatomy, suspected malignancy." },
    { label: "EUS / ERCP", detail: "EUS: detect microlithiasis, occult malignancy. ERCP: therapeutic only (no diagnostic role)." },
  ];

  steps.forEach((step, i) => {
    const y = 1.35 + i * 0.97;
    s.addShape(pres.ShapeType.roundRect, { x: 0.5, y, w: 2.4, h: 0.75, rectRadius: 0.1, fill: { color: C.teal }, line: { type: "none" } });
    s.addText(step.label, { x: 0.5, y, w: 2.4, h: 0.75, fontSize: 11.5, bold: true, color: C.navy, fontFace: "Calibri", align: "center", valign: "middle" });
    s.addShape(pres.ShapeType.rect, { x: 2.9, y: y + 0.3, w: 0.4, h: 0.08, fill: { color: C.teal }, line: { type: "none" } });
    s.addShape(pres.ShapeType.roundRect, { x: 3.3, y: y + 0.05, w: 9.4, h: 0.65, rectRadius: 0.08, fill: { color: C.navy }, line: { color: C.slateLight, pt: 1 } });
    s.addText(step.detail, { x: 3.4, y: y + 0.05, w: 9.3, h: 0.65, fontSize: 13, color: C.white, fontFace: "Calibri", valign: "middle" });
    if (i < steps.length - 1) {
      s.addShape(pres.ShapeType.rect, { x: 1.5, y: y + 0.75, w: 0.05, h: 0.22, fill: { color: C.teal }, line: { type: "none" } });
    }
  });
}

// ═══════════════════════════════════════════════════════════════
// SECTION 5 — SEVERITY SCORING
// ═══════════════════════════════════════════════════════════════
sectionHeader(pres, "Section 5", "Severity Scoring & Atlanta Classification");

{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Revised Atlanta Classification 2012", "Three severity grades based on organ failure and complications");

  const grades = [
    { grade: "MILD AP", color: "2ECC71", bgColor: "0A2E1C",
      points: ["No organ failure", "No local or systemic complications", "Usually resolves within 1 week", "Mortality: < 1%", "Management: supportive outpatient/short inpatient"] },
    { grade: "MODERATELY SEVERE AP", color: C.amber, bgColor: "2D200A",
      points: ["Transient organ failure (resolves < 48 h)", "OR local complications (APFC, ANC, pseudocyst, WON)", "OR exacerbation of pre-existing co-morbidities", "Mortality: ~8%", "May need ICU monitoring"] },
    { grade: "SEVERE AP", color: C.red, bgColor: "2D0A0A",
      points: ["Persistent organ failure (> 48 h)", "Single or multi-organ failure", "Mortality: 30–50% (higher if infected necrosis)", "Requires ICU admission", "Multi-disciplinary team management"] },
  ];
  grades.forEach((g, i) => {
    const x = 0.5 + i * 4.15;
    s.addShape(pres.ShapeType.roundRect, { x, y: 1.35, w: 3.95, h: 5.55, rectRadius: 0.12, fill: { color: g.bgColor }, line: { color: g.color, pt: 2.5 } });
    s.addText(g.grade, { x, y: 1.42, w: 3.95, h: 0.6, fontSize: 13, bold: true, color: g.color, fontFace: "Calibri", align: "center" });
    g.points.forEach((p, j) => {
      s.addText("• " + p, { x: x + 0.15, y: 2.15 + j * 0.82, w: 3.65, h: 0.75, fontSize: 13, color: C.white, fontFace: "Calibri", valign: "top" });
    });
  });
  s.addText("Organ failure defined by modified Marshall scoring: PaO₂/FiO₂ < 300 | Creatinine > 1.9 mg/dL | SBP < 90 mmHg despite fluids", { x: 0.5, y: 7.0, w: 12.3, h: 0.4, fontSize: 11, color: C.gray, fontFace: "Calibri", italic: true });
}

// Ranson's Criteria
{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Ranson's Criteria & Other Scoring Systems");

  // Ranson table
  s.addText("RANSON'S CRITERIA", { x: 0.5, y: 1.35, w: 5.9, h: 0.4, fontSize: 14, bold: true, color: C.navy, fontFace: "Calibri" });
  const ransonData = [
    [{ text: "On Admission", options: { bold: true, color: C.white, fill: { color: C.slate } } },
     { text: "At 48 Hours", options: { bold: true, color: C.white, fill: { color: C.slate } } }],
    [{ text: "Age > 55 years", options: { color: C.navy } }, { text: "Hematocrit drop > 10%", options: { color: C.navy } }],
    [{ text: "WBC > 16,000/mm³", options: { color: C.navy } }, { text: "BUN rise > 5 mg/dL", options: { color: C.navy } }],
    [{ text: "Blood glucose > 200 mg/dL", options: { color: C.navy } }, { text: "Serum Ca²⁺ < 8 mg/dL", options: { color: C.navy } }],
    [{ text: "Serum LDH > 350 IU/L", options: { color: C.navy } }, { text: "PaO₂ < 60 mmHg", options: { color: C.navy } }],
    [{ text: "AST > 250 IU/L", options: { color: C.navy } }, { text: "Base deficit > 4 mEq/L", options: { color: C.navy } }],
    [{ text: "", options: { color: C.navy } }, { text: "Fluid sequestration > 6L", options: { color: C.navy } }],
  ];
  s.addTable(ransonData, { x: 0.5, y: 1.78, w: 6.1, colW: [3.05, 3.05], border: { type: "solid", pt: 0.5, color: C.grayLight }, fontFace: "Calibri", fontSize: 12.5, rowH: 0.36 });
  s.addText("Score ≥ 3 = Severe  |  Score ≥ 5 = High mortality (>40%)", { x: 0.5, y: 4.5, w: 6.1, h: 0.35, fontSize: 12, color: C.red, fontFace: "Calibri", bold: true });

  // Other scores
  s.addText("OTHER SCORING SYSTEMS", { x: 7.0, y: 1.35, w: 5.9, h: 0.4, fontSize: 14, bold: true, color: C.navy, fontFace: "Calibri" });
  const others = [
    { name: "APACHE II", detail: "12 physiology variables + age + chronic health. Score ≥ 8 = severe. Applicable on admission and repeated daily." },
    { name: "BISAP Score", detail: "5 variables (BUN > 25, Impaired mental status, SIRS, Age > 60, Pleural effusion). Score ≥ 3 = severe." },
    { name: "CT Severity Index (CTSI)", detail: "Balthazar grade (A–E) + % necrosis. Score 7–10 = severe. Correlates with morbidity and mortality." },
    { name: "CRP at 48 h", detail: "CRP > 150 mg/L at 48 h is a reliable predictor of severe AP. Simple, widely available." },
  ];
  others.forEach((o, i) => {
    const y = 1.8 + i * 1.28;
    s.addShape(pres.ShapeType.roundRect, { x: 7.0, y, w: 6.0, h: 1.15, rectRadius: 0.1, fill: { color: C.navy }, line: { color: C.teal, pt: 1.2 } });
    s.addText(o.name, { x: 7.1, y: y + 0.06, w: 5.8, h: 0.38, fontSize: 13.5, bold: true, color: C.teal, fontFace: "Calibri" });
    s.addText(o.detail, { x: 7.1, y: y + 0.48, w: 5.8, h: 0.62, fontSize: 12.5, color: C.white, fontFace: "Calibri", valign: "top" });
  });
  s.addText("Glasgow/Imrie criteria: identical concept to Ranson, validated in UK. Score ≥ 3 = severe.", { x: 0.5, y: 7.05, w: 12.3, h: 0.32, fontSize: 11, color: C.gray, fontFace: "Calibri", italic: true });
}

// ═══════════════════════════════════════════════════════════════
// SECTION 6 — IMAGING
// ═══════════════════════════════════════════════════════════════
sectionHeader(pres, "Section 6", "Imaging in Acute Pancreatitis");

{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Imaging Modalities", "Complementary roles — choose based on clinical context");

  const modalities = [
    { title: "Abdominal Ultrasound", color: "2ECC71",
      items: ["First-line imaging in all patients", "Detects gallstones, biliary sludge, CBD dilation", "Limited by bowel gas and obesity", "Cannot reliably assess pancreatic necrosis", "Sensitive for detecting gallstone etiology"] },
    { title: "CECT Abdomen", color: C.teal,
      items: ["Gold standard for severity and complications", "Identifies pancreatic/peripancreatic necrosis", "Non-enhancing pancreas = necrotic parenchyma", "Best performed at 48–72 h (necrosis not visible earlier)", "CT Severity Index (CTSI) calculated from CECT"] },
    { title: "MRI / MRCP", color: C.amber,
      items: ["Equivalent to CT for necrosis detection", "Superior for duct anatomy and gallstones", "MRCP: non-invasive ductal imaging", "Preferred if CT contraindicated (pregnancy, allergy)", "Better for solid vs. liquid component differentiation"] },
    { title: "EUS & ERCP", color: C.red,
      items: ["EUS: detects microlithiasis, ampullary adenoma, malignancy", "EUS preferred over ERCP for diagnosis", "ERCP: therapeutic only — not for diagnosis", "ERCP within 24 h: if cholangitis or persistent biliary obstruction", "Sphincterotomy + stone extraction in gallstone AP with cholangitis"] },
  ];
  modalities.forEach((m, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.5 + col * 6.55;
    const y = 1.35 + row * 2.95;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 6.2, h: 2.75, rectRadius: 0.12, fill: { color: C.navy }, line: { color: m.color, pt: 2 } });
    s.addText(m.title, { x: x + 0.15, y: y + 0.1, w: 5.9, h: 0.4, fontSize: 14, bold: true, color: m.color, fontFace: "Calibri" });
    m.items.forEach((item, j) => {
      s.addText("• " + item, { x: x + 0.15, y: y + 0.58 + j * 0.42, w: 5.9, h: 0.4, fontSize: 12.5, color: C.white, fontFace: "Calibri", valign: "top" });
    });
  });
}

// CT Severity Index
{
  const s = lightSlide(pres);
  slideTitle(s, pres, "CT Severity Index (Balthazar / CTSI)", "Combines CT grade + % necrosis");

  // Balthazar
  s.addText("BALTHAZAR GRADE (CT Inflammation)", { x: 0.5, y: 1.35, w: 5.9, h: 0.4, fontSize: 13, bold: true, color: C.navy, fontFace: "Calibri" });
  const bData = [
    [{ text: "Grade", options: { bold: true, fill: { color: C.slate }, color: C.white } },
     { text: "CT Findings", options: { bold: true, fill: { color: C.slate }, color: C.white } },
     { text: "Points", options: { bold: true, fill: { color: C.slate }, color: C.white } }],
    [{ text: "A", options: {} }, { text: "Normal pancreas", options: {} }, { text: "0", options: {} }],
    [{ text: "B", options: {} }, { text: "Focal/diffuse enlargement", options: {} }, { text: "1", options: {} }],
    [{ text: "C", options: {} }, { text: "Pancreatic + peripancreatic inflammation", options: {} }, { text: "2", options: {} }],
    [{ text: "D", options: {} }, { text: "Single peripancreatic fluid collection", options: {} }, { text: "3", options: {} }],
    [{ text: "E", options: {} }, { text: "≥2 fluid collections / retroperitoneal gas", options: {} }, { text: "4", options: {} }],
  ];
  s.addTable(bData, { x: 0.5, y: 1.8, w: 6.1, colW: [0.8, 4.2, 1.1], border: { type: "solid", pt: 0.5, color: C.grayLight }, fontFace: "Calibri", fontSize: 12.5, rowH: 0.36 });

  // Necrosis
  s.addText("NECROSIS SCORE", { x: 7.0, y: 1.35, w: 5.9, h: 0.4, fontSize: 13, bold: true, color: C.navy, fontFace: "Calibri" });
  const nData = [
    [{ text: "Necrosis (%)", options: { bold: true, fill: { color: C.slate }, color: C.white } },
     { text: "Points", options: { bold: true, fill: { color: C.slate }, color: C.white } }],
    [{ text: "None", options: {} }, { text: "0", options: {} }],
    [{ text: "< 30%", options: {} }, { text: "2", options: {} }],
    [{ text: "30–50%", options: {} }, { text: "4", options: {} }],
    [{ text: "> 50%", options: {} }, { text: "6", options: {} }],
  ];
  s.addTable(nData, { x: 7.0, y: 1.8, w: 3.5, colW: [2.2, 1.3], border: { type: "solid", pt: 0.5, color: C.grayLight }, fontFace: "Calibri", fontSize: 12.5, rowH: 0.36 });

  // Interpretation
  s.addText("CTSI = Balthazar + Necrosis Points (Max = 10)", { x: 7.0, y: 3.65, w: 5.9, h: 0.45, fontSize: 13, bold: true, color: C.teal, fontFace: "Calibri" });
  const interpData = [
    [{ text: "CTSI Score", options: { bold: true, fill: { color: C.slate }, color: C.white } },
     { text: "Severity", options: { bold: true, fill: { color: C.slate }, color: C.white } },
     { text: "Morbidity", options: { bold: true, fill: { color: C.slate }, color: C.white } }],
    [{ text: "0–3", options: {} }, { text: "Mild", options: { color: "2ECC71" } }, { text: "Low", options: {} }],
    [{ text: "4–6", options: {} }, { text: "Moderate", options: { color: C.amber } }, { text: "35%", options: {} }],
    [{ text: "7–10", options: {} }, { text: "Severe", options: { color: C.red } }, { text: "92%", options: {} }],
  ];
  s.addTable(interpData, { x: 7.0, y: 4.15, w: 5.9, colW: [1.8, 2.4, 1.7], border: { type: "solid", pt: 0.5, color: C.grayLight }, fontFace: "Calibri", fontSize: 13, rowH: 0.42 });

  // Local complications
  s.addText("LOCAL COMPLICATIONS (Revised Atlanta 2012)", { x: 0.5, y: 4.65, w: 5.9, h: 0.4, fontSize: 13, bold: true, color: C.navy, fontFace: "Calibri" });
  const lc = [
    ["Acute Peripancreatic Fluid Collection (APFC)", "< 4 weeks, interstitial AP, no wall, no necrosis"],
    ["Acute Necrotic Collection (ANC)", "< 4 weeks, necrotizing AP, no wall, contains necrosis"],
    ["Pseudocyst", "> 4 weeks, wall-encapsulated, no solid necrotic material"],
    ["Walled-Off Necrosis (WON)", "> 4 weeks, wall-encapsulated, contains necrosis"],
  ];
  lc.forEach(([name, detail], i) => {
    s.addShape(pres.ShapeType.roundRect, { x: 0.5, y: 5.12 + i * 0.52, w: 12.3, h: 0.48, rectRadius: 0.08, fill: { color: i % 2 === 0 ? C.navy : C.slateLight }, line: { type: "none" } });
    s.addText(name, { x: 0.65, y: 5.14 + i * 0.52, w: 4.5, h: 0.4, fontSize: 12, bold: true, color: C.teal, fontFace: "Calibri" });
    s.addText(detail, { x: 5.2, y: 5.14 + i * 0.52, w: 7.5, h: 0.4, fontSize: 12, color: C.white, fontFace: "Calibri" });
  });
}

// ═══════════════════════════════════════════════════════════════
// SECTION 7 — MANAGEMENT: INITIAL RESUSCITATION
// ═══════════════════════════════════════════════════════════════
sectionHeader(pres, "Section 7", "Management — Initial Resuscitation");

{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Initial Management: First 24–48 Hours", "Aggressive resuscitation is the cornerstone of treatment");

  const cols = [
    { title: "FLUID RESUSCITATION", color: C.teal, x: 0.5, items: [
      "Goal-directed IV fluid therapy — most important intervention",
      "Lactated Ringer's preferred over Normal Saline",
      "  LR reduces SIRS and inflammatory markers",
      "Rate: 250–500 mL/h in first 12–24 h (guided by response)",
      "Monitor: Urine output > 0.5 mL/kg/h, HR < 100, MAP > 65",
      "BUN and hematocrit — bedside surrogates of resuscitation",
      "Avoid over-hydration: worsens abdominal compartment syndrome",
    ]},
    { title: "ANALGESIA", color: C.amber, x: 4.65, items: [
      "Adequate pain control is mandatory",
      "IV opioids (morphine, hydromorphone) — first line",
      "  No evidence that morphine worsens pancreatitis (historical myth)",
      "NSAIDs / ketorolac as adjuncts",
      "Epidural analgesia — consider in refractory severe pain",
      "Reassess frequently — pain correlates with inflammation",
    ]},
    { title: "MONITORING", color: C.red, x: 8.8, items: [
      "ICU admission if: persistent organ failure, APACHE ≥ 8",
      "Vital signs q1h in severe AP",
      "Foley catheter for urine output monitoring",
      "Serial abdominal exams for peritoneal signs",
      "Repeat labs at 24 h (WBC, BUN, Hct, CRP, LFTs)",
      "CECT if no improvement at 48–72 h",
    ]},
  ];
  cols.forEach(col => {
    s.addShape(pres.ShapeType.roundRect, { x: col.x, y: 1.35, w: 3.95, h: 5.55, rectRadius: 0.12, fill: { color: C.navy }, line: { color: col.color, pt: 2 } });
    s.addText(col.title, { x: col.x + 0.1, y: 1.42, w: 3.75, h: 0.45, fontSize: 12.5, bold: true, color: col.color, fontFace: "Calibri", align: "center" });
    col.items.forEach((item, i) => {
      const isSub = item.startsWith("  ");
      const text = item.replace(/^\s+/, "");
      s.addText((isSub ? "  ↳ " : "• ") + text, { x: col.x + 0.12, y: 1.95 + i * 0.72, w: 3.7, h: 0.68, fontSize: isSub ? 12 : 13, color: isSub ? C.grayLight : C.white, fontFace: "Calibri", valign: "top" });
    });
  });
  s.addText("Discontinue oral intake initially — reassess at 24 h. Most mild AP patients can resume oral feeding within 24–48 h if pain and nausea allow.", { x: 0.5, y: 7.0, w: 12.3, h: 0.38, fontSize: 11.5, color: C.slateLight, fontFace: "Calibri", italic: true });
}

// ═══════════════════════════════════════════════════════════════
// SECTION 8 — NUTRITION & PHARMACOTHERAPY
// ═══════════════════════════════════════════════════════════════
sectionHeader(pres, "Section 8", "Nutrition & Pharmacotherapy");

{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Nutritional Management", "Enteral nutrition is superior to parenteral nutrition");

  // Left: mild AP
  s.addShape(pres.ShapeType.roundRect, { x: 0.5, y: 1.35, w: 5.9, h: 4.35, rectRadius: 0.12, fill: { color: C.navy }, line: { color: "2ECC71", pt: 2 } });
  s.addText("MILD AP", { x: 0.6, y: 1.42, w: 5.7, h: 0.45, fontSize: 15, bold: true, color: "2ECC71", fontFace: "Calibri" });
  bulletBox(s, pres, [
    "Resume oral diet as soon as pain and nausea allow",
    "  Typically within 24–48 hours",
    "Start with soft/low-fat diet (not necessarily clear liquids)",
    "Early oral feeding reduces hospital stay",
    "Nasogastric tube only if persistent vomiting",
    "IV fluids can be de-escalated once oral intake established",
  ], { x: 0.6, y: 1.92, w: 5.7, h: 3.6, fontSize: 13.5 });

  // Right: severe AP
  s.addShape(pres.ShapeType.roundRect, { x: 6.9, y: 1.35, w: 5.9, h: 4.35, rectRadius: 0.12, fill: { color: C.navy }, line: { color: C.red, pt: 2 } });
  s.addText("SEVERE AP", { x: 7.0, y: 1.42, w: 5.7, h: 0.45, fontSize: 15, bold: true, color: C.red, fontFace: "Calibri" });
  bulletBox(s, pres, [
    "Enteral nutrition (EN) is PREFERRED over TPN",
    "  EN maintains gut barrier, reduces bacterial translocation",
    "  EN reduces infection risk, organ failure, and mortality",
    "Nasojejunal (post-ligament of Treitz) feeding preferred",
    "  Nasogastric route acceptable if NJ not feasible",
    "Start EN within 24–48 h in severe AP",
    "TPN: reserved for EN intolerance or inaccessible GI tract",
  ], { x: 7.0, y: 1.92, w: 5.7, h: 3.6, fontSize: 13.5 });

  // Bottom summary
  s.addShape(pres.ShapeType.roundRect, { x: 0.5, y: 5.85, w: 12.3, h: 1.0, rectRadius: 0.1, fill: { color: C.teal, transparency: 10 }, line: { type: "none" } });
  s.addText([
    { text: "KEY PRINCIPLE: ", options: { bold: true, fontSize: 14, color: C.navy } },
    { text: "\"Resting the pancreas\" by NPO is outdated. Early enteral feeding is now standard of care for severe AP. The gut is not a bystander — it is an active source of infection when starved.", options: { fontSize: 13.5, color: C.navy } },
  ], { x: 0.65, y: 5.9, w: 12.0, h: 0.9, fontFace: "Calibri", valign: "middle" });
}

// Pharmacotherapy
{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Pharmacotherapy & What NOT to Use");

  const meds = [
    { title: "ANTIBIOTICS", color: C.amber,
      items: ["NOT routinely indicated in AP — no benefit for sterile disease",
              "Prophylactic antibiotics in necrotizing AP: NOT recommended (multiple RCTs negative)",
              "INDICATIONS: Infected pancreatic necrosis (fever + elevated WBC persisting > 7–10 d)",
              "Choice: Carbapenems (imipenem) or fluoroquinolones — good pancreatic penetration",
              "FNA-guided culture before starting antibiotics if possible"] },
    { title: "PROTON PUMP INHIBITORS", color: C.teal,
      items: ["Routine use NOT evidence-based for pancreatitis per se",
              "Use if co-existing peptic ulcer disease or stress ulcer prophylaxis in ICU patients",
              "Stress ulcer prophylaxis: IV PPI in ventilated ICU patients"] },
    { title: "OCTREOTIDE / PROTEASE INHIBITORS", color: C.red,
      items: ["Octreotide, gabexate, aprotinin: NOT recommended — no mortality benefit",
              "Multiple randomized trials negative",
              "No role for routine somatostatin analog therapy in AP"] },
    { title: "OTHER ADJUNCTS", color: C.gray,
      items: ["Antispasmodics (hyoscine): mild symptom relief only",
              "Insulin: required if glucose > 180–200 mg/dL (hypertriglyceridemic AP)",
              "Plasmapheresis: for extreme hypertriglyceridemia (>1000 mg/dL) refractory to insulin",
              "Anticoagulation: for splenic/portal vein thrombosis complicating AP"] },
  ];
  meds.forEach((m, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.5 + col * 6.55;
    const y = 1.35 + row * 2.95;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 6.2, h: 2.75, rectRadius: 0.12, fill: { color: C.navy }, line: { color: m.color, pt: 1.8 } });
    s.addText(m.title, { x: x + 0.12, y: y + 0.1, w: 5.9, h: 0.4, fontSize: 13.5, bold: true, color: m.color, fontFace: "Calibri" });
    m.items.forEach((item, j) => {
      s.addText("• " + item, { x: x + 0.12, y: y + 0.58 + j * 0.44, w: 5.9, h: 0.42, fontSize: 12, color: C.white, fontFace: "Calibri", valign: "top" });
    });
  });
}

// ═══════════════════════════════════════════════════════════════
// SECTION 9 — COMPLICATIONS & INTERVENTIONS
// ═══════════════════════════════════════════════════════════════
sectionHeader(pres, "Section 9", "Complications & Interventional Management");

{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Systemic Complications & Organ Failure", "Multiorgan failure drives mortality in severe AP");

  const comps = [
    { title: "RESPIRATORY", color: C.teal,
      items: ["ARDS — most feared; PaO₂/FiO₂ < 200", "Pleural effusions (left > right)", "Atelectasis, pneumonia", "Manage: lung-protective ventilation, diuresis"] },
    { title: "RENAL", color: C.amber,
      items: ["Acute kidney injury — 2nd to hypovolemia", "Hemoconcentration (Hct > 44%) = risk factor", "Goal: urine output > 0.5 mL/kg/h", "Dialysis if refractory oliguria"] },
    { title: "CARDIOVASCULAR", color: C.red,
      items: ["Hypovolemic shock — aggressive IVF", "Myocardial depression (cytokine-mediated)", "Splenic/portal vein thrombosis", "Monitor: MAP > 65, avoid vasopressors when possible"] },
    { title: "METABOLIC", color: "9B59B6",
      items: ["Hypocalcemia — saponification of fat", "  Ca²⁺ < 8 mg/dL = Ranson criterion", "Hyperglycemia — stress response", "Hypomagnesemia, hypophosphatemia"] },
    { title: "HEMATOLOGIC", color: "E74C3C",
      items: ["DIC — rare, fulminant course", "Anemia from retroperitoneal hemorrhage", "Thrombocytopenia in septic complications"] },
    { title: "INFECTIOUS", color: C.amber,
      items: ["Infected pancreatic necrosis — most feared complication", "Bacteremia, sepsis, multi-organ failure", "Mortality rises to 30–50% with infection", "Abscesses in peripancreatic collections"] },
  ];
  comps.forEach((c, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.4 + col * 4.3;
    const y = 1.35 + row * 2.85;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 4.0, h: 2.65, rectRadius: 0.1, fill: { color: C.navy }, line: { color: c.color, pt: 1.8 } });
    s.addText(c.title, { x: x + 0.1, y: y + 0.1, w: 3.8, h: 0.38, fontSize: 13, bold: true, color: c.color, fontFace: "Calibri" });
    c.items.forEach((item, j) => {
      const isSub = item.startsWith("  ");
      s.addText((isSub ? "  ↳ " : "• ") + item.trim(), { x: x + 0.1, y: y + 0.55 + j * 0.52, w: 3.8, h: 0.5, fontSize: isSub ? 11.5 : 12.5, color: isSub ? C.grayLight : C.white, fontFace: "Calibri", valign: "top" });
    });
  });
}

// Interventional Management
{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Interventional & Surgical Management", "Step-up approach — minimally invasive first");

  // Step-up approach
  s.addText("STEP-UP APPROACH FOR INFECTED NECROSIS", { x: 0.5, y: 1.35, w: 12.3, h: 0.45, fontSize: 15, bold: true, color: C.navy, fontFace: "Calibri" });
  const steps = [
    { n: "STEP 1", title: "Conservative Management", detail: "Antibiotics (IV carbapenem). Continue enteral nutrition. Monitor for clinical deterioration. Allow 2–4 weeks for demarcation of necrosis.", color: "2ECC71" },
    { n: "STEP 2", title: "Percutaneous / Endoscopic Drainage", detail: "CT-guided percutaneous catheter drainage (PCD). Endoscopic transmural drainage (ETD) for WON adjacent to gut wall. Preferred if well-demarcated WON > 4 weeks.", color: C.amber },
    { n: "STEP 3", title: "Video-Assisted Retroperitoneal Debridement (VARD)", detail: "Minimally invasive necrosectomy via retroperitoneal route. Performed via sinus tract of PCD catheter. Lower morbidity than open surgery.", color: C.red },
    { n: "STEP 4", title: "Open Surgical Necrosectomy", detail: "Reserved for failed endoscopic/percutaneous approaches. Last resort — highest morbidity and mortality. Laparostomy or open packing techniques.", color: "8E44AD" },
  ];
  steps.forEach((step, i) => {
    const y = 1.92 + i * 1.3;
    s.addShape(pres.ShapeType.roundRect, { x: 0.5, y, w: 1.5, h: 1.1, rectRadius: 0.1, fill: { color: step.color }, line: { type: "none" } });
    s.addText(step.n, { x: 0.5, y, w: 1.5, h: 1.1, fontSize: 12.5, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
    s.addShape(pres.ShapeType.rect, { x: 2.0, y: y + 0.48, w: 0.35, h: 0.08, fill: { color: step.color }, line: { type: "none" } });
    s.addShape(pres.ShapeType.roundRect, { x: 2.35, y: y + 0.08, w: 10.35, h: 1.0, rectRadius: 0.1, fill: { color: C.navy }, line: { color: step.color, pt: 1 } });
    s.addText(step.title, { x: 2.5, y: y + 0.1, w: 10.0, h: 0.38, fontSize: 13, bold: true, color: step.color, fontFace: "Calibri" });
    s.addText(step.detail, { x: 2.5, y: y + 0.5, w: 10.0, h: 0.52, fontSize: 12, color: C.white, fontFace: "Calibri", valign: "top" });
  });
  s.addText("ERCP with sphincterotomy: within 24 h for gallstone AP with concurrent cholangitis or persisting biliary obstruction.", { x: 0.5, y: 7.1, w: 12.3, h: 0.32, fontSize: 11, color: C.gray, fontFace: "Calibri", italic: true });
}

// Gallstone AP management
{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Gallstone Pancreatitis — Specific Management");

  bulletBox(s, pres, [
    "## ERCP INDICATIONS",
    "Acute cholangitis complicating gallstone AP → ERCP within 24 hours",
    "Persistent biliary obstruction (rising bilirubin, dilated CBD) → ERCP within 48–72 h",
    "ERCP NOT indicated: mild gallstone AP without cholangitis or obstruction",
    "## CHOLECYSTECTOMY TIMING",
    "Mild AP: Cholecystectomy during SAME ADMISSION (within 7 days) → prevents recurrence (30–50% risk within 30 days without surgery)",
    "Moderate-Severe AP: Delay cholecystectomy until inflammation resolves (≥ 4–6 weeks)",
    "If ERCP sphincterotomy performed: still requires cholecystectomy (sphincterotomy alone insufficient)",
    "## HYPERTRIGLYCERIDEMIA-INDUCED AP",
    "Insulin infusion (even without diabetes) — lowers triglycerides rapidly",
    "Plasmapheresis if TG > 1000 mg/dL unresponsive to insulin",
    "Long-term: fibrates, omega-3 fatty acids, low-fat diet",
    "## ALCOHOL-INDUCED AP",
    "Abstinence counseling — reduces recurrence and progression to chronic pancreatitis",
    "Brief intervention during hospitalization shown to reduce recurrence",
  ], { fontSize: 14 });
}

// ═══════════════════════════════════════════════════════════════
// SECTION 10 — SPECIAL SCENARIOS & FOLLOW-UP
// ═══════════════════════════════════════════════════════════════
sectionHeader(pres, "Section 10", "Special Scenarios & Follow-Up");

{
  const s = lightSlide(pres);
  slideTitle(s, pres, "Post-Discharge Management & Prevention of Recurrence");

  bulletBox(s, pres, [
    "## POST-DISCHARGE FOLLOW-UP",
    "All patients: follow-up at 2–4 weeks; review imaging findings and labs",
    "Pseudocyst / WON: repeat CT at 6–8 weeks if not drained",
    "Assess for exocrine insufficiency (steatorrhea) and endocrine insufficiency (new-onset diabetes)",
    "## PREVENTION OF RECURRENCE",
    "Gallstone AP: SAME-ADMISSION cholecystectomy (see slide 15)",
    "Alcohol AP: abstinence support, addiction referral",
    "Hypertriglyceridemia: fibrates, dietary fat restriction, omega-3 fatty acids",
    "Medication-induced AP: permanent discontinuation of offending agent",
    "## RISK OF CHRONIC PANCREATITIS",
    "Each episode of AP causes progressive fibrosis",
    "Recurrent AP → Chronic pancreatitis continuum",
    "Smoking: strongest modifiable risk factor for progression",
    "Genetic AP (PRSS1 mutations): very high risk → monitoring for exocrine and endocrine insufficiency",
    "## LONG-TERM COMPLICATIONS TO MONITOR",
    "Pancreatic exocrine insufficiency: enzyme replacement therapy (PERT)",
    "Post-AP diabetes mellitus (type 3c): insulin therapy, monitoring HbA1c",
    "Splenic and portal vein thrombosis: anticoagulation 3–6 months",
    "Pancreatic ductal strictures: ERCP / surgery if symptomatic",
  ], { fontSize: 13.5 });
}

// ═══════════════════════════════════════════════════════════════
// SUMMARY SLIDE
// ═══════════════════════════════════════════════════════════════
{
  const s = darkSlide(pres);
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.08, fill: { color: C.teal }, line: { type: "none" } });
  s.addText("CLINICAL PEARLS & TAKE-HOME MESSAGES", { x: 0.5, y: 0.15, w: 12.3, h: 0.7, fontSize: 26, bold: true, color: C.white, fontFace: "Calibri" });

  const pearls = [
    { n: "1", text: "Diagnosis: 2 of 3 — characteristic pain + lipase ≥3× ULN + imaging. Lipase > amylase in sensitivity and duration.", color: "2ECC71" },
    { n: "2", text: "Severity: Revised Atlanta 2012 (mild / moderately severe / severe). Persistent organ failure > 48 h = severe. CTSI, APACHE II, BISAP — use multiple tools.", color: C.teal },
    { n: "3", text: "Fluid resuscitation: Lactated Ringer's preferred. 250–500 mL/h goal-directed. Most important initial intervention.", color: C.amber },
    { n: "4", text: "Nutrition: Early enteral feeding (24–48 h). Enteral > parenteral. Nasojejunal preferred. NPO is outdated for severe AP.", color: "9B59B6" },
    { n: "5", text: "Antibiotics: NOT prophylactic. Reserve for CONFIRMED infected necrosis. Carbapenems / quinolones for good pancreatic penetration.", color: C.red },
    { n: "6", text: "Interventions: Step-up approach — conservative → endoscopic/percutaneous drainage → VARD → open necrosectomy.", color: "E67E22" },
    { n: "7", text: "Gallstone AP: ERCP if cholangitis. Same-admission cholecystectomy for mild AP. Delay 4–6 weeks for severe AP.", color: "1ABC9C" },
    { n: "8", text: "Follow-up: Monitor for exocrine insufficiency, new-onset diabetes (type 3c), and strictures. Address modifiable causes.", color: C.gray },
  ];
  pearls.forEach((p, i) => {
    const col = i < 4 ? 0 : 1;
    const row = i < 4 ? i : i - 4;
    const x = col === 0 ? 0.4 : 6.9;
    const y = 1.0 + row * 1.52;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 6.3, h: 1.38, rectRadius: 0.1, fill: { color: C.navyMid }, line: { color: p.color, pt: 1.5 } });
    s.addShape(pres.ShapeType.ellipse, { x: x + 0.12, y: y + 0.3, w: 0.52, h: 0.52, fill: { color: p.color }, line: { type: "none" } });
    s.addText(p.n, { x: x + 0.12, y: y + 0.3, w: 0.52, h: 0.52, fontSize: 14, bold: true, color: C.navy, fontFace: "Calibri", align: "center", valign: "middle" });
    s.addText(p.text, { x: x + 0.75, y: y + 0.1, w: 5.45, h: 1.15, fontSize: 12, color: C.white, fontFace: "Calibri", valign: "middle" });
  });
}

// FINAL SLIDE
{
  const s = darkSlide(pres);
  s.addShape(pres.ShapeType.ellipse, { x: 3.5, y: 1.2, w: 6.3, h: 6.3, fill: { color: C.teal, transparency: 90 }, line: { type: "none" } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.08, fill: { color: C.teal }, line: { type: "none" } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 7.42, w: "100%", h: 0.08, fill: { color: C.teal }, line: { type: "none" } });
  s.addText("THANK YOU", { x: 1.5, y: 2.2, w: 10.3, h: 1.1, fontSize: 52, bold: true, color: C.white, fontFace: "Calibri", align: "center", charSpacing: 8 });
  s.addText("Questions & Discussion", { x: 1.5, y: 3.4, w: 10.3, h: 0.65, fontSize: 24, color: C.teal, fontFace: "Calibri", align: "center" });
  s.addShape(pres.ShapeType.rect, { x: 3.5, y: 4.2, w: 6.3, h: 0.05, fill: { color: C.amber }, line: { type: "none" } });
  s.addText("Goldman-Cecil Medicine (26e)  •  Sleisenger & Fordtran's GI and Liver Disease  •  Robbins & Kumar Basic Pathology  •  Rosen's Emergency Medicine", { x: 0.5, y: 4.4, w: 12.3, h: 0.5, fontSize: 11.5, color: C.gray, fontFace: "Calibri", align: "center" });
}

// ─── WRITE FILE ──────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/acute-pancreatitis-pptx/Acute_Pancreatitis_PG.pptx" })
  .then(() => console.log("DONE: Acute_Pancreatitis_PG.pptx written"))
  .catch(err => console.error("ERROR:", err));
Running Command

cd /home/daytona/workspace/acute-pancreatitis-pptx && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/acute-pancreatitis-pptx/Acute_Pancreatitis_PG.pptx

Your presentation is ready!

Acute Pancreatitis PG

Presentation · PPTX


Here is a full outline of what's in the deck (20 slides, wide 16:9 format, deep navy/teal/amber palette designed for a medical postgraduate audience):
Slide Structure
#Slide
1Title slide
2Session Outline (10-topic agenda)
3Section divider — Definition & Epidemiology
4Definition (Revised Atlanta 2012 criteria) + 4 key stat boxes (incidence, hospitalisations, mortality)
5Section divider — Etiology
6Etiology — gallstones vs. alcohol (detailed) + 4-category grid (metabolic, drugs, mechanical, infectious)
7Section divider — Pathogenesis
8Pathogenesis — 3 pathways (ductal obstruction / primary acinar injury / defective transport) → SIRS
9Section divider — Clinical Features
10Clinical presentation (symptoms, signs, labs — lipase vs. amylase, CRP, hematocrit)
11Diagnostic workup algorithm (History → Labs → US → CECT → MRI/MRCP → EUS/ERCP)
12Section divider — Severity Scoring
13Revised Atlanta Classification 2012 — mild / moderately severe / severe (3-column cards)
14Ranson's Criteria table + APACHE II / BISAP / CTSI / CRP at 48 h
15Section divider — Imaging
16Imaging modalities (US, CECT, MRI/MRCP, EUS/ERCP — roles, timing, indications)
17CT Severity Index (Balthazar grade + necrosis score) + Atlanta local complications (APFC, ANC, pseudocyst, WON)
18Section divider — Management
19Initial management (fluid resuscitation with LR preferred, analgesia, ICU monitoring)
20Section divider — Nutrition
21Nutrition — mild vs. severe AP; early enteral feeding principle
22Pharmacotherapy — antibiotics (NOT prophylactic), PPIs, octreotide myth, special adjuncts
23Section divider — Complications
24Systemic complications — ARDS, AKI, cardiovascular, metabolic, DIC, infected necrosis
25Step-up approach to infected necrosis (conservative → PCD/endoscopic → VARD → open)
26Gallstone AP specific management (ERCP timing, same-admission cholecystectomy, hypertriglyceridemia)
27Section divider — Follow-up
28Post-discharge management, recurrence prevention, type 3c diabetes, chronic pancreatitis risk
29Clinical pearls summary (8 take-home messages)
30Thank you / Questions
Sources used: Goldman-Cecil Medicine (26e), Sleisenger & Fordtran's GI and Liver Disease, Robbins & Kumar Basic Pathology, Rosen's Emergency Medicine.

It downloading

Great! The file should be downloading now. Once it opens in PowerPoint, you'll have a 30-slide deck ready to present. Feel free to ask if you'd like any slides added, modified, or if you need speaker notes added to any section!

Not downloading

Let me verify the file exists and rebuild it fresh.
Running Command

ls -lh /home/daytona/workspace/acute-pancreatitis-pptx/

The file exists (506 KB). Let me rebuild it so it gets a fresh timestamp, then try the link again:
Running Command

cd /home/daytona/workspace/acute-pancreatitis-pptx && 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.
This is a shared conversation. Sign in to Orris to start your own chat.