how to write a answer in university exams for bephrotic syndrome in oathology

Reading File
Finding Sources
Searching the Web

nephrotic syndrome pathology university exam answer structure MBBS

Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Loading Image
Loading Image
I now have all the material needed. Here is the complete, exam-ready structured answer for Nephrotic Syndrome in Pathology.

Nephrotic Syndrome - Complete University Exam Answer (Pathology)

Source: Robbins & Cotran Pathologic Basis of Disease; Robbins & Kumar Basic Pathology

How to Structure Your Exam Answer

University pathology exams typically award marks under these headings. Follow this structure every time.

NEPHROTIC SYNDROME

1. Definition

Nephrotic syndrome is a clinical complex resulting from increased glomerular permeability to plasma proteins, characterized by the tetrad of:
FeatureThreshold
Massive proteinuria>3.5 g/day in adults (>40 mg/m²/hr in children)
HypoalbuminemiaSerum albumin <3 g/dL
Generalized edema (anasarca)Periorbital, dependent, pitting
Hyperlipidemia + lipiduriaElevated cholesterol, LDL, VLDL; oval fat bodies in urine

2. Pathophysiology (How each feature arises)

This is the most commonly tested section - explain the logical chain:
Step 1 - Glomerular barrier damage: The glomerular capillary wall has three layers: fenestrated endothelium, glomerular basement membrane (GBM), and podocytes with slit diaphragms. This acts as a size and charge barrier. Injury (structural or physicochemical) increases permeability → proteins escape into urine.
Step 2 - Proteinuria → Hypoalbuminemia: Heavy protein loss depletes serum albumin faster than the liver can synthesize it. Increased renal catabolism of filtered albumin also contributes.
Step 3 - Hypoalbuminemia → Edema:
  • Decreased plasma oncotic pressure → fluid shifts to interstitium
  • Hypovolemia triggers aldosterone (via RAAS) and sympathetic activation → Na+ and water retention → worsens edema
  • Reduced atrial natriuretic peptide secretion
Step 4 - Hyperlipidemia:
  • Liver increases lipoprotein synthesis (compensatory response to low oncotic pressure)
  • Defective lipid catabolism
  • Result: elevated cholesterol, TG, VLDL, LDL, lipoprotein(a)
Step 5 - Lipiduria: Lipoproteins leak across the damaged glomerular wall → appear as free fat or "oval fat bodies" (lipoproteins reabsorbed by tubular epithelial cells, then shed)

3. Causes / Etiology

Primary (Glomerular) Causes - Most Important for Exam:
DiseaseAgeKey Feature
Minimal Change DiseaseChildren (1-7 yrs)Most common in children
Focal Segmental Glomerulosclerosis (FSGS)Adults & childrenMost common in adults (USA); often progresses to ESKD
Membranous NephropathyAdults 30-60 yrsMost common primary NS in White adults
Membranoproliferative GN (MPGN)Any age"Tram-track" pattern
Secondary Causes:
  • Diabetes mellitus (most common overall cause of chronic kidney disease)
  • Systemic Lupus Erythematosus (SLE)
  • Amyloidosis
  • Infections: hepatitis B/C, HIV, malaria, syphilis
  • Drugs: gold, penicillamine, NSAIDs
  • Malignancy: lymphoma, carcinoma

4. Major Diseases - Morphology & Features

A. MINIMAL CHANGE DISEASE (Lipoid Nephrosis)

Pathogenesis: Circulating factors (possibly autoantibodies against nephrin, a slit diaphragm protein) injure podocytes → foot process effacement → proteinuria. Immune mechanism suspected due to steroid responsiveness.
Morphology:
  • Light microscopy (LM): Glomeruli appear completely NORMAL (hence the name)
  • Immunofluorescence (IF): No immune deposits
  • Electron microscopy (EM): Diffuse effacement (fusion) of podocyte foot processes - the hallmark
Here is the LM appearance - note the completely normal-looking glomerulus:
Minimal Change Disease - PAS stain showing normal glomerulus
Minimal Change Disease: Normal glomerulus on PAS stain. No proliferation, no thickening.
Tubular change: Proximal tubular cells are laden with protein droplets and lipids (due to reabsorption of leaked proteins).
Clinical features:
  • Abrupt onset nephrotic syndrome in otherwise healthy child
  • Selective proteinuria (mainly albumin - low MW proteins)
  • Renal function preserved
  • Excellent prognosis: >90% respond to corticosteroids
  • Proteinuria recurs in >2/3 of initial responders

B. FOCAL SEGMENTAL GLOMERULOSCLEROSIS (FSGS)

Definition: Sclerosis affecting SOME glomeruli (focal) and only PART of each affected glomerulus (segmental).
Pathogenesis: Podocyte injury is the initiating event. Circulating permeability-inducing factors (analogous to MCD) → foot process effacement → podocyte loss → protein and lipid entrapment → ECM deposition → sclerosis.
Primary FSGS: ~30% of all NS in USA; most common glomerular disease progressing to ESKD.
Secondary causes: HIV infection, heroin use, obesity (maladaptive response to nephron loss), genetic mutations (nephrin, podocin - >60 genes).
Morphology:
  • LM: Initially affects juxtamedullary glomeruli. Affected segments show obliterated capillary lumina, increased mesangial matrix, hyaline deposits, foamy (lipid-laden) macrophages. Unaffected glomeruli look normal.
  • IF: Nonspecific IgM and complement trapping in areas of sclerosis
  • EM: Effacement of foot processes
Variant - Collapsing glomerulopathy: Collapse of entire glomerular tuft with epithelial cell hyperplasia; worst prognosis; associated with HIV.
Clinical features:
  • Nonselective proteinuria (albumin + globulins)
  • Poor response to steroids
  • Progressive course → ESKD

C. MEMBRANOUS NEPHROPATHY

Pathogenesis: Autoimmune disease. Autoantibodies against podocyte antigen phospholipase A2 receptor (PLA2R) form in situ immune complexes along the GBM in 70-80% of primary cases. Complement is also deposited.
Primary: 80% of cases Secondary: Infections (Hep B, syphilis, malaria), malignancy (carcinoma, CLL), SLE, drugs (gold, penicillamine, captopril, NSAIDs), inorganic salts (mercury)
Morphology:
Membranous Nephropathy - LM with GBM thickening, IF with granular deposits, EM with subepithelial deposits
Membranous nephropathy: (A) Diffuse GBM thickening on silver stain. (B) Granular IgG deposits on immunofluorescence along GBM. (C) Subepithelial electron-dense deposits on EM (arrow).
  • LM: Diffuse thickening of glomerular capillary walls (GBM). Silver stain shows "spike and dome" pattern (GBM projections between deposits).
  • IF: Granular deposits of IgG and complement (C3) along GBM - diagnostic
  • EM: Subepithelial electron-dense deposits; foot process effacement; no inflammation
Clinical features:
  • Most common primary NS in White adults aged 30-60
  • Nonselective proteinuria
  • Indolent, slowly progressive course
  • "Rule of thirds": 1/3 remit, 1/3 persist, 1/3 progress to renal failure
  • Often resistant to steroid therapy

5. Complications of Nephrotic Syndrome

