explain me 93rd chapter of campbell in simple language all points. management of upper urinary tract obstruction

Reading File
Finding Sources
Searching the Web

Campbell Walsh Urology chapter 93 upper urinary tract obstruction management

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
I now have extensive content from the chapter. I have enough material to write a thorough, simplified explanation. Let me now compile the full answer based on everything I've read from Campbell Walsh Wein Urology, Chapter 93 (Management of Upper Urinary Tract Obstruction).

Chapter 93 - Management of Upper Urinary Tract Obstruction (Campbell Walsh Wein Urology)

Explained Simply - All Key Points


1. What Is Upper Urinary Tract Obstruction?

The upper urinary tract includes the kidneys and ureters. Obstruction means something is blocking urine from flowing freely from the kidney down to the bladder.
  • Definition: Obstruction is any blockage that impairs urine drainage AND damages kidney function if untreated. Simply having a dilated (wide) ureter or kidney pelvis does NOT always mean there is obstruction - the key is whether kidney function is being harmed.
  • Hydronephrosis = swelling/dilation of the kidney due to backed-up urine. It can occur WITH or WITHOUT true obstruction.
  • The ureteropelvic junction (UPJ) is the most common site of obstruction (where the kidney meets the ureter).

2. How Common Is It? (Prevalence)

  • Upper urinary tract obstruction is detected much more commonly now due to routine prenatal ultrasound screening.
  • In children, UPJ obstruction is the most frequent cause of hydronephrosis.
  • Can be congenital (present at birth) or acquired (develops later from stones, tumors, scarring, etc.)

3. Clinical Presentation - How Do Patients Present?

In Adults:

  • Flank pain / colicky pain (sharp, comes in waves, radiates to groin) - classic feature
  • Nausea/vomiting with the pain
  • Hematuria (blood in urine) - especially if caused by a stone
  • Silent obstruction - some patients have no symptoms at all but slowly lose kidney function
  • Urinary tract infections (UTI) - recurrent infections can be a clue
  • Hypertension (high blood pressure)
  • Palpable abdominal/flank mass (especially in children)

In Children:

  • Abdominal mass (parents notice swollen abdomen)
  • UTI
  • Failure to thrive
  • Often found on prenatal ultrasound before any symptoms develop

Progressive Renal Dysfunction:

  • Obstruction - if left untreated - causes slowly progressive kidney failure even without symptoms
  • One of the most important reasons to evaluate and treat even "silent" obstruction

4. Definition of Obstruction (What Makes It "True" Obstruction?)

This is one of the trickiest parts of the chapter:
  • A dilated collecting system (hydronephrosis) does NOT automatically = obstruction
  • True obstruction means the blockage is impairing drainage AND causing or likely to cause kidney damage
  • Diuresis renography (nuclear scan with a diuretic drug given during the test) is the most widely used way to decide if true obstruction exists
  • The half-time (t½): After giving furosemide (a diuretic), if the radiotracer takes >20 minutes to clear half the radioactivity from the kidney = obstructed. 10-20 min = equivocal. <10 min = not obstructed.

5. Diagnosis and Imaging

Lab Studies:

  • Serum creatinine / BUN - assess overall kidney function
  • eGFR - estimated glomerular filtration rate, tells you how well kidneys are filtering
  • Urinalysis - look for blood, infection, casts
  • Fractional Excretion of Sodium (FENa): <1% suggests pre-renal (reduced blood flow to kidney); >1% suggests intrinsic kidney damage or obstruction has already caused tubular injury

Biomarkers (newer research area):

  • NGAL, KIM-1, L-FABP, Cystatin C - newer urine biomarkers that can detect kidney injury from obstruction earlier than creatinine
  • Still being studied and not yet standard clinical practice

Imaging:

TestWhat It ShowsWhen Used
Ultrasound (US)Dilated kidney (hydronephrosis), cysts, stonesFirst test - quick, no radiation, cheap
CT scan (non-contrast)Stones - gold standardBest for suspected stones
CT with contrast (CT urogram)Full detail of urinary tract, tumors, anatomyWhen cause unclear
Nuclear Renography (MAG-3 scan)Split kidney function + drainageBest for assessing functional significance of obstruction
MRI UrographyDetailed anatomy without radiationUseful in pregnancy, children
Excretory Urography (IVP)Old standard - now largely replaced by CTRarely used now
Whitaker TestPressure-flow measurement via nephrostomyWhen nuclear scan is equivocal - invasive
Retrograde PyelographyFills ureter/pelvis from below (cystoscopy)When endoscopic intervention also planned
Antegrade PyelographyFills ureter from above (nephrostomy)After percutaneous access
Key Imaging Principle:
  • Ultrasound first - finds hydronephrosis
  • CT (non-contrast) if stone suspected
  • MAG-3 renography to answer "is this causing real obstruction and how much function is left?"

6. Pathological Changes of Obstruction (What Happens to the Kidney)

In the Mature (Adult) Kidney:

When obstruction occurs, the kidney undergoes a predictable sequence of injury:
  1. Tubular dilation - the tubules fill up and stretch
  2. Tubular atrophy - cells die off
  3. Glomerular damage - the filters of the kidney get damaged
  4. Interstitial fibrosis - scar tissue replaces normal kidney tissue (irreversible damage)
  5. Loss of nephrons - kidney shrinks over time

In the Developing (Fetal/Newborn) Kidney:

  • Far more vulnerable to obstruction than adult kidneys
  • Obstruction during fetal development disrupts normal kidney growth and differentiation
  • Can lead to renal dysplasia (abnormal kidney development - the kidney looks abnormal under microscope)
  • The earlier the obstruction occurs during fetal development, the worse the outcome

7. Tubulointerstitial Fibrosis (The Core of Irreversible Damage)

This is a major focus of the chapter because once fibrosis sets in, relief of obstruction may not reverse it:

Inflammatory Cells:

  • Macrophages and T-cells invade the obstructed kidney
  • These cells release cytokines and growth factors that drive fibrosis

Key Growth Factors and Cytokines:

FactorRole
TGF-β1 (Transforming Growth Factor-beta 1)The main driver of fibrosis - stimulates scar tissue formation
TNF-α (Tumor Necrosis Factor-alpha)Promotes inflammation and tubular cell death
Interleukin-18 (IL-18)Promotes inflammation; elevated in urine = marker of injury
Angiotensin IICauses vasoconstriction AND stimulates TGF-β production

Emerging Therapies (Research Phase):

  • Angiotensin-converting enzyme (ACE) inhibitors - may reduce fibrosis by blocking angiotensin II
  • Anti-TGF-β agents - experimental
  • These are not yet standard treatment but are an active research area

8. Hemodynamic Changes (Blood Flow Changes in the Kidney)

With Unilateral Ureteral Obstruction (UUO - one kidney blocked):

Time PhaseBlood Flow Change
0-2 hoursINCREASES (prostaglandin E2 and nitric oxide dilate afferent arterioles)
3-4 hoursStarts to DECREASE
>5 hoursMarkedly DECLINES
  • After prolonged UUO, renin-angiotensin system kicks in and causes afferent arteriolar vasoconstriction, reducing GFR
  • Blood flow shifts from outer cortex to inner cortex in UUO

With Bilateral Ureteral Obstruction (BUO - both kidneys blocked):

  • Modest increase for ~2 hours, then profound and rapid decline
  • Blood flow shifts in the opposite direction (toward outer cortex)
  • More clinically dangerous because both kidneys are failing

9. Kidney Tubular Function After Obstruction

Concentrating Ability:

  • Obstruction disrupts aquaporin (AQP) water channels - these are the proteins that let the kidney concentrate urine
  • AQP2 (the main vasopressin-regulated channel) is markedly reduced after 24 hours of bilateral obstruction
  • AQP2 is still 50% below normal even 7 days after the obstruction is relieved
  • Result: Post-obstructive polyuria (lots of dilute urine after the blockage is released) - especially after bilateral obstruction

Sodium Handling:

  • NHE3 (sodium/hydrogen exchanger) and NaKATPase activity are reduced - kidneys can't reabsorb sodium well
  • After relief of bilateral obstruction: kidneys dump large amounts of sodium and water = post-obstructive diuresis
  • This diuresis is usually physiological (appropriate) - getting rid of accumulated fluid and solutes
  • However, if patient's volume status is not managed, can lead to dangerous dehydration

