Appendicitis, make ppt.

Reading File
Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Loading Image
Reading File
Reading File
Finding Sources
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/appendicitis-ppt && ls /home/daytona/workspace/…

Writing File

~/appendicitis-ppt/create_ppt.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Acute Appendicitis";
pres.author = "Orris Medical";

// ─── COLOR PALETTE ───────────────────────────────────────────────────────────
const C = {
  darkBg:   "0D1B2A",   // deep navy  (dominates ~65%)
  midBg:    "1B3A5C",   // mid-blue
  accent:   "E84855",   // vivid crimson-red
  accentSoft:"FF8C94",  // soft coral
  light:    "FFFFFF",   // white text
  bodyText: "D0E4F5",   // pale blue-white
  subHead:  "7FBCD2",   // sky blue
  cardBg:   "14304F",   // dark card
  lineColor:"E84855",
  gold:     "F5A623",   // highlight / warning
  greenSafe:"4CAF82",   // safe/good
};

// ─── HELPERS ─────────────────────────────────────────────────────────────────
function addSectionHeader(pres, title, subtitle) {
  let sl = pres.addSlide();
  sl.background = { color: C.darkBg };
  // left accent bar
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.accent } });
  sl.addText(title.toUpperCase(), {
    x: 0.45, y: 2.1, w: 9.3, h: 0.9,
    fontSize: 38, bold: true, color: C.light,
    fontFace: "Calibri", charSpacing: 4
  });
  if (subtitle) {
    sl.addText(subtitle, {
      x: 0.45, y: 3.1, w: 9.3, h: 0.6,
      fontSize: 18, color: C.subHead, fontFace: "Calibri", italic: true
    });
  }
  return sl;
}

