Create a comprehensive 10 pages ppt on priapism with defition,etiology,pathogenesis,classification,clinical manifestation,diagnosis,differential diagnosis and treatment.Add important small diagrams wherever u think is important.add to the topics page itself

Reading File
Reading File
Reading File
Finding Sources
Searching the Web

priapism definition etiology pathogenesis classification treatment medical

Reading File
Reading File
Reading File
Reading File
Reading File
Loading Image
Loading Image
Running Command

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

Writing File

~/priapism-ppt/priapism.js

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

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Priapism - A Comprehensive Overview";

// ── Color palette ──────────────────────────────────────────────────────────
const C = {
  navy:   "0A2342",   // dominant dark
  teal:   "1B6CA8",   // header accent
  sky:    "4FC3F7",   // light accent
  cream:  "F5F7FA",   // slide background
  white:  "FFFFFF",
  yellow: "FFD600",   // highlights
  red:    "D32F2F",   // warning / emergency
  gray:   "455A64",   // body text
  lightgray: "ECEFF1",
  orange: "F57C00",
};

// ── Helper: slide background ───────────────────────────────────────────────
function applyBg(slide, color) {
  slide.background = { color };
}

// ── Helper: header bar ─────────────────────────────────────────────────────
function addHeader(slide, title, barColor = C.navy) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 0.65,
    fill: { color: barColor },
  });
  slide.addText(title, {
    x: 0.18, y: 0, w: 9.3, h: 0.65,
    fontSize: 20, bold: true, color: C.white,
    valign: "middle", fontFace: "Calibri",
  });
}

// ── Helper: accent line under header ──────────────────────────────────────
function addAccentLine(slide) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0.65, w: "100%", h: 0.06,
    fill: { color: C.sky },
  });
}

// ── Helper: footer ─────────────────────────────────────────────────────────
function addFooter(slide, text = "Priapism – Comprehensive Review") {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 5.35, w: "100%", h: 0.275,
    fill: { color: C.navy },
  });
  slide.addText(text, {
    x: 0.2, y: 5.35, w: 9.6, h: 0.275,
    fontSize: 8, color: C.sky, valign: "middle", fontFace: "Calibri",
  });
}

// ── Helper: section label pill ─────────────────────────────────────────────
function addPill(slide, text, x, y, w = 1.6, h = 0.28, bg = C.teal) {
  slide.addShape(pres.ShapeType.roundRect, {
    x, y, w, h,
    fill: { color: bg },
    rectRadius: 0.08,
  });
  slide.addText(text, {
    x, y, w, h,
    fontSize: 8.5, bold: true, color: C.white,
    align: "center", valign: "middle", fontFace: "Calibri",
  });
}

// ── Helper: info box ───────────────────────────────────────────────────────
function addBox(slide, text, x, y, w, h, bg = C.lightgray, textColor = C.gray, fontSize = 9) {
  slide.addShape(pres.ShapeType.roundRect, {
    x, y, w, h,
    fill: { color: bg },
    line: { color: C.teal, width: 1 },
    rectRadius: 0.06,
  });
  slide.addText(text, {
    x: x + 0.05, y: y + 0.04, w: w - 0.1, h: h - 0.08,
    fontSize, color: textColor, fontFace: "Calibri", valign: "top",
  });
}

// ──────────────────────────────────────────────────────────────────────────
// Download images as base64
// ──────────────────────────────────────────────────────────────────────────
const imgUrls = [
  "https://cdn.orris.care/cdss_images/8e9973b1867bd6ec17b0b5162757489d46fc2578c48adac73e2296cc045e19f7.png",  // treatment flowchart
  "https://cdn.orris.care/cdss_images/64a2acfaba5af7f769b33b99c963ade8f473905b7097803a4509063c7bce1b95.png",  // penile anatomy
];

