Make presentation on normal labour for obgy pg resident students

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

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

Running Command

mkdir -p /home/daytona/workspace/normal-labour-ppt

Writing File

~/normal-labour-ppt/build.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author = "OBGyn Department";
pres.title = "Normal Labour";
pres.subject = "Obstetrics – PG Resident Teaching";

// ─── COLOUR PALETTE ────────────────────────────────────────────────────────────
const CLR = {
  navy:    "0B2545",   // dominant dark
  teal:    "1B6CA8",   // supporting
  sky:     "3EA8D6",   // accent
  mint:    "A8D8C8",   // soft accent
  white:   "FFFFFF",
  offWhite:"F0F4F8",
  lightGray:"E2EBF0",
  charcoal:"2D3748",
  accent:  "E67E22",   // warm orange for callouts
  green:   "27AE60",
  red:     "C0392B",
};

// ─── HELPER: section header slide ──────────────────────────────────────────────
function sectionSlide(pres, num, title) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: CLR.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 4.5, w: 10, h: 1.125, fill: { color: CLR.teal } });
  s.addText(`${num}`, {
    x: 0.5, y: 0.6, w: 2, h: 2,
    fontSize: 90, bold: true, color: CLR.sky, align: "left", valign: "top", transparency: 30
  });
  s.addText(title, {
    x: 0.5, y: 2.3, w: 9, h: 1.8,
    fontSize: 38, bold: true, color: CLR.white, align: "left", valign: "middle"
  });
  return s;
}

// ─── HELPER: content slide with two columns ────────────────────────────────────
function twoColSlide(pres, title, leftItems, rightItems, opts={}) {
  const s = pres.addSlide();
  // header bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText(title, {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  // left column
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 4.85, h: 4.875, fill: { color: CLR.offWhite } });
  const lBullets = leftItems.map((t, i) => ({
    text: t,
    options: { bullet: { code: "2714" }, color: CLR.charcoal, breakLine: i < leftItems.length - 1, paraSpaceAfter: 4 }
  }));
  s.addText(lBullets, {
    x: 0.15, y: 0.9, w: 4.55, h: 4.5, fontSize: 14, color: CLR.charcoal, valign: "top"
  });
  // right column
  s.addShape(pres.ShapeType.rect, { x: 5.15, y: 0.75, w: 4.85, h: 4.875, fill: { color: CLR.lightGray } });
  const rBullets = rightItems.map((t, i) => ({
    text: t,
    options: { bullet: { code: "25B6" }, color: CLR.teal, breakLine: i < rightItems.length - 1, paraSpaceAfter: 4 }
  }));
  s.addText(rBullets, {
    x: 5.3, y: 0.9, w: 4.55, h: 4.5, fontSize: 14, color: CLR.charcoal, valign: "top"
  });
  return s;
}

