Generate a ppt for Ectopic pregnency

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

ls /home/daytona/workspace/ 2>/dev/null && mkdir -p /home/daytona/workspace/ecto…

Writing File

~/ectopic-pregnancy-ppt/generate.js

const pptxgen = require("pptxgenjs");

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

// ─── PALETTE ─────────────────────────────────────────────────────────────────
const C = {
  navy:     "0D2B55",  // dominant dark
  teal:     "1A7A8A",  // supporting mid
  amber:    "E8923A",  // sharp accent
  cream:    "F5F0E8",  // light bg
  white:    "FFFFFF",
  lightGray:"EDF2F4",
  text:     "1C1C2E",
  subtext:  "4A5568",
};

// ─── HELPERS ─────────────────────────────────────────────────────────────────
function addSlideHeader(slide, title, subtitle) {
  // Left accent bar
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.08, h: 5.625, fill: { color: C.amber } });
  // Header band
  slide.addShape(pres.ShapeType.rect, { x: 0.08, y: 0, w: 9.92, h: 1.0, fill: { color: C.navy } });
  // Title
  slide.addText(title, {
    x: 0.35, y: 0.1, w: 9.3, h: 0.75,
    fontSize: 24, bold: true, color: C.white,
    fontFace: "Calibri", valign: "middle", margin: 0,
  });
  if (subtitle) {
    slide.addText(subtitle, {
      x: 0.35, y: 0.85, w: 9.3, h: 0.3,
      fontSize: 11, color: C.amber, fontFace: "Calibri",
      italic: true, margin: 0,
    });
  }
  // Slide background
  slide.background = { color: C.lightGray };
}

function addBullets(slide, items, x, y, w, h, opts = {}) {
  const textArr = items.map((item, i) => ({
    text: item,
    options: {
      bullet: { type: "bullet", indent: 15 },
      fontSize: opts.fontSize || 14,
      color: opts.color || C.text,
      fontFace: "Calibri",
      breakLine: i < items.length - 1,
      paraSpaceAfter: 4,
    },
  }));
  slide.addText(textArr, { x, y, w, h, valign: "top" });
}

function addCard(slide, x, y, w, h, title, titleColor, bgColor) {
  slide.addShape(pres.ShapeType.rect, {
    x, y, w, h,
    fill: { color: bgColor || C.navy },
    line: { color: C.amber, width: 1.5 },
    shadow: { type: "outer", blur: 6, offset: 2, angle: 45, color: "000000", opacity: 0.15 },
  });
  if (title) {
    slide.addText(title, {
      x: x + 0.1, y, w: w - 0.2, h: 0.45,
      fontSize: 13, bold: true, color: titleColor || C.white,
      fontFace: "Calibri", align: "center", valign: "middle", margin: 0,
    });
  }
}

// ─── SLIDE 1: TITLE ───────────────────────────────────────────────────────────
{
  const slide = pres.addSlide();
  slide.background = { color: C.navy };

  // Decorative circles
  slide.addShape(pres.ShapeType.ellipse, { x: 7.5, y: -0.8, w: 4.5, h: 4.5, fill: { color: "1A3A6A" }, line: { color: "1A3A6A" } });
  slide.addShape(pres.ShapeType.ellipse, { x: -1.2, y: 3.2, w: 3.5, h: 3.5, fill: { color: "0A1E3D" }, line: { color: "0A1E3D" } });
  // Amber accent line
  slide.addShape(pres.ShapeType.rect, { x: 1.2, y: 2.45, w: 5.5, h: 0.06, fill: { color: C.amber }, line: { color: C.amber } });

  slide.addText("ECTOPIC PREGNANCY", {
    x: 1.0, y: 1.1, w: 8.0, h: 1.1,
    fontSize: 44, bold: true, color: C.white, fontFace: "Calibri",
    align: "center", charSpacing: 4,
  });
  slide.addText("A Clinical Overview", {
    x: 1.0, y: 2.55, w: 8.0, h: 0.55,
    fontSize: 20, color: C.amber, fontFace: "Calibri",
    align: "center", italic: true,
  });
  slide.addText("Definition · Epidemiology · Pathophysiology · Diagnosis · Management", {
    x: 1.0, y: 3.3, w: 8.0, h: 0.5,
    fontSize: 12, color: "A0B8D0", fontFace: "Calibri", align: "center",
  });
  slide.addText("Sources: Berek & Novak's Gynecology | Robbins Basic Pathology | Roberts & Hedges' Clinical Procedures", {
    x: 0.5, y: 5.1, w: 9.0, h: 0.35,
    fontSize: 9, color: "6080A0", fontFace: "Calibri", align: "center",
  });
}

