Why GFR dec in neohritic syndrome and what is azotemia
"Glomerular diseases that present with the nephritic syndrome are usually associated with significant inflammation in the glomeruli, which damages capillary walls, leading to leakage of red cells (hematuria), and decreased GFR, which results in oliguria and azotemia."
- Robbins & Kumar Basic Pathology, p. 2297
Elevation of blood urea nitrogen (BUN) and serum creatinine levels, due largely to a decreased GFR.
| Type | Cause |
|---|---|
| Prerenal | Hypoperfusion of kidneys (hypotension, shock, dehydration, heart failure) - no parenchymal damage |
| Renal (intrinsic) | Direct glomerular, tubular, interstitial, or vascular damage |
| Postrenal | Obstruction of urine outflow distal to the kidney; corrects when obstruction is relieved |
| Term | Definition |
|---|---|
| Azotemia | Purely a lab finding - elevated BUN and creatinine |
| Uremia | Azotemia that is severe enough to cause clinical symptoms |
So why azotemia and proteinuria occurs
"Azotemia is a biochemical abnormality that refers to an elevation of blood urea nitrogen (BUN) and creatinine levels, related largely to a decreased GFR."
- Robbins, Cotran & Kumar - Pathologic Basis of Disease
| Layer | Role in keeping proteins out |
|---|---|
| Fenestrated endothelial cells (covered by glycocalyx) | Glycocalyx is negatively charged - electrically repels albumin (also negatively charged), preventing it from even reaching the GBM |
| Glomerular Basement Membrane (GBM) | Contains heparan sulfate proteoglycans (negative charge) + collagen type IV mesh - acts as a size and charge barrier |
| Podocyte foot processes + slit diaphragm (nephrin protein) | Final size-selective barrier; slit diaphragm is only 20-30 nm wide - too narrow for albumin (radius ~3.6 nm) to pass in significant amounts |
"The normal glomerulus is highly permeable to water and small solutes... and is impermeable to proteins of the size of albumin (~3.6-nm radius; 70 kDa) or larger."
- Robbins, Cotran & Kumar - Pathologic Basis of Disease
"Glomerular diseases are characterized by breaks in the glomerular capillary wall, thereby leading to hematuria with proteinuria because of loss of the selective barrier to particles based on size and charge."
- Goldman-Cecil Medicine
| Feature | Mechanism | Result |
|---|---|---|
| Azotemia | Glomerular inflammation → ↓GFR → urea & creatinine not filtered | Elevated BUN + creatinine in blood |
| Proteinuria | Capillary wall damage → loss of size & charge selectivity of filtration barrier | Protein leaks into urine (subnephrotic range) |
| Hematuria | Same capillary wall damage → RBCs squeeze through | RBCs and RBC casts in urine |
| Hypertension | ↓GFR → Na & water retention → RAAS activation | Raised BP |
| Oliguria | ↓GFR → less filtrate formed | Reduced urine output |
I cant get 3rd immunoflorrnce of IgA nephropathy

| Immunoreactant | Presence |
|---|---|
| IgA | Dominant / codominant (MUST be present for diagnosis) |
| C3 | Often present (alternative pathway activation) |
| Properdin | Often present (confirms alternative pathway) |
| IgG or IgM | Smaller amounts, may be present |
| C1q / C4 (classical pathway) | Usually ABSENT |
"The characteristic immunofluorescence picture is of mesangial deposition of IgA, often with C3 and the alternative pathway protein properdin and smaller amounts of IgG or IgM. Early components of the classical complement pathway are usually absent."
- Robbins & Kumar Basic Pathology, p. 2405
| Disease | IF Pattern | Location of deposits |
|---|---|---|
| IgA nephropathy | IgA dominant + C3 (alternative pathway) | Mesangium |
| PSGN | IgG + C3 (granular "starry sky") | Subepithelial + mesangial |
| Lupus nephritis | "Full house" (IgG, IgA, IgM, C3, C1q) | Mesangial + subendothelial + subepithelial |
I cant get anything
What exactly are you struggling to understand about IgA nephropathy?