Examiners frequently ask about complications - always include these:
  1. Infections - Particularly staphylococcal and pneumococcal infections due to loss of immunoglobulins in urine; also peritonitis
  2. Thromboembolism - Loss of antithrombin III and other clotting factors in urine + increased hepatic synthesis of procoagulant factors → hypercoagulable state → renal vein thrombosis, DVT, pulmonary embolism
  3. Hyperlipidemia and accelerated atherosclerosis - Long-standing elevated LDL increases cardiovascular risk
  4. Protein malnutrition - Chronic protein loss, especially in children
  5. Vitamin D deficiency - Loss of vitamin D-binding protein in urine → hypocalcemia, secondary hyperparathyroidism
  6. Drug toxicity - Many drugs are albumin-bound; low albumin increases free drug levels
  7. Acute kidney injury - From hypovolemia, thrombosis, or sepsis

6. Summary Comparison Table (Exam Favorite)

FeatureMinimal Change DiseaseFSGSMembranous Nephropathy
AgeChildrenAny (adults++)Adults 30-60
LMNormalFocal, segmental sclerosisGBM thickening
IFNegativeIgM (nonspecific)Granular IgG + C3 along GBM
EMFoot process effacementFoot process effacementSubepithelial deposits
ProteinuriaSelective (albumin)NonselectiveNonselective
Steroid responseExcellent (>90%)PoorVariable/poor
PrognosisGoodProgresses to ESKDRule of thirds
PathogenesisT-cell / anti-nephrinPodocyte injury (circulating factor)Anti-PLA2R antibodies

7. Important One-Liners to Memorize

  • Nephrotic syndrome = protein loss >3.5 g/day + hypoalbuminemia + edema + hyperlipidemia
  • Most common NS in children = Minimal Change Disease (responds to steroids)
  • Most common NS in adults (USA) = FSGS
  • Most common NS in White adults = Membranous nephropathy
  • "Normal glomerulus on LM" = Minimal Change Disease
  • "Anti-PLA2R antibodies" = Membranous nephropathy
  • "Effacement of foot processes on EM" = common to ALL three major causes
  • Most common cause of ESKD from glomerular disease = FSGS
  • Most common cause of chronic kidney disease overall = Diabetic nephropathy

Exam Writing Tips

  1. Start with a definition - always define the syndrome in the first line
  2. Use headings - Definition → Pathophysiology → Causes → Individual diseases (Morphology + Clinical) → Complications → Summary table
  3. Draw a diagram of the pathophysiology chain (glomerular injury → proteinuria → hypoalbuminemia → edema/hyperlipidemia) - examiners love this
  4. For each disease, follow the LM → IF → EM sequence - this is the standard pathology answer format
  5. Include the comparison table - it shows breadth of knowledge and saves time
  6. Mention steroid response for each disease - this is a common clinical bridge question
Sources: Robbins & Cotran Pathologic Basis of Disease (Big Robbins); Robbins & Kumar Basic Pathology

Create a PDF study guide with comparison tables for nephrotic vs nephritic syndrome

Reading File
Finding Sources
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/nephro-study-guide && ls /home/daytona/workspac…

Writing File

~/nephro-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_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus.flowables import BalancedColumns
from reportlab.lib.colors import HexColor

OUTPUT = "/home/daytona/workspace/nephro-study-guide/Nephrotic_vs_Nephritic_Study_Guide.pdf"

# ── Colour palette ──────────────────────────────────────────────────────────
C_DARK_BLUE   = HexColor("#1a3a5c")
C_MED_BLUE    = HexColor("#2e6da4")
C_LIGHT_BLUE  = HexColor("#d6e8f7")
C_ACCENT_RED  = HexColor("#c0392b")
C_ACCENT_ORG  = HexColor("#e67e22")
C_LIGHT_RED   = HexColor("#fadbd8")
C_LIGHT_ORG   = HexColor("#fdebd0")
C_GREEN       = HexColor("#1e8449")
C_LIGHT_GREEN = HexColor("#d5f5e3")
C_YELLOW_BG   = HexColor("#fef9e7")
C_GREY_BG     = HexColor("#f2f3f4")
C_DARK_TEXT   = HexColor("#1c2833")
C_TABLE_STRIPE= HexColor("#eaf4fb")
C_PURPLE      = HexColor("#6c3483")
C_LIGHT_PURP  = HexColor("#e8daef")
C_TEAL        = HexColor("#148f77")
C_LIGHT_TEAL  = HexColor("#d1f2eb")

# ── Document ─────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    rightMargin=1.8*cm, leftMargin=1.8*cm,
    topMargin=2*cm, bottomMargin=2*cm,
    title="Nephrotic vs Nephritic Syndrome – Pathology Study Guide",
    author="Orris Medical Library",
)

W, H = A4
TW = W - 3.6*cm   # usable text width

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

def style(name, **kw):
    s = ParagraphStyle(name, **kw)
    return s

S_COVER_TITLE = style("CoverTitle",
    fontName="Helvetica-Bold", fontSize=28, textColor=colors.white,
    alignment=TA_CENTER, leading=34)
S_COVER_SUB = style("CoverSub",
    fontName="Helvetica", fontSize=14, textColor=HexColor("#d6e8f7"),
    alignment=TA_CENTER, leading=20)
S_COVER_NOTE = style("CoverNote",
    fontName="Helvetica-Oblique", fontSize=10, textColor=HexColor("#aec6e8"),
    alignment=TA_CENTER)
S_H1 = style("H1",
    fontName="Helvetica-Bold", fontSize=16, textColor=C_DARK_BLUE,
    spaceBefore=14, spaceAfter=4, leading=20)
S_H2 = style("H2",
    fontName="Helvetica-Bold", fontSize=13, textColor=C_MED_BLUE,
    spaceBefore=10, spaceAfter=4, leading=17)
S_H3 = style("H3",
    fontName="Helvetica-Bold", fontSize=11, textColor=C_DARK_TEXT,
    spaceBefore=8, spaceAfter=3, leading=14)
S_BODY = style("Body",
    fontName="Helvetica", fontSize=9.5, textColor=C_DARK_TEXT,
    leading=13, spaceAfter=4, alignment=TA_JUSTIFY)
S_BULLET = style("Bullet",
    fontName="Helvetica", fontSize=9.5, textColor=C_DARK_TEXT,
    leading=13, spaceAfter=2, leftIndent=14, firstLineIndent=-10)
S_TABLE_HDR = style("TblHdr",
    fontName="Helvetica-Bold", fontSize=9, textColor=colors.white,
    alignment=TA_CENTER, leading=12)
S_TABLE_CELL = style("TblCell",
    fontName="Helvetica", fontSize=8.8, textColor=C_DARK_TEXT,
    leading=12, alignment=TA_LEFT)
S_TABLE_CELL_C = style("TblCellC",
    fontName="Helvetica", fontSize=8.8, textColor=C_DARK_TEXT,
    leading=12, alignment=TA_CENTER)
S_TABLE_BOLD = style("TblBold",
    fontName="Helvetica-Bold", fontSize=8.8, textColor=C_DARK_TEXT,
    leading=12, alignment=TA_LEFT)
