Systemic lupus erythematosus for brief in an questions in an exam with its, uh, definition, pathogenesis, clinical features, diagnosis, treatment modality.

Reading File
Finding Sources
Finding Sources
Searching Images

systemic lupus erythematosus butterfly rash malar rash

A clinical photograph of a patient's face demonstrating dermatological and mucosal manifestations of Systemic Lupus Erythematosus (SLE). A classic malar rash (butterfly rash) is present, characterized by symmetric, erythematous-to-violaceous patchy lesions over the malar eminences and the bridge of the nose, notably sparing the nasolabial folds. Additionally, the perioral region exhibits significant erythema and mucosal involvement. The lips show evidence of hemorrhagic lesions, with visible blood crusting and a small fissure on the lower lip, suggestive of vasculitis or active systemic inflammation. These visual findings are key diagnostic indicators for SLE, particularly when associated with hematological abnormalities such as thrombocytopenia. The photograph provides a clear example of cutaneous lupus manifestations for clinical diagnosis and medical education.

A clinical photograph of a patient's face demonstrating dermatological and mucosal manifestations of Systemic Lupus Erythematosus (SLE). A classic malar rash (butterfly rash) is present, characterized by symmetric, erythematous-to-violaceous patchy lesions over the malar eminences and the bridge of the nose, notably sparing the nasolabial folds. Additionally, the perioral region exhibits significant erythema and mucosal involvement. The lips show evidence of hemorrhagic lesions, with visible blood crusting and a small fissure on the lower lip, suggestive of vasculitis or active systemic inflammation. These visual findings are key diagnostic indicators for SLE, particularly when associated with hematological abnormalities such as thrombocytopenia. The photograph provides a clear example of cutaneous lupus manifestations for clinical diagnosis and medical education.

This clinical dermatology photograph displays the classic malar or butterfly rash of systemic lupus erythematosus (SLE) on the central face. Modality is clinical photography using standard white-light illumination; frontal/anterior view; color-balanced, high-resolution capture to depict superficial erythema and patchy hyperemia across the malar eminences and nasal bridge. The rash forms a bilateral, 'butterfly' distribution that typically reaches the cheeks and bridge of the nose while sparing the nasolabial folds. The observed features include confluent to patchy, erythematous macules and plaques with uniform erythema, mild perivascular edema, and subtle textural change without overt crusting or scaling in this image. The clinical morphology is characteristic for acute cutaneous lupus erythematosus; photosensitivity may exacerbate lesions. This cutaneous finding is one of the diagnostic criteria for SLE when aligned with serologic abnormalities (ANA, anti-dsDNA) and systemic features; its presence increases diagnostic probability in a compatible patient. Differential considerations include rosacea, seborrheic dermatitis, contact dermatitis, and dermatomyositis rash; however, the malar distribution and nasal bridge involvement help distinguish lupus. Clinically, this image supports SLE workup and educational reference for recognizing lupus-associated facial rash in medical students, residents, and researchers; useful for pattern-recognition training and multimodal data repository indexing. This image emphasizes clinical-context interpretation and education.

This clinical dermatology photograph displays the classic malar or butterfly rash of systemic lupus erythematosus (SLE) on the central face. Modality is clinical photography using standard white-light illumination; frontal/anterior view; color-balanced, high-resolution capture to depict superficial erythema and patchy hyperemia across the malar eminences and nasal bridge. The rash forms a bilateral, 'butterfly' distribution that typically reaches the cheeks and bridge of the nose while sparing the nasolabial folds. The observed features include confluent to patchy, erythematous macules and plaques with uniform erythema, mild perivascular edema, and subtle textural change without overt crusting or scaling in this image. The clinical morphology is characteristic for acute cutaneous lupus erythematosus; photosensitivity may exacerbate lesions. This cutaneous finding is one of the diagnostic criteria for SLE when aligned with serologic abnormalities (ANA, anti-dsDNA) and systemic features; its presence increases diagnostic probability in a compatible patient. Differential considerations include rosacea, seborrheic dermatitis, contact dermatitis, and dermatomyositis rash; however, the malar distribution and nasal bridge involvement help distinguish lupus. Clinically, this image supports SLE workup and educational reference for recognizing lupus-associated facial rash in medical students, residents, and researchers; useful for pattern-recognition training and multimodal data repository indexing. This image emphasizes clinical-context interpretation and education.

Clinical photograph of a female patient presenting with characteristic dermatological manifestations of Systemic Lupus Erythematosus (SLE). A white arrow points to a malar rash, also known as a butterfly rash, which is characterized by fixed erythema and slight edema across the bridge of the nose and the malar eminences of the cheeks, typically sparing the nasolabial folds. A yellow arrow indicates a discoid rash on the upper chest, appearing as a well-demarcated, erythematous, raised papule/plaque with a slightly hyperpigmented or scarred center. The patient also has a nasogastric tube in place, secured with tape, and appears to have thin hair, potentially representing non-scarring alopecia. The clinical significance of these visual findings is their role as diagnostic criteria in rheumatology for SLE. The presentation is suitable for intermediate to advanced medical education regarding autoimmune connective tissue diseases and cutaneous lupus manifestations.

Clinical photograph of a female patient presenting with characteristic dermatological manifestations of Systemic Lupus Erythematosus (SLE). A white arrow points to a malar rash, also known as a butterfly rash, which is characterized by fixed erythema and slight edema across the bridge of the nose and the malar eminences of the cheeks, typically sparing the nasolabial folds. A yellow arrow indicates a discoid rash on the upper chest, appearing as a well-demarcated, erythematous, raised papule/plaque with a slightly hyperpigmented or scarred center. The patient also has a nasogastric tube in place, secured with tape, and appears to have thin hair, potentially representing non-scarring alopecia. The clinical significance of these visual findings is their role as diagnostic criteria in rheumatology for SLE. The presentation is suitable for intermediate to advanced medical education regarding autoimmune connective tissue diseases and cutaneous lupus manifestations.

Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
I now have all the information needed. Here is the comprehensive exam-style answer on SLE:

Systemic Lupus Erythematosus (SLE) - Exam Notes

Classic malar (butterfly) rash of SLE

Definition

Systemic lupus erythematosus (SLE) is a chronic, multisystem autoimmune disease characterized by loss of self-tolerance, production of diverse autoantibodies (particularly anti-nuclear antibodies), immune complex deposition, and widespread tissue inflammation. It has a relapsing-remitting course and can affect virtually any organ system.
  • Predominantly affects young to middle-aged women (female:male ratio ~10:1)
  • Peak onset: 15-45 years of age
  • More common and severe in African-American, Asian, and Hispanic populations
  • Overall prevalence: 40-200 cases per 100,000