const imgs = JSON.parse(
  execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js ${imgUrls.map(u => `"${u}"`).join(" ")}`
  ).toString()
);

const [flowchartImg, anatomyImg] = imgs;

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE SLIDE
// ══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  applyBg(s, C.navy);

  // Top decorative bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.08, fill: { color: C.sky } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.08, w: "100%", h: 0.04, fill: { color: C.yellow } });

  // Left colored strip
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: "100%", fill: { color: C.teal } });

  // Main title
  s.addText("PRIAPISM", {
    x: 0.4, y: 1.1, w: 9.2, h: 1.2,
    fontSize: 54, bold: true, color: C.white,
    fontFace: "Calibri", align: "center",
    charSpacing: 8,
  });

  // Subtitle line
  s.addShape(pres.ShapeType.rect, { x: 2.5, y: 2.35, w: 5, h: 0.05, fill: { color: C.sky } });

  s.addText("A Comprehensive Clinical Overview", {
    x: 0.4, y: 2.45, w: 9.2, h: 0.5,
    fontSize: 18, color: C.sky, fontFace: "Calibri",
    align: "center", italic: true,
  });

  // Topics listed
  const topics = [
    "Definition  •  Etiology  •  Pathogenesis",
    "Classification  •  Clinical Manifestations",
    "Diagnosis  •  Differential Diagnosis  •  Treatment",
  ];
  topics.forEach((t, i) => {
    s.addText(t, {
      x: 1, y: 3.15 + i * 0.38, w: 8, h: 0.36,
      fontSize: 12, color: C.lightgray, fontFace: "Calibri", align: "center",
    });
  });

  // Bottom bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 5.35, w: "100%", h: 0.275, fill: { color: C.teal } });
  s.addText("Urology | Emergency Medicine | Internal Medicine", {
    x: 0.2, y: 5.35, w: 9.6, h: 0.275,
    fontSize: 8.5, color: C.white, valign: "middle", align: "center", fontFace: "Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 2 – TABLE OF CONTENTS
// ══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  applyBg(s, C.cream);
  addHeader(s, "Table of Contents");
  addAccentLine(s);
  addFooter(s);

  const items = [
    ["01", "Definition", "What is priapism? Origin of the term and core criteria."],
    ["02", "Etiology", "Primary (idiopathic) and secondary causes – drugs, haematologic, trauma."],
    ["03", "Pathogenesis", "Molecular and vascular mechanisms driving each subtype."],
    ["04", "Classification", "Ischemic (low-flow) | Non-ischemic (high-flow) | Stuttering."],
    ["05", "Clinical Manifestations", "Presentation, pain, rigidity and distinguishing features."],
    ["06", "Diagnosis", "History, exam, corporal blood gas, colour Doppler ultrasound."],
    ["07", "Differential Diagnosis", "Conditions to exclude before treating."],
    ["08", "Treatment – Ischemic", "Stepwise management: aspiration → phenylephrine → shunt."],
    ["09", "Treatment – Non-ischemic & Stuttering", "Embolisation, PDE5 inhibitors, long-term care."],
    ["10", "Complications & Prognosis", "Erectile dysfunction, fibrosis and outcome predictors."],
  ];

  const col1x = 0.22, col2x = 0.82, col3x = 1.75;
  const rowH = 0.42, startY = 0.78;

  items.forEach(([num, heading, desc], i) => {
    const y = startY + i * rowH;
    const bg = i % 2 === 0 ? C.lightgray : C.white;

    s.addShape(pres.ShapeType.roundRect, {
      x: col1x - 0.05, y: y - 0.02, w: 9.5, h: rowH - 0.04,
      fill: { color: bg }, line: { color: C.teal, width: 0.4 }, rectRadius: 0.05,
    });

    // Number badge
    s.addShape(pres.ShapeType.ellipse, {
      x: col1x, y: y + 0.03, w: 0.34, h: 0.28,
      fill: { color: C.teal },
    });
    s.addText(num, {
      x: col1x, y: y + 0.03, w: 0.34, h: 0.28,
      fontSize: 8, bold: true, color: C.white,
      align: "center", valign: "middle", fontFace: "Calibri",
    });

    // Heading
    s.addText(heading, {
      x: col2x, y: y + 0.02, w: 2.4, h: 0.28,
      fontSize: 9.5, bold: true, color: C.navy, fontFace: "Calibri", valign: "middle",
    });

    // Description
    s.addText(desc, {
      x: col3x + 1.5, y: y + 0.02, w: 5.8, h: 0.34,
      fontSize: 8, color: C.gray, fontFace: "Calibri", valign: "middle",
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 3 – DEFINITION
// ══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  applyBg(s, C.cream);
  addHeader(s, "01 | Definition");
  addAccentLine(s);
  addFooter(s);

  // Big definition box
  s.addShape(pres.ShapeType.roundRect, {
    x: 0.22, y: 0.82, w: 9.56, h: 1.0,
    fill: { color: C.navy }, line: { color: C.sky, width: 1.5 }, rectRadius: 0.1,
  });
  s.addText([
    { text: "Priapism", options: { bold: true, color: C.yellow, fontSize: 13 } },
    { text: " is defined as a prolonged and persistent penile erection ", options: { color: C.white, fontSize: 12 } },
    { text: "unrelated to sexual interest or stimulation", options: { bold: true, color: C.sky, fontSize: 12 } },
    { text: ", lasting more than ", options: { color: C.white, fontSize: 12 } },
    { text: "4 hours", options: { bold: true, color: C.yellow, fontSize: 13 } },
    { text: ", typically involving only the corpora cavernosa, with a soft glans and corpus spongiosum.", options: { color: C.white, fontSize: 12 } },
  ], { x: 0.35, y: 0.85, w: 9.3, h: 0.95, valign: "middle", fontFace: "Calibri" });

  // Etymology box
  s.addShape(pres.ShapeType.roundRect, {
    x: 0.22, y: 1.92, w: 4.5, h: 0.82,
    fill: { color: C.lightgray }, line: { color: C.teal, width: 1 }, rectRadius: 0.08,
  });
  s.addText("Etymology", { x: 0.3, y: 1.95, w: 4.3, h: 0.22, fontSize: 10, bold: true, color: C.navy, fontFace: "Calibri" });
  s.addText('Named after Priapus, the ancient Greek god of fertility, known for his permanent, oversized erection. The term entered medical literature in the 17th century.', {
    x: 0.3, y: 2.17, w: 4.3, h: 0.55, fontSize: 8.5, color: C.gray, fontFace: "Calibri",
  });

  // Key criteria box
  s.addShape(pres.ShapeType.roundRect, {
    x: 4.9, y: 1.92, w: 4.88, h: 0.82,
    fill: { color: C.lightgray }, line: { color: C.teal, width: 1 }, rectRadius: 0.08,
  });
  s.addText("Key Criteria", { x: 4.98, y: 1.95, w: 4.6, h: 0.22, fontSize: 10, bold: true, color: C.navy, fontFace: "Calibri" });
  s.addText([
    { text: "• Duration > 4 hours  ", options: { bold: true } },
    { text: "• Not related to sexual stimulation\n", options: {} },
    { text: "• Corpora cavernosa involved  ", options: { bold: true } },
    { text: "• Glans penis usually soft", options: {} },
  ], { x: 4.98, y: 2.17, w: 4.6, h: 0.55, fontSize: 8.5, color: C.gray, fontFace: "Calibri" });

  // Epidemiology banner
  s.addShape(pres.ShapeType.rect, {
    x: 0.22, y: 2.83, w: 9.56, h: 0.22,
    fill: { color: C.teal },
  });
  s.addText("Epidemiology: Incidence ~0.3–5.34 per 100,000 males/year | Bimodal peaks: 5–10 years (SCD) & 20–50 years (adults) | >95% of cases are ischemic", {
    x: 0.3, y: 2.83, w: 9.4, h: 0.22,
    fontSize: 8, color: C.white, valign: "middle", fontFace: "Calibri",
  });

  // Mini anatomy diagram placeholder note + image
  s.addText("Penile Cross-Section Anatomy", {
    x: 0.22, y: 3.12, w: 4.0, h: 0.22,
    fontSize: 9, bold: true, color: C.navy, fontFace: "Calibri",
  });
  if (!anatomyImg.error) {
    s.addImage({ data: anatomyImg.base64, x: 0.22, y: 3.35, w: 3.8, h: 1.78 });
  }

  // Key note boxes right side
  const notes = [
    ["Corpus Spongiosum", "Surrounds urethra; typically NOT involved in priapism (remains soft)"],
    ["Corpora Cavernosa (×2)", "Erectile bodies; become engorged with stagnant blood in ischemic priapism"],
    ["Tunica Albuginea", "Fibrous sheath; becomes a compartment trapping blood in low-flow priapism"],
  ];
  notes.forEach(([title, text], i) => {
    const y = 3.12 + i * 0.68;
    s.addShape(pres.ShapeType.roundRect, {
      x: 4.25, y, w: 5.53, h: 0.62,
      fill: { color: C.white }, line: { color: C.sky, width: 1 }, rectRadius: 0.06,
    });
    s.addText(title, { x: 4.35, y: y + 0.04, w: 5.3, h: 0.2, fontSize: 9, bold: true, color: C.teal, fontFace: "Calibri" });
    s.addText(text, { x: 4.35, y: y + 0.24, w: 5.3, h: 0.34, fontSize: 8, color: C.gray, fontFace: "Calibri" });
  });
}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 4 – ETIOLOGY
// ══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  applyBg(s, C.cream);
  addHeader(s, "02 | Etiology");
  addAccentLine(s);
  addFooter(s);

  // Two columns: Ischemic causes | Non-ischemic causes
  // ISCHEMIC column
  s.addShape(pres.ShapeType.rect, { x: 0.22, y: 0.78, w: 4.6, h: 0.3, fill: { color: C.navy } });
  s.addText("ISCHEMIC (LOW-FLOW) CAUSES", {
    x: 0.25, y: 0.78, w: 4.55, h: 0.3,
    fontSize: 9.5, bold: true, color: C.white, valign: "middle", fontFace: "Calibri",
  });

  const ischemicGroups = [
    ["Haematologic", ["Sickle cell disease (most common in children)", "Thalassaemia", "Leukemia / lymphoma", "Polycythaemia", "Glucose-6-phosphate deficiency"]],
    ["Medications", ["Intracavernous injections (papaverine, phentolamine, PGE1)", "PDE5 inhibitors (rare, <1%)", "Trazodone, chlorpromazine, prazosin", "Anticoagulants (heparin, warfarin)", "Cocaine, alcohol (up to 21% of cases)"]],
    ["Neurogenic", ["Spinal cord injury / stenosis", "Cauda equina lesions", "General anaesthesia"]],
    ["Neoplastic", ["Penile, prostate, bladder, rectal carcinoma", "Renal cell carcinoma"]],
    ["Idiopathic", ["~60% of all adult ischemic cases", "Presumed microvascular dysregulation"]],
  ];

  let yPos = 1.15;
  ischemicGroups.forEach(([group, items]) => {
    s.addText(group, {
      x: 0.28, y: yPos, w: 4.45, h: 0.22,
      fontSize: 8.5, bold: true, color: C.teal, fontFace: "Calibri",
    });
    yPos += 0.22;
    items.forEach(item => {
      s.addText("• " + item, {
        x: 0.38, y: yPos, w: 4.3, h: 0.19,
        fontSize: 7.5, color: C.gray, fontFace: "Calibri",
      });
      yPos += 0.19;
    });
    yPos += 0.05;
  });

  // NON-ISCHEMIC column
  s.addShape(pres.ShapeType.rect, { x: 5.12, y: 0.78, w: 4.66, h: 0.3, fill: { color: C.teal } });
  s.addText("NON-ISCHEMIC (HIGH-FLOW) CAUSES", {
    x: 5.15, y: 0.78, w: 4.6, h: 0.3,
    fontSize: 9.5, bold: true, color: C.white, valign: "middle", fontFace: "Calibri",
  });

  const nonIschemicItems = [
    ["Perineal / penile blunt trauma", "Most common cause (straddle injuries)"],
    ["Arteriocavernosal fistula", "Post-traumatic; unregulated arterial inflow"],
    ["Cavernous artery pseudoaneurysm", "Follows penile fracture or needle injury"],
    ["Pelvic surgery / biopsy", "Iatrogenic arteriovenous communication"],
    ["Perineal interventions", "Post-TURP, post-radical prostatectomy"],
  ];
  yPos = 1.15;
  nonIschemicItems.forEach(([title, detail]) => {
    s.addShape(pres.ShapeType.roundRect, {
      x: 5.12, y: yPos, w: 4.66, h: 0.54,
      fill: { color: C.white }, line: { color: C.sky, width: 0.8 }, rectRadius: 0.05,
    });
    s.addText(title, { x: 5.22, y: yPos + 0.04, w: 4.46, h: 0.2, fontSize: 9, bold: true, color: C.navy, fontFace: "Calibri" });
    s.addText(detail, { x: 5.22, y: yPos + 0.25, w: 4.46, h: 0.22, fontSize: 8, color: C.gray, fontFace: "Calibri" });
    yPos += 0.6;
  });

  // Stuttering note at bottom
  s.addShape(pres.ShapeType.roundRect, {
    x: 5.12, y: yPos + 0.05, w: 4.66, h: 0.62,
    fill: { color: C.yellow }, line: { color: C.orange, width: 1 }, rectRadius: 0.07,
  });
  s.addText("Stuttering / Intermittent Priapism", {
    x: 5.2, y: yPos + 0.08, w: 4.5, h: 0.22,
    fontSize: 9, bold: true, color: C.navy, fontFace: "Calibri",
  });
  s.addText("Same causes as ischemic priapism. Strongly associated with sickle cell disease; PDE5 dysregulation implicated.", {
    x: 5.2, y: yPos + 0.3, w: 4.5, h: 0.35,
    fontSize: 8, color: C.navy, fontFace: "Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 5 – PATHOGENESIS
// ══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  applyBg(s, C.cream);
  addHeader(s, "03 | Pathogenesis");
  addAccentLine(s);
  addFooter(s);

  // ── ISCHEMIC pathway (left) ────────────────────────────────────────────
  s.addShape(pres.ShapeType.rect, { x: 0.22, y: 0.78, w: 4.55, h: 0.28, fill: { color: C.navy } });
  s.addText("ISCHEMIC PRIAPISM PATHWAY", { x: 0.25, y: 0.78, w: 4.5, h: 0.28, fontSize: 9, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });

  const ischemicSteps = [
    ["Initiating event", "↑ Venous congestion / drugs / SCD sickling"],
    ["Venous outflow obstruction", "Emissary veins compressed by engorged sinusoids"],
    ["↓ Arterial inflow", "Corporal pressure approaches systolic → flow halts"],
    ["Stagnant blood pool", "Hypoxia (pO₂ <30 mmHg), Hypercapnia (pCO₂ >60 mmHg), Acidosis (pH <7.25)"],
    ["Smooth muscle damage", "Reactive oxygen species → cavernous SMC necrosis"],
    ["Fibroblast activation", "Collagen deposition → corporal fibrosis"],
    ["OUTCOME", "Erectile dysfunction (>30% with prolonged priapism)"],
  ];

  const arrowColor = C.teal;
  let yP = 1.12;
  ischemicSteps.forEach(([step, detail], i) => {
    const boxColor = i === ischemicSteps.length - 1 ? C.red : (i % 2 === 0 ? C.white : C.lightgray);
    const textColor = i === ischemicSteps.length - 1 ? C.white : C.navy;
    s.addShape(pres.ShapeType.roundRect, {
      x: 0.22, y: yP, w: 4.55, h: 0.46,
      fill: { color: boxColor }, line: { color: C.teal, width: 0.8 }, rectRadius: 0.05,
    });
    s.addText(step, { x: 0.3, y: yP + 0.02, w: 1.5, h: 0.18, fontSize: 7.5, bold: true, color: i === ischemicSteps.length - 1 ? C.yellow : C.teal, fontFace: "Calibri" });
    s.addText(detail, { x: 0.3, y: yP + 0.2, w: 4.35, h: 0.22, fontSize: 7.5, color: textColor, fontFace: "Calibri" });
    yP += 0.54;
    if (i < ischemicSteps.length - 1) {
      s.addShape(pres.ShapeType.line, { x: 2.43, y: yP - 0.06, w: 0, h: 0.06, line: { color: arrowColor, width: 1.5 }, lineHeadEnd: "arrow" });
    }
  });

  // ── NON-ISCHEMIC pathway (right) ──────────────────────────────────────
  s.addShape(pres.ShapeType.rect, { x: 5.12, y: 0.78, w: 4.66, h: 0.28, fill: { color: C.teal } });
  s.addText("NON-ISCHEMIC PRIAPISM PATHWAY", { x: 5.15, y: 0.78, w: 4.6, h: 0.28, fontSize: 9, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });

  const nonSteps = [
    ["Blunt perineal trauma", "Disrupts cavernosal artery wall"],
    ["Pseudoaneurysm / fistula forms", "Arteriocavernosal or arteriovenous communication"],
    ["Unregulated arterial inflow", "↑ Blood flow bypasses normal resistance"],
    ["Maintained venous drainage", "Blood remains oxygenated → NO pain, NO ischemia"],
    ["Persistent tumescence", "Partial, non-painful, non-rigid erection"],
    ["Outcome if untreated", "Spontaneous resolution possible; embolisation curative"],
  ];

  yP = 1.12;
  nonSteps.forEach(([step, detail], i) => {
    s.addShape(pres.ShapeType.roundRect, {
      x: 5.12, y: yP, w: 4.66, h: 0.46,
      fill: { color: i % 2 === 0 ? C.white : C.lightgray }, line: { color: C.sky, width: 0.8 }, rectRadius: 0.05,
    });
    s.addText(step, { x: 5.2, y: yP + 0.02, w: 1.5, h: 0.18, fontSize: 7.5, bold: true, color: C.teal, fontFace: "Calibri" });
    s.addText(detail, { x: 5.2, y: yP + 0.2, w: 4.45, h: 0.22, fontSize: 7.5, color: C.gray, fontFace: "Calibri" });
    yP += 0.54;
  });

  // Molecular note strip
  s.addShape(pres.ShapeType.rect, { x: 0.22, y: 5.12, w: 9.56, h: 0.22, fill: { color: C.navy } });
  s.addText("Molecular: PDE5 dysregulation → ↓ cGMP → abnormal NO signalling → smooth muscle relaxation persists (stuttering priapism mechanism)", {
    x: 0.3, y: 5.12, w: 9.4, h: 0.22, fontSize: 7.5, color: C.sky, valign: "middle", fontFace: "Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 6 – CLASSIFICATION
// ══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  applyBg(s, C.cream);
  addHeader(s, "04 | Classification");
  addAccentLine(s);
  addFooter(s);

  const types = [
    {
      name: "TYPE 1 – ISCHEMIC\n(Low-Flow / Veno-Occlusive)",
      freq: "~95% of cases",
      mechanism: "Venous outflow obstruction → stagnant hypoxic blood in corpora cavernosa",
      pain: "Painful (penile ischaemia)",
      rigidity: "Fully rigid",
      blood: "Dark (hypoxic, acidotic)",
      emergency: "YES – Urological emergency",
      boxColor: C.navy,
      textColor: C.white,
      badgeColor: C.red,
    },
    {
      name: "TYPE 2 – NON-ISCHEMIC\n(High-Flow / Arterial)",
      freq: "<5% of cases",
      mechanism: "Arteriocavernosal fistula → unregulated arterial inflow with intact venous drainage",
      pain: "Painless",
      rigidity: "Partial / incomplete",
      blood: "Bright red (well-oxygenated)",
      emergency: "NO – Not an emergency",
      boxColor: C.teal,
      textColor: C.white,
      badgeColor: C.sky,
    },
    {
      name: "TYPE 3 – STUTTERING\n(Intermittent / Recurrent)",
      freq: "Subset of ischemic",
      mechanism: "Repeated self-limited ischemic episodes; PDE5 dysregulation; strong SCD association",
      pain: "Painful episodes (self-limiting)",
      rigidity: "Fully rigid during episodes",
      blood: "Hypoxic during episodes",
      emergency: "RECURRENT – chronic management needed",
      boxColor: C.gray,
      textColor: C.white,
      badgeColor: C.yellow,
    },
  ];

  types.forEach((t, i) => {
    const x = 0.22 + i * 3.27;
    // Header
    s.addShape(pres.ShapeType.roundRect, {
      x, y: 0.78, w: 3.1, h: 0.62,
      fill: { color: t.boxColor }, rectRadius: 0.08,
    });
    s.addText(t.name, { x: x + 0.08, y: 0.8, w: 2.95, h: 0.58, fontSize: 9.5, bold: true, color: t.textColor, fontFace: "Calibri", valign: "middle" });

    // Badge
    s.addShape(pres.ShapeType.roundRect, {
      x: x + 1.7, y: 0.82, w: 1.28, h: 0.22,
      fill: { color: t.badgeColor }, rectRadius: 0.06,
    });
    s.addText(t.freq, { x: x + 1.7, y: 0.82, w: 1.28, h: 0.22, fontSize: 7, bold: true, color: C.navy, align: "center", valign: "middle", fontFace: "Calibri" });

    // Detail rows
    const rows = [
      ["Mechanism", t.mechanism],
      ["Pain", t.pain],
      ["Rigidity", t.rigidity],
      ["Blood gas", t.blood],
      ["Emergency?", t.emergency],
    ];
    rows.forEach(([label, val], j) => {
      const yy = 1.5 + j * 0.6;
      const rowBg = j % 2 === 0 ? C.lightgray : C.white;
      s.addShape(pres.ShapeType.rect, { x, y: yy, w: 3.1, h: 0.56, fill: { color: rowBg } });
      s.addText(label, { x: x + 0.06, y: yy + 0.03, w: 0.95, h: 0.2, fontSize: 8, bold: true, color: C.teal, fontFace: "Calibri" });
      s.addText(val, { x: x + 0.06, y: yy + 0.24, w: 2.95, h: 0.28, fontSize: 8, color: C.gray, fontFace: "Calibri" });
    });
  });

  // Comparison table key at bottom
  s.addShape(pres.ShapeType.rect, { x: 0.22, y: 4.62, w: 9.56, h: 0.58, fill: { color: C.lightgray }, line: { color: C.teal, width: 0.8 } });
  s.addText("AUA Classification Note:", { x: 0.3, y: 4.64, w: 3, h: 0.2, fontSize: 9, bold: true, color: C.navy, fontFace: "Calibri" });
  s.addText("The American Urological Association (AUA) 2003 Guidelines and European Association of Urology (EAU) classify priapism into the three subtypes above. Diagnosis relies on history + corporal blood gas analysis + colour Doppler ultrasound. Stuttering priapism is categorised under the ischemic spectrum.", {
    x: 0.3, y: 4.84, w: 9.36, h: 0.34, fontSize: 8, color: C.gray, fontFace: "Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 7 – CLINICAL MANIFESTATIONS
// ══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  applyBg(s, C.cream);
  addHeader(s, "05 | Clinical Manifestations");
  addAccentLine(s);
  addFooter(s);

  // Two panels
  // Left – Ischemic
  s.addShape(pres.ShapeType.rect, { x: 0.22, y: 0.78, w: 4.55, h: 0.3, fill: { color: C.navy } });
  s.addText("ISCHEMIC PRIAPISM", { x: 0.25, y: 0.78, w: 4.5, h: 0.3, fontSize: 10, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });

  const ischemicFeatures = [
    ["Onset", "Usually gradual; hours after sexual activity / medication / sleep (SCD)"],
    ["Duration", "> 4 hours (often 6–48 hours before presentation)"],
    ["Pain", "Progressive, severe penile pain (ischaemic in nature)"],
    ["Erection quality", "Fully rigid corpora cavernosa; glans and corpus spongiosum SOFT"],
    ["Appearance", "Engorged shaft; skin may appear dusky/congested"],
    ["Systemic features", "Anxiety, urinary retention (rare), haematuria"],
    ["SCD-specific", "Triggered by acidosis, dehydration, cold, infection; nocturnal episodes"],
    ["Time-ischaemia correlation", "< 24h – good prognosis; > 48h – high risk of ED"],
  ];

  ischemicFeatures.forEach(([label, val], i) => {
    const yy = 1.14 + i * 0.48;
    const bg = i % 2 === 0 ? C.lightgray : C.white;
    s.addShape(pres.ShapeType.rect, { x: 0.22, y: yy, w: 4.55, h: 0.44, fill: { color: bg } });
    s.addText(label, { x: 0.3, y: yy + 0.03, w: 1.2, h: 0.18, fontSize: 8, bold: true, color: C.teal, fontFace: "Calibri" });
    s.addText(val, { x: 0.3, y: yy + 0.22, w: 4.35, h: 0.2, fontSize: 7.5, color: C.gray, fontFace: "Calibri" });
  });

  // Right – Non-Ischemic + Stuttering
  s.addShape(pres.ShapeType.rect, { x: 5.0, y: 0.78, w: 4.78, h: 0.3, fill: { color: C.teal } });
  s.addText("NON-ISCHEMIC & STUTTERING", { x: 5.03, y: 0.78, w: 4.72, h: 0.3, fontSize: 10, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });

  const niFeatures = [
    ["Onset", "Usually hours to days after perineal trauma"],
    ["Duration", "Persistent, may last weeks/months if untreated"],
    ["Pain", "ABSENT or minimal – key distinguishing feature"],
    ["Erection quality", "Partial tumescence; not fully rigid"],
    ["Appearance", "Normal skin colour; no congestion"],
    ["History clue", "Straddle injury, fall astride, bicycle accident"],
    ["Bruising", "Perineal or penile bruising may be present"],
  ];

  niFeatures.forEach(([label, val], i) => {
    const yy = 1.14 + i * 0.48;
    const bg = i % 2 === 0 ? C.lightgray : C.white;
    s.addShape(pres.ShapeType.rect, { x: 5.0, y: yy, w: 4.78, h: 0.44, fill: { color: bg } });
    s.addText(label, { x: 5.08, y: yy + 0.03, w: 1.2, h: 0.18, fontSize: 8, bold: true, color: C.navy, fontFace: "Calibri" });
    s.addText(val, { x: 5.08, y: yy + 0.22, w: 4.58, h: 0.2, fontSize: 7.5, color: C.gray, fontFace: "Calibri" });
  });

  // Stuttering box
  s.addShape(pres.ShapeType.roundRect, {
    x: 5.0, y: 4.52, w: 4.78, h: 0.64,
    fill: { color: C.yellow }, line: { color: C.orange, width: 1 }, rectRadius: 0.07,
  });
  s.addText("Stuttering: ", { x: 5.08, y: 4.56, w: 1.0, h: 0.22, fontSize: 9, bold: true, color: C.navy, fontFace: "Calibri" });
  s.addText("Recurrent self-limiting painful episodes < 3 hours; complete detumescence between episodes; sleep-associated; progressive risk of ischemic event over time.", {
    x: 5.08, y: 4.76, w: 4.6, h: 0.36, fontSize: 8, color: C.navy, fontFace: "Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 8 – DIAGNOSIS
// ══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  applyBg(s, C.cream);
  addHeader(s, "06 | Diagnosis");
  addAccentLine(s);
  addFooter(s);

  // History column
  s.addShape(pres.ShapeType.rect, { x: 0.22, y: 0.78, w: 3.0, h: 0.28, fill: { color: C.navy } });
  s.addText("HISTORY", { x: 0.25, y: 0.78, w: 2.95, h: 0.28, fontSize: 9, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });
  const histItems = [
    "Duration of erection (critical for management)",
    "Trauma to perineum / penis",
    "Prior episodes + treatments",
    "Known SCD or haematologic disorder",
    "Medications: PDE5i, intracavernous injections, trazodone, antipsychotics",
    "Illicit drug / alcohol use",
    "Erectile function at baseline",
  ];
  histItems.forEach((item, i) => {
    s.addText("• " + item, {
      x: 0.28, y: 1.11 + i * 0.3, w: 2.88, h: 0.28,
      fontSize: 7.8, color: C.gray, fontFace: "Calibri",
    });
  });

  // Examination column
  s.addShape(pres.ShapeType.rect, { x: 3.4, y: 0.78, w: 3.0, h: 0.28, fill: { color: C.teal } });
  s.addText("EXAMINATION", { x: 3.43, y: 0.78, w: 2.95, h: 0.28, fontSize: 9, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });
  const examItems = [
    "Fully rigid (ischemic) vs. partially tumescent (non-ischemic)",
    "Glans and corpus spongiosum: soft in priapism",
    "Perineal / penile bruising (trauma?)",
    "Abdominal: lymphadenopathy, masses",
    "Neurological: reflexes, sensation",
    "Signs of SCD (jaundice, splenomegaly)",
  ];
  examItems.forEach((item, i) => {
    s.addText("• " + item, {
      x: 3.46, y: 1.11 + i * 0.3, w: 2.88, h: 0.28,
      fontSize: 7.8, color: C.gray, fontFace: "Calibri",
    });
  });

  // Investigations column
  s.addShape(pres.ShapeType.rect, { x: 6.6, y: 0.78, w: 3.18, h: 0.28, fill: { color: C.gray } });
  s.addText("INVESTIGATIONS", { x: 6.63, y: 0.78, w: 3.12, h: 0.28, fontSize: 9, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });
  const invItems = [
    "Corporal blood gas (needle aspiration)",
    "FBC, retics, Hb electrophoresis",
    "Coagulation screen",
    "Urine toxicology / drug screen",
    "Colour Doppler USS (gold standard for NI)",
    "Pudendal arteriography (if embolisation planned)",
    "MRI penis (fibrosis assessment)",
  ];
  invItems.forEach((item, i) => {
    s.addText("• " + item, {
      x: 6.66, y: 1.11 + i * 0.3, w: 3.06, h: 0.28,
      fontSize: 7.8, color: C.gray, fontFace: "Calibri",
    });
  });

  // Blood gas table
  s.addShape(pres.ShapeType.rect, { x: 0.22, y: 3.28, w: 9.56, h: 0.26, fill: { color: C.navy } });
  s.addText("CORPORAL BLOOD GAS ANALYSIS – Diagnostic Criteria", {
    x: 0.3, y: 3.28, w: 9.4, h: 0.26, fontSize: 9, bold: true, color: C.white, valign: "middle", fontFace: "Calibri",
  });

  const bgHeaders = ["Parameter", "Normal Penile Blood", "Ischemic Priapism", "Non-Ischemic Priapism"];
  const bgData = [
    ["pO₂",  ">90 mmHg",  "<30 mmHg (↓↓↓)", ">90 mmHg (normal)"],
    ["pCO₂", "<40 mmHg",  ">60 mmHg (↑↑↑)", "<40 mmHg (normal)"],
    ["pH",   "7.40",      "<7.25 (acidotic)", "7.40 (normal)"],
    ["Colour", "Bright red", "Dark / maroon", "Bright red"],
  ];
  const colW = [1.8, 2.2, 2.8, 2.76];
  const colX = [0.22, 2.02, 4.22, 7.0];

  // Header row
  bgHeaders.forEach((h, i) => {
    s.addShape(pres.ShapeType.rect, { x: colX[i], y: 3.56, w: colW[i], h: 0.28, fill: { color: C.teal } });
    s.addText(h, { x: colX[i] + 0.04, y: 3.56, w: colW[i] - 0.08, h: 0.28, fontSize: 8.5, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });
  });

  bgData.forEach((row, ri) => {
    const rowBg = ri % 2 === 0 ? C.lightgray : C.white;
    row.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, { x: colX[ci], y: 3.86 + ri * 0.3, w: colW[ci], h: 0.28, fill: { color: rowBg }, line: { color: C.sky, width: 0.4 } });
      const textColor = cell.includes("↓↓↓") || cell.includes("acidotic") ? C.red : (cell.includes("↑↑↑") ? C.red : C.gray);
      s.addText(cell, { x: colX[ci] + 0.04, y: 3.86 + ri * 0.3, w: colW[ci] - 0.08, h: 0.28, fontSize: 8, color: textColor, valign: "middle", fontFace: "Calibri" });
    });
  });

  // Doppler note
  s.addShape(pres.ShapeType.roundRect, {
    x: 0.22, y: 5.07, w: 9.56, h: 0.26,
    fill: { color: C.sky }, rectRadius: 0.04,
  });
  s.addText("Colour Doppler Ultrasound: Absent/minimal cavernous arterial flow = Ischemic | Turbulent high-velocity flow / fistula = Non-Ischemic (sensitivity 100%, specificity 73%)", {
    x: 0.3, y: 5.07, w: 9.4, h: 0.26, fontSize: 7.8, color: C.navy, valign: "middle", fontFace: "Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 9 – DIFFERENTIAL DIAGNOSIS
// ══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  applyBg(s, C.cream);
  addHeader(s, "07 | Differential Diagnosis");
  addAccentLine(s);
  addFooter(s);

  const diffs = [
    {
      condition: "Penile Fracture",
      similarity: "Acute penile swelling/pain",
      distinction: "Preceded by audible 'pop' during intercourse; immediate detumescence; associated urethral injury. No sustained erection.",
      urgent: true,
    },
    {
      condition: "Pseudopriapism",
      similarity: "Rigid penis",
      distinction: "Penile prosthesis malfunction (infected / mechanical failure); no true erection. History of implant insertion. Soft proximal shaft.",
      urgent: false,
    },
    {
      condition: "Metastatic Penile Involvement",
      similarity: "Persistent tumescence",
      distinction: "Penile metastasis from bladder, prostate, rectum. Involves corpus spongiosum + cavernosa. Painless, firm nodule. Imaging shows mass.",
      urgent: false,
    },
    {
      condition: "Peyronie's Disease",
      similarity: "Penile deformity during erection",
      distinction: "Fibrous plaques causing angulation; pain during erection (not outside); resolves with detumescence. No sustained erection at rest.",
      urgent: false,
    },
    {
      condition: "Venous Thrombosis (penile)",
      similarity: "Penile pain + rigidity",
      distinction: "Isolated dorsal vein thrombosis; linear cord-like induration along dorsum; associated with trauma / Behcet's. Duplex USS diagnostic.",
      urgent: false,
    },
    {
      condition: "Phimosis / Paraphimosis",
      similarity: "Penile engorgement, pain",
      distinction: "Glans oedema in paraphimosis; inability to retract/replace foreskin. Corpora cavernosa are normal.",
      urgent: true,
    },
    {
      condition: "Neurological Erection",
      similarity: "Persistent erection with SCI",
      distinction: "Reflex erections with spinal cord injury; associated with lesion level; not ischaemic. May coexist with true priapism.",
      urgent: false,
    },
  ];

  diffs.forEach((d, i) => {
    const yy = 0.78 + i * 0.62;
    const bg = i % 2 === 0 ? C.lightgray : C.white;
    s.addShape(pres.ShapeType.roundRect, { x: 0.22, y: yy, w: 9.56, h: 0.58, fill: { color: bg }, line: { color: C.sky, width: 0.6 }, rectRadius: 0.05 });

    if (d.urgent) {
      s.addShape(pres.ShapeType.rect, { x: 0.22, y: yy, w: 0.1, h: 0.58, fill: { color: C.red } });
    }

    s.addText(d.condition, { x: 0.4, y: yy + 0.04, w: 2.0, h: 0.22, fontSize: 9.5, bold: true, color: C.navy, fontFace: "Calibri" });
    s.addText("Mimics: " + d.similarity, { x: 0.4, y: yy + 0.26, w: 2.0, h: 0.22, fontSize: 7.5, color: C.teal, fontFace: "Calibri", italic: true });
    s.addText(d.distinction, { x: 2.55, y: yy + 0.08, w: 7.15, h: 0.44, fontSize: 8, color: C.gray, fontFace: "Calibri" });
  });
}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 10 – TREATMENT (ISCHEMIC) with flowchart
// ══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  applyBg(s, C.cream);
  addHeader(s, "08 | Treatment – Ischemic Priapism");
  addAccentLine(s);
  addFooter(s);

  // Left: step-by-step
  s.addShape(pres.ShapeType.rect, { x: 0.22, y: 0.78, w: 5.1, h: 0.28, fill: { color: C.navy } });
  s.addText("STEPWISE MANAGEMENT (AUA / EAU Guidelines)", { x: 0.25, y: 0.78, w: 5.05, h: 0.28, fontSize: 9, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });

  const steps = [
    ["STEP 1", "General measures", "Analgesia (opioids IV/IM), anxiolysis. Treat underlying cause (hydration + oxygenation for SCD; exchange transfusion if needed)."],
    ["STEP 2", "Corporal aspiration", "21-gauge butterfly needle into lateral corpus cavernosum at 3 or 9 o'clock. Aspirate 20–30 mL until bright red blood appears. May repeat."],
    ["STEP 3", "α-adrenergic injection", "Phenylephrine (drug of choice): 100–200 µg in 1 mL saline; repeat every 3–5 min (max 1000 µg). Monitor BP/HR (cardiac risk)."],
    ["STEP 4", "Corporal irrigation", "Saline irrigation with aspiration cycles if aspiration alone insufficient."],
    ["STEP 5", "Surgical shunt", "Distal: Winter shunt (16G Tru-Cut needle via glans) or Ebbehoj / Al-Ghorab shunts. Proximal: Quackels (cavernosospongiosum) or Grayhack (saphenous vein) shunts."],
    ["STEP 6", "Penile prosthesis", "Consider early prosthesis insertion (< 2 weeks) if > 36–72h ischemia to prevent fibrosis / preserve length."],
  ];

  let yPos = 1.12;
  steps.forEach(([num, title, detail]) => {
    s.addShape(pres.ShapeType.roundRect, { x: 0.22, y: yPos, w: 5.1, h: 0.62, fill: { color: C.white }, line: { color: C.teal, width: 0.8 }, rectRadius: 0.06 });
    s.addShape(pres.ShapeType.ellipse, { x: 0.27, y: yPos + 0.06, w: 0.52, h: 0.3, fill: { color: C.navy } });
    s.addText(num, { x: 0.27, y: yPos + 0.06, w: 0.52, h: 0.3, fontSize: 7, bold: true, color: C.white, align: "center", valign: "middle", fontFace: "Calibri" });
    s.addText(title, { x: 0.86, y: yPos + 0.04, w: 4.38, h: 0.22, fontSize: 9, bold: true, color: C.teal, fontFace: "Calibri" });
    s.addText(detail, { x: 0.86, y: yPos + 0.26, w: 4.38, h: 0.32, fontSize: 7.5, color: C.gray, fontFace: "Calibri" });
    yPos += 0.67;
  });

  // Right: management flowchart image
  s.addShape(pres.ShapeType.rect, { x: 5.55, y: 0.78, w: 4.23, h: 0.28, fill: { color: C.teal } });
  s.addText("MANAGEMENT FLOWCHART", { x: 5.58, y: 0.78, w: 4.18, h: 0.28, fontSize: 9, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });

  if (!flowchartImg.error) {
    s.addImage({ data: flowchartImg.base64, x: 5.55, y: 1.1, w: 4.23, h: 3.2 });
  }

  // Phenylephrine dosing box
  s.addShape(pres.ShapeType.roundRect, {
    x: 5.55, y: 4.38, w: 4.23, h: 0.78,
    fill: { color: C.yellow }, line: { color: C.orange, width: 1 }, rectRadius: 0.08,
  });
  s.addText("Phenylephrine – Drug of Choice", { x: 5.62, y: 4.42, w: 4.1, h: 0.2, fontSize: 9.5, bold: true, color: C.navy, fontFace: "Calibri" });
  s.addText([
    { text: "Dose: ", options: { bold: true } },
    { text: "100–500 µg in 1 mL NS every 3–5 min (max 1 mg/dose) | " },
    { text: "Preferred: ", options: { bold: true } },
    { text: "Selective α1-agonist, minimal cardiac effects | " },
    { text: "Alternative: ", options: { bold: true } },
    { text: "Epinephrine 10–20 µg or norepinephrine" },
  ], { x: 5.62, y: 4.64, w: 4.1, h: 0.5, fontSize: 7.5, color: C.navy, fontFace: "Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════
// SLIDE 11 – TREATMENT (NON-ISCHEMIC & STUTTERING) + COMPLICATIONS
// ══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  applyBg(s, C.cream);
  addHeader(s, "09–10 | Non-Ischemic Treatment · Stuttering · Complications & Prognosis");
  addAccentLine(s);
  addFooter(s);

  // Non-Ischemic Treatment
  s.addShape(pres.ShapeType.rect, { x: 0.22, y: 0.78, w: 3.1, h: 0.28, fill: { color: C.teal } });
  s.addText("NON-ISCHEMIC TX", { x: 0.25, y: 0.78, w: 3.05, h: 0.28, fontSize: 9, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });

  const niTx = [
    ["Observation", "20–60% resolve spontaneously; not an emergency."],
    ["Selective arterial embolisation", "Gold standard. Superselective catheterisation of internal pudendal artery. Success 74–80%. Temporary (gelfoam) preferred to preserve potency."],
    ["Surgical ligation", "For failed embolisation; direct surgical ligation of arteriocavernosal fistula via perineal approach."],
    ["Ice-pack", "Initial conservative measure to reduce blood flow."],
  ];
  niTx.forEach(([title, desc], i) => {
    const yy = 1.1 + i * 0.56;
    s.addShape(pres.ShapeType.roundRect, { x: 0.22, y: yy, w: 3.1, h: 0.52, fill: { color: i%2===0?C.lightgray:C.white }, line: { color: C.sky, width: 0.8 }, rectRadius: 0.05 });
    s.addText(title, { x: 0.3, y: yy + 0.03, w: 2.9, h: 0.2, fontSize: 8.5, bold: true, color: C.navy, fontFace: "Calibri" });
    s.addText(desc, { x: 0.3, y: yy + 0.24, w: 2.9, h: 0.26, fontSize: 7.5, color: C.gray, fontFace: "Calibri" });
  });

  // Stuttering Treatment
  s.addShape(pres.ShapeType.rect, { x: 3.48, y: 0.78, w: 3.1, h: 0.28, fill: { color: C.navy } });
  s.addText("STUTTERING TX", { x: 3.51, y: 0.78, w: 3.05, h: 0.28, fontSize: 9, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });

  const stutterTx = [
    ["Acute episode", "Same as ischemic: aspiration + phenylephrine"],
    ["PDE5 inhibitors (chronic)", "Paradoxically prevent recurrence by restoring PDE5 activity & NO signalling (sildenafil 25–50 mg daily)"],
    ["Pseudoephedrine", "Oral α-agonist; 30–60 mg at bedtime for prophylaxis"],
    ["GnRH agonists", "Reduce testosterone; used in refractory cases (leuprolide)"],
    ["Hydroxyurea", "For SCD patients; reduces sickling episodes"],
    ["Baclofen / Digoxin", "Second-line; limited evidence"],
  ];
  stutterTx.forEach(([title, desc], i) => {
    const yy = 1.1 + i * 0.46;
    s.addShape(pres.ShapeType.roundRect, { x: 3.48, y: yy, w: 3.1, h: 0.42, fill: { color: i%2===0?C.lightgray:C.white }, line: { color: C.teal, width: 0.8 }, rectRadius: 0.05 });
    s.addText(title, { x: 3.56, y: yy + 0.02, w: 2.9, h: 0.18, fontSize: 8, bold: true, color: C.teal, fontFace: "Calibri" });
    s.addText(desc, { x: 3.56, y: yy + 0.2, w: 2.9, h: 0.2, fontSize: 7.5, color: C.gray, fontFace: "Calibri" });
  });

  // Complications + Prognosis
  s.addShape(pres.ShapeType.rect, { x: 6.74, y: 0.78, w: 3.04, h: 0.28, fill: { color: C.red } });
  s.addText("COMPLICATIONS & PROGNOSIS", { x: 6.77, y: 0.78, w: 2.98, h: 0.28, fontSize: 8, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });

  const comps = [
    ["Erectile dysfunction", "Most feared complication. >30% with prolonged priapism (>24–48h). Fibrosis of cavernous SMC."],
    ["Corporal fibrosis", "Progressive replacement of erectile tissue by scar; leads to Peyronie-like deformity."],
    ["Penile shortening", "Fibrosis → loss of elasticity → overall penile length reduction."],
    ["Urinary retention", "Rare; due to urethral oedema / haematoma."],
    ["Infection / sepsis", "Post-intervention; rare if technique clean."],
  ];
  comps.forEach(([title, desc], i) => {
    const yy = 1.1 + i * 0.55;
    s.addShape(pres.ShapeType.roundRect, { x: 6.74, y: yy, w: 3.04, h: 0.5, fill: { color: i%2===0?C.lightgray:C.white }, line: { color: C.red, width: 0.8 }, rectRadius: 0.05 });
    s.addText(title, { x: 6.82, y: yy + 0.02, w: 2.85, h: 0.18, fontSize: 8, bold: true, color: C.red, fontFace: "Calibri" });
    s.addText(desc, { x: 6.82, y: yy + 0.22, w: 2.85, h: 0.26, fontSize: 7.5, color: C.gray, fontFace: "Calibri" });
  });

  // Prognosis time bar at bottom
  s.addShape(pres.ShapeType.rect, { x: 0.22, y: 4.82, w: 9.56, h: 0.22, fill: { color: C.navy } });
  s.addText("PROGNOSIS TIMELINE:", { x: 0.3, y: 4.82, w: 1.6, h: 0.22, fontSize: 8, bold: true, color: C.yellow, valign: "middle", fontFace: "Calibri" });
  s.addText("< 4h: ED rare   |   4–24h: ED 10–35%   |   24–48h: ED 50–80%   |   > 48h: ED >90%   |   > 72h: Penile prosthesis likely needed", {
    x: 1.9, y: 4.82, w: 7.8, h: 0.22, fontSize: 8, color: C.sky, valign: "middle", fontFace: "Calibri",
  });

  // Key message banner
  s.addShape(pres.ShapeType.roundRect, { x: 0.22, y: 5.07, w: 9.56, h: 0.26, fill: { color: C.sky }, rectRadius: 0.04 });
  s.addText("KEY MESSAGE: Ischemic priapism is a time-sensitive urological emergency. Prompt diagnosis and treatment within 4–6 hours optimises erectile function preservation.", {
    x: 0.3, y: 5.07, w: 9.4, h: 0.26, fontSize: 8, bold: true, color: C.navy, valign: "middle", fontFace: "Calibri",
  });
}

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

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

You've run out of free credits. Sign up for a free account to continue using Orris.
This is a shared conversation. Sign in to Orris to start your own chat.