S_BOX_TITLE = style("BoxTitle",
    fontName="Helvetica-Bold", fontSize=10.5, textColor=C_DARK_BLUE,
    leading=14, spaceAfter=3)
S_BOX_BODY = style("BoxBody",
    fontName="Helvetica", fontSize=9, textColor=C_DARK_TEXT,
    leading=12, spaceAfter=2)
S_FOOTER = style("Footer",
    fontName="Helvetica-Oblique", fontSize=7.5, textColor=colors.grey,
    alignment=TA_CENTER)
S_BADGE_NEPHROT = style("BadgeNephrot",
    fontName="Helvetica-Bold", fontSize=11, textColor=colors.white,
    alignment=TA_CENTER, backColor=C_MED_BLUE)
S_BADGE_NEPHRIT = style("BadgeNephrit",
    fontName="Helvetica-Bold", fontSize=11, textColor=colors.white,
    alignment=TA_CENTER, backColor=C_ACCENT_RED)
S_MNEMONIC = style("Mnemonic",
    fontName="Helvetica-Bold", fontSize=10, textColor=C_PURPLE,
    leading=15)
S_CAPTION = style("Caption",
    fontName="Helvetica-Oblique", fontSize=7.5, textColor=colors.grey,
    alignment=TA_CENTER, spaceAfter=6)

# ── Helper: coloured box ──────────────────────────────────────────────────────
def colour_box(title, items, bg=C_LIGHT_BLUE, title_color=C_MED_BLUE, width=None):
    """Returns a Table that looks like a shaded info-box."""
    w = width or TW
    rows = [[Paragraph(title, style("bt",
        fontName="Helvetica-Bold", fontSize=10, textColor=title_color, leading=13))]]
    for item in items:
        rows.append([Paragraph(item, S_BOX_BODY)])
    t = Table(rows, colWidths=[w])
    t.setStyle(TableStyle([
        ("BACKGROUND",  (0, 0), (-1, 0),  bg),
        ("BACKGROUND",  (0, 1), (-1, -1), HexColor("#f8fcff")),
        ("BOX",         (0, 0), (-1, -1), 0.8, title_color),
        ("LINEBELOW",   (0, 0), (-1, 0),  0.5, title_color),
        ("TOPPADDING",  (0, 0), (-1, -1), 5),
        ("BOTTOMPADDING",(0,0), (-1,-1),  5),
        ("LEFTPADDING", (0, 0), (-1, -1), 8),
        ("RIGHTPADDING",(0, 0), (-1, -1), 8),
    ]))
    return t

# ── Helper: section divider ───────────────────────────────────────────────────
def section_header(text, color=C_DARK_BLUE):
    tbl = Table([[Paragraph(text, style("sh",
        fontName="Helvetica-Bold", fontSize=13, textColor=colors.white,
        leading=17))]], colWidths=[TW])
    tbl.setStyle(TableStyle([
        ("BACKGROUND",   (0,0), (-1,-1), color),
        ("TOPPADDING",   (0,0), (-1,-1), 7),
        ("BOTTOMPADDING",(0,0), (-1,-1), 7),
        ("LEFTPADDING",  (0,0), (-1,-1), 12),
        ("RIGHTPADDING", (0,0), (-1,-1), 12),
        ("ROUNDEDCORNERS", [4]),
    ]))
    return tbl

# ── Story ─────────────────────────────────────────────────────────────────────
story = []

# ══════════════════════════════════════════════════════════════════════════════
# COVER PAGE
# ══════════════════════════════════════════════════════════════════════════════
cover_data = [[
    Paragraph("PATHOLOGY STUDY GUIDE", S_COVER_SUB),
    Paragraph("Nephrotic Syndrome", S_COVER_TITLE),
    Paragraph("vs", style("vs", fontName="Helvetica-Bold", fontSize=20,
              textColor=HexColor("#aec6e8"), alignment=TA_CENTER, leading=26)),
    Paragraph("Nephritic Syndrome", S_COVER_TITLE),
    Spacer(1, 0.5*cm),
    Paragraph("Complete Comparison Tables · Causes · Morphology · Complications · Mnemonics",
              S_COVER_SUB),
    Spacer(1, 1.2*cm),
    Paragraph("Based on Robbins & Cotran Pathologic Basis of Disease", S_COVER_NOTE),
    Paragraph("Robbins & Kumar Basic Pathology", S_COVER_NOTE),
]]

cover = Table(cover_data, colWidths=[TW])
cover.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), C_DARK_BLUE),
    ("TOPPADDING",    (0,0), (-1,-1), 22),
    ("BOTTOMPADDING", (0,0), (-1,-1), 22),
    ("LEFTPADDING",   (0,0), (-1,-1), 20),
    ("RIGHTPADDING",  (0,0), (-1,-1), 20),
]))
story.append(cover)
story.append(Spacer(1, 0.6*cm))

# Source note
story.append(Paragraph(
    "Source: Robbins &amp; Cotran Pathologic Basis of Disease | Robbins &amp; Kumar Basic Pathology  •  July 2026",
    S_FOOTER))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 1 – MASTER COMPARISON TABLE
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("SECTION 1 – MASTER COMPARISON: NEPHROTIC vs NEPHRITIC SYNDROME"))
story.append(Spacer(1, 0.3*cm))

def P(txt, s=S_TABLE_CELL): return Paragraph(txt, s)
def PB(txt): return Paragraph(txt, S_TABLE_BOLD)
def PC(txt): return Paragraph(txt, S_TABLE_CELL_C)

HDR_NEPHROT = style("hn", fontName="Helvetica-Bold", fontSize=9,
                    textColor=colors.white, alignment=TA_CENTER, leading=12,
                    backColor=C_MED_BLUE)
HDR_NEPHRIT = style("hnit", fontName="Helvetica-Bold", fontSize=9,
                    textColor=colors.white, alignment=TA_CENTER, leading=12,
                    backColor=C_ACCENT_RED)

