explain in a detailed way, definition, causative organisms, mode of transmission, symptoms, ethiology, pathogenesis and treatment, compilation and prevention of urinary tract infection from basic to advanced with suitable examples

Reading File
Finding Sources
Finding Sources
Searching PubMed

"urinary tract infection"[MeSH Terms] AND "treatment"[MeSH Terms]

Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Loading Image
Reading File
Reading File
Finding Sources
Reading File
Reading File
Loading Image
I now have extensive, comprehensive data from multiple authoritative textbooks. Let me compile the full detailed answer.

Urinary Tract Infection (UTI): A Comprehensive Guide from Basic to Advanced


1. DEFINITION

A urinary tract infection (UTI) is a microbial infection affecting any part of the urinary tract - kidneys, ureters, urinary bladder, or urethra. Microbiologically, it is defined as growth of ≥10⁵ (100,000) colony-forming organisms per milliliter (CFU/mL) from a properly collected midstream clean-catch urine specimen, in the presence of clinical symptoms.
Classification by anatomical site:
LevelConditionStructures Involved
Lower UTICystitisUrinary bladder
Lower UTIUrethritisUrethra
Lower UTIProstatitisProstate gland (males)
Upper UTIPyelonephritisRenal pelvis + parenchyma
Upper UTIPyonephrosisKidney + collecting system with pus
Uncomplicated vs. Complicated:
  • Uncomplicated UTI - occurs in a structurally and functionally normal urinary tract (e.g., healthy young non-pregnant woman with cystitis)
  • Complicated UTI - occurs in the setting of structural/functional abnormalities, indwelling catheters, immunosuppression, pregnancy, diabetes, renal failure, obstruction, or multidrug-resistant organisms
Berek & Novak's Gynecology defines UTI as growth of 10⁵ organisms/mL from a voided urine specimen, with most infections caused by coliform bacteria.

2. CAUSATIVE ORGANISMS (ETIOLOGY)

A. Gram-Negative Bacteria (most common)

OrganismUncomplicated UTIComplicated UTINotes
Escherichia coli70-95%21-54%#1 cause overall; has P-fimbriae, type 1 fimbriae, hemolysin
Proteus mirabilis1-2%1-10%Urease producer; causes struvite stones; raises urine pH
Klebsiella spp.1-2%2-17%Common in hospitalized patients
Citrobacter spp.<1%~5%Healthcare-associated
Enterobacter spp.<1%2-10%Often multidrug-resistant
Pseudomonas aeruginosa<1%2-19%Complicated/catheter-associated UTIs

B. Gram-Positive Bacteria

OrganismFrequencyNotes
Staphylococcus saprophyticus5-20%+ (uncomplicated)Young sexually active females; coagulase-negative
Enterococcus faecalis1-2% (uncomplicated)More common in complicated/nosocomial UTI
Staphylococcus aureusRareUsually hematogenous route

C. Fungi and Others

  • Candida spp. - increasing proportion, especially in ICU patients, those on broad-spectrum antibiotics, immunosuppressed patients
  • Chlamydia trachomatis, Neisseria gonorrhoeae - cause urethritis, must be differentiated from cystitis
Key rule: Patients with chronic conditions (spinal cord injury, neurogenic bladder) are more likely to have polymicrobial and multidrug-resistant infections.
Source: Comprehensive Clinical Nephrology, 7th Edition, Table 53.2

3. MODE OF TRANSMISSION

There are two main routes by which bacteria reach the urinary tract:

Route 1: Ascending Infection (Most Common ~95% of cases)

This is the dominant pathway, illustrated in the diagram below:
Pathways of renal infection showing ascending route via bladder, vesicoureteral reflux, intrarenal reflux to pyelonephritis (left) and hematogenous spread from bacteremia (right)
Step-by-step ascending pathway:
  1. Enteric bacteria (predominantly E. coli from the rectum) colonize the perineum and distal urethra
  2. In females, the short urethra (4 cm) and proximity to the anus facilitate colonization of the introitus
  3. Bacteria adhere to mucosal surfaces via fimbriae (pili) and ascend to the bladder
  4. This is facilitated by instrumentation (catheterization, cystoscopy), sexual intercourse, trauma
  5. From the bladder, bacteria ascend via the ureters (especially when vesicoureteral reflux exists) to the renal pelvis and parenchyma

Route 2: Hematogenous (Descending) Spread (Less Common ~5%)

  • Bacteremia seeds the kidneys from the bloodstream
  • Common agents: Staphylococcus aureus (from endocarditis), E. coli (from sepsis)
  • Creates discrete foci of pyelonephritis scattered through renal cortex