(Brenner and Rector's The Kidney, Rheumatology 2-Volume Set)

Pathogenesis

SLE results from a complex interplay of genetic, hormonal, and environmental factors that disrupt immune tolerance:

1. Genetic Predisposition

  • Concordance in monozygotic twins: ~25% (vs. <5% in fraternal twins)
  • HLA associations: HLA-B8, HLA-DR2, HLA-DR3
  • Complement deficiencies (homozygous C1q, C2, C4 deficiency) - C1q deficiency is the strongest single genetic risk factor
  • Over 40 genetic loci identified by GWAS affecting T-cell activation, B-cell signaling, Toll-like receptors (TLRs), and interferon (IFN) production

2. Immune Dysregulation

  • T cells: Decreased suppressor/cytotoxic T cells; increased CD4+ helper T cells; dysfunctional TH1, TH2, TH17 cytokine production
  • B cells: Polyclonal activation, defective B-cell tolerance
  • Apoptotic failure: Defective deletion of autoreactive B and T cell clones; autoreactive clones interact with TLRs, driving autoantibody production

3. Autoantibody Production & Immune Complex Disease

  • Autoantibodies form against: nuclear antigens (dsDNA, nucleosomes, histones), chromatin, and ribonuclear proteins
  • Type I interferon pathway is critically dysregulated - elevated IFN-alpha drives disease
  • Autoantibodies + self-antigens form circulating immune complexes that deposit in kidneys (glomeruli), skin (dermal-epidermal junction), choroid plexus, pericardium, and pleural spaces
  • Immune complex deposition activates complement cascade → inflammatory cell recruitment → tissue damage
  • Neutrophil extracellular traps (NETs): NETs release chromatin and histones, acting as autoantigens and stimulating plasmacytoid dendritic cells to produce IFN-gamma
(Brenner & Rector's The Kidney; Firestein & Kelley's Textbook of Rheumatology)

Clinical Features

SLE is a great imitator - multisystem involvement is the rule.

Mucocutaneous (80% of patients)

  • Malar (butterfly) rash - fixed erythema over cheeks and nasal bridge, sparing nasolabial folds (classic finding)
  • Discoid rash - scarring plaques; more common in chronic cutaneous lupus
  • Photosensitivity
  • Oral ulcers (usually painless, ~21%)
  • Non-scarring alopecia
  • Raynaud phenomenon

Musculoskeletal (most common presenting feature)

  • Polyarthritis/arthralgias - non-erosive, involving small joints
  • Myalgia, myositis

Renal (25-60% develop renal disease)

  • Lupus nephritis - the most serious manifestation
  • Proteinuria >0.5 g/day, hematuria, casts, hypertension, renal failure
  • WHO/ISN Classes I-VI; diffuse proliferative (Class IV) is most severe

Serositis

  • Pleuritis (pleuritic chest pain, pleural effusion)
  • Pericarditis (Libman-Sacks endocarditis - sterile verrucous endocarditis is characteristic)

Neuropsychiatric (NPSLE)

  • Seizures, psychosis, cognitive dysfunction, stroke, peripheral neuropathy

Hematological

  • Hemolytic anemia (Coombs-positive)
  • Leukopenia/lymphopenia
  • Thrombocytopenia
  • Increased thrombosis risk (antiphospholipid antibody syndrome overlap)

Cardiovascular

  • Accelerated atherosclerosis
  • Pericarditis, myocarditis
  • Libman-Sacks endocarditis

Pulmonary

  • Pleuritis, pneumonitis, pulmonary hypertension, shrinking lung syndrome
SLE - malar rash with discoid lesion and oral involvement

Diagnosis

ACR Criteria (1982) - 4 of 11 required (serially or simultaneously):

#Criterion
1Malar rash
2Discoid rash
3Photosensitivity
4Oral ulcers
5Non-erosive arthritis
6Serositis (pleuritis or pericarditis)
7Renal disorder (proteinuria >0.5 g/day or cellular casts)
8Neurologic disorder (seizures or psychosis)
9Hematologic disorder (hemolytic anemia, leukopenia, thrombocytopenia)
10Immunologic disorders (anti-dsDNA, anti-Sm, antiphospholipid antibodies, false +ve VDRL)
11Positive ANA
SLICC Criteria (more sensitive): ≥4 criteria (at least 1 clinical + 1 immunologic), OR biopsy-proven lupus nephritis + ANA or anti-dsDNA.

Key Laboratory Tests

TestSignificance
ANASensitive (~95%) but non-specific; best screening test
Anti-dsDNAHighly specific (~70%); correlates with disease activity and nephritis
Anti-SmHighly specific (~25-30%) but insensitive; pathognomonic
Complement (C3, C4)Low levels indicate active disease/consumption
Anti-Ro/SSA, Anti-La/SSBAssociated with neonatal lupus, SCLE
Antiphospholipid antibodiesRisk of thrombosis and miscarriage
CBCCytopenias
Urinalysis + 24hr proteinRenal involvement
(Andrews' Diseases of the Skin; Washington Manual of Medical Therapeutics)

Treatment Modalities

Treatment is stratified by disease severity.

All Patients - Baseline

  • Hydroxychloroquine (HCQ) 5 mg/kg/day - recommended for ALL SLE patients
    • Effective for: rash, photosensitivity, arthritis, alopecia, malaise
    • Reduces flares, long-term organ damage, thrombosis risk, and mortality
    • Not effective for major organ manifestations alone
  • Sun protection, lifestyle modification
  • Monitor for retinal toxicity

Mild Disease (mucocutaneous, arthritis, mild serositis)

  • NSAIDs - for arthritis, arthralgias, fever, mild serositis
  • Topical corticosteroids - for skin involvement
  • Hydroxychloroquine ± quinacrine

Moderate Disease (refractory symptoms, low complement, high anti-dsDNA)

  • Low-to-moderate dose glucocorticoids (prednisone 0.5 mg/kg/day)
  • Methotrexate - for musculoskeletal and skin manifestations
  • Belimumab (anti-BLyS/BAFF biologic) - approved add-on for active disease

Severe/Life-Threatening Disease (nephritis, CNS, severe cytopenias)

  • High-dose glucocorticoids: Prednisone 1-2 mg/kg/day PO, tapered by 10% every 7-10 days
  • IV pulse methylprednisolone 500-1000 mg/day for 3-5 days for life-threatening crises (severe nephritis, CNS disease, severe thrombocytopenia)
  • Cyclophosphamide - reserved for life-threatening manifestations (especially nephritis)
  • Mycophenolate mofetil (MMF) - as effective as cyclophosphamide in many LN classes; preferred when fertility preservation is a concern
  • Azathioprine - steroid-sparing, maintenance therapy
  • Rituximab (anti-CD20) - for severe SLE refractory to standard treatment
  • Anifrolumab (anti-IFN-alpha receptor) - newer biologic approved for moderate-to-severe SLE

Antiphospholipid Antibody Syndrome (overlap)

  • Long-term anticoagulation (warfarin); hydroxychloroquine reduces thrombosis risk
(Washington Manual of Medical Therapeutics; Firestein & Kelley's Textbook of Rheumatology)

Quick Exam Summary

FeatureKey Point
Classic rashMalar (butterfly) rash sparing nasolabial folds
Best screening testANA
Most specific testAnti-Sm (pathognomonic); Anti-dsDNA (correlates with activity)
Drug for ALL patientsHydroxychloroquine
Most serious complicationLupus nephritis (diffuse proliferative Class IV)
Characteristic cardiac lesionLibman-Sacks endocarditis
Pathognomonic antibodyAnti-Sm (Anti-dsDNA more clinically used)
Key mechanismImmune complex deposition + complement activation

Generate a PowerPoint comparing the immunological basis of SLE with other connective tissue diseases

Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Running Command

ls -la /tmp/workspace/ 2>/dev/null || mkdir -p /tmp/workspace && echo "workspace ready"

Running Command

mkdir -p /tmp/workspace/sle-ctd-pptx && echo "dir created"

Writing File

~/sle-ctd-pptx/build_pptx.py

from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.util import Inches, Pt
from io import BytesIO

# ── Colour palette ──────────────────────────────────────────────────────────
C_DARK_BLUE   = RGBColor(0x0D, 0x2B, 0x55)   # deep navy
C_MID_BLUE    = RGBColor(0x1A, 0x5C, 0x96)   # header blue
C_ACCENT      = RGBColor(0xC0, 0x39, 0x2B)   # red accent (SLE highlight)
C_ACCENT2     = RGBColor(0x27, 0xAE, 0x60)   # green
C_LIGHT_BLUE  = RGBColor(0xD6, 0xE8, 0xF7)   # pale blue bg
C_YELLOW      = RGBColor(0xFF, 0xE0, 0x82)   # highlight yellow
C_WHITE       = RGBColor(0xFF, 0xFF, 0xFF)
C_OFFWHITE    = RGBColor(0xF5, 0xF7, 0xFA)
C_DARK_TEXT   = RGBColor(0x1E, 0x1E, 0x2E)
C_GREY        = RGBColor(0x60, 0x60, 0x70)
C_ORANGE      = RGBColor(0xE6, 0x7E, 0x22)
C_PURPLE      = RGBColor(0x6C, 0x3A, 0x9B)
C_TEAL        = RGBColor(0x0A, 0x7C, 0x8C)

prs = Presentation()
prs.slide_width  = Inches(13.333)
prs.slide_height = Inches(7.5)
blank = prs.slide_layouts[6]

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

def add_rect(slide, x, y, w, h, fill_rgb, alpha=None):
    from pptx.oxml.ns import qn
    shape = slide.shapes.add_shape(1, Inches(x), Inches(y), Inches(w), Inches(h))
    shape.fill.solid()
    shape.fill.fore_color.rgb = fill_rgb
    shape.line.fill.background()
    return shape

def add_text(slide, text, x, y, w, h, size=18, bold=False, color=C_DARK_TEXT,
             align=PP_ALIGN.LEFT, italic=False, wrap=True, valign=MSO_ANCHOR.TOP,
             margin_l=0.05, margin_t=0.04):
    tb = slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h))
    tf = tb.text_frame
    tf.word_wrap = wrap
    tf.vertical_anchor = valign
    tf.margin_left   = Inches(margin_l)
    tf.margin_right  = Inches(0.05)
    tf.margin_top    = Inches(margin_t)
    tf.margin_bottom = Inches(0.02)
    p = tf.paragraphs[0]
    p.alignment = align
    run = p.add_run()
    run.text = text
    run.font.size  = Pt(size)
    run.font.bold  = bold
    run.font.italic = italic
    run.font.color.rgb = color
    run.font.name  = "Calibri"
    return tb

def add_multiline(slide, lines, x, y, w, h, size=14, color=C_DARK_TEXT,
                  bold_first=False, line_spacing=None, wrap=True):
    """lines: list of (text, bold, color_override_or_None)"""
    tb = slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h))
    tf = tb.text_frame
    tf.word_wrap = wrap
    tf.margin_left  = Inches(0.06)
    tf.margin_right = Inches(0.04)
    tf.margin_top   = Inches(0.04)
    tf.margin_bottom = Inches(0.02)
    for i, item in enumerate(lines):
        if isinstance(item, str):
            text, bold, col = item, False, color
        else:
            text = item[0]
            bold = item[1] if len(item) > 1 else False
            col  = item[2] if len(item) > 2 and item[2] else color
        if i == 0:
            p = tf.paragraphs[0]
        else:
            p = tf.add_paragraph()
        p.space_before = Pt(2)
        run = p.add_run()
        run.text = text
        run.font.size  = Pt(size)
        run.font.bold  = bold or (bold_first and i == 0)
        run.font.color.rgb = col
        run.font.name  = "Calibri"
    return tb

