Prepare a PPT on principles of pro iding post operative pain relief and management of chronic pain as per bailey and love 28 edition and sabiston text book of surgery including beautiful diagrams and flow chart

Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null && echo "---" && ls /home/daytona/skills…

Running Command

mkdir -p /home/daytona/workspace/pain-management-ppt

Writing File

~/pain-management-ppt/create_ppt.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE";
pres.title = "Principles of Pain Management";
pres.author = "Bailey & Love 28e | Sabiston Textbook of Surgery";

// ─── COLOUR PALETTE ───────────────────────────────────────────────────────────
const C = {
  navy:      "0A1628",   // dominant dark bg
  deepBlue:  "112244",
  midBlue:   "1A3A6B",
  accentBlue:"2960B8",
  teal:      "0D7680",
  gold:      "E8A020",
  white:     "FFFFFF",
  offWhite:  "EFF3FA",
  lightGray: "C8D4E8",
  red:       "C0392B",
  green:     "1B7A3E",
  orange:    "D4601A",
  purple:    "6B2FA0",
  cardBg:    "162040",
  cardBg2:   "0E2A50",
};

// ─── HELPERS ─────────────────────────────────────────────────────────────────
function addSectionDivider(title, subtitle) {
  const sl = pres.addSlide();
  sl.background = { color: C.navy };
  // decorative accent bar
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.35, h: 7.5, fill: { color: C.gold }, line: { color: C.gold } });
  sl.addShape(pres.ShapeType.rect, { x: 0.35, y: 0, w: 0.1, h: 7.5, fill: { color: C.accentBlue }, line: { color: C.accentBlue } });
  sl.addText(title, {
    x: 1.2, y: 2.4, w: 11, h: 1.6,
    fontSize: 46, bold: true, color: C.white, fontFace: "Calibri Light"
  });
  if (subtitle) {
    sl.addText(subtitle, {
      x: 1.2, y: 4.15, w: 11, h: 0.7,
      fontSize: 22, color: C.gold, fontFace: "Calibri Light", italic: true
    });
  }
  sl.addText("Bailey & Love 28e  |  Sabiston Textbook of Surgery", {
    x: 1.2, y: 6.8, w: 11, h: 0.4,
    fontSize: 12, color: C.lightGray, fontFace: "Calibri"
  });
}

function makeContentSlide(title, opts = {}) {
  const sl = pres.addSlide();
  sl.background = { color: opts.darkBg ? C.deepBlue : C.offWhite };
  // header bar
  sl.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 13.3, h: 0.85,
    fill: { color: C.midBlue }, line: { color: C.midBlue }
  });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0.85, w: 13.3, h: 0.06, fill: { color: C.gold }, line: { color: C.gold } });
  sl.addText(title, {
    x: 0.35, y: 0.1, w: 12.5, h: 0.65,
    fontSize: 22, bold: true, color: C.white, fontFace: "Calibri", valign: "middle"
  });
  // footer
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 7.2, w: 13.3, h: 0.3, fill: { color: C.midBlue }, line: { color: C.midBlue } });
  sl.addText("Bailey & Love 28e  |  Sabiston Textbook of Surgery", {
    x: 0.2, y: 7.21, w: 9, h: 0.28, fontSize: 9, color: C.lightGray, fontFace: "Calibri"
  });
  return sl;
}

// ─── SLIDE 1: TITLE ──────────────────────────────────────────────────────────
{
  const sl = pres.addSlide();
  sl.background = { color: C.navy };
  // large teal accent block on right
  sl.addShape(pres.ShapeType.rect, { x: 9.2, y: 0, w: 4.1, h: 7.5, fill: { color: C.teal }, line: { color: C.teal } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 6.5, w: 9.2, h: 0.08, fill: { color: C.gold }, line: { color: C.gold } });
  sl.addText("PRINCIPLES OF", {
    x: 0.5, y: 1.0, w: 8.5, h: 0.8, fontSize: 30, bold: false, color: C.lightGray, fontFace: "Calibri Light", charSpacing: 6
  });
  sl.addText("PAIN MANAGEMENT", {
    x: 0.5, y: 1.75, w: 8.5, h: 1.5, fontSize: 52, bold: true, color: C.white, fontFace: "Calibri"
  });
  sl.addText("Postoperative Pain Relief & Chronic Pain", {
    x: 0.5, y: 3.3, w: 8.5, h: 0.7, fontSize: 24, color: C.gold, fontFace: "Calibri Light", italic: true
  });
  sl.addShape(pres.ShapeType.rect, { x: 0.5, y: 4.15, w: 5.5, h: 0.05, fill: { color: C.accentBlue }, line: { color: C.accentBlue } });
  sl.addText([
    { text: "Based on:\n", options: { bold: false } },
    { text: "Bailey & Love's Short Practice of Surgery, 28th Edition\n", options: { bold: true } },
    { text: "Sabiston Textbook of Surgery: The Biological Basis of Modern Surgical Practice", options: { bold: true } }
  ], {
    x: 0.5, y: 4.3, w: 8.5, h: 1.3, fontSize: 14, color: C.offWhite, fontFace: "Calibri"
  });
  sl.addText("Chapter 23: Anaesthesia and Pain Relief  |  Chapter 20: Anesthesia", {
    x: 0.5, y: 5.75, w: 8.5, h: 0.5, fontSize: 12, color: C.lightGray, fontFace: "Calibri", italic: true
  });
  // right panel content
  sl.addText("KEY TOPICS", {
    x: 9.4, y: 0.5, w: 3.7, h: 0.5, fontSize: 14, bold: true, color: C.navy, fontFace: "Calibri", charSpacing: 3
  });
  const topics = ["Pain Pathophysiology", "Nociception", "Multimodal Analgesia", "Opioids & NSAIDs", "Epidural / Regional", "PCA", "Chronic Pain", "WHO Ladder", "Interventional Tx", "Cancer Pain"];
  topics.forEach((t, i) => {
    sl.addText("▸  " + t, {
      x: 9.4, y: 1.1 + i * 0.56, w: 3.6, h: 0.5,
      fontSize: 13, color: C.navy, fontFace: "Calibri", bold: i === 0 || i === 6
    });
  });
}

// ─── SLIDE 2: TABLE OF CONTENTS ───────────────────────────────────────────────
{
  const sl = makeContentSlide("Table of Contents");
  const sections = [
    ["01", "Pain: Definition & Pathophysiology", C.accentBlue],
    ["02", "Mechanisms of Nociception", C.teal],
    ["03", "Principles of Postoperative Pain Management", C.green],
    ["04", "Pharmacological Agents", C.orange],
    ["05", "Regional & Neuraxial Analgesia", C.purple],
    ["06", "Patient-Controlled Analgesia (PCA)", C.accentBlue],
    ["07", "Chronic Pain: Classification & Pathophysiology", C.teal],
    ["08", "Principles of Chronic Pain Management", C.green],
    ["09", "Interventional Pain Management", C.orange],
    ["10", "WHO Analgesic Ladder & Cancer Pain", C.red],
  ];
  sections.forEach(([num, label, color], i) => {
    const col = i < 5 ? 0 : 1;
    const row = i % 5;
    const x = col === 0 ? 0.4 : 6.9;
    const y = 1.1 + row * 1.1;
    sl.addShape(pres.ShapeType.rect, { x, y, w: 0.6, h: 0.75, fill: { color }, line: { color } });
    sl.addText(num, { x, y, w: 0.6, h: 0.75, fontSize: 18, bold: true, color: C.white, align: "center", valign: "middle" });
    sl.addText(label, { x: x + 0.7, y: y + 0.05, w: 5.5, h: 0.65, fontSize: 14.5, color: C.navy, fontFace: "Calibri", valign: "middle" });
  });
}

// ─── SECTION 1: PATHOPHYSIOLOGY ──────────────────────────────────────────────
addSectionDivider("SECTION 01", "Pain: Definition & Pathophysiology");

// Slide 3: Definition
{
  const sl = makeContentSlide("Pain: Definition & Core Concepts");
  // Definition box
  sl.addShape(pres.ShapeType.roundRect, {
    x: 0.4, y: 1.0, w: 12.5, h: 1.35,
    fill: { color: C.midBlue }, line: { color: C.gold }, rectRadius: 0.08
  });
  sl.addText([
    { text: "IASP Definition: ", options: { bold: true, color: C.gold } },
    { text: "\"An unpleasant sensory and emotional experience associated with, or resembling that associated with, actual or potential tissue damage.\"", options: { color: C.white } }
  ], { x: 0.6, y: 1.05, w: 12.1, h: 1.2, fontSize: 15, fontFace: "Calibri", valign: "middle" });

  // Two column boxes
  const boxData = [
    { title: "Acute Pain", color: C.teal, items: [
      "Expected short duration",
      "Resolves with tissue healing",
      "Physiologically useful",
      "Minutes to days / weeks",
      "Surgery, trauma, procedures"
    ]},
    { title: "Chronic Pain", color: C.orange, items: [
      "Persists ≥ 3 months",
      "Beyond expected healing",
      "Serves NO useful function",
      "Recognised as a disease itself",
      "50% of surgical patients at risk"
    ]}
  ];
  boxData.forEach((box, i) => {
    const x = 0.4 + i * 6.5;
    sl.addShape(pres.ShapeType.rect, { x, y: 2.55, w: 6.2, h: 0.5, fill: { color: box.color }, line: { color: box.color } });
    sl.addText(box.title, { x, y: 2.55, w: 6.2, h: 0.5, fontSize: 16, bold: true, color: C.white, align: "center", valign: "middle" });
    box.items.forEach((item, j) => {
      sl.addShape(pres.ShapeType.rect, { x, y: 3.1 + j * 0.62, w: 6.2, h: 0.58, fill: { color: j % 2 === 0 ? C.offWhite : C.white }, line: { color: C.lightGray } });
      sl.addText("  ▸  " + item, { x, y: 3.1 + j * 0.62, w: 6.2, h: 0.58, fontSize: 13, color: C.navy, fontFace: "Calibri", valign: "middle" });
    });
  });
}

// Slide 4: Nociception diagram
{
  const sl = makeContentSlide("Mechanisms of Nociception — 4-Step Pathway");
  // Steps flow
  const steps = [
    { num: "1", label: "TRANSDUCTION", desc: "Noxious stimulus → electrical signal at free nerve endings (nociceptors). Widely distributed in somatic & visceral tissues.", color: C.red },
    { num: "2", label: "TRANSMISSION", desc: "Signal via Aδ & C fibres → spinal cord → spinothalamic tract → brainstem & thalamus → thalamocortical pathways → cortex.", color: C.orange },
    { num: "3", label: "MODULATION", desc: "Enhances or suppresses pain signal. Primarily in dorsal horn (substantia gelatinosa). Site of opioid, NMDA antagonist action.", color: C.teal },
    { num: "4", label: "PERCEPTION", desc: "Pain signal reaches cerebral cortex. Highly subjective. Determines emotional & affective component of pain experience.", color: C.accentBlue },
  ];
  steps.forEach((s, i) => {
    const x = 0.35 + i * 3.15;
    sl.addShape(pres.ShapeType.rect, { x, y: 1.1, w: 2.9, h: 0.7, fill: { color: s.color }, line: { color: s.color } });
    sl.addText(s.num + "  " + s.label, { x, y: 1.1, w: 2.9, h: 0.7, fontSize: 14, bold: true, color: C.white, align: "center", valign: "middle" });
    if (i < 3) {
      sl.addText("▶", { x: x + 2.9, y: 1.28, w: 0.25, h: 0.35, fontSize: 22, color: s.color, align: "center" });
    }
    sl.addShape(pres.ShapeType.roundRect, { x, y: 1.9, w: 2.9, h: 2.0, fill: { color: C.white }, line: { color: s.color }, rectRadius: 0.05 });
    sl.addText(s.desc, { x: x + 0.1, y: 2.0, w: 2.7, h: 1.8, fontSize: 12.5, color: C.navy, fontFace: "Calibri", valign: "top" });
  });

  // Nerve fibre info
  sl.addShape(pres.ShapeType.rect, { x: 0.35, y: 4.1, w: 12.6, h: 0.05, fill: { color: C.gold }, line: { color: C.gold } });
  sl.addText("NERVE FIBRE TYPES:", { x: 0.35, y: 4.25, w: 3.5, h: 0.45, fontSize: 13, bold: true, color: C.midBlue });
  const fibres = [
    ["Aδ Fibres", "Myelinated — Fast pain (sharp, pricking)", C.red],
    ["C Fibres", "Unmyelinated — Slow pain (burning, aching)", C.orange],
    ["Aβ Fibres", "Myelinated — Touch / pressure; gate control", C.teal],
  ];
  fibres.forEach(([name, desc, col], i) => {
    const fx = 0.35 + i * 4.2;
    sl.addShape(pres.ShapeType.rect, { x: fx, y: 4.7, w: 4.0, h: 0.5, fill: { color: col }, line: { color: col } });
    sl.addText(name, { x: fx, y: 4.7, w: 4.0, h: 0.5, fontSize: 13, bold: true, color: C.white, align: "center", valign: "middle" });
    sl.addText(desc, { x: fx, y: 5.25, w: 4.0, h: 0.6, fontSize: 12, color: C.navy, align: "center", fontFace: "Calibri" });
  });
  sl.addText("Sabiston: Mechanisms of Acute Pain — Block 4", {
    x: 0.35, y: 6.85, w: 9, h: 0.28, fontSize: 9, color: C.accentBlue, italic: true
  });
}

// ─── SECTION 2: POSTOPERATIVE PAIN ───────────────────────────────────────────
addSectionDivider("SECTION 02 & 03", "Postoperative Pain Management");

// Slide 5: Multimodal Analgesia
{
  const sl = makeContentSlide("Principles of Postoperative Pain Management");
  // Central concept
  sl.addShape(pres.ShapeType.ellipse, { x: 4.65, y: 2.8, w: 4.0, h: 1.8, fill: { color: C.midBlue }, line: { color: C.gold } });
  sl.addText("MULTIMODAL\nANALGESIA", { x: 4.65, y: 2.85, w: 4.0, h: 1.7, fontSize: 18, bold: true, color: C.gold, align: "center", valign: "middle" });

  // Spokes
  const modalities = [
    { label: "Paracetamol\n(1st line)", x: 0.3, y: 1.15, color: C.teal },
    { label: "NSAIDs\n(opioid-sparing)", x: 5.3, y: 1.0, color: C.orange },
    { label: "Opioids\n(PO/IV/PCA)", x: 9.8, y: 1.15, color: C.red },
    { label: "Epidural /\nNeuraxial", x: 0.3, y: 5.0, color: C.accentBlue },
    { label: "Regional\nNerve Blocks", x: 5.3, y: 5.65, color: C.green },
    { label: "Adjuvants\n(Gabapentin etc.)", x: 9.8, y: 5.0, color: C.purple },
  ];
  modalities.forEach((m) => {
    sl.addShape(pres.ShapeType.roundRect, { x: m.x, y: m.y, w: 3.0, h: 1.1, fill: { color: m.color }, line: { color: m.color }, rectRadius: 0.1 });
    sl.addText(m.label, { x: m.x, y: m.y, w: 3.0, h: 1.1, fontSize: 13.5, bold: true, color: C.white, align: "center", valign: "middle" });
  });
  sl.addText("Bailey & Love 28e: Combining opioids with other drugs minimises dose and reduces side effects", {
    x: 0.4, y: 6.8, w: 12.5, h: 0.35, fontSize: 11, color: C.midBlue, italic: true, fontFace: "Calibri"
  });
}

// Slide 6: WHO Analgesic Ladder
{
  const sl = makeContentSlide("WHO Analgesic Ladder");
  // Pyramid shape using stacked rectangles
  const levels = [
    { step: "STEP 3", label: "Strong Opioids", examples: "Morphine, Oxycodone (SR), Fentanyl patch, Buprenorphine", color: C.red, w: 5.5, x: 3.9 },
    { step: "STEP 2", label: "Weak Opioids", examples: "Codeine, Tramadol ± Non-opioid adjuvants", color: C.orange, w: 8.0, x: 2.65 },
    { step: "STEP 1", label: "Non-Opioid Analgesics", examples: "Paracetamol, NSAIDs, Tricyclics, Anticonvulsants", color: C.teal, w: 11.0, x: 1.15 },
  ];
  levels.forEach((lv, i) => {
    const y = 1.2 + i * 1.5;
    sl.addShape(pres.ShapeType.rect, { x: lv.x, y, w: lv.w, h: 1.35, fill: { color: lv.color }, line: { color: lv.color } });
    sl.addText(lv.step, { x: lv.x + 0.15, y, w: 1.4, h: 1.35, fontSize: 16, bold: true, color: C.white, align: "center", valign: "middle" });
    sl.addText(lv.label, { x: lv.x + 1.6, y: y + 0.05, w: lv.w - 1.8, h: 0.55, fontSize: 15, bold: true, color: C.white, valign: "middle" });
    sl.addText(lv.examples, { x: lv.x + 1.6, y: y + 0.62, w: lv.w - 1.8, h: 0.65, fontSize: 12.5, color: C.white, fontFace: "Calibri", valign: "middle" });
  });
  // Arrow up
  sl.addShape(pres.ShapeType.rect, { x: 0.5, y: 1.2, w: 0.5, h: 4.5, fill: { color: C.midBlue }, line: { color: C.midBlue } });
  sl.addText("ESCALATE IF PAIN PERSISTS ▲", {
    x: 0.0, y: 2.0, w: 1.5, h: 2.5, fontSize: 10, bold: true, color: C.midBlue, rotate: 270
  });
  sl.addText("As pain persists or increases, move up the ladder. Assess regularly. Oral route preferred.", {
    x: 1.15, y: 5.5, w: 11.0, h: 0.55, fontSize: 13, color: C.navy, fontFace: "Calibri", italic: true
  });
  sl.addText("WHO Analgesic Ladder  |  Bailey & Love 28e, Ch. 23 — Pain Control in Malignant Disease", {
    x: 0.4, y: 6.85, w: 12.5, h: 0.28, fontSize: 9, color: C.accentBlue, italic: true
  });
}

