attachment
attachment

Make an answer book. Write detailed answers with diagrams (as I directly write in exam from this) as per marks (30/10) mainly from Love and Bailey (you can also use other standard books like sabiston and etc..).

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

ls /home/daytona/workspace/ 2>/dev/null && mkdir -p /home/daytona/workspace/answer-book

Writing File

~/answer-book/create_answer_book.js

const {
  Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
  HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
  VerticalAlign, PageBreak, PageNumber, NumberFormat, convertInchesToTwip,
  UnderlineType
} = require('docx');
const fs = require('fs');

// ─── Color palette ───────────────────────────────────────────────
const DARK_NAVY  = "1B2A4A";
const GOLD       = "B8860B";
const LIGHT_BLUE = "D6E4F0";
const WHITE      = "FFFFFF";
const GREY_BORDER = "CCCCCC";
const RED_HL     = "C0392B";
const GREEN_HL   = "1A7A3C";

// ─── Helpers ─────────────────────────────────────────────────────

function hd1(text) {
  return new Paragraph({
    text,
    heading: HeadingLevel.HEADING_1,
    spacing: { before: 400, after: 160 },
    shading: { type: ShadingType.SOLID, color: DARK_NAVY },
    run: { color: WHITE },
    children: [new TextRun({ text, bold: true, size: 32, color: WHITE, font: "Calibri" })]
  });
}

function qHeading(qno, title, marks) {
  return new Paragraph({
    spacing: { before: 400, after: 200 },
    children: [
      new TextRun({ text: `Q${qno}. `, bold: true, size: 30, color: WHITE, font: "Calibri" }),
      new TextRun({ text: title, bold: true, size: 28, color: WHITE, font: "Calibri" }),
      new TextRun({ text: `  [${marks} Marks]`, bold: true, size: 24, color: GOLD, font: "Calibri" }),
    ],
    shading: { type: ShadingType.SOLID, color: DARK_NAVY },
  });
}

function h2(text) {
  return new Paragraph({
    spacing: { before: 280, after: 100 },
    children: [
      new TextRun({ text, bold: true, size: 24, color: DARK_NAVY, font: "Calibri",
        underline: { type: UnderlineType.SINGLE, color: GOLD } }),
    ],
  });
}

function h3(text) {
  return new Paragraph({
    spacing: { before: 200, after: 80 },
    children: [new TextRun({ text, bold: true, size: 22, color: "2E4057", font: "Calibri" })],
  });
}

function para(text) {
  return new Paragraph({
    spacing: { before: 60, after: 60 },
    children: [new TextRun({ text, size: 20, font: "Calibri" })],
  });
}

function bullet(text, level = 0) {
  return new Paragraph({
    bullet: { level },
    spacing: { before: 40, after: 40 },
    children: [new TextRun({ text, size: 20, font: "Calibri" })],
  });
}

function boldBullet(label, text, level = 0) {
  return new Paragraph({
    bullet: { level },
    spacing: { before: 40, after: 40 },
    children: [
      new TextRun({ text: label + ": ", bold: true, size: 20, font: "Calibri", color: DARK_NAVY }),
      new TextRun({ text, size: 20, font: "Calibri" }),
    ],
  });
}

function note(text) {
  return new Paragraph({
    spacing: { before: 80, after: 80 },
    indent: { left: convertInchesToTwip(0.3) },
    shading: { type: ShadingType.SOLID, color: "FFF3CD" },
    children: [
      new TextRun({ text: "📌 NOTE: ", bold: true, size: 20, color: "856404", font: "Calibri" }),
      new TextRun({ text, size: 20, color: "856404", font: "Calibri" }),
    ],
  });
}

function keyPoint(text) {
  return new Paragraph({
    spacing: { before: 80, after: 80 },
    indent: { left: convertInchesToTwip(0.3) },
    shading: { type: ShadingType.SOLID, color: "D1ECF1" },
    children: [
      new TextRun({ text: "★ KEY: ", bold: true, size: 20, color: "0C5460", font: "Calibri" }),
      new TextRun({ text, size: 20, color: "0C5460", font: "Calibri" }),
    ],
  });
}

function divider() {
  return new Paragraph({
    spacing: { before: 100, after: 100 },
    border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: GOLD } },
    children: [],
  });
}

function pageBreak() {
  return new Paragraph({ children: [new PageBreak()] });
}

// ─── Table helper ────────────────────────────────────────────────
function makeTable(headers, rows, colWidths) {
  const headerRow = new TableRow({
    tableHeader: true,
    children: headers.map((h, i) => new TableCell({
      width: { size: colWidths ? colWidths[i] : Math.floor(9000/headers.length), type: WidthType.DXA },
      shading: { type: ShadingType.SOLID, color: DARK_NAVY },
      verticalAlign: VerticalAlign.CENTER,
      children: [new Paragraph({
        alignment: AlignmentType.CENTER,
        children: [new TextRun({ text: h, bold: true, color: WHITE, size: 20, font: "Calibri" })]
      })],
    })),
  });

  const dataRows = rows.map((row, ri) => new TableRow({
    children: row.map((cell, ci) => new TableCell({
      width: { size: colWidths ? colWidths[ci] : Math.floor(9000/headers.length), type: WidthType.DXA },
      shading: { type: ShadingType.SOLID, color: ri % 2 === 0 ? LIGHT_BLUE : WHITE },
      children: [new Paragraph({
        children: [new TextRun({ text: String(cell), size: 20, font: "Calibri" })]
      })],
    })),
  }));

  return new Table({
    width: { size: 9000, type: WidthType.DXA },
    rows: [headerRow, ...dataRows],
  });
}

// ─── ASCII-art style diagram boxes ───────────────────────────────
function diagramBox(title, lines) {
  const children = [
    new TextRun({ text: `◆ ${title}`, bold: true, size: 22, color: WHITE, font: "Courier New" }),
    new TextRun({ break: 1 }),
    new TextRun({ text: "─".repeat(55), size: 18, color: "AACCFF", font: "Courier New" }),
    new TextRun({ break: 1 }),
  ];
  lines.forEach(line => {
    children.push(new TextRun({ text: line, size: 18, font: "Courier New", color: "E8F4FD" }));
    children.push(new TextRun({ break: 1 }));
  });
  return new Paragraph({
    spacing: { before: 120, after: 120 },
    indent: { left: convertInchesToTwip(0.2), right: convertInchesToTwip(0.2) },
    shading: { type: ShadingType.SOLID, color: "1E3A5F" },
    children,
  });
}

// ═══════════════════════════════════════════════════════
// CONTENT
// ═══════════════════════════════════════════════════════

const content = [];

// ──────────────────────────────────────────────────────
// TITLE PAGE
// ──────────────────────────────────────────────────────
content.push(
  new Paragraph({ spacing: { before: 2000, after: 200 },
    alignment: AlignmentType.CENTER,
    shading: { type: ShadingType.SOLID, color: DARK_NAVY },
    children: [new TextRun({ text: "SURGERY ANSWER BOOK", bold: true, size: 52, color: WHITE, font: "Calibri" })],
  }),
  new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 100, after: 100 },
    children: [new TextRun({ text: "Based on Bailey & Love's Short Practice of Surgery (28th Ed.)", size: 24, color: GOLD, font: "Calibri", italics: true })],
  }),
  new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 60, after: 60 },
    children: [new TextRun({ text: "Supplemented by Sabiston, Schwartz & Current Surgical Therapy", size: 20, color: "555555", font: "Calibri", italics: true })],
  }),
  divider(),
  new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 100 },
    children: [new TextRun({ text: "Q1 (30 marks) · Q2 (30 marks) · Q3 (10 marks) · Q4 (10 marks) · Q5 (10 marks)", size: 22, bold: true, color: DARK_NAVY, font: "Calibri" })],
  }),
  pageBreak()
);

// ══════════════════════════════════════════════════════════
// Q1: BARIATRIC / METABOLIC SURGERY — 30 MARKS
// ══════════════════════════════════════════════════════════