def slide_header(slide, title, subtitle=None):
    """Top banner with title"""
    add_rect(slide, 0, 0, 13.333, 1.05, C_DARK_BLUE)
    add_text(slide, title, 0.3, 0.08, 11, 0.72, size=30, bold=True,
             color=C_WHITE, align=PP_ALIGN.LEFT, valign=MSO_ANCHOR.MIDDLE)
    if subtitle:
        add_text(slide, subtitle, 0.3, 0.7, 11, 0.35, size=13, bold=False,
                 color=C_LIGHT_BLUE, align=PP_ALIGN.LEFT)
    # Accent bar
    add_rect(slide, 0, 1.05, 13.333, 0.06, C_ACCENT)

# ============================================================================
# SLIDE 1 – Title Slide
# ============================================================================
s1 = prs.slides.add_slide(blank)

# Full background gradient simulation with two rects
add_rect(s1, 0,    0, 13.333, 7.5, C_DARK_BLUE)
add_rect(s1, 0,    3.8, 13.333, 3.7, C_MID_BLUE)

# Decorative bars
add_rect(s1, 0,    3.75, 13.333, 0.08, C_ACCENT)
add_rect(s1, 0,    3.83, 13.333, 0.04, C_YELLOW)

# Title
add_text(s1, "Immunological Basis of Connective Tissue Diseases",
         0.8, 1.1, 12.0, 2.0, size=38, bold=True, color=C_WHITE,
         align=PP_ALIGN.CENTER, valign=MSO_ANCHOR.MIDDLE)

# Subtitle
add_text(s1, "A Comparative Analysis: SLE vs Rheumatoid Arthritis, Systemic Sclerosis,\n"
             "Sjögren Syndrome, Inflammatory Myopathies & Mixed CTD",
         0.8, 2.9, 12.0, 1.1, size=17, bold=False, color=C_LIGHT_BLUE,
         align=PP_ALIGN.CENTER, valign=MSO_ANCHOR.MIDDLE)

# Diseases listed at bottom
diseases = [
    ("SLE", C_ACCENT),
    ("RA", C_ORANGE),
    ("SSc", C_TEAL),
    ("SS", C_ACCENT2),
    ("IIM", C_PURPLE),
    ("MCTD", C_MID_BLUE),
]
box_w = 1.6
start_x = (13.333 - len(diseases) * box_w) / 2
for idx, (name, col) in enumerate(diseases):
    bx = start_x + idx * box_w
    add_rect(s1, bx + 0.1, 4.15, box_w - 0.2, 0.7, col)
    add_text(s1, name, bx + 0.1, 4.15, box_w - 0.2, 0.7,
             size=18, bold=True, color=C_WHITE, align=PP_ALIGN.CENTER,
             valign=MSO_ANCHOR.MIDDLE)

add_text(s1, "Sources: Firestein & Kelley's Rheumatology • Robbins & Kumar Basic Pathology\n"
             "Brenner & Rector's The Kidney • Andrews' Diseases of the Skin • Washington Manual",
         0.8, 5.1, 12, 0.7, size=11, color=C_LIGHT_BLUE, align=PP_ALIGN.CENTER)

add_text(s1, "For educational purposes – Medical examination reference",
         0.8, 5.9, 12, 0.4, size=10, color=C_GREY, italic=True, align=PP_ALIGN.CENTER)

# ============================================================================
# SLIDE 2 – Overview: Shared Immunological Mechanisms
# ============================================================================
s2 = prs.slides.add_slide(blank)
add_rect(s2, 0, 0, 13.333, 7.5, C_OFFWHITE)
slide_header(s2, "Shared Immunological Mechanisms in CTDs",
             "Core pathways common to all connective tissue diseases")

# 6 mechanism boxes
mech = [
    ("Loss of Self-Tolerance", "Failure of central/peripheral deletion of autoreactive T and B cells → autoreactive clones survive", C_ACCENT),
    ("T-Cell Dysregulation", "Imbalance of Th1/Th2/Th17 CD4+ subsets; deficient Treg suppression; altered TCR signalling", C_MID_BLUE),
    ("B-Cell Activation", "Polyclonal B-cell activation; defective B-cell tolerance checkpoints → autoantibody production", C_ORANGE),
    ("Autoantibody-Mediated Damage", "Autoantibodies bind self-antigens → immune complex deposition → complement activation → inflammation", C_PURPLE),
    ("Cytokine Dysregulation", "Elevated TNF-α, IL-6, IL-17, type I IFN; drives tissue inflammation, fibrosis, and organ damage", C_TEAL),
    ("Genetic Susceptibility", "HLA class II alleles (DR3, DR4, DR2); complement deficiencies; Fc receptor polymorphisms; >40 GWAS loci", C_ACCENT2),
]