Managing Post-Obstructive Diuresis:

  • Replace half the urine output per hour with IV fluids (typically 0.45% saline)
  • Avoid complete replacement (would perpetuate diuresis)
  • Monitor electrolytes closely - especially sodium, potassium, bicarbonate

Potassium Handling:

  • Obstruction impairs potassium excretion - can cause hyperkalemia (high potassium)
  • After relief: potassium handling normalizes, can sometimes cause hypokalemia from excessive loss

Acid-Base:

  • Obstruction → Type 4 renal tubular acidosis (hyperkalemic, hyperchloremic metabolic acidosis)
  • Mechanism: reduced aldosterone effect in collecting duct

10. Recovery of Renal Function After Relief of Obstruction

One of the most clinically important questions: How much function will come back?
Key factors:
  • Duration of obstruction - shorter = more recovery
  • Degree/completeness of obstruction - partial vs. complete
  • Presence of infection - infected obstruction causes faster and worse damage (pyonephrosis)
  • Age - developing kidneys in children are particularly vulnerable but can also be resilient if obstruction relieved early
  • Pre-existing kidney disease - baseline function matters
General rules (from animal and clinical studies):
  • Complete obstruction of 1 week → significant but largely recoverable function
  • Complete obstruction of 2 weeks → ~70% function recovery possible
  • Complete obstruction of 4 weeks → ~30% function recovery possible
  • Complete obstruction of 6 weeks → minimal function recovery (<10%)
  • These are estimates; individual variation is large

11. Specific Causes of Upper Urinary Tract Obstruction

Intrinsic Causes (inside the urinary tract):

  • Urinary stones (calculi) - most common cause of acute obstruction
  • Transitional cell carcinoma of the ureter or renal pelvis
  • Blood clots - after trauma or kidney procedure
  • Fungal bezoars - in immunocompromised patients
  • Ureteral stricture - narrowing from previous stone passage, surgery, radiation, or infection (TB, schistosomiasis)
  • UPJ obstruction - congenital narrowing at ureteropelvic junction

Extrinsic Causes (outside the urinary tract pressing on ureter):

  • Retroperitoneal fibrosis - fibrosis wraps around and compresses ureters
  • Pelvic malignancy - cervical, ovarian, prostate, colorectal cancer
  • Lymphoma/lymph node metastases
  • Aberrant renal vessels crossing UPJ (common cause of congenital UPJ obstruction)
  • Pregnancy - right-sided hydronephrosis in pregnancy is normal/physiological
  • Aortic aneurysm

12. Management Principles

Goals of Treatment:

  1. Relieve the obstruction
  2. Preserve/recover kidney function
  3. Treat the underlying cause
  4. Prevent complications (infection, sepsis, permanent kidney damage)

Emergency Decompression - When Needed IMMEDIATELY:

Drain the kidney URGENTLY if:
  • Infected obstructed system (pyonephrosis) - this is a urological emergency
  • Bilateral obstruction causing acute kidney injury
  • Solitary kidney obstructed
  • Uncontrolled pain despite medications
  • Urosepsis - infected obstruction causing systemic sepsis

Methods of Decompression:

1. Ureteral Stenting (JJ Stent / Double-J Stent)

  • A soft plastic tube placed inside the ureter from the kidney to the bladder
  • Done cystoscopically (through the urethra) under anesthesia
  • Bypasses the obstruction internally
  • Pros: No external tube, patient can go home, good for temporary relief
  • Cons: Bladder irritation, urinary frequency, flank discomfort with voiding (stent colic), needs periodic replacement every 3-6 months
  • Good for: Stones <10mm likely to pass, strictures, malignant obstruction

2. Percutaneous Nephrostomy (PCN)

  • A tube placed through the back/flank directly into the kidney under ultrasound/fluoroscopy guidance
  • Drains urine externally into a bag
  • Pros: Can be done quickly under local anesthesia, doesn't require patient to go to OR, excellent drainage even in infection
  • Cons: External tube, risk of dislodgment, patient discomfort, infection risk
  • Preferred in: Septic patients (faster, avoids anesthesia), when stenting fails, after failed retrograde access, need for culture-directed drainage

3. Medical Expulsive Therapy (MET) for Stones

  • For ureteral stones ≤10mm: Alpha-1 blockers (tamsulosin 0.4mg daily) relax the ureteral smooth muscle and help stones pass
  • NSAIDs for pain management
  • Push fluids
  • Can observe for 4-6 weeks if no fever, no infection, pain controlled

13. Specific Management by Cause

UPJ Obstruction (Congenital):

Observation: For asymptomatic UPJ obstruction with preserved function (>40% split function), watchful waiting with serial ultrasounds and renograms is appropriate in selected patients
Surgical Repair - Pyeloplasty:
  • Anderson-Hynes dismembered pyeloplasty is the gold standard
  • Done laparoscopically or robotically (open now uncommon)
  • Success rate: ~90-95%
  • The narrowed segment is excised and the ureter reconnected to the renal pelvis in a wider anastomosis
  • Anterior crossing vessels (crossing renal vessel causing UPJ obstruction) are transposed
Endopyelotomy:
  • Endoscopic incision of the UPJ stricture
  • Can be done retrograde (ureteroscopy) or antegrade (percutaneous)
  • Success ~65-75%, lower than pyeloplasty
  • Best for: Secondary UPJ obstruction (recurrence after pyeloplasty), where crossing vessels are NOT the cause

Ureteral Stricture:

  • Short, benign strictures (<1-2 cm): Endoscopic balloon dilation or endoureterotomy (incision)
  • Longer strictures: Ureteral reimplantation, Boari flap, ileal ureter interposition, autotransplantation
  • Malignant strictures: Metal stents for palliation; nephrostomy tube

Stone-Related Obstruction:

  • <10mm, distal ureter: Medical expulsive therapy (tamsulosin), observe up to 4-6 weeks
  • >10mm or proximal: Ureteroscopy with laser lithotripsy (break up stone with laser)
  • Large stones in kidney (>2cm): PCNL (percutaneous nephrolithotomy)
  • Infected/obstructed stone: EMERGENCY - drain first (PCN or stent), treat infection, THEN elective stone removal

Retroperitoneal Fibrosis:

  • Steroids (prednisolone) - first-line to reduce inflammation and fibrosis
  • Ureteral stenting - to relieve obstruction while steroids work
  • Ureterolysis - surgical freeing of the ureter from the fibrous tissue, often with omentum wrapping to prevent re-encasement
  • Biopsy to rule out malignancy (IgG4-related disease is an important cause)

Malignant Obstruction:

  • Ureteral stent or nephrostomy for decompression
  • Metal ureteral stents have longer patency than plastic stents for malignant obstruction
  • Treatment of the underlying cancer is the definitive approach

14. Special Considerations

Obstruction in Pregnancy:

  • Right-sided hydronephrosis is physiological in pregnancy (due to uterus compressing right ureter)
  • For symptomatic obstruction (stones) in pregnancy:
    • Conservative first (hydration, safe analgesia)
    • Ureteral stenting or PCN if conservative fails (both are safe)
    • CT avoided; use ultrasound or low-dose X-ray
    • Ureteroscopy is safe in 2nd trimester

Obstruction with Infection (Pyonephrosis):

  • Most serious complication of upper tract obstruction
  • Can progress to gram-negative urosepsis rapidly
  • Treatment: IMMEDIATE drainage (PCN preferred - can be done at bedside/under local) + IV antibiotics
  • Do NOT try to instrument the ureter in a septic patient through cystoscopy (manipulation can worsen bacteremia)

15. KEY POINTS SUMMARY (as listed in the chapter)

TopicKey Point
Obstruction definitionBlockage that damages kidney function - dilation alone is NOT obstruction
Most common siteUPJ (ureteropelvic junction)
First imaging testUltrasound
Best functional testMAG-3 diuretic renography
Renal blood flow in UUOIncreases first 1-2 hrs, then decreases after 3-5 hrs
Renal blood flow in BUOModest increase for 2 hrs then profound fall
Post-obstructive diuresisReplace ~half urine output; monitor electrolytes
Main cause of fibrosisTGF-β1
Infected obstructionUrological emergency - drain immediately
Gold standard for UPJ repairDismembered pyeloplasty (laparoscopic/robotic)
Stent vs. PCNPCN preferred in sepsis; stent for stable patients
Tamsulosin (alpha-blocker)Helps stones ≤10mm pass spontaneously

