Arthritis

Reading File
Asking for Preferences
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
Reading File
Reading File
Loading Image
I now have comprehensive content across all major arthritis types. Let me compile the full clinical deep-dive.

Arthritis: Overview of All Types - Clinical Deep Dive

Arthritis literally means "joint inflammation," but it encompasses a wide spectrum of diseases ranging from purely degenerative to strongly autoimmune and infectious. The major categories are outlined below.

1. Osteoarthritis (OA)

Definition & Epidemiology

Osteoarthritis - also called degenerative joint disease - is the most common form of arthritis and the leading cause of work disability in the United States (17% of all disability). It affects roughly 20% of the U.S. population, with radiographic evidence in almost all patients over 75. Prevalence rises exponentially after age 50, affecting about 40% of people over 70. It occurs equally in men and women ages 45-55, but becomes more common in women after 55.

Classification

TypeDescription
Primary (idiopathic)Appears insidiously as an aging phenomenon; oligoarticular, affects weight-bearing joints
HereditaryCollagen gene defects; inflammatory hand OA (Heberden/Bouchard nodes) runs in families
SecondaryPrior cartilage damage from trauma, obesity, hemochromatosis, RA, gout, CPPD, neuropathy, acromegaly

Pathogenesis

OA is primarily a degenerative disorder of articular cartilage, with inflammation acting as a secondary contributor. Biomechanical stress is the principal mechanism. The process unfolds in three stages:
OA Pathogenesis - Stages from chondrocyte injury to late OA
  1. Chondrocyte injury - Genetic/biomechanical insults damage Type II collagen and proteoglycans
  2. Early OA - Chondrocytes proliferate and release BMP (repair attempt), but MMPs degrade collagen and proteoglycans; PGE2, NO, TNF drive further damage; degradation exceeds repair
  3. Late OA - Chondrocyte dropout, apoptosis, subchondral bone changes, osteophyte formation, loose bodies
(Robbins & Kumar Basic Pathology, p. 790)

Clinical Features

  • Insidious onset of joint pain, worse with activity, relieved by rest
  • Morning stiffness < 30 minutes (vs. > 1 hour in RA)
  • Bony enlargement (osteophytes): Heberden nodes (DIP), Bouchard nodes (PIP) in hands
  • Crepitus on joint movement
  • No systemic features - OA is purely articular
  • Most OA is asymptomatic - an incidental radiographic finding

Joints Affected

Primarily weight-bearing: knees, hips, lumbar and cervical spine, first MTP joint, DIP and PIP joints of hands.

Investigations

  • X-ray: joint space narrowing, osteophytes, subchondral sclerosis, subchondral cysts
  • No serologic markers (RF and ANA negative)
  • Synovial fluid: non-inflammatory (WBC < 2000/mm³)

Treatment

  • Non-pharmacologic: Weight loss (reduces load on joints), low-impact exercise, physiotherapy, assistive devices
  • Pharmacologic: NSAIDs are the first-line pharmacologic choice; topical NSAIDs for knee/hand OA; acetaminophen for mild pain; intra-articular corticosteroids for flares
  • Surgical: Joint replacement for severe, refractory disease
(Textbook of Family Medicine 9e, p. 873)

2. Rheumatoid Arthritis (RA)

Definition & Epidemiology

RA is a chronic, systemic inflammatory autoimmune disease in which cellular and humoral immunity results in destruction of synovium and other tissues. It affects 1-2% of adults, with a 3:1 female predominance. Peak incidence is ages 20-50. Without treatment, >70% of patients with polyarticular RF-positive RA develop joint erosions within 2 years.

Pathogenesis

  • Genetic: Strong HLA-DR association (HLA-DRB1 "shared epitope"); higher concordance in monozygotic twins
  • Trigger: Unknown inciting event (possibly infectious) activates synovial lining cells and subsynovial vessels → pannus formation (aggressive proliferative synovium)
  • Immune cascade: Leukocyte invasion, protease and cytokine release (TNF-α, IL-1, IL-6 are key)
  • Autoantibodies: Rheumatoid factor (RF) targets IgG Fc; anti-citrullinated peptide antibodies (ACPA/anti-CCP) are more specific and appear years before clinical disease
  • Pannus invades and destroys cartilage and bone → ankylosis in late disease

Clinical Features

  • Symmetric synovitis of small joints of hands and feet - hallmark
  • Morning stiffness > 1 hour
  • Constitutional symptoms: fatigue, fever, weight loss
  • Progression: Wrists → MCPs → PIPs → knees → ankles → larger joints (spares DIP joints, distinguishing it from OA and psoriatic arthritis)
  • Extra-articular manifestations:
    • Rheumatoid nodules (subcutaneous, over pressure points)
    • Pulmonary: interstitial lung disease, pleural effusion
    • Cardiac: pericarditis, accelerated atherosclerosis
    • Ocular: scleritis, sicca syndrome
    • Vasculitis, neuropathy
    • Cervical spine: atlantoaxial subluxation (C1-C2 instability - risk of cord compression)

ACR 1987 Diagnostic Criteria (≥4 of 7, present ≥6 weeks)

  1. Morning stiffness ≥ 1 hour
  2. Arthritis of ≥ 3 joint areas
  3. Arthritis of hand joints (wrists, MCPs, PIPs)
  4. Symmetric arthritis
  5. Rheumatoid nodules
  6. Serum RF positive
  7. Radiographic erosions/periarticular osteopenia on hand/wrist X-ray
(Textbook of Family Medicine 9e, p. 878)