cols = 3
rows = 2
bw = 4.0
bh = 2.3
xstart = 0.25
ystart = 1.3
pad = 0.17

for i, (title, body, col) in enumerate(mech):
    col_idx = i % cols
    row_idx = i // cols
    bx = xstart + col_idx * (bw + pad)
    by = ystart + row_idx * (bh + 0.1)
    add_rect(s2, bx, by, bw, bh, col)
    add_rect(s2, bx, by, bw, 0.45, C_DARK_BLUE)  # header strip
    add_text(s2, title, bx + 0.1, by, bw - 0.2, 0.45,
             size=14, bold=True, color=C_WHITE, valign=MSO_ANCHOR.MIDDLE)
    add_text(s2, body, bx + 0.12, by + 0.5, bw - 0.25, bh - 0.55,
             size=12, color=C_WHITE, wrap=True, valign=MSO_ANCHOR.TOP)

# ============================================================================
# SLIDE 3 – SLE Immunological Basis (Detailed)
# ============================================================================
s3 = prs.slides.add_slide(blank)
add_rect(s3, 0, 0, 13.333, 7.5, C_OFFWHITE)
slide_header(s3, "SLE – Immunological Basis", "The prototype immune complex disease")
add_rect(s3, 0, 1.11, 0.35, 6.39, C_ACCENT)  # left accent bar

# Left column
add_rect(s3, 0.45, 1.25, 6.0, 5.95, C_WHITE)

left_content = [
    ("PATHOGENESIS", True, C_ACCENT),
    ("", False, None),
    ("1. Genetic factors: HLA-DR2, DR3; C1q/C2/C4 deficiency (C1q deficiency is strongest\n    single genetic risk factor); >40 GWAS loci", False, None),
    ("", False, None),
    ("2. Defective apoptosis: Impaired clearance of apoptotic debris → nuclear antigens\n    (dsDNA, histones, nucleosomes) become autoantigens", False, None),
    ("", False, None),
    ("3. TLR activation: NETs release chromatin → pDC produce type I IFN → IFN-α\n    signature drives B-cell activation and autoantibody production", False, None),
    ("", False, None),
    ("4. B-cell dysregulation: Polyclonal activation; defective tolerance → anti-dsDNA,\n    anti-Sm, anti-Ro, anti-La, antiphospholipid antibodies", False, None),
    ("", False, None),
    ("5. Immune complex deposition: Circulating ICs deposit in glomeruli, skin DEJ,\n    pleura, choroid plexus → complement activation → tissue damage", False, None),
]
add_multiline(s3, left_content, 0.55, 1.32, 5.85, 5.8, size=12)

# Right column
add_rect(s3, 6.7, 1.25, 6.4, 2.75, C_WHITE)
right_top = [
    ("KEY AUTOANTIBODIES", True, C_DARK_BLUE),
    ("", False, None),
    ("• ANA (anti-nuclear): >95% sensitive; screening test", False, None),
    ("• Anti-dsDNA: ~70% specific; correlates with disease activity & nephritis", False, None),
    ("• Anti-Sm: Pathognomonic (~25%); highly specific", False, None),
    ("• Anti-Ro/SSA: Neonatal lupus, SCLE, secondary Sjögren", False, None),
    ("• Anti-La/SSB: Often with anti-Ro", False, None),
    ("• Antiphospholipid Ab: Thrombosis, recurrent miscarriage", False, None),
    ("• Anti-C1q: Lupus nephritis marker", False, None),
]
add_multiline(s3, right_top, 6.8, 1.32, 6.25, 2.65, size=12)

add_rect(s3, 6.7, 4.15, 6.4, 3.05, C_DARK_BLUE)
right_bot = [
    ("EFFECTOR MECHANISMS", True, C_YELLOW),
    ("", False, None),
    ("• Type II: Autoantibody-mediated cytopenia (haemolytic anaemia,\n  thrombocytopenia, leucopenia)", False, C_WHITE),
    ("• Type III: Immune complex disease (nephritis, serositis, vasculitis,\n  skin involvement)", False, C_WHITE),
    ("• IFN-α signature: Drives inflammatory loop", False, C_WHITE),
    ("• NETs (neutrophil extracellular traps): Source of autoantigens;\n  not degraded properly in SLE → perpetuate inflammation", False, C_WHITE),
]
add_multiline(s3, right_bot, 6.8, 4.2, 6.25, 2.9, size=12, color=C_WHITE)

# ============================================================================
# SLIDE 4 – Rheumatoid Arthritis Immunology
# ============================================================================
s4 = prs.slides.add_slide(blank)
add_rect(s4, 0, 0, 13.333, 7.5, C_OFFWHITE)
slide_header(s4, "Rheumatoid Arthritis – Immunological Basis",
             "Synovial inflammation driven by adaptive and innate immunity")
add_rect(s4, 0, 1.11, 0.35, 6.39, C_ORANGE)

add_rect(s4, 0.45, 1.25, 6.0, 5.95, C_WHITE)
ra_left = [
    ("PATHOGENESIS", True, C_ORANGE),
    ("", False, None),
    ("1. Genetic predisposition: HLA-DRB1 *04 (shared epitope) – most\n    important genetic risk; also PTPN22, CTLA4 polymorphisms", False, None),
    ("", False, None),
    ("2. Citrullination: Peptidylarginine deiminase (PAD) enzymes convert\n    arginine → citrulline in inflamed synovium; citrullinated proteins\n    (fibrinogen, vimentin, α-enolase) become neo-antigens", False, None),
    ("", False, None),
    ("3. T-cell activation: CD4+ Th1 & Th17 cells activated by APCs presenting\n    citrullinated peptides via HLA-DRB1 → produce IFN-γ, IL-17", False, None),
    ("", False, None),
    ("4. B-cell activation: RF (IgM anti-IgG Fc) and anti-CCP antibodies;\n    form immune complexes in synovium; activate complement & macrophages", False, None),
    ("", False, None),
    ("5. Pannus formation: Synovial fibroblasts (FLS) proliferate → invasive\n    pannus erodes cartilage and bone (via MMPs, RANKL)", False, None),
    ("", False, None),
    ("6. Cytokines: TNF-α, IL-1, IL-6, IL-17 are dominant drivers\n    (hence biologic targets: anti-TNF, anti-IL-6, anti-IL-17)", False, None),
]
add_multiline(s4, ra_left, 0.55, 1.32, 5.85, 5.8, size=11.5)

add_rect(s4, 6.7, 1.25, 6.4, 2.6, C_WHITE)
ra_right_top = [
    ("KEY AUTOANTIBODIES", True, C_ORANGE),
    ("", False, None),
    ("• Rheumatoid Factor (RF): IgM anti-IgG Fc; ~70–80% sensitive;\n  NOT specific (also in SS, SLE, infections)", False, None),
    ("• Anti-CCP (anti-cyclic citrullinated peptide): ~70% sensitive,\n  >95% SPECIFIC – best serologic marker; precedes symptoms", False, None),
    ("• Anti-MCV (mutated citrullinated vimentin): Correlated with\n  disease activity", False, None),
]
add_multiline(s4, ra_right_top, 6.8, 1.32, 6.25, 2.5, size=12)

