Make .pptx on types of ectopic pregnancy

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

ls /home/daytona/workspace/ 2>/dev/null || mkdir -p /home/daytona/workspace

Running Command

mkdir -p /home/daytona/workspace/ectopic-pregnancy-pptx && node -e "require('pptxgenjs')" 2>&1 && echo "pptxgenjs OK"

Writing File

~/ectopic-pregnancy-pptx/create_pptx.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Types of Ectopic Pregnancy";
pres.author = "Orris Medical Education";

// ─── Color Palette ───────────────────────────────────────────
const DARK_BG   = "1A1D2E";   // deep navy
const MID_BG    = "22273A";   // slightly lighter navy
const CARD_BG   = "2C3350";   // card surface
const ACCENT1   = "E8515A";   // vivid red (danger / medical)
const ACCENT2   = "F4A261";   // warm amber
const ACCENT3   = "4CC9F0";   // sky blue
const WHITE     = "FFFFFF";
const LIGHT_TXT = "CBD5E1";   // muted subtitle text
const GOLD      = "FFD166";   // callout gold

// ─── Helper: dark slide background ───────────────────────────
function darkBg(slide) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: "100%", fill: { color: DARK_BG }, line: { type: "none" }
  });
}

// ─── Helper: accent bar (top left) ───────────────────────────
function accentBar(slide, color) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 0.18, h: "100%", fill: { color }, line: { type: "none" }
  });
}

// ─── Helper: section header band ─────────────────────────────
function headerBand(slide, color) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 1.05, fill: { color }, line: { type: "none" }
  });
}