// ─── SLIDE 2: DEFINITION & OVERVIEW ──────────────────────────────────────────
{
  const slide = pres.addSlide();
  addSlideHeader(slide, "Definition & Overview", "What is Ectopic Pregnancy?");

  // Definition box
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.15, w: 9.4, h: 1.05, fill: { color: C.teal }, line: { color: C.teal } });
  slide.addText("Implantation of the fertilized ovum outside the uterine corpus — the most common obstetric cause of maternal death in the first trimester.", {
    x: 0.5, y: 1.18, w: 9.0, h: 0.95,
    fontSize: 14.5, color: C.white, fontFace: "Calibri", bold: false, valign: "middle",
  });

  // 3 stat cards
  const cards = [
    { label: "Incidence", val: "0.64% – 2.0%\nof all pregnancies", bg: C.navy },
    { label: "Most Common Site", val: "Fallopian Tube\n(~95% of cases)", bg: "1A5E72" },
    { label: "Mortality Risk", val: "Leading cause of\nmaternal death in T1", bg: "7A3210" },
  ];
  cards.forEach((c, i) => {
    const x = 0.3 + i * 3.15;
    slide.addShape(pres.ShapeType.rect, {
      x, y: 2.45, w: 3.0, h: 1.55,
      fill: { color: c.bg }, line: { color: C.amber, width: 1.5 },
    });
    slide.addText(c.label, { x: x + 0.05, y: 2.48, w: 2.9, h: 0.42, fontSize: 12, bold: true, color: C.amber, fontFace: "Calibri", align: "center", valign: "middle" });
    slide.addText(c.val, { x: x + 0.05, y: 2.9, w: 2.9, h: 1.0, fontSize: 13, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
  });

  // Bullet points
  addBullets(slide, [
    "~1% of all pregnancies implant ectopically",
    "50% of patients receive evaluation ≥2 times before correct diagnosis",
    "A normal menstrual history is reported in ~50% of affected patients",
    "Urine pregnancy test may occasionally be negative",
  ], 0.3, 4.1, 9.4, 1.3, { fontSize: 12.5, color: C.text });
}

// ─── SLIDE 3: SITES OF IMPLANTATION ──────────────────────────────────────────
{
  const slide = pres.addSlide();
  addSlideHeader(slide, "Sites of Ectopic Implantation", "Where does it occur?");
  slide.background = { color: C.lightGray };

  const sites = [
    { name: "Ampullary", pct: "70%", desc: "Most common tubal site", color: C.amber },
    { name: "Isthmic", pct: "12%", desc: "Narrow tubal segment", color: C.teal },
    { name: "Fimbrial", pct: "11%", desc: "Distal end of tube", color: "2E7D32" },
    { name: "Interstitial", pct: "2-4%", desc: "Cornual / most dangerous", color: "B71C1C" },
    { name: "Ovarian", pct: "0.5-1%", desc: "Ovarian implantation", color: "4527A0" },
    { name: "Cervical", pct: "<1%", desc: "Rare; heavy bleeding risk", color: "00695C" },
    { name: "Abdominal", pct: "<1%", desc: "Peritoneal; rare", color: "4E342E" },
    { name: "Caesarean Scar", pct: "Rare", desc: "Increasingly recognized", color: "546E7A" },
  ];

  sites.forEach((s, i) => {
    const col = i % 4;
    const row = Math.floor(i / 4);
    const x = 0.25 + col * 2.38;
    const y = 1.2 + row * 1.85;
    slide.addShape(pres.ShapeType.rect, { x, y, w: 2.2, h: 1.65, fill: { color: s.color }, line: { color: C.white, width: 1 } });
    slide.addText(s.pct, { x, y: y + 0.08, w: 2.2, h: 0.55, fontSize: 22, bold: true, color: C.white, fontFace: "Calibri", align: "center" });
    slide.addText(s.name, { x, y: y + 0.6, w: 2.2, h: 0.4, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center" });
    slide.addText(s.desc, { x, y: y + 1.02, w: 2.2, h: 0.52, fontSize: 10, color: "E0E0E0", fontFace: "Calibri", align: "center", valign: "middle" });
  });
}

// ─── SLIDE 4: RISK FACTORS ────────────────────────────────────────────────────
{
  const slide = pres.addSlide();
  addSlideHeader(slide, "Risk Factors", "Predisposing conditions");

  const leftFactors = [
    "Previous ectopic pregnancy (strongest predictor)",
    "Prior pelvic inflammatory disease (PID) / salpingitis",
    "Tubal surgery or ligation",
    "Intrauterine contraceptive device (IUD) use",
    "Assisted reproductive technologies (ART/IVF)",
  ];
  const rightFactors = [
    "Previous pelvic or abdominal surgery",
    "Endometriosis",
    "Smoking — increases risk 1.5–4×",
    "Multiple sexual partners",
    "Age > 35 years",
  ];

  // Column headers
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.1, w: 4.45, h: 0.42, fill: { color: C.teal }, line: { color: C.teal } });
  slide.addText("High-Risk Factors", { x: 0.3, y: 1.1, w: 4.45, h: 0.42, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });

  slide.addShape(pres.ShapeType.rect, { x: 5.25, y: 1.1, w: 4.45, h: 0.42, fill: { color: C.navy }, line: { color: C.navy } });
  slide.addText("Additional Risk Factors", { x: 5.25, y: 1.1, w: 4.45, h: 0.42, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });

  addBullets(slide, leftFactors, 0.3, 1.6, 4.45, 3.6, { fontSize: 13 });
  addBullets(slide, rightFactors, 5.25, 1.6, 4.45, 3.6, { fontSize: 13 });

  // Note at bottom
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 5.05, w: 9.4, h: 0.38, fill: { color: "FFF3CD" }, line: { color: C.amber } });
  slide.addText("Note: No combination of signs, symptoms, or historical data alone is diagnostic of ectopic pregnancy.", {
    x: 0.4, y: 5.07, w: 9.2, h: 0.34,
    fontSize: 11, color: "5D4037", fontFace: "Calibri", italic: true, valign: "middle",
  });
}