compare_data = [
    # header
    [PB("Feature"),
     Paragraph("NEPHROTIC SYNDROME", HDR_NEPHROT),
     Paragraph("NEPHRITIC SYNDROME", HDR_NEPHRIT)],
    # rows
    [PB("Definition"),
     P("Glomerular permeability ↑ → protein leak"),
     P("Glomerular inflammation → hematuria + ↓ GFR")],
    [PB("Proteinuria"),
     P("MASSIVE  >3.5 g/day (adults)\n>40 mg/m²/hr (children)"),
     P("Mild–moderate (subnephrotic)\n<3.5 g/day")],
    [PB("Hematuria"),
     P("Absent or microscopic"),
     P("PROMINENT\nRBC casts in urine (diagnostic)")],
    [PB("Edema"),
     P("MARKED – soft, pitting\nPeriorbital, dependent, anasarca"),
     P("Mild – due to Na/H₂O retention")],
    [PB("Hypertension"),
     P("Absent or mild"),
     P("PRESENT – fluid retention + renin↑")],
    [PB("Oliguria / Azotemia"),
     P("Usually absent (GFR preserved)"),
     P("PRESENT – ↓ GFR, oliguria, azotemia")],
    [PB("Serum albumin"),
     P("LOW (<3 g/dL)"),
     P("Normal or mildly reduced")],
    [PB("Serum cholesterol"),
     P("HIGH (hyperlipidemia)"),
     P("Normal")],
    [PB("Lipiduria"),
     P("Present (oval fat bodies)"),
     P("Absent")],
    [PB("RBC casts"),
     P("Absent"),
     P("PRESENT – pathognomonic")],
    [PB("Complement"),
     P("Normal (except MPGN, SLE)"),
     P("↓ C3 (post-strep GN, MPGN, SLE)")],
    [PB("Mechanism"),
     P("Podocyte / GBM barrier damage\n→ protein leak"),
     P("Immune complex / antibody deposition\n→ inflammation, proliferation")],
    [PB("Glomerular pattern"),
     P("Non-proliferative\n(no cell proliferation)"),
     P("PROLIFERATIVE\n(mesangial/endothelial hypercellularity)")],
    [PB("Key diseases"),
     P("• Minimal Change Disease\n• FSGS\n• Membranous Nephropathy\n• MPGN (overlap)"),
     P("• Post-strep GN\n• Rapidly Progressive GN (RPGN)\n• IgA Nephropathy\n• Lupus nephritis")],
    [PB("Age tendency"),
     P("MCD: children\nMembranous/FSGS: adults"),
     P("Post-strep GN: children\nRPGN: any age")],
    [PB("Urine appearance"),
     P("Frothy (proteinuria)\nMilky (lipiduria)"),
     P("Smoky / tea-coloured\n(hematuria)")],
    [PB("Mnemonic"),
     P("\"OTiC\" – Oedema, proTeinuria, hypoalbuminaemia, hyperlipidaemia + lipiduria"),
     P("\"PHAROH\" – Proteinuria, Haematuria, Azotemia, RPGN, Oliguria, Hypertension")],
]

col_w = [TW*0.24, TW*0.38, TW*0.38]
compare_tbl = Table(compare_data, colWidths=col_w, repeatRows=1)
compare_tbl.setStyle(TableStyle([
    # header row
    ("BACKGROUND",    (0, 0), (0, 0),  C_DARK_BLUE),
    ("BACKGROUND",    (1, 0), (1, 0),  C_MED_BLUE),
    ("BACKGROUND",    (2, 0), (2, 0),  C_ACCENT_RED),
    ("TEXTCOLOR",     (0, 0), (-1, 0), colors.white),
    ("FONTNAME",      (0, 0), (-1, 0), "Helvetica-Bold"),
    ("FONTSIZE",      (0, 0), (-1, 0), 9),
    # feature column
    ("BACKGROUND",    (0, 1), (0, -1), C_GREY_BG),
    # alternating rows
    *[("BACKGROUND", (1, i), (1, i), C_TABLE_STRIPE if i % 2 == 0 else colors.white)
      for i in range(1, len(compare_data))],
    *[("BACKGROUND", (2, i), (2, i), HexColor("#fdf2f0") if i % 2 == 0 else colors.white)
      for i in range(1, len(compare_data))],
    # borders
    ("GRID",          (0, 0), (-1, -1), 0.5, HexColor("#cccccc")),
    ("LINEBELOW",     (0, 0), (-1, 0),  1.0, C_DARK_BLUE),
    ("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),
    # highlight mnemonic row
    ("BACKGROUND",    (0, len(compare_data)-1), (-1, len(compare_data)-1), C_LIGHT_PURP),
]))
story.append(compare_tbl)
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 2 – NEPHROTIC SYNDROME IN DEPTH
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("SECTION 2 – NEPHROTIC SYNDROME IN DEPTH", C_MED_BLUE))
story.append(Spacer(1, 0.3*cm))

# Definition box
story.append(colour_box(
    "DEFINITION",
    ["Nephrotic syndrome is caused by increased permeability of the glomerular capillary wall, "
     "resulting in massive loss of plasma proteins into the urine.",
     "Diagnostic tetrad:  (1) Proteinuria >3.5 g/day  •  (2) Hypoalbuminemia <3 g/dL  "
     "•  (3) Generalised oedema  •  (4) Hyperlipidaemia + lipiduria"],
    bg=C_LIGHT_BLUE, title_color=C_MED_BLUE))
story.append(Spacer(1, 0.3*cm))

# Pathophysiology flow
story.append(Paragraph("PATHOPHYSIOLOGY – CHAIN OF EVENTS", S_H2))
patho_data = [
    [Paragraph("↓ GBM / Podocyte Barrier", style("p1", fontName="Helvetica-Bold",
               fontSize=9, textColor=colors.white, alignment=TA_CENTER, leading=12))],
    [Paragraph("▼", style("ar", fontName="Helvetica-Bold", fontSize=12,
               textColor=C_MED_BLUE, alignment=TA_CENTER))],
    [P("Protein leak into urine → MASSIVE PROTEINURIA (>3.5 g/day)")],
    [Paragraph("▼", style("ar2", fontName="Helvetica-Bold", fontSize=12,
               textColor=C_MED_BLUE, alignment=TA_CENTER))],
    [P("Serum albumin depleted faster than liver can replace → HYPOALBUMINAEMIA")],
    [Paragraph("▼", style("ar3", fontName="Helvetica-Bold", fontSize=12,
               textColor=C_MED_BLUE, alignment=TA_CENTER))],
    [P("↓ Plasma oncotic pressure + Aldosterone/RAAS activation + ↓ ANP → OEDEMA (periorbital, dependent, anasarca)")],
    [Paragraph("▼", style("ar4", fontName="Helvetica-Bold", fontSize=12,
               textColor=C_MED_BLUE, alignment=TA_CENTER))],
    [P("Liver ↑ lipoprotein synthesis + ↓ lipid catabolism → HYPERLIPIDAEMIA (↑ Chol, LDL, VLDL, TG)")],
    [Paragraph("▼", style("ar5", fontName="Helvetica-Bold", fontSize=12,
               textColor=C_MED_BLUE, alignment=TA_CENTER))],
    [P("Lipoproteins leak across GBM → reabsorbed by tubular cells → shed as OVAL FAT BODIES → LIPIDURIA")],
]
patho_tbl = Table(patho_data, colWidths=[TW])
patho_tbl.setStyle(TableStyle([
    ("BACKGROUND",    (0, 0), (-1, 0), C_MED_BLUE),
    ("BACKGROUND",    (0, 2), (-1, 2), C_LIGHT_BLUE),
    ("BACKGROUND",    (0, 4), (-1, 4), C_LIGHT_BLUE),
    ("BACKGROUND",    (0, 6), (-1, 6), C_LIGHT_BLUE),
    ("BACKGROUND",    (0, 8), (-1, 8), C_LIGHT_BLUE),
    ("BACKGROUND",    (0, 10),(-1,10), C_LIGHT_BLUE),
    ("TOPPADDING",    (0, 0), (-1,-1), 5),
    ("BOTTOMPADDING", (0, 0), (-1,-1), 5),
    ("LEFTPADDING",   (0, 0), (-1,-1), 10),
    ("BOX",           (0, 0), (-1,-1), 0.8, C_MED_BLUE),
]))
story.append(patho_tbl)
story.append(Spacer(1, 0.35*cm))

