Make a simple ppt on the topic priapism.black and white print out friendly by adding important diagrams.the ppt should be 10 pages in total with definition,etiology,pathogenesis,clinical manifestations,diagnosis,differential diagnosis and treatment.

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

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

Writing File

~/priapism-ppt/build.js

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

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Priapism";
pres.author = "Medical Education";

// ─── PALETTE (B&W print-friendly) ───────────────────────────────────────────
const BLACK   = "000000";
const WHITE   = "FFFFFF";
const DARK    = "1A1A1A";
const MID     = "444444";
const LIGHT   = "888888";
const OFFWHITE= "F5F5F5";
const RULE    = "CCCCCC";

// ─── HELPER: slide title bar ─────────────────────────────────────────────────
function addTitleBar(slide, title) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: DARK } });
  slide.addText(title, {
    x: 0.25, y: 0, w: 9.5, h: 0.75,
    fontSize: 22, bold: true, color: WHITE, fontFace: "Arial",
    valign: "middle", margin: 0
  });
}

// ─── HELPER: horizontal rule ─────────────────────────────────────────────────
function addRule(slide, y) {
  slide.addShape(pres.ShapeType.line, {
    x: 0.25, y: y, w: 9.5, h: 0,
    line: { color: RULE, width: 0.8 }
  });
}

// ─── HELPER: bullet list ─────────────────────────────────────────────────────
function addBullets(slide, items, x, y, w, h, fontSize) {
  const fs = fontSize || 13;
  const textArr = items.map((item, i) => ({
    text: item,
    options: { bullet: { code: "25CF", indent: 10 }, breakLine: i < items.length - 1, color: DARK, fontSize: fs, fontFace: "Arial" }
  }));
  slide.addText(textArr, { x, y, w, h, valign: "top" });
}