// ─── SLIDE 5: CLINICAL FEATURES ───────────────────────────────────────────────
{
  const slide = pres.addSlide();
  addSlideHeader(slide, "Clinical Features", "Symptoms & Signs");

  // Classic triad box
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.1, w: 9.4, h: 0.55, fill: { color: C.amber }, line: { color: C.amber } });
  slide.addText("Classic Triad:  Amenorrhea  ·  Pelvic/Abdominal Pain  ·  Vaginal Bleeding", {
    x: 0.4, y: 1.12, w: 9.2, h: 0.48,
    fontSize: 15, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0,
  });

  const symps = [
    { title: "Pain", items: ["Pelvic / lower abdominal pain", "Isolated rectal or back pain", "Shoulder pain (diaphragm irritation)", "Peritoneal signs (variable)"] },
    { title: "Bleeding", items: ["Abnormal vaginal bleeding", "Amenorrhea (history)", "Uterine decidual cast (pathognomonic)", "Anemia signs on exam"] },
    { title: "Haemodynamic", items: ["Vascular collapse / shock", "Syncope / presyncope", "Tachycardia (not universal)", "Bradycardia — can occur with hemoperitoneum"] },
  ];

  symps.forEach((s, i) => {
    const x = 0.3 + i * 3.15;
    slide.addShape(pres.ShapeType.rect, { x, y: 1.75, w: 3.0, h: 0.4, fill: { color: C.navy }, line: { color: C.navy } });
    slide.addText(s.title, { x, y: 1.75, w: 3.0, h: 0.4, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });
    addBullets(slide, s.items, x, 2.2, 3.0, 2.2, { fontSize: 12 });
  });

  slide.addText("⚠  Blood in peritoneal cavity does NOT consistently correlate with peritoneal irritation, blood pressure, or pulse rate.", {
    x: 0.3, y: 4.6, w: 9.4, h: 0.7,
    fontSize: 12, color: "8B0000", fontFace: "Calibri", italic: true, bold: true,
  });
}