// ─── HELPER: standard bullet slide ────────────────────────────────────────────
function bulletSlide(pres, title, items, opts={}) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: opts.headerColor || CLR.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });
  s.addText(title, {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  const bullets = items.map((item, i) => {
    if (typeof item === "string") {
      return { text: item, options: { bullet: true, breakLine: i < items.length - 1, paraSpaceAfter: 6, color: CLR.charcoal } };
    }
    return item; // already rich text
  });
  s.addText(bullets, {
    x: 0.4, y: 0.9, w: 9.2, h: 4.5,
    fontSize: opts.fontSize || 15, color: CLR.charcoal, valign: "top"
  });
  return s;
}

// ─── HELPER: table slide ───────────────────────────────────────────────────────
function tableSlide(pres, title, rows, colW) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText(title, {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addTable(rows, {
    x: 0.3, y: 0.9, w: 9.4,
    colW: colW,
    border: { type: "solid", color: CLR.teal, pt: 1 },
    fontSize: 13,
  });
  return s;
}

// ─── HELPER: numbered steps slide ─────────────────────────────────────────────
function stepsSlide(pres, title, steps) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.teal } });
  s.addText(title, {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });

  const boxH = (4.7) / steps.length;
  steps.forEach((step, i) => {
    const yPos = 0.85 + i * boxH;
    const bgColor = i % 2 === 0 ? CLR.navy : CLR.teal;
    s.addShape(pres.ShapeType.rect, { x: 0, y: yPos, w: 0.6, h: boxH - 0.06, fill: { color: bgColor } });
    s.addText(`${i + 1}`, {
      x: 0, y: yPos, w: 0.6, h: boxH - 0.06,
      fontSize: 16, bold: true, color: CLR.white, align: "center", valign: "middle", margin: 0
    });
    s.addShape(pres.ShapeType.rect, { x: 0.62, y: yPos, w: 9.38, h: boxH - 0.06, fill: { color: i % 2 === 0 ? CLR.offWhite : CLR.lightGray } });
    s.addText(step, {
      x: 0.75, y: yPos, w: 9.1, h: boxH - 0.06,
      fontSize: 13.5, color: CLR.charcoal, valign: "middle", margin: 4
    });
  });
  return s;
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: CLR.navy } });
  // diagonal accent
  s.addShape(pres.ShapeType.rect, { x: 0, y: 4.2, w: 10, h: 1.425, fill: { color: CLR.teal } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 4.9, w: 10, h: 0.725, fill: { color: CLR.sky } });

  s.addText("NORMAL LABOUR", {
    x: 0.5, y: 0.6, w: 9, h: 1.4,
    fontSize: 52, bold: true, color: CLR.white, align: "center", valign: "middle",
    charSpacing: 4
  });
  s.addText("A Comprehensive Overview for OBGyn PG Residents", {
    x: 0.5, y: 2.15, w: 9, h: 0.7,
    fontSize: 18, color: CLR.mint, align: "center", valign: "middle", italic: true
  });
  s.addShape(pres.ShapeType.line, { x: 1, y: 3.0, w: 8, h: 0, line: { color: CLR.sky, width: 2 } });
  s.addText([
    { text: "Department of Obstetrics & Gynaecology", options: { breakLine: true } },
    { text: "Postgraduate Teaching Series  |  2026", options: {} }
  ], {
    x: 0.5, y: 3.15, w: 9, h: 0.9,
    fontSize: 14, color: CLR.mint, align: "center", valign: "middle"
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — LEARNING OBJECTIVES
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText("Learning Objectives", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });
  const objs = [
    "Define normal labour and list the criteria that constitute it",
    "Describe the anatomy of the pelvis and fetal skull relevant to labour",
    "Explain the physiological mechanisms that initiate labour",
    "Differentiate latent, active, and transition phases of the first stage of labour",
    "Enumerate and describe the seven cardinal movements of the fetal head",
    "Outline management of each stage of labour including active management",
    "Monitor maternal and fetal wellbeing throughout labour",
    "Recognise signs of placental separation and manage the third stage",
    "Identify normal versus abnormal labour progress (Partograph use)",
  ];
  objs.forEach((obj, i) => {
    const y = 0.88 + i * 0.46;
    s.addShape(pres.ShapeType.rect, { x: 0.2, y: y, w: 0.35, h: 0.35, fill: { color: CLR.teal }, rectRadius: 0.04 });
    s.addText(`${i + 1}`, {
      x: 0.2, y: y, w: 0.35, h: 0.35,
      fontSize: 12, bold: true, color: CLR.white, align: "center", valign: "middle", margin: 0
    });
    s.addText(obj, {
      x: 0.65, y: y, w: 9.1, h: 0.38,
      fontSize: 13.5, color: CLR.charcoal, valign: "middle"
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — SECTION: DEFINITION & OVERVIEW
// ═══════════════════════════════════════════════════════════════════════════════
sectionSlide(pres, "01", "Definition & Overview of Normal Labour");

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — DEFINITION
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText("Definition of Normal Labour", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });
  // definition box
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.9, w: 9.4, h: 1.1, fill: { color: CLR.teal }, rectRadius: 0.08 });
  s.addText("Normal labour is the onset of regular uterine contractions that lead to progressive cervical effacement and dilation, culminating in the vaginal delivery of a singleton, term (37–42 weeks), vertex-presenting fetus, followed by expulsion of the placenta and membranes, with blood loss < 500 mL.", {
    x: 0.4, y: 0.92, w: 9.2, h: 1.06,
    fontSize: 13.5, color: CLR.white, valign: "middle", italic: true, align: "justify"
  });

  const criteria = [
    { heading: "Term Gestation", body: "37 0/7 – 41 6/7 weeks" },
    { heading: "Spontaneous Onset", body: "Regular, painful uterine contractions without induction" },
    { heading: "Vertex Presentation", body: "Occiput presenting, ideally OA position" },
    { heading: "Singleton Pregnancy", body: "Single fetus only" },
    { heading: "Low Risk", body: "No major maternal or fetal complication at onset" },
    { heading: "Vaginal Delivery", body: "Spontaneous delivery without operative intervention" },
  ];
  criteria.forEach((c, i) => {
    const col = i % 2 === 0 ? 0.3 : 5.2;
    const row = Math.floor(i / 2);
    const y = 2.2 + row * 1.0;
    const bg = [CLR.navy, CLR.teal, CLR.sky][row];
    s.addShape(pres.ShapeType.rect, { x: col, y: y, w: 4.6, h: 0.85, fill: { color: bg }, rectRadius: 0.06 });
    s.addText([
      { text: c.heading + ": ", options: { bold: true, color: CLR.white } },
      { text: c.body, options: { color: CLR.mint } }
    ], {
      x: col + 0.1, y: y, w: 4.4, h: 0.85,
      fontSize: 13, valign: "middle"
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — SECTION: PELVIC ANATOMY
// ═══════════════════════════════════════════════════════════════════════════════
sectionSlide(pres, "02", "Pelvic Anatomy & Fetal Skull");

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — PELVIC TYPES & DIMENSIONS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText("Pelvic Types (Caldwell–Moloy Classification)", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  const types = [
    { name: "Gynaecoid", freq: "~50%", inlet: "Rounded/oval", favourable: "Yes – most common in females", color: CLR.green },
    { name: "Android", freq: "~20%", inlet: "Heart-shaped (triangular)", favourable: "Unfavourable – deep transverse arrest", color: CLR.red },
    { name: "Anthropoid", freq: "~25%", inlet: "Oval AP > transverse", favourable: "Moderate – OP delivery common", color: CLR.accent },
    { name: "Platypelloid", freq: "~5%", inlet: "Flat, transverse oval", favourable: "Unfavourable – engagement difficult", color: CLR.teal },
  ];
  const headers = [
    [{ text: "Type", options: { bold: true, color: CLR.white, fill: CLR.navy } },
     { text: "Frequency", options: { bold: true, color: CLR.white, fill: CLR.navy } },
     { text: "Inlet Shape", options: { bold: true, color: CLR.white, fill: CLR.navy } },
     { text: "Labour Prognosis", options: { bold: true, color: CLR.white, fill: CLR.navy } }]
  ];
  const rows = types.map(t => [
    { text: t.name, options: { bold: true, color: CLR.white, fill: t.color } },
    { text: t.freq, options: { align: "center" } },
    { text: t.inlet },
    { text: t.favourable }
  ]);
  s.addTable([...headers, ...rows], {
    x: 0.3, y: 0.9, w: 9.4,
    colW: [1.8, 1.5, 2.8, 3.3],
    border: { type: "solid", color: CLR.teal, pt: 1 },
    fontSize: 13,
    rowH: 0.6,
  });

  // Dimensions box
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 3.55, w: 9.4, h: 1.9, fill: { color: CLR.navy }, rectRadius: 0.08 });
  s.addText("Key Pelvic Dimensions", {
    x: 0.5, y: 3.6, w: 9, h: 0.35,
    fontSize: 14, bold: true, color: CLR.sky, align: "left", margin: 0
  });
  s.addText([
    { text: "Pelvic Inlet (conjugates): ", options: { bold: true, color: CLR.mint } },
    { text: "True conjugate (obstetric) >10 cm  |  Diagonal conjugate >11.5 cm  |  Transverse diameter 13–13.5 cm", options: { color: CLR.white } },
    { text: "\nMidplane: ", options: { bold: true, color: CLR.mint, breakLine: true } },
    { text: "Interspinous diameter ≥10 cm (narrowest; most important for engagement)", options: { color: CLR.white } },
    { text: "\nOutlet: ", options: { bold: true, color: CLR.mint, breakLine: true } },
    { text: "Bi-ischial (transverse) ≥8 cm  |  AP diameter ≥11.5 cm", options: { color: CLR.white } },
  ], {
    x: 0.5, y: 4.0, w: 9.1, h: 1.4, fontSize: 12.5, valign: "top"
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — FETAL SKULL DIAMETERS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText("Fetal Skull – Landmarks, Diameters & Fontanelles", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });

  const diameters = [
    ["Suboccipitobregmatic (SOB)", "9.5 cm", "Well-flexed vertex – OA", "Smallest / most favourable"],
    ["Suboccipitofrontal (SOF)", "10.0 cm", "Partially deflexed"],
    ["Occipitofrontal (OF)", "11.5 cm", "Deflexed – sinciput presenting"],
    ["Mentovertical (MV)", "13.5 cm", "Brow presentation – largest"],
    ["Submentobregmatic (SMB)", "9.5 cm", "Face presentation, chin anterior"],
    ["Biparietal (BPD)", "9.5 cm", "Transverse – engagement"],
    ["Bitemporal", "8.0 cm", "Transverse – smallest transverse"],
  ];
  const hdr = [
    [{ text: "Diameter", options: { bold: true, color: CLR.white, fill: CLR.teal } },
     { text: "Size", options: { bold: true, color: CLR.white, fill: CLR.teal } },
     { text: "Presentation", options: { bold: true, color: CLR.white, fill: CLR.teal } },
     { text: "Note", options: { bold: true, color: CLR.white, fill: CLR.teal } }]
  ];
  const dRows = diameters.map((d, i) => [
    { text: d[0], options: { bold: i === 0 } },
    { text: d[1], options: { align: "center", bold: i === 0, color: i === 0 ? CLR.green : CLR.charcoal } },
    { text: d[2] || "" },
    { text: d[3] || "" },
  ]);
  s.addTable([...hdr, ...dRows], {
    x: 0.3, y: 0.85, w: 9.4,
    colW: [3.2, 1.2, 3.0, 2.0],
    border: { type: "solid", color: CLR.lightGray, pt: 1 },
    fontSize: 12.5,
    rowH: 0.52,
  });

  // fontanelles callout
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 4.7, w: 9.4, h: 0.7, fill: { color: CLR.navy }, rectRadius: 0.06 });
  s.addText([
    { text: "Anterior fontanelle (bregma): ", options: { bold: true, color: CLR.sky } },
    { text: "Diamond-shaped, 4 sutures  |  ", options: { color: CLR.white } },
    { text: "Posterior fontanelle (lambda): ", options: { bold: true, color: CLR.mint } },
    { text: "Triangular, 3 sutures (reference point for station & position)", options: { color: CLR.white } },
  ], {
    x: 0.5, y: 4.72, w: 9.1, h: 0.65, fontSize: 12, valign: "middle"
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — SECTION: INITIATION OF LABOUR
// ═══════════════════════════════════════════════════════════════════════════════
sectionSlide(pres, "03", "Initiation & Mechanism of Labour");

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — INITIATION MECHANISMS
// ═══════════════════════════════════════════════════════════════════════════════
twoColSlide(pres,
  "Physiological Initiation of Labour",
  [
    "Progesterone withdrawal (functional) – decreased progesterone receptor activity shifts balance toward pro-labour prostaglandins",
    "Estrogen rises near term – increases oxytocin receptor density, gap junctions, and PG synthesis",
    "Oxytocin (Ferguson reflex) – fetal head pressure on cervix releases oxytocin from posterior pituitary",
    "CRH surge (fetal adrenal axis) – fetal DHEA-S raised, promoting estrogen production",
    "Prostaglandins (PGE2, PGF2α) – key mediators of cervical ripening and myometrial contractions",
  ],
  [
    "Cervical ripening: collagenolysis by matrix metalloproteinases, increased hyaluronic acid, prostaglandin-mediated inflammatory changes",
    "Gap junction formation: connexin-43 upregulation allows coordinated myometrial contractions",
    "Lower uterine segment formation: elongation of isthmus to ~10 cm, cervix drawn upward",
    "Bloody show: plug of cervical mucus mixed with blood from torn capillaries as cervix dilates",
    "Engagement of presenting part: BPD passes below pelvic inlet (0 station)",
  ]
);

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 10 — SECTION: STAGES OF LABOUR
// ═══════════════════════════════════════════════════════════════════════════════
sectionSlide(pres, "04", "Stages of Labour");

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 11 — STAGES OVERVIEW TABLE
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText("Four Stages of Labour – Overview", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });

  const stages = [
    { stage: "First Stage", def: "Onset of labour → full dilation (10 cm)", phases: "Latent + Active + Transition", nullip: "Up to 12–18 h", multip: "Up to 6–12 h", color: CLR.navy },
    { stage: "  Latent Phase", def: "0–6 cm; slow cervical change", phases: "Irregular to regular ctx", nullip: "≤20 h", multip: "≤14 h", color: CLR.teal },
    { stage: "  Active Phase", def: "6–10 cm; rapid dilation", phases: "Regular ctx 3–4/10 min", nullip: "≥1.2 cm/h", multip: "≥1.5 cm/h", color: CLR.sky },
    { stage: "Second Stage", def: "Full dilation → delivery of baby", phases: "Expulsive phase", nullip: "≤2 h (3 h + epidural)", multip: "≤1 h (2 h + epidural)", color: CLR.accent },
    { stage: "Third Stage", def: "Delivery of placenta", phases: "Placental separation + expulsion", nullip: "≤30 min", multip: "≤30 min", color: CLR.green },
    { stage: "Fourth Stage", def: "First 1–2 h postpartum", phases: "Haemostasis & bonding", nullip: "Close monitoring", multip: "Close monitoring", color: CLR.charcoal },
  ];
  const hdr = [[
    { text: "Stage", options: { bold: true, color: CLR.white, fill: CLR.navy } },
    { text: "Definition", options: { bold: true, color: CLR.white, fill: CLR.navy } },
    { text: "Rate / Phases", options: { bold: true, color: CLR.white, fill: CLR.navy } },
    { text: "Nullipara", options: { bold: true, color: CLR.white, fill: CLR.navy } },
    { text: "Multipara", options: { bold: true, color: CLR.white, fill: CLR.navy } },
  ]];
  const rows = stages.map(st => [
    { text: st.stage, options: { bold: true, color: CLR.white, fill: st.color } },
    { text: st.def },
    { text: st.phases },
    { text: st.nullip, options: { align: "center" } },
    { text: st.multip, options: { align: "center" } },
  ]);
  s.addTable([...hdr, ...rows], {
    x: 0.2, y: 0.85, w: 9.6,
    colW: [2.0, 2.5, 2.2, 1.45, 1.45],
    border: { type: "solid", color: CLR.lightGray, pt: 1 },
    fontSize: 12,
    rowH: 0.6,
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 12 — FIRST STAGE DETAIL
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText("First Stage of Labour – In Depth", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });

  // Three phase boxes
  const phases = [
    {
      name: "Latent Phase",
      color: CLR.teal,
      points: [
        "0 – 6 cm dilation",
        "Nullipara: up to 20 h",
        "Multipara: up to 14 h",
        "Irregular, mild contractions",
        "Cervical effacement predominates",
        "Cervical ripening (collagenolysis)",
        "Best managed at home if possible",
        "Morphine for prolonged latent phase",
      ]
    },
    {
      name: "Active Phase",
      color: CLR.sky,
      points: [
        "6 – 10 cm dilation (ACOG 2014: begins at 6 cm)",
        "Rate: ≥1.2 cm/h nullipara; ≥1.5 cm/h multipara",
        "Regular ctx 3–4 in 10 min, 40–60 s duration",
        "Bloody show often appears now",
        "Amniotomy may be performed if needed",
        "IV access; CTG monitoring",
        "Epidural analgesia commonly requested",
        "Partograph monitoring critical",
      ]
    },
    {
      name: "Transition Phase",
      color: CLR.navy,
      points: [
        "8 – 10 cm (rapid completion of dilation)",
        "Intense, frequent contractions",
        "Strong urge to push may develop early",
        "Fetal descent accelerates",
        "Maternal exhaustion common",
        "Encourage breathing techniques",
        "Reassess fetal position",
        "Prepare for delivery",
      ]
    }
  ];
  phases.forEach((ph, i) => {
    const x = 0.2 + i * 3.27;
    s.addShape(pres.ShapeType.rect, { x, y: 0.82, w: 3.1, h: 0.45, fill: { color: ph.color }, rectRadius: 0.06 });
    s.addText(ph.name, {
      x, y: 0.82, w: 3.1, h: 0.45,
      fontSize: 13.5, bold: true, color: CLR.white, align: "center", valign: "middle", margin: 0
    });
    const bullets = ph.points.map((p, j) => ({
      text: p,
      options: { bullet: true, breakLine: j < ph.points.length - 1, color: CLR.charcoal, paraSpaceAfter: 3 }
    }));
    s.addText(bullets, {
      x: x + 0.05, y: 1.32, w: 3.0, h: 4.1, fontSize: 11.5, color: CLR.charcoal, valign: "top"
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 13 — SECTION: CARDINAL MOVEMENTS
// ═══════════════════════════════════════════════════════════════════════════════
sectionSlide(pres, "05", "Cardinal Movements of Labour");

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 14 — CARDINAL MOVEMENTS
// ═══════════════════════════════════════════════════════════════════════════════
stepsSlide(pres, "Seven Cardinal Movements of the Fetal Head (Vertex Presentation)", [
  "ENGAGEMENT – The biparietal diameter (BPD, 9.5 cm) passes below the plane of the pelvic inlet. Station becomes 0. Occurs before labour in nulliparas (last 2 weeks); at onset of labour in multiparas.",
  "DESCENT – Downward passage of the presenting part throughout labour. Driven by uterine contractions, fundal pressure, and bearing-down efforts. Not continuous – progressive.",
  "FLEXION – Head flexes so chin touches sternum. Converts the larger occipitofrontal (11.5 cm) to the smaller suboccipitobregmatic diameter (9.5 cm), easing passage. Passive movement due to resistance from pelvic walls.",
  "INTERNAL ROTATION – Occiput rotates from transverse (OT) to the anterior position under the symphysis pubis (OA). Occurs as head negotiates the midplane between ischial spines. Driven by levator ani muscle tone.",
  "EXTENSION – Flexed head reaches the pelvic outlet and extends around the pubic symphysis. Occiput, bregma, forehead, nose, mouth, chin delivered sequentially over the perineum.",
  "EXTERNAL ROTATION (Restitution) – Head rotates back to its natural alignment with the fetal shoulders (which are still in oblique position). Passive movement confirming shoulder rotation to AP diameter.",
  "EXPULSION – Anterior shoulder delivers under symphysis pubis with gentle downward traction; posterior shoulder sweeps over perineum with upward traction. Remainder of body follows easily.",
]);

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 15 — SECTION: MANAGEMENT
// ═══════════════════════════════════════════════════════════════════════════════
sectionSlide(pres, "06", "Management of Labour");

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 16 — FIRST STAGE MANAGEMENT
// ═══════════════════════════════════════════════════════════════════════════════
twoColSlide(pres,
  "Management – First Stage of Labour",
  [
    "Confirm labour: regular ctx + cervical change (≥3-4 ctx/10 min, dilation ≥1 cm from baseline)",
    "Baseline vitals: BP, pulse, temperature, respiratory rate",
    "Abdominal exam: fundal height, fetal lie, presentation, position, engagement (fifths palpable)",
    "Vaginal exam (sterile): effacement, dilation, station, position, membrane status",
    "Partograph: plot dilation, descent, contractions, FHR, vitals – initiate on admission",
    "FHR monitoring: intermittent auscultation (every 30 min latent; 15 min active) OR continuous CTG in high-risk",
  ],
  [
    "IV access + hydration (crystalloid if prolonged or epidural planned)",
    "Oral intake: clear fluids acceptable; avoid heavy meals",
    "Position: ambulation encouraged; left lateral decubitus to avoid aortocaval compression",
    "Analgesia: entonox, opioids (pethidine 1 mg/kg IM), epidural (preferred in active labour)",
    "Amniotomy (AROM): consider if poor progress; accelerates labour by ~1 h but increases CTG abnormalities",
    "Oxytocin augmentation: if labour dystocia (arrested active phase > 2 h with adequate ctx) – titrate from 1–2 mU/min",
  ]
);

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 17 — SECOND STAGE MANAGEMENT
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.teal } });
  s.addText("Management – Second Stage of Labour", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });

  const leftItems = [
    "Diagnosis: full dilation (10 cm) confirmed on VE",
    "Bearing down: open-glottis pushing with contractions (3 pushes per ctx); avoid breath-holding (Valsalva) if possible",
    "FHR: auscultate after every contraction (every 5–15 min) or continuous CTG",
    "Position: dorsal lithotomy, lateral, squatting, or hands-and-knees – allow maternal preference",
    "Perineal care: warm compresses, controlled delivery of the head (Ritgen manoeuvre), guard the perineum",
    "Episiotomy: mediolateral only if clinically indicated (imminent severe tear, fetal distress, assisted delivery); NOT routine",
  ];
  const rightItems = [
    "Delivery of head: ask mother to pant/stop pushing at crowning; deliver between contractions",
    "Check nuchal cord: reduce if loose; clamp & cut if tight",
    "Restitution: head turns to OA or OP (external rotation); note position",
    "Deliver anterior shoulder: gentle downward traction",
    "Deliver posterior shoulder: gentle upward traction",
    "Rest of body: gentle traction or expulsion",
    "Clamp & cut cord: delayed (≥1–3 min) unless compromised neonate",
    "Initial newborn care: dry, stimulate, Apgar score at 1 & 5 min",
  ];
  const lBullets = leftItems.map((t, i) => ({ text: t, options: { bullet: true, breakLine: i < leftItems.length - 1, paraSpaceAfter: 4 } }));
  const rBullets = rightItems.map((t, i) => ({ text: t, options: { bullet: { code: "25B6" }, breakLine: i < rightItems.length - 1, paraSpaceAfter: 4 } }));
  s.addText(lBullets, { x: 0.2, y: 0.85, w: 4.7, h: 4.6, fontSize: 12.5, color: CLR.charcoal, valign: "top" });
  s.addShape(pres.ShapeType.line, { x: 4.95, y: 0.8, w: 0, h: 4.7, line: { color: CLR.teal, width: 1.5 } });
  s.addText(rBullets, { x: 5.1, y: 0.85, w: 4.7, h: 4.6, fontSize: 12.5, color: CLR.charcoal, valign: "top" });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 18 — ACTIVE MANAGEMENT OF THIRD STAGE (AMTSL)
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText("Active Management of Third Stage of Labour (AMTSL)", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });

  // 3-component AMTSL
  const components = [
    { num: "1", title: "Uterotonic Drug", detail: "Oxytocin 10 IU IM (or IV slow bolus)\nWithin 1 minute of delivery of anterior shoulder\nAlternatives: ergometrine, carbetocin, misoprostol 600 µg SL", color: CLR.teal },
    { num: "2", title: "Controlled Cord Traction (CCT)", detail: "Wait for strong ctx + signs of separation\nCounter-pressure on uterus (Brandt-Andrews)\nGentle, sustained traction; never forceful\nDo NOT do before separation signs", color: CLR.navy },
    { num: "3", title: "Uterine Massage", detail: "After placenta delivery\nRubbing fundus vigorously is NOT recommended (WHO)\nEnsure uterus is well contracted\nInspect placenta for completeness (cotyledons + membranes)", color: CLR.accent },
  ];
  components.forEach((c, i) => {
    const x = 0.3 + i * 3.2;
    s.addShape(pres.ShapeType.rect, { x, y: 0.88, w: 3.0, h: 0.5, fill: { color: c.color }, rectRadius: 0.06 });
    s.addText(`${c.num}. ${c.title}`, {
      x, y: 0.88, w: 3.0, h: 0.5,
      fontSize: 13.5, bold: true, color: CLR.white, align: "center", valign: "middle", margin: 0
    });
    s.addText(c.detail, {
      x: x + 0.05, y: 1.43, w: 2.9, h: 1.7,
      fontSize: 12, color: CLR.charcoal, valign: "top"
    });
  });

  // Signs of placental separation
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 3.25, w: 9.4, h: 0.5, fill: { color: CLR.teal }, rectRadius: 0.06 });
  s.addText("Signs of Placental Separation", {
    x: 0.4, y: 3.25, w: 9.2, h: 0.5,
    fontSize: 14, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  const signs = [
    "Sudden gush of blood (retroplacental haematoma formed)",
    "Lengthening of the cord",
    "Uterus becomes globular and firm and rises in the abdomen",
    "Fundal height rises (placenta descends to lower segment)",
  ];
  const signBullets = signs.map((t, i) => ({ text: t, options: { bullet: { code: "2714" }, breakLine: i < signs.length - 1, color: CLR.charcoal, paraSpaceAfter: 4 } }));
  s.addText(signBullets, { x: 0.4, y: 3.82, w: 9.2, h: 1.5, fontSize: 13, color: CLR.charcoal, valign: "top" });

  // Note
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 5.28, w: 9.4, h: 0.22, fill: { color: CLR.lightGray } });
  s.addText("AMTSL reduces PPH incidence by up to 60% compared with expectant management (WHO 2012; Cochrane 2019)", {
    x: 0.4, y: 5.28, w: 9.2, h: 0.22, fontSize: 10, color: CLR.teal, italic: true, valign: "middle"
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 19 — SECTION: MONITORING & PARTOGRAPH
// ═══════════════════════════════════════════════════════════════════════════════
sectionSlide(pres, "07", "Fetal & Maternal Monitoring");

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 20 — PARTOGRAPH
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText("The Partograph – WHO Modified", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });

  const sections = [
    { title: "Patient Data", detail: "Name, date, time, parity, ruptured membranes, time admitted" },
    { title: "Fetal Heart Rate", detail: "Plotted every 30 min (latent) / 15 min (active). Normal: 110–160 bpm. Flag: <100 or >180 bpm for >10 min" },
    { title: "Membranes & Liquor", detail: "Intact (I), Ruptured (R), colour: clear (C), meconium-stained (M), bloodstained (B), absent (A)" },
    { title: "Cervical Dilation", detail: "Alert line: begins at 4 cm, progresses 1 cm/h. Action line: 4 h to right of alert line. Crossing action line → intervention" },
    { title: "Descent of Head", detail: "Fifths palpable abdominally (5/5 = not engaged; 0/5 = fully delivered). Correlates with station on VE" },
    { title: "Uterine Contractions", detail: "Number per 10 min; duration (mild <20 s, moderate 20–40 s, strong >40 s). Plot frequency and shade intensity" },
    { title: "Oxytocin / Drugs", detail: "Amount, concentration, rate (drops/min or mU/min). Analgesics, antibiotics logged" },
    { title: "Maternal Parameters", detail: "BP & pulse every 30–60 min. Urine: volume, protein, acetone. Temperature every 4 h" },
  ];
  sections.forEach((sec, i) => {
    const col = i % 2 === 0 ? 0.2 : 5.1;
    const row = Math.floor(i / 2);
    const y = 0.88 + row * 0.99;
    const bg = row % 2 === 0 ? CLR.lightGray : CLR.offWhite;
    s.addShape(pres.ShapeType.rect, { x: col, y: y, w: 4.75, h: 0.88, fill: { color: bg }, rectRadius: 0.05 });
    s.addText([
      { text: sec.title + ": ", options: { bold: true, color: CLR.teal } },
      { text: sec.detail, options: { color: CLR.charcoal } }
    ], {
      x: col + 0.1, y: y + 0.04, w: 4.55, h: 0.82, fontSize: 11.5, valign: "top"
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 21 — CTG MONITORING
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.teal } });
  s.addText("Intrapartum CTG – STAN / NICE Classification", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });

  const features = [
    ["Feature", "Normal (Reassuring)", "Suspicious (Non-reassuring)", "Abnormal (Pathological)"],
    ["Baseline FHR", "110–160 bpm", "100–109 or 161–180 bpm", "<100 or >180 bpm"],
    ["Variability", "5–25 bpm", "3–5 bpm (>40 min)", "<3 bpm (>50 min)"],
    ["Accelerations", "Present (≥2 in 20 min)", "Absent (in low-risk)", "Absent (after 40 min with stim)"],
    ["Decelerations", "None / early only", "Variable (typical); single prolonged 2–3 min", "Late, atypical variable, prolonged >3 min"],
    ["Sinusoidal", "None", "–", "Present (≥10 min)"],
  ];
  const tableRows = features.map((row, ri) => {
    return row.map((cell, ci) => {
      let fillColor = undefined;
      let textColor = CLR.charcoal;
      let boldFlag = ri === 0;
      if (ri === 0) { fillColor = CLR.navy; textColor = CLR.white; }
      else if (ci === 1) { fillColor = "#D5F5E3"; }
      else if (ci === 2) { fillColor = "#FEF9E7"; }
      else if (ci === 3) { fillColor = "#FDECEA"; }
      return { text: cell, options: { bold: boldFlag, color: textColor, fill: fillColor } };
    });
  });
  s.addTable(tableRows, {
    x: 0.2, y: 0.85, w: 9.6,
    colW: [2.0, 2.5, 2.5, 2.6],
    border: { type: "solid", color: CLR.lightGray, pt: 1 },
    fontSize: 12,
    rowH: 0.6,
  });

  s.addShape(pres.ShapeType.rect, { x: 0.2, y: 4.55, w: 9.6, h: 0.75, fill: { color: CLR.navy }, rectRadius: 0.06 });
  s.addText([
    { text: "Normal CTG: ", options: { bold: true, color: CLR.green } },
    { text: "All 4 features reassuring → continue monitoring  |  ", options: { color: CLR.white } },
    { text: "Suspicious: ", options: { bold: true, color: CLR.accent } },
    { text: "1 non-reassuring feature → conservative measures  |  ", options: { color: CLR.white } },
    { text: "Pathological: ", options: { bold: true, color: CLR.red } },
    { text: "≥2 non-reassuring OR ≥1 abnormal → expedite delivery", options: { color: CLR.white } },
  ], {
    x: 0.35, y: 4.58, w: 9.3, h: 0.69, fontSize: 11.5, valign: "middle"
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 22 — SECTION: PAIN RELIEF & SUPPORT
// ═══════════════════════════════════════════════════════════════════════════════
sectionSlide(pres, "08", "Pain Relief & Supportive Care in Labour");

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 23 — ANALGESIA OPTIONS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText("Intrapartum Analgesia – Options & Considerations", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });

  const analgesics = [
    { method: "Non-pharmacological", details: "Continuous support (doula/partner) reduces labour duration; water immersion; TENS; breathing techniques; massage; position changes", color: CLR.teal },
    { method: "Entonox (50% N2O:O2)", details: "Inhaled; self-administered; onset 20–30 s; brief analgesia; no effect on labour progress; nausea/lightheadedness", color: CLR.sky },
    { method: "Opioids (Pethidine)", details: "1–1.5 mg/kg IM; max 100–150 mg; neonatal respiratory depression if given <4 h before delivery; have naloxone available; 3–4 h duration", color: CLR.accent },
    { method: "Epidural Analgesia", details: "Gold standard for pain relief; LA + opioid infusion; does NOT prolong first stage; may prolong second stage; increases instrumental delivery rate; CI: coagulopathy, patient refusal, infection at site", color: CLR.green },
    { method: "Spinal-Epidural (CSE)", details: "Combined technique; rapid onset of spinal component; flexibility of epidural catheter; good for advanced labour", color: CLR.navy },
    { method: "Pudendal Block", details: "Transvaginal injection at ischial spine; blocks pudendal nerve (S2–S4); adequate for perineal repair and outlet forceps; 10 mL 1% lignocaine each side", color: CLR.charcoal },
  ];
  analgesics.forEach((a, i) => {
    const y = 0.88 + i * 0.79;
    s.addShape(pres.ShapeType.rect, { x: 0.2, y: y, w: 2.1, h: 0.7, fill: { color: a.color }, rectRadius: 0.05 });
    s.addText(a.method, { x: 0.22, y: y, w: 2.06, h: 0.7, fontSize: 11.5, bold: true, color: CLR.white, valign: "middle", align: "center", margin: 2 });
    s.addText(a.details, { x: 2.4, y: y + 0.04, w: 7.4, h: 0.66, fontSize: 12, color: CLR.charcoal, valign: "top" });
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 24 — SECTION: ABNORMAL LABOUR / DYSTOCIA
// ═══════════════════════════════════════════════════════════════════════════════
sectionSlide(pres, "09", "Abnormal Labour Progress & Dystocia");

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 25 — DYSTOCIA
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText("Labour Dystocia – The Three Ps", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });

  const ps = [
    {
      title: "Power", subtitle: "Uterine Contractions",
      points: ["Hypertonic uterine dysfunction (latent phase)", "Hypotonic uterine dysfunction (active phase)", "Tx: augmentation with oxytocin (Syntocinon), AROM", "Target: 3–4 ctx/10 min, each ≥40 s (Montevideo ≥200 units)"],
      color: CLR.teal
    },
    {
      title: "Passenger", subtitle: "Fetal Factors",
      points: ["Macrosomia (EFW >4 kg at term)", "Malposition: OP, OT (deflexion, larger diameter)", "Malpresentation: brow, face, shoulder", "Tx: position change, rotation (manual/forceps), C/S"],
      color: CLR.navy
    },
    {
      title: "Passage", subtitle: "Pelvis & Soft Tissue",
      points: ["CPD (cephalopelvic disproportion) – true vs relative", "Contracted pelvis: all types unfavourable", "Soft tissue: cervical rigidity, pelvic tumours, full bladder", "Tx: assess by trial of labour; C/S if true CPD"],
      color: CLR.accent
    },
  ];
  ps.forEach((p, i) => {
    const x = 0.2 + i * 3.27;
    s.addShape(pres.ShapeType.rect, { x, y: 0.85, w: 3.0, h: 0.85, fill: { color: p.color }, rectRadius: 0.07 });
    s.addText([
      { text: p.title, options: { bold: true, color: CLR.white, breakLine: true } },
      { text: p.subtitle, options: { color: CLR.mint, italic: true } }
    ], {
      x, y: 0.85, w: 3.0, h: 0.85,
      fontSize: 16, align: "center", valign: "middle", margin: 0
    });
    const bullets = p.points.map((pt, j) => ({
      text: pt,
      options: { bullet: true, breakLine: j < p.points.length - 1, paraSpaceAfter: 5 }
    }));
    s.addText(bullets, {
      x: x + 0.05, y: 1.76, w: 2.9, h: 3.55,
      fontSize: 12, color: CLR.charcoal, valign: "top"
    });
  });

  s.addShape(pres.ShapeType.rect, { x: 0.2, y: 5.3, w: 9.6, h: 0.2, fill: { color: CLR.lightGray } });
  s.addText("Failure to progress in active phase: no dilation in 2 h with adequate contractions → action line crossed → consider C/S or rotational forceps", {
    x: 0.3, y: 5.3, w: 9.4, h: 0.2, fontSize: 10, color: CLR.red, italic: true, valign: "middle"
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 26 — COMPLICATIONS OVERVIEW (FOURTH STAGE)
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText("Fourth Stage & Immediate Postpartum Monitoring", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });

  const items = [
    { icon: "BP", title: "Vital Signs", detail: "BP & pulse every 15 min for 1 h then every 30 min for 1 h. Temperature 1 h postpartum" },
    { icon: "BLD", title: "Uterine Tone & Bleeding", detail: "Palpate fundus every 15 min; firm, midline, at or below umbilicus. Blood loss <500 mL (vaginal) / <1000 mL (C/S). Estimate & document" },
    { icon: "PPH", title: "PPH Prevention", detail: "Continue oxytocin (20–40 IU/L IV) for 4–8 h. If uterine atony: bimanual compression, ergometrine 0.2 mg IM, carboprost 250 µg IM (q15 min × 8), TXA 1g IV within 3 h of delivery" },
    { icon: "LAC", title: "Perineal Assessment", detail: "Systematic inspection for lacerations: 1st (skin), 2nd (muscle), 3rd (anal sphincter), 4th (rectal mucosa). Repair under adequate analgesia" },
    { icon: "BLD", title: "Bladder Care", detail: "Encourage voiding within 6 h. Catheterise if unable to void. Document first void" },
    { icon: "BFD", title: "Breastfeeding", detail: "Initiate within first hour (golden hour). Skin-to-skin contact. Promotes oxytocin release, decreases uterine atony risk" },
  ];
  items.forEach((item, i) => {
    const col = i % 2 === 0 ? 0.2 : 5.1;
    const row = Math.floor(i / 2);
    const y = 0.87 + row * 1.27;
    s.addShape(pres.ShapeType.rect, { x: col, y: y, w: 4.75, h: 1.15, fill: { color: row % 2 === 0 ? CLR.lightGray : CLR.offWhite }, rectRadius: 0.06 });
    s.addText([
      { text: item.title + "\n", options: { bold: true, color: CLR.teal, breakLine: true } },
      { text: item.detail, options: { color: CLR.charcoal } }
    ], {
      x: col + 0.1, y: y + 0.05, w: 4.55, h: 1.07, fontSize: 11.5, valign: "top"
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 27 — SUMMARY / KEY POINTS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: CLR.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.teal } });
  s.addText("Key Take-Home Points", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  const points = [
    "Normal labour requires spontaneous onset, term gestation, vertex singleton, vaginal delivery, and blood loss <500 mL.",
    "Active phase begins at 6 cm (ACOG 2014); progress is ≥1.2 cm/h (nullipara) and ≥1.5 cm/h (multipara).",
    "The seven cardinal movements – engagement, descent, flexion, internal rotation, extension, external rotation, expulsion – are driven by the interplay of pelvic shape, fetal size, and uterine power.",
    "Partograph is the cornerstone of labour monitoring; crossing the action line mandates urgent reassessment.",
    "AMTSL (oxytocin + CCT) reduces PPH risk by ~60%; administer uterotonic within 1 minute of anterior shoulder delivery.",
    "CTG interpretation: normal (all 4 features reassuring), suspicious (1 non-reassuring), pathological (≥2 non-reassuring or ≥1 abnormal) → expedite delivery.",
    "Dystocia = failure of progress; always consider the 3 Ps – Power, Passenger, Passage – before deciding on intervention.",
    "The fourth stage (first 1–2 h postpartum) is the highest risk period for haemorrhage; close monitoring is mandatory.",
  ];
  points.forEach((pt, i) => {
    const y = 0.88 + i * 0.58;
    s.addShape(pres.ShapeType.rect, { x: 0.2, y: y + 0.07, w: 0.35, h: 0.35, fill: { color: CLR.sky }, rectRadius: 0.04 });
    s.addText(`${i + 1}`, {
      x: 0.2, y: y + 0.07, w: 0.35, h: 0.35,
      fontSize: 11, bold: true, color: CLR.white, align: "center", valign: "middle", margin: 0
    });
    s.addText(pt, {
      x: 0.65, y: y, w: 9.1, h: 0.52,
      fontSize: 12, color: i % 2 === 0 ? CLR.mint : CLR.white, valign: "middle"
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 28 — REFERENCES
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: CLR.navy } });
  s.addText("References & Further Reading", {
    x: 0.3, y: 0, w: 9.4, h: 0.75,
    fontSize: 20, bold: true, color: CLR.white, align: "left", valign: "middle", margin: 0
  });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 4.875, fill: { color: CLR.offWhite } });
  const refs = [
    "1. Creasy & Resnik's Maternal-Fetal Medicine: Principles and Practice, 9th ed. (2023) – Chapters on Labor Monitoring & Normal Labor",
    "2. Textbook of Family Medicine, 9th ed. (Rakel) – Chapter 20: Progress of Labor, Stages of Labor",
    "3. Roberts and Hedges' Clinical Procedures in Emergency Medicine – Chapter 56: Labor Movements",
    "4. WHO recommendations: Intrapartum care for a positive childbirth experience (2018)",
    "5. ACOG Practice Bulletin No. 116: Management of Intrapartum Fetal Heart Rate Tracings (2010, reaffirmed 2020)",
    "6. ACOG Committee Opinion No. 766: Approaches to Limit Intervention During Labor and Birth (2019)",
    "7. Friedman EA. Labor: Clinical Evaluation and Management, 2nd ed. (1978) – Cervimetric analysis",
    "8. Tintinalli's Emergency Medicine, 9th ed. – Chapter 101: Emergency Delivery",
    "9. NICE Guideline NG235: Intrapartum Care (2023)",
    "10. Miller's Anesthesia, 10th ed. – Chapter on Obstetric Anesthesia: Labor Progress & Analgesia",
  ];
  const bullets = refs.map((r, i) => ({
    text: r,
    options: { bullet: false, breakLine: i < refs.length - 1, paraSpaceAfter: 5, color: CLR.charcoal }
  }));
  s.addText(bullets, {
    x: 0.3, y: 0.88, w: 9.4, h: 4.6,
    fontSize: 12, color: CLR.charcoal, valign: "top"
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SAVE
// ═══════════════════════════════════════════════════════════════════════════════
pres.writeFile({ fileName: "/home/daytona/workspace/normal-labour-ppt/Normal_Labour_OBGyn_PG.pptx" })
  .then(() => console.log("SUCCESS: Presentation saved."))
  .catch(err => { console.error("ERROR:", err); process.exit(1); });
Running Command

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

Running Command

ls -lh /home/daytona/workspace/normal-labour-ppt/

Your presentation is ready for download:

Normal Labour OBGyn PG

Presentation · PPTX


Here is a full breakdown of what's inside (28 slides, navy/teal/sky colour scheme):
Slide(s)Content
1Title slide – Normal Labour, PG Teaching Series 2026
2Learning Objectives (9 specific, numbered)
3–4Definition & Criteria – consensus definition, 6 criteria boxes (term gestation, vertex, singleton, spontaneous, low-risk, vaginal)
5–7Pelvic Anatomy & Fetal Skull – Caldwell-Moloy classification with labour prognosis; all pelvic diameters; fetal skull diameters table (SOB, SOF, OF, MV, SMB, BPD) + fontanelle callout
8–9Initiation of Labour – progesterone withdrawal, oxytocin/Ferguson reflex, CRH, prostaglandins, cervical ripening, gap junctions
10–12Stages of Labour – overview table (all 4 stages, nullipara vs multipara durations); detailed first-stage slide with latent / active / transition phase columns
13–14Seven Cardinal Movements – full numbered step-by-step slide (engagement → expulsion) with mechanism detail
15–17Labour Management – first stage (admission, partograph, FHR, analgesia, augmentation); second stage (pushing, perineal care, shoulder delivery, cord clamping); third stage (AMTSL)
18AMTSL – 3 components + signs of placental separation + evidence summary
19–21Monitoring – Partograph (8 components); CTG table with normal/suspicious/pathological classification
22–23Analgesia – non-pharmacological, Entonox, pethidine, epidural, CSE, pudendal block
24–25Dystocia & 3 Ps – Power, Passenger, Passage with management for each
26Fourth Stage – vitals monitoring, PPH prevention (TXA, carboprost), perineal lacerations grading, breastfeeding
27Key Take-Home Points (8 bullet summary)
28References – Creasy & Resnik, WHO 2018, ACOG PBs, NICE NG235, Friedman, Tintinalli

Make ppt of normal labour from oxorn foote

Finding Sources
Finding Sources
Finding Sources
Searching the Web

Oxorn Foote Human Labor Birth textbook normal labour topics chapters content

Reading Web Page

https://www.ndl.ethernet.edu.et/bitstream/123456789/57116/1/…

Running Command

ls /home/daytona/workspace/normal-labour-ppt/

Writing File

~/normal-labour-ppt/oxorn_foote.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author = "OBGyn Department";
pres.title = "Normal Labour – Oxorn-Foote";

// ── PALETTE ──────────────────────────────────────────────────────────────────
const C = {
  dark:    "1A2E44",   // dominant dark navy
  mid:     "2D6A8F",   // teal-blue
  bright:  "3AAFCF",   // sky accent
  gold:    "D4A017",   // warm gold accent
  lime:    "5AAA55",   // green
  red:     "C0392B",
  cream:   "F7F3EE",   // warm off-white background
  pale:    "E8F4F8",
  lgray:   "DDE6EE",
  charcoal:"2C3E50",
  white:   "FFFFFF",
  orange:  "E67E22",
};

// ── HELPERS ──────────────────────────────────────────────────────────────────
function hdr(s, title, color) {
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:0.72, fill:{ color: color||C.dark } });
  s.addText(title, { x:0.3, y:0, w:9.4, h:0.72, fontSize:19, bold:true, color:C.white, valign:"middle", margin:0 });
}

function sectionSlide(num, title, subtitle) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:C.dark } });
  s.addShape(pres.ShapeType.rect, { x:0, y:4.3, w:10, h:1.325, fill:{ color:C.mid } });
  s.addShape(pres.ShapeType.rect, { x:0, y:5.1, w:10, h:0.525, fill:{ color:C.bright } });
  s.addText(num, { x:0.4, y:0.3, w:2, h:2, fontSize:88, bold:true, color:C.bright, align:"left", valign:"top", transparency:20 });
  s.addText(title,    { x:0.4, y:1.9, w:9.2, h:1.2, fontSize:34, bold:true, color:C.white, align:"left", valign:"middle" });
  if (subtitle) s.addText(subtitle, { x:0.4, y:3.15, w:9.2, h:0.7, fontSize:16, italic:true, color:"B8D8E8", align:"left", valign:"middle" });
  return s;
}

function bullets(s, items, x, y, w, h, fs, color) {
  const arr = items.map((t,i)=>({ text:t, options:{ bullet:true, breakLine: i<items.length-1, paraSpaceAfter:5, color: color||C.charcoal }}));
  s.addText(arr, { x, y, w, h, fontSize: fs||13, color: color||C.charcoal, valign:"top" });
}

function twoCol(title, left, right, hcolor) {
  const s = pres.addSlide();
  hdr(s, title, hcolor);
  s.addShape(pres.ShapeType.rect, { x:0,   y:0.72, w:4.9, h:4.905, fill:{ color:C.cream } });
  s.addShape(pres.ShapeType.rect, { x:5.1, y:0.72, w:4.9, h:4.905, fill:{ color:C.pale  } });
  bullets(s, left,  0.15, 0.82, 4.65, 4.6, 13);
  bullets(s, right, 5.25, 0.82, 4.65, 4.6, 13);
  return s;
}

function stepSlide(title, steps, hcolor) {
  const s = pres.addSlide();
  hdr(s, title, hcolor||C.mid);
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });
  const bh = 4.7 / steps.length;
  steps.forEach((st, i) => {
    const y = 0.78 + i * bh;
    const bg = i%2===0 ? C.dark : C.mid;
    s.addShape(pres.ShapeType.rect, { x:0,    y, w:0.55, h:bh-0.05, fill:{ color:bg } });
    s.addText(`${i+1}`, { x:0, y, w:0.55, h:bh-0.05, fontSize:15, bold:true, color:C.white, align:"center", valign:"middle", margin:0 });
    s.addShape(pres.ShapeType.rect, { x:0.57, y, w:9.43, h:bh-0.05, fill:{ color: i%2===0 ? C.lgray : C.pale } });
    s.addText(st, { x:0.7, y:y+0.02, w:9.15, h:bh-0.08, fontSize:13, color:C.charcoal, valign:"middle", margin:3 });
  });
  return s;
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0,   w:10, h:5.625, fill:{ color:C.dark } });
  s.addShape(pres.ShapeType.rect, { x:0, y:3.9,  w:10, h:1.0,   fill:{ color:C.mid   } });
  s.addShape(pres.ShapeType.rect, { x:0, y:4.9,  w:10, h:0.725, fill:{ color:C.bright } });
  // decorative vertical bar
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:0.25, h:5.625, fill:{ color:C.gold } });
  s.addText("NORMAL LABOUR", {
    x:0.5, y:0.5, w:9.1, h:1.4, fontSize:50, bold:true, color:C.white, align:"center", valign:"middle", charSpacing:3
  });
  s.addText("Based on Oxorn-Foote: Human Labor & Birth", {
    x:0.5, y:2.05, w:9.1, h:0.6, fontSize:20, italic:true, color:C.gold, align:"center", valign:"middle"
  });
  s.addShape(pres.ShapeType.line, { x:1, y:2.85, w:8, h:0, line:{ color:C.bright, width:1.5 } });
  s.addText([
    { text:"Department of Obstetrics & Gynaecology\n", options:{ breakLine:true } },
    { text:"Postgraduate Teaching Series  |  2026", options:{} }
  ], { x:0.5, y:2.95, w:9.1, h:0.75, fontSize:14, color:"A8D0E0", align:"center", valign:"middle" });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 2 – ABOUT THE BOOK
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Oxorn-Foote: Human Labor & Birth – An Introduction");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  const facts = [
    { label:"Authors",    val:"Harry Oxorn (orig.) → Oxorn-Foote, 6th ed. by William R. Foote; 7th ed. (2013) by Glenn Posner" },
    { label:"Philosophy", val:"Clinical, practitioner-oriented textbook; emphasises mechanics of labour and practical obstetrics over theoretical evidence alone" },
    { label:"Approach",   val:"Organises obstetrics around the 4 Ps: Passenger, Passage, Powers, Placenta" },
    { label:"Scope",      val:"Normal mechanisms → abnormal presentations → complications → operative obstetrics – all in one volume" },
    { label:"Key strength",val:"Unrivalled depth on mechanism of labour, cardinal movements, and management of malpresentations with surgical anatomy focus" },
    { label:"Chapters covered today", val:"1 (Pelvis) · 2 (Fetal skull) · 3 (Relationship of fetus to pelvis) · 4–5 (Mechanisms & cardinal movements) · 6 (Uterus & powers) · 7 (Placenta) · 10–11 (Normal mechanisms & clinical course)" },
  ];
  facts.forEach((f, i) => {
    const y = 0.82 + i * 0.73;
    s.addShape(pres.ShapeType.rect, { x:0.2, y, w:2.0, h:0.62, fill:{ color:C.mid }, rectRadius:0.05 });
    s.addText(f.label, { x:0.22, y, w:1.96, h:0.62, fontSize:12, bold:true, color:C.white, align:"center", valign:"middle", margin:2 });
    s.addText(f.val,   { x:2.3,  y:y+0.06, w:7.5,  h:0.58, fontSize:12.5, color:C.charcoal, valign:"top" });
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 3 – SECTION 01: THE PASSENGER
// ═════════════════════════════════════════════════════════════════════════════
sectionSlide("01", "The Passenger", "Fetal Skull, Dimensions & Presentation (Chapters 2–3)");

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 4 – FETAL SKULL BONES & SUTURES
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Fetal Skull – Bones, Sutures & Fontanelles (Ch. 2)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  // Left: bones + sutures
  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:4.5, h:0.4, fill:{ color:C.dark }, rectRadius:0.05 });
  s.addText("Bones of the Vault", { x:0.22, y:0.82, w:4.46, h:0.4, fontSize:13, bold:true, color:C.white, valign:"middle", margin:0 });
  const bones = ["2 × Frontal bones","2 × Parietal bones","1 × Occipital bone","2 × Temporal bones"];
  bullets(s, bones, 0.3, 1.27, 4.3, 1.3, 13);

  s.addShape(pres.ShapeType.rect, { x:0.2, y:2.62, w:4.5, h:0.4, fill:{ color:C.mid }, rectRadius:0.05 });
  s.addText("Sutures (fibrous joints – allow moulding)", { x:0.22, y:2.62, w:4.46, h:0.4, fontSize:12.5, bold:true, color:C.white, valign:"middle", margin:0 });
  const sutures = [
    "Sagittal suture – between 2 parietals (AP midline)",
    "Coronal sutures (2) – frontal-parietal junction",
    "Lambdoid sutures (2) – parietal-occipital junction",
    "Frontal (metopic) suture – between 2 frontals",
  ];
  bullets(s, sutures, 0.3, 3.07, 4.3, 1.8, 12.5);

  // Right: fontanelles
  s.addShape(pres.ShapeType.rect, { x:5.2, y:0.82, w:4.5, h:0.4, fill:{ color:C.gold }, rectRadius:0.05 });
  s.addText("Fontanelles", { x:5.22, y:0.82, w:4.46, h:0.4, fontSize:13, bold:true, color:C.white, valign:"middle", margin:0 });

  const fontData = [
    { name:"Anterior (Bregma)", shape:"Diamond-shaped", sutures:"4 sutures meet (sagittal, coronal ×2, frontal)", size:"3–4 cm × 3 cm", closes:"18 months after birth", note:"Used to assess position – felt as wide, soft, flat depression" },
    { name:"Posterior (Lambda)", shape:"Triangular", sutures:"3 sutures meet (sagittal + lambdoids ×2)", size:"1–2 cm", closes:"6–8 weeks after birth", note:"Reference point for identifying occiput position in labour" },
  ];
  fontData.forEach((f, i) => {
    const y = 1.3 + i * 1.9;
    s.addShape(pres.ShapeType.rect, { x:5.2, y, w:4.5, h:1.78, fill:{ color: i===0 ? C.pale : C.lgray }, rectRadius:0.06 });
    s.addText([
      { text:f.name+"\n", options:{ bold:true, color:C.mid, breakLine:true } },
      { text:`Shape: ${f.shape}\n`, options:{ breakLine:true } },
      { text:`Sutures: ${f.sutures}\n`, options:{ breakLine:true } },
      { text:`Size: ${f.size}  |  Closes: ${f.closes}\n`, options:{ breakLine:true } },
      { text:f.note, options:{ italic:true, color:"666666" } },
    ], { x:5.3, y:y+0.06, w:4.3, h:1.6, fontSize:11.5, color:C.charcoal, valign:"top" });
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 5 – FETAL SKULL DIAMETERS
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Fetal Skull – Diameters & Regions (Ch. 2)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  // Regions callout
  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:9.6, h:0.5, fill:{ color:C.dark }, rectRadius:0.06 });
  s.addText("Regions: Sinciput (anterior – forehead) · Bregma (anterior fontanelle) · Vertex (between fontanelles, between parietal eminences) · Occiput (behind posterior fontanelle) · Face (glabella to chin)", {
    x:0.3, y:0.83, w:9.4, h:0.48, fontSize:11.5, color:C.white, valign:"middle"
  });

  const rows = [
    ["Suboccipitobregmatic (SOB)","9.5 cm","Fully flexed vertex (OA)","Smallest – most favourable",C.lime],
    ["Suboccipitofrontal (SOF)","10.0 cm","Partially deflexed","–",C.mid],
    ["Occipitofrontal (OF)","11.5 cm","Deflexed – sinciput presenting","Military attitude",C.orange],
    ["Occipitomentalon (OM)","13.5 cm","Brow presentation","Largest AP diameter – cannot deliver vaginally (usually)",C.red],
    ["Submentobregmatic (SMB)","9.5 cm","Face, mentoanterior","Favourable if fully extended","447799"],
    ["Submentovertical","11.5 cm","Face, not fully extended","–",C.orange],
    ["Biparietal (BPD)","9.5 cm","All presentations","Important transverse diameter",C.mid],
    ["Bitemporal","8.0 cm","All presentations","Smallest transverse diameter",C.lime],
  ];
  const tableData = [
    [
      { text:"Diameter",      options:{ bold:true, color:C.white, fill:C.dark } },
      { text:"Size",          options:{ bold:true, color:C.white, fill:C.dark } },
      { text:"Presentation",  options:{ bold:true, color:C.white, fill:C.dark } },
      { text:"Clinical note", options:{ bold:true, color:C.white, fill:C.dark } },
    ],
    ...rows.map(r => [
      { text:r[0], options:{ bold:true } },
      { text:r[1], options:{ align:"center", color:r[4], bold:true } },
      { text:r[2] },
      { text:r[3], options:{ italic:true, color:"555555" } },
    ])
  ];
  s.addTable(tableData, {
    x:0.2, y:1.4, w:9.6, colW:[2.9,1.0,2.3,3.4],
    border:{ type:"solid", color:C.lgray, pt:1 }, fontSize:12, rowH:0.42,
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 6 – LIE, PRESENTATION, POSITION, ATTITUDE
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Lie, Presentation, Position, Attitude & Station (Ch. 3)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  const terms = [
    {
      term:"Lie", color:C.dark,
      def:"Relationship of long axis of fetus to long axis of mother",
      types:"Longitudinal (99%) · Transverse · Oblique",
    },
    {
      term:"Presentation", color:C.mid,
      def:"Part of fetus lying lowest in birth canal (over pelvic inlet)",
      types:"Cephalic (vertex, brow, face) · Breech (frank, complete, footling) · Shoulder",
    },
    {
      term:"Attitude", color:C.gold,
      def:"Relationship of fetal parts to one another (posture of fetus)",
      types:"Flexion (normal – vertex) · Military (neutral) · Deflexion (sinciput) · Extension (brow, face)",
    },
    {
      term:"Position", color:C.orange,
      def:"Relationship of denominator (presenting part) to the quadrants of the maternal pelvis",
      types:"Denominator: Vertex=occiput (O) · Face=mentum (M) · Breech=sacrum (S) · Shoulder=acromion (A); Quadrants: OA, OP, LOA, LOT, LOP, ROA, ROT, ROP",
    },
    {
      term:"Denominator", color:"447799",
      def:"Fixed reference point on the presenting part used to describe position",
      types:"Occiput (vertex) · Mentum / chin (face) · Brow (frontal suture) · Sacrum (breech) · Acromio-dorsal (shoulder)",
    },
    {
      term:"Station", color:C.mid,
      def:"Level of presenting part relative to ischial spines (midplane)",
      types:"–5 to –1 (above spines, not engaged) · 0 (engaged, at spines) · +1 to +5 (below spines, advancing to perineum)",
    },
  ];
  terms.forEach((t, i) => {
    const col = i%2===0 ? 0.2 : 5.1;
    const row = Math.floor(i/2);
    const y = 0.82 + row * 1.27;
    s.addShape(pres.ShapeType.rect, { x:col, y, w:4.75, h:1.18, fill:{ color:C.pale }, rectRadius:0.06 });
    s.addShape(pres.ShapeType.rect, { x:col, y, w:1.4, h:0.38, fill:{ color:t.color }, rectRadius:0.05 });
    s.addText(t.term, { x:col+0.05, y, w:1.3, h:0.38, fontSize:12.5, bold:true, color:C.white, valign:"middle", margin:2 });
    s.addText([
      { text:t.def+"\n", options:{ color:C.charcoal, breakLine:true } },
      { text:t.types, options:{ color:C.mid, italic:true } }
    ], { x:col+0.1, y:y+0.42, w:4.55, h:0.74, fontSize:11.5, valign:"top" });
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 7 – SECTION 02: THE PASSAGE
// ═════════════════════════════════════════════════════════════════════════════
sectionSlide("02", "The Passage", "Bony Pelvis & Birth Canal (Chapter 1)");

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 8 – BONY PELVIS
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Bony Pelvis – Bones, Joints & True vs False Pelvis (Ch. 1)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  // Bones box
  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:4.6, h:2.35, fill:{ color:C.pale }, rectRadius:0.07 });
  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:4.6, h:0.4, fill:{ color:C.dark }, rectRadius:0.05 });
  s.addText("Bones of the Pelvis", { x:0.22, y:0.82, w:4.56, h:0.4, fontSize:13, bold:true, color:C.white, valign:"middle", margin:0 });
  bullets(s, [
    "2 × Hip bones (os coxae): each = ilium + ischium + pubis fused at triradiate cartilage",
    "Sacrum: 5 fused sacral vertebrae; promontory = upper border S1 (key landmark)",
    "Coccyx: 4 rudimentary fused vertebrae; can be pushed back ~1 cm in labour",
  ], 0.3, 1.27, 4.4, 1.8, 12.5);

  // Joints box
  s.addShape(pres.ShapeType.rect, { x:0.2, y:3.26, w:4.6, h:2.2, fill:{ color:C.lgray }, rectRadius:0.07 });
  s.addShape(pres.ShapeType.rect, { x:0.2, y:3.26, w:4.6, h:0.4, fill:{ color:C.mid }, rectRadius:0.05 });
  s.addText("Pelvic Joints – relax in pregnancy (relaxin)", { x:0.22, y:3.26, w:4.56, h:0.4, fontSize:12.5, bold:true, color:C.white, valign:"middle", margin:0 });
  bullets(s, [
    "Pubic symphysis – fibrocartilaginous; widens in pregnancy",
    "2 × Sacroiliac joints (synovial)",
    "Sacrococcygeal joint – allows coccygeal movement",
  ], 0.3, 3.71, 4.4, 1.65, 12.5);

  // True vs False pelvis
  s.addShape(pres.ShapeType.rect, { x:5.1, y:0.82, w:4.6, h:4.64, fill:{ color:C.pale }, rectRadius:0.07 });
  s.addShape(pres.ShapeType.rect, { x:5.1, y:0.82, w:4.6, h:0.4, fill:{ color:C.gold }, rectRadius:0.05 });
  s.addText("True vs False Pelvis", { x:5.12, y:0.82, w:4.56, h:0.4, fontSize:13, bold:true, color:C.white, valign:"middle", margin:0 });
  s.addText([
    { text:"Linea terminalis (brim)\n", options:{ bold:true, color:C.mid, breakLine:true } },
    { text:"= sacral promontory + arcuate lines + pectineal lines + pubic crest\n\n", options:{ breakLine:true } },
    { text:"FALSE pelvis (above brim):\n", options:{ bold:true, color:C.dark, breakLine:true } },
    { text:"= iliac fossae; clinically unimportant for delivery\n\n", options:{ breakLine:true } },
    { text:"TRUE pelvis (below brim):\n", options:{ bold:true, color:C.dark, breakLine:true } },
    { text:"= the birth canal; consists of inlet, cavity (midplane), and outlet\nFetal head must negotiate all three planes during descent\n\n", options:{ breakLine:true } },
    { text:"Pelvic axis (curve of Carus):\n", options:{ bold:true, color:C.dark, breakLine:true } },
    { text:"Curved path traced by presenting part during labour; directed first posteriorly (toward sacrum) then anteriorly (under symphysis) during delivery", options:{ italic:true, color:"555555" } },
  ], { x:5.2, y:1.27, w:4.4, h:4.14, fontSize:12, color:C.charcoal, valign:"top" });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 9 – PELVIC PLANES & DIAMETERS
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Pelvic Planes & Obstetric Diameters (Ch. 1)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  const planes = [
    {
      name:"Pelvic Inlet (Brim)", color:C.dark,
      rows:[
        ["True conjugate (anatomical conjugate)","11.0 cm","Sacral promontory → upper inner symphysis","Not measurable clinically"],
        ["Obstetric conjugate (conjugata vera)","10.0 cm","Promontory → inner symphysis at its narrowest","Most important for engagement; not measurable"],
        ["Diagonal conjugate","11.5–12 cm","Promontory → lower edge symphysis","Only clinically measurable conjugate (subtract 1.5 cm → obstetric)"],
        ["Transverse diameter","13.0–13.5 cm","Widest transverse distance across inlet","Fetal BPD (9.5 cm) enters in this diameter"],
        ["Oblique diameters (L&R)","12.0–12.5 cm","Sacroiliac joint → iliopectineal eminence","Fetal head often engages in oblique"],
      ]
    },
    {
      name:"Midplane (Cavity)", color:C.mid,
      rows:[
        ["Interspinous (transverse)","≥10.5 cm","Between ischial spines","Narrowest diameter; most important for descent; <10 cm = contracted"],
        ["AP diameter","12.0 cm","Sacrum S4–5 → back of symphysis","Roomy cavity"],
      ]
    },
    {
      name:"Pelvic Outlet", color:C.gold,
      rows:[
        ["Bi-ischial (transverse)","11.0 cm","Between inner surfaces of ischial tuberosities","<8 cm = contracted outlet"],
        ["AP diameter (outlet)","9.5–11.5 cm","Tip of coccyx → lower symphysis","Increases to ~13 cm with coccyx displaced"],
      ]
    },
  ];

  let y = 0.82;
  planes.forEach(plane => {
    s.addShape(pres.ShapeType.rect, { x:0.1, y, w:9.8, h:0.38, fill:{ color:plane.color }, rectRadius:0.05 });
    s.addText(plane.name, { x:0.15, y, w:9.7, h:0.38, fontSize:13, bold:true, color:C.white, valign:"middle", margin:0 });
    y += 0.4;
    plane.rows.forEach((r, ri) => {
      const bg = ri%2===0 ? C.pale : C.lgray;
      s.addShape(pres.ShapeType.rect, { x:0.1, y, w:9.8, h:0.38, fill:{ color:bg } });
      s.addText(r[0], { x:0.2,  y, w:2.9, h:0.38, fontSize:11.5, color:C.charcoal, valign:"middle" });
      s.addText(r[1], { x:3.15, y, w:1.1, h:0.38, fontSize:12,   color:r[1].includes("≥")?C.lime:C.dark, bold:true, align:"center", valign:"middle" });
      s.addText(r[2], { x:4.3,  y, w:3.0, h:0.38, fontSize:11.5, color:C.charcoal, valign:"middle" });
      s.addText(r[3], { x:7.35, y, w:2.55,h:0.38, fontSize:11,   color:"555555",   italic:true, valign:"middle" });
      y += 0.4;
    });
    y += 0.1;
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 10 – PELVIC TYPES (CALDWELL-MOLOY)
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Pelvic Types – Caldwell-Moloy Classification (Ch. 1)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  const types = [
    {
      name:"Gynaecoid", freq:"50%", color:C.lime,
      inlet:"Rounded / slightly oval transversely",
      forepelvis:"Rounded", sacrum:"Well curved", spines:"Not prominent",
      prognosis:"Ideal for vaginal delivery. Engagement in transverse diameter. Delivery in OA position.",
    },
    {
      name:"Android", freq:"20%", color:C.red,
      inlet:"Heart-shaped / wedge-shaped",
      forepelvis:"Narrow, triangular", sacrum:"Straight, inclined forward", spines:"Prominent, convergent",
      prognosis:"Unfavourable. Deep transverse arrest common. High incidence of OP delivery, forceps, C/S.",
    },
    {
      name:"Anthropoid", freq:"25%", color:C.orange,
      inlet:"Oval AP > transverse",
      forepelvis:"Narrow", sacrum:"Long, narrow", spines:"Prominent",
      prognosis:"Moderate. OP delivery common (long AP). Narrow midplane. May deliver vaginally.",
    },
    {
      name:"Platypelloid", freq:"5%", color:C.mid,
      inlet:"Flat oval – transverse >> AP",
      forepelvis:"Wide", sacrum:"Short, wide", spines:"Not prominent",
      prognosis:"Unfavourable. Engagement in transverse. Deep transverse arrest. High C/S rate.",
    },
  ];
  types.forEach((t, i) => {
    const x = 0.2 + i*2.42;
    s.addShape(pres.ShapeType.rect, { x, y:0.82, w:2.22, h:0.48, fill:{ color:t.color }, rectRadius:0.06 });
    s.addText([
      { text:t.name+"\n", options:{ bold:true, breakLine:true } },
      { text:`Incidence: ${t.freq}`, options:{} }
    ], { x, y:0.82, w:2.22, h:0.48, fontSize:12.5, color:C.white, align:"center", valign:"middle", margin:2 });

    s.addShape(pres.ShapeType.rect, { x, y:1.34, w:2.22, h:4.1, fill:{ color:C.pale }, rectRadius:0.05 });
    s.addText([
      { text:"Inlet: ", options:{ bold:true, color:t.color } },
      { text:t.inlet+"\n\n", options:{ color:C.charcoal, breakLine:true } },
      { text:"Forepelvis: ", options:{ bold:true, color:t.color } },
      { text:t.forepelvis+"\n\n", options:{ color:C.charcoal, breakLine:true } },
      { text:"Sacrum: ", options:{ bold:true, color:t.color } },
      { text:t.sacrum+"\n\n", options:{ color:C.charcoal, breakLine:true } },
      { text:"Ischial spines: ", options:{ bold:true, color:t.color } },
      { text:t.spines+"\n\n", options:{ color:C.charcoal, breakLine:true } },
      { text:"Labour: ", options:{ bold:true, color:t.color } },
      { text:t.prognosis, options:{ italic:true, color:C.charcoal } },
    ], { x:x+0.08, y:1.38, w:2.06, h:3.98, fontSize:11, color:C.charcoal, valign:"top" });
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 11 – SECTION 03: THE POWERS
// ═════════════════════════════════════════════════════════════════════════════
sectionSlide("03", "The Powers", "Uterine Action & Cervical Changes (Chapters 6 & 8)");

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 12 – UTERINE ACTION
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Uterine Action – Contractions, Polarity & Fundal Dominance (Ch. 6)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  // Top: contraction properties
  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:9.6, h:0.4, fill:{ color:C.dark }, rectRadius:0.05 });
  s.addText("Properties of Uterine Contractions", { x:0.25, y:0.82, w:9.5, h:0.4, fontSize:13, bold:true, color:C.white, valign:"middle", margin:0 });

  const props = [
    ["Frequency","Latent: 1 in 10–15 min → Active: 3–5 in 10 min"],
    ["Duration","Latent: 15–20 s → Active: 40–60 s → Transition: 60–90 s"],
    ["Intensity","Latent: 20–30 mmHg → Active: 40–60 mmHg → Peak: up to 80 mmHg"],
    ["Resting tone","8–12 mmHg (must return to baseline between contractions for placental perfusion)"],
  ];
  props.forEach((p, i) => {
    const y = 1.28 + i*0.5;
    const bg = i%2===0 ? C.lgray : C.pale;
    s.addShape(pres.ShapeType.rect, { x:0.2, y, w:9.6, h:0.46, fill:{ color:bg } });
    s.addText(p[0], { x:0.3,  y, w:1.8, h:0.46, fontSize:12.5, bold:true, color:C.mid, valign:"middle" });
    s.addText(p[1], { x:2.15, y, w:7.5, h:0.46, fontSize:12.5, color:C.charcoal, valign:"middle" });
  });

  // Bottom: Triple descending gradient + polarity
  s.addShape(pres.ShapeType.rect, { x:0.2, y:3.35, w:4.65, h:0.4, fill:{ color:C.mid }, rectRadius:0.05 });
  s.addText("Triple Descending Gradient (Oxorn-Foote concept)", { x:0.22, y:3.35, w:4.6, h:0.4, fontSize:12, bold:true, color:C.white, valign:"middle", margin:0 });
  bullets(s, [
    "1. Contractions start at cornual pacemakers (near fallopian tube insertions)",
    "2. Spread downward to lower uterine segment within 15 s",
    "3. Intensity greatest at fundus, diminishes toward cervix",
    "4. Duration longest at fundus, shortest at lower segment",
    "5. Effect: cervical dilation + fetal descent",
  ], 0.3, 3.8, 4.5, 1.7, 12);

  s.addShape(pres.ShapeType.rect, { x:5.15, y:3.35, w:4.65, h:0.4, fill:{ color:C.gold }, rectRadius:0.05 });
  s.addText("Fundal Dominance & Polarity", { x:5.17, y:3.35, w:4.6, h:0.4, fontSize:12, bold:true, color:C.white, valign:"middle", margin:0 });
  bullets(s, [
    "Upper segment: active, contracts & retracts (thickens with each ctx)",
    "Lower segment: passive, dilates and stretches (acts as reservoir)",
    "Retraction ring (Bandl ring) – physiological junction between upper & lower segments",
    "Polarity = coordinated action of upper (active) + lower (passive) segments",
  ], 5.25, 3.8, 4.5, 1.7, 12);
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 13 – CERVICAL EFFACEMENT & DILATION
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Cervical Effacement & Dilation (Ch. 8)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  // Effacement
  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:4.65, h:4.7, fill:{ color:C.pale }, rectRadius:0.07 });
  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:4.65, h:0.42, fill:{ color:C.dark }, rectRadius:0.05 });
  s.addText("Effacement (Taking Up of Cervix)", { x:0.22, y:0.82, w:4.6, h:0.42, fontSize:13, bold:true, color:C.white, valign:"middle", margin:0 });
  bullets(s, [
    "Normal cervical length: 3–4 cm in non-pregnant state",
    "Effacement = incorporation of cervix into lower uterine segment (shortening + thinning)",
    "Measured as % (0% = uneffaced; 100% = fully effaced)",
    "In nulliparas: effacement precedes dilation",
    "In multiparas: effacement and dilation occur simultaneously",
    "Driven by: Braxton Hicks ctx + prostaglandins + relaxin + fetal presenting part pressure",
    "Cervical ripening: collagen remodelling (collagenase), increased water content, hyaluronic acid ↑, dermatan sulphate ↓",
    "Bishop score: quantifies ripeness (effacement, dilation, consistency, position, station)",
  ], 0.32, 1.3, 4.44, 4.1, 12.5);

  // Dilation
  s.addShape(pres.ShapeType.rect, { x:5.15, y:0.82, w:4.65, h:4.7, fill:{ color:C.lgray }, rectRadius:0.07 });
  s.addShape(pres.ShapeType.rect, { x:5.15, y:0.82, w:4.65, h:0.42, fill:{ color:C.mid }, rectRadius:0.05 });
  s.addText("Dilation of Cervix", { x:5.17, y:0.82, w:4.6, h:0.42, fontSize:13, bold:true, color:C.white, valign:"middle", margin:0 });
  bullets(s, [
    "Dilation = opening of external os from closed to 10 cm (fully dilated)",
    "10 cm = full dilation = sufficient to allow passage of average fetal head",
    "Mechanism: hydrostatic pressure of forewaters + direct fetal head pressure on cervix",
    "Latent phase (0–3 cm): slow dilation; preparatory changes dominant",
    "Active phase (4–10 cm): rapid dilation; rate ≥1.2 cm/h (nullipara), ≥1.5 cm/h (multipara)",
    "Friedman curve: S-shaped dilation curve for nulliparas; steeper for multiparas",
    "Oxorn-Foote adds: in primips, the curve is biphasic – slow then rapid acceleration after 4 cm",
    "VE findings: dilation (cm) + effacement (%) + station + position + consistency + membranes",
  ], 5.27, 1.3, 4.44, 4.1, 12.5);
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 14 – SECTION 04: THE PLACENTA (brief)
// ═════════════════════════════════════════════════════════════════════════════
sectionSlide("04", "The Placenta & Third Stage", "Separation, Descent & Delivery (Chapter 7)");

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 15 – PLACENTAL SEPARATION
// ═════════════════════════════════════════════════════════════════════════════
twoCol(
  "Placental Separation & Expulsion (Ch. 7)",
  [
    "SEPARATION begins as uterus contracts after fetal delivery – retraction reduces placental bed area by ~75%",
    "Mechanism: shearing force between thick, contracting myometrium and relatively fixed placenta",
    "Retroplacental haematoma forms behind placenta and further strips it off the decidua",
    "Schultze mechanism (central separation – 80%): centre separates first; placenta descends fetal surface first (clean; retroplacental clot retained behind placenta)",
    "Matthews Duncan mechanism (marginal separation – 20%): edges separate first; placenta slides sideways; maternal surface presents first; blood trickles during separation",
    "Signs of separation: Calkin sign (uterus firms, rises), cord lengthens, gush of blood",
  ],
  [
    "DESCENT into lower segment after separation; expelled by maternal bearing down with contractions",
    "Brandt-Andrews manoeuvre: gentle CCT with counter-pressure on fundus (prevents uterine inversion)",
    "Inspection of placenta: 15–20 cotyledons on maternal surface; membranes on fetal surface; cord insertion",
    "Confirm completeness: missing cotyledon → retained placenta → risk of PPH",
    "Oxytocin 10 IU IM given with (or after) anterior shoulder delivery – standard AMTSL (WHO)",
    "Normal blood loss: < 500 mL (vaginal delivery); mean ~250 mL",
    "Fourth stage: first 1–2 h post-delivery; uterine tone, lochia, BP monitored every 15 min",
  ],
  C.gold
);

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 16 – SECTION 05: NORMAL MECHANISMS
// ═════════════════════════════════════════════════════════════════════════════
sectionSlide("05", "Normal Mechanisms of Labour", "Cardinal Movements of the Fetal Head (Chapters 10 & 11)");

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 17 – PREREQUISITES FOR NORMAL LABOUR (Oxorn-Foote)
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Prerequisites for Normal Labour – Oxorn-Foote Framework (Ch. 10)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  const pre = [
    { cat:"Passenger", items:["Singleton fetus","Cephalic (vertex) presentation","Normal attitude (well-flexed head)","Normal size (BPD ~9.5 cm; no hydrocephalus)","No gross abnormality"] },
    { cat:"Passage",   items:["Adequate pelvic inlet: OC ≥10 cm; transverse ≥12 cm","Adequate midplane: interspinous ≥10 cm","Adequate outlet: bi-ischial ≥8 cm","Gynaecoid or near-gynaecoid pelvic type","No pelvic tumours or soft tissue obstruction"] },
    { cat:"Powers",    items:["Effective, coordinated uterine contractions","Triple descending gradient intact","Adequate frequency (≥3/10 min active phase)","Adequate intensity (≥40 mmHg active phase)","Normal resting tone (8–12 mmHg)"] },
    { cat:"Placenta",  items:["Normally situated (fundal / posterior)","Not praevia (no obstruction to birth canal)","Normal cord insertion","No vasa praevia","Adequate placental function (no IUGR)"] },
  ];
  pre.forEach((p, i) => {
    const x = 0.2 + i*2.42;
    const colors = [C.dark, C.mid, C.orange, C.gold];
    s.addShape(pres.ShapeType.rect, { x, y:0.82, w:2.22, h:0.42, fill:{ color:colors[i] }, rectRadius:0.05 });
    s.addText(p.cat, { x, y:0.82, w:2.22, h:0.42, fontSize:14, bold:true, color:C.white, align:"center", valign:"middle", margin:0 });
    s.addShape(pres.ShapeType.rect, { x, y:1.28, w:2.22, h:4.2, fill:{ color:C.pale }, rectRadius:0.05 });
    bullets(s, p.items, x+0.1, 1.33, 2.05, 4.0, 12);
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 18 – ENGAGEMENT
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Engagement of the Fetal Head (Ch. 10)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:9.6, h:0.55, fill:{ color:C.dark }, rectRadius:0.06 });
  s.addText("DEFINITION: Engagement = descent of the biparietal diameter (BPD) through the plane of the pelvic inlet (brim)", {
    x:0.3, y:0.83, w:9.4, h:0.53, fontSize:13.5, bold:true, color:C.gold, valign:"middle"
  });

  bullets(s, [
    "When engaged: the lowermost bony point of the skull is at the level of the ischial spines (station 0)",
    "Engagement usually occurs in the TRANSVERSE diameter of the pelvis (occasionally oblique)",
    "Asynclitism commonly accompanies engagement – the fetal head is laterally tilted so one parietal bone leads:\n   • Anterior asynclitism (Naegele obliquity): anterior parietal bone leads; head tilted toward symphysis\n   • Posterior asynclitism (Litzmann obliquity): posterior parietal bone leads; head tilted toward sacrum",
    "Asynclitism is normal and corrects as head descends; persistent severe asynclitism = abnormal",
    "In NULLIPARAS: usually occurs 2–4 weeks before labour (lightening); abdominal palpation shows head 0/5 palpable",
    "In MULTIPARAS: may not occur until active labour begins",
    "Clinical assessment of engagement: abdominal – fifths of head palpable above brim; vaginal – station on VE",
    "Head is NOT engaged if >2/5 palpable abdominally (presenting part still above ischial spines)",
  ], 0.3, 1.45, 9.4, 3.95, 12.5);
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 19 – CARDINAL MOVEMENTS (STEPS)
// ═════════════════════════════════════════════════════════════════════════════
stepSlide(
  "Seven Cardinal Movements of Labour – Vertex OA (Oxorn-Foote, Ch. 10)",
  [
    "ENGAGEMENT – BPD passes through pelvic inlet; presenting part at station 0; head usually enters in transverse or oblique diameter; asynclitism is normal and corrects with descent",
    "DESCENT – Downward passage of fetal head through birth canal; begins with engagement; continuous throughout labour; driven by uterine contractions (fundal pressure), abdominal muscles (bearing-down), and gravity; assessed abdominally (fifths) and vaginally (station)",
    "FLEXION – As head meets resistance of pelvic floor and soft tissues, chin flexes onto chest; converts larger occipitofrontal diameter (11.5 cm) to smaller suboccipitobregmatic (9.5 cm); passive mechanism; lever principle (long lever = occiput; short lever = sinciput)",
    "INTERNAL ROTATION – Occiput rotates from transverse (OT) position to directly anterior (OA) under symphysis pubis; driven by levator ani; occurs as head descends past ischial spines; essential for head to negotiate narrowest AP diameter of midplane; rotation = 90° from OT → OA (or 45° from LOA/ROA)",
    "EXTENSION – After internal rotation, occiput reaches under symphysis; head extends around pubic arch (suboccipital region pivots at subpubic angle); occiput → bregma → forehead → nose → mouth → chin delivered sequentially over the perineum (\"crowning\" = when largest diameter distends the introitus)",
    "RESTITUTION (External Rotation) – After head delivery, occiput rotates ~45° back to the oblique (the position it held at engagement); head realigns with shoulders; passive movement reflecting unwinding of torsion in the neck",
    "EXPULSION – Shoulders descend in oblique diameter; rotate to AP at outlet; ANTERIOR shoulder delivered first (under symphysis with gentle downward traction); POSTERIOR shoulder swept over perineum (gentle upward traction); rest of body follows easily",
  ],
  C.dark
);

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 20 – POSITIONS: LOA, ROA, LOP, ROP
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Vertex Positions – Mechanism Variations (Ch. 10)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  const positions = [
    {
      pos:"LOA – Left Occiput Anterior",
      freq:"Most common position",
      rotation:"45° internal rotation → OA; smooth, short rotation",
      delivery:"Spontaneous in most cases; favourable",
      color:C.lime,
    },
    {
      pos:"ROA – Right Occiput Anterior",
      freq:"Second most common",
      rotation:"45° internal rotation → OA; equally favourable",
      delivery:"Spontaneous delivery; same as LOA mechanism",
      color:C.mid,
    },
    {
      pos:"LOT / ROT – Occiput Transverse",
      freq:"Common on admission (before full rotation)",
      rotation:"90° internal rotation required → OA; may arrest (deep transverse arrest)",
      delivery:"Usually rotates with descent; if arrested → oxytocin, rotation, ventouse",
      color:C.orange,
    },
    {
      pos:"LOP / ROP – Occiput Posterior",
      freq:"10–15% of all vertex labours",
      rotation:"Short (135°) rotation → OA via long arc, OR deliver directly OP (\"face to pubes\")",
      delivery:"Longer labour, more maternal effort; risk of extended tears, instrumental delivery",
      color:C.red,
    },
  ];

  positions.forEach((p, i) => {
    const col = i%2===0 ? 0.2 : 5.1;
    const row = Math.floor(i/2);
    const y = 0.82 + row * 2.25;
    s.addShape(pres.ShapeType.rect, { x:col, y, w:4.7, h:2.1, fill:{ color:C.pale }, rectRadius:0.07 });
    s.addShape(pres.ShapeType.rect, { x:col, y, w:4.7, h:0.42, fill:{ color:p.color }, rectRadius:0.05 });
    s.addText(p.pos, { x:col+0.08, y, w:4.54, h:0.42, fontSize:13, bold:true, color:C.white, valign:"middle", margin:2 });
    s.addText([
      { text:`Frequency: `, options:{ bold:true, color:C.mid } },
      { text:p.freq+"\n", options:{ color:C.charcoal, breakLine:true } },
      { text:`Rotation: `, options:{ bold:true, color:C.mid } },
      { text:p.rotation+"\n", options:{ color:C.charcoal, breakLine:true } },
      { text:`Delivery: `, options:{ bold:true, color:C.mid } },
      { text:p.delivery, options:{ italic:true, color:C.charcoal } },
    ], { x:col+0.12, y:y+0.47, w:4.46, h:1.58, fontSize:12, color:C.charcoal, valign:"top" });
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 21 – SECTION 06: CLINICAL COURSE
// ═════════════════════════════════════════════════════════════════════════════
sectionSlide("06", "Clinical Course of Normal Labour", "Stages, Progress & Management (Chapter 11)");

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 22 – FIRST STAGE OF LABOUR
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "First Stage of Labour – Onset to Full Dilation (Ch. 11)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  // Definition bar
  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:9.6, h:0.48, fill:{ color:C.dark }, rectRadius:0.05 });
  s.addText("ONSET of labour: regular, painful uterine contractions causing progressive cervical effacement and dilation  |  ENDS: complete dilation (10 cm)", {
    x:0.3, y:0.83, w:9.4, h:0.46, fontSize:12.5, color:C.gold, valign:"middle"
  });

  const phases = [
    {
      name:"Latent Phase", range:"0 → 3 cm", color:C.mid,
      duration:"Nullipara: up to 20 h; Multipara: up to 14 h (Friedman)",
      ctx:"Contractions irregular → regular; 5–30 min apart; mild (15–20 mmHg above baseline); duration 15–30 s",
      changes:"Cervical effacement + softening; minimal dilation; head engagement (nullips)",
      mgmt:"Home management preferable; mobilise; light diet / fluids; emotional support; baseline vitals + FHR",
      notes:"Prolonged latent phase: >20 h nullip; >14 h multip → exclude false labour; consider morphine rest",
    },
    {
      name:"Active Phase", range:"4 → 10 cm", color:C.dark,
      duration:"Nullipara: ~8 h (min rate 1.2 cm/h); Multipara: ~5 h (min rate 1.5 cm/h)",
      ctx:"Regular, strong contractions; 2–5 min apart; duration 45–60 s; intensity 40–60 mmHg",
      changes:"Rapid cervical dilation; active fetal descent; forewaters may rupture (SROM or AROM)",
      mgmt:"Hospital; IV access; partograph; continuous CTG (or IA 15 min); analgesia; position of comfort; PV 4-hourly",
      notes:"Active phase arrest: no change in ≥2 h with adequate contractions → augment or C/S",
    },
  ];
  phases.forEach((ph, i) => {
    const y = 1.38 + i * 1.88;
    s.addShape(pres.ShapeType.rect, { x:0.2, y, w:9.6, h:1.78, fill:{ color:C.pale }, rectRadius:0.07 });
    s.addShape(pres.ShapeType.rect, { x:0.2, y, w:9.6, h:0.42, fill:{ color:ph.color }, rectRadius:0.05 });
    s.addText(`${ph.name}  (${ph.range})`, { x:0.28, y, w:9.44, h:0.42, fontSize:13.5, bold:true, color:C.white, valign:"middle", margin:0 });
    const cols = [
      { label:"Duration", val:ph.duration },
      { label:"Contractions", val:ph.ctx },
      { label:"Cervical change", val:ph.changes },
      { label:"Management", val:ph.mgmt },
      { label:"Oxorn note", val:ph.notes },
    ];
    cols.forEach((c, ci) => {
      const startX = 0.28;
      const rowY = y + 0.47 + ci*0.26;
      s.addText([
        { text:c.label+": ", options:{ bold:true, color:ph.color } },
        { text:c.val, options:{ color:C.charcoal } }
      ], { x:startX, y:rowY, w:9.44, h:0.25, fontSize:11, color:C.charcoal, valign:"middle" });
    });
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 23 – SECOND STAGE
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Second Stage of Labour – Full Dilation to Delivery (Ch. 11)", C.mid);
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:9.6, h:0.48, fill:{ color:C.mid }, rectRadius:0.05 });
  s.addText("Begins: Full dilation (10 cm)  |  Ends: Complete delivery of fetus  |  Nullipara: avg 50 min (max 2 h/3 h with epidural)  |  Multipara: avg 20 min (max 1 h)", {
    x:0.3, y:0.83, w:9.4, h:0.46, fontSize:12, color:C.white, valign:"middle"
  });

  const left = [
    "Diagnosis: full dilation confirmed on VE; strong urge to push; Ferguson reflex (PGE2 released)",
    "Contractions: every 2–3 min; 60–90 s duration; very strong",
    "Fetal descent: head progresses from midplane to outlet; occiput visible at introitus",
    "Pushing: open-glottis (preferred); 2–3 pushes per ctx; maintain FHR surveillance between pushes",
    "Position: dorsal lithotomy (most common); lateral Sims; squatting; hands-and-knees (OP)",
    "Crowning: largest diameter distends introitus; head does not recede between contractions",
    "Control of delivery: slow controlled delivery prevents explosive expulsion + perineal tears",
    "Panting: instruct mother to pant at crowning; rest between ctx to allow perineum to stretch",
  ];
  const right = [
    "Ritgen manoeuvre: pressure on fetal chin through perineum + counter-pressure on occiput → control extension and delivery of head",
    "Check nuchal cord: feel for cord around neck; reduce over head if loose; clamp & cut if tight",
    "Suction: clear mouth then nose (only if meconium or obvious obstruction)",
    "Restitution observed: head rotates to oblique after delivery",
    "Deliver anterior shoulder: gentle downward traction with next contraction",
    "Deliver posterior shoulder: gentle upward traction",
    "Body delivered: gentle traction; support baby",
    "Delayed cord clamping: ≥1–3 min (UNLESS depressed neonate, Rh incompatibility, or need for resuscitation)",
  ];
  bullets(s, left,  0.2, 1.4, 4.72, 4.1, 12.5);
  s.addShape(pres.ShapeType.line, { x:4.98, y:0.8, w:0, h:4.8, line:{ color:C.mid, width:1 } });
  bullets(s, right, 5.1, 1.4, 4.72, 4.1, 12.5);
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 24 – EPISIOTOMY
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Perineum, Episiotomy & Perineal Lacerations (Ch. 11)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  // Left: Episiotomy
  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:4.65, h:4.6, fill:{ color:C.pale }, rectRadius:0.07 });
  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:4.65, h:0.42, fill:{ color:C.dark }, rectRadius:0.05 });
  s.addText("Episiotomy", { x:0.22, y:0.82, w:4.6, h:0.42, fontSize:13, bold:true, color:C.white, valign:"middle", margin:0 });
  bullets(s, [
    "Surgical incision of perineum to enlarge vaginal outlet",
    "Oxorn-Foote advocates SELECTIVE (not routine) episiotomy",
    "Indications: fetal distress (expedite delivery), rigid perineum preventing descent, shoulders (macrosomia), instrumental delivery, OP delivery, preterm (protect head)",
    "Types: Mediolateral (most common; away from anal sphincter) · Median (easier repair; higher risk of 3rd/4th degree) · J-shaped",
    "Timing: incise when head distends perineum 3–4 cm at crowning",
    "Repair: 3 layers – vaginal mucosa (continuous), deep perineal muscles (interrupted), skin (subcuticular); use absorbable sutures (Vicryl)",
    "Complications: infection, haematoma, breakdown, dyspareunia, extension to 3rd/4th degree",
  ], 0.32, 1.3, 4.44, 4.0, 12);

  // Right: Lacerations
  s.addShape(pres.ShapeType.rect, { x:5.15, y:0.82, w:4.65, h:4.6, fill:{ color:C.lgray }, rectRadius:0.07 });
  s.addShape(pres.ShapeType.rect, { x:5.15, y:0.82, w:4.65, h:0.42, fill:{ color:C.red }, rectRadius:0.05 });
  s.addText("Perineal Lacerations – Classification", { x:5.17, y:0.82, w:4.6, h:0.42, fontSize:13, bold:true, color:C.white, valign:"middle", margin:0 });

  const degrees = [
    { deg:"1st Degree", desc:"Skin and vaginal mucosa only; no muscle involvement; may not require suture", color:C.lime },
    { deg:"2nd Degree", desc:"Skin + subcutaneous tissue + perineal body muscles (bulbospongiosus, transverse perinei); does NOT involve anal sphincter; requires layer-by-layer repair", color:C.orange },
    { deg:"3rd Degree", desc:"Extends into external anal sphincter:\n  3a: <50% EAS torn\n  3b: >50% EAS torn\n  3c: internal anal sphincter also torn", color:C.red },
    { deg:"4th Degree", desc:"Extends through anal sphincter complex into rectal mucosa; requires specialist repair + antibiotic cover + laxatives post-op", color:"8B0000" },
  ];
  degrees.forEach((d, i) => {
    const y = 1.33 + i * 0.98;
    s.addShape(pres.ShapeType.rect, { x:5.22, y, w:4.5, h:0.88, fill:{ color:C.pale }, rectRadius:0.05 });
    s.addShape(pres.ShapeType.rect, { x:5.22, y, w:1.2, h:0.88, fill:{ color:d.color }, rectRadius:0.05 });
    s.addText(d.deg, { x:5.24, y:y+0.22, w:1.16, h:0.4, fontSize:11.5, bold:true, color:C.white, align:"center", valign:"middle", margin:0 });
    s.addText(d.desc, { x:6.48, y:y+0.06, w:3.2, h:0.76, fontSize:11, color:C.charcoal, valign:"top" });
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 25 – THIRD & FOURTH STAGE
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Third Stage & Fourth Stage of Labour (Ch. 11)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  // 3rd stage
  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.82, w:9.6, h:0.42, fill:{ color:C.dark }, rectRadius:0.05 });
  s.addText("THIRD STAGE: Delivery of baby → Expulsion of placenta + membranes  |  Normal duration: ≤30 min (mean 5–10 min)", {
    x:0.3, y:0.82, w:9.4, h:0.42, fontSize:12.5, bold:true, color:C.gold, valign:"middle"
  });

  const col3L = [
    "Uterus contracts after fetal delivery → retroplacental haematoma forms",
    "Calkin sign: uterus rises in abdomen, becomes globular and firm = separation complete",
    "Cord lengthens + fresh gush of blood confirms separation",
    "Schultze mechanism (80%): fetal surface first; clean expulsion; blood retained behind placenta",
    "Matthews Duncan (20%): edge separation; maternal surface first; blood trickles out",
    "AMTSL: oxytocin 10 IU IM (within 1 min of anterior shoulder) + CCT + uterine massage",
  ];
  const col3R = [
    "CCT (Brandt-Andrews): steady cord traction with one hand + counter-pressure on fundus with other hand",
    "Ask mother to push with each contraction to deliver placenta",
    "Inspect placenta: 15–20 cotyledons; confirm completeness; check cord for 3 vessels (2 arteries, 1 vein)",
    "Examine membranes: confirm intact amnion + chorion; no missing lobes",
    "Missing cotyledon → evacuate uterus under anaesthesia",
    "Blood loss measurement: weighing method (1 mL = 1 g) or visual estimation (unreliable – underestimates by ~50%)",
  ];
  bullets(s, col3L, 0.2,  1.3, 4.72, 2.2, 12);
  bullets(s, col3R, 5.1,  1.3, 4.72, 2.2, 12);

  s.addShape(pres.ShapeType.rect, { x:0.2, y:3.58, w:9.6, h:0.42, fill:{ color:C.mid }, rectRadius:0.05 });
  s.addText("FOURTH STAGE: First 1–2 hours post-delivery – highest risk period for haemorrhage", {
    x:0.3, y:3.58, w:9.4, h:0.42, fontSize:12.5, bold:true, color:C.white, valign:"middle"
  });
  bullets(s, [
    "Vitals every 15 min × 4, then every 30 min × 2",
    "Fundal height + tone: palpate every 15 min; well-contracted = firm, at umbilicus",
    "Lochia: physiological blood loss; red (rubra) initially; estimate volume",
    "Perineal check: haematoma, swelling, sutures intact",
    "Bladder: encourage voiding within 6 h; catheterise if unable",
    "Skin-to-skin: initiate breastfeeding in first hour (golden hour); promotes bonding + oxytocin release",
  ], 0.25, 4.06, 9.5, 1.38, 12);
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 26 – SECTION 07: PARTOGRAPH
// ═════════════════════════════════════════════════════════════════════════════
sectionSlide("07", "Partograph & Labour Monitoring", "Progress, Surveillance & Action Lines");

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 27 – PARTOGRAPH IN DETAIL
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "WHO Partograph – Components & Action Lines");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  const sections = [
    { title:"Patient ID", detail:"Name, parity, gravidity, date & time of admission, SROM time, liquor colour at rupture" },
    { title:"Fetal Heart Rate", detail:"Plotted every 30 min (latent) / 15 min (active); normal 110–160 bpm; deceleration pattern noted; <110 or >160 for >10 min = abnormal" },
    { title:"Membranes & Liquor", detail:"Intact (I); Ruptured (R); Clear (C); Meconium (M1 = light, M2 = thick); Absent (A); Blood-stained (B)" },
    { title:"Cervical Dilation", detail:"ALERT LINE: begins at active phase threshold (4 cm), progresses 1 cm/h; ACTION LINE: 4 h to the right of alert line; crossing action line = critical – reassess, augment, or deliver" },
    { title:"Descent of Head", detail:"Fifths of head palpable above brim (5/5 = fully above, 0/5 = not palpable = delivered); should progressively decrease as labour advances" },
    { title:"Contractions", detail:"Number per 10 min (count); duration shaded: dotted <20 s, hatched 20–40 s, solid >40 s; plot every 30 min" },
    { title:"Oxytocin / Drugs", detail:"Amount (mU/min), concentration (units/mL), drops/min; augmentation record; analgesics, antibiotics logged here" },
    { title:"Maternal Obs", detail:"BP every 4 h (every 30 min if concerns); pulse every 30 min; temperature every 4 h; urine: volume, protein, acetone, glucose" },
  ];
  sections.forEach((sec, i) => {
    const col = i%2===0 ? 0.2 : 5.1;
    const row = Math.floor(i/2);
    const y = 0.82 + row * 1.0;
    const bg = row%2===0 ? C.pale : C.lgray;
    s.addShape(pres.ShapeType.rect, { x:col, y, w:4.75, h:0.9, fill:{ color:bg }, rectRadius:0.05 });
    s.addText([
      { text:sec.title+": ", options:{ bold:true, color:C.mid } },
      { text:sec.detail, options:{ color:C.charcoal } }
    ], { x:col+0.1, y:y+0.05, w:4.55, h:0.82, fontSize:11.5, color:C.charcoal, valign:"top" });
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 28 – FETAL WELLBEING IN LABOUR
// ═════════════════════════════════════════════════════════════════════════════
twoCol(
  "Fetal Wellbeing in Labour – Monitoring Methods",
  [
    "INTERMITTENT AUSCULTATION (IA): Pinard stethoscope or hand-held Doppler; listen for 1 min after contraction; Latent phase every 30 min; Active phase every 15 min; Second stage every 5 min",
    "CTG (Cardiotocography): baseline FHR 110–160 bpm; variability 5–25 bpm; accelerations ≥15 bpm × 15 s; decelerations – early (vagal, benign), late (uteroplacental insufficiency), variable (cord compression)",
    "NICE Classification: Normal (all 4 features reassuring) → Suspicious (1 non-reassuring) → Pathological (≥2 non-reassuring or ≥1 abnormal) → expedite delivery",
    "Meconium: light (M1) = increased surveillance; thick/particulate (M2) + FHR changes = expedite; prepare NICU",
    "Amniotic fluid volume: polyhydramnios or oligohydramnios may indicate fetal compromise",
  ],
  [
    "Fetal scalp pH sampling (FBS): if pathological CTG and immediate delivery not planned; pH >7.25 = reassuring; pH 7.21–7.24 = borderline (repeat in 30 min); pH <7.20 = acidosis → deliver",
    "Fetal scalp stimulation (Allis clamp test): acceleration in response = reassuring (negative for acidosis); rapid bedside tool",
    "ST analysis (STAN): combined CTG + fetal ECG ST segment analysis; elevated T/QRS ratio = fetal hypoxia response",
    "Liquor assessment: clear = reassuring; meconium staining correlates with passage of meconium in utero",
    "Umbilical cord blood gas (after delivery): arterial pH <7.0 and BD >12 mmol/L = significant acidaemia; benchmark for neonatal outcome correlation",
  ],
  C.dark
);

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 29 – PAIN RELIEF IN LABOUR
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Analgesia in Labour – Oxorn-Foote Approach (Ch. 11)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  const methods = [
    { method:"Psychoprophylaxis (Lamaze / Bradley)", class:"Non-pharmacological",
      detail:"Antenatal preparation; relaxation + breathing techniques; reduces anxiety → reduces pain perception; partner/doula support; continuous support reduces labour duration", color:C.lime },
    { method:"Entonox (50% N2O / O2)", class:"Inhalational",
      detail:"Self-administered; onset 20–30 s; brief analgesia per contraction; safe for fetus; side-effects: nausea, dizziness, dry mouth; does not slow labour", color:C.mid },
    { method:"Opioids – Pethidine (Meperidine)", class:"Systemic",
      detail:"50–100 mg IM (1 mg/kg); duration 3–4 h; sedation + analgesia; neonatal respiratory depression if delivery within 1–4 h; have naloxone 0.1 mg/kg ready; promethazine 25 mg co-administered (reduces nausea)", color:C.orange },
    { method:"Epidural Block", class:"Regional (gold standard)",
      detail:"L2–L3 or L3–L4 interspace; LA (bupivacaine 0.1%) + fentanyl; excellent analgesia; prolongs 2nd stage slightly; increases instrumental delivery; CI: coagulopathy, patient refusal, local infection, hypovolaemia; monitor BP every 5 min × 30 min then 15 min", color:C.dark },
    { method:"Spinal / Combined Spinal-Epidural (CSE)", class:"Regional",
      detail:"Rapid onset; useful in advanced labour or for C/S; intrathecal bupivacaine 2.5 mg + fentanyl 25 µg; CSE = spinal for immediate effect + epidural for prolonged use", color:"447799" },
    { method:"Pudendal Nerve Block", class:"Local",
      detail:"Bilateral; 10 mL 1% lignocaine at each ischial spine; blocks pudendal n. (S2–S4); adequate for outlet forceps + perineal repair; simple, safe, effective", color:C.gold },
  ];
  methods.forEach((m, i) => {
    const y = 0.82 + i * 0.7;
    s.addShape(pres.ShapeType.rect, { x:0.2, y, w:2.2, h:0.62, fill:{ color:m.color }, rectRadius:0.05 });
    s.addText([
      { text:m.method+"\n", options:{ bold:true, color:C.white, breakLine:true } },
      { text:m.class, options:{ italic:true, color:"FFFFFFCC" } }
    ], { x:0.24, y:y+0.03, w:2.12, h:0.56, fontSize:10.5, color:C.white, valign:"top", align:"center" });
    s.addText(m.detail, { x:2.5, y:y+0.08, w:7.3, h:0.56, fontSize:12, color:C.charcoal, valign:"top" });
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 30 – DYSTOCIA (3 Ps)
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "Dystocia & Abnormal Labour Progress – The 3 Ps (Oxorn-Foote)");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  const ps = [
    {
      P:"POWER", color:C.mid,
      causes:["Hypotonic inertia (active phase) – most common; ctx weak, infrequent, short", "Hypertonic inertia (latent phase) – painful but ineffective ctx; uncoordinated", "Colicky uterus – uncoordinated polarity"],
      mgmt:["Exclude CPD first", "AROM if membranes intact and head engaged", "Oxytocin augmentation: start 1–2 mU/min; double every 30 min; max 32–40 mU/min", "Morphine rest for hypertonic inertia in latent phase"],
    },
    {
      P:"PASSENGER", color:C.orange,
      causes:["Macrosomia (EFW >4 kg) – relative or absolute CPD", "Malposition (OP, OT deep transverse arrest) – larger diameter presenting", "Malpresentation: brow (OM 13.5 cm), face (MV), shoulder", "Hydrocephalus, fetal tumours"],
      mgmt:["Position change (hands-and-knees for OP)", "Manual rotation / Kjelland forceps for OT arrest", "C/S for brow, brow-to-vertex if not converted", "C/S for all shoulder presentations at term"],
    },
    {
      P:"PASSAGE", color:C.red,
      causes:["Contracted pelvic inlet (OC <10 cm, transverse <12 cm)", "Contracted midplane (interspinous <10 cm)", "Contracted outlet (bi-ischial <8 cm)", "Soft tissue obstruction: cervical fibroid, ovarian cyst, distended bladder"],
      mgmt:["Clinical pelvimetry + CT/MRI pelvimetry if needed", "Trial of labour for borderline CPD", "Empty bladder (catheterise) for soft tissue obstruction", "C/S for true CPD; Symphysiotomy in selected cases (low-resource settings)"],
    },
  ];
  ps.forEach((p, i) => {
    const x = 0.2 + i*3.27;
    s.addShape(pres.ShapeType.rect, { x, y:0.82, w:3.07, h:0.42, fill:{ color:p.color }, rectRadius:0.05 });
    s.addText(p.P, { x, y:0.82, w:3.07, h:0.42, fontSize:15, bold:true, color:C.white, align:"center", valign:"middle", margin:0 });

    s.addShape(pres.ShapeType.rect, { x, y:1.28, w:3.07, h:0.3, fill:{ color:C.dark } });
    s.addText("CAUSES", { x, y:1.28, w:3.07, h:0.3, fontSize:11, bold:true, color:C.gold, align:"center", valign:"middle", margin:0 });
    bullets(s, p.causes, x+0.08, 1.62, 2.9, 1.7, 11);

    s.addShape(pres.ShapeType.rect, { x, y:3.37, w:3.07, h:0.3, fill:{ color:p.color } });
    s.addText("MANAGEMENT", { x, y:3.37, w:3.07, h:0.3, fontSize:11, bold:true, color:C.white, align:"center", valign:"middle", margin:0 });
    bullets(s, p.mgmt, x+0.08, 3.72, 2.9, 1.82, 11);
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 31 – KEY TAKE-HOME MESSAGES
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:C.dark } });
  s.addShape(pres.ShapeType.rect, { x:0, y:0,   w:10, h:0.72, fill:{ color:C.mid  } });
  s.addShape(pres.ShapeType.rect, { x:0, y:5.3, w:10, h:0.325, fill:{ color:C.bright } });
  s.addText("Key Take-Home Points – Oxorn-Foote", {
    x:0.3, y:0, w:9.4, h:0.72, fontSize:19, bold:true, color:C.white, valign:"middle", margin:0
  });
  const pts = [
    "Oxorn-Foote's 4 Ps (Passenger, Passage, Powers, Placenta) form the organisational backbone of normal and abnormal obstetrics.",
    "The fetal skull: suboccipitobregmatic (9.5 cm) is the most favourable diameter; full flexion is essential for safe passage through the midplane.",
    "The gynaecoid pelvis (50%) is most favourable; the interspinous diameter (≥10 cm) is the critical narrowest plane in the birth canal.",
    "Triple descending gradient ensures coordinated uterine contractions: intensity and duration greatest at fundus; cervix dilates passively.",
    "7 cardinal movements (engagement → expulsion) are mechanically driven by the interplay of pelvic shape, fetal size, and uterine power; internal rotation is key.",
    "Active phase dilation: ≥1.2 cm/h nullipara, ≥1.5 cm/h multipara; crossing the action line on partograph demands urgent reassessment.",
    "AMTSL (oxytocin + CCT + uterine massage) is the standard third stage management; inspect placenta carefully for completeness.",
    "Fourth stage (first 2 h post-delivery) carries the highest PPH risk; monitor uterine tone, vitals, and lochia every 15 min.",
  ];
  pts.forEach((pt, i) => {
    const y = 0.82 + i * 0.57;
    s.addShape(pres.ShapeType.rect, { x:0.2, y:y+0.08, w:0.35, h:0.35, fill:{ color:C.gold }, rectRadius:0.04 });
    s.addText(`${i+1}`, { x:0.2, y:y+0.08, w:0.35, h:0.35, fontSize:11, bold:true, color:C.dark, align:"center", valign:"middle", margin:0 });
    s.addText(pt, { x:0.65, y, w:9.1, h:0.52, fontSize:12, color: i%2===0 ? "B8D8E8" : C.white, valign:"middle" });
  });
}

// ═════════════════════════════════════════════════════════════════════════════
// SLIDE 32 – REFERENCES
// ═════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  hdr(s, "References");
  s.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:4.905, fill:{ color:C.cream } });

  // Primary source highlight
  s.addShape(pres.ShapeType.rect, { x:0.2, y:0.85, w:9.6, h:0.8, fill:{ color:C.dark }, rectRadius:0.07 });
  s.addText([
    { text:"PRIMARY SOURCE: ", options:{ bold:true, color:C.gold } },
    { text:"Posner GD, Dy J, Black A, Jones GDA (Eds). Oxorn-Foote Human Labor & Birth, 7th Edition. McGraw-Hill; 2013. [Original: Oxorn H, Foote WR. Human Labor and Birth, 6th ed. 1986]", options:{ color:C.white } }
  ], { x:0.3, y:0.9, w:9.4, h:0.7, fontSize:13, valign:"middle" });

  const refs = [
    "Williams Obstetrics, 26th ed. (Cunningham et al.) – cardinal movements, stages of labour",
    "WHO Recommendations: Intrapartum care for a positive childbirth experience (2018) – AMTSL, support in labour",
    "ACOG Practice Bulletin No. 116: Intrapartum Fetal Heart Rate Monitoring (reaffirmed 2021)",
    "NICE Guideline NG235: Intrapartum Care for Healthy Women and Babies (2023)",
    "Friedman EA. Primigravid labor: a graphicostatistical analysis. Obstet Gynecol 1955;6:567",
    "Creasy & Resnik's Maternal-Fetal Medicine, 9th ed. (2023) – Labor monitoring, mechanisms",
    "Hofmeyr GJ et al. Cochrane review: Uterotonic agents for preventing postpartum haemorrhage (2019)",
    "Royal College of Obstetricians & Gynaecologists (RCOG): Green-top Guidelines – third/fourth degree perineal tears",
    "Caldwell WE, Moloy HC. Anatomical variations in the female pelvis. Am J Obstet Gynecol. 1933;26:479",
  ];
  refs.forEach((r, i) => {
    const y = 1.75 + i * 0.36;
    const bg = i%2===0 ? C.pale : C.lgray;
    s.addShape(pres.ShapeType.rect, { x:0.2, y, w:9.6, h:0.34, fill:{ color:bg } });
    s.addText(`${i+1}. ${r}`, { x:0.3, y:y+0.02, w:9.4, h:0.3, fontSize:11, color:C.charcoal, valign:"middle" });
  });
}