// ─── HELPER: section label ───────────────────────────────────────────────────
function addLabel(slide, text, x, y, w, h) {
  slide.addShape(pres.ShapeType.rect, { x, y, w, h, fill: { color: MID } });
  slide.addText(text, { x, y, w, h, fontSize: 10, bold: true, color: WHITE, fontFace: "Arial", align: "center", valign: "middle", margin: 0 });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  // Full black background
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: BLACK } });
  // Accent bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 2.2, w: 0.15, h: 1.5, fill: { color: WHITE } });
  s.addText("PRIAPISM", {
    x: 0.5, y: 1.5, w: 9, h: 1.4,
    fontSize: 54, bold: true, color: WHITE, fontFace: "Arial", align: "left", valign: "middle", charSpacing: 6
  });
  s.addText("A Comprehensive Medical Overview", {
    x: 0.5, y: 3.0, w: 9, h: 0.5,
    fontSize: 18, color: LIGHT, fontFace: "Arial", align: "left", italic: true
  });
  s.addText("Definition  |  Etiology  |  Pathogenesis  |  Clinical Manifestations  |  Diagnosis  |  Differential Diagnosis  |  Treatment", {
    x: 0.5, y: 3.8, w: 9, h: 0.5,
    fontSize: 11, color: LIGHT, fontFace: "Arial", align: "left"
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 5.3, w: 10, h: 0.325, fill: { color: MID } });
  s.addText("Smith & Tanagho's General Urology · Campbell-Walsh-Wein Urology · Rosen's Emergency Medicine", {
    x: 0.25, y: 5.3, w: 9.5, h: 0.325,
    fontSize: 9, color: WHITE, fontFace: "Arial", valign: "middle"
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — DEFINITION
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: WHITE } });
  addTitleBar(s, "01  |  DEFINITION");

  // Definition box
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.95, w: 9.4, h: 1.5, fill: { color: OFFWHITE }, line: { color: RULE, width: 1 } });
  s.addText([
    { text: "Priapism ", options: { bold: true, fontSize: 14, color: BLACK } },
    { text: "is a prolonged, persistent penile erection ", options: { fontSize: 14, color: DARK } },
    { text: "unrelated to sexual interest or stimulation", options: { bold: true, italic: true, fontSize: 14, color: BLACK } },
    { text: " that lasts longer than ", options: { fontSize: 14, color: DARK } },
    { text: "4 hours.", options: { bold: true, fontSize: 14, color: BLACK } }
  ], { x: 0.5, y: 0.95, w: 9, h: 1.5, valign: "middle" });

  addRule(s, 2.6);

  // Three types
  s.addText("THREE RECOGNIZED TYPES", { x: 0.3, y: 2.7, w: 9.4, h: 0.35, fontSize: 11, bold: true, color: MID, fontFace: "Arial", charSpacing: 2 });

  const types = [
    { title: "ISCHEMIC (Low-Flow)", desc: "Venous outflow obstruction → compartment syndrome of the penis. Most common. Urologic emergency." },
    { title: "NONISCHEMIC (High-Flow)", desc: "Unregulated arterial inflow, often post-trauma. Penis partially rigid, painless. NOT an emergency." },
    { title: "STUTTERING (Recurrent)", desc: "Recurrent self-limited episodes of ischemic priapism. Common in sickle cell disease patients." }
  ];
  types.forEach((t, i) => {
    const x = 0.3 + i * 3.15;
    s.addShape(pres.ShapeType.rect, { x, y: 3.1, w: 3.0, h: 2.2, fill: { color: OFFWHITE }, line: { color: RULE, width: 1 } });
    s.addShape(pres.ShapeType.rect, { x, y: 3.1, w: 3.0, h: 0.38, fill: { color: DARK } });
    s.addText(t.title, { x, y: 3.1, w: 3.0, h: 0.38, fontSize: 10, bold: true, color: WHITE, fontFace: "Arial", align: "center", valign: "middle", margin: 0 });
    s.addText(t.desc, { x: x + 0.1, y: 3.55, w: 2.8, h: 1.65, fontSize: 11, color: DARK, fontFace: "Arial", valign: "top" });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — ETIOLOGY
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: WHITE } });
  addTitleBar(s, "02  |  ETIOLOGY");

  const categories = [
    {
      label: "Hematologic", color: BLACK,
      items: ["Sickle cell disease (most common)", "Thalassemia", "Leukemia", "Polycythemia", "G6PD deficiency"]
    },
    {
      label: "Medications", color: BLACK,
      items: ["Intracavernosal injections (alprostadil)", "PDE-5 inhibitors", "Antipsychotics (chlorpromazine, risperidone)", "Antidepressants (trazodone)", "Antihypertensives (hydralazine, prazosin)"]
    },
    {
      label: "Neurogenic", color: BLACK,
      items: ["Spinal cord injury", "Cauda equina syndrome", "Multiple sclerosis", "Autonomic neuropathy", "Lumbar disc disease"]
    },
    {
      label: "Traumatic / Other", color: BLACK,
      items: ["Perineal/penile trauma (high-flow)", "Pelvic malignancy (metastatic)", "Infections (malaria, scorpion/spider toxin)", "Alcohol, cocaine, marijuana", "Idiopathic (~50%)"]
    }
  ];

  categories.forEach((cat, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.25 + col * 4.9;
    const y = 0.9 + row * 2.25;
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.6, h: 2.1, fill: { color: OFFWHITE }, line: { color: RULE, width: 1 } });
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.6, h: 0.36, fill: { color: cat.color } });
    s.addText(cat.label, { x, y, w: 4.6, h: 0.36, fontSize: 11, bold: true, color: WHITE, fontFace: "Arial", align: "center", valign: "middle", margin: 0 });
    const textArr = cat.items.map((item, ii) => ({
      text: "  " + item,
      options: { bullet: { code: "25A0", indent: 5 }, breakLine: ii < cat.items.length - 1, color: DARK, fontSize: 11, fontFace: "Arial" }
    }));
    s.addText(textArr, { x: x + 0.1, y: y + 0.4, w: 4.4, h: 1.65, valign: "top" });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — PATHOGENESIS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: WHITE } });
  addTitleBar(s, "03  |  PATHOGENESIS");

  // Ischemic pathway diagram (drawn with shapes)
  s.addText("ISCHEMIC (LOW-FLOW) PATHWAY", { x: 0.25, y: 0.85, w: 5.5, h: 0.3, fontSize: 10, bold: true, color: MID, charSpacing: 2, fontFace: "Arial" });

  const steps = [
    "Venous outflow obstruction",
    "↓ Arterial inflow to corpora cavernosa",
    "Hypoxia + Acidosis + Hypercapnia",
    "Endothelial & smooth muscle damage",
    "Fibrosis → Erectile dysfunction"
  ];
  steps.forEach((step, i) => {
    const y = 1.2 + i * 0.68;
    const isLast = i === steps.length - 1;
    s.addShape(pres.ShapeType.rect, { x: 0.25, y, w: 5.3, h: 0.5, fill: { color: isLast ? DARK : OFFWHITE }, line: { color: isLast ? BLACK : RULE, width: 1 } });
    s.addText(step, { x: 0.35, y, w: 5.1, h: 0.5, fontSize: 12, color: isLast ? WHITE : DARK, fontFace: "Arial", valign: "middle", bold: isLast });
    if (!isLast) {
      s.addText("▼", { x: 0.25, y: y + 0.5, w: 5.3, h: 0.18, fontSize: 11, color: MID, fontFace: "Arial", align: "center", valign: "middle" });
    }
  });

  // Non-ischemic box
  addRule(s, 0.85);
  s.addText("NON-ISCHEMIC (HIGH-FLOW) PATHWAY", { x: 6.0, y: 0.85, w: 3.75, h: 0.3, fontSize: 10, bold: true, color: MID, charSpacing: 2, fontFace: "Arial" });
  s.addShape(pres.ShapeType.rect, { x: 6.0, y: 1.2, w: 3.75, h: 2.5, fill: { color: OFFWHITE }, line: { color: RULE, width: 1 } });
  const niSteps = [
    "Trauma to perineum/penis",
    "Vascular injury to cavernosal / helicine artery",
    "Arterio-cavernous fistula formation",
    "Unregulated arterial inflow",
    "Persistent tumescence (painless, oxygenated)"
  ];
  niSteps.forEach((step, i) => {
    s.addText((i === 0 ? "" : (i < 4 ? "  → " : "  ✓ ")) + step, {
      x: 6.1, y: 1.3 + i * 0.42, w: 3.55, h: 0.38,
      fontSize: 11, color: i === 4 ? MID : DARK, fontFace: "Arial", valign: "middle",
      italic: i === 4, bold: i === 0
    });
  });

  // Stuttering note
  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 4.65, w: 9.5, h: 0.7, fill: { color: OFFWHITE }, line: { color: RULE, width: 1 } });
  s.addText([
    { text: "STUTTERING PRIAPISM: ", options: { bold: true, fontSize: 11, color: BLACK } },
    { text: "Recurrent ischemia driven by aberrant PDE5 / NO / cGMP signaling; microvasculature occlusion from sickled RBCs; often occurs during sleep (hypoventilatory acidosis ↓ O₂ tension).", options: { fontSize: 11, color: DARK } }
  ], { x: 0.35, y: 4.65, w: 9.3, h: 0.7, valign: "middle" });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — CLINICAL MANIFESTATIONS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: WHITE } });
  addTitleBar(s, "04  |  CLINICAL MANIFESTATIONS");

  // Comparison table header
  const cols = [
    { label: "Feature", w: 2.0, x: 0.25 },
    { label: "Ischemic (Low-Flow)", w: 3.2, x: 2.25 },
    { label: "Non-Ischemic (High-Flow)", w: 2.6, x: 5.45 },
    { label: "Stuttering", w: 1.8, x: 8.05 }
  ];

  // Header row
  cols.forEach(col => {
    s.addShape(pres.ShapeType.rect, { x: col.x, y: 0.85, w: col.w - 0.05, h: 0.38, fill: { color: DARK } });
    s.addText(col.label, { x: col.x, y: 0.85, w: col.w - 0.05, h: 0.38, fontSize: 10, bold: true, color: WHITE, fontFace: "Arial", align: "center", valign: "middle", margin: 0 });
  });

  const rows = [
    ["Onset",          "Gradual, progressive",             "After trauma",                    "Episodic, recurrent"],
    ["Pain",           "YES — ischemic pain",              "Usually painless",                "Painful during episode"],
    ["Rigidity",       "Fully rigid, tender",              "Partial / full — soft glans",     "Rigid during episode"],
    ["Duration",       "> 4 hours",                        "Hours to days",                   "< 4 hrs; recurrent"],
    ["Emergency?",     "YES — urologic emergency",        "No — can observe",                "Monitor"],
    ["Blood gas",      "Hypoxic, acidotic, hypercapnic",  "Normal / hyperoxic",              "Hypoxic (ischemic)"],
    ["Long-term risk", "ED, fibrosis, necrosis",          "Low — if treated",                "Cumulative ED risk"]
  ];

  rows.forEach((row, ri) => {
    const bg = ri % 2 === 0 ? WHITE : OFFWHITE;
    const y = 1.23 + ri * 0.53;
    cols.forEach((col, ci) => {
      s.addShape(pres.ShapeType.rect, { x: col.x, y, w: col.w - 0.05, h: 0.5, fill: { color: bg }, line: { color: RULE, width: 0.5 } });
      s.addText(row[ci], {
        x: col.x + 0.05, y, w: col.w - 0.15, h: 0.5,
        fontSize: ci === 0 ? 10 : 10, color: (ci === 1 && ri === 4) ? BLACK : DARK,
        fontFace: "Arial", valign: "middle", bold: ci === 0
      });
    });
  });

  // Footer note
  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 5.1, w: 9.5, h: 0.35, fill: { color: OFFWHITE }, line: { color: RULE, width: 0.5 } });
  s.addText("Clinical hallmark: rigid corpus cavernosa with relatively soft glans penis. Glans is NOT engorged because corpus spongiosum usually spared.", {
    x: 0.35, y: 5.1, w: 9.3, h: 0.35, fontSize: 10, color: MID, fontFace: "Arial", valign: "middle", italic: true
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — PENIS ANATOMY DIAGRAM (fetched image)
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: WHITE } });
  addTitleBar(s, "05  |  PENILE ANATOMY & RELEVANT STRUCTURES");

  // Left: image from textbook
  const imgUrls = [
    "https://cdn.orris.care/cdss_images/cab7ea6f0fbb6cfd9f273021e6746b7d449c6603596d2d60c1e4fe422945b74c.png"
  ];
  let imgData = null;
  try {
    const result = execSync(
      `node /home/daytona/skills/shared/scripts/fetch_images.js "${imgUrls[0]}"`,
      { timeout: 30000 }
    ).toString();
    const parsed = JSON.parse(result);
    if (parsed[0] && !parsed[0].error) imgData = parsed[0].base64;
  } catch(e) { console.error("Image fetch failed:", e.message); }

  if (imgData) {
    s.addImage({ data: imgData, x: 0.25, y: 0.9, w: 4.2, h: 4.3 });
  } else {
    s.addShape(pres.ShapeType.rect, { x: 0.25, y: 0.9, w: 4.2, h: 4.3, fill: { color: OFFWHITE }, line: { color: RULE, width: 1 } });
    s.addText("Penile anatomy diagram\n(see textbook Fig. 168.1)", { x: 0.35, y: 2.5, w: 4.0, h: 1.0, fontSize: 11, color: MID, fontFace: "Arial", align: "center" });
  }

  // Right: key structures labelled
  s.addText("KEY STRUCTURES IN PRIAPISM", { x: 4.7, y: 0.9, w: 5.0, h: 0.3, fontSize: 10, bold: true, color: MID, charSpacing: 2, fontFace: "Arial" });
  const structures = [
    ["Corpora Cavernosa (×2)", "Paired erectile cylinders; primary site of ischemia in priapism"],
    ["Corpus Spongiosum", "Surrounds urethra; usually SPARED in priapism → soft glans"],
    ["Tunica Albuginea", "Fibrous sheath; target of shunting procedures"],
    ["Cavernosal Artery", "Branch of internal pudendal artery; injured in high-flow priapism"],
    ["Helicine Arteries", "Regulate blood flow; fistula formation causes non-ischemic type"],
    ["Penile Veins", "Outflow obstruction → ischemic priapism"]
  ];
  structures.forEach((st, i) => {
    const y = 1.3 + i * 0.65;
    s.addShape(pres.ShapeType.rect, { x: 4.7, y, w: 5.0, h: 0.58, fill: { color: i % 2 === 0 ? OFFWHITE : WHITE }, line: { color: RULE, width: 0.5 } });
    s.addText(st[0], { x: 4.8, y: y + 0.02, w: 4.8, h: 0.25, fontSize: 11, bold: true, color: BLACK, fontFace: "Arial", valign: "top" });
    s.addText(st[1], { x: 4.8, y: y + 0.28, w: 4.8, h: 0.25, fontSize: 10, color: MID, fontFace: "Arial", valign: "top" });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — DIAGNOSIS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: WHITE } });
  addTitleBar(s, "06  |  DIAGNOSIS");

  // Left column — Clinical + Lab
  s.addText("CLINICAL DIAGNOSIS", { x: 0.25, y: 0.85, w: 4.5, h: 0.3, fontSize: 10, bold: true, color: MID, charSpacing: 2, fontFace: "Arial" });
  const clinItems = [
    "History: duration, sexual activity, medications, trauma, SCD",
    "Physical exam: rigid corpora, soft glans, tenderness",
    "Priapism is primarily a CLINICAL diagnosis"
  ];
  addBullets(s, clinItems, 0.25, 1.2, 4.5, 1.0, 11);

  addRule(s, 2.3);
  s.addText("LABORATORY TESTS", { x: 0.25, y: 2.35, w: 4.5, h: 0.3, fontSize: 10, bold: true, color: MID, charSpacing: 2, fontFace: "Arial" });
  const labs = [
    "CBC + reticulocyte count (hemoglobinopathy screen)",
    "Hemoglobin electrophoresis (SCD, thalassemia)",
    "Coagulation studies",
    "Urine toxicology screen",
    "Cavernosal blood gas (definitive subtype differentiation)"
  ];
  addBullets(s, labs, 0.25, 2.7, 4.5, 1.6, 11);

  // Blood gas table
  s.addText("CAVERNOSAL BLOOD GAS — KEY VALUES", { x: 5.0, y: 0.85, w: 4.7, h: 0.3, fontSize: 10, bold: true, color: MID, charSpacing: 2, fontFace: "Arial" });
  const bgHeaders = ["Parameter", "Ischemic", "Non-Ischemic"];
  const bgData = [
    ["pO₂", "< 30 mmHg", "> 90 mmHg"],
    ["pCO₂", "> 60 mmHg", "< 40 mmHg"],
    ["pH", "< 7.25", "7.38 – 7.40"],
    ["Color", "Dark, deoxygenated", "Bright red"],
    ["Flow", "Little or none", "Pulsatile, high"]
  ];
  bgHeaders.forEach((h, i) => {
    const x = 5.0 + i * 1.55;
    s.addShape(pres.ShapeType.rect, { x, y: 1.2, w: 1.5, h: 0.38, fill: { color: DARK } });
    s.addText(h, { x, y: 1.2, w: 1.5, h: 0.38, fontSize: 10, bold: true, color: WHITE, fontFace: "Arial", align: "center", valign: "middle", margin: 0 });
  });
  bgData.forEach((row, ri) => {
    row.forEach((cell, ci) => {
      const x = 5.0 + ci * 1.55;
      const y = 1.58 + ri * 0.42;
      s.addShape(pres.ShapeType.rect, { x, y, w: 1.5, h: 0.38, fill: { color: ri % 2 === 0 ? OFFWHITE : WHITE }, line: { color: RULE, width: 0.5 } });
      s.addText(cell, { x: x + 0.05, y, w: 1.4, h: 0.38, fontSize: 10, color: DARK, fontFace: "Arial", valign: "middle" });
    });
  });

  // Imaging
  s.addText("IMAGING", { x: 0.25, y: 4.4, w: 9.5, h: 0.28, fontSize: 10, bold: true, color: MID, charSpacing: 2, fontFace: "Arial" });
  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 4.7, w: 9.5, h: 0.65, fill: { color: OFFWHITE }, line: { color: RULE, width: 1 } });
  s.addText([
    { text: "Color Duplex Ultrasonography (CDU): ", options: { bold: true, fontSize: 11, color: BLACK } },
    { text: "Identifies absence of cavernosal blood flow (ischemic) vs. high-flow fistula (non-ischemic). Always consider post-treatment to confirm resolution. Can differentiate resolved ischemia, persistent ischemia, and conversion to high-flow state.", options: { fontSize: 11, color: DARK } }
  ], { x: 0.35, y: 4.7, w: 9.3, h: 0.65, valign: "middle" });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — DIFFERENTIAL DIAGNOSIS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: WHITE } });
  addTitleBar(s, "07  |  DIFFERENTIAL DIAGNOSIS");

  s.addText("The underlying etiology must be differentiated. Priapism itself is a clinical diagnosis — the differential concerns TYPE and CAUSE.", {
    x: 0.25, y: 0.82, w: 9.5, h: 0.4, fontSize: 11, color: MID, fontFace: "Arial", valign: "middle", italic: true
  });

  const ddCols = [
    {
      head: "ISCHEMIC CAUSES", items: [
        "Sickle cell disease / thalassemia",
        "G6PD deficiency",
        "Leukemia / lymphoma",
        "Infection (malaria, UTI)",
        "Neurogenic (SCI, cauda equina)",
        "Toxin (scorpion, spider bite)",
        "Henoch-Schönlein purpura"
      ]
    },
    {
      head: "NON-ISCHEMIC CAUSES", items: [
        "Perineal / penile trauma",
        "Post-surgical arteriocavernous fistula",
        "Hematologic (SCD, leukemia) — rare",
        "Fabry disease",
        "Iatrogenic (surgical injury)"
      ]
    },
    {
      head: "MEDICATION-INDUCED", items: [
        "Intracavernosal alprostadil / papaverine",
        "PDE-5 inhibitors (sildenafil, tadalafil)",
        "Testosterone / anabolic steroids",
        "Antipsychotics (trazodone, chlorpromazine)",
        "Antidepressants (SSRIs)",
        "Antihypertensives (prazosin, hydralazine)",
        "Alcohol, cocaine, marijuana"
      ]
    }
  ];

  ddCols.forEach((col, i) => {
    const x = 0.25 + i * 3.2;
    s.addShape(pres.ShapeType.rect, { x, y: 1.3, w: 3.1, h: 3.95, fill: { color: OFFWHITE }, line: { color: RULE, width: 1 } });
    s.addShape(pres.ShapeType.rect, { x, y: 1.3, w: 3.1, h: 0.38, fill: { color: DARK } });
    s.addText(col.head, { x, y: 1.3, w: 3.1, h: 0.38, fontSize: 10, bold: true, color: WHITE, fontFace: "Arial", align: "center", valign: "middle", margin: 0 });
    const textArr = col.items.map((item, ii) => ({
      text: item,
      options: { bullet: { code: "25CF", indent: 8 }, breakLine: ii < col.items.length - 1, color: DARK, fontSize: 11, fontFace: "Arial" }
    }));
    s.addText(textArr, { x: x + 0.1, y: 1.75, w: 2.9, h: 3.4, valign: "top" });
  });

  // Neonatal note
  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 5.1, w: 9.5, h: 0.3, fill: { color: OFFWHITE }, line: { color: RULE, width: 0.5 } });
  s.addText([
    { text: "NEONATAL PRIAPISM: ", options: { bold: true, fontSize: 10, color: BLACK } },
    { text: "Polycythemia, infection, forceps-assisted delivery, respiratory distress syndrome, UAC manipulation.", options: { fontSize: 10, color: DARK } }
  ], { x: 0.35, y: 5.1, w: 9.3, h: 0.3, valign: "middle" });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — TREATMENT
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: WHITE } });
  addTitleBar(s, "08  |  TREATMENT");

  // Fetch management flowchart image
  const flowUrl = "https://cdn.orris.care/cdss_images/8e9973b1867bd6ec17b0b5162757489d46fc2578c48adac73e2296cc045e19f7.png";
  let flowData = null;
  try {
    const result = execSync(
      `node /home/daytona/skills/shared/scripts/fetch_images.js "${flowUrl}"`,
      { timeout: 30000 }
    ).toString();
    const parsed = JSON.parse(result);
    if (parsed[0] && !parsed[0].error) flowData = parsed[0].base64;
  } catch(e) { console.error("Flow image fetch failed:", e.message); }

  // Left: step-by-step treatment
  s.addText("ISCHEMIC PRIAPISM — STEPWISE MANAGEMENT", { x: 0.25, y: 0.82, w: 5.4, h: 0.3, fontSize: 10, bold: true, color: MID, charSpacing: 2, fontFace: "Arial" });

  const steps = [
    { num: "1", text: "CONSERVATIVE (< 4 hrs): exercise, urination, cold packs (avoid in SCD)" },
    { num: "2", text: "PAIN CONTROL + HYDRATION + dorsal penile nerve block (lidocaine without epi)" },
    { num: "3", text: "CORPORAL ASPIRATION: 19–23G butterfly needle at 3 or 9 o'clock; aspirate in 5 mL aliquots until bright red" },
    { num: "4", text: "INTRACAVERNOSAL PHENYLEPHRINE: 100–500 mcg q5 min (preferred α-agonist; cardiac monitoring required)" },
    { num: "5", text: "SURGICAL SHUNT (if fails): Distal → Ebbehoj / Winter / T-shunt → Al-Ghorab; Proximal → Quackels; Tunneling (Lue/Burnett)" },
    { num: "6", text: "PENILE PROSTHESIS: for ischemia > 48–72 hrs; early implant preferred (< 4 weeks)" }
  ];

  steps.forEach((step, i) => {
    const y = 1.2 + i * 0.68;
    s.addShape(pres.ShapeType.rect, { x: 0.25, y, w: 0.38, h: 0.5, fill: { color: DARK } });
    s.addText(step.num, { x: 0.25, y, w: 0.38, h: 0.5, fontSize: 13, bold: true, color: WHITE, fontFace: "Arial", align: "center", valign: "middle", margin: 0 });
    s.addShape(pres.ShapeType.rect, { x: 0.63, y, w: 5.0, h: 0.5, fill: { color: i % 2 === 0 ? OFFWHITE : WHITE }, line: { color: RULE, width: 0.5 } });
    s.addText(step.text, { x: 0.73, y, w: 4.85, h: 0.5, fontSize: 10, color: DARK, fontFace: "Arial", valign: "middle" });
  });

  // Right: image or non-ischemic + sickle cell
  if (flowData) {
    s.addImage({ data: flowData, x: 5.85, y: 0.82, w: 3.9, h: 3.5 });
    s.addText("Fig: Management algorithm for ischemic priapism\n(Smith & Tanagho's General Urology)", {
      x: 5.85, y: 4.3, w: 3.9, h: 0.35, fontSize: 8, color: MID, fontFace: "Arial", italic: true, align: "center"
    });
  } else {
    s.addShape(pres.ShapeType.rect, { x: 5.85, y: 0.82, w: 3.9, h: 3.0, fill: { color: OFFWHITE }, line: { color: RULE, width: 1 } });
    s.addText("Management algorithm\n(see Fig 39-7, Smith & Tanagho's)", { x: 5.85, y: 2.0, w: 3.9, h: 1.0, fontSize: 11, color: MID, fontFace: "Arial", align: "center" });
  }

  // Non-ischemic + SCD footer
  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 5.0, w: 9.5, h: 0.5, fill: { color: OFFWHITE }, line: { color: RULE, width: 1 } });
  s.addText([
    { text: "NON-ISCHEMIC: ", options: { bold: true, fontSize: 10, color: BLACK } },
    { text: "Observation → androgen ablation (1–3 months) → selective arterial embolization → surgery (last resort).  ", options: { fontSize: 10, color: DARK } },
    { text: "SCD STUTTERING: ", options: { bold: true, fontSize: 10, color: BLACK } },
    { text: "Hydration, O₂, alkalisation, analgesia, exchange transfusion; pseudoephedrine at bedtime; PDE5 inhibitor (long-term, low-dose) may prevent recurrence.", options: { fontSize: 10, color: DARK } }
  ], { x: 0.35, y: 5.0, w: 9.3, h: 0.5, valign: "middle" });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 10 — SUMMARY / KEY POINTS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: BLACK } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: DARK } });
  s.addText("09  |  KEY TAKEAWAYS", {
    x: 0.25, y: 0, w: 9.5, h: 0.75, fontSize: 22, bold: true, color: WHITE, fontFace: "Arial", valign: "middle", margin: 0
  });

  const keyPoints = [
    ["1", "Priapism = penile erection > 4 hours, unrelated to sexual stimulation; three types: ischemic, non-ischemic, stuttering."],
    ["2", "Ischemic priapism is a UROLOGIC EMERGENCY — time-sensitive; delays cause fibrosis and permanent erectile dysfunction."],
    ["3", "Sickle cell disease is the most common identifiable cause (65% pediatric cases; up to 89% of SCD males affected)."],
    ["4", "Cavernosal blood gas differentiates types: ischemic = hypoxic, acidotic; non-ischemic = hyperoxic, normal pH."],
    ["5", "First-line treatment: phenylephrine intracavernosal injection after corporal aspiration; surgical shunts for refractory cases."],
    ["6", "Long-term PDE5 inhibitor therapy (paradoxical) may prevent stuttering priapism by correcting NO/cGMP dysregulation."]
  ];

  keyPoints.forEach((kp, i) => {
    const y = 0.85 + i * 0.72;
    s.addShape(pres.ShapeType.rect, { x: 0.25, y, w: 0.45, h: 0.52, fill: { color: WHITE } });
    s.addText(kp[0], { x: 0.25, y, w: 0.45, h: 0.52, fontSize: 16, bold: true, color: BLACK, fontFace: "Arial", align: "center", valign: "middle", margin: 0 });
    s.addShape(pres.ShapeType.rect, { x: 0.7, y, w: 9.0, h: 0.52, fill: { color: DARK }, line: { color: MID, width: 0.5 } });
    s.addText(kp[1], { x: 0.8, y, w: 8.8, h: 0.52, fontSize: 12, color: WHITE, fontFace: "Arial", valign: "middle" });
  });

  s.addText("References: Smith & Tanagho's General Urology 19e · Campbell-Walsh-Wein Urology 12e · Rosen's Emergency Medicine 9e · Goldman-Cecil Medicine", {
    x: 0.25, y: 5.3, w: 9.5, h: 0.25, fontSize: 8, color: LIGHT, fontFace: "Arial", italic: true
  });
}