# Diseases comparison table (nephrotic)
story.append(Paragraph("PRIMARY GLOMERULAR DISEASES CAUSING NEPHROTIC SYNDROME", S_H2))

dis_hdr = style("dh", fontName="Helvetica-Bold", fontSize=8.5,
                textColor=colors.white, alignment=TA_CENTER, leading=11)
dis_cell = style("dc", fontName="Helvetica", fontSize=8.2,
                 textColor=C_DARK_TEXT, leading=11, alignment=TA_LEFT)
dis_bold = style("db", fontName="Helvetica-Bold", fontSize=8.2,
                 textColor=C_DARK_TEXT, leading=11)

def DP(t): return Paragraph(t, dis_cell)
def DB(t): return Paragraph(t, dis_bold)

dis_data = [
    [Paragraph("Feature", dis_hdr),
     Paragraph("Minimal Change Disease", dis_hdr),
     Paragraph("FSGS", dis_hdr),
     Paragraph("Membranous Nephropathy", dis_hdr),
     Paragraph("MPGN", dis_hdr)],
    [DB("Age"), DP("Children 1–7 yrs"), DP("Any (adults > children)"), DP("Adults 30–60 yrs"), DP("Any age")],
    [DB("Frequency"), DP("Most common NS in children"), DP("Most common → ESKD (USA)"), DP("Most common primary NS\nin White adults"), DP("Less common")],
    [DB("Light Microscopy"), DP("NORMAL glomeruli"), DP("Focal + segmental sclerosis;\nhyaline deposits"), DP("Diffuse GBM thickening;\n'spike & dome' on silver"), DP("Mesangial proliferation;\nGBM thickening\n'tram-track' pattern")],
    [DB("Immunofluorescence"), DP("Negative\n(no deposits)"), DP("IgM + C3 in sclerosed areas\n(nonspecific)"), DP("Granular IgG + C3\nalong GBM"), DP("IgG + C3 in mesangium\n& capillary walls")],
    [DB("Electron Microscopy"), DP("Foot process effacement\n(ONLY finding)"), DP("Foot process effacement;\nno deposits"), DP("Subepithelial\nelectron-dense deposits;\nfoot process effacement"), DP("Subendothelial &\nmesangial deposits")],
    [DB("Pathogenesis"), DP("T-cell dysfunction;\n? anti-nephrin antibodies;\npodocyte injury"), DP("Podocyte injury;\ncirculating permeability\nfactor; >60 genes"), DP("Anti-PLA₂R antibodies\n(70–80% primary);\nin situ immune complex"), DP("Immune complex\ndeposition; complement\nactivation")],
    [DB("Proteinuria"), DP("SELECTIVE\n(albumin only)"), DP("Non-selective"), DP("Non-selective"), DP("Non-selective")],
    [DB("Steroid response"), DP("EXCELLENT\n>90% in children"), DP("Poor"), DP("Variable / poor"), DP("Poor")],
    [DB("Prognosis"), DP("Very good"), DP("Often → ESKD"), DP("Rule of thirds:\n1/3 remit, 1/3 persist,\n1/3 → renal failure"), DP("Progressive")],
    [DB("Secondary causes"), DP("Infections, drugs,\nneoplasms (lymphoma)"), DP("HIV, heroin, obesity,\ngenetic (nephrin, podocin)"), DP("Hep B, SLE, malignancy,\ngold, penicillamine"), DP("SLE, infections,\ncryoglobulins")],
    [DB("Key buzzword"), DP("'Normal glomerulus on LM'\nFoot process effacement on EM"), DP("'Focal segmental sclerosis'\nCollapsing variant = HIV"), DP("Anti-PLA₂R antibodies\nSubepithelial deposits"), DP("'Tram-track'\nDouble contour GBM")],
]

col_widths = [TW*0.14, TW*0.215, TW*0.19, TW*0.24, TW*0.215]
dis_tbl = Table(dis_data, colWidths=col_widths, repeatRows=1)
row_colors_nephrot = [C_MED_BLUE, C_LIGHT_TEAL, C_LIGHT_BLUE, C_LIGHT_BLUE,
                      C_LIGHT_BLUE, C_LIGHT_BLUE, C_LIGHT_BLUE, C_LIGHT_BLUE,
                      C_LIGHT_ORG, C_LIGHT_BLUE, C_LIGHT_BLUE, C_LIGHT_PURP]
dis_style = [
    ("BACKGROUND", (0, 0), (-1, 0), C_MED_BLUE),
    ("BACKGROUND", (0, 1), (0, -1), C_GREY_BG),
    ("FONTNAME",   (0, 0), (-1, 0), "Helvetica-Bold"),
    ("TEXTCOLOR",  (0, 0), (-1, 0), colors.white),
    ("GRID",       (0, 0), (-1,-1), 0.4, HexColor("#c8c8c8")),
    ("LINEBELOW",  (0, 0), (-1, 0), 1.0, C_DARK_BLUE),
    ("VALIGN",     (0, 0), (-1,-1), "TOP"),
    ("TOPPADDING", (0, 0), (-1,-1), 4),
    ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING",(0, 0), (-1,-1), 5),
    ("RIGHTPADDING",(0,0), (-1,-1), 5),
]
for i, bg in enumerate(row_colors_nephrot[1:], start=1):
    dis_style.append(("BACKGROUND", (1, i), (-1, i), bg))
dis_tbl.setStyle(TableStyle(dis_style))
story.append(dis_tbl)
story.append(Spacer(1, 0.4*cm))

# Complications
story.append(KeepTogether([
    Paragraph("COMPLICATIONS OF NEPHROTIC SYNDROME", S_H2),
    colour_box("", [
        "1. <b>Infections</b> – Loss of IgG + complement factors in urine → ↑ risk of Streptococcal, Pneumococcal, staphylococcal infections; spontaneous bacterial peritonitis",
        "2. <b>Thromboembolism</b> – Loss of antithrombin III, Proteins C & S + ↑ hepatic synthesis of clotting factors → hypercoagulable state → renal vein thrombosis, DVT, pulmonary embolism",
        "3. <b>Hyperlipidaemia + Atherosclerosis</b> – Chronic ↑ LDL increases CVD risk",
        "4. <b>Protein malnutrition</b> – Chronic protein loss; growth retardation in children",
        "5. <b>Vitamin D deficiency</b> – Loss of Vit-D binding protein → hypocalcaemia, secondary hyperparathyroidism",
        "6. <b>Drug toxicity</b> – Many drugs are albumin-bound; ↓ albumin = ↑ free drug levels",
        "7. <b>Acute Kidney Injury</b> – From hypovolaemia, sepsis, or renal vein thrombosis",
    ], bg=C_LIGHT_ORG, title_color=C_ACCENT_ORG)
]))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 3 – NEPHRITIC SYNDROME IN DEPTH
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("SECTION 3 – NEPHRITIC SYNDROME IN DEPTH", C_ACCENT_RED))
story.append(Spacer(1, 0.3*cm))