// ─── Helper: card box ────────────────────────────────────────
function card(slide, x, y, w, h, color) {
  slide.addShape(pres.ShapeType.roundRect, {
    x, y, w, h,
    fill: { color: color || CARD_BG },
    line: { color: ACCENT3, width: 0.8 },
    rectRadius: 0.12
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);

  // Full-width top gradient strip
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 0.08, fill: { color: ACCENT1 }, line: { type: "none" }
  });

  // Large background circle (decorative)
  slide.addShape(pres.ShapeType.ellipse, {
    x: 6.5, y: -1.2, w: 5, h: 5,
    fill: { color: "2E1E3A", transparency: 30 },
    line: { color: ACCENT1, width: 1.5 }
  });

  // Small decorative circle
  slide.addShape(pres.ShapeType.ellipse, {
    x: 8.5, y: 3.8, w: 2, h: 2,
    fill: { color: CARD_BG },
    line: { color: ACCENT2, width: 1 }
  });

  // Tag / label
  slide.addShape(pres.ShapeType.roundRect, {
    x: 0.55, y: 1.3, w: 2.4, h: 0.38,
    fill: { color: ACCENT1 }, line: { type: "none" }, rectRadius: 0.06
  });
  slide.addText("OBSTETRICS & GYNECOLOGY", {
    x: 0.55, y: 1.3, w: 2.4, h: 0.38,
    fontSize: 7.5, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0
  });

  // Main title
  slide.addText("Types of", {
    x: 0.5, y: 1.9, w: 7, h: 0.8,
    fontSize: 30, bold: false, color: LIGHT_TXT, fontFace: "Calibri", align: "left"
  });
  slide.addText("Ectopic Pregnancy", {
    x: 0.5, y: 2.55, w: 8.5, h: 1.1,
    fontSize: 52, bold: true, color: WHITE, fontFace: "Calibri", align: "left"
  });

  // Subtitle / definition
  slide.addShape(pres.ShapeType.rect, {
    x: 0.5, y: 3.75, w: 6.5, h: 0.03, fill: { color: ACCENT3 }, line: { type: "none" }
  });
  slide.addText("Implantation of the fertilized ovum outside the endometrial cavity", {
    x: 0.5, y: 3.85, w: 7.5, h: 0.6,
    fontSize: 15, italic: true, color: LIGHT_TXT, fontFace: "Calibri", align: "left"
  });

  // Stats strip
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 4.7, w: "100%", h: 0.93, fill: { color: CARD_BG }, line: { type: "none" }
  });
  const stats = [
    { val: "~2%", label: "Incidence in general population" },
    { val: "82%", label: "Tubal ectopics" },
    { val: "#1", label: "Cause of 1st trimester maternal death" },
  ];
  stats.forEach((s, i) => {
    const x = 0.6 + i * 3.15;
    slide.addText(s.val, { x, y: 4.72, w: 2.8, h: 0.42, fontSize: 22, bold: true, color: ACCENT2, align: "center" });
    slide.addText(s.label, { x, y: 5.14, w: 2.8, h: 0.38, fontSize: 10, color: LIGHT_TXT, align: "center" });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 2 — OVERVIEW / CLASSIFICATION
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);
  accentBar(slide, ACCENT1);
  headerBand(slide, MID_BG);

  slide.addText("Classification of Ectopic Pregnancy", {
    x: 0.3, y: 0.12, w: 9.4, h: 0.8,
    fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 0
  });

  // Subtitle
  slide.addText("Based on site of implantation", {
    x: 0.3, y: 0.88, w: 9.4, h: 0.38,
    fontSize: 12, color: ACCENT3, italic: true
  });

  // Central uterus icon (text-art)
  const types = [
    { name: "Tubal", pct: "82%", color: ACCENT1, x: 0.35, y: 1.4 },
    { name: "Ovarian", pct: "~3%", color: ACCENT2, x: 0.35, y: 2.25 },
    { name: "Interstitial", pct: "2–3%", color: ACCENT3, x: 0.35, y: 3.1 },
    { name: "Cervical", pct: "<1%", color: "A78BFA", x: 5.1, y: 1.4 },
    { name: "Abdominal", pct: "1–1.4%", color: "34D399", x: 5.1, y: 2.25 },
    { name: "Caesarean Scar", pct: "~1%", color: GOLD, x: 5.1, y: 3.1 },
    { name: "Heterotopic", pct: "1:30,000", color: "F472B6", x: 2.65, y: 4.05 },
  ];

  types.forEach(t => {
    // colored pill
    slide.addShape(pres.ShapeType.roundRect, {
      x: t.x, y: t.y, w: 4.5, h: 0.68,
      fill: { color: t.color, transparency: 75 },
      line: { color: t.color, width: 1.2 },
      rectRadius: 0.1
    });
    // dot
    slide.addShape(pres.ShapeType.ellipse, {
      x: t.x + 0.12, y: t.y + 0.22, w: 0.24, h: 0.24,
      fill: { color: t.color }, line: { type: "none" }
    });
    slide.addText(t.name, {
      x: t.x + 0.45, y: t.y, w: 2.8, h: 0.68,
      fontSize: 14, bold: true, color: WHITE, valign: "middle", margin: 0
    });
    slide.addText(t.pct, {
      x: t.x + 3.2, y: t.y, w: 1.2, h: 0.68,
      fontSize: 13, bold: true, color: t.color, valign: "middle", align: "right", margin: 0
    });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 3 — TUBAL ECTOPIC
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);

  // Top bar
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 1.05, fill: { color: ACCENT1 }, line: { type: "none" }
  });
  slide.addText("01", {
    x: 0.15, y: 0.08, w: 0.7, h: 0.7,
    fontSize: 28, bold: true, color: "FFFFFF55", fontFace: "Calibri", valign: "middle", align: "center", margin: 0
  });
  slide.addText("Tubal Ectopic Pregnancy", {
    x: 0.9, y: 0.12, w: 7.5, h: 0.8,
    fontSize: 26, bold: true, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 0
  });
  slide.addText("Most Common Type  •  82% of all ectopic pregnancies", {
    x: 0.9, y: 0.7, w: 7.5, h: 0.32,
    fontSize: 10, color: "FFD7D9", italic: true, margin: 0
  });

  // Sub-types header
  slide.addText("Sub-sites within the Fallopian Tube", {
    x: 0.3, y: 1.18, w: 9.4, h: 0.4,
    fontSize: 13, bold: true, color: ACCENT3
  });

  const subtypes = [
    { name: "Ampullary", pct: "70%", desc: "Most common sub-site; slow distension before rupture" },
    { name: "Isthmic", pct: "12%", desc: "Narrower lumen; early rupture at 6–8 weeks" },
    { name: "Fimbrial", pct: "11%", desc: "May abort spontaneously into peritoneal cavity" },
    { name: "Interstitial", pct: "2–4%", desc: "Intramural segment; late rupture with catastrophic bleed" },
    { name: "Infundibular", pct: "~5%", desc: "At funnel-shaped opening of tube" },
  ];

  subtypes.forEach((s, i) => {
    const row = i < 3 ? 0 : 1;
    const col = i < 3 ? i : i - 3;
    const x = 0.3 + col * 3.3;
    const y = 1.65 + row * 1.55;
    const w = row === 1 && col > 1 ? 0 : 3.1;
    if (row === 1 && i === subtypes.length - 1) {
      // last card centered
    }
    card(slide, x, y, 3.1, 1.38, "1E2235");
    slide.addShape(pres.ShapeType.rect, {
      x, y, w: 0.06, h: 1.38, fill: { color: ACCENT1 }, line: { type: "none" }
    });
    slide.addText(s.name, { x: x + 0.14, y: y + 0.08, w: 2.6, h: 0.35, fontSize: 13, bold: true, color: WHITE, margin: 0 });
    slide.addShape(pres.ShapeType.roundRect, {
      x: x + 0.14, y: y + 0.44, w: 0.6, h: 0.25,
      fill: { color: ACCENT1 }, line: { type: "none" }, rectRadius: 0.05
    });
    slide.addText(s.pct, { x: x + 0.14, y: y + 0.44, w: 0.6, h: 0.25, fontSize: 9, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });
    slide.addText(s.desc, { x: x + 0.14, y: y + 0.75, w: 2.85, h: 0.55, fontSize: 9.5, color: LIGHT_TXT, margin: 0 });
  });

  // Risk factors
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 4.85, w: "100%", h: 0.78, fill: { color: "1E2235" }, line: { type: "none" }
  });
  slide.addText("Key Risk Factors: ", { x: 0.3, y: 4.88, w: 1.6, h: 0.34, fontSize: 10, bold: true, color: ACCENT2, margin: 0 });
  slide.addText("PID / salpingitis  •  Previous tubal surgery  •  IUD use  •  Tubal ligation  •  ART / IVF  •  Smoking", {
    x: 1.9, y: 4.88, w: 8.1, h: 0.34, fontSize: 10, color: LIGHT_TXT, margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 4 — INTERSTITIAL ECTOPIC
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);

  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 1.05, fill: { color: ACCENT3 }, line: { type: "none" }
  });
  slide.addText("02", { x: 0.15, y: 0.08, w: 0.7, h: 0.7, fontSize: 28, bold: true, color: "FFFFFF55", fontFace: "Calibri", valign: "middle", align: "center", margin: 0 });
  slide.addText("Interstitial Ectopic Pregnancy", { x: 0.9, y: 0.12, w: 8, h: 0.65, fontSize: 26, bold: true, color: "1A1D2E", fontFace: "Calibri", valign: "middle", margin: 0 });
  slide.addText("Also called: Cornual Ectopic", { x: 0.9, y: 0.72, w: 7, h: 0.28, fontSize: 10, color: "1E3A4C", italic: true, margin: 0 });

  // Facts cards
  const facts = [
    { icon: "📍", title: "Location", body: "Intramural portion of the fallopian tube, within the myometrium of the uterine cornu" },
    { icon: "⚠️", title: "Incidence", body: "2–4% of all ectopic pregnancies; accounts for disproportionate mortality" },
    { icon: "🩸", title: "Rupture Risk", body: "Ruptures later (8–16 wks) than other tubal types due to surrounding myometrium; catastrophic hemorrhage when it does rupture" },
    { icon: "🔍", title: "Diagnosis", body: "\"Interstitial line sign\" on US: echogenic line from endometrial cavity to gestational sac; <5 mm surrounding myometrium" },
    { icon: "💊", title: "Management", body: "Medical: Methotrexate (systemic ± local). Surgical: Cornual resection / laparoscopic interstitial salpingostomy" },
    { icon: "📊", title: "Prognosis", body: "Maternal mortality up to 2.5%; high risk of uterine rupture in subsequent pregnancies" },
  ];

  facts.forEach((f, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.3 + col * 3.25;
    const y = 1.2 + row * 1.95;
    card(slide, x, y, 3.05, 1.78);
    slide.addText(f.title, { x: x + 0.15, y: y + 0.1, w: 2.8, h: 0.38, fontSize: 13, bold: true, color: ACCENT3, margin: 0 });
    slide.addShape(pres.ShapeType.rect, { x: x + 0.15, y: y + 0.5, w: 2.7, h: 0.02, fill: { color: ACCENT3, transparency: 60 }, line: { type: "none" } });
    slide.addText(f.body, { x: x + 0.15, y: y + 0.58, w: 2.8, h: 1.12, fontSize: 10, color: LIGHT_TXT, margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 5 — OVARIAN ECTOPIC
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);

  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 1.05, fill: { color: ACCENT2 }, line: { type: "none" }
  });
  slide.addText("03", { x: 0.15, y: 0.08, w: 0.7, h: 0.7, fontSize: 28, bold: true, color: "FFFFFF55", fontFace: "Calibri", valign: "middle", align: "center", margin: 0 });
  slide.addText("Ovarian Ectopic Pregnancy", { x: 0.9, y: 0.12, w: 8, h: 0.65, fontSize: 26, bold: true, color: "1A1D2E", valign: "middle", margin: 0 });
  slide.addText("Most common non-tubal ectopic  •  Up to 3% of all ectopics", { x: 0.9, y: 0.72, w: 7, h: 0.28, fontSize: 10, color: "3A2500", italic: true, margin: 0 });

  // Left column - content
  card(slide, 0.3, 1.18, 5.8, 2.1, "1E2235");
  slide.addText("Spiegelberg Diagnostic Criteria (1878)", { x: 0.45, y: 1.25, w: 5.5, h: 0.42, fontSize: 13, bold: true, color: ACCENT2, margin: 0 });
  const criteria = [
    "Fallopian tube on affected side must be intact",
    "Fetal sac must occupy the position of the ovary",
    "Ovary must be connected to uterus by ovarian ligament",
    "Ovarian tissue must be located within the sac wall",
  ];
  criteria.forEach((c, i) => {
    slide.addShape(pres.ShapeType.ellipse, { x: 0.45, y: 1.75 + i * 0.33, w: 0.18, h: 0.18, fill: { color: ACCENT2 }, line: { type: "none" } });
    slide.addText(`${c}`, { x: 0.7, y: 1.68 + i * 0.33, w: 5.3, h: 0.32, fontSize: 10.5, color: LIGHT_TXT, margin: 0 });
  });

  // Right column
  card(slide, 6.3, 1.18, 3.4, 2.1, "1E2235");
  slide.addText("Key Points", { x: 6.45, y: 1.25, w: 3.1, h: 0.42, fontSize: 13, bold: true, color: ACCENT2, margin: 0 });
  const kp = [
    "NOT associated with PID or tubal disease",
    "Clinical picture: bleeding + pain + +ve pregnancy test",
    "Differential: corpus luteum cyst, hemorrhagic cyst",
    "Treatment: ovarian cystectomy / wedge resection",
    "Methotrexate used successfully in stable patients",
  ];
  kp.forEach((k, i) => {
    slide.addText(`• ${k}`, { x: 6.45, y: 1.72 + i * 0.28, w: 3.1, h: 0.27, fontSize: 9.5, color: LIGHT_TXT, margin: 0 });
  });

  // Bottom row - US and management
  card(slide, 0.3, 3.45, 9.4, 1.6, "1E2235");
  slide.addText("Ultrasound & Clinical Features", { x: 0.45, y: 3.52, w: 4.5, h: 0.38, fontSize: 12, bold: true, color: ACCENT2, margin: 0 });
  slide.addText("US findings: cystic ovarian mass — difficult to distinguish from corpus luteum cyst or hemorrhagic cyst. No specific sonographic sign. Confirmation often intraoperative. Free fluid in Pouch of Douglas may be present. β-hCG positive. Cardiac activity rarely seen. Diagnosis mostly made at laparoscopy or laparotomy.", {
    x: 0.45, y: 3.94, w: 9.1, h: 1.0,
    fontSize: 10, color: LIGHT_TXT, margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 6 — CERVICAL ECTOPIC
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);

  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 1.05, fill: { color: "A78BFA" }, line: { type: "none" }
  });
  slide.addText("04", { x: 0.15, y: 0.08, w: 0.7, h: 0.7, fontSize: 28, bold: true, color: "FFFFFF55", valign: "middle", align: "center", margin: 0 });
  slide.addText("Cervical Ectopic Pregnancy", { x: 0.9, y: 0.12, w: 8, h: 0.65, fontSize: 26, bold: true, color: "1A1D2E", valign: "middle", margin: 0 });
  slide.addText("< 1% of all ectopic pregnancies  •  High risk of profuse hemorrhage", { x: 0.9, y: 0.72, w: 7.5, h: 0.28, fontSize: 10, color: "1A1237", italic: true, margin: 0 });

  // US Criteria table
  slide.addText("Ultrasound Criteria for Cervical Pregnancy", { x: 0.3, y: 1.1, w: 9.4, h: 0.4, fontSize: 14, bold: true, color: "A78BFA", margin: 0 });

  const usCriteria = [
    "Gestational sac or placental tissue visualized within the cervix",
    "Cardiac motion noted below the level of the internal os",
    "No intrauterine pregnancy present",
    "Hourglass uterine shape with ballooned cervical canal",
    "No \"sliding sign\" with transvaginal probe pressure (sliding sign = abortion in progress)",
    "Closed internal os",
  ];

  usCriteria.forEach((c, i) => {
    const y = 1.58 + i * 0.43;
    slide.addShape(pres.ShapeType.roundRect, {
      x: 0.3, y, w: 9.4, h: 0.37,
      fill: { color: i % 2 === 0 ? "28243A" : "221E36" },
      line: { type: "none" }, rectRadius: 0.05
    });
    slide.addShape(pres.ShapeType.rect, { x: 0.3, y, w: 0.04, h: 0.37, fill: { color: "A78BFA" }, line: { type: "none" } });
    slide.addText(`${i + 1}.  ${c}`, { x: 0.45, y, w: 9.1, h: 0.37, fontSize: 10.5, color: LIGHT_TXT, valign: "middle", margin: 0 });
  });

  // Footer management box
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 4.75, w: "100%", h: 0.88, fill: { color: "28243A" }, line: { type: "none" } });
  slide.addText("Management:", { x: 0.3, y: 4.8, w: 1.6, h: 0.35, fontSize: 11, bold: true, color: "A78BFA", margin: 0 });
  slide.addText("Methotrexate (single/multi-dose) • KCl injection for viable pregnancies • UAE + hysteroscopic endocervical resection • D&C (risk of major hemorrhage — prepare for transfusion/hysterectomy)", {
    x: 1.9, y: 4.8, w: 8, h: 0.7, fontSize: 10, color: LIGHT_TXT, margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 7 — ABDOMINAL ECTOPIC
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);

  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 1.05, fill: { color: "34D399" }, line: { type: "none" }
  });
  slide.addText("05", { x: 0.15, y: 0.08, w: 0.7, h: 0.7, fontSize: 28, bold: true, color: "FFFFFF55", valign: "middle", align: "center", margin: 0 });
  slide.addText("Abdominal Ectopic Pregnancy", { x: 0.9, y: 0.12, w: 8, h: 0.65, fontSize: 26, bold: true, color: "0A2010", valign: "middle", margin: 0 });
  slide.addText("1–1.4% of ectopics  •  7–8× higher mortality than tubal ectopic  •  50× higher than IUP", { x: 0.9, y: 0.72, w: 8, h: 0.28, fontSize: 10, color: "0A3020", italic: true, margin: 0 });

  // Two columns
  // Primary vs Secondary
  card(slide, 0.3, 1.15, 4.6, 1.75, "1E2235");
  slide.addText("Primary Abdominal Pregnancy", { x: 0.45, y: 1.22, w: 4.3, h: 0.38, fontSize: 13, bold: true, color: "34D399", margin: 0 });
  slide.addText("Studdiford Criteria:", { x: 0.45, y: 1.62, w: 4.2, h: 0.28, fontSize: 10.5, bold: true, color: LIGHT_TXT, margin: 0 });
  ["Normal tubes and ovaries — no evidence of past/recent pregnancy", "No uteroplacental fistula", "Pregnancy relates exclusively to peritoneal surface — early enough to exclude secondary implantation"].forEach((s, i) => {
    slide.addText(`${i + 1}. ${s}`, { x: 0.45, y: 1.9 + i * 0.33, w: 4.3, h: 0.32, fontSize: 9.5, color: LIGHT_TXT, margin: 0 });
  });

  card(slide, 5.1, 1.15, 4.6, 1.75, "1E2235");
  slide.addText("Secondary Abdominal Pregnancy", { x: 5.25, y: 1.22, w: 4.3, h: 0.38, fontSize: 13, bold: true, color: "34D399", margin: 0 });
  slide.addText("More common. Results from:", { x: 5.25, y: 1.62, w: 4.2, h: 0.28, fontSize: 10.5, bold: true, color: LIGHT_TXT, margin: 0 });
  ["Tubal abortion or rupture with peritoneal reimplantation", "Uterine rupture (rare)"].forEach((s, i) => {
    slide.addText(`• ${s}`, { x: 5.25, y: 1.95 + i * 0.35, w: 4.3, h: 0.32, fontSize: 10, color: LIGHT_TXT, margin: 0 });
  });

  // Sites + risk factors
  card(slide, 0.3, 3.05, 4.6, 1.85, "1E2235");
  slide.addText("Common Implantation Sites", { x: 0.45, y: 3.12, w: 4.3, h: 0.38, fontSize: 12, bold: true, color: "34D399", margin: 0 });
  ["Posterior cul-de-sac (most common)", "Mesosalpinx, omentum, bowel", "Liver, spleen, abdominal wall", "Within broad ligament"].forEach((s, i) => {
    slide.addText(`• ${s}`, { x: 0.45, y: 3.54 + i * 0.32, w: 4.3, h: 0.3, fontSize: 10, color: LIGHT_TXT, margin: 0 });
  });

  card(slide, 5.1, 3.05, 4.6, 1.85, "1E2235");
  slide.addText("Clinical Notes", { x: 5.25, y: 3.12, w: 4.3, h: 0.38, fontSize: 12, bold: true, color: "34D399", margin: 0 });
  ["US detects only ~50% of cases", "Risk factors: PID, multiparity, endometriosis, ART, tubal damage", "MRI superior to US for diagnosis", "Treatment: Laparotomy; placenta management complex — risk of hemorrhage if removed early"].forEach((s, i) => {
    slide.addText(`• ${s}`, { x: 5.25, y: 3.54 + i * 0.33, w: 4.3, h: 0.31, fontSize: 9.5, color: LIGHT_TXT, margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 8 — CAESAREAN SCAR ECTOPIC
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);

  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 1.05, fill: { color: GOLD }, line: { type: "none" }
  });
  slide.addText("06", { x: 0.15, y: 0.08, w: 0.7, h: 0.7, fontSize: 28, bold: true, color: "FFFFFF55", valign: "middle", align: "center", margin: 0 });
  slide.addText("Caesarean Scar Ectopic Pregnancy", { x: 0.9, y: 0.12, w: 8, h: 0.65, fontSize: 26, bold: true, color: "1A1200", valign: "middle", margin: 0 });
  slide.addText("Rare but increasing with rising C-section rates  •  Risk of massive hemorrhage", { x: 0.9, y: 0.72, w: 7.5, h: 0.28, fontSize: 10, color: "3A2C00", italic: true, margin: 0 });

  const info = [
    { title: "Definition", body: "Implantation within the myometrium of a previous caesarean section scar, at the uterine isthmus. Can erode into bladder or rupture causing life-threatening hemorrhage." },
    { title: "Diagnosis (US)", body: "Empty uterine cavity + empty cervical canal. Gestational sac located in anterior isthmic region. Thin myometrium (<5 mm) between sac and bladder. Increased vascularity ('ring of fire') on Doppler." },
    { title: "Risk Factors", body: "Previous caesarean delivery (↑ risk with ↑ number of sections). Previous uterine surgery. IVF/IUI. Dilatation & curettage. Prior uterine instrumentation." },
    { title: "Treatment Options", body: "Methotrexate (systemic or local injection into sac). UAE (uterine artery embolization) prior to surgery. Hysteroscopic resection. Laparoscopic / open excision. Hysterectomy for uncontrolled hemorrhage." },
    { title: "Complications", body: "Placenta accreta spectrum. Uterine rupture. Massive hemorrhage. Bladder injury. Risk to future pregnancies — recommend planning subsequent delivery." },
    { title: "Why Increasing?", body: "Global rise in caesarean delivery rates. More women with uterine scars now conceiving. IVF population growth. Better diagnostic imaging detecting previously missed cases." },
  ];

  info.forEach((item, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.3 + col * 3.25;
    const y = 1.15 + row * 1.95;
    card(slide, x, y, 3.05, 1.78, "1E2235");
    slide.addShape(pres.ShapeType.rect, { x, y, w: 0.06, h: 1.78, fill: { color: GOLD }, line: { type: "none" } });
    slide.addText(item.title, { x: x + 0.15, y: y + 0.1, w: 2.8, h: 0.38, fontSize: 12, bold: true, color: GOLD, margin: 0 });
    slide.addText(item.body, { x: x + 0.15, y: y + 0.52, w: 2.85, h: 1.18, fontSize: 9.5, color: LIGHT_TXT, margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 9 — HETEROTOPIC PREGNANCY
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);

  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 1.05, fill: { color: "F472B6" }, line: { type: "none" }
  });
  slide.addText("07", { x: 0.15, y: 0.08, w: 0.7, h: 0.7, fontSize: 28, bold: true, color: "FFFFFF55", valign: "middle", align: "center", margin: 0 });
  slide.addText("Heterotopic Pregnancy", { x: 0.9, y: 0.12, w: 8, h: 0.65, fontSize: 26, bold: true, color: "1A0010", valign: "middle", margin: 0 });
  slide.addText("Simultaneous intrauterine AND ectopic pregnancy", { x: 0.9, y: 0.72, w: 8, h: 0.28, fontSize: 10, color: "3A0025", italic: true, margin: 0 });

  // Incidence highlight
  slide.addShape(pres.ShapeType.roundRect, {
    x: 0.3, y: 1.18, w: 9.4, h: 0.6,
    fill: { color: "3A1A2E" }, line: { color: "F472B6", width: 1 }, rectRadius: 0.1
  });
  slide.addText("Spontaneous incidence: 1 in 30,000 pregnancies     •     After ART / IVF: up to 1–3% (dramatically increased risk)", {
    x: 0.4, y: 1.18, w: 9.2, h: 0.6, fontSize: 12, bold: true, color: "F472B6", align: "center", valign: "middle", margin: 0
  });

  // Cards
  const hetCards = [
    { title: "Diagnosis Pitfall", body: "Identification of an intrauterine pregnancy does NOT exclude a co-existing ectopic in IVF/ART patients. Both pregnancies must be actively sought. β-hCG levels may be falsely reassuring." },
    { title: "Clinical Presentation", body: "Symptoms of ectopic (pelvic pain, adnexal mass, peritonism) PLUS a positive intrauterine pregnancy. Vital to suspect in any ART patient with abdominal pain and confirmed IUP." },
    { title: "Management", body: "Ectopic must be treated: surgical removal preferred. Methotrexate is CONTRAINDICATED as it will terminate the IUP. Laparoscopic salpingectomy/salpingotomy while preserving IUP." },
    { title: "Prognosis of IUP", body: "With prompt diagnosis and treatment of the ectopic component, the intrauterine pregnancy can be preserved and progress to term. Outcomes depend on gestational age at diagnosis." },
  ];

  hetCards.forEach((c, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.3 + col * 4.85;
    const y = 1.92 + row * 1.72;
    card(slide, x, y, 4.6, 1.58, "1E2235");
    slide.addShape(pres.ShapeType.rect, { x, y, w: 0.06, h: 1.58, fill: { color: "F472B6" }, line: { type: "none" } });
    slide.addText(c.title, { x: x + 0.15, y: y + 0.08, w: 4.35, h: 0.38, fontSize: 13, bold: true, color: "F472B6", margin: 0 });
    slide.addText(c.body, { x: x + 0.15, y: y + 0.5, w: 4.35, h: 1.0, fontSize: 10, color: LIGHT_TXT, margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 10 — CLINICAL FEATURES & DIAGNOSIS
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);
  accentBar(slide, ACCENT1);
  headerBand(slide, MID_BG);

  slide.addText("Clinical Features & Diagnosis", {
    x: 0.3, y: 0.12, w: 9.4, h: 0.8, fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 0
  });

  // Symptoms column
  card(slide, 0.3, 1.1, 4.55, 2.55, "1E2235");
  slide.addText("Symptoms", { x: 0.45, y: 1.17, w: 4.2, h: 0.38, fontSize: 14, bold: true, color: ACCENT1, margin: 0 });
  ["Abdominal/pelvic pain (most common)", "Amenorrhoea or missed period", "Vaginal bleeding (scant or heavy)", "Breast tenderness", "Dizziness, fainting, syncope", "Shoulder tip pain (diaphragmatic irritation)", "Rectal pressure or tenesmus", "Asymptomatic (incidental)"].forEach((s, i) => {
    slide.addText(`• ${s}`, { x: 0.45, y: 1.58 + i * 0.26, w: 4.3, h: 0.25, fontSize: 10, color: LIGHT_TXT, margin: 0 });
  });

  // Signs column
  card(slide, 5.1, 1.1, 4.55, 2.55, "1E2235");
  slide.addText("Signs", { x: 5.25, y: 1.17, w: 4.2, h: 0.38, fontSize: 14, bold: true, color: ACCENT2, margin: 0 });
  ["Adnexal tenderness or mass", "Cervical motion tenderness", "Peritoneal signs (guarding, rigidity)", "Pallor, abdominal distension", "Tachycardia + hypotension", "Orthostatic hypotension", "Shock or collapse (rupture)"].forEach((s, i) => {
    slide.addText(`• ${s}`, { x: 5.25, y: 1.58 + i * 0.26, w: 4.3, h: 0.25, fontSize: 10, color: LIGHT_TXT, margin: 0 });
  });

  // Diagnosis strip
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 3.75, w: 9.4, h: 0.38, fill: { color: CARD_BG }, line: { type: "none" } });
  slide.addText("Diagnostic Workup", { x: 0.45, y: 3.75, w: 9, h: 0.38, fontSize: 13, bold: true, color: ACCENT3, valign: "middle", margin: 0 });

  const diag = [
    { t: "β-hCG", b: "Positive urine test; serial serum levels guide management. Discriminatory zone: 2000 mIU/mL (no IUP visible on TVUS = high suspicion)" },
    { t: "Transvaginal US", b: "First-line imaging. Empty uterine cavity + adnexal mass ± tubal ring. 'Ring of fire' on Doppler. Adnexal mass separate from ovary (84% sensitive, 98% specific)" },
    { t: "MRI", b: "Reserved for diagnostic uncertainty or rare types (abdominal, heterotopic). Helps differentiate from other pelvic masses." },
  ];
  diag.forEach((d, i) => {
    card(slide, 0.3 + i * 3.25, 4.2, 3.1, 1.35, "1A1D2E");
    slide.addText(d.t, { x: 0.45 + i * 3.25, y: 4.26, w: 2.8, h: 0.35, fontSize: 11, bold: true, color: ACCENT3, margin: 0 });
    slide.addText(d.b, { x: 0.45 + i * 3.25, y: 4.64, w: 2.9, h: 0.85, fontSize: 9, color: LIGHT_TXT, margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 11 — MANAGEMENT OVERVIEW
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);
  accentBar(slide, ACCENT2);
  headerBand(slide, MID_BG);

  slide.addText("Management Overview", {
    x: 0.3, y: 0.12, w: 9.4, h: 0.8, fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 0
  });

  const mgmt = [
    {
      title: "Expectant Management",
      color: ACCENT3,
      criteria: "Declining β-hCG, clinically stable, no cardiac activity, small ectopic (<3.5 cm)",
      details: "Serial β-hCG measurements every 48h. TVU follow-up. Patient must be compliant and have easy access to emergency care. Success in 50–70% of selected cases."
    },
    {
      title: "Medical — Methotrexate",
      color: ACCENT2,
      criteria: "Hemodynamically stable, β-hCG <5000, no cardiac activity, unruptured ectopic <4 cm",
      details: "Folate antagonist. Single-dose (50 mg/m²) or multi-dose protocol. Contraindications: hepatic/renal disease, immunodeficiency, breastfeeding, peptic ulcer. Avoid NSAIDs during treatment."
    },
    {
      title: "Surgical",
      color: ACCENT1,
      criteria: "Hemodynamic instability, rupture, failed medical treatment, contraindications to MTX",
      details: "Salpingostomy (tube preserved) vs Salpingectomy (tube removed). Laparoscopic approach preferred. Open (laparotomy) for unstable/ruptured. Cornual resection for interstitial. Hysterectomy for scar ectopic with uncontrolled bleed."
    },
  ];

  mgmt.forEach((m, i) => {
    const y = 1.1 + i * 1.45;
    slide.addShape(pres.ShapeType.roundRect, {
      x: 0.3, y, w: 9.4, h: 1.32,
      fill: { color: "1E2235" }, line: { color: m.color, width: 1.2 }, rectRadius: 0.1
    });
    slide.addShape(pres.ShapeType.rect, { x: 0.3, y, w: 0.08, h: 1.32, fill: { color: m.color }, line: { type: "none" } });
    slide.addText(m.title, { x: 0.5, y: y + 0.08, w: 4, h: 0.38, fontSize: 14, bold: true, color: m.color, margin: 0 });
    slide.addText("Indications: ", { x: 0.5, y: y + 0.5, w: 1.3, h: 0.27, fontSize: 10, bold: true, color: WHITE, margin: 0 });
    slide.addText(m.criteria, { x: 1.7, y: y + 0.5, w: 8, h: 0.27, fontSize: 10, color: LIGHT_TXT, margin: 0 });
    slide.addText(m.details, { x: 0.5, y: y + 0.82, w: 9.1, h: 0.44, fontSize: 9.5, color: LIGHT_TXT, margin: 0 });
  });

  // Warning box
  slide.addShape(pres.ShapeType.roundRect, {
    x: 0.3, y: 5.0, w: 9.4, h: 0.52,
    fill: { color: "3A1212" }, line: { color: ACCENT1, width: 1 }, rectRadius: 0.08
  });
  slide.addText("⚠  Ruptured ectopic = SURGICAL EMERGENCY. Resuscitate with IV fluids / blood and proceed to theatre without delay.", {
    x: 0.45, y: 5.0, w: 9.1, h: 0.52, fontSize: 11, bold: true, color: ACCENT1, valign: "middle", margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 12 — COMPARISON TABLE
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);
  accentBar(slide, ACCENT3);
  headerBand(slide, MID_BG);

  slide.addText("Comparative Summary", {
    x: 0.3, y: 0.12, w: 9.4, h: 0.8, fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 0
  });

  // Table
  const headers = ["Type", "Incidence", "Rupture Timing", "Key Feature", "Treatment"];
  const rows = [
    ["Tubal (Ampullary)", "70% of tubal", "~8–12 wks", "Most common; slow distension", "Salpingectomy / MTX"],
    ["Interstitial", "2–4% of ectopics", "8–16 wks (late)", "Catastrophic hemorrhage; myometrium delays rupture", "MTX / cornual resection"],
    ["Ovarian", "~3%", "Variable", "Not linked to PID; Spiegelberg criteria", "Cystectomy / wedge resection"],
    ["Cervical", "<1%", "N/A (hemorrhage)", "Hourglass uterus; no sliding sign", "MTX / UAE + hysteroscopy"],
    ["Abdominal", "1–1.4%", "Late / rarely", "7–8× mortality > tubal; posterior cul-de-sac", "Laparotomy"],
    ["Caesarean Scar", "~1%", "Early / massive", "Anterior isthmus; ↑ with ↑ C-section rates", "MTX ± UAE / hysteroscopy"],
    ["Heterotopic", "1:30,000 (IVF 1–3%)", "Same as ectopic component", "IUP co-exists; MTX contraindicated", "Surgical (preserve IUP)"],
  ];

  const colW = [1.8, 1.35, 1.35, 2.9, 2.15];
  const colX = [0.25, 2.07, 3.44, 4.81, 7.73];
  const rowH = 0.46;
  const startY = 1.05;

  // Header row
  headers.forEach((h, ci) => {
    slide.addShape(pres.ShapeType.rect, {
      x: colX[ci], y: startY, w: colW[ci], h: rowH,
      fill: { color: ACCENT3 }, line: { type: "none" }
    });
    slide.addText(h, {
      x: colX[ci] + 0.06, y: startY, w: colW[ci] - 0.08, h: rowH,
      fontSize: 10, bold: true, color: "0A1A25", valign: "middle", margin: 0
    });
  });

  rows.forEach((row, ri) => {
    const y = startY + rowH + ri * rowH;
    const bg = ri % 2 === 0 ? "1E2235" : "22273A";
    row.forEach((cell, ci) => {
      slide.addShape(pres.ShapeType.rect, {
        x: colX[ci], y, w: colW[ci], h: rowH,
        fill: { color: bg }, line: { type: "none" }
      });
      slide.addText(cell, {
        x: colX[ci] + 0.06, y, w: colW[ci] - 0.08, h: rowH,
        fontSize: 8.5, color: ci === 0 ? ACCENT2 : LIGHT_TXT, valign: "middle", margin: 0
      });
    });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 13 — CLOSING SUMMARY
// ═══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  darkBg(slide);

  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 0.08, fill: { color: ACCENT1 }, line: { type: "none" }
  });

  // Decorative circle
  slide.addShape(pres.ShapeType.ellipse, {
    x: 7.2, y: 1.0, w: 4, h: 4,
    fill: { color: CARD_BG, transparency: 50 },
    line: { color: ACCENT1, width: 1 }
  });

  slide.addText("Key Takeaways", {
    x: 0.5, y: 0.5, w: 6, h: 0.65, fontSize: 32, bold: true, color: WHITE, fontFace: "Calibri"
  });
  slide.addShape(pres.ShapeType.rect, {
    x: 0.5, y: 1.22, w: 4, h: 0.05, fill: { color: ACCENT1 }, line: { type: "none" }
  });

  const takeaways = [
    { num: "01", text: "Tubal (ampullary) is the most common site (82%). Always the first consideration." },
    { num: "02", text: "Interstitial ectopics present LATE and rupture catastrophically — high index of suspicion." },
    { num: "03", text: "β-hCG + TVUS is the cornerstone of diagnosis. Discriminatory zone: 2000 mIU/mL." },
    { num: "04", text: "In IVF patients, an IUP does NOT exclude a co-existing ectopic (heterotopic)." },
    { num: "05", text: "Caesarean scar ectopics are rising. MTX + UAE are frontline non-surgical options." },
    { num: "06", text: "Ruptured ectopic = emergency laparoscopy/laparotomy. Do NOT delay for methotrexate." },
  ];

  takeaways.forEach((t, i) => {
    const y = 1.4 + i * 0.66;
    slide.addText(t.num, {
      x: 0.5, y, w: 0.5, h: 0.52, fontSize: 13, bold: true, color: ACCENT1, valign: "middle", margin: 0
    });
    slide.addText(t.text, {
      x: 1.1, y, w: 6.2, h: 0.52, fontSize: 12, color: LIGHT_TXT, valign: "middle", margin: 0
    });
    if (i < takeaways.length - 1) {
      slide.addShape(pres.ShapeType.rect, {
        x: 0.5, y: y + 0.55, w: 6.8, h: 0.01, fill: { color: CARD_BG }, line: { type: "none" }
      });
    }
  });

  // Footer
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 5.32, w: "100%", h: 0.3, fill: { color: CARD_BG }, line: { type: "none" }
  });
  slide.addText("Sources: Bailey & Love's Surgery 28e  •  Berek & Novak's Gynecology  •  Tintinalli's Emergency Medicine  •  Grainger & Allison's Diagnostic Radiology  •  Robbins & Kumar Basic Pathology", {
    x: 0.2, y: 5.32, w: 9.6, h: 0.3, fontSize: 7, color: "556070", align: "center", valign: "middle", margin: 0
  });
}

// ─── Save ────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/ectopic-pregnancy-pptx/Ectopic_Pregnancy_Types.pptx" })
  .then(() => console.log("DONE: Ectopic_Pregnancy_Types.pptx saved"))
  .catch(err => { console.error("ERROR:", err); process.exit(1); });
Running Command

cd /home/daytona/workspace/ectopic-pregnancy-pptx && node create_pptx.js 2>&1

Running Command

sed -i 's/"FFFFFF55"/"334455"/g' /home/daytona/workspace/ectopic-pregnancy-pptx/create_pptx.js && cd /home/daytona/workspace/ectopic-pregnancy-pptx && node create_pptx.js 2>&1

Editing File

~/ectopic-pregnancy-pptx/create_pptx.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-pptx/create_pptx.js'
Searching Content

"FFFFFF55" in ~/ectopic-pregnancy-pptx

Running Command

python3 -c " with open('/home/daytona/workspace/ectopic-pregnancy-pptx/create_pptx.js', 'r') as f: content = f.read() content = content.replace('\"FFFFFF55\"', '\"334455\"') with open('/home/daytona/workspace/ectopic-pregnancy-pptx/create_pptx.js', 'w') as f: f.write(content) print('Done') "

Running Command

cd /home/daytona/workspace/ectopic-pregnancy-pptx && node create_pptx.js 2>&1

Running Command

ls -lh /home/daytona/workspace/ectopic-pregnancy-pptx/Ectopic_Pregnancy_Types.pptx

Your presentation is ready:

Ectopic Pregnancy Types

Presentation · PPTX


13 slides with a dark navy/medical theme. Here's what's covered:
SlideContent
1Title slide with incidence stats
2Classification overview - all 7 types with frequencies
3Tubal ectopic - 5 sub-sites (ampullary, isthmic, fimbrial, interstitial, infundibular) with risk factors
4Interstitial ectopic - 6 detail cards (location, rupture risk, diagnosis, management)
5Ovarian ectopic - Spiegelberg criteria + US features + management
6Cervical ectopic - US criteria table + management options
7Abdominal ectopic - primary vs secondary, Studdiford criteria, implantation sites
8Caesarean scar ectopic - definition, US diagnosis, rising incidence, treatment
9Heterotopic pregnancy - ART risk, the MTX contraindication, surgical approach
10Clinical features & diagnosis (symptoms, signs, β-hCG, TVUS, MRI)
11Management overview - expectant / methotrexate / surgical with indications
12Comparative summary table across all 7 types
13Key takeaways + source citations
Content sourced from Bailey & Love's Surgery, Berek & Novak's Gynecology, Tintinalli's Emergency Medicine, Grainger & Allison's Diagnostic Radiology, and Robbins & Kumar Pathology.
This is a shared conversation. Sign in to Orris to start your own chat.