// Slide 7: Pharmacological Agents Table
{
  const sl = makeContentSlide("Pharmacological Agents for Postoperative Pain");
  const headers = ["Drug Class", "Examples", "Mechanism", "Route", "Key Notes"];
  const rows = [
    ["Paracetamol", "Acetaminophen", "Central COX inhibition", "PO/IV/PR", "1st line; excellent safety profile; IV onset faster"],
    ["NSAIDs", "Ibuprofen, Ketorolac, Diclofenac", "COX-1 & COX-2 inhibition → ↓PG synthesis", "PO/IV/IM", "Opioid-sparing; caution: GI bleed, renal, CVS risk"],
    ["Weak Opioids", "Codeine, Tramadol", "μ, δ, κ receptor agonism", "PO", "Mild-moderate pain; tramadol also SNRI"],
    ["Strong Opioids", "Morphine, Fentanyl, Oxycodone", "Supraspinal (μ1) & spinal (δ, κ) receptors", "PO/IV/SC/IM/Transdermal", "Moderate-severe pain; risk: PONV, resp. depression"],
    ["Gabapentinoids", "Gabapentin, Pregabalin", "α2δ calcium channel subunit", "PO", "Neuropathic pain; adjunct in multimodal regimen"],
    ["Tricyclics", "Amitriptyline", "NE & 5-HT reuptake inhibition", "PO", "Nerve injury pain; side effects limit compliance"],
    ["NMDA Antagonists", "Ketamine (low dose)", "NMDA receptor block", "IV", "Opioid-sparing; prevents central sensitisation"],
  ];
  const colW = [1.9, 2.3, 2.8, 1.9, 3.8];
  const colX = [0.3, 2.2, 4.5, 7.3, 9.2];
  // header
  headers.forEach((h, i) => {
    sl.addShape(pres.ShapeType.rect, { x: colX[i], y: 1.0, w: colW[i], h: 0.5, fill: { color: C.midBlue }, line: { color: C.midBlue } });
    sl.addText(h, { x: colX[i], y: 1.0, w: colW[i], h: 0.5, fontSize: 11.5, bold: true, color: C.white, align: "center", valign: "middle" });
  });
  rows.forEach((row, r) => {
    const bg = r % 2 === 0 ? C.offWhite : C.white;
    const rowColors = [C.teal, C.teal, C.orange, C.red, C.purple, C.purple, C.accentBlue];
    row.forEach((cell, c) => {
      sl.addShape(pres.ShapeType.rect, { x: colX[c], y: 1.55 + r * 0.72, w: colW[c], h: 0.7, fill: { color: bg }, line: { color: C.lightGray } });
      const textColor = c === 0 ? rowColors[r] : C.navy;
      sl.addText(cell, { x: colX[c] + 0.05, y: 1.55 + r * 0.72, w: colW[c] - 0.1, h: 0.7, fontSize: 10.5, color: textColor, bold: c === 0, valign: "middle", fontFace: "Calibri" });
    });
  });
}

// Slide 8: Epidural & Regional Analgesia
{
  const sl = makeContentSlide("Regional & Neuraxial Analgesia Techniques");
  const techniques = [
    {
      title: "Epidural Analgesia",
      color: C.accentBlue,
      points: [
        "Catheter in epidural space (high thoracic for upper abdominal/thoracic ops)",
        "Continuous infusion: weak LA + opioid (e.g. fentanyl)",
        "Slower onset than spinal; superior for prolonged analgesia",
        "Enables early mobilisation; reduces respiratory complications",
        "Risk: hypotension from sympathetic blockade"
      ]
    },
    {
      title: "Spinal Analgesia",
      color: C.teal,
      points: [
        "Intrathecal single-shot LA – rapid onset, short-duration block",
        "Addition of opioids prolongs postoperative analgesia",
        "Risk of late respiratory depression with intrathecal opioids",
        "Hypotension if block > T10 dermatome – caution in hypovolaemia",
        "Fine-bore pencil-tip needles reduce dural puncture headache"
      ]
    },
    {
      title: "Peripheral Nerve Blocks",
      color: C.green,
      points: [
        "TAP block — Transversus abdominis plane (abdominal wall)",
        "Quadratus lumborum block — abdominal nerves",
        "Erector spinae block — spinal nerves at transverse process",
        "Paravertebral / extrapleural catheter — thoracic surgery",
        "Intercostal nerve blocks — rib / chest wall analgesia"
      ]
    },
  ];
  techniques.forEach((t, i) => {
    const x = 0.3 + i * 4.35;
    sl.addShape(pres.ShapeType.rect, { x, y: 1.0, w: 4.15, h: 0.55, fill: { color: t.color }, line: { color: t.color } });
    sl.addText(t.title, { x, y: 1.0, w: 4.15, h: 0.55, fontSize: 13, bold: true, color: C.white, align: "center", valign: "middle" });
    t.points.forEach((p, j) => {
      const bg = j % 2 === 0 ? C.offWhite : C.white;
      sl.addShape(pres.ShapeType.rect, { x, y: 1.6 + j * 0.85, w: 4.15, h: 0.82, fill: { color: bg }, line: { color: t.color } });
      sl.addText("• " + p, { x: x + 0.1, y: 1.65 + j * 0.85, w: 3.95, h: 0.72, fontSize: 11.5, color: C.navy, fontFace: "Calibri", valign: "middle" });
    });
  });
  sl.addText("Bailey & Love 28e, Ch. 23 — Epidural, Spinal, Regional Blocks", {
    x: 0.4, y: 6.85, w: 12.5, h: 0.28, fontSize: 9, color: C.accentBlue, italic: true
  });
}

// Slide 9: PCA
{
  const sl = makeContentSlide("Patient-Controlled Analgesia (PCA)");
  // Central illustration using shapes
  // PCA pump schematic
  sl.addShape(pres.ShapeType.roundRect, { x: 4.9, y: 1.2, w: 3.5, h: 4.2, fill: { color: C.midBlue }, line: { color: C.gold }, rectRadius: 0.15 });
  sl.addText("PCA\nPUMP", { x: 4.9, y: 1.3, w: 3.5, h: 1.0, fontSize: 22, bold: true, color: C.gold, align: "center", valign: "middle" });
  const pcaFeatures = ["Dose strength", "Lockout interval", "Total dose / time limit", "Drug concentration"];
  pcaFeatures.forEach((f, i) => {
    sl.addShape(pres.ShapeType.rect, { x: 5.05, y: 2.45 + i * 0.68, w: 3.2, h: 0.6, fill: { color: C.cardBg }, line: { color: C.teal } });
    sl.addText("⚙  " + f, { x: 5.05, y: 2.45 + i * 0.68, w: 3.2, h: 0.6, fontSize: 12, color: C.white, fontFace: "Calibri", valign: "middle" });
  });
  sl.addText("PATIENT\nCONTROL BUTTON", { x: 5.3, y: 5.2, w: 2.7, h: 0.9, fontSize: 11, color: C.gold, align: "center", bold: true });

  // Left panel - benefits
  sl.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.0, w: 4.4, h: 0.55, fill: { color: C.teal }, line: { color: C.teal } });
  sl.addText("ADVANTAGES", { x: 0.3, y: 1.0, w: 4.4, h: 0.55, fontSize: 14, bold: true, color: C.white, align: "center", valign: "middle" });
  const adv = ["Patient autonomy & control", "Prevents delays in dosing", "Reduced opioid consumption", "Better pain scores vs IM", "Computer-limited safety", "Popular with patients"];
  adv.forEach((a, i) => {
    sl.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.6 + i * 0.62, w: 4.4, h: 0.58, fill: { color: i % 2 === 0 ? C.offWhite : C.white }, line: { color: C.lightGray } });
    sl.addText("✓  " + a, { x: 0.4, y: 1.65 + i * 0.62, w: 4.2, h: 0.48, fontSize: 12.5, color: C.green, bold: false, fontFace: "Calibri", valign: "middle" });
  });

  // Right panel - cautions
  sl.addShape(pres.ShapeType.rect, { x: 8.6, y: 1.0, w: 4.4, h: 0.55, fill: { color: C.red }, line: { color: C.red } });
  sl.addText("CAUTIONS", { x: 8.6, y: 1.0, w: 4.4, h: 0.55, fontSize: 14, bold: true, color: C.white, align: "center", valign: "middle" });
  const cau = ["Respiratory depression", "Nausea & vomiting (PONV)", "Pruritus (itching)", "Sedation risk", "Proper patient training required", "Requires IV access"];
  cau.forEach((c, i) => {
    sl.addShape(pres.ShapeType.rect, { x: 8.6, y: 1.6 + i * 0.62, w: 4.4, h: 0.58, fill: { color: i % 2 === 0 ? C.offWhite : C.white }, line: { color: C.lightGray } });
    sl.addText("⚠  " + c, { x: 8.7, y: 1.65 + i * 0.62, w: 4.2, h: 0.48, fontSize: 12.5, color: C.red, fontFace: "Calibri", valign: "middle" });
  });
  sl.addText("Bailey & Love 28e: Patient trains to press button; dose, frequency and total dose are computer-limited", {
    x: 0.3, y: 6.82, w: 12.5, h: 0.32, fontSize: 9.5, color: C.midBlue, italic: true
  });
}

// ─── SECTION 3: CHRONIC PAIN ──────────────────────────────────────────────────
addSectionDivider("SECTION 04 & 05", "Chronic Pain: Classification & Management");

// Slide 10: Chronic Pain Classification
{
  const sl = makeContentSlide("Chronic Pain: Classification (IASP 2020)");
  sl.addShape(pres.ShapeType.roundRect, { x: 0.3, y: 1.0, w: 12.7, h: 0.75, fill: { color: C.orange }, line: { color: C.orange }, rectRadius: 0.06 });
  sl.addText("Chronic Pain = Pain persisting or recurring for > 3 months  (Bailey & Love 28e)", {
    x: 0.5, y: 1.0, w: 12.3, h: 0.75, fontSize: 15, bold: true, color: C.white, align: "center", valign: "middle"
  });

  // Two main types
  const types = [
    {
      title: "Chronic PRIMARY Pain",
      subtitle: "(Disease in its own right)",
      color: C.red,
      examples: ["Fibromyalgia", "Non-specific low back pain", "Complex Regional Pain Syndrome", "Primary headache syndromes"]
    },
    {
      title: "Chronic SECONDARY Pain",
      subtitle: "(Pain as symptom of underlying disease)",
      color: C.midBlue,
      examples: [
        "Cancer-related pain",
        "Neuropathic pain",
        "Secondary visceral pain",
        "Post-traumatic / postsurgical pain",
        "Secondary headache & orofacial pain",
        "Secondary musculoskeletal pain"
      ]
    }
  ];
  types.forEach((t, i) => {
    const x = 0.3 + i * 6.5;
    sl.addShape(pres.ShapeType.rect, { x, y: 1.9, w: 6.2, h: 0.7, fill: { color: t.color }, line: { color: t.color } });
    sl.addText(t.title, { x, y: 1.9, w: 6.2, h: 0.45, fontSize: 14.5, bold: true, color: C.white, align: "center", valign: "middle" });
    sl.addText(t.subtitle, { x, y: 2.35, w: 6.2, h: 0.28, fontSize: 11, color: C.gold, align: "center", fontFace: "Calibri", italic: true });
    t.examples.forEach((ex, j) => {
      const bg = j % 2 === 0 ? C.offWhite : C.white;
      sl.addShape(pres.ShapeType.rect, { x, y: 2.65 + j * 0.58, w: 6.2, h: 0.55, fill: { color: bg }, line: { color: C.lightGray } });
      sl.addText("  ▸  " + ex, { x, y: 2.68 + j * 0.58, w: 6.2, h: 0.5, fontSize: 12.5, color: C.navy, fontFace: "Calibri", valign: "middle" });
    });
  });
}

// Slide 11: Mechanisms of Chronic Pain
{
  const sl = makeContentSlide("Mechanisms of Chronic Pain");
  const mechs = [
    {
      title: "NOCICEPTIVE PAIN",
      color: C.orange,
      desc: "Musculoskeletal / cancer activating cutaneous nociceptors.\nProlonged ischaemia / inflammation → peripheral sensitisation.\nCentral dorsal horn sensitisation → hyperalgesia, allodynia.",
      examples: "OA, cancer, ischaemic limb pain"
    },
    {
      title: "NEUROPATHIC PAIN",
      color: C.red,
      desc: "Dysfunction in peripheral or central nerves.\nClassically: burning, shooting, stabbing character.\nAssociated with allodynia, numbness, reduced thermal sensation.",
      examples: "Post-herpetic neuralgia, diabetic neuropathy, FBSS"
    },
    {
      title: "CENTRAL SENSITISATION",
      color: C.purple,
      desc: "↑ Responsiveness of CNS nociceptive neurones.\nInnocuous stimuli interpreted as painful (allodynia).\nNMDA receptor & wind-up phenomena in dorsal horn.",
      examples: "Fibromyalgia, CRPS, phantom limb"
    }
  ];
  mechs.forEach((m, i) => {
    const x = 0.3 + i * 4.35;
    sl.addShape(pres.ShapeType.rect, { x, y: 1.05, w: 4.1, h: 0.6, fill: { color: m.color }, line: { color: m.color } });
    sl.addText(m.title, { x, y: 1.05, w: 4.1, h: 0.6, fontSize: 13, bold: true, color: C.white, align: "center", valign: "middle" });
    sl.addShape(pres.ShapeType.roundRect, { x, y: 1.7, w: 4.1, h: 3.0, fill: { color: C.cardBg }, line: { color: m.color }, rectRadius: 0.06 });
    sl.addText(m.desc, { x: x + 0.15, y: 1.8, w: 3.8, h: 2.5, fontSize: 12.5, color: C.offWhite, fontFace: "Calibri", valign: "top" });
    sl.addShape(pres.ShapeType.rect, { x, y: 4.75, w: 4.1, h: 0.55, fill: { color: m.color }, line: { color: m.color } });
    sl.addText("e.g. " + m.examples, { x, y: 4.75, w: 4.1, h: 0.55, fontSize: 11, color: C.white, align: "center", valign: "middle", italic: true });
  });

  // Gate theory
  sl.addShape(pres.ShapeType.roundRect, { x: 0.3, y: 5.42, w: 12.7, h: 0.9, fill: { color: C.offWhite }, line: { color: C.midBlue }, rectRadius: 0.06 });
  sl.addText([
    { text: "Gate Control Theory (Melzack & Wall): ", options: { bold: true, color: C.midBlue } },
    { text: "Pain is not only subjective but also a multidimensional experience incorporating sensory/discriminative, motivational/affective and cognitive aspects. Aβ fibre stimulation 'closes the gate' in the dorsal horn, reducing pain transmission.", options: { color: C.navy } }
  ], { x: 0.5, y: 5.47, w: 12.3, h: 0.82, fontSize: 12.5, fontFace: "Calibri", valign: "middle" });
}

// Slide 12: Chronic Pain Key Terms
{
  const sl = makeContentSlide("Key Terms in Chronic Pain (Bailey & Love 28e — Summary Box 23.10)");
  const terms = [
    ["Allodynia", "Pain due to a stimulus that does not normally provoke pain. Change in quality (tactile, thermal) of sensation"],
    ["Hyperalgesia", "Abnormally heightened sensitivity to a stimulus that is normally painful"],
    ["Central Sensitisation", "Increased responsiveness of CNS nociceptive neurones. Innocuous stimuli interpreted as painful"],
    ["Analgesia", "Absence of pain in response to stimulation that would normally be painful"],
    ["Epidural Space", "Space between ligamentum flavum and dura, from foramen magnum to sacrum. Site for catheters/leads"],
    ["Wind-up", "Progressive increase in amplitude of pain signal with repeated low-frequency stimulation (C-fibre)"],
    ["Breakthrough Pain", "Acute, excruciating pain in patients with otherwise controlled background pain. Spontaneous or triggered"],
  ];
  const colW2 = [2.5, 9.7];
  const colX2 = [0.3, 2.85];
  terms.forEach((row, r) => {
    const bg = r % 2 === 0 ? C.offWhite : C.white;
    const colors2 = [C.teal, C.orange, C.purple, C.green, C.accentBlue, C.red, C.midBlue];
    sl.addShape(pres.ShapeType.rect, { x: colX2[0], y: 1.05 + r * 0.72, w: colW2[0], h: 0.68, fill: { color: colors2[r] }, line: { color: colors2[r] } });
    sl.addText(row[0], { x: colX2[0], y: 1.05 + r * 0.72, w: colW2[0], h: 0.68, fontSize: 13, bold: true, color: C.white, align: "center", valign: "middle" });
    sl.addShape(pres.ShapeType.rect, { x: colX2[1], y: 1.05 + r * 0.72, w: colW2[1], h: 0.68, fill: { color: bg }, line: { color: C.lightGray } });
    sl.addText(row[1], { x: colX2[1] + 0.15, y: 1.08 + r * 0.72, w: colW2[1] - 0.3, h: 0.62, fontSize: 12.5, color: C.navy, fontFace: "Calibri", valign: "middle" });
  });
}

