~/rrt-exam/generate_rrt_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.lib.colors import HexColor, black, white, Color
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.platypus import KeepTogether
OUTPUT = "/home/daytona/workspace/rrt-exam/Renal_Replacement_Therapy_MD_Anaesthesia.pdf"
# Colors
DARK_BLUE = HexColor('#1a3c5e')
MED_BLUE = HexColor('#2d6a9f')
LIGHT_BLUE = HexColor('#ddeeff')
ACCENT = HexColor('#e8a020')
LIGHT_GREY = HexColor('#f5f5f5')
TABLE_HEADER = HexColor('#2d6a9f')
TABLE_ALT = HexColor('#eaf4fb')
BORDER_COLOR = HexColor('#b0c8e0')
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
leftMargin=2*cm, rightMargin=2*cm,
topMargin=2.5*cm, bottomMargin=2.5*cm,
title="Renal Replacement Therapy - MD Anaesthesia 30 Marks",
author="MD Anaesthesia Exam Preparation"
)
styles = getSampleStyleSheet()
# Custom styles
title_style = ParagraphStyle(
'CustomTitle',
parent=styles['Title'],
fontSize=20,
fontName='Helvetica-Bold',
textColor=white,
alignment=TA_CENTER,
spaceAfter=4,
)
subtitle_style = ParagraphStyle(
'Subtitle',
parent=styles['Normal'],
fontSize=11,
fontName='Helvetica',
textColor=HexColor('#ddeeff'),
alignment=TA_CENTER,
spaceAfter=2,
)
h1_style = ParagraphStyle(
'H1',
parent=styles['Heading1'],
fontSize=13,
fontName='Helvetica-Bold',
textColor=white,
backColor=DARK_BLUE,
borderPad=6,
spaceAfter=6,
spaceBefore=14,
leftIndent=-10,
rightIndent=-10,
leading=18,
)
h2_style = ParagraphStyle(
'H2',
parent=styles['Heading2'],
fontSize=11,
fontName='Helvetica-Bold',
textColor=DARK_BLUE,
spaceAfter=4,
spaceBefore=10,
borderPad=2,
)
h3_style = ParagraphStyle(
'H3',
parent=styles['Heading3'],
fontSize=10,
fontName='Helvetica-Bold',
textColor=MED_BLUE,
spaceAfter=3,
spaceBefore=7,
)
body_style = ParagraphStyle(
'Body',
parent=styles['Normal'],
fontSize=9.5,
fontName='Helvetica',
textColor=HexColor('#222222'),
spaceAfter=5,
leading=14,
alignment=TA_JUSTIFY,
)
bullet_style = ParagraphStyle(
'Bullet',
parent=body_style,
leftIndent=16,
bulletIndent=6,
spaceAfter=3,
leading=13,
)
sub_bullet_style = ParagraphStyle(
'SubBullet',
parent=body_style,
leftIndent=32,
bulletIndent=22,
spaceAfter=2,
leading=12,
fontSize=9,
)
key_point_style = ParagraphStyle(
'KeyPoint',
parent=body_style,
backColor=LIGHT_BLUE,
borderColor=MED_BLUE,
borderWidth=1,
borderPad=6,
spaceAfter=8,
spaceBefore=4,
leftIndent=8,
rightIndent=8,
fontName='Helvetica-Bold',
fontSize=9.5,
)
note_style = ParagraphStyle(
'Note',
parent=body_style,
backColor=HexColor('#fff8e8'),
borderColor=ACCENT,
borderWidth=1,
borderPad=5,
spaceAfter=6,
spaceBefore=3,
leftIndent=6,
rightIndent=6,
fontSize=9,
fontName='Helvetica-Oblique',
)
def H1(text):
return Paragraph(f" {text}", h1_style)
def H2(text):
return Paragraph(text, h2_style)
def H3(text):
return Paragraph(text, h3_style)
def B(text):
return Paragraph(text, body_style)
def BU(text):
return Paragraph(f"• {text}", bullet_style)
def BSU(text):
return Paragraph(f"◦ {text}", sub_bullet_style)
def KP(text):
return Paragraph(f"⭐ {text}", key_point_style)
def NOTE(text):
return Paragraph(f"📝 {text}", note_style)
def HR():
return HRFlowable(width="100%", thickness=0.5, color=BORDER_COLOR, spaceAfter=6, spaceBefore=2)
def SP(h=6):
return Spacer(1, h)
def make_table(headers, rows, col_widths=None):
data = [headers] + rows
if col_widths is None:
avail = 17*cm
col_widths = [avail/len(headers)] * len(headers)
table = Table(data, colWidths=col_widths, repeatRows=1)
style_cmds = [
('BACKGROUND', (0,0), (-1,0), TABLE_HEADER),
('TEXTCOLOR', (0,0), (-1,0), white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,0), 9),
('ALIGN', (0,0), (-1,0), 'CENTER'),
('VALIGN', (0,0), (-1,-1), 'TOP'),
('FONTNAME', (0,1), (-1,-1), 'Helvetica'),
('FONTSIZE', (0,1), (-1,-1), 8.5),
('ROWBACKGROUNDS', (0,1), (-1,-1), [white, TABLE_ALT]),
('GRID', (0,0), (-1,-1), 0.4, BORDER_COLOR),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 5),
('RIGHTPADDING', (0,0), (-1,-1), 5),
]
table.setStyle(TableStyle(style_cmds))
return table
# ─── Title Banner ───────────────────────────────────────────────────────────────
def make_title_banner():
banner_data = [[
Paragraph("<b><font size=18 color='white'>RENAL REPLACEMENT THERAPY</font></b>", ParagraphStyle('T', alignment=TA_CENTER)),
]]
banner = Table(banner_data, colWidths=[17*cm])
banner.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), DARK_BLUE),
('ALIGN', (0,0), (-1,-1), 'CENTER'),
('TOPPADDING', (0,0), (-1,-1), 14),
('BOTTOMPADDING', (0,0), (-1,-1), 6),
('LEFTPADDING', (0,0), (-1,-1), 10),
('RIGHTPADDING', (0,0), (-1,-1), 10),
]))
sub_data = [[
Paragraph("<font size=10 color='#2d6a9f'>MD Anaesthesia | 30 Marks Question | Long Answer</font>", ParagraphStyle('S', alignment=TA_CENTER)),
]]
sub_banner = Table(sub_data, colWidths=[17*cm])
sub_banner.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), LIGHT_BLUE),
('ALIGN', (0,0), (-1,-1), 'CENTER'),
('TOPPADDING', (0,0), (-1,-1), 6),
('BOTTOMPADDING', (0,0), (-1,-1), 6),
]))
return [banner, sub_banner, SP(10)]
# ─── BUILD ───────────────────────────────────────────────────────────────────────
story = []
story += make_title_banner()
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 1: INTRODUCTION & DEFINITION
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("1. INTRODUCTION AND DEFINITION"))
story.append(B("Renal Replacement Therapy (RRT) - also termed Renal Support Therapy (RST) or Kidney Replacement Therapy (KRT) - refers to extracorporeal techniques that temporarily replace some of the normal renal functions, primarily salt, water, and solute clearance. The terminology 'support' is more accurate because these modalities do not replace endocrine functions (erythropoietin, vitamin D activation, renin-angiotensin regulation) of the kidney."))
story.append(B("In the anaesthesia and critical care context, RRT is predominantly indicated for patients with <b>Acute Kidney Injury (AKI)</b> in the ICU or perioperative setting. AKI is defined by the KDIGO criteria as:"))
story.append(BU("Increase in serum creatinine (sCr) ≥0.3 mg/dL within 48 hours, OR"))
story.append(BU("Increase in sCr ≥1.5× baseline within 7 days, OR"))
story.append(BU("Urine output <0.5 mL/kg/h for ≥6 hours"))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 2: INDICATIONS
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("2. INDICATIONS FOR RRT (Mnemonic: AEIOU)"))
ind_data = [
[Paragraph("<b>Letter</b>", body_style), Paragraph("<b>Indication</b>", body_style), Paragraph("<b>Details</b>", body_style)],
[Paragraph("A", body_style), Paragraph("Acidosis", body_style), Paragraph("Severe metabolic acidosis (pH <7.1) unresponsive to bicarbonate; life-threatening", body_style)],
[Paragraph("E", body_style), Paragraph("Electrolytes", body_style), Paragraph("Hyperkalemia (K⁺ >6.5 mEq/L) refractory to medical management; risk of fatal arrhythmias", body_style)],
[Paragraph("I", body_style), Paragraph("Ingestion / Intoxication", body_style), Paragraph("Certain dialyzable toxins: methanol, ethylene glycol, lithium, salicylates, theophylline", body_style)],
[Paragraph("O", body_style), Paragraph("Overload (Fluid)", body_style), Paragraph("Volume overload causing pulmonary oedema, hypertension unresponsive to diuretics", body_style)],
[Paragraph("U", body_style), Paragraph("Uraemia", body_style), Paragraph("Uraemic encephalopathy, pericarditis, bleeding; BUN >100 mg/dL (relative); BUN >140 mg/dL (mandatory - associated with increased mortality if delayed)", body_style)],
]
story.append(make_table([], ind_data[0:1] + ind_data[1:], col_widths=[1.2*cm, 3.5*cm, 12.3*cm]))
story.append(SP(4))
story.append(B("<b>Additional indications:</b>"))
story.append(BU("Severe hypertension refractory to antihypertensive therapy"))
story.append(BU("Nonobstructive anuria"))
story.append(BU("Inborn errors of metabolism (e.g., hyperammonaemia)"))
story.append(BU("Uraemic complications - encephalopathy, pericarditis, coagulopathy"))
story.append(BU("Impending acute respiratory failure from fluid overload"))
story.append(NOTE("KDIGO guidelines recommend NOT to delay RRT until a mandatory crisis indication. Delaying until BUN >140 mg/dL is associated with HR 1.60 increased mortality (AKIKI-2 trial)."))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 3: PRINCIPLES OF SOLUTE CLEARANCE
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("3. PRINCIPLES OF SOLUTE AND FLUID REMOVAL"))
story.append(B("All RRT modalities operate through two fundamental mechanisms:"))
story.append(H2("3.1 Diffusion (Dialysis)"))
story.append(BU("Solute moves across a semipermeable membrane down a concentration gradient"))
story.append(BU("Best for small molecules (<1 kDa): urea, creatinine, potassium, electrolytes"))
story.append(BU("Efficiency increases with: higher blood flow rate, higher dialysate flow rate, longer session time"))
story.append(BU("Blood and dialysate flow in opposite directions (countercurrent) to maximise gradient"))
story.append(H2("3.2 Convection (Filtration / Ultrafiltration)"))
story.append(BU("Solute is 'dragged' across membrane with solvent (plasma water) under hydrostatic pressure gradient — 'solvent drag'"))
story.append(BU("Effective for molecules up to 50 kDa — clears middle molecules and cytokines better than diffusion"))
story.append(BU("Replacement fluid is administered to replace cleared volume"))
story.append(BU("Efficiency increases with: higher ultrafiltration/effluent flow rate"))
story.append(H2("3.3 Combination (Haemodiafiltration)"))
story.append(BU("Uses both diffusion (dialysate) and convection (ultrafiltration)"))
story.append(BU("Best overall clearance of both small and middle molecules"))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 4: MODALITIES
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("4. MODALITIES OF RRT IN THE ICU"))
story.append(B("Four principal modalities are available in critical care:"))
story.append(SP(4))
modality_rows = [
[Paragraph("<b>Feature</b>", body_style),
Paragraph("<b>Peritoneal Dialysis (PD)</b>", body_style),
Paragraph("<b>Intermittent HD (IHD)</b>", body_style),
Paragraph("<b>SLED / PIRRT</b>", body_style),
Paragraph("<b>CRRT</b>", body_style)],
[B("Duration"), B("Continuous cycles"), B("3-6 hrs/session"), B("8-18 hrs/session"), B("24 hrs/day")],
[B("Frequency"), B("Continuous"), B("3-6 days/week"), B("3-6 days/week"), B("Continuous")],
[B("Blood flow"), B("None (peritoneum)"), B("200-400 mL/min"), B("Low-moderate"), B("100-200 mL/min")],
[B("Mechanism"), B("Diffusion + osmosis"), B("Diffusion"), B("Diffusion ± convection"), B("Diffusion + convection")],
[B("Haemodynamic tolerance"), B("Good"), B("Poor"), B("Moderate-Good"), B("Best")],
[B("Solute clearance"), B("Slow"), B("Rapid (small mol)"), B("Moderate"), B("Slow but continuous")],
[B("Anticoagulation"), B("Not needed"), B("Optional"), B("Often not needed"), B("Required")],
[B("Nursing requirements"), B("Moderate"), B("Moderate"), B("Moderate"), B("High (ICU)"), ],
[B("Cost"), B("Low"), B("Moderate"), B("Moderate"), B("High")],
[B("Preferred in"), B("LMIC, infants, no CVL"), B("Haemodynamically stable"), B("Transition, step-down"), B("Haemodynamically unstable")],
]
story.append(make_table([], modality_rows, col_widths=[2.8*cm, 3.1*cm, 3.1*cm, 3.1*cm, 3.3*cm]))
story.append(SP(8))
# Peritoneal Dialysis
story.append(H2("4.1 Peritoneal Dialysis (PD)"))
story.append(BU("Peritoneal membrane acts as semipermeable dialysis surface"))
story.append(BU("Dialysate composition: Na⁺ ~130 mEq/L, Cl⁻ ~100 mEq/L, buffer (lactate/acetate) ~35 mEq/L, Ca²⁺ 3.5 mEq/L, Mg²⁺ 1.5 mEq/L"))
story.append(BU("Hypertonic (glucose) dialysate used for greater fluid removal via osmosis"))
story.append(BU("<b>Advantages:</b> No CVL required, low cost, haemodynamically stable, technically straightforward, good for infants"))
story.append(BU("<b>Disadvantages:</b> Cannot use after recent abdominal surgery, slow clearance, risk of peritonitis (bacterial/fungal), respiratory compromise from abdominal distension, inadequate in hypermetabolic states"))
story.append(SP())
# IHD
story.append(H2("4.2 Intermittent Haemodialysis (IHD)"))
story.append(BU("Blood and dialysate flow in countercurrent through an extracorporeal semipermeable membrane"))
story.append(BU("Session duration: 3-6 hours, 3-6 days per week"))
story.append(BU("Blood flow: 200-400 mL/min; dialysate flow: 500-800 mL/min"))
story.append(BU("Kt/V urea target ≥1.2 per session (adequacy measure)"))
story.append(BU("<b>Key modifications for AKI:</b>"))
story.append(BSU("Sessions extended to 5 hours due to high catabolism in critically ill"))
story.append(BSU("Hypertonic dialysate sodium (145 mmol/L) for haemodynamic stability"))
story.append(BSU("Avoid dialysate K⁺ <2 mmol/L (risk of hypokalaemia-mediated arrhythmias)"))
story.append(BSU("Lower initial blood flow rates to reduce risk of dialysis disequilibrium syndrome"))
story.append(BSU("Heparin often omitted due to bleeding risk"))
story.append(BU("<b>Complication: Intradialytic hypotension</b> — managed by lowering dialysate temperature, reducing UF rate, hypertonic saline dialysate, escalating vasopressors"))
story.append(BU("If intradialytic hypotension persistent → convert to CRRT or SLED"))
story.append(SP())
# SLED
story.append(H2("4.3 Sustained Low-Efficiency Dialysis (SLED) / PIRRT"))
story.append(BU("Hybrid modality: uses conventional HD machines with extended session (8-18 hours)"))
story.append(BU("Lower blood and dialysate flow rates than IHD → slower solute shifts → better haemodynamic tolerance"))
story.append(BU("Advantages: no specialised machine required, can be done overnight, often no anticoagulation needed, lower cost than CRRT"))
story.append(BU("Achieved acceptable solute control and ultrafiltration goals in studies"))
story.append(BU("When prescribed daily, clearance approaches that of CRRT"))
story.append(SP())
# CRRT
story.append(H2("4.4 Continuous Renal Replacement Therapy (CRRT)"))
story.append(B("CRRT operates 24 hours per day. Preferred in haemodynamically unstable patients requiring vasopressor support."))
story.append(H3("CRRT Modalities (Venovenous — most common):"))
crrt_rows = [
[Paragraph("<b>Modality</b>", body_style), Paragraph("<b>Abbrev.</b>", body_style), Paragraph("<b>Mechanism</b>", body_style), Paragraph("<b>Notes</b>", body_style)],
[B("Continuous Venovenous Haemodialysis"), B("CVVHD"), B("Diffusion only"), B("Dialysate used; best small solute clearance")],
[B("Continuous Venovenous Haemofiltration"), B("CVVH"), B("Convection only"), B("Replacement fluid used; clears middle molecules; isotonic fluid removal")],
[B("Continuous Venovenous Haemodiafiltration"), B("CVVHDF"), B("Diffusion + Convection"), B("Combines both; best overall clearance")],
]
story.append(make_table([], crrt_rows, col_widths=[5.5*cm, 2.2*cm, 3.8*cm, 5.5*cm]))
story.append(SP(4))
story.append(B("<b>Older modalities (arteriovenous — rarely used now due to arterial cannulation bleeding risk):</b> CAVHD, CAVH — replaced by venovenous approaches."))
story.append(SP(4))
story.append(H3("CRRT Prescription Parameters:"))
story.append(BU("<b>Blood flow rate:</b> 100-200 mL/min"))
story.append(BU("<b>Effluent/Ultrafiltration flow rate:</b> Determines clearance dose (see dosing section)"))
story.append(BU("<b>Replacement fluid position:</b> Pre-filter (dilutes blood, reduces haemoconcentration, prolongs filter life) vs. post-filter (more efficient clearance)"))
story.append(BU("<b>Fluid balance:</b> Managed hourly; prescribed net fluid removal accounts for all inputs (drugs, nutrition, blood products)"))
story.append(KP("CRRT is inherently inefficient per unit time but achieves adequate clearance when run continuously. Frequent circuit clotting or procedural interruptions reduce delivered dose — aim for >85% delivery efficiency."))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 5: ANTICOAGULATION
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("5. ANTICOAGULATION IN RRT"))
story.append(B("Anticoagulation is needed to prevent clotting of the extracorporeal circuit, especially for continuous modalities. Choice depends on patient's bleeding risk, thrombotic risk, and chosen modality."))
story.append(SP(4))
anticoag_rows = [
[Paragraph("<b>Agent</b>", body_style), Paragraph("<b>Mechanism</b>", body_style), Paragraph("<b>Monitoring</b>", body_style), Paragraph("<b>Pros / Cons</b>", body_style)],
[B("Regional Citrate (RCA)\n[Preferred]"), B("Chelates Ca²⁺ pre-filter → extracorporeal hypocalcaemia (0.25-0.45 mmol/L) → inhibits coagulation cascade"), B("Post-filter ionised Ca²⁺ (target 0.25-0.45), systemic iCa²⁺ (maintain normal), anion gap"), B("PRO: Lower bleeding, longer filter life\nCON: Citrate accumulation in liver failure → high anion gap + hypocalcaemia; metabolic alkalosis")],
[B("Unfractionated Heparin (UFH)"), B("Activates antithrombin III → inhibits thrombin and Xa; infused pre-filter"), B("aPTT (systemic — try to avoid affecting systemic coagulation)"), B("PRO: Familiar, reversible with protamine\nCON: Bleeding risk, HIT risk, uncertain dosing")],
[B("Low-dose Heparin"), B("100-500 units/h pre-filter; aims for minimal systemic effect"), B("aPTT or anti-Xa"), B("Common practice; small increased bleeding risk vs. no anticoagulation")],
[B("Argatroban"), B("Direct thrombin inhibitor"), B("aPTT"), B("USE: Heparin-induced thrombocytopenia (HIT); hepatic metabolism — use with caution in liver failure")],
[B("No anticoagulation"), B("—"), B("Filter life monitoring"), B("USE: High bleeding risk, coagulopathy; SLED/IHD tolerate better; in CRRT, expect more frequent circuit changes; higher blood flow (≥250 mL/min) and pre-filter replacement fluid reduce clotting risk")],
]
story.append(make_table([], anticoag_rows, col_widths=[3.2*cm, 4.8*cm, 3.0*cm, 6.0*cm]))
story.append(SP(4))
story.append(NOTE("Regional Citrate Anticoagulation (RCA) is the current preferred strategy (KDIGO 2012; multiple meta-analyses). Citrate is converted to bicarbonate in the liver. In liver failure: citrate accumulates → wide anion gap + low systemic ionised Ca²⁺. Monitor with total Ca²⁺:ionised Ca²⁺ ratio (>2.5 suggests citrate accumulation)."))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 6: DOSE AND INTENSITY
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("6. DOSE AND INTENSITY OF RRT"))
story.append(H2("6.1 CRRT Dosing"))
story.append(BU("Dose expressed as <b>effluent flow rate (mL/kg/h)</b> — includes ultrafiltrate + dialysate output"))
story.append(BU("<b>Recommended dose: 20-25 mL/kg/h</b> (KDIGO 2012; ATN and RENAL trials)"))
story.append(BU("ATN Trial (n=1124): Intensive (35 mL/kg/h) vs. standard (20 mL/kg/h) — <b>no difference</b> in 60-day mortality or renal recovery"))
story.append(BU("RENAL Trial (n=1508): Higher dose (40 mL/kg/h) vs. lower (25 mL/kg/h) — <b>no benefit</b> to higher dose; higher dose associated with more hypophosphataemia"))
story.append(BU("<b>Prescribe higher than target</b> (e.g., 25-30 mL/kg/h) to account for circuit downtime and interruptions — aim to <b>deliver</b> 20-25 mL/kg/h"))
story.append(H2("6.2 IHD Dosing"))
story.append(BU("<b>Kt/V urea ≥1.2-1.4 per session</b> — K=dialyser clearance, t=session time, V=volume of distribution of urea"))
story.append(BU("For AKI: IHD prescribed 6 days/week in intensive arm of ATN trial"))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 7: TIMING OF INITIATION
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("7. TIMING OF RRT INITIATION"))
story.append(B("The optimal timing of RRT initiation remains controversial. Current evidence:"))
story.append(SP(4))
timing_rows = [
[Paragraph("<b>Trial</b>", body_style), Paragraph("<b>Design</b>", body_style), Paragraph("<b>Finding</b>", body_style)],
[B("Single-centre cardiac surgery (Zarbock)"), B("Stage 2 vs Stage 3 AKI after cardiac surgery"), B("Early RRT: lower mortality (39.3% vs 54.7%), better renal recovery at 90d — but only 21h median difference; large effect, interpret cautiously")],
[B("IDEAL-ICU Trial"), B("Early vs deferred RRT in KDIGO stage 3 AKI"), B("No mortality difference; 29% in deferred arm never required RRT — spontaneous recovery")],
[B("ELAIN Trial"), B("Early vs late RRT — KDIGO stage 2 vs 3"), B("Favoured early initiation (28-day mortality benefit)")],
[B("STARRT-AKI Trial"), B("Accelerated vs standard RRT initiation"), B("No 90-day survival benefit; accelerated group had more adverse events")],
[B("AKIKI-2 Trial"), B("Delayed vs more-delayed RRT"), B("Delaying until BUN >140 mg/dL → HR 1.60 increased mortality")],
]
story.append(make_table([], timing_rows, col_widths=[3.5*cm, 5.5*cm, 8.0*cm]))
story.append(SP(4))
story.append(KP("Current consensus: Do NOT use early empirical RRT in stable patients. Await classical indications (A-E-I-O-U) or signs of clinical deterioration. However, do NOT delay too long — BUN >140 mg/dL or mandatory crises (K⁺ >6.5, pH <7.1, pulmonary oedema) mandate urgent initiation."))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 8: MODALITY COMPARISON - OUTCOMES
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("8. CRRT vs IHD vs SLED — OUTCOME EVIDENCE"))
story.append(H2("8.1 CRRT vs IHD"))
story.append(BU("Multiple RCTs and meta-analyses: <b>no significant mortality difference</b> between CRRT and IHD (RR 1.00; 95% CI 0.92-1.09)"))
story.append(BU("Theoretical advantage of CRRT: avoids intradialytic hypotension → less ischaemic renal injury → better renal recovery"))
story.append(BU("Observational studies suggest lower long-term dialysis dependence with CRRT (25% lower risk of long-term dialysis at 2 years — Ontario cohort study)"))
story.append(BU("CRRT preferred clinically when: vasopressor-dependent, haemodynamically unstable, cerebral oedema risk (slower osmolar shifts), fluid overload requiring precise hourly titration"))
story.append(H2("8.2 CRRT vs SLED"))
story.append(BU("Single-centre RCT (n=232 surgical ICU): 90-day mortality 49.6% (SLED) vs 55.6% (CRRT) — no significant difference"))
story.append(BU("SLED: lower cost, no specialised machine, can be done without anticoagulation, practically more flexible"))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 9: VASCULAR ACCESS
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("9. VASCULAR ACCESS FOR RRT"))
story.append(BU("<b>Preferred site:</b> Non-tunnelled temporary dialysis catheter (11-13 Fr, dual lumen)"))
story.append(BU("<b>Site preference order (KDIGO):</b>"))
story.append(BSU("1st: Right internal jugular vein (straight path to SVC/RA, lowest complication rate)"))
story.append(BSU("2nd: Femoral vein (high recirculation, position-dependent flow, infection risk)"))
story.append(BSU("3rd: Left internal jugular vein (longer, more tortuous path)"))
story.append(BSU("4th: Subclavian vein — AVOID (risk of subclavian stenosis compromising future AV fistula)"))
story.append(BU("<b>Catheter length:</b> Right IJV ~15-20 cm; Left IJV ~20 cm; Femoral ~24-25 cm"))
story.append(BU("Catheter dysfunction (poor flows, recirculation >15%) reduces delivered dose"))
story.append(BU("Ultrasound guidance recommended for all catheter insertions"))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 10: COMPLICATIONS
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("10. COMPLICATIONS OF RRT"))
comp_rows = [
[Paragraph("<b>Complication</b>", body_style), Paragraph("<b>Cause</b>", body_style), Paragraph("<b>Management</b>", body_style)],
[B("Intradialytic hypotension"), B("Rapid fluid removal, vasodilation, myocardial stunning"), B("Slow UF rate, cool dialysate, hypertonic saline, vasopressors, convert to CRRT/SLED")],
[B("Dialysis disequilibrium syndrome"), B("Rapid osmolar shift → cerebral oedema; first sessions"), B("Slow initial blood flows, shorter sessions, use mannitol prophylactically")],
[B("Electrolyte abnormalities"), B("Over-removal of K⁺, Mg²⁺, phosphate, Ca²⁺"), B("Regular monitoring, supplement phosphate/potassium; adjust dialysate composition")],
[B("Hypophosphataemia"), B("Excessive clearance especially with high-dose CRRT"), B("Supplement phosphate IV/PO; monitor daily in CRRT")],
[B("Hypothermia"), B("Blood cooling in extracorporeal circuit"), B("Warm replacement fluids, heated circuit, dialysate warmer")],
[B("Circuit clotting"), B("Inadequate anticoagulation, low blood flow, haemoconcentration"), B("Optimise anticoagulation, increase blood flow, pre-filter replacement fluid position")],
[B("Bleeding"), B("Anticoagulation especially heparin"), B("Switch to RCA or no anticoagulation; reverse with protamine for heparin")],
[B("Citrate toxicity"), B("Liver failure → citrate accumulation"), B("Reduce citrate dose, supplement calcium, monitor total Ca:ionised Ca ratio")],
[B("Drug clearance"), B("Many drugs removed by CRRT — especially hydrophilic, low protein-bound, small molecules"), B("Review all drug dosing; antibiotics (vancomycin, aminoglycosides, beta-lactams) require therapeutic drug monitoring")],
[B("Infection / Line sepsis"), B("Dialysis catheter, peritonitis (PD)"), B("Strict asepsis, catheter care bundles, antibiotic lock therapy")],
[B("Air embolism"), B("Circuit disconnection"), B("Air detectors; clamp and position; aspirate if confirmed")],
]
story.append(make_table([], comp_rows, col_widths=[4.0*cm, 5.5*cm, 7.5*cm]))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 11: DRUG DOSING IN RRT
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("11. DRUG DOSING ADJUSTMENTS IN RRT"))
story.append(B("Drug clearance in CRRT depends on: molecular weight, protein binding, volume of distribution (Vd), and sieving coefficient. CRRT significantly clears many critical drugs."))
story.append(SP(4))
drug_rows = [
[Paragraph("<b>Drug</b>", body_style), Paragraph("<b>Effect of RRT</b>", body_style), Paragraph("<b>Recommendation</b>", body_style)],
[B("Vancomycin"), B("Significantly cleared by CRRT"), B("TDM (trough/AUC); increased dosing frequency needed; target AUC/MIC 400-600")],
[B("Aminoglycosides"), B("High clearance"), B("Extended-interval dosing; TDM mandatory")],
[B("Beta-lactams (pip-taz, meropenem)"), B("Hydrophilic, cleared by CRRT"), B("Extended infusion strategies; increased doses in CRRT")],
[B("Fluconazole"), B("Highly dialysable"), B("Standard doses may be inadequate; increase frequency")],
[B("Linezolid"), B("Partially cleared"), B("Standard dosing generally adequate; TDM if available")],
[B("Heparin, Warfarin"), B("Minimally cleared"), B("No dose change needed for drug itself; adjust anticoagulation target for RRT circuit")],
[B("Digoxin"), B("Minimal clearance (large Vd, protein-bound)"), B("Maintain standard dosing; use cautiously")],
[B("Phosphate (endogenous)"), B("Cleared by all modalities"), B("Supplement to avoid hypophosphataemia")],
]
story.append(make_table([], drug_rows, col_widths=[3.8*cm, 5.2*cm, 8.0*cm]))
story.append(NOTE("During RRT, the sieving coefficient (SC) of a drug = concentration in ultrafiltrate / plasma concentration. SC ~1 means drug freely passes the membrane. High Vd and high protein binding = low clearance by RRT."))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 12: ANAESTHETIC CONSIDERATIONS
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("12. ANAESTHETIC CONSIDERATIONS FOR RRT PATIENTS"))
story.append(H2("12.1 Preoperative Assessment"))
story.append(BU("Assess volume status, electrolytes (K⁺, Mg²⁺, Ca²⁺, HCO₃⁻), acid-base status"))
story.append(BU("Timing: if urgent surgery needed, consider perioperative haemodialysis to optimise K⁺ (<5.5 mEq/L) and acid-base"))
story.append(BU("Check current anticoagulation regimen — if on heparin for CRRT, plan reversal or discuss with nephrologist"))
story.append(BU("Review drug dosing adjustments in context of RRT modality"))
story.append(H2("12.2 Intraoperative RRT"))
story.append(BU("Occasionally required intraoperatively during prolonged cases (e.g., liver transplantation, major abdominal surgery with massive transfusion)"))
story.append(BU("Close coordination between anaesthesiologist and nephrologist/perfusionist essential"))
story.append(BU("Anticoagulation strategy needs joint planning — systemic heparin for surgical haemostasis may conflict with CRRT anticoagulation needs"))
story.append(BU("Citrate RCA preferred intraoperatively as it does not affect surgical haemostasis"))
story.append(BU("RRT can be run via the same CVL provided dedicated lumens available, or through a separate dedicated dialysis catheter"))
story.append(H2("12.3 Pharmacological Considerations"))
story.append(BU("<b>Neuromuscular blocking agents:</b> Atracurium and cisatracurium preferred (Hofmann elimination, not renally cleared)"))
story.append(BU("<b>Opioids:</b> Morphine active metabolites (M6G) accumulate in renal failure → prefer fentanyl, remifentanil"))
story.append(BU("<b>Volatile agents:</b> All safe; sevoflurane produces compound A (theoretical nephrotoxicity at low flows — avoid prolonged low-flow anaesthesia in AKI)"))
story.append(BU("<b>NSAIDs:</b> Contraindicated in AKI"))
story.append(BU("<b>Sugammadex:</b> Cleared by RRT; monitor for recurarisation"))
story.append(H2("12.4 Fluid Management"))
story.append(BU("Avoid fluid overload — fluid overload is independently associated with worse outcomes in AKI"))
story.append(BU("Use goal-directed fluid therapy with dynamic predictors of fluid responsiveness"))
story.append(BU("Avoid normal saline in large volumes — risk of hyperchloraemic metabolic acidosis; prefer balanced crystalloids"))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 13: DISCONTINUATION OF RRT
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("13. DISCONTINUATION OF RRT"))
story.append(B("RRT should be discontinued when the underlying cause of AKI has resolved and renal function is recovering. Signs of renal recovery:"))
story.append(BU("Increasing urine output (>0.5 mL/kg/h without diuretics, or >200-500 mL/day)"))
story.append(BU("Decreasing creatinine trend while on RRT"))
story.append(BU("Creatinine clearance >15-20 mL/min (measured from timed urine collection on low-flow CRRT)"))
story.append(BU("Absence of ongoing fluid/electrolyte/acid-base management needs"))
story.append(B("Recovery after AKI — KDIGO stages:"))
story.append(BU("Early recovery: within 7 days of AKI onset"))
story.append(BU("Late recovery: 7-90 days"))
story.append(BU("Failure to recover by 90 days → classified as CKD"))
story.append(NOTE("Approximately 10-30% of survivors of severe AKI requiring RRT remain dialysis-dependent at 90 days. AKI survivors have increased long-term risk of CKD, cardiovascular disease, hypertension, and renal malignancy."))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 14: SPECIAL CONTEXTS
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("14. SPECIAL CONTEXTS"))
story.append(H2("14.1 RRT in Sepsis / SIRS"))
story.append(BU("High-volume haemofiltration (HVHF) proposed for cytokine removal — theoretical benefit"))
story.append(BU("ATN and RENAL trials showed no mortality benefit to higher effluent volumes in septic AKI"))
story.append(BU("CRRT preferred in haemodynamically unstable septic patients on vasopressors"))
story.append(H2("14.2 Poisoning and Drug Overdose"))
story.append(BU("IHD preferred for rapid removal of dialysable toxins: methanol, ethylene glycol, lithium, salicylates, theophylline, metformin (lactic acidosis)"))
story.append(BU("Characteristics of dialysable toxin: low molecular weight, low Vd, low protein binding, water-soluble"))
story.append(H2("14.3 Paediatric RRT"))
story.append(BU("PD preferred in neonates and small infants (no need for CVL, haemodynamically stable)"))
story.append(BU("CRRT using venovenous access used in older children and haemodynamically unstable infants"))
story.append(BU("Circuit volume is proportionally large relative to blood volume in small patients — may require priming with blood products"))
story.append(H2("14.4 RRT in ESRD Patients Undergoing Surgery"))
story.append(BU("Pre-dialysis timing: ideally within 24 hours of planned elective surgery"))
story.append(BU("Optimise K⁺, acid-base, fluid status, coagulation"))
story.append(BU("Avoid hypotension during dialysis — increases perioperative AKI risk in residual function"))
story.append(SP())
# ──────────────────────────────────────────────────────────────────────────────
# SECTION 15: SUMMARY TABLE
# ──────────────────────────────────────────────────────────────────────────────
story.append(H1("15. EXAM QUICK-REFERENCE SUMMARY"))
summary_rows = [
[Paragraph("<b>Topic</b>", body_style), Paragraph("<b>Key Point</b>", body_style)],
[B("Indications"), B("AEIOU: Acidosis, Electrolytes (K⁺), Ingestion, Overload, Uraemia")],
[B("Principle of dialysis"), B("Diffusion (small molecules) across concentration gradient")],
[B("Principle of filtration"), B("Convection (up to 50 kDa) via hydrostatic pressure / solvent drag")],
[B("Preferred anticoagulation"), B("Regional Citrate Anticoagulation (RCA) — KDIGO preferred")],
[B("CRRT dose"), B("Target 20-25 mL/kg/h effluent; prescribe 25-30 mL/kg/h to achieve delivery target")],
[B("IHD dose"), B("Kt/V ≥1.2 per session")],
[B("CRRT vs IHD mortality"), B("No difference in RCTs (ATN, RENAL, meta-analyses)")],
[B("Timing initiation"), B("No benefit to early empirical RRT; don't delay to crisis (BUN >140 → mortality ↑)")],
[B("CRRT preferred when"), B("Haemodynamically unstable, vasopressor-dependent, cerebral oedema, severe fluid overload")],
[B("IHD preferred when"), B("Haemodynamically stable, toxin/overdose (rapid clearance), ESRD maintenance")],
[B("Dialysis catheter"), B("Right IJV preferred; avoid subclavian (risk of stenosis)")],
[B("Drug monitoring"), B("Vancomycin, aminoglycosides, beta-lactams — TDM mandatory in CRRT")],
[B("NMB in renal failure"), B("Atracurium / cisatracurium preferred (Hofmann elimination)")],
[B("Opioids in renal failure"), B("Fentanyl, remifentanil preferred — avoid morphine (M6G accumulation)")],
[B("Citrate toxicity sign"), B("High total Ca:ionised Ca ratio >2.5 + wide anion gap + hypocalcaemia")],
[B("Discontinuation sign"), B("UO >0.5 mL/kg/h without diuretics; rising urine creatinine clearance >15-20 mL/min")],
]
story.append(make_table([], summary_rows, col_widths=[5.0*cm, 12.0*cm]))
story.append(SP(10))
story.append(HR())
story.append(Paragraph("<i>Sources: Miller's Anesthesia 10e | Brenner & Rector's The Kidney | Current Surgical Therapy 14e | Goldman-Cecil Medicine | KDIGO AKI Guidelines 2012</i>",
ParagraphStyle('footer', parent=styles['Normal'], fontSize=8, textColor=HexColor('#666666'), alignment=TA_CENTER)))
# ─── BUILD PDF ───────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF successfully created: {OUTPUT}")