Investigations

  • RF: Positive in ~80% of RA; not specific (also positive in SLE, Sjogren's, infection)
  • Anti-CCP (ACPA): More specific (~95%), present years before symptoms
  • Elevated ESR and CRP
  • Synovial fluid: inflammatory (WBC > 2000, often > 50,000/mm³)
  • X-ray: periarticular osteopenia → marginal erosions → joint space narrowing

Treatment

  • NSAIDs/Corticosteroids: For symptom control and bridging only
  • DMARDs (Disease-Modifying Anti-Rheumatic Drugs) - start early:
    • Methotrexate - first-line DMARD; most widely used
    • Hydroxychloroquine, Sulfasalazine, Leflunomide
  • Biologic DMARDs for inadequate DMARD response:
    • Anti-TNF agents: etanercept, adalimumab, infliximab
    • IL-6 inhibitors: tocilizumab
    • B-cell depletion: rituximab
    • T-cell co-stimulation blockade: abatacept
  • JAK inhibitors (tsDMARDs): tofacitinib, baricitinib

OA vs. RA Comparison

FeatureOsteoarthritisRheumatoid Arthritis
Primary mechanismMechanical injuryAutoimmunity
InflammationSecondaryPrimary
JointsWeight-bearing, DIPSmall joints of hands (MCP, PIP), symmetric
Morning stiffness< 30 min> 1 hour
PathologyCartilage degeneration, osteophytesPannus, erosions, ankylosis
SerologyNegativeRF, anti-CCP positive
Systemic involvementNoYes (lungs, heart, eyes, etc.)
(Robbins & Kumar Basic Pathology, p. 790)

3. Gout (Gouty Arthritis)

Definition & Epidemiology

Gout is a crystal arthropathy caused by deposition of monosodium urate (MSU) crystals in joints and soft tissues. It primarily affects middle-aged men (40-60 years) and postmenopausal women. Hyperuricemia (usually > 8 mg/dL) is the underlying metabolic abnormality, though asymptomatic hyperuricemia alone is not a disease.

Pathophysiology

  • 90% of cases: reduced renal excretion of uric acid
  • 10% of cases: overproduction (inborn errors, high purine diet, increased cell turnover)
  • Secondary hyperuricemia: diuretics (especially thiazides), low-dose aspirin, cyclosporine, renal failure, myeloproliferative disorders
  • MSU crystals trigger intense neutrophil-mediated inflammation

Clinical Stages

  1. Asymptomatic hyperuricemia - elevated uric acid; no symptoms; takes ~20 years before first attack
  2. Acute gouty arthritis - sudden onset severe monoarticular pain (often nocturnal); first MTP joint (podagra) in 50% of first attacks, eventually in 75-90% of patients; heels, ankles, knees also affected; self-limited in days to weeks
  3. Intercritical gout - symptom-free intervals between attacks
  4. Chronic tophaceous gout - persistent hyperuricemia → tophi (urate deposits in soft tissue, cartilage, ear pinnae), chronic arthritis, joint damage, renal involvement (urate nephropathy, uric acid stones)

Diagnosis

  • Definitive: Needle-shaped, negatively birefringent urate crystals on polarized light microscopy of synovial fluid
  • Presumptive: clinical features + hyperuricemia + rapid response to NSAIDs/colchicine
  • Serum uric acid: usually > 8 mg/dL
  • Note: in women and elderly, gout can be polyarticular and mimic RA (tophi mistaken for rheumatoid nodules)

Treatment

PhaseTreatment
Acute attackNSAIDs (indomethacin), colchicine, corticosteroids
Urate-lowering therapy (ULT)Allopurinol (xanthine oxidase inhibitor) - first line; febuxostat; probenecid (uricosuric)
Prophylaxis during ULT initiationLow-dose colchicine or NSAID for 3-6 months (prevents mobilization flares)
(Textbook of Family Medicine 9e, p. 887)

4. Spondyloarthritis (SpA)

Definition

A group of related inflammatory arthritides linked by shared disease manifestations and genetic susceptibility. Major subtypes:
  • Ankylosing Spondylitis (AS) - axial predominant
  • Psoriatic Arthritis (PsA)
  • Reactive Arthritis (formerly Reiter's syndrome)
  • Enteropathic Arthritis (associated with IBD: Crohn's, UC)

Key Features Shared Across SpA

  • HLA-B27 association: ~90% of ankylosing spondylitis patients are HLA-B27 positive
  • Sacroiliitis and axial involvement
  • Enthesitis: inflammation at tendon/ligament insertions (hallmark of SpA - distinguishes from RA)
  • Asymmetric oligoarthritis of large joints
  • Dactylitis ("sausage digit")
  • RF negative (seronegative)
  • Eye involvement: uveitis (anterior)

Classification (ASAS)

  • Axial SpA (axSpA): back-dominated; subdivided into radiographic (= ankylosing spondylitis, with sacroiliac joint changes on X-ray) and non-radiographic
  • Peripheral SpA: peripheral joint-dominated
(Goldman-Cecil Medicine, p. 244)

Ankylosing Spondylitis (AS)

  • Chronic inflammatory disease of the spine and sacroiliac joints
  • Young men (< 40 years); insidious onset of inflammatory back pain (worse at rest/morning, improved with exercise - opposite of mechanical back pain)
  • Eventual fusion of vertebrae ("bamboo spine") on X-ray
  • Extra-articular: anterior uveitis, aortitis, apical pulmonary fibrosis, cauda equina syndrome
  • Treatment: NSAIDs first-line; physiotherapy; anti-TNF biologics for refractory disease

5. Psoriatic Arthritis (PsA)

  • Affects 5-7% of psoriasis patients (up to 40% of hospitalized patients with extensive psoriasis)
  • RF usually negative
  • Psoriatic skin lesions precede arthritis in 70% of cases; follow in 15%
  • Five clinical patterns: oligoarticular asymmetric (most common), symmetric polyarticular (resembles RA), DIP-predominant, axial/spondylitic, arthritis mutilans (most destructive)
  • DIP joint involvement and enthesitis distinguish it from RA
  • Arthritis mutilans: osteolysis of phalanges/metacarpals → "telescoping fingers"
  • X-ray: marginal erosions at DIP/PIP with new bone formation (periostitis) - "pencil-in-cup" deformity
  • Treatment: NSAIDs → DMARDs (methotrexate, sulfasalazine) → anti-TNF biologics for axial/refractory disease
(Textbook of Family Medicine 9e, p. 893)

6. Reactive Arthritis

  • Sterile inflammatory arthritis triggered by a distant infection (usually urogenital - Chlamydia - or enteric - Salmonella, Shigella, Yersinia, Campylobacter)
  • Classic triad (Reiter's): arthritis + urethritis + conjunctivitis ("can't see, can't pee, can't climb a tree")
  • Asymmetric oligoarthritis of lower limbs; enthesitis; dactylitis; oral ulcers; keratoderma blennorrhagica
  • HLA-B27 positive in ~75%
  • Usually self-limited (3-12 months); treat with NSAIDs; antibiotics for active infection; DMARDs for chronic cases

7. Septic (Infectious) Arthritis

Definition

An orthopedic emergency caused by bacterial (most commonly S. aureus) infection of a joint, usually via hematogenous spread. Loss of joint function in 25-50% of cases even with prompt treatment.

Epidemiology & Risk

  • Incidence: 2-10/100,000 in native joints; rises to 30-70/100,000 in RA patients
  • Risk factors: pre-existing joint disease (OA, RA, gout), IV drug use, immunosuppression, corticosteroids, prosthetic joints
  • Most commonly monoarticular: knee (50%), hip (25%), shoulder (15%) in adults

Clinical Features

  • Acute onset severe monoarticular pain, warmth, swelling, erythema
  • Fever in > 80% of children; only ~40% of adults
  • Restricted range of motion (most sensitive sign)
  • Position of comfort: slight flexion

Diagnosis

  • Joint aspiration is mandatory - synovial fluid: turbid, WBC > 50,000/mm³ (often > 100,000), predominantly neutrophils; Gram stain and culture
  • Blood cultures (often positive in hematogenous septic arthritis)
  • X-ray: initially normal; MRI for early osteomyelitis or hip involvement

Treatment

  • IV antibiotics targeting likely organisms; empirical anti-staphylococcal coverage (vancomycin for MRSA risk)
  • Surgical drainage/arthroscopic washout - often required; hip septic arthritis always requires surgical drainage (cannot adequately drain by aspiration alone)
  • Duration: typically 2-4 weeks IV → oral antibiotics
(Rosen's Emergency Medicine, p. 2730)

Quick Diagnostic Summary Table

TypeAge/SexJointsKey Lab/ImagingHallmark
OAElderly, F>M after 55Knees, hips, DIPX-ray: osteophytes, JSNNo systemic features; Heberden/Bouchard nodes
RA20-50, F>>MMCP, PIP, wrist (symmetric)RF+, Anti-CCP+, erosionsSymmetric synovitis, > 1 hr morning stiffness
GoutMen 40-60, postmeno F1st MTP, ankles, knees-ve birefringent crystals, ↑uric acidPodagra; acute severe monoarthritis
ASYoung men < 40Sacroiliac, spineHLA-B27+, bamboo spineInflammatory back pain, improved with exercise
PsAAny, psoriasis historyDIP, large joints, spineHLA+ (multiple), pencil-in-cupEnthesitis, DIP involvement, nail changes
ReactiveYoung adultsLower limb, asymmetricHLA-B27+, preceding infectionPost-infectious; classic triad
SepticAny (peak children/elderly)Knee > Hip > ShoulderWBC > 50,000 in joint fluid, +ve cultureOrthopedic emergency; fever + acute monoarthritis

Sources: Robbins & Kumar Basic Pathology, p. 790 | Textbook of Family Medicine 9e, pp. 873-893 | Goldman-Cecil Medicine, p. 244 | Rosen's Emergency Medicine, p. 2730 | Firestein & Kelley's Textbook of Rheumatology

All ?

Asking for Preferences

Mmm fine do you anle to make pdfs

Asking for Preferences

1 & 2

Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null && echo "OK"

Running Command

mkdir -p /home/daytona/workspace/arthritis-pdf && python3 -c "from reportlab.lib…

Writing File

~/arthritis-pdf/generate_arthritis_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import ListFlowable, ListItem

OUTPUT = "/home/daytona/workspace/arthritis-pdf/Arthritis_Clinical_Overview.pdf"

# ── Colour palette ──────────────────────────────────────────────────────────
DARK_BLUE   = colors.HexColor("#1A3A5C")
MED_BLUE    = colors.HexColor("#2E6DA4")
LIGHT_BLUE  = colors.HexColor("#D6E8F7")
ACCENT      = colors.HexColor("#E84040")
GOLD        = colors.HexColor("#F5A623")
LIGHT_GREY  = colors.HexColor("#F2F4F7")
MID_GREY    = colors.HexColor("#B0BEC5")
WHITE       = colors.white
BLACK       = colors.black

# ── Styles ───────────────────────────────────────────────────────────────────
base = getSampleStyleSheet()

def S(name, parent="Normal", **kw):
    return ParagraphStyle(name, parent=base[parent], **kw)

styles = {
    "cover_title": S("cover_title", "Title",
        fontSize=34, textColor=WHITE, leading=42, alignment=TA_CENTER, spaceAfter=6),
    "cover_sub":   S("cover_sub", "Normal",
        fontSize=14, textColor=colors.HexColor("#AED6F1"), alignment=TA_CENTER, spaceAfter=4),
    "cover_note":  S("cover_note", "Normal",
        fontSize=10, textColor=colors.HexColor("#AED6F1"), alignment=TA_CENTER),
    "h1": S("h1", "Heading1",
        fontSize=18, textColor=WHITE, leading=24, spaceBefore=0, spaceAfter=0,
        leftIndent=0),
    "h2": S("h2", "Heading2",
        fontSize=13, textColor=DARK_BLUE, leading=18, spaceBefore=10, spaceAfter=4,
        borderPad=4),
    "h3": S("h3", "Heading3",
        fontSize=11, textColor=MED_BLUE, leading=15, spaceBefore=6, spaceAfter=3),
    "body": S("body", "Normal",
        fontSize=9.5, leading=14, spaceAfter=4, alignment=TA_JUSTIFY),
    "bullet": S("bullet", "Normal",
        fontSize=9.5, leading=13, leftIndent=14, spaceAfter=2),
    "table_hdr": S("table_hdr", "Normal",
        fontSize=9, textColor=WHITE, leading=12, alignment=TA_CENTER),
    "table_cell": S("table_cell", "Normal",
        fontSize=8.5, leading=12, alignment=TA_LEFT),
    "table_cell_c": S("table_cell_c", "Normal",
        fontSize=8.5, leading=12, alignment=TA_CENTER),
    "caption": S("caption", "Normal",
        fontSize=8, textColor=MID_GREY, alignment=TA_CENTER, spaceAfter=6),
    "key_point": S("key_point", "Normal",
        fontSize=9, leading=13, textColor=DARK_BLUE,
        leftIndent=10, rightIndent=10, spaceAfter=3),
    "footer": S("footer", "Normal",
        fontSize=7.5, textColor=MID_GREY, alignment=TA_CENTER),
}

PAGE_W, PAGE_H = A4
MARGIN = 2.0 * cm

# ── Helper builders ──────────────────────────────────────────────────────────
def section_header(title, subtitle=""):
    """Coloured banner for a major section."""
    data = [[Paragraph(f"<b>{title}</b>", styles["h1"])]]
    t = Table(data, colWidths=[PAGE_W - 2*MARGIN])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
        ("ROUNDEDCORNERS", [6,6,6,6]),
        ("TOPPADDING",    (0,0), (-1,-1), 10),
        ("BOTTOMPADDING", (0,0), (-1,-1), 10),
        ("LEFTPADDING",   (0,0), (-1,-1), 14),
    ]))
    elems = [t]
    if subtitle:
        elems.append(Paragraph(subtitle, styles["body"]))
    elems.append(Spacer(1, 6))
    return elems

def h2(text):
    return [Paragraph(text, styles["h2"]), HRFlowable(width="100%", thickness=1,
            color=MED_BLUE, spaceAfter=4)]

def h3(text):
    return [Paragraph(text, styles["h3"])]

def body(text):
    return [Paragraph(text, styles["body"])]

def bullets(items):
    return [Paragraph(f"• {i}", styles["bullet"]) for i in items]

def spacer(h=6):
    return [Spacer(1, h)]

def key_box(items, title="Key Points"):
    content = [Paragraph(f"<b>{title}</b>", styles["key_point"])]
    for i in items:
        content.append(Paragraph(f"◆  {i}", styles["key_point"]))
    t = Table([[content]], colWidths=[PAGE_W - 2*MARGIN])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), LIGHT_BLUE),
        ("ROUNDEDCORNERS", [6,6,6,6]),
        ("TOPPADDING",    (0,0), (-1,-1), 8),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
        ("BOX", (0,0), (-1,-1), 1, MED_BLUE),
    ]))
    return [t, Spacer(1, 6)]