// ─── Write file ───────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/priapism-ppt/Priapism.pptx" })
  .then(() => console.log("SUCCESS: Priapism.pptx created"))
  .catch(err => { console.error("ERROR:", err); process.exit(1); });
Running Command

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

Running Command

ls -lh /home/daytona/workspace/priapism-ppt/Priapism.pptx

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

Priapism

Presentation · PPTX


What's inside (10 slides, black & white print-friendly):
SlideContent
1Title Slide - Bold black cover with topic overview
2Definition - Full definition + three types (Ischemic / Non-Ischemic / Stuttering) in labeled boxes
3Etiology - 4 categories: Hematologic, Medications, Neurogenic, Traumatic/Other
4Pathogenesis - Visual step-by-step flow diagrams for both ischemic and non-ischemic pathways
5Clinical Manifestations - Side-by-side comparison table of all 3 types across 7 features
6Penile Anatomy Diagram - Textbook image (Fig. 168.1) + key structures labeled with clinical relevance
7Diagnosis - Clinical approach, labs, cavernosal blood gas table (ischemic vs. non-ischemic values), CDU
8Differential Diagnosis - Three-column table: Ischemic causes / Non-ischemic causes / Medication-induced
9Treatment - Numbered stepwise management (conservative → aspiration → phenylephrine → shunts → prosthesis) + management algorithm image + non-ischemic/SCD notes
10Key Takeaways - 6 high-yield summary points on dark background
All content is sourced from Smith & Tanagho's General Urology (19e), Campbell-Walsh-Wein Urology, Rosen's Emergency Medicine, and Goldman-Cecil Medicine.

