Hypertensive disorers of pregnancy. Rh negative pregnancy - management multiple pregnancy - complications in each type. Gestational age assessment. FGR - examination and ultrasound. Preterm labour - drugs. Placenta previa- management. Ectopic pregnancy - medical management and surgical indications. Abortion - MTP, Molar pregnancy. Cervical changes in labour. NST and biophysical profile. Menstruation - physiology. AUB. Fibroid. Adenomyosis. Endometriosis. These are the topics for tomorrow exam give me a brief about them reference take mudaliar and Shaw textbooks

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
All 17 topics are covered above in comprehensive exam-ready notes. Here's a quick guide to what's included:
Topics covered:
  1. HDP - Classification, HELLP, severe features, MgSO₄ dosing, antihypertensives
  2. Rh Negative - ICT protocol, anti-D doses, sensitizing events, IUT indications
  3. Multiple Pregnancy - DCDA/MCDA/MCMA/Conjoined complications, TTTS staging, TRAP
  4. Gestational Age - Naegele's rule, fundal height landmarks, USS parameters (CRL most accurate)
  5. FGR - Symmetric vs asymmetric, Doppler sequence (UA→MCA→DV), management by Doppler
  6. Preterm Labour - Tocolytics table (Nifedipine 1st line), corticosteroid regimens, MgSO₄ neuroprotection
  7. Placenta Previa - Classification, management, PAS (accreta/increta/percreta)
  8. Ectopic Pregnancy - MTX criteria, contraindications, protocol, surgical indications
  9. MTP - MTP Act 2021 (India), methods by gestation, Mifepristone + Misoprostol doses
  10. Molar Pregnancy - Complete vs partial mole table, evacuation, hCG surveillance, GTN criteria
  11. Cervical Changes - Bishop score table, active/latent phase rates, Friedman's criteria
  12. NST & BPP - Reactive criteria, Manning's 5-parameter BPP table, modified BPP
  13. Menstruation - Full hormonal cycle, PGF2α mechanism, endometrial layers
  14. AUB - PALM-COEIN classification, medical management hierarchy (LNG-IUS most effective)
  15. Fibroid - Location types, red degeneration, UAE, myomectomy vs hysterectomy
  16. Adenomyosis - JZ >12mm on MRI, boggy uterus, LNG-IUS for medical tx
  17. Endometriosis - "3 Ds," Sampson's theory, staging, laparoscopy gold standard, Danazol vs GnRH

Create a study guide PDF with all these notes for offline review

Reading File
Running Command

ls -la /tmp/workspace/ 2>/dev/null || mkdir -p /tmp/workspace && echo "workspace ready"

Running Command

mkdir -p /tmp/workspace/obgyn-study-guide && echo "dir created"

Writing File

~/obgyn-study-guide/generate_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
                                 TableStyle, HRFlowable, PageBreak, KeepTogether)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
import os

OUTPUT = "/tmp/workspace/obgyn-study-guide/OBGyn_ExamNotes.pdf"

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=1.8*cm, rightMargin=1.8*cm,
    topMargin=2*cm, bottomMargin=2*cm,
    title="OB/GYN Exam Study Guide",
    author="Orris Medical",
    subject="Obstetrics & Gynaecology - Exam Notes"
)

# ── Colour palette ──────────────────────────────────────────────────────────
NAVY      = colors.HexColor("#1a3a5c")
TEAL      = colors.HexColor("#0d7377")
TEAL_LIGHT= colors.HexColor("#e0f4f4")
AMBER     = colors.HexColor("#e07b00")
AMBER_LIGHT=colors.HexColor("#fff4e0")
RED_SOFT  = colors.HexColor("#c0392b")
GREEN_SOFT= colors.HexColor("#1e8449")
GREY_BG   = colors.HexColor("#f5f5f5")
WHITE     = colors.white
BLACK     = colors.black
DARK_GREY = colors.HexColor("#333333")
MID_GREY  = colors.HexColor("#666666")

# ── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def S(name, **kwargs):
    return ParagraphStyle(name, **kwargs)

cover_title   = S("CoverTitle", fontSize=28, textColor=WHITE, alignment=TA_CENTER,
                   fontName="Helvetica-Bold", spaceAfter=6, leading=34)
cover_sub     = S("CoverSub",   fontSize=14, textColor=colors.HexColor("#cce8e8"),
                   alignment=TA_CENTER, fontName="Helvetica", spaceAfter=4)
cover_date    = S("CoverDate",  fontSize=10, textColor=colors.HexColor("#99cccc"),
                   alignment=TA_CENTER, fontName="Helvetica-Oblique")

h1 = S("H1", fontSize=15, textColor=WHITE, fontName="Helvetica-Bold",
        spaceBefore=0, spaceAfter=4, leading=18,
        backColor=NAVY, leftIndent=-0.3*cm, rightIndent=-0.3*cm,
        borderPad=(4,8,4,8))

h2 = S("H2", fontSize=11, textColor=NAVY, fontName="Helvetica-Bold",
        spaceBefore=10, spaceAfter=3, leading=14, borderPad=(2,0,2,0))

h3 = S("H3", fontSize=9.5, textColor=TEAL, fontName="Helvetica-Bold",
        spaceBefore=7, spaceAfter=2, leading=12)

body = S("Body", fontSize=8.5, textColor=DARK_GREY, fontName="Helvetica",
          leading=13, spaceBefore=2, spaceAfter=2, alignment=TA_JUSTIFY)

bullet = S("Bullet", fontSize=8.5, textColor=DARK_GREY, fontName="Helvetica",
            leading=13, spaceBefore=1, spaceAfter=1,
            leftIndent=14, firstLineIndent=-10)

bullet2 = S("Bullet2", fontSize=8, textColor=MID_GREY, fontName="Helvetica",
             leading=12, spaceBefore=0, spaceAfter=1,
             leftIndent=26, firstLineIndent=-10)

bold_inline = S("BoldInline", fontSize=8.5, textColor=DARK_GREY,
                 fontName="Helvetica-Bold", leading=13)

note_style = S("Note", fontSize=8, textColor=colors.HexColor("#555555"),
                fontName="Helvetica-Oblique", leading=12, leftIndent=10,
                backColor=AMBER_LIGHT, borderPad=(4,6,4,6))

mnemonic = S("Mnemonic", fontSize=8.5, textColor=colors.HexColor("#1e5c1e"),
              fontName="Helvetica-Bold", leading=13, leftIndent=10,
              backColor=colors.HexColor("#e8f5e9"), borderPad=(4,6,4,6))

ref_style = S("Ref", fontSize=7.5, textColor=MID_GREY, fontName="Helvetica-Oblique",
               alignment=TA_CENTER, leading=10)

# ── Helper functions ─────────────────────────────────────────────────────────
def P(text, style=body): return Paragraph(text, style)
def B(text):  return Paragraph(f"• {text}", bullet)
def B2(text): return Paragraph(f"◦ {text}", bullet2)
def SP(n=4):  return Spacer(1, n)
def HR():     return HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#cccccc"), spaceAfter=4)

def section_header(num, title):
    return [
        SP(8),
        Table([[Paragraph(f"{num}. {title}", h1)]],
              colWidths=[doc.width],
              style=TableStyle([
                  ('BACKGROUND', (0,0), (-1,-1), NAVY),
                  ('TOPPADDING', (0,0), (-1,-1), 6),
                  ('BOTTOMPADDING', (0,0), (-1,-1), 6),
                  ('LEFTPADDING', (0,0), (-1,-1), 10),
                  ('RIGHTPADDING', (0,0), (-1,-1), 6),
              ])),
        SP(6),
    ]

def sub_header(text):
    return [P(text, h2)]

def sub2_header(text):
    return [P(text, h3)]

def make_table(headers, rows, col_widths=None, header_bg=TEAL):
    if col_widths is None:
        n = len(headers)
        col_widths = [doc.width / n] * n
    data = [headers] + rows
    ts = TableStyle([
        ('BACKGROUND',   (0,0), (-1,0),  header_bg),
        ('TEXTCOLOR',    (0,0), (-1,0),  WHITE),
        ('FONTNAME',     (0,0), (-1,0),  'Helvetica-Bold'),
        ('FONTSIZE',     (0,0), (-1,0),  8),
        ('FONTNAME',     (0,1), (-1,-1), 'Helvetica'),
        ('FONTSIZE',     (0,1), (-1,-1), 7.5),
        ('ROWBACKGROUNDS',(0,1),(-1,-1), [WHITE, GREY_BG]),
        ('TEXTCOLOR',    (0,1), (-1,-1), DARK_GREY),
        ('GRID',         (0,0), (-1,-1), 0.4, colors.HexColor("#bbbbbb")),
        ('TOPPADDING',   (0,0), (-1,-1), 4),
        ('BOTTOMPADDING',(0,0), (-1,-1), 4),
        ('LEFTPADDING',  (0,0), (-1,-1), 5),
        ('RIGHTPADDING', (0,0), (-1,-1), 5),
        ('VALIGN',       (0,0), (-1,-1), 'MIDDLE'),
        ('WORDWRAP',     (0,0), (-1,-1), True),
    ])
    tbl = Table([[Paragraph(str(c), ParagraphStyle('tc', fontSize=8 if i>0 else 8,
                  fontName='Helvetica-Bold' if i==0 else 'Helvetica',
                  textColor=WHITE if i==0 else DARK_GREY, leading=11)) for c in row]
                 for i, row in enumerate(data)],
                colWidths=col_widths)
    # rebuild properly
    table_data = []
    for i, row in enumerate(data):
        r = []
        for cell in row:
            fs = 8; fn = 'Helvetica-Bold' if i == 0 else 'Helvetica'
            tc = WHITE if i == 0 else DARK_GREY
            r.append(Paragraph(str(cell), ParagraphStyle(f'tc{i}', fontSize=fs,
                      fontName=fn, textColor=tc, leading=11)))
        table_data.append(r)
    t = Table(table_data, colWidths=col_widths)
    t.setStyle(ts)
    return t