def make_table(headers, rows, col_widths=None):
    avail = PAGE_W - 2*MARGIN
    if col_widths is None:
        col_widths = [avail / len(headers)] * len(headers)
    hdr_row = [Paragraph(f"<b>{h}</b>", styles["table_hdr"]) for h in headers]
    data = [hdr_row]
    for row in rows:
        data.append([Paragraph(str(c), styles["table_cell"]) for c in row])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    style = TableStyle([
        ("BACKGROUND",    (0,0), (-1,0),  DARK_BLUE),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, LIGHT_GREY]),
        ("GRID",          (0,0), (-1,-1), 0.4, MID_GREY),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
        ("RIGHTPADDING",  (0,0), (-1,-1), 6),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
    ])
    t.setStyle(style)
    return [t, Spacer(1, 8)]

# ── Page callbacks ────────────────────────────────────────────────────────────
def on_page(canvas, doc):
    canvas.saveState()
    # Top blue bar
    canvas.setFillColor(DARK_BLUE)
    canvas.rect(0, PAGE_H - 0.7*cm, PAGE_W, 0.7*cm, fill=1, stroke=0)
    canvas.setFillColor(WHITE)
    canvas.setFont("Helvetica", 7)
    canvas.drawCentredString(PAGE_W/2, PAGE_H - 0.5*cm, "ARTHRITIS — Clinical Overview")
    # Bottom bar
    canvas.setFillColor(LIGHT_GREY)
    canvas.rect(0, 0, PAGE_W, 1.0*cm, fill=1, stroke=0)
    canvas.setFillColor(MID_GREY)
    canvas.setFont("Helvetica", 7)
    canvas.drawString(MARGIN, 0.35*cm, "Sources: Robbins & Kumar Basic Pathology | Textbook of Family Medicine 9e | Goldman-Cecil Medicine | Rosen's Emergency Medicine | Firestein & Kelley's Rheumatology")
    canvas.drawRightString(PAGE_W - MARGIN, 0.35*cm, f"Page {doc.page}")
    canvas.restoreState()

def cover_page():
    from reportlab.platypus import Frame, BaseDocTemplate
    # We'll fake a cover with a coloured table
    elems = []
    # Blue banner fill
    cover_data = [[
        Paragraph("<b>ARTHRITIS</b>", styles["cover_title"]),
    ]]
    ct = Table(cover_data, colWidths=[PAGE_W - 2*MARGIN])
    ct.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), DARK_BLUE),
        ("TOPPADDING",    (0,0), (-1,-1), 40),
        ("BOTTOMPADDING", (0,0), (-1,-1), 10),
        ("LEFTPADDING",   (0,0), (-1,-1), 20),
        ("RIGHTPADDING",  (0,0), (-1,-1), 20),
        ("ROUNDEDCORNERS",[8,8,8,8]),
    ]))
    elems.append(ct)
    sub_data = [[Paragraph("Clinical Deep-Dive: All Types, Pathology, Diagnosis & Treatment", styles["cover_sub"])]]
    st = Table(sub_data, colWidths=[PAGE_W - 2*MARGIN])
    st.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), MED_BLUE),
        ("TOPPADDING",    (0,0), (-1,-1), 12),
        ("BOTTOMPADDING", (0,0), (-1,-1), 12),
        ("ROUNDEDCORNERS",[0,0,8,8]),
    ]))
    elems.append(st)
    elems.append(Spacer(1, 16))

    # Type overview boxes
    types = [
        ("1", "Osteoarthritis",       "Degenerative",      GOLD),
        ("2", "Rheumatoid Arthritis", "Autoimmune",        ACCENT),
        ("3", "Gout",                 "Crystal",           colors.HexColor("#27AE60")),
        ("4", "Spondyloarthritis",    "Seronegative",      MED_BLUE),
        ("5", "Psoriatic Arthritis",  "Seronegative SpA",  colors.HexColor("#8E44AD")),
        ("6", "Reactive Arthritis",   "Post-infectious",   colors.HexColor("#E67E22")),
        ("7", "Septic Arthritis",     "Infectious/Emergency", ACCENT),
    ]
    box_rows = []
    for num, name, tag, col in types:
        box_rows.append([
            Paragraph(f"<b>{num}</b>", ParagraphStyle("n", fontSize=18, textColor=WHITE, alignment=TA_CENTER)),
            Paragraph(f"<b>{name}</b><br/><font size=8 color='#FFFFFF'>{tag}</font>",
                      ParagraphStyle("t", fontSize=11, textColor=WHITE, leading=15)),
        ])
    for i, (num, name, tag, col) in enumerate(types):
        row_data = [[
            Paragraph(f"<b>{i+1}</b>", ParagraphStyle("nn", fontSize=16, textColor=WHITE, alignment=TA_CENTER)),
            Paragraph(f"<b>{name}</b><br/><font size=8>{tag}</font>",
                      ParagraphStyle("tt", fontSize=11, textColor=WHITE, leading=15)),
        ]]
        rt = Table(row_data, colWidths=[1.2*cm, PAGE_W - 2*MARGIN - 1.2*cm - 0.2*cm])
        rt.setStyle(TableStyle([
            ("BACKGROUND",    (0,0), (-1,-1), col),
            ("TOPPADDING",    (0,0), (-1,-1), 8),
            ("BOTTOMPADDING", (0,0), (-1,-1), 8),
            ("LEFTPADDING",   (0,0), (-1,-1), 10),
            ("ROUNDEDCORNERS",[6,6,6,6]),
        ]))
        elems.append(rt)
        elems.append(Spacer(1, 5))

    elems.append(Spacer(1, 20))
    note_data = [[Paragraph(
        "Sources: Robbins & Kumar Basic Pathology • Textbook of Family Medicine 9e • Goldman-Cecil Medicine • Rosen's Emergency Medicine • Firestein & Kelley's Textbook of Rheumatology",
        styles["caption"])]]
    nt = Table(note_data, colWidths=[PAGE_W - 2*MARGIN])
    nt.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), LIGHT_GREY),
        ("TOPPADDING",    (0,0), (-1,-1), 8),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
        ("BOX", (0,0), (-1,-1), 0.5, MID_GREY),
    ]))
    elems.append(nt)
    elems.append(PageBreak())
    return elems