// SAVE
pres.writeFile({ fileName:"/home/daytona/workspace/normal-labour-ppt/Normal_Labour_OxornFoote.pptx" })
  .then(() => console.log("SUCCESS"))
  .catch(e => { console.error(e); process.exit(1); });
Running Command

cd /home/daytona/workspace/normal-labour-ppt && node oxorn_foote.js 2>&1

Editing File

~/normal-labour-ppt/oxorn_foote.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/normal-labour-ppt/oxorn_foote.js'
Editing File

~/normal-labour-ppt/oxorn_foote.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/normal-labour-ppt/oxorn_foote.js'
Running Command

cd /home/daytona/workspace/normal-labour-ppt && node oxorn_foote.js 2>&1

Running Command

ls -lh /home/daytona/workspace/normal-labour-ppt/Normal_Labour_OxornFoote.pptx

Your Oxorn-Foote presentation is ready:

Normal Labour OxornFoote

Presentation · PPTX


Here is a full breakdown of the 32 slides built around the Oxorn-Foote framework (navy/teal/gold colour scheme):
Slide(s)Oxorn-Foote ChapterContent
1-Title slide
2PrefaceAbout the book - 4 Ps philosophy, clinical approach
3-6Ch. 2-3: PassengerFetal skull bones, sutures & fontanelles; all skull diameters (SOB 9.5 cm → OM 13.5 cm); lie, presentation, attitude, position, denominator, station
7-10Ch. 1: PassageBony pelvis anatomy, true vs false pelvis, curve of Carus; all pelvic planes & obstetric diameters (inlet, midplane, outlet); Caldwell-Moloy classification with labour prognosis for each type
11-13Ch. 6 & 8: PowersTriple descending gradient, fundal dominance, polarity, retraction ring; cervical effacement (nullipara vs multipara sequence); cervical dilation with Friedman curve, Bishop score
14-15Ch. 7: PlacentaSchultze vs Matthews Duncan mechanisms; signs of placental separation (Calkin sign); AMTSL; placental inspection
16-20Ch. 10: MechanismsPrerequisites for normal labour (4 Ps); engagement & asynclitism (Naegele / Litzmann); 7 cardinal movements in full detail (step-by-step); vertex position variations (LOA, ROA, LOT/ROT, LOP/ROP)
21-25Ch. 11: Clinical CourseFirst stage - latent + active phases (Friedman rates); second stage - Ritgen manoeuvre, crowning, shoulder delivery, delayed cord clamping; episiotomy (selective approach, types, repair); perineal laceration grading (1st-4th degree); third + fourth stage management
26-27-Partograph components - alert line, action line, all 8 parameters
28-Fetal wellbeing - IA, CTG classification, FBS, scalp stimulation, cord gases
29-Analgesia - psychoprophylaxis, Entonox, pethidine, epidural, CSE, pudendal block
30-Dystocia - 3 Ps with causes + management for each
31-8 key take-home points
32-References (Oxorn-Foote 7th ed. as primary source + WHO, ACOG, NICE)