// ─── SLIDE 6: DIAGNOSIS ───────────────────────────────────────────────────────
{
  const slide = pres.addSlide();
  addSlideHeader(slide, "Diagnosis", "Investigations & Approach");

  // Urine hCG
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.1, w: 4.55, h: 0.4, fill: { color: C.teal }, line: { color: C.teal } });
  slide.addText("Urine β-hCG", { x: 0.3, y: 1.1, w: 4.55, h: 0.4, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });
  addBullets(slide, [
    "Sensitive at ≥20 mIU/mL",
    "Positive 98% of the time in first weeks of pregnancy",
    "A negative result rules out pregnancy in >98% of cases",
    "May be falsely negative in ectopic (low hCG production)",
  ], 0.3, 1.55, 4.55, 1.8, { fontSize: 12.5 });

  // Serum hCG
  slide.addShape(pres.ShapeType.rect, { x: 5.15, y: 1.1, w: 4.55, h: 0.4, fill: { color: C.navy }, line: { color: C.navy } });
  slide.addText("Serum β-hCG (Quantitative)", { x: 5.15, y: 1.1, w: 4.55, h: 0.4, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });
  addBullets(slide, [
    "Sensitive to 5 mIU/mL",
    "Normal: doubles ~every 2 days in first trimester",
    "Discriminatory zone: IUP detectable at ~1200–1500 mIU/mL (TVUS) or >6000 mIU/mL (TAUS)",
    "Subnormal rise + empty uterus = high suspicion",
  ], 5.15, 1.55, 4.55, 1.8, { fontSize: 12.5 });

  // Ultrasound
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 3.45, w: 9.4, h: 0.4, fill: { color: "2E7D32" }, line: { color: "2E7D32" } });
  slide.addText("Transvaginal Ultrasound (TVUS) — Primary Imaging Modality", { x: 0.3, y: 3.45, w: 9.4, h: 0.4, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });
  addBullets(slide, [
    "Empty uterus + positive β-hCG strongly suggests ectopic pregnancy",
    "Fetal pole detectable at ~6 weeks; cardiac activity at ~7 weeks by TVUS",
    "Free fluid in POD raises concern for rupture",
    "3D US: aids evaluation of adnexae and interstitial ectopics",
    "A heartbeat in an extrauterine location may be mistaken for intrauterine — careful evaluation required",
  ], 0.3, 3.93, 9.4, 1.5, { fontSize: 12.5 });
}