content.push(
  qHeading(1, "Bariatric / Metabolic Surgery — Principles, Procedures & Recent Trends", 30),

  h2("1. DEFINITION & OVERVIEW"),
  para("Bariatric surgery refers to operative procedures that reduce body weight, primarily in morbidly obese patients. The term 'metabolic surgery' reflects the additional benefit of resolving metabolic disorders — particularly type 2 diabetes — independent of weight loss, mediated through gut-hormone alterations (GLP-1, PYY, GIP)."),
  keyPoint("Metabolic surgery improves T2DM in >80% of patients, sometimes before significant weight loss occurs."),

  h2("2. INDICATIONS (NIH Consensus / IFSO Guidelines)"),
  makeTable(
    ["Criterion", "Threshold"],
    [
      ["BMI", "≥ 40 kg/m²  OR  ≥ 35 kg/m² with obesity-related comorbidity"],
      ["Age", "18–65 years (selected cases outside this range)"],
      ["Failed conservative management", "6–12 months of supervised diet & lifestyle programme"],
      ["Metabolic surgery for T2DM", "BMI 30–35 kg/m² if T2DM not controlled by medical therapy"],
      ["Psychological fitness", "No untreated psychiatric illness; compliant personality"],
    ],
    [3000, 6000]
  ),

  h2("3. CONTRAINDICATIONS"),
  bullet("Active substance abuse or severe psychiatric disorder"),
  bullet("Uncontrolled cardiopulmonary disease (relative)"),
  bullet("Current malignancy"),
  bullet("Inability to comply with long-term follow-up"),

  h2("4. MECHANISMS OF ACTION"),
  diagramBox("Mechanisms of Bariatric Surgery", [
    "┌──────────────────────────────────────────────────┐",
    "│           BARIATRIC MECHANISMS                   │",
    "├─────────────────────┬────────────────────────────┤",
    "│   RESTRICTION       │   MALABSORPTION            │",
    "│  • Reduced pouch    │  • Bypassed duodenum       │",
    "│  • Early satiety    │  • Reduced bile-acid        │",
    "│  • Decreased        │    exposure                │",
    "│    ghrelin          │  • Short common channel    │",
    "├─────────────────────┴────────────────────────────┤",
    "│         GUT-HORMONE CHANGES                      │",
    "│  ↑ GLP-1  ↑ PYY   ↓ Ghrelin   ↑ GIP             │",
    "│  → Satiety, β-cell regeneration, ↓ Glucagon      │",
    "└──────────────────────────────────────────────────┘",
  ]),

  h2("5. SURGICAL PROCEDURES"),

  h3("A. Laparoscopic Sleeve Gastrectomy (LSG)"),
  bullet("Removes 70–80% of the greater curvature of the stomach along a bougie (32–40 Fr)"),
  bullet("Tubular remnant of ~100–150 mL capacity"),
  bullet("Mechanism: Restriction + marked reduction in ghrelin (fundus removed)"),
  bullet("EWL: ~60–70% at 1 year"),
  bullet("No anastomosis; simpler, reversible to RYGB"),
  bullet("Risk: Staple-line leak (0.5–2%), GORD worsening"),
  diagramBox("Sleeve Gastrectomy – Schema", [
    "  BEFORE              AFTER (Sleeve)",
    " ┌────────┐          ┌──┐",
    " │ Fundus │  Remove  │  │← Tube ~150 mL",
    " │  Body  │ ──────►  │  │",
    " │ Antrum │          │  │← Antrum preserved",
    " └────────┘          └──┘",
    " Bougie size: 32–40 Fr",
    " Ghrelin: ↓↓ (fundus removed)",
  ]),

  h3("B. Laparoscopic Roux-en-Y Gastric Bypass (LRYGB)"),
  bullet("Gold standard bariatric procedure (historically)"),
  bullet("Proximal gastric pouch (~30 mL) created; Roux limb (150 cm) anastomosed"),
  bullet("Biliopancreatic limb (50–100 cm) transected from duodeno-jejunal junction"),
  bullet("Mechanism: Restriction + malabsorption + foregut bypass + ↑GLP-1"),
  bullet("EWL: ~70–80%; T2DM remission ~80%"),
  bullet("Risks: Anastomotic leak, marginal ulcer, dumping syndrome, internal hernia, nutritional deficiencies (B12, Fe, Ca, folate)"),
  diagramBox("RYGB Anatomy", [
    "  Oesophagus",
    "      |",
    "  [Gastric Pouch ~30mL]",
    "      |",
    "  Gastrojejunostomy",
    "      |",
    "  Roux Limb (alimentary, 150 cm)",
    "      |",
    "  [Jejuno-jejunostomy (Y-junction)]",
    "      |_____________|",
    "  Biliopancreatic   Common",
    "  Limb (50-100cm)   Channel (>100cm)",
    "  (Duodenum +",
    "   Proximal Jejunum)",
  ]),

  h3("C. Laparoscopic Adjustable Gastric Band (LAGB)"),
  bullet("Silastic band placed around proximal stomach, creating 15–20 mL pouch"),
  bullet("Adjustable via subcutaneous port; band tightened by saline injection"),
  bullet("Purely restrictive; reversible"),
  bullet("EWL: ~45–50%; T2DM remission ~60%"),
  bullet("Disadvantages: Band slippage, erosion, port infection; highest re-operation rate"),
  bullet("Now largely abandoned due to poor long-term outcomes vs LSG/RYGB"),

  h3("D. Biliopancreatic Diversion with Duodenal Switch (BPD-DS)"),
  bullet("Most potent bariatric procedure"),
  bullet("Sleeve gastrectomy + duodenoileostomy + long biliopancreatic limb"),
  bullet("Common channel: only 50–100 cm"),
  bullet("EWL: ~80–90%; T2DM remission ~95%"),
  bullet("Highest malabsorption risk: Protein deficiency, fat-soluble vitamin deficiency (A, D, E, K), dumping"),
  bullet("Indicated for BMI >50 or metabolic super-obesity"),

  h3("E. Mini Gastric Bypass / Single Anastomosis Gastric Bypass (SAGB/MGB)"),
  bullet("Single gastrojejunal anastomosis; long biliopancreatic limb (150–250 cm)"),
  bullet("Simpler than RYGB (one anastomosis only)"),
  bullet("EWL ~75–80%; effective T2DM remission"),
  bullet("Concern: Biliary reflux into pouch (gastric cancer risk debated)"),

  makeTable(
    ["Procedure", "Mechanism", "EWL (%)", "T2DM Remission", "Key Risk"],
    [
      ["Sleeve Gastrectomy", "Restriction + ↓Ghrelin", "60–70", "~60–70%", "Staple-line leak, GORD"],
      ["RYGB (Gold Standard)", "Restriction + Malabsorption + Hormonal", "70–80", "~80%", "Internal hernia, dumping"],
      ["LAGB", "Restriction only", "45–50", "~60%", "Band slippage, erosion"],
      ["BPD-DS", "Restriction + Severe malabsorption", "80–90", "~95%", "Protein / vitamin deficiency"],
      ["Mini Gastric Bypass", "Restriction + Partial malabsorption", "75–80", "~80%", "Bile reflux"],
    ],
    [2000, 2200, 1100, 1700, 2000]
  ),

  h2("6. PREOPERATIVE WORKUP"),
  bullet("BMI calculation, weight history, dietary assessment"),
  bullet("Multidisciplinary team: surgeon, dietitian, psychologist, endocrinologist"),
  bullet("Investigations: FBS, HbA1c, LFTs, TFTs, lipid profile, sleep study (OSA), echocardiography if indicated"),
  bullet("Upper GI endoscopy: rule out Helicobacter pylori, Barrett's, hiatus hernia"),
  bullet("Nutritional assessment and supplementation pre-op"),

  h2("7. POSTOPERATIVE CARE & COMPLICATIONS"),
  makeTable(
    ["Phase", "Complication", "Management"],
    [
      ["Early (<30 days)", "Anastomotic/staple-line leak", "CT scan, drainage; re-operation if peritonitis"],
      ["Early (<30 days)", "Haemorrhage (luminal/intra-abdominal)", "Endoscopy / re-laparoscopy"],
      ["Early (<30 days)", "Pulmonary embolism", "LMWH prophylaxis; therapeutic anticoagulation"],
      ["Late (>30 days)", "Internal hernia (RYGB)", "Closure of mesenteric defects; laparoscopy"],
      ["Late", "Dumping syndrome", "Small meals, avoid simple sugars; acarbose"],
      ["Late", "Marginal ulcer", "PPIs, H. pylori eradication"],
      ["Late", "Nutritional deficiencies", "Lifelong supplementation: B12, Fe, Ca+D, folate"],
      ["Late", "Weight regain", "Re-sleeve / conversion to RYGB; behavioural therapy"],
    ],
    [1300, 2400, 5300]
  ),

  h2("8. NUTRITIONAL SUPPLEMENTATION AFTER BARIATRIC SURGERY"),
  bullet("Multivitamin + mineral: daily lifelong"),
  bullet("Vitamin B12: 500–1000 mcg/day oral OR 1000 mcg IM monthly"),
  bullet("Iron: 45–60 mg elemental iron daily (especially females)"),
  bullet("Calcium citrate: 1200–1500 mg/day (citrate preferred — no acid needed for absorption)"),
  bullet("Vitamin D: 3000 IU/day; target 25-OH-D3 >30 ng/mL"),
  bullet("Folate: 400–800 mcg/day (1 mg in women of childbearing age)"),

  h2("9. RECENT TRENDS IN BARIATRIC / METABOLIC SURGERY"),
  makeTable(
    ["Trend", "Details"],
    [
      ["Endoscopic bariatric therapies", "Intragastric balloon, endoscopic sleeve gastroplasty (Overstitch), aspiration therapy"],
      ["Robotic-assisted bariatric surgery", "Improved dexterity for RYGB & revisional surgery; reduced conversion rate"],
      ["One Anastomosis Gastric Bypass (OAGB)", "Gaining global acceptance; IFSO approval 2018"],
      ["SADI-S (Single Anastomosis Duodeno-Ileal Bypass)", "Simplified BPD-DS variant; promising outcomes"],
      ["Metabolic surgery in T2DM with BMI 30–35", "Multiple RCTs (STAMPEDE, TRIABETES) — surgery superior to medical therapy"],
      ["Enhanced Recovery After Surgery (ERAS) in bariatrics", "Same-day or 23-hour discharge protocols; multimodal analgesia"],
      ["Digital follow-up platforms", "App-based dietary tracking, remote monitoring for weight regain"],
    ],
    [3000, 6000]
  ),

  keyPoint("STAMPEDE trial (NEJM 2017): At 5 years, bariatric surgery (RYGB/sleeve) superior to intensive medical therapy for glycaemic control in obese T2DM patients."),
  note("Pregnancy: Advise at least 12–18 months delay after bariatric surgery before conception. Monitor for nutritional deficiencies in pregnancy."),
  divider(),
  pageBreak(),

// ══════════════════════════════════════════════════════════
// Q2: CARCINOMA OESOPHAGUS — 30 MARKS
// ══════════════════════════════════════════════════════════

  qHeading(2, "Carcinoma Oesophagus — Aetio-Pathogenesis, Clinical Features & Management", 30),

  h2("1. EPIDEMIOLOGY"),
  para("Oesophageal cancer is the 8th most common cancer worldwide and 6th most common cause of cancer-related death (Bailey & Love, 28th ed). It most commonly presents in the 6th–7th decade. Two main histological types: Squamous Cell Carcinoma (SCC) and Adenocarcinoma (AC)."),
  makeTable(
    ["Feature", "Squamous Cell Carcinoma", "Adenocarcinoma"],
    [
      ["Location", "Upper & mid-oesophagus", "Lower oesophagus & OGJ"],
      ["Geography", "Asia, Africa, Iran, South America", "Western countries (USA, UK, Australia)"],
      ["Precursor lesion", "Squamous dysplasia", "Barrett's oesophagus"],
      ["Trend", "Steady incidence", "Rapidly rising since 1990s"],
    ],
    [2000, 3500, 3500]
  ),

  h2("2. AETIOLOGY & PATHOGENESIS"),

  h3("A. Squamous Cell Carcinoma — Risk Factors"),
  bullet("Smoking (strongest): 3–8× increased risk"),
  bullet("Alcohol: Independent risk factor; synergistic with smoking (10–15× combined)"),
  bullet("ALDH2 deficiency (East Asians): Acetaldehyde accumulation → DNA damage"),
  bullet("Hot beverages: Thermal mucosal injury → squamous dysplasia"),
  bullet("Nitrosamines in diet: Pickled vegetables, preserved foods, N-nitroso compounds"),
  bullet("Nutritional deficiencies: Vitamins A, C, E; zinc, selenium, riboflavin, molybdenum"),
  bullet("Achalasia: 5% develop SCC after >10 years"),
  bullet("Plummer-Vinson (Patterson-Kelly) syndrome: Iron-deficiency, post-cricoid web → SCC"),
  bullet("Corrosive strictures: Long-term risk (15–30 year latency)"),
  bullet("Coeliac disease, tylosis (palmoplantar keratoderma — AD gene on chromosome 17q25)"),

  h3("B. Adenocarcinoma — Risk Factors"),
  bullet("GORD (Gastro-oesophageal reflux disease): Core risk factor"),
  bullet("Barrett's Oesophagus: Columnar metaplasia replacing squamous; risk of AC 0.2–0.5%/year"),
  bullet("Obesity (central adiposity): ↑intra-abdominal pressure → GORD → Barrett's"),
  bullet("H. pylori infection: Paradoxically protective (↓ gastric acid production via corpus gastritis)"),
  bullet("Smoking (mild role, unlike SCC)"),

  h3("C. Pathogenesis of Barrett's → Adenocarcinoma"),
  diagramBox("Barrett's Oesophagus → Adenocarcinoma Sequence", [
    " GORD",
    "   |",
    "   ▼",
    " Reflux oesophagitis (chronic acid/bile exposure)",
    "   |",
    "   ▼",
    " Barrett's metaplasia",
    " (Columnar intestinal epithelium replaces squamous)",
    "   |",
    "   ▼",
    " Low-grade dysplasia (LGD)",
    "   |",
    "   ▼",
    " High-grade dysplasia (HGD)",
    "   |",
    "   ▼",
    " Intramucosal carcinoma (T1a)",
    "   |",
    "   ▼",
    " Invasive adenocarcinoma",
    " (Through submucosa → muscularis → serosa)",
  ]),

  h2("3. PATHOLOGY"),
  h3("Macroscopic Types"),
  bullet("Polypoid / fungating (most common AC)"),
  bullet("Ulcerative"),
  bullet("Infiltrating / stenosing (most common SCC)"),
  bullet("Superficial / flat (early disease)"),

  h3("Spread"),
  bullet("Local: Trachea, bronchi, aorta, recurrent laryngeal nerve, pericardium, diaphragm"),
  bullet("Lymphatic: Cervical, mediastinal, coeliac nodes — submucosal lymphatics facilitate SKIP metastases"),
  bullet("Haematogenous: Liver, lungs, bone, brain, adrenals"),
  bullet("Peritoneal: Particularly OGJ adenocarcinoma"),

  h2("4. STAGING (TNM 8th Edition, AJCC/UICC)"),
  makeTable(
    ["Stage", "T", "N", "M", "Implication"],
    [
      ["I", "T1a/T1b", "N0", "M0", "Mucosal/submucosal; potentially curable endoscopically"],
      ["II", "T2–T3", "N0–N1", "M0", "Resectable with surgery ± neoadjuvant"],
      ["III", "T3–T4a", "N1–N3", "M0", "Locally advanced; multimodal treatment"],
      ["IV", "Any T", "Any N", "M1", "Distant metastasis; palliative intent"],
    ],
    [900, 1200, 1200, 900, 4800]
  ),

  h2("5. CLINICAL FEATURES"),
  makeTable(
    ["Feature", "Details"],
    [
      ["Dysphagia", "Cardinal symptom — initially to solids, then semi-solids, then liquids (progressive)"],
      ["Weight loss", "Marked — due to dysphagia + systemic effects of malignancy"],
      ["Odynophagia", "Pain on swallowing; suggests T3/T4 disease"],
      ["Regurgitation", "Undigested food; nocturnal aspiration → pneumonia"],
      ["Hoarseness", "RLN involvement (left RLN in mediastinum)"],
      ["Cough", "Tracheo-oesophageal fistula — coughing on swallowing"],
      ["Haematemesis", "Uncommon; tumour erosion into vessel"],
      ["Cachexia & anaemia", "Late features of advanced disease"],
    ],
    [2000, 7000]
  ),

  h2("6. INVESTIGATIONS"),
  h3("A. Endoscopy (OGD)"),
  bullet("First-line — allows direct visualisation + biopsy for histology"),
  bullet("Chromoendoscopy / NBI for Barrett's surveillance"),

  h3("B. Barium Swallow"),
  bullet("'Rat-tail' or 'shouldering' appearance"),
  bullet("Shows length of stricture, fistula"),

  h3("C. Staging Investigations"),
  bullet("CT Chest, Abdomen & Pelvis: First-line staging; assess T, N, M (sensitivity ~65% for nodal disease)"),
  bullet("Endoscopic Ultrasound (EUS): Best for T and N staging (accuracy ~85% for T, ~75% for N)"),
  bullet("PET-CT (FDG): Best for detecting distant metastases; assesses treatment response (ΔSUVmax)"),
  bullet("Laparoscopy: For OGJ adenocarcinoma — exclude peritoneal metastases"),
  bullet("Bronchoscopy: Upper/mid-thoracic SCC — exclude airway invasion"),
  bullet("MRI: Brain/liver if clinically suspected metastases"),

  h3("D. Nutritional & Functional Assessment"),
  bullet("Nutritional risk screening (NRS-2002) — most patients malnourished"),
  bullet("Spirometry / DLCO — pulmonary reserve for resection"),
  bullet("Cardiac assessment: ECG, Echo if high-risk"),

  diagramBox("Staging Investigations Algorithm", [
    "OGD + Biopsy (Diagnosis confirmed)",
    "         |",
    "         ▼",
    "CT Chest-Abdomen-Pelvis (First staging)",
    "         |",
    "    ┌────┴────┐",
    "    ▼         ▼",
    "EUS      PET-CT",
    "(T, N)   (M staging, response)",
    "    |",
    "Laparoscopy (OGJ / GEJ adenocarcinoma)",
  ]),

  h2("7. MANAGEMENT"),

  h3("A. Multidisciplinary Team (MDT)"),
  para("All cases should be discussed in an MDT comprising upper GI surgeon, oncologist, gastroenterologist, radiologist, pathologist, dietitian, clinical nurse specialist."),

  h3("B. Curative Intent Surgery"),
  bullet("Oesophagectomy is the cornerstone of curative treatment for resectable disease (Stage I–III)"),
  makeTable(
    ["Approach", "Technique", "Indication"],
    [
      ["Ivor Lewis / McKeown Oesophagectomy", "Laparotomy + Right thoracotomy; cervical anastomosis in McKeown", "Mid and lower thoracic tumours"],
      ["Transhiatal Oesophagectomy (THE)", "Laparotomy + cervical dissection — no thoracotomy; 'blind' mediastinal dissection", "Lower oesophagus / OGJ; poor pulmonary reserve"],
      ["Minimally Invasive Oesophagectomy (MIO)", "VATS + laparoscopy ± robotic-assisted", "Equivalent oncological outcomes; ↓ pulmonary complications"],
      ["Left thoraco-abdominal approach", "Single incision across left chest-abdomen", "Siewert II/III OGJ cancers"],
    ],
    [2200, 3800, 3000]
  ),

  h3("C. Reconstruction"),
  bullet("Gastric conduit (stomach): Most common — based on right gastro-epiploic artery; single anastomosis"),
  bullet("Colonic interposition: When stomach unavailable (previous gastrectomy); right or left colon"),
  bullet("Jejunal conduit: For cervical replacements; free jejunal transfer possible"),

  h3("D. Neoadjuvant Therapy (Pre-operative)"),
  bullet("CROSS Trial Protocol (Lancet Oncology): Weekly carboplatin + paclitaxel × 5 weeks + 41.4 Gy radiotherapy → surgery"),
  bullet("pCR (pathological complete response) ~30%"),
  bullet("FLOT regimen (Germany): 5-FU, leucovorin, oxaliplatin, docetaxel — 4 cycles pre- and post-op; preferred for gastric/OGJ AC"),
  bullet("Indicated for T3/T4a or N+ disease (Stage II–III)"),

  h3("E. Endoscopic Treatment — Early Disease"),
  bullet("T1a (mucosal): Endoscopic Mucosal Resection (EMR) or Endoscopic Submucosal Dissection (ESD)"),
  bullet("Post-EMR/ESD: Radiofrequency ablation (RFA) of remaining Barrett's mucosa"),
  bullet("T1b (submucosal): Higher nodal risk — surgery generally recommended unless unfit"),

  h3("F. Palliative Management"),
  makeTable(
    ["Symptom / Goal", "Intervention"],
    [
      ["Dysphagia relief (rapid)", "Self-expanding metallic stent (SEMS) — palliation of choice"],
      ["Local disease control", "Palliative chemoradiotherapy or radiotherapy alone"],
      ["Metastatic disease", "Chemotherapy (CF regimen: cisplatin + 5-FU; FOLFOX) ± nivolumab/pembrolizumab (PD-L1 +ve)"],
      ["Nutrition", "Nasojejunal tube / jejunostomy feeding; TPN if gut non-functional"],
      ["Tracheo-oesophageal fistula", "Covered SEMS; supportive care"],
      ["Pain control", "WHO analgesic ladder; palliative radiotherapy for bone metastases"],
    ],
    [2500, 6500]
  ),

  h3("G. Complications of Oesophagectomy"),
  bullet("Anastomotic leak (5–10%): CT/drain; conservative vs. re-operation"),
  bullet("Pulmonary complications (most common): Pneumonia, ARDS, atelectasis"),
  bullet("Recurrent laryngeal nerve palsy: Hoarseness, aspiration"),
  bullet("Chylothorax: Thoracic duct injury; medium-chain triglyceride diet vs. ligation"),
  bullet("Conduit ischaemia/necrosis: Emergency re-operation"),

  h2("8. PROGNOSIS"),
  para("Overall 5-year survival: ~15–20% (all stages). Stage I: 70–80%; Stage II: 30–40%; Stage III: 10–20%; Stage IV: <5%. Resection with clear margins (R0) is the strongest prognostic factor."),
  note("Siewert classification for OGJ adenocarcinoma: Type I (oesophageal AC, 1–5 cm above OGJ), Type II (true cardia, ±1 cm of OGJ), Type III (subcardial gastric, 1–5 cm below OGJ). Important for surgical approach."),
  divider(),
  pageBreak(),

// ══════════════════════════════════════════════════════════
// Q3: TPN — 10 MARKS
// ══════════════════════════════════════════════════════════

  qHeading(3, "Total Parenteral Nutrition (TPN)", 10),

  h2("1. DEFINITION"),
  para("Total Parenteral Nutrition (TPN) is the provision of all nutritional requirements entirely via the intravenous route, bypassing the gastrointestinal tract. It is distinct from supplemental parenteral nutrition (PN given alongside enteral feeding)."),

  h2("2. INDICATIONS"),
  bullet("Short bowel syndrome (main indication): Post-massive intestinal resection or intestinal fistulation"),
  bullet("Prolonged intestinal ileus unresponsive to treatment (>5–7 days)"),
  bullet("High-output gastrointestinal fistula (>500 mL/day)"),
  bullet("Acute severe pancreatitis (when enteral feeding not tolerated)"),
  bullet("Inflammatory bowel disease with severe malabsorption"),
  bullet("Post-operative ileus when enteral route not achievable in 5–7 days"),
  bullet("Oesophageal/pharyngeal obstruction — as bridge to surgery"),
  bullet("Severely malnourished patients prior to major surgery (if gut non-functional)"),
  note("Enteral nutrition is always preferred over TPN when gut is functional (preserves gut integrity, cheaper, fewer infectious complications)."),

  h2("3. COMPOSITION OF TPN"),
  makeTable(
    ["Component", "Content", "Remarks"],
    [
      ["Carbohydrate", "Glucose 40–50% of non-protein energy", "Phosphorylation requires phosphate supplementation"],
      ["Lipid emulsion", "30–50% of non-protein energy (LCT/MCT emulsion)", "Essential fatty acids; prevents fatty liver"],
      ["Amino acids", "Essential + non-essential amino acids", "ICU patients need >1.2–2 g/kg/day"],
      ["Electrolytes", "Na, K, Ca, Mg, Phosphate, Cl, HCO3", "Tailored daily based on serum levels"],
      ["Trace elements", "Zinc, copper, selenium, manganese, chromium", "Check if TPN >28 days"],
      ["Vitamins", "Fat-soluble (A, D, E, K) + water-soluble (B-complex, C)", "Folic acid 15 mg once or twice weekly"],
      ["Vitamins B12", "1000 mcg IM monthly", "Required in long-term TPN (>months)"],
    ],
    [2000, 3000, 4000]
  ),
  para("Energy content: 150–250 kcal per gram of protein nitrogen; 30–50% energy from fat. Total daily energy: 25–35 kcal/kg/day. Phosphate: 20–30 mmol/day essential to prevent hypophosphataemia."),

  h2("4. ROUTES OF ADMINISTRATION"),

  h3("Central Venous Access — Preferred"),
  bullet("Subclavian vein (most common) or Internal jugular vein — catheter tip in SVC or right atrium"),
  bullet("PICC line (Peripherally Inserted Central Catheter): via basilic/cephalic vein"),
  bullet("Long-term TPN: Hickman line (tunnelled CVC) or implantable port"),
  bullet("CXR mandatory before starting TPN to confirm line tip position"),

  h3("Peripheral PN — Short-term Only"),
  bullet("Duration <14 days; low osmolarity feeds required"),
  bullet("Risk of thrombophlebitis due to high osmolarity; cannula changed every 2–3 days"),
  bullet("Soft polyurethane paediatric cannulae reduce phlebitis risk"),

  h2("5. COMPLICATIONS OF TPN"),
  makeTable(
    ["Category", "Complication", "Prevention / Management"],
    [
      ["Insertion (CVC)", "Pneumothorax, haemothorax, arterial puncture", "USS-guided insertion; CXR post-insertion"],
      ["Insertion (CVC)", "Air embolism", "Trendelenburg position; immediate occlusion"],
      ["Line complications", "Central line-associated bloodstream infection (CLABSI)", "Strict aseptic technique; chlorhexidine dressing; change line if persistent fever"],
      ["Line complications", "Catheter thrombosis / occlusion", "Heparinised saline flush; thrombolytics if occluded"],
      ["Metabolic", "Hyperglycaemia", "Insulin infusion (target BG 6–10 mmol/L); monitor 6-hourly"],
      ["Metabolic", "Refeeding syndrome", "Gradual refeeding; phosphate supplementation; thiamine prior to feeding"],
      ["Metabolic", "Hypophosphataemia", "20–30 mmol phosphate in each bag daily"],
      ["Metabolic", "Hypertriglyceridaemia", "Reduce lipid infusion rate; monitor triglycerides"],
      ["Metabolic", "Hepatic steatosis / cholestasis", "Cycle TPN (12–18 hr); add lipids; consider enteral feeding"],
      ["Metabolic", "Mineral / vitamin deficiency", "Monitor zinc, Cu, Se, B12, folate; supplement accordingly"],
    ],
    [1600, 2800, 4600]
  ),

  h2("6. MONITORING OF TPN"),
  bullet("Daily: Weight, fluid balance, blood glucose (6-hourly initially), electrolytes, urea, creatinine"),
  bullet("Weekly: LFTs, triglycerides, full blood count"),
  bullet("Monthly (if long-term): Zinc, copper, selenium, ferritin, folate, vitamin B12, vitamin D"),

  diagramBox("TPN Monitoring Protocol", [
    " DAILY                 WEEKLY              MONTHLY (long-term)",
    " ─────────────────     ─────────────────   ────────────────────",
    " Blood glucose (6h)    LFTs                Zinc, Copper, Se",
    " U&E, Creatinine       Triglycerides       Ferritin, B12, Folate",
    " Phosphate             FBC, INR            Vitamin D, MRI liver",
    " Weight                CRP                 Bone densitometry",
    " Fluid balance         Electrolytes",
  ]),

  h2("7. REFEEDING SYNDROME"),
  para("A potentially fatal metabolic complication occurring when nutrition is reintroduced too rapidly to malnourished patients. Mechanism: Increased insulin → intracellular shift of phosphate, potassium, magnesium → hypophosphataemia → cardiac arrhythmias, respiratory failure, Wernicke's encephalopathy."),
  bullet("High-risk: BMI <16, weight loss >15%, negligible intake >10 days, alcoholics, cancer"),
  bullet("Management: Start at 10 kcal/kg/day; increase over 4–7 days; supplement IV thiamine (Pabrinex) BEFORE feeding; correct electrolytes"),
  divider(),
  pageBreak(),

// ══════════════════════════════════════════════════════════
// Q4: BLOOD TRANSFUSION — 10 MARKS
// ══════════════════════════════════════════════════════════

  qHeading(4, "Blood Transfusion — Complications, Blood Products & Substitutes", 10),

  h2("1. BLOOD PRODUCTS"),
  makeTable(
    ["Product", "Content", "Volume/Unit", "Indications"],
    [
      ["Packed Red Blood Cells (PRBC)", "Red cells, minimal plasma", "~250–300 mL", "Anaemia (Hb <70 g/L, or <80 in cardiac disease); acute haemorrhage"],
      ["Fresh Frozen Plasma (FFP)", "All clotting factors, fibrinogen, albumin", "~250 mL", "Coagulopathy, massive transfusion, DIC, factor deficiency (if specific factor concentrate unavailable)"],
      ["Platelets", "Platelets in plasma or additive solution", "~200–250 mL (pool of 4)", "Platelet count <10×10⁹/L; <50×10⁹/L with active bleeding/surgery"],
      ["Cryoprecipitate", "Fibrinogen, Factor VIII, XIII, vWF", "~15 mL/unit (pooled ×5)", "Hypofibrinogenaemia (<1.5 g/L); DIC; haemophilia A (if concentrate unavailable)"],
      ["Albumin 4.5% / 20%", "Human albumin", "250 mL / 100 mL", "Hypoalbuminaemia; SBP prophylaxis; hepatorenal syndrome"],
      ["Prothrombin Complex Concentrate (PCC)", "Factors II, VII, IX, X; Protein C & S", "Vial", "Urgent warfarin reversal; bleeding in factor deficiency"],
    ],
    [2000, 2200, 1200, 3600]
  ),

  h2("2. COMPLICATIONS OF BLOOD TRANSFUSION"),

  h3("A. From a Single Transfusion (Bailey & Love, 28th ed.)"),
  bullet("Incompatibility Haemolytic Transfusion Reaction: Most dangerous — ABO incompatibility (usually clerical error). Fever, rigors, flank pain, haemoglobinuria, DIC, renal failure → STOP transfusion immediately"),
  bullet("Febrile Non-Haemolytic Reaction (FNHTR): Antibodies to donor leucocytes; fever without haemolysis → antipyretics; leucodepleted blood reduces risk"),
  bullet("Allergic Reaction: Urticaria, bronchospasm, anaphylaxis — IgA-deficient patients most at risk → antihistamine; IgA-deficient: use washed or IgA-deficient blood"),
  bullet("Infections — Bacterial (most dangerous acutely): Gram-negative organisms; fever, shock within minutes; platelets most at risk → Blood cultures; broad-spectrum antibiotics"),
  bullet("Infections — Viral: Hepatitis B (1:500,000), Hepatitis C (1:2,000,000), HIV (1:5,000,000) — residual risk despite screening"),
  bullet("Infections — Parasitic: Malaria (in endemic regions); Chagas disease (T. cruzi)"),
  bullet("Air Embolism: Improper venting; modern closed systems have eliminated this"),
  bullet("Thrombophlebitis: At peripheral IV site"),
  bullet("TRALI (Transfusion-Related Acute Lung Injury): Donor anti-leucocyte antibodies → non-cardiogenic pulmonary oedema within 6 hours of FFP/PRBC → supportive; avoid FFP from multiparous females (reduces TRALI)"),

  h3("B. From Massive Transfusion (>10 units PRBC in 24h)"),
  makeTable(
    ["Complication", "Mechanism", "Management"],
    [
      ["Coagulopathy / Dilutional", "Dilution of clotting factors and platelets", "Balanced transfusion 1:1:1 (PRBC:FFP:Platelets); tranexamic acid; cryoprecipitate for fibrinogen"],
      ["Hypocalcaemia", "Citrate (anticoagulant) chelates calcium", "IV calcium gluconate 10%; monitor ionised Ca²⁺"],
      ["Hyperkalaemia", "K⁺ leaks from stored RBCs (peak at day 21–35)", "ECG monitoring; calcium gluconate; insulin-dextrose"],
      ["Hypokalaemia", "Cell Na-K-ATPase activity resumes after transfusion", "IV potassium replacement"],
      ["Hypothermia", "Large volumes of cold blood", "Blood warmer; warming blankets; warm IV fluids"],
      ["Iron overload", "Each PRBC unit = 250 mg elemental iron", "Deferoxamine chelation; reserve transfusions"],
      ["Transfusion-associated circulatory overload (TACO)", "Volume overload → pulmonary oedema", "Diuretics; reduce transfusion rate; CPAP"],
    ],
    [2200, 2500, 4300]
  ),

  diagramBox("Transfusion Reaction — Immediate Management", [
    " STOP TRANSFUSION",
    "     |",
    "     ▼",
    " Check patient identity vs. blood bag label",
    "     |",
    "     ▼",
    " Maintain IV access; give 0.9% NaCl",
    "     |",
    "     ▼",
    " Notify blood bank; send blood bank sample + urine",
    "     |",
    "     ▼",
    " Treat specific reaction:",
    "   Haemolytic → IV fluids + furosemide + treat DIC",
    "   Anaphylaxis → Adrenaline IM + steroids + antihistamine",
    "   TRALI → O2 + CPAP; avoid diuretics",
  ]),

  h2("3. BLOOD SUBSTITUTES"),
  makeTable(
    ["Category", "Examples", "Status / Use"],
    [
      ["Haemoglobin-based oxygen carriers (HBOCs)", "HBOC-201 (Hemopure®)", "Licensed in South Africa; limited use globally due to vasoconstriction, oxidative injury"],
      ["Perfluorocarbon emulsions (PFCs)", "Perflubron (LiquiVent)", "Experimental; high O₂ solubility but require 100% FiO₂; short half-life"],
      ["Recombinant erythropoietin (EPO)", "Epoetin alfa/beta", "Pre-operative use to increase autologous blood reserve; not a direct substitute"],
      ["Cell-free Hb solutions", "Polyhaemoglobin", "Research phase; issues with NO scavenging → hypertension"],
      ["Autologous blood techniques", "Cell salvage, pre-op autologous donation, acute normovolaemic haemodilution", "Clinical practice; reduce allogeneic transfusion"],
    ],
    [2400, 2600, 4000]
  ),

  h2("4. BLOOD CONSERVATION STRATEGIES"),
  bullet("Autologous pre-deposit: Patient donates own blood 3–5 weeks pre-op"),
  bullet("Acute normovolaemic haemodilution (ANH): Removed pre-op + replaced with crystalloid/colloid → returned post-op"),
  bullet("Intra-operative cell salvage: Blood suctioned, washed, reinfused (CI: malignancy, infection)"),
  bullet("Tranexamic acid: Antifibrinolytic → reduces perioperative blood loss (CRASH-2 trial: reduces mortality in trauma)"),
  bullet("Erythropoietin + iron: Pre-operative to boost Hb"),
  bullet("Restrictive transfusion triggers: Hb threshold 70 g/L (TRICC trial)"),
  note("CRASH-2 Trial (Lancet 2010): Tranexamic acid given within 3 hours of injury reduces all-cause mortality in trauma by 1.5% and bleeding death by 30%."),
  divider(),
  pageBreak(),

// ══════════════════════════════════════════════════════════
// Q5: ROBOTIC SURGERY — 10 MARKS
// ══════════════════════════════════════════════════════════

  qHeading(5, "Robotic Surgery", 10),

  h2("1. DEFINITION"),
  para("A surgical robot is a mechanical device that performs tasks according to human supervision or a pre-programmed/AI-guided plan, creating a human-machine interface (Bailey & Love, 28th ed.). In surgery, it primarily exists as teleoperated (master-slave) or active/semi-active systems."),

  h2("2. HISTORY"),
  makeTable(
    ["Year", "Milestone"],
    [
      ["1985", "PUMA 560 — first clinical robotic use: CT-guided brain biopsy"],
      ["1986", "ROBODOC — pre-programmed robot for hip implant cavity preparation"],
      ["1992", "AESOP (Computer Motion) — voice-controlled endoscopic camera arm"],
      ["1996", "ZEUS robot — 3-arm master-slave system; first telesurgery (Lindbeger operation, 2001)"],
      ["2000", "da Vinci Surgical System — FDA approved; first robotic surgical system in widespread clinical use"],
      ["2006", "da Vinci S — improved multi-arm system"],
      ["2018", "da Vinci SP — single-port fully wristed system"],
      ["2023+", "Hugo RAS, Versius, Senhance — new competitive robotic platforms"],
    ],
    [1200, 7800]
  ),

  h2("3. COMPONENTS OF A ROBOTIC SURGICAL SYSTEM (da Vinci)"),
  diagramBox("da Vinci Robotic System — Components", [
    " ┌────────────────────────────────────────────────┐",
    " │           3 MAIN COMPONENTS                    │",
    " ├────────────────┬───────────────┬───────────────┤",
    " │ SURGEON        │ PATIENT-SIDE  │ VISION        │",
    " │ CONSOLE        │ CART (ROBOT)  │ TOWER         │",
    " │                │               │               │",
    " │ • 3D binocular │ • 3–4 robotic │ • HD 3D       │",
    " │   viewer       │   arms        │   camera      │",
    " │ • Finger-tip   │ • Endoscope   │   processor   │",
    " │   controls     │ • Wristed     │ • CO₂         │",
    " │ • Pedal        │   instruments │   insufflator │",
    " │   controls     │ (7° freedom)  │               │",
    " │                │               │               │",
    " │ Surgeon sits   │ Positioned at │               │",
    " │ at console     │ patient table │               │",
    " └────────────────┴───────────────┴───────────────┘",
  ]),

  h2("4. TYPES OF ROBOTIC SYSTEMS"),
  makeTable(
    ["Type", "Description", "Example"],
    [
      ["Teleoperated (Master-Slave)", "Surgeon at console controls robot arms; motion scaling + tremor suppression", "da Vinci, Hugo RAS, Versius"],
      ["Active systems", "Pre-programmed robot completes defined task autonomously", "ROBODOC (orthopaedics)"],
      ["Semi-active systems", "Surgeon guided with robotic constraints/boundaries", "MAKO (orthopaedics), ROSA (neurosurgery)"],
      ["Autonomous / AI-assisted", "Machine learning guides specific steps; emerging technology", "Smart Tissue Autonomous Robot (STAR)"],
    ],
    [2000, 4000, 3000]
  ),

  h2("5. ADVANTAGES OF ROBOTIC SURGERY (Bailey & Love, 28th ed.)"),

  h3("Vision"),
  bullet("10× magnified 3D high-definition stereoscopic image — true depth perception"),
  bullet("30° angulation; surgeon-controlled camera orientation; reference horizon maintained"),
  bullet("Single-port systems (da Vinci SP): Wristed camera allows triangulation through one skin incision"),

  h3("Manoeuvrability — 7 Degrees of Freedom (EndoWrist)"),
  bullet("Robotic wrist allows 7° of movement (vs. 4° for conventional laparoscopy)"),
  bullet("Tremor suppression: Computer filters surgeon hand tremor (critical for microsurgery)"),
  bullet("Motion scaling: Large external hand movements translated to precise micro-movements"),
  bullet("Particularly useful in confined spaces: pelvis, mediastinum, head & neck"),

  h3("Ergonomics"),
  bullet("Surgeon operates seated at console in ergonomic position"),
  bullet("Reduces physical strain vs. prolonged laparoscopic posture"),
  bullet("Allows longer, more complex operations with reduced surgeon fatigue"),

  h2("6. DISADVANTAGES OF ROBOTIC SURGERY"),
  bullet("Cost: Initial capital outlay ~$1.5–2 million USD; maintenance ~$150,000/year; disposable instruments ~$700–2000/procedure"),
  bullet("Loss of haptic (tactile) feedback — surgeon cannot feel tissue resistance"),
  bullet("Bulk of robotic cart — requires larger operating theatre"),
  bullet("Longer setup time vs. conventional laparoscopy (learning curve)"),
  bullet("Instrument size limitation — single-port systems still developing"),
  bullet("Limited evidence of superior outcomes over standard laparoscopy for many procedures (ROLARR trial: robotic vs. laparoscopic rectal resection — no significant difference in conversion rate)"),

  h2("7. CLINICAL APPLICATIONS"),
  makeTable(
    ["Specialty", "Procedure"],
    [
      ["Urology", "Robotic radical prostatectomy (RARP) — most common robotic procedure worldwide; also cystectomy, nephrectomy"],
      ["Colorectal surgery", "Robotic low anterior resection (TME), right hemicolectomy"],
      ["Gynaecology", "Hysterectomy, myomectomy, endometriosis, lymphadenectomy"],
      ["Upper GI surgery", "Gastrectomy, oesophagectomy, Heller myotomy, Nissen fundoplication"],
      ["Hepato-pancreato-biliary (HPB)", "Distal pancreatectomy, Whipple's procedure, hepatic resection"],
      ["Bariatric surgery", "RYGB, sleeve gastrectomy — improved ergonomics in obese patients"],
      ["Cardiac surgery", "Mitral valve repair, CABG (in development)"],
      ["Thoracic surgery", "Robotic VATS lobectomy, thymectomy"],
      ["Head & Neck / ENT", "Transoral robotic surgery (TORS) — base of tongue, tonsillar tumours"],
    ],
    [2500, 6500]
  ),

  h2("8. RECENT ADVANCES / FUTURE DIRECTIONS"),
  bullet("Single-port robotic surgery (da Vinci SP, Versius): Single incision with full wristed instruments"),
  bullet("Haptic feedback integration: Force-sensing instruments in development"),
  bullet("Augmented reality (AR) overlay: Superimpose preoperative imaging onto operative field for navigation"),
  bullet("AI-guided autonomous steps: STAR robot demonstrated autonomous intestinal anastomosis (Science Robotics, 2022)"),
  bullet("Miniaturisation: Miniature robots for natural orifice transluminal endoscopic surgery (NOTES)"),
  bullet("5G telesurgery: Low-latency networks enabling real remote operations"),
  bullet("Modular platforms: Hugo RAS (Medtronic), Versius (CMR Surgical) — more affordable alternatives to da Vinci"),
  keyPoint("ROLARR Trial (JAMA 2017): First RCT of robotic vs. laparoscopic rectal resection — no significant difference in conversion to open surgery (8.1% vs 12.2%, p=0.19). Evidence of benefit is still evolving."),
  divider(),
);