def note_box(text):
    return Table([[Paragraph(f"⚠ {text}", note_style)]],
                 colWidths=[doc.width],
                 style=TableStyle([
                     ('BACKGROUND',(0,0),(-1,-1), AMBER_LIGHT),
                     ('LEFTPADDING',(0,0),(-1,-1),8),
                     ('RIGHTPADDING',(0,0),(-1,-1),8),
                     ('TOPPADDING',(0,0),(-1,-1),5),
                     ('BOTTOMPADDING',(0,0),(-1,-1),5),
                     ('BOX',(0,0),(-1,-1),1, AMBER),
                 ]))

def mnemonic_box(text):
    return Table([[Paragraph(f"🧠 {text}", mnemonic)]],
                 colWidths=[doc.width],
                 style=TableStyle([
                     ('BACKGROUND',(0,0),(-1,-1), colors.HexColor("#e8f5e9")),
                     ('LEFTPADDING',(0,0),(-1,-1),8),
                     ('RIGHTPADDING',(0,0),(-1,-1),8),
                     ('TOPPADDING',(0,0),(-1,-1),5),
                     ('BOTTOMPADDING',(0,0),(-1,-1),5),
                     ('BOX',(0,0),(-1,-1),1, GREEN_SOFT),
                 ]))

# ═══════════════════════════════════════════════════════════════════════════════
# CONTENT
# ═══════════════════════════════════════════════════════════════════════════════
story = []

# ── COVER PAGE ───────────────────────────────────────────────────────────────
cover_table = Table(
    [[
        Paragraph("OB/GYN", cover_title),
        Paragraph("EXAM STUDY GUIDE", cover_title),
        SP(10),
        Paragraph("Obstetrics & Gynaecology", cover_sub),
        Paragraph("17 High-Yield Topics", cover_sub),
        SP(6),
        Paragraph("Reference: Mudaliar & Shaw · Berek & Novak · Creasy & Resnik", cover_date),
        SP(4),
        Paragraph("July 2026", cover_date),
    ]],
    colWidths=[doc.width],
    style=TableStyle([
        ('BACKGROUND',(0,0),(-1,-1), NAVY),
        ('ALIGN',(0,0),(-1,-1),'CENTER'),
        ('VALIGN',(0,0),(-1,-1),'MIDDLE'),
        ('TOPPADDING',(0,0),(-1,-1),60),
        ('BOTTOMPADDING',(0,0),(-1,-1),60),
        ('LEFTPADDING',(0,0),(-1,-1),20),
        ('RIGHTPADDING',(0,0),(-1,-1),20),
    ])
)
story.append(cover_table)
story.append(PageBreak())

# ── TABLE OF CONTENTS ────────────────────────────────────────────────────────
story.append(P("<b>TABLE OF CONTENTS</b>", ParagraphStyle("TOCHead", fontSize=14,
    textColor=NAVY, fontName="Helvetica-Bold", spaceAfter=10, alignment=TA_CENTER)))
toc_items = [
    ("1", "Hypertensive Disorders of Pregnancy"),
    ("2", "Rh Negative Pregnancy — Management"),
    ("3", "Multiple Pregnancy — Complications by Type"),
    ("4", "Gestational Age Assessment"),
    ("5", "FGR — Examination and Ultrasound"),
    ("6", "Preterm Labour — Drugs"),
    ("7", "Placenta Previa — Management"),
    ("8", "Ectopic Pregnancy — Medical &amp; Surgical"),
    ("9", "Abortion — MTP"),
    ("10", "Molar Pregnancy"),
    ("11", "Cervical Changes in Labour"),
    ("12", "NST and Biophysical Profile"),
    ("13", "Menstruation — Physiology"),
    ("14", "AUB — Abnormal Uterine Bleeding"),
    ("15", "Fibroid (Uterine Leiomyoma)"),
    ("16", "Adenomyosis"),
    ("17", "Endometriosis"),
]
toc_style = ParagraphStyle("TOC", fontSize=9, textColor=DARK_GREY,
    fontName="Helvetica", leading=16)
for num, title in toc_items:
    story.append(P(f"&nbsp;&nbsp;<b>{num}.</b>&nbsp; {title}", toc_style))
story.append(SP(6))
story.append(HR())
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 1. HDP
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("1", "HYPERTENSIVE DISORDERS OF PREGNANCY (HDP)")
story += sub_header("Classification")
story.append(make_table(
    ["Type", "Definition"],
    [
        ["Gestational HTN", "BP ≥140/90 after 20 wks, no proteinuria, resolves by 12 wks postpartum"],
        ["Preeclampsia", "HTN + proteinuria (≥300 mg/24h or PCR ≥0.3) after 20 wks"],
        ["Eclampsia", "Preeclampsia + seizures (not attributable to other causes)"],
        ["Chronic HTN", "HTN before 20 wks / pre-existing"],
        ["Superimposed PE", "Chronic HTN + new-onset proteinuria or worsening"],
    ],
    col_widths=[5*cm, doc.width - 5*cm]
))
story.append(SP(8))
story += sub_header("Severe Features of Preeclampsia (any ONE = severe)")
story.append(mnemonic_box("Mnemonic: TReVID — Thrombocytopenia, Renal insufficiency, elevated LFTs (x2), Visual/Headache, Increased BP (≥160/110), Dyspnea (pulmonary edema)"))
story.append(SP(4))
severe_items = [
    "BP ≥160/110 on two occasions (≥15 min apart)",
    "Thrombocytopenia (platelets &lt;100,000/μL)",
    "Renal insufficiency (Creatinine &gt;1.1 mg/dL or doubling of baseline)",
    "Impaired liver function (AST/ALT ≥2x normal, RUQ/epigastric pain unresponsive to medication)",
    "Pulmonary edema",
    "New-onset headache unresponsive to analgesia / visual disturbances",
]
for i in severe_items:
    story.append(B(i))

story += sub_header("HELLP Syndrome")
for i in [
    "<b>H</b>emolysis, <b>E</b>levated <b>L</b>iver enzymes, <b>L</b>ow <b>P</b>latelets",
    "Complication of severe preeclampsia; can occur without classic HTN/proteinuria",
    "Treatment: delivery if ≥34 wks or maternal deterioration; dexamethasone if &lt;34 wks",
]:
    story.append(B(i))

story += sub_header("Management")
story += sub2_header("Antihypertensives (Acute — BP ≥160/110)")
story.append(make_table(
    ["Drug", "Route", "Dose"],
    [
        ["Labetalol (1st line)", "IV", "20 mg bolus, repeat q10 min (max 220 mg)"],
        ["Hydralazine", "IV", "5–10 mg q20 min"],
        ["Nifedipine IR", "Oral", "10 mg, repeat q20 min (max 30 mg)"],
    ],
    col_widths=[4.5*cm, 2*cm, doc.width - 6.5*cm]
))
story.append(SP(6))
story += sub2_header("Magnesium Sulphate (Seizure Prophylaxis / Eclampsia)")
story.append(make_table(
    ["Parameter", "Detail"],
    [
        ["Loading dose", "4–6 g IV over 15–20 min"],
        ["Maintenance", "1–2 g/hr IV infusion"],
        ["Antidote", "Calcium gluconate 1 g IV (10 mL of 10%) — for toxicity"],
        ["Monitor", "Urine output &gt;25 mL/hr, Resp rate &gt;12/min, DTRs present, Serum Mg 4–7 mEq/L"],
        ["Toxicity signs", "Loss of DTR (first sign), then respiratory depression, then cardiac arrest"],
    ],
    col_widths=[4*cm, doc.width - 4*cm]
))
story.append(SP(6))
story += sub2_header("Delivery Decisions")
story.append(make_table(
    ["Severity", "Gestation", "Action"],
    [
        ["Without severe features", "≥37 wks", "Deliver promptly"],
        ["Without severe features", "&lt;37 wks", "Expectant + corticosteroids if &lt;34 wks"],
        ["With severe features", "≥34 wks", "Deliver after stabilization (MgSO₄ + antihypertensive)"],
        ["With severe features", "&lt;34 wks", "Expectant only at tertiary center with ICU; deliver if deterioration"],
    ],
    col_widths=[4*cm, 2.5*cm, doc.width - 6.5*cm]
))
story.append(note_box("NEVER use diuretics (furosemide) unless pulmonary edema — worsens placental perfusion."))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 2. Rh NEGATIVE
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("2", "Rh NEGATIVE PREGNANCY — MANAGEMENT")
story += sub_header("Pathophysiology")
for i in [
    "Rh(D) negative mother + Rh positive fetus → fetal RBCs cross placenta → maternal anti-D IgG formed",
    "1st pregnancy: sensitization; 2nd pregnancy: anamnestic response → severe Hemolytic Disease of Newborn (HDN)",
    "Anti-D IgG crosses placenta → fetal RBC destruction → fetal anemia, hydrops fetalis",
]:
    story.append(B(i))