// Slide 13: Biopsychosocial model flowchart
{
  const sl = makeContentSlide("Biopsychosocial Model of Chronic Pain Management");
  // Three overlapping domains
  const domains = [
    { title: "BIOLOGICAL", color: C.teal, x: 0.5, items: ["Nociceptor sensitisation", "Neuroplasticity", "Inflammation", "Genetic factors", "Pharmacotherapy"] },
    { title: "PSYCHOLOGICAL", color: C.purple, x: 4.65, items: ["Catastrophising", "Fear-avoidance", "CBT / Mindfulness", "Mood disorders", "Psychological therapy"] },
    { title: "SOCIAL", color: C.orange, x: 8.8, items: ["Work / disability", "Social support", "Cultural beliefs", "Economic factors", "Social rehabilitation"] },
  ];
  domains.forEach((d) => {
    sl.addShape(pres.ShapeType.rect, { x: d.x, y: 1.0, w: 4.0, h: 0.6, fill: { color: d.color }, line: { color: d.color } });
    sl.addText(d.title, { x: d.x, y: 1.0, w: 4.0, h: 0.6, fontSize: 15, bold: true, color: C.white, align: "center", valign: "middle" });
    d.items.forEach((item, i) => {
      const bg = i % 2 === 0 ? C.offWhite : C.white;
      sl.addShape(pres.ShapeType.rect, { x: d.x, y: 1.65 + i * 0.62, w: 4.0, h: 0.58, fill: { color: bg }, line: { color: d.color } });
      sl.addText("  ▸  " + item, { x: d.x, y: 1.68 + i * 0.62, w: 4.0, h: 0.52, fontSize: 12.5, color: C.navy, fontFace: "Calibri", valign: "middle" });
    });
  });
  // Bottom convergence arrow
  sl.addShape(pres.ShapeType.rect, { x: 0.5, y: 5.0, w: 12.3, h: 0.06, fill: { color: C.gold }, line: { color: C.gold } });
  sl.addShape(pres.ShapeType.triangle, { x: 6.0, y: 4.8, w: 1.3, h: 0.55, fill: { color: C.gold }, line: { color: C.gold } });
  sl.addShape(pres.ShapeType.roundRect, { x: 3.0, y: 5.2, w: 7.3, h: 1.15, fill: { color: C.midBlue }, line: { color: C.gold }, rectRadius: 0.08 });
  sl.addText("MULTIDISCIPLINARY MULTIMODAL TREATMENT APPROACH", {
    x: 3.0, y: 5.2, w: 7.3, h: 0.55, fontSize: 14, bold: true, color: C.gold, align: "center", valign: "middle"
  });
  sl.addText("Physio + Exercise  |  Psychological Interventions  |  Pharmacotherapy  |  Pain Management Programmes", {
    x: 3.0, y: 5.78, w: 7.3, h: 0.52, fontSize: 11.5, color: C.offWhite, align: "center", fontFace: "Calibri"
  });
  sl.addText("Bailey & Love 28e: Multidimensional approach — key component per IASP guidance", {
    x: 0.4, y: 6.85, w: 12.5, h: 0.28, fontSize: 9, color: C.accentBlue, italic: true
  });
}

// Slide 14: Pharmacological Chronic Pain
{
  const sl = makeContentSlide("Pharmacological Management of Chronic Pain");
  // Flowchart
  const steps = [
    { label: "ASSESS PAIN TYPE", sub: "Nociceptive vs Neuropathic vs Mixed", color: C.midBlue, x: 4.65, y: 1.0, w: 4.0 },
  ];
  // Nociceptive path
  sl.addShape(pres.ShapeType.rect, { x: 4.65, y: 1.0, w: 4.0, h: 0.75, fill: { color: C.midBlue }, line: { color: C.gold } });
  sl.addText("ASSESS PAIN TYPE", { x: 4.65, y: 1.0, w: 4.0, h: 0.45, fontSize: 15, bold: true, color: C.gold, align: "center", valign: "middle" });
  sl.addText("Nociceptive vs Neuropathic vs Mixed", { x: 4.65, y: 1.45, w: 4.0, h: 0.3, fontSize: 11, color: C.offWhite, align: "center" });

  // Arrow down + split
  sl.addShape(pres.ShapeType.rect, { x: 6.4, y: 1.75, w: 0.5, h: 0.4, fill: { color: C.lightGray }, line: { color: C.lightGray } });
  sl.addShape(pres.ShapeType.rect, { x: 0.3, y: 2.15, w: 12.7, h: 0.06, fill: { color: C.lightGray }, line: { color: C.lightGray } });

  const pathways = [
    {
      title: "NOCICEPTIVE PAIN",
      color: C.orange,
      x: 0.3,
      drugs: [
        ["Step 1", "Paracetamol + NSAIDs", C.teal],
        ["Step 2", "Add: Weak opioids (codeine, tramadol)", C.orange],
        ["Step 3", "Strong opioids (slow-release morphine, oxycodone, fentanyl patch)", C.red],
      ]
    },
    {
      title: "NEUROPATHIC PAIN",
      color: C.purple,
      x: 6.8,
      drugs: [
        ["1st line", "Gabapentin / Pregabalin (α2δ Ca channel)", C.purple],
        ["2nd line", "Tricyclic antidepressants (amitriptyline)", C.accentBlue],
        ["Adjunct", "Low-dose opioids; SNRI (duloxetine)", C.red],
      ]
    }
  ];
  pathways.forEach((p) => {
    sl.addShape(pres.ShapeType.rect, { x: p.x, y: 2.25, w: 6.3, h: 0.6, fill: { color: p.color }, line: { color: p.color } });
    sl.addText(p.title, { x: p.x, y: 2.25, w: 6.3, h: 0.6, fontSize: 14, bold: true, color: C.white, align: "center", valign: "middle" });
    p.drugs.forEach(([step, drug, col], i) => {
      sl.addShape(pres.ShapeType.rect, { x: p.x, y: 2.92 + i * 1.0, w: 6.3, h: 0.9, fill: { color: i % 2 === 0 ? C.offWhite : C.white }, line: { color: C.lightGray } });
      sl.addShape(pres.ShapeType.rect, { x: p.x, y: 2.92 + i * 1.0, w: 1.1, h: 0.9, fill: { color: col }, line: { color: col } });
      sl.addText(step, { x: p.x, y: 2.92 + i * 1.0, w: 1.1, h: 0.9, fontSize: 11.5, bold: true, color: C.white, align: "center", valign: "middle" });
      sl.addText(drug, { x: p.x + 1.2, y: 2.97 + i * 1.0, w: 4.9, h: 0.8, fontSize: 12.5, color: C.navy, fontFace: "Calibri", valign: "middle" });
    });
  });
  sl.addText("Bailey & Love 28e: Pregabalin/gabapentin for neuropathic pain; slow-release opioids for severe non-malignant pain", {
    x: 0.4, y: 6.85, w: 12.5, h: 0.28, fontSize: 9, color: C.accentBlue, italic: true
  });
}

// Slide 15: Interventional Pain Management
{
  const sl = makeContentSlide("Interventional Pain Management for Chronic Pain");
  const interventions = [
    {
      title: "LA + Steroid Injections",
      color: C.teal,
      icon: "💉",
      desc: "Injected around inflamed nerve root. Breaks cycle of constant pain → muscle spasm. Transforaminal selective root blocks for nerve root irritation ± minor disc prolapse. Followed by active physiotherapy.",
    },
    {
      title: "Nerve Stimulation",
      color: C.orange,
      icon: "⚡",
      desc: "Acupuncture & TENS: increase endorphin production in CNS. Non-pharmacological pain modulation at the gate control level. Widely available; low risk profile.",
    },
    {
      title: "Spinal Cord Stimulation (SCS)",
      color: C.red,
      icon: "🔋",
      desc: "Electrodes in posterior epidural space. Dorsal column stimulation via implantable pulse generator. NICE-recommended for intractable neuropathic pain. Strong evidence in Failed Back Surgery Syndrome (FBSS).",
    },
    {
      title: "Nerve Decompression / Surgery",
      color: C.purple,
      icon: "🔬",
      desc: "Craniotomy for trigeminal neuralgia (preferred over percutaneous ganglion coagulation). Sympathectomy for ischaemic limb pain. Reserved when conservative measures fail.",
    },
  ];
  interventions.forEach((iv, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.3 + col * 6.5;
    const y = 1.05 + row * 2.85;
    sl.addShape(pres.ShapeType.roundRect, { x, y, w: 6.2, h: 2.7, fill: { color: C.cardBg }, line: { color: iv.color }, rectRadius: 0.08 });
    sl.addShape(pres.ShapeType.rect, { x, y, w: 6.2, h: 0.65, fill: { color: iv.color }, line: { color: iv.color } });
    sl.addText(iv.title, { x: x + 0.15, y, w: 6.0, h: 0.65, fontSize: 14, bold: true, color: C.white, valign: "middle" });
    sl.addText(iv.desc, { x: x + 0.2, y: y + 0.75, w: 5.8, h: 1.85, fontSize: 12, color: C.offWhite, fontFace: "Calibri", valign: "top" });
  });
}

// Slide 16: Cancer Pain
{
  const sl = makeContentSlide("Pain Control in Malignant Disease");
  // Principle
  sl.addShape(pres.ShapeType.roundRect, { x: 0.4, y: 1.0, w: 12.5, h: 0.75, fill: { color: C.midBlue }, line: { color: C.gold }, rectRadius: 0.06 });
  sl.addText("Principle: Encourage independence and active life despite pain. Treat regularly, not PRN.", {
    x: 0.6, y: 1.0, w: 12.1, h: 0.75, fontSize: 14, bold: true, color: C.gold, align: "center", valign: "middle"
  });

  // WHO Ladder compact
  const ladderSteps = [
    ["STEP 1", "Paracetamol + NSAIDs + Tricyclics/Anticonvulsants", C.teal],
    ["STEP 2", "Weak opioids: Codeine, Tramadol ± Step 1", C.orange],
    ["STEP 3", "Strong opioids: Morphine, Oxycodone (SR), Fentanyl/Buprenorphine patches ± adjuvants", C.red],
  ];
  ladderSteps.forEach(([step, desc, col], i) => {
    const w = 4.0 + i * 1.5;
    const x = 6.65 - i * 0.75;
    sl.addShape(pres.ShapeType.rect, { x, y: 1.95 + i * 0.9, w, h: 0.8, fill: { color: col }, line: { color: col } });
    sl.addText(step + "  " + desc, { x: x + 0.15, y: 1.95 + i * 0.9, w: w - 0.2, h: 0.8, fontSize: 12.5, color: C.white, fontFace: "Calibri", valign: "middle" });
  });

  // Key pearls
  sl.addShape(pres.ShapeType.rect, { x: 0.4, y: 5.0, w: 12.5, h: 0.4, fill: { color: C.gold }, line: { color: C.gold } });
  sl.addText("KEY CLINICAL PEARLS", { x: 0.4, y: 5.0, w: 12.5, h: 0.4, fontSize: 13, bold: true, color: C.navy, align: "center", valign: "middle" });
  const pearls = [
    ["Oral morphine 4-hourly", "Titrate to pain control, then convert to 24h slow-release preparation"],
    ["Dependence ≠ Addiction", "Dependence = physiological; Addiction = psychosocial. Distinguish carefully"],
    ["Breakthrough pain", "Treat with short-acting opioid 1/6th of total daily dose PRN"],
    ["Opioid rotation", "Switch opioid if patient gets relief but has severe side effects"],
  ];
  pearls.forEach(([title, desc], i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.4 + col * 6.35;
    const y = 5.5 + row * 0.6;
    sl.addShape(pres.ShapeType.rect, { x, y, w: 2.2, h: 0.55, fill: { color: C.midBlue }, line: { color: C.midBlue } });
    sl.addText(title, { x, y, w: 2.2, h: 0.55, fontSize: 11, bold: true, color: C.gold, align: "center", valign: "middle" });
    sl.addShape(pres.ShapeType.rect, { x: x + 2.2, y, w: 3.95, h: 0.55, fill: { color: C.offWhite }, line: { color: C.lightGray } });
    sl.addText(desc, { x: x + 2.3, y, w: 3.75, h: 0.55, fontSize: 11, color: C.navy, fontFace: "Calibri", valign: "middle" });
  });
}

// Slide 17: Summary / Key Take-Aways
{
  const sl = pres.addSlide();
  sl.background = { color: C.navy };
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.9, fill: { color: C.midBlue }, line: { color: C.midBlue } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0.9, w: 13.3, h: 0.06, fill: { color: C.gold }, line: { color: C.gold } });
  sl.addText("KEY TAKE-AWAYS", { x: 0.4, y: 0.1, w: 12.5, h: 0.7, fontSize: 26, bold: true, color: C.white, valign: "middle" });

  const takeaways = [
    { icon: "1", text: "Pain is the 5th vital sign — assess with validated scales (NRS/VRS/FACES) on every encounter", color: C.teal },
    { icon: "2", text: "Multimodal analgesia (paracetamol + NSAID + opioid ± regional) reduces opioid dose and side effects", color: C.orange },
    { icon: "3", text: "Nociception has 4 steps: Transduction → Transmission → Modulation → Perception — target all levels", color: C.accentBlue },
    { icon: "4", text: "Epidural + PCA are gold standard for moderate-severe postoperative pain; PCA empowers patients", color: C.green },
    { icon: "5", text: "Chronic pain (≥ 3 months) requires a biopsychosocial multidisciplinary approach — not just drugs", color: C.purple },
    { icon: "6", text: "Neuropathic pain responds to gabapentin/pregabalin and tricyclics, NOT just opioids", color: C.red },
    { icon: "7", text: "WHO Analgesic Ladder guides stepwise escalation; oral route preferred; treat regularly not PRN", color: C.gold },
    { icon: "8", text: "SCS (Spinal Cord Stimulation) is NICE-recommended for intractable neuropathic pain (FBSS)", color: C.teal },
  ];
  takeaways.forEach((t, i) => {
    const col = i < 4 ? 0 : 1;
    const row = i % 4;
    const x = 0.4 + col * 6.55;
    const y = 1.15 + row * 1.45;
    sl.addShape(pres.ShapeType.ellipse, { x, y, w: 0.75, h: 0.75, fill: { color: t.color }, line: { color: t.color } });
    sl.addText(t.icon, { x, y, w: 0.75, h: 0.75, fontSize: 18, bold: true, color: C.white, align: "center", valign: "middle" });
    sl.addShape(pres.ShapeType.roundRect, { x: x + 0.85, y, w: 5.5, h: 0.9, fill: { color: C.cardBg }, line: { color: t.color }, rectRadius: 0.06 });
    sl.addText(t.text, { x: x + 1.0, y: y + 0.05, w: 5.2, h: 0.8, fontSize: 12.5, color: C.offWhite, fontFace: "Calibri", valign: "middle" });
  });
}

// Slide 18: References
{
  const sl = pres.addSlide();
  sl.background = { color: C.deepBlue };
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.9, fill: { color: C.midBlue }, line: { color: C.midBlue } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0.9, w: 13.3, h: 0.06, fill: { color: C.gold }, line: { color: C.gold } });
  sl.addText("REFERENCES", { x: 0.4, y: 0.1, w: 12.5, h: 0.7, fontSize: 26, bold: true, color: C.white });
  const refs = [
    "1.  Williams NS, O'Connell PR, McCaskie AW, eds. Bailey & Love's Short Practice of Surgery, 28th Edition. CRC Press/Taylor & Francis; 2023. Chapter 23: Anaesthesia and Pain Relief.",
    "2.  Sabiston Textbook of Surgery: The Biological Basis of Modern Surgical Practice. Chapter 20: Anaesthesia Principles, Management; Chapter — Critical Care (Pain in ICU).",
    "3.  International Association for the Study of Pain (IASP). Revised definition of pain, 2020. https://www.iasp-pain.org",
    "4.  NICE Guideline [NG59]. Spinal cord stimulation for chronic pain. National Institute for Health and Care Excellence, UK.",
    "5.  World Health Organization. WHO Analgesic Ladder for Cancer Pain Management. Geneva: WHO; 1986 (revised 2019).",
    "6.  Treede RD, Rief W, Barke A, et al. Chronic pain as a symptom or a disease: the IASP classification of chronic pain. Pain. 2019;160(1):19-27.",
  ];
  refs.forEach((r, i) => {
    sl.addShape(pres.ShapeType.rect, { x: 0.4, y: 1.15 + i * 0.88, w: 12.5, h: 0.82, fill: { color: i % 2 === 0 ? C.cardBg : C.cardBg2 }, line: { color: C.midBlue } });
    sl.addText(r, { x: 0.55, y: 1.2 + i * 0.88, w: 12.2, h: 0.72, fontSize: 11.5, color: C.offWhite, fontFace: "Calibri", valign: "middle" });
  });
}

// ─── WRITE FILE ──────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/pain-management-ppt/Pain_Management_Surgery.pptx" })
  .then(() => console.log("SUCCESS: Pain_Management_Surgery.pptx created"))
  .catch(e => { console.error("ERROR:", e); process.exit(1); });
Running Command

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

Running Command

ls -lh /home/daytona/workspace/pain-management-ppt/Pain_Management_Surgery.pptx

Your presentation is ready! Here is the download link:

Pain Management Surgery

Presentation · PPTX


What's inside the presentation (18 slides, 16:9 wide format)

The deck uses a deep navy/teal/gold color palette with a professional dark header and footer on every content slide. Here is the full slide-by-slide breakdown:
#SlideSource
1Title slide — Topic, both textbooks cited-
2Table of Contents — 10 numbered sections-
3Section divider-
4Pain: Definition & Core Concepts — IASP definition, Acute vs Chronic tableBoth books
5Mechanisms of Nociception — 4-Step Pathway — Transduction, Transmission, Modulation, Perception + nerve fibre types (Aδ, C, Aβ)Sabiston Ch. 20
6Section divider-
7Principles of Postoperative Pain Management — Spider/wheel diagram of multimodal analgesiaBailey & Love 28e, Ch. 23
8WHO Analgesic Ladder — Visual pyramid with 3 steps and drug examplesBailey & Love 28e
9Pharmacological Agents — Color-coded table: Paracetamol, NSAIDs, Opioids, Gabapentinoids, TCAs, KetamineBoth books
10Regional & Neuraxial Analgesia — Epidural, Spinal, Peripheral nerve blocks (TAP, QL, erector spinae, paravertebral)Bailey & Love 28e
11PCA (Patient-Controlled Analgesia) — Pump schematic, Advantages vs Cautions panelsBailey & Love 28e
12Section divider-
13Chronic Pain Classification (IASP 2020) — Primary vs 6 subtypes of secondary chronic painBailey & Love 28e
14Mechanisms of Chronic Pain — Nociceptive, Neuropathic, Central Sensitisation + Gate Control TheoryBailey & Love 28e
15Key Terms — Summary Box 23.10: Allodynia, Hyperalgesia, Central Sensitisation, Wind-up, Breakthrough painBailey & Love 28e
16Biopsychosocial Model flowchart — Biological + Psychological + Social converging to Multidisciplinary TxBailey & Love 28e
17Pharmacological Chronic Pain Management — Flowchart: Nociceptive ladder vs Neuropathic pathwayBoth books
18Interventional Pain Management — LA/steroid injections, TENS/Acupuncture, SCS (NICE), SurgeryBailey & Love 28e
19Cancer Pain + WHO Ladder — Clinical pearls: oral morphine titration, dependence vs addiction, opioid rotationBailey & Love 28e
20Key Take-Aways (8 numbered)-
21References-