function accentLine(sl, x, y, w) {
  sl.addShape("rect", { x, y, w, h: 0.04, fill: { color: C.accent } });
}

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

  // large diagonal decorative block
  sl.addShape("rect", { x: 6.8, y: 0, w: 3.2, h: 5.625, fill: { color: C.midBg } });
  sl.addShape("rect", { x: 7.2, y: 0, w: 0.22, h: 5.625, fill: { color: C.accent } });

  // TITLE
  sl.addText("ACUTE", {
    x: 0.5, y: 1.0, w: 7, h: 0.85,
    fontSize: 56, bold: true, color: C.accent,
    fontFace: "Calibri", charSpacing: 8
  });
  sl.addText("APPENDICITIS", {
    x: 0.5, y: 1.85, w: 7, h: 0.85,
    fontSize: 56, bold: true, color: C.light,
    fontFace: "Calibri", charSpacing: 4
  });

  accentLine(sl, 0.5, 2.85, 5.5);

  sl.addText("Pathophysiology · Diagnosis · Management", {
    x: 0.5, y: 3.0, w: 7, h: 0.5,
    fontSize: 18, color: C.subHead, fontFace: "Calibri", italic: true
  });

  sl.addText([
    { text: "Sources: ", options: { bold: true, color: C.gold } },
    { text: "Fischer's Mastery of Surgery • Tintinalli's Emergency Medicine\nSabiston Textbook of Surgery • Goldman-Cecil Medicine\nBailey & Love's Short Practice of Surgery", options: { color: C.bodyText } }
  ], { x: 0.5, y: 4.3, w: 6.5, h: 1.1, fontSize: 11, fontFace: "Calibri" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 2 — OVERVIEW & EPIDEMIOLOGY
// ═══════════════════════════════════════════════════════════════════
{
  let sl = pres.addSlide();
  sl.background = { color: C.darkBg };

  sl.addText("OVERVIEW & EPIDEMIOLOGY", {
    x: 0.4, y: 0.2, w: 9.2, h: 0.55,
    fontSize: 26, bold: true, color: C.light, fontFace: "Calibri", charSpacing: 2
  });
  accentLine(sl, 0.4, 0.78, 9.2);

  // Stat cards  (3 across)
  const cards = [
    { icon: "🏥", val: "#1", label: "Most common surgical\nemergency worldwide", sub: "" },
    { icon: "📊", val: "8.7% / 6.9%", label: "Lifetime prevalence\nMen / Women", sub: "" },
    { icon: "🎯", val: "10–19 yrs", label: "Peak incidence\nage group", sub: "" },
  ];
  cards.forEach((c, i) => {
    const x = 0.35 + i * 3.2;
    sl.addShape("rect", { x, y: 1.0, w: 2.9, h: 1.65, fill: { color: C.cardBg }, line: { color: C.accent, width: 1.5 } });
    sl.addText(c.icon + "  " + c.val, { x: x+0.12, y: 1.08, w: 2.66, h: 0.55, fontSize: 18, bold: true, color: C.gold, fontFace: "Calibri" });
    sl.addText(c.label, { x: x+0.12, y: 1.65, w: 2.66, h: 0.75, fontSize: 12, color: C.bodyText, fontFace: "Calibri" });
  });

  // Bullet list
  const bullets = [
    "250,000–300,000 appendectomies/year in the US; ~700,000 affected in Europe annually",
    "Lifetime risk: 12% males, 25% females (Tintinalli's — higher in females due to diagnostic uncertainty)",
    "Most common atraumatic abdominal pain requiring surgery in children >1 year old",
    "Most frequent non-obstetric surgical emergency in pregnancy (1 in 1,500 pregnancies)",
    "Gangrenous appendicitis almost always associated with luminal obstruction",
    "Lifetime appendectomy rates higher than true prevalence: 12% men, 23% women",
  ];
  sl.addText(bullets.map((b, i) => ({
    text: b, options: { bullet: { type: "bullet" }, color: C.bodyText, breakLine: i < bullets.length - 1 }
  })), {
    x: 0.4, y: 2.8, w: 9.2, h: 2.6,
    fontSize: 13.5, fontFace: "Calibri", lineSpacingMultiple: 1.25
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 3 — ANATOMY & PATHOPHYSIOLOGY
// ═══════════════════════════════════════════════════════════════════
{
  let sl = pres.addSlide();
  sl.background = { color: C.darkBg };

  sl.addText("PATHOPHYSIOLOGY", {
    x: 0.4, y: 0.2, w: 9.2, h: 0.55,
    fontSize: 26, bold: true, color: C.light, fontFace: "Calibri", charSpacing: 2
  });
  accentLine(sl, 0.4, 0.78, 9.2);

  // Left column — anatomy note
  sl.addText("Anatomy", { x: 0.4, y: 0.95, w: 4.5, h: 0.4, fontSize: 16, bold: true, color: C.accent, fontFace: "Calibri" });
  const anatBullets = [
    "True diverticulum of the cecum (all 3 intestinal layers)",
    "Contains gut-associated lymphoid tissue (GALT) — immunologically active",
    "Lymphoid tissue peaks in children → obstructs lumen via hyperplasia",
    "Appendiceal lumen obliterates with age → lower incidence in elderly",
  ];
  sl.addText(anatBullets.map((b,i) => ({
    text: b, options: { bullet: { type: "bullet" }, color: C.bodyText, breakLine: i < anatBullets.length - 1 }
  })), { x: 0.4, y: 1.38, w: 4.4, h: 1.95, fontSize: 12.5, fontFace: "Calibri", lineSpacingMultiple: 1.3 });

  // Right column — cascade
  sl.addText("Pathophysiology Cascade", { x: 5.1, y: 0.95, w: 4.7, h: 0.4, fontSize: 16, bold: true, color: C.accent, fontFace: "Calibri" });

  const steps = [
    { n: "1", t: "Luminal Obstruction", d: "Fecalith (most common), lymphoid hyperplasia, tumor, parasites" },
    { n: "2", t: "↑ Intraluminal Pressure", d: "Continued mucosal secretion → Law of Laplace: ↑ wall tension → ↓ venous return" },
    { n: "3", t: "Vascular Insufficiency", d: "Venous & lymphatic outflow obstruction → ischemia, bacterial translocation" },
    { n: "4", t: "Transmural Necrosis", d: "Inflammation → necrosis → perforation → abscess or diffuse peritonitis / sepsis" },
  ];
  steps.forEach((s, i) => {
    const y = 1.38 + i * 0.95;
    sl.addShape("rect", { x: 5.1, y, w: 4.7, h: 0.82, fill: { color: C.cardBg }, line: { color: C.midBg, width: 1 } });
    sl.addShape("rect", { x: 5.1, y, w: 0.32, h: 0.82, fill: { color: C.accent } });
    sl.addText(s.n, { x: 5.11, y: y+0.17, w: 0.3, h: 0.4, fontSize: 16, bold: true, color: C.light, fontFace: "Calibri", align: "center" });
    sl.addText(s.t, { x: 5.5, y: y+0.04, w: 4.2, h: 0.3, fontSize: 12.5, bold: true, color: C.subHead, fontFace: "Calibri" });
    sl.addText(s.d, { x: 5.5, y: y+0.37, w: 4.2, h: 0.38, fontSize: 11, color: C.bodyText, fontFace: "Calibri" });
  });

  // Pain migration note
  sl.addShape("rect", { x: 0.4, y: 3.45, w: 4.4, h: 1.95, fill: { color: C.cardBg }, line: { color: C.gold, width: 1.5 } });
  sl.addText("Pain Migration Mechanism", { x: 0.55, y: 3.55, w: 4.1, h: 0.35, fontSize: 13, bold: true, color: C.gold, fontFace: "Calibri" });
  sl.addText([
    { text: "Early: ", options: { bold: true, color: C.accentSoft } },
    { text: "Visceral (T10–T11) → vague periumbilical pain\n", options: { color: C.bodyText } },
    { text: "Late: ", options: { bold: true, color: C.accentSoft } },
    { text: "Parietal peritoneum irritation → RLQ pain at McBurney's point\n(1/3 from ASIS to umbilicus)\n", options: { color: C.bodyText } },
    { text: "Variants: ", options: { bold: true, color: C.accentSoft } },
    { text: "Retrocecal → flank/back pain; Pelvic → groin pain;\nMalrotation → LUQ pain; Pregnancy → RUQ pain", options: { color: C.bodyText } },
  ], { x: 0.55, y: 3.95, w: 4.1, h: 1.35, fontSize: 11.5, fontFace: "Calibri", lineSpacingMultiple: 1.2 });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 4 — CLINICAL FEATURES
// ═══════════════════════════════════════════════════════════════════
{
  let sl = pres.addSlide();
  sl.background = { color: C.darkBg };

  sl.addText("CLINICAL FEATURES", {
    x: 0.4, y: 0.2, w: 9.2, h: 0.55,
    fontSize: 26, bold: true, color: C.light, fontFace: "Calibri", charSpacing: 2
  });
  accentLine(sl, 0.4, 0.78, 9.2);

  // SYMPTOMS column
  sl.addText("Symptoms", { x: 0.4, y: 0.95, w: 4.5, h: 0.38, fontSize: 16, bold: true, color: C.accent, fontFace: "Calibri" });
  const symptoms = [
    ["Periumbilical pain", "migrates to RLQ over hours"],
    ["Anorexia", "common but not universal"],
    ["Nausea/vomiting", "follows onset of pain"],
    ["Low-grade fever", "subjective or objective"],
    ["Bowel changes", "constipation, diarrhea, or obstruction"],
    ["Dysuria/hematuria", "from proximity to urinary tract"],
  ];
  symptoms.forEach(([s, d], i) => {
    const y = 1.4 + i * 0.65;
    sl.addShape("rect", { x: 0.4, y, w: 0.1, h: 0.42, fill: { color: C.accent } });
    sl.addText(s, { x: 0.62, y, w: 2.3, h: 0.25, fontSize: 12.5, bold: true, color: C.subHead, fontFace: "Calibri" });
    sl.addText(d, { x: 0.62, y: y+0.25, w: 4.1, h: 0.22, fontSize: 11, color: C.bodyText, fontFace: "Calibri" });
  });

  // SIGNS column
  sl.addText("Signs & Eponyms", { x: 5.1, y: 0.95, w: 4.7, h: 0.38, fontSize: 16, bold: true, color: C.accent, fontFace: "Calibri" });
  const signs = [
    ["McBurney's Point Tenderness", "RLQ point, 1/3 ASIS to umbilicus"],
    ["Rovsing's Sign", "RLQ pain on LLQ palpation (peritoneal stretch)"],
    ["Psoas Sign", "RLQ pain on extension of right hip (retrocecal)"],
    ["Obturator Sign", "Pain on internal rotation of right hip (pelvic appendix)"],
    ["Rebound Tenderness", "Pain worse on release — peritoneal irritation"],
    ["Dunphy's Sign", "Pain on coughing — peritoneal involvement"],
  ];
  signs.forEach(([s, d], i) => {
    const y = 1.4 + i * 0.65;
    sl.addShape("rect", { x: 5.1, y, w: 0.1, h: 0.42, fill: { color: C.gold } });
    sl.addText(s, { x: 5.32, y, w: 4.4, h: 0.25, fontSize: 12.5, bold: true, color: C.gold, fontFace: "Calibri" });
    sl.addText(d, { x: 5.32, y: y+0.25, w: 4.4, h: 0.22, fontSize: 11, color: C.bodyText, fontFace: "Calibri" });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 5 — DIAGNOSIS & SCORING
// ═══════════════════════════════════════════════════════════════════
{
  let sl = pres.addSlide();
  sl.background = { color: C.darkBg };

  sl.addText("DIAGNOSIS & SCORING SYSTEMS", {
    x: 0.4, y: 0.2, w: 9.2, h: 0.55,
    fontSize: 26, bold: true, color: C.light, fontFace: "Calibri", charSpacing: 2
  });
  accentLine(sl, 0.4, 0.78, 9.2);

  // Alvarado Score Table
  sl.addText("Modified Alvarado Score (MANTRELS)", {
    x: 0.4, y: 0.9, w: 5.5, h: 0.38, fontSize: 15, bold: true, color: C.accent, fontFace: "Calibri"
  });

  const tRows = [
    ["Feature", "Points"],
    ["Migration of pain to RLQ", "1"],
    ["Anorexia / urinary acetone", "1"],
    ["Nausea / Vomiting", "1"],
    ["RLQ tenderness", "2"],
    ["Rebound tenderness", "1"],
    ["Fever (>37.3°C)", "1"],
    ["WBC > 10,000/mm³", "2"],
    ["TOTAL", "10"],
  ];
  const tH = 0.34, tW1 = 3.6, tW2 = 0.9, tX = 0.4, tY0 = 1.32;
  tRows.forEach((row, i) => {
    const y = tY0 + i * tH;
    const bg = i === 0 ? C.accent : (i === tRows.length - 1 ? C.midBg : (i % 2 === 0 ? C.cardBg : C.darkBg));
    sl.addShape("rect", { x: tX, y, w: tW1, h: tH, fill: { color: bg }, line: { color: C.midBg, width: 0.5 } });
    sl.addShape("rect", { x: tX + tW1, y, w: tW2, h: tH, fill: { color: bg }, line: { color: C.midBg, width: 0.5 } });
    sl.addText(row[0], { x: tX + 0.1, y: y+0.05, w: tW1 - 0.15, h: tH - 0.08, fontSize: 11.5,
      bold: i === 0 || i === tRows.length - 1,
      color: i === 0 ? C.light : (i === tRows.length - 1 ? C.gold : C.bodyText), fontFace: "Calibri" });
    sl.addText(row[1], { x: tX + tW1, y: y+0.05, w: tW2 - 0.05, h: tH - 0.08, fontSize: 12,
      bold: true, align: "center",
      color: i === 0 ? C.light : (i === tRows.length - 1 ? C.gold : C.accentSoft), fontFace: "Calibri" });
  });

  // Score interpretation
  const interp = [
    { score: "1–4", label: "Low risk", color: C.greenSafe, note: "Appendicitis unlikely — observe" },
    { score: "5–6", label: "Equivocal", color: C.gold, note: "Imaging recommended" },
    { score: "7–9", label: "Probable", color: C.accent, note: "Surgical consultation" },
    { score: "10",  label: "Certain", color: "FF3333", note: "Emergent surgery" },
  ];
  sl.addText("Score Interpretation", { x: 0.4, y: 4.5, w: 5.5, h: 0.35, fontSize: 13, bold: true, color: C.subHead, fontFace: "Calibri" });
  interp.forEach((r, i) => {
    const x = 0.4 + i * 1.28;
    sl.addShape("rect", { x, y: 4.88, w: 1.18, h: 0.6, fill: { color: r.color }, line: { color: C.darkBg, width: 1 } });
    sl.addText(r.score, { x, y: 4.9, w: 1.18, h: 0.25, fontSize: 14, bold: true, color: C.light, align: "center", fontFace: "Calibri" });
    sl.addText(r.label, { x, y: 5.15, w: 1.18, h: 0.25, fontSize: 10, color: C.light, align: "center", fontFace: "Calibri" });
  });

  // Right column — lab tests
  sl.addText("Laboratory & Biomarkers", {
    x: 5.3, y: 0.9, w: 4.5, h: 0.38, fontSize: 15, bold: true, color: C.accent, fontFace: "Calibri"
  });
  const labs = [
    ["WBC", "Elevated in 90%; typically 10,000–18,000/μL; normal in 10% → don't use alone"],
    ["CRP", ">10 mg/L in children <6 yr predictive; combined WBC+CRP sensitivity up to 98%"],
    ["Procalcitonin", "Elevated; supports diagnosis but not specific"],
    ["Urinalysis", "Trace pyuria/hematuria possible even in true appendicitis — not excluder"],
    ["β-hCG", "Mandatory in females of reproductive age — exclude ectopic pregnancy"],
    ["AIR / AAS Score", "Current guidelines recommend AIR or Adult Appendicitis Score over Alvarado"],
  ];
  labs.forEach(([lab, note], i) => {
    const y = 1.35 + i * 0.69;
    sl.addShape("rect", { x: 5.3, y, w: 4.45, h: 0.58, fill: { color: C.cardBg }, line: { color: C.midBg, width: 0.75 } });
    sl.addText(lab, { x: 5.42, y: y+0.04, w: 1.5, h: 0.26, fontSize: 12.5, bold: true, color: C.gold, fontFace: "Calibri" });
    sl.addText(note, { x: 5.42, y: y+0.3, w: 4.2, h: 0.26, fontSize: 10.5, color: C.bodyText, fontFace: "Calibri" });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 6 — IMAGING
// ═══════════════════════════════════════════════════════════════════
{
  let sl = pres.addSlide();
  sl.background = { color: C.darkBg };

  sl.addText("IMAGING IN APPENDICITIS", {
    x: 0.4, y: 0.2, w: 9.2, h: 0.55,
    fontSize: 26, bold: true, color: C.light, fontFace: "Calibri", charSpacing: 2
  });
  accentLine(sl, 0.4, 0.78, 9.2);

  // CT image from Bailey & Love textbook
  const ctImgUrl = "https://cdn.orris.care/cdss_images/078c8e56593eeea35b80a2fdd2066f7087ad312748e9cd6806c66f6d1ad7b305.png";
  const images = JSON.parse(require("child_process").execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js "${ctImgUrl}"`
  ).toString());

  if (images[0] && !images[0].error) {
    sl.addImage({ data: images[0].base64, x: 0.4, y: 0.95, w: 3.4, h: 4.4 });
    sl.addText("CT: Thickened appendix with periappendiceal fat stranding (arrow)\n– Bailey & Love's Surgery", {
      x: 0.4, y: 5.25, w: 3.4, h: 0.28,
      fontSize: 9, color: C.subHead, fontFace: "Calibri", italic: true, align: "center"
    });
  }

  // Right column imaging modalities
  const modalities = [
    {
      name: "Plain X-Ray",
      icon: "🔲",
      sensitivity: "Low",
      notes: "Calcified appendicolith visible in only ~5% cases. Not recommended routinely.",
      color: C.midBg
    },
    {
      name: "Ultrasound (US)",
      icon: "📡",
      sensitivity: "Sensitivity 71–94%\nSpecificity 81–98%",
      notes: "First line in children & pregnant women (no radiation). Inflamed appendix: enlarged, non-compressible, >6mm diameter. Operator-dependent. Retrocecal appendix may be missed.",
      color: C.cardBg
    },
    {
      name: "CT Scan",
      icon: "💻",
      sensitivity: "Sensitivity & Specificity ≥94%",
      notes: "Gold standard in adults. Criteria: appendix >7 mm, periappendiceal fat stranding, free fluid. Can detect perforation, abscess. Low-dose (2 mSv) preferred.",
      color: C.cardBg
    },
    {
      name: "MRI",
      icon: "🧲",
      sensitivity: "Comparable to CT",
      notes: "Preferred alternative for pregnant women when US is inconclusive. No ionizing radiation. Not better than CT but safe in pregnancy.",
      color: C.cardBg
    },
  ];

  modalities.forEach((m, i) => {
    const y = 0.95 + i * 1.15;
    sl.addShape("rect", { x: 4.05, y, w: 5.6, h: 1.05, fill: { color: m.color }, line: { color: C.midBg, width: 1 } });
    sl.addShape("rect", { x: 4.05, y, w: 0.12, h: 1.05, fill: { color: C.accent } });
    sl.addText(m.icon + " " + m.name, { x: 4.28, y: y+0.05, w: 3.0, h: 0.32, fontSize: 13.5, bold: true, color: C.light, fontFace: "Calibri" });
    sl.addText(m.sensitivity, { x: 7.3, y: y+0.05, w: 2.2, h: 0.32, fontSize: 10, bold: true, color: C.gold, fontFace: "Calibri", align: "right" });
    sl.addText(m.notes, { x: 4.28, y: y+0.38, w: 5.25, h: 0.62, fontSize: 10.5, color: C.bodyText, fontFace: "Calibri" });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 7 — DIFFERENTIAL DIAGNOSIS
// ═══════════════════════════════════════════════════════════════════
{
  let sl = pres.addSlide();
  sl.background = { color: C.darkBg };

  sl.addText("DIFFERENTIAL DIAGNOSIS", {
    x: 0.4, y: 0.2, w: 9.2, h: 0.55,
    fontSize: 26, bold: true, color: C.light, fontFace: "Calibri", charSpacing: 2
  });
  accentLine(sl, 0.4, 0.78, 9.2);

  const ddx = [
    {
      cat: "Surgical",
      color: C.accent,
      items: ["Meckel's diverticulitis", "Perforated peptic ulcer", "Intestinal obstruction", "Intussusception (children)", "Ileocecal Crohn's disease", "Cecal carcinoma / carcinoid"]
    },
    {
      cat: "Urological / Gynaecological",
      color: C.gold,
      items: ["Ectopic pregnancy", "Ovarian torsion / cyst", "Tubo-ovarian abscess", "Mittelschmerz", "Ureteric colic (renal stone)", "Pelvic inflammatory disease"]
    },
    {
      cat: "Medical / Infectious",
      color: C.greenSafe,
      items: ["Mesenteric lymphadenitis", "Gastroenteritis", "Yersinia / Salmonella ileitis", "Pyelonephritis / UTI", "Psoas abscess", "Diabetic ketoacidosis"]
    },
  ];

  ddx.forEach((col, i) => {
    const x = 0.35 + i * 3.2;
    sl.addShape("rect", { x, y: 0.95, w: 0.12, h: 0.36, fill: { color: col.color } });
    sl.addText(col.cat, { x: x+0.2, y: 0.95, w: 2.9, h: 0.36, fontSize: 13.5, bold: true, color: col.color, fontFace: "Calibri" });
    sl.addText(col.items.map((item, j) => ({
      text: item,
      options: { bullet: { type: "bullet" }, color: C.bodyText, breakLine: j < col.items.length - 1 }
    })), {
      x: x, y: 1.4, w: 3.0, h: 3.6,
      fontSize: 12.5, fontFace: "Calibri", lineSpacingMultiple: 1.4
    });
  });

  // Key note
  sl.addShape("rect", { x: 0.35, y: 5.0, w: 9.3, h: 0.48, fill: { color: C.midBg }, line: { color: C.accent, width: 1.2 } });
  sl.addText("⚠  Consider appendicitis in ANY patient with atraumatic abdominal pain without prior appendectomy — Tintinalli's Emergency Medicine", {
    x: 0.5, y: 5.05, w: 9.0, h: 0.38, fontSize: 11.5, color: C.gold, fontFace: "Calibri", italic: true
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 8 — MANAGEMENT
// ═══════════════════════════════════════════════════════════════════
{
  let sl = pres.addSlide();
  sl.background = { color: C.darkBg };

  sl.addText("MANAGEMENT", {
    x: 0.4, y: 0.2, w: 9.2, h: 0.55,
    fontSize: 26, bold: true, color: C.light, fontFace: "Calibri", charSpacing: 2
  });
  accentLine(sl, 0.4, 0.78, 9.2);

  // Pre-op
  sl.addShape("rect", { x: 0.4, y: 0.95, w: 4.45, h: 0.38, fill: { color: C.accent } });
  sl.addText("Pre-operative Management", { x: 0.5, y: 0.98, w: 4.25, h: 0.3, fontSize: 13.5, bold: true, color: C.light, fontFace: "Calibri" });
  const preop = [
    "IV fluid resuscitation — correct dehydration from fever and vomiting",
    "NPO status",
    "Pre-operative antibiotics: Cefotetan 2 g IV, or Cefoxitin 2 g IV (± 3 post-op doses)",
    "Alternative: Ticarcillin-clavulanic acid",
    "Antibiotics reduce infectious complications even in uncomplicated cases",
  ];
  sl.addText(preop.map((b,i) => ({ text: b, options: { bullet: { type: "bullet" }, color: C.bodyText, breakLine: i<preop.length-1 } })),
    { x: 0.4, y: 1.38, w: 4.45, h: 2.0, fontSize: 12, fontFace: "Calibri", lineSpacingMultiple: 1.3 });

  // Surgical
  sl.addShape("rect", { x: 0.4, y: 3.45, w: 4.45, h: 0.38, fill: { color: C.midBg } });
  sl.addText("Surgical Treatment — Appendectomy", { x: 0.5, y: 3.48, w: 4.25, h: 0.3, fontSize: 13.5, bold: true, color: C.gold, fontFace: "Calibri" });
  const surg = [
    "Laparoscopic appendectomy preferred — lower complication rates, faster recovery",
    "3 incisions: umbilical + 2 lower abdominal",
    "Open approach preferred when perforation is evident",
    "Resume liquids shortly after uncomplicated laparoscopic surgery; solid diet next day",
    "Full recovery in 2–3 weeks; older patients require longer recovery",
  ];
  sl.addText(surg.map((b,i) => ({ text: b, options: { bullet: { type: "bullet" }, color: C.bodyText, breakLine: i<surg.length-1 } })),
    { x: 0.4, y: 3.88, w: 4.45, h: 1.65, fontSize: 12, fontFace: "Calibri", lineSpacingMultiple: 1.3 });

  // Outcomes / Perforation impact
  sl.addShape("rect", { x: 5.1, y: 0.95, w: 4.65, h: 0.38, fill: { color: C.accent } });
  sl.addText("Impact of Perforation", { x: 5.2, y: 0.98, w: 4.45, h: 0.3, fontSize: 13.5, bold: true, color: C.light, fontFace: "Calibri" });

  const perfStats = [
    { label: "Mortality (uncomplicated)", val: "0.0002%" },
    { label: "Mortality (perforated)", val: "3%" },
    { label: "Morbidity (uncomplicated)", val: "3%" },
    { label: "Morbidity (perforated)", val: "47%" },
  ];
  perfStats.forEach((s, i) => {
    const y = 1.42 + i * 0.65;
    sl.addShape("rect", { x: 5.1, y, w: 4.65, h: 0.55, fill: { color: C.cardBg }, line: { color: C.midBg, width: 0.75 } });
    sl.addText(s.label, { x: 5.22, y: y+0.1, w: 3.0, h: 0.35, fontSize: 12, color: C.bodyText, fontFace: "Calibri" });
    sl.addText(s.val, { x: 8.1, y: y+0.08, w: 1.5, h: 0.38, fontSize: 14, bold: true, color: i >= 2 ? C.accent : C.greenSafe, fontFace: "Calibri", align: "right" });
  });

  // Non-operative management box
  sl.addShape("rect", { x: 5.1, y: 3.15, w: 4.65, h: 2.3, fill: { color: C.cardBg }, line: { color: C.gold, width: 1.5 } });
  sl.addText("Non-operative (Antibiotic) Management", { x: 5.2, y: 3.22, w: 4.4, h: 0.38, fontSize: 13, bold: true, color: C.gold, fontFace: "Calibri" });
  const nonop = [
    "Effective in ~80% of uncomplicated appendicitis cases",
    "Failure rate remains unacceptably high for many patients",
    "Perforated / peritonitis / obstruction: surgery mandatory",
    "Abscess: image-guided percutaneous drainage + antibiotics → interval appendectomy at 6–8 weeks",
    "Not standard; RCTs ongoing (NCT02800785)",
  ];
  sl.addText(nonop.map((b,i) => ({ text: b, options: { bullet: { type: "bullet" }, color: C.bodyText, breakLine: i<nonop.length-1 } })),
    { x: 5.2, y: 3.65, w: 4.4, h: 1.7, fontSize: 11, fontFace: "Calibri", lineSpacingMultiple: 1.25 });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 9 — SPECIAL POPULATIONS
// ═══════════════════════════════════════════════════════════════════
{
  let sl = pres.addSlide();
  sl.background = { color: C.darkBg };

  sl.addText("SPECIAL POPULATIONS", {
    x: 0.4, y: 0.2, w: 9.2, h: 0.55,
    fontSize: 26, bold: true, color: C.light, fontFace: "Calibri", charSpacing: 2
  });
  accentLine(sl, 0.4, 0.78, 9.2);

  const pops = [
    {
      title: "Children",
      icon: "👶",
      color: C.gold,
      items: [
        "Most common atraumatic abdominal surgical emergency in children >1 yr",
        "Young children (<5 yrs) often present WITH perforation — unable to localize pain",
        "Diagnosis remains largely clinical; CT/US/MRI as adjuncts",
        "Girls: US first to exclude ovarian pathology",
        "Diagnostic laparoscopy if all studies negative but pain persists",
        "Remove appendix even if normal unless other cause definitively identified",
      ]
    },
    {
      title: "Pregnancy",
      icon: "🤰",
      color: C.accentSoft,
      items: [
        "Most common non-obstetric surgical emergency in pregnancy (1 in 1,500)",
        "Same incidence as non-pregnant — but perforation rate higher due to diagnostic delay",
        "2× risk of sepsis, septic shock, bowel obstruction vs. non-pregnant",
        "Classic RLQ pain still most common even in 3rd trimester",
        "Imaging: US first; MRI if US inconclusive; CT only when MRI not available",
        "Physiologic leukocytosis and elevated ESR in pregnancy — confounds diagnosis",
      ]
    },
    {
      title: "Elderly",
      icon: "👴",
      color: C.subHead,
      items: [
        "Lower overall incidence (appendiceal lumen obliterates with age)",
        "Higher mortality — comorbidities + delayed presentation",
        "Atypical presentation common — diagnosis frequently delayed",
        "Perforation and abscess more likely at presentation",
        "Longer recovery period post-operatively",
      ]
    },
  ];

  pops.forEach((p, i) => {
    const x = 0.35 + i * 3.2;
    sl.addShape("rect", { x, y: 0.93, w: 3.0, h: 4.55, fill: { color: C.cardBg }, line: { color: p.color, width: 1.5 } });
    sl.addText(p.icon + "  " + p.title, { x: x+0.15, y: 1.0, w: 2.7, h: 0.42, fontSize: 15, bold: true, color: p.color, fontFace: "Calibri" });
    sl.addShape("rect", { x: x+0.15, y: 1.44, w: 2.7, h: 0.03, fill: { color: p.color } });
    sl.addText(p.items.map((b,j) => ({ text: b, options: { bullet: { type: "bullet" }, color: C.bodyText, breakLine: j < p.items.length - 1 } })),
      { x: x+0.1, y: 1.52, w: 2.8, h: 3.8, fontSize: 11, fontFace: "Calibri", lineSpacingMultiple: 1.3 });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 10 — COMPLICATIONS
// ═══════════════════════════════════════════════════════════════════
{
  let sl = pres.addSlide();
  sl.background = { color: C.darkBg };

  sl.addText("COMPLICATIONS OF APPENDICITIS", {
    x: 0.4, y: 0.2, w: 9.2, h: 0.55,
    fontSize: 26, bold: true, color: C.light, fontFace: "Calibri", charSpacing: 2
  });
  accentLine(sl, 0.4, 0.78, 9.2);

  const comps = [
    { title: "Perforation", color: C.accent, icon: "💥",
      text: "Mortality rises from 0.0002% → 3%. Morbidity 3% → 47%. Classic sudden pain relief followed by diffuse peritonitis. Extraluminal fecalith may propagate sepsis." },
    { title: "Peritonitis", color: "FF5555", icon: "⚠️",
      text: "Diffuse bacterial peritonitis from free perforation. Requires urgent laparotomy with broad-spectrum antibiotics and peritoneal lavage." },
    { title: "Appendiceal Abscess / Phlegmon", color: C.gold, icon: "🔴",
      text: "Localized collection after contained perforation. Management: percutaneous image-guided drainage + IV antibiotics → interval appendectomy at 6–8 weeks." },
    { title: "Pylephlebitis", color: C.subHead, icon: "🩸",
      text: "Septic thrombophlebitis of portal vein — rare but life-threatening. Fever, jaundice, RUQ pain. Requires antibiotics ± anticoagulation." },
    { title: "Adhesions / Bowel Obstruction", color: C.greenSafe, icon: "🔗",
      text: "Late complication. Post-inflammatory adhesions may cause small bowel obstruction requiring future surgical intervention." },
    { title: "Negative Appendectomy", color: C.bodyText, icon: "🔍",
      text: "Histologically normal appendix removed. Rate up to 15% without imaging. Reduces with CT use. Balance against risk of perforation from observation delay." },
  ];

  comps.forEach((c, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.35 + col * 4.75;
    const y = 0.95 + row * 1.6;
    sl.addShape("rect", { x, y, w: 4.45, h: 1.45, fill: { color: C.cardBg }, line: { color: c.color, width: 1.5 } });
    sl.addShape("rect", { x, y, w: 0.12, h: 1.45, fill: { color: c.color } });
    sl.addText(c.icon + "  " + c.title, { x: x+0.22, y: y+0.07, w: 4.1, h: 0.35, fontSize: 13, bold: true, color: c.color, fontFace: "Calibri" });
    sl.addText(c.text, { x: x+0.22, y: y+0.45, w: 4.1, h: 0.92, fontSize: 11, color: C.bodyText, fontFace: "Calibri", lineSpacingMultiple: 1.2 });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 11 — KEY TAKEAWAYS
// ═══════════════════════════════════════════════════════════════════
{
  let sl = pres.addSlide();
  sl.background = { color: C.darkBg };

  // Decorative right panel
  sl.addShape("rect", { x: 7.2, y: 0, w: 2.8, h: 5.625, fill: { color: C.midBg } });
  sl.addShape("rect", { x: 7.2, y: 0, w: 0.18, h: 5.625, fill: { color: C.accent } });

  sl.addText("KEY TAKEAWAYS", {
    x: 0.4, y: 0.25, w: 6.5, h: 0.55,
    fontSize: 26, bold: true, color: C.light, fontFace: "Calibri", charSpacing: 3
  });
  accentLine(sl, 0.4, 0.82, 6.5);

  const takeaways = [
    { n: "01", t: "Most common surgical emergency", d: "Affects ~1/1,000 adults/year; lifetime risk 8.7% M / 6.9% F" },
    { n: "02", t: "Pathophysiology: luminal obstruction", d: "Fecalith or lymphoid hyperplasia → ischemia → necrosis → perforation" },
    { n: "03", t: "Classic triad", d: "Periumbilical pain migrating to RLQ + nausea + fever — but 50% are atypical" },
    { n: "04", t: "CT is gold standard", d: "Sensitivity/specificity ≥94%; US first in children and pregnant women" },
    { n: "05", t: "Laparoscopic appendectomy preferred", d: "Unless perforation present; preoperative antibiotics mandatory" },
    { n: "06", t: "Perforation = major risk", d: "Mortality ×15,000; morbidity ×16 — early diagnosis prevents perforation" },
  ];

  takeaways.forEach((t, i) => {
    const y = 1.0 + i * 0.75;
    sl.addText(t.n, { x: 0.4, y, w: 0.55, h: 0.55, fontSize: 20, bold: true, color: C.accent, fontFace: "Calibri", align: "center" });
    sl.addText(t.t, { x: 1.05, y: y+0.02, w: 5.9, h: 0.28, fontSize: 13.5, bold: true, color: C.light, fontFace: "Calibri" });
    sl.addText(t.d, { x: 1.05, y: y+0.3, w: 5.9, h: 0.25, fontSize: 11.5, color: C.bodyText, fontFace: "Calibri" });
    if (i < takeaways.length - 1)
      sl.addShape("rect", { x: 0.4, y: y+0.63, w: 6.5, h: 0.025, fill: { color: C.midBg } });
  });

  sl.addText("Sources: Fischer's Mastery of Surgery 8e • Tintinalli's Emergency Medicine 9e\nSabiston Textbook of Surgery • Goldman-Cecil Medicine • Bailey & Love 28e", {
    x: 7.4, y: 3.5, w: 2.3, h: 1.5,
    fontSize: 9.5, color: C.subHead, fontFace: "Calibri", align: "center", lineSpacingMultiple: 1.4
  });
}

// ═══════════════════════════════════════════════════════════════════
// WRITE FILE
// ═══════════════════════════════════════════════════════════════════
pres.writeFile({ fileName: "/home/daytona/workspace/appendicitis-ppt/Acute_Appendicitis.pptx" })
  .then(() => console.log("✅ Presentation saved to /home/daytona/workspace/appendicitis-ppt/Acute_Appendicitis.pptx"))
  .catch(e => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/appendicitis-ppt && node create_ppt.js 2>&1

Running Command

cd /home/daytona/workspace/appendicitis-ppt && node /home/daytona/skills/shared/…

Editing File

~/appendicitis-ppt/create_ppt.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/appendicitis-ppt/create_ppt.js'
Running Command

cd /home/daytona/workspace/appendicitis-ppt && node create_ppt.js 2>&1

Running Command

ls -lh /home/daytona/workspace/appendicitis-ppt/Acute_Appendicitis.pptx

Your presentation is ready:

Acute Appendicitis

Presentation · PPTX

3.8 MB | 11 slides | 16:9 widescreen

Here is what the deck covers, slide by slide:
#SlideHighlights
1TitleDeep navy + crimson design with source list
2Overview & EpidemiologyStat cards + bullets — 250K–300K appendectomies/yr, lifetime risk, peak age 10–19
3PathophysiologyLaw of Laplace cascade (obstruction → ischemia → necrosis → perforation) + pain migration mechanism
4Clinical FeaturesSymptoms column + Signs/Eponyms column (McBurney, Rovsing, Psoas, Obturator, Dunphy signs)
5Diagnosis & ScoringFull Modified Alvarado (MANTRELS) table with colour-coded interpretation + Lab / biomarker cards
6ImagingReal CT scan from Bailey & Love textbook + modality comparison (X-Ray / US / CT / MRI) with sensitivity/specificity
7Differential Diagnosis3 columns: Surgical / Gynae-Urological / Medical–Infectious
8ManagementPre-op antibiotics, laparoscopic vs. open, perforation mortality table, non-operative (antibiotic) approach
9Special PopulationsChildren, Pregnancy, Elderly — diagnostic pitfalls and management adjustments
10Complications6 cards: Perforation, Peritonitis, Abscess/Phlegmon, Pylephlebitis, Adhesions, Negative appendectomy
11Key Takeaways6 numbered points summarizing the essential clinical lessons
Sources drawn from: Fischer's Mastery of Surgery 8e, Tintinalli's Emergency Medicine 9e, Sabiston Textbook of Surgery, Goldman-Cecil Medicine, Bailey & Love's Short Practice of Surgery 28e.
This is a shared conversation. Sign in to Orris to start your own chat.