story += sub_header("Sensitizing Events (give Anti-D within 72 hours)")
story.append(make_table(
    ["Obstetric Events", "Procedural Events"],
    [
        ["Delivery (vaginal/CS)", "Amniocentesis / CVS / Cordocentesis"],
        ["Abortion / MTP (any trimester)", "External Cephalic Version (ECV)"],
        ["Ectopic pregnancy treatment", "Antepartum Hemorrhage"],
        ["Molar pregnancy evacuation", "Abdominal trauma in pregnancy"],
    ],
    col_widths=[doc.width/2, doc.width/2]
))
story.append(SP(8))
story += sub_header("Management Protocol")
story += sub2_header("ICT Negative (Unsensitized)")
story.append(make_table(
    ["Time", "Action"],
    [
        ["Booking visit", "Blood group, Rh type, ICT (Indirect Coombs Test)"],
        ["28 weeks", "Anti-D immunoglobulin 300 mcg IM (antenatal prophylaxis)"],
        ["After delivery (within 72 hrs)", "Anti-D 300 mcg IM if baby is Rh positive (confirm cord blood grouping)"],
        ["After sensitizing event &lt;13 wks", "Anti-D 50–75 mcg IM"],
        ["After sensitizing event &gt;13 wks", "Anti-D 300 mcg IM"],
    ],
    col_widths=[4.5*cm, doc.width - 4.5*cm]
))
story.append(SP(6))
story += sub2_header("ICT Positive (Sensitized) — Management")
story.append(make_table(
    ["Step", "Action"],
    [
        ["Serial anti-D titers", "Every 4 weeks; critical titer = 1:16 or 1:32"],
        ["Rising titer / critical", "MCA Doppler: PSV &gt;1.5 MoM = fetal anemia"],
        ["Severe anemia &lt;34 wks", "Intrauterine Transfusion (IUT) via cordocentesis"],
        ["Delivery", "At 37–38 wks; cord blood for DCT, Hb, bilirubin, blood group"],
        ["Newborn", "Exchange transfusion if Hb &lt;12 g/dL or rising bilirubin"],
    ],
    col_widths=[4.5*cm, doc.width - 4.5*cm]
))
story.append(SP(4))
story.append(note_box("Kleihauer-Betke test quantifies fetomaternal hemorrhage. If &gt;15 mL fetal blood, additional Anti-D doses are needed (300 mcg per 15 mL fetal RBCs)."))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 3. MULTIPLE PREGNANCY
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("3", "MULTIPLE PREGNANCY — COMPLICATIONS BY TYPE")
story += sub_header("Chorionicity and Timing of Division (Monozygotic)")
story.append(make_table(
    ["Days of Division", "Chorionicity", "Risk Level"],
    [
        ["Dizygotic (any)", "DCDA (Dichorionic Diamniotic)", "Lowest"],
        ["≤3 days", "DCDA", "Low"],
        ["4–8 days", "MCDA (Monochorionic Diamniotic)", "Moderate"],
        ["8–13 days", "MCMA (Monochorionic Monoamniotic)", "High"],
        ["&gt;13 days", "Conjoined twins", "Highest"],
    ],
    col_widths=[3.5*cm, 5*cm, doc.width - 8.5*cm]
))
story.append(SP(6))
story.append(mnemonic_box("Mnemonic: 3-4-8-13 days → DCDA / MCDA / MCMA / Conjoined"))
story.append(SP(8))

story += sub_header("DCDA Twin Complications")
for i in ["Preterm labour (50% deliver &lt;37 wks) — most common", "Preeclampsia/GH (3x risk)",
    "IUGR / discordant growth", "GDM and anemia", "Malpresentation",
    "Polyhydramnios", "PPH (uterine overdistension)"]:
    story.append(B(i))

story += sub_header("MCDA Additional Complications")
story.append(make_table(
    ["Complication", "Mechanism", "Management"],
    [
        ["TTTS (Twin-to-Twin Transfusion)", "Vascular anastomoses on shared placenta → unbalanced flow", "Fetoscopic laser photocoagulation (Quintero Stage II–IV)"],
        ["Selective IUGR", "Unequal placental sharing", "Surveillance; deliver by 36–37 wks"],
        ["TAPS (Twin Anemia Polycythemia)", "Slow inter-twin transfusion via tiny anastomoses", "IUT / early delivery"],
        ["TRAP Sequence", "Acardiac twin — pump twin provides circulation", "Radiofrequency ablation of acardiac cord"],
    ],
    col_widths=[3.5*cm, 4.5*cm, doc.width - 8*cm]
))
story.append(SP(4))
story += sub2_header("Quintero Staging (TTTS)")
story.append(make_table(
    ["Stage", "Criteria"],
    [
        ["I", "AFI discordance (polyhydramnios/oligohydramnios) without absent/reversed flow"],
        ["II", "Absent bladder in donor"],
        ["III", "Critically abnormal Doppler (absent/reversed UA, reversed DV a-wave, pulsatile UV)"],
        ["IV", "Hydrops in either twin"],
        ["V", "Death of one or both twins"],
    ],
    col_widths=[2*cm, doc.width - 2*cm]
))
story.append(SP(8))
story += sub_header("MCMA Complications (additional)")
for i in ["Cord entanglement (up to 50% perinatal mortality without intensive monitoring)",
    "All MCDA complications",
    "Delivery: elective CS at 32–34 weeks"]:
    story.append(B(i))

story += sub_header("Conjoined Twins")
for i in ["Thoracopagus (most common, 75%), omphalopagus, craniopagus, pygopagus",
    "Failure of complete cleavage after Day 13",
    "Diagnosis: USS / MRI",
    "Delivery: always by CS; prognosis depends on shared organs"]:
    story.append(B(i))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 4. GESTATIONAL AGE ASSESSMENT
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("4", "GESTATIONAL AGE ASSESSMENT")
story += sub_header("Clinical Methods")
story.append(make_table(
    ["Method", "Details"],
    [
        ["LMP (Naegele's Rule)", "Subtract 3 months + add 7 days (+ 1 year). Assumes 28-day cycle."],
        ["Fundal height (12 wks)", "At symphysis pubis"],
        ["Fundal height (16 wks)", "Between symphysis and umbilicus"],
        ["Fundal height (20 wks)", "At umbilicus (1 cm/wk thereafter until 36 wks)"],
        ["Fundal height (36 wks)", "At xiphisternum; drops to 34 cm at term (lightening)"],
        ["Quickening", "Primigravida: 18–20 wks; Multigravida: 16–18 wks"],
        ["FHS (Doppler)", "From 10–12 wks; Pinard from 20 wks"],
    ],
    col_widths=[4.5*cm, doc.width - 4.5*cm]
))
story.append(SP(8))
story += sub_header("Ultrasound Methods")
story.append(make_table(
    ["Trimester", "Parameter", "Accuracy"],
    [
        ["1st (6–12 wks)", "Crown-Rump Length (CRL) — MOST ACCURATE", "± 5–7 days"],
        ["2nd (13–20 wks)", "BPD, HC, AC, FL", "± 7–10 days"],
        ["3rd (&gt;20 wks)", "BPD + FL + AC (composite)", "± 2–3 weeks"],
    ],
    col_widths=[3.5*cm, 7*cm, doc.width - 10.5*cm]
))
story.append(SP(4))
story.append(mnemonic_box("TCD (Transcerebellar Diameter in mm) ≈ Gestational Age in weeks — reliable even in FGR!"))
story.append(SP(4))
story += sub_header("BPD Measurement Level")
story.append(B("At the level of: thalami + cavum septum pellucidum + absence of cerebellum"))
story.append(B("Measured outer edge to inner edge (OI method)"))
story.append(B("Placental grading (Grannum 0–III): Grade III = lung maturity likely"))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 5. FGR
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("5", "FGR — EXAMINATION AND ULTRASOUND")
story += sub_header("Definition")
story.append(B("EFW &lt;10th percentile for gestational age"))
story.append(B("SGA: EFW &lt;10th centile (may be constitutionally small)"))
story.append(B("FGR: pathologically small + evidence of placental insufficiency (Doppler, oligo)"))

story += sub_header("Types of FGR")
story.append(make_table(
    ["Type", "Feature", "HC:AC Ratio", "Cause"],
    [
        ["Symmetric (Type I)", "HC and AC both reduced; early onset", "Normal (&lt;1)", "Chromosomal, TORCH, drugs"],
        ["Asymmetric (Type II)", "AC reduced; HC spared (brain-sparing)", "Increased (&gt;1)", "PIH, DM, uteroplacental insufficiency"],
    ],
    col_widths=[3.5*cm, 5*cm, 2.5*cm, doc.width - 11*cm]
))
story.append(SP(8))
story += sub_header("Clinical Examination")
for i in ["Fundal height &lt; expected for dates (&gt;3 cm discrepancy: investigate)",
    "Oligohydramnios on clinical assessment",
    "Poor maternal weight gain",
    "Risk factors: hypertension, renal disease, smoking, prior SGA baby"]:
    story.append(B(i))