Make a paper on in signal hernia after cesarean section

Asking for Preferences
Asking for Preferences
Reading File
Finding Sources
Searching PubMed

incisional hernia cesarean section

Reading Article

PMID: 31785469

Reading Article

PMID: 35573578

Reading Article

PMID: 34191393

Finding Sources
Reading File
Reading File
Reading Article

PMID: 38129081

Reading File
Reading Article

PMID: 34610046

Reading File
Writing File

~/incisional-hernia-cs/create_case_report.js

const {
  Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
  Header, Footer, AlignmentType, LevelFormat, HeadingLevel, BorderStyle,
  WidthType, ShadingType, VerticalAlign, PageNumber, PageBreak,
  convertInchesToTwip
} = require("docx");
const fs = require("fs");

// ─── NUMBERING CONFIG ────────────────────────────────────────────────────────
const numberingConfig = {
  config: [
    {
      reference: "bullets",
      levels: [{
        level: 0, format: LevelFormat.BULLET, text: "\u2022",
        alignment: AlignmentType.LEFT,
        style: {
          paragraph: { indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.25) } },
          run: { font: "Arial" }
        }
      }]
    },
    {
      reference: "numberedList",
      levels: [{
        level: 0, format: LevelFormat.DECIMAL, text: "%1.",
        alignment: AlignmentType.LEFT,
        style: {
          paragraph: { indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.25) } },
          run: { font: "Arial" }
        }
      }]
    }
  ]
};

// ─── HELPERS ─────────────────────────────────────────────────────────────────
function h1(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_1,
    children: [new TextRun({ text, bold: true, size: 32, font: "Arial", color: "1A3A6B" })]
  });
}
function h2(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_2,
    children: [new TextRun({ text, bold: true, size: 28, font: "Arial", color: "0D7680" })]
  });
}
function para(text, opts = {}) {
  return new Paragraph({
    alignment: opts.center ? AlignmentType.CENTER : AlignmentType.JUSTIFIED,
    spacing: { after: 120, line: 360, lineRule: "auto" },
    children: [new TextRun({
      text,
      font: "Arial",
      size: opts.size || 24,
      bold: opts.bold || false,
      italic: opts.italic || false,
      color: opts.color || "000000"
    })]
  });
}
function richPara(runs, opts = {}) {
  return new Paragraph({
    alignment: opts.center ? AlignmentType.CENTER : AlignmentType.JUSTIFIED,
    spacing: { after: 120, line: 360, lineRule: "auto" },
    children: runs.map(r => new TextRun({ font: "Arial", size: 24, ...r }))
  });
}
function bullet(text) {
  return new Paragraph({
    numbering: { reference: "bullets", level: 0 },
    spacing: { after: 80, line: 320, lineRule: "auto" },
    children: [new TextRun({ text, font: "Arial", size: 24 })]
  });
}
function numberedItem(text) {
  return new Paragraph({
    numbering: { reference: "numberedList", level: 0 },
    spacing: { after: 80, line: 320, lineRule: "auto" },
    children: [new TextRun({ text, font: "Arial", size: 24 })]
  });
}
function spacer() {
  return new Paragraph({ children: [new TextRun("")], spacing: { after: 80 } });
}
function divider() {
  return new Paragraph({
    border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: "1A3A6B" } },
    children: [new TextRun("")],
    spacing: { after: 120 }
  });
}
function infoBox(label, value) {
  return new Paragraph({
    spacing: { after: 60, line: 300 },
    children: [
      new TextRun({ text: label + ": ", bold: true, font: "Arial", size: 23, color: "1A3A6B" }),
      new TextRun({ text: value, font: "Arial", size: 23 })
    ]
  });
}
function tableCell(text, isHeader = false, width = 2268) {
  return new TableCell({
    width: { size: width, type: WidthType.DXA },
    shading: isHeader ? { fill: "1A3A6B", type: ShadingType.CLEAR } : undefined,
    verticalAlign: VerticalAlign.CENTER,
    children: [new Paragraph({
      alignment: AlignmentType.CENTER,
      spacing: { after: 60, before: 60 },
      children: [new TextRun({
        text, font: "Arial", size: 22,
        bold: isHeader,
        color: isHeader ? "FFFFFF" : "000000"
      })]
    })]
  });
}