// ─── Build and save document ─────────────────────────────
const doc = new Document({
  creator: "Orris AI — Surgery Answer Book",
  title: "Surgery Answer Book",
  description: "Detailed surgical answer book based on Bailey & Love 28th Edition",
  styles: {
    default: {
      document: {
        run: { font: "Calibri", size: 20 },
      },
    },
  },
  sections: [{
    properties: {
      page: {
        margin: {
          top: convertInchesToTwip(1),
          right: convertInchesToTwip(1),
          bottom: convertInchesToTwip(1),
          left: convertInchesToTwip(1.2),
        },
      },
    },
    children: content,
  }],
});

Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync("/home/daytona/workspace/answer-book/Surgery_Answer_Book.docx", buffer);
  console.log("SUCCESS: Surgery_Answer_Book.docx written");
}).catch(err => {
  console.error("ERROR:", err.message);
  process.exit(1);
});
Running Command

cd /home/daytona/workspace/answer-book && node create_answer_book.js 2>&1

Running Command

python3 /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/workspace/answer-book/Surgery_Answer_Book.docx 2>&1 && ls -lh /home/daytona/workspace/answer-book/

Running Command

ls -lh /home/daytona/workspace/answer-book/ && python3 -c "import zipfile; z=zipfile.ZipFile('/home/daytona/workspace/answer-book/Surgery_Answer_Book.docx'); print('Valid ZIP. Files:', len(z.namelist())); print(z.namelist()[:8])"