story += sub_header("Ultrasound Parameters")
story.append(make_table(
    ["Parameter", "Finding in FGR", "Significance"],
    [
        ["Abdominal Circumference (AC)", "&lt;10th centile (MOST sensitive)", "First parameter to fall in asymmetric FGR"],
        ["AFI", "&lt;5 cm or SDP &lt;2 cm (oligohydramnios)", "Placental insufficiency"],
        ["UA S/D ratio", "Elevated → AEDF → REDF", "Progressive placental resistance"],
        ["MCA PI", "Decreased (low PI = vasodilatation)", "Brain-sparing; cerebral redistribution"],
        ["CPR (MCA PI / UA PI)", "&lt;1.0", "Combined compromise"],
        ["Ductus Venosus (DV)", "Absent or reversed a-wave", "Pre-terminal; deliver immediately"],
        ["BPP", "≤4/10", "Deliver regardless of gestation"],
    ],
    col_widths=[3.5*cm, 4*cm, doc.width - 7.5*cm]
))
story.append(SP(6))
story.append(make_table(
    ["Doppler Finding", "Management"],
    [
        ["Normal UA Doppler", "Fortnightly monitoring"],
        ["Elevated S/D ratio", "Weekly monitoring + corticosteroids if &lt;34 wks"],
        ["Absent end-diastolic flow (AEDF)", "Admit + daily monitoring; deliver ≥34 wks"],
        ["Reversed end-diastolic flow (REDF)", "Deliver immediately (regardless of GA)"],
        ["DV reversed a-wave", "Deliver immediately (critical — imminent demise)"],
    ],
    col_widths=[5*cm, doc.width - 5*cm]
))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 6. PRETERM LABOUR — DRUGS
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("6", "PRETERM LABOUR — DRUGS")
story += sub_header("Definition")
story.append(B("Regular uterine contractions + progressive cervical change between 20–37 completed weeks"))
story.append(B("Diagnosis: ≥4 contractions in 20 min + cervical dilation &gt;2 cm or 80% effacement"))

story += sub_header("Tocolytics (delay delivery 48 hrs for steroids/transfer)")
story.append(note_box("Tocolytics do NOT improve perinatal outcome — they only buy 48 hours for corticosteroids and transfer. Not used beyond 34 weeks."))
story.append(SP(4))
story.append(make_table(
    ["Drug", "Class", "Dose", "Side Effects / Contraindications"],
    [
        ["Nifedipine (1st line)", "Ca-channel blocker", "20 mg oral loading, then 10–20 mg q6h", "Hypotension, flushing; avoid in cardiac disease"],
        ["Atosiban (2nd line)", "Oxytocin receptor antagonist", "6.75 mg IV bolus → 18 mg/hr x3h → 6 mg/hr x45h", "Minimal; avoid &lt;24 wks"],
        ["Indomethacin", "COX inhibitor (PG synthesis inhibitor)", "50 mg PR loading then 25 mg q6h oral", "Premature closure of DA; avoid &gt;32 wks"],
        ["Salbutamol / Ritodrine", "β₂ agonist", "IV infusion titrated", "Tachycardia, pulmonary edema, hyperglycemia"],
        ["MgSO₄", "Membrane stabilizer", "4–6 g IV load, 2–3 g/hr", "Respiratory depression; monitor DTRs"],
    ],
    col_widths=[3*cm, 3.5*cm, 4*cm, doc.width - 10.5*cm]
))
story.append(SP(8))
story += sub_header("Corticosteroids (Lung Maturation) — Give between 24–34 wks")
story.append(make_table(
    ["Drug", "Dose", "Benefits"],
    [
        ["Betamethasone (preferred)", "12 mg IM x2 doses, 24 hrs apart", "Reduces: RDS, IVH, NEC, perinatal mortality by 30–50%"],
        ["Dexamethasone", "6 mg IM x4 doses, 12 hrs apart", "Same benefits; used when betamethasone unavailable"],
    ],
    col_widths=[4*cm, 4.5*cm, doc.width - 8.5*cm]
))
story.append(SP(6))
story += sub_header("Magnesium Sulfate — Neuroprotection")
story.append(B("Indications: &lt;32 weeks with imminent preterm delivery"))
story.append(B("Dose: 4 g IV loading over 20 min"))
story.append(B("Benefit: Reduces cerebral palsy risk by 30–40%"))
story += sub_header("GBS Prophylaxis in Labour")
story.append(B("Penicillin G: 5 MU IV loading dose, then 2.5 MU IV q4h until delivery"))
story.append(B("Alternative if PCN allergy: Clindamycin 900 mg IV q8h"))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 7. PLACENTA PREVIA
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("7", "PLACENTA PREVIA — MANAGEMENT")
story += sub_header("Classification (Ultrasound-based)")
story.append(make_table(
    ["Type", "Definition"],
    [
        ["Low-lying (Minor)", "Placental edge within 2 cm of internal os but not covering it"],
        ["Partial/Marginal Previa", "Placenta covers edge of internal os"],
        ["Complete Previa (Major)", "Placenta centrally covers the internal os"],
    ],
    col_widths=[4.5*cm, doc.width - 4.5*cm]
))
story.append(SP(8))
story += sub_header("Classical Presentation")
for i in [
    "Painless, bright red, REVEALED antepartum hemorrhage after 28 weeks",
    "First bleed usually stops spontaneously ('warning bleed') — more episodes follow",
    "Uterus: SOFT, non-tender (painless — distinguishes from abruption)",
    "Malpresentation: transverse lie, oblique lie, high floating head",
    "NEVER perform vaginal examination before ruling out placenta previa",
]:
    story.append(B(i))

story += sub_header("Diagnosis")
story.append(B("Transabdominal USS (full bladder) — first-line screening"))
story.append(B("Transvaginal USS — most accurate; safe (90% accuracy); preferred for confirmation"))
story.append(note_box("Posterior placenta previa may be missed on transabdominal scan."))

