Create a PPT of hydrocele with details from bailey and sabiston with images

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

mkdir -p /home/daytona/workspace/hydrocele-ppt && ls /home/daytona/workspace/hydrocele-ppt/

Writing File

~/hydrocele-ppt/create_hydrocele_ppt.js

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

// Fetch images as base64
const imageUrls = [
  "https://cdn.orris.care/cdss_images/149b1f8484a9832b49d38235cd6a3caee4b50f887e987fee7ce402e8dcff3980.png",  // Fig 86.8 types
  "https://cdn.orris.care/cdss_images/cd9ebcd2b44456db2628445585eb4c0a42cbec993bfeb3ad0a094a6bad69fc0b.png",  // Fig 86.9 clinical photo + US
  "https://cdn.orris.care/cdss_images/603bee10335caf3f2ed96d20dbd072b735d3ae6d50164dc9b756a1eb592e3c65.png",  // Fig 86.10a Lord's op
  "https://cdn.orris.care/cdss_images/978b9f4cac8e3a4ab345edc9bbda4549968138eddd89500fca842e75bb6f353a.png",  // Fig 86.10b Jaboulay's
];

console.log("Fetching images...");
let images = [];
try {
  const result = execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`,
    { maxBuffer: 50 * 1024 * 1024 }
  ).toString();
  images = JSON.parse(result);
  console.log("Images fetched:", images.map(i => i.error ? "ERROR: " + i.error : "OK"));
} catch (e) {
  console.error("Image fetch error:", e.message);
  images = imageUrls.map(() => ({ base64: null, error: "fetch failed" }));
}

// ─────────────── PRESENTATION SETUP ───────────────
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Hydrocele";
pres.author = "Bailey & Love / Sabiston";

// Color palette: deep teal dominant, white text, gold accent
const DARK = "0D3349";      // deep navy-teal (dominant)
const MID  = "12516F";      // mid teal for headers
const ACCENT = "E8A838";    // gold accent
const LIGHT = "EFF7FA";     // light background
const WHITE = "FFFFFF";
const BODY  = "1C2B36";     // dark body text on light bg
const SUBTITLE = "A8D5E8";  // muted blue subtitle

function darkSlide(slide) {
  slide.background = { color: DARK };
}
function lightSlide(slide) {
  slide.background = { color: LIGHT };
}

function addSlideTitle(slide, title, dark = true) {
  slide.addText(title, {
    x: 0.4, y: 0.12, w: 9.2, h: 0.65,
    fontSize: 26, bold: true, color: dark ? ACCENT : MID,
    fontFace: "Calibri", margin: 0
  });
  // Accent underline bar
  slide.addShape(pres.ShapeType.rect, {
    x: 0.4, y: 0.78, w: 2.0, h: 0.06,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });
}

// ═══════════════════════════════════════════
// SLIDE 1 — TITLE SLIDE
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);

  // Large background accent rectangle
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 0.22, h: 5.625,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });

  s.addText("HYDROCELE", {
    x: 0.5, y: 1.3, w: 9.0, h: 1.2,
    fontSize: 54, bold: true, color: WHITE,
    fontFace: "Calibri", charSpacing: 4, margin: 0
  });
  s.addText("A Comprehensive Surgical Review", {
    x: 0.5, y: 2.6, w: 9.0, h: 0.6,
    fontSize: 22, color: SUBTITLE,
    fontFace: "Calibri", italic: true, margin: 0
  });
  s.addText("Sources: Bailey & Love's Short Practice of Surgery (28th Ed.) · Sabiston Textbook of Surgery", {
    x: 0.5, y: 4.7, w: 9.0, h: 0.5,
    fontSize: 13, color: SUBTITLE,
    fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════
// SLIDE 2 — DEFINITION & INCIDENCE
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  lightSlide(s);
  addSlideTitle(s, "Definition & Incidence", false);

  // Left column – definition
  s.addShape(pres.ShapeType.rect, {
    x: 0.3, y: 0.95, w: 4.5, h: 4.0,
    fill: { color: MID }, line: { color: MID },
    rectRadius: 0.1
  });
  s.addText("DEFINITION", {
    x: 0.4, y: 1.0, w: 4.3, h: 0.45,
    fontSize: 16, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0
  });
  s.addText([
    { text: "An abnormal collection of serous fluid in a part of the processus vaginalis, usually the ", options: { color: WHITE } },
    { text: "tunica vaginalis", options: { color: ACCENT, bold: true } },
    { text: " around the testis, and occasionally along the spermatic cord.", options: { color: WHITE } },
    { text: "\n\nAcquired hydroceles are:", options: { color: WHITE, bold: true, breakLine: false } },
    { text: "\n• Primary (idiopathic)", options: { color: WHITE, bullet: false } },
    { text: "\n• Secondary to epididymal or testicular disease", options: { color: WHITE } },
  ], {
    x: 0.4, y: 1.5, w: 4.25, h: 3.3,
    fontSize: 15, fontFace: "Calibri", valign: "top", margin: 6
  });

  // Right column – incidence
  s.addShape(pres.ShapeType.rect, {
    x: 5.1, y: 0.95, w: 4.6, h: 4.0,
    fill: { color: DARK }, line: { color: DARK },
    rectRadius: 0.1
  });
  s.addText("INCIDENCE", {
    x: 5.2, y: 1.0, w: 4.4, h: 0.45,
    fontSize: 16, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0
  });
  s.addText([
    { text: "~1%", options: { fontSize: 36, bold: true, color: ACCENT } },
    { text: "\nof adult men are affected", options: { color: WHITE } },
    { text: "\n\n", options: {} },
    { text: ">80%", options: { fontSize: 30, bold: true, color: ACCENT } },
    { text: "\nof newborn boys have a patent processus vaginalis", options: { color: WHITE } },
    { text: "\n\nMost close spontaneously within ", options: { color: WHITE } },
    { text: "18 months", options: { bold: true, color: ACCENT } },
    { text: " of age", options: { color: WHITE } },
  ], {
    x: 5.2, y: 1.5, w: 4.4, h: 3.3,
    fontSize: 15, fontFace: "Calibri", valign: "top", margin: 6
  });

  s.addText("Bailey & Love, 28th Ed.", {
    x: 7.5, y: 5.3, w: 2.2, h: 0.25,
    fontSize: 10, color: MID, italic: true, fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════
// SLIDE 3 — PATHOPHYSIOLOGY / EMBRYOLOGY
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  addSlideTitle(s, "Pathophysiology & Embryology");

  s.addText([
    { text: "Embryology: ", options: { bold: true, color: ACCENT } },
    { text: "The processus vaginalis is a diverticulum of the peritoneal cavity that descends with the testes into the scrotum via the inguinal canal around the ", options: { color: WHITE } },
    { text: "28th week of gestation", options: { bold: true, color: ACCENT } },
    { text: ", with gradual closure through infancy and childhood.", options: { color: WHITE } },
  ], {
    x: 0.4, y: 0.9, w: 9.2, h: 0.9,
    fontSize: 14, fontFace: "Calibri", margin: 0
  });

  // Three type boxes
  const types = [
    { title: "1. Communicating (Congenital)", color: "#1A6E8A", text: "Patent processus vaginalis permits flow of peritoneal fluid into scrotum (tunica vaginalis). Associated with indirect inguinal hernias." },
    { title: "2. Non-communicating (Vaginal)", color: "#145C73", text: "Processus vaginalis is closed. Fluid accumulates due to excessive production and/or defective absorption by tunica vaginalis — disrupted lymphatic drainage." },
    { title: "3. Infantile / Cord Hydrocele", color: "#0F4A5C", text: "Distal end closes correctly but mid-portion remains patent. Proximal open = 'infantile' hydrocele; proximal closed = hydrocele of the cord." },
  ];

  types.forEach((t, i) => {
    const x = 0.3 + i * 3.2;
    s.addShape(pres.ShapeType.rect, {
      x: x, y: 1.85, w: 3.0, h: 3.25,
      fill: { color: t.color.replace("#", "") }, line: { color: ACCENT },
      rectRadius: 0.1
    });
    s.addText(t.title, {
      x: x + 0.1, y: 1.9, w: 2.8, h: 0.55,
      fontSize: 13, bold: true, color: ACCENT, fontFace: "Calibri",
      margin: 4, wrap: true
    });
    s.addText(t.text, {
      x: x + 0.1, y: 2.52, w: 2.8, h: 2.5,
      fontSize: 12.5, color: WHITE, fontFace: "Calibri",
      margin: 4, wrap: true, valign: "top"
    });
  });

  // Secondary hydrocele note
  s.addText([
    { text: "Secondary hydroceles ", options: { bold: true, color: ACCENT } },
    { text: "usually occur in men >40 years and may present acutely from local injury, infection, neoplasm or radiotherapy. If a tumour is suspected, ", options: { color: WHITE } },
    { text: "DO NOT puncture", options: { bold: true, color: "FF6B6B" } },
    { text: " — risk of malignant needle-track implantation.", options: { color: WHITE } },
  ], {
    x: 0.4, y: 5.1, w: 9.2, h: 0.4,
    fontSize: 12, fontFace: "Calibri", margin: 0
  });

  s.addText("Bailey & Love, 28th Ed.", {
    x: 7.5, y: 5.35, w: 2.2, h: 0.2,
    fontSize: 10, color: SUBTITLE, italic: true, fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════
// SLIDE 4 — TYPES DIAGRAM (with image)
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  lightSlide(s);
  addSlideTitle(s, "Classification of Hydrocele — Illustrated", false);

  if (images[0] && !images[0].error) {
    s.addImage({ data: images[0].base64, x: 0.3, y: 0.95, w: 5.5, h: 4.3 });
  }

  // Type labels
  const labels = [
    "Fig. 86.8 (Bailey & Love):\n(a) Vaginal hydrocele – most common",
    "(b) 'Infantile' hydrocele",
    "(c) Congenital hydrocele",
    "(d) Hydrocele of the cord",
  ];
  s.addShape(pres.ShapeType.rect, {
    x: 6.0, y: 0.95, w: 3.7, h: 4.3,
    fill: { color: DARK }, line: { color: MID }, rectRadius: 0.1
  });
  s.addText("CLASSIFICATION", {
    x: 6.1, y: 1.0, w: 3.5, h: 0.4,
    fontSize: 14, bold: true, color: ACCENT, fontFace: "Calibri", margin: 4
  });
  s.addText(labels.map((l, i) => ({
    text: `${l}\n`, options: {
      color: i === 0 ? ACCENT : WHITE,
      fontSize: 13,
      bullet: true,
      breakLine: true
    }
  })), {
    x: 6.1, y: 1.45, w: 3.5, h: 3.5,
    fontFace: "Calibri", valign: "top", margin: 6
  });

  s.addText("Bailey & Love, Fig 86.8", {
    x: 0.3, y: 5.28, w: 3.5, h: 0.25,
    fontSize: 10, color: MID, italic: true, fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════
// SLIDE 5 — CLINICAL FEATURES
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  addSlideTitle(s, "Clinical Features");

  // Left: exam steps
  s.addShape(pres.ShapeType.rect, {
    x: 0.3, y: 0.9, w: 5.1, h: 4.3,
    fill: { color: MID }, line: { color: MID }, rectRadius: 0.1
  });
  s.addText("EXAMINATION — 3 KEY QUESTIONS", {
    x: 0.4, y: 0.95, w: 4.9, h: 0.45,
    fontSize: 14, bold: true, color: ACCENT, fontFace: "Calibri", margin: 4
  });
  s.addText([
    { text: "1. ", options: { bold: true, color: ACCENT } },
    { text: "Can you get ABOVE the swelling?\n", options: { color: WHITE } },
    { text: "   If not → suspect inguinal hernia\n\n", options: { color: SUBTITLE, fontSize: 12 } },
    { text: "2. ", options: { bold: true, color: ACCENT } },
    { text: "Are testis & epididymis palpable?\n", options: { color: WHITE } },
    { text: "   Hydrocele encloses both → may be impalpable\n\n", options: { color: SUBTITLE, fontSize: 12 } },
    { text: "3. ", options: { bold: true, color: ACCENT } },
    { text: "Does swelling TRANSILLUMINATE?\n", options: { color: WHITE } },
    { text: "   Hydroceles are typically translucent", options: { color: SUBTITLE, fontSize: 12 } },
  ], {
    x: 0.4, y: 1.45, w: 4.9, h: 3.6,
    fontSize: 14, fontFace: "Calibri", valign: "top", margin: 6
  });

  // Right: clinical notes
  s.addShape(pres.ShapeType.rect, {
    x: 5.6, y: 0.9, w: 4.1, h: 4.3,
    fill: { color: "0F4A5C" }, line: { color: ACCENT }, rectRadius: 0.1
  });
  s.addText("CLINICAL NOTES", {
    x: 5.7, y: 0.95, w: 3.9, h: 0.45,
    fontSize: 14, bold: true, color: ACCENT, fontFace: "Calibri", margin: 4
  });
  s.addText([
    { text: "Primary hydrocele:\n", options: { bold: true, color: ACCENT } },
    { text: "Most common in middle and later life. Usually painless → may reach large size before presentation.\n\n", options: { color: WHITE, fontSize: 13 } },
    { text: "⚠ Acute hydrocele in young man:\n", options: { bold: true, color: "FF6B6B" } },
    { text: "Always consider testicular tumour.\n\n", options: { color: WHITE, fontSize: 13 } },
    { text: "Congenital hydrocele:\n", options: { bold: true, color: ACCENT } },
    { text: "May be intermittent; check for ascites if bilateral. Pressure doesn't always empty it.\n\n", options: { color: WHITE, fontSize: 13 } },
    { text: "Hydrocele of cord:\n", options: { bold: true, color: ACCENT } },
    { text: "Smooth oval swelling above testis. Moves downwards when testis is pulled — distinguishes from hernia.", options: { color: WHITE, fontSize: 13 } },
  ], {
    x: 5.7, y: 1.45, w: 3.85, h: 3.6,
    fontFace: "Calibri", valign: "top", margin: 6
  });

  s.addText("Bailey & Love, 28th Ed.", {
    x: 7.5, y: 5.35, w: 2.2, h: 0.2,
    fontSize: 10, color: SUBTITLE, italic: true, fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════
// SLIDE 6 — CLINICAL PHOTO & ULTRASOUND
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  lightSlide(s);
  addSlideTitle(s, "Clinical Presentation — Photo & Ultrasound", false);

  if (images[1] && !images[1].error) {
    s.addImage({ data: images[1].base64, x: 0.3, y: 0.95, w: 6.0, h: 4.3 });
  }

  s.addShape(pres.ShapeType.rect, {
    x: 6.5, y: 0.95, w: 3.2, h: 4.3,
    fill: { color: DARK }, line: { color: MID }, rectRadius: 0.1
  });
  s.addText("ULTRASOUND", {
    x: 6.6, y: 1.0, w: 3.0, h: 0.4,
    fontSize: 15, bold: true, color: ACCENT, fontFace: "Calibri", margin: 4
  });
  s.addText([
    { text: "Valuable adjunct ", options: { bold: true, color: ACCENT } },
    { text: "especially when the testis and epididymis are impalpable.\n\n", options: { color: WHITE } },
    { text: "Used to:\n", options: { bold: true, color: ACCENT } },
    { text: "• Assess testicular pathology\n", options: { color: WHITE } },
    { text: "• Exclude testicular tumour\n", options: { color: WHITE } },
    { text: "• Differentiate from hernia\n\n", options: { color: WHITE } },
    { text: "Transillumination can be misleading in thin-walled bowel loops in infants.", options: { color: SUBTITLE, fontSize: 12 } },
  ], {
    x: 6.6, y: 1.45, w: 3.0, h: 3.6,
    fontSize: 14, fontFace: "Calibri", valign: "top", margin: 6
  });

  s.addText("Bailey & Love, Fig 86.9 — Right-sided hydrocele (clinical photo + ultrasound)", {
    x: 0.3, y: 5.28, w: 6.0, h: 0.25,
    fontSize: 10, color: MID, italic: true, fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════
// SLIDE 7 — DIAGNOSIS
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  addSlideTitle(s, "Diagnosis");

  const rows = [
    ["Method", "Finding", "Note"],
    ["History", "Painless scrotal swelling, often large at presentation", "Acute onset in young man → red flag"],
    ["Examination", "Get above swelling ✓ | Transilluminates ✓ | Testis impalpable", "Bimanual palpation upright & supine"],
    ["Ultrasound", "Anechoic fluid surrounding testis; testis appears normal", "Method of choice to exclude malignancy"],
    ["Transillumination", "Bright translucency in hydrocele", "May be misleading in thin bowel loops (infants)"],
    ["Tumour markers", "AFP, β-HCG, LDH — order if solid lesion suspected", "Exclude germ cell tumour"],
  ];

  s.addTable(rows, {
    x: 0.3, y: 0.92, w: 9.4, h: 4.5,
    fontSize: 13, fontFace: "Calibri",
    colW: [2.0, 4.4, 2.8],
    rowH: [0.5, 0.7, 0.8, 0.7, 0.7, 0.7],
    border: { pt: 1, color: MID },
    align: "left",
    color: WHITE,
    fill: { color: DARK },
    autoPage: false,
    newSlideStartY: 0.5,
  });

  s.addText("Bailey & Love / Sabiston", {
    x: 7.5, y: 5.35, w: 2.2, h: 0.2,
    fontSize: 10, color: SUBTITLE, italic: true, fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════
// SLIDE 8 — TREATMENT
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  lightSlide(s);
  addSlideTitle(s, "Treatment", false);

  // Conservative column
  s.addShape(pres.ShapeType.rect, {
    x: 0.3, y: 0.9, w: 2.9, h: 4.4,
    fill: { color: DARK }, line: { color: MID }, rectRadius: 0.1
  });
  s.addText("CONSERVATIVE", {
    x: 0.35, y: 0.95, w: 2.8, h: 0.42,
    fontSize: 13, bold: true, color: ACCENT, fontFace: "Calibri", margin: 4
  });
  s.addText([
    { text: "Small, asymptomatic hydroceles:\n", options: { bold: true, color: WHITE } },
    { text: "No treatment required.\n\n", options: { color: SUBTITLE } },
    { text: "Congenital:\n", options: { bold: true, color: WHITE } },
    { text: "Most resolve spontaneously within 18 months.\n\n", options: { color: SUBTITLE } },
    { text: "Aspiration:\n", options: { bold: true, color: WHITE } },
    { text: "Simple but fluid reaccumulates within ~1 week. Suitable for men unfit for surgery.\n\nRisk: Haematocele formation.\n\n", options: { color: SUBTITLE } },
    { text: "Sclerotherapy:\n", options: { bold: true, color: WHITE } },
    { text: "Tetracycline injection — effective but painful.", options: { color: SUBTITLE } },
  ], {
    x: 0.4, y: 1.42, w: 2.7, h: 3.75,
    fontSize: 12, fontFace: "Calibri", valign: "top", margin: 4
  });

  // Surgical column
  s.addShape(pres.ShapeType.rect, {
    x: 3.4, y: 0.9, w: 6.3, h: 4.4,
    fill: { color: MID }, line: { color: MID }, rectRadius: 0.1
  });
  s.addText("SURGICAL (MAINSTAY OF TREATMENT)", {
    x: 3.5, y: 0.95, w: 6.1, h: 0.42,
    fontSize: 13, bold: true, color: ACCENT, fontFace: "Calibri", margin: 4
  });

  // Congenital note
  s.addText([
    { text: "Congenital: ", options: { bold: true, color: ACCENT } },
    { text: "Ligation of patent processus vaginalis (Herniotomy)", options: { color: WHITE } },
  ], {
    x: 3.5, y: 1.42, w: 6.1, h: 0.4,
    fontSize: 13, fontFace: "Calibri", margin: 4
  });

  // Three surgical technique boxes
  const techs = [
    {
      name: "1. Plication\n(Lord's Operation)",
      detail: "Suitable for thin-walled sac. Minimal dissection. Interrupted absorbable sutures plicate redundant tunica vaginalis — bunches at attachment to testis. Reduced haematoma risk.",
      col: "0A3F55"
    },
    {
      name: "2. Eversion\n(Jaboulay's Procedure)",
      detail: "Sac is opened and everted behind testis. Testis placed in fascial pouch. Overrunning stitches at cut edge reduce risk of haematoma. Care needed to stop bleeding.",
      col: "0D4F68"
    },
    {
      name: "3. Excision of Sac",
      detail: "Sac is excised. Used for thick-walled acquired hydroceles. Higher risk of haematoma if haemostasis not meticulous. Overrunning sutures at cut edge essential.",
      col: "105E7A"
    },
  ];

  techs.forEach((t, i) => {
    const x = 3.5 + i * 2.0;
    s.addShape(pres.ShapeType.rect, {
      x: x, y: 1.9, w: 1.9, h: 3.2,
      fill: { color: t.col }, line: { color: ACCENT }, rectRadius: 0.08
    });
    s.addText(t.name, {
      x: x + 0.05, y: 1.94, w: 1.8, h: 0.65,
      fontSize: 11.5, bold: true, color: ACCENT, fontFace: "Calibri",
      margin: 3, wrap: true, valign: "top"
    });
    s.addText(t.detail, {
      x: x + 0.05, y: 2.62, w: 1.8, h: 2.4,
      fontSize: 11, color: WHITE, fontFace: "Calibri",
      margin: 3, wrap: true, valign: "top"
    });
  });

  s.addText("Bailey & Love, 28th Ed. — Summary Box 86.5", {
    x: 6.5, y: 5.3, w: 3.2, h: 0.25,
    fontSize: 10, color: MID, italic: true, fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════
// SLIDE 9 — SURGICAL TECHNIQUES (with images)
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  addSlideTitle(s, "Surgical Techniques — Illustrated");

  // Lord's operation image
  s.addText("Lord's Operation (Plication)", {
    x: 0.3, y: 0.9, w: 4.5, h: 0.4,
    fontSize: 15, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0
  });
  if (images[2] && !images[2].error) {
    s.addImage({ data: images[2].base64, x: 0.3, y: 1.35, w: 4.5, h: 3.5 });
  }
  s.addText("Interrupted absorbable sutures plicate the redundant tunica vaginalis, bunching it at the attachment to the testis.", {
    x: 0.3, y: 4.88, w: 4.5, h: 0.6,
    fontSize: 11, color: SUBTITLE, fontFace: "Calibri", margin: 0, wrap: true
  });

  // Jaboulay's image
  s.addText("Jaboulay's Procedure (Eversion)", {
    x: 5.2, y: 0.9, w: 4.5, h: 0.4,
    fontSize: 15, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0
  });
  if (images[3] && !images[3].error) {
    s.addImage({ data: images[3].base64, x: 5.2, y: 1.35, w: 4.5, h: 3.5 });
  }
  s.addText("The hydrocele sac is everted and anchored with sutures behind the testis. Overrunning stitches at the cut edge reduce haematoma risk.", {
    x: 5.2, y: 4.88, w: 4.5, h: 0.6,
    fontSize: 11, color: SUBTITLE, fontFace: "Calibri", margin: 0, wrap: true
  });

  s.addText("Bailey & Love, Fig 86.10", {
    x: 0.3, y: 5.4, w: 3.0, h: 0.2,
    fontSize: 10, color: SUBTITLE, italic: true, fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════
// SLIDE 10 — FILARIAL HYDROCELE & CHYLOCELE
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  lightSlide(s);
  addSlideTitle(s, "Filarial Hydrocele & Chylocele", false);

  s.addShape(pres.ShapeType.rect, {
    x: 0.3, y: 0.9, w: 9.4, h: 0.55,
    fill: { color: MID }, line: { color: MID }, rectRadius: 0.08
  });
  s.addText("Account for up to 80% of hydroceles in tropical countries (Wuchereria bancrofti endemic areas)", {
    x: 0.4, y: 0.92, w: 9.2, h: 0.5,
    fontSize: 14, bold: true, color: WHITE, fontFace: "Calibri", margin: 4
  });

  const points = [
    ["Aetiology", "Follow repeated attacks of filarial epididymo-orchitis caused by Wuchereria bancrofti"],
    ["Chylocele", "Fluid contains liquid fat rich in cholesterol — from rupture of a lymphatic varix with discharge of chyle into the hydrocele sac"],
    ["Longstanding cases", "Dense adhesions between scrotum and its contents; filarial elephantiasis may supervene in a small number of cases"],
    ["Treatment", "Acute: Rest and aspiration\nChronic: Excision of the sac"],
    ["Sabiston note", "Acute onset hydrocele may also be associated with epididymitis, testicular torsion, and torsion of testicular appendage — ultrasound helps differentiate"],
  ];

  points.forEach((p, i) => {
    const y = 1.55 + i * 0.72;
    const bg = i % 2 === 0 ? DARK : "1A3D50";
    s.addShape(pres.ShapeType.rect, {
      x: 0.3, y: y, w: 9.4, h: 0.65,
      fill: { color: bg }, line: { color: bg }
    });
    s.addText(p[0], {
      x: 0.4, y: y + 0.04, w: 2.2, h: 0.56,
      fontSize: 13, bold: true, color: ACCENT, fontFace: "Calibri", margin: 4, valign: "middle"
    });
    s.addText(p[1], {
      x: 2.7, y: y + 0.04, w: 6.8, h: 0.56,
      fontSize: 13, color: WHITE, fontFace: "Calibri", margin: 4, valign: "middle", wrap: true
    });
  });

  s.addText("Bailey & Love, 28th Ed. | Sabiston Textbook of Surgery", {
    x: 5.5, y: 5.35, w: 4.2, h: 0.2,
    fontSize: 10, color: MID, italic: true, fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════
// SLIDE 11 — SPECIAL SITUATIONS (PEDIATRIC / SABISTON)
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  addSlideTitle(s, "Pediatric Hydrocele & Special Considerations");

  s.addShape(pres.ShapeType.rect, {
    x: 0.3, y: 0.9, w: 9.4, h: 4.55,
    fill: { color: "0A2E3F" }, line: { color: MID }, rectRadius: 0.1
  });

  s.addText([
    { text: "Processus Vaginalis (Sabiston):\n", options: { bold: true, color: ACCENT, fontSize: 15 } },
    { text: "An elongated diverticulum of the peritoneum accompanying the testicle during descent. Generally obliterated during the 9th month of gestation or soon after birth. Variable persistence leads to a spectrum: scrotal hernia, communicating hydrocele, or cord hydrocele.\n\n", options: { color: WHITE, fontSize: 13 } },

    { text: "Incidence (Sabiston):\n", options: { bold: true, color: ACCENT, fontSize: 15 } },
    { text: "Inguinal hernia with communicating hydrocele: ~3–5% of term infants, 9–11% in premature infants. Males affected ~6x more than females.\n\n", options: { color: WHITE, fontSize: 13 } },

    { text: "Transillumination Caution:\n", options: { bold: true, color: "FF6B6B", fontSize: 14 } },
    { text: "Can be misleading in infants — thin-walled bowel loops within a hernia can transilluminate. 'Silk glove sign' on palpation of cord is diagnostic clue.\n\n", options: { color: WHITE, fontSize: 13 } },

    { text: "Incarceration Risk:\n", options: { bold: true, color: "FF6B6B", fontSize: 14 } },
    { text: "Major risk of inguinal hernia with hydrocele is bowel incarceration — especially in first year of life and in premature infants.", options: { color: WHITE, fontSize: 13 } },
  ], {
    x: 0.5, y: 0.96, w: 9.0, h: 4.4,
    fontFace: "Calibri", valign: "top", margin: 8
  });

  s.addText("Sabiston Textbook of Surgery", {
    x: 7.5, y: 5.35, w: 2.2, h: 0.2,
    fontSize: 10, color: SUBTITLE, italic: true, fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════
// SLIDE 12 — SUMMARY BOX
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  lightSlide(s);
  addSlideTitle(s, "Summary — Key Points", false);

  const keyPoints = [
    "A hydrocele is a collection of fluid within the tunica vaginalis surrounding the testis",
    "Hydroceles surround the testis and transilluminate brightly",
    "Ultrasound is valuable, especially when testis and epididymis are impalpable",
    "Testicular malignancy is an uncommon but important cause — exclude by ultrasound before puncture",
    "Small, asymptomatic hydroceles can be treated conservatively",
    "Surgery is the mainstay of treatment for large/symptomatic hydroceles",
    "Three main surgical options: Plication (Lord's), Eversion (Jaboulay's), Excision",
    "Congenital hydroceles — herniotomy if not resolved by 18 months",
    "Filarial hydrocele accounts for up to 80% of cases in tropical countries",
    "Always consider testicular tumour in acute hydrocele in young men",
  ];

  keyPoints.forEach((pt, i) => {
    const col = i % 2 === 0 ? DARK : "193344";
    const y = 0.9 + i * 0.455;
    s.addShape(pres.ShapeType.rect, {
      x: 0.3, y: y, w: 9.4, h: 0.42,
      fill: { color: col }, line: { color: col }
    });
    s.addShape(pres.ShapeType.rect, {
      x: 0.3, y: y, w: 0.18, h: 0.42,
      fill: { color: ACCENT }, line: { color: ACCENT }
    });
    s.addText(pt, {
      x: 0.6, y: y + 0.03, w: 9.0, h: 0.36,
      fontSize: 13, color: WHITE, fontFace: "Calibri", margin: 2, valign: "middle"
    });
  });

  s.addText("Bailey & Love's Short Practice of Surgery, 28th Ed. | Sabiston Textbook of Surgery", {
    x: 1.5, y: 5.38, w: 7.5, h: 0.2,
    fontSize: 10, color: MID, italic: true, fontFace: "Calibri", align: "center", margin: 0
  });
}

// ═══════════════════════════════════════════
// SLIDE 13 — REFERENCES
// ═══════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);

  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 0.22, h: 5.625,
    fill: { color: ACCENT }, line: { color: ACCENT }
  });

  s.addText("References", {
    x: 0.5, y: 0.3, w: 9.0, h: 0.7,
    fontSize: 32, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0
  });

  const refs = [
    "1. Williams N, O'Connell PR, McCaskie AW. Bailey and Love's Short Practice of Surgery. 28th ed. CRC Press; 2023. Chapter 86: Scrotum and Testis — Hydrocele, pp. 1586–1588.",
    "2. Townsend CM, Beauchamp RD, Evers BM, Mattox KL. Sabiston Textbook of Surgery: The Biological Basis of Modern Surgical Practice. 21st ed. Elsevier; 2022. Pediatric Hernias and Hydroceles.",
    "3. Wein AJ, Kavoussi LR. Campbell-Walsh-Wein Urology. 12th ed. Elsevier; 2021. Hydrocele and Abdominoscrotal Hydrocele sections.",
  ];

  refs.forEach((r, i) => {
    s.addShape(pres.ShapeType.rect, {
      x: 0.5, y: 1.2 + i * 1.3, w: 9.0, h: 1.1,
      fill: { color: MID }, line: { color: "145C73" }, rectRadius: 0.08
    });
    s.addText(r, {
      x: 0.6, y: 1.25 + i * 1.3, w: 8.8, h: 1.0,
      fontSize: 13, color: WHITE, fontFace: "Calibri", margin: 5, valign: "middle", wrap: true
    });
  });
}

// ─────────────── SAVE ───────────────
const outPath = "/home/daytona/workspace/hydrocele-ppt/Hydrocele_Bailey_Sabiston.pptx";
pres.writeFile({ fileName: outPath }).then(() => {
  console.log("✅ Saved:", outPath);
}).catch(e => {
  console.error("❌ Error saving:", e);
});
Running Command

cd /home/daytona/workspace/hydrocele-ppt && node create_hydrocele_ppt.js 2>&1

Running Command

ls -lh /home/daytona/workspace/hydrocele-ppt/Hydrocele_Bailey_Sabiston.pptx

Your presentation is ready!

Hydrocele Bailey Sabiston

Presentation · PPTX


Here's what's inside the 13-slide deck (5.7 MB, 16:9, deep navy-teal + gold design):
SlideContent
1Title slide — Hydrocele: A Comprehensive Surgical Review
2Definition & Incidence — two-column layout with key stats (1% adult men, 80% neonates patent PV, closes by 18 months)
3Pathophysiology & Embryology — three type boxes: Communicating, Non-communicating, Infantile/Cord; secondary hydrocele warning
4Classification Illustrated — Bailey Fig 86.8 diagram (types a–d) with labeled annotations
5Clinical Features — 3 key examination questions + clinical notes (primary, congenital, cord hydrocele)
6Clinical Photo & Ultrasound — Bailey Fig 86.9 (right-sided hydrocele photo + US image)
7Diagnosis table — History, Examination, Ultrasound, Transillumination, Tumour markers
8Treatment — Conservative vs Surgical columns; Lord's, Jaboulay's, Excision details
9Surgical Techniques Illustrated — Bailey Figs 86.10a & 86.10b (Lord's plication + Jaboulay's eversion)
10Filarial Hydrocele & Chylocele — tropical distribution, Wuchereria bancrofti, chyle rupture, treatment
11Pediatric Considerations (Sabiston) — processus vaginalis embryology, silk-glove sign, incarceration risk
12Summary — 10 Key Points (Bailey Summary Box 86.5 + Sabiston)
13References — Bailey 28th Ed., Sabiston, Campbell-Walsh-Wein
This is a shared conversation. Sign in to Orris to start your own chat.