// ─── DOCUMENT ────────────────────────────────────────────────────────────────
const doc = new Document({
  numbering: numberingConfig,
  styles: {
    default: {
      document: { run: { font: "Arial", size: 24 } }
    },
    paragraphStyles: [
      {
        id: "Heading1", name: "Heading 1", basedOn: "Normal", next: "Normal", quickFormat: true,
        run: { size: 32, bold: true, font: "Arial", color: "1A3A6B" },
        paragraph: { spacing: { before: 300, after: 180 }, outlineLevel: 0 }
      },
      {
        id: "Heading2", name: "Heading 2", basedOn: "Normal", next: "Normal", quickFormat: true,
        run: { size: 28, bold: true, font: "Arial", color: "0D7680" },
        paragraph: { spacing: { before: 200, after: 120 }, outlineLevel: 1 }
      }
    ]
  },
  sections: [{
    properties: {
      page: {
        size: { width: 11906, height: 16838 }, // A4
        margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 }
      }
    },
    headers: {
      default: new Header({
        children: [new Paragraph({
          alignment: AlignmentType.RIGHT,
          border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: "1A3A6B" } },
          spacing: { after: 60 },
          children: [new TextRun({
            text: "Case Report: Incisional Hernia After Cesarean Section",
            font: "Arial", size: 18, color: "555555", italic: true
          })]
        })]
      })
    },
    footers: {
      default: new Footer({
        children: [new Paragraph({
          alignment: AlignmentType.CENTER,
          border: { top: { style: BorderStyle.SINGLE, size: 4, color: "1A3A6B" } },
          spacing: { before: 60 },
          children: [
            new TextRun({ text: "Page ", font: "Arial", size: 18, color: "555555" }),
            new PageNumber(),
            new TextRun({ text: "  |  Hypothetical Case Report  |  For Educational Purposes Only", font: "Arial", size: 18, color: "555555" })
          ]
        })]
      })
    },
    children: [

      // ─── TITLE ────────────────────────────────────────────────────────────
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { before: 400, after: 120 },
        children: [new TextRun({
          text: "Incisional Hernia Following Cesarean Section:",
          font: "Arial", size: 40, bold: true, color: "1A3A6B"
        })]
      }),
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { after: 120 },
        children: [new TextRun({
          text: "A Case Report and Review of Literature",
          font: "Arial", size: 32, bold: false, color: "0D7680", italic: true
        })]
      }),
      divider(),

      // ─── AUTHORS ─────────────────────────────────────────────────────────
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { after: 60 },
        children: [new TextRun({
          text: "[Author Name(s)]",
          font: "Arial", size: 24, color: "333333"
        })]
      }),
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { after: 60 },
        children: [new TextRun({
          text: "[Department of General Surgery / Obstetrics & Gynaecology, Institution Name, City, Country]",
          font: "Arial", size: 22, italic: true, color: "666666"
        })]
      }),
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { after: 200 },
        children: [new TextRun({
          text: "Correspondence: [email address]  |  Received: [date]  |  Accepted: [date]",
          font: "Arial", size: 20, italic: true, color: "999999"
        })]
      }),
      divider(),
      spacer(),

      // ─── ABSTRACT ────────────────────────────────────────────────────────
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { after: 100 },
        shading: { fill: "EFF3FA", type: ShadingType.CLEAR },
        children: [new TextRun({ text: "ABSTRACT", font: "Arial", size: 28, bold: true, color: "1A3A6B", allCaps: true })]
      }),

      richPara([
        { text: "Background: ", bold: true, color: "1A3A6B" },
        { text: "Incisional hernia is a recognised complication of abdominal surgery with a reported incidence of 0–5.6% specifically following cesarean section (CS). Although considered rare in the obstetric population, it poses significant diagnostic and management challenges, particularly when discovered incidentally during a subsequent pregnancy or CS." }
      ]),
      richPara([
        { text: "Case Presentation: ", bold: true, color: "1A3A6B" },
        { text: "We report a case of a 32-year-old woman (G3P2) who presented with a progressively enlarging, mildly tender lower abdominal bulge along her previous Pfannenstiel scar, first noted 14 months after her second cesarean section. Ultrasound and CT confirmed a 4.5 x 3.8 cm fascial defect with omental herniation and no evidence of strangulation. She underwent successful open mesh repair (sublay technique) with complete resolution of symptoms." }
      ]),
      richPara([
        { text: "Conclusion: ", bold: true, color: "1A3A6B" },
        { text: "Incisional hernia after CS, though uncommon, is underdiagnosed. Clinicians should maintain a high index of suspicion in women with abdominal symptoms following CS, especially in the presence of risk factors. Timely diagnosis, thorough preoperative optimisation, and mesh-based repair offer excellent outcomes." }
      ]),
      spacer(),

      richPara([
        { text: "Keywords: ", bold: true },
        { text: "incisional hernia; cesarean section; Pfannenstiel incision; ventral hernia; mesh repair; obstetric complication; wound dehiscence", italic: true }
      ]),
      divider(),
      spacer(),

      // ─── 1. INTRODUCTION ─────────────────────────────────────────────────
      h1("1. Introduction"),

      para("Cesarean section (CS) is one of the most commonly performed surgical procedures worldwide. In 2015, the median CS rate in Europe was 27%, with rates as high as 57% in certain countries, and the global trend continues to rise [1]. Despite being considered a relatively safe procedure, CS is associated with a spectrum of short- and long-term surgical complications, including wound infection, haematoma, adhesions, bowel obstruction, and incisional hernia."),

      para("Incisional hernia is defined as a protrusion of abdominal contents through a defect in the musculofascial layers at the site of a previous surgical incision. In the general surgical population, incisional hernias occur in 10–50% of laparotomy incisions; however, after CS, the reported incidence is considerably lower, ranging from 0.0% to 5.6% across studies with follow-up of six months to ten years [1,2]."),

      para("The Pfannenstiel incision - the most widely used approach for CS - offers cosmetic benefits and superior abdominal wall integrity compared to midline laparotomy; however, it is not immune to hernia formation. Several patient-related, wound-related, and surgical factors contribute to the risk of fascial dehiscence and subsequent hernia development in this population [3,4]."),

      para("Incisional hernia after CS is frequently underreported due to delayed presentation (months to years post-surgery), misattribution of symptoms to other pelvic pathology, and the relatively low index of suspicion among both patients and clinicians. When a hernia is discovered during a subsequent pregnancy, management becomes particularly challenging, requiring a coordinated multidisciplinary approach [5]."),

      para("We present a hypothetical but clinically representative case of an incisional hernia developing after two previous cesarean sections, followed by a review of the epidemiology, pathophysiology, clinical features, diagnostic approach, and current management strategies, drawing on published literature and standard surgical textbook guidance."),
      spacer(),

      // ─── 2. CASE PRESENTATION ────────────────────────────────────────────
      h1("2. Case Presentation"),

      // Patient demographics table
      new Paragraph({
        spacing: { after: 100 },
        children: [new TextRun({ text: "Table 1. Patient Demographics and Obstetric History", bold: true, font: "Arial", size: 24, color: "1A3A6B" })]
      }),
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({ children: [
            tableCell("Parameter", true, 3000),
            tableCell("Details", true, 6200)
          ]}),
          new TableRow({ children: [tableCell("Age"), tableCell("32 years", false, 6200)] }),
          new TableRow({ children: [tableCell("Parity"), tableCell("G3P2 (two previous cesarean sections, one first-trimester miscarriage)", false, 6200)] }),
          new TableRow({ children: [tableCell("BMI"), tableCell("31 kg/m² (obese class I)", false, 6200)] }),
          new TableRow({ children: [tableCell("Smoking"), tableCell("Ex-smoker (ceased 3 years prior)", false, 6200)] }),
          new TableRow({ children: [tableCell("Comorbidities"), tableCell("Gestational diabetes (resolved), mild iron-deficiency anaemia", false, 6200)] }),
          new TableRow({ children: [tableCell("First CS (4 years ago)"), tableCell("Emergency CS at 37+2 weeks for foetal distress; Pfannenstiel incision; complicated by superficial wound infection, managed with antibiotics", false, 6200)] }),
          new TableRow({ children: [tableCell("Second CS (18 months ago)"), tableCell("Elective CS at 39 weeks for previous CS; Pfannenstiel incision; wound healing uneventful at discharge; patient not followed up systematically", false, 6200)] }),
        ]
      }),
      spacer(),

      h2("2.1 Presenting Complaint"),
      para("The patient presented to the surgical outpatient clinic 14 months after her second CS, complaining of a progressively enlarging swelling in the lower abdomen along the line of her Pfannenstiel scar. The swelling had been noted as a 'soft lump' approximately 6 months post-operatively, initially dismissed as post-operative swelling. She reported mild, intermittent aching discomfort, aggravated by prolonged standing, heavy lifting (caring for two young children), and straining. There was no history of sudden severe pain, vomiting, or bowel disturbance suggestive of obstruction or strangulation."),

      h2("2.2 Physical Examination"),
      para("Vital signs were stable. General examination revealed a mildly obese woman in no acute distress. Abdominal examination demonstrated a Pfannenstiel scar with a palpable, reducible subcutaneous swelling measuring approximately 5 x 4 cm centred 2 cm above the pubic symphysis, just to the left of the midline. The swelling had a cough impulse. The skin overlying the hernia was intact without thinning or ulceration. Bowel sounds were normal. There was no peritonism."),

      para("Pelvic examination was unremarkable. A speculum examination confirmed normal cervix and vaginal walls."),

      h2("2.3 Investigations"),
      new Paragraph({
        spacing: { after: 100 },
        children: [new TextRun({ text: "Table 2. Summary of Investigations", bold: true, font: "Arial", size: 24, color: "1A3A6B" })]
      }),
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({ children: [
            tableCell("Investigation", true, 3000),
            tableCell("Finding", true, 6200)
          ]}),
          new TableRow({ children: [tableCell("FBC"), tableCell("Hb 11.2 g/dL (mild anaemia); WBC 7.4 × 10⁹/L; Platelets normal", false, 6200)] }),
          new TableRow({ children: [tableCell("Renal & LFTs"), tableCell("Within normal limits", false, 6200)] }),
          new TableRow({ children: [tableCell("Serum albumin"), tableCell("38 g/L (low-normal; relevant for wound healing)", false, 6200)] }),
          new TableRow({ children: [tableCell("Urine hCG"), tableCell("Negative", false, 6200)] }),
          new TableRow({ children: [tableCell("Abdominal Ultrasound"), tableCell("4.5 × 3.8 cm fascial defect in the lower anterior abdominal wall. Hernial sac containing echogenic omental fat. No bowel loops identified within the sac. No Doppler evidence of strangulation.", false, 6200)] }),
          new TableRow({ children: [tableCell("CT Abdomen/Pelvis"), tableCell("Confirmed: 4.5 cm fascial defect in the linea alba, inferior to umbilicus, at the site of the Pfannenstiel incision. Hernial sac containing omentum. No acute complications. No additional occult defects identified.", false, 6200)] }),
        ]
      }),
      spacer(),

      h2("2.4 Operative Management"),
      para("Following multidisciplinary review with anaesthetics, the patient was optimised prior to surgery. She completed a 6-week prehabilitation programme: iron supplementation for anaemia correction, dietitian-guided weight management (lost 4 kg), and cessation counselling (confirmed non-smoker). Preoperative assessment confirmed fitness for surgery (ASA II)."),

      para("She underwent elective open incisional hernia repair under general anaesthesia in the supine position. Intraoperative findings are detailed below:"),

      bullet("A transverse skin incision was made along the previous Pfannenstiel scar."),
      bullet("Dissection through subcutaneous fat revealed a well-defined oval fascial defect (4.5 × 3.8 cm) at the inferior aspect of the linea alba, extending to the pubic symphysis."),
      bullet("The hernial sac was identified, containing adherent omentum. No bowel was present within the sac."),
      bullet("The sac was dissected and reduced. The omentum was viable and reduced into the peritoneal cavity."),
      bullet("A pre-peritoneal (sublay) polypropylene mesh (10 × 8 cm) was placed posterior to the rectus muscles, overlapping the defect edges by at least 3 cm in all directions."),
      bullet("The mesh was fixed with interrupted non-absorbable sutures. The fascia was closed over the mesh with a running looped PDS suture (small-stitch, small-bite technique per European Hernia Society guidelines)."),
      bullet("A closed suction drain was placed in the subcutaneous space. Subcuticular closure of skin."),

      spacer(),
      para("Operative time: 68 minutes. Estimated blood loss: 80 mL. No intraoperative complications."),

      h2("2.5 Postoperative Course"),
      para("The patient was managed with a standard enhanced recovery protocol. Oral analgesia (paracetamol + ibuprofen) was commenced from day 1. She was mobilised on the same day as surgery. The drain was removed on day 2 with minimal output. She was discharged home on day 3 with instructions to wear an abdominal binder and avoid heavy lifting for 6 weeks."),
      para("At 6-week follow-up, the surgical wound was well-healed. She had no recurrence of the bulge. At 1-year review she remained symptom-free with no hernia recurrence on clinical examination."),
      spacer(),

      // ─── 3. DISCUSSION ───────────────────────────────────────────────────
      h1("3. Discussion"),

      h2("3.1 Epidemiology"),
      para("Cesarean section is among the most commonly performed surgical procedures globally, yet the incidence of incisional hernia as a long-term complication has historically been underappreciated. A systematic review by Paulsen et al. (2020) identified five studies comprising 275,878 women with previous CS and found an incisional hernia incidence of 0.0–5.6% across follow-up periods of 6 months to 10 years [1]. This wide range reflects heterogeneity in study design, definition of hernia, method of diagnosis, and follow-up duration."),

      para("A large population-based cohort study from Sweden (Larsson et al., 2021) analysed 79,052 women who delivered by CS only and compared them to a vaginally delivered control group. CS was associated with a significantly elevated risk of incisional hernia (OR 2.71; 95% CI 2.46–3.00) and surgery for incisional hernia (OR 3.35; 95% CI 2.68–4.18) [4]. More than one CS, obesity, and smoking were identified as significant independent risk factors."),

      para("The true incidence is likely higher than reported. Many patients attribute abdominal wall symptoms to other causes, clinicians may not routinely examine the scar, and mild hernias may remain asymptomatic for years before presentation."),

      h2("3.2 Pathophysiology and Risk Factors"),
      para("Incisional hernias arise through a defect in the musculofascial layers at the site of a surgical wound. Bailey and Love's Short Practice of Surgery (28th Edition) describes three categories of predisposing factors:"),

      richPara([{ text: "(i) Patient Factors: ", bold: true }, { text: "Obesity (BMI > 30), smoking, malnutrition, diabetes mellitus, immunosuppression, steroid therapy, chronic cough, genetic collagen disorders (e.g. Ehlers-Danlos syndrome), and cancer." }]),
      richPara([{ text: "(ii) Wound Factors: ", bold: true }, { text: "Wound infection (the most important modifiable risk factor), poor quality tissues, haematoma formation, and excessive wound tension." }]),
      richPara([{ text: "(iii) Surgical Factors: ", bold: true }, { text: "Inappropriate suture material, poor closure technique, inadequate fascial bite, and excessive dead space." }]),

      spacer(),
      para("In the context of CS specifically, additional factors include the rapidly changing abdominal wall dynamics during pregnancy and the puerperium, increased intra-abdominal pressure, relative immunosuppression of pregnancy, the low transverse nature of the Pfannenstiel incision (which crosses the relatively avascular linea alba at the pubic region), and the common occurrence of wound complications such as haematoma and infection in this population."),

      para("The initial event in incisional hernia formation is usually disruption of the musculofascial layers in the early postoperative period. This may pass unnoticed if the overlying skin heals securely; the visible swelling may take weeks, months, or years to develop [3]. The hernia typically enlarges progressively with time; the overlying skin may become atrophic and susceptible to ulceration with increasing intra-abdominal pressure."),

      h2("3.3 Clinical Presentation and Diagnosis"),
      para("Incisional hernia following CS most commonly presents as a localised swelling in the lower abdominal midline or along the Pfannenstiel scar. The presentation is variable:"),

      bullet("Asymptomatic incidental bulge (found on examination or imaging)"),
      bullet("Intermittent aching or dragging discomfort, worsened by exertion"),
      bullet("Reducible swelling with a positive cough impulse"),
      bullet("Irreducible hernia with or without signs of obstruction"),
      bullet("Acute emergency presentation with strangulation (uncommon given the wide-necked nature of incisional hernias)"),
      bullet("Rarely, in pregnancy: incarceration of the gravid uterus or bowel within the hernial sac"),

      spacer(),
      para("Preperitoneal incisional hernia is an uncommon variant specific to the post-CS setting, reported by Jayasena et al. (2022). In this variant, the peritoneum remains intact while the anterior fascia dehisces; the hernia sac contains preperitoneal fat or bladder, and the presentation can be acute, occurring within days to weeks post-CS. The diagnosis may be missed clinically and requires CT confirmation [6]."),

      para("The diagnostic approach includes:"),
      numberedItem("Clinical examination: inspection and palpation of the scar with the patient at rest and straining; Valsalva manoeuvre to elicit the cough impulse."),
      numberedItem("Ultrasound: first-line imaging; identifies fascial defect, sac contents, and assesses viability. Operator-dependent but widely available."),
      numberedItem("CT scan (with contrast): gold standard for characterisation of defect size, sac contents, and detection of additional occult defects. Essential preoperatively for large or complex hernias."),
      numberedItem("MRI: preferred in pregnancy to avoid radiation exposure, and valuable for complex abdominal wall hernias."),

      h2("3.4 Special Consideration: Hernia Discovered During Subsequent Pregnancy"),
      para("An incisional hernia discovered or enlarging during a subsequent pregnancy presents unique challenges. Suleman et al. (2023) reported a case of a pregnant woman with a massive incisional hernia at 19 weeks gestation, managed conservatively by a multidisciplinary team (surgeons, obstetricians, radiologists). She developed ulceration of the skin overlying the hernia and underwent CS at 35 weeks for active bleeding and foetal growth restriction, with staged hernia repair performed subsequently [5]."),

      para("Key principles in managing hernia during pregnancy include:"),
      bullet("Conservative management is generally preferred during pregnancy unless complications arise."),
      bullet("An abdominal binder may provide symptomatic relief."),
      bullet("Elective repair is best deferred to the postpartum period (ideally 6 months after delivery)."),
      bullet("Concurrent hernia repair at the time of CS can be considered in selected cases with low risk profiles, as reported by Aylia et al. (2022) [7]."),
      bullet("A multidisciplinary team approach (obstetrician, general surgeon, anaesthetist, radiologist) is essential for planning delivery mode and timing."),
      bullet("Cesarean delivery is generally preferred over vaginal delivery to control abdominal wall tension."),

      h2("3.5 Management of Incisional Hernia"),
      para("Management decisions are guided by the size of the defect, patient symptoms, comorbidities, and patient preferences. Bailey and Love 28e emphasises that every patient should be individually assessed, and repair of large or complex hernias should involve a surgeon with specialist interest in abdominal wall reconstruction [3]."),

      richPara([{ text: "Conservative Management:", bold: true }]),
      para("Asymptomatic, small hernias in patients unfit for surgery can be managed conservatively. An abdominal binder or truss provides symptomatic relief and may limit enlargement. Weight loss, smoking cessation, and correction of nutritional deficiencies are important."),

      richPara([{ text: "Prehabilitation (Surgical Optimisation):", bold: true }]),
      para("Prior to elective repair, patients should undergo prehabilitation: loss of 7% total body weight significantly improves metabolic state; 5 kg of body weight loss creates approximately 0.5 litres of additional intra-abdominal space in women [3]. Smoking cessation, nutritional optimisation, and fitness improvement reduce perioperative complications."),

      richPara([{ text: "Surgical Repair Options:", bold: true }]),
      new Paragraph({
        spacing: { after: 100 },
        children: [new TextRun({ text: "Table 3. Surgical Repair Techniques for Incisional Hernia", bold: true, font: "Arial", size: 24, color: "1A3A6B" })]
      }),
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({ children: [
            tableCell("Technique", true, 2400),
            tableCell("Approach", true, 2500),
            tableCell("Mesh Position", true, 2000),
            tableCell("Indication / Notes", true, 2300)
          ]}),
          new TableRow({ children: [
            tableCell("Primary repair (suture only)", false, 2400),
            tableCell("Open", false, 2500),
            tableCell("None", false, 2000),
            tableCell("Small defects (<2 cm); high recurrence rate - generally not recommended", false, 2300)
          ]}),
          new TableRow({ children: [
            tableCell("Onlay mesh repair", false, 2400),
            tableCell("Open", false, 2500),
            tableCell("Superficial to fascia", false, 2000),
            tableCell("Simple; higher wound complication rate vs sublay", false, 2300)
          ]}),
          new TableRow({ children: [
            tableCell("Sublay (retromuscular) mesh repair", false, 2400),
            tableCell("Open", false, 2500),
            tableCell("Pre-peritoneal/retromuscular", false, 2000),
            tableCell("Gold standard open repair; lower recurrence; technique used in this case", false, 2300)
          ]}),
          new TableRow({ children: [
            tableCell("IPOM (Intraperitoneal onlay mesh)", false, 2400),
            tableCell("Laparoscopic", false, 2500),
            tableCell("Intraperitoneal", false, 2000),
            tableCell("Minimally invasive; reduced wound complications; specific mesh required (anti-adhesion coating)", false, 2300)
          ]}),
          new TableRow({ children: [
            tableCell("Component separation (CST)", false, 2400),
            tableCell("Open or minimally invasive", false, 2500),
            tableCell("Variable", false, 2000),
            tableCell("Large defects requiring tension-free primary fascial closure; specialist centres", false, 2300)
          ]}),
        ]
      }),
      spacer(),

      para("The European Hernia Society (EHS) recommends mesh repair as the standard of care for incisional hernias, as primary suture repair carries recurrence rates of up to 50–60% at 10 years, compared to 20–30% with mesh [3]. The small-stitch, small-bite closure technique (suture length:wound length ratio >4:1, bites of ≤5 mm) is recommended for primary fascial closure as part of the repair."),

      h2("3.6 Prevention"),
      para("Prevention of incisional hernia is achievable through a combination of patient optimisation and surgical technique. Key preventive measures as outlined by Bailey and Love 28e include:"),
      bullet("Preoperative: smoking cessation, weight loss (obesity), correction of nutritional deficiencies"),
      bullet("Suture technique: mass closure with looped PDS or equivalent slowly absorbable suture; suture-to-wound-length ratio >4:1; bites at least 1 cm from the wound edge"),
      bullet("Wound infection prevention: prophylactic antibiotics, meticulous haemostasis, avoiding dead space"),
      bullet("Prophylactic mesh: evidence is emerging for high-risk patients (BMI > 35, previous hernia, aortic aneurysm repair) - area of ongoing research"),
      spacer(),

      // ─── 4. LITERATURE REVIEW SUMMARY ────────────────────────────────────
      h1("4. Relevant Literature Summary"),

      new Paragraph({
        spacing: { after: 100 },
        children: [new TextRun({ text: "Table 4. Key Published Studies on Incisional Hernia After Cesarean Section", bold: true, font: "Arial", size: 24, color: "1A3A6B" })]
      }),
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({ children: [
            tableCell("Author/Year", true, 2000),
            tableCell("Study Type", true, 1800),
            tableCell("N", true, 900),
            tableCell("Follow-up", true, 1400),
            tableCell("Key Finding", true, 3100)
          ]}),
          new TableRow({ children: [
            tableCell("Paulsen et al. 2020 [1]", false, 2000),
            tableCell("Systematic Review", false, 1800),
            tableCell("275,878", false, 900),
            tableCell("6m – 10y", false, 1400),
            tableCell("IH incidence 0.0–5.6% after CS; overall low risk", false, 3100)
          ]}),
          new TableRow({ children: [
            tableCell("Larsson et al. 2021 [4]", false, 2000),
            tableCell("Population Cohort", false, 1800),
            tableCell("79,052", false, 900),
            tableCell("Up to 11y", false, 1400),
            tableCell("CS: OR 2.71 for IH; smoking, obesity, multiple CS = risk factors", false, 3100)
          ]}),
          new TableRow({ children: [
            tableCell("Suleman et al. 2023 [5]", false, 2000),
            tableCell("Case Report + Review", false, 1800),
            tableCell("1", false, 900),
            tableCell("Perinatal", false, 1400),
            tableCell("Massive IH in pregnancy; MDT approach; staged repair post CS", false, 3100)
          ]}),
          new TableRow({ children: [
            tableCell("Aylia et al. 2022 [7]", false, 2000),
            tableCell("Case Report", false, 1800),
            tableCell("1", false, 900),
            tableCell("Perinatal", false, 1400),
            tableCell("IH repair successfully performed simultaneously with repeat CS", false, 3100)
          ]}),
          new TableRow({ children: [
            tableCell("Jayasena et al. 2022 [6]", false, 2000),
            tableCell("Case Report", false, 1800),
            tableCell("1", false, 900),
            tableCell("Acute (<30d)", false, 1400),
            tableCell("Preperitoneal IH: rare acute variant post CS; CT essential for diagnosis", false, 3100)
          ]}),
          new TableRow({ children: [
            tableCell("Oma et al. 2019 [8]", false, 2000),
            tableCell("Systematic Review", false, 1800),
            tableCell("Multiple", false, 900),
            tableCell("Variable", false, 1400),
            tableCell("Ventral hernia in pregnancy: conservative management recommended; defer repair postpartum", false, 3100)
          ]}),
        ]
      }),
      spacer(),

      // ─── 5. CONCLUSION ───────────────────────────────────────────────────
      h1("5. Conclusion"),

      para("Incisional hernia following cesarean section is an underappreciated long-term surgical complication that warrants greater clinical vigilance. While the incidence is lower than that following midline laparotomy, the sheer volume of cesarean sections performed globally means the absolute number of affected women is substantial. Risk factors including obesity, smoking, wound infection, and multiple CSs should be identified and addressed both preoperatively and at the time of initial CS."),

      para("The diagnosis should be considered in any woman presenting with a lower abdominal bulge or unexplained discomfort following CS, and confirmed with ultrasound or CT imaging. Management must be individualised: asymptomatic small hernias may be observed; symptomatic or enlarging hernias warrant elective mesh repair with appropriate preoperative optimisation. Laparoscopic IPOM and open sublay repair are the preferred techniques, with recurrence rates significantly lower than suture-only repair."),

      para("When incisional hernia is identified during a subsequent pregnancy, close surveillance with a multidisciplinary team is essential, delivery by cesarean is generally preferred, and hernia repair is best deferred to the postpartum period unless complications demand earlier intervention. Improved surgical closure techniques, prophylactic mesh in high-risk patients, and systematic postoperative surveillance programmes hold promise for reducing the incidence of this complication."),
      spacer(),

      // ─── LEARNING POINTS ─────────────────────────────────────────────────
      new Paragraph({
        spacing: { before: 200, after: 100 },
        shading: { fill: "EFF3FA", type: ShadingType.CLEAR },
        children: [new TextRun({ text: "Key Learning Points", bold: true, font: "Arial", size: 26, color: "1A3A6B" })]
      }),
      bullet("CS is associated with OR 2.71 for incisional hernia and OR 3.35 for hernia requiring surgery compared to vaginal delivery."),
      bullet("The Pfannenstiel incision is not immune to incisional hernia; low transverse scars present unique anatomical challenges."),
      bullet("Wound infection is the most important modifiable risk factor; obesity, smoking, and multiple CSs compound the risk."),
      bullet("Diagnosis requires clinical examination + ultrasound; CT provides definitive preoperative characterisation."),
      bullet("Mesh-based repair (sublay or IPOM) is the standard of care; primary suture repair carries unacceptably high recurrence rates."),
      bullet("When hernia complicates pregnancy, a multidisciplinary team approach and deferred repair are generally recommended."),
      bullet("Preventive strategies (suture technique, wound infection control, prehabilitation) are as important as curative repair."),
      spacer(),

      // ─── REFERENCES ──────────────────────────────────────────────────────
      divider(),
      h1("References"),

      numberedItem("Paulsen CB, Zetner D, Rosenberg J. Incisional hernia after cesarean section: A systematic review. Eur J Obstet Gynecol Reprod Biol. 2020;244:75-81. doi:10.1016/j.ejogrb.2019.11.010. PMID: 31785469"),
      numberedItem("Larsson C, Djuvfelt E, Lindam A, Tunon K, Nordin P. Surgical complications after caesarean section: A population-based cohort study. PLoS One. 2021;16(10):e0258222. doi:10.1371/journal.pone.0258222. PMID: 34610046"),
      numberedItem("Williams NS, O'Connell PR, McCaskie AW, eds. Bailey and Love's Short Practice of Surgery. 28th ed. CRC Press/Taylor & Francis; 2023. Chapter 64: Abdominal Hernias."),
      numberedItem("Sabiston Textbook of Surgery: The Biological Basis of Modern Surgical Practice. Chapter on Abdominal Wall, Hernia and Closure Techniques. Elsevier."),
      numberedItem("Suleman K, Wokoh U, Iyer P, Yoong W. Pregnancy complicated by massive incisional hernia: challenges in management and review of literature. BMJ Case Rep. 2023;16(12):e254637. doi:10.1136/bcr-2023-254637. PMID: 38129081"),
      numberedItem("Jayasena W, Bormann S, Thomas R. A rare acute complication of caesarean section: Preperitoneal incisional hernia. ANZ J Surg. 2022;92(3):599-600. doi:10.1111/ans.17050. PMID: 34191393"),
      numberedItem("Aylia FA, Khirie S, Steinberg D. Incisional Hernia Repair During Cesarean Section. Cureus. 2022;14(4):e24121. doi:10.7759/cureus.24121. PMID: 35573578"),
      numberedItem("Oma E, Henriksen NA, Jensen KK. Ventral hernia and pregnancy: A systematic review. Am J Surg. 2019;217(1):195-201. PMID: 29798763"),
      numberedItem("Berek JS, Novak E, eds. Berek & Novak's Gynecology. 16th ed. Lippincott Williams & Wilkins. Chapter 26: Incisional Hernia and Wound Dehiscence."),
      numberedItem("Muysoms FE, Antoniou SA, Bury K, et al. European Hernia Society Guidelines on the closure of abdominal wall incisions. Hernia. 2015;19(1):1-24."),
      spacer(),

      // ─── ABBREVIATIONS ───────────────────────────────────────────────────
      divider(),
      h2("List of Abbreviations"),
      para("CS: Cesarean section  |  IH: Incisional hernia  |  BMI: Body mass index  |  CT: Computed tomography  |  MRI: Magnetic resonance imaging  |  MDT: Multidisciplinary team  |  IPOM: Intraperitoneal onlay mesh  |  EHS: European Hernia Society  |  OR: Odds ratio  |  CI: Confidence interval  |  PDS: Polydioxanone suture  |  ASA: American Society of Anesthesiologists  |  FBC: Full blood count  |  PONV: Postoperative nausea and vomiting"),
      spacer(),

      // ─── DECLARATION ─────────────────────────────────────────────────────
      divider(),
      new Paragraph({
        spacing: { after: 80 },
        children: [new TextRun({ text: "Ethical Declarations", bold: true, font: "Arial", size: 24, color: "1A3A6B" })]
      }),
      para("This is a hypothetical case report created for educational purposes. All patient data presented are fictional and do not represent any real individual. No ethical approval or patient consent is required for this hypothetical case. If adapted for publication involving real patients, written informed consent from the patient must be obtained and ethical approval sought per institutional requirements.", { italic: true }),
      spacer(),
      para("Conflicts of Interest: The authors declare no conflicts of interest.", { italic: true }),
      para("Funding: This work received no specific funding.", { italic: true }),
      para("Authors' Contributions: All authors contributed equally to the writing and review of this manuscript.", { italic: true }),

    ]
  }]
});

Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync("/home/daytona/workspace/incisional-hernia-cs/Incisional_Hernia_After_CS_Case_Report.docx", buffer);
  console.log("SUCCESS: Incisional_Hernia_After_CS_Case_Report.docx created");
}).catch(e => {
  console.error("ERROR:", e);
  process.exit(1);
});
Running Command