# ── Content ───────────────────────────────────────────────────────────────────
def build_content():
    E = []

    # ── COVER ─────────────────────────────────────────────────────────────────
    E += cover_page()

    # ── 1. OSTEOARTHRITIS ─────────────────────────────────────────────────────
    E += section_header("1. Osteoarthritis (OA)", "Degenerative Joint Disease — Most Common Arthritis")
    E += key_box([
        "Most common form of arthritis; affects ~20% of U.S. population.",
        "Primarily degenerative — cartilage breakdown with secondary inflammation.",
        "Prevalence rises exponentially after age 50; ~40% of people >70 are affected.",
        "NSAIDs (not COX-2 inhibitors alone) are first-line pharmacologic treatment.",
    ])
    E += h2("Epidemiology & Classification")
    E += body("OA occurs about equally in men and women ages 45–55, but is more common in women after 55. "
              "It is found radiographically in almost all 75-year-olds, most of whom are asymptomatic.")
    E += make_table(
        ["Type", "Description", "Examples"],
        [
            ["Primary (Idiopathic)", "Insidious onset; aging phenomenon; oligoarticular", "Knee, hip, lumbar spine OA in the elderly"],
            ["Hereditary", "Collagen gene defects; inflammatory hand OA runs in families", "Heberden nodes, Bouchard nodes in women"],
            ["Secondary", "Prior cartilage damage from identifiable cause", "Post-trauma, obesity, hemochromatosis, RA, gout, CPPD, acromegaly, neuropathy"],
        ],
        col_widths=[3.5*cm, 7*cm, 6.5*cm]
    )

    E += h2("Pathogenesis")
    E += body("OA stems from <b>biomechanical stress</b> on articular cartilage, with genetic factors (GDF5, RUNX2, SMAD3 loci) amplifying risk. "
              "The process evolves in three stages:")
    E += bullets([
        "<b>Stage 1 – Chondrocyte Injury:</b> Genetic/biomechanical insults damage Type II collagen and proteoglycans in articular cartilage.",
        "<b>Stage 2 – Early OA:</b> Chondrocytes proliferate and release BMP (repair attempt). MMPs degrade collagen and proteoglycans; PGE₂, NO, TNF drive further damage — degradation exceeds repair.",
        "<b>Stage 3 – Late OA:</b> Chondrocyte dropout and apoptosis, subchondral bone sclerosis and cysts, osteophyte formation, loose bodies in joint space.",
    ])

    E += h2("Clinical Features")
    E += make_table(
        ["Feature", "Details"],
        [
            ["Onset", "Insidious; pain worsens with activity, relieved by rest"],
            ["Morning stiffness", "< 30 minutes (key distinction from RA)"],
            ["Joint involvement", "Weight-bearing: knees, hips, lumbar/cervical spine, 1st MTP, DIP/PIP of hands"],
            ["Heberden nodes", "Bony enlargement at DIP joints (osteophytes)"],
            ["Bouchard nodes", "Bony enlargement at PIP joints"],
            ["Crepitus", "Grating sensation on joint movement"],
            ["Systemic features", "ABSENT — OA is purely articular"],
            ["Radiographic findings", "Joint space narrowing, osteophytes, subchondral sclerosis, subchondral cysts"],
        ],
        col_widths=[5*cm, 12*cm]
    )

    E += h2("Investigations")
    E += bullets([
        "X-ray: joint space narrowing, osteophytes, subchondral sclerosis/cysts — most important investigation",
        "Serology: RF and ANA negative; no specific OA biomarker",
        "Synovial fluid: non-inflammatory (WBC < 2,000/mm³); no crystals",
        "MRI: best for early cartilage damage (not routine in most cases)",
    ])

    E += h2("Treatment")
    E += make_table(
        ["Category", "Intervention"],
        [
            ["Non-pharmacologic", "Weight loss (reduces joint load), low-impact exercise (swimming, cycling), physiotherapy, quadriceps strengthening, assistive devices (cane, braces)"],
            ["Pharmacologic — 1st line", "NSAIDs (oral or topical for knee/hand); acetaminophen for mild pain"],
            ["Pharmacologic — adjuncts", "Intra-articular corticosteroids (short-term flare relief); intra-articular hyaluronic acid (controversial)"],
            ["Surgical", "Joint replacement (arthroplasty) for severe, refractory disease unresponsive to conservative measures"],
        ],
        col_widths=[4.5*cm, 12.5*cm]
    )
    E += spacer(8)

    # ── 2. RHEUMATOID ARTHRITIS ───────────────────────────────────────────────
    E += section_header("2. Rheumatoid Arthritis (RA)", "Chronic Systemic Autoimmune Inflammatory Disease")
    E += key_box([
        "Affects 1–2% of adults; female predominance 3:1; peak incidence ages 20–50.",
        "Symmetric synovitis with morning stiffness >1 hour is the hallmark.",
        ">70% of polyarticular RF-positive RA patients develop joint erosions within 2 years without treatment.",
        "Start DMARDs early — before irreversible joint destruction occurs.",
    ])

    E += h2("Pathogenesis")
    E += bullets([
        "<b>Genetic:</b> HLA-DRB1 'shared epitope' is the strongest genetic risk factor; higher concordance in monozygotic twins.",
        "<b>Trigger:</b> Unknown inciting event (possibly infectious or environmental) in a genetically susceptible host.",
        "<b>Pannus formation:</b> Synovial lining cells and subsynovial vessels proliferate → aggressive pannus invades cartilage and bone.",
        "<b>Immune cascade:</b> T-cell and B-cell activation; key cytokines TNF-α, IL-1, IL-6 drive inflammation and erosion.",
        "<b>Autoantibodies:</b> Rheumatoid factor (RF) targets IgG Fc; Anti-CCP (ACPA) — more specific, detectable years before symptoms.",
    ])

    E += h2("Clinical Features")
    E += make_table(
        ["System", "Manifestations"],
        [
            ["Articular (early)", "Symmetric synovitis of MCPs, PIPs, wrists; spares DIP joints"],
            ["Articular (late)", "Ulnar deviation, swan-neck/boutonnière deformities, Z-thumb; joint ankylosis"],
            ["Constitutional", "Fatigue, fever, weight loss, malaise (often precede joint symptoms)"],
            ["Rheumatoid nodules", "Subcutaneous; over pressure points (olecranon, fingers); indicate seropositive disease"],
            ["Pulmonary", "Interstitial lung disease, pleural effusion, pulmonary nodules, Caplan syndrome"],
            ["Cardiac", "Pericarditis, accelerated atherosclerosis (major cause of mortality), valvular disease"],
            ["Ocular", "Scleritis, episcleritis, sicca syndrome (secondary Sjögren's)"],
            ["Neurologic", "Atlantoaxial subluxation (C1–C2 instability → spinal cord compression risk), peripheral neuropathy"],
            ["Haematologic", "Anaemia of chronic disease, Felty syndrome (RA + splenomegaly + neutropenia)"],
        ],
        col_widths=[4.5*cm, 12.5*cm]
    )

    E += h2("ACR 1987 Diagnostic Criteria (≥4 of 7, symptoms ≥6 weeks)")
    E += make_table(
        ["#", "Criterion", "Definition"],
        [
            ["1", "Morning stiffness", "In and around joints; ≥1 hour before maximal improvement"],
            ["2", "Arthritis of ≥3 joint areas", "Soft-tissue swelling or fluid in ≥3 joints"],
            ["3", "Arthritis of hand joints", "Wrists, MCPs, or PIPs involved"],
            ["4", "Symmetric arthritis", "Simultaneous bilateral involvement"],
            ["5", "Rheumatoid nodules", "Subcutaneous nodules over bony prominences"],
            ["6", "Serum RF positive", "Positive by any method in <5% of normal controls"],
            ["7", "Radiographic changes", "Erosions or periarticular osteopenia on hand/wrist X-ray"],
        ],
        col_widths=[0.8*cm, 5*cm, 11.2*cm]
    )

    E += h2("Investigations")
    E += bullets([
        "RF: positive in ~80% of RA; not specific (also positive in SLE, Sjögren's, infections, elderly)",
        "Anti-CCP (ACPA): ~95% specific for RA; detectable years before clinical disease",
        "Elevated ESR and CRP — reflect inflammatory activity",
        "FBC: normocytic anaemia, thrombocytosis in active disease",
        "Synovial fluid: inflammatory (WBC >2,000/mm³, often >50,000); no crystals",
        "X-ray hands/feet: periarticular osteopenia → marginal erosions → joint space narrowing",
        "MRI/Ultrasound: detect early synovitis and erosions before X-ray changes",
    ])

    E += h2("Treatment — Treat-to-Target Strategy")
    E += make_table(
        ["Category", "Agents", "Notes"],
        [
            ["Symptomatic", "NSAIDs, corticosteroids (oral/intra-articular)", "Bridging only; not disease-modifying"],
            ["Conventional DMARDs (csDMARDs)", "Methotrexate (1st-line), hydroxychloroquine, sulfasalazine, leflunomide", "MTX is anchor drug; combinations used (triple therapy)"],
            ["Biologic DMARDs — anti-TNF", "Etanercept, adalimumab, infliximab, certolizumab, golimumab", "For inadequate response to csDMARDs"],
            ["Biologic DMARDs — other", "Tocilizumab (IL-6 inhibitor), rituximab (B-cell), abatacept (T-cell co-stim)", "Alternative biologics depending on profile"],
            ["Targeted synthetic DMARDs", "Tofacitinib, baricitinib, upadacitinib (JAK inhibitors)", "Oral; used when biologics fail or not tolerated"],
        ],
        col_widths=[3.5*cm, 6*cm, 7.5*cm]
    )
    E.append(PageBreak())

    # ── 3. GOUT ──────────────────────────────────────────────────────────────
    E += section_header("3. Gout (Crystal Arthropathy)", "Monosodium Urate Crystal Deposition Disease")
    E += key_box([
        "Primarily affects men 40–60 years and postmenopausal women.",
        "Hyperuricemia (usually >8 mg/dL) is the underlying abnormality — but asymptomatic hyperuricemia is not a disease.",
        "Definitive diagnosis: needle-shaped, negatively birefringent crystals on polarized light microscopy.",
        "First MTP joint (podagra) involved in 50% of initial attacks; eventually in 75–90% of patients.",
    ])

    E += h2("Pathophysiology")
    E += make_table(
        ["Mechanism", "Details"],
        [
            ["Reduced excretion (90%)", "Renal underexcretion of urate; genetic predisposition + thiazides, low-dose aspirin, cyclosporine, renal failure"],
            ["Overproduction (10%)", "Inborn errors (HGPRT deficiency — Lesch-Nyhan), high purine diet, myeloproliferative disorders, tumour lysis"],
            ["Crystal deposition", "MSU crystals form in cooler peripheral joints → phagocytosed by neutrophils → IL-1β release → acute intense inflammation"],
            ["Tophi", "Chronic urate deposits in soft tissue, cartilage, bone, ear pinnae; indicate years of uncontrolled hyperuricemia"],
        ],
        col_widths=[4.5*cm, 12.5*cm]
    )

    E += h2("Clinical Stages")
    E += make_table(
        ["Stage", "Features"],
        [
            ["Asymptomatic hyperuricemia", "Elevated uric acid; no symptoms; typically takes ~20 years before first attack"],
            ["Acute gouty arthritis", "Sudden severe monoarticular pain (often nocturnal); exquisite tenderness; swelling, warmth, erythema; self-limited in days–weeks"],
            ["Intercritical gout", "Symptom-free intervals; attacks become more frequent and prolonged over time"],
            ["Chronic tophaceous gout", "Persistent hyperuricemia → tophi; chronic destructive arthritis; renal complications (urate nephropathy, uric acid stones)"],
        ],
        col_widths=[5*cm, 12*cm]
    )

    E += h2("Diagnosis")
    E += bullets([
        "<b>Definitive:</b> Needle-shaped, negatively birefringent monosodium urate crystals on polarized light microscopy of synovial fluid or tophi material",
        "<b>Presumptive:</b> Clinical features + hyperuricemia + rapid response to colchicine/NSAIDs",
        "Serum uric acid: usually >8 mg/dL (note: may be normal during acute attack)",
        "Joint aspiration: cloudy fluid, high WBC (polymorphonuclear predominance)",
        "X-ray (late disease): punched-out erosions with overhanging edges ('rat bite' erosions), tophi calcifications",
        "Note: In women and elderly, gout may be <b>polyarticular</b> and mimic RA; tophi may be mistaken for rheumatoid nodules",
    ])

    E += h2("Treatment")
    E += make_table(
        ["Phase", "Treatment", "Notes"],
        [
            ["Acute attack", "NSAIDs (indomethacin, naproxen), colchicine, corticosteroids (oral/IA)", "Start within 24 hours of attack onset for best effect"],
            ["Urate-lowering therapy (ULT)", "Allopurinol (xanthine oxidase inhibitor) — 1st line; Febuxostat; Probenecid (uricosuric)", "Target serum uric acid <6 mg/dL (<5 mg/dL in tophaceous gout)"],
            ["Prophylaxis during ULT initiation", "Low-dose colchicine or NSAID for 3–6 months", "Prevents mobilization flares as urate depots dissolve"],
            ["Dietary/lifestyle", "Reduce red meat, seafood, fructose-sweetened beverages, alcohol (especially beer); increase hydration", "Address secondary causes: review diuretics, aspirin"],
        ],
        col_widths=[4*cm, 6.5*cm, 6.5*cm]
    )
    E += spacer(8)

    # ── 4. SPONDYLOARTHRITIS ─────────────────────────────────────────────────
    E += section_header("4. Spondyloarthritis (SpA)", "HLA-B27 Associated Seronegative Arthritides")
    E += key_box([
        "Group of related syndromes: ankylosing spondylitis, psoriatic arthritis, reactive arthritis, enteropathic arthritis.",
        "HLA-B27 positive in ~90% of ankylosing spondylitis patients.",
        "RF negative (seronegative); enthesitis is the pathologic hallmark.",
        "Classified as axial SpA (spine/sacroiliac predominant) or peripheral SpA.",
    ])

    E += h2("Common Features Across All SpA Subtypes")
    E += make_table(
        ["Feature", "Description"],
        [
            ["Enthesitis", "Inflammation at tendon/ligament insertions (e.g., Achilles, plantar fascia, iliac crest) — HALLMARK of SpA"],
            ["Sacroiliitis", "Inflammation of sacroiliac joints; key diagnostic feature on imaging"],
            ["Asymmetric oligoarthritis", "Typically lower limb large joints (knee, ankle, hip)"],
            ["Dactylitis", "'Sausage digit' — diffuse swelling of an entire finger/toe; very specific for SpA"],
            ["Anterior uveitis", "Most common extra-articular feature across SpA subtypes"],
            ["HLA-B27", "Present in ~90% AS, ~75% reactive arthritis, ~50% psoriatic arthritis with axial disease"],
            ["RF negative", "Key feature distinguishing SpA from RA"],
        ],
        col_widths=[4*cm, 13*cm]
    )

    E += h2("Ankylosing Spondylitis (AS)")
    E += bullets([
        "Chronic inflammatory disease of spine and sacroiliac joints; predominantly young men <40 years",
        "<b>Inflammatory back pain:</b> insidious onset, worse at night and in the morning, <b>improved with exercise</b> (opposite of mechanical back pain), relieved poorly by rest",
        "Schober test: measures lumbar flexion limitation",
        "X-ray: sacroiliitis → 'bamboo spine' (syndesmophytes, spinal fusion) in late disease",
        "MRI: detects active sacroiliitis before X-ray changes (bone marrow oedema)",
        "Extra-articular: anterior uveitis, aortitis, aortic regurgitation, apical pulmonary fibrosis, cauda equina syndrome",
        "<b>Treatment:</b> NSAIDs (first-line) + physiotherapy (mandatory); anti-TNF biologics (adalimumab, etanercept) for refractory disease; IL-17 inhibitors (secukinumab, ixekizumab)",
    ])
    E += spacer(8)

    # ── 5. PSORIATIC ARTHRITIS ────────────────────────────────────────────────
    E += section_header("5. Psoriatic Arthritis (PsA)", "Seronegative SpA Associated with Psoriasis")
    E += key_box([
        "Affects 5–7% of psoriasis patients (up to 40% of hospitalised patients with extensive psoriasis).",
        "Psoriatic skin lesions precede arthritis in 70% of cases; family history is important when skin lesions absent.",
        "DIP joint involvement and enthesitis distinguish PsA from RA.",
        "RF usually negative.",
    ])
    E += h2("Clinical Patterns (5 Types)")
    E += make_table(
        ["Pattern", "Features", "Frequency"],
        [
            ["Oligoarticular asymmetric", "Asymmetric involvement of <5 joints; large joints; most common presentation", "~70% (classic)"],
            ["Symmetric polyarticular", "Resembles RA; multiple small joints; but DIP involved, RF negative", "~15%"],
            ["DIP-predominant", "Mainly DIP joints; associated with nail disease (pitting, onycholysis)", "~5%"],
            ["Spondylitic/axial", "Sacroiliitis ± spondylitis; may be asymptomatic radiographically", "~5%"],
            ["Arthritis mutilans", "Most destructive; osteolysis of phalanges/metacarpals → 'telescoping fingers' (opera glass hand)", "~5%"],
        ],
        col_widths=[4*cm, 9*cm, 4*cm]
    )
    E += h2("Diagnosis & Treatment")
    E += bullets([
        "X-ray: marginal erosions at DIP/PIP with periostitis (new bone formation); 'pencil-in-cup' deformity in arthritis mutilans",
        "CASPAR criteria used for diagnosis (psoriasis + arthritis + RF negative + imaging findings)",
        "<b>Treatment:</b> NSAIDs (1st line) → DMARDs (methotrexate, sulfasalazine) → anti-TNF biologics for axial/refractory disease",
        "IL-17 inhibitors (secukinumab) and IL-12/23 inhibitors (ustekinumab) also approved",
        "Avoid corticosteroid injections through psoriatic skin (colonised with Staph/Strep)",
    ])
    E += spacer(8)

    # ── 6. REACTIVE ARTHRITIS ─────────────────────────────────────────────────
    E += section_header("6. Reactive Arthritis", "Post-infectious Sterile Arthritis (formerly Reiter's Syndrome)")
    E += key_box([
        "Sterile inflammatory arthritis triggered by a distant infection — usually urogenital or enteric.",
        "Classic triad: arthritis + urethritis + conjunctivitis ('can't see, can't pee, can't climb a tree').",
        "HLA-B27 positive in ~75%; strongly associated.",
        "Usually self-limited (3–12 months).",
    ])
    E += h2("Triggering Organisms")
    E += make_table(
        ["Route", "Organisms"],
        [
            ["Urogenital (STI)", "Chlamydia trachomatis (most common in developed countries)"],
            ["Enteric (food/waterborne)", "Salmonella, Shigella, Yersinia, Campylobacter, Clostridioides difficile"],
        ],
        col_widths=[4*cm, 13*cm]
    )
    E += h2("Clinical Features & Treatment")
    E += bullets([
        "Asymmetric oligoarthritis of lower limbs (knees, ankles, feet) 1–4 weeks after infection",
        "Enthesitis (Achilles, plantar fascia), dactylitis",
        "Mucocutaneous: oral ulcers (painless), keratoderma blennorrhagica (psoriasiform skin lesions on palms/soles), circinate balanitis",
        "Ocular: conjunctivitis (mild, bilateral) or anterior uveitis",
        "<b>Treatment:</b> NSAIDs for arthritis; antibiotics for active infection (Chlamydia: doxycycline/azithromycin); DMARDs (sulfasalazine, methotrexate) for chronic/recurrent disease",
    ])
    E += spacer(8)

    # ── 7. SEPTIC ARTHRITIS ───────────────────────────────────────────────────
    E += section_header("7. Septic (Infectious) Arthritis", "Orthopedic Emergency — Prompt Diagnosis Required")
    E += key_box([
        "Orthopedic emergency: loss of joint function in 25–50% of patients even with prompt treatment.",
        "Most common organism: Staphylococcus aureus (all ages).",
        "Incidence: 2–10/100,000 in native joints; jumps to 30–70/100,000 in RA patients.",
        "Joint aspiration is mandatory for diagnosis — do not delay pending imaging.",
    ])
    E += h2("Pathways & Organisms")
    E += make_table(
        ["Mechanism", "Details"],
        [
            ["Hematogenous (most common)", "Bacteraemia seeds synovial membrane; explains why septic arthritis may coexist with osteomyelitis"],
            ["Direct inoculation", "Trauma, joint aspiration, or injection"],
            ["Contiguous spread", "Adjacent osteomyelitis, soft tissue infection"],
        ],
        col_widths=[4.5*cm, 12.5*cm]
    )
    E += make_table(
        ["Population", "Common Organisms"],
        [
            ["All adults", "S. aureus (most common), Streptococcus spp."],
            ["Sexually active young adults", "Neisseria gonorrhoeae (most common cause of septic arthritis in <40 y adults)"],
            ["IV drug users, immunocompromised", "S. aureus (including MRSA), Gram-negative bacilli (Pseudomonas)"],
            ["Neonates/infants", "S. aureus, Group B Streptococcus, Gram-negative rods"],
            ["Prosthetic joint (early <3 months)", "S. aureus, coagulase-negative staph, Gram-negatives"],
        ],
        col_widths=[5*cm, 12*cm]
    )

    E += h2("Clinical Features")
    E += bullets([
        "Acute onset severe monoarticular pain; exacerbated by any range of motion",
        "Cardinal signs: swelling, erythema, warmth; joint held in position of slight flexion (greatest comfort)",
        "Fever >80% of children; only ~40% of adults (especially immunosuppressed/steroid users may have minimal fever)",
        "Adults: knee (50%), hip (25%), shoulder (15%)",
        "Gonococcal septic arthritis: may present with migratory polyarthralgia → monoarthritis + skin vesiculopustular lesions + tenosynovitis",
    ])

    E += h2("Diagnosis")
    E += make_table(
        ["Investigation", "Expected Findings"],
        [
            ["Joint aspiration (mandatory)", "Turbid fluid; WBC >50,000/mm³ (often >100,000), >90% neutrophils; Gram stain and culture"],
            ["Blood cultures", "Often positive in hematogenous septic arthritis (draw before antibiotics)"],
            ["Serum WBC, CRP, ESR", "Elevated but non-specific"],
            ["X-ray", "Initially normal; useful to exclude fracture; late: joint space loss, osteomyelitis"],
            ["MRI", "Best for hip septic arthritis; detects osteomyelitis, soft tissue extension"],
            ["Ultrasound", "Detects joint effusion; guides aspiration (especially hip)"],
        ],
        col_widths=[4.5*cm, 12.5*cm]
    )

    E += h2("Treatment")
    E += bullets([
        "<b>IV antibiotics empirically:</b> anti-staphylococcal (flucloxacillin or vancomycin for MRSA risk); adjust to culture/sensitivity",
        "<b>Duration:</b> typically 2–4 weeks IV → oral switch; total 4–6 weeks for S. aureus",
        "<b>Surgical drainage:</b> hip joint always requires surgical drainage (arthroscopy or open); knee can often be managed with repeated aspiration",
        "Gonococcal arthritis: IV ceftriaxone → oral switch; excellent prognosis",
        "Physiotherapy: early passive range of motion once infection controlled to prevent ankylosis",
    ])
    E.append(PageBreak())

    # ── COMPARISON TABLES ─────────────────────────────────────────────────────
    E += section_header("Summary & Comparison Tables", "Quick Reference for Diagnosis and Differentiation")
    E += spacer(6)

    E += h2("Table 1: Diagnostic Comparison — All 7 Types")
    E += make_table(
        ["Type", "Age/Sex", "Joints Affected", "Key Lab/Imaging", "Hallmark Feature"],
        [
            ["Osteoarthritis", "Elderly; F>M after 55", "Knees, hips, lumbar spine, DIP/PIP", "X-ray: osteophytes, JSN; Serology negative", "No systemic features; Heberden/Bouchard nodes; morning stiffness <30 min"],
            ["Rheumatoid Arthritis", "20–50 y; F>>M (3:1)", "MCP, PIP, wrists (symmetric); spares DIP", "RF+, Anti-CCP+, ↑ESR/CRP; X-ray erosions", "Symmetric synovitis; morning stiffness >1 hr; systemic features; extra-articular manifestations"],
            ["Gout", "Men 40–60; postmeno women", "1st MTP (podagra), ankles, knees", "↑Uric acid; −ve birefringent crystals in fluid", "Acute severe monoarthritis; nocturnal onset; podagra; tophi"],
            ["Ankylosing Spondylitis", "Young men <40", "Sacroiliac joints, spine", "HLA-B27+; MRI sacroiliitis; bamboo spine on X-ray", "Inflammatory back pain improved with exercise; enthesitis; iritis"],
            ["Psoriatic Arthritis", "Any; psoriasis history", "DIP joints, large joints, axial; asymmetric", "HLA+(multiple); pencil-in-cup deformity; RF neg", "Nail changes (pitting, onycholysis); DIP involvement; enthesitis; dactylitis"],
            ["Reactive Arthritis", "Young adults post-infection", "Lower limb large joints; asymmetric", "HLA-B27+; cultures of infection trigger", "Post-infectious; classic triad (urethritis, conjunctivitis, arthritis)"],
            ["Septic Arthritis", "Any (children, elderly, immunocomp)", "Knee > Hip > Shoulder; monoarticular", "Joint fluid WBC >50,000; Gram stain/culture +ve", "Orthopedic emergency; fever; acute severe monoarthritis"],
        ],
        col_widths=[3*cm, 3*cm, 4*cm, 4*cm, 4.5*cm]
    )

    E += h2("Table 2: OA vs. RA — Head-to-Head Comparison")
    E += make_table(
        ["Feature", "Osteoarthritis", "Rheumatoid Arthritis"],
        [
            ["Primary mechanism", "Mechanical injury to articular cartilage", "Autoimmunity (T-cell and antibody-mediated)"],
            ["Role of inflammation", "Secondary; exacerbates cartilage damage", "Primary — drives all joint destruction"],
            ["Joints involved", "Weight-bearing: knees, hips; DIP joints", "Small joints: MCPs, PIPs, wrists (symmetric); spares DIP"],
            ["Morning stiffness", "<30 minutes", ">1 hour"],
            ["Systemic involvement", "No", "Yes: lungs, heart, eyes, cervical spine, blood"],
            ["Serology", "RF, ANA negative", "RF+ in 80%; Anti-CCP+ in ~70% (95% specific)"],
            ["Pathology", "Cartilage degeneration, osteophytes, subchondral cysts", "Pannus formation, marginal erosions, ankylosis"],
            ["Synovial fluid", "Non-inflammatory (<2,000 WBC/mm³)", "Inflammatory (>2,000–50,000+ WBC/mm³)"],
            ["Treatment", "NSAIDs, physiotherapy, joint replacement", "DMARDs (MTX), biologics (anti-TNF, IL-6i, JAKi)"],
        ],
        col_widths=[4.5*cm, 6*cm, 6*cm]
    )

    E += h2("Table 3: Synovial Fluid Analysis in Arthritis")
    E += make_table(
        ["Category", "WBC/mm³", "Appearance", "Conditions"],
        [
            ["Normal", "<200", "Clear, viscous", "Normal joint"],
            ["Non-inflammatory", "200–2,000", "Clear/yellow, viscous", "OA, trauma, early SLE"],
            ["Inflammatory", "2,000–50,000", "Turbid, yellow, low viscosity", "RA, gout, pseudogout, SpA, reactive arthritis"],
            ["Septic (presumed)", ">50,000 (often >100,000)", "Turbid/purulent, very low viscosity", "Bacterial septic arthritis"],
            ["Haemorrhagic", "Variable (RBCs)", "Red/bloody", "Trauma, haemophilia, pigmented villonodular synovitis"],
        ],
        col_widths=[3.5*cm, 3.5*cm, 5*cm, 5.5*cm]
    )

    E += h2("Table 4: Crystal Arthropathies Comparison")
    E += make_table(
        ["Feature", "Gout (MSU)", "Pseudogout (CPPD)"],
        [
            ["Crystal type", "Monosodium urate (MSU)", "Calcium pyrophosphate dihydrate (CPPD)"],
            ["Birefringence", "Negatively birefringent; needle-shaped", "Weakly positively birefringent; rhomboid-shaped"],
            ["Common joints", "1st MTP (podagra), ankles, knees", "Knees (most common), wrists, hips"],
            ["Age/sex", "Middle-aged men; postmeno women", "Elderly; equal sex distribution"],
            ["X-ray", "Punched-out erosions; tophi calcifications", "Chondrocalcinosis (calcification in cartilage)"],
            ["Underlying causes", "Hyperuricemia; thiazides, renal failure", "Hyperparathyroidism, haemochromatosis, hypomagnesaemia"],
            ["Acute treatment", "NSAIDs, colchicine, corticosteroids", "NSAIDs, colchicine, corticosteroids"],
            ["Long-term treatment", "Allopurinol/febuxostat (urate-lowering)", "No specific crystal-reducing therapy available"],
        ],
        col_widths=[4*cm, 6*cm, 7*cm]
    )

    E += h2("Table 5: Key Drug Summary in Arthritis Management")
    E += make_table(
        ["Drug/Class", "Mechanism", "Used In", "Key Side Effects"],
        [
            ["NSAIDs", "COX-1/2 inhibition → ↓prostaglandins", "OA, RA, Gout (acute), SpA, PsA, Reactive arthritis", "GI ulcers, renal impairment, CV risk, fluid retention"],
            ["Colchicine", "Inhibits microtubule polymerisation → ↓neutrophil chemotaxis", "Gout (acute + prophylaxis), CPPD, pericarditis", "GI: diarrhoea, nausea; myopathy (high dose); drug interactions (CYP3A4)"],
            ["Allopurinol", "Xanthine oxidase inhibitor → ↓uric acid synthesis", "Gout prevention (ULT)", "Rash (SJS in HLA-B*58:01 carriers), hypersensitivity syndrome"],
            ["Methotrexate", "Folic acid antagonist → anti-inflammatory via adenosine pathway", "RA (1st-line DMARD), PsA, other inflammatory arthritis", "Hepatotoxicity, myelosuppression, mucositis, pneumonitis; folate supplementation required"],
            ["Anti-TNF biologics", "Block TNF-α (key pro-inflammatory cytokine)", "RA, AS, PsA, IBD-related arthritis", "Infection risk (TB reactivation — screen with IGRA before use), injection site reactions"],
            ["IL-6 inhibitors (tocilizumab)", "Block IL-6 receptor", "RA (especially with systemic features)", "Infection, dyslipidaemia, liver enzyme elevation; may mask fever"],
            ["JAK inhibitors (tofacitinib)", "Inhibit JAK1/3 → ↓cytokine signalling", "RA, PsA, AS", "Infection, VTE risk, CV events; avoid in high CV risk patients"],
            ["Corticosteroids", "Broad anti-inflammatory via glucocorticoid receptor", "Bridging in RA, acute gout, septic arthritis (adjunct in some cases)", "Osteoporosis, hyperglycaemia, adrenal suppression, Cushing's features with prolonged use"],
        ],
        col_widths=[3.5*cm, 4*cm, 4*cm, 5.5*cm]
    )
    E += spacer(8)

    # Sources
    sources = [
        "Robbins & Kumar Basic Pathology, p. 790 — OA pathogenesis and OA vs RA comparison",
        "Textbook of Family Medicine 9e, pp. 873–893 — OA, RA, Gout, PsA, Reactive Arthritis",
        "Goldman-Cecil Medicine (International Edition) — Spondyloarthritis (Chapter 244)",
        "Rosen's Emergency Medicine — Septic Arthritis (p. 2730)",
        "Firestein & Kelley's Textbook of Rheumatology (2-Volume Set) — OA genetics, SpA",
    ]
    E += h2("Sources")
    E += bullets(sources)

    return E