Your Surgery Answer Book is ready:

Surgery Answer Book

Word Document · DOCX


What's inside

The document is formatted for direct exam use — dark navy headings, colour-coded tables, text-art diagrams, key point boxes, and clinical notes throughout.

Q1 — Bariatric/Metabolic Surgery (30 marks)

  • Definition + NIH indications table (BMI criteria, T2DM thresholds)
  • Mechanisms diagram (restriction vs. malabsorption vs. gut hormone changes)
  • All 5 major procedures with schemas: LSG, LRYGB, LAGB, BPD-DS, Mini Gastric Bypass
  • Comparison table (EWL%, T2DM remission, key risks)
  • Pre-op workup, post-op complications table, nutritional supplementation protocol
  • Recent trends: OAGB, SADI-S, robotic bariatrics, STAMPEDE trial, endoscopic therapies

Q2 — Carcinoma Oesophagus (30 marks)

  • Epidemiology + SCC vs. AC comparison table (geography, precursor, trend)
  • Full aetiology (ALDH2 deficiency, Barrett's sequence, Plummer-Vinson, tylosis)
  • Barrett's → AC progression diagram
  • TNM 8th Ed. staging table + spread pathways
  • Clinical features table (dysphagia → cachexia)
  • Investigations algorithm: OGD → CT → EUS → PET-CT → Laparoscopy
  • Surgery: Ivor Lewis, McKeown, Transhiatal, MIO approaches with indications
  • Reconstruction options (gastric conduit, colonic interposition, jejunal)
  • Neoadjuvant therapy: CROSS trial, FLOT regimen
  • Palliative management table (SEMS, chemo, immunotherapy, fistula management)
  • Siewert classification note, 5-year survival figures

Q3 — TPN (10 marks)

  • Indications + composition table (7 components with doses)
  • Central vs. peripheral access; CXR confirmation
  • Complications table (insertion, line, metabolic — 10 complications)
  • Monitoring protocol diagram (daily/weekly/monthly)
  • Refeeding syndrome: mechanism, risk factors, management

Q4 — Blood Transfusion (10 marks)

  • Blood products table: PRBC, FFP, platelets, cryoprecipitate, PCC, albumin
  • Single transfusion complications (HAEMOLYTIC reaction, FNHTR, TRALI, infections with risk figures)
  • Massive transfusion complications table: coagulopathy, hypoCa, hyperK, hypothermia, TACO
  • Immediate management flowchart
  • Blood substitutes (HBOCs, PFCs — current status)
  • Blood conservation strategies + CRASH-2 trial, TRICC trial

Q5 — Robotic Surgery (10 marks)

  • History timeline table (PUMA 1985 → da Vinci → Hugo/Versius 2023)
  • Component diagram: Surgeon console / Patient-side cart / Vision tower
  • Types: Teleoperated, Active, Semi-active, AI-assisted
  • Advantages: 7° freedom, tremor suppression, motion scaling, 3D HD vision, ergonomics
  • Disadvantages: Cost (figures), no haptic feedback, ROLARR trial result
  • Applications table across all specialties (TORS, RARP, TME, HPB, bariatrics)
  • Future: AR overlay, STAR autonomous robot (Science Robotics 2022), 5G telesurgery

Make pdf file of answerbook

Running Command

ls -lh /home/daytona/workspace/answer-book/

Running Command

which libreoffice soffice 2>/dev/null; python3 /home/daytona/skills/docx/scripts/office/soffice.py --version 2>&1 | head -5

Running Command

python3 /home/daytona/skills/docx/scripts/office/soffice.py --headless --convert-to pdf --outdir /home/daytona/workspace/answer-book/ /home/daytona/workspace/answer-book/Surgery_Answer_Book.docx 2>&1

Running Command

mkdir -p /home/daytona/workspace/answer-book/pdf_out && libreoffice --headless --convert-to pdf --outdir /home/daytona/workspace/answer-book/pdf_out /home/daytona/workspace/answer-book/Surgery_Answer_Book.docx 2>&1

Running Command

chmod 777 /home/daytona/workspace/answer-book/pdf_out && cp /home/daytona/workspace/answer-book/Surgery_Answer_Book.docx /tmp/Surgery_Answer_Book.docx && libreoffice --headless --convert-to pdf --outdir /tmp/ /tmp/Surgery_Answer_Book.docx 2>&1 && ls -lh /tmp/Surgery_Answer_Book.pdf

Running Command

cp /home/daytona/workspace/answer-book/Surgery_Answer_Book.docx /tmp/Surgery_Answer_Book.docx && libreoffice --headless --convert-to pdf --outdir /tmp/ /tmp/Surgery_Answer_Book.docx 2>&1 && ls -lh /tmp/Surgery_Answer_Book.pdf

Running Command

cp /tmp/Surgery_Answer_Book.pdf /home/daytona/workspace/answer-book/Surgery_Answer_Book.pdf && ls -lh /home/daytona/workspace/answer-book/

Done! Here's your PDF:

Surgery Answer Book

PDF Document · PDF

(384 KB)
The DOCX is also still available if you need it:

Surgery Answer Book

Word Document · DOCX

attachment
attachment

Do the same

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Writing File

~/answer-book/create_answer_book2.js

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

const DARK_NAVY = "1B2A4A";
const GOLD      = "B8860B";
const LIGHT_BLUE= "D6E4F0";
const WHITE     = "FFFFFF";

function qHeading(qno, title, marks) {
  return new Paragraph({
    spacing: { before: 400, after: 200 },
    shading: { type: ShadingType.SOLID, color: DARK_NAVY },
    children: [
      new TextRun({ text: `Q${qno}. `, bold: true, size: 30, color: WHITE, font: "Calibri" }),
      new TextRun({ text: title, bold: true, size: 28, color: WHITE, font: "Calibri" }),
      new TextRun({ text: `  [${marks} Marks]`, bold: true, size: 24, color: GOLD, font: "Calibri" }),
    ],
  });
}

function h2(text) {
  return new Paragraph({
    spacing: { before: 280, after: 100 },
    children: [new TextRun({ text, bold: true, size: 24, color: DARK_NAVY, font: "Calibri",
      underline: { type: UnderlineType.SINGLE, color: GOLD } })],
  });
}

function h3(text) {
  return new Paragraph({
    spacing: { before: 200, after: 80 },
    children: [new TextRun({ text, bold: true, size: 22, color: "2E4057", font: "Calibri" })],
  });
}

function para(text) {
  return new Paragraph({
    spacing: { before: 60, after: 60 },
    children: [new TextRun({ text, size: 20, font: "Calibri" })],
  });
}

function bullet(text, level = 0) {
  return new Paragraph({
    bullet: { level },
    spacing: { before: 40, after: 40 },
    children: [new TextRun({ text, size: 20, font: "Calibri" })],
  });
}

function boldBullet(label, text) {
  return new Paragraph({
    bullet: { level: 0 },
    spacing: { before: 40, after: 40 },
    children: [
      new TextRun({ text: label + ": ", bold: true, size: 20, font: "Calibri", color: DARK_NAVY }),
      new TextRun({ text, size: 20, font: "Calibri" }),
    ],
  });
}

function keyPoint(text) {
  return new Paragraph({
    spacing: { before: 80, after: 80 },
    indent: { left: convertInchesToTwip(0.3) },
    shading: { type: ShadingType.SOLID, color: "D1ECF1" },
    children: [
      new TextRun({ text: "★ KEY: ", bold: true, size: 20, color: "0C5460", font: "Calibri" }),
      new TextRun({ text, size: 20, color: "0C5460", font: "Calibri" }),
    ],
  });
}

function note(text) {
  return new Paragraph({
    spacing: { before: 80, after: 80 },
    indent: { left: convertInchesToTwip(0.3) },
    shading: { type: ShadingType.SOLID, color: "FFF3CD" },
    children: [
      new TextRun({ text: "📌 NOTE: ", bold: true, size: 20, color: "856404", font: "Calibri" }),
      new TextRun({ text, size: 20, color: "856404", font: "Calibri" }),
    ],
  });
}

function divider() {
  return new Paragraph({
    spacing: { before: 100, after: 100 },
    border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: GOLD } },
    children: [],
  });
}

function pageBreak() {
  return new Paragraph({ children: [new PageBreak()] });
}

function makeTable(headers, rows, colWidths) {
  const total = 9000;
  const defaultW = Math.floor(total / headers.length);
  const headerRow = new TableRow({
    tableHeader: true,
    children: headers.map((h, i) => new TableCell({
      width: { size: colWidths ? colWidths[i] : defaultW, type: WidthType.DXA },
      shading: { type: ShadingType.SOLID, color: DARK_NAVY },
      verticalAlign: VerticalAlign.CENTER,
      children: [new Paragraph({ alignment: AlignmentType.CENTER,
        children: [new TextRun({ text: h, bold: true, color: WHITE, size: 20, font: "Calibri" })] })],
    })),
  });
  const dataRows = rows.map((row, ri) => new TableRow({
    children: row.map((cell, ci) => new TableCell({
      width: { size: colWidths ? colWidths[ci] : defaultW, type: WidthType.DXA },
      shading: { type: ShadingType.SOLID, color: ri % 2 === 0 ? LIGHT_BLUE : WHITE },
      children: [new Paragraph({ children: [new TextRun({ text: String(cell), size: 20, font: "Calibri" })] })],
    })),
  }));
  return new Table({ width: { size: 9000, type: WidthType.DXA }, rows: [headerRow, ...dataRows] });
}

function diagramBox(title, lines) {
  const children = [
    new TextRun({ text: `◆ ${title}`, bold: true, size: 22, color: WHITE, font: "Courier New" }),
    new TextRun({ break: 1 }),
    new TextRun({ text: "─".repeat(55), size: 18, color: "AACCFF", font: "Courier New" }),
    new TextRun({ break: 1 }),
  ];
  lines.forEach(line => {
    children.push(new TextRun({ text: line, size: 18, font: "Courier New", color: "E8F4FD" }));
    children.push(new TextRun({ break: 1 }));
  });
  return new Paragraph({
    spacing: { before: 120, after: 120 },
    indent: { left: convertInchesToTwip(0.2), right: convertInchesToTwip(0.2) },
    shading: { type: ShadingType.SOLID, color: "1E3A5F" },
    children,
  });
}

// ═══════════════════════════════════════════
// DOCUMENT CONTENT
// ═══════════════════════════════════════════
const content = [];

// ─── TITLE PAGE ──────────────────────────────
content.push(
  new Paragraph({
    spacing: { before: 1800, after: 200 }, alignment: AlignmentType.CENTER,
    shading: { type: ShadingType.SOLID, color: DARK_NAVY },
    children: [new TextRun({ text: "SURGERY ANSWER BOOK — II", bold: true, size: 52, color: WHITE, font: "Calibri" })],
  }),
  new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 100, after: 100 },
    children: [new TextRun({ text: "Bailey & Love's Short Practice of Surgery (28th Ed.) + Fischer's Mastery + Campbell-Walsh Urology", size: 22, color: GOLD, font: "Calibri", italics: true })],
  }),
  divider(),
  new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 100 },
    children: [new TextRun({ text: "Q1 (30) · Q2 (30) · Q3 (30) · Q4 (30) · Q5 (10) · Q6 (10)", size: 22, bold: true, color: DARK_NAVY, font: "Calibri" })],
  }),
  pageBreak()
);