// ─── SLIDE 7: DIFFERENTIAL DIAGNOSIS ─────────────────────────────────────────
{
  const slide = pres.addSlide();
  addSlideHeader(slide, "Differential Diagnosis", "Conditions to exclude");

  const diffs = [
    { name: "Threatened / Incomplete Abortion", points: "Bleeding + IUP on US; declining β-hCG" },
    { name: "Ruptured Ovarian Cyst", points: "No raised β-hCG; US shows cyst debris/fluid" },
    { name: "Corpus Luteum Cyst", points: "Adnexal mass; no gestational sac identified" },
    { name: "Appendicitis", points: "RIF pain; tenderness + fever; no β-hCG rise" },
    { name: "PID / Salpingitis", points: "Bilateral tenderness; cervical excitation; no pregnancy" },
    { name: "Ovarian Torsion", points: "Sudden severe pain; absent Doppler flow to ovary" },
    { name: "Heterotopic Pregnancy", points: "Rare — concurrent IUP and ectopic; ART increases risk" },
    { name: "Intrauterine Pregnancy", points: "Confirm IUP on TVUS before excluding ectopic" },
  ];

  diffs.forEach((d, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.3 + col * 4.8;
    const y = 1.1 + row * 1.1;
    slide.addShape(pres.ShapeType.rect, { x, y, w: 4.6, h: 1.0, fill: { color: col === 0 ? "EBF4F8" : "FFF8F0" }, line: { color: col === 0 ? C.teal : C.amber, width: 1.2 } });
    slide.addText(d.name, { x: x + 0.1, y, w: 4.4, h: 0.38, fontSize: 12.5, bold: true, color: C.navy, fontFace: "Calibri", valign: "middle", margin: 0 });
    slide.addText(d.points, { x: x + 0.1, y: y + 0.38, w: 4.4, h: 0.58, fontSize: 11, color: C.subtext, fontFace: "Calibri", valign: "top", margin: 0 });
  });
}

// ─── SLIDE 8: MANAGEMENT OVERVIEW ─────────────────────────────────────────────
{
  const slide = pres.addSlide();
  addSlideHeader(slide, "Management Overview", "Expectant · Medical · Surgical");

  // 3 management pathways
  const paths = [
    {
      title: "Expectant Management",
      bg: "1A5E72",
      items: [
        "For haemodynamically stable patients",
        "Declining β-hCG levels (<1000 mIU/mL)",
        "No evidence of rupture on imaging",
        "Close serial β-hCG monitoring required",
        "Not appropriate for interstitial or cornual ectopics",
      ],
    },
    {
      title: "Medical — Methotrexate",
      bg: C.navy,
      items: [
        "Folate antagonist — inhibits DHFR",
        "~35% of ectopic patients are eligible",
        "Requires: haemodynamic stability, no rupture",
        "Gestational sac <4 cm, no cardiac activity",
        "Pre-treatment: CBC, LFTs, renal function, CXR",
      ],
    },
    {
      title: "Surgical Treatment",
      bg: "7A3210",
      items: [
        "Most widely used treatment approach",
        "Laparoscopy preferred over laparotomy",
        "Salpingectomy vs. salpingostomy (individualised)",
        "Laparotomy reserved for haemodynamic instability",
        "Mini-laparotomy: cost-effective alternative",
      ],
    },
  ];

  paths.forEach((p, i) => {
    const x = 0.3 + i * 3.15;
    slide.addShape(pres.ShapeType.rect, { x, y: 1.1, w: 3.0, h: 0.45, fill: { color: p.bg }, line: { color: C.amber, width: 1.5 } });
    slide.addText(p.title, { x, y: 1.1, w: 3.0, h: 0.45, fontSize: 12.5, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });
    slide.addShape(pres.ShapeType.rect, { x, y: 1.55, w: 3.0, h: 3.8, fill: { color: "F0F4F8" }, line: { color: p.bg, width: 1 } });
    addBullets(slide, p.items, x + 0.05, 1.6, 2.9, 3.7, { fontSize: 12, color: C.text });
  });
}

