Ne0hritic vs nephritic syndrome

Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Finding Sources
Reading File
Loading Image
Excellent - I now have comprehensive data from multiple authoritative sources. Here is the full comparison:

Nephrotic Syndrome vs. Nephritic Syndrome

These are the two cardinal presentations of glomerular disease. The distinction is fundamental: nephrotic reflects a permeability failure (protein leaks out), while nephritic reflects inflammation (cells and blood leak in).

Core Pathophysiology

Nephrotic Syndrome

The glomerular capillary wall - composed of endothelium, GBM, and podocytes - acts as both a size and charge barrier. In nephrotic syndrome, structural or physicochemical alterations in this barrier increase permeability to plasma proteins. The key proteins lost are albumin, immunoglobulins, antithrombin III, and lipid-binding proteins. Podocyte injury (foot process effacement) is the common final pathway regardless of the underlying cause.
Cascade of consequences:
  • Massive proteinuria (≥3.5 g/day in adults; >50 mg/kg/day in children) → hypoalbuminemia (albumin <3 g/dL)
  • Hypoalbuminemia → reduced plasma oncotic pressure → fluid shifts into the interstitium → edema
  • Compensatory hepatic lipoprotein synthesis ↑ + reduced lipid catabolism → hyperlipidemia → lipiduria (oval fat bodies in urine)
  • Loss of immunoglobulins → susceptibility to infection (especially pneumococcal, staphylococcal)
  • Loss of antithrombin III + protein C/S → hypercoagulable state → renal vein thrombosis (especially in membranous nephropathy)
Two edema subtypes:
  • Underfill (classic, e.g., minimal change disease): low plasma volume → activated RAAS, elevated aldosterone/ADH, low ANP → sodium retention
  • Overfill (other causes): primary renal sodium retention → expanded plasma volume, suppressed RAAS

Nephritic Syndrome

Nephritic syndrome results from glomerular inflammation - proliferation of glomerular cells + infiltration of leukocytes. This inflammatory reaction damages capillary walls, permitting blood to enter the urine, and reduces GFR by reducing the filtering surface area. The reduced GFR leads to oliguria, fluid/sodium retention, and renin release from ischemic kidneys.

Clinical & Lab Features - Head to Head

FeatureNephroticNephritic
OnsetInsidiousAbrupt
MechanismIncreased GBM permeabilityGlomerular inflammation
ProteinuriaMassive (>3.5 g/day)Mild-moderate (<3.5 g/day)
HematuriaAbsent or microscopicProminent (gross or microscopic)
RBC castsAbsentPresent (pathognomonic)
Serum albuminLow (<3 g/dL)Normal or slightly reduced
EdemaSevere, soft, pitting, periorbitalMild-moderate
Blood pressureNormalRaised (hypertension)
JVPNormal/lowRaised
GFR/azotemiaUsually preserved initiallyReduced, oliguria, azotemia
Urine colorFrothy (protein)Smoky/brown (blood)
LipidsHyperlipidemia + lipiduriaNormal
ComplementUsually normal (except MPGN)Often low (C3 low in PSAGN)

Urinary Findings

FindingNephroticNephritic
Protein+++++++
RBCsRare+++
RBC castsNoYes
WBCsNoPossible
Oval fat bodiesYes (lipiduria)No
Fatty castsYesNo

Causes

Nephrotic Syndrome Causes (Robbins 9e)

Primary (children vs. adults):
DiseaseChildrenAdults
Minimal change disease (MCD)75%8%
Focal segmental glomerulosclerosis (FSGS)10%35%
Membranous nephropathy3%30%
MPGN10%10%
Secondary (systemic diseases):
  • Diabetes mellitus (most common worldwide)
  • Amyloidosis
  • Systemic lupus erythematosus (class V lupus nephritis)
  • Drugs (NSAIDs, gold, penicillamine, heroin)
  • Infections (hepatitis B, HIV, malaria)

Nephritic Syndrome Causes

