attachment
attachment

• SLIDE 3: History of Present Illness • SLIDE 4: Past Medical History • SLIDE 5: Personal and Social History; Family History • SLIDE 6: Physical Examination • SLIDE 7: Primary Impression/Diagnosis • SLIDE 8-9: Differential Diagnosis (Give at least 3) • SLIDE 10: Interpretation of results (Lab and Imaging studies given in the case) • SLIDE 11: Final Impression/Diagnosis • CASE DICUSSION o SLIDE 12-13: Brief Anatomy and Physiology o SLIDE 14-15: Definition of Disease and Pathophysiology (including etiology and risk factors) o SLIDE 16: Diagnostics (Ideal Laboratory and Imaging studies) o SLIDE 17-23: Management ▪ Pre-operative management (when applicable) ▪ Neoadjuvant treatment (when applicable) ▪ Surgical Treatment (including descriptions of surgical procedure) ▪ Post-operative Complications and Management ▪ Adjuvant Therapy and Surveillance (when applicable) • SLIDE 24-25: Case Resolution o Complete management plan for the patient.. Give me very detailed explained with images according to this case for the above question for a surgery in reference to schwarts surgery... give me fast

Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Searching Images

appendix carcinoid neuroendocrine tumor histology chromogranin synaptophysin

Finding Sources
Finding Sources
Searching Images

appendix anatomy location cecum ileocecal valve diagram

Searching Images

right hemicolectomy surgical procedure appendiceal tumor

Searching Images

octreotide somatostatin analogue neuroendocrine tumor treatment

Searching Images

appendix cross section anatomy wall layers

Running Command

ls -la /home/daytona/workspace/ && mkdir -p /home/daytona/workspace/appendix-net…

Writing File

~/appendix-net-pptx/build.js

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

// ─── Fetch images as base64 ───────────────────────────────────────────────────
const imageUrls = [
  "https://cdn.orris.care/cdss_images/Pathology_1760053241942_9fa64fcf-524d-4cd7-925f-63b598c09747.jpg", // histology H&E invasive carcinoid
  "https://cdn.orris.care/cdss_images/Pathology_1760053240654_cde07258-91e6-4931-b6a1-82f801a84284.jpg", // histology salt & pepper
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_9cedb50f8730122ce549e52bdc63417c77ee338fe39704f8f525d1ef04b0771b.jpg", // right hemi specimen
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_759596e8b4c6da858173ac1c16a3564393788d365bc06ef2f66186a5ac9bfbdb.jpg", // gross surgical specimen
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_51db9bd32402ce0eb8f076e4f39102c5100cd892df5b5ca1c840c7d29721201a.jpg", // OctreoScan NET
  "https://cdn.orris.care/cdss_images/Pathology_1760053192131_30e17101-430e-408c-9f9d-44be1fe5452b.jpg", // appendix cross section
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_1e7c482eb7f3ef5a942606cb344597c4070ac76a6c10c327f79847e945a2208f.jpg", // ileocecal anatomy
];