story.append(colour_box(
    "DEFINITION",
    ["Nephritic syndrome results from glomerular INFLAMMATION (proliferative GN), leading to haematuria, "
     "oliguria with azotemia, mild proteinuria, and hypertension.",
     "Cardinal features:  (1) Haematuria + RBC casts  •  (2) Oliguria / Azotemia (↓ GFR)  "
     "•  (3) Hypertension  •  (4) Mild–moderate proteinuria (<3.5 g/day)"],
    bg=C_LIGHT_RED, title_color=C_ACCENT_RED))
story.append(Spacer(1, 0.3*cm))

story.append(Paragraph("PATHOPHYSIOLOGY", S_H2))
story.append(Paragraph(
    "Immune complexes or anti-GBM antibodies deposit in the glomeruli → complement activation "
    "→ neutrophil/macrophage infiltration → <b>proliferation of mesangial and endothelial cells</b> "
    "→ capillary wall damage. This results in: (a) RBCs passing into urine (haematuria + RBC casts); "
    "(b) ↓ GFR → oliguria, azotemia, fluid retention; (c) fluid retention + ischaemia-driven renin release → hypertension.",
    S_BODY))
story.append(Spacer(1, 0.3*cm))

# Nephritic diseases table
story.append(Paragraph("PRIMARY DISEASES CAUSING NEPHRITIC SYNDROME", S_H2))

nit_data = [
    [Paragraph("Feature", dis_hdr),
     Paragraph("Post-Infectious GN\n(Post-Strep)", dis_hdr),
     Paragraph("RPGN\n(Crescentic GN)", dis_hdr),
     Paragraph("IgA Nephropathy\n(Berger's Disease)", dis_hdr),
     Paragraph("Alport Syndrome", dis_hdr)],
    [DB("Cause"), DP("Group A β-haemolytic\nStreptococcus (types 1,4,12)\nOther infections possible"), DP("Anti-GBM antibodies\n(Type I),\nImmune complexes (Type II),\nANCA-vasculitis (Type III)"), DP("Defective IgA glycosylation\n→ IgA deposits in mesangium"), DP("Mutation in type IV\ncollagen genes (COL4A3/4/5)")],
    [DB("Age"), DP("Children 6–10 yrs;\n1–4 wks post-infection"), DP("Any age; all types\npresent with rapid ↓ GFR"), DP("Children & young adults;\nmost common GN worldwide"), DP("Children; X-linked or\nautosomal recessive")],
    [DB("Latent period"), DP("Pharyngitis: 1–3 wks\nImpetigo: 3–6 wks"), DP("None – rapid"), DP("Concurrent with URTI"), DP("Genetic – progressive")],
    [DB("Light Microscopy"), DP("Diffuse hypercellularity;\nneutrophil infiltration;\n'lumpy bumpy' appearance"), DP("Parietal cell proliferation\nforming CRESCENTS\n(>50% glomeruli);\nfibrinoid necrosis, GBM breaks"), DP("Mesangial proliferation;\nfocal hypercellularity"), DP("GBM thinning +\nlamellation;\nfocal glomerulosclerosis")],
    [DB("Immunofluorescence"), DP("Granular IgG + C3\n(subepithelial 'humps')"), DP("Type I: Linear IgG\nType II: Granular IgG\nType III: Pauci-immune\n(negative / ANCA+)"), DP("Mesangial IgA\n(+ IgG, C3)\nDIAGNOSTIC"), DP("Negative\n(no immune deposits)")],
    [DB("Electron Microscopy"), DP("Large subepithelial\nelectron-dense humps\n(DIAGNOSTIC)"), DP("Fibrinoid necrosis;\nGBM rupture;\nfibrin in Bowman's space"), DP("Mesangial deposits\nof IgA"), DP("GBM thinning and\nlongitudinal splitting\n(basket-weave)")],
    [DB("Complement"), DP("↓ C3, ↓ CH50\n(Normal C4 in post-strep)"), DP("Type I: normal\nType II: ↓ C3\nType III: normal"), DP("Normal"), DP("Normal")],
    [DB("Key labs"), DP("↑ ASO titre;\n↑ anti-DNase B;\n↓ C3"), DP("Type I: Anti-GBM antibodies\n(Goodpasture's if lung+kidney)\nType III: ANCA (p-ANCA or\nc-ANCA)"), DP("↑ Serum IgA (50% cases);\nrecurrent haematuria\nwith URTI"), DP("Family history;\nhaematuria;\nsensorineural deafness;\nlens abnormalities")],
    [DB("Prognosis"), DP("Children: >95% recover\nAdults: worse prognosis,\nsome → CKD"), DP("POOR without treatment;\nrapid progression to ESKD;\nplasmapheresis + steroids"), DP("Mostly benign;\n~25–30% → ESKD over 25 yrs"), DP("Progressive → ESKD;\nno specific therapy")],
    [DB("Key buzzword"), DP("'Subepithelial humps'\nPost-strep latent period"), DP("'Crescents in >50% glomeruli'\nRapid ↓ GFR = RPGN"), DP("Mesangial IgA\nRecurrent haematuria\nafter throat infection"), DP("'Basket-weave' GBM\nAlport = deafness + eye\n+ haematuria")],
]
nit_col_w = [TW*0.13, TW*0.22, TW*0.22, TW*0.215, TW*0.215]
nit_tbl = Table(nit_data, colWidths=nit_col_w, repeatRows=1)
nit_style_list = [
    ("BACKGROUND", (0, 0), (-1, 0), C_ACCENT_RED),
    ("BACKGROUND", (0, 1), (0, -1), C_GREY_BG),
    ("FONTNAME",   (0, 0), (-1, 0), "Helvetica-Bold"),
    ("TEXTCOLOR",  (0, 0), (-1, 0), colors.white),
    ("GRID",       (0, 0), (-1,-1), 0.4, HexColor("#c8c8c8")),
    ("LINEBELOW",  (0, 0), (-1, 0), 1.0, C_ACCENT_RED),
    ("VALIGN",     (0, 0), (-1,-1), "TOP"),
    ("TOPPADDING", (0, 0), (-1,-1), 4),
    ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING",(0, 0), (-1,-1), 5),
    ("RIGHTPADDING",(0,0), (-1,-1), 5),
]
nit_row_bgs = [C_LIGHT_TEAL, C_LIGHT_RED, C_LIGHT_RED, C_LIGHT_RED,
               C_LIGHT_RED, C_LIGHT_RED, C_LIGHT_ORG, C_LIGHT_RED,
               C_LIGHT_RED, C_LIGHT_PURP]
for i, bg in enumerate(nit_row_bgs, start=1):
    nit_style_list.append(("BACKGROUND", (1, i), (-1, i), bg))
nit_tbl.setStyle(TableStyle(nit_style_list))
story.append(nit_tbl)
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 4 – QUICK REFERENCE TABLES
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("SECTION 4 – QUICK REFERENCE TABLES FOR EXAM", C_TEAL))
story.append(Spacer(1, 0.3*cm))