Ppt is perfect but add picture to this ppt for pictorical presentation

Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Searching Content

"cdn.orris.care" in /textbooks/9780323354783

Searching Content

"cdn.orris.care" in /textbooks/9781260019933

Searching Content

"cdn.orris.care" in /textbooks/9780323239905

Reading File
Reading File
Reading File
Reading File
Running Command

node /home/daytona/skills/shared/scripts/fetch_images.js \ "https://cdn.orris.care/cdss_images/7be931070d4b64abd7cd72a7998c9f52d51fbeec9af38e96869663cd5b4980f4.png" \ "https://cdn.orris.care/cdss_images/083c770538011e907f4d95e79940098bd93a9fde3a1adcf6c6f9b51207df8ae1.png" \ "https://cdn.orris.care/cdss_images/3766438e0dc70cac2789400c9a7b4c16b98a1fa02bebde8a8cbf2915b6b72c38.png" \ 2>&1 | head -5

!

An error occurred (ValidationException) when calling the ConverseStream operation: The model returned the following errors: prompt is too long: 215908 tokens > 200000 maximum

We encountered an error while processing your request. Please try again or reach out to us for help.

Try again plz

It looks like the conversation summary hit a token limit error. Could you let me know what you'd like help with? I'm ready to assist fresh from here!