story += sub_header("Management")
story += sub2_header("Expectant Management (Remote from term, no active bleeding)")
story.append(make_table(
    ["Action", "Detail"],
    [
        ["Admit", "Bed rest, IV access, group &amp; crossmatch, correct anemia"],
        ["Corticosteroids", "If &lt;34 wks"],
        ["Avoid", "Vaginal examination, intercourse, prolonged ambulation"],
        ["Tocolysis", "Only if concurrent uterine contractions (short course)"],
        ["Rh prophylaxis", "Anti-D if Rh negative with any bleed"],
    ],
    col_widths=[3.5*cm, doc.width - 3.5*cm]
))
story.append(SP(6))
story += sub2_header("Delivery")
story.append(make_table(
    ["Scenario", "Management"],
    [
        ["Major previa (elective)", "CS at 36–37 wks; cross-match blood"],
        ["Minor previa, edge &gt;2 cm from os", "Trial of vaginal delivery possible"],
        ["Uncontrolled hemorrhage (any gestation)", "Emergency CS immediately"],
        ["PPH at CS", "Oxytocin, bimanual compression, B-Lynch suture, uterine artery ligation, hysterectomy"],
    ],
    col_widths=[5*cm, doc.width - 5*cm]
))
story.append(SP(6))
story += sub_header("Placenta Accreta Spectrum (PAS)")
story.append(make_table(
    ["Type", "Extent of Invasion"],
    [
        ["Accreta", "Placenta adheres to myometrium (no decidua basalis)"],
        ["Increta", "Placenta invades into myometrium"],
        ["Percreta", "Placenta penetrates through serosa (may invade bladder/bowel)"],
    ],
    col_widths=[3*cm, doc.width - 3*cm]
))
story.append(B("Risk factors: Prior CS + anterior low-lying placenta; each additional CS increases risk"))
story.append(B("Management: CS-hysterectomy (do NOT attempt manual removal of placenta)"))
story.append(note_box("Suspect PAS if placenta lacunae on USS + prior uterine surgery. MRI helps assess depth before CS."))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 8. ECTOPIC PREGNANCY
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("8", "ECTOPIC PREGNANCY — MEDICAL &amp; SURGICAL MANAGEMENT")
story += sub_header("Sites")
story.append(make_table(
    ["Site", "Frequency"],
    [
        ["Ampulla (fallopian tube)", "55% (most common)"],
        ["Isthmus (tube)", "25%"],
        ["Fimbria (tube)", "17%"],
        ["Ovary", "3%"],
        ["Cervix / Cornua / Abdominal / CS scar", "Rare"],
    ],
    col_widths=[5*cm, doc.width - 5*cm]
))
story.append(SP(8))
story += sub_header("Medical Management — Methotrexate (MTX)")
story.append(mnemonic_box("Criteria Mnemonic: SNAP — Stable hemodynamics, No cardiac activity, Adnexal mass ≤3.5 cm, β-hCG &lt;5000 mIU/mL"))
story.append(SP(4))
story += sub2_header("Eligibility Criteria")
story.append(make_table(
    ["Inclusion", "Exclusion (Contraindications)"],
    [
        ["Hemodynamically stable", "Hemodynamic instability / rupture"],
        ["No significant abdominal pain", "Immunodeficiency / blood dyscrasia"],
        ["Adnexal mass ≤3.5 cm", "Renal / hepatic / pulmonary disease"],
        ["No fetal cardiac activity", "Breastfeeding"],
        ["β-hCG &lt;5000 mIU/mL", "Peptic ulcer disease"],
        ["Compliant with follow-up", "Hypersensitivity to MTX"],
    ],
    col_widths=[doc.width/2, doc.width/2]
))
story.append(SP(6))
story += sub2_header("MTX Protocol")
story.append(make_table(
    ["Step", "Action"],
    [
        ["Single dose", "MTX 50 mg/m² IM"],
        ["Day 4", "Check β-hCG"],
        ["Day 7", "Check β-hCG — need ≥15% fall from Day 4 to Day 7"],
        ["If &lt;15% fall", "Give 2nd dose of MTX (or surgical management)"],
        ["Follow-up", "Weekly β-hCG until undetectable; avoid pregnancy 3 months"],
        ["Avoid", "NSAIDs, folic acid supplements, alcohol, sexual intercourse, sun exposure"],
    ],
    col_widths=[3.5*cm, doc.width - 3.5*cm]
))
story.append(SP(8))
story += sub_header("Surgical Indications")
story.append(make_table(
    ["Indication", "Comment"],
    [
        ["Hemodynamic instability / rupture", "EMERGENCY — laparotomy"],
        ["Failed MTX (β-hCG not falling after 2 doses)", "Laparoscopic surgery"],
        ["Contraindication to MTX", "Laparoscopy preferred"],
        ["β-hCG &gt;5000 or rising rapidly", "Relative; consider surgery"],
        ["Fetal cardiac activity", "Medical less effective; surgery preferred"],
        ["Adnexal mass &gt;3.5–4 cm", "Higher rupture risk; surgery preferred"],
        ["Unable to comply with follow-up", "Surgery safer"],
    ],
    col_widths=[5*cm, doc.width - 5*cm]
))
story.append(SP(4))
story += sub2_header("Surgical Options")
story.append(B("<b>Salpingostomy:</b> Linear incision + remove ectopic; tube preserved — for future fertility desire"))
story.append(B("<b>Salpingectomy:</b> Remove entire tube — if tubal damage, recurrence risk, contralateral tube normal"))
story.append(B("<b>Route:</b> Laparoscopy preferred; laparotomy for unstable patients"))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 9. ABORTION — MTP
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("9", "ABORTION — MTP (Medical Termination of Pregnancy)")
story += sub_header("MTP Act, India (Amended 2021)")
story.append(make_table(
    ["Gestation", "Authorization Required", "Where"],
    [
        ["Up to 20 wks", "1 Registered Medical Practitioner (RMP)", "Any approved facility"],
        ["20–24 wks", "2 RMPs (specialist opinion)", "Government hospital / approved hospital"],
        ["&gt;24 wks", "Medical Board", "Government hospital only"],
    ],
    col_widths=[3*cm, 5.5*cm, doc.width - 8.5*cm]
))
story.append(SP(4))
story.append(note_box("2021 Amendment: Expanded 24-wk provision to ALL women (removed 'married woman' restriction) for: rape/incest survivors, minors, fetal anomalies incompatible with life, contraceptive failure, physical/mental disability."))
story.append(SP(8))
story += sub_header("Methods by Gestation")
story.append(make_table(
    ["Gestation", "Medical Method", "Surgical Method"],
    [
        ["Up to 7 wks (49 days)", "Mifepristone 200 mg + Misoprostol 800 mcg vaginally/sublingually after 24–48 h", "Manual Vacuum Aspiration (MVA)"],
        ["7–12 wks", "Same + uterine evacuation if incomplete", "EVA (Electric VA) or D&amp;C"],
        ["12–20 wks", "Mifepristone 200 mg + Misoprostol 400–800 mcg vaginally q3h", "D&amp;E (Dilatation &amp; Evacuation)"],
        ["&gt;20 wks", "Mifepristone + high-dose Misoprostol OR Oxytocin induction", "Hysterotomy (rare, failed medical)"],
    ],
    col_widths=[2.5*cm, 6.5*cm, doc.width - 9*cm]
))
story.append(SP(6))
story += sub_header("Drug Mechanisms")
story.append(make_table(
    ["Drug", "Class", "Mechanism"],
    [
        ["Mifepristone", "Antiprogestin", "Progesterone receptor antagonist → decidual necrosis, cervical ripening, ↑ uterine contractility"],
        ["Misoprostol", "PGE₁ analogue", "Prostaglandin E1 → cervical ripening + uterine contractions"],
    ],
    col_widths=[3*cm, 3*cm, doc.width - 6*cm]
))
story.append(SP(4))
story.append(note_box("Safe abortion: Complete evacuation confirmed by USS; follow-up in 2 weeks; contraception counselling mandatory."))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 10. MOLAR PREGNANCY
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("10", "MOLAR PREGNANCY (Gestational Trophoblastic Disease)")
story += sub_header("Complete vs Partial Mole")
story.append(make_table(
    ["Feature", "Complete Mole", "Partial Mole"],
    [
        ["Karyotype", "46XX or 46XY (entirely paternal)", "69XXX or 69XXY (triploid)"],
        ["Origin", "1–2 sperm + empty ovum", "2 sperm + 1 normal ovum"],
        ["Fetal tissue", "Absent", "Present (abnormal/malformed)"],
        ["Trophoblast proliferation", "Diffuse", "Focal"],
        ["β-hCG level", "Very high (&gt;100,000)", "Moderately elevated"],
        ["Ultrasound", "'Snowstorm' appearance, no fetus", "Swiss cheese placenta; fetal parts; transverse:AP &gt;1.5"],
        ["Risk of GTN", "15–20%", "0.5–5%"],
    ],
    col_widths=[4*cm, 5*cm, doc.width - 9*cm]
))
story.append(SP(8))
story += sub_header("Clinical Features (Complete Mole)")
for i in [
    "Vaginal bleeding in first trimester with grape-like vesicles",
    "Uterus large-for-dates (50% of cases)",
    "Hyperemesis gravidarum (very high β-hCG)",
    "Pre-eclampsia BEFORE 20 weeks (pathognomonic — think mole!)",
    "Bilateral theca-lutein cysts (high hCG → LH-like stimulation of ovaries)",
    "Hyperthyroidism (hCG has weak TSH-like activity → TSH suppression)",
]:
    story.append(B(i))

story += sub_header("Management")
story.append(make_table(
    ["Step", "Action"],
    [
        ["Evacuation", "Suction curettage (MVA/EVA) under oxytocin drip; avoid sharp curettage"],
        ["Rh prophylaxis", "Anti-D if Rh negative"],
        ["Histopathology", "All evacuated tissue (mandatory)"],
        ["β-hCG surveillance", "Weekly until normal x3 consecutive, then monthly x6 months (complete) / x3 months (partial)"],
        ["Contraception", "OCP or barrier for 6–12 months; avoid IUD; avoid pregnancy during surveillance"],
        ["CXR", "Baseline for metastasis (lung most common site)"],
    ],
    col_widths=[3.5*cm, doc.width - 3.5*cm]
))
story.append(SP(6))
story += sub_header("GTN (Gestational Trophoblastic Neoplasia) Diagnosis")
story.append(make_table(
    ["Criterion (any one)", "Detail"],
    [
        ["β-hCG plateau", "≤10% variation over 4 measurements in 3 weeks"],
        ["β-hCG rise", "&gt;10% rise over 3 measurements in 2 weeks"],
        ["Persistent elevation", "hCG elevated &gt;6 months after evacuation"],
        ["Histological", "Choriocarcinoma or PSTT (placental site trophoblastic tumor)"],
    ],
    col_widths=[4.5*cm, doc.width - 4.5*cm]
))
story.append(B("<b>Treatment:</b> MTX ± Actinomycin-D (low risk); EMA-CO regimen (high risk)"))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 11. CERVICAL CHANGES IN LABOUR
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("11", "CERVICAL CHANGES IN LABOUR")
story += sub_header("Cervical Ripening")
for i in [
    "<b>Biochemical:</b> Collagen breakdown (collagenase, elastase) → ↑ hyaluronic acid, ↓ dermatan sulfate → cervix softens",
    "<b>Effacement:</b> Cervical canal shortens (taken up into lower uterine segment); measured as %",
    "Dilatation: widening of the cervical os",
]:
    story.append(B(i))

