Make a PowerPoint presentation on the ante partum haemorrhage
ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or missing"
mkdir -p /home/daytona/workspace/aph-presentation
~/aph-presentation/build.js
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Antepartum Haemorrhage";
pres.author = "Medical Education";
// === COLOUR PALETTE ===
const C = {
darkBg: "1A2340", // deep navy – title / section slides
midBg: "1E3A5F", // mid-navy
accent: "E84C4C", // crimson-red (obstetric urgency)
gold: "F0A500", // amber accent
white: "FFFFFF",
lightGrey: "F0F4FA",
bodyText: "1A2340",
card1: "2E4E7E", // card background
card2: "C0392B",
card3: "16A085",
card4: "8E44AD",
teal: "17A589",
orange: "E67E22",
};
// ── helpers ──────────────────────────────────────────────────────────────────
function darkBg(slide) {
slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.darkBg }, line: { color: C.darkBg } });
}
function sectionHeader(slide, label) {
slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.midBg }, line: { color: C.midBg } });
slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 2.3, w: 10, h: 1.0, fill: { color: C.accent }, line: { color: C.accent } });
slide.addText(label, {
x: 0.5, y: 2.35, w: 9, h: 0.9,
fontSize: 32, bold: true, color: C.white, align: "center", valign: "middle", margin: 0
});
}
function slideTitle(slide, title, sub = "") {
// top accent bar
slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.55, fill: { color: C.accent }, line: { color: C.accent } });
slide.addText(title, {
x: 0.35, y: 0.6, w: 9.3, h: 0.65,
fontSize: 20, bold: true, color: C.bodyText, margin: 0
});
if (sub) {
slide.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: 1.28, w: 1.6, h: 0.05, fill: { color: C.accent }, line: { color: C.accent } });
}
}
function bulletBlock(slide, items, opts = {}) {
const defaults = { x: 0.4, y: 1.5, w: 9.2, h: 3.7, fontSize: 14, color: C.bodyText };
const o = { ...defaults, ...opts };
const richText = items.map((item, i) => {
const isLast = i === items.length - 1;
if (item.sub) {
return { text: " • " + item.text, options: { fontSize: o.fontSize - 1, color: "444444", breakLine: !isLast } };
}
return { text: item.text, options: { bullet: { code: "25CF", indent: 12 }, fontSize: o.fontSize, bold: item.bold || false, color: o.color, breakLine: !isLast } };
});
slide.addText(richText, { x: o.x, y: o.y, w: o.w, h: o.h, valign: "top" });
}
function infoCard(slide, x, y, w, h, title, body, bgColor) {
slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x, y, w, h,
fill: { color: bgColor },
line: { color: bgColor },
rectRadius: 0.12,
shadow: { type: "outer", color: "000000", blur: 8, offset: 3, angle: 135, opacity: 0.18 }
});
slide.addText(title, { x: x + 0.12, y: y + 0.1, w: w - 0.24, h: 0.35, fontSize: 12, bold: true, color: C.white, margin: 0 });
slide.addText(body, { x: x + 0.12, y: y + 0.45, w: w - 0.24, h: h - 0.55, fontSize: 11, color: C.white, valign: "top", margin: 0 });
}
function footnote(slide, text) {
slide.addText(text, { x: 0.3, y: 5.28, w: 9.4, h: 0.3, fontSize: 8, color: "888888", italic: true });
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 1 – Title
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
darkBg(s);
// decorative red arc-like shape
s.addShape(pres.shapes.RECTANGLE, { x: 7.8, y: 0, w: 2.2, h: 5.625, fill: { color: C.accent }, line: { color: C.accent } });
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 4.5, w: 10, h: 0.08, fill: { color: C.gold }, line: { color: C.gold } });
s.addText("ANTEPARTUM", { x: 0.5, y: 1.0, w: 7, h: 0.75, fontSize: 40, bold: true, color: C.white, charSpacing: 6, margin: 0 });
s.addText("HAEMORRHAGE", { x: 0.5, y: 1.75, w: 7, h: 0.75, fontSize: 40, bold: true, color: C.gold, charSpacing: 6, margin: 0 });
s.addText("A Comprehensive Clinical Overview", {
x: 0.5, y: 2.65, w: 7, h: 0.4, fontSize: 14, color: "AABBD0", italic: true, margin: 0
});
// icon-style info strip
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 3.3, w: 6.8, h: 0.9, fill: { color: "253554" }, line: { color: "253554" }, rectRadius: 0.1 });
s.addText([
{ text: "Definition | ", options: { bold: true, color: C.gold } },
{ text: "Causes | ", options: { bold: true, color: C.gold } },
{ text: "Diagnosis | ", options: { bold: true, color: C.gold } },
{ text: "Management", options: { bold: true, color: C.gold } }
], { x: 0.5, y: 3.35, w: 6.8, h: 0.8, align: "center", valign: "middle", fontSize: 12, margin: 0 });
s.addText("Source: Barash Clinical Anesthesia 9e • Rosen's Emergency Medicine • Morgan & Mikhail 7e",
{ x: 0.5, y: 5.2, w: 7, h: 0.3, fontSize: 8, color: "5577AA", italic: true });
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 2 – Outline / Contents
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.accent }, line: { color: C.accent } });
s.addText("CONTENTS", {
x: 0.5, y: 0.25, w: 9, h: 0.55, fontSize: 26, bold: true, color: C.darkBg, charSpacing: 4, margin: 0
});
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.85, w: 8.5, h: 0.04, fill: { color: C.accent }, line: { color: C.accent } });
const topics = [
"01 Definition & Incidence",
"02 Classification",
"03 Placenta Previa – Causes, Features & Management",
"04 Placental Abruption – Causes, Features & Management",
"05 Vasa Praevia & Other Causes",
"06 Investigations",
"07 Emergency Management",
"08 Anaesthesia Considerations",
"09 Complications & Outcomes",
];
const richText = topics.map((t, i) => ({
text: t,
options: { fontSize: 13, color: i % 2 === 0 ? C.darkBg : C.midBg, bold: i % 2 === 0, breakLine: i < topics.length - 1 }
}));
s.addText(richText, { x: 0.7, y: 1.0, w: 8.8, h: 4.3, valign: "top", lineSpacingMultiple: 1.35 });
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 3 – Section: Definition & Incidence
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
sectionHeader(s, "DEFINITION & INCIDENCE");
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 4 – Definition & Incidence
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Definition & Incidence");
// Definition box
s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x: 0.4, y: 1.5, w: 9.2, h: 1.35,
fill: { color: C.darkBg }, line: { color: C.darkBg }, rectRadius: 0.1
});
s.addText([
{ text: "Definition: ", options: { bold: true, color: C.gold } },
{ text: "Antepartum haemorrhage (APH) is defined as bleeding from the genital tract at or after 24 weeks of gestation and before delivery of the baby.", options: { color: C.white } }
], { x: 0.55, y: 1.55, w: 9.0, h: 1.2, fontSize: 13.5, valign: "middle" });
// Stats row
const stats = [
{ val: "3–5%", label: "of all pregnancies affected" },
{ val: "#1", label: "leading cause of maternal mortality" },
{ val: "9–12%", label: "perinatal mortality in abruption" },
{ val: ">28 wks", label: "most cases occur in 3rd trimester" },
];
stats.forEach((st, i) => {
const x = 0.4 + i * 2.3;
s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x, y: 3.0, w: 2.1, h: 1.5,
fill: { color: i === 1 ? C.accent : C.card1 }, line: { color: "transparent" }, rectRadius: 0.1
});
s.addText(st.val, { x: x + 0.05, y: 3.05, w: 2.0, h: 0.65, fontSize: 20, bold: true, color: C.gold, align: "center", margin: 0 });
s.addText(st.label, { x: x + 0.05, y: 3.7, w: 2.0, h: 0.7, fontSize: 10, color: C.white, align: "center", margin: 0 });
});
footnote(s, "Sources: Barash Clinical Anesthesia 9e; Rosen's Emergency Medicine");
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 5 – Classification
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Classification of APH");
const causes = [
{ title: "Placenta Previa", pct: "~30%", body: "Abnormal implantation over/near the cervical os. Painless, bright-red bleeding.", col: C.accent },
{ title: "Placental Abruption", pct: "~30%", body: "Premature separation of normally-sited placenta. Painful, dark blood; may be concealed.", col: C.card1 },
{ title: "Vasa Praevia", pct: "Rare", body: "Fetal vessels traverse the membranes over the os. High fetal mortality if ruptured.", col: C.teal },
{ title: "Local / Unclassified", pct: "~40%", body: "Cervical ectropion, polyp, genital lesion, or indeterminate cause.", col: C.orange },
];
causes.forEach((c, i) => {
const x = 0.35 + (i % 2) * 4.75;
const y = i < 2 ? 1.45 : 3.2;
s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x, y, w: 4.4, h: 1.6,
fill: { color: c.col }, line: { color: c.col }, rectRadius: 0.12,
shadow: { type: "outer", color: "000000", blur: 6, offset: 2, angle: 135, opacity: 0.2 }
});
s.addText([
{ text: c.title + " ", options: { bold: true, fontSize: 13, color: C.white } },
{ text: c.pct, options: { fontSize: 11, color: C.gold } }
], { x: x + 0.15, y: y + 0.12, w: 4.1, h: 0.35, margin: 0 });
s.addText(c.body, { x: x + 0.15, y: y + 0.52, w: 4.1, h: 1.0, fontSize: 11, color: C.white, valign: "top", margin: 0 });
});
footnote(s, "~40% of APH cases have no identifiable placental cause and are classified as indeterminate.");
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 6 – Section: Placenta Previa
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
sectionHeader(s, "PLACENTA PREVIA");
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 7 – Placenta Previa – Definition & Types
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Placenta Previa – Types");
const types = [
{ name: "Type I – Low-lying", desc: "Lower segment, does not reach internal os" },
{ name: "Type II – Marginal", desc: "Placental edge reaches but does not cover the os" },
{ name: "Type III – Partial", desc: "Partially covers the internal os" },
{ name: "Type IV – Complete / Central", desc: "Entirely covers the internal os; most severe. ~20% of previa cases. Risk of exsanguination." },
];
types.forEach((t, i) => {
const y = 1.5 + i * 0.95;
const barColor = [C.teal, C.gold, C.orange, C.accent][i];
s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: y, w: 0.12, h: 0.7, fill: { color: barColor }, line: { color: barColor } });
s.addText(t.name, { x: 0.6, y: y, w: 3.8, h: 0.32, fontSize: 13, bold: true, color: C.darkBg, margin: 0 });
s.addText(t.desc, { x: 0.6, y: y + 0.33, w: 9.0, h: 0.32, fontSize: 11, color: "334466", margin: 0 });
});
s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x: 0.35, y: 5.15, w: 9.3, h: 0.35,
fill: { color: C.accent }, line: { color: C.accent }, rectRadius: 0.05
});
s.addText("Most cases of mid-trimester previa resolve as the lower uterine segment elongates before delivery.",
{ x: 0.4, y: 5.16, w: 9.2, h: 0.33, fontSize: 10, color: C.white, align: "center", margin: 0 });
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 8 – Placenta Previa – Risk Factors & Clinical Features
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Placenta Previa – Risk Factors & Clinical Features");
// Left panel – Risk factors
s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x: 0.35, y: 1.3, w: 4.5, h: 4.0,
fill: { color: C.card1 }, line: { color: C.card1 }, rectRadius: 0.12
});
s.addText("RISK FACTORS", { x: 0.5, y: 1.38, w: 4.2, h: 0.35, fontSize: 12, bold: true, color: C.gold, margin: 0 });
const rf = [
"Previous caesarean section (dose-dependent risk)",
"Prior uterine surgery / myomectomy",
"Multiparity",
"Advanced maternal age (AMA)",
"Multiple gestation (twins/triplets)",
"Tobacco / cocaine use",
"Prior placenta previa",
"Assisted reproductive techniques",
];
const rfRich = rf.map((r, i) => ({ text: r, options: { bullet: true, fontSize: 11, color: C.white, breakLine: i < rf.length - 1 } }));
s.addText(rfRich, { x: 0.5, y: 1.8, w: 4.2, h: 3.3, valign: "top" });
// Right panel – Clinical features
s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x: 5.15, y: 1.3, w: 4.5, h: 4.0,
fill: { color: C.darkBg }, line: { color: C.darkBg }, rectRadius: 0.12
});
s.addText("CLINICAL FEATURES", { x: 5.3, y: 1.38, w: 4.2, h: 0.35, fontSize: 12, bold: true, color: C.gold, margin: 0 });
const cf = [
{ text: "Painless bright-red vaginal bleeding", bold: true },
{ text: "Usually after 28 weeks gestation" },
{ text: "Sentinel bleed – typically self-limited first episode" },
{ text: "No uterine tenderness / hypertonus" },
{ text: "Malpresentation or high presenting part common" },
{ text: "Uterine irritability in ~20% cases" },
{ text: "Digital cervical exam CONTRAINDICATED", bold: true },
];
const cfRich = cf.map((c, i) => ({
text: c.text,
options: { bullet: true, fontSize: 11, color: c.bold ? C.gold : C.white, bold: c.bold || false, breakLine: i < cf.length - 1 }
}));
s.addText(cfRich, { x: 5.3, y: 1.8, w: 4.2, h: 3.3, valign: "top" });
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 9 – Placenta Previa – Diagnosis & Management
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Placenta Previa – Diagnosis & Management");
// Diagnosis
s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: 1.3, w: 9.3, h: 0.35, fill: { color: C.teal }, line: { color: C.teal } });
s.addText("DIAGNOSIS", { x: 0.4, y: 1.32, w: 9.2, h: 0.3, fontSize: 12, bold: true, color: C.white, margin: 0 });
s.addText([
{ text: "• Transabdominal ultrasound ", options: { bold: true } },
{ text: "(first-line; empty bladder to avoid false positive)\n", options: {} },
{ text: "• Transvaginal ultrasound ", options: { bold: true } },
{ text: "(safe, more accurate for os relationships; preferred when diagnosis uncertain)\n", options: {} },
{ text: "• MRI ", options: { bold: true } },
{ text: "(if placenta accreta spectrum suspected)", options: {} }
], { x: 0.4, y: 1.7, w: 9.2, h: 1.0, fontSize: 11.5, color: C.darkBg });
// Management
s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: 2.85, w: 9.3, h: 0.35, fill: { color: C.accent }, line: { color: C.accent } });
s.addText("MANAGEMENT", { x: 0.4, y: 2.87, w: 9.2, h: 0.3, fontSize: 12, bold: true, color: C.white, margin: 0 });
const mgmt = [
{ head: "Expectant (remote from term):", body: "Admit to high-risk unit; IV access; type & crossmatch; fetal monitoring; avoid digital exam" },
{ head: "Haemostasis:", body: "2 large-bore IV lines; fluid resuscitation; CBC, coags, fibrinogen; Rh-negative → Rh immunoglobulin 300 µg" },
{ head: "Delivery:", body: "Caesarean section is mandatory if previa persists at term; vaginal delivery is CONTRAINDICATED" },
{ head: "Anaesthesia:", body: "Neuraxial (spinal/epidural) preferred over GA when haemodynamically stable. GA = greater blood loss" },
];
mgmt.forEach((m, i) => {
const y = 3.28 + i * 0.52;
s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: y, w: 0.1, h: 0.38, fill: { color: C.gold }, line: { color: C.gold } });
s.addText([
{ text: m.head + " ", options: { bold: true, color: C.darkBg } },
{ text: m.body, options: { color: "334466" } }
], { x: 0.55, y: y, w: 9.1, h: 0.44, fontSize: 10.5, valign: "middle" });
});
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 10 – Section: Placental Abruption
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
sectionHeader(s, "PLACENTAL ABRUPTION");
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 11 – Placental Abruption – Definition & Risk Factors
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Placental Abruption – Definition & Risk Factors");
s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x: 0.4, y: 1.3, w: 9.2, h: 1.1,
fill: { color: C.darkBg }, line: { color: C.darkBg }, rectRadius: 0.1
});
s.addText([
{ text: "Definition: ", options: { bold: true, color: C.gold } },
{ text: "Premature separation of a normally-sited placenta from the uterine wall before delivery of the fetus. Complicates approximately 1% of deliveries, typically in the final 10 weeks of gestation.", options: { color: C.white } }
], { x: 0.55, y: 1.35, w: 9.0, h: 1.0, fontSize: 12.5, valign: "middle" });
// Types of abruption
const types = [
{ label: "Revealed", desc: "Blood tracks between membranes and cervix; visible externally (80%)" },
{ label: "Concealed", desc: "Blood retained behind placenta; no external bleeding (~20%); most dangerous" },
{ label: "Mixed", desc: "Partial concealed / partial revealed" },
];
types.forEach((t, i) => {
const x = 0.4 + i * 3.15;
const col = [C.teal, C.accent, C.orange][i];
s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y: 2.55, w: 2.9, h: 1.0, fill: { color: col }, line: { color: col }, rectRadius: 0.1 });
s.addText(t.label, { x: x + 0.1, y: 2.6, w: 2.7, h: 0.3, fontSize: 12, bold: true, color: C.white, margin: 0 });
s.addText(t.desc, { x: x + 0.1, y: 2.93, w: 2.7, h: 0.55, fontSize: 10, color: C.white, margin: 0 });
});
// Risk factors
s.addShape(pres.shapes.RECTANGLE, { x: 0.4, y: 3.7, w: 9.2, h: 0.28, fill: { color: C.card1 }, line: { color: C.card1 } });
s.addText("KEY RISK FACTORS", { x: 0.5, y: 3.72, w: 9.0, h: 0.25, fontSize: 11, bold: true, color: C.gold, margin: 0 });
const rf2 = "Hypertension / Preeclampsia • Tobacco use • Cocaine use • Abdominal trauma • Multiple gestation • Advanced maternal age • PPROM • Prior abruption";
s.addText(rf2, { x: 0.4, y: 4.05, w: 9.2, h: 0.6, fontSize: 11.5, color: C.darkBg, align: "center" });
footnote(s, "Maternal mortality <1%; perinatal mortality 9–12% in developed countries (Barash Clinical Anesthesia 9e)");
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 12 – Placental Abruption – Clinical Features & Grading
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Placental Abruption – Clinical Features");
// Clinical features column
s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.35, y: 1.3, w: 4.6, h: 4.0, fill: { color: C.darkBg }, line: { color: C.darkBg }, rectRadius: 0.1 });
s.addText("CLINICAL FEATURES", { x: 0.5, y: 1.38, w: 4.3, h: 0.3, fontSize: 12, bold: true, color: C.gold, margin: 0 });
const cf2 = [
{ text: "Painful uterine contractions (sudden onset)", bold: true },
{ text: "Uterine tenderness and hypertonus" },
{ text: "Dark, clotted vaginal bleeding" },
{ text: "Bleeding may be concealed (no visible blood)" },
{ text: "Maternal hypovolaemia / shock if severe" },
{ text: "Signs of fetal distress (CTG changes)" },
{ text: "50% separation → likely stillbirth", bold: true },
{ text: "DIC risk in severe cases", bold: true },
];
const cf2Rich = cf2.map((c, i) => ({
text: c.text,
options: { bullet: true, fontSize: 11, color: c.bold ? C.gold : C.white, bold: c.bold || false, breakLine: i < cf2.length - 1 }
}));
s.addText(cf2Rich, { x: 0.5, y: 1.75, w: 4.3, h: 3.4, valign: "top" });
// Grading table (right)
s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 5.2, y: 1.3, w: 4.45, h: 4.0, fill: { color: "F7F9FC" }, line: { color: C.card1, pt: 1.5 }, rectRadius: 0.1 });
s.addText("GRADING (Sher 1985)", { x: 5.35, y: 1.37, w: 4.15, h: 0.3, fontSize: 12, bold: true, color: C.darkBg, margin: 0 });
const grades = [
{ g: "0", desc: "Asymptomatic – diagnosed retrospectively" },
{ g: "I", desc: "Mild vaginal bleeding; no fetal/maternal compromise" },
{ g: "II", desc: "Moderate bleeding; fetal distress present; no maternal compromise" },
{ g: "III", desc: "Severe; fetal death; maternal shock and/or DIC" },
];
grades.forEach((gr, i) => {
const y = 1.75 + i * 0.82;
const col = [C.teal, C.gold, C.orange, C.accent][i];
s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 5.3, y, w: 0.42, h: 0.55, fill: { color: col }, line: { color: col }, rectRadius: 0.06 });
s.addText("Grade " + gr, { x: 5.3, y: y, w: 0.42, h: 0.55, fontSize: 9, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
s.addText(gr.desc, { x: 5.8, y: y + 0.05, w: 3.7, h: 0.5, fontSize: 10.5, color: C.darkBg, valign: "middle", margin: 0 });
});
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 13 – Abruption – Diagnosis & Management
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Placental Abruption – Diagnosis & Management");
s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: 1.3, w: 9.3, h: 0.32, fill: { color: C.card1 }, line: { color: C.card1 } });
s.addText("DIAGNOSIS", { x: 0.4, y: 1.31, w: 4.5, h: 0.3, fontSize: 12, bold: true, color: C.gold, margin: 0 });
s.addText([
{ text: "Ultrasound: ", options: { bold: true } },
{ text: "NOT reliable to EXCLUDE abruption (retroplacental haematoma isoechoic acutely). Clinical diagnosis is primary.\n", options: {} },
{ text: "Labs: ", options: { bold: true } },
{ text: "CBC, coags, fibrinogen (<300 mg/dL = significant consumption), fibrin split products, Kleihauer–Betke if Rh-negative.", options: {} }
], { x: 0.4, y: 1.68, w: 9.2, h: 0.95, fontSize: 11, color: C.darkBg });
s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: 2.7, w: 9.3, h: 0.32, fill: { color: C.accent }, line: { color: C.accent } });
s.addText("MANAGEMENT", { x: 0.4, y: 2.71, w: 4.5, h: 0.3, fontSize: 12, bold: true, color: C.white, margin: 0 });
const mgmt2 = [
{ icon: "01", text: "Stabilise mother: 2 large-bore IVs, aggressive fluid/blood resuscitation, continuous CTG monitoring" },
{ icon: "02", text: "Labs: crossmatch 4–6 units; DIC screen; fibrinogen level q2–4h; Rh prophylaxis if indicated" },
{ icon: "03", text: "Mild/remote from term: expectant – ARM + oxytocin augmentation; close observation" },
{ icon: "04", text: "Non-reassuring fetal status or severe haemorrhage: emergency Caesarean section" },
{ icon: "05", text: "Fetal death with stable mother: aim for vaginal delivery (avoid additional surgical risk)" },
{ icon: "06", text: "DIC: FFP, cryoprecipitate (fibrinogen target >200 mg/dL), platelets; activate massive haemorrhage protocol" },
];
mgmt2.forEach((m, i) => {
const y = 3.1 + i * 0.39;
s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.35, y: y, w: 0.38, h: 0.3, fill: { color: C.teal }, line: { color: C.teal }, rectRadius: 0.05 });
s.addText(m.icon, { x: 0.35, y: y, w: 0.38, h: 0.3, fontSize: 9, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
s.addText(m.text, { x: 0.82, y: y + 0.02, w: 8.85, h: 0.32, fontSize: 10.5, color: C.darkBg, valign: "middle", margin: 0 });
});
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 14 – Vasa Praevia & Other Causes
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Vasa Praevia & Other Causes of APH");
const cards2 = [
{
title: "Vasa Praevia", col: C.teal,
points: [
"Fetal blood vessels cross internal cervical os within membranes",
"Rupture causes fetal haemorrhage → rapid exsanguination",
"Painless bright-red bleeding at membrane rupture",
"Classic triad: membrane rupture + haemorrhage + fetal bradycardia",
"Dx: antenatal colour-flow Doppler USS",
"Mx: elective C/S at 35–36 weeks (before labour)",
"Fetal mortality up to 60% if undiagnosed"
]
},
{
title: "Other / Local Causes", col: C.orange,
points: [
"Cervical ectropion (cervical erosion)",
"Cervical polyp or carcinoma",
"Vulval / vaginal varices",
"Trauma (domestic violence – enquire sensitively)",
"Uterine rupture (prior scar; rare)",
"Placenta accreta spectrum (abnormal invasion; may coexist with previa)",
"Marginal sinus bleeding (low-risk)"
]
}
];
cards2.forEach((card, i) => {
const x = 0.35 + i * 4.85;
s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x, y: 1.3, w: 4.5, h: 4.1,
fill: { color: card.col }, line: { color: card.col }, rectRadius: 0.12
});
s.addText(card.title, { x: x + 0.15, y: 1.37, w: 4.2, h: 0.35, fontSize: 13, bold: true, color: C.white, margin: 0 });
const pts = card.points.map((p, j) => ({ text: p, options: { bullet: true, fontSize: 10.5, color: C.white, breakLine: j < card.points.length - 1 } }));
s.addText(pts, { x: x + 0.15, y: 1.78, w: 4.2, h: 3.5, valign: "top" });
});
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 15 – Investigations
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Investigations");
const invGroups = [
{
title: "Haematology", col: C.accent,
items: ["FBC (haemoglobin, platelets)", "Blood group & crossmatch (4–6 units)", "Coagulation screen (PT, APTT)", "Fibrinogen (normal in pregnancy 400–450 mg/dL; <300 mg/dL = consumption)", "Fibrin degradation products / D-dimer", "Kleihauer–Betke test (Rh-negative mothers)"]
},
{
title: "Imaging", col: C.teal,
items: ["Transabdominal ultrasound (first-line)", "Transvaginal ultrasound (safe; more accurate)", "MRI (suspected accreta/increta/percreta)", "CTG / electronic fetal monitoring (continuous)"]
},
{
title: "Other Blood Tests", col: C.orange,
items: ["U&E, LFTs, uric acid (pre-eclampsia screen)", "Blood glucose", "Urine dipstick / MSU", "LDH (haemolysis screen in HELLP)"]
}
];
invGroups.forEach((g, i) => {
const x = 0.35 + i * 3.18;
s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y: 1.3, w: 2.95, h: 4.0, fill: { color: g.col }, line: { color: g.col }, rectRadius: 0.1 });
s.addText(g.title, { x: x + 0.1, y: 1.37, w: 2.75, h: 0.32, fontSize: 12, bold: true, color: C.white, margin: 0 });
const pts = g.items.map((p, j) => ({ text: p, options: { bullet: true, fontSize: 10.5, color: C.white, breakLine: j < g.items.length - 1 } }));
s.addText(pts, { x: x + 0.1, y: 1.74, w: 2.75, h: 3.45, valign: "top" });
});
s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x: 0.35, y: 5.18, w: 9.3, h: 0.3,
fill: { color: C.darkBg }, line: { color: C.darkBg }, rectRadius: 0.05
});
s.addText("Digital cervical examination is ABSOLUTELY CONTRAINDICATED until placenta previa is excluded by ultrasound.",
{ x: 0.4, y: 5.19, w: 9.2, h: 0.28, fontSize: 10, color: C.gold, bold: true, align: "center", margin: 0 });
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 16 – Emergency Management
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Emergency Management of APH");
const steps = [
{ num: "A", label: "Airway & O₂", detail: "High-flow O₂ via non-rebreather; airway protection if unconscious", col: C.teal },
{ num: "B", label: "Breathing", detail: "Assess respiratory status; pulse oximetry monitoring", col: C.teal },
{ num: "C", label: "Circulation", detail: "2 large-bore IV cannulas (16G+); rapid crystalloid / blood products; crossmatch; BP & HR monitoring", col: C.accent },
{ num: "D", label: "Disability", detail: "GCS; fetal monitoring (CTG); left lateral tilt to reduce aortocaval compression", col: C.orange },
{ num: "E", label: "Exposure / Bloods", detail: "Inspect for external bleeding; DIC screen; labs as per investigations slide", col: C.gold },
];
steps.forEach((st, i) => {
const y = 1.35 + i * 0.82;
s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.35, y, w: 0.6, h: 0.65, fill: { color: st.col }, line: { color: st.col }, rectRadius: 0.08 });
s.addText(st.num, { x: 0.35, y, w: 0.6, h: 0.65, fontSize: 18, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
s.addText(st.label, { x: 1.1, y: y + 0.0, w: 2.0, h: 0.32, fontSize: 12, bold: true, color: C.darkBg, margin: 0 });
s.addText(st.detail, { x: 1.1, y: y + 0.33, w: 8.5, h: 0.32, fontSize: 10.5, color: "334466", margin: 0 });
});
s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.35, y: 5.15, w: 9.3, h: 0.33, fill: { color: C.accent }, line: { color: C.accent }, rectRadius: 0.06 });
s.addText("CALL FOR HELP EARLY: Obstetrics + Anaesthesia + Haematology + Neonatology + Theatre team",
{ x: 0.4, y: 5.16, w: 9.2, h: 0.3, fontSize: 10.5, bold: true, color: C.white, align: "center", margin: 0 });
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 17 – Anaesthesia Considerations
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Anaesthesia Considerations in APH");
const rows = [
{
head: "Neuraxial (Spinal / Epidural) – PREFERRED",
body: "Indicated when mother is haemodynamically stable and no coagulopathy. Associated with LESS blood loss and LESS need for transfusion vs general anaesthesia. Contraindicated if coags abnormal (DIC) or patient haemodynamically unstable.",
col: C.teal
},
{
head: "General Anaesthesia – RESERVED FOR",
body: "Maternal haemodynamic instability, coagulopathy/DIC, non-reassuring fetal status requiring immediate delivery, or patient refusal of neuraxial. Associated with greater blood loss. Difficult airway anticipated in pregnancy (Mallampati changes).",
col: C.orange
},
{
head: "Placenta Accreta Spectrum (PAS)",
body: "Risk increases with number of prior Caesareans: 3% (1st C/S) → 61% (3+ C/S with previa). Plan for cell salvage, massive haemorrhage protocol, potential hysterectomy, IR involvement. Multidisciplinary pre-op planning essential.",
col: C.accent
},
];
rows.forEach((r, i) => {
const y = 1.3 + i * 1.38;
s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.35, y, w: 9.3, h: 1.3, fill: { color: r.col }, line: { color: r.col }, rectRadius: 0.1 });
s.addText(r.head, { x: 0.5, y: y + 0.1, w: 9.0, h: 0.3, fontSize: 12, bold: true, color: C.white, margin: 0 });
s.addText(r.body, { x: 0.5, y: y + 0.42, w: 9.0, h: 0.8, fontSize: 10.5, color: C.white, valign: "top", margin: 0 });
});
footnote(s, "Sources: Barash Clinical Anesthesia 9e; Morgan & Mikhail 7e");
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 18 – Complications
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Complications & Outcomes");
const maternal = [
"Haemorrhagic shock",
"Disseminated intravascular coagulation (DIC)",
"Acute kidney injury (ATN)",
"Hepatic necrosis / HELLP",
"Pulmonary oedema / ARDS",
"Emergency hysterectomy (PAS)",
"Peripartum cardiac arrest",
"Maternal death",
];
const fetal = [
"Fetal distress / asphyxia",
"Preterm delivery",
"Intrauterine growth restriction (IUGR)",
"Stillbirth (50% placental separation)",
"Neonatal anaemia / coagulopathy",
"Perinatal mortality 9–12% (abruption)",
"Neurodevelopmental impairment",
];
const mkList = (items, col) => items.map((t, i) => ({
text: t,
options: { bullet: true, fontSize: 11, color: col, breakLine: i < items.length - 1 }
}));
s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.35, y: 1.25, w: 4.55, h: 4.1, fill: { color: C.accent }, line: { color: C.accent }, rectRadius: 0.12 });
s.addText("MATERNAL COMPLICATIONS", { x: 0.5, y: 1.33, w: 4.25, h: 0.32, fontSize: 12, bold: true, color: C.white, margin: 0 });
s.addText(mkList(maternal, C.white), { x: 0.5, y: 1.7, w: 4.25, h: 3.5, valign: "top" });
s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 5.1, y: 1.25, w: 4.55, h: 4.1, fill: { color: C.darkBg }, line: { color: C.darkBg }, rectRadius: 0.12 });
s.addText("FETAL / NEONATAL COMPLICATIONS", { x: 5.25, y: 1.33, w: 4.25, h: 0.32, fontSize: 12, bold: true, color: C.gold, margin: 0 });
s.addText(mkList(fetal, C.white), { x: 5.25, y: 1.7, w: 4.25, h: 3.5, valign: "top" });
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 19 – Key Differentials: Previa vs Abruption
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGrey }, line: { color: C.lightGrey } });
slideTitle(s, "Comparison: Placenta Previa vs Placental Abruption");
const headers = ["Feature", "Placenta Previa", "Placental Abruption"];
const rows2 = [
["Pain", "None (painless)", "Severe, sudden (uterine pain)"],
["Bleeding", "Bright red, fresh", "Dark, clotted; may be concealed"],
["Uterine tone", "Soft, non-tender", "Rigid, tender, hypertonus"],
["Fetal position", "Malpresentation common", "Normal (usually)"],
["Fetal distress", "Less common initially", "Common (early distress)"],
["Ultrasound", "Confirms diagnosis", "May be normal – clinical Dx"],
["Digital VE", "CONTRAINDICATED", "Avoid until U/S done"],
["Delivery", "Caesarean section", "Depends on severity/GA"],
["DIC risk", "Moderate (with accreta)", "HIGH – coags q2–4h"],
];
const colW = [2.0, 3.7, 3.7];
const startX = [0.3, 2.35, 6.1];
const headerH = 0.38;
const rowH = 0.38;
// Header row
headers.forEach((h, ci) => {
const bgCol = ci === 0 ? C.card1 : (ci === 1 ? C.teal : C.accent);
s.addShape(pres.shapes.RECTANGLE, { x: startX[ci], y: 1.3, w: colW[ci], h: headerH, fill: { color: bgCol }, line: { color: bgCol } });
s.addText(h, { x: startX[ci] + 0.08, y: 1.3, w: colW[ci] - 0.1, h: headerH, fontSize: 11, bold: true, color: C.white, valign: "middle", margin: 0 });
});
rows2.forEach((row, ri) => {
const y = 1.3 + headerH + ri * rowH;
const rowBg = ri % 2 === 0 ? "EDF2FB" : "FFFFFF";
row.forEach((cell, ci) => {
const isHighlight = (ci === 1 && (cell.includes("CONTRA") || cell === "None (painless)")) ||
(ci === 2 && (cell.includes("HIGH") || cell.includes("Severe")));
s.addShape(pres.shapes.RECTANGLE, { x: startX[ci], y, w: colW[ci], h: rowH, fill: { color: rowBg }, line: { color: "CCCCCC", pt: 0.5 } });
s.addText(cell, {
x: startX[ci] + 0.08, y: y + 0.02, w: colW[ci] - 0.1, h: rowH - 0.04,
fontSize: 9.5, color: isHighlight ? C.accent : C.darkBg, bold: isHighlight, valign: "middle", margin: 0
});
});
});
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 20 – Summary / Key Takeaways
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
darkBg(s);
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 4.6, w: 10, h: 1.025, fill: { color: C.accent }, line: { color: C.accent } });
s.addText("KEY TAKEAWAYS", {
x: 0.5, y: 0.2, w: 9, h: 0.55, fontSize: 24, bold: true, color: C.gold, charSpacing: 3, align: "center", margin: 0
});
s.addShape(pres.shapes.RECTANGLE, { x: 3.5, y: 0.8, w: 3, h: 0.06, fill: { color: C.gold }, line: { color: C.gold } });
const takes = [
"APH complicates 3–5% of pregnancies and is a leading cause of maternal and perinatal mortality.",
"The two main causes are placenta previa (painless bright-red bleeding) and placental abruption (painful, dark, clotted bleeding; may be concealed).",
"Digital cervical examination is absolutely contraindicated until placenta previa is excluded by ultrasound.",
"Investigations: FBC, coags, fibrinogen, crossmatch, ultrasound, continuous CTG. Normal fibrinogen in pregnancy is 400–450 mg/dL.",
"Management: stabilise mother first (ABCDE), call for multidisciplinary help, decide on delivery route based on cause, gestation and maternal/fetal status.",
"Neuraxial anaesthesia is preferred over general anaesthesia when the mother is stable and coagulopathy is absent.",
"Placenta accreta spectrum risk rises sharply with increasing number of Caesarean deliveries.",
];
const rich = takes.map((t, i) => ({
text: " " + (i + 1) + ". " + t,
options: { fontSize: 11, color: C.white, breakLine: i < takes.length - 1 }
}));
s.addText(rich, { x: 0.5, y: 0.98, w: 9, h: 3.5, valign: "top", lineSpacingMultiple: 1.4 });
s.addText("Antepartum Haemorrhage – Clinical Overview | Sources: Barash 9e • Rosen's EM • Morgan & Mikhail 7e",
{ x: 0.3, y: 4.65, w: 9.4, h: 0.9, fontSize: 10, color: C.white, align: "center", valign: "middle" });
}
// ─────────────────────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/aph-presentation/Antepartum_Haemorrhage.pptx" })
.then(() => console.log("SUCCESS: Antepartum_Haemorrhage.pptx written"))
.catch(e => { console.error("ERROR:", e); process.exit(1); });
cd /home/daytona/workspace/aph-presentation && node build.js 2>&1
Antepartum Haemorrhage
Presentation · PPTX
| Slide | Content |
|---|---|
| 1 | Title slide (deep navy + crimson palette) |
| 2 | Table of contents |
| 3-4 | Definition & Incidence (3-5% of pregnancies; stat cards) |
| 5 | Classification (Previa / Abruption / Vasa Praevia / Local) |
| 6-7 | Placenta Previa - Types (I-IV) |
| 8 | Placenta Previa - Risk factors & Clinical features |
| 9 | Placenta Previa - Diagnosis & Management |
| 10-11 | Placental Abruption - Definition, Types (revealed/concealed), Risk factors |
| 12 | Placental Abruption - Clinical features & Sher grading (0-III) |
| 13 | Placental Abruption - Diagnosis & Management |
| 14 | Vasa Praevia & Other causes (ectropion, accreta, trauma) |
| 15 | Investigations (bloods, imaging, key fibrinogen threshold) |
| 16 | Emergency Management (ABCDE approach + MDT alert) |
| 17 | Anaesthesia considerations (neuraxial preferred; GA indications; PAS) |
| 18 | Complications - maternal vs fetal two-column layout |
| 19 | Comparison table: Previa vs Abruption |
| 20 | Key Takeaways summary slide |
Prepare a ppt on APH
Antepartum Haemorrhage
Presentation · PPTX
| Slides | Topic |
|---|---|
| 1–2 | Title + Table of Contents |
| 3–4 | Definition & Incidence (3–5% of pregnancies; key stats) |
| 5 | Classification (Previa / Abruption / Vasa Praevia / Local) |
| 6–9 | Placenta Previa - Types, Risk Factors, Clinical Features, Diagnosis & Management |
| 10–13 | Placental Abruption - Definition, Grading (Sher 0-III), Clinical Features, Management |
| 14 | Vasa Praevia & Other Causes |
| 15 | Investigations (bloods, imaging, fibrinogen thresholds) |
| 16 | Emergency Management (ABCDE + MDT) |
| 17 | Anaesthesia Considerations (neuraxial vs GA; accreta spectrum) |
| 18 | Complications - Maternal vs Fetal |
| 19 | Comparison Table: Previa vs Abruption |
| 20 | Key Takeaways |