Normal glomerulus cross-section:
Capillary wall (GBM)
/
[Bowman's space] -- [Capillary loops] -- [Mesangium in the middle]
↑
THIS is where IgA deposits sit
| Disease | Where it glows on IF | Pattern |
|---|---|---|
| IgA nephropathy | Mesangium (center of tuft) | Granular, central |
| PSGN | Capillary walls + mesangium | "Starry sky" all over |
| Goodpasture | Along entire GBM | Smooth linear line |
| Membranous GN | Outer capillary wall (subepithelial) | Granular, peripheral |
IgA = "I go to the mesAngium"
| Stain | Result |
|---|---|
| Anti-IgA | Bright green (dominant) |
| Anti-C3 | Often positive |
| Anti-IgG | Faint / minor |
| Anti-C1q | NEGATIVE (important!) |
Test me using nephrotic and nephritic syndrome from FA according to uworld and nbme
USMLE UWorld NBME high yield nephrotic nephritic syndrome tested concepts
C D B B A B C B B B
Key: Normal LM + Normal IF + Abnormal EM (foot process effacement) = MCD
Key FSGS associations to memorize:
- HIV → collapsing FSGS
- Heroin, sickle cell, obesity → secondary FSGS
- Idiopathic → most common in Black adults
EM buzzword: "spike and dome" appearance - spikes of GBM material projecting between subepithelial deposits.
LM: hypercellular glomeruli with neutrophils EM: subepithelial "humps" (pathognomonic)
Exam tip: Normal C3 + mesangial IgA + recurrent hematuria with URTI = IgA nephropathy. Low C3 = think PSGN, lupus, MPGN.
The question stem gave you secondary membranous (gold therapy) but asked specifically about the idiopathic form's antibody = anti-PLA2R.
The single most important distinguishing feature of nephritic vs nephrotic: RBC casts = nephritic. Massive proteinuria >3.5g + no hematuria = nephrotic.
This is Type II HSR (cytotoxic). The antibody is anti-GBM (anti-α3 chain of type IV collagen). Distinguish from Granulomatosis with polyangiitis (Wegener): also hemoptysis + hematuria, but pauci-immune IF (no deposits) + c-ANCA/PR3-ANCA positive.
Full list of proteins lost in nephrotic syndrome to know:
- Albumin → edema, hypoalbuminemia
- Antithrombin III → thrombosis (renal vein, DVT, PE)
- IgG → infections (encapsulated bacteria - pneumococcus)
- Thyroxine-binding globulin → hypothyroidism (low T4 but normal TSH)
- Transferrin → microcytic anemia
- Complement (factor B/D) → infections
| Q | Topic | You | Answer | Result |
|---|---|---|---|---|
| 1 | MCD - EM finding | C | C | ✅ |
| 2 | FSGS - cell injured | D | D | ✅ |
| 3 | Membranous nephropathy | B | B | ✅ |
| 4 | PSGN - IF pattern | B | B | ✅ |
| 5 | IgA - complement pathway | A | B | ❌ |
| 6 | Membranous - antibody target | B | C | ❌ |
| 7 | MCD - steroid response | C | C | ✅ |
| 8 | Nephritic vs nephrotic | B | B | ✅ |
| 9 | Goodpasture - lung finding | B | B | ✅ |
| 10 | Nephrotic complication | B | B | ✅ |
Create a PDF quick reference card comparing all glomerular diseases
mkdir -p /home/daytona/workspace/glomerular-ref && ls /home/daytona/workspace/
~/glomerular-ref/build_pdf.py
from reportlab.lib.pagesizes import A4, landscape
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.platypus import (
SimpleDocTemplate, Table, TableStyle, Paragraph, Spacer,
HRFlowable, KeepTogether
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT
from reportlab.platypus import PageBreak
OUTPUT = "/home/daytona/workspace/glomerular-ref/Glomerular_Diseases_Quick_Reference.pdf"
# ── Colour palette ──────────────────────────────────────────────
C_HEADER_BG = colors.HexColor("#1a3a5c") # dark navy
C_NEPHROTIC = colors.HexColor("#1565C0") # blue
C_NEPHRITIC = colors.HexColor("#B71C1C") # red
C_BOTH = colors.HexColor("#4A148C") # purple
C_ROW_ALT = colors.HexColor("#F0F4FF") # very light blue
C_ROW_ALT2 = colors.HexColor("#FFF3F3") # very light red
C_ROW_WHITE = colors.white
C_ACCENT = colors.HexColor("#FF6F00") # amber for key facts
C_LIGHT_NAVY = colors.HexColor("#E8EFF8")
C_GREEN_LIGHT = colors.HexColor("#E8F5E9")
C_SUBHEADER = colors.HexColor("#37474F") # dark grey
styles = getSampleStyleSheet()
def style(name="Normal", size=8, color=colors.black, bold=False,
align=TA_LEFT, leading=10):
return ParagraphStyle(
name, parent=styles["Normal"],
fontSize=size, textColor=color,
fontName="Helvetica-Bold" if bold else "Helvetica",
alignment=align, leading=leading, spaceAfter=0
)
TITLE_S = style("Title", size=18, color=colors.white, bold=True, align=TA_CENTER, leading=22)
SUB_S = style("Sub", size=10, color=colors.HexColor("#CFD8DC"), align=TA_CENTER, leading=13)
H2_S = style("H2", size=11, color=C_HEADER_BG, bold=True, leading=14)
CELL_S = style("Cell", size=7.5, leading=10)
CELL_B = style("CellB", size=7.5, bold=True, leading=10)
CELL_SM = style("CellSM", size=7, leading=9.5)
NEP_S = style("Nep", size=8, color=C_NEPHROTIC, bold=True, align=TA_CENTER, leading=10)
NIT_S = style("Nit", size=8, color=C_NEPHRITIC, bold=True, align=TA_CENTER, leading=10)
BOTH_S = style("Both", size=8, color=C_BOTH, bold=True, align=TA_CENTER, leading=10)
KEY_S = style("Key", size=7, color=C_ACCENT, bold=True, leading=9)
FOOT_S = style("Foot", size=6.5,color=C_SUBHEADER, leading=9)
def P(txt, s=None):
if s is None: s = CELL_S
return Paragraph(txt, s)
def bold(txt):
return f"<b>{txt}</b>"
def col(txt, c):
hex_c = c.hexval() if hasattr(c, 'hexval') else c
return f'<font color="{hex_c}">{txt}</font>'
# ── Disease data ─────────────────────────────────────────────────
# Columns: Disease | Syndrome | Age/Pop | LM | IF | EM | Clinical | Key Fact
NEPHROTIC_COLOR = "#1565C0"
NEPHRITIC_COLOR = "#B71C1C"
BOTH_COLOR = "#4A148C"
diseases = [
# ── NEPHROTIC ─────────────────────────────────────────────
{
"name": "Minimal Change\nDisease (MCD)",
"syndrome": ("NEPHROTIC", C_NEPHROTIC),
"pop": "Children\n(#1 cause)\nAdults: Hodgkin\nlymphoma, NSAIDs",
"lm": "NORMAL\n(no changes visible)",
"IF": "NEGATIVE\n(no deposits)",
"em": "Diffuse effacement\nof podocyte\nfoot processes",
"clinical": "Massive proteinuria\n>3.5g/day\nEdema\nHypoalbuminemia\nNormal complement",
"key": "★ Responds to\nsteroids (80-90%)\n★ No hematuria",
"row_color": C_ROW_ALT,
},
{
"name": "Focal Segmental\nGlomerulosclerosis\n(FSGS)",
"syndrome": ("NEPHROTIC", C_NEPHROTIC),
"pop": "Adults\n(#1 primary\nnephrotic in\nBlack adults)\nHIV, heroin,\nobesity, sickle cell",
"lm": "FOCAL (some\nglomeruli) &\nSEGMENTAL\n(part of tuft)\nsclerosis/hyalinosis",
"IF": "IgM + C3\n(nonspecific,\nin sclerotic areas)",
"em": "Effacement of\nfoot processes\n(focal/segmental)",
"clinical": "Nephrotic syndrome\nHypertension\nSteroid-RESISTANT\nProgresses to ESRD",
"key": "★ HIV → Collapsing\nvariant (worst)\n★ Most common\nnephrotic in adults",
"row_color": C_ROW_WHITE,
},
{
"name": "Membranous\nNephropathy",
"syndrome": ("NEPHROTIC", C_NEPHROTIC),
"pop": "Adults 30-50y\n(#1 primary\nnephrotic in\nwhite adults)\nHep B/C, SLE,\nmalignancy, gold",
"lm": "Thickened GBM\n'Spike & dome'\non silver stain\n(GBM spikes between\nsubepithelial deposits)",
"IF": "Granular IgG + C3\nalong GBM\n(peripheral/\nsubepithelial)",
"em": "Subepithelial\nelectron-dense\ndeposits",
"clinical": "Nephrotic syndrome\nRenal vein thrombosis\n(highest risk of all\nnephrotic diseases)",
"key": "★ Anti-PLA2R Ab\n(idiopathic form)\n★ 'Spike & dome'\non EM/silver stain",
"row_color": C_ROW_ALT,
},
{
"name": "Membrano-\nproliferative GN\n(MPGN)",
"syndrome": ("NEPHROTIC\nor NEPHRITIC", C_BOTH),
"pop": "Young adults\nHep C (Type I)\nC3 glomerulopathy\n(Type II)",
"lm": "'Tram-track'\n(double contour\nof GBM)\nMesangial\nproliferation",
"IF": "Type I: IgG+C3\n(subendothelial)\nType II: C3 only\n(intramembranous)",
"em": "Type I: Subendothelial\ndeposits\nType II: Dense\ndeposits (ribbon-like\nin GBM)",
"clinical": "Nephrotic OR\nnephritic features\nLow C3 (both types)\nLow C4 (Type I only)",
"key": "★ 'Tram-track' = MPGN\n★ Type II = C3\nNephritic Factor\n(stabilizes C3\nconvertase)",
"row_color": C_ROW_WHITE,
},
# ── NEPHRITIC ─────────────────────────────────────────────
{
"name": "Post-Streptococcal\nGN (PSGN)",
"syndrome": ("NEPHRITIC", C_NEPHRITIC),
"pop": "Children 2-14y\n2-3 wks after\nthroat infection\n(6 wks after skin)",
"lm": "Diffuse hypercellular\nglomeruli\nNeutrophil\ninfiltration\n'Lumpy bumpy'",
"IF": "Granular IgG + C3\n'Starry sky'\nsubepithelial +\nmesangial",
"em": "Subepithelial\n'HUMPS'\n(pathognomonic)",
"clinical": "Hematuria (tea-colored)\nRBC casts\nOliguria, azotemia\nHTN\nLOW C3, LOW C4\nElevated ASO titer",
"key": "★ Subepithelial\n'humps' on EM\n★ Self-limiting\nin children\n★ Low C3",
"row_color": C_ROW_ALT2,
},
{
"name": "IgA Nephropathy\n(Berger Disease)",
"syndrome": ("NEPHRITIC", C_NEPHRITIC),
"pop": "Young adults\n(#1 GN worldwide)\nAsian > others\nRecurrent after\nURTI",
"lm": "Mesangial\nproliferation and\nmatrix increase\n(focal or diffuse)",
"IF": "Mesangial IgA\n(dominant)\n± C3, IgG, IgM\nNO C1q\n(alternative pathway)",
"em": "Mesangial electron-\ndense deposits",
"clinical": "Gross hematuria\ncoinciding with URTI\n(synpharyngitic)\nNORMAL complement\nSubnephrotic proteinuria",
"key": "★ Normal C3\n(unlike PSGN)\n★ NO C1q on IF\n★ Alternative\ncomplement pathway",
"row_color": C_ROW_WHITE,
},
{
"name": "Goodpasture\nSyndrome",
"syndrome": ("NEPHRITIC\n(RPGN)", C_NEPHRITIC),
"pop": "Young men\n20-30y (HLA-DR2)\nOlder men 60-70y\nSmoking triggers\npulmonary disease",
"lm": "Crescentic GN\n(crescents in\nBowman's space)\nFibrinoid necrosis",
"IF": "LINEAR IgG\nalong GBM\n(smooth, ribbon-like)\n± C3",
"em": "No immune deposits\n(antibody-mediated,\nnot immune complex)",
"clinical": "Hemoptysis +\nHematuria\nRapid GFR decline\nAnti-GBM antibodies\n(anti-α3 collagen IV)",
"key": "★ LINEAR IF\n(only disease)\n★ Anti-GBM Ab\n★ Pulmonary\nhemorrhage\n★ Type II HSR",
"row_color": C_ROW_ALT2,
},
{
"name": "Pauci-Immune\nRPGN (ANCA-GN)",
"syndrome": ("NEPHRITIC\n(RPGN)", C_NEPHRITIC),
"pop": "Adults 50-70y\nGPA (Wegener's)\nMPA\nEosinophilic GPA\n(Churg-Strauss)",
"lm": "Crescentic GN\nFibrinoid necrosis\nNo immune deposits",
"IF": "NEGATIVE / PAUCI-\nIMMUNE\n(no/scanty deposits)\nKey distinguishing\nfeature",
"em": "No electron-dense\nimmune deposits",
"clinical": "Rapid GFR decline\n± hemoptysis (GPA/MPA)\nGPA: c-ANCA/PR3-ANCA\nsinusitis, lung nodules\nMPA: p-ANCA/MPO-ANCA",
"key": "★ NEGATIVE IF\n(pauci-immune)\n★ GPA: c-ANCA\n(PR3)\n★ MPA: p-ANCA\n(MPO)",
"row_color": C_ROW_WHITE,
},
{
"name": "Lupus Nephritis\n(Diffuse, Class IV)",
"syndrome": ("NEPHRITIC or\nNEPHROTIC", C_BOTH),
"pop": "Women 20-40y\nSLE\n(most common\ncause of death\nin SLE)",
"lm": "'Wire-loop'\nlesions\n(subendothelial\ndeposits)\nDiffuse proliferative",
"IF": "'FULL HOUSE'\nIgG + IgA + IgM\n+ C3 + C1q\n(all positive = SLE)",
"em": "Subendothelial +\nmesangial +\nsubepithelial deposits\n('fingerprint' pattern)",
"clinical": "Any nephritic/\nnephrotic features\nLow C3 AND C4\nAnti-dsDNA, ANA +\nLow platelets, rash",
"key": "★ 'Full house' IF\n★ 'Wire-loop' LM\n★ LOW C3 + C4\n(classical pathway)\n★ Anti-dsDNA",
"row_color": C_ROW_ALT,
},
{
"name": "Alport Syndrome",
"syndrome": ("NEPHRITIC", C_NEPHRITIC),
"pop": "Males (X-linked)\nMutation in\nCOL4A5 gene\n(α5 chain type\nIV collagen)",
"lm": "Variable; may be\nnormal early\nFocal GN later",
"IF": "Negative\n(no immune deposits)\nAnti-GBM staining\nABSENT",
"em": "GBM thinning AND\nthickening with\nsplitting/lamellation\n('basket-weave'\nappearance)",
"clinical": "Hematuria (from\nchildhood)\nSensorineural\nhearing loss\nOcular defects\n(lens dislocation)",
"key": "★ 'Basket-weave'\nGBM on EM\n★ Triad: hematuria\n+ deafness\n+ eye defects",
"row_color": C_ROW_ALT2,
},
]
def build_disease_table(doc_width):
col_widths = [2.8*cm, 1.8*cm, 2.4*cm, 2.8*cm, 2.8*cm, 2.8*cm, 3.0*cm, 2.4*cm]
header = [
P(bold("Disease"), CELL_B),
P(bold("Syndrome"), CELL_B),
P(bold("Population /\nAssociations"), CELL_B),
P(bold("Light Microscopy\n(LM)"), CELL_B),
P(bold("Immunofluorescence\n(IF)"), CELL_B),
P(bold("Electron\nMicroscopy (EM)"), CELL_B),
P(bold("Clinical Features"), CELL_B),
P(bold("★ Key USMLE\nFacts"), CELL_B),
]
rows = [header]
for i, d in enumerate(diseases):
syn_text, syn_color = d["syndrome"]
syn_style = ParagraphStyle(
f"syn{i}", parent=styles["Normal"],
fontSize=7.5, textColor=syn_color,
fontName="Helvetica-Bold", alignment=TA_CENTER, leading=10
)
key_style = ParagraphStyle(
f"key{i}", parent=styles["Normal"],
fontSize=7, textColor=C_ACCENT,
fontName="Helvetica-Bold", alignment=TA_LEFT, leading=9.5
)
row = [
P(bold(d["name"].replace("\n","<br/>")), CELL_B),
Paragraph(syn_text.replace("\n","<br/>"), syn_style),
P(d["pop"].replace("\n","<br/>"), CELL_SM),
P(d["lm"].replace("\n","<br/>"), CELL_SM),
P(d["IF"].replace("\n","<br/>"), CELL_SM),
P(d["em"].replace("\n","<br/>"), CELL_SM),
P(d["clinical"].replace("\n","<br/>"), CELL_SM),
Paragraph(d["key"].replace("\n","<br/>"), key_style),
]
rows.append(row)
tbl = Table(rows, colWidths=col_widths, repeatRows=1)
ts = TableStyle([
# Header row
("BACKGROUND", (0,0), (-1,0), C_HEADER_BG),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,0), 8),
("ROWBACKGROUND", (0,0), (-1,0), C_HEADER_BG),
# Borders
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#B0BEC5")),
("BOX", (0,0), (-1,-1), 1, C_HEADER_BG),
# Vertical alignment
("VALIGN", (0,0), (-1,-1), "TOP"),
# Row padding
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 4),
("RIGHTPADDING", (0,0), (-1,-1), 4),
# Alternate row colors
("ROWBACKGROUND", (0,1), (-1,1), colors.HexColor("#EBF5FB")),
("ROWBACKGROUND", (0,2), (-1,2), colors.white),
("ROWBACKGROUND", (0,3), (-1,3), colors.HexColor("#EBF5FB")),
("ROWBACKGROUND", (0,4), (-1,4), colors.white),
("ROWBACKGROUND", (0,5), (-1,5), colors.HexColor("#FDEDEC")),
("ROWBACKGROUND", (0,6), (-1,6), colors.white),
("ROWBACKGROUND", (0,7), (-1,7), colors.HexColor("#FDEDEC")),
("ROWBACKGROUND", (0,8), (-1,8), colors.white),
("ROWBACKGROUND", (0,9), (-1,9), colors.HexColor("#EDE7F6")),
("ROWBACKGROUND", (0,10),(-1,10), colors.HexColor("#FDEDEC")),
# Syndrome column alignment center
("ALIGN", (1,0), (1,-1), "CENTER"),
])
tbl.setStyle(ts)
return tbl
# ── Complement / IF quick-reference mini-table ───────────────────
def build_complement_table():
headers = ["Disease", "C3", "C4", "C1q on IF", "IF Pattern", "Complement Pathway"]
data = [
["MCD", "Normal", "Normal", "–", "Negative", "None"],
["FSGS", "Normal", "Normal", "–", "IgM+C3 (focal)", "None (nonspecific)"],
["Membranous", "Normal", "Normal", "–", "Granular IgG+C3", "Alternative"],
["PSGN", "LOW ↓", "LOW ↓", "–", "Granular IgG+C3", "Classical"],
["IgA Nephropathy", "Normal", "Normal", "–", "Mesangial IgA", "Alternative/Lectin"],
["MPGN Type I", "LOW ↓", "LOW ↓", "±", "IgG+C3", "Classical"],
["MPGN Type II", "LOW ↓", "Normal", "–", "C3 only", "Alternative"],
["Goodpasture", "Normal", "Normal", "–", "LINEAR IgG", "None (anti-GBM Ab)"],
["Pauci-immune RPGN","Normal", "Normal", "–", "NEGATIVE", "None (ANCA)"],
["Lupus (Class IV)", "LOW ↓", "LOW ↓", "+++", "Full house", "Classical (C1q++)"],
]
col_w = [3.5*cm, 1.5*cm, 1.5*cm, 1.8*cm, 3.5*cm, 4.5*cm]
rows = [[P(bold(h), CELL_B) for h in headers]]
for i, row in enumerate(data):
styled = []
for j, cell in enumerate(row):
if "LOW" in cell or "↓" in cell:
s = ParagraphStyle(f"r{i}{j}", parent=styles["Normal"],
fontSize=7.5, textColor=C_NEPHRITIC,
fontName="Helvetica-Bold", leading=10)
elif cell in ("Normal",):
s = ParagraphStyle(f"r{i}{j}", parent=styles["Normal"],
fontSize=7.5, textColor=colors.HexColor("#2E7D32"),
fontName="Helvetica-Bold", leading=10)
elif "Full house" in cell or "LINEAR" in cell or "NEGATIVE" in cell:
s = ParagraphStyle(f"r{i}{j}", parent=styles["Normal"],
fontSize=7.5, textColor=C_BOTH,
fontName="Helvetica-Bold", leading=10)
else:
s = CELL_SM
styled.append(Paragraph(cell.replace("\n","<br/>"), s))
rows.append(styled)
tbl = Table(rows, colWidths=col_w, repeatRows=1)
ts = TableStyle([
("BACKGROUND", (0,0), (-1,0), C_HEADER_BG),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#B0BEC5")),
("BOX", (0,0), (-1,-1), 1, C_HEADER_BG),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("TOPPADDING", (0,0), (-1,-1), 3),
("BOTTOMPADDING",(0,0),(-1,-1), 3),
("LEFTPADDING", (0,0), (-1,-1), 4),
("RIGHTPADDING",(0,0), (-1,-1), 4),
("ROWBACKGROUND",(0,1),(-1,4), colors.HexColor("#EBF5FB")),
("ROWBACKGROUND",(0,5),(-1,5), colors.white),
("ROWBACKGROUND",(0,6),(-1,7), colors.HexColor("#FDEDEC")),
("ROWBACKGROUND",(0,8),(-1,9), colors.HexColor("#EDE7F6")),
("ROWBACKGROUND",(0,10),(-1,10),colors.HexColor("#FDEDEC")),
])
tbl.setStyle(ts)
return tbl
# ── Header banner ─────────────────────────────────────────────────
def header_banner(canvas, doc):
canvas.saveState()
w, h = landscape(A4)
banner_h = 2.4*cm
canvas.setFillColor(C_HEADER_BG)
canvas.rect(0, h - banner_h, w, banner_h, fill=1, stroke=0)
canvas.setFont("Helvetica-Bold", 20)
canvas.setFillColor(colors.white)
canvas.drawCentredString(w/2, h - 1.55*cm, "GLOMERULAR DISEASES — QUICK REFERENCE CARD")
canvas.setFont("Helvetica", 9)
canvas.setFillColor(colors.HexColor("#90CAF9"))
canvas.drawCentredString(w/2, h - 2.1*cm,
"Nephrotic Syndrome | Nephritic Syndrome | Light Microscopy | Immunofluorescence | Electron Microscopy | Key USMLE Facts")
# Footer
canvas.setFont("Helvetica", 7)
canvas.setFillColor(C_SUBHEADER)
canvas.drawString(1*cm, 0.5*cm, "Sources: Robbins Pathology | Goldman-Cecil Medicine | Comprehensive Clinical Nephrology | NKF Primer")
canvas.drawRightString(w - 1*cm, 0.5*cm, f"Page {doc.page}")
# Legend bar
legend_y = 0.9*cm
canvas.setFont("Helvetica-Bold", 7.5)
canvas.setFillColor(C_NEPHROTIC)
canvas.drawString(1*cm, legend_y, "■ NEPHROTIC")
canvas.setFillColor(C_NEPHRITIC)
canvas.drawString(4.5*cm, legend_y, "■ NEPHRITIC")
canvas.setFillColor(C_BOTH)
canvas.drawString(8*cm, legend_y, "■ BOTH / RPGN")
canvas.setFillColor(C_ACCENT)
canvas.drawString(13*cm, legend_y, "★ = High-yield USMLE/NBME fact")
canvas.restoreState()
# ── Build document ────────────────────────────────────────────────
def build():
doc = SimpleDocTemplate(
OUTPUT,
pagesize=landscape(A4),
leftMargin=1*cm, rightMargin=1*cm,
topMargin=2.9*cm, bottomMargin=1.5*cm,
)
w = landscape(A4)[0] - 2*cm
story = []
# Main disease table
story.append(build_disease_table(w))
story.append(Spacer(1, 0.5*cm))
# Section divider
story.append(HRFlowable(width="100%", thickness=1, color=C_HEADER_BG))
story.append(Spacer(1, 0.15*cm))
story.append(P(bold("COMPLEMENT LEVELS & IMMUNOFLUORESCENCE QUICK REFERENCE"), H2_S))
story.append(Spacer(1, 0.2*cm))
story.append(build_complement_table())
story.append(Spacer(1, 0.3*cm))
# Memory boxes
tips = [
("LOW C3 + LOW C4 → Classical pathway → PSGN, Lupus, MPGN type I", C_NEPHRITIC),
("LOW C3 + NORMAL C4 → Alternative pathway → MPGN type II, C3 glomerulopathy", colors.HexColor("#E65100")),
("NORMAL complement → MCD, FSGS, Membranous, IgA nephropathy", colors.HexColor("#2E7D32")),
("LINEAR IF = Goodpasture (anti-GBM) | NEGATIVE IF = Pauci-immune (ANCA) | FULL HOUSE IF = Lupus", C_BOTH),
]
tip_data = [[
Paragraph(f'<font color="{c.hexval() if hasattr(c,"hexval") else "#333"}">{bold("▶")} {t}</font>',
ParagraphStyle(f"tip{i}", parent=styles["Normal"], fontSize=8,
textColor=colors.black, leading=11,
fontName="Helvetica", leftIndent=4))
for i, (t, c) in enumerate(tips)
]]
# Stack them vertically
for i, (tip_text, tip_color) in enumerate(tips):
hex_c = tip_color.hexval() if hasattr(tip_color, "hexval") else "#333333"
s = ParagraphStyle(f"tipS{i}", parent=styles["Normal"],
fontSize=8, leading=11,
leftIndent=6, spaceAfter=2)
story.append(Paragraph(
f'<font color="{hex_c}"><b>▶</b></font> {tip_text}', s))
doc.build(story, onFirstPage=header_banner, onLaterPages=header_banner)
print(f"PDF saved: {OUTPUT}")
build()
cd /home/daytona/workspace/glomerular-ref && python build_pdf.py 2>&1
ls -lh /home/daytona/workspace/glomerular-ref/Glomerular_Diseases_Quick_Reference.pdf
Glomerular Diseases Quick Reference
PDF Document · PDF
| Column | Content |
|---|---|
| Disease | Name + color-coded by syndrome |
| Syndrome | NEPHROTIC (blue) / NEPHRITIC (red) / BOTH (purple) |
| Population | Age group + classic associations |
| Light Microscopy | Key LM findings |
| Immunofluorescence | Pattern + deposits + location |
| Electron Microscopy | EM findings |
| Clinical Features | Presentation + labs |
| ★ Key USMLE Facts | Highlighted in amber |