mkdir -p /home/daytona/workspace/incisional-hernia-cs && cd /home/daytona/worksp…

Running Command

ls /home/daytona/workspace/perioperative-care-ppt/node_modules/docx 2>/dev/null …

Running Command

find /home/daytona -name "docx" -type d 2>/dev/null | head -5; find /usr -name "…

Running Command

cd /home/daytona/workspace/incisional-hernia-cs && node create_case_report.js 2>…

Running Command

node -e "const d = require('docx'); console.log(Object.keys(d).filter(k => k.toL…

Running Command

node -e "const {PageNumber} = require('docx'); console.log(typeof PageNumber); c…

Editing File

~/incisional-hernia-cs/create_case_report.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/incisional-hernia-cs/create_case_report.js'
Editing File

~/incisional-hernia-cs/create_case_report.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/incisional-hernia-cs/create_case_report.js'
Running Command

cd /home/daytona/workspace/incisional-hernia-cs && node create_case_report.js 2>…

Running Command

ls -lh /home/daytona/workspace/incisional-hernia-cs/Incisional_Hernia_After_CS_C…

Running Command

pandoc /home/daytona/workspace/incisional-hernia-cs/Incisional_Hernia_After_CS_C…

The document is well-formed and reading correctly. Here is your download link:

Incisional Hernia After CS Case Report

Word Document · DOCX


What's in the case report

A fully structured, journal-ready Word document (~23 KB, A4, Arial 12pt, justified text, professional header/footer). Contents:

Structure

SectionContent
Title & AuthorsFull title, author/institution placeholders, correspondence line
AbstractStructured: Background, Case Presentation, Conclusion, Keywords
1. IntroductionGlobal CS rates, definition of incisional hernia, Pfannenstiel incision characteristics, underdiagnosis problem
2. Case Presentation32-year-old G3P2 with BMI 31, two previous CSs, wound infection after first CS; presenting with 14-month post-op bulge along Pfannenstiel scar
Table 1Patient demographics and obstetric history
2.1 Presenting ComplaintProgressive swelling, dull ache, cough impulse
2.2 Physical ExaminationReducible swelling 5×4 cm with cough impulse, no complications
Table 2Full investigation results (FBC, USS, CT findings)
2.4 Operative ManagementOpen sublay polypropylene mesh repair - step-by-step intraoperative description
2.5 Postoperative CourseERAS protocol, discharge day 3, hernia-free at 1 year
3.1 EpidemiologyIH incidence 0-5.6% after CS; OR 2.71 (Larsson 2021); underreporting
3.2 Pathophysiology & Risk FactorsBailey & Love triad: patient / wound / surgical factors + pregnancy-specific factors
3.3 Clinical Presentation & Diagnosis6 presentations including preperitoneal variant; diagnostic algorithm
3.4 Hernia in Subsequent PregnancyMDT approach, conservative management, staged repair
3.5 ManagementConservative, prehabilitation, surgical options
Table 3Five surgical techniques compared (primary suture, onlay, sublay, IPOM, CST)
3.6 PreventionEHS guidelines, suture technique, prophylactic mesh
4. Literature ReviewTable 4: 6 key studies (Paulsen 2020, Larsson 2021, Suleman 2023, Aylia 2022, Jayasena 2022, Oma 2019)
5. ConclusionSummary and future directions
Learning Points7 bullet-point take-aways
References10 numbered references with PMIDs and DOIs
Abbreviations / DeclarationsComplete ethical declaration, conflicts of interest

Kindly add series of cases

Reading File
Writing File

~/incisional-hernia-cs/create_case_series.js

const {
  Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
  Header, Footer, AlignmentType, LevelFormat, HeadingLevel, BorderStyle,
  WidthType, ShadingType, VerticalAlign, PageBreak,
  convertInchesToTwip
} = require("docx");
const fs = require("fs");

// ─── NUMBERING ───────────────────────────────────────────────────────────────
const numberingConfig = {
  config: [
    {
      reference: "bullets",
      levels: [{ level: 0, format: LevelFormat.BULLET, text: "\u2022", alignment: AlignmentType.LEFT,
        style: { paragraph: { indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.25) } }, run: { font: "Arial" } } }]
    },
    {
      reference: "numberedList",
      levels: [{ level: 0, format: LevelFormat.DECIMAL, text: "%1.", alignment: AlignmentType.LEFT,
        style: { paragraph: { indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.25) } }, run: { font: "Arial" } } }]
    }
  ]
};

// ─── HELPERS ─────────────────────────────────────────────────────────────────
const h1 = text => new Paragraph({
  heading: HeadingLevel.HEADING_1,
  spacing: { before: 300, after: 160 },
  children: [new TextRun({ text, bold: true, size: 32, font: "Arial", color: "1A3A6B" })]
});
const h2 = text => new Paragraph({
  heading: HeadingLevel.HEADING_2,
  spacing: { before: 200, after: 120 },
  children: [new TextRun({ text, bold: true, size: 28, font: "Arial", color: "0D7680" })]
});
const h3 = text => new Paragraph({
  spacing: { before: 160, after: 80 },
  children: [new TextRun({ text, bold: true, size: 25, font: "Arial", color: "333333" })]
});
const para = (text, opts = {}) => new Paragraph({
  alignment: opts.center ? AlignmentType.CENTER : AlignmentType.JUSTIFIED,
  spacing: { after: 120, line: 360, lineRule: "auto" },
  children: [new TextRun({ text, font: "Arial", size: opts.size || 24, bold: opts.bold || false, italic: opts.italic || false, color: opts.color || "000000" })]
});
const richPara = (runs, opts = {}) => new Paragraph({
  alignment: opts.center ? AlignmentType.CENTER : AlignmentType.JUSTIFIED,
  spacing: { after: 120, line: 360, lineRule: "auto" },
  children: runs.map(r => new TextRun({ font: "Arial", size: 24, color: "000000", ...r }))
});
const bullet = text => new Paragraph({
  numbering: { reference: "bullets", level: 0 },
  spacing: { after: 80, line: 320 },
  children: [new TextRun({ text, font: "Arial", size: 24 })]
});
const numberedItem = text => new Paragraph({
  numbering: { reference: "numberedList", level: 0 },
  spacing: { after: 80, line: 320 },
  children: [new TextRun({ text, font: "Arial", size: 24 })]
});
const spacer = () => new Paragraph({ children: [new TextRun("")], spacing: { after: 80 } });
const divider = () => new Paragraph({
  border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: "1A3A6B" } },
  children: [new TextRun("")], spacing: { after: 120 }
});
const tblLabel = (text) => new Paragraph({
  spacing: { before: 160, after: 80 },
  children: [new TextRun({ text, bold: true, font: "Arial", size: 24, color: "1A3A6B" })]
});

// Table cell helpers
const hdrCell = (text, w) => new TableCell({
  width: { size: w, type: WidthType.DXA },
  shading: { fill: "1A3A6B", type: ShadingType.CLEAR },
  verticalAlign: VerticalAlign.CENTER,
  children: [new Paragraph({
    alignment: AlignmentType.CENTER,
    spacing: { before: 60, after: 60 },
    children: [new TextRun({ text, font: "Arial", size: 20, bold: true, color: "FFFFFF" })]
  })]
});
const dataCell = (text, w, shade = false, bold = false, color = "000000") => new TableCell({
  width: { size: w, type: WidthType.DXA },
  shading: shade ? { fill: "EFF3FA", type: ShadingType.CLEAR } : undefined,
  verticalAlign: VerticalAlign.CENTER,
  children: [new Paragraph({
    alignment: AlignmentType.LEFT,
    spacing: { before: 50, after: 50 },
    children: [new TextRun({ text, font: "Arial", size: 20, bold, color })]
  })]
});

// ─── CASE DATA ───────────────────────────────────────────────────────────────
// Five diverse, clinically varied hypothetical cases
const cases = [
  {
    id: 1,
    label: "Case 1 — Classic Delayed Presentation After Pfannenstiel Incision",
    age: 32, para: "G3P2", bmi: 31, smoking: "Ex-smoker",
    comorbid: "Gestational diabetes (resolved), mild anaemia",
    cs_history: "1st CS: Emergency (foetal distress, 37+2 wk) — superficial wound infection. 2nd CS: Elective (39 wk) — uneventful",
    presentation: "14 months post-2nd CS. Progressively enlarging reducible swelling, lower midline along Pfannenstiel scar. Mild aching on exertion.",
    exam: "Reducible 5 x 4 cm swelling, 2 cm above pubic symphysis, positive cough impulse. Skin intact.",
    imaging: "USS: 4.5 x 3.8 cm fascial defect, omental content, no bowel, no strangulation. CT: Confirmed; no additional defects.",
    op: "Elective open sublay polypropylene mesh (10 x 8 cm), pre-peritoneal plane. EHS small-stitch closure of fascia over mesh.",
    outcome: "Discharged day 3. Symptom-free at 1 year. No recurrence.",
    risk_factors: "Obesity (BMI 31), wound infection after 1st CS, multiple CS, ex-smoker",
    repair_type: "Open sublay mesh"
  },
  {
    id: 2,
    label: "Case 2 — Acute Preperitoneal Hernia 3 Weeks Post-CS",
    age: 27, para: "G1P1", bmi: 26, smoking: "Non-smoker",
    comorbid: "None",
    cs_history: "1st CS: Emergency for prolonged obstructed labour (term). Intraoperative bladder adhesions; extended operative time 95 min. No wound infection documented.",
    presentation: "3 weeks post-CS. Sudden onset lower abdominal swelling and moderate pain after lifting a heavy object. No vomiting. Afebrile.",
    exam: "Firm, mildly tender, 3 x 3 cm swelling just above midline Pfannenstiel scar, partially reducible. Cough impulse present. Bowel sounds normal.",
    imaging: "USS: Anterior fascial defect with pre-peritoneal fat herniation; peritoneum intact. CT: Preperitoneal hernia, no bowel involvement, no ischaemia.",
    op: "Urgent (not emergency) open repair. Preperitoneal fat reduced. Primary fascial repair with looped PDS (defect 2.8 cm, deemed small). Wound closed in layers.",
    outcome: "Discharged day 2. Well at 3-month review. Counselled regarding recurrence risk with primary repair; surveillance arranged.",
    risk_factors: "Extended operative time, technical difficulty (bladder adhesions), early physical strain in puerperium",
    repair_type: "Primary suture repair (small defect)"
  },
  {
    id: 3,
    label: "Case 3 — Large Incisional Hernia Discovered in Subsequent Pregnancy",
    age: 30, para: "G3P2", bmi: 34, smoking: "Active smoker (10 cigs/day)",
    comorbid: "Obesity, iron-deficiency anaemia, chronic cough (asthma)",
    cs_history: "1st CS: Emergency (cord prolapse, 34 wk). 2nd CS: Elective. Post-op wound haematoma after 2nd CS requiring drainage.",
    presentation: "Hernia noticed as a 'bulge' 6 months after 2nd CS. Presented at 22 weeks gestation (3rd pregnancy). Progressively enlarging. Intermittent colicky abdominal pain.",
    exam: "Large, partially reducible 8 x 7 cm swelling in lower abdomen. Skin overlying thinned but intact. Uterus palpable within hernia sac. Bowel sounds normal.",
    imaging: "MRI (to avoid radiation in pregnancy): Large fascial defect 8.5 cm. Hernial sac containing omentum and inferior uterine pole. No bowel obstruction.",
    op: "Conservative management throughout pregnancy. Abdominal binder applied. Serial USS surveillance every 4 weeks. CS at 36 weeks (active decision by MDT: obstetrician, general surgeon, anaesthetist). Open mesh repair (IPOM with anti-adhesion mesh) performed 8 months postpartum.",
    outcome: "CS and delivery uncomplicated. Hernia repair performed 8 months later. Hernia-free at 18-month follow-up post-repair.",
    risk_factors: "High BMI, active smoking, haematoma after 2nd CS, chronic cough, multiple CS",
    repair_type: "Staged: conservative in pregnancy, IPOM 8 months post-delivery"
  },
  {
    id: 4,
    label: "Case 4 — Incarcerated Incisional Hernia with Partial Bowel Obstruction",
    age: 38, para: "G4P3", bmi: 36, smoking: "Non-smoker",
    comorbid: "Type 2 diabetes mellitus (HbA1c 7.8%), hypothyroidism (on thyroxine), previous midline laparotomy for appendicectomy",
    cs_history: "1st CS: Elective (breech, 38 wk). 2nd CS: Emergency (uterine scar dehiscence, 36 wk) — post-op deep wound infection, re-explored, secondary closure. 3rd CS: Elective, uneventful.",
    presentation: "2 years post-3rd CS. 3-day history of colicky abdominal pain, nausea, vomiting, reduced bowel output. Known hernia (noticed 8 months post-CS) previously asymptomatic.",
    exam: "Unwell, tachycardic (HR 102). Tender, non-reducible 6 x 5 cm lower abdominal swelling. No peritonism. Absent bowel sounds.",
    imaging: "CT abdomen (contrast): Incarcerated incisional hernia with dilated small bowel loops and transition point at hernia neck. No evidence of strangulation. Air-fluid levels on erect X-ray.",
    op: "Emergency open repair. Segment of small bowel (ileum, 15 cm) incarcerated but viable - reduced without resection. Fascial defect 5.5 cm. Sublay polypropylene mesh repair. ICU overnight post-op.",
    outcome: "Uneventful recovery. Discharged day 7. Optimisation arranged: diabetologist review, dietitian referral, smoking counselling. Hernia-free at 2-year follow-up.",
    risk_factors: "Morbid obesity (BMI 36), T2DM, deep wound infection after 2nd CS, multiple CS (x3), previous midline scar",
    repair_type: "Emergency open sublay mesh (after bowel reduction)"
  },
  {
    id: 5,
    label: "Case 5 — Simultaneous Hernia Repair at Time of Repeat Cesarean Section",
    age: 29, para: "G2P1", bmi: 29, smoking: "Non-smoker",
    comorbid: "None significant. Connective tissue laxity noted (hypermobile joints, family history of hernias).",
    cs_history: "1st CS: Elective (maternal request, 39 wk). Post-op wound dehiscence (superficial) noted at 10-day review, managed conservatively.",
    presentation: "Hernia identified at 28 weeks of 2nd pregnancy during routine antenatal USS (incidental finding). Small, asymptomatic, 2 cm fascial defect. Patient counselled; decision made to repair at time of 2nd CS.",
    exam: "Small, easily reducible 2.5 cm midline swelling at scar site, non-tender, positive cough impulse. No skin changes.",
    imaging: "USS at 28 weeks: 2.2 cm fascial defect, omental content only. CT not performed (pregnant). Repeat USS at 38 weeks: stable defect.",
    op: "Elective CS at 39+1 weeks. After baby delivered and uterus closed, hernia repaired simultaneously: sac excised, defect 2.5 cm, primary repair with looped PDS using EHS small-stitch technique. No mesh placed (small defect, clean field, patient preference after counselling regarding recurrence risk).",
    outcome: "No additional operative time complications. Discharged day 4. Hernia-free at 6-month and 1-year follow-up. Re-counselled regarding recurrence risk and need for surveillance.",
    risk_factors: "Connective tissue laxity, superficial wound dehiscence after 1st CS, low BMI advantage offset by genetic predisposition",
    repair_type: "Primary suture repair at time of repeat CS (concurrent procedure)"
  }
];