Source: Campbell Walsh Wein Urology (12th Ed.), Chapter 93 - Management of Upper Urinary Tract Obstruction, pp. 1003-1020+

Make a summary presentation (PPTX) on upper urinary tract obstruction

Reading File
Reading File
Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null || echo "workspace empty"

Running Command

mkdir -p /home/daytona/workspace/uut-obstruction-pptx

Writing File

~/uut-obstruction-pptx/create_pptx.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Management of Upper Urinary Tract Obstruction";
pres.author = "Campbell Walsh Wein Urology";

// ── PALETTE ──────────────────────────────────────────────────────────────
const DARK_BG   = "0D2137";   // deep navy – title / section dividers
const MID_BG    = "102A4C";   // medium navy – content slides bg
const ACCENT    = "2E86DE";   // vivid blue – headings, accents
const ACCENT2   = "1ABC9C";   // teal – highlights, icons
const LIGHT_BG  = "F0F4F8";   // very light blue-grey – content area
const WHITE     = "FFFFFF";
const DARK_TEXT = "1A2C42";
const BODY_TEXT = "2C3E50";
const ORANGE    = "E67E22";   // for warnings / emergencies
const RED       = "C0392B";   // emergency
const LIGHT_ACCENT = "D6EAF8"; // soft blue fill for cards

// ── HELPER FUNCTIONS ─────────────────────────────────────────────────────

function addSlideBg(slide, color) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: "100%", h: "100%",
    fill: { color: color }, line: { color: color }
  });
}

function addTopBar(slide, color) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: "100%", h: 0.08,
    fill: { color: color }, line: { color: color }
  });
}

function addBottomBar(slide, label) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 5.35, w: "100%", h: 0.28,
    fill: { color: DARK_BG }, line: { color: DARK_BG }
  });
  slide.addText(label, {
    x: 0.3, y: 5.35, w: 9.4, h: 0.28,
    fontSize: 8, color: "AABBCC", align: "left", valign: "middle", margin: 0
  });
  slide.addText("Campbell Walsh Wein Urology – Ch. 93", {
    x: 0.3, y: 5.35, w: 9.4, h: 0.28,
    fontSize: 8, color: "AABBCC", align: "right", valign: "middle", margin: 0
  });
}

function addSectionHeading(slide, text) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0.4, y: 0.18, w: 4.5, h: 0.06,
    fill: { color: ACCENT2 }, line: { color: ACCENT2 }
  });
  slide.addText(text, {
    x: 0.4, y: 0.26, w: 9.2, h: 0.55,
    fontSize: 22, bold: true, color: ACCENT, fontFace: "Calibri",
    margin: 0
  });
}

function bulletItem(text, indent, bold) {
  return {
    text: text,
    options: {
      bullet: { indent: indent || 15 },
      breakLine: true,
      bold: bold || false,
      fontSize: 13,
      color: BODY_TEXT
    }
  };
}