# ── Build PDF ─────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=MARGIN,
    rightMargin=MARGIN,
    topMargin=MARGIN + 0.7*cm,
    bottomMargin=MARGIN + 1.0*cm,
    title="Arthritis — Clinical Overview",
    author="Orris Medical AI",
    subject="All types of arthritis: pathology, diagnosis, treatment",
)

story = build_content()
doc.build(story, onFirstPage=on_page, onLaterPages=on_page)
print(f"PDF created: {OUTPUT}")
Running Command

cd /home/daytona/workspace/arthritis-pdf && python3 generate_arthritis_pdf.py 2>…

Running Command

ls -lh /home/daytona/workspace/arthritis-pdf/Arthritis_Clinical_Overview.pdf

Your PDF is ready! Here's the download link:

Arthritis Clinical Overview

PDF Document · PDF

What's inside (46 KB, A4, multi-page):
  • Cover page with colour-coded index of all 7 types
  • 7 clinical sections - OA, RA, Gout, Spondyloarthritis, Psoriatic Arthritis, Reactive Arthritis, Septic Arthritis - each with key points box, pathogenesis, clinical features, investigations, and treatment tables
  • 5 summary/comparison tables:
    1. Diagnostic comparison across all 7 types
    2. OA vs. RA head-to-head
    3. Synovial fluid analysis guide
    4. Gout vs. Pseudogout (crystal arthropathies)
    5. Key drug summary (NSAIDs, colchicine, allopurinol, MTX, biologics, JAK inhibitors, steroids)
  • Sourced from Robbins Pathology, Goldman-Cecil Medicine, Rosen's Emergency Medicine, and Firestein & Kelley's Rheumatology