story += sub_header("Bishop Score (0–13)")
story.append(make_table(
    ["Parameter", "0", "1", "2", "3"],
    [
        ["Dilation (cm)", "0", "1–2", "3–4", "≥5"],
        ["Effacement (%)", "0–30", "40–50", "60–70", "≥80"],
        ["Station", "–3", "–2", "–1/0", "+1/+2"],
        ["Consistency", "Firm", "Medium", "Soft", "—"],
        ["Position", "Posterior", "Mid", "Anterior", "—"],
    ],
    col_widths=[3.5*cm, 2*cm, 2*cm, 2*cm, doc.width - 9.5*cm]
))
story.append(SP(4))
story.append(mnemonic_box("Bishop ≥8 = Favorable (induce directly) | Bishop &lt;6 = Ripen cervix first (PGE2, misoprostol, balloon catheter)"))
story.append(SP(8))
story += sub_header("Phases of First Stage of Labour (Friedman's Curve)")
story.append(make_table(
    ["Phase", "Dilation", "Duration (Primigravida)", "Rate"],
    [
        ["Latent phase", "0 → 3 cm (or 4 cm new WHO)", "Up to 20 hrs", "Slow"],
        ["Active phase", "3 → 10 cm", "Max slope", "≥1.2 cm/hr (Friedman) / ≥0.5 cm/hr (WHO 2018)"],
        ["Transition", "8 → 10 cm", "Variable", "Fastest"],
    ],
    col_widths=[3*cm, 3*cm, 4*cm, doc.width - 10*cm]
))
story.append(SP(6))
story += sub_header("Abnormalities")
story.append(make_table(
    ["Abnormality", "Definition (Primigravida)"],
    [
        ["Prolonged latent phase", "&gt;20 hrs (primi) / &gt;14 hrs (multi)"],
        ["Protracted active phase", "&lt;1.2 cm/hr (primi) / &lt;1.5 cm/hr (multi)"],
        ["Arrest of dilation", "No progress for &gt;2 hrs in active phase with adequate contractions"],
        ["Secondary arrest", "Arrested after previous progress in active phase"],
    ],
    col_widths=[4.5*cm, doc.width - 4.5*cm]
))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 12. NST AND BPP
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("12", "NST AND BIOPHYSICAL PROFILE (BPP)")
story += sub_header("Non-Stress Test (NST)")
story.append(B("Principle: Fetal movement → sympathetic stimulation → transient FHR acceleration. Loss of accelerations = possible hypoxia/CNS depression."))
story.append(B("Duration: 20 min (extend to 40 min if non-reactive — fetal sleep cycle)"))
story.append(SP(4))
story.append(make_table(
    ["Result", "Criteria", "Interpretation"],
    [
        ["Reactive (Normal)", "≥2 accelerations in 20 min; ≥15 bpm rise, lasting ≥15 sec (≥32 wks)", "No fetal hypoxia"],
        ["Reactive (Preterm &lt;32 wks)", "≥2 accelerations; ≥10 bpm, lasting ≥10 sec", "Normal for gestational age"],
        ["Non-Reactive", "Criteria not met in 40 min", "Investigate further (BPP, Doppler)"],
    ],
    col_widths=[3.5*cm, 6*cm, doc.width - 9.5*cm]
))
story.append(SP(4))
story += sub2_header("Other CTG Features")
story.append(make_table(
    ["Feature", "Normal Range", "Abnormal"],
    [
        ["Baseline FHR", "110–160 bpm", "Bradycardia &lt;110 / Tachycardia &gt;160"],
        ["Variability", "5–25 bpm (moderate)", "Absent (&lt;5) or saltatory (&gt;25)"],
        ["Early decels", "With contractions, return to baseline", "Benign — head compression"],
        ["Late decels", "After peak of contraction", "UTEROPLACENTAL INSUFFICIENCY"],
        ["Variable decels", "Vary in shape and timing", "CORD COMPRESSION"],
    ],
    col_widths=[3.5*cm, 4*cm, doc.width - 7.5*cm]
))
story.append(SP(8))
story += sub_header("Biophysical Profile (Manning's Score)")
story.append(mnemonic_box("Mnemonic: NBA-FT — NST, Breathing, Amniotic fluid, Fetal movements (gross body), Tone"))
story.append(SP(4))
story.append(make_table(
    ["Parameter", "Normal (Score = 2)", "Observation Time"],
    [
        ["NST", "≥2 accelerations (≥15 bpm, ≥15 sec)", "20–40 min"],
        ["Fetal Breathing Movements", "≥1 episode lasting ≥30 sec", "30 min"],
        ["Gross Body Movements", "≥3 discrete movements", "30 min"],
        ["Fetal Tone", "≥1 extension-flexion (limb / trunk)", "30 min"],
        ["Amniotic Fluid Volume", "Single deepest pocket ≥2 cm", "Any time"],
    ],
    col_widths=[5*cm, 5*cm, doc.width - 10*cm]
))
story.append(SP(6))
story.append(make_table(
    ["Score", "Interpretation", "Action"],
    [
        ["8–10 / 10", "Normal, no asphyxia", "Repeat in 1–2 weeks"],
        ["6 / 10", "Equivocal", "Repeat in 24 hrs; deliver if ≥36 wks"],
        ["4 / 10", "Probable asphyxia", "Deliver if ≥32 wks"],
        ["0–2 / 10", "Strong asphyxia", "Deliver immediately"],
    ],
    col_widths=[2.5*cm, 4*cm, doc.width - 6.5*cm]
))
story.append(SP(4))
story.append(B("<b>Modified BPP:</b> NST + AFI only — quick bedside screening tool"))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 13. MENSTRUATION — PHYSIOLOGY
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("13", "MENSTRUATION — PHYSIOLOGY")
story += sub_header("Normal Parameters")
story.append(make_table(
    ["Parameter", "Normal Range"],
    [
        ["Cycle length", "21–35 days (mean 28 days)"],
        ["Duration", "2–7 days (mean 4 days)"],
        ["Blood loss", "20–80 mL (mean 35 mL); &gt;80 mL = Heavy Menstrual Bleeding"],
        ["pH of menstrual blood", "6.7–7.2 (slightly acidic; does not clot — fibrinolysins present)"],
    ],
    col_widths=[4*cm, doc.width - 4*cm]
))
story.append(SP(8))
story += sub_header("Hormonal Cycle (28-day)")
story += sub2_header("Follicular Phase (Days 1–14)")
story.append(make_table(
    ["Event", "Detail"],
    [
        ["FSH rises", "Follicle recruitment and development; dominant follicle selected by day 5–7"],
        ["Rising Estradiol", "Endometrium: proliferative phase (glandular growth, stromal proliferation)"],
        ["LH surge (Day 13–14)", "Triggers ovulation ~36 hrs later"],
        ["Ovulation (Day 14)", "Dominant follicle ruptures → oocyte released"],
    ],
    col_widths=[4*cm, doc.width - 4*cm]
))
story.append(SP(6))
story += sub2_header("Luteal Phase (Days 14–28)")
story.append(make_table(
    ["Event", "Detail"],
    [
        ["Corpus luteum", "Secretes progesterone + estrogen"],
        ["Secretory phase", "Endometrium: subnuclear vacuoles (Day 17–20) → supranuclear → secretion (Day 21–24)"],
        ["Corpus luteum regression (Day 24–25)", "If no fertilization → progesterone/estrogen fall"],
        ["Menstruation trigger", "Progesterone withdrawal → ↑ PGF2α + PGE2 → vasoconstriction → ischemia → shedding"],
    ],
    col_widths=[4.5*cm, doc.width - 4.5*cm]
))
story.append(SP(8))
story += sub_header("Mechanism of Menstruation")
for i in [
    "Progesterone withdrawal → PGF2α release from endometrium",
    "PGF2α → spiral artery vasoconstriction + myometrial contraction → ischemia → coagulative necrosis",
    "Stratum functionalis (compactum + spongiosum) is shed; stratum basalis is retained (contains stem cells)",
    "Fibrinolysins (plasmin, activated by tissue plasminogen activator) lyse clots → fluid menstrual flow",
]:
    story.append(B(i))