// ═══════════════════════════════════════════════════════
// Q1: BILE DUCT INJURIES AT CHOLECYSTECTOMY — 30 MARKS
// ═══════════════════════════════════════════════════════
content.push(
  qHeading(1, "Bile Duct Injuries at Cholecystectomy — Types, Classification, Prevention & Management", 30),

  h2("1. INTRODUCTION"),
  para("Bile duct injury (BDI) at cholecystectomy is one of the most serious complications of general surgery. Incidence: 0.2–0.5% for laparoscopic cholecystectomy (LC) vs. 0.1–0.2% for open cholecystectomy. The increase in LC adoption led to an initial surge in BDI rates. It carries significant morbidity, mortality, litigation implications, and impact on quality of life."),
  keyPoint("The risk of BDI is 2–3× higher with laparoscopic vs. open cholecystectomy, largely due to misidentification of the CBD as the cystic duct ('classic laparoscopic injury')."),

  h2("2. AETIOLOGY / RISK FACTORS"),
  makeTable(
    ["Factor", "Details"],
    [
      ["Classic misidentification error", "CBD mistaken for cystic duct — most common mechanism in LC (>75% of LC injuries)"],
      ["Acute cholecystitis / adhesions", "Obscures Calot's triangle anatomy; dense periportal fibrosis"],
      ["Anatomical variation", "Low insertion of cystic duct; aberrant right hepatic duct (Luschka duct injury)"],
      ["Obesity / short cystic duct", "Reduced operative field; tenting of CBD into operative field"],
      ["Excessive haemostasis", "Blind clipping near porta hepatis to control bleeding"],
      ["Mirizzi syndrome", "Impacted stone compresses common hepatic duct; inflammatory distortion"],
      ["Surgeon experience", "Learning curve; early LC experience associated with higher rates"],
    ],
    [2500, 6500]
  ),

  h2("3. CLASSIFICATION OF BILE DUCT INJURIES"),

  h3("A. Bismuth Classification (1982) — Surgical repair planning"),
  makeTable(
    ["Type", "Level of Injury", "Confluence Intact?"],
    [
      ["I", "Common hepatic duct (CHD) ≥2 cm below confluence", "Yes"],
      ["II", "CHD <2 cm below confluence", "Yes"],
      ["III", "At level of biliary confluence", "Yes (roof intact)"],
      ["IV", "Destruction of biliary confluence; right and left ducts separated", "No"],
      ["V", "Injury to aberrant right sectoral duct ± CHD", "Variable"],
    ],
    [700, 5300, 3000]
  ),

  h3("B. Strasberg Classification (1995) — More comprehensive, includes cystic duct leaks"),
  makeTable(
    ["Type", "Description"],
    [
      ["A", "Leak from cystic duct stump or Luschka ducts (minor — bile leak)"],
      ["B", "Occlusion of aberrant right sectoral duct"],
      ["C", "Transection (non-occluded) of aberrant right sectoral duct — bile leak"],
      ["D", "Lateral injury to CHD or CBD — partial laceration"],
      ["E1–E5", "Circumferential transection/stricture — corresponds to Bismuth I–V"],
    ],
    [800, 8200]
  ),

  diagramBox("Bismuth Classification — Diagram", [
    "  R.Hepatic    L.Hepatic",
    "     duct         duct",
    "       \\         /",
    "        \\       /",
    "    [Confluence]  ← Bismuth IV / V injury here",
    "          |",
    "    [CHD] ← III = at confluence roof",
    "          |",
    "          |  ← II = <2 cm below confluence",
    "          |",
    "          |  ← I  = ≥2 cm below confluence",
    "          |",
    "    [Cystic duct join]",
    "          |",
    "         CBD",
    "          |",
    "      [Ampulla of Vater]",
  ]),

  h3("C. Stewart-Way Classification (based on mechanism)"),
  bullet("Class I: CBD mistaken for cystic duct — incised, recognised, repaired primarily"),
  bullet("Class II: Lateral damage to CHD by cautery or clips"),
  bullet("Class III: CBD/CHD transected and excised — classic laparoscopic injury"),
  bullet("Class IV: Right hepatic artery + CBD both injured"),

  h2("4. CLINICAL PRESENTATION"),
  makeTable(
    ["Timing", "Presentation"],
    [
      ["Intraoperative recognition (<10%)", "Bile in field; abnormal anatomy on cholangiogram"],
      ["Immediate post-op (24–72 h)", "Bile leak: biliary peritonitis — fever, pain, guarding; or external fistula via drain"],
      ["Early post-op (days–weeks)", "Jaundice + fever (cholangitis); bile ascites; biloma"],
      ["Late presentation (months–years)", "Progressive obstructive jaundice; recurrent cholangitis; secondary biliary cirrhosis"],
    ],
    [2800, 6200]
  ),

  h2("5. INVESTIGATIONS"),
  bullet("LFTs: Raised ALP, GGT, conjugated bilirubin (obstructive pattern)"),
  bullet("USS abdomen: Biloma collection; dilated ducts"),
  bullet("MRCP (Magnetic Resonance Cholangiopancreatography): Non-invasive gold standard — defines level and extent of injury; also shows anatomy of confluence"),
  bullet("ERCP (Endoscopic Retrograde Cholangiopancreatography): Therapeutic and diagnostic — stent placement for type A/D; define leak"),
  bullet("PTC (Percutaneous Transhepatic Cholangiography): When ERCP fails or for proximal injuries; bridge to surgery"),
  bullet("CT scan: Assess biloma, vascular injury, biliary dilatation; CT angiography if vascular injury suspected"),
  bullet("Intraoperative cholangiography (IOC): Prevention — Gold standard for identifying anatomy before clipping"),

  h2("6. PREVENTION OF BDI"),

  h3("A. Critical View of Safety (CVS) — Strasberg's Technique"),
  para("The most important principle in preventing BDI during LC. Three criteria must ALL be met before any structure is divided:"),
  bullet("1. The hepatocystic triangle is cleared of fat and fibrous tissue"),
  bullet("2. The lower third of the gallbladder is separated from the liver bed"),
  bullet("3. Only TWO structures (cystic duct + cystic artery) are seen entering the gallbladder"),
  keyPoint("CVS must be achieved before any clipping or cutting. If CVS cannot be achieved safely, convert to open or perform subtotal cholecystectomy."),

  h3("B. Other Prevention Strategies"),
  bullet("Intraoperative cholangiography (IOC): Defines biliary anatomy in real-time; reduces BDI by identifying anomalies"),
  bullet("Indocyanine green (ICG) fluorescence cholangiography: Near-infrared imaging of bile ducts without contrast — promising real-time guidance"),
  bullet("Routine conversion to open when anatomy unclear — 'Safe cholecystectomy' 6-step programme"),
  bullet("Subtotal cholecystectomy: In severe inflammation/Mirizzi — leave gallbladder infundibulum rather than risk BDI"),
  bullet("Avoid over-medial dissection; always start dissection at gallbladder–cystic duct junction"),

  h2("7. MANAGEMENT OF BDI"),

  h3("A. Intraoperative Recognition — Best Scenario"),
  bullet("If recognised immediately AND injury is simple (partial CBD transection, clean divide): Primary repair over T-tube or biliary-enteric anastomosis by experienced hepatobiliary surgeon"),
  bullet("If uncertain or inexperienced: Pack, drain and refer to HPB specialist — do not attempt repair"),
  bullet("Associated right hepatic artery injury: Vascular repair or ligation (risk of ischaemic biliary stricture later)"),

  h3("B. Post-operative Management — Based on Type"),
  makeTable(
    ["Injury Type", "Treatment"],
    [
      ["Bile leak (Strasberg A)", "ERCP + biliary stent ± sphincterotomy; drain biloma percutaneously; usually heals in 4–8 weeks"],
      ["Biloma / collection", "Percutaneous image-guided drainage + ERCP stenting"],
      ["Partial transection (Type D)", "ERCP stent if minor; surgical repair if major"],
      ["Complete transection (Strasberg E1–E4)", "Surgical biliary-enteric reconstruction — Roux-en-Y hepaticojejunostomy"],
      ["High hilar injury (Bismuth III–V)", "Specialist HPB centre; Roux-en-Y hepaticojejunostomy ± bilateral duct repairs; may require liver transplantation if secondary biliary cirrhosis"],
      ["Associated vascular injury", "Vascular surgery ± interventional radiology; increased risk of biliary ischaemia"],
    ],
    [2200, 6800]
  ),

  h3("C. Roux-en-Y Hepaticojejunostomy — Gold Standard Surgical Repair"),
  diagramBox("Roux-en-Y Hepaticojejunostomy", [
    " Common hepatic duct (divided at stricture)",
    "          |",
    "    [Hepatico-jejunostomy] ← Anastomosis",
    "          |",
    "    Roux limb (~60 cm jejunum)",
    "          |",
    "    [Jejuno-jejunostomy] (Y-junction)",
    "          |",
    " Biliopancreatic limb",
    "",
    " Key principles:",
    "  • Mucosa-to-mucosa anastomosis",
    "  • Wide anastomosis (prevent stricture)",
    "  • No tension; good blood supply",
    "  • Timing: >6 weeks after injury (acute inflammation resolved)",
  ]),

  h3("D. Timing of Repair"),
  bullet("Immediate (within 72 h): Only if fresh injury, no peritonitis, experienced HPB surgeon available"),
  bullet("Delayed (6–12 weeks): After biloma drainage, nutritional optimisation, resolution of inflammation — preferred approach in most cases"),
  bullet("Long-term outcome: 80–90% good results at 5 years with proper Roux-en-Y repair at specialised centres"),

  h2("8. COMPLICATIONS OF BDI & REPAIR"),
  bullet("Anastomotic stricture (15–20%): Repeat ERCP dilation or redo surgery"),
  bullet("Recurrent cholangitis: Ascending infection; need for antibiotics ± revision"),
  bullet("Secondary biliary cirrhosis: Long-standing obstruction; may require liver transplantation"),
  bullet("Portal hypertension: From biliary cirrhosis — variceal bleeding"),
  bullet("Reduced quality of life: Up to 30% of patients report significant functional impairment"),
  note("Medico-legal implications: BDI is the most common cause of surgical litigation in cholecystectomy. Proper documentation of CVS, use of IOC, and early referral to HPB specialist are critical."),
  divider(),
  pageBreak(),

// ═══════════════════════════════════════════════════════
// Q2: SURGICAL ANATOMY BILIARY TRACT + JAUNDICE — 30 MARKS
// ═══════════════════════════════════════════════════════
  qHeading(2, "Surgical Anatomy of Biliary Tract — Investigations & Differential Diagnosis of Jaundice", 30),

  h2("1. SURGICAL ANATOMY OF THE BILIARY TRACT"),

  h3("A. Intrahepatic Biliary System"),
  para("Bile canaliculi → bile ductules → interlobular ducts → septal ducts → segmental ducts → sectoral ducts → right and left hepatic ducts."),
  bullet("Right hepatic duct: Short; formed by right anterior (segs 5+8) and right posterior (segs 6+7) sectoral ducts"),
  bullet("Left hepatic duct: Longer; runs along inferior aspect of segment 4; formed by lateral sectoral duct (segs 2+3) + segment 4 branches"),
  bullet("Hepatic biliary anatomy is highly variable — anomalous ducts present in up to 25% of people (Fischer's Mastery of Surgery)"),

  h3("B. Extrahepatic Biliary System"),
  diagramBox("Extrahepatic Biliary Anatomy", [
    "  Right hepatic duct  +  Left hepatic duct",
    "            \\               /",
    "             [Common Hepatic Duct (CHD)]",
    "                      |",
    "               Cystic duct joins",
    "                      |",
    "             [Common Bile Duct (CBD)]",
    "            Length: 7–8 cm; Diameter: <8 mm",
    "                      |",
    "          ┌───────────┴──────────────┐",
    "    Supraduodenal   Retroduodenal   Intrapancreatic",
    "    (in hepato-     (behind 1st     (in head of",
    "     duodenal lig)   part duo)       pancreas)",
    "                      |",
    "               [Ampulla of Vater]",
    "               (Sphincter of Oddi)",
    "                      |",
    "              2nd part Duodenum",
  ]),

  h3("C. Gallbladder"),
  bullet("Location: Inferior surface of liver between right and left lobes (Segments IV and V)"),
  bullet("Parts: Fundus, body, infundibulum (Hartmann's pouch — where stones lodge), neck"),
  bullet("Capacity: ~50 mL; wall: mucosa (simple columnar), smooth muscle, serosa"),
  bullet("Blood supply: Cystic artery (branch of right hepatic artery in 80%; variable anatomy)"),
  bullet("Venous drainage: Cystic veins → portal vein; small veins directly into liver"),
  bullet("Lymphatics: Cystic node (Lund's node at Calot's triangle) → hepatic nodes → coeliac nodes"),

  h3("D. Calot's Triangle (Cystohepatic Triangle)"),
  bullet("Boundaries: Superiorly — inferior surface of liver; medially — CHD; laterally — cystic duct"),
  bullet("Contents: Cystic artery, right hepatic artery, cystic lymph node (Lund's node), autonomic nerves"),
  keyPoint("Safe cholecystectomy requires clear identification of CVS within Calot's triangle. Cystic artery must be traced to the gallbladder wall before ligation."),

  h3("E. Relations of CBD"),
  bullet("Supraduodenal: In right free edge of hepatoduodenal ligament (with portal vein posteriorly, hepatic artery on left)"),
  bullet("Portal triad (from anterior to posterior): CBD (right) — Hepatic artery (left) — Portal vein (posterior)"),
  bullet("Retroduodenal: Behind 1st part duodenum (at risk in duodenal surgery)"),
  bullet("Intrapancreatic: Grooved or tunnelled in head of pancreas (at risk in pancreatic disease/surgery)"),
  bullet("Intraduodenal: Oblique passage through duodenal wall; sphincter of Oddi controls flow"),

  h2("2. PHYSIOLOGY OF BILE FORMATION"),
  bullet("Liver produces 500–1000 mL bile/day"),
  bullet("Components: Water (97%), bile salts (0.7%), bilirubin, cholesterol, phospholipids, electrolytes"),
  bullet("Bile salts: Primary (cholic, chenodeoxycholic) synthesised from cholesterol; secondary (deoxycholic, lithocholic) formed by gut bacteria"),
  bullet("Enterohepatic circulation: 94–95% of bile salts reabsorbed in terminal ileum → portal vein → liver"),
  bullet("Gallbladder concentrates bile 5–10× by absorbing water and electrolytes"),

  h2("3. JAUNDICE — CLASSIFICATION & DIFFERENTIAL DIAGNOSIS"),

  para("Jaundice (icterus) = yellow discolouration of skin, sclera, mucous membranes due to hyperbilirubinaemia (bilirubin >35 μmol/L or >2 mg/dL). Clinically apparent when bilirubin >50 μmol/L."),

  makeTable(
    ["Type", "Mechanism", "Bilirubin type", "Examples"],
    [
      ["Pre-hepatic (Haemolytic)", "Excess RBC breakdown → unconjugated hyperbilirubinaemia", "Unconjugated (indirect) ↑", "Haemolytic anaemia (sickle cell, G6PD), malaria, blood transfusion reaction"],
      ["Hepatocellular (Hepatic)", "Hepatocyte dysfunction — impaired uptake, conjugation or excretion", "Both ↑ (mixed)", "Hepatitis A/B/C, cirrhosis, alcoholic hepatitis, drugs (paracetamol, isoniazid), leptospirosis, Wilson's"],
      ["Post-hepatic (Obstructive)", "Mechanical block to bile outflow → conjugated bilirubinaemia", "Conjugated (direct) ↑", "Gallstones (CBD), cholangiocarcinoma, carcinoma pancreas, PSC, biliary stricture"],
    ],
    [1500, 2500, 1800, 3200]
  ),

  h3("Differential Diagnosis of Surgical (Obstructive) Jaundice"),
  makeTable(
    ["Cause", "Distinguishing Features"],
    [
      ["Choledocholithiasis (CBD stones)", "Intermittent jaundice; colicky pain; fever (Charcot's triad = pain + fever + jaundice); raised ALP+GGT; USS shows stones"],
      ["Carcinoma head of pancreas", "Painless progressive jaundice; weight loss; Courvoisier's sign (palpable non-tender GB); CA 19-9 raised; CT — mass in pancreatic head"],
      ["Cholangiocarcinoma", "Elderly; painless jaundice; weight loss; MRCP shows stricture; CEA+CA19-9 raised; Klatskin tumour at hilum"],
      ["Ampullary carcinoma", "Intermittent jaundice (tumour ulcerates → tumour bleeds → decompresses); malaena; ERCP diagnostic; better prognosis than pancreatic cancer"],
      ["PSC (Primary Sclerosing Cholangitis)", "Young male; UC association; ALP markedly raised; MRCP shows 'beaded' appearance of ducts; p-ANCA positive"],
      ["Mirizzi syndrome", "Gallstone in Hartmann's pouch compressing CHD; recurrent jaundice + cholecystitis; MRCP diagnostic"],
      ["Biliary stricture post-surgery", "History of cholecystectomy; progressive jaundice; MRCP shows stricture level"],
    ],
    [2500, 6500]
  ),

  h2("4. INVESTIGATIONS OF JAUNDICE"),

  h3("A. Blood Tests"),
  makeTable(
    ["Test", "Pre-hepatic", "Hepatocellular", "Obstructive"],
    [
      ["Unconjugated (indirect) bilirubin", "↑↑↑", "↑", "Normal/↑"],
      ["Conjugated (direct) bilirubin", "Normal", "↑", "↑↑↑"],
      ["ALP (Alkaline phosphatase)", "Normal", "↑", "↑↑↑"],
      ["GGT (Gamma-glutamyl transferase)", "Normal", "↑↑", "↑↑↑"],
      ["ALT/AST (Transaminases)", "Normal", "↑↑↑", "Mildly ↑"],
      ["PT/INR", "Normal", "↑ (impaired synthesis)", "↑ (corrects with Vit K)"],
      ["Albumin", "Normal", "↓ (chronic)", "Normal/↓"],
      ["Urine urobilinogen", "↑↑", "↑", "Absent"],
      ["Urine bilirubin", "Absent", "Present", "Present (dark urine)"],
    ],
    [3000, 2000, 2000, 2000]
  ),

  h3("B. Imaging"),
  bullet("Ultrasound (USS) — First-line: CBD diameter (>8 mm = dilated); intrahepatic duct dilatation; gallstones; liver parenchyma; pancreatic mass. Sensitivity 80% for CBD stones"),
  bullet("MRCP — Non-invasive gold standard for biliary imaging: Visualises entire biliary tree; best for strictures, stones, anatomy. No radiation, no contrast needed"),
  bullet("CT Abdomen+Pelvis (with contrast): Level of obstruction; hepatic/pancreatic masses; vascular involvement; lymphadenopathy; staging of malignancy"),
  bullet("ERCP — Therapeutic and diagnostic: Best for CBD stones (stone extraction + stenting); tissue sampling of ampullary lesions; biliary stenting for palliation"),
  bullet("PTC (Percutaneous Transhepatic Cholangiography): When ERCP not possible; proximal obstructions; allows internal/external drainage"),
  bullet("EUS (Endoscopic Ultrasound): Highly sensitive for small CBD stones, ampullary tumours, pancreatic head masses; allows FNA"),
  bullet("HIDA scan (Hepatobiliary iminodiacetic acid): Functional assessment of biliary excretion; cystic duct obstruction (acute cholecystitis)"),

  h3("C. Histology / Cytology"),
  bullet("Liver biopsy: Hepatocellular vs. cholestatic jaundice; cirrhosis staging; autoimmune hepatitis"),
  bullet("Brushings/biopsies at ERCP: For cholangiocarcinoma"),
  bullet("EUS-FNA: Pancreatic head mass"),

  h2("5. PRE-OPERATIVE MANAGEMENT OF OBSTRUCTIVE JAUNDICE"),
  bullet("Correct coagulopathy: Vitamin K 10 mg IM daily × 3 days (corrects PT in obstructive jaundice)"),
  bullet("Renal protection: IV fluids; mannitol infusion intraoperatively; urinary catheter — target UO >40 mL/h (hepatorenal syndrome prevention — Pye's Surgical Handicraft)"),
  bullet("Nutritional optimisation: High carbohydrate diet; parenteral nutrition if severely malnourished"),
  bullet("Prophylactic antibiotics: Bile infected in >95% of obstructed cases (Pye's)"),
  bullet("Pre-operative biliary drainage: If cholangitis or very high bilirubin before major surgery — ERCP stenting or PTC"),
  note("Courvoisier's Law: In a patient with obstructive jaundice, if the gallbladder is palpable it is unlikely to be due to gallstones (because chronic stone disease causes a thick, non-distensible GB). More likely — pancreatic/ampullary/cholangiocarcinoma."),
  divider(),
  pageBreak(),

// ═══════════════════════════════════════════════════════
// Q3: RENAL / URETERIC CALCULI — 30 MARKS
// ═══════════════════════════════════════════════════════
  qHeading(3, "Renal / Ureteric Calculi — Modalities of Treatment & Latest Management", 30),

  h2("1. INTRODUCTION & EPIDEMIOLOGY"),
  para("Urolithiasis is one of the most common urological conditions, affecting 10–15% of the population in Western countries. Peak incidence: 3rd–5th decade; M:F = 3:1. Recurrence rate: ~50% within 5–10 years without preventive treatment."),

  h2("2. TYPES & COMPOSITION OF STONES"),
  makeTable(
    ["Stone Type", "Frequency", "Characteristics", "Association"],
    [
      ["Calcium oxalate", "70–80%", "Hard, brown-black, spiky; Radio-opaque", "Hypercalciuria, hyperoxaluria, hypocitraturia"],
      ["Calcium phosphate", "~10%", "Staghorn potential; Radio-opaque", "Hyperparathyroidism, RTA type I"],
      ["Struvite (Triple phosphate — MgNH4PO4)", "~5–10%", "Staghorn calculi; Radiopaque; Soft, chalky", "Urease-producing organisms (Proteus, Klebsiella)"],
      ["Uric acid", "~5%", "Smooth, yellow-brown; Radiolucent", "Gout, ileostomy, myeloproliferative disorders"],
      ["Cystine", "~1–2%", "Yellow, crystalline; Faintly radiopaque", "Cystinuria (autosomal recessive)"],
    ],
    [1700, 1100, 2200, 4000]
  ),

  h2("3. PATHOGENESIS"),
  diagramBox("Stone Formation Pathogenesis", [
    " SUPERSATURATION of urine",
    "          |",
    "          ▼",
    " NUCLEATION (crystal seed formation)",
    "          |",
    "          ▼",
    " CRYSTAL GROWTH + AGGREGATION",
    "          |",
    "          ▼",
    " STONE FORMATION",
    "",
    " Promoters: Hypercalciuria, Hyperoxaluria, Hyperuricosuria, ↓ Urine volume",
    " Inhibitors: Citrate, Magnesium, Glycosaminoglycans, Tamm-Horsfall protein",
    "",
    " Randall's plaques (calcium phosphate) act as nidus at",
    " renal papilla for calcium oxalate stone formation",
  ]),

  h2("4. CLINICAL FEATURES"),
  makeTable(
    ["Feature", "Details"],
    [
      ["Renal colic", "Severe, colicky flank pain radiating to groin/ipsilateral testis/labia (ureteric colic); 'patient cannot keep still' — distinguishes from peritonitis"],
      ["Haematuria", "Micro- or macroscopic in 90%; absent in pure uric acid stones"],
      ["Nausea/vomiting", "Reflex; associated with severe pain"],
      ["Fever/rigors", "Infected stone / obstructed infected kidney = EMERGENCY (urosepsis)"],
      ["Renal calculi (asymptomatic)", "Discovered incidentally on imaging; dull loin ache"],
      ["Staghorn calculus", "May present with recurrent UTIs, pyelonephritis; rarely obstructive"],
    ],
    [2200, 6800]
  ),

  h2("5. INVESTIGATIONS"),
  bullet("Urinalysis + MSU culture: Haematuria; pyuria; pH >7.5 (struvite); crystals on microscopy"),
  bullet("FBC, U&E, Creatinine: Renal function assessment"),
  bullet("Serum calcium, uric acid, PTH: Metabolic workup for recurrent stones"),
  bullet("Non-contrast CT KUB (NCCT) — Gold standard: Sensitivity 97%, specificity 96%; detects all stone types; measures size, density (HU), and site; evaluates hydronephrosis"),
  bullet("USS kidneys: First-line in pregnancy; detects hydronephrosis; limited for ureteric stones"),
  bullet("X-ray KUB (plain film): Detects radio-opaque stones (70%); quick but misses radiolucent (uric acid) stones; useful for follow-up"),
  bullet("IVU (Intravenous Urogram): Largely replaced by NCCT; shows level of obstruction as filling defect"),

  h2("6. MANAGEMENT — PRINCIPLES"),
  h3("A. Acute Management of Ureteric Colic"),
  bullet("Analgesia: NSAIDs (diclofenac 75 mg IM/IV) — first choice (superior to opioids for ureteric colic)"),
  bullet("Anti-emetics: Metoclopramide / ondansetron"),
  bullet("Alpha-blocker (tamsulosin 0.4 mg od): Medical expulsive therapy — relaxes ureteric smooth muscle → facilitates spontaneous stone passage"),
  bullet("IV fluids: Maintain hydration; avoid fluid overload"),
  bullet("Antibiotics: If infected obstruction suspected — emergency decompression (ureteric stent or nephrostomy) + broad-spectrum antibiotics"),

  h3("B. Spontaneous Passage Rates"),
  bullet("Stones <4 mm: 80% pass spontaneously within 4 weeks"),
  bullet("Stones 4–6 mm: ~60% pass"),
  bullet("Stones >6 mm: <20% pass; intervention usually required"),

  h2("7. TREATMENT MODALITIES"),

  h3("A. Extracorporeal Shock Wave Lithotripsy (ESWL)"),
  bullet("Non-invasive; outpatient procedure"),
  bullet("Mechanism: Focused shock waves generated (electrohydraulic, electromagnetic, piezoelectric) fragmented stones pass in urine"),
  bullet("Best for: Renal stones <2 cm; upper ureteric stones <1 cm; soft stone density (<900 HU on NCCT)"),
  bullet("Contraindications: Pregnancy; coagulopathy; aortic aneurysm; pacemaker (relative); obstruction distal to stone; infection (must treat before ESWL)"),
  bullet("Complications: Perirenal haematoma; steinstrasse (stone street — stone fragments obstructing ureter); urosepsis; incomplete fragmentation"),
  bullet("Stone-free rate: ~75–80% for stones <1 cm; <60% for stones 1–2 cm"),

  h3("B. Ureteroscopy (URS) + Laser Lithotripsy"),
  bullet("Semi-rigid ureteroscope (distal/mid ureter) or Flexible ureteroscope (proximal ureter + renal pelvis)"),
  bullet("Holmium:YAG laser — gold standard energy source; 'dusting' technique (fine powder) or 'popcorn' effect"),
  bullet("Stone-free rate: 90–95% for ureteric stones <1 cm; 85–90% for renal stones <2 cm"),
  bullet("Ureteric stent (JJ stent) placed post-procedure for 1–2 weeks"),
  bullet("Advantages: High stone-free rate; suitable for all stone compositions; effective for lower pole renal stones"),
  bullet("Complications: Ureteric perforation/avulsion; stricture; fever; haematuria"),

  h3("C. Percutaneous Nephrolithotomy (PCNL)"),
  bullet("Access: Percutaneous tract into renal collecting system (usually under USS/fluoroscopic guidance); 24–30 Fr sheath"),
  bullet("Stone fragmentation: Holmium laser, ultrasonic lithotriptor, or ballistic pneumatic lithotriptor"),
  bullet("Indications: Stones >2 cm; staghorn calculi; lower pole renal stones (ESWL less effective due to fragment drainage); hard stones; failed ESWL/URS"),
  bullet("Mini-PCNL (14–18 Fr): Reduced blood loss; shorter hospital stay"),
  bullet("Ultra-mini PCNL / Micro-PCNL: Even smaller tracts; suitable for paediatric patients"),
  bullet("Stone-free rate: >95% for stones >2 cm in single session"),
  bullet("Complications: Haemorrhage (most serious — angioembolisation); sepsis; collecting system injury; pneumothorax (upper pole access); pleural effusion"),

  h3("D. Open Surgery"),
  bullet("Rarely performed (<1% of stone cases in developed countries)"),
  bullet("Indications: Failed endoscopic approaches; anatomo-surgical complexity; horseshoe kidney; PUJ obstruction with coexistent stone; developing countries (cost)"),
  bullet("Procedures: Pyelolithotomy, nephrolithotomy, ureterolithotomy, anatrophic nephrolithotomy (for staghorn)"),

  h3("E. Laparoscopic / Robotic Ureterolithotomy"),
  bullet("For large proximal ureteric stones where URS has failed or anatomical constraints"),
  bullet("Retroperitoneoscopic or transperitoneal approach"),

  makeTable(
    ["Modality", "Best For", "Stone-Free Rate", "Key Risk"],
    [
      ["ESWL", "Renal ≤2 cm; Upper ureter ≤1 cm; soft stones", "75–85%", "Steinstrasse; perirenal haematoma"],
      ["URS + Holmium laser", "Ureteric stones; Renal ≤2 cm", "90–95%", "Ureteric perforation; stricture"],
      ["PCNL", "Renal ≥2 cm; Staghorn; Lower pole; Hard stones", ">95%", "Haemorrhage; Sepsis"],
      ["Open / Laparoscopic", "Complex anatomy; failed endoscopy", "Variable", "Morbidity of open surgery"],
    ],
    [1500, 3200, 1700, 2600]
  ),

  h2("8. SPECIAL SITUATIONS"),
  h3("Staghorn Calculi"),
  bullet("Fill renal pelvis + ≥2 calices; usually struvite (infective); occasionally calcium oxalate/phosphate"),
  bullet("Treatment: PCNL (1st line) ± ESWL adjunct; open surgery for very complex cases"),
  bullet("Untreated staghorn → renal failure, sepsis, loss of kidney"),

  h3("Ureteric Colic in Pregnancy"),
  bullet("USS first-line; MRI if unclear; avoid CT radiation if possible"),
  bullet("Conservative management preferred (most stones pass spontaneously in pregnancy)"),
  bullet("URS safe in all trimesters; ESWL contraindicated in pregnancy"),

  h3("Infected Obstructed Kidney (Urosepsis)"),
  bullet("Emergency urological condition — immediately life-threatening"),
  bullet("Management: Emergency decompression (ureteric stent or percutaneous nephrostomy) + IV antibiotics (broad-spectrum) + ICU if septic shock"),

  h2("9. METABOLIC EVALUATION & PREVENTION OF RECURRENCE"),
  bullet("24-hour urine collection: Volume, calcium, oxalate, urate, citrate, creatinine, sodium"),
  bullet("Fluid intake: >2.5 L/day urine output — most important preventive measure"),
  bullet("Dietary advice: ↓ sodium, ↓ animal protein; normal calcium intake (not restriction)"),
  boldBullet("Calcium oxalate stones", "Potassium citrate; thiazide diuretics (↓ urinary calcium); low-oxalate diet"),
  boldBullet("Uric acid stones", "Allopurinol; urine alkalinisation (potassium citrate — target pH 6.5–7.0)"),
  boldBullet("Struvite stones", "Complete stone removal; long-term antibiotics; acetohydroxamic acid (urease inhibitor)"),
  boldBullet("Cystine stones", "High fluid intake; D-penicillamine or tiopronin; urine alkalinisation"),
  note("Latest development: Holmium laser fibre technology improvements (single-use flexible URS — Lithovue, LithoVue) and thulium fibre laser (TFL) offer higher ablation efficiency with less thermal spread — emerging as the new gold standard for laser lithotripsy."),
  divider(),
  pageBreak(),

// ═══════════════════════════════════════════════════════
// Q4: CARCINOMA PROSTATE — 30 MARKS
// ═══════════════════════════════════════════════════════
  qHeading(4, "Carcinoma Prostate — Surgical Anatomy, Staging, Clinical Features, Investigations & Management", 30),

  h2("1. SURGICAL ANATOMY OF THE PROSTATE"),

  h3("A. Location & Dimensions"),
  bullet("Located in true pelvis; behind pubic symphysis; anterior to rectum; below bladder neck; above urogenital diaphragm"),
  bullet("Normal dimensions: 3 cm wide × 4 cm long × 2 cm thick; weight ~20 g"),

  h3("B. Zones (McNeal's Zonal Anatomy)"),
  makeTable(
    ["Zone", "% of Gland", "Significance"],
    [
      ["Peripheral zone (PZ)", "70%", "Most common site of carcinoma (70–80%); palpable on DRE; biopsy target"],
      ["Transitional zone (TZ)", "5–10%", "Site of BPH; T1a/T1b tumours found after TURP; 20% of PCa"],
      ["Central zone (CZ)", "25%", "Surrounds ejaculatory ducts; rarely site of cancer; resistant to carcinoma"],
      ["Anterior fibromuscular stroma", "No glands", "Pure smooth muscle + fibrous tissue; no cancer"],
    ],
    [2200, 1500, 5300]
  ),
  keyPoint("Most prostate cancers originate in the PERIPHERAL ZONE — hence routine prostatectomy for BPH confers NO protection from subsequent carcinoma (Bailey & Love)."),

  h3("C. Relations of the Prostate"),
  bullet("Anterior: Puboprostatic ligaments; retropubic space (Retzius)"),
  bullet("Posterior: Rectum (separated by Denonvilliers' fascia) — DRE feels posterior surface"),
  bullet("Superior: Bladder neck; seminal vesicles enter posterosuperiorly"),
  bullet("Inferior: External urethral sphincter (urogenital diaphragm) — at risk in radical prostatectomy"),
  bullet("Lateral: Levator ani; prostatic venous plexus (Santorini's plexus) — haemorrhage risk"),

  h3("D. Neurovascular Bundles (Walsh's nerve-sparing anatomy)"),
  bullet("Posterolateral to prostate; contain cavernous nerves (branches of pelvic splanchnic + hypogastric nerves)"),
  bullet("Responsible for erectile function — preservation is key aim in nerve-sparing radical prostatectomy"),

  h3("E. Blood Supply"),
  bullet("Arterial: Inferior vesical artery (from internal iliac) → prostatic branches"),
  bullet("Venous: Prostatic venous plexus (Santorini's) → internal iliac veins"),
  bullet("Lymphatic: Internal iliac → external iliac → obturator nodes → para-aortic nodes"),

  h2("2. EPIDEMIOLOGY & AETIOLOGY"),
  para("Most common malignant tumour in men over 65 years (Bailey & Love, 28th ed). UK: >48,000 diagnosed, >11,800 deaths/year. USA: 190,000 diagnosed, 33,000 deaths/year. Highest in African-Caribbean men; lowest in East Asian populations."),
  bullet("Genetic factors: 10–15% have positive family history; BRCA2, BRCA1 mutations increase risk"),
  bullet("Race: African-Caribbean men at higher risk; Japanese/Chinese men at low risk (increases with Westernised diet)"),
  bullet("Diet: High saturated fat associated with increased risk; lycopene (tomatoes) may be protective"),
  bullet("Hormonal: Androgen-dependent tumour; castration reduces tumour growth"),

  h2("3. PATHOLOGY"),
  bullet("Histological type: Adenocarcinoma (>95%)"),
  bullet("Other types (rare): Small cell carcinoma, TCC, squamous cell carcinoma"),
  bullet("Microscopic latent cancer: Found at autopsy in 25% of men 50–65 years; 70% of men >80 years (Bailey & Love)"),
  bullet("Gleason Grading System: Based on glandular architecture; primary + secondary pattern graded 1–5"),
  makeTable(
    ["Gleason Score (Grade Group)", "Pattern", "Clinical Behaviour"],
    [
      ["≤6 (Grade Group 1)", "Well-differentiated; regular glands", "Low risk; often indolent; may not progress"],
      ["3+4=7 (Grade Group 2)", "Predominantly well-differentiated + some poorly", "Intermediate risk"],
      ["4+3=7 (Grade Group 3)", "Predominantly poorly differentiated", "Intermediate-high risk"],
      ["8 (Grade Group 4)", "Poorly differentiated", "High risk"],
      ["9–10 (Grade Group 5)", "Anaplastic; no gland formation", "Very high risk; aggressive"],
    ],
    [2800, 3200, 3000]
  ),

  h3("Spread"),
  bullet("Local: Seminal vesicles (common), bladder, rectum (Denonvilliers' fascia protects)"),
  bullet("Lymphatic: Obturator → internal/external iliac → para-aortic lymph nodes"),
  bullet("Haematogenous: Bone metastases (most common) — OSTEOBLASTIC (sclerotic) lesions; especially lumbar spine, pelvis, femur, ribs"),
  keyPoint("Prostate cancer bone metastases are OSTEOBLASTIC (unlike most other cancers which cause osteolytic lesions). Raised ALP and positive bone scan are hallmarks."),

  h2("4. TNM STAGING (AJCC 8th Edition)"),
  makeTable(
    ["Stage", "Description"],
    [
      ["T1a", "Incidental: ≤5% of TURP chips with carcinoma"],
      ["T1b", "Incidental: >5% of TURP chips with carcinoma"],
      ["T1c", "Tumour identified by needle biopsy (e.g. elevated PSA); not palpable"],
      ["T2a", "Tumour in ≤½ of one lobe"],
      ["T2b", "Tumour in >½ of one lobe, but not both lobes"],
      ["T2c", "Tumour involves both lobes"],
      ["T3a", "Extracapsular extension"],
      ["T3b", "Seminal vesicle invasion"],
      ["T4", "Invasion of bladder, rectum, external sphincter, levator ani or pelvic wall"],
      ["N1", "Regional lymph node metastasis"],
      ["M1a/b/c", "Non-regional nodes / Bone / Other distant sites"],
    ],
    [1200, 7800]
  ),

  h3("D'Amico Risk Classification"),
  makeTable(
    ["Risk Group", "PSA", "Gleason Score", "Clinical Stage"],
    [
      ["Low", "<10 ng/mL", "≤6", "T1–T2a"],
      ["Intermediate", "10–20 ng/mL", "7", "T2b"],
      ["High", ">20 ng/mL", "8–10", "T3–T4"],
    ],
    [1500, 2500, 2000, 3000]
  ),

  h2("5. CLINICAL FEATURES"),
  makeTable(
    ["Presentation", "Details"],
    [
      ["Asymptomatic (most common)", "Detected on routine PSA screening or incidental on TURP"],
      ["LUTS (lower urinary tract symptoms)", "Hesitancy, poor stream, frequency, nocturia, terminal dribbling — from urethral compression by tumour"],
      ["Haematuria / haematospermia", "Less common; suggests locally advanced disease"],
      ["Bone pain", "Back pain (lumbar spine), hip pain — from osteoblastic bone metastases"],
      ["Hard, irregular nodule on DRE", "T2 lesion in peripheral zone; loss of normal sulcus"],
      ["Neurological symptoms", "Cord compression (emergency); loin pain from ureteric obstruction"],
      ["Constitutional", "Weight loss, fatigue, anaemia — advanced disease"],
    ],
    [2500, 6500]
  ),

  h2("6. INVESTIGATIONS"),

  h3("A. PSA (Prostate Specific Antigen)"),
  bullet("Normal: <4 ng/mL (age-specific ranges used)"),
  bullet("PSA density: PSA/prostate volume — >0.15 ng/mL/cc suggests malignancy"),
  bullet("PSA velocity: Rise >0.75 ng/mL/year suggests malignancy"),
  bullet("Free:Total PSA ratio: <10% free PSA suggests malignancy; >25% favours BPH"),
  bullet("PSA not cancer-specific: Also raised in BPH, prostatitis, urinary retention, recent catheterisation, DRE"),

  h3("B. Digital Rectal Examination (DRE)"),
  bullet("Hard, irregular, nodular prostate; loss of normal median sulcus; fixed mass in advanced disease"),

  h3("C. Prostate Biopsy"),
  bullet("Trans-rectal ultrasound-guided (TRUS) biopsy: 12-core systematic biopsy; now being replaced by MRI-targeted"),
  bullet("MRI-targeted fusion biopsy: MRI images fused with TRUS to target suspicious lesions — higher cancer detection rate for clinically significant cancer"),
  bullet("Trans-perineal biopsy: Reduces infection risk (avoids rectal contamination); increasingly preferred"),

  h3("D. Multi-parametric MRI (mpMRI) — PI-RADS Scoring"),
  bullet("Combines T2W, DWI, DCE sequences; PI-RADS score 1–5"),
  bullet("PI-RADS ≥3: Biopsy recommended; guides targeted biopsy"),
  bullet("PROMIS trial: mpMRI before biopsy reduces unnecessary biopsies and detects more clinically significant cancers"),

  h3("E. Staging Investigations"),
  bullet("Bone scan (99mTc): Detect osteoblastic metastases (indicated if PSA >20, T3/T4, high Gleason, bone pain)"),
  bullet("PSMA-PET CT (Prostate-Specific Membrane Antigen PET): Most sensitive staging — detects nodal and bone metastases; replacing bone scan + CT"),
  bullet("CT abdomen/pelvis: Lymph node staging"),
  bullet("MRI pelvis: Local staging (extracapsular extension, seminal vesicle invasion)"),

  h2("7. MANAGEMENT"),

  h3("A. Active Surveillance"),
  bullet("For low-risk (T1–T2a, Gleason ≤6, PSA <10, PSA density <0.15) and selected intermediate-risk"),
  bullet("Protocol: PSA every 3–6 months; annual DRE; repeat biopsy at 1 year then 3–5 yearly; mpMRI"),
  bullet("ProtecT trial: AS = radical prostatectomy = radiotherapy in terms of prostate-cancer-specific survival at 10 years for low-risk disease"),

  h3("B. Radical Prostatectomy"),
  bullet("Open (retropubic), laparoscopic or robot-assisted radical prostatectomy (RARP)"),
  bullet("RARP now standard in most Western centres — better visualisation of neurovascular bundles; improved continence and erectile function outcomes"),
  bullet("Nerve-sparing technique: Preserves cavernous nerves posterolateral to prostate — important for erectile function"),
  bullet("Complications: Urinary incontinence (5–10% long-term), erectile dysfunction (30–80%), anastomotic stricture, rectal injury"),
  bullet("Indicated for: Localised disease (T1–T2) in fit patients with ≥10-year life expectancy"),

  h3("C. Radiotherapy"),
  bullet("External beam radiotherapy (EBRT): Image-guided intensity-modulated (IMRT/IGRT) — minimises rectal/bladder dose"),
  bullet("Brachytherapy: Low-dose-rate (LDR) permanent seeds or high-dose-rate (HDR) temporary needles — for low/intermediate risk"),
  bullet("Combined with ADT for high-risk/locally advanced disease"),
  bullet("STAMPEDE, ENZAMET, ARCHES trials: Addition of enzalutamide/abiraterone to ADT improves survival in high-risk/metastatic disease"),

  h3("D. Androgen Deprivation Therapy (ADT)"),
  bullet("Mechanism: GnRH agonists (leuprolide, goserelin) → initial testosterone surge then castrate levels; GnRH antagonists (degarelix) — no surge"),
  bullet("Anti-androgens: Bicalutamide (first-generation); Enzalutamide, Apalutamide, Darolutamide (second-generation ARIs)"),
  bullet("Surgical castration (bilateral orchidectomy): Immediate; permanent; no compliance issues"),
  bullet("Indications: Metastatic disease; locally advanced (T3/T4) with radiotherapy; biochemical recurrence; neoadjuvant/adjuvant"),
  bullet("Side effects: Hot flushes, gynaecomastia, osteoporosis, metabolic syndrome, cardiovascular risk, sexual dysfunction"),

  h3("E. Treatment Summary (Bailey & Love, 28th ed.)"),
  makeTable(
    ["Disease Stage", "Treatment Options"],
    [
      ["Low-risk localised (T1–T2a, GS ≤6, PSA <10)", "Active surveillance; Radical prostatectomy; Brachytherapy; EBRT"],
      ["Intermediate-risk (T2b, GS 7, PSA 10–20)", "Radical prostatectomy + pelvic LN dissection; EBRT + short-course ADT (6 months)"],
      ["High-risk localised (T3, GS 8–10, PSA >20)", "EBRT + long-course ADT (2–3 years); Radical prostatectomy + adjuvant therapy"],
      ["Locally advanced (T4)", "ADT + EBRT; palliative TURP if obstruction"],
      ["Metastatic (M1)", "ADT ± docetaxel (STAMPEDE) ± abiraterone; Enzalutamide; 223Radium (bone mets); Opioids for pain"],
      ["Castrate-resistant PCa (CRPC)", "Enzalutamide; Abiraterone; Cabazitaxel; PSMA-targeted radioligand therapy (177Lu-PSMA-617 — VISION trial)"],
    ],
    [3000, 6000]
  ),
  note("VISION Trial (NEJM 2021): 177Lu-PSMA-617 radioligand therapy significantly improved overall survival (15.3 vs 11.3 months) in metastatic CRPC patients who had progressed on enzalutamide/abiraterone and taxane — FDA approved 2022."),
  divider(),
  pageBreak(),

// ═══════════════════════════════════════════════════════
// Q5: EXTRADURAL HAEMATOMA — 10 MARKS
// ═══════════════════════════════════════════════════════
  qHeading(5, "Extradural Haematoma — Clinical Features, Investigations & Management", 10),

  h2("1. DEFINITION"),
  para("Extradural (epidural) haematoma (EDH) is a collection of blood between the inner table of the skull and the outer layer of the dura mater. It is a neurosurgical emergency (Bailey & Love, 28th ed.)."),

  h2("2. AETIOLOGY & PATHOPHYSIOLOGY"),
  bullet("Most common cause: Fracture of the thin squamous temporal bone → rupture of middle meningeal artery (a branch of maxillary artery)"),
  bullet("The middle meningeal artery runs in a groove on the inner aspect of the temporal bone — fracture tears it → arterial haemorrhage → rapid haematoma formation"),
  bullet("Other sources: Middle meningeal vein, diploic veins, dural venous sinus (posterior fossa EDH — transverse/sigmoid sinus injury)"),
  bullet("The haematoma is constrained by dural attachments at cranial sutures — lentiform (biconvex) shape"),
  bullet("Venous EDH: Slower accumulation; less emergency"),

  diagramBox("Pathophysiology of EDH — Monroe-Kellie Doctrine", [
    " HEAD INJURY → Skull fracture → MMA rupture",
    "          |",
    "          ▼",
    " Arterial haemorrhage → Extradural haematoma",
    "          |",
    "          ▼",
    " ↑ Intracranial pressure (ICP)",
    "          |",
    "    ┌─────┴──────────────────────┐",
    "    ▼                           ▼",
    " EARLY (compensated)       LATE (decompensated)",
    " Cerebral CSF displaced    ICP exceeds compensation",
    " No deficit (LUCID         Rapid deterioration:",
    " INTERVAL)                  • ↓ Consciousness (GCS ↓)",
    "                            • Contralateral hemiparesis",
    "                            • Ipsilateral pupil dilation",
    "                              (CN III compression)",
    "                            • Cushing's triad:",
    "                              ↑BP + ↓HR + Irregular RR",
  ]),

  h2("3. CLINICAL FEATURES (Bailey & Love, 28th ed.)"),
  makeTable(
    ["Feature", "Details"],
    [
      ["Mechanism", "Direct blow to temporal region (assault, fall, road traffic accident)"],
      ["Lucid interval", "CLASSIC feature — occurs in ~1/3 of cases. Initial LOC → recovery → progressive deterioration as haematoma expands"],
      ["Headache", "Progressive, worsening; early symptom during lucid interval"],
      ["Nausea/vomiting", "Raised ICP symptoms"],
      ["Decreasing GCS", "Rapid deterioration — 'talk and die' pattern"],
      ["Ipsilateral pupil dilation", "CN III (oculomotor) compression by uncal herniation → fixed dilated ipsilateral pupil (Hutchinson pupil)"],
      ["Contralateral hemiparesis", "Compression of contralateral corticospinal tract in cerebral peduncle"],
      ["Cushing's triad", "Hypertension + Bradycardia + Irregular respirations — LATE sign of severe ICP rise"],
    ],
    [2200, 6800]
  ),
  keyPoint("'Talk and die' syndrome: Patient initially speaks (lucid interval) then rapidly deteriorates — classic EDH presentation. Present in only 1/3 but critically important to recognise."),

  h2("4. INVESTIGATIONS"),
  bullet("CT head (non-contrast) — Investigation of choice: BICONVEX (lenticular/lens-shaped) hyperdense (white) collection between skull and brain; NOT crossing suture lines; midline shift; brain compression"),
  bullet("Areas of mixed density = active bleeding (hypodense areas within hyperacute haematoma)"),
  bullet("Skull fracture usually visible on bone windows — temporal bone most common site"),
  bullet("MRI head: Not used acutely (too slow); useful for posterior fossa or subacute presentations"),
  bullet("X-ray skull: May show fracture but CT is always preferred; cannot show haematoma"),
  bullet("GCS monitoring: Rapid serial neurological assessment is critical"),

  h2("5. MANAGEMENT"),

  h3("A. Immediate Resuscitation"),
  bullet("Airway: Intubation if GCS ≤8 ('can't protect airway')"),
  bullet("Breathing: Maintain PaO2 >13 kPa; PaCO2 4.5–5.0 kPa (avoid hyperventilation except as temporary bridge)"),
  bullet("Circulation: Target MAP 80 mmHg; avoid hypotension"),
  bullet("Head of bed 30° elevation; avoid neck flexion"),
  bullet("Mannitol 0.25–0.5 g/kg IV: Osmotic therapy for acute ICP rise as bridge to surgery"),
  bullet("Avoid corticosteroids (no benefit; may worsen outcome in TBI — CRASH trial)"),

  h3("B. Surgical Management — Craniotomy"),
  bullet("DEFINITIVE treatment: Emergency craniotomy + evacuation of haematoma + haemostasis (coagulation/ligation of middle meningeal artery)"),
  makeTable(
    ["Indication for Surgery", "Criteria"],
    [
      ["Absolute", "EDH >30 mL volume; thickness >15 mm; midline shift >5 mm; clinical deterioration"],
      ["Relative", "EDH >10 mL with clinical symptoms in accessible location"],
      ["Conservative (very small)", "EDH <10 mL; thickness <15 mm; no midline shift; GCS >14; no pupil abnormality; close monitoring with serial CT"],
    ],
    [2000, 7000]
  ),

  h3("C. Burr Hole (Emergency Temporal Decompression)"),
  bullet("Performed at bedside or in theatre when patient critically deteriorating and CT not available"),
  bullet("Ipsilateral temporal burr hole (below temporal hairline, above zygomatic arch) to rapidly decompress haematoma"),
  bullet("Now rarely needed with modern CT availability; only in extremis"),

  h2("6. PROGNOSIS"),
  para("Bailey & Love: Prognosis for PROMPTLY EVACUATED extradural haematoma, without associated primary brain injury, is EXCELLENT. If treated before pupil dilation: mortality <5%. Delayed treatment: Mortality rises to 20–30%. Outcome depends heavily on pre-operative GCS and speed of intervention."),
  note("Posterior fossa EDH: More dangerous — small volume causes rapid brainstem compression; treat aggressively."),
  divider(),
  pageBreak(),

// ═══════════════════════════════════════════════════════
// Q6: CARCINOMA URINARY BLADDER — 10 MARKS
// ═══════════════════════════════════════════════════════
  qHeading(6, "Carcinoma Urinary Bladder — Types, Etiopathology, Clinical Features, Investigations & Management", 10),

  h2("1. EPIDEMIOLOGY"),
  para("4th most common cancer in men; 9th in women. M:F = 3:1. Peak incidence 60–70 years. Most common urological cancer (though prostate cancer is more prevalent overall). 90% are urothelial (transitional cell) carcinomas. 75–80% are non-muscle-invasive (superficial) at presentation."),

  h2("2. TYPES OF BLADDER CARCINOMA"),
  makeTable(
    ["Type", "Frequency", "Notes"],
    [
      ["Urothelial carcinoma (TCC)", "90–95%", "Arises from transitional epithelium; can be papillary, sessile, flat (CIS)"],
      ["Squamous cell carcinoma", "3–7%", "Associated with chronic irritation: schistosomiasis, stones, chronic catheterisation"],
      ["Adenocarcinoma", "< 2%", "Urachal remnant; bladder exstrophy; rarely primary"],
      ["Small cell carcinoma", "Rare", "Highly aggressive; neuroendocrine; poor prognosis"],
    ],
    [2300, 1200, 5500]
  ),

  h2("3. AETIOLOGY / ETIOPATHOLOGY"),
  makeTable(
    ["Risk Factor", "Mechanism / Details"],
    [
      ["Smoking (STRONGEST)", "2–4× increased risk; aromatic amines in tobacco → excreted in urine → prolonged urothelial contact → DNA damage"],
      ["Occupational exposure", "Aniline dyes, aromatic amines (2-naphthylamine, benzidine): Chemical, rubber, textile, printing industries — latency 20–50 years"],
      ["Schistosomiasis (S. haematobium)", "Chronic bladder infection → squamous metaplasia → SCC; endemic in Egypt/sub-Saharan Africa"],
      ["Cyclophosphamide", "Acrolein metabolite → urothelial damage; haemorrhagic cystitis → TCC"],
      ["Pelvic irradiation", "Post-radiotherapy for cervical/prostate cancer; increased TCC risk"],
      ["Chronic urinary infection / stones", "Chronic irritation → SCC risk"],
      ["Phenacetin (analgesic abuse)", "Upper tract urothelial tumours particularly"],
      ["Genetic", "TP53, RB1, FGFR3 mutations — key molecular drivers"],
    ],
    [2500, 6500]
  ),

  h3("Molecular Pathogenesis"),
  diagramBox("Bladder Cancer Molecular Pathways", [
    " LOW-GRADE PATHWAY          HIGH-GRADE PATHWAY",
    " (Non-muscle invasive)      (Muscle-invasive / CIS)",
    "                            ",
    " FGFR3 mutation             TP53 + RB1 mutations",
    " RAS mutation               Loss of tumour suppressors",
    "      |                           |",
    "      ▼                           ▼",
    " Papillary low-grade        Carcinoma in situ (CIS)",
    " Ta tumour (pTa)            then muscle invasive",
    " (Slow growing;             (pT2-pT4; aggressive;",
    "  recurrent but            metastatic potential)",
    "  rarely progresses)",
  ]),

  h2("4. STAGING — TNM"),
  makeTable(
    ["Stage", "Description"],
    [
      ["CIS (Tis)", "Flat high-grade carcinoma in situ; confined to urothelium; no invasion"],
      ["Ta", "Non-invasive papillary tumour; confined to urothelium"],
      ["T1", "Invades subepithelial connective tissue (lamina propria)"],
      ["T2a", "Invades superficial muscle (inner half of detrusor)"],
      ["T2b", "Invades deep muscle (outer half of detrusor)"],
      ["T3a", "Microscopic perivesical tissue invasion"],
      ["T3b", "Macroscopic perivesical tissue invasion"],
      ["T4a", "Invades prostate, uterus, vagina"],
      ["T4b", "Invades pelvic wall, abdominal wall"],
    ],
    [1500, 7500]
  ),
  para("Non-muscle invasive bladder cancer (NMIBC): Tis, Ta, T1. Muscle-invasive bladder cancer (MIBC): T2–T4."),

  h2("5. CLINICAL FEATURES"),
  makeTable(
    ["Feature", "Details"],
    [
      ["Painless haematuria (CARDINAL symptom)", "Frank haematuria in 85%; intermittent; 'clot per urethra' — entire voided urine uniformly red (total haematuria — bladder/upper tract source)"],
      ["Irritative LUTS", "Frequency, urgency, dysuria — especially CIS (diffuse involvement)"],
      ["Obstructive symptoms", "Ureteric obstruction → loin pain, hydroureteronephrosis if tumour at ureteric orifice"],
      ["Pelvic pain / perineal pain", "T3/T4 locally advanced disease"],
      ["Constitutional symptoms", "Weight loss, fatigue, anaemia — advanced/metastatic disease"],
    ],
    [3000, 6000]
  ),

  h2("6. INVESTIGATIONS"),
  bullet("Urine cytology: Highly specific (90–95%) but low sensitivity for low-grade TCC; excellent for CIS; voided or barbotage (bladder washing) specimens"),
  bullet("Urine biomarkers: NMP22 (Nuclear matrix protein 22), BTA (bladder tumour antigen), UroVysion FISH — adjuncts to cytology"),
  bullet("Flexible cystoscopy — gold standard for diagnosis: Direct visualisation; biopsy of suspicious lesions; mapping"),
  bullet("CT urography (CTU): Upper tract TCC; staging of MIBC; lymph node assessment"),
  bullet("MRI pelvis: Best for local staging (muscle invasion, perivesical extension)"),
  bullet("FDG-PET CT: Metastatic staging in MIBC"),
  bullet("TURBT (Transurethral Resection of Bladder Tumour): Diagnostic AND therapeutic; must include detrusor muscle in specimen for staging"),
  bullet("Bone scan: If bone metastases suspected"),

  h2("7. MANAGEMENT"),

  h3("A. Non-Muscle Invasive Bladder Cancer (NMIBC — Ta, T1, CIS)"),
  bullet("TURBT: Primary treatment — complete resection; re-TURBT at 4–6 weeks for T1/high-grade"),
  bullet("Risk stratification: EAU risk groups (low / intermediate / high) guide adjuvant intravesical therapy"),
  bullet("Intravesical chemotherapy (mitomycin C): Single dose within 6 hours of TURBT — reduces immediate recurrence; intermediate risk maintenance"),
  bullet("Intravesical BCG (Bacillus Calmette-Guérin): HIGH-GRADE Ta, T1, CIS — 6-week induction + 1–3 years maintenance; reduces recurrence AND progression; most effective for CIS"),
  bullet("Radical cystectomy: BCG-failure high-risk NMIBC; recurrent T1G3; extensive CIS non-responsive to BCG"),

  h3("B. Muscle-Invasive Bladder Cancer (MIBC — T2–T4)"),
  bullet("Radical cystectomy (gold standard): Males — remove bladder, prostate, seminal vesicles; Females — remove bladder, uterus, ovaries, anterior vaginal wall + pelvic lymphadenectomy"),
  bullet("Neoadjuvant chemotherapy (MVAC or GC): Before radical cystectomy — 5–8% absolute survival benefit; reduces pathological stage"),
  bullet("Urinary diversion after cystectomy:"),
  bullet("  Ileal conduit (Bricker's): Most common; incontinent; permanent stoma", 1),
  bullet("  Orthotopic neobladder (Studer's pouch): Ileum fashioned into neobladder anastomosed to urethra; continent; best QoL", 1),
  bullet("  Continent cutaneous diversion (Indiana pouch, Mitrofanoff)", 1),
  bullet("Trimodality therapy (bladder-preservation): TURBT + chemoradiotherapy (cisplatin + RT) — for patients unfit for cystectomy or who refuse; comparable outcomes in selected T2 patients"),
  bullet("Immunotherapy: Pembrolizumab (PD-1) / Atezolizumab (PD-L1) — for metastatic/cisplatin-ineligible MIBC; FDA approved"),

  h3("C. Surveillance for NMIBC"),
  bullet("Low-risk: Cystoscopy at 3 months, then annually × 5 years"),
  bullet("High-risk: Cystoscopy every 3 months × 2 years, then 6-monthly × 3 years, then annually"),
  note("EV-302/KEYNOTE-A39 Trial (NEJM 2024): Enfortumab vedotin (EV) + pembrolizumab — superior to gemcitabine-cisplatin as first-line for unresectable/metastatic urothelial carcinoma. This is now the new standard of care for metastatic bladder cancer."),
  divider(),

  new Paragraph({ spacing: { before: 200 }, alignment: AlignmentType.CENTER,
    children: [new TextRun({ text: "— END OF ANSWER BOOK II —", bold: true, size: 22, color: DARK_NAVY, font: "Calibri" })],
  })
);