function subBullet(text) {
  return {
    text: text,
    options: {
      bullet: { indent: 30 },
      breakLine: true,
      fontSize: 11.5,
      color: "4A6785"
    }
  };
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, DARK_BG);

  // Decorative diagonal band
  s.addShape(pres.shapes.RECTANGLE, {
    x: 7.2, y: 0, w: 2.8, h: 5.625,
    fill: { color: "0A1B2E", transparency: 0 }, line: { color: "0A1B2E" }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 4.9, w: "100%", h: 0.725,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });

  // Kidney icon (text emoji as visual placeholder)
  s.addText("🫘", {
    x: 7.4, y: 0.6, w: 2.3, h: 2.5,
    fontSize: 90, align: "center", valign: "middle"
  });

  s.addText("MANAGEMENT OF", {
    x: 0.5, y: 0.8, w: 6.6, h: 0.5,
    fontSize: 14, bold: false, color: ACCENT2, charSpacing: 5,
    fontFace: "Calibri", margin: 0
  });
  s.addText("Upper Urinary\nTract Obstruction", {
    x: 0.5, y: 1.2, w: 6.5, h: 2.0,
    fontSize: 38, bold: true, color: WHITE, fontFace: "Calibri",
    lineSpacingMultiple: 1.1
  });
  s.addText("Campbell Walsh Wein Urology | Chapter 93", {
    x: 0.5, y: 3.3, w: 6.5, h: 0.4,
    fontSize: 13, color: "8AAFC8", fontFace: "Calibri"
  });
  s.addText("Pathophysiology  ·  Diagnosis  ·  Management", {
    x: 0.5, y: 4.92, w: 9, h: 0.72,
    fontSize: 15, bold: false, color: WHITE, align: "left",
    valign: "middle", fontFace: "Calibri"
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 2 – OVERVIEW / AGENDA
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, LIGHT_BG);
  addTopBar(s, ACCENT);

  s.addText("Chapter Overview", {
    x: 0.4, y: 0.2, w: 9.2, h: 0.55,
    fontSize: 24, bold: true, color: DARK_TEXT, fontFace: "Calibri", margin: 0
  });

  const topics = [
    ["1", "Definition & Prevalence"],
    ["2", "Clinical Presentation"],
    ["3", "Diagnosis & Imaging"],
    ["4", "Pathological Changes"],
    ["5", "Hemodynamic Changes"],
    ["6", "Tubular Function & Recovery"],
    ["7", "Causes of Obstruction"],
    ["8", "Management Principles"],
    ["9", "UPJ Obstruction Treatment"],
    ["10", "Special Situations"],
  ];

  const cols = [topics.slice(0, 5), topics.slice(5)];
  cols.forEach((col, ci) => {
    col.forEach((item, ri) => {
      const x = 0.5 + ci * 4.7;
      const y = 0.95 + ri * 0.84;
      s.addShape(pres.shapes.RECTANGLE, {
        x, y, w: 4.3, h: 0.72,
        fill: { color: WHITE },
        line: { color: "C5D8EC", pt: 1 },
        shadow: { type: "outer", color: "000000", blur: 4, offset: 2, angle: 135, opacity: 0.08 }
      });
      s.addShape(pres.shapes.RECTANGLE, {
        x, y, w: 0.38, h: 0.72,
        fill: { color: ACCENT }, line: { color: ACCENT }
      });
      s.addText(item[0], {
        x, y, w: 0.38, h: 0.72,
        fontSize: 13, bold: true, color: WHITE,
        align: "center", valign: "middle", margin: 0
      });
      s.addText(item[1], {
        x: x + 0.44, y, w: 3.8, h: 0.72,
        fontSize: 12.5, color: DARK_TEXT,
        align: "left", valign: "middle", margin: 0
      });
    });
  });

  addBottomBar(s, "Overview");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 3 – DEFINITION & PREVALENCE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, WHITE);
  addTopBar(s, ACCENT);
  addSectionHeading(s, "Definition & Prevalence");

  // Left column – definition box
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.95, w: 4.5, h: 2.35,
    fill: { color: DARK_BG }, line: { color: DARK_BG },
    shadow: { type: "outer", color: "000000", blur: 8, offset: 3, angle: 135, opacity: 0.2 }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.95, w: 4.5, h: 0.45,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });
  s.addText("DEFINITION", {
    x: 0.35, y: 0.95, w: 4.5, h: 0.45,
    fontSize: 12, bold: true, color: WHITE,
    align: "center", valign: "middle", charSpacing: 3, margin: 0
  });
  s.addText([
    { text: "A blockage that impairs urine drainage ", options: { color: WHITE, fontSize: 12, breakLine: false } },
    { text: "AND causes / is likely to cause kidney damage", options: { color: ACCENT2, fontSize: 12, bold: true, breakLine: true } },
    { text: " ", options: { breakLine: true, fontSize: 8 } },
    { text: "⚠  Hydronephrosis ≠ Obstruction", options: { color: ORANGE, fontSize: 12.5, bold: true, breakLine: true } },
    { text: "Dilation alone does not confirm obstruction", options: { color: "AABBCC", fontSize: 11, breakLine: false } },
  ], {
    x: 0.5, y: 1.45, w: 4.2, h: 1.75, valign: "top"
  });

  // Right column – prevalence
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.15, y: 0.95, w: 4.5, h: 2.35,
    fill: { color: LIGHT_ACCENT }, line: { color: "C5D8EC" }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.15, y: 0.95, w: 4.5, h: 0.45,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });
  s.addText("PREVALENCE", {
    x: 5.15, y: 0.95, w: 4.5, h: 0.45,
    fontSize: 12, bold: true, color: WHITE,
    align: "center", valign: "middle", charSpacing: 3, margin: 0
  });
  s.addText([
    bulletItem("Detected more commonly due to routine prenatal ultrasound"),
    bulletItem("UPJ obstruction = most common cause of hydronephrosis in children"),
    bulletItem("Can be congenital or acquired"),
    bulletItem("Often asymptomatic – risk of silent kidney loss"),
  ], { x: 5.3, y: 1.48, w: 4.2, h: 1.75, valign: "top" });

  // Bottom row – UPJ anatomy note
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 3.42, w: 9.3, h: 1.7,
    fill: { color: "EBF5FB" }, line: { color: "C5D8EC" }
  });
  s.addText("Most Common Sites of Obstruction", {
    x: 0.5, y: 3.48, w: 9, h: 0.38,
    fontSize: 13, bold: true, color: ACCENT, margin: 0
  });
  const sites = [
    ["UPJ\n(Ureteropelvic Jn.)", "Most common\ncongenital site"],
    ["Mid-ureter\n(Crossing vessels)", "Aberrant renal\nartery compression"],
    ["UVJ\n(Ureterovesical Jn.)", "Common in ureterocele\nor ureter reimplant"],
    ["Intraureteral\n(Stones / Stricture)", "Most common\nacquired cause"],
  ];
  sites.forEach((item, i) => {
    const x = 0.5 + i * 2.35;
    s.addShape(pres.shapes.RECTANGLE, {
      x, y: 3.9, w: 2.1, h: 1.05,
      fill: { color: WHITE }, line: { color: ACCENT, pt: 1.5 }
    });
    s.addShape(pres.shapes.RECTANGLE, {
      x, y: 3.9, w: 2.1, h: 0.28,
      fill: { color: ACCENT }, line: { color: ACCENT }
    });
    s.addText(item[0], {
      x, y: 3.9, w: 2.1, h: 0.28,
      fontSize: 9, bold: true, color: WHITE,
      align: "center", valign: "middle", margin: 0
    });
    s.addText(item[1], {
      x, y: 4.18, w: 2.1, h: 0.77,
      fontSize: 10, color: DARK_TEXT,
      align: "center", valign: "middle"
    });
  });

  addBottomBar(s, "Definition & Prevalence");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 4 – CLINICAL PRESENTATION
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, WHITE);
  addTopBar(s, ACCENT);
  addSectionHeading(s, "Clinical Presentation");

  // Adults box
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.92, w: 4.5, h: 3.3,
    fill: { color: LIGHT_BG }, line: { color: "C5D8EC" }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.92, w: 4.5, h: 0.42,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });
  s.addText("IN ADULTS", {
    x: 0.35, y: 0.92, w: 4.5, h: 0.42,
    fontSize: 12, bold: true, color: WHITE,
    align: "center", valign: "middle", charSpacing: 2, margin: 0
  });
  s.addText([
    bulletItem("Flank / colicky pain (comes in waves, radiates to groin)", 18),
    bulletItem("Nausea & vomiting with pain", 18),
    bulletItem("Hematuria – especially with stones", 18),
    bulletItem("Recurrent UTIs", 18),
    bulletItem("Hypertension", 18),
    bulletItem("Silent obstruction – no pain but progressive renal loss", 18, true),
  ], { x: 0.5, y: 1.4, w: 4.2, h: 2.75, valign: "top" });

  // Children box
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.15, y: 0.92, w: 4.5, h: 3.3,
    fill: { color: LIGHT_BG }, line: { color: "C5D8EC" }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.15, y: 0.92, w: 4.5, h: 0.42,
    fill: { color: ACCENT2 }, line: { color: ACCENT2 }
  });
  s.addText("IN CHILDREN", {
    x: 5.15, y: 0.92, w: 4.5, h: 0.42,
    fontSize: 12, bold: true, color: WHITE,
    align: "center", valign: "middle", charSpacing: 2, margin: 0
  });
  s.addText([
    bulletItem("Palpable abdominal / flank mass", 18),
    bulletItem("Failure to thrive", 18),
    bulletItem("Recurrent UTIs", 18),
    bulletItem("Detected on prenatal ultrasound (before symptoms)", 18, true),
    subBullet("Most common presentation today"),
    bulletItem("Progressive hydronephrosis on follow-up scans", 18),
  ], { x: 5.3, y: 1.4, w: 4.2, h: 2.75, valign: "top" });

  // Warning banner
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 4.35, w: 9.3, h: 0.85,
    fill: { color: "FEF9E7" }, line: { color: ORANGE, pt: 1.5 }
  });
  s.addText([
    { text: "⚠  KEY POINT: ", options: { bold: true, color: ORANGE, fontSize: 13 } },
    { text: "Progressive renal dysfunction can occur silently. Obstruction must be evaluated even without symptoms because irreversible kidney damage may develop without any pain.", options: { color: BODY_TEXT, fontSize: 12 } }
  ], { x: 0.55, y: 4.35, w: 9.0, h: 0.85, valign: "middle" });

  addBottomBar(s, "Clinical Presentation");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 5 – DIAGNOSIS & IMAGING
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, WHITE);
  addTopBar(s, ACCENT);
  addSectionHeading(s, "Diagnosis & Imaging");

  // Lab studies
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.88, w: 3.0, h: 2.5,
    fill: { color: LIGHT_BG }, line: { color: "C5D8EC" }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.88, w: 3.0, h: 0.38,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });
  s.addText("LAB STUDIES", {
    x: 0.35, y: 0.88, w: 3.0, h: 0.38,
    fontSize: 11, bold: true, color: WHITE,
    align: "center", valign: "middle", charSpacing: 2, margin: 0
  });
  s.addText([
    bulletItem("Serum Cr / BUN / eGFR", 14),
    subBullet("Overall kidney function"),
    bulletItem("Urinalysis", 14),
    subBullet("Blood, WBC, casts"),
    bulletItem("FENa", 14),
    subBullet("<1% = pre-renal / obstruction"),
    subBullet(">1% = tubular injury"),
    bulletItem("NGAL, KIM-1, Cystatin C", 14),
    subBullet("Novel biomarkers (research stage)"),
  ], { x: 0.45, y: 1.3, w: 2.8, h: 2.05, valign: "top" });

  // Imaging table
  const imgRows = [
    ["Ultrasound (US)", "First-line test – finds hydronephrosis, stones, cysts. No radiation.", ACCENT2],
    ["Non-contrast CT", "Gold standard for stones. Detects size & location.", ACCENT],
    ["CT Urogram", "Full anatomy, tumors, cause unclear cases.", ACCENT],
    ["MAG-3 Renography", "Split renal function + drainage curves. t½ >20 min = obstructed.", "8E44AD"],
    ["MRI Urography", "No radiation. For pregnancy, children, contrast allergy.", "16A085"],
    ["Whitaker Test", "Pressure-flow via nephrostomy. Invasive – when renogram equivocal.", ORANGE],
    ["Retrograde Pyelo.", "Via cystoscopy – when endoscopic intervention also planned.", "2E86DE"],
  ];

  s.addShape(pres.shapes.RECTANGLE, {
    x: 3.6, y: 0.88, w: 6.05, h: 0.38,
    fill: { color: DARK_BG }, line: { color: DARK_BG }
  });
  s.addText("IMAGING MODALITY", {
    x: 3.65, y: 0.88, w: 2.9, h: 0.38,
    fontSize: 10, bold: true, color: WHITE,
    align: "left", valign: "middle", margin: 0
  });
  s.addText("KEY ROLE", {
    x: 6.55, y: 0.88, w: 3.05, h: 0.38,
    fontSize: 10, bold: true, color: WHITE,
    align: "left", valign: "middle", margin: 0
  });

  imgRows.forEach((row, i) => {
    const y = 1.3 + i * 0.48;
    const bg = i % 2 === 0 ? LIGHT_BG : WHITE;
    s.addShape(pres.shapes.RECTANGLE, {
      x: 3.6, y, w: 6.05, h: 0.46,
      fill: { color: bg }, line: { color: "D5E8F5", pt: 0.5 }
    });
    s.addShape(pres.shapes.RECTANGLE, {
      x: 3.6, y, w: 0.06, h: 0.46,
      fill: { color: row[2] }, line: { color: row[2] }
    });
    s.addText(row[0], {
      x: 3.72, y, w: 2.78, h: 0.46,
      fontSize: 10.5, bold: true, color: DARK_TEXT,
      align: "left", valign: "middle", margin: 0
    });
    s.addText(row[1], {
      x: 6.55, y, w: 3.05, h: 0.46,
      fontSize: 9.5, color: BODY_TEXT,
      align: "left", valign: "middle", margin: 0
    });
  });

  // Workflow note
  s.addShape(pres.shapes.RECTANGLE, {
    x: 3.6, y: 4.66, w: 6.05, h: 0.6,
    fill: { color: "EAF2FF" }, line: { color: ACCENT }
  });
  s.addText([
    { text: "Imaging Workflow: ", options: { bold: true, color: ACCENT, fontSize: 11 } },
    { text: "Ultrasound → CT (stone?) → MAG-3 Renography (functional significance?)", options: { color: BODY_TEXT, fontSize: 11 } }
  ], { x: 3.72, y: 4.66, w: 5.85, h: 0.6, valign: "middle" });

  addBottomBar(s, "Diagnosis & Imaging");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 6 – PATHOLOGICAL CHANGES
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, WHITE);
  addTopBar(s, ACCENT);
  addSectionHeading(s, "Pathological Changes of Obstruction");

  // Left – mature kidney
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.88, w: 4.5, h: 3.6,
    fill: { color: LIGHT_BG }, line: { color: "C5D8EC" }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.88, w: 4.5, h: 0.42,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });
  s.addText("MATURE (ADULT) KIDNEY", {
    x: 0.35, y: 0.88, w: 4.5, h: 0.42,
    fontSize: 11, bold: true, color: WHITE,
    align: "center", valign: "middle", charSpacing: 2, margin: 0
  });
  const matureSteps = [
    "Tubular dilation – tubules fill & stretch",
    "Tubular atrophy – cells die off",
    "Glomerular damage – filters impaired",
    "Interstitial fibrosis – irreversible scar tissue",
    "Nephron loss – kidney shrinks",
  ];
  matureSteps.forEach((text, i) => {
    const y = 1.42 + i * 0.6;
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.48, y, w: 0.4, h: 0.4,
      fill: { color: ACCENT }, line: { color: ACCENT }
    });
    s.addText(String(i + 1), {
      x: 0.48, y, w: 0.4, h: 0.4,
      fontSize: 13, bold: true, color: WHITE,
      align: "center", valign: "middle", margin: 0
    });
    s.addText(text, {
      x: 0.98, y, w: 3.75, h: 0.4,
      fontSize: 11.5, color: DARK_TEXT,
      align: "left", valign: "middle", margin: 0
    });
  });

  // Right – developing kidney
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.15, y: 0.88, w: 4.5, h: 3.6,
    fill: { color: LIGHT_BG }, line: { color: "C5D8EC" }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.15, y: 0.88, w: 4.5, h: 0.42,
    fill: { color: "8E44AD" }, line: { color: "8E44AD" }
  });
  s.addText("DEVELOPING (FETAL) KIDNEY", {
    x: 5.15, y: 0.88, w: 4.5, h: 0.42,
    fontSize: 11, bold: true, color: WHITE,
    align: "center", valign: "middle", charSpacing: 2, margin: 0
  });
  s.addText([
    bulletItem("Far more vulnerable than adult kidney", 18, true),
    bulletItem("Disrupts normal growth & differentiation", 18),
    bulletItem("Can lead to renal dysplasia (abnormal development)", 18),
    bulletItem("Earlier the obstruction → worse the outcome", 18, true),
    bulletItem("Key mediator: TGF-β1 drives fibrosis", 18),
  ], { x: 5.3, y: 1.38, w: 4.2, h: 3.0, valign: "top" });

  // Bottom fibrosis key
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 4.6, w: 9.3, h: 0.7,
    fill: { color: "FDFEFE" }, line: { color: RED, pt: 1.5 }
  });
  s.addText([
    { text: "❗ Tubulointerstitial Fibrosis: ", options: { bold: true, color: RED, fontSize: 12 } },
    { text: "Once fibrosis sets in, relief of obstruction may NOT reverse kidney damage. Key drivers: ", options: { color: BODY_TEXT, fontSize: 11.5 } },
    { text: "TGF-β1, TNF-α, Angiotensin II, IL-18", options: { bold: true, color: ACCENT, fontSize: 11.5 } }
  ], { x: 0.5, y: 4.6, w: 9.1, h: 0.7, valign: "middle" });

  addBottomBar(s, "Pathological Changes");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 7 – HEMODYNAMIC CHANGES
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, WHITE);
  addTopBar(s, ACCENT);
  addSectionHeading(s, "Hemodynamic & Tubular Changes");

  // UUO timeline
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.88, w: 9.3, h: 0.38,
    fill: { color: DARK_BG }, line: { color: DARK_BG }
  });
  s.addText("UNILATERAL URETERAL OBSTRUCTION (UUO) – Blood Flow Timeline", {
    x: 0.35, y: 0.88, w: 9.3, h: 0.38,
    fontSize: 11, bold: true, color: WHITE,
    align: "center", valign: "middle", margin: 0
  });

  const phases = [
    { label: "0–2 hrs", desc: "INCREASES\n(PGE2 & NO\ndilate arterioles)", color: ACCENT2 },
    { label: "3–4 hrs", desc: "Starts to\nDECREASE", color: ORANGE },
    { label: ">5 hrs", desc: "MARKEDLY\nDECLINES\n(RAS activated)", color: RED },
    { label: "Chronic", desc: "Afferent arteriole\nvasoconstriction\n↓ GFR", color: "8B0000" },
  ];
  phases.forEach((p, i) => {
    const x = 0.45 + i * 2.35;
    s.addShape(pres.shapes.RECTANGLE, {
      x, y: 1.32, w: 2.15, h: 1.4,
      fill: { color: p.color }, line: { color: p.color }
    });
    s.addText(p.label, {
      x, y: 1.32, w: 2.15, h: 0.38,
      fontSize: 12, bold: true, color: WHITE,
      align: "center", valign: "middle", margin: 0
    });
    s.addText(p.desc, {
      x, y: 1.7, w: 2.15, h: 1.02,
      fontSize: 11, color: WHITE,
      align: "center", valign: "top"
    });
  });

  // BUO row
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 2.84, w: 9.3, h: 0.35,
    fill: { color: "4A235A" }, line: { color: "4A235A" }
  });
  s.addText("BILATERAL URETERAL OBSTRUCTION (BUO)", {
    x: 0.35, y: 2.84, w: 9.3, h: 0.35,
    fontSize: 11, bold: true, color: WHITE,
    align: "center", valign: "middle", margin: 0
  });
  s.addText([
    bulletItem("Modest increase in RBF for ~2 hours, then PROFOUND & RAPID DECLINE", 18, true),
    bulletItem("More clinically dangerous – both kidneys failing simultaneously", 18),
    bulletItem("Blood flow shifts toward OUTER cortex (opposite of UUO)", 18),
    bulletItem("Presents as acute kidney injury (AKI) – urgent intervention required", 18, true),
  ], { x: 0.5, y: 3.24, w: 9.0, h: 1.05, valign: "top" });

  // Post-obstructive diuresis
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 4.36, w: 9.3, h: 0.9,
    fill: { color: "EAF2FF" }, line: { color: ACCENT }
  });
  s.addText([
    { text: "Post-Obstructive Diuresis (after BUO relief): ", options: { bold: true, color: ACCENT, fontSize: 12 } },
    { text: "Large urine output after obstruction is relieved. Usually physiological. Management: replace ", options: { color: BODY_TEXT, fontSize: 11.5 } },
    { text: "~half the urine output per hour", options: { bold: true, color: ACCENT, fontSize: 11.5 } },
    { text: " with 0.45% NS. Monitor Na⁺, K⁺, HCO₃⁻ closely.", options: { color: BODY_TEXT, fontSize: 11.5 } }
  ], { x: 0.5, y: 4.36, w: 9.1, h: 0.9, valign: "middle" });

  addBottomBar(s, "Hemodynamic Changes");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 8 – RENAL FUNCTION RECOVERY
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, WHITE);
  addTopBar(s, ACCENT);
  addSectionHeading(s, "Recovery of Renal Function");

  // Recovery timeline bars
  const recoveryData = [
    { dur: "1 week", pct: 90, label: "~90% recovery" },
    { dur: "2 weeks", pct: 70, label: "~70% recovery" },
    { dur: "4 weeks", pct: 30, label: "~30% recovery" },
    { dur: "6 weeks", pct: 10, label: "<10% recovery" },
  ];

  s.addText("Expected Recovery After COMPLETE Obstruction Relief", {
    x: 0.4, y: 0.9, w: 9.2, h: 0.38,
    fontSize: 14, bold: true, color: DARK_TEXT, margin: 0
  });

  const barColors = [ACCENT2, ACCENT, ORANGE, RED];
  recoveryData.forEach((d, i) => {
    const y = 1.38 + i * 0.7;
    const barW = 5.5 * (d.pct / 100);
    s.addShape(pres.shapes.RECTANGLE, {
      x: 2.2, y, w: 5.5, h: 0.5,
      fill: { color: "EBF5FB" }, line: { color: "D5E8F5" }
    });
    s.addShape(pres.shapes.RECTANGLE, {
      x: 2.2, y, w: barW, h: 0.5,
      fill: { color: barColors[i] }, line: { color: barColors[i] }
    });
    s.addText(d.dur, {
      x: 0.4, y, w: 1.75, h: 0.5,
      fontSize: 12, bold: true, color: DARK_TEXT,
      align: "right", valign: "middle", margin: 0
    });
    s.addText(d.label, {
      x: 7.82, y, w: 1.8, h: 0.5,
      fontSize: 12, bold: true, color: barColors[i],
      align: "left", valign: "middle", margin: 0
    });
  });

  // Factors affecting recovery
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 4.2, w: 9.3, h: 1.05,
    fill: { color: LIGHT_BG }, line: { color: "C5D8EC" }
  });
  s.addText("Factors Affecting Recovery:", {
    x: 0.5, y: 4.23, w: 3, h: 0.35,
    fontSize: 12, bold: true, color: ACCENT, margin: 0
  });
  const factors = [
    "Duration of obstruction",
    "Degree (partial vs. complete)",
    "Presence of infection",
    "Patient age",
    "Pre-existing kidney disease",
  ];
  factors.forEach((f, i) => {
    const col = i < 3 ? 0 : 1;
    const row = i < 3 ? i : i - 3;
    s.addText("• " + f, {
      x: 0.5 + col * 4.6, y: 4.6 + row * 0.22,
      w: 4.5, h: 0.22,
      fontSize: 11.5, color: BODY_TEXT
    });
  });

  addBottomBar(s, "Recovery of Renal Function");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 9 – CAUSES OF OBSTRUCTION
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, WHITE);
  addTopBar(s, ACCENT);
  addSectionHeading(s, "Causes of Upper Urinary Tract Obstruction");

  // Intrinsic
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.88, w: 4.5, h: 3.65,
    fill: { color: LIGHT_BG }, line: { color: "C5D8EC" }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.88, w: 4.5, h: 0.42,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });
  s.addText("INTRINSIC CAUSES", {
    x: 0.35, y: 0.88, w: 4.5, h: 0.42,
    fontSize: 12, bold: true, color: WHITE,
    align: "center", valign: "middle", charSpacing: 2, margin: 0
  });
  s.addText([
    bulletItem("Urinary stones (calculi) – most common acute cause", 18, true),
    bulletItem("UPJ obstruction (congenital)", 18),
    bulletItem("Urothelial carcinoma (TCC) of ureter/pelvis", 18),
    bulletItem("Blood clots – post-trauma or procedure", 18),
    bulletItem("Fungal bezoars – immunocompromised patients", 18),
    bulletItem("Ureteral stricture – from:", 18),
    subBullet("Previous stone passage / instrumentation"),
    subBullet("Radiation therapy"),
    subBullet("TB / schistosomiasis"),
    subBullet("Post-surgical scarring"),
  ], { x: 0.5, y: 1.38, w: 4.2, h: 3.1, valign: "top" });

  // Extrinsic
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.15, y: 0.88, w: 4.5, h: 3.65,
    fill: { color: LIGHT_BG }, line: { color: "C5D8EC" }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.15, y: 0.88, w: 4.5, h: 0.42,
    fill: { color: "8E44AD" }, line: { color: "8E44AD" }
  });
  s.addText("EXTRINSIC CAUSES", {
    x: 5.15, y: 0.88, w: 4.5, h: 0.42,
    fontSize: 12, bold: true, color: WHITE,
    align: "center", valign: "middle", charSpacing: 2, margin: 0
  });
  s.addText([
    bulletItem("Retroperitoneal fibrosis – wraps & compresses ureter", 18),
    bulletItem("Pelvic malignancy:", 18, true),
    subBullet("Cervical, ovarian, prostate, colorectal cancer"),
    bulletItem("Lymphoma / lymph node metastases", 18),
    bulletItem("Aberrant crossing vessels at UPJ", 18),
    bulletItem("Pregnancy – right-sided physiological hydronephrosis", 18),
    bulletItem("Aortic aneurysm", 18),
    bulletItem("Pelvic inflammatory disease / abscess", 18),
  ], { x: 5.3, y: 1.38, w: 4.2, h: 3.1, valign: "top" });

  // Bottom callout
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 4.65, w: 9.3, h: 0.6,
    fill: { color: "EBF5FB" }, line: { color: ACCENT }
  });
  s.addText([
    { text: "Most common cause of ACUTE obstruction: ", options: { bold: true, color: ACCENT, fontSize: 12 } },
    { text: "Urinary stones  |  ", options: { color: BODY_TEXT, fontSize: 12 } },
    { text: "Most common cause of CHRONIC obstruction: ", options: { bold: true, color: "8E44AD", fontSize: 12 } },
    { text: "Stricture / Malignancy", options: { color: BODY_TEXT, fontSize: 12 } }
  ], { x: 0.5, y: 4.65, w: 9.1, h: 0.6, valign: "middle" });

  addBottomBar(s, "Causes of Obstruction");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 10 – MANAGEMENT PRINCIPLES
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, WHITE);
  addTopBar(s, ACCENT);
  addSectionHeading(s, "Management Principles");

  // Goals
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.88, w: 9.3, h: 0.88,
    fill: { color: DARK_BG }, line: { color: DARK_BG }
  });
  s.addText("TREATMENT GOALS", {
    x: 0.45, y: 0.88, w: 2, h: 0.88,
    fontSize: 11, bold: true, color: ACCENT2,
    charSpacing: 1, align: "left", valign: "middle", margin: 0
  });
  const goals = ["Relieve obstruction", "Preserve/recover kidney function", "Treat underlying cause", "Prevent complications (sepsis, fibrosis)"];
  goals.forEach((g, i) => {
    s.addShape(pres.shapes.RECTANGLE, {
      x: 2.45 + i * 1.78, y: 0.95, w: 1.6, h: 0.74,
      fill: { color: ACCENT }, line: { color: "1A6DAA" }
    });
    s.addText(g, {
      x: 2.45 + i * 1.78, y: 0.95, w: 1.6, h: 0.74,
      fontSize: 10, color: WHITE, align: "center", valign: "middle"
    });
  });

  // Emergency section
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 1.9, w: 9.3, h: 0.36,
    fill: { color: RED }, line: { color: RED }
  });
  s.addText("🚨  URGENT DECOMPRESSION REQUIRED WHEN:", {
    x: 0.45, y: 1.9, w: 9.1, h: 0.36,
    fontSize: 12, bold: true, color: WHITE,
    align: "left", valign: "middle", margin: 0
  });
  const emergency = [
    "Infected obstructed system (PYONEPHROSIS)",
    "Bilateral obstruction with AKI",
    "Solitary kidney obstruction",
    "Urosepsis",
    "Uncontrolled pain",
  ];
  emergency.forEach((item, i) => {
    const col = i < 3 ? 0 : 1;
    const row = i < 3 ? i : i - 3;
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.4 + col * 4.85, y: 2.3 + row * 0.38, w: 4.5, h: 0.34,
      fill: { color: "FEF9E7" }, line: { color: ORANGE, pt: 0.8 }
    });
    s.addText("⚠  " + item, {
      x: 0.5 + col * 4.85, y: 2.3 + row * 0.38, w: 4.3, h: 0.34,
      fontSize: 11, color: DARK_TEXT, bold: i === 0,
      align: "left", valign: "middle", margin: 0
    });
  });

  // Two decompression methods
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 3.45, w: 9.3, h: 0.34,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });
  s.addText("DECOMPRESSION METHODS", {
    x: 0.35, y: 3.45, w: 9.3, h: 0.34,
    fontSize: 11, bold: true, color: WHITE,
    align: "center", valign: "middle", charSpacing: 2, margin: 0
  });

  const methods = [
    {
      title: "JJ (Double-J) Ureteral Stent",
      pros: "Internal, no external bag, patient mobile",
      cons: "Bladder irritation, stent colic, needs replacement q3-6mo",
      best: "Stable patients, stones <10mm, strictures, malignant obstruction"
    },
    {
      title: "Percutaneous Nephrostomy (PCN)",
      pros: "Rapid, local anesthesia, excellent drainage",
      cons: "External tube, dislodgment risk, discomfort",
      best: "Septic/unstable patients, failed stenting, infected obstruction"
    },
  ];
  methods.forEach((m, i) => {
    const x = 0.4 + i * 4.85;
    s.addShape(pres.shapes.RECTANGLE, {
      x, y: 3.84, w: 4.5, h: 1.4,
      fill: { color: LIGHT_BG }, line: { color: "C5D8EC" }
    });
    s.addText(m.title, {
      x, y: 3.84, w: 4.5, h: 0.36,
      fontSize: 11, bold: true, color: DARK_TEXT,
      align: "center", valign: "middle", margin: 0
    });
    s.addText([
      { text: "✅ ", options: { color: ACCENT2, fontSize: 11 } },
      { text: m.pros, options: { color: BODY_TEXT, fontSize: 10.5, breakLine: true } },
      { text: "❌ ", options: { color: RED, fontSize: 11 } },
      { text: m.cons, options: { color: BODY_TEXT, fontSize: 10.5, breakLine: true } },
      { text: "★ Best for: ", options: { bold: true, color: ACCENT, fontSize: 10.5 } },
      { text: m.best, options: { color: BODY_TEXT, fontSize: 10.5 } },
    ], { x: x + 0.1, y: 4.22, w: 4.3, h: 1.0, valign: "top" });
  });

  addBottomBar(s, "Management Principles");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 11 – UPJ OBSTRUCTION TREATMENT
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, WHITE);
  addTopBar(s, ACCENT);
  addSectionHeading(s, "UPJ Obstruction – Specific Treatment");

  // Observation
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.88, w: 9.3, h: 0.92,
    fill: { color: "EBF5FB" }, line: { color: ACCENT }
  });
  s.addText([
    { text: "OBSERVATION (Conservative): ", options: { bold: true, color: ACCENT, fontSize: 13 } },
    { text: "Asymptomatic UPJ obstruction + preserved split function >40% + no complications → watchful waiting with serial ultrasound + renography every 6–12 months", options: { color: BODY_TEXT, fontSize: 12 } }
  ], { x: 0.5, y: 0.88, w: 9.1, h: 0.92, valign: "middle" });

  // Pyeloplasty – main box
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 1.9, w: 5.5, h: 2.85,
    fill: { color: LIGHT_BG }, line: { color: "C5D8EC" }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 1.9, w: 5.5, h: 0.42,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });
  s.addText("PYELOPLASTY (Gold Standard)", {
    x: 0.35, y: 1.9, w: 5.5, h: 0.42,
    fontSize: 12, bold: true, color: WHITE,
    align: "center", valign: "middle", charSpacing: 2, margin: 0
  });
  s.addText([
    bulletItem("Anderson-Hynes dismembered pyeloplasty", 18, true),
    bulletItem("Laparoscopic or robotic approach (open rarely done now)", 18),
    bulletItem("Success rate: ~90–95%", 18, true),
    bulletItem("Narrowed segment excised, ureter reconnected widely", 18),
    bulletItem("Crossing vessels transposed if causing obstruction", 18),
    bulletItem("Best for: Primary UPJ obstruction, crossing vessels present", 18),
  ], { x: 0.5, y: 2.38, w: 5.2, h: 2.3, valign: "top" });

  // Endopyelotomy box
  s.addShape(pres.shapes.RECTANGLE, {
    x: 6.05, y: 1.9, w: 3.6, h: 2.85,
    fill: { color: LIGHT_BG }, line: { color: "C5D8EC" }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 6.05, y: 1.9, w: 3.6, h: 0.42,
    fill: { color: "E67E22" }, line: { color: "E67E22" }
  });
  s.addText("ENDOPYELOTOMY", {
    x: 6.05, y: 1.9, w: 3.6, h: 0.42,
    fontSize: 12, bold: true, color: WHITE,
    align: "center", valign: "middle", charSpacing: 2, margin: 0
  });
  s.addText([
    bulletItem("Endoscopic incision of UPJ stricture", 18),
    bulletItem("Retrograde (ureteroscopy) or antegrade (percutaneous)", 18),
    bulletItem("Success: ~65–75% (lower than pyeloplasty)", 18, true),
    bulletItem("Best for: Secondary UPJ obstruction / recurrence after pyeloplasty, NO crossing vessels", 18),
  ], { x: 6.18, y: 2.38, w: 3.35, h: 2.3, valign: "top" });

  // Stone MET row
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 4.87, w: 9.3, h: 0.42,
    fill: { color: ACCENT2 }, line: { color: ACCENT2 }
  });
  s.addText("MEDICAL EXPULSIVE THERAPY (Stones ≤10mm): Tamsulosin 0.4mg OD → relaxes ureteral smooth muscle → helps stone pass spontaneously within 4–6 weeks", {
    x: 0.5, y: 4.87, w: 9.1, h: 0.42,
    fontSize: 11, color: WHITE, align: "left", valign: "middle", margin: 0
  });

  addBottomBar(s, "UPJ Obstruction Treatment");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 12 – MANAGEMENT BY CAUSE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, WHITE);
  addTopBar(s, ACCENT);
  addSectionHeading(s, "Management by Specific Cause");

  const rows = [
    { cause: "Stone <10mm\n(distal ureter)", tx: "Medical expulsive therapy (tamsulosin). Observe up to 4–6 wks. NSAIDs for pain.", color: ACCENT2 },
    { cause: "Stone >10mm\nor proximal", tx: "Ureteroscopy + holmium laser lithotripsy (break up stone).", color: ACCENT },
    { cause: "Large renal\nstones >2cm", tx: "PCNL (Percutaneous Nephrolithotomy) – go directly into kidney.", color: "8E44AD" },
    { cause: "Infected + obstructed\nstone", tx: "EMERGENCY: Drain first (PCN or stent) + IV antibiotics. Elective stone removal later.", color: RED },
    { cause: "Ureteral stricture\n(<1–2cm)", tx: "Endoscopic balloon dilation or endoureterotomy (incision).", color: ORANGE },
    { cause: "Long ureteral\nstricture", tx: "Ureteral reimplant / Boari flap / ileal ureter / autotransplantation.", color: "D35400" },
    { cause: "Retroperitoneal\nfibrosis", tx: "Steroids (prednisolone) + ureteral stenting. Ureterolysis + omentum wrapping if needed.", color: "16A085" },
    { cause: "Malignant\nobstruction", tx: "Metal ureteral stent (longer patency) or PCN. Treat underlying cancer.", color: "2C3E50" },
    { cause: "Pregnancy\n(symptomatic)", tx: "Hydration + safe analgesia first. JJ stent or PCN if fails. Avoid CT – use US.", color: "2980B9" },
  ];

  rows.forEach((row, i) => {
    const col = i % 3;
    const r = Math.floor(i / 3);
    const x = 0.35 + col * 3.2;
    const y = 0.9 + r * 1.5;

    s.addShape(pres.shapes.RECTANGLE, {
      x, y, w: 3.0, h: 1.4,
      fill: { color: LIGHT_BG }, line: { color: "C5D8EC" },
      shadow: { type: "outer", color: "000000", blur: 4, offset: 2, angle: 135, opacity: 0.08 }
    });
    s.addShape(pres.shapes.RECTANGLE, {
      x, y, w: 3.0, h: 0.38,
      fill: { color: row.color }, line: { color: row.color }
    });
    s.addText(row.cause, {
      x, y, w: 3.0, h: 0.38,
      fontSize: 10, bold: true, color: WHITE,
      align: "center", valign: "middle", margin: 0
    });
    s.addText(row.tx, {
      x: x + 0.1, y: y + 0.42, w: 2.8, h: 0.95,
      fontSize: 10, color: DARK_TEXT,
      align: "left", valign: "top"
    });
  });

  addBottomBar(s, "Management by Cause");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 13 – KEY POINTS SUMMARY TABLE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, WHITE);
  addTopBar(s, ACCENT);
  addSectionHeading(s, "Key Points Summary");

  const kp = [
    ["Obstruction definition", "Blockage that HARMS kidney function – dilation alone is NOT obstruction"],
    ["Most common site", "UPJ (Ureteropelvic Junction) – most common congenital site"],
    ["First imaging test", "Ultrasound – quick, no radiation, detects hydronephrosis"],
    ["Best functional test", "MAG-3 diuretic renography – t½ >20 min = obstructed"],
    ["UUO blood flow", "Increases 0–2 hrs (PGE2/NO), markedly declines after 5 hrs"],
    ["BUO blood flow", "Modest increase 2 hrs then PROFOUND fall – urgent risk"],
    ["Post-obstructive diuresis", "Replace ~half urine output/hr with 0.45% NS; monitor electrolytes"],
    ["Main fibrosis driver", "TGF-β1 (also: TNF-α, Angiotensin II, IL-18)"],
    ["Infected obstruction", "UROLOGICAL EMERGENCY – drain immediately (PCN preferred)"],
    ["Gold standard UPJ repair", "Dismembered pyeloplasty (laparoscopic/robotic) – success ~95%"],
    ["Stent vs. PCN", "PCN preferred in sepsis/unstable; stent for stable patients"],
    ["MET for stones", "Tamsulosin for stones ≤10mm – helps pass spontaneously"],
  ];

  // header
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.88, w: 4.6, h: 0.36,
    fill: { color: DARK_BG }, line: { color: DARK_BG }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.05, y: 0.88, w: 4.6, h: 0.36,
    fill: { color: DARK_BG }, line: { color: DARK_BG }
  });
  s.addText("TOPIC", {
    x: 0.35, y: 0.88, w: 4.6, h: 0.36,
    fontSize: 10, bold: true, color: ACCENT2,
    align: "center", valign: "middle", charSpacing: 2, margin: 0
  });
  s.addText("KEY POINT", {
    x: 5.05, y: 0.88, w: 4.6, h: 0.36,
    fontSize: 10, bold: true, color: ACCENT2,
    align: "center", valign: "middle", charSpacing: 2, margin: 0
  });

  kp.forEach((row, i) => {
    const y = 1.28 + i * 0.355;
    const bg = i % 2 === 0 ? LIGHT_BG : WHITE;
    const highlight = [8].includes(i); // emergency row
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.35, y, w: 4.6, h: 0.34,
      fill: { color: highlight ? "FEF9E7" : bg }, line: { color: "D5E8F5", pt: 0.5 }
    });
    s.addShape(pres.shapes.RECTANGLE, {
      x: 5.05, y, w: 4.6, h: 0.34,
      fill: { color: highlight ? "FEF9E7" : bg }, line: { color: "D5E8F5", pt: 0.5 }
    });
    s.addText(row[0], {
      x: 0.5, y, w: 4.3, h: 0.34,
      fontSize: 10.5, bold: true, color: highlight ? RED : ACCENT,
      align: "left", valign: "middle", margin: 0
    });
    s.addText(row[1], {
      x: 5.15, y, w: 4.4, h: 0.34,
      fontSize: 10, color: highlight ? RED : BODY_TEXT,
      align: "left", valign: "middle", margin: 0
    });
  });

  addBottomBar(s, "Key Points Summary");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 14 – CLOSING
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addSlideBg(s, DARK_BG);

  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: "100%", h: 0.55,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 5.08, w: "100%", h: 0.545,
    fill: { color: ACCENT2 }, line: { color: ACCENT2 }
  });

  s.addText("Management of Upper Urinary Tract Obstruction", {
    x: 0.5, y: 0.7, w: 9, h: 0.6,
    fontSize: 20, bold: true, color: WHITE, align: "center"
  });
  s.addText("Chapter 93 – Campbell Walsh Wein Urology", {
    x: 0.5, y: 1.3, w: 9, h: 0.4,
    fontSize: 13, color: ACCENT2, align: "center"
  });

  const takeaways = [
    "True obstruction = impaired drainage that damages kidney function",
    "Imaging: US → CT → MAG-3 renography for functional assessment",
    "Infected obstruction = urological emergency: drain FIRST",
    "Anderson-Hynes pyeloplasty is gold standard for UPJ obstruction",
    "Post-obstructive diuresis: replace ~50% urine output/hr",
    "Duration & completeness of obstruction determine recovery potential",
  ];

  s.addText("Take-Home Messages", {
    x: 1.5, y: 1.85, w: 7, h: 0.4,
    fontSize: 15, bold: true, color: ACCENT2, align: "center"
  });

  takeaways.forEach((t, i) => {
    s.addShape(pres.shapes.RECTANGLE, {
      x: 1.0, y: 2.32 + i * 0.42, w: 8.0, h: 0.38,
      fill: { color: "0A1B2E" }, line: { color: ACCENT, pt: 0.5 }
    });
    s.addShape(pres.shapes.RECTANGLE, {
      x: 1.0, y: 2.32 + i * 0.42, w: 0.28, h: 0.38,
      fill: { color: ACCENT }, line: { color: ACCENT }
    });
    s.addText(String(i + 1), {
      x: 1.0, y: 2.32 + i * 0.42, w: 0.28, h: 0.38,
      fontSize: 10, bold: true, color: WHITE,
      align: "center", valign: "middle", margin: 0
    });
    s.addText(t, {
      x: 1.34, y: 2.32 + i * 0.42, w: 7.55, h: 0.38,
      fontSize: 11, color: "C8DCF0",
      align: "left", valign: "middle", margin: 0
    });
  });

  s.addText("Source: Campbell Walsh Wein Urology, 12th Ed.", {
    x: 0, y: 5.08, w: 10, h: 0.545,
    fontSize: 12, bold: false, color: WHITE,
    align: "center", valign: "middle"
  });
}