story += sub_header("Endometrial Layers")
story.append(make_table(
    ["Layer", "Component", "Fate"],
    [
        ["Functionalis", "Stratum compactum (superficial) + Stratum spongiosum", "SHED during menstruation"],
        ["Basalis", "Deep basal layer (contains stem cells, gland bases)", "RETAINED; source of regeneration"],
    ],
    col_widths=[3*cm, 6*cm, doc.width - 9*cm]
))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 14. AUB
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("14", "AUB — ABNORMAL UTERINE BLEEDING")
story += sub_header("PALM-COEIN Classification (FIGO 2011)")
story.append(mnemonic_box("PALM = Structural causes | COEIN = Non-structural causes"))
story.append(SP(4))
story.append(make_table(
    ["Acronym", "Cause", "Notes"],
    [
        ["P", "Polyp", "Endometrial / cervical; diagnosed on hysteroscopy / SIS"],
        ["A", "Adenomyosis", "Endometrium within myometrium; globular uterus, dysmenorrhea"],
        ["L", "Leiomyoma (Fibroid)", "Submucosal most symptomatic for HMB"],
        ["M", "Malignancy / Hyperplasia", "Must exclude in women &gt;45 or risk factors"],
        ["C", "Coagulopathy", "vWD, ITP, platelet disorders (suspect if HMB since menarche)"],
        ["O", "Ovulatory dysfunction", "PCOS, thyroid disease, hyperprolactinemia"],
        ["E", "Endometrial", "Local endometrial disorders; endometritis"],
        ["I", "Iatrogenic", "Anticoagulants, IUD, OCPs, breakthrough bleeding"],
        ["N", "Not yet classified", "AVM, myometrial hypertrophy"],
    ],
    col_widths=[1.5*cm, 3*cm, doc.width - 4.5*cm]
))
story.append(SP(8))
story += sub_header("Investigations")
story.append(make_table(
    ["Investigation", "Purpose"],
    [
        ["CBC, ferritin", "Anemia assessment"],
        ["Coagulation screen (PT, APTT, vWF)", "Coagulopathy"],
        ["Thyroid function, Prolactin, LH/FSH", "Ovulatory dysfunction"],
        ["Transvaginal USS", "Fibroids, polyps, adenomyosis, endometrial thickness"],
        ["SIS (Saline Infusion Sonography)", "Intracavitary lesions (polyps, submucous fibroids)"],
        ["Pipelle biopsy", "Endometrial sampling — if &gt;45 yrs, treatment failure, or risk factors for hyperplasia"],
        ["Hysteroscopy + biopsy", "Gold standard for endometrial assessment"],
    ],
    col_widths=[4.5*cm, doc.width - 4.5*cm]
))
story.append(SP(6))
story += sub_header("Management — Medical (in order of evidence)")
story.append(make_table(
    ["Drug", "Dose", "Mechanism / Efficacy"],
    [
        ["LNG-IUS (Mirena)", "52 mg IUS inserted in uterus", "Local progesterone → endometrial atrophy; BEST medical treatment (↓ HMB 80–90%)"],
        ["Tranexamic acid", "1 g TDS x5 days of period", "Antifibrinolytic; ↓ HMB by 40%"],
        ["Mefenamic acid (NSAID)", "500 mg TDS x5 days", "↓ PGs → ↓ HMB by 25% + treats dysmenorrhea"],
        ["Combined OCP", "Standard dosing", "Regulates cycle; ↓ HMB"],
        ["Norethisterone", "5 mg BD/TDS days 5–26", "Cyclical progestin; ↓ HMB"],
        ["GnRH agonist (Leuprolide)", "3.75 mg IM monthly", "Hypoestrogen state; temporary (max 6 months); pre-op fibroid shrinkage"],
    ],
    col_widths=[3.5*cm, 3.5*cm, doc.width - 7*cm]
))
story.append(SP(6))
story += sub_header("Surgical Options")
story.append(make_table(
    ["Procedure", "Indication"],
    [
        ["Endometrial ablation (NovaSure, thermal balloon)", "HMB refractory to medical; completed family; no intrauterine pathology"],
        ["Hysteroscopic polypectomy / myomectomy", "Polyp or submucosal fibroid"],
        ["Abdominal / laparoscopic myomectomy", "Fibroid, fertility desired"],
        ["Hysterectomy (total / subtotal)", "Definitive; completed family; failed all else"],
    ],
    col_widths=[5.5*cm, doc.width - 5.5*cm]
))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 15. FIBROID
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("15", "FIBROID (UTERINE LEIOMYOMA)")
story += sub_header("Epidemiology")
story.append(B("Most common benign gynecological tumor; affects 20–40% of women &gt;35 years"))
story.append(B("More common in Black women (3–5x higher prevalence)"))
story.append(B("Estrogen + progesterone dependent; grow during reproductive years; REGRESS after menopause"))

story += sub_header("Classification by Location (FIGO 0–8)")
story.append(make_table(
    ["Type", "Location", "Most Symptomatic?"],
    [
        ["Submucosal (0–2)", "Under endometrium; FIGO 0 = fully intracavitary pedunculated", "MOST — HMB, subfertility"],
        ["Intramural (3–4)", "Within myometrium (most common overall)", "Moderate — HMB, bulk symptoms"],
        ["Subserosal (5–7)", "Under serosa; can be pedunculated", "LEAST — bulk symptoms only"],
        ["Cervical (8)", "Within cervical stroma", "Rare"],
    ],
    col_widths=[3.5*cm, 5*cm, doc.width - 8.5*cm]
))
story.append(SP(8))
story += sub_header("Complications / Degenerations")
story.append(make_table(
    ["Type", "Feature", "Clinical Clue"],
    [
        ["Red (Carneous) degeneration", "Pregnancy-related; hemorrhagic infarction", "Acute localized pain over fibroid; low-grade fever; responds to analgesia"],
        ["Hyaline degeneration", "Most common; central hyalinization", "Usually asymptomatic"],
        ["Cystic degeneration", "Liquefaction of hyaline center", "USS: cystic areas"],
        ["Calcific degeneration", "Post-menopausal; calcified rim", "X-ray: 'whorled calcification'"],
        ["Sarcomatous change", "Malignant transformation (&lt;0.5%)", "Rapid growth, post-menopausal bleeding"],
    ],
    col_widths=[3.5*cm, 4*cm, doc.width - 7.5*cm]
))
story.append(SP(8))
story += sub_header("Management")
story.append(make_table(
    ["Option", "Type", "Details"],
    [
        ["LNG-IUS, OCP, NSAIDs", "Medical (symptom control)", "For HMB; no effect on fibroid size"],
        ["Ulipristal acetate (UPA)", "Medical (selective PRM)", "↓ fibroid size + HMB; short courses (3 months)"],
        ["GnRH agonist", "Medical (pre-op)", "↓ fibroid size 30–50%; max 6 months; add-back therapy"],
        ["Myomectomy", "Surgical (fertility-sparing)", "Open / laparoscopic / hysteroscopic (type 0–1)"],
        ["UAE (Uterine Artery Embolization)", "Interventional radiology", "Fibroid infarction; NOT for fertility desire"],
        ["HIFU / MRgFUS", "Non-invasive", "High-intensity focused ultrasound; MRI-guided"],
        ["Hysterectomy", "Surgical (definitive)", "Completed family; failed other treatments"],
    ],
    col_widths=[3.5*cm, 3.5*cm, doc.width - 7*cm]
))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 16. ADENOMYOSIS
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("16", "ADENOMYOSIS")
story += sub_header("Definition")
story.append(B("Endometrial glands and stroma within the myometrium (&gt;2.5 mm from basalis) + smooth muscle hypertrophy"))
story.append(B("'Endometriosis interna' — estrogen-dependent, affects multiparous women (35–50 yrs)"))
story.append(B("Associated with prior uterine surgery (D&amp;C, CS, myomectomy)"))

story += sub_header("Types")
story.append(make_table(
    ["Type", "Feature"],
    [
        ["Diffuse adenomyosis", "Entire uterus involved; globular, bulky, 'boggy' uterus"],
        ["Focal adenomyoma", "Localized nodule; may mimic fibroid on USS"],
    ],
    col_widths=[4*cm, doc.width - 4*cm]
))
story.append(SP(8))
story += sub_header("Clinical Features")
story.append(make_table(
    ["Feature", "Detail"],
    [
        ["Dysmenorrhea", "Progressive, secondary (worsens with each cycle); HALLMARK symptom"],
        ["HMB", "Menorrhagia ± metrorrhagia"],
        ["Uterus on exam", "Uniformly enlarged (4–6 wk size), GLOBULAR, BOGGY, TENDER (esp. menstrual phase)"],
        ["Subfertility", "Impaired implantation and embryo transport"],
    ],
    col_widths=[3.5*cm, doc.width - 3.5*cm]
))
story.append(SP(8))
story += sub_header("Investigations")
story.append(make_table(
    ["Investigation", "Finding"],
    [
        ["Transvaginal USS", "Globular uterus, thickened posterior wall, heterogeneous myometrium, 'Swiss cheese' cysts, ill-defined endo-myometrial junction"],
        ["MRI (gold standard — non-histological)", "Junctional Zone (JZ) thickness &gt;12 mm = diagnostic; JZ/myometrium ratio &gt;40%"],
        ["Histopathology", "Definitive diagnosis (hysterectomy specimen)"],
        ["CA-125", "Mildly elevated (non-specific)"],
    ],
    col_widths=[4*cm, doc.width - 4*cm]
))
story.append(SP(8))
story += sub_header("Management")
story.append(make_table(
    ["Option", "Details"],
    [
        ["LNG-IUS (Mirena)", "MOST EFFECTIVE medical option; reduces HMB + dysmenorrhea; local progesterone"],
        ["Combined OCP (continuous)", "Suppresses cycle; reduces dysmenorrhea"],
        ["Dienogest / Norethisterone", "Continuous progestin; effective for pain"],
        ["GnRH agonist", "Temporary (6 months); add-back therapy; reduces uterine size pre-op"],
        ["Adenomyomectomy", "Focal adenomyoma only; technically difficult; high recurrence (&gt;50%)"],
        ["Hysterectomy (definitive)", "Completed family, failed medical management; curative"],
    ],
    col_widths=[4*cm, doc.width - 4*cm]
))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# 17. ENDOMETRIOSIS
# ══════════════════════════════════════════════════════════════════════════════
story += section_header("17", "ENDOMETRIOSIS")
story += sub_header("Definition")
story.append(B("Endometrial glands and stroma present OUTSIDE the uterus"))
story.append(B("Estrogen-dependent; benign but invasive, inflammatory, and highly recurrent"))