add_rect(s4, 6.7, 4.0, 6.4, 3.2, C_ORANGE)
ra_right_bot = [
    ("VS SLE – KEY DIFFERENCES", True, C_WHITE),
    ("", False, None),
    ("• Target: Synovium (not kidney/multi-organ as in SLE)", False, C_WHITE),
    ("• Dominant Ig: No high-titre ANA; RF is main antibody", False, C_WHITE),
    ("• Mechanism: Cellular (Th17/Th1) > Immune complex", False, C_WHITE),
    ("• Complement: Usually normal (consumed in SLE)", False, C_WHITE),
    ("• Cytokines: TNF-α dominant (vs IFN-α in SLE)", False, C_WHITE),
    ("• Erosions: Yes (absent in SLE – non-erosive arthritis)", False, C_WHITE),
    ("• Anti-dsDNA: Absent (present in SLE)", False, C_WHITE),
]
add_multiline(s4, ra_right_bot, 6.8, 4.07, 6.25, 3.1, size=12, color=C_WHITE)

# ============================================================================
# SLIDE 5 – Systemic Sclerosis Immunology
# ============================================================================
s5 = prs.slides.add_slide(blank)
add_rect(s5, 0, 0, 13.333, 7.5, C_OFFWHITE)
slide_header(s5, "Systemic Sclerosis (Scleroderma) – Immunological Basis",
             "Autoimmunity, vasculopathy, and progressive fibrosis")
add_rect(s5, 0, 1.11, 0.35, 6.39, C_TEAL)

add_rect(s5, 0.45, 1.25, 6.0, 5.95, C_WHITE)
ssc_left = [
    ("PATHOGENESIS (THREE-COMPONENT MODEL)", True, C_TEAL),
    ("", False, None),
    ("1. VASCULOPATHY (earliest event)", True, C_DARK_TEXT),
    ("   Endothelial cell activation/injury → Raynaud phenomenon;\n   vascular remodelling; anti-endothelial cell antibodies", False, None),
    ("", False, None),
    ("2. IMMUNE DYSREGULATION", True, C_DARK_TEXT),
    ("   • Th2-dominant response → IL-4, IL-13 → TGF-β overproduction\n   • Th17 cells and IL-17 promote inflammation\n   • B-cell activation → autoantibodies (functional: stimulate\n     PDGF receptor on fibroblasts → collagen synthesis)", False, None),
    ("", False, None),
    ("3. FIBROSIS (hallmark)", True, C_DARK_TEXT),
    ("   TGF-β is the master fibrogenic cytokine → activates fibroblasts\n   → myofibroblasts → excessive ECM/collagen deposition in skin,\n   lung, heart, gut, kidney", False, None),
    ("", False, None),
    ("Triggering factors: Silica/solvents exposure; molecular mimicry\nwith CMV/other viruses; genetic background (HLA-DQ7, DR5, DR11)", False, None),
]
add_multiline(s5, ssc_left, 0.55, 1.32, 5.85, 5.8, size=11.5)

add_rect(s5, 6.7, 1.25, 6.4, 3.3, C_WHITE)
ssc_right_top = [
    ("DISEASE-SPECIFIC AUTOANTIBODIES", True, C_TEAL),
    ("", False, None),
    ("• Anti-Scl-70 (anti-topoisomerase I): diffuse SSc;\n  assoc. with pulmonary fibrosis; ~30% sensitivity", False, None),
    ("• Anti-centromere (ACA): limited SSc (CREST syndrome);\n  assoc. with pulmonary hypertension", False, None),
    ("• Anti-RNA polymerase III: diffuse SSc;\n  assoc. with renal crisis & cancer risk", False, None),
    ("• Anti-U1-RNP: Overlap with MCTD", False, None),
    ("• Anti-Th/To: limited SSc, pulmonary hypertension", False, None),
    ("• ANA: >90% positive (diffuse nuclear/speckled pattern)", False, None),
]
add_multiline(s5, ssc_right_top, 6.8, 1.32, 6.25, 3.2, size=12)

add_rect(s5, 6.7, 4.7, 6.4, 2.55, C_TEAL)
ssc_right_bot = [
    ("VS SLE – KEY DIFFERENCES", True, C_WHITE),
    ("", False, None),
    ("• Fibrosis is the hallmark (absent in SLE)", False, C_WHITE),
    ("• Th2/TGF-β dominant (vs Th1/IFN-α in SLE)", False, C_WHITE),
    ("• Vasculopathy is early and central", False, C_WHITE),
    ("• Anti-dsDNA and anti-Sm absent", False, C_WHITE),
    ("• Complement levels: Normal (not consumed)", False, C_WHITE),
    ("• Kidneys: Renal crisis (not immune complex GN)", False, C_WHITE),
]
add_multiline(s5, ssc_right_bot, 6.8, 4.77, 6.25, 2.45, size=12, color=C_WHITE)

# ============================================================================
# SLIDE 6 – Sjögren Syndrome Immunology
# ============================================================================
s6 = prs.slides.add_slide(blank)
add_rect(s6, 0, 0, 13.333, 7.5, C_OFFWHITE)
slide_header(s6, "Sjögren Syndrome – Immunological Basis",
             "Exocrinopathy driven by glandular lymphocytic infiltration")
add_rect(s6, 0, 1.11, 0.35, 6.39, C_ACCENT2)

add_rect(s6, 0.45, 1.25, 6.0, 5.95, C_WHITE)
ss_left = [
    ("PATHOGENESIS", True, C_ACCENT2),
    ("", False, None),
    ("1. Initiating trigger: Viral infection (EBV, HTLV-1, CMV) → glandular\n   epithelial cell activation → upregulate HLA-DR, co-stimulatory\n   molecules → self-antigen presentation", False, None),
    ("", False, None),
    ("2. T-cell infiltration: Periductal CD4+ T cells (Th1) infiltrate salivary\n   and lacrimal glands → lymphocytic sialadenitis (focus score ≥1)\n   → glandular destruction", False, None),
    ("", False, None),
    ("3. B-cell hyperactivity: Polyclonal B-cell activation; lymphoid\n   aggregates → ectopic germinal centres in glands; high risk\n   of B-cell lymphoma (40× increased risk of MALT lymphoma)", False, None),
    ("", False, None),
    ("4. Cytokines: BAFF/BLyS (B-cell survival factor) overexpressed\n   → B-cell survival and autoantibody production", False, None),
    ("", False, None),
    ("5. Type I IFN: IFN-α signature present (overlap with SLE)\n   → drives plasmacytoid dendritic cell activation", False, None),
    ("", False, None),
    ("HLA associations: HLA-DR3, B8; predominantly women (9:1 F:M)", False, None),
]
add_multiline(s6, ss_left, 0.55, 1.32, 5.85, 5.8, size=11.5)

add_rect(s6, 6.7, 1.25, 6.4, 3.0, C_WHITE)
ss_right_top = [
    ("KEY AUTOANTIBODIES", True, C_ACCENT2),
    ("", False, None),
    ("• Anti-Ro/SSA: ~70% sensitive; most useful marker;\n  causes neonatal lupus + congenital heart block (maternal Ab)", False, None),
    ("• Anti-La/SSB: ~40% sensitive; highly specific;\n  usually accompanies anti-Ro", False, None),
    ("• ANA: ~70% positive (speckled pattern)", False, None),
    ("• RF: ~75% positive (B-cell hyperactivity)", False, None),
    ("• Anti-alpha-fodrin: Specific marker for Sjögren", False, None),
    ("• Anti-M3R (muscarinic receptor Ab): Inhibit gland secretion", False, None),
]
add_multiline(s6, ss_right_top, 6.8, 1.32, 6.25, 2.9, size=12)