Route 3: Direct/Lymphatic (Rare)

  • Direct spread from adjacent pelvic organs (e.g., Crohn's disease fistula, pelvic abscess)
Why women are more susceptible:
  • Shorter urethra (4 cm vs. 20 cm in males)
  • Proximity of urethral meatus to vagina and anus
  • Loss of estrogen in postmenopausal women reduces lactobacilli colonization that normally acidifies the vaginal environment
  • Sexual intercourse mechanically pushes bacteria into the urethra

4. RISK FACTORS (PREDISPOSING FACTORS)

Host Determinants:
CategoryFactors
BehavioralSexual intercourse (especially new partners), use of spermicides (kills Lactobacillus), recent antibiotic use, suboptimal voiding habits
GeneticNon-secretor of ABO blood group antigens (bacteria adhere more easily), P1 blood group phenotype, reduced CXCR1 expression, previous history of recurrent cystitis
BiologicEstrogen deficiency (postmenopausal), glycosuria (diabetes, SGLT-2 inhibitors), pregnancy, urinary obstruction (BPH, stones, tumors)
StructuralVesicoureteral reflux (VUR), urethral stricture, posterior urethral valves, neurogenic bladder, indwelling catheter, nephrostomy tubes, ureteral stents
SystemicDiabetes mellitus, immunosuppression, renal transplant, spinal cord injury
Source: Comprehensive Clinical Nephrology, 7th Edition, Table 53.1

5. PATHOGENESIS (Mechanism of Disease)

Step 1: Bacterial Colonization and Adhesion

Uropathogenic E. coli (UPEC) is the paradigm for UTI pathogenesis. It possesses specific virulence factors:
  • Type 1 fimbriae (mannose-sensitive) - bind to uroplakin on bladder urothelium; trigger invasion into superficial umbrella cells
  • P-fimbriae (pili; mannose-resistant) - bind to Gal-Gal (globoside) receptors on uroepithelium and renal tubules; major virulence factor for pyelonephritis
  • S-fimbriae and Dr fimbriae - bind to additional urothelial receptors
  • Hemolysin (HlyA) - pore-forming toxin; lyses RBCs and host cells, releasing iron and nutrients
  • Aerobactin (siderophore) - scavenges iron from host; required for survival in iron-poor urine
  • Serum resistance - lipopolysaccharide (LPS) capsule resists complement-mediated killing

Step 2: Intracellular Bacterial Communities (IBCs)

Once UPEC binds to bladder umbrella cells via type 1 fimbriae, it:
  1. Invades the urothelial cells
  2. Replicates rapidly inside to form intracellular bacterial communities (IBCs) or "pods" - biofilm-like structures that protect bacteria from antibiotics and immune cells
  3. These IBCs can persist as quiescent intracellular reservoirs (QIRs) and re-emerge to cause recurrent infections

Step 3: Host Defense Failure

Normally, the bladder is sterile because of:
  • Periodic voiding - flushing mechanism removes bacteria
  • Urine properties - high osmolality, low pH, high urea, Tamm-Horsfall protein (uromodulin) which traps bacteria
  • Bladder mucosa - produces antimicrobial peptides (defensins), IgA secretion
  • Innate immune response - TLR4 on urothelium senses LPS; triggers IL-8 release, recruiting neutrophils
When outflow obstruction (BPH, calculi, pregnancy) or bladder dysfunction produces urinary stasis, bacteria multiply without being flushed out.

Step 4: Spread to Upper Tract (Pyelonephritis)

Bacteria from the bladder ascend to the kidney via two critical mechanisms:
  • Vesicoureteral reflux (VUR) - incompetent ureterovesical valve (present in 20-40% of children with UTI) allows bacteria to be propelled up the ureter
  • Intrarenal reflux - infected urine enters the renal papillae and parenchyma
In the kidney, bacteria trigger suppurative inflammation: neutrophil infiltration of tubules and interstitium, with formation of discrete yellowish abscesses on the renal surface.

6. SYMPTOMS AND CLINICAL FEATURES

Lower UTI (Cystitis/Urethritis)

SymptomDescription
DysuriaBurning or pain on urination (most common complaint)
FrequencyNeed to urinate more often than usual
UrgencySudden, compelling need to void
Suprapubic pain/pressureDiscomfort in lower abdomen over the bladder
HematuriaBlood in urine (frank or microscopic)
Cloudy/malodorous urineDue to pyuria and bacterial metabolites
NocturiaWaking at night to urinate
Note: Systemic symptoms (fever, chills) are absent in uncomplicated cystitis - their presence should raise suspicion for upper tract involvement.

Upper UTI (Acute Pyelonephritis)

  • Sudden onset of fever (often >38.5°C) with rigors and chills
  • Costovertebral angle (CVA) tenderness - flank pain at the loin
  • Nausea and vomiting
  • Malaise and headache
  • Lower urinary tract symptoms may co-exist (dysuria, frequency)
  • Turbid urine with pyuria (WBC casts are pathognomonic)
  • Right-sided symptoms predominate in pregnancy (mechanical pressure on right ureter)

Special Populations

PopulationSpecial Features
Neonates/infantsNonspecific: fever, vomiting, failure to thrive, irritability, jaundice
ElderlyOften atypical: confusion, falls, delirium - without dysuria
Pregnant womenAsymptomatic bacteriuria can progress to pyelonephritis; risk of preterm labor
MenUTI is uncommon; consider prostatitis, structural abnormality
Catheterized patientsMay be asymptomatic (CAUTI); diagnosis requires symptoms + positive culture

7. DIAGNOSIS (Laboratory and Investigations)

Urinalysis (dipstick)

  • Nitrite positive - indicates gram-negative bacteria (reduce urinary nitrates to nitrites)
  • Leukocyte esterase positive - indicates pyuria (WBCs > 5/hpf)
  • Hematuria (frank or microscopic)
  • Protein - may be present with upper tract involvement

Urine Microscopy

  • Pyuria (>5 WBC/hpf) - most sensitive finding
  • WBC casts - pathognomonic for pyelonephritis
  • Bacteriuria on unspun urine smear

Urine Culture (Gold Standard)

  • ≥10⁵ CFU/mL from midstream clean-catch = significant bacteriuria
  • Culture + sensitivity to guide antibiotic choice
  • Lower counts (10²-10⁴) may be significant in symptomatic patients or catheter specimens

Blood Tests (for upper UTI)

  • CBC: leukocytosis with neutrophilia
  • CRP, procalcitonin: elevated
  • Blood cultures: if sepsis suspected

Imaging

  • Ultrasound - first-line; detects obstruction, hydronephrosis, abscess, stones
  • CT scan (non-contrast) - best for detecting calculi; contrast CT for abscess/perinephric involvement
  • VCUG (voiding cystourethrogram) - detects VUR in children
  • Technetium DMSA scan - detects renal cortical scarring from chronic pyelonephritis

8. TREATMENT

Uncomplicated Lower UTI (Cystitis) - Standard Regimens

AntimicrobialOral DoseDurationNotes
Trimethoprim-sulfamethoxazole (TMP-SMX)160/800 mg twice daily3 daysAvoid if local resistance >20%
Nitrofurantoin (macrocrystals)100 mg twice daily5 daysAvoid if eGFR <45 mL/min/1.73m²; inactive against Proteus, Pseudomonas
Fosfomycin3 g as single dose1 dayActive against MDR organisms; reserve for when first-line fails
Fluoroquinolones (ciprofloxacin, levofloxacin) should NOT be used as first-line for uncomplicated cystitis - reserve for complicated or severe infections requiring renal/prostate penetration.

Acute Pyelonephritis

Outpatient (mild-moderate, no vomiting):
  • Ciprofloxacin 500 mg orally twice daily x 7 days, OR
  • TMP-SMX 160/800 mg twice daily x 14 days (if susceptible)
  • Levofloxacin 750 mg once daily x 5 days
Inpatient (severe, vomiting, sepsis, pregnancy):
  • IV ciprofloxacin 400 mg q8-12h
  • IV ceftriaxone 1-2 g daily
  • Aminoglycosides (gentamicin, amikacin) - excellent urinary concentrations
  • Anti-pseudomonal agents for complicated/ICU cases: piperacillin-tazobactam, meropenem, ceftazidime-avibactam
Duration: 7-10 days for most; up to 14 days for severe pyelonephritis; 4-6 weeks if renal abscess present

Complicated UTI (including catheter-associated)

  • Broader-spectrum empirical coverage based on local antibiogram
  • Remove or replace indwelling catheter when possible
  • For Pseudomonas: ciprofloxacin IV 400 mg q8h, amikacin 15 mg/kg/day, antipseudomonal beta-lactams
  • Newer agents for MDR organisms: ceftazidime-avibactam, ceftolozane-tazobactam, cefiderocol, imipenem-cilastatin-relebactam

Pregnancy

  • 7-10 days course of safe antibiotics
  • Safe choices: cephalosporins (cephalexin 500 mg BID), nitrofurantoin 100 mg BID (avoid 3rd trimester - risk of neonatal hemolysis), amoxicillin 500 mg TID
  • TMP-SMX allowed 1st/2nd trimester only; contraindicated in 3rd trimester
  • Pyelonephritis in pregnancy: IV antibiotics + hospitalization due to risk of maternal sepsis and preterm labor

Recurrent UTI

  • Prophylaxis (≥3 episodes/year): low-dose trimethoprim or nitrofurantoin nightly
  • Post-coital prophylaxis: single-dose antibiotic after intercourse
  • Cranberry products: some evidence for reducing recurrence (proanthocyanidins inhibit bacterial adhesion)
  • Vaginal estrogen: postmenopausal women to restore Lactobacillus colonization

9. COMPLICATIONS

Short-term Complications

ComplicationDescription
Acute pyelonephritisUntreated cystitis ascending to upper tract
Septicemia/UrosepsisBacteria enter bloodstream; gram-negative sepsis with endotoxin release; life-threatening
Perinephric abscessPus collection around the kidney; requires drainage
Renal abscess (intrarenal)Liquefaction necrosis within renal parenchyma; requires CT-guided drainage
PyonephrosisPus fills the entire collecting system when obstruction is prominent

Long-term / Chronic Complications

ComplicationDescription
Chronic pyelonephritisRepeated infections → recurrent renal inflammation → coarse, irregular corticomedullary scars overlying dilated, blunted calyces → progressive CKD
Papillary necrosisIschemic/suppurative necrosis of renal papillae; seen especially in diabetes + obstruction + sickle cell anemia
Emphysematous pyelonephritis/cystitisGas-forming infection of renal parenchyma/bladder; almost exclusively in diabetics; surgical emergency
Xanthogranulomatous pyelonephritisChronic infection with lipid-laden foamy macrophages; usually with Proteus or E. coli; mimics renal cell carcinoma on imaging
Renal failureBilateral severe chronic pyelonephritis → end-stage renal disease
HypertensionRenal scarring activates renin-angiotensin-aldosterone system
In pregnancyPreterm labor, low birth weight, maternal sepsis, permanent renal injury
VUR nephropathyIn children: VUR + recurrent UTI → reflux nephropathy → stunted kidney growth
The image below shows papillary necrosis (left: gross hemorrhagic necrosis of papillae, arrows) and pyonephrosis (right: tubules filled with pus casts):
Acute pyelonephritis - papillary necrosis (gross hemorrhagic necrosis of papillae, left) and histology showing tubular pus (right)

10. PREVENTION

Non-pharmacological Measures

MeasureRationale
Adequate fluid intake (>1.5-2 L/day)Maintains urinary flow and flushes bacteria before they establish infection
Void frequently; do not delay urinationReduces bacterial multiplication time in bladder
Post-coital voidingFlushes bacteria introduced during intercourse
Wipe front-to-back (females)Prevents fecal flora from reaching urethra
Avoid spermicides and diaphragmSpermicides kill protective Lactobacillus; alter vaginal flora
Adequate perineal hygieneReduce periurethral bacterial burden
Minimize catheter useRemove urinary catheters as soon as clinically possible
Cranberry productsProanthocyanidins block type 1 fimbriae-mediated adhesion of E. coli to urothelium
Probiotic Lactobacillus preparationsRestore vaginal flora; especially in recurrent UTI

Pharmacological Prevention

  • Antibiotic prophylaxis (low-dose nightly trimethoprim or nitrofurantoin) for recurrent UTI (≥3/yr) - nitrofurantoin must be avoided if eGFR <45 mL/min/1.73m²
  • Post-coital antibiotic (single dose TMP-SMX or nitrofurantoin) for women with coitus-related recurrent UTI
  • Vaginal estrogen cream (postmenopausal women) - restores Lactobacillus dominance, lowers vaginal pH, reduces E. coli colonization
  • Perioperative prophylaxis in gynecologic/urologic surgery: a single perioperative dose reduces postoperative UTI from 40% to as low as 4%
  • Intravesical BCG or other immunomodulators are under investigation for recurrent UTI

In Children with Anatomic Abnormalities

  • Prophylactic antibiotics for children with high-grade VUR (grades 3-5) to prevent renal scarring
  • Surgical correction of VUR (ureteral reimplantation) in refractory cases
  • Circumcision reduces UTI risk in male infants with high-grade hydronephrosis

Hospital Infection Control (CAUTI Prevention)

  • Strict aseptic technique during catheter insertion
  • Use of closed drainage systems
  • Minimize catheter dwell time
  • Catheter bundles and surveillance programs
  • Silver-coated or antibiotic-impregnated catheters (limited evidence for long-term use)

Summary Table

FeatureLower UTI (Cystitis)Upper UTI (Pyelonephritis)
Main organismE. coliE. coli, Proteus, Klebsiella
RouteAscendingAscending ± hematogenous
Key symptomsDysuria, frequency, urgencyFever, flank pain, chills + lower tract symptoms
Systemic signsAbsentPresent (fever, sepsis possible)
Urine findingsPyuria, bacteriuria, nitritesPyuria, WBC casts, bacteriuria
Treatment3-5 day oral course7-14 days; IV if severe
First-line drugTMP-SMX or nitrofurantoinFluoroquinolone or 3rd-gen cephalosporin
Key complicationPyelonephritisRenal scarring, sepsis, papillary necrosis

Sources

  • Robbins & Kumar Basic Pathology (Robbins Pathology) - Pathogenesis, morphology, acute/chronic pyelonephritis
  • Comprehensive Clinical Nephrology, 7th Edition - Etiology table, virulence factors, clinical syndromes, treatment
  • Rosen's Emergency Medicine: Concepts and Clinical Practice - UTI in pregnancy, antibiotic tables, treatment regimens
  • Berek & Novak's Gynecology - Definition, postoperative UTI, prophylaxis
  • Campbell-Walsh-Wein Urology - Pediatric UTI, VUR, prenatal hydronephrosis risk
  • Goldman-Cecil Medicine - Pseudomonas UTI treatment, complicated UTI management

Generate a presentation on UTI pathogenesis and virulence factors for medical students

Reading File
Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/uti-presentation && ls /home/daytona/workspace/uti-presentation/

Running Command

node /home/daytona/skills/shared/scripts/fetch_images.js "https://cdn.orris.care/cdss_images/d84b872e9c3821532caedd57a597ba486318b2f478b0d401e5a8e08ff47db866.png" "https://cdn.orris.care/cdss_images/08ed2dff2bab31de4494ac2aaeed8e20cb7ba0483a0a6e8ae7ca0e1104435737.png" 2>/dev/null | node -e "const d=require('fs');const j=JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));j.forEach((x,i)=>d.writeFileSync('/home/daytona/workspace/uti-presentation/img'+i+'.b64',x.base64||''));console.log(j.map(x=>x.error||'OK'))"

Writing File

~/uti-presentation/build.js

const pptxgen = require("pptxgenjs");
const fs = require("fs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "UTI Pathogenesis & Virulence Factors";
pres.author = "Medical Education";

// ─── COLOR PALETTE ────────────────────────────────────────────────
// Deep navy dominant, steel-blue secondary, amber/orange accent
const C = {
  navy:      "0D1B2A",   // dominant background
  navyMid:   "1B2D40",   // card / panel background
  steel:     "1E6091",   // secondary blue
  steelLight:"2980B9",
  accent:    "E67E22",   // amber accent
  accentLight:"F39C12",
  green:     "27AE60",
  red:       "E74C3C",
  white:     "FFFFFF",
  offWhite:  "ECF0F1",
  lightGray: "BDC3C7",
  midGray:   "7F8C8D",
  darkGray:  "2C3E50",
};

// ─── LOAD IMAGES ─────────────────────────────────────────────────
const pathwayImg = fs.readFileSync("/home/daytona/workspace/uti-presentation/img0.b64", "utf8");
const pyeloImg   = fs.readFileSync("/home/daytona/workspace/uti-presentation/img1.b64", "utf8");

// ─── HELPER FUNCTIONS ─────────────────────────────────────────────
function darkSlide(slide, withAccentBar = true) {
  slide.background = { color: C.navy };
  if (withAccentBar) {
    slide.addShape(pres.shapes.RECTANGLE, {
      x: 0, y: 5.25, w: 10, h: 0.375,
      fill: { color: C.steel }, line: { color: C.steel }
    });
  }
}

function slideTitle(slide, text, y = 0.22, color = C.accent) {
  slide.addText(text.toUpperCase(), {
    x: 0.45, y, w: 9.1, h: 0.5,
    fontSize: 14, bold: true, color,
    charSpacing: 3, margin: 0,
    fontFace: "Calibri"
  });
  // accent underline
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0.45, y: y + 0.5, w: 1.2, h: 0.04,
    fill: { color: C.accent }, line: { color: C.accent }
  });
}