// ─── SLIDE 9: METHOTREXATE IN DETAIL ──────────────────────────────────────────
{
  const slide = pres.addSlide();
  addSlideHeader(slide, "Medical Management: Methotrexate", "Mechanism, Eligibility & Protocols");

  // Mechanism
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.1, w: 9.4, h: 0.4, fill: { color: C.teal }, line: { color: C.teal } });
  slide.addText("Mechanism of Action", { x: 0.3, y: 1.1, w: 9.4, h: 0.4, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });
  slide.addText("Folic acid analogue → inhibits dihydrofolate reductase (DHFR) → prevents DNA synthesis → trophoblast cell death", {
    x: 0.4, y: 1.55, w: 9.2, h: 0.45, fontSize: 13, color: C.text, fontFace: "Calibri", italic: false,
  });

  // Absolute contraindications
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 2.1, w: 4.55, h: 0.4, fill: { color: "B71C1C" }, line: { color: "B71C1C" } });
  slide.addText("Absolute Contraindications", { x: 0.3, y: 2.1, w: 4.55, h: 0.4, fontSize: 12.5, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });
  addBullets(slide, [
    "Intrauterine pregnancy",
    "Breastfeeding",
    "Hepatic / renal / hematologic disorders",
    "Known sensitivity to methotrexate",
    "Active pulmonary disease",
  ], 0.3, 2.55, 4.55, 2.2, { fontSize: 12 });

  // Relative contraindications
  slide.addShape(pres.ShapeType.rect, { x: 5.15, y: 2.1, w: 4.55, h: 0.4, fill: { color: C.amber }, line: { color: C.amber } });
  slide.addText("Relative Contraindications", { x: 5.15, y: 2.1, w: 4.55, h: 0.4, fontSize: 12.5, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });
  addBullets(slide, [
    "Gestational sac > 4 cm",
    "Embryonic cardiac activity on TVUS",
    "Elevated baseline β-hCG",
    "Patient unable to comply with follow-up",
  ], 5.15, 2.55, 4.55, 2.2, { fontSize: 12 });

  // Pre-treatment workup
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 4.8, w: 9.4, h: 0.4, fill: { color: C.navy }, line: { color: C.navy } });
  slide.addText("Pre-Treatment Workup: CBC · Blood Group · LFTs · Renal function (creatinine) · CXR (if pulmonary hx)", {
    x: 0.35, y: 4.82, w: 9.3, h: 0.36, fontSize: 11.5, color: C.white, fontFace: "Calibri", valign: "middle", margin: 0,
  });
}

// ─── SLIDE 10: SURGICAL MANAGEMENT ────────────────────────────────────────────
{
  const slide = pres.addSlide();
  addSlideHeader(slide, "Surgical Management", "Laparoscopy vs Laparotomy · Salpingectomy vs Salpingostomy");

  // Laparoscopy vs Laparotomy
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.1, w: 4.55, h: 0.42, fill: { color: "1B5E20" }, line: { color: "1B5E20" } });
  slide.addText("Laparoscopy (Preferred)", { x: 0.3, y: 1.1, w: 4.55, h: 0.42, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });
  addBullets(slide, [
    "Shorter hospital stay (1.3 vs 3.0 days)",
    "Reduced operative time",
    "Less blood loss & faster convalescence",
    "Lower adhesion formation",
    "Significant cost savings vs laparotomy",
  ], 0.3, 1.58, 4.55, 2.0, { fontSize: 12 });

  slide.addShape(pres.ShapeType.rect, { x: 5.15, y: 1.1, w: 4.55, h: 0.42, fill: { color: "7A3210" }, line: { color: "7A3210" } });
  slide.addText("Laparotomy (Indicated When...)", { x: 5.15, y: 1.1, w: 4.55, h: 0.42, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });
  addBullets(slide, [
    "Haemodynamic instability requiring rapid access",
    "Extensive adhesive disease",
    "Abdominal pregnancy",
    "Laparoscopic equipment/expertise unavailable",
    "Unable to evacuate haemoperitoneum laparoscopically",
  ], 5.15, 1.58, 4.55, 2.0, { fontSize: 12 });

  // Salpingectomy vs Salpingostomy
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 3.65, w: 9.4, h: 0.42, fill: { color: C.navy }, line: { color: C.navy } });
  slide.addText("Salpingectomy vs. Salpingostomy — Key Evidence", { x: 0.3, y: 3.65, w: 9.4, h: 0.42, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });
  addBullets(slide, [
    "No overall difference in future intrauterine pregnancy rates in RCTs",
    "Salpingostomy: higher repeat ectopic risk (10% vs 4% with salpingectomy; OR 2.27)",
    "Salpingostomy: slightly higher intrauterine pregnancy rate (RR 1.24)",
    "With tubal damage: pregnancy rate 42% vs 79% without damage — key prognostic factor",
  ], 0.3, 4.12, 9.4, 1.35, { fontSize: 12.5 });
}