Unable to download it

Running Command

ls -lh /home/daytona/workspace/arthritis-pdf/ && echo "---" && python3 -c " with…

Running Command

python3 -c " import base64 with open('/home/daytona/workspace/arthritis-pdf/Arth…

Try these two options:
Option 1 - Direct file link (try right-click → Save As):

Arthritis Clinical Overview

PDF Document · PDF

Option 2 - HTML download page (click to open, then click the download button inside):

download

HTML File · HTML


If neither works, the issue is your platform/browser restricting sandbox file access. In that case, here's what I can do instead:
  1. Email it to you - if your platform supports that
  2. Recreate as a web-viewable format - I can produce the full content as a clean HTML page you can print-to-PDF from your own browser (File → Print → Save as PDF)
  3. Upload to a file host - if the sandbox has internet outbound access
Which would you prefer?

Thank you I downloaded it

Glad it worked! 🎉
Whenever you need more topics covered — whether it's a deeper dive into any arthritis type, a new medical subject, or another PDF — just let me know. Good luck with your studies!

I'm a final year medical student (Sri Lanka- preparing for final exam), I'll give you my references, whenever I ask can you give answers, explanations or notes including important exam aspects, by get adhere to those references and please make sure not make any mistakes. References: Medicine :Kumar and clerk 11th edition Oxford handbook for Medicine Harrison principles of medicine Pead : Illustrated pediatrics Concise peadiatrics(Sri lankan book) Oxford hand book for peadiatrics Surgery : Bailey and love Oxford handbook Gyn & Obs : Oxford hand book for gyn and obs Ten teachers eranthi Madam's book(gyn and obs) --( in Sri Lanka) dutta's textbook of gynecology Psychiatry : Oxford hand book Hanwela sir's book (sri lankan book) Mim's Microbiology Robin's pathology Bennerd and brown's pharmacology And accepted national and other standards updated guidelines for all of them