Add pictures to previous ppt

Asking for Preferences
Reading File
Reading File
Running Command

cd /home/daytona/workspace && python -m markitdown /home/daytona/workspace/attachments/838f0044-94f6-4b76-8fc9-a5159983b1b8/Normal_Labour_OxornFoote.pptx 2>/dev/null | head -200

Running Command

cd /home/daytona/skills/pptx && python scripts/thumbnail.py /home/daytona/workspace/attachments/838f0044-94f6-4b76-8fc9-a5159983b1b8/Normal_Labour_OxornFoote.pptx 2>&1 | head -30

Loading Image
Running Command

cd /home/daytona/skills/pptx && python scripts/office/unpack.py /home/daytona/workspace/attachments/838f0044-94f6-4b76-8fc9-a5159983b1b8/Normal_Labour_OxornFoote.pptx /home/daytona/workspace/normal_labour_unpacked/ 2>&1 | tail -20

Running Command

unzip -o /home/daytona/workspace/attachments/838f0044-94f6-4b76-8fc9-a5159983b1b8/Normal_Labour_OxornFoote.pptx -d /home/daytona/workspace/normal_labour_unpacked/ 2>&1 | tail -10

Running Command

ls -lh /home/daytona/workspace/attachments/838f0044-94f6-4b76-8fc9-a5159983b1b8/Normal_Labour_OxornFoote.pptx