// ─── Build + Save ────────────────────────────────────────
const doc = new Document({
  creator: "Orris AI — Surgery Answer Book II",
  title: "Surgery Answer Book II",
  description: "Detailed surgical answers: Bile Duct Injuries, Biliary Tract & Jaundice, Renal/Ureteric Calculi, Ca Prostate, EDH, Ca Urinary Bladder",
  styles: { default: { document: { run: { font: "Calibri", size: 20 } } } },
  sections: [{
    properties: {
      page: {
        margin: {
          top: convertInchesToTwip(1), right: convertInchesToTwip(1),
          bottom: convertInchesToTwip(1), left: convertInchesToTwip(1.2),
        },
      },
    },
    children: content,
  }],
});

Packer.toBuffer(doc).then(buf => {
  fs.writeFileSync("/home/daytona/workspace/answer-book/Surgery_Answer_Book_II.docx", buf);
  console.log("SUCCESS: Surgery_Answer_Book_II.docx written");
}).catch(err => { console.error("ERROR:", err.message); process.exit(1); });
Running Command

cd /home/daytona/workspace/answer-book && node create_answer_book2.js 2>&1

Running Command

cp /home/daytona/workspace/answer-book/Surgery_Answer_Book_II.docx /tmp/Surgery_Answer_Book_II.docx && libreoffice --headless --convert-to pdf --outdir /tmp/ /tmp/Surgery_Answer_Book_II.docx 2>&1 && cp /tmp/Surgery_Answer_Book_II.pdf /home/daytona/workspace/answer-book/Surgery_Answer_Book_II.pdf && ls -lh /home/daytona/workspace/answer-book/