DiseaseKey Feature
Post-streptococcal GN (PSAGN)Latency 1-4 wks; subepithelial "humps" on EM; ↓C3
IgA nephropathy (Berger's)Episodic hematuria with URI; mesangial IgA deposits
Lupus nephritis (class III/IV)Anti-dsDNA, ↓C3/C4
ANCA-associated vasculitis (GPA, MPA)pANCA/cANCA positive; pauci-immune
Anti-GBM disease (Goodpasture's)Linear IgG on IF; pulmonary hemorrhage
MPGNCan present as either nephrotic or nephritic; ↓C3

Rapidly Progressive GN (RPGN) - The Nephritic Emergency

When nephritic syndrome progresses to kidney failure over days to weeks, this is RPGN. The histologic hallmark is crescents - proliferation of parietal epithelial cells in Bowman's space due to GBM breaks and fibrin leakage. Three immunologic types:
TypeMechanismIF PatternSerology
Type IAnti-GBM antibodiesLinear IgGAnti-GBM Ab
Type IIImmune complexGranular ("lumpy-bumpy")Varies (ANA, ASOT, ↓C3)
Type IIIPauci-immune (ANCA)Negative / traceANCA positive

Edema Mechanism Comparison

Nephrotic underfill vs. overfill:
Nephrotic syndrome underfill vs overfill edema mechanisms
In the underfill group (typical of minimal change disease): low serum albumin → low oncotic pressure → contracted plasma volume → RAAS activation, elevated aldosterone, AVP, catecholamines, low ANP.
In the overfill group: primary renal sodium retention → expanded plasma volume → suppressed RAAS, low aldosterone. Diuretics in the underfill group risk azotemia and orthostasis; in the overfill group they work safely.

Key Memory Anchors

ClueThink
Frothy urine, periorbital puffiness, no hematuriaNephrotic
Cola/tea-colored urine, hypertension, oliguriaNephritic
Child with MCDNephrotic, steroid-responsive
Diabetic for 10+ years with proteinuriaSecondary nephrotic
Post-sore throat hematuria in child, ↓C3Post-streptococcal (nephritic)
Recurrent hematuria with upper respiratory infectionsIgA nephropathy (nephritic)
Hemoptysis + hematuria, anti-GBM+Goodpasture's (nephritic/RPGN)
Rapidly deteriorating kidney function with crescentsRPGN
Can present as EITHERMPGN

Note: Some diseases - especially MPGN and lupus nephritis - blur the boundary and can present with mixed features of both syndromes simultaneously.
Sources: Robbins, Cotran & Kumar Pathologic Basis of Disease, 10e; Comprehensive Clinical Nephrology, 7e; Brenner and Rector's The Kidney, 2-Volume Set.

Create a clinical decision tree to differentiate these syndromes

Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or missing"

Running Command

mkdir -p /home/daytona/workspace/nephro-decision-tree && python3 -c "import reportlab; print('reportlab ok')" && python3 -c "from reportlab.lib import colors; print('colors ok')"

Writing File

~/nephro-decision-tree/build_tree.py

#!/usr/bin/env python3
"""
Clinical Decision Tree: Nephrotic vs Nephritic Syndrome
Renders a full A3-landscape PDF using ReportLab
"""

from reportlab.lib.pagesizes import A3, landscape
from reportlab.lib import colors
from reportlab.lib.units import mm
from reportlab.pdfgen import canvas
from reportlab.lib.fonts import addMapping
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
import textwrap

OUTPUT = "/home/daytona/workspace/nephro-decision-tree/Nephro_Decision_Tree.pdf"

# ── Colour palette ────────────────────────────────────────────────────────────
C_BG          = colors.HexColor("#F7F9FC")
C_START       = colors.HexColor("#2C3E50")   # dark slate  – root node
C_QUESTION    = colors.HexColor("#2980B9")   # blue        – decision diamonds
C_NEPHROTIC   = colors.HexColor("#1A7A4A")   # green       – nephrotic branch
C_NEPHRITIC   = colors.HexColor("#C0392B")   # red         – nephritic branch
C_MIXED       = colors.HexColor("#7D3C98")   # purple      – mixed/MPGN
C_RPGN        = colors.HexColor("#D35400")   # orange      – RPGN
C_DIAGNOSIS   = colors.HexColor("#17202A")   # near-black  – final diagnosis boxes
C_ARROW       = colors.HexColor("#555555")
C_YES         = colors.HexColor("#27AE60")
C_NO          = colors.HexColor("#E74C3C")
C_WHITE       = colors.white
C_LIGHT_GRAY  = colors.HexColor("#ECF0F1")

PW, PH = landscape(A3)   # 420 × 297 mm  →  pt: ~1191 × 842

c = canvas.Canvas(OUTPUT, pagesize=landscape(A3))
c.setTitle("Clinical Decision Tree: Nephrotic vs Nephritic Syndrome")


# ── Helper functions ──────────────────────────────────────────────────────────

def rounded_rect(cv, x, y, w, h, r=8, fill_color=C_WHITE, stroke_color=C_QUESTION, lw=1.5):
    cv.setFillColor(fill_color)
    cv.setStrokeColor(stroke_color)
    cv.setLineWidth(lw)
    cv.roundRect(x, y, w, h, r, stroke=1, fill=1)

def diamond(cv, cx, cy, w, h, fill_color=C_QUESTION, stroke_color=None):
    if stroke_color is None:
        stroke_color = fill_color.clone() if hasattr(fill_color, 'clone') else fill_color
    cv.setFillColor(fill_color)
    cv.setStrokeColor(colors.HexColor("#1A252F"))
    cv.setLineWidth(1.5)
    p = cv.beginPath()
    p.moveTo(cx,      cy + h/2)   # top
    p.lineTo(cx + w/2, cy)        # right
    p.lineTo(cx,      cy - h/2)   # bottom
    p.lineTo(cx - w/2, cy)        # left
    p.close()
    cv.drawPath(p, stroke=1, fill=1)

def wrap_text_in_box(cv, text, x, y, w, h, font="Helvetica-Bold", size=8,
                     text_color=C_WHITE, align="center", padding=4):
    cv.setFont(font, size)
    cv.setFillColor(text_color)
    lines = []
    # simple word-wrap
    words = text.split()
    line = ""
    for word in words:
        test = (line + " " + word).strip()
        if cv.stringWidth(test, font, size) <= w - padding*2:
            line = test
        else:
            if line:
                lines.append(line)
            line = word
    if line:
        lines.append(line)
    line_h = size * 1.3
    total_h = len(lines) * line_h
    start_y = y + h/2 + total_h/2 - line_h * 0.85
    for l in lines:
        if align == "center":
            cv.drawCentredString(x + w/2, start_y, l)
        else:
            cv.drawString(x + padding, start_y, l)
        start_y -= line_h

def wrap_text_diamond(cv, text, cx, cy, w, h, font="Helvetica-Bold", size=7.5,
                      text_color=C_WHITE):
    cv.setFont(font, size)
    cv.setFillColor(text_color)
    words = text.split()
    lines = []
    line = ""
    max_w = w * 0.65
    for word in words:
        test = (line + " " + word).strip()
        if cv.stringWidth(test, font, size) <= max_w:
            line = test
        else:
            if line:
                lines.append(line)
            line = word
    if line:
        lines.append(line)
    line_h = size * 1.3
    total_h = len(lines) * line_h
    start_y = cy + total_h/2 - line_h * 0.7
    for l in lines:
        cv.drawCentredString(cx, start_y, l)
        start_y -= line_h

def arrow(cv, x1, y1, x2, y2, label="", label_color=C_ARROW, lw=1.5, head=7):
    cv.setStrokeColor(C_ARROW)
    cv.setFillColor(C_ARROW)
    cv.setLineWidth(lw)
    cv.line(x1, y1, x2, y2)
    # arrowhead
    import math
    angle = math.atan2(y2 - y1, x2 - x1)
    for da in [2.5, -2.5]:
        ax = x2 - head * math.cos(angle + da)
        ay = y2 - head * math.sin(angle + da)
        cv.line(x2, y2, ax, ay)
    if label:
        mx = (x1 + x2) / 2
        my = (y1 + y2) / 2
        cv.setFont("Helvetica-Bold", 7.5)
        cv.setFillColor(label_color)
        cv.drawCentredString(mx, my + 4, label)

def elbow_arrow(cv, x1, y1, x2, y2, bend_x=None, bend_y=None, label="",
                label_side="left", lw=1.5, head=7, label_color=C_ARROW):
    import math
    cv.setStrokeColor(C_ARROW)
    cv.setFillColor(C_ARROW)
    cv.setLineWidth(lw)
    if bend_x is not None and bend_y is None:
        # L-shaped: go right/left then up/down
        cv.line(x1, y1, bend_x, y1)
        cv.line(bend_x, y1, bend_x, y2)
        cv.line(bend_x, y2, x2, y2)
        angle = math.atan2(y2 - y2, x2 - bend_x)  # horizontal segment end
        for da in [2.5, -2.5]:
            ax = x2 - head * math.cos(angle + da)
            ay = y2 - head * math.sin(angle + da)
            cv.line(x2, y2, ax, ay)
        if label:
            cv.setFont("Helvetica-Bold", 7.5)
            cv.setFillColor(label_color)
            if label_side == "left":
                cv.drawString(x1 + 3, y1 + 4, label)
            else:
                cv.drawCentredString(bend_x, (y1 + y2)/2, label)
    elif bend_y is not None and bend_x is None:
        # vertical then horizontal
        cv.line(x1, y1, x1, bend_y)
        cv.line(x1, bend_y, x2, bend_y)
        cv.line(x2, bend_y, x2, y2)
        angle = math.atan2(y2 - bend_y, 0)
        for da in [2.5, -2.5]:
            ax = x2 - head * math.cos(angle + da)
            ay = y2 - head * math.sin(angle + da)
            cv.line(x2, y2, ax, ay)
        if label:
            cv.setFont("Helvetica-Bold", 7.5)
            cv.setFillColor(label_color)
            cv.drawCentredString((x1+x2)/2, bend_y + 4, label)


# ══════════════════════════════════════════════════════════════════════════════
# PAGE BACKGROUND
# ══════════════════════════════════════════════════════════════════════════════
c.setFillColor(C_BG)
c.rect(0, 0, PW, PH, fill=1, stroke=0)

# ── Title bar ─────────────────────────────────────────────────────────────────
c.setFillColor(C_START)
c.rect(0, PH - 42, PW, 42, fill=1, stroke=0)
c.setFillColor(C_WHITE)
c.setFont("Helvetica-Bold", 16)
c.drawCentredString(PW/2, PH - 28, "Clinical Decision Tree: Differentiating Nephrotic vs. Nephritic Syndrome")
c.setFont("Helvetica", 9)
c.drawCentredString(PW/2, PH - 38, "Based on clinical presentation, urinalysis, and biochemistry  |  Robbins Pathology · Comprehensive Clinical Nephrology")

# ── Legend ─────────────────────────────────────────────────────────────────────
leg_x = PW - 185
leg_y = PH - 105
c.setFillColor(C_LIGHT_GRAY)
c.setStrokeColor(colors.HexColor("#BDC3C7"))
c.setLineWidth(0.8)
c.roundRect(leg_x - 8, leg_y - 8, 183, 65, 6, stroke=1, fill=1)
c.setFont("Helvetica-Bold", 8)
c.setFillColor(C_START)
c.drawString(leg_x, leg_y + 48, "LEGEND")
items = [
    (C_START,     "Entry / Start"),
    (C_QUESTION,  "Decision point (diamond)"),
    (C_NEPHROTIC, "Nephrotic pathway"),
    (C_NEPHRITIC, "Nephritic pathway"),
    (C_MIXED,     "Mixed / MPGN"),
    (C_RPGN,      "RPGN / Crescentic GN"),
]
for i, (col, lbl) in enumerate(items):
    row = i % 3
    col_offset = 0 if i < 3 else 92
    ly = leg_y + 36 - row * 14
    c.setFillColor(col)
    c.rect(leg_x + col_offset, ly, 10, 8, fill=1, stroke=0)
    c.setFillColor(C_START)
    c.setFont("Helvetica", 7.5)
    c.drawString(leg_x + col_offset + 13, ly + 1, lbl)


# ══════════════════════════════════════════════════════════════════════════════
#  TREE LAYOUT  (coordinates in points; origin = bottom-left)
#  We work top-down.  PH ≈ 842 pt.  Top of content ≈ PH-55 = 787
#  Columns:   LEFT=nephrotic   CENTRE=shared entry   RIGHT=nephritic
# ══════════════════════════════════════════════════════════════════════════════

# Row Y positions (top of each node row, rough)
Y = {
    "start":   762,
    "q1":      700,   # Proteinuria ≥3.5 g/day?
    "q2l":     630,   # Hematuria / RBC casts?  (left branch = no)
    "q2r":     630,   # same row – right branch = yes
    "q3l":     555,   # Serum albumin <3 g/dL?
    "q3r":     555,   # GFR reduced / oliguria?
    "q4l":     480,   # Complement low?
    "q4r":     480,   # Rapidly deteriorating Cr?
    "diag_nt": 395,   # nephrotic diagnoses
    "diag_ni": 395,   # nephritic diagnoses
    "rpgn":    340,
}

CX = PW / 2        # centre x

# Node dimensions
NW, NH   = 155, 38   # normal rect box
DW, DH   = 148, 46   # diamond
BW, BH   = 160, 50   # big diagnosis box

# ── ROOT NODE ─────────────────────────────────────────────────────────────────
rx = CX - NW/2
ry = Y["start"]
rounded_rect(c, rx, ry, NW, NH, r=10, fill_color=C_START, stroke_color=C_START, lw=2)
wrap_text_in_box(c, "PATIENT WITH SUSPECTED GLOMERULAR DISEASE", rx, ry, NW, NH, size=8)

# arrow down
arrow(c, CX, ry, CX, Y["q1"] + DH)

# ── Q1 : Proteinuria ≥3.5 g/day? ─────────────────────────────────────────────
q1cx, q1cy = CX, Y["q1"] + DH/2
diamond(c, q1cx, q1cy, DW, DH, fill_color=C_QUESTION)
wrap_text_diamond(c, "Proteinuria ≥ 3.5 g/day\n(nephrotic-range)?", q1cx, q1cy, DW, DH, size=8)

# YES → left (nephrotic)
LEFT_X = CX - 280
arrow(c, q1cx - DW/2, q1cy, LEFT_X + NW/2, q1cy, label="YES", label_color=C_YES)

# NO → right (nephritic)
RIGHT_X = CX + 280 - NW/2
arrow(c, q1cx + DW/2, q1cy, RIGHT_X + NW/2, q1cy, label="NO  (sub-nephrotic)", label_color=C_NO)

# ── Q2-LEFT : Hematuria / RBC casts present? (nephrotic branch has low/none) ─
q2l_cx = LEFT_X + NW/2
q2l_cy = Y["q2l"] + DH/2

# first drop arrow on left
arrow(c, q2l_cx, q1cy, q2l_cx, Y["q2l"] + DH)

diamond(c, q2l_cx, q2l_cy, DW, DH, fill_color=C_NEPHROTIC)
wrap_text_diamond(c, "RBC casts or gross\nhematuria present?", q2l_cx, q2l_cy, DW, DH, size=8)

# ── Q2-RIGHT : Check hematuria in sub-nephrotic proteinuria ───────────────────
q2r_cx = RIGHT_X + NW/2
q2r_cy = Y["q2r"] + DH/2

arrow(c, q2r_cx, q1cy, q2r_cx, Y["q2r"] + DH)

diamond(c, q2r_cx, q2r_cy, DW, DH, fill_color=C_NEPHRITIC)
wrap_text_diamond(c, "Hematuria / RBC casts\n+ azotemia present?", q2r_cx, q2r_cy, DW, DH, size=8)

# ── Q3-LEFT (from Q2L NO): Serum albumin <3 g/dL? ────────────────────────────
q3l_cx = q2l_cx
q3l_cy = Y["q3l"] + DH/2

# NO arm goes down
arrow(c, q3l_cx, q2l_cy - DH/2, q3l_cx, Y["q3l"] + DH, label="NO", label_color=C_NO)

diamond(c, q3l_cx, q3l_cy, DW, DH, fill_color=C_NEPHROTIC)
wrap_text_diamond(c, "Serum albumin < 3 g/dL\n+ hyperlipidemia?", q3l_cx, q3l_cy, DW, DH, size=8)

# YES arm from Q2L → mixed / re-evaluate
mixed_cx = (q2l_cx + q2r_cx) / 2
mixed_cy = Y["q3l"] + DH/2
arrow(c, q2l_cx + DW/2, q2l_cy, mixed_cx - NW/2, mixed_cy, label="YES (mixed)", label_color=C_MIXED)
rounded_rect(c, mixed_cx - NW/2, Y["q3l"], NW, NH, r=8, fill_color=C_MIXED, stroke_color=C_MIXED)
wrap_text_in_box(c, "MIXED FEATURES\nConsider MPGN / Lupus nephritis", mixed_cx - NW/2, Y["q3l"], NW, NH, size=8)

# ── Q3-RIGHT (from Q2R YES): GFR reduced / oliguria? ─────────────────────────
q3r_cx = q2r_cx
q3r_cy = Y["q3r"] + DH/2

arrow(c, q3r_cx, q2r_cy - DH/2, q3r_cx, Y["q3r"] + DH, label="YES", label_color=C_YES)

diamond(c, q3r_cx, q3r_cy, DW, DH, fill_color=C_NEPHRITIC)
wrap_text_diamond(c, "Hypertension + ↓GFR\n/ oliguria present?", q3r_cx, q3r_cy, DW, DH, size=8)

# Q2R NO → recheck (could be mild glomerular disease, not classic)
recheck_x = q2r_cx + 200
recheck_y = Y["q2r"]
arrow(c, q2r_cx + DW/2, q2r_cy, recheck_x, q2r_cy, label="NO", label_color=C_NO)
rounded_rect(c, recheck_x, recheck_y, NW - 10, NH, r=8, fill_color=colors.HexColor("#7F8C8D"), stroke_color=colors.HexColor("#7F8C8D"))
wrap_text_in_box(c, "Non-glomerular cause\nor isolated microscopic\nhematuria – further W/U", recheck_x, recheck_y, NW - 10, NH, size=7)

# ── Q4-LEFT: Complement (C3) low? ─────────────────────────────────────────────
q4l_cx = q3l_cx
q4l_cy = Y["q4l"] + DH/2

arrow(c, q4l_cx, q3l_cy - DH/2, q4l_cx, Y["q4l"] + DH, label="YES", label_color=C_YES)

diamond(c, q4l_cx, q4l_cy, DW, DH, fill_color=C_NEPHROTIC)
wrap_text_diamond(c, "Serum C3 low\nor proteinuria > 3.5 g?", q4l_cx, q4l_cy, DW, DH, size=8)

# Q3L NO → reassess
q3l_no_x = q3l_cx - 215
q3l_no_y = Y["q3l"]
arrow(c, q3l_cx - DW/2, q3l_cy, q3l_no_x + NW/2, q3l_cy, label="NO", label_color=C_NO)
rounded_rect(c, q3l_no_x - NW/2 + 20, q3l_no_y, NW, NH, r=8, fill_color=colors.HexColor("#7F8C8D"), stroke_color=colors.HexColor("#7F8C8D"))
wrap_text_in_box(c, "Re-evaluate:\nOrthostatic / overflow\nproteinuria", q3l_no_x - NW/2 + 20, q3l_no_y, NW, NH, size=7.5)

# ── Q4-RIGHT: Rapidly progressive (Cr doubles < 3 months)? ───────────────────
q4r_cx = q3r_cx
q4r_cy = Y["q4r"] + DH/2

arrow(c, q4r_cx, q3r_cy - DH/2, q4r_cx, Y["q4r"] + DH, label="YES", label_color=C_YES)

diamond(c, q4r_cx, q4r_cy, DW, DH, fill_color=C_NEPHRITIC)
wrap_text_diamond(c, "Cr doubles in < 3 months\nor uremic emergency?", q4r_cx, q4r_cy, DW, DH, size=8)

# Q3R NO
q3r_no_x = q3r_cx + 200
q3r_no_y = Y["q3r"]
arrow(c, q3r_cx + DW/2, q3r_cy, q3r_no_x, q3r_cy, label="NO", label_color=C_NO)
rounded_rect(c, q3r_no_x, q3r_no_y, NW, NH, r=8, fill_color=colors.HexColor("#7F8C8D"), stroke_color=colors.HexColor("#7F8C8D"))
wrap_text_in_box(c, "Mild nephritic / isolated\nhematuria – consider IgA\nnephropathy, thin GBM dz", q3r_no_x, q3r_no_y, NW, NH, size=7.5)

# ══════════════════════════════════════════════════════════════════════════════
# DIAGNOSIS BOXES – Nephrotic
# ══════════════════════════════════════════════════════════════════════════════
# Q4L YES → MPGN
mpgn_dx_x = q4l_cx - 210
mpgn_dx_y = Y["diag_nt"]
arrow(c, q4l_cx - DW/2, q4l_cy, mpgn_dx_x + BW/2, q4l_cy, label="YES (↓C3)", label_color=C_MIXED)
# elbow down
arrow(c, mpgn_dx_x + BW/2, q4l_cy, mpgn_dx_x + BW/2, mpgn_dx_y + BH)
rounded_rect(c, mpgn_dx_x, mpgn_dx_y, BW, BH, r=8, fill_color=C_MIXED, stroke_color=C_MIXED)
wrap_text_in_box(c, "MPGN / Dense Deposit Disease\n↓C3, ↓C4 (MPGN I/III)\nIF: granular C3 ± IgG\nEM: subendothelial / intramembranous", mpgn_dx_x, mpgn_dx_y, BW, BH, size=7)

# Q4L NO → classic nephrotic (children vs. adults)
nt_dx_x = q4l_cx + 20
nt_dx_y = Y["diag_nt"]
arrow(c, q4l_cx, q4l_cy - DH/2, q4l_cx, nt_dx_y + BH + 10, label="NO", label_color=C_NO)
# age split
arrow(c, q4l_cx, nt_dx_y + BH + 10, nt_dx_x + BW/2, nt_dx_y + BH)

# Children box
ch_x = nt_dx_x
ch_y = nt_dx_y
rounded_rect(c, ch_x, ch_y, BW, BH, r=8, fill_color=C_NEPHROTIC, stroke_color=C_NEPHROTIC)
wrap_text_in_box(c, "CHILDREN (<16 yrs)\nMinimal Change Disease (75%)\nFSGS (10%)\nIF: negative  EM: foot process fusion", ch_x, ch_y, BW, BH, size=7)

# Adults box
ad_x = nt_dx_x + BW + 12
ad_y = nt_dx_y
rounded_rect(c, ad_x, ad_y, BW, BH, r=8, fill_color=C_NEPHROTIC, stroke_color=C_NEPHROTIC)
wrap_text_in_box(c, "ADULTS\nFSGS (35%)  Membranous (30%)\nDiabetic nephropathy (most common 2°)\nIF: IgG+C3 (subepithelial) in MN", ad_x, ad_y, BW, BH, size=7)

# age question label
arrow(c, q4l_cx, nt_dx_y + BH + 10, ad_x + BW/2, nt_dx_y + BH)
c.setFont("Helvetica-Bold", 7)
c.setFillColor(C_NEPHROTIC)
c.drawCentredString(ch_x + BW/2, ch_y + BH + 3, "Age < 16 yrs")
c.drawCentredString(ad_x + BW/2, ad_y + BH + 3, "Age ≥ 16 yrs")

# ══════════════════════════════════════════════════════════════════════════════
# DIAGNOSIS BOXES – Nephritic
# ══════════════════════════════════════════════════════════════════════════════
# Q4R YES → RPGN
rpgn_x = q4r_cx + 25
rpgn_y = Y["rpgn"]
arrow(c, q4r_cx, q4r_cy - DH/2, q4r_cx, rpgn_y + BH + 10, label="YES", label_color=C_YES)
# RPGN type split
c.setFillColor(C_RPGN)
c.setStrokeColor(C_RPGN)
c.setLineWidth(1.5)
c.roundRect(q4r_cx - BW/2, rpgn_y + 15, BW * 2.1, BH + 20, 8, fill=1, stroke=1)
c.setFillColor(C_WHITE)
c.setFont("Helvetica-Bold", 8.5)
c.drawCentredString(q4r_cx + BW/2*0.1 + 10, rpgn_y + BH + 22, "RPGN / CRESCENTIC GN  (Cr doubles in weeks)")
c.setFont("Helvetica", 7.5)
lines = [
    "Type I – Anti-GBM (Goodpasture): Linear IgG on IF  |  Anti-GBM Ab serology  |  ± pulmonary hemorrhage",
    "Type II – Immune complex: Granular IF  |  ↓C3/C4  |  Post-infectious, Lupus, IgA, MPGN",
    "Type III – Pauci-immune (ANCA): Negative IF  |  cANCA (GPA) or pANCA (MPA)  |  Most common in adults",
]
for i, l in enumerate(lines):
    c.drawCentredString(q4r_cx + BW/2*0.1 + 10, rpgn_y + 10 + (2-i)*14, l)

# Q4R NO → classic nephritic
ni_dx_x = q4r_cx - BW * 1.1
ni_dx_y = Y["diag_ni"]
arrow(c, q4r_cx - DW/2, q4r_cy, ni_dx_x + BW/2, q4r_cy, label="NO", label_color=C_NO)
arrow(c, ni_dx_x + BW/2, q4r_cy, ni_dx_x + BW/2, ni_dx_y + BH)

rounded_rect(c, ni_dx_x, ni_dx_y, BW * 1.15, BH + 20, r=8, fill_color=C_NEPHRITIC, stroke_color=C_NEPHRITIC)
wrap_text_in_box(c, "CLASSIC NEPHRITIC\nPost-streptococcal GN: ↓C3, antistreptolysin O+\nIgA nephropathy: IgA mesangial deposits\nLupus Class III/IV: ↓C3/C4, ANA+, anti-dsDNA+\nANCA vasculitis: pauci-immune", ni_dx_x, ni_dx_y, BW * 1.15, BH + 20, size=7.5)

# ══════════════════════════════════════════════════════════════════════════════
# COMPLICATIONS FOOTNOTE ROW
# ══════════════════════════════════════════════════════════════════════════════
footer_y = 22
c.setFillColor(C_LIGHT_GRAY)
c.rect(10, footer_y - 5, PW - 20, 22, fill=1, stroke=0)
c.setFont("Helvetica-Bold", 7)
c.setFillColor(C_NEPHROTIC)
c.drawString(18, footer_y + 9, "NEPHROTIC complications:")
c.setFont("Helvetica", 7)
c.setFillColor(C_DIAGNOSIS)
c.drawString(130, footer_y + 9, "Thrombosis (↓AT-III, ↓Prot C/S) · Infection (↓IgG) · Hyperlipidemia · AKI (underfill)")
c.setFont("Helvetica-Bold", 7)
c.setFillColor(C_NEPHRITIC)
c.drawString(530, footer_y + 9, "NEPHRITIC complications:")
c.setFont("Helvetica", 7)
c.setFillColor(C_DIAGNOSIS)
c.drawString(640, footer_y + 9, "Hypertensive emergency · Pulmonary edema (fluid overload) · Rapid CKD progression")

c.setFont("Helvetica", 6.5)
c.setFillColor(colors.HexColor("#888888"))
c.drawCentredString(PW/2, footer_y - 2, "Robbins & Cotran Pathologic Basis of Disease 10e  ·  Comprehensive Clinical Nephrology 7e  ·  Brenner & Rector's The Kidney")

# ══════════════════════════════════════════════════════════════════════════════
c.save()
print(f"PDF saved to {OUTPUT}")
Running Command

cd /home/daytona/workspace/nephro-decision-tree && python3 build_tree.py 2>&1

Running Command

ls -lh /home/daytona/workspace/nephro-decision-tree/Nephro_Decision_Tree.pdf && python3 -c " from reportlab.lib.pagesizes import A3, landscape w, h = landscape(A3) print(f'Page size: {w:.0f} x {h:.0f} pt ({w/72*25.4:.0f} x {h/72*25.4:.0f} mm)') " && pdftoppm -r 150 /home/daytona/workspace/nephro-decision-tree/Nephro_Decision_Tree.pdf /home/daytona/workspace/nephro-decision-tree/preview && ls /home/daytona/workspace/nephro-decision-tree/

Running Command

python3 -c " from PIL import Image img = Image.open('/home/daytona/workspace/nephro-decision-tree/preview-1.ppm') img.save('/home/daytona/workspace/nephro-decision-tree/preview.png') print(f'PNG size: {img.size}') "

Reading File
Editing File

~/nephro-decision-tree/build_tree.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/nephro-decision-tree/build_tree.py'
Writing File

~/nephro-decision-tree/build_tree_v2.py

#!/usr/bin/env python3
"""
Clinical Decision Tree: Nephrotic vs Nephritic Syndrome  (v2 – clean layout)
A3 landscape, carefully spaced so nothing clips.
"""

from reportlab.lib.pagesizes import A3, landscape
from reportlab.lib import colors
from reportlab.pdfgen import canvas
import math

OUT = "/home/daytona/workspace/nephro-decision-tree/Nephro_Decision_Tree.pdf"

PW, PH = landscape(A3)   # ≈ 1191 × 842 pt

c = canvas.Canvas(OUT, pagesize=landscape(A3))
c.setTitle("Clinical Decision Tree: Nephrotic vs Nephritic Syndrome")

# ── Palette ──────────────────────────────────────────────────────────────────
BG      = colors.HexColor("#F0F4F8")
HEADER  = colors.HexColor("#1A2942")
QBLUE   = colors.HexColor("#2471A3")   # decision diamond
GREEN   = colors.HexColor("#1E8449")   # nephrotic
RED     = colors.HexColor("#B03A2E")   # nephritic
PURPLE  = colors.HexColor("#6C3483")   # mixed
ORANGE  = colors.HexColor("#CA6F1E")   # RPGN
GREY    = colors.HexColor("#717D7E")   # non-specific
WHITE   = colors.white
DARK    = colors.HexColor("#1C2833")
YARROW  = colors.HexColor("#229954")   # YES label
NRED    = colors.HexColor("#C0392B")   # NO label
ARROW_C = colors.HexColor("#4A4A4A")

# ── Background + header ───────────────────────────────────────────────────────
c.setFillColor(BG)
c.rect(0, 0, PW, PH, fill=1, stroke=0)

c.setFillColor(HEADER)
c.rect(0, PH-48, PW, 48, fill=1, stroke=0)
c.setFillColor(WHITE)
c.setFont("Helvetica-Bold", 15)
c.drawCentredString(PW/2, PH-28, "Clinical Decision Tree: Differentiating Nephrotic vs. Nephritic Syndrome")
c.setFont("Helvetica", 8.5)
c.drawCentredString(PW/2, PH-40, "Based on clinical presentation · urinalysis · biochemistry  |  Robbins & Cotran Pathology · Comprehensive Clinical Nephrology 7e · Brenner & Rector's The Kidney")

# ── Helper draw fns ───────────────────────────────────────────────────────────

def rrect(x, y, w, h, fill=WHITE, stroke=QBLUE, lw=1.5, r=7):
    c.setFillColor(fill)
    c.setStrokeColor(stroke)
    c.setLineWidth(lw)
    c.roundRect(x, y, w, h, r, stroke=1, fill=1)

def text_in(x, y, w, h, lines, font="Helvetica-Bold", size=7.5, col=WHITE):
    c.setFont(font, size)
    c.setFillColor(col)
    lh = size * 1.35
    total = len(lines) * lh
    sy = y + h/2 + total/2 - lh * 0.75
    for ln in lines:
        c.drawCentredString(x + w/2, sy, ln)
        sy -= lh

def diamond(cx, cy, w, h, fill=QBLUE, stroke=DARK):
    c.setFillColor(fill)
    c.setStrokeColor(stroke)
    c.setLineWidth(1.8)
    p = c.beginPath()
    p.moveTo(cx,      cy+h/2)
    p.lineTo(cx+w/2,  cy)
    p.lineTo(cx,      cy-h/2)
    p.lineTo(cx-w/2,  cy)
    p.close()
    c.drawPath(p, stroke=1, fill=1)

def dtext(cx, cy, lines, font="Helvetica-Bold", size=7.5, col=WHITE, w_limit=90):
    c.setFont(font, size)
    c.setFillColor(col)
    lh = size * 1.3
    total = len(lines) * lh
    sy = cy + total/2 - lh*0.65
    for ln in lines:
        c.drawCentredString(cx, sy, ln)
        sy -= lh

def arr(x1, y1, x2, y2, lbl="", lbl_col=YARROW, lw=1.5, head=7):
    c.setStrokeColor(ARROW_C)
    c.setFillColor(ARROW_C)
    c.setLineWidth(lw)
    c.line(x1, y1, x2, y2)
    ang = math.atan2(y2-y1, x2-x1)
    for da in (0.45, -0.45):
        ax = x2 - head*math.cos(ang+da)
        ay = y2 - head*math.sin(ang+da)
        c.line(x2, y2, ax, ay)
    if lbl:
        mx, my = (x1+x2)/2, (y1+y2)/2
        c.setFont("Helvetica-Bold", 7.5)
        c.setFillColor(lbl_col)
        # offset perp to arrow direction
        c.drawCentredString(mx + 6*math.sin(ang), my + 6*math.cos(ang) + 3, lbl)

def harrow(x1, y1, bend_x, x2, y2, lbl="", lbl_col=YARROW):
    """go horizontal to bend_x, then vertical to y2, then horizontal to x2"""
    c.setStrokeColor(ARROW_C)
    c.setFillColor(ARROW_C)
    c.setLineWidth(1.5)
    c.line(x1, y1, bend_x, y1)
    c.line(bend_x, y1, bend_x, y2)
    c.line(bend_x, y2, x2, y2)
    # arrowhead
    ang = math.atan2(0, x2-bend_x)
    for da in (0.45, -0.45):
        ax = x2 - 7*math.cos(ang+da)
        ay = y2 - 7*math.sin(ang+da)
        c.line(x2, y2, ax, ay)
    if lbl:
        c.setFont("Helvetica-Bold", 7.5)
        c.setFillColor(lbl_col)
        c.drawCentredString((x1+bend_x)/2, y1+5, lbl)

def varrow(x1, y1, bend_y, x2, y2, lbl="", lbl_col=YARROW):
    """go vertical to bend_y, then horizontal to x2, then vertical to y2"""
    c.setStrokeColor(ARROW_C)
    c.setFillColor(ARROW_C)
    c.setLineWidth(1.5)
    c.line(x1, y1, x1, bend_y)
    c.line(x1, bend_y, x2, bend_y)
    c.line(x2, bend_y, x2, y2)
    ang = math.atan2(y2-bend_y, 0)
    for da in (0.45, -0.45):
        ax = x2 - 7*math.cos(ang+da)
        ay = y2 - 7*math.sin(ang+da)
        c.line(x2, y2, ax, ay)
    if lbl:
        c.setFont("Helvetica-Bold", 7.5)
        c.setFillColor(lbl_col)
        c.drawString(x1+4, (y1+bend_y)/2, lbl)

# ══════════════════════════════════════════════════════════════════════════════
#  LAYOUT CONSTANTS
#  X zones:  FAR_LEFT  LEFT  CENTRE  RIGHT  FAR_RIGHT
#  Y rows:   R0(top) → R6(bottom)
# ══════════════════════════════════════════════════════════════════════════════

CX  = PW / 2         # 595.5

# X centres of columns
X_FL = 110           # far-left  (overflow/orthostatic)
X_L  = 230           # left      (nephrotic branch)
X_C  = CX            # centre    (entry + q1)
X_R  = 870           # right     (nephritic branch)
X_FR = 1090          # far-right (non-glomerular)

# Y rows (centre of content)
R0 = 785   # root node
R1 = 720   # Q1
R2 = 648   # Q2 left & right
R3 = 575   # Q3 left & right
R4 = 500   # Q4 left & right
R5 = 415   # diagnosis boxes row 1
R6 = 330   # RPGN / extra row

# Standard box dims
NW, NH = 145, 36     # normal decision box
DW, DH = 155, 50     # diamond total width/height
BW, BH = 175, 62     # big diagnosis box

# ── ROOT ─────────────────────────────────────────────────────────────────────
rx, ry = X_C - NW/2, R0 - NH/2
rrect(rx, ry, NW, NH, fill=HEADER, stroke=HEADER, lw=2)
text_in(rx, ry, NW, NH, ["PATIENT WITH SUSPECTED", "GLOMERULAR DISEASE"], size=8.5)
arr(X_C, R0-NH/2, X_C, R1+DH/2)   # down to Q1

# ── Q1 : Proteinuria ≥ 3.5 g/day? ───────────────────────────────────────────
diamond(X_C, R1, DW, DH, fill=QBLUE)
dtext(X_C, R1, ["Proteinuria", "≥ 3.5 g/day?"], size=8.5)

# Q1 → YES left
arr(X_C-DW/2, R1, X_L, R1, lbl="YES", lbl_col=YARROW)
# Q1 → NO right
arr(X_C+DW/2, R1, X_R, R1, lbl="NO  (sub-nephrotic)", lbl_col=NRED)

# ── Q2-LEFT : RBC casts / gross hematuria? ───────────────────────────────────
arr(X_L, R1, X_L, R2+DH/2)
diamond(X_L, R2, DW, DH, fill=GREEN)
dtext(X_L, R2, ["RBC casts or", "gross hematuria?"], size=8.5)

# Q2L YES → mixed (centre, between branches)
X_MIX = CX
harrow(X_L+DW/2, R2, X_MIX-NW/2-10, X_MIX+NW/2, R3+NH/2, lbl="YES (mixed)", lbl_col=PURPLE)
# draw mixed box centred at X_MIX
rrect(X_MIX-NW/2, R3-NH/2, NW, NH+10, fill=PURPLE, stroke=PURPLE)
text_in(X_MIX-NW/2, R3-NH/2, NW, NH+10,
        ["MIXED FEATURES", "Consider MPGN", "or Lupus Nephritis"], size=8)

# Q2L NO → down to Q3L
arr(X_L, R2-DH/2, X_L, R3+DH/2, lbl="NO", lbl_col=NRED)

# ── Q3-LEFT : Albumin <3 g/dL + hyperlipidemia? ──────────────────────────────
diamond(X_L, R3, DW, DH, fill=GREEN)
dtext(X_L, R3, ["Albumin < 3 g/dL", "+ hyperlipidemia?"], size=8.5)

# Q3L NO → far-left re-evaluate
harrow(X_L-DW/2, R3, X_FL+NW/2+5, X_FL-NW/2+20, R3, lbl="NO", lbl_col=NRED)
rrect(X_FL-NW/2+20, R3-NH/2, NW, NH, fill=GREY, stroke=GREY)
text_in(X_FL-NW/2+20, R3-NH/2, NW, NH,
        ["Re-evaluate:", "Orthostatic / overflow", "proteinuria"], size=7.5)

# Q3L YES → down to Q4L
arr(X_L, R3-DH/2, X_L, R4+DH/2, lbl="YES", lbl_col=YARROW)

# ── Q4-LEFT : C3 low / MPGN pattern? ─────────────────────────────────────────
diamond(X_L, R4, DW, DH, fill=GREEN)
dtext(X_L, R4, ["Complement C3 low", "or MPGN pattern?"], size=8.5)

# Q4L YES → MPGN dx (left)
X_MPGN = X_L - 195
harrow(X_L-DW/2, R4, X_MPGN+BW/2, X_MPGN, R5+BH/2, lbl="YES (↓C3)", lbl_col=PURPLE)
rrect(X_MPGN, R5-BH/2, BW, BH, fill=PURPLE, stroke=PURPLE)
text_in(X_MPGN, R5-BH/2, BW, BH,
        ["MPGN / Dense Deposit Disease",
         "↓C3 ± ↓C4",
         "IF: granular C3 ± IgG",
         "EM: subendothelial /",
         "intramembranous deposits"], size=7.5)

# Q4L NO → age split → children / adults
arr(X_L, R4-DH/2, X_L, R5+BH/2, lbl="NO", lbl_col=NRED)
# children left, adults right
X_CH = X_L - 85
X_AD = X_L + 85
c.setStrokeColor(ARROW_C); c.setLineWidth(1.5)
c.line(X_L, R5+BH/2, X_CH+BW/4, R5+BH/2)
c.line(X_L, R5+BH/2, X_AD+BW/4, R5+BH/2)
arr(X_CH+BW/4, R5+BH/2, X_CH+BW/4, R5+BH/2-5)
arr(X_AD+BW/4, R5+BH/2, X_AD+BW/4, R5+BH/2-5)

# Children dx
rrect(X_CH-BW/4, R5-BH/2, BW-5, BH, fill=GREEN, stroke=GREEN)
text_in(X_CH-BW/4, R5-BH/2, BW-5, BH,
        ["CHILDREN (<16 yrs)",
         "Minimal Change Dis. (75%)",
         "FSGS (10%)",
         "IF: negative",
         "EM: foot process fusion"], size=7.5)
c.setFont("Helvetica-Bold", 7); c.setFillColor(GREEN)
c.drawCentredString(X_CH+BW/4, R5+BH/2+4, "Age < 16")

# Adults dx
rrect(X_AD-BW/4+10, R5-BH/2, BW+5, BH, fill=GREEN, stroke=GREEN)
text_in(X_AD-BW/4+10, R5-BH/2, BW+5, BH,
        ["ADULTS",
         "FSGS (35%)  Membranous (30%)",
         "Diabetic nephropathy (2°)",
         "IF: IgG subepithelial (MN)",
         "EM: spike and dome (MN)"], size=7.5)
c.setFont("Helvetica-Bold", 7); c.setFillColor(GREEN)
c.drawCentredString(X_AD+BW/4+5, R5+BH/2+4, "Age ≥ 16")

# ── Q2-RIGHT : Hematuria + azotemia? ─────────────────────────────────────────
arr(X_R, R1, X_R, R2+DH/2)
diamond(X_R, R2, DW, DH, fill=RED)
dtext(X_R, R2, ["Hematuria / RBC casts", "+ azotemia present?"], size=8.5)

# Q2R NO → far-right
harrow(X_R+DW/2, R2, X_FR-NW/2+15, X_FR+NW/2-20, R2, lbl="NO", lbl_col=NRED)
rrect(X_FR-NW/2+15, R2-NH/2, NW, NH+10, fill=GREY, stroke=GREY)
text_in(X_FR-NW/2+15, R2-NH/2, NW, NH+10,
        ["Non-glomerular cause or", "isolated microscopic", "hematuria – further W/U"], size=7.5)

# Q2R YES → Q3R
arr(X_R, R2-DH/2, X_R, R3+DH/2, lbl="YES", lbl_col=YARROW)

# ── Q3-RIGHT : Hypertension + ↓GFR / oliguria? ───────────────────────────────
diamond(X_R, R3, DW, DH, fill=RED)
dtext(X_R, R3, ["Hypertension + ↓GFR", "/ oliguria?"], size=8.5)

# Q3R NO → right mild
harrow(X_R+DW/2, R3, X_FR-NW/2+15, X_FR+NW/2-20, R3, lbl="NO", lbl_col=NRED)
rrect(X_FR-NW/2+15, R3-NH/2, NW, NH+10, fill=GREY, stroke=GREY)
text_in(X_FR-NW/2+15, R3-NH/2, NW, NH+10,
        ["Mild nephritic:", "Consider IgA nephropathy", "or thin GBM disease"], size=7.5)

# Q3R YES → Q4R
arr(X_R, R3-DH/2, X_R, R4+DH/2, lbl="YES", lbl_col=YARROW)

# ── Q4-RIGHT : Creatinine doubles < 3 months? ────────────────────────────────
diamond(X_R, R4, DW, DH, fill=RED)
dtext(X_R, R4, ["Cr doubles in <3 months", "/ uremic emergency?"], size=8.5)

# Q4R NO → Classic nephritic
X_NI = X_R - 210
harrow(X_R-DW/2, R4, X_NI+BW/2+5, X_NI, R5+BH/2, lbl="NO", lbl_col=NRED)
rrect(X_NI, R5-BH/2, BW+10, BH+10, fill=RED, stroke=RED)
text_in(X_NI, R5-BH/2, BW+10, BH+10,
        ["CLASSIC NEPHRITIC",
         "Post-strep GN: ↓C3, ASOT+",
         "IgA nephropathy: IgA mesangial",
         "Lupus III/IV: ANA+, anti-dsDNA+",
         "ANCA vasculitis: pANCA / cANCA"], size=7.5)

# Q4R YES → RPGN box (below)
arr(X_R, R4-DH/2, X_R, R6+BH/2+25, lbl="YES", lbl_col=YARROW)

# ── RPGN big box ───────────────────────────────────────────────────────────────
RW, RH = 390, 90
rrect(X_R - RW/2, R6 - RH/2, RW, RH, fill=ORANGE, stroke=ORANGE, lw=2, r=9)
# title
c.setFont("Helvetica-Bold", 9); c.setFillColor(WHITE)
c.drawCentredString(X_R, R6 + RH/2 - 14, "RPGN / CRESCENTIC GN  (Cr doubles in weeks – uremic emergency)")
# type sub-boxes
sub_w = (RW - 20) / 3
sub_h = 50
sub_y = R6 - RH/2 + 8
labels = [
    ("TYPE I – Anti-GBM", ["(Goodpasture)", "Linear IgG on IF", "Anti-GBM Ab serology", "± Pulmonary hemorrhage"], colors.HexColor("#922B21")),
    ("TYPE II – Immune Complex", ["Granular IF", "↓C3/C4", "Post-infect · Lupus · IgA · MPGN", ""], colors.HexColor("#784212")),
    ("TYPE III – Pauci-immune", ["Negative IF", "cANCA (GPA) · pANCA (MPA)", "Most common in adults", ""], colors.HexColor("#1A5276")),
]
for i, (title, lns, col) in enumerate(labels):
    sx = X_R - RW/2 + 8 + i*(sub_w + 4)
    c.setFillColor(col); c.setStrokeColor(WHITE); c.setLineWidth(0.8)
    c.roundRect(sx, sub_y, sub_w, sub_h, 4, stroke=1, fill=1)
    c.setFont("Helvetica-Bold", 7); c.setFillColor(WHITE)
    c.drawCentredString(sx + sub_w/2, sub_y + sub_h - 10, title)
    c.setFont("Helvetica", 6.5)
    for j, ln in enumerate(lns):
        c.drawCentredString(sx + sub_w/2, sub_y + sub_h - 22 - j*10, ln)

# ══════════════════════════════════════════════════════════════════════════════
#  COMPLICATIONS FOOTER
# ══════════════════════════════════════════════════════════════════════════════
fy = 14
c.setFillColor(colors.HexColor("#DCE0E5"))
c.rect(0, fy-4, PW, 24, fill=1, stroke=0)

c.setFont("Helvetica-Bold", 7); c.setFillColor(GREEN)
c.drawString(12, fy+11, "NEPHROTIC complications:")
c.setFont("Helvetica", 7); c.setFillColor(DARK)
c.drawString(148, fy+11, "Thrombosis (↓AT-III, ↓Prot C/S)  ·  Infection (↓IgG, ↓IgM)  ·  Hyperlipidemia / lipiduria  ·  AKI (underfill, diuretics)  ·  Pleural effusion / ascites")

c.setFont("Helvetica-Bold", 7); c.setFillColor(RED)
c.drawString(650, fy+11, "NEPHRITIC complications:")
c.setFont("Helvetica", 7); c.setFillColor(DARK)
c.drawString(785, fy+11, "Hypertensive emergency  ·  Pulmonary edema  ·  Rapid CKD / ESRD  ·  Uremic emergency")

c.setFont("Helvetica", 6); c.setFillColor(GREY)
c.drawCentredString(PW/2, fy, "Sources: Robbins & Cotran Pathologic Basis of Disease 10e  ·  Comprehensive Clinical Nephrology 7e  ·  Brenner & Rector's The Kidney")

# ── LEGEND ────────────────────────────────────────────────────────────────────
lg_x, lg_y = PW - 178, PH - 48 - 110
c.setFillColor(colors.HexColor("#E8EDF2")); c.setStrokeColor(colors.HexColor("#B0BEC5"))
c.setLineWidth(0.8)
c.roundRect(lg_x-6, lg_y-8, 176, 104, 6, stroke=1, fill=1)
c.setFont("Helvetica-Bold", 8); c.setFillColor(DARK)
c.drawString(lg_x, lg_y + 88, "LEGEND")
entries = [
    (HEADER, "Entry node"),
    (QBLUE,  "Decision diamond"),
    (GREEN,  "Nephrotic pathway"),
    (RED,    "Nephritic pathway"),
    (PURPLE, "Mixed / MPGN"),
    (ORANGE, "RPGN / Crescentic GN"),
    (GREY,   "Non-specific / reassess"),
]
for i, (col, lbl) in enumerate(entries):
    row = i % 4
    col_off = 0 if i < 4 else 88
    ly = lg_y + 76 - row * 18
    c.setFillColor(col); c.rect(lg_x + col_off, ly, 11, 9, fill=1, stroke=0)
    c.setFont("Helvetica", 7); c.setFillColor(DARK)
    c.drawString(lg_x + col_off + 14, ly + 1, lbl)

# ══════════════════════════════════════════════════════════════════════════════
c.save()
print(f"Saved: {OUT}")
Running Command

cd /home/daytona/workspace/nephro-decision-tree && python3 build_tree_v2.py 2>&1 && pdftoppm -r 150 Nephro_Decision_Tree.pdf preview2 && python3 -c "from PIL import Image; img=Image.open('preview2-1.ppm'); img.save('preview2.png'); print(img.size)"

Reading File
Running Command

cd /home/daytona/workspace/nephro-decision-tree && python3 -c " # Quick coordinate patch: push X_L further left, fix RPGN placement # Read the script, apply targeted fixes import re code = open('build_tree_v2.py').read() # Move left column further left code = code.replace('X_L = 230', 'X_L = 255') # Move right column slightly left so RPGN fits code = code.replace('X_R = 870', 'X_R = 820') # Widen far-right margin code = code.replace('X_FR = 1090', 'X_FR = 1060') # Fix RPGN box: centre it between X_R and right edge, not too far right # Current: X_R - RW/2 ... with RW=390 → 820-195=625 to 820+195=1015 → fits # RPGN Y: R6-RH/2 where R6=330, RH=90 → 285 to 375 # Fix RPGN bottom cut: RH needs to be taller code = code.replace('RW, RH = 390, 90', 'RW, RH = 400, 95') open('build_tree_v3.py','w').write(code) print('done') " python3 build_tree_v3.py 2>&1 pdftoppm -r 150 Nephro_Decision_Tree.pdf preview3 python3 -c \"from PIL import Image; Image.open('preview3-1.ppm').save('preview3.png'); print('ok')\"

Running Command

cd /home/daytona/workspace/nephro-decision-tree && python3 build_tree_v3.py 2>&1

Running Command

cd /home/daytona/workspace/nephro-decision-tree && pdftoppm -r 150 Nephro_Decision_Tree.pdf preview3 && python3 -c "from PIL import Image; Image.open('preview3-1.ppm').save('preview3.png'); print('saved')"

Reading File
Running Command

ls -lh /home/daytona/workspace/nephro-decision-tree/Nephro_Decision_Tree.pdf

Your clinical decision tree is ready:

Nephro Decision Tree

PDF Document · PDF

- A3 landscape, print-ready

Here's what the tree covers, step by step:
Entry point: Patient with suspected glomerular disease
Branch 1 - Proteinuria ≥ 3.5 g/day?
  • YES → Nephrotic pathway (green)
  • NO / sub-nephrotic → Nephritic pathway (red)
Nephrotic branch (left, green):
  1. RBC casts / gross hematuria? → YES = mixed features (MPGN / Lupus, purple)
  2. Albumin < 3 g/dL + hyperlipidemia? → NO = re-evaluate orthostatic/overflow proteinuria
  3. C3 low / MPGN pattern? → YES = MPGN / Dense Deposit Disease
  4. Age split: Children (<16) → MCD 75%, FSGS 10% | Adults → FSGS 35%, Membranous 30%
Nephritic branch (right, red):
  1. Hematuria + azotemia? → NO = non-glomerular, further workup
  2. Hypertension + ↓GFR / oliguria? → NO = mild nephritic (IgA / thin GBM)
  3. Cr doubles in < 3 months? → NO = Classic nephritic (Post-strep GN, IgA, Lupus III/IV, ANCA)
  4. YES → RPGN / Crescentic GN (orange), split into:
    • Type I: Anti-GBM (Goodpasture) - linear IgG
    • Type II: Immune complex - granular IF, ↓C3/C4
    • Type III: Pauci-immune (ANCA) - negative IF
Footer bar: Nephrotic complications vs. Nephritic complications side by side.

Gonadal hormones drugs pharmacology and medicine

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
I now have comprehensive data from Goodman & Gilman's across all major drug classes. Let me compile the full answer:

Gonadal Hormones: Drugs, Pharmacology & Medicine

(Based on Goodman & Gilman's The Pharmacological Basis of Therapeutics, 14e)

Overview: The HPG Axis - Pharmacological Control Points

The hypothalamic-pituitary-gonadal (HPG) axis provides multiple drug targets:
Hypothalamus → GnRH (pulsatile)
      ↓
Anterior pituitary → FSH + LH
      ↓
Gonads → Estradiol / Progesterone / Testosterone
      ↓
Target tissues (ER / PR / AR)
      ↓ (negative feedback)
Drugs act at every level: GnRH analogues, gonadotropins, sex steroid agonists/antagonists, receptor modulators, and enzyme inhibitors.

I. ESTROGENS

Chemistry & Classification

ClassExamples
Steroidal (natural)Estradiol (17β-estradiol), estrone, estriol
Steroidal (synthetic)Ethinyl estradiol, mestranol, estradiol valerate/cypionate
Nonsteroidal syntheticDiethylstilbestrol (DES)
Conjugated equine estrogens (CEE)Premarin - mixture of sulfated estrogens

Mechanism of Action

Estrogens act via two nuclear receptors - ERα and ERβ - which function as ligand-activated transcription factors. The ER-ligand complex dimerizes, binds estrogen response elements (EREs) in gene promoters, and recruits co-activators/co-repressors. Non-genomic signaling also occurs via membrane-associated ERs (rapid effects on ion channels, kinase cascades).

Pharmacokinetics

  • Oral estradiol undergoes extensive first-pass hepatic metabolism → converted to estrone and estrone sulfate
  • Ethinyl estradiol: synthetic, highly resistant to first-pass metabolism → far more potent orally than natural estradiol
  • 0.625 mg conjugated estrogens ≈ 5-10 μg ethinyl estradiol (in terms of oral potency)
  • Routes: oral, transdermal patch/gel, vaginal ring/cream, IM injection (esters)
  • Transdermal avoids first-pass effect → lower hepatic impact on clotting factors and SHBG

Physiological Effects

  • Secondary sexual development in females (puberty)
  • Endometrial proliferation (→ requires progestin opposition to prevent hyperplasia/cancer)
  • Bone: inhibits osteoclast activity → maintains bone mineral density
  • Cardiovascular: favorable lipid profile (↑HDL, ↓LDL); complex vascular effects
  • CNS: influences thermoregulation (hot flashes when deficient), mood, cognition
  • Liver: stimulates synthesis of clotting factors, SHBG, angiotensinogen, triglycerides

Therapeutic Uses

1. Menopausal Hormone Therapy (MHT)
  • Vasomotor symptoms (hot flashes, sweats) - most efficacious treatment
  • Urogenital atrophy (vaginal dryness, dyspareunia)
  • Osteoporosis prevention (reduces fracture risk)
  • Women with intact uterus: must add progestin to prevent endometrial cancer
  • Women post-hysterectomy: estrogen alone is appropriate
  • Principle: minimum effective dose for shortest necessary duration
2. Oral Contraceptives (see Section IV below)
3. Female hypogonadism - primary ovarian insufficiency, Turner syndrome
4. Transgender hormone therapy (male-to-female)

Adverse Effects

  • Thromboembolism (DVT, PE) - oral > transdermal; related to hepatic effect on clotting factors
  • Endometrial cancer (unopposed estrogen)
  • Breast cancer (long-term combination MHT - WHI trial data)
  • Migraine exacerbation
  • Nausea, fluid retention
  • Hypertriglyceridemia (oral route)
  • Contraindicated in: active thromboembolism, hormone-sensitive cancers, unexplained vaginal bleeding, active liver disease, pregnancy

II. PROGESTINS (Progestogens)

Classification

ClassKey DrugsNotes
PregnanesProgesterone (natural), MPA (medroxyprogesterone acetate), dydrogesteroneProgesterone has rapid first-pass metabolism; micronized form available
Estranes (19-nortestosterone)Norethindrone, norethynodrelSome androgenic activity
Gonanes (19-nortestosterone)Levonorgestrel, norgestrel, norgestimate, desogestrelProgestational; components of contraceptives
Spirolactone-derivedDrospirenoneAntimineralocorticoid activity; used in OCs
Antiprogestins/modulatorsMifepristone, ulipristalSee below

Mechanism of Action

Bind progesterone receptors (PR-A and PR-B) → nuclear transcription regulation. Oppose estrogen-driven endometrial proliferation → converts proliferative to secretory endometrium. In sufficient doses, suppress LH surge → prevent ovulation.

Key Uses

  • MHT - endometrial protection (any woman with a uterus on estrogen must have progestin added)
  • Contraception (oral, injectable, implant, IUD, emergency)
  • Assisted reproductive technology (luteal phase support)
  • Endometriosis (depot MPA suppresses menstruation/lesions)
  • Dysfunctional uterine bleeding
  • Threatened/habitual abortion (progesterone support)

Key Drugs in Detail

Medroxyprogesterone acetate (MPA / Depo-Provera)
  • Depot IM injection (150 mg every 3 months) - highly effective contraceptive
  • Suppresses ovarian function → amenorrhea common
  • Caution: delayed return of fertility (6-18 months); transient bone mineral density loss
Levonorgestrel
  • Emergency contraception (Plan B): 1.5 mg within 72 h of unprotected sex
  • Progestin-only pill ("mini-pill")
  • IUD (Mirena): local uterine delivery, minimal systemic absorption
Micronized progesterone (Prometrium)
  • Bioidentical; preferred by many over synthetic progestins for MHT
  • Oral or vaginal; better tolerated (less androgenic/glucocorticoid effects)

Mifepristone (RU-486)

  • Competitive antagonist at both PR isoforms (also anti-glucocorticoid at high doses)
  • Medical abortion: combined with misoprostol (PGE1 analogue) for termination up to 10 weeks
  • Also used for Cushing's syndrome (mifepristone blocks glucocorticoid receptor)

Ulipristal Acetate

  • Partial PR agonist/antagonist
  • Emergency contraception up to 120 h (5 days) post-intercourse - more effective than levonorgestrel, especially days 3-5

III. ANDROGENS

Physiology

  • Testosterone is the principal androgen in both men and women
  • Men: produced by Leydig cells (LH-stimulated); ~7 mg/day
  • Women: corpus luteum + adrenal cortex; ~0.25 mg/day
  • Precursors: androstenedione, DHEA (weak androgens, converted peripherally)
  • Dihydrotestosterone (DHT): formed by 5α-reductase in prostate, skin, hair follicles - more potent at AR; responsible for prostate growth, male-pattern baldness
  • Aromatization: testosterone → estradiol (via aromatase, in adipose/brain/bone)

Testosterone Across the Life Cycle

StageLevelSignificance
1st trimester fetus~250 ng/dLMale sexual differentiation (Wolffian duct development, external genitalia)
Birth~250 ng/dLBrief postnatal surge
2-3 months postnatal~250 ng/dL"Minipuberty"
Childhood<50 ng/dLMinimal
Puberty (12-17 yrs)Rising to adult levelsExternal genitalia growth, muscle, bone, voice, sexual hair, spermatogenesis
Adult male300-1000 ng/dLMaintained by HPG axis
Postpuberty deficiencyVariableLibido ↓ (weeks), Hgb ↓ (months), bone density ↓ (1 yr), muscle loss (years)

Therapeutic Androgen Preparations

PreparationRouteDetails
Testosterone enanthate / cypionateDeep IM injection q 1-2 weeksFormulated in oil; wide serum fluctuations → mood/libido swings
Testosterone undecanoateIM q 10-14 weeks or oralLong-acting IM; oral form bypasses first-pass via lymphatics
Testosterone gel/solution (1-2%)Transdermal dailyStable levels; risk of transfer to others via skin contact
Testosterone patchTransdermal dailySkin irritation common
Buccal testosteroneBuccal mucosa twice dailyAvoids first-pass; gum irritation
Alkylated androgens (methyltestosterone, oxandrolone)Oral17α-alkylated - resist first-pass but hepatotoxic (peliosis hepatis, cholestasis)
Nandrolone decanoateIMAnabolic with lower androgenic ratio
Oral testosterone itself is ineffective due to rapid hepatic catabolism. Preparations are designed to bypass this.

Therapeutic Uses of Androgens

  1. Male hypogonadism (primary or secondary) - restore virilization, sexual function, energy, bone density, mood
  2. Delayed puberty in boys - short course to initiate puberty
  3. Female hypogonadism / low libido - low-dose supplementation
  4. Wasting/catabolic states - HIV wasting, burns, major surgery (anabolic effect)
  5. Aplastic anemia - stimulate erythropoiesis
  6. Hereditary angioedema - anabolic androgens increase C1-inhibitor synthesis

Adverse Effects of Androgens

  • Virilization in women (acne, hirsutism, clitoromegaly, voice deepening)
  • Polycythemia (↑ EPO secretion)
  • Dyslipidemia (↓HDL, ↑LDL)
  • Suppression of spermatogenesis (negative HPG feedback → male contraceptive research)
  • Hepatotoxicity (17α-alkylated compounds)
  • Acne, oily skin
  • Prostatic growth (contraindicated in prostate cancer)
  • Premature epiphyseal closure if used in adolescents
  • Cardiovascular events (↑ RBC viscosity, dyslipidemia)

Selective Androgen Receptor Modulators (SARMs)

Tissue-selective AR agonists designed to maximize anabolic effects (muscle, bone) while minimizing androgenic effects (prostate, scalp). Currently investigational (enobosarm/ostarine most studied); none yet approved.

IV. ORAL CONTRACEPTIVES

Combined Oral Contraceptives (COCs)

Mechanism of contraceptive action (multiple):
  1. Inhibition of LH surge → prevent ovulation (primary mechanism)
  2. Altered cervical mucus → impairs sperm penetration
  3. Altered endometrial receptivity → prevents implantation
  4. Altered tubal motility
Components:
  • Estrogen: ethinyl estradiol (20-35 µg/day in modern pills); or estradiol valerate/estetrol in newer formulations
  • Progestin: varies by generation
GenerationProgestinsNotes
1stNorethindrone, norethynodrelModerate androgenic activity
2ndLevonorgestrel, norgestrelStandard; lower VTE risk vs. 3rd/4th gen
3rdDesogestrel, gestodene, norgestimateLess androgenic; slightly higher VTE risk vs. 2nd gen
4thDrospirenone, dienogestAntimineralocorticoid (drospirenone); anti-androgenic; used in PCOS, acne
Formulations:
  • Monophasic: fixed estrogen + progestin dose throughout cycle
  • Biphasic/triphasic: varying doses to mimic natural cycle (theoretical advantage unproven)
  • Extended cycle / continuous (e.g., Seasonale): 84 active pills + 7 placebo → 4 periods/year
  • Progestin-only pill ("mini-pill"): no estrogen; mechanism mainly cervical mucus + endometrium; must be taken at precise same time daily
Non-contraceptive benefits of COCs:
  • Dysmenorrhea relief
  • Management of endometriosis
  • PCOS (cycle regulation, acne, hirsutism)
  • PMS/PMDD (drospirenone-containing)
  • Iron-deficiency anemia (reduced menstrual blood loss)
  • Reduced risk of ovarian and endometrial cancer
  • Acne treatment (anti-androgenic progestins)
Risks and Contraindications (WHO MEC):
  • VTE (absolute contraindication in history of DVT/PE; risk ×3-4 with COCs)
  • Arterial events: stroke, MI (risk highest with smoking + age >35)
  • Hypertension (can worsen; estrogen raises angiotensinogen)
  • Breast cancer (modest increased risk with current use)
  • Liver disease / hepatic adenoma
  • Migraine with aura (contraindication - ischemic stroke risk)
  • Absolute contraindications: smoking >35 yrs + age >35, active VTE, stroke/MI history, hormone-sensitive cancer, active liver disease, unexplained vaginal bleeding

V. GnRH ANALOGUES

GnRH Agonists (Paradoxically Suppress Gonadal Function)

Continuous (non-pulsatile) GnRH receptor stimulation → receptor downregulation → suppressed FSH/LH → medical castration
DrugRoute
Leuprolide (leuprorelin)SC/IM depot (monthly, 3-monthly, 6-monthly)
GoserelinSC implant
Buserelin, nafarelinIntranasal
TriptorelinIM depot
Initial "flare" effect: first 1-2 weeks → transient ↑ in FSH/LH/testosterone (important in prostate cancer - can worsen bone pain temporarily; cover with antiandrogen)
After 1-3 weeks: pituitary downregulation → sustained hypogonadotropic hypogonadal state
Uses:
  • Prostate cancer (androgen deprivation therapy)
  • Endometriosis
  • Uterine fibroids (leiomyomas)
  • Precocious puberty
  • Controlled ovarian hyperstimulation (IVF protocols) - used with gonadotropins to prevent premature LH surge
  • Breast cancer (premenopausal ER+ - ovarian suppression)
  • Menstrual suppression (thrombocytopenia, transsexual transitioning)
Long-term side effects: hot flashes, osteoporosis (add bisphosphonate ± add-back therapy), sexual dysfunction, fatigue, cognitive effects

GnRH Antagonists (Immediate Suppression - No Flare)

Competitive receptor antagonists → immediate ↓ FSH/LH (no flare effect)
DrugUse
Cetrorelix, ganirelixIVF - prevent premature LH surge
DegarelixProstate cancer (no flare; preferred if spinal metastases or urinary obstruction)
ElagolixEndometriosis (oral); also used in uterine fibroids
RelugolixProstate cancer (oral, daily)

VI. SELECTIVE ESTROGEN RECEPTOR MODULATORS (SERMs)

SERMs bind ERα/ERβ but have tissue-selective agonist or antagonist activity depending on the local co-regulator environment.
DrugBreastBoneUterusUses
TamoxifenAntagonistAgonistAgonistBreast cancer (adjuvant + treatment); risk of endometrial cancer
RaloxifeneAntagonistAgonistNeutral/antagonistOsteoporosis; breast cancer prevention; no endometrial risk
ToremifeneAntagonist--Breast cancer
BazedoxifeneAntagonistAgonistNeutralOsteoporosis prevention; paired with CEE ("TSEC" - tissue-selective estrogen complex)
OspemifeneNeutral-Some agonismDyspareunia / HSDD (postmenopausal); oral
ClomipheneAntagonist--Infertility (anovulation); blocks hypothalamic ER → removes negative feedback → ↑ FSH/LH
All SERMs: increased VTE risk (similar to estrogen)
Tamoxifen (key details):
  • Competitive inhibitor of 17β-estradiol binding to ER
  • In breast: net antagonist → used in ER+ breast cancer (premenopausal and postmenopausal)
  • In bone and liver: agonist → maintains bone density, favorable lipid effects
  • In uterus: agonist → endometrial hyperplasia and cancer risk (important ADR)
  • Metabolized by CYP2D6 to active metabolite endoxifen; CYP2D6 inhibitors (e.g., fluoxetine, paroxetine) reduce efficacy
Fulvestrant (not a SERM - pure antagonist / SERD):
  • Selective Estrogen Receptor Downregulator (SERD)
  • Competitively binds ER → no agonist activity → promotes receptor degradation
  • IM monthly injection
  • ER+ HER2- advanced breast cancer (post-aromatase inhibitor failure)

VII. AROMATASE INHIBITORS (Estrogen Synthesis Inhibitors)

Block conversion of androgens → estrogens (aromatase = CYP19A1), primarily used in postmenopausal women (adrenal/peripheral aromatization is the main estrogen source post-menopause).
DrugTypeNotes
AnastrozoleNon-steroidal (reversible)Once daily oral; breast cancer adjuvant
LetrozoleNon-steroidal (reversible)Also used for ovulation induction in PCOS
ExemestaneSteroidal (irreversible, "suicide inhibitor")Aromatase inactivation; different resistance pattern
Uses:
  • Adjuvant therapy for postmenopausal ER+ breast cancer (more effective than tamoxifen postmenopausally)
  • Metastatic breast cancer
  • Letrozole: ovulation induction (increasingly first-line over clomiphene in PCOS)
ADRs: arthralgia/myalgia ("AI arthropathy"), osteoporosis (↓ estrogen → ↑ bone resorption), hot flashes, vaginal dryness; NOT suitable for premenopausal women (ovarian aromatase overwhelms inhibition unless combined with GnRH agonist)

VIII. ANTIANDROGENS

Inhibitors of Androgen Synthesis

DrugMechanismUse
Ketoconazole (high dose)Blocks multiple steroidogenic enzymes (CYP17A1)Rapid castration (adrenal crisis risk)
AbirateroneSelective CYP17A1 inhibitor (17α-hydroxylase + 17,20-lyase)Castration-resistant prostate cancer; given with prednisone (prevents mineralocorticoid excess)
Finasteride5α-reductase type II inhibitor → ↓ DHTBPH, male-pattern baldness (Propecia)
Dutasteride5α-reductase type I + II inhibitor → ↓ DHT more completelyBPH

Androgen Receptor Antagonists

DrugGenerationNotes
Flutamide1st genHepatotoxic; rarely used now
Bicalutamide2nd genBetter tolerated; prostate cancer
Enzalutamide3rd genNo agonist activity; crosses BBB (seizure risk); castration-resistant prostate cancer
Apalutamide, darolutamide3rd genMetastatic/non-metastatic prostate cancer; darolutamide - lower CNS penetration
SpironolactoneNon-selective (also MR antagonist)Hirsutism in women; acne; used off-label as anti-androgen in trans women
Cyproterone acetateProgestogenic antiandrogenHirsutism; trans women; not available in USA

IX. PDE5 INHIBITORS (Erectile Dysfunction)

Mechanism: Nitric oxide (NO) → guanylyl cyclase → cGMP → smooth muscle relaxation in corpus cavernosum → increased blood flow → erection. PDE5 degrades cGMP; PDE5 inhibitors prolong cGMP action.
DrugOnsetDurationNotes
Sildenafil (Viagra)4 h30-60 min12 hAlso used for pulmonary arterial hypertension; affected by food (high-fat meal delays absorption)
Vardenafil4 h30-60 min10 hMost potent PDE5 selectivity (Ki 0.1 nM)
Tadalafil (Cialis)17.5 h30-120 min36 h"Weekend pill"; also used for BPH; not affected by food
Avanafil1.3-2 h15-30 min6 hFastest onset; least food effect
Critical drug interaction: Absolute contraindication with organic nitrates (both raise cGMP/cGMP-dependent pathways → catastrophic hypotension). Also caution with α-blockers.
ADRs: Headache, flushing, dyspepsia, nasal congestion, visual disturbances (sildenafil/vardenafil - PDE6 inhibition in retina), priapism (>4 hours → urological emergency)

X. GONADOTROPINS

DrugCompositionUse
FSH (follitropin α/β, urofollitropin)Recombinant or urinary FSHOvulation induction (IVF); male infertility (spermatogenesis)
LH (lutropin α)Recombinant LHCombined with FSH in ovulation induction
hCG (choriogonadotropin)LH-like activityTrigger ovulation; male hypogonadism (stimulate Leydig cells); cryptorchidism
Menotropins (hMG)FSH + LH from urinary sourceOvulation induction
Risk of ovarian hyperstimulation syndrome (OHSS) - potentially life-threatening complication of gonadotropin therapy; characterized by enlarged ovaries, ascites, pleural effusions, hemoconcentration, thrombosis.

XI. Quick Clinical Reference Summary

Drug ClassKey DrugsMain UseCritical ADR/Interaction
EstrogensEstradiol, ethinyl estradiol, CEEMHT, contraceptionVTE, endometrial Ca (unopposed)
ProgestinsProgesterone, MPA, levonorgestrelMHT, contraception, ARTMood changes, irregular bleeding, thrombosis
Combined OCEthinyl estradiol + progestinContraceptionVTE, migraine with aura
GnRH agonistsLeuprolide, goserelinProstate Ca, endometriosisFlare effect, osteoporosis
GnRH antagonistsDegarelix, elagolixProstate Ca, endoOsteoporosis (no flare)
SERMsTamoxifen, raloxifeneBreast Ca, osteoporosisVTE; tamoxifen → endometrial Ca
SERDsFulvestrantER+ breast CaIM only; injection site reactions
Aromatase inhibitorsAnastrozole, letrozole, exemestanePostmeno breast CaArthralgia, osteoporosis
AndrogensTestosterone (various forms)Male hypogonadismPolycythemia, virilization, suppressed spermatogenesis
AntiandrogensEnzalutamide, abiraterone, finasterideProstate Ca, BPH, hirsutismAbiraterone: mineralocorticoid excess
MifepristoneMifepristoneMedical abortionAnti-glucocorticoid at high doses
PDE5 inhibitorsSildenafil, tadalafilErectile dysfunction, PAHNitrate contraindication, priapism
GonadotropinsFSH, hCGART, hypogonadismOHSS

Source: Goodman & Gilman's The Pharmacological Basis of Therapeutics, 14e - Chapter 49 (Estrogens, Progestins, Androgens) and Chapter 48 (SERMs, aromatase inhibitors)

Needle stick injury microbiology

Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Reading File
I now have comprehensive, multi-source data. Here is the complete answer:

Needlestick Injury - Microbiology & Management


What Is a Needlestick Injury?

A needlestick (percutaneous sharps) injury is accidental puncture of the skin by a needle or other sharp instrument contaminated with blood or body fluid. An estimated 600,000-800,000 needlestick injuries occur annually in the US among healthcare workers. The three principal bloodborne pathogens of concern are HIV, HBV (Hepatitis B), and HCV (Hepatitis C).

The Three Key Pathogens

1. Hepatitis B Virus (HBV)

Organism: Hepadnaviridae family; partially double-stranded circular DNA virus. Serological markers:
  • HBsAg - surface antigen; marker of infection
  • HBeAg - "e" antigen; marker of active viral replication and HIGH infectivity
  • Anti-HBs - protective antibody; marker of immunity (vaccination or recovery)
Environmental survival: HBV retains infectivity at room temperature for at least 7 days after drying on surfaces - the most environmentally stable of the three bloodborne pathogens.
Transmission risk after needlestick:
Source StatusRisk of Clinical HepatitisRisk of Seroconversion
HBsAg+ AND HBeAg+ (high viremia)22-31%37-62%
HBsAg+ but HBeAg- (low viremia)1-6%23-37%
HBsAg-NegligibleNegligible
HBV has the highest per-exposure transmission risk of all three bloodborne pathogens after needlestick.

2. Hepatitis C Virus (HCV)

Organism: Flaviviridae family; single-stranded positive-sense RNA virus. 6 major genotypes (1-6); genotype 1 predominant in USA.
Transmission risk after needlestick:
  • Average seroconversion rate: ~1.8% (range 0-7%)
  • Risk factors for transmission:
    • Deep injury
    • Hollow-bore needle (carries larger blood volume)
    • Visible blood on needle
    • High source viral load
Note: HCV is not transmitted efficiently by needlestick compared to HBV, but is far more likely to establish chronic infection (55-85% chronicity rate) compared to HBV (5-10% in adults).

3. Human Immunodeficiency Virus (HIV)

Organism: Retroviridae, subfamily Lentiviridae; single-stranded RNA virus with reverse transcriptase. Tropism for CD4+ T-helper cells and macrophages.
Transmission risk after needlestick:
RouteRisk per Exposure
Percutaneous (needlestick) from known HIV+ source~0.3%
Mucous membrane splash~0.09%
Non-intact skin<0.09%
Intact skinNegligible
Factors that increase HIV transmission risk:
  • Large volume of blood (visible blood contamination on device)
  • Deep injury
  • Device placed directly in vein or artery
  • High source viral load / advanced AIDS (source patient dying within 2 months of exposure)
  • Prolonged contact
Contrast: HBV (22-31%) > HCV (1.8%) > HIV (0.3%) - HBV is the most transmissible by needlestick by far.

Other Pathogens (Less Common)

PathogenNotes
HDV (Hepatitis D)Only infects HBsAg-positive individuals (requires HBV co-infection); PEP same as HBV
HTLV-1/2Rare occupational transmission reported
MalariaRare case reports
SyphilisTheoretical; Treponema pallidum very fragile outside host
TetanusEspecially with soil/dirt-contaminated needles found in community settings

Immediate Management Steps (Universal for All Needlestick Injuries)

Step 1: First Aid (IMMEDIATE)

  1. Do not squeeze or suck the wound
  2. Wash thoroughly with soap and water for a minimum of 15 minutes
  3. For mucous membrane splashes (eyes, mouth): irrigate copiously with water/saline
  4. Allow the wound to bleed freely

Step 2: Report & Assess (Within Hours)

  1. Report to supervisor immediately
  2. Document: time/date, type of sharp, activity being performed, site and depth of injury, source patient details
  3. Test the source patient (with consent where applicable) for:
    • HIV (rapid antibody/antigen test)
    • HBsAg (Hepatitis B surface antigen)
    • Anti-HCV (Hepatitis C antibody)
  4. Test the exposed healthcare worker (baseline) for:
    • HIV (antibody/antigen)
    • Anti-HCV
    • Anti-HBs (Hepatitis B surface antibody - to assess immunity)
    • HBsAg
  5. Review vaccination history (especially HBV)
  6. Consider tetanus prophylaxis based on vaccination status and wound type

Pathogen-Specific Post-Exposure Prophylaxis (PEP)

Hepatitis B PEP

Management depends on the exposed worker's vaccination/immune status and the source's HBsAg status:
Exposed Worker's StatusSource HBsAg+Source HBsAg-Source Unknown
UnvaccinatedHBIG × 1 dose (0.06 mL/kg IM) + start HBV vaccine seriesStart HBV vaccine seriesStart HBV vaccine series
Vaccinated - known responder (anti-HBs ≥10 mIU/mL)No treatmentNo treatmentNo treatment
Vaccinated - known non-responderHBIG × 1 + start vaccine series OR HBIG × 2 dosesNo treatmentHBIG × 1 + start vaccine series or HBIG × 2
Vaccinated - antibody response unknownTest anti-HBs: if <10 → HBIG × 1 + vaccine booster; if ≥10 → no treatmentNo treatmentTest anti-HBs; if <10 → vaccine booster; recheck in 1-2 weeks
Key points:
  • HBIG and HBV vaccine can be given simultaneously at different anatomical sites
  • PEP should be administered as soon as possible after exposure (within 24 hours ideally)
  • HBV vaccine series (3-dose: 0, 1, 6 months) is the best pre-exposure prevention

Hepatitis C PEP

No pharmacological PEP is currently recommended for HCV.
Management focuses on:
  1. Baseline anti-HCV testing of exposed worker
  2. Follow-up testing at 3-6 months for seroconversion
  3. If source is HCV-positive: consider HCV RNA testing at 3-4 weeks post-exposure for early detection
  4. If acute HCV infection is confirmed: refer to hepatologist - highly effective direct-acting antivirals (DAAs) can achieve sustained virological response (SVR) ≥95% even in acute phase
  5. Treat acute HCV rather than waiting for spontaneous clearance (which occurs in ~15-45%)

HIV PEP

PEP must be initiated within 72 hours - the sooner the better (ideally within 1 hour). Efficacy diminishes significantly with delay beyond 72 hours.
Preferred PEP Regimen (US DHHS / Goldman-Cecil guidelines):
Tenofovir disoproxil fumarate (TDF) / Emtricitabine (FTC) [Truvada] + Dolutegravir (or Raltegravir)
  • 3-drug regimen
  • Duration: 28 days (4 weeks)
ComponentDrugClass
BackboneTDF/FTC (Truvada) or TAF/FTC (Descovy)NRTI
Third agent (preferred)Dolutegravir (DTG)Integrase inhibitor
Third agent (alternative)Raltegravir (RAL)Integrase inhibitor
Follow-up testing for exposed worker:
  • HIV antibody/antigen at 4-6 weeks, 3 months, and 6 months
  • If taking PEP: monitor for drug toxicity (renal function with TDF; metabolic effects)
Important considerations:
  • If source patient is on antiretroviral therapy with known drug resistance, consult specialist
  • National Clinicians' Post-Exposure Prophylaxis Hotline: 1-888-448-4911 (24/7 consultation)
  • If source HIV status is unknown: assess epidemiologic likelihood and initiate PEP if high suspicion, with reassessment when source testing results return
Restrictions during follow-up period (regardless of PEP):
  • Refrain from donating blood, plasma, organs, tissue, or semen
  • No need to modify sexual practices or avoid pregnancy (exposed person is not infectious to contacts)
  • No specific precautions needed to prevent secondary household transmission

Community Needlestick (Non-Occupational)

Children and members of the public who sustain injuries from needles discarded in public places (parks, public toilets):
  • Risk is generally lower than occupational injury (older needle, less blood volume, dried)
  • A review of 14 studies found no transmissions among 613 children exposed to community needlesticks (for HIV, HBV, HCV)
  • However, every community needlestick warrants evaluation, wound care, and counseling
  • Tetanus prophylaxis especially important (soil/environmental contamination)
  • HBV PEP decision based on vaccination status
  • HIV PEP: based on epidemiological risk assessment (estimated prevalence of HIV among IDUs in local community)

Risk Factor Summary for High-Transmission Exposures

Transmission risk is HIGHER when:
  • Deep percutaneous injury (vs. superficial)
  • Hollow-bore needle (vs. solid suture needle)
  • Visible blood on device
  • Device placed in vein or artery (blood-filled)
  • Large volume of blood
  • High viral titer in source (HIV: advanced AIDS; HBV: HBeAg+, high DNA)
  • Source dies within 2 months of exposure (marker of advanced disease)

Prevention Strategies

  1. Universal/Standard Precautions - treat all blood and body fluids as potentially infectious at all times
  2. HBV vaccination of all healthcare workers - most effective single intervention (gives >95% seroprotection)
  3. Safety-engineered devices - self-sheathing needles, needleless IV systems, retractable lancets
  4. No recapping of needles - single most common activity leading to needlestick injury
  5. Proper disposal: sharps containers - never overfill; place near point of use
  6. PPE: gloves, eye protection, gowns when splash risk exists
  7. Occupational health reporting systems - encourage reporting culture (many needlestick injuries go unreported)
  8. Double-gloves during high-risk procedures (surgical, obstetric)

Comparative Transmission Risk Summary

FeatureHBVHCVHIV
Per-needlestick risk22-62% (HBeAg+)~1.8%~0.3%
Environmental stabilitySurvives 7 days dryHours-daysMinutes-hours
Vaccine availableYes (highly effective)NoNo
PEP availableYes (HBIG + vaccine)NoYes (ARV, 28 days)
Chronicity if infected5-10% (adults)55-85%100% (lifelong)
Cure possibleFunctional cure (HBsAg loss)Yes (DAAs, >95% SVR)No (suppression only)

Sources: Yamada's Textbook of Gastroenterology 7e; Jawetz, Melnick & Adelberg's Medical Microbiology 28e; Goldman-Cecil Medicine; Harriet Lane Handbook 23e; Red Book 2021 (AAP)
This is a shared conversation. Sign in to Orris to start your own chat.