A. 66-ycar-old man is evaiuated because of severe left lower quadrant pain. This morning he awoke with progressive lower abdominal pain. He described both a steady lower abdominal discomfort as well as waves of pain that came in "spasms." Physical examination reveals a man in considerable abdominal distress. His temperature is 38.7 °C (101.5 °F), blood pressure is 160/88 mm Hg, and pulse rate is 108/min. He has occasional, high-pitched bowel sounds, and he is quite tender over the left lower quadrant. The remainder of the examination is normal. Laboratory abnormalities include a hemoglobin of 16 g/dL; leukocyte count of 12,600/pL with 15% band forms and 52% polymorphonuclear cells. A computed tomographic (CT) scan shows several air-filled loops of small intestine. There are multiple diverticula in the left colon, with thickening of wall anc an inflammatory mass but no definite abscess. Which of the following is the most appropriate management? A. CT-guided biopsy of the inflammatory mass B. Laparotomy and colon resection C. Nasogastric suction and an antibiotic D. ColonoscopY
acute diverticulitis management antibiotics bowel rest guidelines
| Finding | Significance |
|---|---|
| 66-year-old male | Age group most affected |
| Left lower quadrant pain, progressive | Classic sigmoid diverticulitis location |
| Fever 38.7°C, tachycardia 108/min | Systemic inflammatory response |
| WBC 12,600 + 15% band forms | Leukocytosis with left shift (infection/inflammation) |
| CT: diverticula + wall thickening + inflammatory mass | Hinchey Stage Ib - pericolic phlegmon (no free abscess, no free air) |
| High-pitched bowel sounds, dilated small bowel loops | Reactive ileus from adjacent inflammation |
"Conservative treatment of acute diverticulitis normally includes bowel rest with intravenous fluids, antibiotics, and appropriate analgesia." - Yamada's Textbook of Gastroenterology
"A patient with localized LLQ peritonitis secondary to sigmoid colonic diverticulitis can be managed with bowel rest and IV antibiotics alone." - Sleisenger and Fordtran's GI and Liver Disease
Create a decision tree for diverticulitis management based on Hinchey stage
mkdir -p /home/daytona/workspace/diverticulitis-tree && ls /home/daytona/workspace/diverticulitis-tree
~/diverticulitis-tree/build.js
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3" x 7.5"
pres.title = "Diverticulitis Management Decision Tree";
// ─── COLOR PALETTE ────────────────────────────────────────────────────────────
const C = {
bg: "0D1B2A", // deep navy (dominant dark)
bgLight: "162032", // slightly lighter navy for cards
accent: "00C2A8", // teal accent
accentWarm:"F4A261", // warm orange for warnings / surgery
white: "FFFFFF",
offwhite: "E8F0F7",
gray: "8FA8C0",
green: "2EC4B6",
red: "E63946",
yellow: "FFD166",
purple: "9B5DE5",
stage0: "2EC4B6", // green - mild
stage1: "FFD166", // yellow - pericolic abscess
stage2: "F4A261", // orange - pelvic abscess
stage3: "E07040", // red-orange - purulent peritonitis
stage4: "E63946", // red - fecal peritonitis
};
// ─── HELPERS ──────────────────────────────────────────────────────────────────
function box(slide, x, y, w, h, fill, line, radius) {
slide.addShape(pres.ShapeType.roundRect, {
x, y, w, h,
fill: { color: fill },
line: { color: line || fill, width: 1.5 },
rectRadius: radius !== undefined ? radius : 0.08,
});
}
function txt(slide, text, x, y, w, h, opts) {
slide.addText(text, {
x, y, w, h,
fontFace: "Calibri",
fontSize: opts.fontSize || 12,
color: opts.color || C.white,
bold: opts.bold || false,
align: opts.align || "center",
valign: opts.valign || "middle",
wrap: true,
margin: opts.margin !== undefined ? opts.margin : 4,
italic: opts.italic || false,
});
}
// Arrow (simple line with arrowhead)
function arrow(slide, x1, y1, x2, y2, color) {
slide.addShape(pres.ShapeType.line, {
x: x1, y: y1, w: x2 - x1, h: y2 - y1,
line: { color: color || C.accent, width: 2, endArrowType: "arrow" },
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ══════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.background = { color: C.bg };
// Top accent bar
s.addShape(pres.ShapeType.rect, {
x: 0, y: 0, w: 13.3, h: 0.08, fill: { color: C.accent },
});
// Large title
txt(s, "Diverticulitis", 0.5, 1.2, 12.3, 1.4, {
fontSize: 54, bold: true, color: C.white, align: "center",
});
txt(s, "Management Decision Tree", 0.5, 2.5, 12.3, 0.9, {
fontSize: 32, color: C.accent, align: "center",
});
// Subtitle line
s.addShape(pres.ShapeType.line, {
x: 3.5, y: 3.55, w: 6.3, h: 0,
line: { color: C.accent, width: 1.5 },
});
txt(s, "Based on Hinchey Classification (Original & Modified Wasvary)", 0.5, 3.7, 12.3, 0.5, {
fontSize: 14, color: C.gray, align: "center", italic: true,
});
// Stage legend pills
const stages = [
{ label: "Stage 0 / Ia", color: C.stage0, x: 1.4 },
{ label: "Stage Ib / II", color: C.stage1, x: 4.1 },
{ label: "Stage II (large)", color: C.stage2, x: 6.8 },
{ label: "Stage III", color: C.stage3, x: 9.5 },
{ label: "Stage IV", color: C.red, x: 11.2 },
];
stages.forEach(st => {
box(s, st.x, 4.6, 1.6, 0.45, st.color, st.color, 0.2);
txt(s, st.label, st.x, 4.6, 1.6, 0.45, { fontSize: 10, bold: true });
});
txt(s, "Sources: Current Surgical Therapy 14e | Tintinalli's EM | Yamada's Gastroenterology | Sleisenger & Fordtran", 0.5, 6.9, 12.3, 0.35, {
fontSize: 9, color: C.gray, align: "center", italic: true,
});
// Bottom bar
s.addShape(pres.ShapeType.rect, {
x: 0, y: 7.42, w: 13.3, h: 0.08, fill: { color: C.accent },
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — HINCHEY CLASSIFICATION TABLE
// ══════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.background = { color: C.bg };
s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:0.08, fill:{ color: C.accent } });
txt(s, "Hinchey Classification", 0.4, 0.15, 12.5, 0.65, { fontSize: 28, bold: true, color: C.white, align: "left" });
txt(s, "Staging severity of acute diverticulitis", 0.4, 0.75, 12.5, 0.4, { fontSize: 14, color: C.gray, align: "left", italic: true });
// Column headers
const colHeaders = ["Stage", "Original Hinchey", "Modified Wasvary (CT-based)", "Severity"];
const colX = [0.3, 1.7, 5.0, 9.6];
const colW = [1.3, 3.2, 4.5, 3.0];
colHeaders.forEach((h, i) => {
box(s, colX[i], 1.25, colW[i], 0.42, C.accent, C.accent, 0.04);
txt(s, h, colX[i], 1.25, colW[i], 0.42, { fontSize: 12, bold: true });
});
const rows = [
{ stage:"0", orig:"—", mod:"Mild clinical diverticulitis (no imaging findings)", sev:"Mild", color: C.stage0 },
{ stage:"Ia", orig:"Pericolic abscess / phlegmon", mod:"Colonic wall thickening; confined pericolic inflammation", sev:"Mild", color: C.stage0 },
{ stage:"Ib", orig:"Pericolic abscess / phlegmon", mod:"Confined pericolic or mesocolic abscess (<5 cm)", sev:"Moderate",color: C.stage1 },
{ stage:"II", orig:"Pelvic / intra-abdominal / retroperitoneal abscess", mod:"Pelvic, distant intra-abdominal or retroperitoneal abscess",sev:"Moderate-Severe", color: C.stage2 },
{ stage:"III", orig:"Generalised purulent peritonitis", mod:"Generalised purulent peritonitis", sev:"Severe", color: C.stage3 },
{ stage:"IV", orig:"Generalised fecal peritonitis", mod:"Generalised fecal peritonitis", sev:"Critical",color: C.red },
];
rows.forEach((r, i) => {
const y = 1.78 + i * 0.78;
const rowBg = i % 2 === 0 ? "1A2840" : "162032";
box(s, 0.3, y, 12.3, 0.72, rowBg, rowBg, 0.04);
// Stage pill
box(s, 0.35, y + 0.12, 1.18, 0.48, r.color, r.color, 0.22);
txt(s, r.stage, 0.35, y + 0.12, 1.18, 0.48, { fontSize: 16, bold: true });
txt(s, r.orig, colX[1], y, colW[1], 0.72, { fontSize: 10.5, color: C.offwhite, align: "left", valign: "middle" });
txt(s, r.mod, colX[2], y, colW[2], 0.72, { fontSize: 10.5, color: C.offwhite, align: "left", valign: "middle" });
txt(s, r.sev, colX[3], y, colW[3], 0.72, { fontSize: 11, bold: true, color: r.color });
});
s.addShape(pres.ShapeType.rect, { x:0, y:7.42, w:13.3, h:0.08, fill:{ color: C.accent } });
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — MAIN DECISION TREE OVERVIEW
// ══════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.background = { color: C.bg };
s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:0.08, fill:{ color: C.accent } });
txt(s, "Decision Tree Overview", 0.4, 0.12, 12.5, 0.55, { fontSize: 24, bold: true, color: C.white, align: "left" });
// ── ROOT: ACUTE DIVERTICULITIS ──
box(s, 4.65, 0.78, 3.8, 0.62, C.accent, C.accent, 0.2);
txt(s, "ACUTE DIVERTICULITIS", 4.65, 0.78, 3.8, 0.62, { fontSize: 13, bold: true, color: C.bg });
// Arrow down
s.addShape(pres.ShapeType.line, { x:6.55, y:1.4, w:0, h:0.35,
line: { color: C.accent, width:2, endArrowType:"arrow" } });
// ── CT SCAN ASSESSMENT ──
box(s, 4.65, 1.75, 3.8, 0.55, "1E3A5A", C.accent, 0.08);
txt(s, "CT Scan + Clinical Assessment", 4.65, 1.75, 3.8, 0.55, { fontSize: 11, bold: true, color: C.accent });
// Arrow down
s.addShape(pres.ShapeType.line, { x:6.55, y:2.3, w:0, h:0.3,
line: { color: C.accent, width:2, endArrowType:"arrow" } });
// ── CLASSIFY ──
box(s, 5.0, 2.6, 3.1, 0.5, "1E3A5A", C.yellow, 0.08);
txt(s, "Classify by Hinchey Stage", 5.0, 2.6, 3.1, 0.5, { fontSize: 11, bold: true, color: C.yellow });
// ── 5 BRANCHES ──
// We'll draw 5 stage boxes in a row, with connecting lines from the classify box
const branches = [
{ label: "Stage 0 / Ia\nPhlegmon", color: C.stage0, x: 0.25 },
{ label: "Stage Ib / II\nSmall Abscess", color: C.stage1, x: 2.7 },
{ label: "Stage II\nLarge Abscess", color: C.stage2, x: 5.15 },
{ label: "Stage III\nPurulent Peritonitis", color: C.stage3, x: 7.6 },
{ label: "Stage IV\nFecal Peritonitis", color: C.red, x: 10.05},
];
// horizontal connector line at y=3.5
s.addShape(pres.ShapeType.line, { x: 1.15, y:3.5, w:10.95, h:0,
line: { color: C.gray, width:1.5 } });
branches.forEach(b => {
// vertical drop from classify box center to horizontal line
s.addShape(pres.ShapeType.line, { x: b.x+1.0, y:3.1, w:0, h:0.4,
line:{ color: C.gray, width:1.5 } });
// vertical from horizontal line to stage box
s.addShape(pres.ShapeType.line, { x: b.x+1.0, y:3.5, w:0, h:0.25,
line:{ color: b.color, width:2, endArrowType:"arrow" } });
// Stage box
box(s, b.x, 3.75, 2.05, 0.72, b.color, b.color, 0.12);
txt(s, b.label, b.x, 3.75, 2.05, 0.72, { fontSize: 10, bold: true, color: C.bg });
// Arrow down to management
s.addShape(pres.ShapeType.line, { x: b.x+1.0, y:4.47, w:0, h:0.28,
line:{ color: b.color, width:2, endArrowType:"arrow" } });
});
// ── MANAGEMENT BOX per branch ──
const mgmt = [
{ text: "Outpatient\nBowel rest\n± Antibiotics\nFollow-up 2-3d", color: C.stage0, x: 0.25, bg: "0D2E1E" },
{ text: "Admit\nIV Antibiotics\nBowel rest\nMonitor", color: C.stage1, x: 2.7, bg: "2E2600" },
{ text: "Admit\nIV Antibiotics\nCT-guided drain\nif >4 cm", color: C.stage2, x: 5.15, bg: "2E1800" },
{ text: "Resuscitate\nIV Antibiotics\nEmergency\nSurgery", color: C.stage3, x: 7.6, bg: "2E0C00" },
{ text: "Resuscitate\nIV Antibiotics\nEmergency\nHartmann's", color: C.red, x: 10.05,bg: "2E0000" },
];
mgmt.forEach(m => {
box(s, m.x, 4.75, 2.05, 1.1, m.bg, m.color, 0.08);
txt(s, m.text, m.x, 4.75, 2.05, 1.1, { fontSize: 9.5, color: m.color, align: "center" });
});
// ── OUTCOME label ──
const outcomes = [
{ text: "Recovery\n>95% success", color: C.stage0, x: 0.25, bg: "0D2E1E" },
{ text: "Recovery\nElective f/u scope", color: C.stage1, x: 2.7, bg: "2E2600" },
{ text: "Recovery or\nElective surgery",color: C.stage2, x: 5.15, bg: "2E1800" },
{ text: "Mortality\n~13%", color: C.stage3, x: 7.6, bg: "2E0C00" },
{ text: "Mortality\n~43%", color: C.red, x: 10.05,bg: "2E0000" },
];
mgmt.forEach((m, i) => {
s.addShape(pres.ShapeType.line, { x: m.x+1.0, y:5.85, w:0, h:0.25,
line:{ color: m.color, width:1.5, endArrowType:"arrow" } });
box(s, outcomes[i].x, 6.1, 2.05, 0.65, outcomes[i].bg, outcomes[i].color, 0.08);
txt(s, outcomes[i].text, outcomes[i].x, 6.1, 2.05, 0.65, { fontSize: 9, color: outcomes[i].color, align: "center" });
});
// Footer
txt(s, "See slides 4-8 for detailed management per stage", 0.4, 7.18, 12.5, 0.28,
{ fontSize: 9.5, color: C.gray, align: "center", italic: true });
s.addShape(pres.ShapeType.rect, { x:0, y:7.42, w:13.3, h:0.08, fill:{ color: C.accent } });
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDES 4–8 — DETAILED PER-STAGE MANAGEMENT
// ══════════════════════════════════════════════════════════════════════════════
const stageDetails = [
{
stage: "Stage 0 / Ia",
subtitle: "Mild Uncomplicated Diverticulitis",
color: C.stage0,
bg: "0D2E1E",
desc: "Inflammation limited to the colon wall (Stage 0) or confined pericolic fat stranding without abscess (Stage Ia). No systemic compromise.",
criteria: ["LLQ pain + fever + leukocytosis", "CT: wall thickening ± pericolic fat stranding", "No abscess, no peritonitis", "Tolerating oral intake"],
management: [
{ heading: "Outpatient (most patients)", items: ["Clear liquid diet advancing to low-residue", "± Oral antibiotics: ciprofloxacin + metronidazole OR levofloxacin + metronidazole (4-7 days)", "Analgesia (avoid NSAIDs)", "Strict return precautions"] },
{ heading: "Admit if:", items: ["Intractable vomiting / unable to tolerate PO", "High fever (>39°C) or marked leukocytosis", "Elderly, immunocompromised, or significant comorbidities", "Poor social support"] },
],
follow: ["Follow up in 2-3 days", "Colonoscopy 6-8 weeks post-recovery (exclude malignancy)", "Consider elective sigmoid resection after ≥2 recurrences"],
note: "RCTs (AVOD, DIABOLO) show antibiotics may NOT be required in uncomplicated diverticulitis. Reserve for high-risk patients.",
},
{
stage: "Stage Ib",
subtitle: "Confined Pericolic / Mesocolic Abscess (<5 cm)",
color: C.stage1,
bg: "302800",
desc: "Small abscess (<5 cm) confined to the pericolic or mesocolic tissue. No pelvic extension. Considered the lower end of 'complicated' diverticulitis.",
criteria: ["CT: confined abscess <5 cm adjacent to colon", "Fever, leukocytosis with left shift", "Localised peritonism (no generalised peritonitis)", "No free air"],
management: [
{ heading: "Hospital Admission", items: ["NPO / bowel rest + IV fluids", "IV antibiotics: pip-tazo OR imipenem OR cefoxitin + metronidazole (7-10 days)", "Serial abdominal exams every 8-12 hrs", "Transition to oral antibiotics when improving"] },
{ heading: "Small abscesses <3 cm", items: ["IV antibiotics alone - majority resolve", "No drainage required in most cases", "Monitor for clinical deterioration"] },
],
follow: ["Repeat CT if no clinical improvement in 48-72 hrs", "Colonoscopy 6-8 weeks post-recovery", "Elective sigmoid resection after recovery — recommended given complicated course"],
note: "Initial non-operative treatment fails in ~20% — have a low threshold to escalate.",
},
{
stage: "Stage II",
subtitle: "Pelvic / Distant Intra-abdominal Abscess (>4-5 cm)",
color: C.stage2,
bg: "301800",
desc: "Larger abscess extending to the pelvis, distant intra-abdominal space, or retroperitoneum. Requires drainage in addition to antibiotics.",
criteria: ["CT: abscess >4-5 cm, ± pelvic location", "Sepsis or systemic inflammatory response", "May have palpable mass on rectal exam", "No free air / generalised peritonitis"],
management: [
{ heading: "Hospital Admission + Drainage", items: ["NPO, IV fluids, IV antibiotics (pip-tazo or carbapenems)", "CT-guided or US-guided percutaneous drainage for abscesses >4 cm", "Radiological drainage allows 'bridge to elective surgery'", "Surgical drainage if percutaneous approach not feasible"] },
{ heading: "If drainage fails:", items: ["Reassess in 48-72 hrs with repeat CT", "Consider laparoscopic washout vs. resection", "Surgery if systemic sepsis not improving"] },
],
follow: ["Interval sigmoid resection 6-8 weeks after recovery (strongly recommended)", "Colonoscopy prior to surgery", "Risk of fistula formation if not resected (colovesical, colovaginal)"],
note: "Percutaneous drainage allows deferral of surgery to elective setting with lower morbidity than emergency Hartmann's.",
},
{
stage: "Stage III",
subtitle: "Generalised Purulent Peritonitis",
color: C.stage3,
bg: "2E0C00",
desc: "Free perforation of a pericolic abscess releasing purulent (not fecal) contents into the peritoneal cavity. Generalised peritonitis. Surgical emergency.",
criteria: ["Generalised abdominal peritonism / rigidity", "Free fluid on CT (purulent)", "Systemic sepsis / haemodynamic compromise", "No frank fecal contamination"],
management: [
{ heading: "Immediate Resuscitation", items: ["IV access x2, aggressive fluid resuscitation", "IV broad-spectrum antibiotics STAT (carbapenems or pip-tazo + vancomycin)", "Urinary catheter, ICU-level monitoring", "Urgent surgical consultation"] },
{ heading: "Surgery (within hours)", items: ["Hartmann's procedure (resection + end colostomy) — standard", "OR primary anastomosis ± defunctioning stoma in selected patients", "Laparoscopic lavage and drainage — controversial, may be attempted in select stable patients", "Perioperative antibiotics continued post-op"] },
],
follow: ["ICU post-op", "Reversal of Hartmann's stoma at 3-6 months if patient recovers", "Mortality ~13%"],
note: "Laparoscopic lavage (LADIES, SCANDIV trials) showed higher re-operation rates vs. resection — use with caution.",
},
{
stage: "Stage IV",
subtitle: "Generalised Fecal Peritonitis",
color: C.red,
bg: "2E0000",
desc: "Free perforation with gross fecal contamination of the peritoneal cavity. Most severe form. Life-threatening surgical emergency with high mortality.",
criteria: ["Free fecal contamination of abdomen", "Peritoneal feces on CT or exam", "Severe sepsis / septic shock", "Haemodynamic instability"],
management: [
{ heading: "Immediate Resuscitation", items: ["Aggressive crystalloid resuscitation + vasopressors if needed", "IV broad-spectrum antibiotics STAT (carbapenem regimen)", "Blood cultures x2 before antibiotics", "URGENT theatre / operating room notification"] },
{ heading: "Emergency Surgery", items: ["Hartmann's procedure — operation of choice", "Subtotal colectomy if pan-colonic involvement", "Thorough peritoneal lavage (>10L warm saline)", "Damage control surgery in unstable patients", "NO primary anastomosis in fecal contamination"] },
],
follow: ["ICU post-operatively, multidisciplinary team care", "Mortality ~43%", "Stoma reversal deferred — many patients never undergo reversal given morbidity"],
note: "This is a true surgical emergency. Time to theatre is directly correlated with mortality.",
},
];
stageDetails.forEach((sd, idx) => {
const s = pres.addSlide();
s.background = { color: C.bg };
// Top accent bar
s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:0.08, fill:{ color: sd.color } });
// Stage badge
box(s, 0.3, 0.15, 2.0, 0.7, sd.color, sd.color, 0.3);
txt(s, sd.stage, 0.3, 0.15, 2.0, 0.7, { fontSize: 18, bold: true, color: C.bg });
// Title
txt(s, sd.subtitle, 2.45, 0.15, 10.5, 0.45, { fontSize: 22, bold: true, color: C.white, align: "left" });
txt(s, sd.desc, 2.45, 0.6, 10.5, 0.45, { fontSize: 10.5, color: C.gray, align: "left", italic: true });
// ── LEFT COLUMN: Diagnostic Criteria ──
box(s, 0.3, 1.15, 3.5, 0.38, sd.color, sd.color, 0.06);
txt(s, "DIAGNOSTIC CRITERIA", 0.3, 1.15, 3.5, 0.38, { fontSize: 10, bold: true, color: C.bg });
box(s, 0.3, 1.55, 3.5, 1.8, "162032", sd.color, 0.06);
const critText = sd.criteria.map(c => ({ text: " " + c, options: { bullet: { code: "25CF" }, color: C.offwhite, fontSize: 10, breakLine: true } }));
s.addText(critText, { x: 0.3, y: 1.58, w: 3.5, h: 1.74, fontFace: "Calibri", wrap: true, valign: "top", margin: 6 });
// ── MIDDLE-LEFT COLUMN: Management ──
const mgmtX = 4.0;
box(s, mgmtX, 1.15, 5.2, 0.38, sd.color, sd.color, 0.06);
txt(s, "MANAGEMENT", mgmtX, 1.15, 5.2, 0.38, { fontSize: 10, bold: true, color: C.bg });
let mgmtY = 1.55;
sd.management.forEach(mg => {
// Sub-heading
txt(s, mg.heading, mgmtX + 0.1, mgmtY, 4.9, 0.3, { fontSize: 10, bold: true, color: sd.color, align: "left" });
mgmtY += 0.3;
mg.items.forEach(item => {
const itemText = [{ text: " • " + item, options: { color: C.offwhite, fontSize: 9.5 } }];
s.addText(itemText, { x: mgmtX + 0.1, y: mgmtY, w: 4.9, h: 0.3, fontFace: "Calibri", wrap: true, valign: "top", margin: 0 });
mgmtY += 0.3;
});
mgmtY += 0.08;
});
// ── RIGHT COLUMN: Follow-up ──
const fuX = 9.4;
box(s, fuX, 1.15, 3.6, 0.38, sd.color, sd.color, 0.06);
txt(s, "FOLLOW-UP", fuX, 1.15, 3.6, 0.38, { fontSize: 10, bold: true, color: C.bg });
box(s, fuX, 1.55, 3.6, 1.8, "162032", sd.color, 0.06);
const fuText = sd.follow.map(f => ({ text: " " + f, options: { bullet: { code: "25B6" }, color: C.offwhite, fontSize: 10, breakLine: true } }));
s.addText(fuText, { x: fuX, y: 1.6, w: 3.6, h: 1.72, fontFace: "Calibri", wrap: true, valign: "top", margin: 6 });
// ── BOTTOM: Clinical Note ──
box(s, 0.3, 3.48, 12.7, 0.62, "1A2840", sd.color, 0.06);
s.addText([
{ text: " Clinical Note: ", options: { bold: true, color: sd.color, fontSize: 10.5 } },
{ text: sd.note, options: { color: C.offwhite, fontSize: 10 } },
], { x: 0.3, y: 3.5, w: 12.7, h: 0.58, fontFace: "Calibri", valign: "middle", margin: 6, wrap: true });
// ── SEVERITY METER ──
const sev = idx + 1; // 1-5
txt(s, "SEVERITY", 0.3, 4.2, 2.5, 0.3, { fontSize: 9, color: C.gray, align: "left" });
for (let i = 0; i < 5; i++) {
const filled = i < sev;
s.addShape(pres.ShapeType.roundRect, {
x: 0.3 + i * 0.55, y: 4.5, w: 0.45, h: 0.22,
fill: { color: filled ? sd.color : "1E3A5A" },
line: { color: sd.color, width: 1 },
rectRadius: 0.04,
});
}
// Antibiotic regimen box
if (idx < 3) {
box(s, 0.3, 4.85, 12.7, 0.55, "0D1B2A", sd.color, 0.06);
const abxText = idx === 0
? "Antibiotic Regimen (if used): Ciprofloxacin 500 mg PO BD + Metronidazole 400 mg PO TDS | OR: Levofloxacin 750 mg PO OD + Metronidazole | Duration: 4-7 days"
: idx === 1
? "Antibiotic Regimen: Piperacillin-tazobactam 4.5g IV q8h | OR: Cefoxitin 2g IV q8h + Metronidazole 500 mg IV q8h | Duration: 7-10 days, step down to oral when improving"
: "Antibiotic Regimen: Piperacillin-tazobactam 4.5g IV q8h | OR: Imipenem 500 mg IV q6h | Duration: 10-14 days depending on clinical response";
s.addText([{ text: "Rx: ", options: { bold: true, color: sd.color } }, { text: abxText, options: { color: C.offwhite } }],
{ x: 0.3, y: 4.87, w: 12.7, h: 0.51, fontFace: "Calibri", fontSize: 9.5, valign: "middle", margin: 6, wrap: true });
} else {
box(s, 0.3, 4.85, 12.7, 0.55, "0D1B2A", sd.color, 0.06);
const surgText = idx === 3
? "Surgical Note: Hartmann's procedure (sigmoid resection + end colostomy) is standard. Laparoscopic lavage may be attempted in stable Stage III — but LADIES/SCANDIV trials showed higher re-op rates. Primary anastomosis in select low-risk Stage III patients."
: "Surgical Note: Hartmann's procedure (resection of sigmoid + end colostomy + oversew of rectal stump) is the operation of choice. No primary anastomosis in fecal contamination. Damage control surgery if haemodynamically unstable. Peritoneal lavage essential.";
s.addText([{ text: "Surgery: ", options: { bold: true, color: sd.color } }, { text: surgText, options: { color: C.offwhite } }],
{ x: 0.3, y: 4.87, w: 12.7, h: 0.51, fontFace: "Calibri", fontSize: 9.5, valign: "middle", margin: 6, wrap: true });
}
// Page indicator
txt(s, `Slide ${idx + 4} of 9`, 11.5, 7.14, 1.5, 0.28, { fontSize: 8.5, color: C.gray, align: "right" });
s.addShape(pres.ShapeType.rect, { x:0, y:7.42, w:13.3, h:0.08, fill:{ color: sd.color } });
});
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — WHEN TO SCOPE + ELECTIVE SURGERY GUIDE
// ══════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.background = { color: C.bg };
s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:0.08, fill:{ color: C.accent } });
txt(s, "Post-Acute: Colonoscopy & Elective Surgery", 0.4, 0.13, 12.5, 0.58, { fontSize: 24, bold: true, color: C.white, align: "left" });
// Colonoscopy box
box(s, 0.3, 0.85, 5.9, 2.7, "162032", C.accent, 0.08);
box(s, 0.3, 0.85, 5.9, 0.42, C.accent, C.accent, 0.06);
txt(s, "COLONOSCOPY", 0.3, 0.85, 5.9, 0.42, { fontSize: 13, bold: true, color: C.bg });
const scopeItems = [
"Perform 6-8 weeks after resolution of acute episode",
"Purpose: exclude colorectal carcinoma (mimics diverticulitis on CT in ~5% of cases)",
"NOT performed during acute attack — risk of perforation from insufflation",
"Virtual colonoscopy (CT colonography) if standard scope contraindicated",
"Carcinoembryonic antigen (CEA) if malignancy clinically suspected",
];
const scopeText = scopeItems.map(it => ({ text: " " + it, options: { bullet: { code: "25B6" }, color: C.offwhite, fontSize: 10.5, breakLine: true } }));
s.addText(scopeText, { x: 0.4, y: 1.3, w: 5.7, h: 2.2, fontFace: "Calibri", valign: "top", margin: 4, wrap: true });
// Elective surgery box
box(s, 6.5, 0.85, 6.5, 2.7, "162032", C.accentWarm, 0.08);
box(s, 6.5, 0.85, 6.5, 0.42, C.accentWarm, C.accentWarm, 0.06);
txt(s, "ELECTIVE SURGERY (Sigmoid Resection)", 6.5, 0.85, 6.5, 0.42, { fontSize: 11, bold: true, color: C.bg });
const surgItems = [
"Indications: ≥2 episodes uncomplicated OR 1 episode complicated diverticulitis",
"Immunocompromised patients: consider earlier (after 1st episode)",
"Laparoscopic sigmoid resection — preferred approach (↓ complications vs open)",
"Primary anastomosis can usually be performed electively",
"Reversal of Hartmann's stoma — 3-6 months post-emergency procedure",
];
const surgText = surgItems.map(it => ({ text: " " + it, options: { bullet: { code: "25B6" }, color: C.offwhite, fontSize: 10.5, breakLine: true } }));
s.addText(surgText, { x: 6.6, y: 1.3, w: 6.3, h: 2.2, fontFace: "Calibri", valign: "top", margin: 4, wrap: true });
// Contraindications row
box(s, 0.3, 3.7, 12.7, 0.38, "1A3040", C.red, 0.06);
txt(s, "CONTRAINDICATIONS TO COLONOSCOPY IN ACUTE PHASE", 0.3, 3.7, 12.7, 0.38, { fontSize: 11, bold: true, color: C.red });
const contra = ["Active peritonitis", "Free perforation", "Massive distension", "Haemodynamic instability", "Acute severe inflammation"];
contra.forEach((c, i) => {
box(s, 0.3 + i * 2.52, 4.1, 2.38, 0.45, "2E0A0A", C.red, 0.08);
txt(s, c, 0.3 + i * 2.52, 4.1, 2.38, 0.45, { fontSize: 10, color: C.red });
});
// Quick reference summary
box(s, 0.3, 4.75, 12.7, 1.7, "0D2030", C.accent, 0.08);
box(s, 0.3, 4.75, 12.7, 0.4, "0D2030", C.accent, 0.06);
txt(s, "QUICK REFERENCE SUMMARY", 0.3, 4.75, 12.7, 0.4, { fontSize: 11, bold: true, color: C.accent });
const summ = [
["0 / Ia", "Phlegmon", "Outpatient ± oral Abx", "2-3 day follow-up"],
["Ib", "Small abscess (<5 cm)", "Admit, IV Abx, monitor", "Scope + elective Sx"],
["II", "Large/pelvic abscess", "Admit, IV Abx, CT drainage", "Interval sigmoid resection"],
["III", "Purulent peritonitis", "Resus + emergency Hartmann's", "ICU — ~13% mortality"],
["IV", "Fecal peritonitis", "Resus + emergency Hartmann's", "ICU — ~43% mortality"],
];
const colXS = [0.35, 1.6, 3.8, 7.6, 10.9];
const colWS = [1.15, 2.1, 3.7, 3.2, 2.25];
summ.forEach((row, ri) => {
const stageColors = [C.stage0, C.stage1, C.stage2, C.stage3, C.red];
const y = 5.22 + ri * 0.23;
row.forEach((cell, ci) => {
const color = ci === 0 ? stageColors[ri] : (ri < 2 ? C.offwhite : (ri === 2 ? C.accentWarm : C.red));
txt(s, cell, colXS[ci], y, colWS[ci], 0.22, { fontSize: 9.5, color, align: ci === 0 ? "center" : "left", valign: "middle" });
});
});
txt(s, "Sources: Current Surgical Therapy 14e | Tintinalli's EM | Yamada's Textbook of Gastroenterology | Sleisenger & Fordtran GI & Liver Disease", 0.4, 7.14, 12.5, 0.28,
{ fontSize: 8.5, color: C.gray, align: "center", italic: true });
s.addShape(pres.ShapeType.rect, { x:0, y:7.42, w:13.3, h:0.08, fill:{ color: C.accent } });
}
// ── OUTPUT ──
pres.writeFile({ fileName: "/home/daytona/workspace/diverticulitis-tree/Diverticulitis_Decision_Tree.pptx" })
.then(() => console.log("SUCCESS: File written."))
.catch(e => { console.error("ERROR:", e); process.exit(1); });
cd /home/daytona/workspace/diverticulitis-tree && node build.js 2>&1
ls -lh /home/daytona/workspace/diverticulitis-tree/
Diverticulitis Decision Tree
Presentation · PPTX
| Slide | Content |
|---|---|
| 1 - Title | Overview with color-coded stage legend (Stage 0 through IV) |
| 2 - Classification Table | Original Hinchey vs. Modified Wasvary (CT-based) side by side |
| 3 - Master Decision Tree | Full flowchart: CT assessment → Hinchey staging → Management → Outcomes |
| 4 - Stage 0 / Ia | Mild/uncomplicated: outpatient, ± oral antibiotics, ciprofloxacin + metronidazole regimen |
| 5 - Stage Ib | Confined pericolic abscess <5 cm: admit, IV antibiotics, monitor; pip-tazo regimen |
| 6 - Stage II | Large/pelvic abscess: CT-guided percutaneous drainage + IV antibiotics; surgical note |
| 7 - Stage III | Purulent peritonitis: resuscitate + emergency Hartmann's; LADIES/SCANDIV trial note; ~13% mortality |
| 8 - Stage IV | Fecal peritonitis: resuscitate + emergency Hartmann's; no primary anastomosis; ~43% mortality |
| 9 - Post-Acute | Colonoscopy timing (6-8 weeks), indications for elective surgery, contraindications, quick reference summary |