add_rect(s6, 6.7, 4.4, 6.4, 2.85, C_ACCENT2)
ss_right_bot = [
    ("VS SLE – KEY DIFFERENCES", True, C_WHITE),
    ("", False, None),
    ("• Primary target: Exocrine glands (not kidneys/multi-organ)", False, C_WHITE),
    ("• Anti-Ro/La are SHARED with SLE (secondary SS in ~30% SLE)", False, C_WHITE),
    ("• Anti-dsDNA and anti-Sm: Absent in primary SS", False, C_WHITE),
    ("• Lymphoma risk: Markedly elevated (unique to SS)", False, C_WHITE),
    ("• Complement: May be low (if cryoglobulins present)", False, C_WHITE),
    ("• Histology: Focal lymphocytic sialadenitis (pathognomonic)", False, C_WHITE),
]
add_multiline(s6, ss_right_bot, 6.8, 4.47, 6.25, 2.75, size=12, color=C_WHITE)

# ============================================================================
# SLIDE 7 – Inflammatory Myopathies & MCTD
# ============================================================================
s7 = prs.slides.add_slide(blank)
add_rect(s7, 0, 0, 13.333, 7.5, C_OFFWHITE)
slide_header(s7, "Inflammatory Myopathies & Mixed CTD – Immunological Basis",
             "IIM (Dermatomyositis / Polymyositis) and MCTD (Sharp Syndrome)")
add_rect(s7, 0, 1.11, 0.35, 6.39, C_PURPLE)

# Left: IIM
add_rect(s7, 0.45, 1.25, 6.0, 5.95, C_WHITE)
iim_left = [
    ("INFLAMMATORY MYOPATHIES (DM/PM/IBM)", True, C_PURPLE),
    ("", False, None),
    ("Dermatomyositis (DM) – Humoral/Complement pathway:", True, C_DARK_TEXT),
    ("• Complement activation (C3b/C4b) on endomysial capillaries\n  → MAC deposition → microangiopathy → muscle ischaemia\n  → perifascicular atrophy (hallmark histology)", False, None),
    ("• B cells and CD4+ T cells predominate", False, None),
    ("", False, None),
    ("Polymyositis (PM) – Cell-mediated pathway:", True, C_DARK_TEXT),
    ("• CD8+ cytotoxic T cells invade non-necrotic muscle fibres\n  expressing MHC class I (normally absent on muscle)\n  → perforin/granzyme-mediated myocyte destruction", False, None),
    ("", False, None),
    ("Key autoantibodies in IIM:", True, C_DARK_TEXT),
    ("• Anti-Jo-1 (anti-histidyl tRNA synthetase): Anti-synthetase\n  syndrome (ILD + myositis + mechanic's hands)", False, None),
    ("• Anti-Mi-2: DM; Gottron papules and heliotrope rash", False, None),
    ("• Anti-MDA5: Rapidly progressive ILD in DM", False, None),
    ("• Anti-SRP: Immune-mediated necrotising myopathy", False, None),
    ("• Anti-TIF1-γ: DM + cancer-associated myositis", False, None),
]
add_multiline(s7, iim_left, 0.55, 1.32, 5.85, 5.8, size=11)

# Right: MCTD
add_rect(s7, 6.7, 1.25, 6.4, 3.6, C_WHITE)
mctd_top = [
    ("MIXED CONNECTIVE TISSUE DISEASE (MCTD)", True, C_PURPLE),
    ("", False, None),
    ("Definition: Overlap syndrome with features of SLE, SSc, PM/DM\nand RA – united by anti-U1-RNP antibodies (Sharp syndrome)", False, None),
    ("", False, None),
    ("Immunology:", True, C_DARK_TEXT),
    ("• Anti-U1-RNP: Pathognomonic (high titres); target is U1 small\n  nuclear ribonucleoprotein complex", False, None),
    ("• ANA: Positive with high-titre speckled (S) pattern", False, None),
    ("• T-cell infiltration of vessels (vasculopathy) is prominent", False, None),
    ("• Th2 skewing → pulmonary hypertension risk", False, None),
    ("• Anti-dsDNA and anti-Sm usually ABSENT\n  (distinguishes from SLE)", False, None),
    ("• Complement: Usually normal", False, None),
]
add_multiline(s7, mctd_top, 6.8, 1.32, 6.25, 3.5, size=11.5)

add_rect(s7, 6.7, 5.0, 6.4, 2.25, C_PURPLE)
mctd_bot = [
    ("IIM & MCTD VS SLE", True, C_WHITE),
    ("", False, None),
    ("• IIM: DM = complement vasculopathy; PM = CD8+ T cells\n  (both mechanisms differ from SLE type III IC disease)", False, C_WHITE),
    ("• MCTD: Anti-U1-RNP defines it; overlap features but\n  anti-dsDNA/Sm absent; milder renal disease", False, C_WHITE),
    ("• IIM: MHC-I upregulation on muscle (unique)", False, C_WHITE),
]
add_multiline(s7, mctd_bot, 6.8, 5.07, 6.25, 2.15, size=12, color=C_WHITE)

# ============================================================================
# SLIDE 8 – Master Comparison Table
# ============================================================================
s8 = prs.slides.add_slide(blank)
add_rect(s8, 0, 0, 13.333, 7.5, C_DARK_BLUE)
slide_header(s8, "Master Comparison: Immunological Features of CTDs",
             "Side-by-side reference table")

# Table data
headers = ["Feature", "SLE", "RA", "SSc", "Sjögren", "IIM (DM/PM)", "MCTD"]
col_colors = [C_DARK_BLUE, C_ACCENT, C_ORANGE, C_TEAL, C_ACCENT2, C_PURPLE, C_MID_BLUE]

rows_data = [
    ["Sex ratio (F:M)", "10:1", "3:1", "4:1", "9:1", "2:1", "9:1"],
    ["Key mechanism", "IC deposition\nComplement", "Th17/Th1\nPannus", "TGF-β\nFibrosis", "Glandular\nCD4+ infiltrate", "DM: Complement\nPM: CD8+ T", "Overlap\nAnti-RNP"],
    ["Dominant Ab", "Anti-dsDNA\nAnti-Sm", "Anti-CCP\nRF", "Anti-Scl70\nAnti-centromere", "Anti-Ro/SSA\nAnti-La/SSB", "Anti-Jo-1\nAnti-Mi-2", "Anti-U1-RNP"],
    ["ANA pattern", "Homogeneous\n/Speckled", "Negative\nor low", "Diffuse\n/Nucleolar", "Speckled", "Speckled\nor negative", "High-titre\nSpeckled"],
    ["Complement", "↓ C3, C4\n(consumed)", "Normal", "Normal", "↓ if cryo-\nglobulinaemia", "Normal", "Normal"],
    ["Type I IFN", "+++", "+", "+", "++", "++ (DM)", "+"],
    ["Hallmark organ", "Kidney\n(nephritis)", "Joints\n(synovium)", "Skin/Lung\n(fibrosis)", "Salivary &\nlacrimal glands", "Muscle\n(myositis)", "Multi-system\noverlap"],
    ["Cytokines", "IFN-α\nIL-10", "TNF-α\nIL-6, IL-17", "TGF-β\nIL-4, IL-13", "BAFF\nIFN-α", "IL-15\nTNF-α", "IL-4\nIL-13"],
]

# Table dimensions
ncols = 7
nrows = len(rows_data) + 1  # +1 for header
table_x = 0.25
table_y = 1.2
table_w = 12.85
table_h = 6.05
col_w = table_w / ncols
row_h = table_h / nrows

for ci, (hdr, col) in enumerate(zip(headers, col_colors)):
    bx = table_x + ci * col_w
    add_rect(s8, bx, table_y, col_w, row_h, col)
    add_text(s8, hdr, bx + 0.03, table_y, col_w - 0.06, row_h,
             size=11, bold=True, color=C_WHITE, align=PP_ALIGN.CENTER,
             valign=MSO_ANCHOR.MIDDLE)