// ── WRITE FILE ────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/uut-obstruction-pptx/UUT_Obstruction_Campbell_Ch93.pptx" })
  .then(() => console.log("SUCCESS: File written"))
  .catch(err => { console.error("ERROR:", err); process.exit(1); });
Running Command

cd /home/daytona/workspace/uut-obstruction-pptx && node create_pptx.js 2>&1

Running Command

ls -lh /home/daytona/workspace/uut-obstruction-pptx/

Your presentation is ready! Here's the download link:

UUT Obstruction Campbell Ch93

Presentation · PPTX


What's inside (14 slides, navy/blue theme):
SlideContent
1Title slide
2Chapter overview / agenda
3Definition & Prevalence + 4 common obstruction sites
4Clinical Presentation – Adults vs. Children
5Diagnosis & Imaging (lab studies + imaging table with workflow)
6Pathological Changes – mature vs. developing kidney + fibrosis mediators
7Hemodynamic changes (UUO timeline, BUO, post-obstructive diuresis)
8Recovery of Renal Function (visual bar chart by duration)
9Causes – Intrinsic vs. Extrinsic
10Management Principles – goals, emergency criteria, stent vs. PCN
11UPJ Obstruction – Observation, Pyeloplasty, Endopyelotomy, MET
12Management by specific cause (9 condition cards)
13Key Points Summary table (12 rows)
14Closing slide with 6 take-home messages
This is a shared conversation. Sign in to Orris to start your own chat.