function card(slide, x, y, w, h, fillColor = C.navyMid, radius = false) {
  slide.addShape(radius ? pres.shapes.ROUNDED_RECTANGLE : pres.shapes.RECTANGLE, {
    x, y, w, h,
    fill: { color: fillColor },
    line: { color: C.steel, pt: 0.75 },
    shadow: { type: "outer", color: "000000", blur: 8, offset: 2, angle: 135, opacity: 0.25 },
    ...(radius ? { rectRadius: 0.12 } : {})
  });
}

function stepBox(slide, x, y, w, h, number, title, body, numColor = C.accent) {
  card(slide, x, y, w, h, C.navyMid);
  // number badge
  slide.addShape(pres.shapes.ELLIPSE, {
    x: x + 0.15, y: y + 0.15, w: 0.45, h: 0.45,
    fill: { color: numColor }, line: { color: numColor }
  });
  slide.addText(String(number), {
    x: x + 0.15, y: y + 0.12, w: 0.45, h: 0.45,
    fontSize: 13, bold: true, color: C.white,
    align: "center", valign: "middle", margin: 0
  });
  // title
  slide.addText(title, {
    x: x + 0.7, y: y + 0.14, w: w - 0.85, h: 0.32,
    fontSize: 11, bold: true, color: C.accent, margin: 0
  });
  // body
  slide.addText(body, {
    x: x + 0.18, y: y + 0.55, w: w - 0.35, h: h - 0.65,
    fontSize: 9.5, color: C.offWhite, margin: 0,
    wrap: true
  });
}