for ri, row in enumerate(rows_data):
    for ci, cell in enumerate(row):
        bx = table_x + ci * col_w
        by = table_y + (ri + 1) * row_h
        bg = C_WHITE if ri % 2 == 0 else C_LIGHT_BLUE
        if ci == 0:
            bg = C_DARK_BLUE
        add_rect(s8, bx, by, col_w, row_h, bg)
        txt_col = C_WHITE if ci == 0 else C_DARK_TEXT
        add_text(s8, cell, bx + 0.03, by, col_w - 0.06, row_h,
                 size=9.5, bold=(ci == 0), color=txt_col,
                 align=PP_ALIGN.CENTER, valign=MSO_ANCHOR.MIDDLE)

# ============================================================================
# SLIDE 9 – Autoantibody Quick Reference
# ============================================================================
s9 = prs.slides.add_slide(blank)
add_rect(s9, 0, 0, 13.333, 7.5, C_OFFWHITE)
slide_header(s9, "Autoantibody Quick Reference for CTDs",
             "Sensitivity, specificity and clinical associations")

ab_data = [
    # (Antibody, Disease, Sensitivity, Specificity, Clinical Association, Color)
    ("ANA", "SLE (screen)", "95%", "Low", "Screening – present in many CTDs", C_ACCENT),
    ("Anti-dsDNA", "SLE", "70%", "High", "Nephritis; tracks disease activity; complement consumption", C_ACCENT),
    ("Anti-Sm", "SLE", "25%", "Pathognomonic", "Specific for SLE; CNS and renal disease", C_ACCENT),
    ("Anti-Ro/SSA", "SLE/SS", "40–70%", "Moderate", "Neonatal lupus; SCLE; secondary Sjögren in SLE", C_ACCENT),
    ("Anti-CCP", "RA", "70%", ">95%", "Best RA marker; preclinical; erosive disease", C_ORANGE),
    ("RF (IgM)", "RA", "70–80%", "Low", "Not specific; also in SS, SLE, infections", C_ORANGE),
    ("Anti-Scl-70", "SSc (diffuse)", "30–40%", "High", "Pulmonary fibrosis risk in diffuse SSc", C_TEAL),
    ("Anti-centromere", "SSc (limited)", "60–80%", "High", "CREST; pulmonary hypertension risk", C_TEAL),
    ("Anti-RNA pol III", "SSc", "20%", "High", "Renal crisis; cancer-associated SSc", C_TEAL),
    ("Anti-La/SSB", "Sjögren", "40%", "High", "Almost always with anti-Ro; secondary SS", C_ACCENT2),
    ("Anti-Jo-1", "PM/DM (IIM)", "20–30%", "High", "Anti-synthetase syndrome: ILD + myositis", C_PURPLE),
    ("Anti-Mi-2", "DM", "15–25%", "High", "Classical DM rash (Gottron papules, heliotrope)", C_PURPLE),
    ("Anti-MDA5", "DM", "~20%", "High", "Rapidly progressive ILD; amyopathic DM", C_PURPLE),
    ("Anti-U1-RNP", "MCTD", ">95% in MCTD", "Moderate", "Pathognomonic for MCTD (required for dx)", C_MID_BLUE),
]

headers9 = ["Antibody", "Primary Disease", "Sensitivity", "Specificity", "Key Clinical Association"]
col_ws = [1.7, 1.6, 1.2, 1.2, 7.1]  # sum = 12.8
tx = 0.27
ty = 1.2
hrow_h = 0.4
drow_h = 0.38
hcols = [C_DARK_BLUE, C_MID_BLUE, C_MID_BLUE, C_MID_BLUE, C_MID_BLUE]

cx = tx
for i, (h, cw, hcol) in enumerate(zip(headers9, col_ws, hcols)):
    add_rect(s9, cx, ty, cw, hrow_h, hcol)
    add_text(s9, h, cx + 0.04, ty, cw - 0.06, hrow_h,
             size=11, bold=True, color=C_WHITE, align=PP_ALIGN.CENTER,
             valign=MSO_ANCHOR.MIDDLE)
    cx += cw

for ri, (ab, dis, sens, spec, assoc, col) in enumerate(ab_data):
    by = ty + hrow_h + ri * drow_h
    cx = tx
    cells = [ab, dis, sens, spec, assoc]
    cell_cols = [col, C_WHITE if ri%2==0 else C_LIGHT_BLUE,
                 C_WHITE if ri%2==0 else C_LIGHT_BLUE,
                 C_WHITE if ri%2==0 else C_LIGHT_BLUE,
                 C_WHITE if ri%2==0 else C_LIGHT_BLUE]
    cell_txt_cols = [C_WHITE, C_DARK_TEXT, C_DARK_TEXT, C_DARK_TEXT, C_DARK_TEXT]
    for ci, (cell, cw, bg, tc) in enumerate(zip(cells, col_ws, cell_cols, cell_txt_cols)):
        add_rect(s9, cx, by, cw, drow_h, bg)
        add_text(s9, cell, cx + 0.04, by, cw - 0.06, drow_h,
                 size=10, bold=(ci==0), color=tc,
                 align=PP_ALIGN.CENTER if ci < 4 else PP_ALIGN.LEFT,
                 valign=MSO_ANCHOR.MIDDLE)
        cx += cw

# ============================================================================
# SLIDE 10 – Treatment Targets & Biologics
# ============================================================================
s10 = prs.slides.add_slide(blank)
add_rect(s10, 0, 0, 13.333, 7.5, C_OFFWHITE)
slide_header(s10, "Immunological Treatment Targets in CTDs",
             "Targeted therapies based on dominant immunological pathways")

target_data = [
    ("SLE", C_ACCENT, [
        "Hydroxychloroquine – TLR/IFN inhibition; ALL SLE patients",
        "Belimumab – Anti-BLyS/BAFF; reduces B-cell survival",
        "Anifrolumab – Anti-IFNα receptor; blocks IFN signature",
        "Mycophenolate mofetil / Cyclophosphamide – Nephritis",
        "Glucocorticoids – Acute flares/severe manifestations",
        "Voclosporin (CNI) – Lupus nephritis (newer approval)",
    ]),
    ("RA", C_ORANGE, [
        "Anti-TNF-α: Infliximab, Etanercept, Adalimumab",
        "Anti-IL-6R: Tocilizumab, Sarilumab",
        "CTLA4-Ig: Abatacept (blocks T-cell co-stimulation)",
        "Anti-CD20: Rituximab (B-cell depletion)",
        "JAK inhibitors: Tofacitinib, Baricitinib (JAK1/2)",
        "Methotrexate – anchor DMARD",
    ]),
    ("SSc", C_TEAL, [
        "Anti-TGF-β strategies (nintedanib for ILD)",
        "Mycophenolate / Cyclophosphamide – ILD",
        "Tocilizumab (anti-IL-6R) – skin/ILD",
        "Rituximab – anti-fibrotic + immune suppression",
        "CCB / Sildenafil / Bosentan – vasculopathy/PAH",
        "Autologous HSCT – severe diffuse SSc",
    ]),
    ("Sjögren", C_ACCENT2, [
        "Hydroxychloroquine – systemic inflammation",
        "Rituximab – severe extraglandular manifestations",
        "Belimumab – anti-BAFF; B-cell directed",
        "Symptomatic: Pilocarpine/cevimeline (muscarinic agonist)",
        "Topical ciclosporin – dry eye",
        "Ianalumab (anti-BAFFR) – in trials",
    ]),
    ("IIM", C_PURPLE, [
        "Glucocorticoids – first-line",
        "Methotrexate / Azathioprine – steroid-sparing",
        "IVIG – DM, juvenile DM, refractory cases",
        "Rituximab – anti-synthetase, refractory PM/DM",
        "Anti-IL-6 / JAK inhibitors – emerging evidence",
        "Nintedanib / Pirfenidone – IIM-associated ILD",
    ]),
    ("MCTD", C_MID_BLUE, [
        "Hydroxychloroquine – mild-moderate disease",
        "Glucocorticoids – inflammatory flares",
        "Treat component manifestations:\n  • SLE features → HCQ ± immunosuppressants\n  • PAH → sildenafil/bosentan\n  • Myositis → methotrexate",
        "Rituximab – refractory systemic disease",
    ]),
]