// ─── SLIDE 11: COMPLICATIONS ──────────────────────────────────────────────────
{
  const slide = pres.addSlide();
  addSlideHeader(slide, "Complications", "If ruptured or untreated");

  const comps = [
    { icon: "💉", title: "Haemorrhage", desc: "Intraperitoneal bleeding leading to hypovolemic shock; life-threatening if unrecognised" },
    { icon: "💔", title: "Rupture", desc: "Tubal rupture is a surgical emergency; interstitial ectopics rupture later but with more blood loss" },
    { icon: "⚰", title: "Maternal Death", desc: "Leading obstetric cause of maternal death in first trimester; exsanguination if untreated" },
    { icon: "🔄", title: "Repeat Ectopic", desc: "10% risk after salpingostomy; prior ectopic is the strongest future risk factor" },
    { icon: "🏥", title: "Infertility", desc: "Tubal damage impairs future fertility; pregnancy rate drops from 79% to 42% with tubal damage" },
    { icon: "⚕", title: "Persistent Trophoblast", desc: "After salpingostomy; requires surveillance β-hCG or methotrexate treatment" },
  ];

  comps.forEach((c, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.3 + col * 3.15;
    const y = 1.15 + row * 2.05;
    slide.addShape(pres.ShapeType.rect, { x, y, w: 3.0, h: 1.9, fill: { color: row === 0 ? "FFF3F3" : "F0F4FF" }, line: { color: row === 0 ? "B71C1C" : C.navy, width: 1.2 } });
    slide.addText(c.icon + "  " + c.title, { x: x + 0.08, y, w: 2.85, h: 0.48, fontSize: 13.5, bold: true, color: row === 0 ? "B71C1C" : C.navy, fontFace: "Calibri", valign: "middle", margin: 0 });
    slide.addText(c.desc, { x: x + 0.08, y: y + 0.5, w: 2.85, h: 1.35, fontSize: 11.5, color: C.subtext, fontFace: "Calibri", valign: "top", wrap: true, margin: 0 });
  });
}

// ─── SLIDE 12: PROGNOSIS & FOLLOW-UP ──────────────────────────────────────────
{
  const slide = pres.addSlide();
  addSlideHeader(slide, "Prognosis & Follow-Up", "Reproductive outcomes & monitoring");

  addBullets(slide, [
    "After medical (methotrexate) treatment: β-hCG should be checked on days 4 and 7 post-treatment",
    "A 15% drop in β-hCG from day 4 to day 7 indicates treatment success",
    "Weekly β-hCG monitoring until undetectable (<5 mIU/mL)",
    "Persistent ectopic (rising or plateauing β-hCG) may require repeat methotrexate or surgery",
    "After salpingostomy vs salpingectomy: IUP rates similar in RCTs; cohort studies favour salpingectomy for lower re-ectopic risk",
    "Tubal patency after salpingostomy does not guarantee function — scarring affects fertility",
    "Advise against pregnancy until β-hCG is undetectable (typically 3 months post-MTX)",
    "Rh immunoglobulin: give to Rh-negative patients with ectopic pregnancy",
  ], 0.3, 1.2, 9.4, 4.0, { fontSize: 13.5 });

  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 5.05, w: 9.4, h: 0.38, fill: { color: "E8F5E9" }, line: { color: "2E7D32" } });
  slide.addText("Overall prognosis is excellent when diagnosed early. The key is a high index of suspicion in any woman of reproductive age with pelvic pain + positive hCG.", {
    x: 0.4, y: 5.07, w: 9.2, h: 0.34, fontSize: 11, color: "1B5E20", fontFace: "Calibri", italic: true, valign: "middle",
  });
}