Understood! I've noted all your references. Here's how I'll work with you:

Your Reference Stack (saved):
SubjectReferences
MedicineKumar & Clark 11th ed, Oxford Handbook of Medicine, Harrison's Principles
PaediatricsIllustrated Paediatrics, Concise Paediatrics (SL), Oxford Handbook of Paediatrics
SurgeryBailey & Love, Oxford Handbook of Surgery
Gyn & ObsOxford Handbook G&O, Ten Teachers, Eranthi Madam's book (SL), Dutta's Gynaecology
PsychiatryOxford Handbook of Psychiatry, Hanwela Sir's book (SL)
Cross-cuttingMims' Microbiology, Robbins' Pathology, Brenner & Rector's Pharmacology, Current national/international guidelines

How I'll answer every question:
  • Content aligned to those references as the primary authority
  • Sri Lankan context respected (local guidelines, SL-specific books prioritised where relevant)
  • Exam-focused: I'll flag high-yield points, common exam traps, and structured answer formats (SAQ/MCQ style where helpful)
  • No guessing - if something is uncertain or outside your references, I'll say so clearly
  • PDFs available on request for any topic

Go ahead - ask away! What topic do you want to start with?

Epilepsy

Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Excellent content gathered. Now compiling the full exam-focused notes.

EPILEPSY

Final Year MBBS - Exam Notes | Kumar & Clark | Harrison's | Oxford Handbook of Medicine


DEFINITION

Epilepsy = a disorder of the brain characterised by an enduring predisposition to generate epileptic seizures, defined as 2 or more unprovoked seizures >24 hours apart, OR 1 unprovoked seizure with ≥60% risk of recurrence (ILAE 2014).
An epileptic seizure = a transient occurrence of signs and/or symptoms due to abnormal, excessive, or synchronous neuronal activity in the brain.
⚠️ Exam Trap: A single seizure is NOT epilepsy. A provoked seizure (e.g., from hypoglycaemia, fever, drugs) is NOT epilepsy.

EPIDEMIOLOGY

  • Prevalence: ~1% of the population
  • Most common serious neurological disorder
  • Bimodal age distribution: peak in childhood and >60 years
  • ~30% of patients remain refractory to medical treatment

AETIOLOGY (ILAE Classification)

CategoryExamples
StructuralHippocampal sclerosis (mesial TLE), cortical dysplasia, post-stroke, tumour, trauma, post-encephalitis
GeneticIon channel mutations (SCN1A in Dravet, KCNQ2); chromosomal (Angelman, Down syndrome)
InfectiousNeurocysticercosis (most common cause worldwide), TB, cerebral malaria, HIV encephalopathy
MetabolicHypoglycaemia, hyponatraemia, hypocalcaemia, uraemia, pyridoxine deficiency
ImmuneAutoimmune encephalitis (anti-NMDAR, anti-LGI1)
UnknownMajority (~50% of cases)
⚠️ Exam High-Yield: In Sri Lanka/South Asia - neurocysticercosis and CNS TB are important infective causes. Always ask about travel, diet (pork), and TB contacts.

SEIZURE CLASSIFICATION (ILAE 2017)

A. By Onset Type

                    SEIZURES
                  /          \
          FOCAL             GENERALISED         UNKNOWN ONSET
        (partial)
       /        \
  Aware    Impaired        → Can evolve to bilateral tonic-clonic
(Simple)   Awareness       ("focal to bilateral tonic-clonic")
(Complex)

1. Focal Onset Seizures

Originate in one hemisphere (or network).
Old TermNew ILAE 2017 Term
Simple partialFocal aware seizure
Complex partialFocal impaired awareness seizure
Secondary generalisedFocal to bilateral tonic-clonic
  • Motor features: clonic jerking, tonic posturing, automatisms (lip smacking, fumbling)
  • Non-motor features: aura (epigastric rising, déjà vu, smell - temporal lobe), sensory, autonomic, emotional
  • Todd's paresis: post-ictal focal weakness lasting minutes to hours after focal seizure - IMPORTANT for exams

2. Generalised Onset Seizures

Both hemispheres involved from onset.
TypeFeatures
Tonic-clonic (grand mal)Tonic phase (stiffening) → clonic phase (jerking); post-ictal confusion; tongue biting; urinary incontinence
Absence (petit mal)Brief 5-20 sec staring; no post-ictal phase; 3 Hz spike-wave on EEG; childhood onset
MyoclonicBrief muscle jerks; usually morning; juvenile myoclonic epilepsy (JME)
Atonic (drop attacks)Sudden loss of muscle tone; falls; seen in Lennox-Gastaut syndrome
TonicSustained muscle contraction; falls
ClonicRhythmic jerking without prior tonic phase
⚠️ Exam High-Yield: Absence vs. focal impaired awareness - Absence: no aura, no post-ictal phase, very brief (<30 sec), 3 Hz spike-wave. Complex partial: may have aura, post-ictal confusion, longer, temporal EEG focus.

IMPORTANT EPILEPSY SYNDROMES

SyndromeAgeFeaturesEEGDrug of Choice
West Syndrome (Infantile spasms)3-12 monthsSalaam attacks; developmental regressionHypsarrhythmiaACTH / Vigabatrin
Lennox-Gastaut Syndrome1-7 yearsMultiple seizure types (tonic, atonic, absence); intellectual disabilitySlow spike-wave (<2.5 Hz)Valproate, Clobazam; Rufinamide
Childhood Absence Epilepsy (CAE)4-10 yearsMultiple daily absences; normal development3 Hz spike-waveEthosuximide / Valproate
Juvenile Myoclonic Epilepsy (JME)12-18 yearsMorning myoclonic jerks + GTCS; precipitated by sleep deprivationPolyspike-wave 4-6 HzValproate (lifelong often needed)
Temporal Lobe Epilepsy (TLE)AnyFocal impaired awareness + automatisms; aura commonTemporal spike-waveCarbamazepine / Lamotrigine
Dravet Syndrome<1 yearFebrile seizures → refractory epilepsy; SCN1A mutationVariesValproate + Clobazam; avoid Na+ channel blockers
Benign Rolandic Epilepsy5-12 yearsNocturnal GTCS + facial twitching; self-limitedCentrotemporal spikesOften no treatment needed

DIAGNOSIS

History (Most Important)

  • From witness (patient unaware during seizure): detailed account of ictal behaviour
  • Onset: focal or generalised? Aura?
  • Duration, frequency, precipitants (sleep deprivation, alcohol, flickering lights, fever, menstruation - catamenial epilepsy)
  • Post-ictal phase: confusion, Todd's paresis, headache
  • Birth history, developmental history, family history
  • Drug/alcohol history

Investigations

1. EEG
  • Most important investigation for epilepsy
  • Epileptiform activity (spikes/sharp waves) in ~90% of epileptics depending on recording circumstances
  • Only ~2% of non-epileptics show epileptiform activity
  • Interictal EEG is usual (not during seizure)
  • Normal EEG does NOT exclude epilepsy
  • Ictal EEG (video-EEG monitoring) = gold standard
  • Sleep-deprived EEG, hyperventilation, photic stimulation increase yield
  • Photosensitive epilepsy: photoparoxysmal response on photic stimulation
⚠️ Exam Trap: "The EEG is always abnormal in epilepsy" - FALSE. A substantial number of epileptics have consistently normal interictal EEGs.
2. Neuroimaging
  • MRI brain - preferred; detects structural causes (hippocampal sclerosis, tumours, cortical dysplasia, vascular malformations)
  • CT brain - for acute settings (haemorrhage, calcification e.g. neurocysticercosis)
  • Hippocampal sclerosis (mesial temporal sclerosis): most common structural cause of TLE; MRI shows hippocampal atrophy and T2 hyperintensity