Can you make it simple white pages

Reading File
Writing File

~/priapism-ppt/build_simple.js

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

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Priapism";

// Simple white palette
const BLACK    = "000000";
const WHITE    = "FFFFFF";
const DARK     = "222222";
const MID      = "555555";
const LIGHT    = "888888";
const RULE     = "BBBBBB";
const HEADBG   = "F0F0F0";  // very light grey for headers
const ALTROW   = "FAFAFA";  // near-white alt rows

// ── Title bar: simple bottom border line, white bg ──────────────────────────
function addTitleBar(slide, title) {
  slide.addText(title, {
    x: 0.35, y: 0.12, w: 9.3, h: 0.6,
    fontSize: 24, bold: true, color: BLACK, fontFace: "Arial",
    valign: "middle", margin: 0
  });
  slide.addShape(pres.ShapeType.line, {
    x: 0.35, y: 0.72, w: 9.3, h: 0,
    line: { color: BLACK, width: 1.5 }
  });
}

// ── Thin rule ────────────────────────────────────────────────────────────────
function addRule(slide, y) {
  slide.addShape(pres.ShapeType.line, {
    x: 0.35, y, w: 9.3, h: 0,
    line: { color: RULE, width: 0.8 }
  });
}

// ── Bullet list ──────────────────────────────────────────────────────────────
function addBullets(slide, items, x, y, w, h, fontSize) {
  const fs = fontSize || 13;
  const textArr = items.map((item, i) => ({
    text: item,
    options: { bullet: true, breakLine: i < items.length - 1, color: DARK, fontSize: fs, fontFace: "Arial" }
  }));
  slide.addText(textArr, { x, y, w, h, valign: "top" });
}