// ─── SLIDE 13: SUMMARY / KEY POINTS ───────────────────────────────────────────
{
  const slide = pres.addSlide();
  slide.background = { color: C.navy };

  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.08, h: 5.625, fill: { color: C.amber } });
  slide.addText("Key Takeaways", {
    x: 0.3, y: 0.2, w: 9.4, h: 0.7, fontSize: 30, bold: true, color: C.white,
    fontFace: "Calibri", charSpacing: 2,
  });
  slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.92, w: 9.4, h: 0.04, fill: { color: C.amber } });

  const points = [
    "Ectopic pregnancy = implantation outside uterus; fallopian tube (95%) is the most common site",
    "Leading cause of first-trimester maternal mortality — high index of suspicion is essential",
    "Classic triad: amenorrhea, pelvic pain, vaginal bleeding — but presentation is often atypical",
    "Diagnosis: combine serum β-hCG with transvaginal ultrasound for highest accuracy",
    "Management: expectant / methotrexate (stable, no rupture) OR surgery (unstable / ruptured)",
    "Laparoscopy is preferred over laparotomy for stable patients",
    "Methotrexate is first-line medical therapy — verify eligibility and contraindications",
    "Follow-up β-hCG monitoring is mandatory after any conservative management",
  ];

  points.forEach((p, i) => {
    slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.1 + i * 0.55, w: 0.35, h: 0.38, fill: { color: C.amber }, line: { color: C.amber } });
    slide.addText((i + 1).toString(), { x: 0.3, y: 1.1 + i * 0.55, w: 0.35, h: 0.38, fontSize: 12, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 });
    slide.addText(p, { x: 0.75, y: 1.12 + i * 0.55, w: 9.0, h: 0.38, fontSize: 12.5, color: "D0E8F5", fontFace: "Calibri", valign: "middle", margin: 0 });
  });
}

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

cd /home/daytona/workspace/ectopic-pregnancy-ppt && node generate.js 2>&1

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

Ectopic Pregnancy

Presentation · PPTX


The presentation has 13 slides built from authoritative textbook content (Berek & Novak's Gynecology, Robbins Basic Pathology, Roberts & Hedges' Clinical Procedures in Emergency Medicine, and Bailey & Love's Surgery). Here's what's covered:
SlideContent
1Title slide
2Definition & Overview (incidence, mortality stats)
3Sites of Ectopic Implantation (colour-coded grid with % frequency)
4Risk Factors (high-risk vs additional)
5Clinical Features (classic triad + atypical presentations)
6Diagnosis (urine β-hCG, serum β-hCG, TVUS discriminatory zones)
7Differential Diagnosis (8 conditions, side-by-side)
8Management Overview (expectant / medical / surgical pathways)
9Methotrexate in Detail (mechanism, absolute & relative contraindications, pre-treatment workup)
10Surgical Management (laparoscopy vs laparotomy, salpingectomy vs salpingostomy evidence)
11Complications (6 cards: haemorrhage, rupture, death, repeat ectopic, infertility, persistent trophoblast)
12Prognosis & Follow-Up (β-hCG monitoring, Rh immunoglobulin, contraception advice)
13Key Takeaways (8 numbered points, dark summary slide)
Design: Navy/teal/amber palette with accent bars, card layouts, and colour-coded severity indicators throughout.

Mention each heading properly with black colour

Reading File
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Reading File
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Editing File

~/ectopic-pregnancy-ppt/generate.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ectopic-pregnancy-ppt/generate.js'
Running Command

cd /home/daytona/workspace/ectopic-pregnancy-ppt && node generate.js 2>&1

Model call limits exceeded: run limit (20/20)
This is a shared conversation. Sign in to Orris to start your own chat.