~/obg-reference/build_obg.py
#!/usr/bin/env python3
"""
Comprehensive OBG Reference Document Builder
Generates a professionally formatted DOCX using python-docx
"""
from docx import Document
from docx.shared import Pt, Inches, RGBColor, Cm
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT, WD_ALIGN_VERTICAL
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
import copy
# ─────────────────────────── helpers ────────────────────────────
def set_cell_bg(cell, hex_color):
"""Set table cell background color."""
tc = cell._tc
tcPr = tc.get_or_add_tcPr()
shd = OxmlElement('w:shd')
shd.set(qn('w:val'), 'clear')
shd.set(qn('w:color'), 'auto')
shd.set(qn('w:fill'), hex_color)
tcPr.append(shd)
def set_cell_font(cell, bold=False, size=10, color=None):
for para in cell.paragraphs:
for run in para.runs:
run.bold = bold
run.font.size = Pt(size)
if color:
run.font.color.rgb = RGBColor(*color)
def add_header_row(table, headers, bg="1A3C5E", fg=(255,255,255)):
row = table.rows[0]
for i, h in enumerate(headers):
cell = row.cells[i]
cell.text = h
set_cell_bg(cell, bg)
set_cell_font(cell, bold=True, size=9, color=fg)
cell.paragraphs[0].alignment = WD_ALIGN_PARAGRAPH.CENTER
def add_table_row(table, values, alt=False):
row = table.add_row()
bg = "EEF4FB" if alt else "FFFFFF"
for i, v in enumerate(values):
cell = row.cells[i]
cell.text = str(v)
set_cell_bg(cell, bg)
set_cell_font(cell, bold=False, size=9)
return row
def style_heading(para, level, color_hex=None):
"""Apply custom color to a heading paragraph."""
if color_hex:
for run in para.runs:
r, g, b = tuple(int(color_hex[i:i+2], 16) for i in (0, 2, 4))
run.font.color.rgb = RGBColor(r, g, b)
def add_colored_heading(doc, text, level, color="1A3C5E"):
p = doc.add_heading(text, level=level)
r, g, b = tuple(int(color[i:i+2], 16) for i in (0, 2, 4))
for run in p.runs:
run.font.color.rgb = RGBColor(r, g, b)
return p
def add_note_box(doc, text, bg="FFF3CD", border="FFC107"):
"""Add a highlighted note paragraph."""
p = doc.add_paragraph()
p.paragraph_format.left_indent = Inches(0.3)
p.paragraph_format.right_indent = Inches(0.3)
p.paragraph_format.space_before = Pt(4)
p.paragraph_format.space_after = Pt(4)
run = p.add_run(f" NOTE: {text} ")
run.bold = True
run.font.size = Pt(9)
run.font.color.rgb = RGBColor(0x85, 0x64, 0x04)
return p
def add_bullet(doc, text, level=0):
p = doc.add_paragraph(style='List Bullet')
p.paragraph_format.left_indent = Inches(0.3 + 0.2*level)
run = p.add_run(text)
run.font.size = Pt(10)
return p
def simple_table(doc, headers, rows, col_widths=None):
"""Create a styled table with header and data rows."""
t = doc.add_table(rows=1, cols=len(headers))
t.style = 'Table Grid'
t.alignment = WD_TABLE_ALIGNMENT.CENTER
add_header_row(t, headers)
for i, row in enumerate(rows):
add_table_row(t, row, alt=(i % 2 == 0))
if col_widths:
for i, row in enumerate(t.rows):
for j, cell in enumerate(row.cells):
if j < len(col_widths):
cell.width = Inches(col_widths[j])
doc.add_paragraph()
return t
# ────────────────────────────────────────────────────────────────
# BUILD DOCUMENT
# ────────────────────────────────────────────────────────────────
doc = Document()
# Page margins
for section in doc.sections:
section.top_margin = Cm(2.0)
section.bottom_margin = Cm(2.0)
section.left_margin = Cm(2.5)
section.right_margin = Cm(2.0)
# Default styles
normal_style = doc.styles['Normal']
normal_style.font.name = 'Calibri'
normal_style.font.size = Pt(10)
for lvl in range(1, 5):
try:
h = doc.styles[f'Heading {lvl}']
h.font.name = 'Calibri'
h.font.bold = True
if lvl == 1:
h.font.size = Pt(15)
elif lvl == 2:
h.font.size = Pt(12)
elif lvl == 3:
h.font.size = Pt(11)
else:
h.font.size = Pt(10)
except Exception:
pass
# ══════════════════ COVER PAGE ══════════════════
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("\n\n\n")
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("COMPREHENSIVE OBSTETRICS & GYNAECOLOGY")
run.bold = True
run.font.size = Pt(22)
run.font.color.rgb = RGBColor(0x1A, 0x3C, 0x5E)
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("ANC REFERENCE GUIDE")
run.bold = True
run.font.size = Pt(18)
run.font.color.rgb = RGBColor(0x1A, 0x3C, 0x5E)
doc.add_paragraph()
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("─────────────────────────────────────────────────")
run.font.color.rgb = RGBColor(0x1A, 0x3C, 0x5E)
doc.add_paragraph()
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("Based on: Williams Obstetrics 25e • Creasy & Resnik's Maternal-Fetal Medicine 8e\n"
"Berek & Novak's Gynecology 16e • WHO ANC Guidelines 2016 • ACOG/RCOG/FIGO")
run.font.size = Pt(11)
run.font.color.rgb = RGBColor(0x55, 0x55, 0x55)
doc.add_paragraph()
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("Date: July 2026")
run.font.size = Pt(10)
run.font.color.rgb = RGBColor(0x77, 0x77, 0x77)
doc.add_page_break()
# ══════════════════ SECTION 1: CORE DEFINITIONS ══════════════════
add_colored_heading(doc, "PART 1: CORE OBSTETRIC DEFINITIONS", 1)
add_colored_heading(doc, "Gravida and Para", 2)
simple_table(doc,
["Term", "Definition"],
[
["Gravida", "Total number of pregnancies including current one, regardless of outcome. Multiple gestation counts as ONE."],
["Nulligravida", "Never been pregnant"],
["Primigravida", "Pregnant for the first time"],
["Multigravida", "Has been pregnant more than once"],
["Para", "Number of pregnancies that reached the age of viability (≥20 weeks / ≥500 g), alive or dead"],
["Nullipara", "Never delivered at or beyond viability"],
["Primipara", "Delivered once at or beyond viability"],
["Multipara", "Delivered twice or more at viability"],
["Grand Multipara", "5 or more deliveries at or beyond viability"],
],
col_widths=[1.5, 4.5]
)
p = doc.add_paragraph()
run = p.add_run("GTPAL Notation: ")
run.bold = True
run.font.size = Pt(10)
p.add_run("Gravida / Term / Preterm / Abortions / Living children").font.size = Pt(10)
add_colored_heading(doc, "Abortion (WHO / FIGO Standard)", 2)
add_bullet(doc, "Expulsion or extraction of an embryo or fetus weighing 500 g or less (approximately ≤20-22 weeks gestation)")
add_bullet(doc, "Where weight unavailable: gestation less than 20 completed weeks")
add_bullet(doc, "WHO threshold in developing countries: before 28 weeks")
add_bullet(doc, "Types: Threatened | Inevitable | Incomplete | Complete | Missed | Septic | Recurrent")
add_colored_heading(doc, "Live Birth (WHO)", 2)
p = doc.add_paragraph("Complete expulsion or extraction of a product of conception from mother, irrespective of duration of pregnancy, which breathes or shows ANY evidence of life (heartbeat, pulsation of umbilical cord, definite voluntary muscle movement), regardless of whether cord is cut.")
p.font_size = Pt(10)
add_colored_heading(doc, "Stillbirth (WHO)", 2)
add_bullet(doc, "Birth of a baby with NO signs of life at or after 28 completed weeks gestation (birth weight ≥1000 g)")
add_bullet(doc, "Early fetal death: 20-27+6 weeks")
add_bullet(doc, "Late fetal death (Stillbirth): ≥28 weeks")
add_bullet(doc, "ACOG/CDC: ≥20 weeks | WHO international reporting: ≥28 weeks")
doc.add_paragraph()
# ══════════════════ SECTION 2: NAEGELE'S RULE ══════════════════
add_colored_heading(doc, "PART 2: NAEGELE'S RULE — EDD CALCULATION", 1)
add_colored_heading(doc, "Formula", 2)
p = doc.add_paragraph()
run = p.add_run("EDD = LMP + 9 months + 7 days OR LMP − 3 months + 7 days + 1 year")
run.bold = True
run.font.size = Pt(11)
run.font.color.rgb = RGBColor(0x1A, 0x3C, 0x5E)
p = doc.add_paragraph()
run = p.add_run("Example: ")
run.bold = True
p.add_run("LMP = 1st April → EDD = 8th January (next year)")
add_colored_heading(doc, "Indications (Reliable LMP)", 2)
for item in ["Regular menstrual cycles (28 ± 7 days)", "Certain, known LMP date",
"No OCP use in preceding 3 months", "No breastfeeding in preceding 3 months",
"No early pregnancy bleeding mimicking LMP"]:
add_bullet(doc, item)
add_colored_heading(doc, "Contraindications / Limitations", 2)
for item in ["Irregular cycles / PCOS / oligomenorrhea", "Uncertain or unknown LMP",
"Recent oral contraceptive pill use (cycle not normalized)",
"Lactation amenorrhea preceding pregnancy",
"First trimester bleeding causing confusion",
"In all above: first trimester CRL ultrasound (7-13+6 weeks) SUPERSEDES Naegele's rule"]:
add_bullet(doc, item)
# ══════════════════ SECTION 3: PERIOD OF GESTATION ══════════════════
add_colored_heading(doc, "PART 3: PERIOD OF GESTATION (POG)", 1)
add_bullet(doc, "POG calculated from FIRST DAY of LMP (not conception date)")
add_bullet(doc, "Normal pregnancy = 40 weeks (280 days) from LMP = 38 weeks from conception")
simple_table(doc,
["Trimester", "Weeks"],
[
["1st Trimester", "0 to 13+6 weeks"],
["2nd Trimester", "14 to 27+6 weeks"],
["3rd Trimester", "28 weeks to delivery"],
],
col_widths=[2.5, 3.5]
)
# ══════════════════ SECTION 4: BOOKING VISIT ══════════════════
add_colored_heading(doc, "PART 4: BOOKING VISIT AND WHO ANC CONTACTS (2016)", 1)
add_colored_heading(doc, "WHO 2016 Updated Model — 8 ANC Contacts", 2)
simple_table(doc,
["Contact", "Gestational Timing", "Key Activities"],
[
["Contact 1", "Up to 12 weeks", "History, examination, booking investigations, TT1, folic acid, risk stratification"],
["Contact 2", "20 weeks", "Anomaly scan, anatomy check, anaemia screen"],
["Contact 3", "26 weeks", "Fetal growth, BP, urine, haemoglobin"],
["Contact 4", "30 weeks", "BP, fundal height, fetal movement"],
["Contact 5", "34 weeks", "OGTT result review, anaemia management, birth planning"],
["Contact 6", "36 weeks", "Presentation, BP, GBS swab, birth plan"],
["Contact 7", "38 weeks", "Fetal wellbeing, BP monitoring"],
["Contact 8", "40 weeks", "Fetal wellbeing; if not delivered return at 41 weeks"],
],
col_widths=[1.0, 1.5, 4.0]
)
add_colored_heading(doc, "WHO Definition of Booked (Updated)", 2)
add_bullet(doc, "A woman is BOOKED if she attended ANC at least once before 20 weeks gestation and completed booking assessment with basic investigations")
add_bullet(doc, "Some definitions accept: at least 4 ANC visits, first before 20 weeks, last after 36 weeks")
add_bullet(doc, "UNBOOKED: No ANC before arrival in labor — associated with significantly higher maternal and perinatal mortality")
doc.add_paragraph()
# ══════════════════ SECTION 5: AGE COMPLICATIONS ══════════════════
add_colored_heading(doc, "PART 5: MATERNAL AND FETAL COMPLICATIONS BY MATERNAL AGE", 1)
add_colored_heading(doc, "Young Age (Teenage / Adolescent Pregnancy, <20 years)", 2)
simple_table(doc,
["Type", "Complications"],
[
["Maternal", "PIH/Preeclampsia • Iron deficiency anaemia • Cephalopelvic disproportion (CPD) • Obstructed labour • Obstetric fistula • Higher STI rates • Postpartum depression • Poor ANC compliance"],
["Fetal/Neonatal", "Prematurity/Preterm birth • Low birth weight (LBW) / IUGR • Higher perinatal mortality • Congenital anomalies (very young mothers <16 years)"],
],
col_widths=[1.5, 5.0]
)
add_colored_heading(doc, "Advanced Maternal Age (AMA, ≥35 years; Very Advanced ≥40 years)", 2)
simple_table(doc,
["Type", "Complications"],
[
["Maternal", "GDM (2-3x risk) • Gestational HTN/Preeclampsia • Placenta previa & abruption • Increased C-section rate • Uterine dysfunction • Postpartum haemorrhage • Thromboembolic events • Pre-existing medical conditions"],
["Fetal/Neonatal", "Chromosomal anomalies (Down syndrome risk: age 35=1:350, age 40=1:100, age 45=1:30) • Stillbirth (2x risk at ≥40) • IUGR/LBW • Preterm birth"],
],
col_widths=[1.5, 5.0]
)
# ══════════════════ SECTION 6: Rh INCOMPATIBILITY ══════════════════
add_colored_heading(doc, "PART 6: Rh INCOMPATIBILITY AND TREATMENT", 1)
add_colored_heading(doc, "Mechanism", 2)
add_bullet(doc, "Mother Rh-negative + Fetus Rh-positive → Fetomaternal haemorrhage → Maternal sensitisation")
add_bullet(doc, "IgG anti-D antibodies formed → cross placenta in subsequent pregnancies → destroy fetal RBCs")
add_bullet(doc, "Result: Haemolytic Disease of the Fetus and Newborn (HDFN)")
add_colored_heading(doc, "Fetal Complications (Severity by Antibody Titer)", 2)
for item in ["Fetal haemolytic anaemia", "Hydrops fetalis (severe anaemia → cardiac failure → generalised oedema)",
"Intrauterine fetal death (IUFD)", "Neonatal jaundice (within 24h of birth)",
"Kernicterus (bilirubin in basal ganglia → brain damage)", "Neonatal anaemia"]:
add_bullet(doc, item)
add_colored_heading(doc, "Direct Coombs Test (DAT) vs Indirect Coombs Test (IAT)", 2)
simple_table(doc,
["Feature", "Direct Coombs Test (DAT)", "Indirect Coombs Test (IAT)"],
[
["What it detects", "Antibodies BOUND to RBCs (in vivo sensitisation)", "FREE antibodies in maternal SERUM"],
["Sample used", "Newborn/fetal cord blood", "Mother's serum"],
["Positive in", "HDFN, autoimmune haemolytic anaemia", "Sensitised Rh-negative mother"],
["Principle", "Wash RBCs + add Coombs reagent → agglutination = positive", "Maternal serum + Rh+ RBCs → incubate → Coombs reagent → agglutination"],
["Purpose", "Diagnose HDFN in neonate", "Antenatal screening, cross-matching, monitoring Rh-negative mothers"],
],
col_widths=[1.5, 2.8, 2.8]
)
add_colored_heading(doc, "Management", 2)
p = doc.add_paragraph()
run = p.add_run("Prevention — Anti-D Immunoglobulin (Rho-GAM):")
run.bold = True
add_bullet(doc, "Dose: 300 mcg IM (covers 30 mL fetal whole blood)")
add_bullet(doc, "Routine antenatal prophylaxis: 28 weeks (and optionally 34 weeks)")
add_bullet(doc, "Post-delivery: within 72 hours of delivery of Rh+ baby")
add_bullet(doc, "After sensitising events: abortion, amniocentesis, CVS, ECV, APH, trauma — give within 72 hours")
p = doc.add_paragraph()
run = p.add_run("Monitoring sensitised mother:")
run.bold = True
add_bullet(doc, "Indirect Coombs titer every 4 weeks; critical titer = 1:16")
add_bullet(doc, "MCA-PSV Doppler (gold standard for fetal anaemia): >1.5 MoM indicates significant anaemia")
p = doc.add_paragraph()
run = p.add_run("Treatment:")
run.bold = True
add_bullet(doc, "Intrauterine transfusion (IUT) if MCA-PSV >1.5 MoM")
add_bullet(doc, "Early delivery at 32-34 weeks if near term")
add_bullet(doc, "Neonatal: phototherapy, exchange transfusion, top-up transfusion")
doc.add_paragraph()
# ══════════════════ SECTION 7: OCCUPATIONAL & RELIGIOUS ══════════════════
add_colored_heading(doc, "PART 7: OCCUPATIONAL AND RELIGIOUS COMPLICATIONS IN PREGNANCY", 1)
add_colored_heading(doc, "Occupational Hazards", 2)
simple_table(doc,
["Hazard Type", "Examples", "Pregnancy Risk"],
[
["Physical", "Prolonged standing, heavy lifting", "Preterm labour, LBW, varicosities, back pain"],
["Chemical", "Pesticides, solvents, anaesthetic gases", "Miscarriage, congenital anomalies, IUGR"],
["Radiation", "X-ray workers, radiographers", "Teratogenesis if >50 mGy; see Part 16"],
["Biological", "Healthcare workers", "Rubella, CMV, HBV, HIV, COVID-19 exposure"],
["Psychosocial", "High stress, shift work, night work", "Preterm birth, GDM, PIH, circadian disruption"],
],
col_widths=[1.4, 2.0, 3.0]
)
add_colored_heading(doc, "Religious Practice Considerations", 2)
simple_table(doc,
["Practice", "Risk", "Recommendation"],
[
["Fasting (Ramadan, Yom Kippur)", "Ketosis, dehydration, hypoglycaemia, reduced FM — especially in GDM", "Counselling; GDM patients may be exempt"],
["Dietary restrictions (vegan/vegetarian)", "Iron, B12, calcium, zinc deficiency", "Supplementation; dietitian referral"],
["Herbal/traditional remedies", "Some teratogenic or abortifacient", "Counsel against; document all use"],
["Refusal of blood products (JW)", "Risk in PPH, surgery", "Advance directive, cell salvage, iron optimisation"],
["Pilgrimage (Hajj)", "DVT, dehydration, infection, heat exhaustion", "Delay if <20 or >32 weeks; hydration; TED stockings"],
],
col_widths=[1.8, 2.4, 2.4]
)
doc.add_page_break()
# ══════════════════ SECTION 8: GOOD DATES / EXCELLENT DATES ══════════════════
add_colored_heading(doc, "PART 8: GOOD DATES AND EXCELLENT DATES", 1)
add_colored_heading(doc, "Good Dates (Reliable LMP)", 2)
for item in ["LMP is certain and known",
"Regular menstrual cycles (28 ± 7 days)",
"No OCP use in preceding 3 months",
"No breastfeeding in preceding 3 months",
"No early pregnancy bleeding mistaken for LMP",
"First trimester ultrasound (CRL) concordant — within 7 days of LMP dates"]:
add_bullet(doc, item)
add_colored_heading(doc, "Excellent Dates (Gold Standard)", 2)
for item in ["All criteria for Good Dates PLUS:",
"First trimester CRL ultrasound performed at 7-13+6 weeks",
"CRL-based EDD differs from LMP-based EDD by ≤5-7 days",
"IVF/ART: embryo transfer date known (most precise — EDD = transfer date + 266 days for day-3 embryo)"]:
add_bullet(doc, item)
add_note_box(doc, "If US-based EDD and LMP-based EDD differ by >7 days (1st trimester), US dating supersedes LMP.")
# ══════════════════ SECTION 9: PRETERM / POST-TERM ══════════════════
add_colored_heading(doc, "PART 9: GESTATIONAL AGE CLASSIFICATION — PRETERM, TERM, POST-TERM", 1)
add_colored_heading(doc, "Preterm (WHO/ACOG) — Delivery before 37+0 completed weeks", 2)
simple_table(doc,
["Classification", "Gestational Age", "Notes"],
[
["Extremely Preterm", "< 28+0 weeks", "Highest mortality/morbidity"],
["Very Preterm", "28+0 to 31+6 weeks", "High NICU dependency"],
["Moderate Preterm", "32+0 to 33+6 weeks", "Better outcomes with steroids"],
["Late Preterm", "34+0 to 36+6 weeks", "Largest group; still at risk"],
],
col_widths=[2.0, 2.0, 2.5]
)
add_colored_heading(doc, "By Aetiology", 2)
for item in ["Spontaneous preterm labour (PTL)",
"Preterm Premature Rupture of Membranes (PPROM)",
"Iatrogenic/medically indicated preterm delivery (PIH, IUGR, etc.)"]:
add_bullet(doc, item)
add_colored_heading(doc, "Term Gestational Age Categories (ACOG 2013)", 2)
simple_table(doc,
["Category", "Gestational Age"],
[
["Early Term", "37+0 to 38+6 weeks"],
["Full Term", "39+0 to 40+6 weeks"],
["Late Term", "41+0 to 41+6 weeks"],
["Post-Term", "≥ 42+0 weeks"],
],
col_widths=[2.5, 3.5]
)
add_colored_heading(doc, "Post-Date vs Post-Term", 2)
add_bullet(doc, "Post-dates: Beyond EDD (>40 weeks) — colloquial term")
add_bullet(doc, "Prolonged pregnancy: >41+0 weeks")
add_bullet(doc, "Post-term (official): ≥42+0 completed weeks (WHO/ACOG)")
add_bullet(doc, "Risks: uteroplacental insufficiency, oligohydramnios, macrosomia, meconium aspiration, stillbirth (risk doubles after 42 weeks)")
doc.add_page_break()
# ══════════════════ SECTION 10: BLEEDING PV ══════════════════
add_colored_heading(doc, "PART 10: BLEEDING PV — CAUSES BY TRIMESTER", 1)
add_colored_heading(doc, "First Trimester Bleeding (0-13+6 weeks)", 2)
simple_table(doc,
["Cause", "Key Features"],
[
["Threatened Abortion", "Bleeding + closed os + viable fetus on US"],
["Inevitable Abortion", "Bleeding + open os + painful cramps"],
["Incomplete Abortion", "Partial expulsion, open os, retained products"],
["Complete Abortion", "All products expelled, os closing, pain reducing"],
["Missed Abortion", "No symptoms, fetal demise on US (no FHR), brownish discharge"],
["Ectopic Pregnancy", "Amenorrhea + unilateral pain + bleeding + adnexal mass; raised hCG without IUP on US — EMERGENCY"],
["Hydatidiform Mole", "Heavy bleeding, uterus > dates, hyperemesis, snowstorm on US, very high hCG"],
["Implantation Bleeding", "Scanty spotting 6-10 days post conception, self-limiting"],
["Cervical Ectropion/Polyp", "Post-coital, painless, cervix on speculum"],
],
col_widths=[2.0, 4.5]
)
add_colored_heading(doc, "Second Trimester Bleeding (14-27+6 weeks)", 2)
for item in ["Cervical incompetence — painless dilatation, 'bulging membranes'",
"Placenta previa — painless, bright red bleeding",
"Abruptio placentae — painful, dark blood, uterine tenderness",
"Late miscarriage / mid-trimester loss",
"Vasa previa — fetal blood, occurs with membrane rupture",
"Cervical causes — polyp, ectropion, rarely carcinoma"]:
add_bullet(doc, item)
add_colored_heading(doc, "Third Trimester — Antepartum Haemorrhage (APH, ≥28 weeks)", 2)
simple_table(doc,
["Cause", "Features", "Management Clue"],
[
["Placenta Previa", "Painless, bright red, recurrent, no uterine tenderness, no fetal distress initially", "NEVER do VE before USS"],
["Abruptio Placentae", "Painful, dark blood, woody-hard uterus, fetal distress, concealed possible", "Immediate delivery if severe"],
["Vasa Previa", "Fetal blood — bright red at membrane rupture; fetal bradycardia", "Emergency LSCS"],
["Uterine Rupture", "Severe pain, cessation of contractions, fetal parts palpable, maternal shock", "Emergency laparotomy"],
["Bloody Show", "Labour onset, mucus-mixed, painless initially", "Assess for labour"],
["Cervical Causes", "Polyp, ectropion, carcinoma — post-coital / contact bleeding", "Speculum exam"],
],
col_widths=[1.8, 2.8, 2.0]
)
doc.add_page_break()
# ══════════════════ SECTION 11: LEAKING PV ══════════════════
add_colored_heading(doc, "PART 11: LEAKING PV — DIFFERENTIATION FROM WHITE DISCHARGE", 1)
simple_table(doc,
["Feature", "Amniotic Fluid (LEAKING)", "White Discharge (Leucorrhoea)"],
[
["Color", "Clear / pale straw", "White / yellow"],
["Odor", "Odorless or faint sweet", "May be offensive if infected"],
["Amount", "Continuous trickle, worsens with Valsalva / activity", "Constant but not progressive"],
["Ferning test (microscopy)", "POSITIVE — arborization pattern on dry slide", "NEGATIVE"],
["Nitrazine / pH test", "ALKALINE pH 7-7.5 — turns yellow paper BLUE", "ACIDIC pH 4-4.5 — paper stays yellow"],
["Pooling on speculum", "PRESENT in posterior fornix", "Absent"],
["AmniSure / IGFBP-1 test", "POSITIVE", "Negative"],
["Fetal fibronectin", "May be positive", "Usually negative"],
],
col_widths=[2.2, 2.5, 2.5]
)
add_note_box(doc, "In ANY trimester: PPROM (before 37 weeks) or PROM (at term before labour) — confirm with ferning + pH + pooling. Never miss leaking in preterm — risk of chorioamnionitis and cord prolapse.")
doc.add_paragraph()
# ══════════════════ SECTION 12: ANC CHIEF COMPLAINTS PER TRIMESTER ══════════════════
add_colored_heading(doc, "PART 12: ANC CHIEF COMPLAINTS PER TRIMESTER", 1)
simple_table(doc,
["Trimester", "Common Chief Complaints"],
[
["1st Trimester\n(0-13+6 wks)", "Amenorrhea (missed period) • Nausea and vomiting • Breast tenderness/heaviness • Frequency of micturition • Fatigue • Implantation spotting • Mild abdominal cramps • Headache • Ptyalism (excess salivation)"],
["2nd Trimester\n(14-27+6 wks)", "Quickening (first fetal movements) • Increasing abdominal size • Back pain (lumbar/sacral) • Heartburn/reflux • Leg cramps • Varicosities • Constipation • Skin changes (linea nigra, chloasma, striae) • Nasal congestion/epistaxis • Ankle oedema (physiological)"],
["3rd Trimester\n(28 wks-delivery)", "Increasing abdominal girth • Reduced fetal movements (ALARM) • Braxton Hicks • Dyspnoea • Frequency of micturition • Oedema (feet/ankles; face = PREECLAMPSIA alert) • Headache/visual disturbances • Epigastric pain • Leaking PV • Show • Labour pains"],
],
col_widths=[1.5, 5.0]
)
doc.add_page_break()
# ══════════════════ SECTION 13: IMMUNIZATION ══════════════════
add_colored_heading(doc, "PART 13: IMMUNIZATION IN PREGNANCY", 1)
add_colored_heading(doc, "Recommended Vaccines", 2)
simple_table(doc,
["Vaccine", "Dose", "Route", "Timing", "Notes"],
[
["Tetanus Toxoid (TT)\nor Td (preferred)", "0.5 mL x 2 doses\n(TT2: 4 weeks after TT1)", "IM (deltoid)", "TT1 at booking;\nTT2 at 4 weeks", "If previously immunized (TT3/4/5): single 0.5 mL booster"],
["Influenza (inactivated)", "0.5 mL single dose", "IM", "Any trimester;\nespecially 2nd/3rd", "Recommended every flu season; reduces maternal and neonatal morbidity"],
["Tdap (Pertussis)", "0.5 mL single dose", "IM", "27-36 weeks\n(each pregnancy)", "Protects neonate via transplacental antibodies before their own immunisation"],
["COVID-19\n(inactivated/mRNA)", "Per protocol", "IM", "Any trimester", "WHO recommends for all pregnant women"],
["Hepatitis B\n(if non-immune)", "1 mL x 3 doses", "IM", "Any trimester", "0, 1, 6 month schedule; safe in pregnancy"],
],
col_widths=[1.5, 1.4, 0.7, 1.2, 2.5]
)
add_colored_heading(doc, "Vaccines CONTRAINDICATED in Pregnancy (Live vaccines)", 2)
for item in ["MMR (measles-mumps-rubella) — give postpartum",
"Varicella (chickenpox) — give postpartum",
"Yellow fever — use only if benefit >> risk (unavoidable travel to endemic area)",
"Oral Polio Vaccine (OPV) — use IPV instead",
"BCG — avoid"]:
add_bullet(doc, item)
doc.add_paragraph()
# ══════════════════ SECTION 14: LAB INVESTIGATIONS ══════════════════
add_colored_heading(doc, "PART 14: LAB INVESTIGATIONS BY TRIMESTER", 1)
simple_table(doc,
["Trimester", "Investigation", "Purpose"],
[
["1st (Booking)", "Blood group + Rh type", "Type and screen; Rh status"],
["1st (Booking)", "CBC (Hb, platelets)", "Anaemia, thrombocytopaenia"],
["1st (Booking)", "Urine R/M + C/S", "Asymptomatic bacteriuria (treat to prevent pyelonephritis)"],
["1st (Booking)", "Blood glucose (fasting/random)", "Screen for overt DM"],
["1st (Booking)", "VDRL/RPR", "Syphilis screening"],
["1st (Booking)", "HIV (with counselling)", "PMTCT"],
["1st (Booking)", "HBsAg", "Hepatitis B — neonatal prophylaxis planning"],
["1st (Booking)", "Rubella IgG", "Immunity status"],
["1st (Booking)", "TSH", "Thyroid disease screening"],
["1st (Booking)", "Indirect Coombs test", "If Rh-negative — detect alloimmunisation"],
["1st (Booking)", "NIPT / Combined screen (PAPP-A + free beta-hCG + NT US)", "Down syndrome + chromosomal anomaly screening (11-13+6 wks)"],
["2nd (14-22 wks)", "Anomaly scan (18-20 wks)", "Structural anomaly detection"],
["2nd (15-20 wks)", "Triple/Quad screen (AFP, hCG, uE3, Inhibin A)", "NTD + Down syndrome screen"],
["2nd", "Amniocentesis (if indicated)", "Karyotype, genetic diagnosis"],
["2nd-3rd (24-28 wks)", "GCT 50g (screening) then OGTT 75g if positive", "GDM diagnosis"],
["3rd (28 wks)", "Repeat CBC", "Anaemia"],
["3rd (35-37 wks)", "Group B Streptococcus (GBS) swab", "Intrapartum GBS prophylaxis"],
["3rd", "Repeat urine C/S, HIV, VDRL (if high risk)", "Per protocol"],
["3rd", "NST, BPP, Doppler, AFI", "Fetal well-being"],
],
col_widths=[1.4, 2.5, 2.7]
)
doc.add_page_break()
# ══════════════════ SECTION 15: HYPEREMESIS ══════════════════
add_colored_heading(doc, "PART 15: HYPEREMESIS GRAVIDARUM", 1)
add_colored_heading(doc, "Definition and Diagnostic Criteria (CMAJ 2024 / RCOG 2024)", 2)
for item in ["Onset: typically 4-6 weeks, peaks 8-12 weeks",
"Persistent vomiting not relieved by standard measures",
"Weight loss ≥5% of pre-pregnancy body weight",
"Dehydration + ketonuria (2+ on urinalysis)",
"Electrolyte imbalance (hyponatraemia, hypokalaemia)",
"PUQE-24 score ≥13 = severe",
"Ketonuria NOT required for diagnosis (CMAJ 2024)"]:
add_bullet(doc, item)
add_colored_heading(doc, "Causes", 2)
p = doc.add_paragraph()
run = p.add_run("Physiological: ")
run.bold = True
run.font.color.rgb = RGBColor(0x1A, 0x3C, 0x5E)
p.add_run("Peak hCG (8-12 weeks) • Oestrogen excess • Progesterone (reduced gastric motility) • H. pylori association • Thyroid (transient gestational hyperthyroidism — hCG cross-reacts with TSH receptor) • Psychosocial factors")
p = doc.add_paragraph()
run = p.add_run("Pathological (to exclude): ")
run.bold = True
run.font.color.rgb = RGBColor(0xC0, 0x39, 0x2B)
p.add_run("Gastroenteritis • Peptic ulcer • Pancreatitis • Hepatitis • Appendicitis • UTI/Pyelonephritis • True thyrotoxicosis • DKA • Raised ICP • Vestibular disease")
add_colored_heading(doc, "Treatment", 2)
simple_table(doc,
["Step", "Treatment", "Notes"],
[
["1 - IV fluids", "Normal saline with KCl", "NOT dextrose first — risk of Wernicke's encephalopathy"],
["2 - Thiamine", "B1 100 mg IV BEFORE any dextrose", "MANDATORY to prevent Wernicke's"],
["3 - Anti-emetics", "Ondansetron • Metoclopramide • Prochlorperazine • Promethazine", "Ondansetron: use cautiously (risk of cleft palate if 1st trimester, limited data)"],
["4 - B6 ± Doxylamine", "Pyridoxine 25 mg + Doxylamine 12.5 mg (Diclegis)", "First-line for mild-moderate NVP"],
["5 - Steroids", "Methylprednisolone 16 mg TDS tapering", "Refractory hyperemesis only"],
["6 - Nutrition", "NG feeding or TPN if oral intake impossible", "Avoid oral iron during acute HG"],
],
col_widths=[1.2, 2.5, 3.0]
)
add_colored_heading(doc, "Complications of Untreated Hyperemesis", 2)
for item in ["Wernicke's encephalopathy (thiamine deficiency — classic triad: confusion, ataxia, ophthalmoplegia)",
"Mallory-Weiss oesophageal tears",
"Fetal growth restriction / LBW",
"Preterm birth",
"Marchiafava-Bignami (rare corpus callosum demyelination)",
"Maternal muscle wasting, severe electrolyte disturbances"]:
add_bullet(doc, item)
doc.add_paragraph()
# ══════════════════ SECTION 16: FEVER WITH RASH ══════════════════
add_colored_heading(doc, "PART 16: FEVER WITH RASH IN PREGNANCY — IMPORTANCE", 1)
p = doc.add_paragraph("Fever with rash is critical because several infections causing this combination are teratogenic, cause fetal death, or cause serious neonatal disease.")
simple_table(doc,
["Infection", "Fetal / Neonatal Risk"],
[
["Rubella (German measles)", "Congenital rubella syndrome: cataracts, SNHL, CHD (PDA, pulmonary stenosis), microcephaly, IUGR — WORST in 1st trimester (risk 90% <11 wks)"],
["Varicella (Chickenpox)", "Congenital varicella syndrome: skin scarring, limb hypoplasia, eye defects, CNS (5-12 weeks); Neonatal varicella if maternal VZV within 5 days of delivery — can be fatal"],
["Parvovirus B19 (Slapped Cheek)", "Fetal hydrops (profound anaemia), aplastic crisis, IUFD — especially 2nd trimester"],
["CMV", "Microcephaly, periventricular calcifications, SNHL, IUGR, hepatosplenomegaly — most common congenital infection"],
["Zika Virus", "Microcephaly, brain malformations (calcifications, cortical atrophy)"],
["Dengue", "Preterm birth, neonatal thrombocytopaenia, neonatal dengue"],
["Measles", "Miscarriage, preterm, pneumonia — no proven teratogenicity"],
["Syphilis (secondary)", "Congenital syphilis: stillbirth, multi-organ disease, rash, hepatomegaly, SNHL"],
],
col_widths=[1.8, 4.7]
)
doc.add_page_break()
# ══════════════════ SECTION 17: RADIATION ══════════════════
add_colored_heading(doc, "PART 17: RADIATION IN PREGNANCY AND IMAGING SAFETY", 1)
add_colored_heading(doc, "Acceptable Radiation Dose", 2)
add_bullet(doc, "Threshold for fetal harm: >50 mGy (5 rad) — organogenesis (2-8 weeks) most sensitive")
add_bullet(doc, "US recommended safe limit: <50 mGy throughout pregnancy")
add_bullet(doc, "Most diagnostic X-rays deliver far below threshold")
simple_table(doc,
["Investigation", "Approximate Fetal Dose", "Safe?"],
[
["Chest X-ray (single)", "0.01 mGy", "Yes — negligible"],
["Abdomen/pelvis X-ray", "1-3 mGy", "Yes"],
["CT Abdomen/Pelvis", "8-25 mGy", "Acceptable if necessary"],
["CT Chest", "<0.1 mGy", "Yes"],
["Barium Enema", "1.4-4 mGy", "Yes if necessary"],
["Nuclear medicine (Tc-99m)", "~5 mGy", "Generally acceptable"],
["I-131 (radioactive iodine)", "High thyroid dose", "CONTRAINDICATED"],
],
col_widths=[2.5, 1.8, 2.0]
)
add_colored_heading(doc, "Imaging Priority in Pregnancy", 2)
simple_table(doc,
["Modality", "Safety", "Notes"],
[
["Ultrasound", "SAFEST — no ionising radiation", "First choice for all obstetric imaging"],
["MRI (without gadolinium)", "Safe — no ionising radiation", "Second choice; avoid gadolinium especially 1st trimester"],
["X-ray", "Low dose — generally safe", "Use if clinically necessary; shield uterus"],
["CT scan", "Higher dose — use if necessary", "MRI preferred; use when CT changes management"],
["PET/Nuclear medicine", "Avoid if possible", "Case-by-case risk-benefit"],
],
col_widths=[1.8, 1.8, 3.0]
)
doc.add_paragraph()
# ══════════════════ SECTION 18: SUPPLEMENTS ══════════════════
add_colored_heading(doc, "PART 18: FOLIC ACID, IRON, CALCIUM — DOSES AND DURATION", 1)
simple_table(doc,
["Supplement", "Phase", "Dose", "Duration", "Route", "Notes"],
[
["Folic Acid", "Preconception", "400-800 mcg/day", "≥1 month before conception", "Oral", "Prevents neural tube defects"],
["Folic Acid", "Pregnancy (standard)", "400-800 mcg/day", "Throughout (esp. first 12 weeks)", "Oral", "Neural tube closes day 26-28"],
["Folic Acid", "High-risk (prev NTD, anticonvulsants, DM, obesity)", "5 mg/day", "3 months pre-conception to 12 weeks", "Oral", "High-dose regimen"],
["Iron (WHO 2016)", "All pregnant women", "30-60 mg elemental iron/day + 400 mcg folate", "Throughout pregnancy", "Oral", "Prevents IDA"],
["Iron", "Anaemia (Hb <11 g/dL)", "120 mg elemental iron/day + folate", "Until corrected, then 30-60 mg/day", "Oral", "Monitor Hb response"],
["Iron", "Intermittent (intolerant)", "120 mg elemental iron once weekly", "1st ANC contact to delivery", "Oral", "Reduces GI side effects"],
["Calcium", "All pregnant women", "1000-1200 mg/day (dietary)", "Throughout", "Oral/Dietary", ""],
["Calcium", "PIH prevention (low dietary Ca)", "1.5-2 g/day elemental calcium", "From 20 weeks", "Oral (divided doses)", "Reduces preeclampsia risk ~50% (WHO)"],
["Calcium", "Lactation", "1000-1200 mg/day", "Throughout breastfeeding", "Oral", ""],
],
col_widths=[1.3, 1.5, 1.6, 1.6, 0.8, 1.8]
)
add_note_box(doc, "Give calcium and iron at DIFFERENT meal times — calcium inhibits iron absorption. Common ferrous sulfate 325 mg = 65 mg elemental iron.")
doc.add_page_break()
# ══════════════════ SECTION 19: DRUGS ══════════════════
add_colored_heading(doc, "PART 19: DRUGS AVOIDED IN PREGNANCY AND LACTATION", 1)
add_colored_heading(doc, "Key Drugs Contraindicated in Pregnancy", 2)
simple_table(doc,
["Drug", "Risk to Fetus", "Safe Alternative"],
[
["ACE Inhibitors\n(enalapril, lisinopril)", "Fetal renal agenesis, oligohydramnios, neonatal renal failure (2nd/3rd trimester)", "Methyldopa, Labetalol, Nifedipine"],
["ARBs (losartan)", "Same as ACE inhibitors", "Methyldopa, Labetalol"],
["Warfarin", "Embryopathy 6-12 wks (stippled epiphyses, nasal hypoplasia); CNS anomalies; fetal haemorrhage", "LMWH (Enoxaparin) or UFH"],
["Tetracyclines\n(doxycycline)", "Dental staining, impaired bone growth (2nd/3rd trimester)", "Amoxicillin, Erythromycin, Azithromycin"],
["Fluoroquinolones", "Cartilage damage (animal data)", "Beta-lactams, Nitrofurantoin (avoid near term)"],
["Methotrexate", "Embryotoxic — CNS, limb, craniofacial defects", "Contraindicated; avoid pregnancy 3 months after"],
["Isotretinoin\n(Accutane)", "Severe craniofacial, CNS, cardiac anomalies", "Topical: azelaic acid, topical erythromycin"],
["NSAIDs\n(after 32 wks)", "Premature DA closure, oligohydramnios", "Paracetamol (acetaminophen)"],
["Sodium Valproate", "NTDs, autism, cognitive impairment — HIGH RISK", "Lamotrigine, Levetiracetam"],
["Phenytoin", "Fetal hydantoin syndrome: dysmorphic features, IUGR", "Levetiracetam"],
["Carbamazepine", "Spina bifida, craniofacial defects", "Lamotrigine"],
["Lithium", "Ebstein's anomaly (tricuspid valve)", "Quetiapine (lower risk)"],
["Streptomycin/Aminoglycosides", "Sensorineural deafness, renal toxicity", "Penicillin, Erythromycin"],
["Statins", "Possible teratogen (uncertain)", "Stop statins; resume postpartum"],
["Radioactive Iodine (I-131)", "Fetal thyroid ablation", "PTU (1st trimester) / Methimazole (2nd/3rd)"],
["Thalidomide", "Phocomelia (limb reduction defects)", "Strictly contraindicated"],
["Alcohol", "Fetal Alcohol Syndrome: IUGR, CNS, facial anomalies", "Complete abstinence"],
],
col_widths=[1.5, 2.5, 2.5]
)
add_colored_heading(doc, "Key Drugs Avoided in Lactation", 2)
simple_table(doc,
["Drug", "Risk to Infant", "Alternative"],
[
["Tetracyclines", "Dental staining", "Amoxicillin, Erythromycin"],
["Fluoroquinolones", "Cartilage risk", "Beta-lactams"],
["Methotrexate", "Immunosuppression", "Temporary breastfeeding cessation"],
["Lithium", "Toxicity", "Valproate, Olanzapine (monitor)"],
["Radioactive iodine", "Thyroid ablation", "Stop feeding 48h post-dose"],
["Amiodarone", "Neonatal thyroid dysfunction", "Avoid if possible"],
["Cytotoxic drugs", "Neonatal cytotoxicity", "Stop breastfeeding"],
["Alcohol (>1-2 units)", "Sedation, developmental delay", "Abstain or wait 2h per unit"],
],
col_widths=[1.8, 2.2, 2.6]
)
add_note_box(doc, "Generally SAFE in lactation: Paracetamol, short-term ibuprofen, amoxicillin, cefalexin, metronidazole, methyldopa, labetalol, nifedipine, heparin, insulin, low-dose prednisolone.")
doc.add_page_break()
# ══════════════════ SECTION 20: NST / CTG ══════════════════
add_colored_heading(doc, "PART 20: NST (NON-STRESS TEST) AND CTG INTERPRETATION", 1)
add_colored_heading(doc, "Non-Stress Test (NST)", 2)
add_bullet(doc, "Electronic fetal monitoring WITHOUT contractions — assesses FHR response to fetal movement")
add_bullet(doc, "Principle: Normally, FHR accelerates with fetal movement (intact CNS = 'reactive')")
add_bullet(doc, "Equipment: CTG/cardiotocograph, external Doppler transducer")
add_bullet(doc, "Duration: 20 minutes; extend to 40 minutes before calling non-reactive")
add_bullet(doc, "Indications: High-risk pregnancy, reduced FM, post-dates, GDM, PIH, IUGR, SGA")
add_bullet(doc, "When to start: From 28 weeks; 32-34 weeks standard in most protocols")
add_colored_heading(doc, "NST Interpretation", 2)
simple_table(doc,
["Result", "Criteria", "Action"],
[
["REACTIVE (Normal)", "≥2 accelerations in 20 min; each ≥15 bpm above baseline for ≥15 seconds\n(<32 weeks: ≥10 bpm for ≥10 seconds)", "Reassure; routine follow-up"],
["NON-REACTIVE (NTNB)", "Fails reactive criteria in 40 minutes", "Vibroacoustic stimulation; extend to 40 min; if still non-reactive → BPP or CST"],
["NTNB causes", "Fetal sleep cycle (commonest) • Prematurity • Fetal compromise • CNS depressants (opioids, sedatives) • Steroids given <48h prior", "Investigate cause; serial monitoring"],
],
col_widths=[1.8, 3.0, 2.0]
)
add_colored_heading(doc, "Contraction Stress Test (CST)", 2)
add_bullet(doc, "Negative CST (NORMAL): No late decelerations — adequate placental reserve")
add_bullet(doc, "Positive CST (ABNORMAL): Persistent late decelerations with >50% contractions — placental insufficiency")
doc.add_paragraph()
# ══════════════════ SECTION 21: SCANS ══════════════════
add_colored_heading(doc, "PART 21: ANTENATAL ULTRASOUND SCANS — IDEAL WEEKS AND SIGNIFICANCE", 1)
simple_table(doc,
["Scan", "Ideal Week", "Key Structures Assessed", "Significance"],
[
["Viability / Early Scan", "6-8 weeks", "FHR, gestational sac, CRL, number of fetuses, adnexa", "Confirm IUP, viability, exclude ectopic, date by CRL"],
["First Trimester Combined / NT Scan", "11+2 to 13+6 weeks\n(CRL 45-84 mm)", "NT (normal <3.5 mm), nasal bone, ductus venosus, tricuspid flow, CRL, anatomy survey", "Trisomy 21/18/13 screening; major cardiac defects; chorionicity in twins"],
["Anomaly / Morphology Scan", "18-20 weeks\n(up to 22 weeks)", "Full fetal anatomy: head (BPD, cerebellum, CSP), face, heart (4-chamber + outflow tracts), spine, abdomen (stomach, kidneys, bladder, AC), limbs, cord insertion; placenta; AFI; cervical length if indicated", "Detect major structural anomalies (cardiac, NTD, abdominal wall defects, renal anomalies, skeletal dysplasias)"],
["Growth Scan (standard)", "28-32 weeks", "Biometry (BPD, HC, AC, FL) → EFW; AFI/SDP; placental site + maturity; umbilical artery Doppler (RI, PI, S/D ratio); presentation", "IUGR / macrosomia detection; placental insufficiency; oligohydramnios/polyhydramnios"],
["Late Growth / Pre-labour Scan", "34-36 weeks", "EFW, presentation, Doppler, AFI, placental position", "Birth planning; confirm presentation; placenta previa re-assessment"],
],
col_widths=[1.4, 1.3, 2.8, 2.0]
)
doc.add_paragraph()
# ══════════════════ SECTION 22: AFI / SDP ══════════════════
add_colored_heading(doc, "PART 22: AFI AND SDP (AMNIOTIC FLUID ASSESSMENT)", 1)
simple_table(doc,
["Parameter", "Normal", "Oligohydramnios", "Polyhydramnios"],
[
["AFI (4-quadrant sum)", "8-24 cm", "<5 cm", ">24 cm"],
["SDP / MVP (single deepest pocket)", "2-8 cm", "<2 cm", ">8 cm"],
],
col_widths=[2.0, 1.5, 1.5, 1.5]
)
simple_table(doc,
["Condition", "Causes"],
[
["Oligohydramnios", "Fetal renal agenesis (Potter's) • IUGR/Uteroplacental insufficiency • PPROM/PROM • Post-term pregnancy • NSAIDs"],
["Polyhydramnios", "Fetal GI obstruction (duodenal/oesophageal atresia) • CNS anomalies (anencephaly — cannot swallow) • Neuromuscular (reduced swallowing) • GDM (most common maternal cause) • Idiopathic (60%)"],
],
col_widths=[2.0, 5.5]
)
add_note_box(doc, "SDP preferred for multiple pregnancies; AFI preferred for singleton monitoring. Recent evidence suggests SDP reduces unnecessary intervention vs AFI.")
doc.add_page_break()
# ══════════════════ SECTION 23: OGCT / OGTT / GDM ══════════════════
add_colored_heading(doc, "PART 23: OGCT, OGTT, GDM, PIH, PREECLAMPSIA, ECLAMPSIA", 1)
add_colored_heading(doc, "OGCT — Glucose Challenge Test (Screening)", 2)
add_bullet(doc, "Dose: 50 g oral glucose — NON-FASTING")
add_bullet(doc, "Blood drawn at 1 HOUR")
add_bullet(doc, "Cut-off: ≥7.8 mmol/L (140 mg/dL) → POSITIVE → proceed to OGTT")
add_bullet(doc, "Some centres: ≥7.2 mmol/L (130 mg/dL) for higher sensitivity")
add_bullet(doc, "When: 24-28 weeks routine; earlier in high-risk women")
add_colored_heading(doc, "OGTT — Oral Glucose Tolerance Test (Diagnostic)", 2)
p = doc.add_paragraph()
run = p.add_run("Procedure: ")
run.bold = True
for step in ["Fast 8-14 hours overnight",
"Fasting plasma glucose (FPG) taken",
"75 g oral glucose in 250-300 mL water over 5 minutes",
"Blood at 1 hour and 2 hours",
"Patient remains seated, no smoking, no exercise during test"]:
add_bullet(doc, step)
add_colored_heading(doc, "WHO/IADPSG 2013 Diagnostic Criteria (75 g OGTT)", 2)
simple_table(doc,
["Diagnosis", "Fasting", "1-hour", "2-hour"],
[
["GDM (any 1 threshold met)", "≥5.1 mmol/L (92 mg/dL)", "≥10.0 mmol/L (180 mg/dL)", "≥8.5 mmol/L (153 mg/dL)"],
["Overt DM in pregnancy", "≥7.0 mmol/L (126 mg/dL)", "—", "≥11.1 mmol/L (200 mg/dL)"],
],
col_widths=[2.0, 1.8, 1.5, 1.5]
)
add_colored_heading(doc, "OGTT Contraindications", 2)
for item in ["Active hyperemesis gravidarum", "Gastroparesis (delayed absorption)", "Post-bariatric surgery (dumping syndrome risk)"]:
add_bullet(doc, item)
add_colored_heading(doc, "High-Risk Screening (Early OGTT <20 weeks)", 2)
for item in ["BMI ≥30", "Previous GDM", "Previous macrosomic baby (>4.5 kg)",
"First-degree relative with DM", "PCOS",
"Previous unexplained stillbirth", "Glycosuria on routine urinalysis"]:
add_bullet(doc, item)
doc.add_paragraph()
# ══════════════════ SECTION 24: HYPERTENSIVE DISORDERS ══════════════════
add_colored_heading(doc, "PART 24: HYPERTENSIVE DISORDERS OF PREGNANCY", 1)
simple_table(doc,
["Condition", "Definition"],
[
["Chronic Hypertension", "HTN diagnosed before pregnancy OR before 20 weeks; persists >12 weeks postpartum"],
["Gestational Hypertension", "NEW onset HTN ≥140/90 mmHg AFTER 20 weeks WITHOUT proteinuria; resolves by 12 weeks postpartum"],
["Preeclampsia", "NEW onset HTN ≥140/90 after 20 weeks PLUS proteinuria ≥300 mg/24h (or PCR ≥30 mg/mmol) OR end-organ damage"],
["Severe Preeclampsia", "BP ≥160/110 + ≥1 severe feature"],
["Eclampsia", "Seizures in a preeclamptic woman with no other cause"],
["HELLP Syndrome", "Haemolysis + Elevated Liver enzymes + Low Platelets — severe preeclampsia variant"],
["Superimposed Preeclampsia", "Preeclampsia developing on background of pre-existing chronic HTN"],
],
col_widths=[2.0, 5.0]
)
add_colored_heading(doc, "Severe Features of Preeclampsia (ACOG 2024)", 2)
for item in ["BP ≥160/110 mmHg on two occasions ≥4 hours apart",
"Thrombocytopaenia (<100,000/mm³)",
"Renal impairment (creatinine >1.1 mg/dL or doubling of baseline)",
"Impaired liver function (transaminases >2x normal; epigastric/RUQ pain)",
"Pulmonary oedema",
"New-onset headache unresponsive to medication",
"Visual disturbances (scotomata, blurred vision)"]:
add_bullet(doc, item)
add_colored_heading(doc, "Eclampsia Management (ABCDE)", 2)
simple_table(doc,
["Step", "Action"],
[
["A — Airway", "Left lateral position, oxygen, protect airway"],
["B — MgSO4", "Loading: 4-6 g IV over 15-20 min → Maintenance: 1-2 g/hour IV"],
["C — Antihypertensives", "Hydralazine 5-10 mg IV or Labetalol 20-80 mg IV boluses"],
["D — Deliver", "Stabilise first; aim delivery within 24 hours"],
["E — Monitor", "Patellar reflexes (absent = Mg toxicity), RR >12/min, UO >25 mL/h, serum Mg 4-7 mEq/L"],
["Antidote", "Calcium gluconate 1 g IV (10 mL of 10%) — for MgSO4 toxicity"],
],
col_widths=[2.0, 5.0]
)
doc.add_page_break()
# ══════════════════ SECTION 25: DECREASED FM ══════════════════
add_colored_heading(doc, "PART 25: DECREASED FETAL MOVEMENTS — SIGNIFICANCE AND COMPLICATIONS", 1)
add_colored_heading(doc, "Normal Fetal Movement", 2)
add_bullet(doc, "First felt at 18-20 weeks (primigravida); 16-18 weeks (multigravida)")
add_bullet(doc, "Cardiff Count to 10: 10 movements within 2 hours (or up to 12 hours)")
add_bullet(doc, "Fetal sleep cycle: normally 20-40 min (max 90 min)")
add_colored_heading(doc, "Causes of Reduced FM", 2)
for item in ["Fetal sleep cycle (most common, benign — max 90 min)",
"Maternal sedatives, alcohol, opioids",
"Fetal compromise / uteroplacental insufficiency",
"Oligohydramnios", "Cord compression", "Anterior placenta (dampens perception)",
"Fetal prematurity", "IUGR"]:
add_bullet(doc, item)
add_colored_heading(doc, "Complications / Significance", 2)
for item in ["IUGR — most common cause of reduced FM",
"Cord accident (true knot, nuchal cord)",
"Fetal hypoxia and acidosis",
"Intrauterine fetal death (IUFD) — reduced FM often precedes death by 12-48h",
"Placental insufficiency"]:
add_bullet(doc, item)
add_colored_heading(doc, "Management", 2)
add_bullet(doc, "History + NST/CTG")
add_bullet(doc, "Ultrasound: AFI, biophysical profile (BPP), Doppler")
add_bullet(doc, "Reactive NST + normal AFI + no other risk factors → reassure, continue kick counting")
add_bullet(doc, "Non-reactive or concern → extended monitoring, admission, consider delivery")
doc.add_paragraph()
# ══════════════════ SECTION 26: PRETERM COMPLICATIONS ══════════════════
add_colored_heading(doc, "PART 26: COMPLICATIONS OF PRETERM LABOUR", 1)
simple_table(doc,
["Neonatal Complication", "Details"],
[
["Respiratory Distress Syndrome (RDS)", "Surfactant deficiency — commonest cause of preterm death; risk inversely proportional to GA"],
["Intraventricular Haemorrhage (IVH)", "Germinal matrix bleed → brain injury; grades I-IV"],
["Necrotising Enterocolitis (NEC)", "Ischaemic gut necrosis; <32 weeks risk"],
["Retinopathy of Prematurity (ROP)", "Abnormal retinal vascularisation; risk if <32 weeks or O2 exposure"],
["Hypothermia", "Inadequate brown fat; maintain thermoneutral environment"],
["Hypoglycaemia", "Inadequate glycogen stores"],
["Sepsis (early + late onset)", "Immature immune system"],
["Cerebral Palsy (long-term)", "Periventricular leukomalacia; esp. <28 weeks"],
],
col_widths=[2.5, 5.0]
)
add_colored_heading(doc, "Management of Preterm Labour", 2)
simple_table(doc,
["Intervention", "Detail"],
[
["Corticosteroids", "Betamethasone 12 mg IM × 2 doses 24h apart OR Dexamethasone 6 mg IM × 4 doses 12h apart — 24-34+6 weeks"],
["Tocolytics (delay 48h for steroids)", "Nifedipine (first-line) • Atosiban (oxytocin antagonist) • Indomethacin (<32 weeks, short-term)"],
["MgSO4 (neuroprotection)", "24-31+6 weeks — 4 g loading, 1 g/hour maintenance (ACOG/SMFM)"],
["GBS Prophylaxis", "Penicillin G IV if GBS positive or unknown and <37 weeks"],
],
col_widths=[2.0, 5.5]
)
doc.add_page_break()
# ══════════════════ SECTION 27: POST-TERM COMPLICATIONS ══════════════════
add_colored_heading(doc, "PART 27: COMPLICATIONS OF POST-TERM PREGNANCY (≥42 WEEKS)", 1)
simple_table(doc,
["Complication", "Details"],
[
["Uteroplacental insufficiency", "Placental 'ageing' → reduced O2/nutrient delivery → fetal hypoxia"],
["Oligohydramnios", "Fetal urine output falls → cord compression risk"],
["Meconium-stained liquor", "Fetal hypoxia → meconium passage → Meconium Aspiration Syndrome (MAS)"],
["Macrosomia", "Continued fetal growth → shoulder dystocia, traumatic delivery"],
["Stillbirth", "Risk doubles after 42 weeks vs 39-40 weeks"],
["Dysmaturity syndrome", "Dry peeling skin, long nails, alert facies, no vernix/lanugo, meconium-stained skin"],
["Maternal", "Increased C-section • Perineal trauma • PPH • Psychological distress"],
],
col_widths=[2.0, 5.5]
)
add_note_box(doc, "Induction of labour at 41+0-42+0 weeks reduces stillbirth without increasing C-section rate (ARRIVE trial, NICE 2021). At 42 weeks: induction is mandatory or intensive fetal surveillance.")
doc.add_paragraph()
# ══════════════════ SECTION 28: HIGH-RISK PREGNANCY ══════════════════
add_colored_heading(doc, "PART 28: HIGH-RISK PREGNANCY", 1)
p = doc.add_paragraph("A pregnancy with increased likelihood of adverse maternal or fetal outcome requiring additional monitoring or intervention.")
add_colored_heading(doc, "Risk Factors", 2)
simple_table(doc,
["Category", "Factors"],
[
["Age/Demographics", "Age <18 or ≥35 • Height <145 cm (CPD risk) • BMI <18.5 or >30"],
["Obstetric History", "Previous C-section • Preterm birth • Stillbirth/NND • PPH • Preeclampsia • Grand multiparity (≥5) • Previous molar pregnancy"],
["Current Pregnancy", "GDM • PIH/Preeclampsia • IUGR • Multiple pregnancy • Placenta previa • Malpresentation • Polyhydramnios/Oligohydramnios"],
["Medical Conditions", "DM • HTN • Cardiac disease • Renal disease • Thyroid disease • Epilepsy • SLE • Sickle cell • Thrombophilia"],
["Social", "Substance abuse • Teenage pregnancy • Domestic violence • Poor socioeconomic status • Unbooked"],
],
col_widths=[1.8, 5.0]
)
doc.add_paragraph()
# ══════════════════ REFERENCES ══════════════════
doc.add_page_break()
add_colored_heading(doc, "REFERENCES AND SOURCES", 1)
refs = [
"Williams Obstetrics, 25th Edition — Cunningham et al., McGraw-Hill",
"Creasy & Resnik's Maternal-Fetal Medicine: Principles and Practice, 8th Edition",
"Berek & Novak's Gynecology, 16th Edition",
"WHO Recommendations on Antenatal Care for a Positive Pregnancy Experience (2016) — WHO/RHR/16.12",
"ACOG Practice Bulletin: Gestational Hypertension and Preeclampsia (2024 update)",
"ACOG Committee Opinion: Definition of Term Pregnancy (2013)",
"RCOG Green-top Guideline: The Management of Nausea and Vomiting of Pregnancy (2024)",
"CMAJ: Diagnosis and treatment of hyperemesis gravidarum (2024)",
"IADPSG/WHO Diagnostic Criteria for GDM (2013)",
"RCOG/SOGC: Management of Reduced Fetal Movements",
"ACOG/SMFM: Magnesium Sulphate for Neuroprotection (2021)",
"March of Dimes / CDC Gestational Age Classification (2024)",
]
for i, ref in enumerate(refs, 1):
p = doc.add_paragraph()
run = p.add_run(f"{i}. {ref}")
run.font.size = Pt(9)
run.font.color.rgb = RGBColor(0x44, 0x44, 0x44)
# ══════════════════ FOOTER NOTE ══════════════════
doc.add_paragraph()
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("─────────────────────────────────────────────────────────────────────")
run.font.color.rgb = RGBColor(0x1A, 0x3C, 0x5E)
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("This document is for educational reference only. "
"Always consult current institutional guidelines and clinical judgment for patient care.")
run.italic = True
run.font.size = Pt(9)
run.font.color.rgb = RGBColor(0x77, 0x77, 0x77)
# ══════════════════ SAVE ══════════════════
out_path = "/tmp/workspace/obg-reference/OBG_Comprehensive_ANC_Reference.docx"
doc.save(out_path)
print(f"SUCCESS: Saved to {out_path}")