3. Blood Tests
  • FBC, electrolytes (Na, Ca, Mg, glucose), renal/liver function
  • AED levels (if on treatment)
  • Prolactin: rises after tonic-clonic seizures (within 20 min) - helps differentiate from pseudoseizures (non-epileptic attack disorder / NEAD)
4. Lumbar Puncture
  • If meningitis/encephalitis suspected
  • Not routine

DIFFERENTIAL DIAGNOSIS

⚠️ Very commonly tested - Differentiating seizure from syncope/pseudoseizure
FeatureEpileptic SeizureSyncopeNon-Epileptic Attack (NEAD/Pseudoseizure)
ProdromeAura (specific)Pre-syncope: dizziness, dimming visionVariable, emotional trigger often
PositionAnyUprightAny
ColourCyanosis (GTCS)PallorNormal or flushing
DurationUsually <3 minSecondsOften prolonged (>2 min), waxing-waning
JerkingSynchronous, rhythmicBrief myoclonic (if prolonged)Asynchronous, thrashing, pelvic thrusting
Tongue biteSide of tongueTip of tongue (rare)Rare
IncontinenceCommon (GTCS)UncommonUncommon
Post-ictal confusionYes (mins-hours)Rapid recoveryVariable, often prolonged
ProlactinElevated (20 min post-GTCS)NormalNormal
EEG during attackAbnormalNormalNormal

MANAGEMENT OF EPILEPSY

When to Start AEDs?

  • After 2 or more unprovoked seizures
  • After 1 seizure if: known structural lesion, abnormal EEG, abnormal neurology, strong family history, or high personal risk (e.g., driver)

General Principles

  • Monotherapy first - start low, go slow; 70% controlled with first AED
  • If first drug fails at adequate dose → try second monotherapy
  • Combination only after 2 monotherapies fail
  • Drug-refractory epilepsy = failure of 2 appropriate AEDs at adequate doses

AED Selection by Seizure Type

Seizure/SyndromeFirst-lineSecond-line/Alternatives
Focal seizuresCarbamazepine, Lamotrigine, OxcarbazepineLevetiracetam, Sodium valproate, Gabapentin
Generalised tonic-clonicSodium valproate, LamotrigineLevetiracetam, Carbamazepine (with caution)
AbsenceEthosuximide, Sodium valproateLamotrigine
MyoclonicSodium valproateLevetiracetam, Clonazepam
JMESodium valproateLevetiracetam, Lamotrigine
TLE (focal)CarbamazepineLamotrigine, Levetiracetam
⚠️ Critical Exam Point: Carbamazepine WORSENS absence, myoclonic and atonic seizures - NEVER use in generalised epilepsy syndromes with these types.
⚠️ Valproate in women of childbearing age: HIGH teratogenicity risk (neural tube defects, cognitive effects in child) - AVOID if possible; requires Pregnancy Prevention Programme in UK (relevant for Harrison's/Kumar & Clark).

Key AED Side Effects (High Yield)

DrugImportant Side Effects
CarbamazepineDiplopia, ataxia, hyponatraemia (SIADH), rash (Stevens-Johnson in HLA-B*1502 - Asian patients), aplastic anaemia, enzyme inducer
PhenytoinNystagmus, ataxia, gingival hyperplasia, hirsutism, coarse facies, folate deficiency, peripheral neuropathy, zero-order kinetics (small dose change = large level change)
Sodium ValproateTremor, weight gain, hair loss (reversible), teratogenicity (neural tube defects), hepatotoxicity (especially in children <2 y), thrombocytopenia, pancreatitis
LamotrigineRash (SJS if titrated too fast), insomnia, diplopia; must titrate SLOWLY especially with valproate
LevetiracetamBehavioural problems, irritability, depression; otherwise well tolerated
EthosuximideGI upset, headache; only for absence seizures
PhenobarbitoneSedation, tolerance, hyperactivity in children, enzyme inducer, dependence
Carbamazepine/Phenytoin/PhenobarbEnzyme inducers - affect OCP, warfarin, other drugs
⚠️ HLA-B*1502 (common in Sri Lankan/South Asian populations) - associated with carbamazepine-induced Stevens-Johnson Syndrome. Consider testing before starting carbamazepine.

Stopping AEDs

  • Consider after 2 years seizure-free
  • Must discuss driving licence implications
  • Gradual taper over months (never abrupt - risk of withdrawal seizures)
  • Higher risk of recurrence: structural cause, abnormal EEG, focal epilepsy

Drug-Refractory Epilepsy (20%)

  • Surgery: anterior temporal lobectomy - 80-90% seizure freedom in mesial TLE with hippocampal sclerosis
  • Vagus Nerve Stimulation (VNS): ~50% get ≥50% seizure reduction
  • Deep Brain Stimulation (DBS): anterior nucleus of thalamus
  • Responsive Neurostimulation (RNS): closed-loop device
  • Ketogenic diet: especially in children; high fat, low carbohydrate

STATUS EPILEPTICUS (SE)

Definition

  • Convulsive SE: seizure lasting >5 minutes (operational - time to treat; older definition was 30 min)
  • Traditional definition: >30 minutes of continuous seizure OR ≥2 seizures without full recovery between them
  • A medical emergency - mortality 10-20%

Causes (VITAMINS mnemonic)

Vascular, Infection, Trauma, AED withdrawal/non-compliance (most common), Metabolic (Na, Ca, glucose), Infection, Neoplasm, Structure
Most common cause in a known epileptic = AED non-compliance

Management - Time-Based Protocol

TimeAction
0-5 minABC, O₂, position (left lateral), IV access, blood glucose (BM), bloods (FBC, U&E, Ca, Mg, glucose, LFT, AED levels, ABG), ECG, monitor
5-10 min (1st line)Lorazepam IV 0.1 mg/kg (4 mg in adult) - drug of choice; or Diazepam IV 0.15-0.25 mg/kg; Midazolam buccal/IM if no IV access
If seizure continues 5 min after 1st benzodiazepineRepeat benzodiazepine (second dose)
10-30 min (2nd line)Levetiracetam IV (preferred now) OR Fosphenytoin IV OR Sodium valproate IV; start while giving 2nd benzo
30-60 min (Refractory SE)Anaesthetic agents: Propofol OR Thiopental OR Midazolam infusion; intubation; ICU; continuous EEG monitoring
>60 min (Super-refractory SE)Ketamine, hypothermia, ketogenic diet, immunotherapy (if autoimmune encephalitis), surgery
⚠️ Exam Point: Lorazepam (not diazepam) is drug of choice for IV SE because it has longer CNS duration of action. Diazepam preferred if IV access unavailable (rectal). Midazolam IM/buccal for pre-hospital.
⚠️ Fosphenytoin preferred over phenytoin IV (less cardiotoxic, can give faster, no propylene glycol).
⚠️ If glucose low or alcoholic → give thiamine BEFORE dextrose (prevents Wernicke's).

EPILEPSY IN SPECIAL SITUATIONS

Epilepsy & Driving

  • Must be seizure-free for 1 year before driving a private car (UK/most countries; Sri Lanka guidelines similar)
  • Heavy goods/bus: seizure-free for 10 years off medication
  • Must notify the licensing authority

Epilepsy & Pregnancy

  • Uncontrolled seizures are MORE dangerous to foetus than most AEDs
  • Valproate: highest teratogenic risk - avoid (neural tube defects, spina bifida, developmental delay)
  • Carbamazepine: lowest teratogenic risk among older AEDs; still causes neural tube defects
  • Lamotrigine/Levetiracetam: preferred in pregnancy
  • Give folic acid 5 mg/day pre-conception and throughout pregnancy
  • Vitamin K to neonate at birth (enzyme-inducing AEDs reduce clotting factor synthesis)

Febrile Convulsions (relevant to Paeds rotation)

  • Age 6 months - 6 years; fever >38°C
  • Simple: <15 min, generalised, single episode in 24h, complete recovery
  • Complex: >15 min OR focal OR >1 episode in 24h → investigate further
  • NOT the same as epilepsy; only 2-3% develop epilepsy later
  • Treatment: diazepam rectal/buccal midazolam for seizure; antipyretics; NOT regular AEDs for simple febrile convulsions

EXAM SUMMARY - HIGH-YIELD POINTS

#Key Point
1Epilepsy = ≥2 unprovoked seizures; a provoked seizure is NOT epilepsy
2ILAE 2017: focal aware / focal impaired awareness / focal to bilateral tonic-clonic
3EEG: ~90% show epileptiform activity; normal EEG does NOT exclude epilepsy
4Absence: 3 Hz spike-wave; no post-ictal phase; ethosuximide or valproate
5Carbamazepine worsens absence/myoclonic/atonic seizures - never use
6Valproate: most teratogenic - avoid in women of childbearing age
7HLA-B*1502 (Asian): carbamazepine → Stevens-Johnson Syndrome
8Phenytoin: zero-order kinetics, gingival hyperplasia, hirsutism, nystagmus
9SE first-line = IV Lorazepam; second-line = Levetiracetam/Fosphenytoin/Valproate IV
10Status epilepticus operational definition = >5 min (treat now, don't wait for 30 min)
11Todd's paresis = post-ictal focal weakness; distinguishes focal from generalised
12Prolactin elevated after GTCS (within 20 min); normal in pseudoseizures
13Febrile convulsions: do NOT give regular AEDs for simple febrile convulsions
14Drug-refractory TLE → temporal lobectomy; 80-90% seizure freedom
15Drive only after 1 year seizure-free (private car)

Sources: Kumar & Clark's Clinical Medicine 11e | Harrison's Principles of Internal Medicine | Bradley & Daroff's Neurology in Clinical Practice | Katzung Basic & Clinical Pharmacology | Rosen's Emergency Medicine | Textbook of Family Medicine 9e

Would you like me to make a PDF of these epilepsy notes, or move on to the next topic?
This is a shared conversation. Sign in to Orris to start your own chat.