Running Command

cp /home/daytona/workspace/attachments/838f0044-94f6-4b76-8fc9-a5159983b1b8/Normal_Labour_OxornFoote.pptx /home/daytona/workspace/Normal_Labour_OxornFoote.pptx && ls -lh /home/daytona/workspace/Normal_Labour_OxornFoote.pptx

Running Command

mkdir -p /home/daytona/workspace/nl_unpacked && unzip /home/daytona/workspace/Normal_Labour_OxornFoote.pptx -d /home/daytona/workspace/nl_unpacked/ 2>&1 | tail -5

Running Command

ls /home/daytona/workspace/nl_unpacked/ppt/slides/ | head -40

Running Command

for i in $(seq 1 32); do echo "=== SLIDE $i ==="; python3 -c " import xml.etree.ElementTree as ET tree = ET.parse('/home/daytona/workspace/nl_unpacked/ppt/slides/slide${i}.xml') ns = {'a': 'http://schemas.openxmlformats.org/drawingml/2006/main', 'p': 'http://schemas.openxmlformats.org/presentationml/2006/main'} texts = [] for t in tree.findall('.//a:t', ns): if t.text and t.text.strip(): texts.append(t.text.strip()) print(' | '.join(texts[:8])) " 2>/dev/null; done

Writing File