bw = 4.0; bh = 2.85
xst = 0.2; yst = 1.2; pad = 0.13

for i, (name, col, items) in enumerate(target_data):
    ci = i % 3
    ri = i // 3
    bx = xst + ci * (bw + pad)
    by = yst + ri * (bh + 0.12)
    add_rect(s10, bx, by, bw, bh, C_WHITE)
    add_rect(s10, bx, by, bw, 0.42, col)
    add_text(s10, name, bx + 0.08, by, bw - 0.16, 0.42,
             size=15, bold=True, color=C_WHITE, valign=MSO_ANCHOR.MIDDLE)
    lines = [(item, False, None) for item in items]
    # Add bullet prefix
    lines_fmt = [("• " + item[0], False, None) for item in lines]
    add_multiline(s10, lines_fmt, bx + 0.1, by + 0.47, bw - 0.2, bh - 0.52, size=10.5)

# ============================================================================
# SLIDE 11 – Summary & Key Exam Points
# ============================================================================
s11 = prs.slides.add_slide(blank)
add_rect(s11, 0, 0, 13.333, 7.5, C_DARK_BLUE)
slide_header(s11, "Summary & High-Yield Exam Points",
             "Key facts for clinical examinations")

summary_points = [
    ("SLE", C_ACCENT, [
        "Anti-dsDNA + low complement = active SLE (especially nephritis)",
        "Anti-Sm is pathognomonic; Anti-dsDNA tracks activity",
        "Type III (IC) disease is the dominant mechanism",
        "IFN-α signature drives the inflammatory loop",
        "HCQ is given to ALL SLE patients",
    ]),
    ("RA", C_ORANGE, [
        "Anti-CCP is the best marker (>95% specific); precedes symptoms",
        "Shared epitope (HLA-DRB1*04) is the main genetic risk",
        "Citrullination → neo-antigen → anti-CCP production",
        "TNF-α, IL-6 and IL-17 are dominant cytokines",
        "Complement is NORMAL (unlike SLE)",
    ]),
    ("SSc", C_TEAL, [
        "Anti-centromere = limited SSc (CREST); pulm. hypertension",
        "Anti-Scl-70 = diffuse SSc; pulmonary fibrosis",
        "TGF-β drives fibrosis; distinct from SLE (IC disease)",
        "Vasculopathy is the earliest event (Raynaud)",
        "Renal crisis ≠ nephritis (different from SLE)",
    ]),
    ("SS", C_ACCENT2, [
        "Anti-Ro/SSA most sensitive; neonatal lupus + heart block",
        "Anti-La almost always accompanies anti-Ro",
        "MALT lymphoma risk is 40× increased",
        "Focal lymphocytic sialadenitis (focus score ≥1) is diagnostic",
        "BAFF/BLyS is over-expressed → therapeutic target",
    ]),
    ("IIM", C_PURPLE, [
        "DM = complement-mediated microangiopathy (perifascicular atrophy)",
        "PM = CD8+ T cells invade MHC-I+ muscle fibres",
        "Anti-Jo-1 = anti-synthetase syndrome (ILD + myositis)",
        "Anti-MDA5 = rapidly progressive ILD (high mortality)",
        "Anti-TIF1-γ = cancer-associated myositis",
    ]),
    ("MCTD", C_MID_BLUE, [
        "High-titre anti-U1-RNP is required for diagnosis",
        "Anti-dsDNA and anti-Sm are ABSENT (distinguishes from SLE)",
        "Overlap of SLE + SSc + PM features",
        "Generally better prognosis than SLE alone",
        "Pulmonary hypertension is a major cause of mortality",
    ]),
]

bw = 3.95; bh = 2.75
xst = 0.2; yst = 1.2; pad = 0.1

for i, (name, col, pts) in enumerate(summary_points):
    ci = i % 3
    ri = i // 3
    bx = xst + ci * (bw + pad)
    by = yst + ri * (bh + 0.12)
    add_rect(s11, bx, by, bw, bh, RGBColor(0x1A, 0x2A, 0x40))
    add_rect(s11, bx, by, bw, 0.42, col)
    add_text(s11, name, bx + 0.08, by, bw - 0.16, 0.42,
             size=15, bold=True, color=C_WHITE, valign=MSO_ANCHOR.MIDDLE)
    lines_fmt = [("✓ " + pt, False, C_WHITE) for pt in pts]
    add_multiline(s11, lines_fmt, bx + 0.1, by + 0.47, bw - 0.2, bh - 0.52,
                  size=10.5, color=C_WHITE)

# Footer
add_text(s11,
    "Sources: Firestein & Kelley's Textbook of Rheumatology • Robbins & Kumar Basic Pathology • "
    "Brenner & Rector's The Kidney • Andrews' Diseases of the Skin • Washington Manual of Medical Therapeutics",
    0.3, 7.1, 12.8, 0.38, size=9, color=C_GREY, italic=True, align=PP_ALIGN.CENTER)

# ── Save ─────────────────────────────────────────────────────────────────────
output_path = "/tmp/workspace/sle-ctd-pptx/SLE_vs_CTDs_Immunology.pptx"
buf = BytesIO()
prs.save(buf)
with open(output_path, "wb") as f:
    f.write(buf.getvalue())
print(f"Saved: {output_path}")
print(f"Slides: {len(prs.slides)}")
Running Command

cd /tmp/workspace/sle-ctd-pptx && python build_pptx.py 2>&1

Running Command

ls -lh /tmp/workspace/sle-ctd-pptx/SLE_vs_CTDs_Immunology.pptx

Your presentation is ready:

SLE vs CTDs Immunology

Presentation · PPTX


What's Inside (11 slides)

SlideContent
1Title slide - All 6 diseases colour-coded
2Shared immunological mechanisms - 6 core boxes (loss of tolerance, T/B cell dysregulation, autoantibodies, cytokines, genetics)
3SLE - deep dive - Pathogenesis, NETs, IFN-α, autoantibody panel, Type II/III mechanisms
4Rheumatoid Arthritis - Citrullination, shared epitope, anti-CCP, pannus, TNF-α vs SLE
5Systemic Sclerosis - Three-component model (vasculopathy → immunity → fibrosis), TGF-β, antibody panel
6Sjögren Syndrome - Glandular infiltration, BAFF/BLyS, anti-Ro/La, lymphoma risk
7IIM (DM/PM) & MCTD - Complement vs CD8+ pathways in myositis; anti-U1-RNP in MCTD
8Master comparison table - All 6 diseases side-by-side (mechanism, antibodies, complement, IFN, cytokines, target organ)
9Autoantibody quick reference - 14 antibodies with sensitivity, specificity and clinical associations
10Treatment targets & biologics - Immunological rationale for each drug class per disease
11High-yield exam summary - 5 bullet points per disease for rapid revision
Sources: Firestein & Kelley's Rheumatology, Robbins & Kumar Basic Pathology, Brenner & Rector's The Kidney, Andrews' Diseases of the Skin, Washington Manual of Medical Therapeutics.
This is a shared conversation. Sign in to Orris to start your own chat.