// ── Section heading ──────────────────────────────────────────────────────────
function addSectionHead(slide, text, x, y, w) {
  slide.addText(text, {
    x, y, w, h: 0.28,
    fontSize: 10, bold: true, color: MID, fontFace: "Arial",
    charSpacing: 2, underline: false
  });
  slide.addShape(pres.ShapeType.line, {
    x, y: y + 0.28, w, h: 0,
    line: { color: RULE, width: 0.6 }
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  // All white bg — no fill needed (default)

  // Large title
  s.addText("PRIAPISM", {
    x: 0.5, y: 1.2, w: 9, h: 1.2,
    fontSize: 52, bold: true, color: BLACK, fontFace: "Arial", align: "left"
  });

  // Subtitle line
  s.addShape(pres.ShapeType.line, {
    x: 0.5, y: 2.5, w: 9, h: 0,
    line: { color: BLACK, width: 2 }
  });

  s.addText("A Comprehensive Medical Overview", {
    x: 0.5, y: 2.6, w: 9, h: 0.45,
    fontSize: 16, color: MID, fontFace: "Arial", align: "left", italic: true
  });

  s.addText("Definition  |  Etiology  |  Pathogenesis  |  Clinical Manifestations\nDiagnosis  |  Differential Diagnosis  |  Treatment", {
    x: 0.5, y: 3.1, w: 9, h: 0.7,
    fontSize: 12, color: LIGHT, fontFace: "Arial", align: "left"
  });

  // Footer
  s.addShape(pres.ShapeType.line, {
    x: 0.5, y: 5.2, w: 9, h: 0,
    line: { color: RULE, width: 0.8 }
  });
  s.addText("Sources: Smith & Tanagho's General Urology 19e  ·  Campbell-Walsh-Wein Urology 12e  ·  Rosen's Emergency Medicine 9e  ·  Goldman-Cecil Medicine", {
    x: 0.5, y: 5.25, w: 9, h: 0.28,
    fontSize: 8, color: LIGHT, fontFace: "Arial", align: "left"
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — DEFINITION
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addTitleBar(s, "DEFINITION");

  // Definition quote box
  s.addShape(pres.ShapeType.rect, {
    x: 0.35, y: 0.85, w: 9.3, h: 1.05,
    fill: { color: HEADBG }, line: { color: RULE, width: 1 }
  });
  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 0.85, w: 0.08, h: 1.05, fill: { color: BLACK } });
  s.addText([
    { text: "Priapism ", options: { bold: true, fontSize: 14, color: BLACK } },
    { text: "is a prolonged, persistent penile erection ", options: { fontSize: 14, color: DARK } },
    { text: "unrelated to sexual interest or stimulation", options: { bold: true, fontSize: 14, color: BLACK } },
    { text: " lasting longer than ", options: { fontSize: 14, color: DARK } },
    { text: "4 hours.", options: { bold: true, fontSize: 14, color: BLACK } }
  ], { x: 0.55, y: 0.85, w: 9.0, h: 1.05, valign: "middle" });

  // Three types
  s.addText("THREE RECOGNIZED TYPES", {
    x: 0.35, y: 2.05, w: 9.3, h: 0.3,
    fontSize: 11, bold: true, color: MID, fontFace: "Arial", charSpacing: 2
  });
  addRule(s, 2.35);

  const types = [
    { title: "ISCHEMIC  (Low-Flow)", num: "01", desc: ["Most common type", "Venous outflow obstruction", "Compartment syndrome of penis", "Urologic EMERGENCY", "Painful, fully rigid corpora"] },
    { title: "NON-ISCHEMIC  (High-Flow)", num: "02", desc: ["Result of perineal/penile trauma", "Arterio-cavernous fistula", "Unregulated arterial inflow", "NOT an emergency", "Painless, partial rigidity"] },
    { title: "STUTTERING  (Recurrent)", num: "03", desc: ["Recurrent ischemic episodes", "< 4 hours each, self-limited", "Common in sickle cell disease", "Aberrant NO/cGMP signaling", "Risk of cumulative ED"] }
  ];

  types.forEach((t, i) => {
    const x = 0.35 + i * 3.15;
    // Header
    s.addShape(pres.ShapeType.rect, { x, y: 2.45, w: 3.05, h: 0.38, fill: { color: HEADBG }, line: { color: RULE, width: 1 } });
    s.addText(t.title, { x: x + 0.08, y: 2.45, w: 2.9, h: 0.38, fontSize: 10, bold: true, color: BLACK, fontFace: "Arial", valign: "middle" });
    // Body
    s.addShape(pres.ShapeType.rect, { x, y: 2.83, w: 3.05, h: 2.5, fill: { color: WHITE }, line: { color: RULE, width: 1 } });
    const textArr = t.desc.map((d, ii) => ({
      text: d,
      options: { bullet: true, breakLine: ii < t.desc.length - 1, color: DARK, fontSize: 12, fontFace: "Arial" }
    }));
    s.addText(textArr, { x: x + 0.1, y: 2.9, w: 2.85, h: 2.3, valign: "top" });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — ETIOLOGY
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addTitleBar(s, "ETIOLOGY");

  const cats = [
    { label: "Hematologic", items: ["Sickle cell disease (most common)", "Thalassemia", "Leukemia / lymphoma", "Polycythemia", "G6PD deficiency"] },
    { label: "Medications", items: ["Intracavernosal injections (alprostadil, papaverine)", "PDE-5 inhibitors (sildenafil, tadalafil)", "Antipsychotics (chlorpromazine, risperidone, trazodone)", "Antidepressants (SSRIs)", "Antihypertensives (prazosin, hydralazine)"] },
    { label: "Neurogenic", items: ["Spinal cord injury", "Cauda equina syndrome", "Multiple sclerosis", "Autonomic neuropathy", "Lumbar disc herniation"] },
    { label: "Traumatic / Other", items: ["Perineal or penile trauma → high-flow", "Pelvic / penile malignancy", "Infections (malaria, scorpion/spider toxin)", "Alcohol, cocaine, marijuana", "Idiopathic (~50% of cases)"] }
  ];

  cats.forEach((cat, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.35 + col * 4.75;
    const y = 0.9 + row * 2.3;
    // Header
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.55, h: 0.35, fill: { color: HEADBG }, line: { color: RULE, width: 1 } });
    s.addText(cat.label, { x: x + 0.1, y, w: 4.35, h: 0.35, fontSize: 11, bold: true, color: BLACK, fontFace: "Arial", valign: "middle" });
    // Body
    s.addShape(pres.ShapeType.rect, { x, y: y + 0.35, w: 4.55, h: 1.85, fill: { color: WHITE }, line: { color: RULE, width: 1 } });
    const textArr = cat.items.map((item, ii) => ({
      text: item,
      options: { bullet: true, breakLine: ii < cat.items.length - 1, color: DARK, fontSize: 11, fontFace: "Arial" }
    }));
    s.addText(textArr, { x: x + 0.1, y: y + 0.4, w: 4.35, h: 1.75, valign: "top" });
  });

  // Footer note
  s.addShape(pres.ShapeType.line, { x: 0.35, y: 5.28, w: 9.3, h: 0, line: { color: RULE, width: 0.6 } });
  s.addText("Note: Sickle cell disease accounts for up to 65% of pediatric priapism cases. ~50% of all adult cases are idiopathic.", {
    x: 0.35, y: 5.3, w: 9.3, h: 0.25, fontSize: 9, color: LIGHT, fontFace: "Arial", italic: true
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — PATHOGENESIS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addTitleBar(s, "PATHOGENESIS");

  // ── Ischemic flow ──────────────────────────────────────────────────────────
  s.addText("ISCHEMIC (LOW-FLOW)", { x: 0.35, y: 0.85, w: 4.5, h: 0.28, fontSize: 10, bold: true, color: MID, charSpacing: 2, fontFace: "Arial" });
  addRule(s, 1.13);

  const ishSteps = [
    "Venous outflow obstruction from corpora cavernosa",
    "Arterial inflow halts → blood stasis",
    "Hypoxia  +  Hypercapnia  +  Acidosis",
    "Endothelial & smooth muscle damage",
    "Fibrosis of corpora  →  Erectile dysfunction"
  ];
  ishSteps.forEach((step, i) => {
    const y = 1.2 + i * 0.68;
    const isLast = i === ishSteps.length - 1;
    s.addShape(pres.ShapeType.rect, {
      x: 0.35, y, w: 4.5, h: 0.5,
      fill: { color: isLast ? HEADBG : WHITE },
      line: { color: isLast ? BLACK : RULE, width: isLast ? 1.5 : 1 }
    });
    s.addText(step, {
      x: 0.45, y, w: 4.3, h: 0.5,
      fontSize: 11, color: BLACK, fontFace: "Arial", valign: "middle",
      bold: isLast
    });
    if (!isLast) {
      s.addText("▼", { x: 0.35, y: y + 0.5, w: 4.5, h: 0.18, fontSize: 10, color: LIGHT, fontFace: "Arial", align: "center", valign: "middle" });
    }
  });

  // ── Non-ischemic flow ──────────────────────────────────────────────────────
  s.addText("NON-ISCHEMIC (HIGH-FLOW)", { x: 5.15, y: 0.85, w: 4.5, h: 0.28, fontSize: 10, bold: true, color: MID, charSpacing: 2, fontFace: "Arial" });
  addRule(s, 1.13);

  const niSteps = [
    "Trauma to perineum or penis",
    "Injury to cavernosal / helicine artery",
    "Arterio-cavernous fistula forms",
    "Unregulated arterial inflow to sinusoids",
    "Persistent tumescence — oxygenated, painless"
  ];
  niSteps.forEach((step, i) => {
    const y = 1.2 + i * 0.68;
    const isLast = i === niSteps.length - 1;
    s.addShape(pres.ShapeType.rect, {
      x: 5.15, y, w: 4.5, h: 0.5,
      fill: { color: isLast ? HEADBG : WHITE },
      line: { color: isLast ? BLACK : RULE, width: isLast ? 1.5 : 1 }
    });
    s.addText(step, {
      x: 5.25, y, w: 4.3, h: 0.5,
      fontSize: 11, color: BLACK, fontFace: "Arial", valign: "middle",
      bold: isLast, italic: isLast
    });
    if (!isLast) {
      s.addText("▼", { x: 5.15, y: y + 0.5, w: 4.5, h: 0.18, fontSize: 10, color: LIGHT, fontFace: "Arial", align: "center", valign: "middle" });
    }
  });

  // Vertical divider
  s.addShape(pres.ShapeType.line, { x: 4.9, y: 0.85, w: 0, h: 4.6, line: { color: RULE, width: 1 } });

  // Stuttering note
  addRule(s, 4.75);
  s.addText([
    { text: "STUTTERING PRIAPISM: ", options: { bold: true, fontSize: 11, color: BLACK } },
    { text: "Aberrant PDE5 / NO / cGMP signaling; microvascular occlusion by sickled RBCs; episodes triggered during sleep (hypoventilatory acidosis ↓ O₂ tension in corpora).", options: { fontSize: 11, color: DARK } }
  ], { x: 0.35, y: 4.8, w: 9.3, h: 0.6, valign: "middle" });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — CLINICAL MANIFESTATIONS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addTitleBar(s, "CLINICAL MANIFESTATIONS");

  const headers = ["Feature", "Ischemic (Low-Flow)", "Non-Ischemic (High-Flow)", "Stuttering"];
  const colW = [1.8, 2.7, 2.7, 1.8];
  const colX = [0.35, 2.15, 4.85, 7.55];

  // Header row
  headers.forEach((h, i) => {
    s.addShape(pres.ShapeType.rect, { x: colX[i], y: 0.85, w: colW[i] - 0.05, h: 0.4, fill: { color: HEADBG }, line: { color: RULE, width: 1 } });
    s.addText(h, { x: colX[i] + 0.05, y: 0.85, w: colW[i] - 0.1, h: 0.4, fontSize: 10, bold: true, color: BLACK, fontFace: "Arial", valign: "middle", align: "center" });
  });

  const rows = [
    ["Onset",          "Gradual, progressive",              "After trauma",               "Episodic, recurrent"],
    ["Pain",           "Yes — ischemic pain",               "Usually painless",           "Painful each episode"],
    ["Rigidity",       "Fully rigid, tender corpora",       "Partial; soft glans",        "Rigid during episode"],
    ["Duration",       "> 4 hours",                        "Hours to days",              "< 4 hrs; recurrent"],
    ["Emergency?",     "YES",                              "No — observe",               "Monitor"],
    ["Blood gas",      "Hypoxic, acidotic, hypercapnic",   "Normal / hyperoxic",         "Hypoxic (ischemic)"],
    ["Complication",   "ED, fibrosis, necrosis",           "Low risk if treated",        "Cumulative ED risk"]
  ];

  rows.forEach((row, ri) => {
    const y = 1.25 + ri * 0.53;
    const bg = ri % 2 === 0 ? WHITE : ALTROW;
    row.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, { x: colX[ci], y, w: colW[ci] - 0.05, h: 0.5, fill: { color: bg }, line: { color: RULE, width: 0.5 } });
      s.addText(cell, {
        x: colX[ci] + 0.05, y, w: colW[ci] - 0.1, h: 0.5,
        fontSize: 10, color: DARK, fontFace: "Arial", valign: "middle",
        bold: ci === 0,
        color: (ci === 1 && ri === 4) ? BLACK : DARK
      });
    });
  });

  addRule(s, 5.12);
  s.addText("Clinical hallmark: rigid corpora cavernosa with relatively SOFT GLANS — corpus spongiosum is typically spared.", {
    x: 0.35, y: 5.16, w: 9.3, h: 0.28, fontSize: 10, color: MID, fontFace: "Arial", italic: true
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — PENILE ANATOMY DIAGRAM
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addTitleBar(s, "PENILE ANATOMY — KEY STRUCTURES");

  // Fetch anatomy image
  const imgUrl = "https://cdn.orris.care/cdss_images/cab7ea6f0fbb6cfd9f273021e6746b7d449c6603596d2d60c1e4fe422945b74c.png";
  let imgData = null;
  try {
    const result = execSync(`node /home/daytona/skills/shared/scripts/fetch_images.js "${imgUrl}"`, { timeout: 30000 }).toString();
    const parsed = JSON.parse(result);
    if (parsed[0] && !parsed[0].error) imgData = parsed[0].base64;
  } catch(e) {}

  if (imgData) {
    s.addImage({ data: imgData, x: 0.35, y: 0.88, w: 4.3, h: 4.4 });
  } else {
    s.addShape(pres.ShapeType.rect, { x: 0.35, y: 0.88, w: 4.3, h: 4.4, fill: { color: ALTROW }, line: { color: RULE, width: 1 } });
    s.addText("[Penile anatomy diagram — Fig. 168.1]", { x: 0.35, y: 2.8, w: 4.3, h: 0.5, fontSize: 11, color: MID, fontFace: "Arial", align: "center" });
  }
  s.addText("Fig. 168.1 — Anatomy of the penis showing flaccid vs. erect state\n(Rosen's Emergency Medicine, 9e)", {
    x: 0.35, y: 5.3, w: 4.3, h: 0.3, fontSize: 8, color: LIGHT, fontFace: "Arial", align: "center", italic: true
  });

  // Divider
  s.addShape(pres.ShapeType.line, { x: 4.85, y: 0.88, w: 0, h: 4.5, line: { color: RULE, width: 1 } });

  // Right: structures table
  s.addText("STRUCTURE & CLINICAL RELEVANCE", { x: 5.0, y: 0.9, w: 4.7, h: 0.28, fontSize: 10, bold: true, color: MID, charSpacing: 2, fontFace: "Arial" });
  addRule(s, 1.18);

  const structs = [
    ["Corpora Cavernosa (×2)", "Primary erectile cylinders; site of ischemia, aspiration, and shunting"],
    ["Corpus Spongiosum", "Surrounds urethra; usually SPARED → glans remains soft"],
    ["Tunica Albuginea", "Fibrous sheath encasing corpora; incised during shunt procedures"],
    ["Cavernosal Artery", "Branch of internal pudendal artery; injured in high-flow priapism"],
    ["Helicine Arteries", "Regulate sinusoidal flow; fistula formation → non-ischemic type"],
    ["Penile Dorsal Vein", "Outflow vessel; obstruction drives ischemic priapism"]
  ];
  structs.forEach((st, i) => {
    const y = 1.25 + i * 0.65;
    s.addShape(pres.ShapeType.rect, { x: 5.0, y, w: 4.7, h: 0.58, fill: { color: i % 2 === 0 ? WHITE : ALTROW }, line: { color: RULE, width: 0.5 } });
    s.addText(st[0], { x: 5.1, y: y + 0.02, w: 4.5, h: 0.26, fontSize: 11, bold: true, color: BLACK, fontFace: "Arial" });
    s.addText(st[1], { x: 5.1, y: y + 0.28, w: 4.5, h: 0.26, fontSize: 10, color: MID, fontFace: "Arial" });
  });
}

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

  // Left column
  addSectionHead(s, "CLINICAL APPROACH", 0.35, 0.85, 4.55);
  addBullets(s, [
    "History: duration, sexual activity, medications, trauma, sickle cell disease",
    "Physical exam: rigid corpora cavernosa, soft glans, tenderness",
    "Priapism is primarily a CLINICAL diagnosis"
  ], 0.35, 1.2, 4.55, 0.95, 11);

  addSectionHead(s, "LABORATORY TESTS", 0.35, 2.25, 4.55);
  addBullets(s, [
    "CBC + reticulocyte count",
    "Hemoglobin electrophoresis (SCD, thalassemia)",
    "Coagulation studies",
    "Urine toxicology screen",
    "Cavernosal blood gas — gold standard for subtype"
  ], 0.35, 2.6, 4.55, 1.55, 11);

  addSectionHead(s, "IMAGING", 0.35, 4.28, 4.55);
  s.addText("Color Duplex Ultrasonography (CDU): identifies absence of flow (ischemic) vs. high-flow fistula (non-ischemic); confirms resolution post-treatment.", {
    x: 0.35, y: 4.58, w: 4.55, h: 0.7, fontSize: 11, color: DARK, fontFace: "Arial", valign: "top"
  });

  // Divider
  s.addShape(pres.ShapeType.line, { x: 5.15, y: 0.85, w: 0, h: 4.5, line: { color: RULE, width: 1 } });

  // Right: blood gas table
  addSectionHead(s, "CAVERNOSAL BLOOD GAS — DIFFERENTIATING SUBTYPES", 5.3, 0.85, 4.35);
  const bgHeaders = ["Parameter", "Ischemic", "Non-Ischemic"];
  const bgW = [1.3, 1.5, 1.5];
  const bgX = [5.3, 6.6, 8.1];

  bgHeaders.forEach((h, i) => {
    s.addShape(pres.ShapeType.rect, { x: bgX[i], y: 1.2, w: bgW[i] - 0.05, h: 0.38, fill: { color: HEADBG }, line: { color: RULE, width: 1 } });
    s.addText(h, { x: bgX[i] + 0.05, y: 1.2, w: bgW[i] - 0.1, h: 0.38, fontSize: 10, bold: true, color: BLACK, fontFace: "Arial", valign: "middle", align: "center" });
  });

  const bgRows = [
    ["pO₂",    "< 30 mmHg",           "> 90 mmHg"],
    ["pCO₂",   "> 60 mmHg",           "< 40 mmHg"],
    ["pH",     "< 7.25",              "7.38 – 7.40"],
    ["Color",  "Dark, deoxygenated",  "Bright red"],
    ["Flow",   "Absent / minimal",   "Pulsatile, high"]
  ];
  bgRows.forEach((row, ri) => {
    const bg = ri % 2 === 0 ? WHITE : ALTROW;
    row.forEach((cell, ci) => {
      const y = 1.58 + ri * 0.44;
      s.addShape(pres.ShapeType.rect, { x: bgX[ci], y, w: bgW[ci] - 0.05, h: 0.4, fill: { color: bg }, line: { color: RULE, width: 0.5 } });
      s.addText(cell, { x: bgX[ci] + 0.05, y, w: bgW[ci] - 0.1, h: 0.4, fontSize: 10, color: DARK, fontFace: "Arial", valign: "middle", bold: ci === 0 });
    });
  });

  addSectionHead(s, "NOTE", 5.3, 3.88, 4.35);
  s.addText("Send aspirated blood for gas analysis before saline irrigation. CDU should always follow treatment to confirm resolution or detect conversion to high-flow state.", {
    x: 5.3, y: 4.2, w: 4.35, h: 0.8, fontSize: 11, color: DARK, fontFace: "Arial", valign: "top"
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — DIFFERENTIAL DIAGNOSIS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addTitleBar(s, "DIFFERENTIAL DIAGNOSIS");

  s.addText("Priapism is a clinical diagnosis. The differential concerns identifying the TYPE and UNDERLYING CAUSE.", {
    x: 0.35, y: 0.82, w: 9.3, h: 0.32, fontSize: 11, color: MID, fontFace: "Arial", italic: true
  });

  const ddCols = [
    {
      head: "ISCHEMIC CAUSES",
      items: ["Sickle cell disease / thalassemia", "G6PD deficiency", "Leukemia / lymphoma", "Infection (malaria, UTI)", "Neurogenic (SCI, cauda equina)", "Toxin (scorpion, spider bite)", "Henoch-Schönlein purpura"]
    },
    {
      head: "NON-ISCHEMIC CAUSES",
      items: ["Perineal / penile trauma", "Post-surgical arteriocavernous fistula", "Hematologic (SCD, leukemia) — rare", "Fabry disease", "Iatrogenic (surgical injury)", "", ""]
    },
    {
      head: "MEDICATION-INDUCED",
      items: ["Intracavernosal alprostadil / papaverine", "PDE-5 inhibitors", "Testosterone / anabolic steroids", "Antipsychotics (trazodone, chlorpromazine)", "Antidepressants (SSRIs)", "Antihypertensives (prazosin, hydralazine)", "Alcohol, cocaine, marijuana"]
    }
  ];

  ddCols.forEach((col, i) => {
    const x = 0.35 + i * 3.2;
    s.addShape(pres.ShapeType.rect, { x, y: 1.25, w: 3.1, h: 0.38, fill: { color: HEADBG }, line: { color: RULE, width: 1 } });
    s.addText(col.head, { x: x + 0.1, y: 1.25, w: 2.9, h: 0.38, fontSize: 10, bold: true, color: BLACK, fontFace: "Arial", valign: "middle" });
    s.addShape(pres.ShapeType.rect, { x, y: 1.63, w: 3.1, h: 3.3, fill: { color: WHITE }, line: { color: RULE, width: 1 } });
    const validItems = col.items.filter(it => it.trim() !== "");
    const textArr = validItems.map((item, ii) => ({
      text: item,
      options: { bullet: true, breakLine: ii < validItems.length - 1, color: DARK, fontSize: 11, fontFace: "Arial" }
    }));
    s.addText(textArr, { x: x + 0.1, y: 1.7, w: 2.9, h: 3.15, valign: "top" });
  });

  addRule(s, 5.1);
  s.addText([
    { text: "NEONATAL: ", options: { bold: true, fontSize: 10, color: BLACK } },
    { text: "Polycythemia, infection, forceps-assisted delivery, respiratory distress syndrome, umbilical arterial catheter (UAC) manipulation.", options: { fontSize: 10, color: DARK } }
  ], { x: 0.35, y: 5.14, w: 9.3, h: 0.28, valign: "middle" });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — TREATMENT
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addTitleBar(s, "TREATMENT");

  // Left: stepwise management
  addSectionHead(s, "ISCHEMIC PRIAPISM — STEPWISE MANAGEMENT", 0.35, 0.82, 5.4);

  const steps = [
    { n: "1", t: "CONSERVATIVE  (< 4 hrs):  exercise, urination, cold packs (avoid cold in SCD)" },
    { n: "2", t: "PAIN CONTROL + HYDRATION + dorsal penile nerve block (lidocaine without epinephrine)" },
    { n: "3", t: "CORPORAL ASPIRATION:  19–23G butterfly at 3 or 9 o'clock; aspirate 5 mL aliquots until bright red" },
    { n: "4", t: "INTRACAVERNOSAL PHENYLEPHRINE:  100–500 mcg q5 min (preferred α-agonist; requires cardiac monitoring)" },
    { n: "5", t: "SURGICAL SHUNT:  Distal (Ebbehoj / Winter / T-shunt / Al-Ghorab) → Proximal (Quackels) → Tunneling (Lue / Burnett)" },
    { n: "6", t: "PENILE PROSTHESIS:  for ischemia > 48–72 hrs; early implantation (< 4 weeks) preferred" }
  ];

  steps.forEach((step, i) => {
    const y = 1.18 + i * 0.66;
    s.addShape(pres.ShapeType.rect, { x: 0.35, y, w: 0.42, h: 0.52, fill: { color: HEADBG }, line: { color: RULE, width: 1 } });
    s.addText(step.n, { x: 0.35, y, w: 0.42, h: 0.52, fontSize: 14, bold: true, color: BLACK, fontFace: "Arial", align: "center", valign: "middle", margin: 0 });
    s.addShape(pres.ShapeType.rect, { x: 0.77, y, w: 5.0, h: 0.52, fill: { color: i % 2 === 0 ? WHITE : ALTROW }, line: { color: RULE, width: 0.5 } });
    s.addText(step.t, { x: 0.87, y, w: 4.85, h: 0.52, fontSize: 10, color: DARK, fontFace: "Arial", valign: "middle" });
  });

  // Right: management flowchart image
  s.addShape(pres.ShapeType.line, { x: 6.05, y: 0.85, w: 0, h: 4.5, line: { color: RULE, width: 1 } });

  const flowUrl = "https://cdn.orris.care/cdss_images/8e9973b1867bd6ec17b0b5162757489d46fc2578c48adac73e2296cc045e19f7.png";
  let flowData = null;
  try {
    const result = execSync(`node /home/daytona/skills/shared/scripts/fetch_images.js "${flowUrl}"`, { timeout: 30000 }).toString();
    const parsed = JSON.parse(result);
    if (parsed[0] && !parsed[0].error) flowData = parsed[0].base64;
  } catch(e) {}

  if (flowData) {
    s.addImage({ data: flowData, x: 6.15, y: 0.82, w: 3.55, h: 3.3 });
    s.addText("Fig. 39-7: Ischemic priapism management algorithm\n(Smith & Tanagho's General Urology, 19e)", {
      x: 6.15, y: 4.15, w: 3.55, h: 0.35, fontSize: 8, color: LIGHT, fontFace: "Arial", italic: true, align: "center"
    });
  } else {
    s.addShape(pres.ShapeType.rect, { x: 6.15, y: 0.82, w: 3.55, h: 3.0, fill: { color: ALTROW }, line: { color: RULE, width: 1 } });
    s.addText("Management algorithm\n(Fig. 39-7, Smith & Tanagho's)", { x: 6.15, y: 2.1, w: 3.55, h: 0.7, fontSize: 11, color: MID, fontFace: "Arial", align: "center" });
  }

  // Footer: non-ischemic + SCD
  addRule(s, 5.05);
  s.addText([
    { text: "NON-ISCHEMIC: ", options: { bold: true, fontSize: 10, color: BLACK } },
    { text: "Observation → androgen ablation (1–3 months) → selective arterial embolization → surgery (last resort).  ", options: { fontSize: 10, color: DARK } },
    { text: "STUTTERING / SCD: ", options: { bold: true, fontSize: 10, color: BLACK } },
    { text: "Hydration, O₂, alkalisation, analgesia, exchange transfusion; pseudoephedrine at bedtime; long-term low-dose PDE5 inhibitor to prevent recurrence.", options: { fontSize: 10, color: DARK } }
  ], { x: 0.35, y: 5.08, w: 9.3, h: 0.4, valign: "middle" });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 10 — KEY TAKEAWAYS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addTitleBar(s, "KEY TAKEAWAYS");

  const points = [
    "Priapism = penile erection > 4 hours, unrelated to sexual stimulation; three types: ischemic, non-ischemic, stuttering.",
    "Ischemic priapism is a UROLOGIC EMERGENCY — every hour of delay increases risk of permanent erectile dysfunction and fibrosis.",
    "Sickle cell disease is the most common identifiable cause (65% pediatric; up to 89% of SCD males affected by age 20).",
    "Cavernosal blood gas is the gold standard: ischemic = pO₂ < 30, pCO₂ > 60, pH < 7.25; non-ischemic = hyperoxic, normal pH.",
    "First-line treatment: corporal aspiration + intracavernosal phenylephrine; surgical shunts for refractory cases.",
    "Long-term low-dose PDE5 inhibitors (paradoxically) prevent stuttering priapism by restoring NO/cGMP regulation."
  ];

  points.forEach((pt, i) => {
    const y = 0.88 + i * 0.72;
    s.addShape(pres.ShapeType.rect, { x: 0.35, y, w: 0.42, h: 0.55, fill: { color: HEADBG }, line: { color: RULE, width: 1 } });
    s.addText(String(i + 1), { x: 0.35, y, w: 0.42, h: 0.55, fontSize: 15, bold: true, color: BLACK, fontFace: "Arial", align: "center", valign: "middle", margin: 0 });
    s.addShape(pres.ShapeType.rect, { x: 0.77, y, w: 8.9, h: 0.55, fill: { color: i % 2 === 0 ? WHITE : ALTROW }, line: { color: RULE, width: 0.5 } });
    s.addText(pt, { x: 0.87, y, w: 8.75, h: 0.55, fontSize: 12, color: DARK, fontFace: "Arial", valign: "middle" });
  });

  addRule(s, 5.2);
  s.addText("References: Smith & Tanagho's General Urology 19e  ·  Campbell-Walsh-Wein Urology 12e  ·  Rosen's Emergency Medicine 9e  ·  Goldman-Cecil Medicine", {
    x: 0.35, y: 5.25, w: 9.3, h: 0.25, fontSize: 8, color: LIGHT, fontFace: "Arial", italic: true
  });
}

// ─── Write ────────────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/priapism-ppt/Priapism_Simple.pptx" })
  .then(() => console.log("SUCCESS: Priapism_Simple.pptx created"))
  .catch(err => { console.error("ERROR:", err); process.exit(1); });
Running Command

cd /home/daytona/workspace/priapism-ppt && node build_simple.js 2>&1

Running Command

ls -lh /home/daytona/workspace/priapism-ppt/Priapism_Simple.pptx

Done! Here's your clean white version:

Priapism Simple

Presentation · PPTX

What changed:
  • All slides are pure white backgrounds
  • No dark/black filled boxes or colored backgrounds
  • Titles use a simple bold text with a thin black underline
  • Tables use very light grey (#F0F0F0) for headers and near-white alternating rows
  • All text in black/dark grey - clean and print-friendly
  • Diagrams and structure tables remain, just on white backgrounds
  • Same 10-slide structure with all content intact
This is a shared conversation. Sign in to Orris to start your own chat.