console.log("Fetching images...");
let imgs = [];
try {
  const raw = execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`,
    { maxBuffer: 50 * 1024 * 1024 }
  ).toString();
  imgs = JSON.parse(raw);
} catch(e) {
  console.error("Image fetch error:", e.message);
  imgs = imageUrls.map(u => ({ url: u, base64: null, error: e.message }));
}
console.log("Images fetched:", imgs.map(i => i.error ? "ERR" : "OK"));

// ─── Color palette ────────────────────────────────────────────────────────────
const NAVY   = "0D2B55";   // dominant dark
const TEAL   = "147B8C";   // secondary
const GOLD   = "E8A020";   // accent
const WHITE  = "FFFFFF";
const LTGRAY = "F0F4F8";
const MGRAY  = "7B8EA0";
const RED    = "C0392B";
const GREEN  = "1A7A4A";

// ─── Helpers ──────────────────────────────────────────────────────────────────
function addSlide(pres) { return pres.addSlide(); }

function slideBG(slide, color) {
  slide.background = { color: color || NAVY };
}

function addHeaderBar(slide, title, subtitle) {
  // dark top bar
  slide.addShape("rect", { x: 0, y: 0, w: 13.33, h: 1.1, fill: { color: NAVY }, line: { type: "none" } });
  slide.addShape("rect", { x: 0, y: 1.1, w: 13.33, h: 0.06, fill: { color: GOLD }, line: { type: "none" } });
  slide.addText(title, { x: 0.35, y: 0.08, w: 12.6, h: 0.7, fontSize: 26, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
  if (subtitle) {
    slide.addText(subtitle, { x: 0.35, y: 0.75, w: 12.6, h: 0.32, fontSize: 13, color: GOLD, fontFace: "Calibri", margin: 0 });
  }
}

function addSlideNum(slide, num) {
  slide.addText(`${num}`, { x: 12.8, y: 5.3, w: 0.4, h: 0.3, fontSize: 10, color: MGRAY, align: "right", margin: 0 });
}

function bullet(text, sub) {
  const arr = [{ text: text, options: { bullet: { indent: 15 }, breakLine: true, fontSize: 14, color: NAVY, fontFace: "Calibri" } }];
  if (sub) sub.forEach(s => arr.push({ text: s, options: { bullet: { indent: 30 }, breakLine: true, fontSize: 12, color: MGRAY, fontFace: "Calibri" } }));
  return arr;
}

function addImageSafe(slide, imgObj, x, y, w, h) {
  if (imgObj && imgObj.base64 && !imgObj.error) {
    slide.addImage({ data: imgObj.base64, x, y, w, h });
  }
}

// ─── PRESENTATION ─────────────────────────────────────────────────────────────
const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE";
pres.title  = "Appendiceal Neuroendocrine Tumor – Surgical Case Presentation";
pres.author = "Gullas College of Medicine – University of the Visayas";

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE SLIDE
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: NAVY };
  s.addShape("rect", { x: 0, y: 0, w: 0.18, h: 7.5, fill: { color: GOLD }, line: { type: "none" } });
  s.addShape("rect", { x: 0.18, y: 0, w: 13.15, h: 7.5, fill: { color: NAVY }, line: { type: "none" } });
  s.addText("MODULE 6: SMALL INTESTINE AND APPENDIX", {
    x: 0.5, y: 1.2, w: 12, h: 0.5, fontSize: 16, color: GOLD, bold: true, fontFace: "Calibri", charSpacing: 2, margin: 0
  });
  s.addText("Appendiceal Neuroendocrine\nTumor (Carcinoid)", {
    x: 0.5, y: 1.9, w: 12, h: 2.2, fontSize: 42, bold: true, color: WHITE, fontFace: "Calibri", margin: 0
  });
  s.addText("CASE 5 — SURGICAL CASE PRESENTATION", {
    x: 0.5, y: 4.15, w: 12, h: 0.45, fontSize: 18, color: TEAL, fontFace: "Calibri", margin: 0
  });
  s.addShape("line", { x: 0.5, y: 4.7, w: 11, h: 0, line: { color: GOLD, width: 1 } });
  s.addText("Reference: Schwartz's Principles of Surgery, 11th Edition", {
    x: 0.5, y: 4.85, w: 10, h: 0.35, fontSize: 13, color: MGRAY, fontFace: "Calibri", margin: 0
  });
  s.addText("Gullas College of Medicine  •  University of the Visayas", {
    x: 0.5, y: 5.25, w: 10, h: 0.35, fontSize: 13, color: MGRAY, fontFace: "Calibri", margin: 0
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 – CASE OVERVIEW
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "CASE OVERVIEW", "Module 6 – Case 5");
  s.addText([
    { text: "Patient:", options: { bold: true, color: NAVY, fontSize: 15, fontFace: "Calibri", breakLine: false } },
    { text: "  J.C. — 25-year-old Male", options: { color: NAVY, fontSize: 15, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 8 } },
    { text: "Chief Complaint:", options: { bold: true, color: NAVY, fontSize: 15, fontFace: "Calibri", breakLine: false } },
    { text: "  Follow-up visit post Open Appendectomy (1 week prior)", options: { color: NAVY, fontSize: 15, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 8 } },
    { text: "Setting:", options: { bold: true, color: NAVY, fontSize: 15, fontFace: "Calibri", breakLine: false } },
    { text: "  Outpatient clinic follow-up", options: { color: NAVY, fontSize: 15, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 8 } },
    { text: "Key Finding:", options: { bold: true, color: RED, fontSize: 15, fontFace: "Calibri", breakLine: false } },
    { text: "  Final histopathologic result consistent with appendiceal neuroendocrine tumor (carcinoid)", options: { color: NAVY, fontSize: 15, fontFace: "Calibri", breakLine: true } },
  ], { x: 0.5, y: 1.3, w: 12.2, h: 4, valign: "top" });
  // accent box
  s.addShape("rect", { x: 0.5, y: 5.1, w: 12.3, h: 0.65, fill: { color: TEAL }, line: { type: "none" }, rounding: true });
  s.addText("Histopath: 1.8cm firm yellow bulbar mass at appendiceal base  •  Chromogranin A (+)  •  Synaptophysin (+)  •  Salt-and-pepper nucleoli", {
    x: 0.6, y: 5.15, w: 12.1, h: 0.55, fontSize: 12, color: WHITE, fontFace: "Calibri", bold: true, align: "center", margin: 0
  });
  addSlideNum(s, 2);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 – HISTORY OF PRESENT ILLNESS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "HISTORY OF PRESENT ILLNESS", "Slide 3");
  // Left column
  s.addShape("rect", { x: 0.3, y: 1.25, w: 6.0, h: 3.8, fill: { color: WHITE }, line: { color: TEAL, width: 1.5 }, rounding: true });
  s.addText("PRESENTING COMPLAINT", { x: 0.5, y: 1.35, w: 5.6, h: 0.4, fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "• ", options: { bold: true } },
    { text: "25-year-old male presenting for post-operative follow-up", options: { breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "• ", options: { bold: true } },
    { text: "Originally admitted 1 week prior for fever and right lower quadrant (RLQ) pain", options: { breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "• ", options: { bold: true } },
    { text: "Underwent emergency Open Appendectomy for Acute Appendicitis", options: { breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "• ", options: { bold: true } },
    { text: "Follow-up: wound well-coaptated, NO complaints of post-op pain", options: { breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "• ", options: { bold: true } },
    { text: "Patient brought final histopathologic result — unexpected finding of neuroendocrine tumor", options: { breakLine: true } },
  ], { x: 0.55, y: 1.85, w: 5.6, h: 3.1, fontSize: 13, color: NAVY, fontFace: "Calibri", valign: "top", margin: 0 });
  // Right column
  s.addShape("rect", { x: 6.7, y: 1.25, w: 6.0, h: 3.8, fill: { color: WHITE }, line: { color: GOLD, width: 1.5 }, rounding: true });
  s.addText("PERTINENT DETAILS", { x: 6.9, y: 1.35, w: 5.6, h: 0.4, fontSize: 13, bold: true, color: GOLD, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "Onset:", options: { bold: true, color: NAVY, breakLine: false } },
    { text: "  Acute onset fever + RLQ pain", options: { color: NAVY, breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "Duration:", options: { bold: true, color: NAVY, breakLine: false } },
    { text: "  1 week prior to follow-up", options: { color: NAVY, breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "Intervention:", options: { bold: true, color: NAVY, breakLine: false } },
    { text: "  Emergency Open Appendectomy", options: { color: NAVY, breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "Post-op Course:", options: { bold: true, color: NAVY, breakLine: false } },
    { text: "  Uneventful. No pain. Wound intact.", options: { color: NAVY, breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "Incidental Finding:", options: { bold: true, color: RED, breakLine: false } },
    { text: "  Neuroendocrine Tumor (1.8 cm) at appendiceal base confirmed on histopath", options: { color: NAVY, breakLine: true } },
  ], { x: 6.9, y: 1.85, w: 5.6, h: 3.1, fontSize: 13, color: NAVY, fontFace: "Calibri", valign: "top", margin: 0 });
  addSlideNum(s, 3);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 – PAST MEDICAL HISTORY
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "PAST MEDICAL HISTORY", "Slide 4");
  const items = [
    { label: "Surgical History 1", text: "S/P ORIF Plating, Left Humerus (2005)", icon: "🦴", note: "Open Reduction Internal Fixation — left humeral fracture repair, ~20 years ago. No current complications reported." },
    { label: "Surgical History 2", text: "Open Appendectomy (1 week prior)", icon: "⚕️", note: "Emergency procedure for acute appendicitis. Uneventful post-operative course. Wound well-coaptated on follow-up." },
    { label: "Medical Conditions", text: "No known comorbidities reported", icon: "📋", note: "No hypertension, diabetes, cardiac disease, or malignancy prior to this admission." },
    { label: "Medications", text: "None reported", icon: "💊", note: "No current maintenance medications." },
    { label: "Allergies", text: "Not elicited / Not reported", icon: "⚠️", note: "NKDA — No Known Drug Allergies (assumed)." },
  ];
  items.forEach((item, i) => {
    const y = 1.35 + i * 1.0;
    s.addShape("rect", { x: 0.4, y: y, w: 12.5, h: 0.85, fill: { color: i % 2 === 0 ? WHITE : "EBF4F8" }, line: { color: TEAL, width: 0.5 }, rounding: true });
    s.addText(item.label.toUpperCase(), { x: 0.6, y: y + 0.04, w: 3.0, h: 0.3, fontSize: 10, bold: true, color: TEAL, fontFace: "Calibri", margin: 0 });
    s.addText(item.text, { x: 0.6, y: y + 0.34, w: 5.0, h: 0.35, fontSize: 13, bold: true, color: NAVY, fontFace: "Calibri", margin: 0 });
    s.addText(item.note, { x: 6.0, y: y + 0.1, w: 6.7, h: 0.6, fontSize: 12, color: MGRAY, fontFace: "Calibri", valign: "middle", margin: 0 });
  });
  addSlideNum(s, 4);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 – PERSONAL / SOCIAL / FAMILY HISTORY
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "PERSONAL, SOCIAL & FAMILY HISTORY", "Slide 5");
  // Personal & Social
  s.addShape("rect", { x: 0.3, y: 1.25, w: 6.0, h: 4.5, fill: { color: WHITE }, line: { color: TEAL, width: 1.5 }, rounding: true });
  s.addText("PERSONAL & SOCIAL HISTORY", { x: 0.5, y: 1.35, w: 5.6, h: 0.4, fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "Alcohol:", options: { bold: true, color: NAVY, fontSize: 14, fontFace: "Calibri", breakLine: false } },
    { text: "  Occasional alcoholic beverage drinker", options: { color: NAVY, fontSize: 13, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 8 } },
    { text: "Smoking:", options: { bold: true, color: NAVY, fontSize: 14, fontFace: "Calibri", breakLine: false } },
    { text: "  Smoker — 1 pack year", options: { color: NAVY, fontSize: 13, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 8 } },
    { text: "Illicit Drugs:", options: { bold: true, color: NAVY, fontSize: 14, fontFace: "Calibri", breakLine: false } },
    { text: "  Not reported", options: { color: MGRAY, fontSize: 13, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 8 } },
    { text: "Occupation:", options: { bold: true, color: NAVY, fontSize: 14, fontFace: "Calibri", breakLine: false } },
    { text: "  Not elicited", options: { color: MGRAY, fontSize: 13, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 8 } },
    { text: "Diet:", options: { bold: true, color: NAVY, fontSize: 14, fontFace: "Calibri", breakLine: false } },
    { text: "  Not elicited", options: { color: MGRAY, fontSize: 13, fontFace: "Calibri", breakLine: true } },
  ], { x: 0.55, y: 1.85, w: 5.6, h: 3.6, fontSize: 13, color: NAVY, fontFace: "Calibri", valign: "top", margin: 0 });
  // Family
  s.addShape("rect", { x: 6.7, y: 1.25, w: 6.0, h: 4.5, fill: { color: WHITE }, line: { color: GOLD, width: 1.5 }, rounding: true });
  s.addText("FAMILY HISTORY", { x: 6.9, y: 1.35, w: 5.6, h: 0.4, fontSize: 13, bold: true, color: GOLD, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "No reported family history of:", options: { bold: true, color: NAVY, fontSize: 14, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 8 } },
    { text: "• Gastrointestinal malignancy", options: { color: NAVY, fontSize: 13, fontFace: "Calibri", breakLine: true, bullet: false } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "• Neuroendocrine tumors (NET)", options: { color: NAVY, fontSize: 13, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "• Multiple Endocrine Neoplasia (MEN-1, MEN-2)", options: { color: NAVY, fontSize: 13, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "• Cardiovascular or metabolic disease", options: { color: NAVY, fontSize: 13, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 8 } },
    { text: "⚠ Note:", options: { bold: true, color: RED, fontSize: 13, fontFace: "Calibri", breakLine: false } },
    { text: "  MEN-1 association with GI NETs should be inquired — especially given young age of patient", options: { color: NAVY, fontSize: 12, fontFace: "Calibri", breakLine: true } },
  ], { x: 6.9, y: 1.85, w: 5.6, h: 3.6, fontSize: 13, color: NAVY, fontFace: "Calibri", valign: "top", margin: 0 });
  addSlideNum(s, 5);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 – PHYSICAL EXAMINATION
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "PHYSICAL EXAMINATION", "Slide 6");
  // Vital signs bar
  const vitals = [
    { label: "BP", val: "120/80", unit: "mmHg" },
    { label: "HR", val: "80", unit: "bpm" },
    { label: "RR", val: "20", unit: "cpm" },
    { label: "Temp", val: "36.7", unit: "°C" },
    { label: "O₂ Sat", val: "98%", unit: "RA" },
    { label: "Ht", val: "5'6\"", unit: "" },
    { label: "Wt", val: "50", unit: "kg" },
  ];
  vitals.forEach((v, i) => {
    const x = 0.3 + i * 1.85;
    s.addShape("rect", { x, y: 1.25, w: 1.75, h: 0.9, fill: { color: NAVY }, line: { type: "none" }, rounding: true });
    s.addText(v.label, { x, y: 1.28, w: 1.75, h: 0.28, fontSize: 10, color: GOLD, bold: true, align: "center", fontFace: "Calibri", margin: 0 });
    s.addText(v.val, { x, y: 1.55, w: 1.75, h: 0.38, fontSize: 18, bold: true, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
    if (v.unit) s.addText(v.unit, { x, y: 1.93, w: 1.75, h: 0.2, fontSize: 9, color: MGRAY, align: "center", fontFace: "Calibri", margin: 0 });
  });
  // Systems
  const sys = [
    { sys: "HEENT", find: "Anicteric sclerae, trachea midline, no palpable lymph nodes" },
    { sys: "C/L", find: "Clear breath sounds, equal chest expansion, equal tactile fremitus" },
    { sys: "CV", find: "Adynamic precordium, regular rate and rhythm" },
    { sys: "Abdomen", find: "(+) post-op wound at RLQ — well-coaptated, no erythema, no signs of infection" },
    { sys: "Extremities", find: "Strong peripheral pulses, CRT <2 secs, Full ROM all extremities" },
    { sys: "GUT", find: "(−) KPS (Kidney-Punch Sign negative)" },
  ];
  sys.forEach((item, i) => {
    const col = i < 3 ? 0 : 1;
    const row = i % 3;
    const x = 0.3 + col * 6.6;
    const y = 2.35 + row * 0.88;
    s.addShape("rect", { x, y, w: 6.3, h: 0.78, fill: { color: i === 3 ? "FFF3CD" : WHITE }, line: { color: TEAL, width: 0.5 }, rounding: true });
    s.addText(item.sys, { x: x + 0.15, y: y + 0.04, w: 1.6, h: 0.3, fontSize: 11, bold: true, color: TEAL, fontFace: "Calibri", margin: 0 });
    s.addText(item.find, { x: x + 0.15, y: y + 0.32, w: 5.9, h: 0.4, fontSize: 12, color: NAVY, fontFace: "Calibri", margin: 0 });
  });
  addSlideNum(s, 6);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 7 – PRIMARY IMPRESSION / DIAGNOSIS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: NAVY };
  s.addShape("rect", { x: 0, y: 0, w: 13.33, h: 7.5, fill: { color: NAVY }, line: { type: "none" } });
  s.addText("PRIMARY IMPRESSION / DIAGNOSIS", {
    x: 0.5, y: 0.3, w: 12, h: 0.5, fontSize: 16, bold: true, color: GOLD, fontFace: "Calibri", charSpacing: 2, margin: 0
  });
  s.addShape("rect", { x: 1.0, y: 1.0, w: 11.3, h: 2.4, fill: { color: TEAL }, line: { type: "none" }, rounding: true });
  s.addText("Incidental Appendiceal Neuroendocrine\nTumor (Carcinoid) — Well-Differentiated", {
    x: 1.2, y: 1.1, w: 10.9, h: 2.1, fontSize: 34, bold: true, color: WHITE, fontFace: "Calibri", align: "center", valign: "middle", margin: 0
  });
  s.addText("Discovered incidentally on final histopathologic examination of appendectomy specimen\nperformed for acute appendicitis", {
    x: 1.2, y: 3.55, w: 10.9, h: 0.65, fontSize: 15, color: LTGRAY, fontFace: "Calibri", align: "center", margin: 0
  });
  const tags = [
    { t: "Tumor Size: 1.8 cm", c: RED },
    { t: "Chromogranin A (+)", c: GREEN },
    { t: "Synaptophysin (+)", c: GREEN },
    { t: "Salt-and-Pepper Nucleoli", c: TEAL },
    { t: "Nested Pattern", c: TEAL },
  ];
  tags.forEach((tag, i) => {
    s.addShape("rect", { x: 0.5 + i * 2.45, y: 4.4, w: 2.3, h: 0.55, fill: { color: tag.c }, line: { type: "none" }, rounding: true });
    s.addText(tag.t, { x: 0.5 + i * 2.45, y: 4.42, w: 2.3, h: 0.5, fontSize: 10.5, color: WHITE, bold: true, align: "center", fontFace: "Calibri", margin: 0 });
  });
  s.addText("Based on Schwartz's Surgery: Appendiceal NETs (carcinoids) are the most common tumors of the appendix, comprising ~50% of all appendiceal neoplasms. Prognosis is highly favorable for tumors <2 cm without lymphovascular invasion.", {
    x: 0.5, y: 5.2, w: 12.3, h: 0.9, fontSize: 12, color: MGRAY, fontFace: "Calibri", italic: true, margin: 0
  });
  s.addText("Slide 7", { x: 12.8, y: 7.1, w: 0.4, h: 0.3, fontSize: 10, color: MGRAY, align: "right", margin: 0 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 8 – DIFFERENTIAL DIAGNOSIS (Part 1)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "DIFFERENTIAL DIAGNOSIS", "Slide 8 of 2");
  const diffs = [
    {
      num: "01", dx: "Acute Appendicitis (Uncomplicated)",
      for: "RLQ pain, fever, leukocytosis, RLQ wound noted post-op.",
      against: "Histopath ruled out pure inflammation — neuroendocrine nests confirmed.",
      color: RED,
    },
    {
      num: "02", dx: "Appendiceal Mucinous Adenocarcinoma",
      for: "Appendiceal mass/tumor, abdominal pain, can present incidentally.",
      against: "Histology shows glands/mucin, not nested neuroendocrine pattern; CgA and SYP negative.",
      color: TEAL,
    },
    {
      num: "03", dx: "Goblet Cell Carcinoid (Adenoneuroendocrine Carcinoma)",
      for: "Appendiceal lesion with neuroendocrine features and glandular elements.",
      against: "Goblet cell carcinoid shows goblet/signet cells; IHC profile differs from pure NET here.",
      color: GOLD,
    },
  ];
  diffs.forEach((d, i) => {
    const y = 1.3 + i * 1.9;
    s.addShape("rect", { x: 0.3, y, w: 12.7, h: 1.75, fill: { color: WHITE }, line: { color: d.color, width: 2 }, rounding: true });
    s.addShape("rect", { x: 0.3, y, w: 0.8, h: 1.75, fill: { color: d.color }, line: { type: "none" }, rounding: true });
    s.addText(d.num, { x: 0.3, y: y + 0.55, w: 0.8, h: 0.65, fontSize: 18, bold: true, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
    s.addText(d.dx, { x: 1.25, y: y + 0.08, w: 11.5, h: 0.45, fontSize: 15, bold: true, color: d.color, fontFace: "Calibri", margin: 0 });
    s.addText([
      { text: "For: ", options: { bold: true, color: GREEN, fontSize: 12, fontFace: "Calibri" } },
      { text: d.for, options: { color: NAVY, fontSize: 12, fontFace: "Calibri", breakLine: true } },
      { text: "Against: ", options: { bold: true, color: RED, fontSize: 12, fontFace: "Calibri" } },
      { text: d.against, options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    ], { x: 1.25, y: y + 0.58, w: 11.5, h: 1.0, valign: "top", margin: 0 });
  });
  addSlideNum(s, 8);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 9 – DIFFERENTIAL DIAGNOSIS (Part 2)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "DIFFERENTIAL DIAGNOSIS (CONTINUED)", "Slide 9 of 2");
  const diffs2 = [
    {
      num: "04", dx: "Appendiceal Adenocarcinoma (Colonic Type)",
      for: "Appendiceal mass, incidental finding, affects males.",
      against: "Forms tubular glands, mucin; no neuroendocrine IHC staining pattern.",
      color: "7B2FBE",
    },
    {
      num: "05", dx: "Crohn's Disease of the Appendix",
      for: "Young male, RLQ pain, inflammatory changes on gross specimen.",
      against: "No transmural granulomatous inflammation or skip lesions on histology.",
      color: "0A7A5A",
    },
    {
      num: "06", dx: "Carcinoid Syndrome (metastatic NET)",
      for: "NET confirmed, chromogranin A and synaptophysin positive.",
      against: "Tumor <2 cm, no diarrhea/flushing/bronchoconstriction; likely localized disease.",
      color: "C0392B",
    },
  ];
  diffs2.forEach((d, i) => {
    const y = 1.3 + i * 1.9;
    s.addShape("rect", { x: 0.3, y, w: 12.7, h: 1.75, fill: { color: WHITE }, line: { color: d.color, width: 2 }, rounding: true });
    s.addShape("rect", { x: 0.3, y, w: 0.8, h: 1.75, fill: { color: d.color }, line: { type: "none" }, rounding: true });
    s.addText(d.num, { x: 0.3, y: y + 0.55, w: 0.8, h: 0.65, fontSize: 18, bold: true, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
    s.addText(d.dx, { x: 1.25, y: y + 0.08, w: 11.5, h: 0.45, fontSize: 15, bold: true, color: d.color, fontFace: "Calibri", margin: 0 });
    s.addText([
      { text: "For: ", options: { bold: true, color: GREEN, fontSize: 12, fontFace: "Calibri" } },
      { text: d.for, options: { color: NAVY, fontSize: 12, fontFace: "Calibri", breakLine: true } },
      { text: "Against: ", options: { bold: true, color: RED, fontSize: 12, fontFace: "Calibri" } },
      { text: d.against, options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    ], { x: 1.25, y: y + 0.58, w: 11.5, h: 1.0, valign: "top", margin: 0 });
  });
  addSlideNum(s, 9);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 10 – INTERPRETATION OF RESULTS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "INTERPRETATION OF RESULTS", "Lab & Imaging Studies — Slide 10");
  // Histopath images
  addImageSafe(s, imgs[0], 0.35, 1.3, 4.0, 3.0);
  addImageSafe(s, imgs[1], 4.55, 1.3, 4.0, 3.0);
  s.addText("H&E: Nested neuroendocrine cells,\nsalt-and-pepper chromatin, low mitosis", { x: 0.35, y: 4.35, w: 4.0, h: 0.5, fontSize: 10, color: NAVY, fontFace: "Calibri", align: "center", italic: true, margin: 0 });
  s.addText("IHC: Diffuse positivity for\nChromogranin A and Synaptophysin", { x: 4.55, y: 4.35, w: 4.0, h: 0.5, fontSize: 10, color: NAVY, fontFace: "Calibri", align: "center", italic: true, margin: 0 });
  // Interpretation box
  s.addShape("rect", { x: 8.9, y: 1.3, w: 4.1, h: 5.5, fill: { color: NAVY }, line: { type: "none" }, rounding: true });
  s.addText("HISTOPATH INTERPRETATION", { x: 9.1, y: 1.4, w: 3.7, h: 0.4, fontSize: 12, bold: true, color: GOLD, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "Gross:", options: { bold: true, color: GOLD, fontSize: 12, fontFace: "Calibri", breakLine: false } },
    { text: " Appendix 90×7mm, inflamed with fat stranding. 1.8 cm firm, yellow, bulbar mass at base.", options: { color: WHITE, fontSize: 11, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "Micro:", options: { bold: true, color: GOLD, fontSize: 12, fontFace: "Calibri", breakLine: false } },
    { text: " 2.8 cm lesion, submucosal, nodular, characteristic nested pattern.", options: { color: WHITE, fontSize: 11, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "Cells:", options: { bold: true, color: GOLD, fontSize: 12, fontFace: "Calibri", breakLine: false } },
    { text: " Small, uniform, round nuclei, central nucleoli, salt-and-pepper chromatin.", options: { color: WHITE, fontSize: 11, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "IHC:", options: { bold: true, color: GOLD, fontSize: 12, fontFace: "Calibri", breakLine: false } },
    { text: " Chromogranin A (+), Synaptophysin (+) — diffuse positivity confirming neuroendocrine differentiation.", options: { color: WHITE, fontSize: 11, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 6 } },
    { text: "Conclusion:", options: { bold: true, color: TEAL, fontSize: 12, fontFace: "Calibri", breakLine: false } },
    { text: " Well-differentiated neuroendocrine tumor (NET G1), appendiceal origin.", options: { color: WHITE, fontSize: 11, fontFace: "Calibri", breakLine: true } },
  ], { x: 9.1, y: 1.9, w: 3.7, h: 4.6, valign: "top", margin: 0 });
  addSlideNum(s, 10);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 11 – FINAL IMPRESSION / DIAGNOSIS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: NAVY };
  s.addText("FINAL IMPRESSION / DIAGNOSIS", {
    x: 0.5, y: 0.3, w: 12, h: 0.5, fontSize: 16, bold: true, color: GOLD, fontFace: "Calibri", charSpacing: 2, margin: 0
  });
  s.addShape("rect", { x: 0.5, y: 1.0, w: 12.3, h: 2.0, fill: { color: TEAL }, line: { type: "none" }, rounding: true });
  s.addText("Appendiceal Well-Differentiated\nNeuroendocrine Tumor (NET G1) — Carcinoid", {
    x: 0.7, y: 1.05, w: 11.9, h: 1.85, fontSize: 32, bold: true, color: WHITE, fontFace: "Calibri", align: "center", valign: "middle", margin: 0
  });
  // 2 columns of key points
  const left = [
    "• Tumor size: 1.8 cm at appendiceal base",
    "• Microscopic: 2.8 cm submucosal, nested pattern",
    "• Low mitotic index (G1 per WHO 2022)",
    "• Appendix 90 mm, inflamed, fat stranding",
  ];
  const right = [
    "• Chromogranin A: Diffuse Positive (+)",
    "• Synaptophysin: Diffuse Positive (+)",
    "• Salt-and-pepper chromatin pattern",
    "• No reported distant metastasis",
  ];
  left.forEach((item, i) => {
    s.addText(item, { x: 0.5, y: 3.2 + i * 0.52, w: 6.0, h: 0.48, fontSize: 13, color: WHITE, fontFace: "Calibri", margin: 0 });
  });
  right.forEach((item, i) => {
    s.addText(item, { x: 6.9, y: 3.2 + i * 0.52, w: 6.0, h: 0.48, fontSize: 13, color: GOLD, fontFace: "Calibri", margin: 0 });
  });
  s.addShape("rect", { x: 0.5, y: 5.55, w: 12.3, h: 0.7, fill: { color: "1A1A2E" }, line: { type: "none" }, rounding: true });
  s.addText("WHO 2022 Classification: NET G1 — Ki-67 <3%, Mitoses <2/10 HPF | AJCC/ENETS Staging Required | Schwartz's Surgery, 11th Ed.", {
    x: 0.7, y: 5.6, w: 11.9, h: 0.6, fontSize: 11, color: MGRAY, fontFace: "Calibri", align: "center", italic: true, margin: 0
  });
  s.addText("Slide 11", { x: 12.8, y: 7.1, w: 0.4, h: 0.3, fontSize: 10, color: MGRAY, align: "right", margin: 0 });
}

// ══════════════════════════════════════════════════════════════════════════════
// CASE DISCUSSION DIVIDER
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: TEAL };
  s.addText("CASE DISCUSSION", {
    x: 1, y: 2.5, w: 11.33, h: 1.5, fontSize: 56, bold: true, color: WHITE, fontFace: "Calibri", align: "center", valign: "middle", charSpacing: 4, margin: 0
  });
  s.addText("Anatomy • Physiology • Pathophysiology • Diagnostics • Management", {
    x: 1, y: 4.1, w: 11.33, h: 0.5, fontSize: 16, color: WHITE, fontFace: "Calibri", align: "center", margin: 0
  });
  s.addShape("line", { x: 2, y: 4.75, w: 9.33, h: 0, line: { color: WHITE, width: 1 } });
  s.addText("Slides 12–25", { x: 1, y: 4.9, w: 11.33, h: 0.4, fontSize: 14, color: "D0EEF2", fontFace: "Calibri", align: "center", margin: 0 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 12 – ANATOMY & PHYSIOLOGY (Part 1)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "BRIEF ANATOMY OF THE APPENDIX", "Slide 12");
  // Image
  addImageSafe(s, imgs[5], 0.35, 1.3, 4.5, 3.8);
  // Text
  s.addShape("rect", { x: 5.2, y: 1.3, w: 7.8, h: 3.8, fill: { color: WHITE }, line: { color: TEAL, width: 1.5 }, rounding: true });
  s.addText("Anatomy of the Vermiform Appendix", { x: 5.4, y: 1.4, w: 7.4, h: 0.38, fontSize: 14, bold: true, color: TEAL, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "Location: ", options: { bold: true, color: NAVY, fontSize: 13, fontFace: "Calibri" } },
    { text: "Posteromedial wall of cecum, 2.5 cm below ileocecal valve (McBurney's point in RLQ)\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Length: ", options: { bold: true, color: NAVY, fontSize: 13, fontFace: "Calibri" } },
    { text: "Average 8–10 cm (range 2–20 cm)\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Diameter: ", options: { bold: true, color: NAVY, fontSize: 13, fontFace: "Calibri" } },
    { text: "6–8 mm external; lumen 1–2 mm\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Blood Supply: ", options: { bold: true, color: NAVY, fontSize: 13, fontFace: "Calibri" } },
    { text: "Appendicular artery (branch of ileocolic artery from SMA)\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Lymphatics: ", options: { bold: true, color: NAVY, fontSize: 13, fontFace: "Calibri" } },
    { text: "Drain to ileocolic and right colic lymph nodes\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Wall Layers: ", options: { bold: true, color: NAVY, fontSize: 13, fontFace: "Calibri" } },
    { text: "Mucosa → Submucosa → Muscularis propria (inner circular, outer longitudinal) → Serosa", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
  ], { x: 5.4, y: 1.85, w: 7.4, h: 3.0, valign: "top", margin: 0 });
  // Bottom bar
  s.addShape("rect", { x: 0.3, y: 5.25, w: 12.7, h: 0.9, fill: { color: NAVY }, line: { type: "none" }, rounding: true });
  s.addText("Positions: Retrocecal (most common 65%) | Pelvic | Pre-ileal | Paracolic | Retroileal  |  All three taeniae coli converge at appendiceal base — surgical landmark", {
    x: 0.5, y: 5.3, w: 12.3, h: 0.8, fontSize: 11, color: WHITE, fontFace: "Calibri", align: "center", margin: 0
  });
  addSlideNum(s, 12);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 13 – ANATOMY & PHYSIOLOGY (Part 2)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "PHYSIOLOGY OF THE APPENDIX & NEUROENDOCRINE CELLS", "Slide 13");
  const boxes = [
    {
      title: "Immunologic Function",
      body: "Contains abundant lymphoid tissue (gut-associated lymphoid tissue, GALT). Produces immunoglobulin A (IgA) and serves as a reservoir of commensal bacteria. Proposed role in maintaining gut microbiome.",
      color: TEAL,
    },
    {
      title: "Enterochromaffin (EC) Cells",
      body: "Neuroendocrine cells in the appendiceal mucosa are the origin of NETs/carcinoids. EC cells produce serotonin (5-HT), substance P, and other bioactive peptides in response to luminal stimuli.",
      color: GOLD,
    },
    {
      title: "Secretory Role",
      body: "EC cells secrete serotonin via the portal circulation. In localized tumors, liver detoxifies serotonin — carcinoid syndrome requires metastatic hepatic disease or extra-hepatic spread.",
      color: NAVY,
    },
    {
      title: "Somatostatin Receptors",
      body: "Appendiceal NETs overexpress somatostatin receptors (SSTR2 > SSTR5). Basis for OctreoScan (In-111 pentetreotide) localization and somatostatin analog therapy (octreotide/lanreotide).",
      color: "7B2FBE",
    },
  ];
  boxes.forEach((b, i) => {
    const x = 0.3 + (i % 2) * 6.5;
    const y = 1.3 + Math.floor(i / 2) * 2.75;
    s.addShape("rect", { x, y, w: 6.2, h: 2.55, fill: { color: WHITE }, line: { color: b.color, width: 2 }, rounding: true });
    s.addShape("rect", { x, y, w: 6.2, h: 0.48, fill: { color: b.color }, line: { type: "none" }, rounding: true });
    s.addText(b.title, { x: x + 0.15, y: y + 0.06, w: 5.9, h: 0.35, fontSize: 13, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
    s.addText(b.body, { x: x + 0.15, y: y + 0.6, w: 5.9, h: 1.8, fontSize: 12, color: NAVY, fontFace: "Calibri", valign: "top", margin: 0 });
  });
  addSlideNum(s, 13);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 14 – DEFINITION & PATHOPHYSIOLOGY
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "DEFINITION OF DISEASE & PATHOPHYSIOLOGY", "Slide 14");
  s.addShape("rect", { x: 0.3, y: 1.25, w: 12.7, h: 1.1, fill: { color: NAVY }, line: { type: "none" }, rounding: true });
  s.addText("Definition: ", { x: 0.5, y: 1.3, w: 1.6, h: 0.95, fontSize: 14, bold: true, color: GOLD, fontFace: "Calibri", valign: "middle", margin: 0 });
  s.addText("Appendiceal Neuroendocrine Tumors (NETs), formerly known as carcinoids, are well-differentiated neoplasms arising from enterochromaffin (Kulchitsky) cells in the appendiceal mucosa. They are the most common neoplasm of the appendix (~50%), typically well-differentiated (G1), and most present incidentally.", {
    x: 2.0, y: 1.3, w: 10.8, h: 0.95, fontSize: 12, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 0
  });
  // Pathophysiology flow
  s.addText("PATHOPHYSIOLOGIC MECHANISM", { x: 0.3, y: 2.55, w: 12.7, h: 0.38, fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri", margin: 0 });
  const steps = [
    { step: "EC Cell\nActivation", detail: "Enterochromaffin cell mutation/proliferation in appendiceal submucosa" },
    { step: "Neuroendo-\ncrine Nesting", detail: "Tumor cells form characteristic nested/insular or trabecular patterns" },
    { step: "Hormone\nSecretion", detail: "Serotonin, substance P, chromogranin A, synaptophysin secreted" },
    { step: "Local\nGrowth", detail: "Submucosal expansion; may obstruct lumen → acute appendicitis" },
    { step: "Metastasis\nPotential", detail: "Correlated with size: <1 cm <2%, 1–2 cm ~2%, >2 cm ~30% lymph node spread" },
  ];
  steps.forEach((st, i) => {
    const x = 0.3 + i * 2.55;
    s.addShape("rect", { x, y: 3.05, w: 2.35, h: 1.5, fill: { color: i === 3 ? "FFF3CD" : WHITE }, line: { color: TEAL, width: 1 }, rounding: true });
    s.addText(st.step, { x, y: 3.08, w: 2.35, h: 0.5, fontSize: 12, bold: true, color: NAVY, align: "center", fontFace: "Calibri", margin: 0 });
    s.addText(st.detail, { x, y: 3.62, w: 2.35, h: 0.85, fontSize: 10, color: MGRAY, align: "center", fontFace: "Calibri", margin: 0 });
    if (i < 4) {
      s.addShape("line", { x: x + 2.35, y: 3.8, w: 0.2, h: 0, line: { color: TEAL, width: 2 } });
    }
  });
  // Carcinoid syndrome
  s.addShape("rect", { x: 0.3, y: 4.75, w: 12.7, h: 1.55, fill: { color: "FFF3CD" }, line: { color: GOLD, width: 1.5 }, rounding: true });
  s.addText("Carcinoid Syndrome (Metastatic Disease):", { x: 0.5, y: 4.85, w: 5.0, h: 0.38, fontSize: 13, bold: true, color: RED, fontFace: "Calibri", margin: 0 });
  s.addText("Occurs when hepatic metastases bypass first-pass serotonin metabolism. Characterized by flushing, secretory diarrhea, bronchoconstriction, and right-sided cardiac valvular disease (tricuspid/pulmonary). ABSENT in this patient — tumor is localized.", {
    x: 0.5, y: 5.28, w: 12.3, h: 0.85, fontSize: 12, color: NAVY, fontFace: "Calibri", margin: 0
  });
  addSlideNum(s, 14);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 15 – ETIOLOGY & RISK FACTORS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "ETIOLOGY & RISK FACTORS", "Slide 15");
  // Histology image
  addImageSafe(s, imgs[1], 0.3, 1.3, 4.5, 4.2);
  // Right panel
  s.addShape("rect", { x: 5.1, y: 1.3, w: 7.9, h: 4.2, fill: { color: WHITE }, line: { color: TEAL, width: 1 }, rounding: true });
  s.addText("ETIOLOGY", { x: 5.3, y: 1.4, w: 7.5, h: 0.35, fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "• ", options: { bold: true } }, { text: "Sporadic mutation of enterochromaffin (Kulchitsky) cells\n", options: { breakLine: true } },
    { text: "• ", options: { bold: true } }, { text: "Loss of heterozygosity at chromosome 11q (MEN-1 locus) in rare cases\n", options: { breakLine: true } },
    { text: "• ", options: { bold: true } }, { text: "Associated with MEN-1 syndrome (uncommon for appendiceal NETs)\n", options: { breakLine: true } },
    { text: "• ", options: { bold: true } }, { text: "No clear association with diet, alcohol, or smoking (unlike GI adenocarcinoma)\n", options: { breakLine: true } },
  ], { x: 5.3, y: 1.85, w: 7.5, h: 1.3, fontSize: 12, color: NAVY, fontFace: "Calibri", valign: "top", margin: 0 });
  s.addShape("line", { x: 5.3, y: 3.15, w: 7.5, h: 0, line: { color: LTGRAY, width: 1 } });
  s.addText("RISK FACTORS", { x: 5.3, y: 3.25, w: 7.5, h: 0.35, fontSize: 13, bold: true, color: GOLD, fontFace: "Calibri", margin: 0 });
  const rfs = [
    ["Age", "Peak incidence: 40s–50s; but can occur at any age (25 y/o in this case)"],
    ["Sex", "Slight female predominance overall; equal distribution for appendiceal NETs"],
    ["MEN-1", "Multiple Endocrine Neoplasia Type 1 — rare association"],
    ["Neurofibromatosis", "NF-1 predisposes to GI NETs"],
    ["Prior GI Tumors", "History of another GI malignancy slightly increases risk"],
  ];
  rfs.forEach(([label, val], i) => {
    s.addText([
      { text: label + ": ", options: { bold: true, color: GOLD, fontSize: 12, fontFace: "Calibri" } },
      { text: val, options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    ], { x: 5.3, y: 3.65 + i * 0.47, w: 7.5, h: 0.42, margin: 0 });
  });
  addSlideNum(s, 15);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 16 – DIAGNOSTICS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "DIAGNOSTICS — IDEAL LABORATORY & IMAGING STUDIES", "Slide 16");
  // OctreoScan image
  addImageSafe(s, imgs[4], 9.0, 1.3, 4.0, 4.2);
  // Lab section
  s.addShape("rect", { x: 0.3, y: 1.3, w: 8.5, h: 2.1, fill: { color: WHITE }, line: { color: TEAL, width: 1.5 }, rounding: true });
  s.addText("LABORATORY STUDIES", { x: 0.5, y: 1.38, w: 8.0, h: 0.35, fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri", margin: 0 });
  const labs = [
    ["Serum Chromogranin A (CgA)", "Most sensitive serum marker for NET; correlates with tumor burden"],
    ["24-hr Urine 5-HIAA", "Serotonin metabolite; elevated in carcinoid syndrome (NOT present here)"],
    ["Serum Serotonin", "Elevated in functional NETs with systemic secretion"],
    ["CBC, BMP, LFTs", "Baseline; detect anemia, hepatic metastases, metabolic derangements"],
    ["Ki-67 Proliferation Index", "Grading: G1 <3%, G2 3–20%, G3 >20% (WHO 2022)"],
  ];
  labs.forEach(([label, detail], i) => {
    s.addText([
      { text: "• " + label + ": ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
      { text: detail, options: { color: MGRAY, fontSize: 12, fontFace: "Calibri" } },
    ], { x: 0.5, y: 1.8 + i * 0.3, w: 8.1, h: 0.28, margin: 0 });
  });
  // Imaging section
  s.addShape("rect", { x: 0.3, y: 3.55, w: 8.5, h: 2.3, fill: { color: WHITE }, line: { color: GOLD, width: 1.5 }, rounding: true });
  s.addText("IMAGING STUDIES", { x: 0.5, y: 3.63, w: 8.0, h: 0.35, fontSize: 13, bold: true, color: GOLD, fontFace: "Calibri", margin: 0 });
  const imgs_list = [
    ["CT Abdomen/Pelvis (triple phase)", "Detect primary tumor, lymph node involvement, liver mets"],
    ["MRI Abdomen", "Superior for liver metastasis characterization"],
    ["Somatostatin Receptor Scintigraphy (OctreoScan)", "68Ga-DOTATATE PET/CT — highest sensitivity for SSTR-positive NETs"],
    ["68Ga-DOTATATE PET/CT", "Preferred over OctreoScan — sensitivity >90% for well-differentiated NETs"],
    ["Chest CT", "Exclude pulmonary metastases in advanced disease"],
  ];
  imgs_list.forEach(([label, detail], i) => {
    s.addText([
      { text: "• " + label + ": ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
      { text: detail, options: { color: MGRAY, fontSize: 12, fontFace: "Calibri" } },
    ], { x: 0.5, y: 4.05 + i * 0.33, w: 8.1, h: 0.3, margin: 0 });
  });
  s.addText("OctreoScan/68Ga-DOTATATE PET/CT (shown right): functional imaging for somatostatin-receptor positive NETs", {
    x: 9.0, y: 5.55, w: 4.0, h: 0.5, fontSize: 10, color: MGRAY, fontFace: "Calibri", italic: true, align: "center", margin: 0
  });
  addSlideNum(s, 16);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 17 – MANAGEMENT OVERVIEW
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: NAVY };
  s.addText("MANAGEMENT", { x: 0.5, y: 0.3, w: 12, h: 0.5, fontSize: 16, bold: true, color: GOLD, fontFace: "Calibri", charSpacing: 2, margin: 0 });
  s.addText("Schwartz's Surgery Framework", { x: 0.5, y: 0.75, w: 12, h: 0.38, fontSize: 14, color: TEAL, fontFace: "Calibri", margin: 0 });
  const mgmt = [
    { num: "01", title: "Pre-operative Management", sub: "Assessment, imaging, biochemical markers, anesthesia evaluation", slide: "18" },
    { num: "02", title: "Surgical Treatment", sub: "Appendectomy vs. Right Hemicolectomy — size-dependent decision", slide: "19-20" },
    { num: "03", title: "Post-operative Complications", sub: "Wound infection, ileus, fistula, leak — monitoring and management", slide: "21" },
    { num: "04", title: "Adjuvant Therapy", sub: "Somatostatin analogs, PRRT, chemotherapy (for advanced disease)", slide: "22" },
    { num: "05", title: "Surveillance", sub: "CgA levels, imaging protocol, follow-up schedule", slide: "23" },
  ];
  mgmt.forEach((m, i) => {
    const y = 1.3 + i * 1.15;
    s.addShape("rect", { x: 0.4, y, w: 12.5, h: 1.0, fill: { color: "112244" }, line: { color: TEAL, width: 1 }, rounding: true });
    s.addShape("rect", { x: 0.4, y, w: 0.9, h: 1.0, fill: { color: TEAL }, line: { type: "none" }, rounding: true });
    s.addText(m.num, { x: 0.4, y: y + 0.3, w: 0.9, h: 0.4, fontSize: 16, bold: true, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
    s.addText(m.title, { x: 1.5, y: y + 0.05, w: 9.0, h: 0.42, fontSize: 15, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
    s.addText(m.sub, { x: 1.5, y: y + 0.5, w: 9.0, h: 0.4, fontSize: 12, color: MGRAY, fontFace: "Calibri", margin: 0 });
    s.addText(`Slide ${m.slide}`, { x: 11.4, y: y + 0.3, w: 1.2, h: 0.38, fontSize: 12, color: GOLD, bold: true, align: "right", fontFace: "Calibri", margin: 0 });
  });
  s.addText("Slide 17", { x: 12.8, y: 7.1, w: 0.4, h: 0.3, fontSize: 10, color: MGRAY, align: "right", margin: 0 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 18 – PRE-OPERATIVE MANAGEMENT
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "PRE-OPERATIVE MANAGEMENT", "Slide 18");
  const preop = [
    {
      cat: "History & Physical",
      items: ["Full review of appendectomy op note and pathology report", "Screen for carcinoid syndrome: flushing, diarrhea, bronchoconstriction, wheezing", "Assess nutritional status and BMI (50 kg, 5'6\" — BMI ~17.8 — low normal)"],
    },
    {
      cat: "Biochemical Workup",
      items: ["Serum Chromogranin A (CgA) — tumor marker baseline", "24-hour urine 5-HIAA if carcinoid syndrome suspected", "CBC, CMP, coagulation studies (PT/INR, aPTT)", "LFTs + Liver function to detect metastatic disease"],
    },
    {
      cat: "Imaging & Staging",
      items: ["68Ga-DOTATATE PET/CT or OctreoScan — functional staging", "CT Abdomen/Pelvis with triple-phase contrast — lymph node assessment", "Echocardiogram if carcinoid syndrome present (valvular disease)", "Tumor size >2cm OR positive margins OR lymphovascular invasion → proceed to right hemicolectomy"],
    },
    {
      cat: "Anesthesia & Pre-op Prep",
      items: ["Bowel prep for anticipated right hemicolectomy", "Perioperative octreotide if carcinoid syndrome — prevent carcinoid crisis during induction", "Pre-op antibiotics (cefazolin IV 1g within 60 min of incision)", "DVT prophylaxis — compression stockings + LMWH"],
    },
  ];
  preop.forEach((p, i) => {
    const col = i < 2 ? 0 : 1;
    const row = i % 2;
    const x = 0.3 + col * 6.5;
    const y = 1.3 + row * 2.85;
    s.addShape("rect", { x, y, w: 6.2, h: 2.65, fill: { color: WHITE }, line: { color: TEAL, width: 1.5 }, rounding: true });
    s.addShape("rect", { x, y, w: 6.2, h: 0.45, fill: { color: TEAL }, line: { type: "none" }, rounding: true });
    s.addText(p.cat, { x: x + 0.12, y: y + 0.06, w: 5.9, h: 0.33, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
    const textArr = p.items.flatMap((item, j) => [
      { text: "• " + item, options: { color: NAVY, fontSize: 11.5, fontFace: "Calibri", breakLine: true } },
      ...(j < p.items.length - 1 ? [{ text: " ", options: { fontSize: 4, breakLine: true } }] : []),
    ]);
    s.addText(textArr, { x: x + 0.12, y: y + 0.55, w: 5.9, h: 1.95, valign: "top", margin: 0 });
  });
  addSlideNum(s, 18);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 19 – SURGICAL TREATMENT (Decision Framework)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "SURGICAL TREATMENT — DECISION FRAMEWORK", "Slide 19");
  // Decision tree
  s.addShape("rect", { x: 4.2, y: 1.3, w: 4.9, h: 0.6, fill: { color: NAVY }, line: { type: "none" }, rounding: true });
  s.addText("APPENDICEAL NET — SURGICAL DECISION", { x: 4.2, y: 1.32, w: 4.9, h: 0.55, fontSize: 12, bold: true, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
  // Tumor size box
  s.addShape("rect", { x: 4.9, y: 2.05, w: 3.5, h: 0.7, fill: { color: TEAL }, line: { type: "none" }, rounding: true });
  s.addText("Tumor Size?", { x: 4.9, y: 2.08, w: 3.5, h: 0.62, fontSize: 14, bold: true, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
  // Lines
  s.addShape("line", { x: 6.65, y: 2.75, w: 0, h: 0.4, line: { color: NAVY, width: 2 } });
  s.addShape("line", { x: 3.0, y: 3.15, w: 7.3, h: 0, line: { color: NAVY, width: 2 } });
  s.addShape("line", { x: 3.0, y: 3.15, w: 0, h: 0.5, line: { color: NAVY, width: 2 } });
  s.addShape("line", { x: 6.65, y: 3.15, w: 0, h: 0.5, line: { color: NAVY, width: 2 } });
  s.addShape("line", { x: 10.3, y: 3.15, w: 0, h: 0.5, line: { color: NAVY, width: 2 } });
  // Three branches
  const branches = [
    { label: "< 1 cm", x: 0.4, color: GREEN, box: "Simple Appendectomy\n(already performed)\n\nCurative in >97% of cases.\nNo further surgery required.", boxColor: GREEN },
    { label: "1–2 cm", x: 4.9, color: GOLD, box: "Appendectomy +\nAssess Margins\n\nIf margins clear + no LVI:\nAppendectomy alone sufficient.\nIf positive margins or LVI:\nConsider right hemicolectomy.", boxColor: GOLD },
    { label: "> 2 cm", x: 8.8, color: RED, box: "Right Hemicolectomy\n\nFormal oncologic resection.\n~30% nodal metastasis rate.\nRemove ileocolic/right colic\nlymph nodes (D2 dissection).", boxColor: RED },
  ];
  branches.forEach(b => {
    s.addShape("rect", { x: b.x, y: 3.65, w: 3.6, h: 0.5, fill: { color: b.color }, line: { type: "none" }, rounding: true });
    s.addText(b.label, { x: b.x, y: 3.67, w: 3.6, h: 0.45, fontSize: 13, bold: true, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
    s.addShape("rect", { x: b.x, y: 4.25, w: 3.6, h: 2.2, fill: { color: WHITE }, line: { color: b.boxColor, width: 1.5 }, rounding: true });
    s.addText(b.box, { x: b.x + 0.1, y: 4.35, w: 3.4, h: 2.0, fontSize: 11.5, color: NAVY, fontFace: "Calibri", valign: "top", margin: 0 });
  });
  // THIS PATIENT annotation
  s.addShape("rect", { x: 4.7, y: 6.55, w: 3.9, h: 0.5, fill: { color: GOLD }, line: { type: "none" }, rounding: true });
  s.addText("⬆ THIS PATIENT — 1.8 cm tumor (assess margins)", { x: 4.7, y: 6.58, w: 3.9, h: 0.44, fontSize: 12, bold: true, color: NAVY, align: "center", fontFace: "Calibri", margin: 0 });
  addSlideNum(s, 19);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 20 – SURGICAL PROCEDURE (Open Appendectomy & Right Hemicolectomy)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "SURGICAL PROCEDURE DESCRIPTION", "Slide 20");
  addImageSafe(s, imgs[3], 0.3, 1.3, 4.5, 3.5);
  s.addText("Gross specimen: Right hemicolectomy for appendiceal NET", {
    x: 0.3, y: 4.85, w: 4.5, h: 0.4, fontSize: 10, color: MGRAY, italic: true, fontFace: "Calibri", align: "center", margin: 0
  });
  s.addShape("rect", { x: 5.1, y: 1.3, w: 7.9, h: 5.5, fill: { color: WHITE }, line: { color: TEAL, width: 1 }, rounding: true });
  s.addText("OPEN APPENDECTOMY (Already Performed)", { x: 5.3, y: 1.4, w: 7.5, h: 0.38, fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "1. ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "RLQ incision (McBurney's point); enter peritoneal cavity\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "2. ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Identify cecum + taeniae coli convergence → appendix\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "3. ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Divide mesoappendix → ligate appendicular artery\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "4. ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Crush, clamp, ligate appendiceal base with absorbable suture\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "5. ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Specimen sent to pathology → histopathology reveals NET\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
  ], { x: 5.3, y: 1.85, w: 7.5, h: 1.9, valign: "top", margin: 0 });
  s.addShape("line", { x: 5.3, y: 3.78, w: 7.5, h: 0, line: { color: LTGRAY, width: 1 } });
  s.addText("RIGHT HEMICOLECTOMY (If indicated — tumor ≥2cm or +LVI)", { x: 5.3, y: 3.88, w: 7.5, h: 0.38, fontSize: 13, bold: true, color: RED, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "1. ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Midline laparotomy or right-sided incision\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "2. ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Mobilize right colon (hepatic flexure to terminal ileum)\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "3. ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Divide ileocolic, right colic, and right branch of middle colic vessels at origin\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "4. ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "En-bloc resection: terminal ileum + cecum + ascending colon + hepatic flexure\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "5. ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Ileotransverse anastomosis (side-to-side or end-to-end)\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "6. ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    { text: "Lymph node harvest: minimum 12 nodes per oncologic standard\n", options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
  ], { x: 5.3, y: 4.3, w: 7.5, h: 2.35, valign: "top", margin: 0 });
  addSlideNum(s, 20);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 21 – POST-OPERATIVE COMPLICATIONS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "POST-OPERATIVE COMPLICATIONS & MANAGEMENT", "Slide 21");
  const comps = [
    {
      comp: "Surgical Site Infection (SSI)",
      timing: "Days 3–7",
      mgmt: "Wound care, drainage, antibiotics (cefazolin or piperacillin-tazobactam for polymicrobial). Monitor CBC and CRP.",
      color: RED,
    },
    {
      comp: "Paralytic Ileus",
      timing: "Days 1–5",
      mgmt: "NPO, NGT decompression, IV fluids, ambulation, gum chewing (prokinetic effect). Resume feeds gradually.",
      color: TEAL,
    },
    {
      comp: "Anastomotic Leak (Post-hemicolectomy)",
      timing: "Days 5–10",
      mgmt: "CT abdomen with contrast. If contained: IV antibiotics + percutaneous drain. If free perforation: re-exploration + Hartmann procedure.",
      color: "7B2FBE",
    },
    {
      comp: "Carcinoid Crisis",
      timing: "Intra/post-op",
      mgmt: "IV octreotide 500 mcg bolus → 500 mcg/hr infusion. Avoid catecholamines. Cardiovascular support.",
      color: GOLD,
    },
    {
      comp: "Bleeding / Hematoma",
      timing: "Immediate",
      mgmt: "Monitor Hgb/Hct. If stable: transfuse PRBCs. If unstable: return to OR for hemostasis.",
      color: NAVY,
    },
    {
      comp: "Deep Vein Thrombosis / PE",
      timing: "Days 3–14",
      mgmt: "LMWH prophylaxis (enoxaparin 40 mg SC daily). Early ambulation. If DVT confirmed: therapeutic anticoagulation.",
      color: "C0392B",
    },
  ];
  comps.forEach((c, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.3 + col * 6.5;
    const y = 1.3 + row * 2.0;
    s.addShape("rect", { x, y, w: 6.2, h: 1.85, fill: { color: WHITE }, line: { color: c.color, width: 1.5 }, rounding: true });
    s.addShape("rect", { x, y, w: 6.2, h: 0.42, fill: { color: c.color }, line: { type: "none" }, rounding: true });
    s.addText(c.comp, { x: x + 0.12, y: y + 0.05, w: 4.0, h: 0.32, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
    s.addText(c.timing, { x: x + 4.2, y: y + 0.05, w: 1.8, h: 0.32, fontSize: 11, color: WHITE, align: "right", fontFace: "Calibri", margin: 0 });
    s.addText(c.mgmt, { x: x + 0.12, y: y + 0.5, w: 5.9, h: 1.2, fontSize: 11, color: NAVY, fontFace: "Calibri", valign: "top", margin: 0 });
  });
  addSlideNum(s, 21);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 22 – ADJUVANT THERAPY
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "ADJUVANT THERAPY", "Slide 22");
  // OctreoScan image
  addImageSafe(s, imgs[4], 9.2, 1.3, 3.8, 3.5);
  s.addText("OctreoScan: functional imaging\nfor SSTR-positive NET", { x: 9.2, y: 4.85, w: 3.8, h: 0.45, fontSize: 10, color: MGRAY, italic: true, align: "center", fontFace: "Calibri", margin: 0 });
  const therapies = [
    {
      cat: "Somatostatin Analogs (First-line)",
      color: TEAL,
      items: [
        "Octreotide LAR 20–30 mg IM q4 weeks OR Lanreotide 120 mg SC q4 weeks",
        "Indicated for: metastatic/advanced disease or symptoms",
        "PROMID/CLARINET trials: significant antiproliferative effect in mid/foregut NETs",
        "For this patient (localized, 1.8 cm, NET G1): may NOT be required if R0 resection confirmed",
      ],
    },
    {
      cat: "Peptide Receptor Radionuclide Therapy (PRRT)",
      color: GOLD,
      items: [
        "177Lu-DOTATATE (Lutathera) — for SSTR-positive unresectable/metastatic NET",
        "NETTER-1 trial: significant PFS improvement vs high-dose octreotide",
        "Requires positive 68Ga-DOTATATE PET/CT or OctreoScan",
        "Not indicated for localized appendiceal NET in this case",
      ],
    },
    {
      cat: "mTOR Inhibitors / Targeted Therapy",
      color: NAVY,
      items: [
        "Everolimus (RAD001): for progressive, metastatic pancreatic and GI NETs",
        "RADIANT-4 trial: improved PFS in non-functional GI/lung NETs",
        "Sunitinib: VEGFR inhibitor for pancreatic NETs",
        "Reserved for advanced/progressive disease — NOT applicable here",
      ],
    },
  ];
  therapies.forEach((t, i) => {
    const y = 1.3 + i * 2.1;
    s.addShape("rect", { x: 0.3, y, w: 8.7, h: 1.95, fill: { color: WHITE }, line: { color: t.color, width: 1.5 }, rounding: true });
    s.addShape("rect", { x: 0.3, y, w: 8.7, h: 0.42, fill: { color: t.color }, line: { type: "none" }, rounding: true });
    s.addText(t.cat, { x: 0.5, y: y + 0.05, w: 8.3, h: 0.32, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
    const textArr = t.items.flatMap((item, j) => [
      { text: "• " + item, options: { color: NAVY, fontSize: 11, fontFace: "Calibri", breakLine: true } },
    ]);
    s.addText(textArr, { x: 0.5, y: y + 0.5, w: 8.3, h: 1.35, valign: "top", margin: 0 });
  });
  addSlideNum(s, 22);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 23 – SURVEILLANCE
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "SURVEILLANCE PROTOCOL", "Slide 23");
  s.addShape("rect", { x: 0.3, y: 1.3, w: 12.7, h: 0.65, fill: { color: NAVY }, line: { type: "none" }, rounding: true });
  s.addText("Based on ENETS/NANETS Guidelines & Schwartz's Surgery — Appendiceal NET Surveillance", {
    x: 0.5, y: 1.35, w: 12.3, h: 0.55, fontSize: 13, bold: true, color: WHITE, fontFace: "Calibri", align: "center", margin: 0
  });
  const rows = [
    { period: "Immediate Post-op\n(0–6 weeks)", labs: "CBC, CMP, CgA baseline", imaging: "Wound assessment only", notes: "Tumor <2cm, R0 resection confirmed → no further oncologic surgery needed" },
    { period: "6 Months", labs: "Serum CgA, 24-hr 5-HIAA", imaging: "CT Abdomen/Pelvis", notes: "Establish biochemical and imaging baseline post-appendectomy" },
    { period: "1 Year", labs: "CgA, 5-HIAA, LFTs", imaging: "CT or MRI Abdomen/Pelvis", notes: "68Ga-DOTATATE PET/CT if CgA elevation or symptoms" },
    { period: "Years 2–5", labs: "Annual CgA + 5-HIAA", imaging: "Annual CT/MRI Abdomen", notes: "Extended surveillance for NET G1 given low but persistent metastatic risk" },
    { period: "> 5 Years", labs: "CgA every 1–2 years", imaging: "As clinically indicated", notes: "Discharge from intensive surveillance if negative at 5 years (tumor <1 cm or clear margins)" },
  ];
  const headers = ["Period", "Laboratory", "Imaging", "Clinical Notes"];
  const widths = [2.0, 2.5, 2.8, 5.0];
  const startX = [0.3, 2.35, 4.9, 7.75];
  // Header row
  headers.forEach((h, j) => {
    s.addShape("rect", { x: startX[j], y: 2.05, w: widths[j], h: 0.4, fill: { color: TEAL }, line: { type: "none" } });
    s.addText(h, { x: startX[j] + 0.05, y: 2.07, w: widths[j] - 0.1, h: 0.35, fontSize: 11, bold: true, color: WHITE, fontFace: "Calibri", align: "center", margin: 0 });
  });
  rows.forEach((r, i) => {
    const y = 2.55 + i * 0.82;
    const bg = i % 2 === 0 ? WHITE : "EBF4F8";
    const vals = [r.period, r.labs, r.imaging, r.notes];
    vals.forEach((v, j) => {
      s.addShape("rect", { x: startX[j], y, w: widths[j], h: 0.75, fill: { color: bg }, line: { color: TEAL, width: 0.5 } });
      s.addText(v, { x: startX[j] + 0.05, y: y + 0.04, w: widths[j] - 0.1, h: 0.67, fontSize: 10, color: NAVY, fontFace: "Calibri", valign: "middle", margin: 0 });
    });
  });
  addSlideNum(s, 23);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 24 – CASE RESOLUTION (Part 1)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "CASE RESOLUTION — COMPLETE MANAGEMENT PLAN", "Slide 24");
  // Left: case summary
  s.addShape("rect", { x: 0.3, y: 1.3, w: 5.8, h: 5.5, fill: { color: NAVY }, line: { type: "none" }, rounding: true });
  s.addText("PATIENT SUMMARY", { x: 0.5, y: 1.4, w: 5.4, h: 0.38, fontSize: 13, bold: true, color: GOLD, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "J.C., 25M, post Open Appendectomy\n", options: { color: WHITE, fontSize: 12, fontFace: "Calibri", bold: true, breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 5 } },
    { text: "Final Dx: ", options: { bold: true, color: GOLD, fontSize: 12, fontFace: "Calibri" } },
    { text: "Appendiceal NET G1 (1.8 cm)\nChromogranin A (+), Synaptophysin (+)\n", options: { color: WHITE, fontSize: 12, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 5 } },
    { text: "Vitals: ", options: { bold: true, color: GOLD, fontSize: 12, fontFace: "Calibri" } },
    { text: "Stable. BP 120/80, HR 80\n", options: { color: WHITE, fontSize: 12, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 5 } },
    { text: "Wound: ", options: { bold: true, color: GOLD, fontSize: 12, fontFace: "Calibri" } },
    { text: "Well-coaptated, no erythema, no pain\n", options: { color: WHITE, fontSize: 12, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 5 } },
    { text: "Key Question: ", options: { bold: true, color: TEAL, fontSize: 12, fontFace: "Calibri" } },
    { text: "Is the appendectomy sufficient, or is right hemicolectomy needed?\n", options: { color: WHITE, fontSize: 12, fontFace: "Calibri", breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 5 } },
    { text: "Answer: ", options: { bold: true, color: GOLD, fontSize: 13, fontFace: "Calibri" } },
    { text: "1.8 cm NET G1. Review margins and LVI status:\n• If R0, no LVI → OBSERVE (no further surgery)\n• If margins (+) or LVI → Right Hemicolectomy", options: { color: WHITE, fontSize: 12, fontFace: "Calibri", breakLine: false } },
  ], { x: 0.5, y: 1.85, w: 5.4, h: 4.8, valign: "top", margin: 0 });
  // Right: management steps
  s.addShape("rect", { x: 6.4, y: 1.3, w: 6.6, h: 5.5, fill: { color: WHITE }, line: { color: TEAL, width: 1.5 }, rounding: true });
  s.addText("COMPLETE MANAGEMENT PLAN", { x: 6.6, y: 1.4, w: 6.2, h: 0.38, fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri", margin: 0 });
  const steps = [
    { step: "STEP 1", title: "Biochemical Staging", body: "Order serum CgA and 24-hr urine 5-HIAA. Screen for carcinoid syndrome." },
    { step: "STEP 2", title: "Imaging Staging", body: "CT Abdomen/Pelvis + 68Ga-DOTATATE PET/CT for occult metastases." },
    { step: "STEP 3", title: "Review Pathology", body: "Confirm R0 margins, assess lymphovascular invasion, depth of invasion." },
    { step: "STEP 4", title: "Surgical Decision", body: "If margins clear + no LVI: observation. If margins+ or LVI: right hemicolectomy." },
    { step: "STEP 5", title: "Follow-up Protocol", body: "CgA every 6 months × 2 yrs, then annually. CT/MRI at 6 mo and 1 yr." },
  ];
  steps.forEach((st, i) => {
    const y = 1.85 + i * 0.98;
    s.addText([
      { text: st.step + " — ", options: { bold: true, color: TEAL, fontSize: 12, fontFace: "Calibri" } },
      { text: st.title + ": ", options: { bold: true, color: NAVY, fontSize: 12, fontFace: "Calibri" } },
      { text: st.body, options: { color: NAVY, fontSize: 11.5, fontFace: "Calibri" } },
    ], { x: 6.6, y, w: 6.2, h: 0.85, valign: "middle", margin: 0 });
    if (i < 4) s.addShape("line", { x: 6.6, y: y + 0.9, w: 6.2, h: 0, line: { color: LTGRAY, width: 0.8 } });
  });
  addSlideNum(s, 24);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 25 – CASE RESOLUTION (Part 2 — Prognosis & Key Takeaways)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: LTGRAY };
  addHeaderBar(s, "CASE RESOLUTION — PROGNOSIS & KEY TAKEAWAYS", "Slide 25");
  addImageSafe(s, imgs[2], 0.3, 1.3, 4.5, 3.2);
  s.addText("Appendix + right hemicolectomy specimen\n(for reference — if oncologic resection needed)", {
    x: 0.3, y: 4.55, w: 4.5, h: 0.5, fontSize: 10, color: MGRAY, italic: true, align: "center", fontFace: "Calibri", margin: 0
  });
  // Prognosis box
  s.addShape("rect", { x: 5.1, y: 1.3, w: 7.9, h: 2.0, fill: { color: NAVY }, line: { type: "none" }, rounding: true });
  s.addText("PROGNOSIS", { x: 5.3, y: 1.38, w: 7.5, h: 0.38, fontSize: 13, bold: true, color: GOLD, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "• Tumor 1.8 cm, NET G1: 5-year survival >95% with complete resection\n", options: { color: WHITE, fontSize: 12, fontFace: "Calibri" } },
    { text: "• Tumors <2 cm: lymph node metastasis rate ~2% → appendectomy alone is curative in majority\n", options: { color: WHITE, fontSize: 12, fontFace: "Calibri" } },
    { text: "• Carcinoid syndrome: NOT expected in localized disease (requires hepatic metastases)\n", options: { color: WHITE, fontSize: 12, fontFace: "Calibri" } },
    { text: "• Young age (25 y/o): long surveillance period recommended; excellent overall prognosis", options: { color: GOLD, fontSize: 12, fontFace: "Calibri", bold: true } },
  ], { x: 5.3, y: 1.82, w: 7.5, h: 1.35, valign: "top", margin: 0 });
  // Key takeaways
  s.addShape("rect", { x: 5.1, y: 3.45, w: 7.9, h: 3.35, fill: { color: WHITE }, line: { color: TEAL, width: 1.5 }, rounding: true });
  s.addText("KEY TAKEAWAYS", { x: 5.3, y: 3.55, w: 7.5, h: 0.38, fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri", margin: 0 });
  const kts = [
    "Appendiceal NETs (carcinoids) are the most common appendiceal neoplasm — often found incidentally",
    "Histologic hallmarks: nested pattern, salt-and-pepper chromatin, Chromogranin A (+), Synaptophysin (+)",
    "Size is the dominant prognostic factor: <2 cm → appendectomy curative; ≥2 cm → right hemicolectomy",
    "Margins and lymphovascular invasion guide reoperation decisions in borderline tumors (1–2 cm)",
    "Carcinoid syndrome indicates hepatic metastasis — absent in localized disease",
    "Long-term surveillance with serum CgA and cross-sectional imaging is mandatory",
  ];
  kts.forEach((kt, i) => {
    s.addText([
      { text: `${i + 1}. `, options: { bold: true, color: TEAL, fontSize: 12, fontFace: "Calibri" } },
      { text: kt, options: { color: NAVY, fontSize: 12, fontFace: "Calibri" } },
    ], { x: 5.3, y: 3.98 + i * 0.45, w: 7.5, h: 0.42, margin: 0 });
  });
  addSlideNum(s, 25);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 26 – REFERENCES
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: NAVY };
  s.addText("REFERENCES", { x: 0.5, y: 0.3, w: 12, h: 0.5, fontSize: 18, bold: true, color: GOLD, fontFace: "Calibri", charSpacing: 2, margin: 0 });
  const refs = [
    "1. Schwartz's Principles of Surgery, 11th Edition. Brunicardi FC, et al. McGraw-Hill, 2019.",
    "2. WHO Classification of Tumours: Digestive System Tumours, 5th Edition. IARC Press, 2019.",
    "3. ENETS Consensus Guidelines for Standard of Care in Neuroendocrine Tumors. Neuroendocrinology, 2017.",
    "4. NANETS Consensus Guidelines for the Diagnosis and Management of Neuroendocrine Tumors. Pancreas, 2010.",
    "5. Moertel CG. Karnell LH, et al. Carcinoid tumor of the appendix. N Engl J Med 1987; 317:1699.",
    "6. Pawa N, et al. Appendiceal neuroendocrine tumors — surgical management. Colorectal Dis 2011.",
    "7. Pavel M, et al. ENETS Consensus Guidelines for unresectable and metastatic NETs. Neuroendocrinology 2012.",
    "8. Yao JC, et al. Everolimus for advanced pancreatic neuroendocrine tumors (RADIANT-3). NEJM 2011.",
    "9. Strosberg J, et al. Phase 3 Trial of 177Lu-DOTATATE for Midgut NETs (NETTER-1). NEJM 2017.",
    "10. Kulke MH, et al. NANETS Treatment Guidelines: Well-differentiated neuroendocrine tumors. Pancreas 2010.",
  ];
  refs.forEach((ref, i) => {
    s.addText(ref, { x: 0.5, y: 0.95 + i * 0.56, w: 12.3, h: 0.5, fontSize: 12, color: i === 0 ? WHITE : MGRAY, fontFace: "Calibri", margin: 0 });
  });
  s.addShape("line", { x: 0.5, y: 6.6, w: 12.3, h: 0, line: { color: GOLD, width: 1 } });
  s.addText("Gullas College of Medicine — University of the Visayas  •  Module 6: Small Intestine and Appendix  •  Case 5", {
    x: 0.5, y: 6.7, w: 12.3, h: 0.35, fontSize: 11, color: MGRAY, fontFace: "Calibri", align: "center", italic: true, margin: 0
  });
}

// ─── Write file ───────────────────────────────────────────────────────────────
const outPath = "/home/daytona/workspace/appendix-net-pptx/Appendiceal_NET_Carcinoid_CasePresentation.pptx";
pres.writeFile({ fileName: outPath }).then(() => {
  console.log("SUCCESS: " + outPath);
}).catch(err => {
  console.error("WRITE ERROR:", err);
  process.exit(1);
});
Your credits are exhausted. Your daily credits reset tomorrow, or you can purchase a top-up for more.
This is a shared conversation. Sign in to Orris to start your own chat.