~/add_images_to_pptx.py

"""
Add relevant images to Normal_Labour_OxornFoote.pptx using python-pptx.
Images are fetched from Wikimedia Commons (public domain / CC licensed).
"""

import io
import os
import urllib.request
from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor

INPUT_PATH  = "/home/daytona/workspace/Normal_Labour_OxornFoote.pptx"
OUTPUT_PATH = "/home/daytona/workspace/Normal_Labour_OxornFoote_with_images.pptx"

# (slide_index 0-based, image_url, left_in, top_in, width_in, height_in)
# We keep images small/medium and placed in lower-right or right column
# so they don't cover the text content.
SLIDE_IMAGES = {
    # Slide 4 (idx 3): Fetal skull bones/sutures
    3: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/9/97/Gray193.png/400px-Gray193.png",
        5.8, 1.2, 3.8, 3.2
    ),
    # Slide 5 (idx 4): Fetal skull diameters
    4: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8c/Fetal_skull_anterior_diagram.svg/400px-Fetal_skull_anterior_diagram.svg.png",
        5.8, 1.5, 3.8, 3.0
    ),
    # Slide 6 (idx 5): Lie/presentation/position
    5: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Fetal_presentation_-_cephalic_presentations.png/400px-Fetal_presentation_-_cephalic_presentations.png",
        5.8, 1.5, 3.8, 3.2
    ),
    # Slide 8 (idx 7): Bony pelvis
    7: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Gray241.png/400px-Gray241.png",
        5.8, 1.2, 3.8, 3.5
    ),
    # Slide 9 (idx 8): Pelvic planes & diameters
    8: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/Gray243.png/400px-Gray243.png",
        5.8, 1.5, 3.8, 3.2
    ),
    # Slide 10 (idx 9): Caldwell-Moloy pelvic types
    9: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Caldwell_Moloy_pelvis_types.jpg/400px-Caldwell_Moloy_pelvis_types.jpg",
        5.8, 1.5, 3.8, 3.0
    ),
    # Slide 12 (idx 11): Uterine contractions / CTG trace
    11: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2b/Cardiotocography_output.jpg/400px-Cardiotocography_output.jpg",
        5.8, 1.5, 3.8, 3.0
    ),
    # Slide 13 (idx 12): Cervical effacement and dilation
    12: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Cervical_dilation_and_effacement.jpg/400px-Cervical_dilation_and_effacement.jpg",
        5.8, 1.5, 3.8, 3.0
    ),
    # Slide 15 (idx 14): Placental separation
    14: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Placenta_labeled.jpg/400px-Placenta_labeled.jpg",
        5.8, 1.2, 3.8, 3.2
    ),
    # Slide 18 (idx 17): Engagement of fetal head
    17: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e2/Engagement_of_fetal_head.png/400px-Engagement_of_fetal_head.png",
        5.8, 1.5, 3.8, 3.2
    ),
    # Slide 19 (idx 18): Cardinal movements of labour
    18: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Cardinal_movements_of_labor.jpg/400px-Cardinal_movements_of_labor.jpg",
        5.8, 1.0, 3.8, 4.0
    ),
    # Slide 22 (idx 21): First stage of labour / Friedman curve
    21: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Friedman_labor_curve.svg/400px-Friedman_labor_curve.svg.png",
        5.8, 1.5, 3.8, 3.2
    ),
    # Slide 23 (idx 22): Second stage
    22: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/7/7a/Crowning_of_baby%27s_head_during_birth.jpg/400px-Crowning_of_baby%27s_head_during_birth.jpg",
        5.8, 1.5, 3.8, 3.0
    ),
    # Slide 24 (idx 23): Episiotomy types
    23: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Episiotomy_-_types.jpg/400px-Episiotomy_-_types.jpg",
        5.8, 1.5, 3.8, 3.2
    ),
    # Slide 25 (idx 24): Third stage / placenta expulsion
    24: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Schultze_vs_Duncan_placenta.jpg/400px-Schultze_vs_Duncan_placenta.jpg",
        5.8, 1.5, 3.8, 3.0
    ),
    # Slide 27 (idx 26): WHO Partograph
    26: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/WHO_partograph_example.png/400px-WHO_partograph_example.png",
        5.8, 1.2, 3.8, 3.5
    ),
    # Slide 28 (idx 27): CTG monitoring
    27: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2b/Cardiotocography_output.jpg/400px-Cardiotocography_output.jpg",
        5.8, 1.5, 3.8, 3.0
    ),
    # Slide 29 (idx 28): Analgesia / epidural
    28: (
        "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9c/Epidural_anatomy.jpg/400px-Epidural_anatomy.jpg",
        5.8, 1.5, 3.8, 3.0
    ),
}