# --- Table 4a: Urine findings ---
story.append(Paragraph("4A. URINE FINDINGS AT A GLANCE", S_H2))
urine_data = [
    [Paragraph("Finding", dis_hdr), Paragraph("Nephrotic", dis_hdr), Paragraph("Nephritic", dis_hdr), Paragraph("Both", dis_hdr)],
    [DP("Proteinuria"), DP("Massive (>3.5 g/day)"), DP("Mild–moderate"), DP("Present")],
    [DP("Haematuria"), DP("Absent / trace"), DP("Prominent"), DP("–")],
    [DP("RBC casts"), DP("ABSENT"), DP("PRESENT (pathognomonic)"), DP("–")],
    [DP("Oval fat bodies"), DP("PRESENT"), DP("Absent"), DP("–")],
    [DP("Lipiduria"), DP("Present"), DP("Absent"), DP("–")],
    [DP("WBC / Granular casts"), DP("Absent"), DP("May be present"), DP("–")],
    [DP("Urine colour"), DP("Frothy / milky"), DP("Smoky / tea-coloured"), DP("–")],
]
urine_tbl = Table(urine_data, colWidths=[TW*0.27, TW*0.255, TW*0.255, TW*0.22], repeatRows=1)
urine_tbl.setStyle(TableStyle([
    ("BACKGROUND",    (0, 0), (-1, 0), C_TEAL),
    ("BACKGROUND",    (0, 1), (0, -1), C_GREY_BG),
    ("TEXTCOLOR",     (0, 0), (-1, 0), colors.white),
    ("FONTNAME",      (0, 0), (-1, 0), "Helvetica-Bold"),
    ("GRID",          (0, 0), (-1,-1), 0.5, HexColor("#c0c0c0")),
    ("VALIGN",        (0, 0), (-1,-1), "MIDDLE"),
    *[("BACKGROUND", (1, i), (-1, i), C_LIGHT_TEAL if i%2==0 else colors.white)
      for i in range(1, len(urine_data))],
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
]))
story.append(urine_tbl)
story.append(Spacer(1, 0.35*cm))

# --- Table 4b: Causes by age ---
story.append(Paragraph("4B. CAUSES BY AGE GROUP", S_H2))
age_data = [
    [Paragraph("Age Group", dis_hdr), Paragraph("Most Common Nephrotic", dis_hdr), Paragraph("Most Common Nephritic", dis_hdr)],
    [DP("Children (1–10 yrs)"), DP("Minimal Change Disease"), DP("Post-Streptococcal GN")],
    [DP("Young adults (10–30 yrs)"), DP("FSGS"), DP("IgA Nephropathy, RPGN")],
    [DP("Adults (30–60 yrs)"), DP("Membranous Nephropathy\n(White adults)\nFSGS (African ancestry)"), DP("Rapidly Progressive GN\n(ANCA-associated)")],
    [DP("Any age"), DP("FSGS (secondary)"), DP("Lupus nephritis, RPGN")],
    [DP("Elderly"), DP("Membranous Nephropathy\n(malignancy-associated)"), DP("ANCA-associated GN")],
]
age_tbl = Table(age_data, colWidths=[TW*0.22, TW*0.39, TW*0.39], repeatRows=1)
age_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), C_TEAL),
    ("TEXTCOLOR",  (0,0), (-1,0), colors.white),
    ("FONTNAME",   (0,0), (-1,0), "Helvetica-Bold"),
    ("BACKGROUND", (0,1), (0,-1), C_GREY_BG),
    ("GRID",       (0,0), (-1,-1), 0.5, HexColor("#c0c0c0")),
    *[("BACKGROUND", (1,i), (-1,i), C_LIGHT_TEAL if i%2==0 else colors.white)
      for i in range(1, len(age_data))],
    ("TOPPADDING",    (0,0),(-1,-1),5),
    ("BOTTOMPADDING", (0,0),(-1,-1),5),
    ("LEFTPADDING",   (0,0),(-1,-1),6),
    ("VALIGN",        (0,0),(-1,-1),"MIDDLE"),
]))
story.append(age_tbl)
story.append(Spacer(1, 0.35*cm))

# --- Table 4c: Complement levels ---
story.append(Paragraph("4C. COMPLEMENT LEVELS (HIGH-YIELD FOR EXAMS)", S_H2))
comp_data = [
    [Paragraph("Disease", dis_hdr), Paragraph("C3", dis_hdr), Paragraph("C4", dis_hdr), Paragraph("CH50", dis_hdr)],
    [DP("Post-Streptococcal GN"), DP("↓↓ LOW"), DP("Normal"), DP("↓ LOW")],
    [DP("SLE (Lupus nephritis)"), DP("↓ LOW"), DP("↓ LOW"), DP("↓ LOW")],
    [DP("MPGN"), DP("↓ LOW"), DP("Variable"), DP("↓ LOW")],
    [DP("Membranous Nephropathy"), DP("Normal"), DP("Normal"), DP("Normal")],
    [DP("Minimal Change Disease"), DP("Normal"), DP("Normal"), DP("Normal")],
    [DP("FSGS"), DP("Normal"), DP("Normal"), DP("Normal")],
    [DP("RPGN Type I (anti-GBM)"), DP("Normal"), DP("Normal"), DP("Normal")],
    [DP("RPGN Type III (ANCA)"), DP("Normal"), DP("Normal"), DP("Normal")],
]
comp_tbl = Table(comp_data, colWidths=[TW*0.43, TW*0.19, TW*0.19, TW*0.19], repeatRows=1)
comp_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), C_TEAL),
    ("TEXTCOLOR",  (0,0), (-1,0), colors.white),
    ("FONTNAME",   (0,0), (-1,0), "Helvetica-Bold"),
    ("GRID",       (0,0), (-1,-1), 0.5, HexColor("#c0c0c0")),
    ("BACKGROUND", (0,1), (0,-1), C_GREY_BG),
    *[("BACKGROUND", (1,i), (-1,i), C_LIGHT_TEAL if i%2==0 else colors.white)
      for i in range(1, len(comp_data))],
    # Low complement rows highlighting
    ("TEXTCOLOR", (1,1), (3,3), C_ACCENT_RED),
    ("FONTNAME",  (1,1), (3,3), "Helvetica-Bold"),
    ("TOPPADDING",    (0,0),(-1,-1),5),
    ("BOTTOMPADDING", (0,0),(-1,-1),5),
    ("LEFTPADDING",   (0,0),(-1,-1),6),
    ("VALIGN",        (0,0),(-1,-1),"MIDDLE"),
]))
story.append(comp_tbl)
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 5 – MNEMONICS + HIGH-YIELD EXAM POINTS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("SECTION 5 – MNEMONICS & HIGH-YIELD EXAM POINTS", C_PURPLE))
story.append(Spacer(1, 0.3*cm))

