~/anemia-pregnancy-chart/create_chart.js
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3" x 7.5"
pres.title = "Anemia Management in Pregnancy - Quick Reference";
pres.author = "Orris Medical";
// ── COLOUR PALETTE ──────────────────────────────────────────
const C = {
navy: "0D2B55", // dominant dark navy
teal: "1A7A8A", // section headers
mint: "E6F5F7", // light teal bg for rows
gold: "D4A017", // accent / warning
red: "C0392B", // danger / contraindicated
green: "1E7A4A", // safe / treat
white: "FFFFFF",
offwhite: "F4F8FA",
gray: "5A6473",
lightgray: "D9E2EA",
black: "0A0A0A",
};
// ════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE SLIDE
// ════════════════════════════════════════════════════════════════
let s1 = pres.addSlide();
// Full-bleed background
s1.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
// Decorative accent bar
s1.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.5, h: "100%", fill: { color: C.teal } });
// Red/gold accent stripe
s1.addShape(pres.ShapeType.rect, { x: 0.5, y: 3.4, w: 12.8, h: 0.06, fill: { color: C.gold } });
// Main title
s1.addText("ANEMIA IN PREGNANCY", {
x: 0.8, y: 1.6, w: 11.5, h: 1.0,
fontSize: 44, bold: true, color: C.white,
fontFace: "Calibri", charSpacing: 4, align: "left",
});
// Subtitle
s1.addText("Quick Reference Management Chart", {
x: 0.8, y: 2.65, w: 11.5, h: 0.7,
fontSize: 24, color: C.mint, fontFace: "Calibri", align: "left",
});
// Bottom tag line
s1.addText("WHO Definition: Hb < 11 g/dL | Severe: Hb < 7 g/dL | Screen at 1st trimester & 24–28 weeks", {
x: 0.8, y: 6.7, w: 12, h: 0.5,
fontSize: 13, color: C.lightgray, fontFace: "Calibri", align: "left",
});
// Source tag
s1.addText("Sources: Creasy & Resnik; Harrison's 22e; Goldman-Cecil; Cochrane 2024", {
x: 0.8, y: 7.1, w: 12, h: 0.3,
fontSize: 10, color: C.gray, fontFace: "Calibri", italic: true,
});
// ════════════════════════════════════════════════════════════════
// SLIDE 2 — PHYSIOLOGIC vs PATHOLOGIC OVERVIEW
// ════════════════════════════════════════════════════════════════
let s2 = pres.addSlide();
s2.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.offwhite } });
// Header bar
s2.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.75, fill: { color: C.navy } });
s2.addText("OVERVIEW: Physiologic vs Pathologic Anemia", {
x: 0.3, y: 0, w: 12.7, h: 0.75, fontSize: 18, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle",
});
// ── LEFT PANEL: Physiologic ──────────────────────────────────
s2.addShape(pres.ShapeType.roundRect, {
x: 0.3, y: 0.9, w: 5.9, h: 5.9,
fill: { color: C.white }, line: { color: C.teal, width: 2 }, rectRadius: 0.1,
});
s2.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.9, w: 5.9, h: 0.6, fill: { color: C.teal } });
s2.addText("PHYSIOLOGIC (DILUTIONAL)", {
x: 0.35, y: 0.9, w: 5.8, h: 0.6, fontSize: 14, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle", align: "center",
});
const physRows = [
["Mechanism", "Plasma vol ↑47% >> RBC mass ↑17%"],
["Peak", "28–34 weeks gestation"],
["Hb lower limit", "≥11 g/dL (1st), ≥10 g/dL (2nd/3rd)"],
["MCV/MCHC", "Normal (key differentiator!)"],
["Treatment", "NONE — physiologic adaptation"],
["Fetal risk", "None if Hb within acceptable range"],
];
physRows.forEach(([label, val], i) => {
const yy = 1.6 + i * 0.75;
const bg = i % 2 === 0 ? C.mint : C.white;
s2.addShape(pres.ShapeType.rect, { x: 0.35, y: yy, w: 5.8, h: 0.68, fill: { color: bg } });
s2.addText(label, {
x: 0.45, y: yy, w: 1.9, h: 0.68, fontSize: 11, bold: true,
color: C.navy, fontFace: "Calibri", valign: "middle",
});
s2.addText(val, {
x: 2.35, y: yy, w: 3.7, h: 0.68, fontSize: 11,
color: C.black, fontFace: "Calibri", valign: "middle",
});
});
// ── RIGHT PANEL: Causes of True Anemia ───────────────────────
s2.addShape(pres.ShapeType.roundRect, {
x: 6.5, y: 0.9, w: 6.5, h: 5.9,
fill: { color: C.white }, line: { color: C.navy, width: 2 }, rectRadius: 0.1,
});
s2.addShape(pres.ShapeType.rect, { x: 6.5, y: 0.9, w: 6.5, h: 0.6, fill: { color: C.navy } });
s2.addText("CAUSES OF TRUE ANEMIA IN PREGNANCY", {
x: 6.55, y: 0.9, w: 6.4, h: 0.6, fontSize: 13, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle", align: "center",
});
const causesData = [
[C.red, "Iron Deficiency", "Most common (18–29% of pregnancies)"],
[C.teal, "Folate Deficiency", "2nd most common nutritional cause"],
[C.teal, "Vitamin B12 Deficiency", "Vegans, pernicious anemia, IBD"],
[C.gold, "Sickle Cell Disease", "Highest-risk hemoglobinopathy"],
[C.gold, "Thalassemia", "Microcytic; varies by type"],
[C.gray, "AIHA", "Warm (IgG) or cold (IgM) antibodies"],
[C.gray, "Aplastic Anemia", "Rare; pancytopenia"],
];
causesData.forEach(([dot, label, desc], i) => {
const yy = 1.62 + i * 0.72;
const bg = i % 2 === 0 ? C.mint : C.white;
s2.addShape(pres.ShapeType.rect, { x: 6.55, y: yy, w: 6.4, h: 0.66, fill: { color: bg } });
s2.addShape(pres.ShapeType.ellipse, { x: 6.65, y: yy + 0.2, w: 0.25, h: 0.25, fill: { color: dot } });
s2.addText(label, {
x: 7.0, y: yy, w: 2.2, h: 0.66, fontSize: 11, bold: true,
color: C.navy, fontFace: "Calibri", valign: "middle",
});
s2.addText(desc, {
x: 9.2, y: yy, w: 3.7, h: 0.66, fontSize: 10,
color: C.gray, fontFace: "Calibri", valign: "middle",
});
});
// ════════════════════════════════════════════════════════════════
// SLIDE 3 — IRON DEFICIENCY ANEMIA
// ════════════════════════════════════════════════════════════════
let s3 = pres.addSlide();
s3.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.offwhite } });
s3.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.75, fill: { color: C.red } });
s3.addText("IRON DEFICIENCY ANEMIA — Diagnosis & Management", {
x: 0.3, y: 0, w: 12.7, h: 0.75, fontSize: 17, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle",
});
// ── Stages of IDA ─────────────────────────────────────────
s3.addText("STAGES OF IRON DEFICIENCY", {
x: 0.3, y: 0.9, w: 5.7, h: 0.4, fontSize: 13, bold: true,
color: C.navy, fontFace: "Calibri",
});
const stages = [
["Stage 1 — Prelatent", "↓ Ferritin only; Hb NORMAL", C.gold],
["Stage 2 — Latent", "↓ Fe, ↑ TIBC, ↓ Transferrin sat; Hb still NORMAL", C.gold],
["Stage 3 — Overt IDA", "↓ Hb + ↓ MCV (microcytic, hypochromic)", C.red],
];
stages.forEach(([title, desc, color], i) => {
const yy = 1.38 + i * 0.82;
s3.addShape(pres.ShapeType.rect, { x: 0.3, y: yy, w: 0.15, h: 0.65, fill: { color } });
s3.addShape(pres.ShapeType.roundRect, {
x: 0.48, y: yy, w: 5.55, h: 0.65,
fill: { color: C.white }, line: { color: C.lightgray, width: 1 }, rectRadius: 0.05,
});
s3.addText(title, { x: 0.58, y: yy + 0.02, w: 5.3, h: 0.28, fontSize: 11, bold: true, color, fontFace: "Calibri" });
s3.addText(desc, { x: 0.58, y: yy + 0.32, w: 5.3, h: 0.28, fontSize: 10, color: C.black, fontFace: "Calibri" });
});
// ── Diagnostic Tests ─────────────────────────────────────────
s3.addShape(pres.ShapeType.rect, { x: 6.2, y: 0.85, w: 6.8, h: 0.45, fill: { color: C.navy } });
s3.addText("DIAGNOSTIC TESTS", {
x: 6.2, y: 0.85, w: 6.8, h: 0.45, fontSize: 13, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle", align: "center",
});
const diagTests = [
["Serum Ferritin", "<12 μg/L = IDA; <20 μg/L = depletion", "Best single test ★"],
["Serum Iron", "Decreased", "Affected by diurnal variation"],
["TIBC", "Increased (rises through pregnancy)", "Inversely relates to iron stores"],
["Transferrin Sat", "<16%", "Fe / TIBC × 100"],
["MCV", "Decreased (late finding)", "Also ↓ in thalassemia"],
["sTfR", "Increased", "Useful if ferritin unreliable (inflammation)"],
["Peripheral Smear", "Microcytic, hypochromic RBCs", "Pencil cells, target cells"],
];
diagTests.forEach(([test, result, note], i) => {
const yy = 1.38 + i * 0.56;
const bg = i % 2 === 0 ? C.mint : C.white;
s3.addShape(pres.ShapeType.rect, { x: 6.2, y: yy, w: 6.8, h: 0.54, fill: { color: bg } });
s3.addText(test, { x: 6.3, y: yy, w: 1.8, h: 0.54, fontSize: 10, bold: true, color: C.navy, fontFace: "Calibri", valign: "middle" });
s3.addText(result, { x: 8.1, y: yy, w: 2.4, h: 0.54, fontSize: 10, color: C.red, fontFace: "Calibri", valign: "middle" });
s3.addText(note, { x: 10.5, y: yy, w: 2.4, h: 0.54, fontSize: 9, color: C.gray, fontFace: "Calibri", valign: "middle", italic: true });
});
// ── Treatment ─────────────────────────────────────────
s3.addShape(pres.ShapeType.rect, { x: 0.3, y: 4.25, w: 5.7, h: 0.45, fill: { color: C.green } });
s3.addText("TREATMENT", {
x: 0.3, y: 4.25, w: 5.7, h: 0.45, fontSize: 13, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle", align: "center",
});
const txRows = [
["Oral Iron", "60 mg elemental iron/day (2nd + 3rd tri)", "Ferrous sulfate 325 mg; take with vit C"],
["IV Iron", "Iron sucrose / ferric carboxymaltose", "If oral fails, severe anemia, malabsorption"],
["Transfusion","Packed RBCs (1 unit = +1 g/dL Hb)", "Hb <7 g/dL or haemodynamic instability"],
];
txRows.forEach(([route, dose, indication], i) => {
const yy = 4.78 + i * 0.77;
const bg = i % 2 === 0 ? C.white : C.mint;
s3.addShape(pres.ShapeType.rect, { x: 0.3, y: yy, w: 5.7, h: 0.72, fill: { color: bg }, line: { color: C.lightgray, width: 0.5 } });
s3.addText(route, { x: 0.4, y: yy, w: 1.4, h: 0.72, fontSize: 11, bold: true, color: C.green, fontFace: "Calibri", valign: "middle" });
s3.addText(dose, { x: 1.85, y: yy, w: 2.3, h: 0.72, fontSize: 10, color: C.black, fontFace: "Calibri", valign: "middle" });
s3.addText(indication, { x: 4.15, y: yy, w: 1.75, h: 0.72, fontSize: 9, color: C.gray, fontFace: "Calibri", valign: "middle", italic: true });
});
// ════════════════════════════════════════════════════════════════
// SLIDE 4 — MEGALOBLASTIC ANEMIA (FOLATE + B12)
// ════════════════════════════════════════════════════════════════
let s4 = pres.addSlide();
s4.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.offwhite } });
s4.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.75, fill: { color: C.teal } });
s4.addText("MEGALOBLASTIC ANEMIA — Folate & Vitamin B12 Deficiency", {
x: 0.3, y: 0, w: 12.7, h: 0.75, fontSize: 17, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle",
});
// FOLATE section
s4.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.88, w: 6.1, h: 0.5, fill: { color: C.teal } });
s4.addText("FOLATE DEFICIENCY", {
x: 0.3, y: 0.88, w: 6.1, h: 0.5, fontSize: 14, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle", align: "center",
});
const folateRows = [
["Daily requirement", "400 μg (non-pregnant) → 600 μg (pregnant)"],
["Why deficient", "Increased erythropoiesis; fetal demand; drugs reducing conjugase (anticonvulsants, sulfa, alcohol, OCP)"],
["Smear/labs", "Macrocytic RBCs; hypersegmented neutrophils; ↓ serum folate (<2.5 ng/mL)"],
["Complications", "Megaloblastic anemia + Neural Tube Defects (NTDs)"],
["Prophylaxis", "0.4–0.8 mg/day folic acid — start ≥1 month BEFORE conception, continue through 1st trimester"],
["High-risk prophylaxis","4–5 mg/day (prior NTD, anticonvulsant use, multiple gestation, haemolytic anaemia)"],
["Treatment", "1–5 mg/day folic acid orally until resolution"],
];
folateRows.forEach(([label, val], i) => {
const yy = 1.46 + i * 0.58;
const bg = i % 2 === 0 ? C.mint : C.white;
s4.addShape(pres.ShapeType.rect, { x: 0.3, y: yy, w: 6.1, h: 0.55, fill: { color: bg } });
s4.addText(label, { x: 0.4, y: yy, w: 1.85, h: 0.55, fontSize: 10, bold: true, color: C.teal, fontFace: "Calibri", valign: "middle" });
s4.addText(val, { x: 2.28, y: yy, w: 4.05, h: 0.55, fontSize: 10, color: C.black, fontFace: "Calibri", valign: "middle", wrap: true });
});
// B12 section
s4.addShape(pres.ShapeType.rect, { x: 6.8, y: 0.88, w: 6.2, h: 0.5, fill: { color: C.navy } });
s4.addText("VITAMIN B12 DEFICIENCY", {
x: 6.8, y: 0.88, w: 6.2, h: 0.5, fontSize: 14, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle", align: "center",
});
const b12Rows = [
["Risk groups", "Vegans/vegetarians, pernicious anaemia, Crohn's disease, prior gastric surgery"],
["Clinical features","Macrocytic anemia + neurological symptoms (peripheral neuropathy, posterior column signs)"],
["Critical warning", "⚠ Treating with folate alone corrects anaemia but WILL NOT prevent neurological damage — replace B12!"],
["Diagnosis", "Serum B12 <130 pg/mL; anti-intrinsic factor antibody (positive in pernicious anaemia)"],
["Treatment", "Parenteral cyanocobalamin/hydroxocobalamin (IM); oral high-dose B12 if parenteral unavailable"],
["Fetal risk", "NTDs, impaired neurodevelopment if untreated"],
];
b12Rows.forEach(([label, val], i) => {
const yy = 1.46 + i * 0.66;
const bg = i % 2 === 0 ? C.mint : C.white;
const isWarning = i === 2;
s4.addShape(pres.ShapeType.rect, { x: 6.8, y: yy, w: 6.2, h: 0.62, fill: { color: isWarning ? "#FFF3CD" : bg } });
s4.addText(label, { x: 6.9, y: yy, w: 1.7, h: 0.62, fontSize: 10, bold: true, color: isWarning ? C.red : C.navy, fontFace: "Calibri", valign: "middle" });
s4.addText(val, { x: 8.65, y: yy, w: 4.25, h: 0.62, fontSize: 10, color: isWarning ? C.red : C.black, fontFace: "Calibri", valign: "middle", bold: isWarning, wrap: true });
});
// ════════════════════════════════════════════════════════════════
// SLIDE 5 — HEMOGLOBINOPATHIES & OTHER CAUSES
// ════════════════════════════════════════════════════════════════
let s5 = pres.addSlide();
s5.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.offwhite } });
s5.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.75, fill: { color: C.navy } });
s5.addText("HEMOGLOBINOPATHIES & OTHER CAUSES", {
x: 0.3, y: 0, w: 12.7, h: 0.75, fontSize: 17, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle",
});
const hemoData = [
{
title: "SICKLE CELL DISEASE",
color: C.red,
rows: [
["Risk", "Highest-risk hemoglobinopathy in pregnancy"],
["Complications","Vaso-occlusive crises, ACS, stroke, preeclampsia, peripartum cardiomyopathy; FGR, preterm birth"],
["Management", "Multidisciplinary care; prophylactic transfusions; folic acid; aggressive pain Mx; avoid NSAIDs (3rd tri)"],
["Drugs", "Hydroxyurea is TERATOGENIC — discontinue before conception; exchange transfusion for severe cases"],
["Vaccination", "Pneumococcal, meningococcal, Haemophilus influenzae vaccines"],
]
},
{
title: "THALASSEMIA",
color: C.gold,
rows: [
["α-thal trait / β-thal trait", "Microcytic picture; usually tolerated; folic acid supplementation"],
["β-thal major", "Severe anemia; regular transfusions; iron chelation paused in pregnancy"],
["Hb H disease (α-thal)", "Moderate hemolytic anemia; may worsen in pregnancy"],
["Screening", "Hb electrophoresis for all pregnant women with low MCV/MCH"],
]
},
];
hemoData.forEach((section, col) => {
const xBase = col === 0 ? 0.3 : 6.8;
const w = 6.1;
s5.addShape(pres.ShapeType.rect, { x: xBase, y: 0.88, w, h: 0.48, fill: { color: section.color } });
s5.addText(section.title, {
x: xBase, y: 0.88, w, h: 0.48, fontSize: 13, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle", align: "center",
});
section.rows.forEach(([label, val], i) => {
const yy = 1.44 + i * 0.68;
const bg = i % 2 === 0 ? C.mint : C.white;
s5.addShape(pres.ShapeType.rect, { x: xBase, y: yy, w, h: 0.64, fill: { color: bg } });
s5.addText(label, { x: xBase + 0.1, y: yy, w: 2.0, h: 0.64, fontSize: 10, bold: true, color: section.color, fontFace: "Calibri", valign: "middle" });
s5.addText(val, { x: xBase + 2.1, y: yy, w: w - 2.2, h: 0.64, fontSize: 9.5, color: C.black, fontFace: "Calibri", valign: "middle", wrap: true });
});
});
// Bottom row — AIHA + Aplastic
const bottomCauses = [
{
title: "AUTOIMMUNE HEMOLYTIC ANEMIA (AIHA)",
color: C.gray,
rows: [
["Types", "Warm IgG (anti-Rh) → associated with SLE, lymphoma, drugs (penicillin, methyldopa) | Cold IgM (anti-I) → Mycoplasma, EBV"],
["Diagnosis","Positive direct Coombs test; macrocytic/hyperproliferative smear with spherocytes"],
["Treatment","Corticosteroids; blood transfusion; IVIG; rarely splenectomy"],
]
},
{
title: "APLASTIC ANEMIA",
color: C.gray,
rows: [
["Features", "Rare; bone marrow failure; pancytopenia (↓ WBC, ↓ platelets, ↓ Hb)"],
["Management","Transfusion support; cyclosporine; SCT deferred if possible; folic acid"],
["Notes", "Pregnancy itself can trigger or worsen aplastic anemia"],
]
},
];
bottomCauses.forEach((section, col) => {
const xBase = col === 0 ? 0.3 : 6.8;
const w = 6.1;
const yStart = 5.1;
s5.addShape(pres.ShapeType.rect, { x: xBase, y: yStart, w, h: 0.38, fill: { color: section.color } });
s5.addText(section.title, {
x: xBase, y: yStart, w, h: 0.38, fontSize: 11, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle", align: "center",
});
section.rows.forEach(([label, val], i) => {
const yy = yStart + 0.42 + i * 0.52;
const bg = i % 2 === 0 ? C.mint : C.white;
s5.addShape(pres.ShapeType.rect, { x: xBase, y: yy, w, h: 0.48, fill: { color: bg } });
s5.addText(label, { x: xBase + 0.1, y: yy, w: 1.5, h: 0.48, fontSize: 9.5, bold: true, color: C.gray, fontFace: "Calibri", valign: "middle" });
s5.addText(val, { x: xBase + 1.6, y: yy, w: w - 1.7, h: 0.48, fontSize: 9, color: C.black, fontFace: "Calibri", valign: "middle", wrap: true });
});
});
// ════════════════════════════════════════════════════════════════
// SLIDE 6 — DIAGNOSTIC ALGORITHM + REFERENCE RANGES
// ════════════════════════════════════════════════════════════════
let s6 = pres.addSlide();
s6.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.offwhite } });
s6.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.75, fill: { color: C.teal } });
s6.addText("DIAGNOSTIC ALGORITHM & LABORATORY REFERENCE RANGES", {
x: 0.3, y: 0, w: 12.7, h: 0.75, fontSize: 17, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle",
});
// Algorithm boxes
const algoX = 0.3;
s6.addShape(pres.ShapeType.roundRect, { x: algoX, y: 0.9, w: 5.5, h: 0.6, fill: { color: C.navy }, rectRadius: 0.1 });
s6.addText("Hb < 11 g/dL (1st tri) or < 10 g/dL (2nd/3rd tri)", {
x: algoX, y: 0.9, w: 5.5, h: 0.6, fontSize: 11, bold: true,
color: C.white, fontFace: "Calibri", align: "center", valign: "middle",
});
// Arrow down
s6.addShape(pres.ShapeType.rect, { x: algoX + 2.65, y: 1.54, w: 0.2, h: 0.3, fill: { color: C.navy } });
s6.addShape(pres.ShapeType.roundRect, { x: algoX, y: 1.86, w: 5.5, h: 0.55, fill: { color: C.teal }, rectRadius: 0.1 });
s6.addText("Check: MCV + Ferritin + Peripheral Smear + Reticulocyte count", {
x: algoX, y: 1.86, w: 5.5, h: 0.55, fontSize: 10, bold: true,
color: C.white, fontFace: "Calibri", align: "center", valign: "middle",
});
// Arrow down
s6.addShape(pres.ShapeType.rect, { x: algoX + 2.65, y: 2.44, w: 0.2, h: 0.25, fill: { color: C.teal } });
// Three branches
const branches = [
{ x: 0.3, label: "MICROCYTIC\n(↓ MCV)", sub: "IDA (check ferritin)\nThalassemia\nSideroblastic anemia", color: C.red },
{ x: 2.2, label: "NORMOCYTIC\n(normal MCV)", sub: "Physiologic dilution\nBlood loss / Hemolysis\nAnemia of chronic disease", color: C.teal },
{ x: 4.05, label: "MACROCYTIC\n(↑ MCV)", sub: "Folate deficiency\nVit B12 deficiency\nHypothyroidism / drugs", color: C.gold },
];
// horizontal bar
s6.addShape(pres.ShapeType.rect, { x: 0.3, y: 2.68, w: 5.5, h: 0.07, fill: { color: C.lightgray } });
branches.forEach(({ x, label, sub, color }) => {
s6.addShape(pres.ShapeType.rect, { x: x, y: 2.68, w: 0.07, h: 0.3, fill: { color: C.lightgray } });
s6.addShape(pres.ShapeType.roundRect, { x: x - 0.1, y: 3.0, w: 1.75, h: 0.75, fill: { color }, rectRadius: 0.1 });
s6.addText(label, {
x: x - 0.08, y: 3.0, w: 1.72, h: 0.75, fontSize: 10, bold: true,
color: C.white, fontFace: "Calibri", align: "center", valign: "middle",
});
s6.addShape(pres.ShapeType.roundRect, {
x: x - 0.1, y: 3.78, w: 1.75, h: 1.05,
fill: { color: C.white }, line: { color, width: 1.5 }, rectRadius: 0.05,
});
s6.addText(sub, {
x: x, y: 3.82, w: 1.55, h: 0.98, fontSize: 9, color: C.black,
fontFace: "Calibri", align: "left", valign: "top",
bullet: true,
});
});
// Additional test note
s6.addText("Also check: Hb electrophoresis (all women), Direct Coombs (if hemolysis), Anti-IF antibody (if pernicious anemia suspected)", {
x: 0.3, y: 4.93, w: 5.5, h: 0.55, fontSize: 9.5, color: C.gray,
fontFace: "Calibri", italic: true,
});
// ── Reference ranges table ──────────────────────────
s6.addShape(pres.ShapeType.rect, { x: 6.2, y: 0.88, w: 6.8, h: 0.48, fill: { color: C.navy } });
s6.addText("LABORATORY REFERENCE RANGES IN PREGNANCY (Creasy & Resnik)", {
x: 6.2, y: 0.88, w: 6.8, h: 0.48, fontSize: 11, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle", align: "center",
});
const labs = [
["Test", "1st Trimester", "2nd Trimester", "3rd Trimester"],
["Hb (g/dL)", "≥11.0", "≥10.0", "≥10.0"],
["MCV (μm³)", "81–96", "82–97", "81–99"],
["MCHC (g/dL)", "32–35", "32–35", "32–35"],
["Ferritin (μg/L)", ">20 (1st)", "Declines", "May be low"],
["Serum Iron (μg/dL)","72–143", "44–178", "30–193"],
["TIBC (μg/dL)", "235–408", "302–519", "580–597"],
["Transferrin Sat", "16–60%", "16–60%", "16–60%"],
["Serum Folate", "26–150 μg/L", "8–240 μg/L", "14–207 μg/L"],
["Serum B12 (pg/mL)","118–438", "130–656", "99–526"],
["Reticulocytes", "0.5–1.5%", "0.5–1.5%", "0.5–1.5%"],
];
labs.forEach((row, i) => {
const yy = 1.44 + i * 0.52;
const isHeader = i === 0;
const bg = isHeader ? C.teal : (i % 2 === 0 ? C.mint : C.white);
const textColor = isHeader ? C.white : C.black;
const fw = isHeader;
s6.addShape(pres.ShapeType.rect, { x: 6.2, y: yy, w: 6.8, h: 0.5, fill: { color: bg } });
const cols = [1.9, 1.55, 1.65, 1.6];
const xs = [6.25, 8.15, 9.7, 11.35];
row.forEach((cell, ci) => {
s6.addText(cell, {
x: xs[ci], y: yy, w: cols[ci], h: 0.5, fontSize: isHeader ? 10 : 9.5,
bold: fw, color: textColor, fontFace: "Calibri", valign: "middle",
});
});
});
// ════════════════════════════════════════════════════════════════
// SLIDE 7 — OUTCOMES + CONTRAINDICATED DRUGS + SCREENING
// ════════════════════════════════════════════════════════════════
let s7 = pres.addSlide();
s7.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.offwhite } });
s7.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.75, fill: { color: C.navy } });
s7.addText("OUTCOMES, DRUG SAFETY & SCREENING", {
x: 0.3, y: 0, w: 12.7, h: 0.75, fontSize: 17, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle",
});
// Maternal outcomes
s7.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.88, w: 4.0, h: 0.48, fill: { color: C.red } });
s7.addText("MATERNAL OUTCOMES", {
x: 0.3, y: 0.88, w: 4.0, h: 0.48, fontSize: 12, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle", align: "center",
});
const maternalOutcomes = [
"Fatigue, dyspnea, palpitations",
"Increased susceptibility to infection",
"Cardiac decompensation (severe anemia)",
"Reduced tolerance to peripartum hemorrhage",
"Higher perioperative risk",
"Postpartum depression (linked to IDA)",
];
s7.addText(maternalOutcomes.map(t => ({ text: t, options: { bullet: true, breakLine: true } })), {
x: 0.35, y: 1.4, w: 3.9, h: 3.0, fontSize: 10, color: C.black, fontFace: "Calibri",
});
// Fetal outcomes
s7.addShape(pres.ShapeType.rect, { x: 4.6, y: 0.88, w: 4.0, h: 0.48, fill: { color: C.gold } });
s7.addText("FETAL / NEONATAL OUTCOMES", {
x: 4.6, y: 0.88, w: 4.0, h: 0.48, fontSize: 12, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle", align: "center",
});
const fetalOutcomes = [
"Low birth weight (LBW)",
"Preterm delivery",
"Perinatal death",
"Neonatal anemia (especially severe maternal IDA)",
"Neural tube defects (folate deficiency)",
"Impaired neurodevelopment (iron/folate/B12)",
];
s7.addText(fetalOutcomes.map(t => ({ text: t, options: { bullet: true, breakLine: true } })), {
x: 4.65, y: 1.4, w: 3.9, h: 3.0, fontSize: 10, color: C.black, fontFace: "Calibri",
});
// Drug safety + screening
s7.addShape(pres.ShapeType.rect, { x: 9.0, y: 0.88, w: 4.0, h: 0.48, fill: { color: C.navy } });
s7.addText("DRUG SAFETY & SCREENING", {
x: 9.0, y: 0.88, w: 4.0, h: 0.48, fontSize: 12, bold: true,
color: C.white, fontFace: "Calibri", valign: "middle", align: "center",
});
const drugItems = [
{ drug: "Ferrous sulfate", safety: "SAFE", note: "1st-line oral iron" },
{ drug: "Ferric carboxymaltose", safety: "SAFE (2nd/3rd)","note: IV iron; avoid 1st trimester" },
{ drug: "Folic acid 0.4–0.8 mg", safety: "SAFE", note: "Periconceptional" },
{ drug: "Cyanocobalamin (B12 IM)", safety: "SAFE", note: "For pernicious anemia" },
{ drug: "Hydroxyurea", safety: "TERATOGENIC", note: "Stop before conception" },
{ drug: "Methotrexate", safety: "CONTRAIND.", note: "Folate antagonist" },
{ drug: "Iron chelators", safety: "AVOID", note: "Deferoxamine: limited data; pause in pregnancy" },
];
drugItems.forEach(({ drug, safety, note }, i) => {
const yy = 1.44 + i * 0.58;
const bg = i % 2 === 0 ? C.mint : C.white;
const safetyColor = safety === "SAFE" ? C.green : safety.includes("SAFE") ? C.teal : C.red;
s7.addShape(pres.ShapeType.rect, { x: 9.0, y: yy, w: 4.0, h: 0.54, fill: { color: bg } });
s7.addText(drug, { x: 9.05, y: yy, w: 2.0, h: 0.54, fontSize: 9.5, bold: true, color: C.navy, fontFace: "Calibri", valign: "middle" });
s7.addText(safety, { x: 11.0, y: yy, w: 1.0, h: 0.54, fontSize: 9, bold: true, color: safetyColor, fontFace: "Calibri", valign: "middle", align: "center" });
s7.addText(note, { x: 11.95, y: yy, w: 0.9, h: 0.54, fontSize: 8, italic: true, color: C.gray, fontFace: "Calibri", valign: "middle" });
});
// Screening box
s7.addShape(pres.ShapeType.roundRect, {
x: 0.3, y: 4.55, w: 12.7, h: 1.1,
fill: { color: C.navy }, rectRadius: 0.1,
});
s7.addText([
{ text: "SCREENING PROTOCOL: ", options: { bold: true, color: C.gold } },
{ text: "Check Hb at 1st trimester booking visit ", options: { color: C.white } },
{ text: "| ", options: { color: C.lightgray } },
{ text: "Repeat at 24–28 weeks ", options: { color: C.white } },
{ text: "| ", options: { color: C.lightgray } },
{ text: "Hb electrophoresis for ALL women ", options: { color: C.white } },
{ text: "| ", options: { color: C.lightgray } },
{ text: "Measure ferritin alongside Hb to detect pre-anaemic iron depletion", options: { color: C.mint } },
], {
x: 0.5, y: 4.58, w: 12.4, h: 0.55, fontSize: 11, fontFace: "Calibri", valign: "middle",
});
s7.addText("Sources: Creasy & Resnik's MFM; Harrison's 22e (2025); Goldman-Cecil; Cochrane 2024 (PMID 39145520, 38189492) | WHO / ACOG / NICE guidelines", {
x: 0.5, y: 5.1, w: 12.4, h: 0.45, fontSize: 9, color: C.lightgray,
fontFace: "Calibri", italic: true, valign: "middle",
});
// SAVE
pres.writeFile({ fileName: "/home/daytona/workspace/anemia-pregnancy-chart/Anemia_in_Pregnancy_Quick_Reference.pptx" });
console.log("DONE");