# Fallback: a universally accessible medical illustration if Wikimedia images fail
# We'll use an alternative well-known public URL
FALLBACK_URLS = {
    3:  "https://upload.wikimedia.org/wikipedia/commons/thumb/9/97/Gray193.png/320px-Gray193.png",
    7:  "https://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Gray241.png/320px-Gray241.png",
    8:  "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/Gray243.png/320px-Gray243.png",
}

headers = {
    "User-Agent": "Mozilla/5.0 (compatible; PresentationBot/1.0)"
}

def fetch_image_bytes(url):
    req = urllib.request.Request(url, headers=headers)
    try:
        with urllib.request.urlopen(req, timeout=15) as resp:
            data = resp.read()
            if len(data) < 500:
                return None
            return io.BytesIO(data)
    except Exception as e:
        print(f"  FETCH FAILED: {url} -> {e}")
        return None

def add_image_to_slide(slide, img_bytes, left, top, width, height):
    slide.shapes.add_picture(
        img_bytes,
        Inches(left), Inches(top),
        Inches(width), Inches(height)
    )

prs = Presentation(INPUT_PATH)
slides = prs.slides

print(f"Presentation loaded: {len(slides)} slides")

success = 0
fail = 0

for slide_idx, (url, left, top, width, height) in SLIDE_IMAGES.items():
    if slide_idx >= len(slides):
        print(f"  Slide {slide_idx+1} does not exist, skipping")
        continue
    slide = slides[slide_idx]
    print(f"  Slide {slide_idx+1}: fetching {url}")
    img = fetch_image_bytes(url)
    if img is None and slide_idx in FALLBACK_URLS:
        print(f"  Slide {slide_idx+1}: trying fallback URL")
        img = fetch_image_bytes(FALLBACK_URLS[slide_idx])
    if img is None:
        print(f"  Slide {slide_idx+1}: SKIPPED (could not fetch image)")
        fail += 1
        continue
    try:
        add_image_to_slide(slide, img, left, top, width, height)
        print(f"  Slide {slide_idx+1}: image added OK")
        success += 1
    except Exception as e:
        print(f"  Slide {slide_idx+1}: error adding image: {e}")
        fail += 1

print(f"\nDone. {success} images added, {fail} skipped.")
prs.save(OUTPUT_PATH)
print(f"Saved: {OUTPUT_PATH}")
Running Command

cd /home/daytona/workspace && python add_images_to_pptx.py 2>&1

Running Command

which python3 && python3 -c "import pptx; print('pptx OK')" 2>&1; python3 -c "import pptx" 2>&1 || pip install --user python-pptx 2>&1 | tail -5

Running Command

cd /home/daytona/workspace && python3 add_images_to_pptx.py 2>&1

Running Command

# Test direct Wikimedia file URLs (not thumbnail) python3 -c " import urllib.request, io headers = {'User-Agent': 'Mozilla/5.0'} urls = [ 'https://upload.wikimedia.org/wikipedia/commons/9/97/Gray193.png', 'https://upload.wikimedia.org/wikipedia/commons/f/f1/Gray241.png', ] for url in urls: req = urllib.request.Request(url, headers=headers) try: with urllib.request.urlopen(req, timeout=10) as r: data = r.read() print(f'OK {len(data)} bytes: {url}') except Exception as e: print(f'FAIL: {url}: {e}') " 2>&1 # Also test the save path python3 -c " from pptx import Presentation import io prs = Presentation('/home/daytona/workspace/Normal_Labour_OxornFoote.pptx') buf = io.BytesIO() prs.save(buf) buf.seek(0) with open('/home/daytona/workspace/test_save.pptx','wb') as f: f.write(buf.read()) import os; print('save OK, size:', os.path.getsize('/home/daytona/workspace/test_save.pptx')) " 2>&1

Running Command

python3 -c " from PIL import Image, ImageDraw, ImageFont import io, os # test pillow img = Image.new('RGB', (400, 300), color=(70, 130, 180)) d = ImageDraw.Draw(img) d.text((10,10), 'TEST', fill=(255,255,255)) buf = io.BytesIO() img.save(buf, format='PNG') print('Pillow OK, size:', len(buf.getvalue())) " 2>&1

Model call limits exceeded: run limit (20/20)

What to do to add pics

The sandbox environment can't fetch images from external URLs (Wikimedia blocks requests from this server). Here are your options:

Option 1: You provide the images (Easiest)

Upload the image files you want added here. Tell me:
  • Which slide number each image goes on
  • I'll place them in the right position automatically

Option 2: Tell me what images you want and I'll generate them

I can generate AI illustrations for each slide topic (fetal skull, pelvis, cardinal movements, CTG trace, etc.) using the built-in image generator, then embed them into the PPTX.
Just say "generate images" and I'll:
  1. Generate a relevant medical illustration for each key slide
  2. Download them into the sandbox
  3. Embed them all into your PPTX
  4. Give you the final file to download

Option 3: Do it manually in PowerPoint

If you prefer to add images yourself:
  1. Open the PPTX in PowerPoint / LibreOffice
  2. Go to Insert → Pictures
  3. Select your image file
  4. Resize and position on the slide

My recommendation: Option 2 - I can generate appropriate medical diagrams for slides like:
  • Fetal skull anatomy (Slide 4-5)
  • Bony pelvis / Caldwell-Moloy types (Slides 8-10)
  • Cardinal movements of labour (Slide 19)
  • Cervical dilation / Friedman curve (Slides 13, 22)
  • CTG trace (Slides 12, 28)
  • Partograph (Slide 27)
Want me to go ahead with that?

Yes

Generating Image

Medical diagram of fetal skull anatomy showing bones (frontal, parietal, occipital, temporal), sutures (sagittal, coronal, lambdoid, frontal), and fontanelles (anterior bregma, posterior lambda). Clean labeled educational diagram on white background.

Generating Image

Medical diagram of fetal skull diameters showing suboccipitobregmatic (9.5cm), occipitofrontal (11.5cm), and suboccipitofrontal (10cm) diameters. Side profile view with measurement lines and labels. Clean educational obstetrics diagram on white background.

Generating Image

Medical obstetrics diagram showing fetal lie and presentation types: longitudinal vs transverse lie, and cephalic (vertex, brow, face) vs breech presentations. Clean labeled educational diagram on white background.

Generating Image

Anatomical diagram of the female bony pelvis showing inlet, outlet, true vs false pelvis, sacrum, coccyx, ischial spines, and obstetric conjugate diameter. Labeled educational diagram for obstetrics on white background.

Generating Image

Caldwell-Moloy pelvic classification diagram showing four pelvic types: gynaecoid (round, 50%), android (heart-shaped), anthropoid (oval AP), and platypelloid (flat oval). Each type shown from above with labels and approximate incidence. Clean medical educational diagram.

Generating Image

CTG cardiotocography trace showing uterine contractions on lower channel and fetal heart rate on upper channel. Shows normal baseline 110-160 bpm, variability, accelerations, and a late deceleration. Educational obstetrics diagram with labels.

Generating Image

Medical diagram showing cervical effacement and dilation progression: uneffaced cervix (3-4cm long), 50% effaced, 100% effaced, then dilation from 1cm to 10cm (fully dilated). Sequential stages shown with cross-sectional views and labels. Obstetrics educational diagram.

Generating Image

Medical diagram showing the seven cardinal movements of labor for vertex presentation: engagement, descent, flexion, internal rotation, extension, external rotation (restitution), and expulsion. Sequential side-view diagrams of fetal head through pelvis with arrows and labels. Clean educational obstetrics illustration.

Generating Image

Friedman labor curve graph showing normal cervical dilation over time. X-axis is time in hours, Y-axis is cervical dilation 0-10cm. Shows latent phase (slow), active phase acceleration, and transition phase. Nullipara curve labeled. Educational obstetrics graph on white background.

Generating Image

WHO partograph diagram showing labor monitoring chart with: fetal heart rate section (top), cervical dilation plot with alert and action lines, descent of head, contractions section, and maternal vitals. Educational obstetrics monitoring chart.

What to di next

Generating Image

Medical diagram of fetal skull anatomy showing bones (frontal, parietal, occipital, temporal), sutures (sagittal, coronal, lambdoid), and fontanelles (anterior bregma, posterior lambda). Clean labeled educational diagram on white background.

Generating Image

Medical diagram of fetal skull diameters: suboccipitobregmatic 9.5cm, occipitofrontal 11.5cm, suboccipitofrontal 10cm. Side profile view with measurement lines and labels. Clean educational obstetrics diagram on white background.

Generating Image

Obstetrics diagram showing fetal presentations: vertex cephalic, brow, face, frank breech, complete breech, footling breech, and transverse lie. Each shown as small labeled uterus cross-section. Educational diagram on white background.

Generating Image

Anatomical diagram of female bony pelvis showing inlet, outlet, true vs false pelvis, sacrum, coccyx, ischial spines, pubic symphysis, and obstetric conjugate. Labeled educational obstetrics diagram on white background.

Generating Image

Caldwell-Moloy pelvic classification showing four types from above: gynaecoid (round, 50%), android (heart-shaped, 20%), anthropoid (oval AP, 25%), platypelloid (flat transverse oval, 5%). Each labeled with type name and incidence. Clean medical diagram.

Generating Image

CTG cardiotocography strip showing fetal heart rate (top trace, baseline 140bpm with variability and accelerations) and uterine contractions (bottom trace). Shows one late deceleration labeled. Educational obstetrics monitoring diagram.

Generating Image

Medical diagram showing cervical effacement and dilation stages: uneffaced long cervix, 50% effaced, fully effaced, then dilating from 1cm to 10cm fully dilated. Cross-section views in sequence with labels. Obstetrics educational diagram on white background.

Generating Image

Seven cardinal movements of labor diagram: 1-Engagement, 2-Descent, 3-Flexion, 4-Internal rotation, 5-Extension, 6-External rotation/restitution, 7-Expulsion. Sequential side-view illustrations of fetal head through maternal pelvis with arrows. Clean educational obstetrics diagram.

Generating Image

Friedman labor curve graph. X-axis: time in hours (0-20). Y-axis: cervical dilation 0-10cm. Shows S-shaped curve with labeled phases: latent phase (flat, 0-3cm), active phase acceleration (steep rise 3-8cm), deceleration phase, and second stage. Clear grid lines and axis labels. Educational obstetrics graph.

This is a shared conversation. Sign in to Orris to start your own chat.