function pill(slide, x, y, w, h, text, fillColor = C.steel, textColor = C.white, fontSize = 9.5) {
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x, y, w, h,
    fill: { color: fillColor }, line: { color: fillColor },
    rectRadius: 0.12
  });
  slide.addText(text, {
    x, y, w, h,
    fontSize, bold: true, color: textColor,
    align: "center", valign: "middle", margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE SLIDE
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.navy };

  // top accent stripe
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 0.08,
    fill: { color: C.accent }, line: { color: C.accent }
  });

  // large left panel
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0.08, w: 6.5, h: 5.545,
    fill: { color: C.navyMid }, line: { color: C.navyMid }
  });

  // vertical accent bar
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.38, y: 1.1, w: 0.07, h: 3.0,
    fill: { color: C.accent }, line: { color: C.accent }
  });

  // main title
  s.addText("URINARY TRACT", {
    x: 0.6, y: 1.1, w: 5.6, h: 0.75,
    fontSize: 38, bold: true, color: C.white,
    fontFace: "Calibri", margin: 0
  });
  s.addText("INFECTION", {
    x: 0.6, y: 1.82, w: 5.6, h: 0.75,
    fontSize: 38, bold: true, color: C.accent,
    fontFace: "Calibri", margin: 0
  });

  s.addText("Pathogenesis & Virulence Factors", {
    x: 0.6, y: 2.7, w: 5.6, h: 0.45,
    fontSize: 17, bold: false, color: C.lightGray,
    fontFace: "Calibri", margin: 0
  });

  // divider line
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.6, y: 3.25, w: 3.5, h: 0.04,
    fill: { color: C.steel }, line: { color: C.steel }
  });

  s.addText("For Medical Students — Basic to Advanced", {
    x: 0.6, y: 3.4, w: 5.6, h: 0.35,
    fontSize: 11, color: C.midGray, fontFace: "Calibri", margin: 0
  });

  // right side info boxes
  const rightX = 6.8;
  const topics = [
    "Definition & Classification",
    "Host Defense Mechanisms",
    "Virulence Factors of UPEC",
    "Ascending Pathogenesis",
    "Intracellular Bacterial Communities",
    "Complications & Clinical Outcomes",
  ];
  topics.forEach((t, i) => {
    const yPos = 0.7 + i * 0.75;
    s.addShape(pres.shapes.RECTANGLE, {
      x: rightX, y: yPos, w: 2.9, h: 0.55,
      fill: { color: C.steel, transparency: 60 },
      line: { color: C.steelLight, pt: 0.5 }
    });
    s.addShape(pres.shapes.RECTANGLE, {
      x: rightX, y: yPos, w: 0.06, h: 0.55,
      fill: { color: C.accent }, line: { color: C.accent }
    });
    s.addText(t, {
      x: rightX + 0.15, y: yPos, w: 2.7, h: 0.55,
      fontSize: 9, color: C.offWhite, valign: "middle", margin: 0
    });
  });

  // bottom bar
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 5.375, w: 10, h: 0.25,
    fill: { color: C.steel }, line: { color: C.steel }
  });
  s.addText("Sources: Robbins & Kumar Basic Pathology  |  Comprehensive Clinical Nephrology 7e  |  Campbell-Walsh-Wein Urology", {
    x: 0.3, y: 5.375, w: 9.4, h: 0.25,
    fontSize: 7, color: C.lightGray, valign: "middle", margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 2 — OVERVIEW / TABLE OF CONTENTS
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  slideTitle(s, "Learning Objectives");

  const objectives = [
    ["1", "Define UTI and classify by anatomical site and severity"],
    ["2", "Describe the normal host defense mechanisms of the urinary tract"],
    ["3", "Explain the virulence factors of uropathogenic E. coli (UPEC)"],
    ["4", "Trace the step-by-step ascending pathogenesis from colonization to pyelonephritis"],
    ["5", "Describe intracellular bacterial communities (IBCs) and recurrence mechanisms"],
    ["6", "Identify risk factors, predisposing conditions, and complications"],
  ];

  objectives.forEach(([num, text], i) => {
    const row = Math.floor(i / 2);
    const col = i % 2;
    const x = 0.45 + col * 4.85;
    const y = 0.95 + row * 1.42;
    card(s, x, y, 4.6, 1.22, C.navyMid);
    // circle number
    s.addShape(pres.shapes.ELLIPSE, {
      x: x + 0.18, y: y + 0.35, w: 0.52, h: 0.52,
      fill: { color: C.accent }, line: { color: C.accent }
    });
    s.addText(num, {
      x: x + 0.18, y: y + 0.33, w: 0.52, h: 0.52,
      fontSize: 14, bold: true, color: C.white,
      align: "center", valign: "middle", margin: 0
    });
    s.addText(text, {
      x: x + 0.82, y: y + 0.2, w: 3.62, h: 0.82,
      fontSize: 10.5, color: C.offWhite, valign: "middle",
      wrap: true, margin: 0
    });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 3 — DEFINITION & CLASSIFICATION
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  slideTitle(s, "Definition & Classification");

  // Definition box
  card(s, 0.45, 0.95, 9.1, 1.05, C.steel);
  s.addText("DEFINITION", {
    x: 0.65, y: 0.98, w: 1.5, h: 0.3,
    fontSize: 8.5, bold: true, color: C.accent, charSpacing: 2, margin: 0
  });
  s.addText("Microbial infection of any part of the urinary tract. Microbiologically defined as ≥10⁵ CFU/mL from a midstream clean-catch urine specimen with clinical symptoms.", {
    x: 0.65, y: 1.28, w: 8.7, h: 0.58,
    fontSize: 11, color: C.white, margin: 0
  });

  // Classification — 2 columns
  // Left: by site
  card(s, 0.45, 2.15, 4.4, 3.0, C.navyMid);
  s.addText("BY ANATOMICAL SITE", {
    x: 0.65, y: 2.22, w: 4.0, h: 0.28,
    fontSize: 9, bold: true, color: C.accent, charSpacing: 1.5, margin: 0
  });
  const siteRows = [
    { label: "Urethritis", sub: "Urethra — often STI-related", color: C.steelLight },
    { label: "Cystitis", sub: "Bladder — most common", color: C.steelLight },
    { label: "Prostatitis", sub: "Prostate (males)", color: C.steelLight },
    { label: "Pyelonephritis", sub: "Renal pelvis + parenchyma", color: C.accent },
    { label: "Pyonephrosis", sub: "Collecting system filled with pus", color: C.accent },
  ];
  siteRows.forEach((r, i) => {
    const yRow = 2.6 + i * 0.5;
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.65, y: yRow, w: 0.06, h: 0.32,
      fill: { color: r.color }, line: { color: r.color }
    });
    s.addText(r.label, {
      x: 0.82, y: yRow, w: 1.5, h: 0.32,
      fontSize: 10, bold: true, color: C.white, valign: "middle", margin: 0
    });
    s.addText(r.sub, {
      x: 2.32, y: yRow, w: 2.3, h: 0.32,
      fontSize: 9, color: C.lightGray, valign: "middle", margin: 0
    });
  });

  // Right: uncomplicated vs complicated
  card(s, 5.05, 2.15, 4.4, 3.0, C.navyMid);
  s.addText("UNCOMPLICATED vs COMPLICATED", {
    x: 5.22, y: 2.22, w: 4.1, h: 0.28,
    fontSize: 9, bold: true, color: C.accent, charSpacing: 1.0, margin: 0
  });

  // Uncomplicated
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.22, y: 2.6, w: 3.9, h: 0.78,
    fill: { color: C.green, transparency: 75 }, line: { color: C.green, pt: 0.5 }
  });
  s.addText("UNCOMPLICATED", {
    x: 5.32, y: 2.64, w: 3.7, h: 0.22,
    fontSize: 9, bold: true, color: C.green, margin: 0
  });
  s.addText("Normal urinary tract, non-pregnant, no structural/functional abnormality\nExample: Young healthy woman with simple cystitis", {
    x: 5.32, y: 2.84, w: 3.7, h: 0.48,
    fontSize: 8.5, color: C.offWhite, margin: 0, wrap: true
  });

  // Complicated
  s.addShape(pres.shapes.RECTANGLE, {
    x: 5.22, y: 3.52, w: 3.9, h: 1.45,
    fill: { color: C.red, transparency: 80 }, line: { color: C.red, pt: 0.5 }
  });
  s.addText("COMPLICATED", {
    x: 5.32, y: 3.55, w: 3.7, h: 0.22,
    fontSize: 9, bold: true, color: C.red, margin: 0
  });
  const compFeatures = [
    "Structural/functional urinary tract abnormality",
    "Indwelling catheter, stent, or nephrostomy tube",
    "Poorly controlled diabetes or immunosuppression",
    "Pregnancy, renal failure, recent hospitalization",
    "Multidrug-resistant organisms",
  ];
  s.addText(compFeatures.map(f => "• " + f).join("\n"), {
    x: 5.32, y: 3.78, w: 3.7, h: 1.12,
    fontSize: 8.5, color: C.offWhite, margin: 0, wrap: true
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 4 — HOST DEFENSE MECHANISMS
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  slideTitle(s, "Normal Host Defense Mechanisms");

  s.addText("The urinary tract has multiple barriers against infection. UTI occurs when these defenses are overwhelmed.", {
    x: 0.45, y: 0.92, w: 9.1, h: 0.4,
    fontSize: 10.5, color: C.lightGray, margin: 0, italic: true
  });

  const defenses = [
    { icon: "🚿", title: "Urinary Flow & Voiding", body: "Periodic voiding flushes bacteria before they can establish infection. Urinary stasis (obstruction, neurogenic bladder) removes this flushing mechanism and favors bacterial multiplication.", color: C.steelLight },
    { icon: "🔬", title: "Urine Properties", body: "High osmolality, low pH, high urea concentration, and organic acids create a hostile environment. Tamm-Horsfall protein (uromodulin) secreted by loop of Henle binds type 1 fimbriae, trapping bacteria.", color: C.steelLight },
    { icon: "🛡️", title: "Bladder Mucosa", body: "Urothelial cells produce antimicrobial peptides (defensins) and secrete secretory IgA. TLR4 on urothelium detects LPS and triggers IL-8 release to recruit neutrophils.", color: C.steelLight },
    { icon: "⚗️", title: "Prostatic Secretions (Males)", body: "Prostatic fluid contains zinc and other antimicrobials. The longer male urethra (20 cm vs 4 cm female) and drier periurethral environment provide added protection.", color: C.green },
    { icon: "🦠", title: "Normal Vaginal Flora", body: "Lactobacillus species colonize the vaginal mucosa, maintain low pH (~4.5) and produce H₂O₂ that inhibits E. coli. Spermicide use and estrogen deficiency disrupt this protective flora.", color: C.green },
    { icon: "🧬", title: "Innate Immune System", body: "Complement activation, neutrophil recruitment, and cytokine cascades (IL-6, IL-8, TNF-α) rapidly respond to bacterial LPS. CXCR1 receptor on neutrophils is important — reduced expression → recurrent UTI.", color: C.accent },
  ];

  defenses.forEach((d, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.45 + col * 3.12;
    const y = 1.42 + row * 1.85;
    card(s, x, y, 3.0, 1.68, C.navyMid);
    s.addShape(pres.shapes.RECTANGLE, {
      x, y, w: 3.0, h: 0.08,
      fill: { color: d.color }, line: { color: d.color }
    });
    s.addText(d.icon + "  " + d.title, {
      x: x + 0.15, y: y + 0.14, w: 2.75, h: 0.38,
      fontSize: 10, bold: true, color: C.white, margin: 0
    });
    s.addText(d.body, {
      x: x + 0.15, y: y + 0.55, w: 2.75, h: 1.05,
      fontSize: 8.5, color: C.offWhite, margin: 0, wrap: true
    });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 5 — VIRULENCE FACTORS OF UPEC (visual table)
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  slideTitle(s, "Virulence Factors of Uropathogenic E. coli (UPEC)");

  s.addText("UPEC accounts for 70–95% of uncomplicated UTIs. Its pathogenicity depends on a suite of specialized virulence factors:", {
    x: 0.45, y: 0.92, w: 9.1, h: 0.4,
    fontSize: 10, color: C.lightGray, italic: true, margin: 0
  });

  const factors = [
    { name: "Type 1 Fimbriae\n(Mannose-Sensitive)", mech: "Bind uroplakin Ia/Ib on umbrella cells", outcome: "Triggers invasion into urothelial cells → IBC formation", role: "Adhesion / Invasion" },
    { name: "P-Fimbriae\n(Mannose-Resistant)", mech: "Bind Gal-Gal (globoside) receptors on urothelium + renal tubules", outcome: "Critical for upper tract ascent → PYELONEPHRITIS", role: "Upper tract virulence" },
    { name: "S-Fimbriae &\nDr Fimbriae", mech: "Bind sialoglycoprotein & Dr blood group antigen on kidney cells", outcome: "Bind to Bowman's capsule — associated with recurrent cystitis in pregnancy", role: "Adhesion" },
    { name: "Hemolysin (HlyA)", mech: "Pore-forming toxin — inserts into host cell membranes", outcome: "Lyses RBCs and urothelial cells → releases iron, nutrients & damages vasculature", role: "Cytotoxin / Iron acquisition" },
    { name: "Aerobactin\n(Siderophore)", mech: "High-affinity iron chelator secreted into urine", outcome: "Scavenges iron from host proteins (lactoferrin, transferrin) — essential for survival in iron-poor urine", role: "Iron acquisition" },
    { name: "Serum Resistance\n(O-Antigen / K-Antigen)", mech: "Thick polysaccharide capsule (K antigen) and LPS O-antigen", outcome: "Resists complement-mediated killing; evades opsonization — allows bacteremia in urosepsis", role: "Immune evasion" },
    { name: "Cytotoxic\nNecrotizing Factor (CNF1)", mech: "Activates Rho GTPases in host cells", outcome: "Promotes bacterial internalization and suppresses apoptosis — prolongs intracellular survival", role: "Invasion" },
    { name: "Type VI Secretion\nSystem (T6SS)", mech: "Injects toxic effectors into competing bacteria", outcome: "Kills competing microbiota → gives UPEC competitive advantage in bladder colonization", role: "Competition / Colonization" },
  ];

  // Table header
  const colX = [0.35, 2.55, 5.15, 8.05];
  const colW = [2.1, 2.5, 2.8, 1.6];
  const headers = ["FACTOR", "MECHANISM", "OUTCOME / SIGNIFICANCE", "ROLE"];
  headers.forEach((h, i) => {
    s.addShape(pres.shapes.RECTANGLE, {
      x: colX[i], y: 1.42, w: colW[i], h: 0.35,
      fill: { color: C.steel }, line: { color: C.steelLight, pt: 0.5 }
    });
    s.addText(h, {
      x: colX[i] + 0.08, y: 1.42, w: colW[i] - 0.1, h: 0.35,
      fontSize: 8.5, bold: true, color: C.white, valign: "middle", margin: 0
    });
  });

  factors.forEach((f, i) => {
    const yRow = 1.77 + i * 0.455;
    const bg = i % 2 === 0 ? C.navyMid : C.navy;
    colX.forEach((cx, ci) => {
      s.addShape(pres.shapes.RECTANGLE, {
        x: cx, y: yRow, w: colW[ci], h: 0.45,
        fill: { color: bg }, line: { color: C.steel, pt: 0.3 }
      });
    });
    const cells = [f.name, f.mech, f.outcome, f.role];
    cells.forEach((cell, ci) => {
      const isAccent = ci === 3;
      s.addText(cell, {
        x: colX[ci] + 0.08, y: yRow + 0.02, w: colW[ci] - 0.12, h: 0.41,
        fontSize: 8, color: isAccent ? C.accentLight : C.offWhite,
        bold: isAccent, valign: "middle", margin: 0, wrap: true
      });
    });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 6 — ASCENDING PATHOGENESIS (with diagram)
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  slideTitle(s, "Pathogenesis: Ascending Infection Route");

  // Image left half
  s.addImage({
    data: pathwayImg,
    x: 0.2, y: 0.82, w: 5.5, h: 4.25
  });

  // Right: step-by-step
  const steps = [
    { n: "1", t: "Periurethral Colonization", b: "Enteric bacteria (E. coli, Proteus) from bowel flora colonize the perineum and distal urethra; short female urethra (4 cm) favors colonization." },
    { n: "2", t: "Bladder Entry & Adhesion", b: "Bacteria ascend to bladder. Type 1 fimbriae bind uroplakin Ia/Ib on umbrella cells. Facilitated by sexual intercourse, catheterization, or instrumentation." },
    { n: "3", t: "Bladder Infection (Cystitis)", b: "Bacterial multiplication in stasis urine. Host mounts innate immune response (neutrophil influx, IL-8, TLR4 signaling). Symptoms: dysuria, frequency, urgency." },
    { n: "4", t: "Vesicoureteral Reflux (VUR)", b: "Incompetent ureterovesical valve allows infected urine to reflux into ureters. Present in 20–40% of children with UTI. Also seen in neurogenic bladder, spinal cord injury." },
    { n: "5", t: "Renal Ascent → Pyelonephritis", b: "Bacteria reach renal pelvis. P-fimbriae bind Gal-Gal on renal tubular cells. Suppurative inflammation: neutrophil-filled tubules, discrete cortical abscesses, WBC casts." },
  ];

  steps.forEach((st, i) => {
    const y = 0.88 + i * 0.86;
    card(s, 5.85, y, 3.9, 0.78, C.navyMid);
    s.addShape(pres.shapes.ELLIPSE, {
      x: 5.97, y: y + 0.16, w: 0.44, h: 0.44,
      fill: { color: i < 2 ? C.steelLight : i < 4 ? C.accent : C.red },
      line: { color: C.navy }
    });
    s.addText(st.n, {
      x: 5.97, y: y + 0.14, w: 0.44, h: 0.44,
      fontSize: 12, bold: true, color: C.white,
      align: "center", valign: "middle", margin: 0
    });
    s.addText(st.t, {
      x: 6.52, y: y + 0.08, w: 3.1, h: 0.24,
      fontSize: 9.5, bold: true, color: C.accent, margin: 0
    });
    s.addText(st.b, {
      x: 6.52, y: y + 0.32, w: 3.1, h: 0.42,
      fontSize: 8, color: C.offWhite, margin: 0, wrap: true
    });
  });

  // Arrow connectors on right
  for (let i = 0; i < 4; i++) {
    const arrowY = 0.88 + (i + 1) * 0.86 - 0.08;
    s.addShape(pres.shapes.RECTANGLE, {
      x: 6.15, y: arrowY, w: 0.04, h: 0.11,
      fill: { color: C.midGray }, line: { color: C.midGray }
    });
  }
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 7 — HEMATOGENOUS ROUTE & RISK FACTORS
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  slideTitle(s, "Hematogenous Route & Key Risk Factors");

  // Left: hematogenous
  card(s, 0.45, 0.92, 4.2, 2.55, C.navyMid);
  s.addText("⬇  HEMATOGENOUS (DESCENDING) ROUTE", {
    x: 0.65, y: 0.98, w: 3.9, h: 0.32,
    fontSize: 9, bold: true, color: C.red, charSpacing: 0.5, margin: 0
  });
  s.addText("~5% of UTIs — bacteria seed kidneys from bloodstream", {
    x: 0.65, y: 1.28, w: 3.9, h: 0.28,
    fontSize: 9, italic: true, color: C.lightGray, margin: 0
  });
  const hematoItems = [
    "Common agents: Staphylococcus aureus (endocarditis), E. coli (gram-negative sepsis)",
    "Creates discrete cortical foci of pyelonephritis — not contiguous with pelvis initially",
    "Suspect when no lower UTI symptoms precede upper tract disease",
    "Associated with IV drug use, infected indwelling venous lines, immunosuppression",
    "Candida UTI is usually hematogenous in ICU / immunocompromised patients",
  ];
  s.addText(hematoItems.map(i => "▸  " + i).join("\n"), {
    x: 0.65, y: 1.58, w: 3.8, h: 1.72,
    fontSize: 9, color: C.offWhite, margin: 0, wrap: true
  });

  // Right: comparison table
  card(s, 4.85, 0.92, 4.7, 2.55, C.navyMid);
  s.addText("ASCENDING vs HEMATOGENOUS — COMPARISON", {
    x: 5.02, y: 0.98, w: 4.4, h: 0.28,
    fontSize: 8.5, bold: true, color: C.accent, charSpacing: 0.3, margin: 0
  });
  const compRows = [
    ["Feature", "Ascending", "Hematogenous"],
    ["Frequency", "~95%", "~5%"],
    ["Route", "Urethra → Bladder → Kidney", "Bloodstream → Kidney"],
    ["Common agents", "E. coli, Proteus, Klebsiella", "S. aureus, Candida, E. coli"],
    ["Initial site", "Bladder / lower tract first", "Cortex (discrete foci)"],
    ["Association", "VUR, catheter, pregnancy", "Sepsis, endocarditis, IVDU"],
  ];
  compRows.forEach((row, ri) => {
    const isHeader = ri === 0;
    const yRow = 1.3 + ri * 0.36;
    const fills = [C.steel, C.steelLight, C.midGray];
    const widths = [1.1, 1.7, 1.7];
    const xStart = [5.02, 6.15, 7.88];
    row.forEach((cell, ci) => {
      s.addShape(pres.shapes.RECTANGLE, {
        x: xStart[ci], y: yRow, w: widths[ci], h: 0.34,
        fill: { color: isHeader ? C.steel : (ri % 2 === 0 ? C.navyMid : C.navy) },
        line: { color: C.steel, pt: 0.3 }
      });
      s.addText(cell, {
        x: xStart[ci] + 0.05, y: yRow, w: widths[ci] - 0.08, h: 0.34,
        fontSize: isHeader ? 8 : 8, bold: isHeader, color: isHeader ? C.white : C.offWhite,
        valign: "middle", margin: 0
      });
    });
  });

  // Bottom: risk factor grid
  s.addText("KEY RISK FACTORS FOR UTI", {
    x: 0.45, y: 3.62, w: 5, h: 0.28,
    fontSize: 9.5, bold: true, color: C.accent, charSpacing: 2, margin: 0
  });
  const riskFactors = [
    { cat: "Anatomical", items: "Short urethra (F), VUR, urethral stricture, BPH, posterior urethral valves" },
    { cat: "Behavioral", items: "Sexual intercourse, spermicide use, new sexual partner, poor voiding habits" },
    { cat: "Metabolic", items: "Diabetes mellitus (glycosuria, neurogenic bladder), SGLT-2 inhibitors (glycosuria)" },
    { cat: "Iatrogenic", items: "Urinary catheter, cystoscopy, nephrostomy tube, ureteral stent" },
    { cat: "Hormonal", items: "Estrogen deficiency (postmenopause) → loss of Lactobacillus protection" },
    { cat: "Immune", items: "Immunosuppression, transplant, neutropenia, HIV/AIDS" },
  ];
  riskFactors.forEach((rf, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.45 + col * 3.15;
    const y = 3.98 + row * 0.58;
    s.addShape(pres.shapes.RECTANGLE, {
      x, y, w: 3.0, h: 0.52,
      fill: { color: C.navyMid }, line: { color: C.steel, pt: 0.4 }
    });
    s.addShape(pres.shapes.RECTANGLE, {
      x, y, w: 0.06, h: 0.52,
      fill: { color: C.accent }, line: { color: C.accent }
    });
    s.addText(rf.cat + ": ", {
      x: x + 0.15, y: y + 0.04, w: 0.85, h: 0.24,
      fontSize: 8.5, bold: true, color: C.accentLight, margin: 0
    });
    s.addText(rf.items, {
      x: x + 0.15, y: y + 0.26, w: 2.75, h: 0.24,
      fontSize: 8, color: C.lightGray, margin: 0
    });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 8 — INTRACELLULAR BACTERIAL COMMUNITIES (IBCs)
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  slideTitle(s, "Intracellular Bacterial Communities (IBCs) & Recurrence");

  s.addText("Why does UTI recur? The IBC pathway explains recurrent cystitis in the absence of re-infection.", {
    x: 0.45, y: 0.9, w: 9.1, h: 0.35,
    fontSize: 10.5, italic: true, color: C.lightGray, margin: 0
  });

  // IBC lifecycle steps — horizontal flow
  const ibcSteps = [
    { n: "1", title: "Attachment", body: "Type 1 fimbriae bind FimH to uroplakin Ia/Ib on urothelial surface", color: C.steelLight },
    { n: "2", title: "Invasion", body: "UPEC triggers actin rearrangement → zip-up mechanism → endocytosis into umbrella cell", color: C.steelLight },
    { n: "3", title: "IBC Formation", body: "Bacteria replicate rapidly inside vesicle → 10⁴–10⁵ bacteria form biofilm-like pod (\"IBC\") within 6 hrs", color: C.accent },
    { n: "4", title: "Dispersal", body: "IBCs disperse, bacteria egress, flux into underlying transitional cells → establish Quiescent Intracellular Reservoirs (QIRs)", color: C.accent },
    { n: "5", title: "QIR Reactivation", body: "QIRs remain dormant for weeks–months. Triggered by estrogen, stress or antibiotic exposure → seeding of recurrent UTI", color: C.red },
  ];

  ibcSteps.forEach((step, i) => {
    const x = 0.38 + i * 1.9;
    const y = 1.35;
    card(s, x, y, 1.75, 2.4, C.navyMid);
    s.addShape(pres.shapes.RECTANGLE, {
      x, y, w: 1.75, h: 0.08,
      fill: { color: step.color }, line: { color: step.color }
    });
    s.addShape(pres.shapes.ELLIPSE, {
      x: x + 0.65, y: y + 0.18, w: 0.45, h: 0.45,
      fill: { color: step.color }, line: { color: step.color }
    });
    s.addText(step.n, {
      x: x + 0.65, y: y + 0.16, w: 0.45, h: 0.45,
      fontSize: 14, bold: true, color: C.white,
      align: "center", valign: "middle", margin: 0
    });
    s.addText(step.title, {
      x: x + 0.1, y: y + 0.72, w: 1.56, h: 0.32,
      fontSize: 10, bold: true, color: C.white, align: "center", margin: 0
    });
    s.addText(step.body, {
      x: x + 0.1, y: y + 1.06, w: 1.56, h: 1.25,
      fontSize: 8.5, color: C.offWhite, align: "left", margin: 0, wrap: true
    });
    // arrow
    if (i < 4) {
      s.addShape(pres.shapes.RECTANGLE, {
        x: x + 1.75, y: y + 1.15, w: 0.14, h: 0.05,
        fill: { color: C.accent }, line: { color: C.accent }
      });
    }
  });

  // Clinical implication box
  card(s, 0.38, 3.9, 9.25, 1.15, C.steel);
  s.addText("⚠  CLINICAL IMPLICATIONS OF IBC BIOLOGY", {
    x: 0.58, y: 3.95, w: 8.8, h: 0.3,
    fontSize: 9.5, bold: true, color: C.white, charSpacing: 1.5, margin: 0
  });
  s.addText([
    { text: "• Short-course antibiotics kill extracellular bacteria but do NOT eliminate QIRs → explains why 3-day courses cure but may not prevent recurrence  ", options: { color: C.offWhite } },
    { text: "• Fluoroquinolones penetrate cells better than β-lactams → preferred for preventing IBC-driven recurrence  ", options: { color: C.offWhite } },
    { text: "• Novel targets: FimH antagonists (mannosides) block type 1 fimbriae adhesion — currently in clinical trials", options: { color: C.accentLight, bold: true } },
  ], {
    x: 0.58, y: 4.28, w: 8.9, h: 0.72,
    fontSize: 9, margin: 0, wrap: true
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 9 — CLINICAL FEATURES & DIAGNOSIS
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  slideTitle(s, "Clinical Features & Diagnosis");

  // Lower UTI
  card(s, 0.45, 0.92, 4.2, 4.2, C.navyMid);
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.45, y: 0.92, w: 4.2, h: 0.1,
    fill: { color: C.steelLight }, line: { color: C.steelLight }
  });
  s.addText("LOWER UTI (CYSTITIS)", {
    x: 0.62, y: 0.98, w: 3.9, h: 0.3,
    fontSize: 10, bold: true, color: C.steelLight, charSpacing: 1, margin: 0
  });
  const lowerSymptoms = [
    ["Dysuria", "Burning / pain on urination — most common complaint"],
    ["Frequency", "Urinating more often than usual (>8×/day)"],
    ["Urgency", "Sudden compelling need to void — may be unable to defer"],
    ["Suprapubic pain", "Pressure/discomfort over bladder, lower abdomen"],
    ["Hematuria", "Frank or microscopic blood in urine"],
    ["Cloudy urine", "Turbid due to pyuria; malodorous from bacterial metabolites"],
    ["Nocturia", "Waking at night to urinate"],
  ];
  lowerSymptoms.forEach(([sym, desc], i) => {
    const y = 1.38 + i * 0.5;
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.62, y: y + 0.12, w: 0.06, h: 0.22,
      fill: { color: C.steelLight }, line: { color: C.steelLight }
    });
    s.addText(sym + ":", {
      x: 0.8, y: y + 0.05, w: 1.0, h: 0.25,
      fontSize: 9, bold: true, color: C.white, margin: 0
    });
    s.addText(desc, {
      x: 0.8, y: y + 0.26, w: 3.65, h: 0.22,
      fontSize: 8, color: C.lightGray, margin: 0
    });
  });
  s.addText("⚠  No systemic fever in uncomplicated cystitis — fever = upper tract involvement until proven otherwise", {
    x: 0.62, y: 4.85, w: 3.9, h: 0.24,
    fontSize: 8, italic: true, color: C.accent, margin: 0
  });

  // Upper UTI + Diagnosis
  card(s, 4.85, 0.92, 4.7, 2.0, C.navyMid);
  s.addShape(pres.shapes.RECTANGLE, {
    x: 4.85, y: 0.92, w: 4.7, h: 0.1,
    fill: { color: C.red }, line: { color: C.red }
  });
  s.addText("UPPER UTI (PYELONEPHRITIS)", {
    x: 5.02, y: 0.98, w: 4.4, h: 0.3,
    fontSize: 10, bold: true, color: C.red, charSpacing: 1, margin: 0
  });
  const upperSymptoms = [
    "🌡  Fever >38.5°C with rigors and chills — sudden onset",
    "📍  Costovertebral angle (CVA) tenderness — loin/flank pain",
    "🤢  Nausea, vomiting, malaise, headache",
    "💧  Lower tract symptoms (dysuria, frequency) often co-exist",
    "🔬  Turbid urine with WBC casts (pathognomonic)",
    "⚡  Risk of urosepsis if untreated — requires IV antibiotics",
  ];
  s.addText(upperSymptoms.join("\n"), {
    x: 5.02, y: 1.34, w: 4.45, h: 1.48,
    fontSize: 8.5, color: C.offWhite, margin: 0, wrap: true
  });

  // Diagnosis box
  card(s, 4.85, 3.07, 4.7, 2.05, C.navyMid);
  s.addText("DIAGNOSTIC WORKUP", {
    x: 5.02, y: 3.13, w: 4.4, h: 0.28,
    fontSize: 9.5, bold: true, color: C.accent, charSpacing: 1.5, margin: 0
  });
  const diagRows = [
    { test: "Urinalysis (dipstick)", findings: "Nitrite +, leukocyte esterase +, hematuria", level: "1st" },
    { test: "Urine Microscopy", findings: "Pyuria (>5 WBC/hpf), WBC casts = pyelonephritis", level: "1st" },
    { test: "Urine Culture (gold standard)", findings: "≥10⁵ CFU/mL; guides antibiotic choice", level: "1st" },
    { test: "Blood culture + CBC/CRP", findings: "If sepsis suspected; leukocytosis + elevated CRP", level: "2nd" },
    { test: "CT / Ultrasound", findings: "Obstruction, abscess, stones, hydronephrosis", level: "2nd" },
  ];
  diagRows.forEach((d, i) => {
    const y = 3.5 + i * 0.32;
    pill(s, 4.95, y, 0.35, 0.26, d.level, d.level === "1st" ? C.steelLight : C.midGray, C.white, 7);
    s.addText(d.test + ": ", {
      x: 5.42, y: y + 0.02, w: 1.7, h: 0.24,
      fontSize: 8, bold: true, color: C.white, margin: 0
    });
    s.addText(d.findings, {
      x: 7.15, y: y + 0.02, w: 2.2, h: 0.24,
      fontSize: 8, color: C.lightGray, margin: 0
    });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 10 — COMPLICATIONS & PATHOLOGY (with image)
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  slideTitle(s, "Pathological Complications of UTI");

  s.addText("Untreated or recurrent UTI can progress to severe renal pathology — these findings are examinable:", {
    x: 0.45, y: 0.9, w: 9.1, h: 0.35,
    fontSize: 10, italic: true, color: C.lightGray, margin: 0
  });

  // Pathology image (pyelonephritis gross + histology)
  s.addImage({
    data: pyeloImg,
    x: 5.2, y: 1.35, w: 4.45, h: 3.0
  });
  card(s, 5.2, 4.38, 4.45, 0.65, C.navyMid);
  s.addText("FIG: Acute Pyelonephritis (Robbins & Kumar Basic Pathology)\n(A) Gross: yellowish cortical abscesses. (B) Micro: neutrophil-filled tubules (pyonephrosis).", {
    x: 5.32, y: 4.42, w: 4.2, h: 0.58,
    fontSize: 7.5, italic: true, color: C.lightGray, margin: 0
  });

  // Complications list
  const complications = [
    { name: "Acute Pyelonephritis", desc: "Suppurative inflammation: discrete yellowish cortical abscesses, neutrophils in tubules + interstitium, WBC casts", severity: "Moderate" },
    { name: "Perinephric Abscess", desc: "Pus outside kidney capsule. Often needs CT-guided drainage. Present with fever not responding to antibiotics", severity: "Severe" },
    { name: "Pyonephrosis", desc: "Obstruction + infection = collecting system fills with pus. Surgical/urological emergency — nephrostomy required", severity: "Severe" },
    { name: "Papillary Necrosis", desc: "Ischemic + suppurative necrosis of renal papillae. Classic triad: diabetes + obstruction + sickle cell anemia", severity: "Severe" },
    { name: "Urosepsis", desc: "Gram-negative bacteremia + endotoxemia (LPS → septic shock cascade). Mortality >20%. Treat with IV broad-spectrum ABx ± ICU", severity: "Critical" },
    { name: "Chronic Pyelonephritis / CKD", desc: "Recurrent infections → irregular corticomedullary scars + calyceal deformity → progressive CKD + hypertension", severity: "Chronic" },
    { name: "Emphysematous Pyelonephritis", desc: "Gas-forming infection of renal parenchyma; 90% in diabetics; life-threatening surgical emergency", severity: "Critical" },
  ];

  const sevColor = { Moderate: C.steelLight, Severe: C.accent, Critical: C.red, Chronic: C.midGray };
  complications.forEach((c, i) => {
    const y = 1.35 + i * 0.58;
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.45, y, w: 4.5, h: 0.52,
      fill: { color: C.navyMid }, line: { color: C.steel, pt: 0.3 }
    });
    pill(s, 0.5, y + 0.12, 0.72, 0.26, c.severity, sevColor[c.severity] || C.midGray, C.white, 7);
    s.addText(c.name, {
      x: 1.3, y: y + 0.05, w: 3.5, h: 0.22,
      fontSize: 8.5, bold: true, color: C.white, margin: 0
    });
    s.addText(c.desc, {
      x: 1.3, y: y + 0.27, w: 3.5, h: 0.22,
      fontSize: 7.5, color: C.lightGray, margin: 0
    });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 11 — TREATMENT PRINCIPLES
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  slideTitle(s, "Treatment Principles");

  // Antibiotic table header
  s.addText("EMPIRICAL ANTIBIOTIC SELECTION — MATCHED TO SEVERITY", {
    x: 0.45, y: 0.9, w: 9.1, h: 0.32,
    fontSize: 9.5, bold: true, color: C.accent, charSpacing: 1.5, margin: 0
  });

  const tableRows = [
    { type: "Uncomplicated Cystitis", abx: "TMP-SMX 160/800 mg BD × 3 days; Nitrofurantoin 100 mg BD × 5 days; Fosfomycin 3 g × 1 dose", notes: "Fluoroquinolones NOT first-line (reserve for complicated infections)", tier: "1st" },
    { type: "Mild Pyelonephritis\n(outpatient)", abx: "Ciprofloxacin 500 mg BD × 7 days; TMP-SMX × 14 days; Levofloxacin 750 mg OD × 5 days", notes: "If tolerating orals, no vomiting, afebrile after 24–48h", tier: "2nd" },
    { type: "Severe Pyelonephritis\n(inpatient)", abx: "IV Ciprofloxacin 400 mg q8–12h; IV Ceftriaxone 1–2 g OD; Aminoglycosides (gentamicin, amikacin)", notes: "Get blood + urine cultures before starting. Switch to oral when afebrile 24h", tier: "3rd" },
    { type: "Complicated UTI /\nPseudomonas", abx: "Piperacillin-tazobactam 4.5 g q8h; Meropenem 1 g q8h; Ceftazidime-avibactam; Ceftolozane-tazobactam", notes: "Base choice on local antibiogram. Remove/replace catheter or stent", tier: "MDR" },
    { type: "UTI in Pregnancy", abx: "Cephalexin 500 mg BD × 7 days; Nitrofurantoin (avoid 3rd trimester); Amoxicillin 500 mg TID × 7 days", notes: "Screen ALL pregnant women at 12–16 weeks. Up to 30% bacteriuria → pyelonephritis if untreated", tier: "Preg" },
  ];

  const tierColors = { "1st": C.green, "2nd": C.steelLight, "3rd": C.accent, "MDR": C.red, "Preg": C.steelLight };

  const colXs = [0.45, 1.3, 5.1, 7.85];
  const colWs = [0.82, 3.75, 2.7, 1.85];
  const headers = ["TIER", "UTI TYPE", "ANTIBIOTIC OPTIONS", "NOTES / CAUTIONS"];

  headers.forEach((h, ci) => {
    s.addShape(pres.shapes.RECTANGLE, {
      x: colXs[ci], y: 1.3, w: colWs[ci], h: 0.35,
      fill: { color: C.steel }, line: { color: C.steelLight, pt: 0.4 }
    });
    s.addText(h, {
      x: colXs[ci] + 0.06, y: 1.3, w: colWs[ci] - 0.08, h: 0.35,
      fontSize: 8.5, bold: true, color: C.white, valign: "middle", margin: 0
    });
  });

  tableRows.forEach((row, ri) => {
    const y = 1.65 + ri * 0.68;
    const bg = ri % 2 === 0 ? C.navyMid : C.navy;
    colXs.forEach((cx, ci) => {
      s.addShape(pres.shapes.RECTANGLE, {
        x: cx, y, w: colWs[ci], h: 0.65,
        fill: { color: bg }, line: { color: C.steel, pt: 0.3 }
      });
    });
    pill(s, colXs[0] + 0.08, y + 0.18, 0.62, 0.28, row.tier, tierColors[row.tier] || C.midGray, C.white, 8);
    s.addText(row.type, { x: colXs[1] + 0.08, y: y + 0.05, w: colWs[1] - 0.12, h: 0.62, fontSize: 8.5, bold: true, color: C.white, valign: "middle", margin: 0, wrap: true });
    s.addText(row.abx, { x: colXs[2] + 0.06, y: y + 0.04, w: colWs[2] - 0.1, h: 0.58, fontSize: 7.5, color: C.offWhite, margin: 0, wrap: true });
    s.addText(row.notes, { x: colXs[3] + 0.06, y: y + 0.04, w: colWs[3] - 0.1, h: 0.58, fontSize: 7.5, color: C.lightGray, italic: true, margin: 0, wrap: true });
  });

  // IDSA note
  s.addText("IDSA recommends avoiding antimicrobials when local resistance exceeds 20% — always check institutional antibiogram before empirical prescribing.", {
    x: 0.45, y: 5.07, w: 9.1, h: 0.2,
    fontSize: 8, italic: true, color: C.midGray, margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 12 — PREVENTION & KEY TAKEAWAYS
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  slideTitle(s, "Prevention & Key Takeaways");

  // Prevention grid
  s.addText("PREVENTION STRATEGIES", {
    x: 0.45, y: 0.9, w: 5.5, h: 0.3,
    fontSize: 9.5, bold: true, color: C.accent, charSpacing: 2, margin: 0
  });

  const preventions = [
    { icon: "💧", title: "Hydration", body: ">1.5–2 L/day — maintains urinary flow, flushes periurethral bacteria" },
    { icon: "🚽", title: "Voiding habits", body: "Void frequently; post-coital voiding; wipe front-to-back (females)" },
    { icon: "🍒", title: "Cranberry", body: "Proanthocyanidins block FimH-mediated adhesion of E. coli to urothelium" },
    { icon: "💊", title: "Antibiotic prophylaxis", body: "Low-dose nightly TMP or nitrofurantoin for ≥3 UTIs/year; post-coital single dose" },
    { icon: "🧫", title: "Vaginal estrogen", body: "Postmenopausal women — restores Lactobacillus, lowers pH, reduces colonization" },
    { icon: "🏥", title: "CAUTI prevention", body: "Aseptic catheter insertion, closed drainage, minimize dwell time, catheter bundles" },
  ];

  preventions.forEach((p, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.45 + col * 1.78;
    const y = 1.28 + row * 1.3;
    card(s, x, y, 1.65, 1.18, C.navyMid);
    s.addText(p.icon, {
      x: x + 0.6, y: y + 0.08, w: 0.5, h: 0.4,
      fontSize: 18, align: "center", margin: 0
    });
    s.addText(p.title, {
      x: x + 0.08, y: y + 0.5, w: 1.5, h: 0.24,
      fontSize: 9, bold: true, color: C.accent, align: "center", margin: 0
    });
    s.addText(p.body, {
      x: x + 0.08, y: y + 0.72, w: 1.5, h: 0.42,
      fontSize: 7.5, color: C.offWhite, align: "left", margin: 0, wrap: true
    });
  });

  // Key takeaways
  s.addText("KEY TAKEAWAYS FOR EXAMS", {
    x: 5.75, y: 0.9, w: 3.9, h: 0.3,
    fontSize: 9.5, bold: true, color: C.accent, charSpacing: 2, margin: 0
  });
  card(s, 5.75, 1.28, 3.9, 2.3, C.navyMid);

  const takeaways = [
    "E. coli causes 70–95% of uncomplicated UTIs; P-fimbriae = upper tract virulence",
    "Ascending route (~95%) > hematogenous (~5%)",
    "IBCs explain recurrent UTI — QIRs survive short antibiotic courses",
    "VUR (20–40% of children with UTI) is the key predisposing factor for pyelonephritis",
    "First-line uncomplicated cystitis: TMP-SMX × 3 d, nitrofurantoin × 5 d, fosfomycin × 1 dose",
    "Fluoroquinolones: NOT for simple cystitis; reserved for complicated/severe infections",
    "WBC casts in urine = pathognomonic for pyelonephritis",
    "Papillary necrosis triad: diabetes + obstruction + sickle cell anemia",
  ];

  s.addText(takeaways.map(t => "✓  " + t).join("\n"), {
    x: 5.9, y: 1.4, w: 3.65, h: 2.1,
    fontSize: 8.5, color: C.offWhite, margin: 0, wrap: true
  });

  // References
  card(s, 5.75, 3.72, 3.9, 1.4, C.navyMid);
  s.addText("REFERENCES", {
    x: 5.9, y: 3.77, w: 3.6, h: 0.25,
    fontSize: 8, bold: true, color: C.accent, charSpacing: 2, margin: 0
  });
  const refs = [
    "Robbins & Kumar Basic Pathology (Robbins Pathology)",
    "Comprehensive Clinical Nephrology, 7th Edition",
    "Campbell-Walsh-Wein Urology, 3-Volume Set",
    "Rosen's Emergency Medicine, 10th Edition",
    "Berek & Novak's Gynecology",
    "Goldman-Cecil Medicine, International Edition",
  ];
  s.addText(refs.map((r, i) => `${i+1}. ${r}`).join("\n"), {
    x: 5.9, y: 4.04, w: 3.65, h: 1.0,
    fontSize: 7.5, color: C.lightGray, margin: 0
  });

  // Emerging therapies
  card(s, 0.45, 2.85, 5.15, 2.3, C.navyMid);
  s.addText("🔬  EMERGING & ADVANCED TOPICS", {
    x: 0.62, y: 2.9, w: 4.85, h: 0.28,
    fontSize: 9.5, bold: true, color: C.accent, charSpacing: 1, margin: 0
  });
  const emerging = [
    { t: "FimH Antagonists (Mannosides)", b: "Block type 1 fimbriae–uroplakin interaction → prevent invasion; phase II trials ongoing" },
    { t: "Phage Therapy", b: "Bacteriophages targeting MDR E. coli for catheter-associated UTI; compassionate use cases reported" },
    { t: "UTI Vaccines", b: "Uromune (OM-89): oral polybacterial vaccine; reduces recurrent UTI rates by ~50% in trials" },
    { t: "SGLT-2 Inhibitors & UTI risk", b: "Glycosuria provides carbon source for E. coli; associated with 1.5× increased UTI risk — important pharmacology link" },
  ];
  emerging.forEach((e, i) => {
    const y = 3.26 + i * 0.46;
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.62, y: y + 0.08, w: 0.06, h: 0.28,
      fill: { color: C.steelLight }, line: { color: C.steelLight }
    });
    s.addText(e.t + ": ", {
      x: 0.78, y: y + 0.04, w: 4.68, h: 0.22,
      fontSize: 8.5, bold: true, color: C.white, margin: 0
    });
    s.addText(e.b, {
      x: 0.78, y: y + 0.24, w: 4.68, h: 0.2,
      fontSize: 8, color: C.lightGray, margin: 0
    });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 13 — CLOSING / THANK YOU
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.navy };

  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 0.08,
    fill: { color: C.accent }, line: { color: C.accent }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 5.545, w: 10, h: 0.08,
    fill: { color: C.accent }, line: { color: C.accent }
  });

  s.addShape(pres.shapes.RECTANGLE, {
    x: 3.0, y: 0.08, w: 4.0, h: 5.465,
    fill: { color: C.navyMid }, line: { color: C.navyMid }
  });

  s.addText("SUMMARY", {
    x: 3.2, y: 1.1, w: 3.6, h: 0.45,
    fontSize: 11, bold: true, color: C.accent,
    charSpacing: 5, align: "center", margin: 0
  });

  s.addText("UTI Pathogenesis &\nVirulence Factors", {
    x: 3.0, y: 1.62, w: 4.0, h: 1.1,
    fontSize: 26, bold: true, color: C.white,
    align: "center", margin: 0
  });

  s.addShape(pres.shapes.RECTANGLE, {
    x: 3.8, y: 2.85, w: 2.4, h: 0.04,
    fill: { color: C.accent }, line: { color: C.accent }
  });

  const summaryPoints = [
    "UPEC Type 1 & P-Fimbriae → Adhesion & Upper Tract Invasion",
    "Ascending route: Colonization → Bladder → VUR → Kidney",
    "IBCs → QIRs → Recurrent Cystitis",
    "E. coli 70–95% · S. saprophyticus 5–20%",
    "TMP-SMX / Nitrofurantoin → First-line for cystitis",
    "Complications: Urosepsis · Papillary Necrosis · CKD",
  ];
  s.addText(summaryPoints.map(p => "◆  " + p).join("\n"), {
    x: 3.1, y: 3.0, w: 3.8, h: 2.1,
    fontSize: 8.5, color: C.offWhite, align: "left",
    margin: 0, wrap: true
  });

  s.addText("For Medical Students", {
    x: 0.3, y: 2.5, w: 2.5, h: 0.3,
    fontSize: 9, color: C.midGray, align: "right", margin: 0
  });
  s.addText("Based on:", {
    x: 7.2, y: 2.5, w: 2.5, h: 0.3,
    fontSize: 9, color: C.midGray, margin: 0
  });
  ["Robbins & Kumar", "Clinical Nephrology 7e", "Campbell-Walsh Urology", "Rosen's Emergency Medicine"].forEach((ref, i) => {
    s.addText("• " + ref, {
      x: 7.2, y: 2.85 + i * 0.28, w: 2.5, h: 0.26,
      fontSize: 8, color: C.lightGray, margin: 0
    });
  });
}

// ─── WRITE FILE ───────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/uti-presentation/UTI_Pathogenesis_Virulence_Factors.pptx" })
  .then(() => console.log("SUCCESS: Presentation written."))
  .catch(e => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/uti-presentation && node build.js 2>&1

Running Command

node -e "const p = require('pptxgenjs'); const pp = new p(); console.log(Object.keys(pp.shapes).filter(k => k.includes('RECT') || k.includes('ROUND')))"

Reading File
Running Command

node -e "const p = require('pptxgenjs'); const pp = new p(); console.log('ELLIPSE:', pp.shapes.ELLIPSE)"

Running Command

node -e "const p = require('pptxgenjs'); const pp = new p(); console.log(Object.keys(pp.shapes).filter(k => k.includes('ELLIP') || k.includes('OVAL') || k.includes('CIRC')))"

Running Command

sed -i 's/pres\.shapes\.ELLIPSE/pres.shapes.OVAL/g' /home/daytona/workspace/uti-presentation/build.js && echo "Fixed ELLIPSE -> OVAL" && grep -c "ELLIPSE" /home/daytona/workspace/uti-presentation/build.js

Running Command

node -e " const fs = require('fs'); let code = fs.readFileSync('/home/daytona/workspace/uti-presentation/build.js', 'utf8'); code = code.replace(/pres\.shapes\.ELLIPSE/g, 'pres.shapes.OVAL'); fs.writeFileSync('/home/daytona/workspace/uti-presentation/build.js', code); console.log('Done. ELLIPSE count remaining:', (code.match(/ELLIPSE/g)||[]).length); "

Running Command

cd /home/daytona/workspace/uti-presentation && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/uti-presentation/UTI_Pathogenesis_Virulence_Factors.pptx

Model call limits exceeded: run limit (20/20)
This is a shared conversation. Sign in to Orris to start your own chat.