story += sub_header("Common Sites")
story.append(make_table(
    ["Site", "Notes"],
    [
        ["Ovaries (most common)", "Endometrioma = 'chocolate cyst' (dark brown old blood)"],
        ["Uterosacral ligaments, POD", "Most common site of pain; nodularity on P/V exam"],
        ["Fallopian tubes, broad ligament", "Adhesions → tubal factor infertility"],
        ["Rectovaginal septum, bowel, bladder", "Deep infiltrating endometriosis (DIE)"],
        ["Surgical scars (umbilicus, CS scar)", "Rare; cyclic pain/swelling at scar"],
    ],
    col_widths=[4*cm, doc.width - 4*cm]
))
story.append(SP(6))
story += sub_header("Pathogenesis Theories")
story.append(make_table(
    ["Theory", "Mechanism", "Evidence"],
    [
        ["Sampson's Retrograde Menstruation (most accepted)", "Endometrial cells reflux via tubes → implant on peritoneum", "Explains pelvic sites; most supporting evidence"],
        ["Coelomic Metaplasia", "Peritoneal cells undergo metaplasia → endometrial phenotype", "Explains distant sites"],
        ["Lympho-vascular Dissemination", "Cells spread via lymphatics/blood vessels", "Explains rare distant sites (lung, nose)"],
    ],
    col_widths=[4*cm, 4*cm, doc.width - 8*cm]
))
story.append(SP(6))
story += sub_header("Clinical Features — '3 Ds'")
story.append(mnemonic_box("3 Ds: Dysmenorrhea (secondary, progressive) + Dyspareunia (deep, premenstrual) + Dyschezia (painful defecation — rectovaginal involvement)"))
story.append(SP(4))
story.append(make_table(
    ["Symptom", "Detail"],
    [
        ["Dysmenorrhea", "Secondary (develops after pain-free periods), progressive; hallmark"],
        ["Dyspareunia", "Deep; worse premenstrually; uterosacral involvement"],
        ["Dyschezia", "Painful defecation; rectal/rectovaginal involvement"],
        ["Chronic pelvic pain", "Constant or cyclical"],
        ["Subfertility", "30–40% of women with endometriosis; multiple mechanisms"],
        ["HMB / irregular bleeding", "Common; endometrioma may cause ovarian reserve reduction"],
    ],
    col_widths=[4*cm, doc.width - 4*cm]
))
story.append(SP(6))
story += sub_header("Investigations")
story.append(make_table(
    ["Investigation", "Finding"],
    [
        ["Transvaginal USS", "Endometrioma: 'ground glass' homogeneous cyst with thick wall, no papillary projections"],
        ["CA-125", "Elevated (not specific); useful for monitoring treatment response"],
        ["MRI", "Deep infiltrating endometriosis, rectovaginal, bladder lesions"],
        ["Laparoscopy + biopsy (GOLD STANDARD)", "'Powder burn' (blue-black deposits), red lesions (active), clear vesicles, adhesions, chocolate cysts"],
    ],
    col_widths=[4.5*cm, doc.width - 4.5*cm]
))
story.append(SP(6))
story += sub_header("ASRM Staging")
story.append(make_table(
    ["Stage", "Description"],
    [
        ["I — Minimal", "Isolated superficial implants; no significant adhesions"],
        ["II — Mild", "Small, deep implants; few adhesions"],
        ["III — Moderate", "Multiple implants; ectopic endometrioma; peritubal adhesions"],
        ["IV — Severe", "Large bilateral endometriomas; dense adhesions; significant distortion"],
    ],
    col_widths=[3*cm, doc.width - 3*cm]
))
story.append(note_box("ASRM staging does NOT correlate well with pain severity or fertility outcomes."))
story.append(SP(6))
story += sub_header("Management")
story += sub2_header("Medical (hormonal suppression — not curative; for symptoms)")
story.append(make_table(
    ["Drug", "Mechanism", "Notes"],
    [
        ["Combined OCP (continuous)", "Suppresses ovulation + endometrium", "First-line; few side effects"],
        ["Dienogest / Progestins", "Decidualization + atrophy of implants", "Effective for pain; well tolerated"],
        ["LNG-IUS", "Local progesterone → endometrial atrophy", "Best for pelvic pain + HMB"],
        ["GnRH agonist (Leuprolide, Goserelin)", "Medical castration → hypoestrogen", "Most effective; max 6 months; add-back therapy prevents bone loss"],
        ["Danazol", "Androgen → pseudomenopause", "Effective but side effects (acne, virilization, weight gain); rarely used now"],
    ],
    col_widths=[3.5*cm, 3.5*cm, doc.width - 7*cm]
))
story.append(SP(4))
story += sub2_header("Surgical")
story.append(make_table(
    ["Procedure", "Indication", "Notes"],
    [
        ["Laparoscopic ablation / excision of implants", "Pain, mild-moderate disease", "Excision (cystectomy) preferred over ablation"],
        ["Endometrioma cystectomy (stripping)", "Ovarian endometrioma ≥4 cm", "Reduces ovarian reserve (AMH falls); 30% recurrence at 5 yrs"],
        ["Adhesiolysis", "Tubal factor infertility", "Improves fertility"],
        ["TAH + BSO (radical)", "Severe disease, completed family", "Curative; causes surgical menopause; HRT needed"],
    ],
    col_widths=[4*cm, 3.5*cm, doc.width - 7.5*cm]
))
story.append(SP(4))
story += sub2_header("Fertility Treatment")
story.append(B("IUI: mild disease + patent tubes"))
story.append(B("IVF: moderate-severe, tubal factor; surgery before IVF improves outcome for endometrioma ≥4 cm"))
story.append(B("Bilateral endometrioma cystectomy: risk of premature ovarian insufficiency — counsel carefully"))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# QUICK MNEMONICS PAGE
# ══════════════════════════════════════════════════════════════════════════════
story.append(P("<b>QUICK MNEMONICS &amp; EXAM TIPS</b>",
    ParagraphStyle("MHead", fontSize=14, textColor=NAVY, fontName="Helvetica-Bold",
        spaceAfter=10, alignment=TA_CENTER)))
story.append(HR())
mnemonics_list = [
    ("HDP Severe Features", "TReVID — Thrombocytopenia, Renal insufficiency, elevated LFTs, Visual/Headache, Increased BP ≥160/110, Dyspnea (pulmonary edema)"),
    ("MgSO4 Toxicity Sequence", "Loss of DTRs (first) → Respiratory depression → Cardiac arrest. Antidote: Calcium gluconate 1g IV"),
    ("BPP Parameters", "NBA-FT — NST, Breathing, Amniotic fluid, Fetal movements (gross body), Tone"),
    ("AUB Classification", "PALM-COEIN — Polyp, Adenomyosis, Leiomyoma, Malignancy / Coagulopathy, Ovulatory, Endometrial, Iatrogenic, Not classified"),
    ("MTX Criteria (Ectopic)", "SNAP — Stable hemodynamics, No cardiac activity, Adnexal mass ≤3.5 cm, β-hCG &lt;5000 mIU/mL"),
    ("Twin Division Timing", "3-4-8-13 days → DCDA(MZ) / MCDA / MCMA / Conjoined"),
    ("Endometriosis Classic", "3 Ds — Dysmenorrhea (secondary, progressive) + Dyspareunia (deep) + Dyschezia"),
    ("Cervical Bishop Score", "Bishop ≥8 = Favorable (induce). &lt;6 = Ripen first. Parameters: Dilatation, Effacement, Station, Consistency, Position"),
    ("Complete vs Partial Mole", "Complete = 46XX all-paternal, no fetus, snowstorm USS, very high hCG, 15-20% GTN risk"),
    ("Rh Negative Protocol", "ICT at booking → Anti-D at 28 wks → Anti-D within 72h after delivery (if baby Rh+)"),
    ("FGR Doppler Sequence", "Normal UA → High S/D → AEDF → REDF → DV reversed a-wave (deliver immediately at each worsening step)"),
    ("Preterm Labour Tocolysis", "Nifedipine (1st line, Ca-blocker) → Atosiban (2nd line, oxytocin antagonist) — only 48 hrs; then steroids"),
]
for term, tip in mnemonics_list:
    story.append(mnemonic_box(f"<b>{term}:</b> {tip}"))
    story.append(SP(4))

story.append(SP(10))
story.append(HR())
story.append(P("Reference: Mudaliar &amp; Menon's Clinical Obstetrics (Shaw revised) · Berek &amp; Novak's Gynecology ·<br/>Creasy &amp; Resnik's Maternal-Fetal Medicine · ACOG / FOGSI Guidelines 2024", ref_style))

# ── Build PDF ─────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF created: {OUTPUT}")
Running Command

cd /tmp/workspace/obgyn-study-guide && python generate_pdf.py 2>&1

Running Command

ls -lh /tmp/workspace/obgyn-study-guide/OBGyn_ExamNotes.pdf

Your study guide PDF is ready for download:

OBGyn ExamNotes

PDF Document · PDF

What's inside (62 KB, professionally formatted):
  • Cover page with title and references
  • Table of contents with all 17 topics listed
  • 17 color-coded sections - each with a navy header bar for easy navigation
  • All tables with alternating row shading (HDP classification, Bishop score, BPP scoring, tocolytic drugs, MTX protocol, twin complications, Doppler management, etc.)
  • Amber alert boxes for critical warnings (e.g., never VE in PP, MgSO4 antidote, GTN criteria)
  • Green mnemonic boxes throughout (TReVID, NBA-FT, PALM-COEIN, SNAP, 3Ds, 3-4-8-13, etc.)
  • Final quick-revision mnemonics page with all 12 key mnemonics in one place
Good luck tomorrow - you've got this!
This is a shared conversation. Sign in to Orris to start your own chat.