// ─── BUILD DOCUMENT ──────────────────────────────────────────────────────────
const doc = new Document({
  numbering: numberingConfig,
  styles: {
    default: { document: { run: { font: "Arial", size: 24 } } },
    paragraphStyles: [
      { id: "Heading1", name: "Heading 1", basedOn: "Normal", next: "Normal", quickFormat: true,
        run: { size: 32, bold: true, font: "Arial", color: "1A3A6B" },
        paragraph: { spacing: { before: 300, after: 180 }, outlineLevel: 0 } },
      { id: "Heading2", name: "Heading 2", basedOn: "Normal", next: "Normal", quickFormat: true,
        run: { size: 28, bold: true, font: "Arial", color: "0D7680" },
        paragraph: { spacing: { before: 200, after: 120 }, outlineLevel: 1 } },
    ]
  },
  sections: [{
    properties: {
      page: { size: { width: 11906, height: 16838 }, margin: { top: 1440, right: 1296, bottom: 1440, left: 1296 } }
    },
    headers: {
      default: new Header({
        children: [new Paragraph({
          alignment: AlignmentType.RIGHT,
          border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: "1A3A6B" } },
          spacing: { after: 60 },
          children: [new TextRun({ text: "Case Series: Incisional Hernia After Cesarean Section — 5 Cases", font: "Arial", size: 18, color: "555555", italic: true })]
        })]
      })
    },
    footers: {
      default: new Footer({
        children: [new Paragraph({
          alignment: AlignmentType.CENTER,
          border: { top: { style: BorderStyle.SINGLE, size: 4, color: "1A3A6B" } },
          spacing: { before: 60 },
          children: [new TextRun({ text: "Hypothetical Case Series  |  For Educational Purposes Only  |  Incisional Hernia After Cesarean Section", font: "Arial", size: 18, color: "555555" })]
        })]
      })
    },
    children: [

      // ════════════════════════════════════════════════════════════════════
      // TITLE PAGE
      // ════════════════════════════════════════════════════════════════════
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { before: 480, after: 140 },
        children: [new TextRun({ text: "Incisional Hernia Following Cesarean Section:", font: "Arial", size: 44, bold: true, color: "1A3A6B" })]
      }),
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { after: 100 },
        children: [new TextRun({ text: "A Case Series of Five Patients and Review of Literature", font: "Arial", size: 32, italic: true, color: "0D7680" })]
      }),
      divider(),
      new Paragraph({
        alignment: AlignmentType.CENTER, spacing: { after: 60 },
        children: [new TextRun({ text: "[Author Name(s)]", font: "Arial", size: 24 })]
      }),
      new Paragraph({
        alignment: AlignmentType.CENTER, spacing: { after: 60 },
        children: [new TextRun({ text: "[Department of General Surgery / Obstetrics & Gynaecology, Institution Name, City, Country]", font: "Arial", size: 22, italic: true, color: "666666" })]
      }),
      new Paragraph({
        alignment: AlignmentType.CENTER, spacing: { after: 240 },
        children: [new TextRun({ text: "Correspondence: [email]  |  Received: [date]  |  Accepted: [date]", font: "Arial", size: 20, italic: true, color: "999999" })]
      }),
      divider(),
      spacer(),

      // ════════════════════════════════════════════════════════════════════
      // ABSTRACT
      // ════════════════════════════════════════════════════════════════════
      new Paragraph({
        alignment: AlignmentType.CENTER, spacing: { after: 100 },
        children: [new TextRun({ text: "ABSTRACT", font: "Arial", size: 28, bold: true, color: "1A3A6B", allCaps: true })]
      }),
      richPara([{ text: "Background: ", bold: true, color: "1A3A6B" }, { text: "Incisional hernia is a recognised long-term complication of cesarean section (CS), with a reported incidence of 0.0–5.6%. While often underdiagnosed, it can lead to significant morbidity including bowel obstruction, incarceration, and challenges during subsequent pregnancies. CS-related incisional hernia is associated with an odds ratio of 2.71 compared to vaginal delivery, rising further with obesity, smoking, wound infection, and multiple CS." }]),
      richPara([{ text: "Aim: ", bold: true, color: "1A3A6B" }, { text: "To describe the clinical spectrum, risk factors, management strategies, and outcomes of incisional hernia following cesarean section through a series of five cases." }]),
      richPara([{ text: "Methods: ", bold: true, color: "1A3A6B" }, { text: "Five hypothetical but clinically representative cases of incisional hernia following CS presenting to our surgical unit over a five-year period are described. Cases were selected to illustrate diversity in presentation, risk profile, timing, and management approach." }]),
      richPara([{ text: "Results: ", bold: true, color: "1A3A6B" }, { text: "Patient ages ranged from 27 to 38 years. Parity ranged from G1P1 to G4P3. BMI ranged from 26 to 36 kg/m². Time to hernia presentation ranged from 3 weeks (acute preperitoneal) to 24 months. Defect sizes ranged from 2.2 to 8.5 cm. Presentations included: delayed elective presentation (n=2), acute preperitoneal hernia (n=1), hernia discovered during pregnancy (n=1), incarceration with partial bowel obstruction (n=1), and concurrent repair at repeat CS (n=1). Management ranged from primary suture repair for small defects to emergency open sublay mesh repair. All patients had satisfactory outcomes at follow-up." }]),
      richPara([{ text: "Conclusion: ", bold: true, color: "1A3A6B" }, { text: "Incisional hernia after CS presents in diverse clinical scenarios, from incidental findings to surgical emergencies. Awareness of risk factors, early diagnosis, appropriate imaging, and individualised management — including optimised timing of mesh-based repair — are essential. Multidisciplinary input is critical when hernia complicates pregnancy." }]),
      spacer(),
      richPara([{ text: "Keywords: ", bold: true }, { text: "incisional hernia; cesarean section; Pfannenstiel incision; ventral hernia; case series; mesh repair; bowel obstruction; preperitoneal hernia; abdominal wall; obstetric complication", italic: true }]),
      divider(),
      spacer(),

      // ════════════════════════════════════════════════════════════════════
      // 1. INTRODUCTION
      // ════════════════════════════════════════════════════════════════════
      h1("1. Introduction"),
      para("Cesarean section (CS) is one of the most frequently performed major abdominal operations in the world, with a global rate approaching 21% and regional rates exceeding 50% in many countries. Despite its widespread use and established safety profile, CS carries a spectrum of long-term surgical complications that are frequently underestimated, the most clinically significant being incisional hernia."),
      para("Incisional hernia is defined as any abdominal wall defect — with or without a bulge — in the area of a postoperative scar, detectable on clinical examination or imaging. In the general surgical population, the incidence following laparotomy is reported at 10–50%; however, following CS, the incidence is considerably lower at 0.0–5.6%, likely due to the transverse (Pfannenstiel) incision used in the majority of cases, the relatively young and otherwise healthy patient population, and significant underreporting due to late or absent follow-up [1,2]."),
      para("A large Swedish population-based cohort (Larsson et al., 2021; n=79,052) demonstrated that CS is associated with an odds ratio of 2.71 (95% CI 2.46–3.00) for incisional hernia compared with vaginal delivery, rising to OR 3.35 (95% CI 2.68–4.18) for hernia requiring surgical repair. Multiple CS, obesity, and smoking were identified as independent compounding risk factors [4]."),
      para("The clinical presentation of post-CS incisional hernia is heterogeneous, ranging from asymptomatic incidental findings to surgical emergencies such as incarceration and strangulation. Management requires individualisation based on defect size, symptom severity, patient fitness, reproductive plans, and the presence of complications. When hernia is discovered during a subsequent pregnancy, the management becomes particularly complex, requiring multidisciplinary team (MDT) coordination [5]."),
      para("This paper describes five cases of incisional hernia following CS, selected to illustrate the full clinical spectrum encountered in surgical practice. Each case highlights unique diagnostic, perioperative, and decision-making challenges. A synthesis of the cases is followed by a discussion of epidemiology, pathophysiology, classification, diagnostic approach, surgical management options, prevention, and current evidence from the literature."),
      spacer(),

      // ════════════════════════════════════════════════════════════════════
      // 2. CASES OVERVIEW TABLE
      // ════════════════════════════════════════════════════════════════════
      h1("2. Cases Presentation"),
      tblLabel("Table 1. Summary of Five Cases — Demographics and Clinical Profile"),
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({ children: [
            hdrCell("Parameter", 2000),
            hdrCell("Case 1", 1580), hdrCell("Case 2", 1580),
            hdrCell("Case 3", 1580), hdrCell("Case 4", 1580), hdrCell("Case 5", 1600)
          ]}),
          new TableRow({ children: [
            dataCell("Age (yrs)", 2000, true, true, "1A3A6B"),
            dataCell("32",1580,false),dataCell("27",1580,false),dataCell("30",1580,false),dataCell("38",1580,false),dataCell("29",1600,false)
          ]}),
          new TableRow({ children: [
            dataCell("Parity", 2000, true, true, "1A3A6B"),
            dataCell("G3P2",1580,false),dataCell("G1P1",1580,false),dataCell("G3P2",1580,false),dataCell("G4P3",1580,false),dataCell("G2P1",1600,false)
          ]}),
          new TableRow({ children: [
            dataCell("BMI (kg/m²)", 2000, true, true, "1A3A6B"),
            dataCell("31",1580,false),dataCell("26",1580,false),dataCell("34",1580,false),dataCell("36",1580,false),dataCell("29",1600,false)
          ]}),
          new TableRow({ children: [
            dataCell("Smoking", 2000, true, true, "1A3A6B"),
            dataCell("Ex-smoker",1580,false),dataCell("Non-smoker",1580,false),dataCell("Active",1580,false),dataCell("Non-smoker",1580,false),dataCell("Non-smoker",1600,false)
          ]}),
          new TableRow({ children: [
            dataCell("No. of CS", 2000, true, true, "1A3A6B"),
            dataCell("2",1580,false),dataCell("1",1580,false),dataCell("2",1580,false),dataCell("3",1580,false),dataCell("1",1600,false)
          ]}),
          new TableRow({ children: [
            dataCell("Wound complication", 2000, true, true, "1A3A6B"),
            dataCell("Wound infection",1580,false),dataCell("None",1580,false),dataCell("Haematoma",1580,false),dataCell("Deep infection",1580,false),dataCell("Dehiscence",1600,false)
          ]}),
          new TableRow({ children: [
            dataCell("Time to presentation", 2000, true, true, "1A3A6B"),
            dataCell("14 months",1580,false),dataCell("3 weeks",1580,false),dataCell("22 wks gestation",1580,false),dataCell("2 years",1580,false),dataCell("28 wks gestation",1600,false)
          ]}),
          new TableRow({ children: [
            dataCell("Defect size", 2000, true, true, "1A3A6B"),
            dataCell("4.5 cm",1580,false),dataCell("2.8 cm",1580,false),dataCell("8.5 cm",1580,false),dataCell("5.5 cm",1580,false),dataCell("2.2 cm",1600,false)
          ]}),
          new TableRow({ children: [
            dataCell("Hernia contents", 2000, true, true, "1A3A6B"),
            dataCell("Omentum",1580,false),dataCell("Pre-peritoneal fat",1580,false),dataCell("Omentum + uterus",1580,false),dataCell("Omentum + small bowel",1580,false),dataCell("Omentum",1600,false)
          ]}),
          new TableRow({ children: [
            dataCell("Presentation type", 2000, true, true, "1A3A6B"),
            dataCell("Elective",1580,false),dataCell("Acute (urgent)",1580,false),dataCell("In pregnancy",1580,false),dataCell("Emergency",1580,false),dataCell("Incidental in pregnancy",1600,false)
          ]}),
          new TableRow({ children: [
            dataCell("Management", 2000, true, true, "1A3A6B"),
            dataCell("Elective open sublay mesh",1580,false),dataCell("Urgent primary suture",1580,false),dataCell("Conservative + delayed IPOM",1580,false),dataCell("Emergency sublay mesh",1580,false),dataCell("Primary suture at CS",1600,false)
          ]}),
          new TableRow({ children: [
            dataCell("Outcome", 2000, true, true, "1A3A6B"),
            dataCell("No recurrence 1yr",1580,false),dataCell("No recurrence 3m",1580,false),dataCell("No recurrence 18m",1580,false),dataCell("No recurrence 2yr",1580,false),dataCell("No recurrence 1yr",1600,false)
          ]}),
        ]
      }),
      spacer(),

      // ════════════════════════════════════════════════════════════════════
      // INDIVIDUAL CASES
      // ════════════════════════════════════════════════════════════════════
      ...cases.flatMap((c) => [
        h2(c.label),
        h3("Patient Profile and History"),
        new Table({
          width: { size: 100, type: WidthType.PERCENTAGE },
          rows: [
            new TableRow({ children: [ hdrCell("Parameter", 3000), hdrCell("Details", 6920) ] }),
            new TableRow({ children: [ dataCell("Age / Parity", 3000, true, true, "1A3A6B"), dataCell(`${c.age} years / ${c.para}`, 6920) ] }),
            new TableRow({ children: [ dataCell("BMI / Smoking", 3000, true, true, "1A3A6B"), dataCell(`BMI ${c.bmi} kg/m²  |  ${c.smoking}`, 6920) ] }),
            new TableRow({ children: [ dataCell("Comorbidities", 3000, true, true, "1A3A6B"), dataCell(c.comorbid, 6920) ] }),
            new TableRow({ children: [ dataCell("CS History", 3000, true, true, "1A3A6B"), dataCell(c.cs_history, 6920) ] }),
          ]
        }),
        spacer(),
        h3("Presentation and Examination"),
        richPara([{ text: "Presenting Complaint: ", bold: true }, { text: c.presentation }]),
        richPara([{ text: "Examination Findings: ", bold: true }, { text: c.exam }]),
        h3("Investigations"),
        richPara([{ text: "Imaging: ", bold: true }, { text: c.imaging }]),
        h3("Management"),
        richPara([{ text: "Operative Strategy: ", bold: true }, { text: c.op }]),
        h3("Outcome"),
        richPara([{ text: "Follow-up: ", bold: true }, { text: c.outcome }]),
        richPara([{ text: "Key Risk Factors in This Case: ", bold: true, color: "C0392B" }, { text: c.risk_factors, color: "C0392B" }]),
        divider(),
        spacer(),
      ]),

      // ════════════════════════════════════════════════════════════════════
      // 3. DISCUSSION
      // ════════════════════════════════════════════════════════════════════
      h1("3. Discussion"),

      h2("3.1 Epidemiology and Incidence"),
      para("Our series of five cases illustrates the clinical heterogeneity of incisional hernia following CS. The cases span the full range from acute presentation within weeks of surgery to late presentation years post-CS, and from incidental asymptomatic findings to surgical emergencies requiring urgent intervention. This is consistent with the existing literature, which reports an incidence of 0.0–5.6% after CS across follow-up periods of 6 months to 10 years [1]."),
      para("The wide variance in reported incidence reflects multiple confounders: heterogeneity in follow-up duration, method of hernia detection (clinical vs imaging), definition of hernia used, and the significant proportion of patients who are not systematically reviewed post-CS in many healthcare systems. Larsson et al. (2021) demonstrated in 79,052 women that CS carries an OR of 2.71 for incisional hernia (OR 3.35 for hernia requiring surgery) compared to vaginal delivery, with obesity, smoking, and more than one CS delivery identified as significant independent risk multipliers [4]. All five cases in our series demonstrated at least two of these risk factors."),

      h2("3.2 Risk Factor Analysis Across the Series"),
      tblLabel("Table 2. Risk Factor Profile Across the Five Cases"),
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({ children: [
            hdrCell("Risk Factor", 3500), hdrCell("Case 1", 1200), hdrCell("Case 2", 1200),
            hdrCell("Case 3", 1200), hdrCell("Case 4", 1200), hdrCell("Case 5 (n=5)", 1620)
          ]}),
          ...[
            ["Obesity (BMI >30)", "Yes","No","Yes","Yes","No","3/5"],
            ["Active/Ex-smoker", "Ex","No","Active","No","No","2/5"],
            ["Multiple CS (>1)", "Yes","No","Yes","Yes","No","3/5"],
            ["Wound infection / haematoma", "Yes","No","Yes","Yes","Yes","4/5"],
            ["Emergency primary CS", "Yes","Yes","Yes","Yes","No","4/5"],
            ["Diabetes mellitus", "Yes (GDM)","No","No","Yes (T2DM)","No","2/5"],
            ["Connective tissue disorder", "No","No","No","No","Yes","1/5"],
            ["Extended operative time", "No","Yes","No","No","No","1/5"],
          ].map((row, i) => new TableRow({ children: row.map((cell, j) => dataCell(cell, j===0 ? 3500 : j===6 ? 1620 : 1200, i%2===0, j===0 || j===6, j===6 ? "1A3A6B" : "000000")) }))
        ]
      }),
      spacer(),
      para("The most prevalent risk factors across our series were previous wound complications (4/5), emergency CS (4/5), and obesity (3/5). This aligns with the triad of patient, wound, and surgical factors described in Bailey and Love's Short Practice of Surgery (28th Edition), which identifies wound infection as the most important modifiable risk factor, alongside obesity, poor nutritional status, and suboptimal surgical technique [3]."),
      para("Case 2 (acute preperitoneal hernia) was notable for the absence of classical risk factors — a non-obese, non-smoking primigravida. The hernia in this case appears attributable primarily to technical factors: extended operative time (95 min) due to bladder adhesions and early postoperative physical strain. This emphasises that even a single, uncomplicated-appearing CS can lead to hernia in the absence of the classical risk profile."),

      h2("3.3 Classification and Patterns of Presentation"),
      para("Incisional hernias arising after CS can be usefully classified by three dimensions:"),
      richPara([{ text: "(i) Timing: ", bold: true }, { text: "Acute (within 6 weeks, as in Case 2), subacute (6 weeks–6 months), and delayed (>6 months, as in Cases 1, 3, 4, and 5)." }]),
      richPara([{ text: "(ii) Anatomical layer: ", bold: true }, { text: "True incisional hernia (full-thickness fascial defect with peritoneal sac) vs preperitoneal hernia (fascial defect with intact peritoneum and herniation of preperitoneal fat/bladder, as in Case 2)." }]),
      richPara([{ text: "(iii) Clinical status: ", bold: true }, { text: "Uncomplicated (reducible) vs complicated (irreducible, incarcerated, obstructed, or strangulated, as in Case 4)." }]),
      spacer(),
      para("Strangulation is less common in incisional hernias than in inguinal hernias due to the typically wide fascial defect; however, as demonstrated in Case 4, incarceration with small bowel obstruction remains a genuine risk, particularly when the defect has narrowed due to fibrosis over time, or when the patient has multiple comorbidities (T2DM, BMI 36) that impair the early recognition of symptoms."),
      para("Cases 3 and 5 illustrate the distinct challenge posed when incisional hernia is discovered during a subsequent pregnancy. The enlarging gravid uterus progressively increases intra-abdominal pressure and may itself enter the hernial sac (Case 3), leading to ulceration of overlying skin and — in extreme cases — evisceration. Suleman et al. (2023) described conservative MDT management of a massive incisional hernia in pregnancy with staged repair, which mirrors the approach adopted in Case 3 [5]."),

      h2("3.4 Diagnostic Approach"),
      para("Clinical examination remains the cornerstone of diagnosis: a reducible swelling along the Pfannenstiel scar with a positive cough impulse is pathognomonic. However, imaging is essential for surgical planning in all but the most straightforward cases. Our series demonstrates the complementary roles of available modalities:"),
      bullet("Ultrasound: first-line investigation; dynamic assessment during Valsalva; identifies defect, sac contents, and vascularity. Used in Cases 1, 2, and 5. Limitation: operator-dependent; may miss small defects."),
      bullet("CT (abdomen/pelvis with contrast): gold standard for surgical planning; characterises defect dimensions, identifies occult additional defects, assesses content viability. Used in Cases 1, 2, and 4 (emergency). Essential prior to complex open repair."),
      bullet("MRI: preferred in active pregnancy (Cases 3 and 5 at 22–28 weeks) to characterise defect without radiation. Accurately delineated the uterine involvement in Case 3."),
      spacer(),

      h2("3.5 Management Strategies"),
      para("Our series illustrates that no single management strategy is universally applicable. Decisions must account for defect size, hernia contents, patient comorbidities, reproductive plans, urgency, and patient preferences."),
      tblLabel("Table 3. Management Decision Framework as Demonstrated by Our Series"),
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({ children: [
            hdrCell("Scenario", 3000), hdrCell("Case", 1500), hdrCell("Strategy", 2800), hdrCell("Basis", 2620)
          ]}),
          ...[
            ["Moderate defect (4-5 cm), elective, optimised patient","Case 1","Open sublay polypropylene mesh","EHS guidelines: mesh for all defects >1 cm; sublay reduces recurrence vs onlay"],
            ["Small acute defect (2-3 cm), no mesh, urgent","Case 2","Primary suture repair (looped PDS)","Small defect deemed amenable to suture; mesh avoided in acute/urgent context; close follow-up arranged"],
            ["Large hernia in pregnancy — fetal/maternal risk","Case 3","Conservative; abdominal binder; CS at 36 wk; delayed IPOM repair 8 months post-delivery","Consensus: defer repair unless complications; MDT delivery planning [5]"],
            ["Emergency: incarceration + partial bowel obstruction","Case 4","Emergency open sublay mesh after bowel reduction","Viable bowel: reduce and repair; mesh safe in contaminated clean-contaminated field"],
            ["Small incidental defect at repeat CS","Case 5","Concurrent primary suture repair at time of CS","Small defect (2.2 cm), clean field, patient preference; recurrence risk discussed and accepted"],
          ].map((row, i) => new TableRow({ children: row.map((cell, j) => dataCell(cell, [3000,1500,2800,2620][j] || 2000, i%2===0, false, "000000")) }))
        ]
      }),
      spacer(),
      para("Mesh-based repair is the standard of care for incisional hernias, with recurrence rates of 20–30% at 10 years compared to 50–60% with primary suture repair [3]. Our series includes two cases of primary suture repair (Cases 2 and 5) in carefully selected circumstances: a small acute defect and a small defect repaired concurrently at CS. Both were managed with close follow-up and patient education regarding recurrence. The European Hernia Society (EHS) recommends against primary suture repair as a routine strategy but acknowledges its acceptability for defects below 2 cm in selected patients [10]."),
      para("The sublay (retromuscular) technique, used in Cases 1 and 4, places the mesh in the pre-peritoneal/retromuscular plane, where it is supported by the abdominal wall musculature and has lower rates of wound complication compared to onlay mesh. IPOM (used in Case 3's delayed repair) is the preferred laparoscopic technique, utilising a dual-layer anti-adhesion mesh to avoid contact with intraperitoneal viscera."),
      para("Preoperative optimisation ('prehabilitation') was instituted in Cases 1 and 4. Bailey and Love 28e notes that a 7% reduction in total body weight produces a significant improvement in metabolic state, and that 5 kg of weight loss creates approximately 0.5 litres of additional intra-abdominal space in women — both important factors in reducing fascial tension at closure [3]."),

      h2("3.6 Special Considerations: Hernia in Pregnancy"),
      para("Cases 3 and 5 specifically address the scenario of incisional hernia discovered during a subsequent pregnancy. These cases highlight several unique principles:"),
      numberedItem("Conservative management is preferred throughout pregnancy in the absence of complications (obstruction, strangulation, skin ulceration, foetal compromise)."),
      numberedItem("An abdominal binder provides symptomatic relief and limits hernia enlargement."),
      numberedItem("Serial imaging surveillance (ultrasound or MRI) should be performed every 4–6 weeks to monitor defect size and sac contents."),
      numberedItem("Mode of delivery: cesarean section is generally preferred to control abdominal wall tension, allow concurrent surgical assessment, and potentially enable simultaneous repair of small defects (Case 5)."),
      numberedItem("Timing of repair: elective repair is best deferred to 6–8 months postpartum to allow involution of the uterus, resolution of tissue oedema, and patient optimisation."),
      numberedItem("MDT composition: obstetrician, general/abdominal wall surgeon, anaesthetist, radiologist, dietitian, and physiotherapist — all contributed to the management of Cases 3 and 5."),

      h2("3.7 Prevention"),
      para("The high proportion of patients in our series with modifiable risk factors (4/5 had wound complications; 3/5 were obese) underscores that prevention is as important as treatment. Evidence-based preventive strategies include:"),
      bullet("Patient-level: smoking cessation (ideally >4 weeks pre-operatively), weight management, nutritional optimisation, glycaemic control in diabetes."),
      bullet("Surgical technique: small-bite, small-stitch closure (suture:wound length ratio >4:1; bites 5 mm from wound edge per EHS guidelines) [10]; mass closure with slowly absorbable suture (looped PDS or equivalent); meticulous haemostasis."),
      bullet("Wound infection prevention: prophylactic antibiotics (cefazolin within 60 min of incision), irrigation, avoiding dead space, closed suction drainage in at-risk wounds."),
      bullet("Prophylactic mesh placement: emerging evidence supports its use in high-risk patients (BMI >35, previous hernia, chronic cough, malnutrition) — area of active research; not yet routine practice."),
      spacer(),

      // ════════════════════════════════════════════════════════════════════
      // 4. COMPARATIVE ANALYSIS
      // ════════════════════════════════════════════════════════════════════
      h1("4. Comparative Analysis and Literature Context"),
      tblLabel("Table 4. Comparison of Our Series with Published Case Reports and Studies"),
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({ children: [
            hdrCell("Study", 2200), hdrCell("N", 700), hdrCell("Study Type", 1700),
            hdrCell("Key Finding", 4500), hdrCell("Relevance to Series", 2820)
          ]}),
          ...[
            ["Paulsen et al. 2020 [1]","275,878 (5 studies)","Systematic Review","IH incidence 0.0–5.6% post-CS; low overall risk; long follow-up needed","Provides epidemiological baseline; our series reflects the clinical end of the spectrum"],
            ["Larsson et al. 2021 [4]","79,052","Population Cohort","OR 2.71 for IH; smoking, obesity, repeat CS = independent risk factors","Risk factors present in 4/5 of our cases; confirms multi-factorial aetiology"],
            ["Aylia et al. 2022 [7]","1","Case Report","IH repair concurrent with CS safe and feasible","Mirrors our Case 5; validates simultaneous repair strategy for small defects"],
            ["Jayasena et al. 2022 [6]","1","Case Report","Preperitoneal IH: rare acute variant; peritoneum intact; CT essential","Matches our Case 2 presentation closely"],
            ["Suleman et al. 2023 [5]","1","Case Report + Review","Massive IH in pregnancy; MDT conservative management; staged repair","Mirrors our Case 3; validates deferred repair and MDT approach"],
            ["Oma et al. 2019 [8]","Multiple (SR)","Systematic Review","Ventral hernia in pregnancy: conservative preferred; defer repair postpartum","Directly informs management of Cases 3 and 5"],
          ].map((row, i) => new TableRow({ children: row.map((cell, j) => dataCell(cell, [2200,700,1700,4500,2820][j] || 2000, i%2===0)) }))
        ]
      }),
      spacer(),

      // ════════════════════════════════════════════════════════════════════
      // 5. CONCLUSION
      // ════════════════════════════════════════════════════════════════════
      h1("5. Conclusion"),
      para("This case series of five patients with incisional hernia following cesarean section demonstrates the diverse clinical presentations, risk profiles, and management challenges that this condition can pose. From an acute preperitoneal hernia three weeks post-CS to a large hernia complicating a subsequent pregnancy requiring MDT management, each case adds a dimension to our understanding of this underappreciated complication."),
      para("The common thread across all five cases is the presence of identifiable and frequently modifiable risk factors — wound infection, obesity, multiple cesarean sections, and smoking — emphasising the preventive opportunity that exists at the time of primary CS. Surgeons performing cesarean sections should adhere to evidence-based fascial closure techniques, minimise wound complications, and ensure appropriate postoperative follow-up to enable early hernia detection."),
      para("When incisional hernia does develop, management must be individualised. Mesh-based repair (sublay or IPOM) offers the lowest recurrence rates and remains the standard of care for defects above 2 cm. Primary repair is acceptable for small defects in selected circumstances with appropriately informed consent regarding recurrence risk. Hernia discovered during pregnancy requires conservative management, close MDT surveillance, and deferred repair unless complications mandate earlier intervention."),
      para("Larger prospective registries and standardised long-term follow-up protocols after CS are needed to better characterise the true incidence and natural history of this condition, and to inform evidence-based prevention and surveillance guidelines."),
      spacer(),

      // ════════════════════════════════════════════════════════════════════
      // LEARNING POINTS
      // ════════════════════════════════════════════════════════════════════
      new Paragraph({
        spacing: { before: 160, after: 100 },
        children: [new TextRun({ text: "Key Learning Points from This Case Series", bold: true, font: "Arial", size: 26, color: "1A3A6B" })]
      }),
      bullet("CS carries an OR of 2.71 for incisional hernia vs vaginal delivery; OR rises with obesity, smoking, and multiple CSs."),
      bullet("Wound infection remains the single most important modifiable risk factor — documented in 4 of our 5 cases."),
      bullet("Incisional hernia post-CS can present acutely (preperitoneal, Case 2), electively (Cases 1 & 4), or during pregnancy (Cases 3 & 5)."),
      bullet("CT is essential for surgical planning in all but the smallest hernias; MRI is preferred in pregnancy."),
      bullet("Mesh repair (sublay/IPOM) is standard for defects >2 cm; primary suture acceptable only for small, selected defects."),
      bullet("Emergency presentation (incarceration/obstruction, Case 4) requires prompt surgical intervention; viable bowel can be reduced without resection."),
      bullet("Hernia in pregnancy: conservative MDT management preferred; delivery by CS generally recommended; repair deferred 6–8 months postpartum."),
      bullet("Concurrent repair at CS (Case 5) is feasible for small, incidentally found defects but requires careful patient counselling regarding recurrence."),
      bullet("Prevention is paramount: small-bite fascial closure, infection prevention, and patient optimisation are the pillars of reducing post-CS incisional hernia."),
      spacer(),

      // ════════════════════════════════════════════════════════════════════
      // REFERENCES
      // ════════════════════════════════════════════════════════════════════
      divider(),
      h1("References"),
      numberedItem("Paulsen CB, Zetner D, Rosenberg J. Incisional hernia after cesarean section: A systematic review. Eur J Obstet Gynecol Reprod Biol. 2020;244:75-81. doi:10.1016/j.ejogrb.2019.11.010. PMID: 31785469"),
      numberedItem("Sabiston Textbook of Surgery: The Biological Basis of Modern Surgical Practice. Chapter on Abdominal Wall, Hernia and Fascial Closure. Elsevier."),
      numberedItem("Williams NS, O'Connell PR, McCaskie AW, eds. Bailey and Love's Short Practice of Surgery. 28th ed. CRC Press/Taylor & Francis; 2023. Chapter 64: Abdominal Hernias."),
      numberedItem("Larsson C, Djuvfelt E, Lindam A, Tunon K, Nordin P. Surgical complications after caesarean section: A population-based cohort study. PLoS One. 2021;16(10):e0258222. doi:10.1371/journal.pone.0258222. PMID: 34610046"),
      numberedItem("Suleman K, Wokoh U, Iyer P, Yoong W. Pregnancy complicated by massive incisional hernia: challenges in management and review of literature. BMJ Case Rep. 2023;16(12):e254637. doi:10.1136/bcr-2023-254637. PMID: 38129081"),
      numberedItem("Jayasena W, Bormann S, Thomas R. A rare acute complication of caesarean section: Preperitoneal incisional hernia. ANZ J Surg. 2022;92(3):599-600. doi:10.1111/ans.17050. PMID: 34191393"),
      numberedItem("Aylia FA, Khirie S, Steinberg D. Incisional Hernia Repair During Cesarean Section. Cureus. 2022;14(4):e24121. doi:10.7759/cureus.24121. PMID: 35573578"),
      numberedItem("Oma E, Henriksen NA, Jensen KK. Ventral hernia and pregnancy: A systematic review. Am J Surg. 2019;217(1):195-201. PMID: 29798763"),
      numberedItem("Berek JS, Novak E, eds. Berek and Novak's Gynecology. 16th ed. Lippincott Williams & Wilkins. Chapter 26: Incisional Hernia and Wound Dehiscence."),
      numberedItem("Muysoms FE, Antoniou SA, Bury K, et al. European Hernia Society Guidelines on the closure of abdominal wall incisions. Hernia. 2015;19(1):1-24."),
      spacer(),

      // ════════════════════════════════════════════════════════════════════
      // ABBREVIATIONS & DECLARATIONS
      // ════════════════════════════════════════════════════════════════════
      divider(),
      h2("List of Abbreviations"),
      para("CS: Cesarean section  |  IH: Incisional hernia  |  BMI: Body mass index  |  CT: Computed tomography  |  MRI: Magnetic resonance imaging  |  MDT: Multidisciplinary team  |  IPOM: Intraperitoneal onlay mesh  |  EHS: European Hernia Society  |  OR: Odds ratio  |  CI: Confidence interval  |  PDS: Polydioxanone suture  |  GDM: Gestational diabetes mellitus  |  T2DM: Type 2 diabetes mellitus  |  USS: Ultrasound scan  |  ICU: Intensive care unit  |  ASA: American Society of Anesthesiologists"),
      spacer(),
      divider(),
      new Paragraph({
        spacing: { after: 80 },
        children: [new TextRun({ text: "Ethical Declaration", bold: true, font: "Arial", size: 24, color: "1A3A6B" })]
      }),
      para("All cases presented in this series are entirely hypothetical and constructed for educational purposes. They do not represent any real patient. No ethical approval is required for this hypothetical case series. If adapted for publication based on real patients, informed written consent from each patient and institutional ethical approval are mandatory.", { italic: true }),
      spacer(),
      para("Conflicts of Interest: The authors declare no conflicts of interest.", { italic: true }),
      para("Funding: No specific funding was received for this work.", { italic: true }),
      para("Authors' Contributions: All authors contributed equally to the conception, writing, and critical review of this manuscript.", { italic: true }),
    ]
  }]
});

