I have presentation And my topic is physiology of scrotal swelling I wanted to include images and a good content

Asking for Preferences
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Searching the Web

scrotal anatomy layers diagram medical education labeled image

Reading File
Finding Sources
Searching the Web

testicular torsion hydrocele varicocele medical diagram labeled pathophysiology

Finding Sources
Finding Sources
Finding Sources
Reading File
Running Command

ls -la /home/daytona/workspace/ && mkdir -p /home/daytona/workspace/scrotal-swel…

Writing File

~/scrotal-swelling-ppt/build.js

const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");

// ─── Color Palette ───────────────────────────────────────────────────────────
const BG_DARK    = "0D1B2A";   // deep navy – dominant
const BG_MID     = "1B3A5C";   // mid navy
const ACCENT     = "00B4D8";   // teal/cyan accent
const ACCENT2    = "90E0EF";   // light teal
const WHITE      = "FFFFFF";
const LIGHT_GRAY = "E0F4FF";
const GOLD       = "FFD166";
const SOFT_RED   = "EF476F";
const GREEN      = "06D6A0";

// ─── Image URLs ──────────────────────────────────────────────────────────────
const imgUrls = [
  "https://cdn.orris.care/cdss_images/2f85765029fe65b9f3e1feb04e3b15a501ecc8ef76538f352bdc84d1ccaeea81.png", // male reproductive anatomy
  "https://cdn.orris.care/cdss_images/bc9f8cd7a5e6b9d79370607e75e4a34ecb9855d31a810e59a431e189b3d168fb.png", // age distribution chart torsion
  "https://cdn.orris.care/cdss_images/bb769a43856c7c88ca76f3979157754df1e0faba30ec63f0c12c306a2099e5d8.png", // Doppler US torsion
  "https://cdn.orris.care/cdss_images/149b1f8484a9832b49d38235cd6a3caee4b50f887e987fee7ce402e8dcff3980.png", // hydrocele types
  "https://teachmeanatomy.info/wp-content/uploads/The-Scrotum-External-Muscle-and-Contents.jpg",               // scrotum layers
  "https://cdn.lecturio.com/assets/Varicocele-hydrocele-spermatocele-scaled.jpg",                             // varicocele hydrocele comparison
];

