Management of pih after delivery
postpartum hypertension management preeclampsia
| Drug | Route | Dose | Notes |
|---|---|---|---|
| Labetalol (preferred) | IV | 10-20 mg bolus, then 20-80 mg every 10-30 min, max 300 mg total | Onset 1-2 min. Mixed α/β blocker; preserves uteroplacental flow; no neonatal sympathetic blockade. Contraindicated in asthma, heart failure |
| Hydralazine | IV/IM | 5 mg initial, then 5-10 mg every 20-40 min, max 20 mg | Onset 10-20 min, peak 20-40 min. Arteriolar vasodilator; increases uterine and renal blood flow. Risk: reflex tachycardia, unpredictable duration |
| Nifedipine IR | Oral | 10-20 mg initially, repeat in 20-30 min if needed; 10-20 mg every 3-6 h for maintenance, max 180 mg/day | Onset 5-10 min. Useful before IV access. Monitor for magnesium potentiation |
| Sign | Action |
|---|---|
| Loss of patellar reflexes | Early warning - check Mg level |
| Respiratory slowing | Reduce or stop infusion |
| Respiratory depression/paralysis | Stop infusion; administer calcium gluconate 1 g IV (antidote) |
Create a clinical reference PDF on acute hypertensive emergencies in pregnancy
ls /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or missing"
mkdir -p /home/daytona/workspace/hypertension-pregnancy-pdf
~/hypertension-pregnancy-pdf/generate_pdf.py
#!/usr/bin/env python3
"""
Clinical Reference PDF: Acute Hypertensive Emergencies in Pregnancy
Uses reportlab for professional clinical layout.
"""
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, PageBreak, KeepTogether
)
from reportlab.platypus.flowables import Flowable
from reportlab.pdfgen import canvas
from reportlab.lib.colors import HexColor
import os
# ---------- Color Palette ----------
RED_DARK = HexColor('#B22222') # firebrick - headers
RED_LIGHT = HexColor('#FFF0F0') # light pink - warning boxes
BLUE_DARK = HexColor('#1A3A5C') # navy - section headings
BLUE_MID = HexColor('#2E6DA4') # medium blue - table headers
BLUE_LIGHT = HexColor('#EBF4FA') # light blue - table alt rows
TEAL = HexColor('#006B6B') # teal - subsection headings
GREEN_DARK = HexColor('#1B5E20') # dark green - normal box
GREEN_LIGHT = HexColor('#F0FFF4') # light green - normal box bg
AMBER = HexColor('#FF8F00') # amber - caution
AMBER_LIGHT = HexColor('#FFFDE7') # light amber
GRAY_DARK = HexColor('#333333')
GRAY_MED = HexColor('#555555')
GRAY_LIGHT = HexColor('#F5F5F5')
GRAY_LINE = HexColor('#CCCCCC')
WHITE = colors.white
OUTPUT_PATH = '/home/daytona/workspace/hypertension-pregnancy-pdf/Hypertensive_Emergencies_Pregnancy.pdf'
PAGE_W, PAGE_H = A4
MARGIN = 1.8 * cm
# ---------- Custom Flowables ----------
class ColoredBox(Flowable):
"""A colored background box with a left accent bar."""
def __init__(self, content_paragraphs, bg_color, bar_color, width=None):
super().__init__()
self.content = content_paragraphs
self.bg_color = bg_color
self.bar_color = bar_color
self._width = width or (PAGE_W - 2 * MARGIN)
self._built = False
def wrap(self, avail_w, avail_h):
self._width = avail_w
total_h = 8 # padding top+bottom
for p in self.content:
w, h = p.wrap(avail_w - 20, avail_h)
total_h += h + 4
self._height = total_h + 4
return avail_w, self._height
def draw(self):
c = self.canv
w, h = self._width, self._height
# Background
c.setFillColor(self.bg_color)
c.roundRect(0, 0, w, h, 4, fill=1, stroke=0)
# Left bar
c.setFillColor(self.bar_color)
c.rect(0, 0, 5, h, fill=1, stroke=0)
# Draw paragraphs
y = h - 8
for p in self.content:
pw, ph = p.wrap(w - 20, h)
p.drawOn(c, 12, y - ph)
y -= ph + 4
class SectionHeader(Flowable):
"""Full-width colored section header band."""
def __init__(self, text, bg_color=BLUE_DARK, text_color=WHITE, height=22):
super().__init__()
self.text = text
self.bg_color = bg_color
self.text_color = text_color
self._height = height
def wrap(self, avail_w, avail_h):
self._width = avail_w
return avail_w, self._height
def draw(self):
c = self.canv
c.setFillColor(self.bg_color)
c.roundRect(0, 0, self._width, self._height, 3, fill=1, stroke=0)
c.setFillColor(self.text_color)
c.setFont('Helvetica-Bold', 11)
c.drawString(8, 6, self.text)
# ---------- Page Template with Header/Footer ----------
def make_page_template(canvas_obj, doc):
canvas_obj.saveState()
w, h = A4
# Top header bar
canvas_obj.setFillColor(BLUE_DARK)
canvas_obj.rect(0, h - 1.1*cm, w, 1.1*cm, fill=1, stroke=0)
canvas_obj.setFillColor(WHITE)
canvas_obj.setFont('Helvetica-Bold', 9)
canvas_obj.drawString(MARGIN, h - 0.75*cm, 'CLINICAL REFERENCE | Acute Hypertensive Emergencies in Pregnancy')
canvas_obj.setFont('Helvetica', 8)
canvas_obj.drawRightString(w - MARGIN, h - 0.75*cm, 'July 2026')
# Red accent line under header
canvas_obj.setFillColor(RED_DARK)
canvas_obj.rect(0, h - 1.2*cm, w, 0.1*cm, fill=1, stroke=0)
# Bottom footer
canvas_obj.setFillColor(GRAY_LIGHT)
canvas_obj.rect(0, 0, w, 0.9*cm, fill=1, stroke=0)
canvas_obj.setFillColor(GRAY_MED)
canvas_obj.setFont('Helvetica', 7.5)
canvas_obj.drawString(MARGIN, 0.32*cm,
'Sources: Creasy & Resnik\'s MFM (8e) | Goldman-Cecil Medicine | Tintinalli\'s Emergency Medicine | Swanson\'s Family Medicine Review')
canvas_obj.setFont('Helvetica-Bold', 8)
canvas_obj.drawRightString(w - MARGIN, 0.32*cm, f'Page {doc.page}')
# Outer border
canvas_obj.setStrokeColor(GRAY_LINE)
canvas_obj.setLineWidth(0.5)
canvas_obj.rect(0.5*cm, 0.9*cm, w - 1*cm, h - 2.1*cm, fill=0, stroke=1)
canvas_obj.restoreState()
# ---------- Styles ----------
styles = getSampleStyleSheet()
def S(name, **kw):
return ParagraphStyle(name, **kw)
style_body = S('body', fontSize=9, leading=13, textColor=GRAY_DARK,
fontName='Helvetica', spaceAfter=4)
style_body_j = S('body_j', fontSize=9, leading=13, textColor=GRAY_DARK,
fontName='Helvetica', alignment=TA_JUSTIFY, spaceAfter=4)
style_bold = S('bold', fontSize=9, leading=13, textColor=GRAY_DARK,
fontName='Helvetica-Bold', spaceAfter=3)
style_small = S('small', fontSize=8, leading=11, textColor=GRAY_MED,
fontName='Helvetica')
style_warn_head = S('warn_head', fontSize=9.5, leading=13, textColor=RED_DARK,
fontName='Helvetica-Bold', spaceAfter=2)
style_warn_body = S('warn_body', fontSize=8.5, leading=12, textColor=GRAY_DARK,
fontName='Helvetica')
style_green_head = S('green_head', fontSize=9.5, leading=13, textColor=GREEN_DARK,
fontName='Helvetica-Bold', spaceAfter=2)
style_green_body = S('green_body', fontSize=8.5, leading=12, textColor=GRAY_DARK,
fontName='Helvetica')
style_teal = S('teal', fontSize=10, leading=14, textColor=TEAL,
fontName='Helvetica-Bold', spaceBefore=8, spaceAfter=3)
style_bullet = S('bullet', fontSize=8.5, leading=12, textColor=GRAY_DARK,
fontName='Helvetica', leftIndent=12, firstLineIndent=-8, spaceAfter=2)
style_sub_bullet = S('sub_bullet', fontSize=8, leading=11, textColor=GRAY_MED,
fontName='Helvetica', leftIndent=22, firstLineIndent=-8, spaceAfter=1)
style_thtop = S('thtop', fontSize=8.5, leading=11, textColor=WHITE,
fontName='Helvetica-Bold', alignment=TA_CENTER)
style_td = S('td', fontSize=8.5, leading=11, textColor=GRAY_DARK,
fontName='Helvetica')
style_td_c = S('td_c', fontSize=8.5, leading=11, textColor=GRAY_DARK,
fontName='Helvetica', alignment=TA_CENTER)
style_td_bold = S('td_bold', fontSize=8.5, leading=11, textColor=GRAY_DARK,
fontName='Helvetica-Bold')
style_page_title = S('page_title', fontSize=20, leading=26, textColor=WHITE,
fontName='Helvetica-Bold', alignment=TA_CENTER)
style_page_sub = S('page_sub', fontSize=11, leading=15, textColor=HexColor('#CCDDE8'),
fontName='Helvetica', alignment=TA_CENTER)
style_caption = S('caption', fontSize=7.5, leading=10, textColor=GRAY_MED,
fontName='Helvetica-Oblique', alignment=TA_CENTER)
# ---------- Helper: Table with standard styling ----------
def make_table(data, col_widths, header_rows=1, zebra=True, header_bg=BLUE_MID):
t = Table(data, colWidths=col_widths, repeatRows=header_rows)
style_cmds = [
('BACKGROUND', (0, 0), (-1, header_rows - 1), header_bg),
('TEXTCOLOR', (0, 0), (-1, header_rows - 1), WHITE),
('FONTNAME', (0, 0), (-1, header_rows - 1), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, header_rows - 1), 8.5),
('ALIGN', (0, 0), (-1, header_rows - 1), 'CENTER'),
('VALIGN', (0, 0), (-1, -1), 'TOP'),
('FONTNAME', (0, header_rows), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, header_rows), (-1, -1), 8.5),
('ROWBACKGROUND', (0, header_rows), (-1, -1),
[WHITE if i % 2 == 0 else BLUE_LIGHT for i in range(100)]) if zebra else ('BACKGROUND', (0, header_rows), (-1, -1), WHITE),
('GRID', (0, 0), (-1, -1), 0.4, GRAY_LINE),
('TOPPADDING', (0, 0), (-1, -1), 4),
('BOTTOMPADDING', (0, 0), (-1, -1), 4),
('LEFTPADDING', (0, 0), (-1, -1), 5),
('RIGHTPADDING', (0, 0), (-1, -1), 5),
('LINEBELOW', (0, header_rows - 1), (-1, header_rows - 1), 1.5, BLUE_MID),
]
t.setStyle(TableStyle(style_cmds))
return t
def b(text):
return f'<b>{text}</b>'
def red(text):
return f'<font color="#B22222"><b>{text}</b></font>'
def P(text, style=None):
return Paragraph(text, style or style_body)
def bullet(text, style=None):
return Paragraph(f'• {text}', style or style_bullet)
def sub_bullet(text):
return Paragraph(f'- {text}', style_sub_bullet)
# ---------- Build Content ----------
def build_story():
story = []
avail_w = PAGE_W - 2 * MARGIN
# ================================================================
# COVER BANNER (simulate with a colored table)
# ================================================================
cover_data = [[
Paragraph('<font color="white"><b>CLINICAL REFERENCE</b></font><br/>'
'<font color="#CCDDE8" size="9">Obstetric Emergency Protocol</font>',
ParagraphStyle('cv1', fontSize=13, leading=18, textColor=WHITE,
fontName='Helvetica-Bold'))
]]
cover_tbl = Table(cover_data, colWidths=[avail_w])
cover_tbl.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, -1), BLUE_DARK),
('TOPPADDING', (0, 0), (-1, -1), 14),
('BOTTOMPADDING', (0, 0), (-1, -1), 6),
('LEFTPADDING', (0, 0), (-1, -1), 10),
('ROUNDEDCORNERS', [5, 5, 0, 0]),
]))
title_data = [[
Paragraph(
'<font color="white" size="17"><b>ACUTE HYPERTENSIVE EMERGENCIES</b></font><br/>'
'<font color="#CCDDE8" size="13">IN PREGNANCY & THE POSTPARTUM PERIOD</font>',
ParagraphStyle('cv2', fontSize=17, leading=24, textColor=WHITE,
fontName='Helvetica-Bold', alignment=TA_CENTER))
]]
title_tbl = Table(title_data, colWidths=[avail_w])
title_tbl.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, -1), RED_DARK),
('TOPPADDING', (0, 0), (-1, -1), 16),
('BOTTOMPADDING', (0, 0), (-1, -1), 16),
('LEFTPADDING', (0, 0), (-1, -1), 10),
]))
meta_data = [[
Paragraph('<font color="#CCCCCC" size="8">For use by trained healthcare professionals | '
'Verify all doses with current formulary | Not a substitute for clinical judgment</font>',
ParagraphStyle('meta', fontSize=8, textColor=HexColor('#AAAAAA'),
fontName='Helvetica', alignment=TA_CENTER))
]]
meta_tbl = Table(meta_data, colWidths=[avail_w])
meta_tbl.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, -1), HexColor('#0D2236')),
('TOPPADDING', (0, 0), (-1, -1), 6),
('BOTTOMPADDING', (0, 0), (-1, -1), 6),
('ROUNDEDCORNERS', [0, 0, 5, 5]),
]))
story += [cover_tbl, title_tbl, meta_tbl, Spacer(1, 0.4*cm)]
# ================================================================
# SECTION 1: DEFINITIONS & CLASSIFICATION
# ================================================================
story.append(SectionHeader('1. DEFINITIONS & CLASSIFICATION'))
story.append(Spacer(1, 4))
# Two-column layout using a Table
col_w = (avail_w - 6) / 2
left_content = [
P(b('Gestational Hypertension'), style_bold),
bullet('New-onset BP ≥ 140/90 mmHg after 20 weeks'),
bullet('No proteinuria or end-organ damage'),
bullet('Resolves within 12 weeks postpartum'),
Spacer(1, 6),
P(b('Preeclampsia (without severe features)'), style_bold),
bullet('BP ≥ 140/90 on 2 occasions ≥4 hours apart'),
bullet('PLUS proteinuria ≥300 mg/24h OR protein:creatinine ≥0.3 OR dipstick ≥2+'),
bullet('OR end-organ dysfunction (even without proteinuria):'),
sub_bullet('Platelets < 100,000/µL'),
sub_bullet('Creatinine > 1.1 mg/dL (or 2x baseline)'),
sub_bullet('AST/ALT > 2x upper limit of normal'),
sub_bullet('Pulmonary edema'),
sub_bullet('New headache unresponsive to medication'),
sub_bullet('New visual disturbances'),
]
right_content = [
P(b('Preeclampsia WITH Severe Features'), style_bold),
bullet('BP ≥ 160/110 on 2 occasions (can confirm within minutes to treat)'),
bullet('Creatinine > 1.1 mg/dL'),
bullet('Platelets < 100,000/µL'),
bullet('AST/ALT > 2x ULN + RUQ/epigastric pain'),
bullet('Pulmonary edema'),
bullet('New-onset headache unresponsive to analgesia'),
bullet('New visual disturbances'),
Spacer(1, 6),
P(b('Eclampsia'), style_bold),
bullet('New-onset seizures superimposed on preeclampsia'),
bullet('Occurs 20 wks gestation to 4 weeks POSTPARTUM'),
bullet('30% of eclamptic seizures occur postpartum'),
Spacer(1, 6),
P(b('Chronic Hypertension in Pregnancy'), style_bold),
bullet('Hypertension predating pregnancy or < 20 weeks'),
bullet('Watch for superimposed preeclampsia'),
]
def wrap_in_table(items, w):
data = [[item] for item in items]
t = Table(data, colWidths=[w])
t.setStyle(TableStyle([
('TOPPADDING', (0, 0), (-1, -1), 0),
('BOTTOMPADDING', (0, 0), (-1, -1), 0),
('LEFTPADDING', (0, 0), (-1, -1), 0),
('RIGHTPADDING', (0, 0), (-1, -1), 0),
]))
return t
two_col = Table(
[[wrap_in_table(left_content, col_w), wrap_in_table(right_content, col_w)]],
colWidths=[col_w, col_w],
spaceBefore=4
)
two_col.setStyle(TableStyle([
('VALIGN', (0, 0), (-1, -1), 'TOP'),
('LEFTPADDING', (0, 0), (-1, -1), 0),
('RIGHTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 0),
('BOTTOMPADDING', (0, 0), (-1, -1), 0),
('LINEAFTER', (0, 0), (0, -1), 0.5, GRAY_LINE),
('RIGHTPADDING', (1, 0), (1, -1), 0),
('LEFTPADDING', (1, 0), (1, -1), 8),
]))
story.append(two_col)
story.append(Spacer(1, 0.3*cm))
# ================================================================
# SECTION 2: HYPERTENSIVE EMERGENCY THRESHOLD
# ================================================================
story.append(SectionHeader('2. HYPERTENSIVE EMERGENCY THRESHOLD & IMMEDIATE RESPONSE', RED_DARK))
story.append(Spacer(1, 4))
warn_box = ColoredBox([
P(red('EMERGENCY THRESHOLD: BP ≥ 160/110 mmHg persisting ≥ 15 minutes'),
style_warn_head),
P('Acute-onset severe hypertension in pregnancy or the postpartum period is a hypertensive emergency. '
'Treatment must be initiated within 30-60 minutes of confirmed severe-range BP. '
'Systolic BP > 155 mmHg is particularly critical — 93% of associated strokes are hemorrhagic.',
style_warn_body),
], RED_LIGHT, RED_DARK)
story.append(warn_box)
story.append(Spacer(1, 5))
story.append(P(b('Immediate Actions:'), style_bold))
immediate_steps = [
('1', 'CONFIRM BP', 'Repeat measurement in the opposite arm within minutes. Two readings in short succession confirm emergency.'),
('2', 'CALL FOR HELP', 'Activate obstetric emergency protocol. Notify MFM, anesthesia, neonatology as appropriate.'),
('3', 'IV ACCESS', 'Establish large-bore IV access. Draw stat labs (CBC, CMP, LFTs, LDH, coagulation, uric acid, UA).'),
('4', 'INITIATE Rx', 'Start first-line antihypertensive within 30-60 min of confirmed severe BP. Goal: reduce to 140-150/90-100 mmHg.'),
('5', 'FETAL STATUS', 'Continuous electronic fetal monitoring (if antenatal). Assess for abruption.'),
('6', 'MAGNESIUM', 'Initiate IV magnesium sulfate for seizure prophylaxis (preeclampsia with severe features).'),
]
imm_data = [
[P(b(s[0]), style_td_bold), P(b(s[1]), style_td_bold), P(s[2], style_td)]
for s in immediate_steps
]
imm_tbl = make_table(imm_data, [0.6*cm, 2.8*cm, avail_w - 3.4*cm - 0.4], header_rows=0)
imm_tbl.setStyle(TableStyle([
('BACKGROUND', (0, 0), (0, -1), BLUE_MID),
('TEXTCOLOR', (0, 0), (0, -1), WHITE),
('FONTNAME', (0, 0), (0, -1), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (0, -1), 10),
('ALIGN', (0, 0), (0, -1), 'CENTER'),
('BACKGROUND', (1, 0), (1, -1), BLUE_DARK),
('TEXTCOLOR', (1, 0), (1, -1), WHITE),
('FONTNAME', (1, 0), (1, -1), 'Helvetica-Bold'),
('FONTSIZE', (1, 0), (1, -1), 8.5),
('ROWBACKGROUND', (2, 0), (2, -1),
[WHITE if i % 2 == 0 else BLUE_LIGHT for i in range(10)]),
('GRID', (0, 0), (-1, -1), 0.4, GRAY_LINE),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('TOPPADDING', (0, 0), (-1, -1), 5),
('BOTTOMPADDING', (0, 0), (-1, -1), 5),
('LEFTPADDING', (0, 0), (-1, -1), 6),
('RIGHTPADDING', (0, 0), (-1, -1), 6),
]))
story.append(imm_tbl)
story.append(Spacer(1, 0.3*cm))
# ================================================================
# SECTION 3: ANTIHYPERTENSIVE AGENTS
# ================================================================
story.append(SectionHeader('3. FIRST-LINE ANTIHYPERTENSIVE AGENTS (ACOG-Endorsed)'))
story.append(Spacer(1, 4))
drug_data = [
[P(b('Drug'), style_thtop), P(b('Route'), style_thtop),
P(b('Initial Dose'), style_thtop), P(b('Repeat / Maintenance'), style_thtop),
P(b('Max Dose'), style_thtop), P(b('Onset / Duration'), style_thtop),
P(b('Key Notes'), style_thtop)],
[P(b('Labetalol'), style_td_bold),
P('IV', style_td_c),
P('10–20 mg IV bolus', style_td),
P('Double dose q10 min (20 → 40 → 80 mg)', style_td),
P('300 mg total', style_td_c),
P('Onset: 1–2 min\nPeak: 10 min\nDuration: 6–16 h', style_td),
P('Mixed α/β blocker. Preserves uteroplacental flow. No neonatal sympathetic blockade. '
'<b>Avoid</b> in asthma, heart failure, heart block.', style_td)],
[P(b('Nifedipine IR'), style_td_bold),
P('Oral', style_td_c),
P('10–20 mg PO', style_td),
P('Repeat in 20–30 min if needed; then 10–20 mg q3–6h', style_td),
P('180 mg/day', style_td_c),
P('Onset: 5–10 min\nPeak: 10–20 min\nDuration: 4–8 h', style_td),
P('Useful before IV access. Monitor carefully with concurrent MgSO₄ (theoretical potentiation). '
'May lower BP faster than IV labetalol.', style_td)],
[P(b('Hydralazine'), style_td_bold),
P('IV / IM', style_td_c),
P('5 mg IV or IM', style_td),
P('5–10 mg q20–40 min\nIV infusion: 0.5–10 mg/hr', style_td),
P('20 mg', style_td_c),
P('Onset: 10–20 min\nPeak: 20–40 min\nDuration: 3–8 h', style_td),
P('Arteriolar vasodilator; increases uterine & renal blood flow. '
'Unpredictable duration. Risk of reflex tachycardia & ventricular arrhythmias. '
'Headache/epigastric pain may mimic worsening preeclampsia.', style_td)],
]
drug_tbl = make_table(drug_data,
[2*cm, 1.2*cm, 2.5*cm, 3*cm, 1.6*cm, 2.5*cm,
avail_w - 2 - 1.2 - 2.5 - 3 - 1.6 - 2.5 - 0.5])
story.append(drug_tbl)
story.append(Spacer(1, 5))
story.append(P(b('Second-line agents (if first-line fails — consult MFM/Anesthesia/Critical Care):'),
style_bold))
second_line = [
('Nicardipine IV', '5 mg/hr initial infusion', 'Max 30 mg/hr',
'Rapid smooth BP reduction. Headache common. Possible uterine relaxation.'),
('Nitroprusside IV', '0.3 µg/kg/min initial', 'Max 10 µg/kg/min',
'Requires arterial line. Fast onset/short duration. Risk of cyanide toxicity >4h use. '
'Cerebral vasodilation. Last resort only.'),
('Labetalol → oral', 'Transition after IV control', '—',
'Suitable for postpartum maintenance. Available as oral tablet.'),
]
sl_data = [[P(b('Agent'), style_thtop), P(b('Starting Dose'), style_thtop),
P(b('Max'), style_thtop), P(b('Notes'), style_thtop)]] + \
[[P(b(r[0]), style_td_bold), P(r[1], style_td), P(r[2], style_td), P(r[3], style_td)]
for r in second_line]
sl_tbl = make_table(sl_data, [3*cm, 3.5*cm, 2*cm, avail_w - 3 - 3.5 - 2 - 0.5],
header_bg=HexColor('#455A64'))
story.append(sl_tbl)
story.append(Spacer(1, 0.3*cm))
# ================================================================
# SECTION 4: MAGNESIUM SULFATE
# ================================================================
story.append(SectionHeader('4. MAGNESIUM SULFATE — SEIZURE PROPHYLAXIS & TREATMENT'))
story.append(Spacer(1, 4))
col_w3 = (avail_w - 8) / 3
mg_indications = [
P(b('INDICATIONS'), style_thtop),
Table([[P('• Preeclampsia with severe features (prophylaxis)', style_bullet)],
[P('• Eclampsia (treatment)', style_bullet)],
[P('• Continue 24–48 h postpartum', style_bullet)],
[P('• Reduces seizure risk by ~50–60%', style_bullet)]],
colWidths=[col_w3 - 4]),
]
mg_dosing = [
P(b('DOSING'), style_thtop),
Table([
[P(b('Loading dose:'), style_td_bold)],
[P('4–6 g IV in 100 mL NS over 20–30 min', style_td)],
[Spacer(1, 4)],
[P(b('Maintenance:'), style_td_bold)],
[P('2 g/hr IV continuous infusion', style_td)],
[Spacer(1, 4)],
[P(b('Recurrent seizure on Mg:'), style_td_bold)],
[P('Additional 2 g IV bolus', style_td)],
[Spacer(1, 4)],
[P(b('Renal impairment:'), style_td_bold)],
[P('Reduce to 2 g IV bolus; check Mg level before increasing', style_td)],
], colWidths=[col_w3 - 4]),
]
mg_toxicity = [
P(b('TOXICITY MONITORING'), style_thtop),
Table([
[P(b('Therapeutic range:'), style_td_bold), P('4–7 mEq/L', style_td)],
[P('Loss of patellar reflex', style_td), P('7–10 mEq/L', style_td)],
[P('Respiratory depression', style_td), P('>10 mEq/L', style_td)],
[P('Cardiac arrest', style_td), P('>15 mEq/L', style_td)],
[P(b('Antidote:'), style_td_bold),
P(b('Calcium gluconate 1 g IV over 3 min'), style_warn_head)],
[P(b('Monitor q1h:'), style_td_bold), P('', style_td)],
[P('• Patellar reflexes', style_bullet), P('', style_td)],
[P('• Respiratory rate (keep >12/min)', style_bullet), P('', style_td)],
[P('• Urine output (keep >25 mL/hr)', style_bullet), P('', style_td)],
[P('• Serum Mg level q6h', style_bullet), P('', style_td)],
], colWidths=[col_w3 * 0.62, col_w3 * 0.38 - 4]),
]
def box_section(content_list, bg, bar):
data = [[item] for item in content_list]
t = Table(data, colWidths=[col_w3 - 4])
t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, -1), bg),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('LEFTPADDING', (0, 0), (-1, -1), 6),
('RIGHTPADDING', (0, 0), (-1, -1), 4),
('LINEAFTER', (0, 0), (-1, -1), 4, bar),
]))
return t
mg_row = Table(
[[box_section(mg_indications, BLUE_LIGHT, BLUE_MID),
box_section(mg_dosing, GREEN_LIGHT, GREEN_DARK),
box_section(mg_toxicity, RED_LIGHT, RED_DARK)]],
colWidths=[col_w3, col_w3, col_w3]
)
mg_row.setStyle(TableStyle([
('VALIGN', (0, 0), (-1, -1), 'TOP'),
('TOPPADDING', (0, 0), (-1, -1), 0),
('BOTTOMPADDING', (0, 0), (-1, -1), 0),
('LEFTPADDING', (0, 0), (-1, -1), 0),
('RIGHTPADDING', (0, 0), (-1, -1), 4),
]))
story.append(mg_row)
story.append(Spacer(1, 0.3*cm))
# ================================================================
# SECTION 5: ECLAMPSIA SEIZURE MANAGEMENT
# ================================================================
story.append(SectionHeader('5. ECLAMPTIC SEIZURE MANAGEMENT'))
story.append(Spacer(1, 4))
seizure_steps = [
('A', 'AIRWAY / POSITION', 'Turn to full left or right lateral decubitus. High-flow O₂ by mask. '
'Suction immediately available (aspiration prevention). Pulse oximetry.'),
('B', 'MAGNESIUM', '4–6 g IV bolus if not already receiving. If already on MgSO₄, give extra 2 g IV bolus. '
'Ensure therapeutic level is maintained.'),
('C', 'SEIZURE > 5 min', 'Propofol or midazolam (small dose) to terminate prolonged seizure. '
'Avoid polypharmacy — preserve ability to perform neurologic exam.'),
('D', 'BP CONTROL', 'Treat concurrent severe hypertension with agents from Section 3. '
'Stroke prevention is the primary goal.'),
('E', 'FETAL MONITORING', 'Monitor FHR if antenatal. FHR abnormalities during seizure usually self-resolve. '
'Do NOT rush to deliver unless abruption/cord prolapse suspected.'),
('F', 'IMAGING', 'CT or MRI brain if: recurrent/focal seizures, seizures despite therapeutic Mg, '
'or declining consciousness (rule out cerebral hemorrhage/venous thrombosis).'),
('G', 'DELIVERY', 'Eclampsia = indication for delivery. NOT necessarily caesarean — assess whether '
'induction or labor progression is feasible. Mode per obstetric assessment.'),
('H', 'POSTPARTUM', '90% of postpartum eclampsia occurs within 7 days of delivery. '
'Maintain Mg for ≥24 h postpartum. Headache in postpartum patient must be evaluated urgently.'),
]
sz_data = [[P(b(s[0]), ParagraphStyle('szl', fontSize=11, textColor=WHITE,
fontName='Helvetica-Bold', alignment=TA_CENTER)),
P(b(s[1]), style_td_bold),
P(s[2], style_td)]
for s in seizure_steps]
sz_tbl = Table(sz_data, colWidths=[0.7*cm, 3*cm, avail_w - 3.7 - 0.5])
sz_tbl.setStyle(TableStyle([
('BACKGROUND', (0, 0), (0, -1), RED_DARK),
('BACKGROUND', (1, 0), (1, -1), HexColor('#2C3E50')),
('TEXTCOLOR', (1, 0), (1, -1), WHITE),
('ROWBACKGROUND', (2, 0), (2, -1),
[WHITE if i % 2 == 0 else RED_LIGHT for i in range(10)]),
('GRID', (0, 0), (-1, -1), 0.4, GRAY_LINE),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('TOPPADDING', (0, 0), (-1, -1), 5),
('BOTTOMPADDING', (0, 0), (-1, -1), 5),
('LEFTPADDING', (0, 0), (-1, -1), 6),
('RIGHTPADDING', (0, 0), (-1, -1), 6),
]))
story.append(sz_tbl)
story.append(Spacer(1, 0.3*cm))
# ================================================================
# PAGE BREAK
# ================================================================
story.append(PageBreak())
# ================================================================
# SECTION 6: HELLP SYNDROME
# ================================================================
story.append(SectionHeader('6. HELLP SYNDROME'))
story.append(Spacer(1, 4))
hellp_left = [
P(b('ACOG Diagnostic Criteria'), style_bold),
Spacer(1, 3),
P(b('H — Hemolysis (≥2 of):'), style_td_bold),
bullet('Schistocytes/burr cells on peripheral smear'),
bullet('Serum bilirubin ≥ 1.2 mg/dL'),
bullet('Low serum haptoglobin'),
bullet('Severe anemia unrelated to blood loss'),
Spacer(1, 5),
P(b('EL — Elevated Liver enzymes:'), style_td_bold),
bullet('AST/ALT ≥ 2x upper limit of normal'),
bullet('LDH > 600 IU/L'),
Spacer(1, 5),
P(b('LP — Low Platelets:'), style_td_bold),
bullet('Platelets < 100,000/µL'),
Spacer(1, 6),
P(b('Mississippi Classification (by platelet nadir):'), style_bold),
bullet('<b>Class I:</b> ≤ 50,000/mm³ (most severe)'),
bullet('<b>Class II:</b> 50,001–100,000/mm³'),
bullet('<b>Class III:</b> 100,001–150,000/mm³'),
]
hellp_right = [
P(b('Management'), style_bold),
Spacer(1, 3),
bullet('IV magnesium sulfate (seizure prophylaxis)'),
bullet('Aggressive BP control (targets as Section 2)'),
bullet('Correct coagulopathy: FFP, platelets, cryoprecipitate PRN'),
bullet('Serial CBC, LFTs, coagulation q6–8h'),
bullet('<b>Definitive treatment = delivery</b>'),
sub_bullet('≥34 weeks: deliver promptly'),
sub_bullet('< 34 weeks: antenatal corticosteroids, stabilize then deliver'),
Spacer(1, 5),
P(b('Complications to anticipate:'), style_bold),
bullet('DIC (5–15%)'),
bullet('Abruptio placentae (9–20%)'),
bullet('Acute renal failure (8%)'),
bullet('Pulmonary edema (10%)'),
bullet('Subcapsular hepatic hematoma (rare but life-threatening)'),
bullet('Maternal death (1–3% in high-resource settings)'),
Spacer(1, 5),
P(b('Transfer criteria:'), style_bold),
bullet('Transfer to tertiary center if local obstetric capabilities insufficient'),
bullet('Stabilize with Mg + antihypertensives before transfer'),
]
hellp_tbl = Table(
[[wrap_in_table(hellp_left, col_w), wrap_in_table(hellp_right, col_w)]],
colWidths=[col_w, col_w]
)
hellp_tbl.setStyle(TableStyle([
('VALIGN', (0, 0), (-1, -1), 'TOP'),
('LEFTPADDING', (0, 0), (-1, -1), 0),
('RIGHTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 0),
('BOTTOMPADDING', (0, 0), (-1, -1), 0),
('LINEAFTER', (0, 0), (0, -1), 0.5, GRAY_LINE),
('LEFTPADDING', (1, 0), (1, -1), 8),
]))
story.append(hellp_tbl)
story.append(Spacer(1, 0.3*cm))
# ================================================================
# SECTION 7: FLUID MANAGEMENT
# ================================================================
story.append(SectionHeader('7. FLUID MANAGEMENT & OLIGURIA'))
story.append(Spacer(1, 4))
fluid_warn = ColoredBox([
P(b('Fluid Restriction is the Rule in Preeclampsia/Eclampsia'), style_warn_head),
P('Preeclamptic patients have endothelial dysfunction with increased vascular permeability. '
'Excess fluid administration shifts to the extravascular space, causing pulmonary edema. '
'Postpartum is highest risk — restrict fluids unless specific hemodynamic indication.',
style_warn_body),
], AMBER_LIGHT, AMBER)
story.append(fluid_warn)
story.append(Spacer(1, 5))
fluid_data = [
[P(b('Parameter'), style_thtop), P(b('Target / Action'), style_thtop),
P(b('Notes'), style_thtop)],
[P('IV fluid rate', style_td_bold), P('≤ 80 mL/hr (total intake)', style_td),
P('Include all IV medications in fluid calculation', style_td)],
[P('Urine output', style_td_bold), P('≥ 25–30 mL/hr', style_td),
P('Oliguria common in preeclampsia — do NOT automatically fluid-load', style_td)],
[P('Oliguria management', style_td_bold), P('First: assess cause (prerenal vs renal)', style_td),
P('Avoid diuretics if prerenal — will further reduce cardiac output & uteroplacental perfusion', style_td)],
[P('Pulmonary edema', style_td_bold), P('Furosemide 20–40 mg IV', style_td),
P('Postpartum fluid mobilization (day 3–5) is highest risk period for pulmonary edema', style_td)],
[P('Invasive monitoring', style_td_bold), P('Arterial line if BP consistently ≥ 160/110', style_td),
P('CVP/PA catheter reserved for refractory pulmonary edema or cardiac failure', style_td)],
]
fluid_tbl = make_table(fluid_data, [3*cm, 4*cm, avail_w - 7 - 0.5])
story.append(fluid_tbl)
story.append(Spacer(1, 0.3*cm))
# ================================================================
# SECTION 8: MONITORING PARAMETERS
# ================================================================
story.append(SectionHeader('8. MONITORING PARAMETERS'))
story.append(Spacer(1, 4))
mon_data = [
[P(b('Parameter'), style_thtop), P(b('Frequency'), style_thtop),
P(b('Action Threshold'), style_thtop)],
[P('Blood pressure', style_td_bold), P('Every 15–30 min (acute phase)\nEvery 4–6 h (stable)', style_td),
P('≥ 160/110: treat immediately. ≥ 140/90: reassess medications.', style_td)],
[P('Urine output', style_td_bold), P('Continuous catheter', style_td),
P('< 25 mL/hr: assess for prerenal cause. < 100 mL/4h: notify team.', style_td)],
[P('Patellar reflexes', style_td_bold), P('Every 1 h (on MgSO₄)', style_td),
P('Absent reflexes: stop Mg infusion, check serum level, give calcium gluconate.', style_td)],
[P('Respiratory rate', style_td_bold), P('Every 1 h (on MgSO₄)', style_td),
P('< 12/min: reduce or hold Mg infusion.', style_td)],
[P('Platelet count', style_td_bold), P('Every 6–12 h (if HELLP)', style_td),
P('< 50,000: hold neuraxial procedures, transfuse if < 10,000 or active bleeding.', style_td)],
[P('LFTs / LDH', style_td_bold), P('Every 6–12 h (HELLP)', style_td),
P('Rising LDH: worsening hemolysis. RUQ pain + rising AST: risk of hepatic hematoma.', style_td)],
[P('Serum creatinine', style_td_bold), P('Every 12–24 h', style_td),
P('> 1.1 mg/dL or doubling from baseline: severe feature, consider delivery.', style_td)],
[P('Serum Mg level', style_td_bold), P('Every 4–6 h (if renal impairment)', style_td),
P('Therapeutic: 4–7 mEq/L. > 9: anticipate toxicity.', style_td)],
[P('O₂ saturation', style_td_bold), P('Continuous (if MgSO₄, ICU)', style_td),
P('< 95%: apply O₂, assess for pulmonary edema, PE.', style_td)],
[P('Fetal monitoring', style_td_bold), P('Continuous EFM (antepartum)', style_td),
P('Decelerations during seizure: usually transient. Sustained: assess for abruption.', style_td)],
]
mon_tbl = make_table(mon_data, [3.5*cm, 3.5*cm, avail_w - 7 - 0.5])
story.append(mon_tbl)
story.append(Spacer(1, 0.3*cm))
# ================================================================
# SECTION 9: POSTPARTUM CONSIDERATIONS
# ================================================================
story.append(SectionHeader('9. POSTPARTUM CONSIDERATIONS'))
story.append(Spacer(1, 4))
pp_left = [
P(b('BP Management After Delivery'), style_bold),
Spacer(1, 3),
bullet('BP may worsen in first 3–5 days postpartum (fluid mobilization)'),
bullet('Continue MgSO₄ for at least 24–48 h postpartum in preeclampsia with severe features'),
bullet('Maintain antihypertensives until BP consistently < 150/100'),
bullet('Oral labetalol or nifedipine ER for outpatient maintenance'),
bullet('Remote/home BP monitoring recommended for ≥72 h post-discharge'),
Spacer(1, 5),
P(b('Breastfeeding-Compatible Agents:'), style_bold),
bullet('Labetalol — compatible (preferred)'),
bullet('Nifedipine — compatible'),
bullet('Methyldopa — compatible (but sedation risk)'),
bullet('Enalapril — compatible in small amounts'),
bullet('<b>Avoid:</b> ARBs, atenolol (accumulates in breast milk)'),
Spacer(1, 5),
P(b('Discharge Criteria:'), style_bold),
bullet('BP ≤ 150/100 on oral medications x 24–48 h'),
bullet('No symptoms of severe preeclampsia'),
bullet('Follow-up arranged within 72 h of discharge'),
]
pp_right = [
P(b('Postpartum Eclampsia'), style_bold),
Spacer(1, 3),
ColoredBox([
P(red('Risk window: UP TO 4 WEEKS POSTPARTUM'), style_warn_head),
P('Most cases occur within 7 days. '
'Headache + visual changes in postpartum patient = URGENT evaluation. '
'Distinguish from post-dural puncture headache in patients who had neuraxial anesthesia.',
style_warn_body),
], RED_LIGHT, RED_DARK),
Spacer(1, 5),
P(b('Long-Term Cardiovascular Risk'), style_bold),
Spacer(1, 3),
bullet('4x increased risk of subsequent hypertension'),
bullet('3x increased risk of cardiovascular disease'),
bullet('Increased risk of ischemic heart disease (evident up to 20 years later)'),
bullet('Increased risk of metabolic syndrome, insulin resistance'),
bullet('Risk amplified in women with early-onset preeclampsia (< 34 weeks)'),
Spacer(1, 5),
P(b('All women with preeclampsia require long-range cardiovascular follow-up'), style_bold),
bullet('Annual BP check'),
bullet('Lifestyle counseling (weight, exercise, diet)'),
bullet('Low-dose aspirin in subsequent pregnancies (history of preeclampsia)'),
]
pp_tbl = Table(
[[wrap_in_table(pp_left, col_w), wrap_in_table(pp_right, col_w)]],
colWidths=[col_w, col_w]
)
pp_tbl.setStyle(TableStyle([
('VALIGN', (0, 0), (-1, -1), 'TOP'),
('LEFTPADDING', (0, 0), (-1, -1), 0),
('RIGHTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 0),
('BOTTOMPADDING', (0, 0), (-1, -1), 0),
('LINEAFTER', (0, 0), (0, -1), 0.5, GRAY_LINE),
('LEFTPADDING', (1, 0), (1, -1), 8),
]))
story.append(pp_tbl)
story.append(Spacer(1, 0.3*cm))
# ================================================================
# SECTION 10: DIFFERENTIAL DIAGNOSIS
# ================================================================
story.append(SectionHeader('10. DIFFERENTIAL DIAGNOSIS & MIMICS', HexColor('#4A148C')))
story.append(Spacer(1, 4))
dd_data = [
[P(b('Condition'), style_thtop), P(b('Distinguishing Features'), style_thtop),
P(b('Action'), style_thtop)],
[P('Epilepsy / Prior seizure disorder', style_td_bold),
P('History of epilepsy; seizure type consistent with prior episodes; no hypertension', style_td),
P('Check AED levels; neurology consult', style_td)],
[P('Cerebral venous thrombosis', style_td_bold),
P('Postpartum; focal deficits; persistent headache; MRI/MRV diagnostic', style_td),
P('MRI brain/MRV; anticoagulation', style_td)],
[P('Thrombotic thrombocytopenic purpura (TTP)', style_td_bold),
P('Fever, microangiopathic hemolysis, thrombocytopenia, renal impairment, neurologic sx\n'
'Distinguished from HELLP by CNS involvement + fever + no hypertension required', style_td),
P('ADAMTS13 level; plasma exchange', style_td)],
[P('Acute fatty liver of pregnancy', style_td_bold),
P('Encephalopathy, jaundice, hypoglycemia, elevated ammonia; coagulopathy; LFTs elevated\n'
'Usually 3rd trimester', style_td),
P('Glucose monitoring; urgent delivery; ICU support', style_td)],
[P('Pheochromocytoma', style_td_bold),
P('Episodic hypertension, sweating, palpitations; catecholamine excess; no proteinuria', style_td),
P('24h urine catecholamines; MRI adrenals', style_td)],
[P('Intracranial hemorrhage', style_td_bold),
P('Severe headache "thunderclap"; focal deficits; papilledema; CT diagnostic', style_td),
P('Urgent CT head; neurosurgery', style_td)],
]
dd_tbl = make_table(dd_data, [3.5*cm, 6.5*cm, avail_w - 10 - 0.5],
header_bg=HexColor('#4A148C'))
story.append(dd_tbl)
story.append(Spacer(1, 0.3*cm))
# ================================================================
# SECTION 11: RISK FACTORS
# ================================================================
story.append(SectionHeader('11. RISK FACTORS FOR PREECLAMPSIA'))
story.append(Spacer(1, 4))
rf_col1 = [
P(b('High Risk (any one warrants aspirin prophylaxis):'), style_bold),
bullet('Prior history of preeclampsia (8x increased risk)'),
bullet('Multifetal gestation'),
bullet('Chronic hypertension'),
bullet('Type 1 or Type 2 diabetes'),
bullet('Renal disease (CKD, transplant, AKI history)'),
bullet('Autoimmune conditions (SLE, antiphospholipid antibody syndrome)'),
]
rf_col2 = [
P(b('Moderate Risk (≥2 factors warrants aspirin):'), style_bold),
bullet('Nulliparity (greatest attributable risk — 32.2%)'),
bullet('BMI > 30'),
bullet('Age > 35 years'),
bullet('Family history in first-degree relative'),
bullet('Non-white race (associated with severity, not incidence)'),
bullet('Assisted reproductive technology'),
bullet('Obstructive sleep apnea'),
bullet('Prior adverse pregnancy outcome / SGA infant'),
bullet('Interval between pregnancies > 10 years'),
]
rf_col3 = [
P(b('Prevention Strategy:'), style_bold),
bullet('Low-dose aspirin 81 mg/day from 12–28 weeks (ideally by 16 weeks) in high-risk women'),
Spacer(1, 6),
P(b('Epidemiology:'), style_bold),
bullet('Gestational HTN: 6–17% nulliparous, 2–4% parous'),
bullet('Preeclampsia: 5–8% of all pregnancies'),
bullet('Eclampsia: 1 in 2000–3000 deliveries (high-resource settings)'),
bullet('Preeclampsia is more prevalent than eclampsia by ~200:1'),
]
def col_box(items, w):
data = [[item] for item in items]
t = Table(data, colWidths=[w])
t.setStyle(TableStyle([
('TOPPADDING', (0, 0), (-1, -1), 0),
('BOTTOMPADDING', (0, 0), (-1, -1), 0),
('LEFTPADDING', (0, 0), (-1, -1), 0),
('RIGHTPADDING', (0, 0), (-1, -1), 0),
]))
return t
w3 = (avail_w - 16) / 3
rf_tbl = Table(
[[col_box(rf_col1, w3), col_box(rf_col2, w3), col_box(rf_col3, w3)]],
colWidths=[w3, w3, w3]
)
rf_tbl.setStyle(TableStyle([
('VALIGN', (0, 0), (-1, -1), 'TOP'),
('LEFTPADDING', (0, 0), (-1, -1), 0),
('RIGHTPADDING', (0, 0), (-1, -1), 6),
('TOPPADDING', (0, 0), (-1, -1), 0),
('BOTTOMPADDING', (0, 0), (-1, -1), 0),
('LINEAFTER', (0, 0), (1, -1), 0.5, GRAY_LINE),
('LEFTPADDING', (1, 0), (2, -1), 8),
]))
story.append(rf_tbl)
story.append(Spacer(1, 0.3*cm))
# ================================================================
# SECTION 12: QUICK REFERENCE FLOWCHART (text-based)
# ================================================================
story.append(SectionHeader('12. ACUTE MANAGEMENT ALGORITHM — QUICK REFERENCE'))
story.append(Spacer(1, 4))
algo_data = [
[P(b('STEP'), style_thtop), P(b('CONDITION'), style_thtop),
P(b('ACTION'), style_thtop), P(b('TARGET'), style_thtop)],
[P('1', style_td_bold),
P('BP ≥ 140/90\n(confirmed)', style_td),
P('IV access + labs (CBC, LFTs, creatinine, LDH, UA, coagulation)\n'
'Fetal monitoring\nDocument: onset, symptoms, prior BPs', style_td),
P('Establish diagnosis\nBaseline labs', style_td)],
[P('2', style_td_bold),
P('BP ≥ 160/110\n≥ 15 min\n(Emergency)', style_td),
P(b('TREAT IMMEDIATELY') + '\nLabetalol 20 mg IV OR Nifedipine 10–20 mg PO OR Hydralazine 5 mg IV\n'
'Repeat per protocol if no response in 20–30 min\nConsult MFM/Ob', style_td),
P('BP 140–150 /\n90–100 mmHg\nWithin 30–60 min', style_td)],
[P('3', style_td_bold),
P('Preeclampsia\nwith Severe\nFeatures', style_td),
P('IV MgSO₄ 4–6 g loading dose then 2 g/hr\n'
'Assess gestational age — plan delivery timing\n'
'Corticosteroids if < 34 weeks', style_td),
P('Seizure prophylaxis\nFetal lung maturity', style_td)],
[P('4', style_td_bold),
P('Eclampsia\n(Seizure)', style_td),
P('Lateral positioning + O₂\nMgSO₄ bolus (4–6 g if not on, or 2 g extra if on Mg)\n'
'Propofol/midazolam if seizure > 5 min\nUrgent delivery planning', style_td),
P('Terminate seizure\nPrevent recurrence\nPrevent aspiration', style_td)],
[P('5', style_td_bold),
P('HELLP\nSyndrome', style_td),
P('Mg + aggressive BP control\nCorrect coagulopathy (FFP/platelets/cryo PRN)\n'
'Serial labs q6–8h\nDeliver if ≥ 34 weeks', style_td),
P('Stabilize mother\nTiming of delivery', style_td)],
[P('6', style_td_bold),
P('Postpartum\n(0–4 weeks)', style_td),
P('Continue MgSO₄ ≥ 24 h\nContinue antihypertensives\nRestrict IV fluids\n'
'Monitor BP daily; remote BP monitoring post-discharge\n'
'Follow-up within 72 h', style_td),
P('BP < 150/100\nNo seizures\nNo pulmonary edema', style_td)],
]
algo_tbl = make_table(algo_data,
[0.8*cm, 3*cm, avail_w - 0.8 - 3 - 3 - 0.5, 3*cm],
header_bg=RED_DARK)
story.append(algo_tbl)
story.append(Spacer(1, 5))
# Disclaimer
disclaimer = ColoredBox([
P(b('CLINICAL DISCLAIMER'), S('dh', fontSize=8.5, textColor=GRAY_MED, fontName='Helvetica-Bold')),
P('This reference document is intended for trained healthcare professionals. All drug doses and '
'management decisions must be verified against current institutional protocols, formulary, '
'and individual patient circumstances. This document does not constitute medical advice and '
'is not a substitute for clinical judgment. Sources: Creasy & Resnik\'s Maternal-Fetal '
'Medicine 8th Ed; Goldman-Cecil Medicine; Tintinalli\'s Emergency Medicine; '
'Swanson\'s Family Medicine Review. Compiled July 2026.',
S('db', fontSize=7.5, textColor=GRAY_MED, fontName='Helvetica')),
], GRAY_LIGHT, GRAY_MED)
story.append(disclaimer)
return story
# ---------- Build PDF ----------
def main():
doc = SimpleDocTemplate(
OUTPUT_PATH,
pagesize=A4,
topMargin=1.4 * cm,
bottomMargin=1.1 * cm,
leftMargin=MARGIN,
rightMargin=MARGIN,
title='Acute Hypertensive Emergencies in Pregnancy — Clinical Reference',
author='Orris Clinical Reference',
subject='Obstetric Emergency Protocol',
)
story = build_story()
doc.build(story, onFirstPage=make_page_template, onLaterPages=make_page_template)
print(f'PDF generated: {OUTPUT_PATH}')
import os
size_kb = os.path.getsize(OUTPUT_PATH) // 1024
print(f'File size: {size_kb} KB')
if __name__ == '__main__':
main()
cd /home/daytona/workspace/hypertension-pregnancy-pdf && python3 generate_pdf.py…
python3 -c " from pypdf import PdfReader r = PdfReader('/home/daytona/workspace/…
Hypertensive Emergencies Pregnancy
PDF Document · PDF
| Section | Contents |
|---|---|
| 1. Definitions & Classification | Gestational HTN, preeclampsia (with/without severe features), eclampsia, chronic HTN — including ACOG diagnostic criteria for each |
| 2. Hypertensive Emergency Threshold | The 160/110 mmHg threshold, 6-step immediate response protocol |
| 3. First-line Antihypertensive Agents | Full drug table: Labetalol, Nifedipine IR, Hydralazine — doses, onset, max, key notes. Second-line agents (nicardipine, nitroprusside) |
| 4. Magnesium Sulfate | Indications, loading/maintenance dosing, renal dose adjustment, toxicity levels with antidote (calcium gluconate) |
| 5. Eclamptic Seizure Management | A–H step protocol — airway, positioning, Mg bolus, prolonged seizure management, fetal monitoring, delivery decisions |
| 6. HELLP Syndrome | ACOG & Mississippi classification criteria, management, complications, transfer criteria |
| 7. Fluid Management | Fluid restriction principles, oliguria management, pulmonary edema prevention |
| 8. Monitoring Parameters | 11 parameters with frequency and action thresholds |
| 9. Postpartum Considerations | Postpartum BP management, breastfeeding-compatible agents, discharge criteria, 4-week eclampsia risk window, long-term CV risk |
| 10. Differential Diagnosis | Six mimics (TTP, AFLP, CVT, pheo, ICH, epilepsy) with distinguishing features |
| 11. Risk Factors | High/moderate risk stratification, aspirin prophylaxis indications, epidemiology |
| 12. Quick Reference Algorithm | 6-step management flowchart from initial BP detection through postpartum discharge |