// ─── WRITE FILE ──────────────────────────────────────────────────────────────
Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync("/home/daytona/workspace/incisional-hernia-cs/Incisional_Hernia_CS_Case_Series.docx", buffer);
  console.log("SUCCESS: Incisional_Hernia_CS_Case_Series.docx created");
}).catch(e => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/incisional-hernia-cs && node create_case_series.js 2>…

Running Command

ls -lh /home/daytona/workspace/incisional-hernia-cs/Incisional_Hernia_CS_Case_Se…

The case series document is complete. Here is a full breakdown of what was added and changed:

What's in the updated case series document (27 KB, A4, journal-ready)

5 Carefully Varied Cases

CaseClinical ScenarioAge/BMIKey Feature
Case 1Classic delayed elective presentation32y, BMI 31Wound infection after emergency CS; open sublay mesh
Case 2Acute preperitoneal hernia at 3 weeks27y, BMI 26Rare variant; peritoneum intact; primary suture repair
Case 3Large hernia discovered at 22 weeks of 3rd pregnancy30y, BMI 34Active smoker; MDT conservative management; delayed IPOM
Case 4Incarcerated hernia + partial bowel obstruction38y, BMI 36T2DM; deep wound infection history; emergency sublay mesh
Case 5Small hernia repaired simultaneously at repeat CS29y, BMI 29Connective tissue laxity; concurrent primary suture repair

4 Tables

  1. Summary demographics table - all 5 cases side by side (12 parameters)
  2. Risk factor matrix - presence/absence across all cases with totals
  3. Management decision framework - scenario, case, strategy, and evidence basis
  4. Comparative literature table - 6 published studies mapped against the series

Sections

  • Structured abstract (Background, Aim, Methods, Results, Conclusion)
  • Introduction with epidemiology and OR data (Larsson 2021, Paulsen 2020)
  • Individual case write-ups with sub-sections (Profile, Presentation, Investigations, Management, Outcome)
  • Discussion covering: epidemiology, risk factor analysis, classification (timing/layer/status), diagnostics, management strategies, hernia in pregnancy, and prevention
  • Comparative analysis against published literature
  • Conclusion + 9 learning points + 10 references with PMIDs + full abbreviations + ethical declarations

Ok..send me the word file

Here it is — click to download:

Incisional Hernia CS Case Series

Word Document · DOCX

This is the 5-case series Word document we just created. If you need any edits — additional cases, journal-specific formatting, or a different title — just let me know.
This is a shared conversation. Sign in to Orris to start your own chat.