console.log("Fetching images...");
let images;
try {
  const out = execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js ${imgUrls.map(u => `"${u}"`).join(" ")}`,
    { timeout: 60000 }
  ).toString();
  images = JSON.parse(out);
} catch(e) {
  console.error("Image fetch error:", e.message);
  images = imgUrls.map(u => ({ url: u, base64: null, error: "fetch failed" }));
}

// helper: use base64 if available, else skip
function imgData(idx) { return images[idx] && !images[idx].error ? images[idx].base64 : null; }

// ─── Helpers ─────────────────────────────────────────────────────────────────
function addSlide(pres, bgColor) {
  const s = pres.addSlide();
  s.background = { color: bgColor || BG_DARK };
  return s;
}

function sectionTitle(s, text, y) {
  s.addText(text, {
    x: 0.4, y: y || 0.15, w: 9.2, h: 0.55,
    fontSize: 26, bold: true, color: ACCENT, fontFace: "Calibri",
    borderBottom: true, borderColor: ACCENT2, borderPt: 1.5
  });
}

function bullet(items, color) {
  color = color || WHITE;
  return items.map((t, i) => ({
    text: t,
    options: { bullet: { code: "2022" }, color, fontSize: 15, fontFace: "Calibri",
               breakLine: i < items.length - 1, paraSpaceBefore: 6 }
  }));
}

function subbullet(items, color) {
  color = color || ACCENT2;
  return items.map((t, i) => ({
    text: "  " + t,
    options: { bullet: { code: "25E6" }, color, fontSize: 13, fontFace: "Calibri",
               breakLine: i < items.length - 1, paraSpaceBefore: 3 }
  }));
}

function addInfoBox(s, x, y, w, h, title, items, titleColor, bgCol) {
  s.addShape(pres.ShapeType.roundRect, { x, y, w, h, fill: { color: bgCol || BG_MID }, line: { color: ACCENT, pt: 1.2 }, rectRadius: 0.08 });
  s.addText(title, { x: x + 0.1, y: y + 0.05, w: w - 0.2, h: 0.35, fontSize: 14, bold: true, color: titleColor || GOLD, fontFace: "Calibri" });
  s.addText(bullet(items), { x: x + 0.1, y: y + 0.38, w: w - 0.2, h: h - 0.48, fontSize: 13, fontFace: "Calibri", valign: "top" });
}

// ─── Build Presentation ──────────────────────────────────────────────────────
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Physiology of Scrotal Swelling";
pres.author = "Medical Education";

// ═══════════════════════════════════════════════════════════
// SLIDE 1 – Title Slide
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  // left accent bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: ACCENT } });
  // top decorative strip
  s.addShape(pres.ShapeType.rect, { x: 0.18, y: 0, w: 9.82, h: 0.08, fill: { color: ACCENT2 } });

  s.addText("PHYSIOLOGY OF", {
    x: 0.4, y: 0.8, w: 9.2, h: 0.7,
    fontSize: 30, bold: false, color: ACCENT2, fontFace: "Calibri", charSpacing: 8
  });
  s.addText("SCROTAL SWELLING", {
    x: 0.4, y: 1.4, w: 9.2, h: 1.1,
    fontSize: 52, bold: true, color: WHITE, fontFace: "Calibri"
  });
  s.addText("A Comprehensive Guide for Medical Students", {
    x: 0.4, y: 2.5, w: 9.2, h: 0.5,
    fontSize: 20, italic: true, color: ACCENT, fontFace: "Calibri"
  });

  // horizontal divider
  s.addShape(pres.ShapeType.line, { x: 0.4, y: 3.1, w: 9.2, h: 0, line: { color: ACCENT, pt: 1.5 } });

  s.addText([
    { text: "Topics Covered: ", options: { bold: true, color: GOLD, fontSize: 15 } },
    { text: "Anatomy · Physiology · Classification · Pathophysiology · Clinical Features · Diagnosis · Management", options: { color: LIGHT_GRAY, fontSize: 14 } }
  ], { x: 0.4, y: 3.25, w: 9.2, h: 0.5, fontFace: "Calibri" });

  s.addText("Sources: Bailey & Love's Surgery | Campbell-Walsh Urology | Rosen's Emergency Medicine | Goldman-Cecil Medicine", {
    x: 0.4, y: 4.9, w: 9.2, h: 0.4,
    fontSize: 11, italic: true, color: "5A7FA8", fontFace: "Calibri"
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 2 – Anatomy of the Scrotum
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Anatomy of the Scrotum", 0.15);

  // left column - text
  s.addText([
    { text: "Layers (Superficial → Deep)\n", options: { bold: true, color: GOLD, fontSize: 16, breakLine: true } },
    ...bullet([
      "Skin – rugose, pigmented, hair-bearing",
      "Dartos muscle – smooth muscle; wrinkles skin for thermoregulation",
      "External spermatic fascia – derived from external oblique aponeurosis",
      "Cremasteric muscle & fascia – striated muscle; elevates testis",
      "Internal spermatic fascia – derived from transversalis fascia",
      "Tunica vaginalis (parietal + visceral layers)",
      "Testis & epididymis"
    ]),
  ], { x: 0.3, y: 0.8, w: 5.0, h: 4.4, valign: "top", fontFace: "Calibri" });

  // right column - image (male reproductive anatomy)
  const d1 = imgData(0);
  if (d1) {
    s.addImage({ data: d1, x: 5.5, y: 0.75, w: 4.2, h: 3.8 });
    s.addText("Testes, Epididymis & Male Reproductive System\n(Rosen's Emergency Medicine)", {
      x: 5.5, y: 4.55, w: 4.2, h: 0.6, fontSize: 10, italic: true, color: ACCENT2, align: "center", fontFace: "Calibri"
    });
  }

  // bottom note
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 5.1, w: 5.0, h: 0.35, fill: { color: BG_MID }, line: { color: ACCENT, pt: 0.5 } });
  s.addText("Key: Scrotal layers correspond to abdominal wall layers (embryological derivation)", {
    x: 0.35, y: 5.12, w: 4.9, h: 0.3, fontSize: 11, color: ACCENT2, italic: true, fontFace: "Calibri"
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 3 – Scrotum Layers Diagram
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Scrotal Wall Layers & Temperature Regulation", 0.15);

  const d5 = imgData(4); // teachmeanatomy scrotum image
  if (d5) {
    s.addImage({ data: d5, x: 0.3, y: 0.85, w: 4.5, h: 3.8 });
    s.addText("Scrotum: External Muscle & Contents\n(TeachMeAnatomy)", {
      x: 0.3, y: 4.65, w: 4.5, h: 0.45, fontSize: 10, italic: true, color: ACCENT2, align: "center", fontFace: "Calibri"
    });
  }

  // right side content
  s.addText("Thermoregulation", { x: 5.1, y: 0.85, w: 4.6, h: 0.4, fontSize: 18, bold: true, color: GOLD, fontFace: "Calibri" });
  s.addText(bullet([
    "Testicular temperature must be 2–3°C BELOW core body temperature for spermatogenesis",
    "Dartos muscle – wrinkles skin → ↓ surface area → ↓ heat loss in cold",
    "Cremasteric muscle – elevates testis toward inguinal canal in cold",
    "Pampiniform plexus – countercurrent heat exchange: arterial blood cooled by venous blood",
    "Scrotal skin is thin and loosely attached to facilitate heat dissipation",
  ]), { x: 5.1, y: 1.3, w: 4.6, h: 2.6, valign: "top", fontFace: "Calibri" });

  s.addText("Blood Supply & Innervation", { x: 5.1, y: 3.9, w: 4.6, h: 0.35, fontSize: 16, bold: true, color: GOLD, fontFace: "Calibri" });
  s.addText(bullet([
    "Arterial: anterior scrotal (ext. pudendal) + posterior scrotal (int. pudendal)",
    "Innervation: ilioinguinal n., genitofemoral n., perineal branches of pudendal n.",
  ]), { x: 5.1, y: 4.28, w: 4.6, h: 1.1, valign: "top", fontFace: "Calibri" });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 4 – Classification of Scrotal Swelling
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Classification of Scrotal Swelling", 0.15);

  // Age-based classification boxes
  const ageGroups = [
    { age: "Infant",     items: ["Inguinal hernia", "Hydrocele"],                        x: 0.25, color: ACCENT },
    { age: "Child",      items: ["Inguinal hernia", "Testicular torsion", "Epididymitis"], x: 2.65, color: GREEN },
    { age: "Adolescent", items: ["Epididymitis", "Testicular torsion", "Trauma"],          x: 5.05, color: GOLD },
    { age: "Adult",      items: ["Epididymitis", "Inguinal hernia", "Trauma", "Tumor", "Torsion", "Fournier gangrene"], x: 7.45, color: SOFT_RED },
  ];

  ageGroups.forEach(g => {
    s.addShape(pres.ShapeType.roundRect, { x: g.x, y: 0.82, w: 2.25, h: 4.55, fill: { color: BG_MID }, line: { color: g.color, pt: 2 }, rectRadius: 0.1 });
    s.addShape(pres.ShapeType.rect, { x: g.x, y: 0.82, w: 2.25, h: 0.5, fill: { color: g.color } });
    s.addText(g.age, { x: g.x, y: 0.84, w: 2.25, h: 0.45, fontSize: 16, bold: true, color: BG_DARK, align: "center", fontFace: "Calibri" });
    s.addText(bullet(g.items, WHITE), { x: g.x + 0.1, y: 1.4, w: 2.05, h: 3.8, valign: "top", fontFace: "Calibri" });
  });

  s.addText("Based on: Rosen's Emergency Medicine (BOX 85.5)", {
    x: 0.25, y: 5.35, w: 9.5, h: 0.25, fontSize: 10, italic: true, color: "5A7FA8", fontFace: "Calibri"
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 5 – Pathophysiology Overview
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Pathophysiology – Mechanisms of Scrotal Swelling", 0.15);

  const mechanisms = [
    { title: "Fluid Accumulation", icon: "💧", items: ["Hydrocele: fluid between visceral/parietal tunica vaginalis layers", "Communicating: patent processus vaginalis → peritoneal fluid flows in", "Non-communicating: ↑ production or ↓ lymphatic absorption"], color: ACCENT },
    { title: "Vascular", icon: "🔴", items: ["Testicular torsion: twisting of spermatic cord → venous then arterial occlusion → ischemia", "Varicocele: incompetent valves in pampiniform plexus → venous stasis", "Hematocele: blood in tunica vaginalis (trauma)"], color: SOFT_RED },
    { title: "Inflammatory", icon: "🔥", items: ["Epididymitis/orchitis: infection → edema, hyperemia, exudate", "STI (Chlamydia, Gonorrhea) in <35 yrs; enteric bacteria in >35 yrs", "Reactive hydrocele may develop secondary to infection"], color: GOLD },
    { title: "Obstructive/Mass", icon: "⬛", items: ["Hernia: bowel/omentum descends through patent processus vaginalis", "Spermatocele: cystic dilatation of efferent ductules of rete testis", "Testicular tumor: germ cell tumors – painless hard mass"], color: GREEN },
  ];

  mechanisms.forEach((m, i) => {
    const col = i % 2 === 0 ? 0.3 : 5.2;
    const row = i < 2 ? 0.82 : 3.05;
    s.addShape(pres.ShapeType.roundRect, { x: col, y: row, w: 4.6, h: 2.1, fill: { color: BG_MID }, line: { color: m.color, pt: 1.5 }, rectRadius: 0.1 });
    s.addText(`${m.title}`, { x: col + 0.1, y: row + 0.07, w: 4.4, h: 0.38, fontSize: 15, bold: true, color: m.color, fontFace: "Calibri" });
    s.addText(bullet(m.items, WHITE), { x: col + 0.1, y: row + 0.45, w: 4.4, h: 1.55, valign: "top", fontFace: "Calibri" });
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 6 – Hydrocele Deep Dive
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Hydrocele – Pathophysiology & Types", 0.15);

  // left text
  s.addText([
    { text: "Definition\n", options: { bold: true, color: GOLD, fontSize: 16, breakLine: true } },
    { text: "Abnormal collection of fluid between the parietal and visceral layers of the tunica vaginalis\n\n", options: { color: WHITE, fontSize: 14, breakLine: true } },
    { text: "Epidemiology\n", options: { bold: true, color: GOLD, fontSize: 16, breakLine: true } },
    { text: "• >80% of newborns have patent processus vaginalis\n• Most close within 18 months of age\n• Affects ~1% of adult men\n\n", options: { color: WHITE, fontSize: 14, breakLine: true } },
    { text: "Types\n", options: { bold: true, color: GOLD, fontSize: 16, breakLine: true } },
    ...bullet([
      "Communicating (congenital): patent processus vaginalis; peritoneal fluid flows in; associated with indirect inguinal hernia",
      "Non-communicating (vaginal): closed processus; ↑ fluid production or ↓ lymphatic absorption",
      "Infantile hydrocele: mid-portion of processus remains patent",
      "Hydrocele of cord: isolated fluid pocket in spermatic cord",
      "Secondary: trauma, torsion, infection, neoplasm (>40 yrs)"
    ]),
  ], { x: 0.3, y: 0.8, w: 5.3, h: 4.6, valign: "top", fontFace: "Calibri" });

  // right image - hydrocele types diagram
  const d4 = imgData(3);
  if (d4) {
    s.addImage({ data: d4, x: 5.8, y: 0.9, w: 3.9, h: 3.5 });
    s.addText("Types of Hydrocele (Bailey & Love's Surgery, Fig. 86.8)", {
      x: 5.8, y: 4.42, w: 3.9, h: 0.5, fontSize: 10, italic: true, color: ACCENT2, align: "center", fontFace: "Calibri"
    });
  }

  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 5.05, w: 5.3, h: 0.38, fill: { color: "1A3A1A" }, line: { color: GREEN, pt: 0.8 } });
  s.addText("Clinical Pearl: NEVER aspirate a hydrocele if malignancy is suspected – risk of malignant needle-track implantation", {
    x: 0.35, y: 5.07, w: 5.2, h: 0.34, fontSize: 11, color: GREEN, fontFace: "Calibri", bold: true
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 7 – Testicular Torsion
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Testicular Torsion – Physiology & Emergency Management", 0.15);

  // left content
  s.addText([
    { text: "Mechanism\n", options: { bold: true, color: SOFT_RED, fontSize: 16, breakLine: true } },
    { text: "Twisting of spermatic cord → venous obstruction (first) → arterial occlusion → ischemia/infarction\n\n", options: { color: WHITE, fontSize: 14, breakLine: true } },
    { text: "Bell-Clapper Deformity\n", options: { bold: true, color: GOLD, fontSize: 15, breakLine: true } },
    { text: "High insertion of tunica vaginalis around spermatic cord → testicle hangs freely like bell clapper → predisposes to torsion\n\n", options: { color: WHITE, fontSize: 13, breakLine: true } },
    { text: "Time-Viability Window ⚠️\n", options: { bold: true, color: SOFT_RED, fontSize: 15, breakLine: true } },
    ...bullet([
      "< 6 hrs: ~100% testicular viability",
      "6–12 hrs: ~70% viability",
      "12–24 hrs: <50% viability",
      "> 24 hrs: near 0% viability → orchiectomy"
    ], ACCENT2),
    { text: "\nTreatment: Surgical detorsion + bilateral orchiopexy\n", options: { color: GREEN, bold: true, fontSize: 14, breakLine: true } },
  ], { x: 0.3, y: 0.8, w: 5.3, h: 4.7, valign: "top", fontFace: "Calibri" });

  // right side - US image + age graph
  const d3 = imgData(2); // Doppler US
  const d2 = imgData(1); // age distribution
  if (d3) {
    s.addImage({ data: d3, x: 5.8, y: 0.85, w: 3.9, h: 2.2 });
    s.addText("Doppler US: absent flow in torsed testis (Rosen's Emergency Medicine, Fig. 85.10)", {
      x: 5.8, y: 3.07, w: 3.9, h: 0.45, fontSize: 10, italic: true, color: ACCENT2, align: "center", fontFace: "Calibri"
    });
  }
  if (d2) {
    s.addImage({ data: d2, x: 5.8, y: 3.6, w: 3.9, h: 1.75 });
    s.addText("Age distribution of acute scrotal conditions (Rosen's EM, Fig. 85.9)", {
      x: 5.8, y: 5.35, w: 3.9, h: 0.28, fontSize: 9, italic: true, color: ACCENT2, align: "center", fontFace: "Calibri"
    });
  }
}

// ═══════════════════════════════════════════════════════════
// SLIDE 8 – Varicocele & Epididymitis
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Varicocele & Epididymitis", 0.15);

  // varicocele box left
  s.addShape(pres.ShapeType.roundRect, { x: 0.3, y: 0.82, w: 4.6, h: 4.7, fill: { color: BG_MID }, line: { color: SOFT_RED, pt: 1.5 }, rectRadius: 0.1 });
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.82, w: 4.6, h: 0.45, fill: { color: SOFT_RED } });
  s.addText("VARICOCELE", { x: 0.3, y: 0.84, w: 4.6, h: 0.4, fontSize: 17, bold: true, color: WHITE, align: "center", fontFace: "Calibri" });
  s.addText([
    { text: "Definition: ", options: { bold: true, color: GOLD, fontSize: 13, breakLine: false } },
    { text: "Abnormally dilated tortuous veins of the pampiniform plexus\n\n", options: { color: WHITE, fontSize: 13, breakLine: true } },
    { text: "Pathophysiology:\n", options: { bold: true, color: GOLD, fontSize: 13, breakLine: true } },
    ...bullet([
      "Incompetent valves in left internal spermatic vein (drains into left renal vein at right angle)",
      "Left >> Right (left spermatic vein drainage angle)",
      "↑ scrotal temperature → impaired spermatogenesis",
      "Venous stasis → hypoxia of seminiferous tubules",
      "Present in 15% of males; 40% of infertile males"
    ], WHITE),
    { text: "\nGrade (Dubin & Amelar):\n", options: { bold: true, color: GOLD, fontSize: 13, breakLine: true } },
    ...bullet(["Grade I: palpable only with Valsalva", "Grade II: palpable without Valsalva", "Grade III: visible through skin ('bag of worms')"], ACCENT2),
  ], { x: 0.45, y: 1.35, w: 4.3, h: 4.1, valign: "top", fontFace: "Calibri" });

  // epididymitis box right
  s.addShape(pres.ShapeType.roundRect, { x: 5.2, y: 0.82, w: 4.6, h: 4.7, fill: { color: BG_MID }, line: { color: GOLD, pt: 1.5 }, rectRadius: 0.1 });
  s.addShape(pres.ShapeType.rect, { x: 5.2, y: 0.82, w: 4.6, h: 0.45, fill: { color: GOLD } });
  s.addText("EPIDIDYMITIS", { x: 5.2, y: 0.84, w: 4.6, h: 0.4, fontSize: 17, bold: true, color: BG_DARK, align: "center", fontFace: "Calibri" });
  s.addText([
    { text: "Pathophysiology:\n", options: { bold: true, color: GOLD, fontSize: 13, breakLine: true } },
    ...bullet([
      "Retrograde spread of bacteria from urethra/bladder via vas deferens to epididymis",
      "Starts at cauda → ascends to caput → may extend to testis (orchitis)",
      "STI (<35 yrs): Chlamydia trachomatis, N. gonorrhoeae",
      "Enteric (>35 yrs): E. coli, Klebsiella",
      "Unilateral in 96% of cases"
    ], WHITE),
    { text: "\nKey Features:\n", options: { bold: true, color: GOLD, fontSize: 13, breakLine: true } },
    ...bullet([
      "Gradual onset pain (days to weeks) – unlike torsion",
      "Cremasteric reflex: INTACT",
      "Prehn's sign positive (elevation relieves pain)",
      "Pyuria on urinalysis",
      "US: hyperechoic enlarged epididymis + ↑ blood flow on Doppler"
    ], ACCENT2),
  ], { x: 5.35, y: 1.35, w: 4.3, h: 4.1, valign: "top", fontFace: "Calibri" });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 9 – Varicocele/Hydrocele Image Slide
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Scrotal Conditions – Visual Comparison", 0.15);

  const d6 = imgData(5); // Lecturio varicocele/hydrocele
  if (d6) {
    s.addImage({ data: d6, x: 1.2, y: 0.85, w: 7.6, h: 4.2 });
    s.addText("Varicocele, Hydrocele & Spermatocele – Comparative Anatomy (Lecturio Medical)", {
      x: 1.2, y: 5.07, w: 7.6, h: 0.4, fontSize: 11, italic: true, color: ACCENT2, align: "center", fontFace: "Calibri"
    });
  } else {
    s.addText([
      { text: "Varicocele vs Hydrocele vs Spermatocele\n\n", options: { bold: true, color: GOLD, fontSize: 20, breakLine: true } },
      ...bullet([
        "Varicocele: dilated pampiniform veins – 'bag of worms' – left side predominant",
        "Hydrocele: fluid in tunica vaginalis – transilluminates – smooth, non-tender",
        "Spermatocele: cyst of epididymis containing spermatozoa – above/behind testis"
      ]),
    ], { x: 1.5, y: 1.5, w: 7.0, h: 3.5, valign: "middle", fontFace: "Calibri" });
  }
}

// ═══════════════════════════════════════════════════════════
// SLIDE 10 – Clinical Examination Approach
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Clinical Examination of a Scrotal Swelling", 0.15);

  // 4-step boxes
  const steps = [
    { n: "1", q: "Can you get ABOVE the swelling?", a: "NO → Inguinal hernia extending into scrotum\nYES → Scrotal origin", color: ACCENT },
    { n: "2", q: "Is the testis PALPABLE separately?", a: "NO → Swelling encloses testis (hydrocele, large hernia)\nYES → Swelling is separate (epididymal cyst, spermatocele)", color: GOLD },
    { n: "3", q: "Does it TRANSILLUMINATE?", a: "YES → Clear fluid content (hydrocele, spermatocele)\nNO → Solid/blood content (tumor, hematocele, hernia)", color: GREEN },
    { n: "4", q: "Is it TENDER?", a: "YES → Inflammatory/ischaemic (torsion, epididymitis, orchitis)\nNO → Likely benign/neoplastic (hydrocele, tumor, varicocele)", color: SOFT_RED },
  ];

  steps.forEach((st, i) => {
    const x = i % 2 === 0 ? 0.3 : 5.15;
    const y = i < 2 ? 0.85 : 3.25;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 4.55, h: 2.2, fill: { color: BG_MID }, line: { color: st.color, pt: 1.8 }, rectRadius: 0.1 });
    s.addShape(pres.ShapeType.ellipse, { x: x + 0.1, y: y + 0.1, w: 0.5, h: 0.5, fill: { color: st.color } });
    s.addText(st.n, { x: x + 0.1, y: y + 0.1, w: 0.5, h: 0.5, fontSize: 18, bold: true, color: BG_DARK, align: "center", valign: "middle", fontFace: "Calibri" });
    s.addText(st.q, { x: x + 0.7, y: y + 0.12, w: 3.75, h: 0.5, fontSize: 14, bold: true, color: st.color, fontFace: "Calibri" });
    s.addText(st.a, { x: x + 0.2, y: y + 0.68, w: 4.2, h: 1.4, fontSize: 12.5, color: WHITE, fontFace: "Calibri", valign: "top" });
  });

  s.addText("Bailey & Love's Surgery: 'Examination of a scrotal swelling should be undertaken in both upright and supine position'", {
    x: 0.3, y: 5.38, w: 9.4, h: 0.28, fontSize: 10, italic: true, color: "5A7FA8", fontFace: "Calibri"
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 11 – Differential Diagnosis Table
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Differential Diagnosis – Acute Scrotum Comparison", 0.15);

  const rows = [
    ["Parameter", "Testicular Torsion", "Epididymitis", "Torsion of Appendix Testis"],
    ["Age", "< 1 yr, puberty", "Adult (STI <35 / enteric >35)", "7–14 years"],
    ["Onset", "Sudden (hours)", "Gradual (days–weeks)", "1–2 days"],
    ["Pain location", "Entire testicle + lower abdomen", "Epididymis", "Upper pole of testis"],
    ["Cremasteric reflex", "ABSENT", "Intact", "Intact"],
    ["Testis position", "High-riding, transverse", "Normal", "Normal"],
    ["Pyuria", "Rare", "Present", "No"],
    ["Fever/Systemic", "Nausea, vomiting", "Possibly fever", "None"],
    ["Doppler US", "↓ / absent flow", "↑ flow (hyperemia)", "Normal flow"],
    ["Treatment", "Surgery (URGENT)", "Antibiotics", "Supportive (analgesia)"],
  ];

  const colW = [2.1, 2.5, 2.5, 2.5];
  const colX = [0.2, 2.35, 4.9, 7.45];
  const rowH = 0.42;

  rows.forEach((row, ri) => {
    row.forEach((cell, ci) => {
      const y = 0.82 + ri * rowH;
      const isHeader = ri === 0;
      const fillColor = isHeader ? ACCENT : (ri % 2 === 0 ? BG_MID : "122035");
      const textColor = isHeader ? BG_DARK : (ci === 0 ? GOLD : WHITE);
      s.addShape(pres.ShapeType.rect, { x: colX[ci], y, w: colW[ci], h: rowH, fill: { color: fillColor }, line: { color: "1A3A5C", pt: 0.5 } });
      s.addText(cell, { x: colX[ci] + 0.08, y: y + 0.02, w: colW[ci] - 0.16, h: rowH - 0.04, fontSize: isHeader ? 13 : 11.5, bold: isHeader || ci === 0, color: textColor, fontFace: "Calibri", valign: "middle" });
    });
  });

  s.addText("Source: Rosen's Emergency Medicine, Table 85.9", {
    x: 0.2, y: 5.15, w: 9.5, h: 0.25, fontSize: 10, italic: true, color: "5A7FA8", fontFace: "Calibri"
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 12 – Fournier Gangrene & Scrotal Masses
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Special Conditions: Fournier Gangrene & Testicular Tumors", 0.15);

  // Fournier
  s.addShape(pres.ShapeType.roundRect, { x: 0.3, y: 0.82, w: 4.5, h: 4.65, fill: { color: BG_MID }, line: { color: SOFT_RED, pt: 2 }, rectRadius: 0.1 });
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.82, w: 4.5, h: 0.48, fill: { color: SOFT_RED } });
  s.addText("⚠ FOURNIER GANGRENE", { x: 0.3, y: 0.84, w: 4.5, h: 0.43, fontSize: 15, bold: true, color: WHITE, align: "center", fontFace: "Calibri" });
  s.addText([
    { text: "Necrotizing fasciitis of the male genitalia and perineum\n\n", options: { bold: true, color: WHITE, fontSize: 14, breakLine: true } },
    ...bullet([
      "Also known as: idiopathic gangrene of scrotum, perineal phlegmon",
      "Polymicrobial infection (mixed aerobes + anaerobes) causing synergistic gangrene",
      "Risk factors: diabetes, obesity, immunosuppression, alcohol abuse",
      "Presents: severe pain, scrotal/genital swelling, skin discolouration, crepitus, foul-smelling discharge",
      "Mortality: up to 67% if untreated",
      "Treatment: EMERGENCY – aggressive surgical debridement + broad-spectrum antibiotics + ICU"
    ], WHITE),
  ], { x: 0.45, y: 1.38, w: 4.2, h: 4.0, valign: "top", fontFace: "Calibri" });

  // Testicular tumors
  s.addShape(pres.ShapeType.roundRect, { x: 5.2, y: 0.82, w: 4.5, h: 4.65, fill: { color: BG_MID }, line: { color: ACCENT, pt: 1.5 }, rectRadius: 0.1 });
  s.addShape(pres.ShapeType.rect, { x: 5.2, y: 0.82, w: 4.5, h: 0.48, fill: { color: ACCENT } });
  s.addText("TESTICULAR TUMORS", { x: 5.2, y: 0.84, w: 4.5, h: 0.43, fontSize: 15, bold: true, color: BG_DARK, align: "center", fontFace: "Calibri" });
  s.addText([
    { text: "Most common solid malignancy in males 15–35 years\n\n", options: { bold: true, color: WHITE, fontSize: 14, breakLine: true } },
    ...bullet([
      "Typically PAINLESS, firm scrotal mass – 'rock hard'",
      "May present with dull ache or sense of heaviness",
      "Risk factors: cryptorchidism (#1), family history, Klinefelter syndrome",
      "Types: Germ cell tumors (95%) – seminoma vs non-seminoma",
      "Tumor markers: AFP, β-hCG, LDH",
      "Secondary hydrocele may accompany tumor – DO NOT aspirate",
      "Differential: epididymitis (confused clinically), hydrocele"
    ], WHITE),
    { text: "\nTreatment: Radical inguinal orchiectomy (never trans-scrotal biopsy)", options: { bold: true, color: GREEN, fontSize: 12, breakLine: true } }
  ], { x: 5.35, y: 1.38, w: 4.2, h: 4.0, valign: "top", fontFace: "Calibri" });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 13 – Investigations & Diagnostics
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Investigations – A Systematic Approach", 0.15);

  const invs = [
    { title: "Bedside / Clinical", color: ACCENT, x: 0.3, y: 0.82, items: [
      "Transillumination test (hydrocele = bright glow)",
      "Cremasteric reflex (absent in torsion)",
      "Prehn's sign (pain relief on elevation = epididymitis)",
      "Blue dot sign (torsion of appendix testis)"
    ]},
    { title: "Urine Analysis & Culture", color: GREEN, x: 5.2, y: 0.82, items: [
      "Pyuria → suggests epididymitis / UTI",
      "First-void urine for Chlamydia NAAT",
      "Mid-stream urine for culture & sensitivity",
      "Absent in torsion (rare pyuria)"
    ]},
    { title: "Scrotal Ultrasound (Doppler)", color: GOLD, x: 0.3, y: 3.1, items: [
      "Investigation of choice for acute scrotum",
      "Sensitivity 96–100%, specificity 84–95% for torsion",
      "'Whirlpool sign' – twisting of spermatic cord",
      "Torsion: ↓ / absent flow; Epididymitis: ↑ flow",
      "Heterogeneous echotexture = late torsion / non-viable",
      "NOTE: Do NOT delay urology consult for USS if torsion suspected"
    ]},
    { title: "Blood Tests & Tumour Markers", color: SOFT_RED, x: 5.2, y: 3.1, items: [
      "FBC: ↑ WBC in infection/Fournier's",
      "CRP/ESR: inflammation markers",
      "AFP + β-hCG + LDH: testicular germ cell tumors",
      "STI screen: Chlamydia, Gonorrhoea serology"
    ]},
  ];

  invs.forEach(inv => {
    s.addShape(pres.ShapeType.roundRect, { x: inv.x, y: inv.y, w: 4.6, h: 2.15, fill: { color: BG_MID }, line: { color: inv.color, pt: 1.5 }, rectRadius: 0.08 });
    s.addText(inv.title, { x: inv.x + 0.1, y: inv.y + 0.07, w: 4.4, h: 0.38, fontSize: 14, bold: true, color: inv.color, fontFace: "Calibri" });
    s.addText(bullet(inv.items, WHITE), { x: inv.x + 0.1, y: inv.y + 0.48, w: 4.4, h: 1.58, valign: "top", fontFace: "Calibri" });
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 14 – Management Summary
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  sectionTitle(s, "Management Summary", 0.15);

  const mgmt = [
    { cond: "Testicular Torsion", rx: "SURGICAL EMERGENCY\n• Manual detorsion (temporary only)\n• Urgent scrotal exploration\n• Bilateral orchiopexy\n• < 6 hrs for best viability", color: SOFT_RED, urgency: "EMERGENCY" },
    { cond: "Epididymitis", rx: "ANTIBIOTICS\n• STI: ceftriaxone 250mg IM + doxycycline 100mg BD × 10 days\n• Enteric: levofloxacin 500mg OD × 10 days\n• Scrotal elevation, NSAIDs, analgesia", color: GOLD, urgency: "URGENT" },
    { cond: "Hydrocele", rx: "CONSERVATIVE / SURGICAL\n• Congenital: watch & wait (resolves by 2 yrs)\n• Symptomatic/persistent: hydrocelectomy (Lord's / Jaboulay's)\n• Aspiration: only for poor surgical candidates", color: ACCENT, urgency: "ELECTIVE" },
    { cond: "Varicocele", rx: "CONSERVATIVE / SURGICAL\n• Grade I-II: analgesia, scrotal support\n• Grade III or infertility: surgical ligation or radiological embolisation\n• Yearly surveillance for testicular atrophy", color: GREEN, urgency: "ELECTIVE" },
    { cond: "Fournier Gangrene", rx: "SURGICAL EMERGENCY\n• Aggressive wide surgical debridement\n• Broad-spectrum IV antibiotics\n• ICU admission, +/- hyperbaric oxygen\n• Mortality up to 67% without prompt treatment", color: "FF6B35", urgency: "LIFE-THREATENING" },
    { cond: "Testicular Tumor", rx: "SURGERY + ONCOLOGY\n• Radical inguinal orchiectomy (NOT trans-scrotal biopsy)\n• Staging CT chest/abdomen/pelvis\n• Seminoma: radiotherapy/chemo\n• Non-seminoma: BEP chemotherapy", color: ACCENT2, urgency: "URGENT" },
  ];

  const colW = 3.05, rowH = 1.68;
  mgmt.forEach((m, i) => {
    const x = i % 3 === 0 ? 0.2 : i % 3 === 1 ? 3.43 : 6.65;
    const y = i < 3 ? 0.82 : 2.6;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: colW, h: rowH, fill: { color: BG_MID }, line: { color: m.color, pt: 1.5 }, rectRadius: 0.08 });
    s.addShape(pres.ShapeType.rect, { x, y, w: colW, h: 0.38, fill: { color: m.color } });
    s.addText(m.cond, { x: x + 0.05, y: y + 0.02, w: colW - 0.1, h: 0.34, fontSize: 12, bold: true, color: BG_DARK, align: "center", fontFace: "Calibri" });
    s.addText(m.rx, { x: x + 0.1, y: y + 0.42, w: colW - 0.2, h: rowH - 0.48, fontSize: 10.5, color: WHITE, fontFace: "Calibri", valign: "top" });
  });

  s.addShape(pres.ShapeType.rect, { x: 0.2, y: 4.35, w: 9.6, h: 0.28, fill: { color: "1A1A3A" }, line: { color: ACCENT2, pt: 0.5 } });
  s.addText("🔑 Remember: In any acute scrotum with torsion suspected – SURGICAL EXPLORATION takes priority over investigations!", {
    x: 0.3, y: 4.37, w: 9.4, h: 0.24, fontSize: 12, bold: true, color: ACCENT2, fontFace: "Calibri"
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 15 – Key Takeaways
// ═══════════════════════════════════════════════════════════
{
  const s = addSlide(pres, BG_DARK);
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: ACCENT } });

  sectionTitle(s, "Key Takeaways & Exam Points", 0.15);

  const points = [
    { text: "Thermoregulation: Testes must be 2–3°C below core temperature – maintained by dartos muscle, cremaster, and pampiniform plexus countercurrent exchanger", color: ACCENT },
    { text: "Testicular torsion is a TIME-SENSITIVE EMERGENCY: 'time is testis' – aim for surgical exploration within 6 hours of symptom onset", color: SOFT_RED },
    { text: "Cremasteric reflex: ABSENT in torsion, INTACT in epididymitis and appendix testis torsion – most important clinical differentiator", color: GOLD },
    { text: "Transillumination: positive in hydrocele (clear fluid) and spermatocele; negative in tumor, hematocele, hernia", color: GREEN },
    { text: "Varicocele: left-sided predominance due to left internal spermatic vein drainage angle; Grade III = 'bag of worms' appearance", color: ACCENT2 },
    { text: "Hydrocele – NEVER aspirate if malignancy suspected (risk of needle-track seeding); testicular tumor – NEVER trans-scrotal biopsy", color: SOFT_RED },
    { text: "Fournier gangrene: polymicrobial necrotizing fasciitis – up to 67% mortality → immediate surgical debridement is life-saving", color: GOLD },
    { text: "Ultrasound Doppler is the investigation of choice for acute scrotum (sensitivity 96–100% for torsion), but must NOT delay urology consult", color: GREEN },
  ];

  points.forEach((p, i) => {
    const y = 0.82 + i * 0.57;
    s.addShape(pres.ShapeType.rect, { x: 0.3, y: y, w: 0.12, h: 0.42, fill: { color: p.color } });
    s.addText(p.text, { x: 0.52, y: y + 0.02, w: 9.2, h: 0.43, fontSize: 12.5, color: WHITE, fontFace: "Calibri", valign: "middle" });
  });
}

// ─── Write file ───────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/scrotal-swelling-ppt/Physiology_of_Scrotal_Swelling.pptx" })
  .then(() => console.log("✅ Presentation saved successfully!"))
  .catch(e => console.error("❌ Error:", e));
Running Command

cd /home/daytona/workspace/scrotal-swelling-ppt && node build.js 2>&1

Editing File

~/scrotal-swelling-ppt/build.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/scrotal-swelling-ppt/build.js'
Running Command

cd /home/daytona/workspace/scrotal-swelling-ppt && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/scrotal-swelling-ppt/

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

Physiology of Scrotal Swelling

Presentation · PPTX


What's inside (15 slides, deep navy + teal theme)

SlideContent
1Title slide with topic overview
2Anatomy of the Scrotum - all layers with labeled diagram (from Rosen's EM textbook)
3Scrotal Layers & Thermoregulation - pampiniform plexus, dartos, cremaster physiology
4Classification by Age - Infant / Child / Adolescent / Adult (from Rosen's BOX 85.5)
5Pathophysiology Overview - 4 mechanisms: fluid, vascular, inflammatory, obstructive
6Hydrocele Deep Dive - 4 types with types diagram (Bailey & Love's Surgery)
7Testicular Torsion - bell-clapper deformity, time-viability window, Doppler US images
8Varicocele & Epididymitis - side-by-side comparison with grading + pathogens
9Visual Comparison - varicocele/hydrocele/spermatocele diagram
10Clinical Examination - 4-step systematic approach (get above / palpate / transilluminate / tenderness)
11Differential Diagnosis Table - Torsion vs Epididymitis vs Appendix Torsion
12Fournier Gangrene & Testicular Tumors - red flags, management
13Investigations - 4 boxes: bedside, urinalysis, Doppler US, blood tests/tumor markers
14Management Summary - all 6 conditions with urgency tags
15Key Takeaways - 8 high-yield exam points with color coding
Sources cited: Bailey & Love's Surgery (28th ed), Campbell-Walsh Wein Urology, Rosen's Emergency Medicine, Goldman-Cecil Medicine, Histology: Text & Atlas.
This is a shared conversation. Sign in to Orris to start your own chat.