Done! Both files are ready:

Surgery Answer Book II

PDF Document · PDF

(473 KB)

Surgery Answer Book II

Word Document · DOCX


Contents summary

Q1 — Bile Duct Injuries at Cholecystectomy (30 marks)

  • Aetiology/risk factors table; Bismuth I–V classification + diagram; Strasberg A–E5 classification; Stewart-Way classification
  • Clinical presentation by timing (intraop → early → late)
  • CVS (Critical View of Safety) — 3 criteria explained; IOC, ICG fluorescence
  • Management table by injury type; Roux-en-Y hepaticojejunostomy diagram + principles
  • Timing of repair; complications (secondary biliary cirrhosis, portal hypertension)

Q2 — Surgical Anatomy of Biliary Tract + Jaundice (30 marks)

  • Intrahepatic/extrahepatic biliary anatomy; CBD relations (supraduodenal, retroduodenal, intrapancreatic); Calot's triangle contents
  • Extrahepatic anatomy diagram (hepatic ducts → CBD → ampulla of Vater)
  • Classification of jaundice (pre-hepatic / hepatic / obstructive) with mechanism table
  • Differential diagnosis of obstructive jaundice (7 causes with distinguishing features)
  • LFT interpretation table (pre-hepatic vs. hepatocellular vs. obstructive)
  • Imaging investigations: USS → MRCP → CT → ERCP → PTC → EUS
  • Pre-operative management of obstructive jaundice (Pye's protocol: Vit K, mannitol, antibiotics); Courvoisier's Law

Q3 — Renal/Ureteric Calculi (30 marks)

  • Stone types table (calcium oxalate, struvite, uric acid, cystine) with radio-opacity
  • Pathogenesis diagram (supersaturation → nucleation → crystal growth; Randall's plaques)
  • ESWL: mechanism, best indications, contraindications, steinstrasse
  • URS + Holmium laser: stone-free rates, flexible vs. semi-rigid
  • PCNL: Indications (>2 cm, staghorn), mini/micro-PCNL, complications (haemorrhage)
  • Treatment comparison table; staghorn management; infected obstruction emergency protocol
  • Metabolic evaluation + prevention; thulium fibre laser (latest advance)

Q4 — Carcinoma Prostate (30 marks)

  • McNeal's zonal anatomy table; surgical relations; Walsh's neurovascular bundles
  • Gleason grading (Grade Groups 1–5); osteoblastic bone metastases
  • TNM 8th Ed. full staging table; D'Amico risk classification
  • Investigations: PSA (density, velocity, free:total), mpMRI PI-RADS, PSMA-PET CT
  • Management by risk group: Active surveillance (ProtecT trial), RARP, EBRT+brachytherapy, ADT
  • Treatment summary table; VISION trial (177Lu-PSMA-617, 2021); STAMPEDE trial

Q5 — Extradural Haematoma (10 marks)

  • MMA anatomy; lentiform/biconvex shape explained
  • Monroe-Kellie doctrine diagram → lucid interval → Hutchinson pupil → Cushing's triad
  • CT findings; surgical criteria table (>30 mL, >15 mm, midline shift >5 mm)
  • Craniotomy; emergency burr hole; prognosis (excellent if promptly treated, mortality <5%)

Q6 — Carcinoma Urinary Bladder (10 marks)

  • Types (TCC 90%, SCC, adenocarcinoma); aetiology table (smoking, aniline dyes, schistosomiasis, cyclophosphamide)
  • Molecular pathways diagram (FGFR3 low-grade vs. TP53/RB1 high-grade)
  • TNM staging table; NMIBC vs. MIBC distinction
  • TURBT + intravesical BCG (CIS/high-grade); urinary diversions (ileal conduit, Studer neobladder)
  • Neoadjuvant MVAC/GC; EV-302 trial (enfortumab vedotin + pembrolizumab, 2024)
This is a shared conversation. Sign in to Orris to start your own chat.