# Mnemonics boxes
mnem_data = [
    [colour_box("NEPHROTIC SYNDROME – Mnemonic: \"EPHALP\"",
        ["E – Edema (periorbital, dependent, anasarca)",
         "P – Proteinuria (>3.5 g/day, frothy urine)",
         "H – Hypoalbuminemia (<3 g/dL)",
         "A – Atherosclerosis risk (hyperlipidaemia)",
         "L – Lipiduria (oval fat bodies)",
         "P – Prone to infections (loss of Ig, complement)"],
        bg=C_LIGHT_BLUE, title_color=C_MED_BLUE, width=TW*0.48),
     colour_box("NEPHRITIC SYNDROME – Mnemonic: \"PHAROH\"",
        ["P – Proteinuria (mild, <3.5 g/day)",
         "H – Haematuria (smoky urine, RBC casts)",
         "A – Azotemia (↑ BUN, creatinine)",
         "R – RBC casts (pathognomonic)",
         "O – Oliguria (↓ urine output)",
         "H – Hypertension (fluid retention + renin↑)"],
        bg=C_LIGHT_RED, title_color=C_ACCENT_RED, width=TW*0.48)],
]
mnem_tbl = Table(mnem_data, colWidths=[TW*0.5, TW*0.5])
mnem_tbl.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),(0,-1), 6),
    ("LEFTPADDING",   (1,0),(1,-1), 6),
]))
story.append(mnem_tbl)
story.append(Spacer(1, 0.4*cm))

# High yield one-liners
story.append(Paragraph("HIGH-YIELD ONE-LINERS (Exam Favourites)", S_H2))

hy_items = [
    ("MCD – 'Normal glomerulus on LM'",
     "Only EM shows diffuse foot process effacement. LM is completely normal. Selective proteinuria (albumin only). Responds to steroids >90%."),
    ("FSGS – Most common glomerular cause of ESKD (USA)",
     "Focal = some glomeruli affected. Segmental = part of each affected glomerulus. Anti-PLA2R is NOT FSGS – that's Membranous! Collapsing variant = HIV."),
    ("Membranous Nephropathy – Anti-PLA2R antibodies",
     "70-80% of primary cases. Silver stain shows 'spike and dome'. Subepithelial deposits on EM. Granular IgG on IF along GBM."),
    ("Post-Strep GN – Latent period is key",
     "Pharyngitis: 1-3 weeks. Impetigo: 3-6 weeks. Subepithelial 'humps' on EM. ↓ C3, normal C4. ASO titre elevated. >95% children recover."),
    ("RPGN – Crescents = poor prognosis",
     ">50% glomeruli have crescents. Type I = anti-GBM (Goodpasture if lung involved). Type III = pauci-immune (ANCA+). Treat with plasmapheresis."),
    ("IgA Nephropathy – Most common GN worldwide",
     "Berger's disease. Mesangial IgA deposits (diagnostic on IF). Haematuria 24-48 hrs after URTI (synpharyngitic). Normal complement."),
    ("Complement clue for exams",
     "Only Post-Strep GN, SLE, and MPGN have LOW C3. All other GN diseases have NORMAL complement."),
    ("Diabetic Nephropathy",
     "Most common cause of CKD overall (USA). Kimmelstiel-Wilson nodules (nodular glomerulosclerosis). Diffuse GBM thickening. Can cause both nephrotic and nephritic features."),
]

for title, body in hy_items:
    hy_tbl = Table([[
        Paragraph(f"★  {title}", style("hyt",
            fontName="Helvetica-Bold", fontSize=9.5, textColor=C_DARK_BLUE, leading=13)),
        Paragraph(body, style("hyb",
            fontName="Helvetica", fontSize=9, textColor=C_DARK_TEXT, leading=12))
    ]], colWidths=[TW*0.37, TW*0.63])
    hy_tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (0,0), C_LIGHT_BLUE),
        ("BACKGROUND",    (1,0), (1,0), HexColor("#f8fcff")),
        ("BOX",           (0,0), (-1,-1), 0.6, C_MED_BLUE),
        ("LINEAFTER",     (0,0), (0,-1), 0.6, C_MED_BLUE),
        ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
        ("TOPPADDING",    (0,0), (-1,-1), 7),
        ("BOTTOMPADDING", (0,0), (-1,-1), 7),
        ("LEFTPADDING",   (0,0), (-1,-1), 8),
        ("RIGHTPADDING",  (0,0), (-1,-1), 8),
    ]))
    story.append(hy_tbl)
    story.append(Spacer(1, 0.18*cm))

story.append(Spacer(1, 0.3*cm))

# Exam writing tip box
story.append(colour_box(
    "EXAM WRITING TIPS FOR PATHOLOGY ANSWERS",
    ["1. Always START with a clear definition (1-2 lines).",
     "2. For each disease follow the sequence:  Pathogenesis → LM → IF → EM → Clinical Features → Prognosis",
     "3. Draw the pathophysiology chain as a flow diagram – earns extra marks.",
     "4. Include a COMPARISON TABLE at the end – shows breadth and saves time.",
     "5. Mention STEROID RESPONSE for each nephrotic disease – frequently asked.",
     "6. For nephritic syndrome, always mention COMPLEMENT LEVELS.",
     "7. RBC CASTS = nephritic. OVAL FAT BODIES = nephrotic. Learn these urine findings cold.",
     "8. 'Foot process effacement on EM' is shared by MCD, FSGS, and Membranous – don't use it as a distinguishing feature alone.",
    ], bg=C_LIGHT_GREEN, title_color=C_GREEN))

story.append(Spacer(1, 0.5*cm))
story.append(HRFlowable(width=TW, thickness=0.5, color=colors.grey))
story.append(Spacer(1, 0.15*cm))
story.append(Paragraph(
    "Pathology Study Guide: Nephrotic vs Nephritic Syndrome  •  "
    "Source: Robbins &amp; Cotran Pathologic Basis of Disease | Robbins &amp; Kumar Basic Pathology  •  "
    "Orris Medical AI  •  July 2026",
    S_FOOTER))

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

cd /home/daytona/workspace/nephro-study-guide && python generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/nephro-study-guide/

Your PDF study guide is ready! Download it here:

Nephrotic vs Nephritic Study Guide

PDF Document · PDF


Here's what's inside the 5-section guide (25 KB, sourced from Robbins & Cotran + Robbins & Kumar Basic Pathology):

Section 1 - Master Comparison Table

A side-by-side colour-coded table comparing every key feature: proteinuria levels, hematuria, edema, hypertension, oliguria, serum albumin, cholesterol, RBC casts, complement levels, glomerular pattern, and mnemonics.

Section 2 - Nephrotic Syndrome In Depth

  • Pathophysiology chain (step-by-step flow table)
  • Full disease comparison table: MCD vs FSGS vs Membranous Nephropathy vs MPGN - covering LM, IF, EM, pathogenesis, steroid response, prognosis
  • Complications table (infections, thromboembolism, Vit D loss, drug toxicity, etc.)

Section 3 - Nephritic Syndrome In Depth

  • Pathophysiology explanation
  • Disease table: Post-Strep GN vs RPGN vs IgA Nephropathy vs Alport Syndrome - with latent periods, complement, key labs, prognosis

Section 4 - Quick Reference Tables

  • Urine findings (oval fat bodies vs RBC casts at a glance)
  • Causes by age group
  • Complement levels (which diseases lower C3/C4 - high-yield exam trap)

Section 5 - Mnemonics & High-Yield Points

  • "EPHALP" for Nephrotic, "PHAROH" for Nephritic
  • 8 high-yield one-liners (anti-PLA2R, collapsing FSGS, post-strep latent period, etc.)
  • Exam writing tips for pathology answer structure
This is a shared conversation. Sign in to Orris to start your own chat.