Arthritis

Reading File
Asking for Preferences
Finding Sources
Finding Sources
Searching PubMed

"arthritis" AND "treatment guidelines"

Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Loading Image

Arthritis - Comprehensive Clinical Overview

Arthritis means inflammation of joints. The major categories differ sharply in their pathogenesis, joint distribution, serology, and systemic involvement. - Robbins & Kumar Basic Pathology, p.790

Classification at a Glance

TypePrimary MechanismJoints AffectedKey Serologies
OsteoarthritisMechanical/degenerativeWeight-bearing (knees, hips, DIP/PIP)None
Rheumatoid ArthritisAutoimmune (T cell/ACPA)Small joints bilaterally (MCP, PIP, wrist)RF, ACPA
GoutUrate crystal deposition1st MTP (podagra), ankle, kneeElevated uric acid
Pseudogout (CPPD)Calcium pyrophosphate crystalsKnees, wristsNone
Seronegative SpAHLA-B27 associatedAxial skeleton, sacroiliac jointsRF negative, HLA-B27
Septic ArthritisBacterial infectionSingle large joint (knee, hip)WBC, cultures
Reactive/LymeInfection-triggered / BorreliaMigratory, large joints (knees)Anti-Borrelia Ab

1. Osteoarthritis (OA)

Pathogenesis

OA is primarily a degenerative disorder, not an inflammatory one - though inflammation acts as a secondary amplifier. Biomechanical stress is the principal driver.
  • Chondrocytes are injured and secrete matrix metalloproteinases (MMPs) that degrade type II collagen
  • Water content increases; proteoglycan concentration falls
  • TGF-β, IL-1, IL-6, prostaglandins, and nitric oxide from macrophages/synoviocytes accelerate cartilage destruction
  • Bone morphogenetic proteins (BMP) + TGF-β drive osteophyte (bone spur) formation
Robbins & Kumar Basic Pathology, p.790-791

Epidemiology & Risk Factors

  • Most common joint disease; prevalence rises exponentially after age 50 (~40% affected by age 70)
  • Idiopathic (primary): aging, female sex, obesity, genetic factors
  • Secondary: prior joint injury, diabetes, joint deformity, metabolic disorders

Morphology

FeatureDescription
Cartilage fibrillationSurface clefting and softening of articular cartilage
Bone eburnationExposed subchondral bone polished ivory-like by friction
Subchondral cystsSynovial fluid forced into bone fracture gaps (ball-valve mechanism)
OsteophytesBony outgrowths at joint margins capped by fibrocartilage
Loose bodies ("joint mice")Fragments of dislodged cartilage/bone in joint space
Synovial changesMild congestion and fibrosis only - no aggressive inflammation

Clinical Features

  • Insidious onset of joint pain, worsened by use, relieved by rest
  • Morning stiffness < 30 minutes (contrast: RA > 1 hour)
  • Crepitus on movement
  • Heberden's nodes (DIP) and Bouchard's nodes (PIP) in hand OA
  • No systemic features; no autoantibodies
  • X-ray: joint space narrowing, subchondral sclerosis, osteophytes, subchondral cysts

Management

  • Non-pharmacologic: weight loss, physiotherapy, low-impact exercise, orthotics
  • Pharmacologic: paracetamol (first-line), topical NSAIDs, oral NSAIDs, intraarticular corticosteroids, intraarticular hyaluronidase
  • Surgical: joint replacement (arthroplasty) for severe/refractory disease

2. Rheumatoid Arthritis (RA)

Pathogenesis

RA is driven by CD4+ T cell autoimmunity against joint antigens (particularly citrullinated proteins). Key mechanisms:
  • TNF, IL-1, IL-6 from macrophages: recruit/activate leukocytes, stimulate proteases that destroy hyaline cartilage - TNF is considered the central mediator (basis for biologic therapy)
  • IL-17 from Th17 cells: recruits neutrophils and monocytes
  • RANKL on activated T cells: stimulates osteoclasts → bone erosion
  • ACPA (anticitrullinated peptide antibody): autoantibodies against citrullinated fibrinogen, type II collagen, α-enolase, and vinculin - detected in up to 70% of patients, appear years before disease onset
  • Rheumatoid factor (RF): IgM or IgA antibodies against Fc of IgG, found in ~80% - role in progression unclear
  • HLA-DR4 is the primary genetic risk allele (50% of risk is genetic); molecular mimicry between citrullinated vinculin epitope and microbial antigens may trigger disease
Robbins & Kumar Basic Pathology, p.792

Morphology

  • Pannus: destructive fibroinflammatory tissue that overlies and erodes cartilage and bone
  • Synovial hyperplasia with dense lymphoplasmacytic infiltrate, lymphoid follicles with germinal centers
  • Fibrous and bony ankylosis in advanced disease
  • Rheumatoid nodules: central fibrinoid necrosis surrounded by palisaded macrophages (skin over pressure points, lungs, heart)

Clinical Features

  • Affects ~0.25-1% of the US population; 3x more common in women; peak onset 3rd-5th decades
  • Symmetric small joint polyarthritis: MCP, PIP, wrist, MTP - DIP typically spared
  • Morning stiffness > 1 hour
  • Fusiform soft tissue swelling, ulnar deviation, swan-neck and boutonniere deformities (late)
  • Extraarticular: subcutaneous nodules, pulmonary fibrosis, pleuritis, pericarditis, vasculitis, Felty's syndrome (RA + splenomegaly + neutropenia), Sjögren's syndrome overlap, increased CV risk

Diagnosis - 2010 ACR/EULAR Criteria

Score ≥ 6/10 confirms RA:
  • Joint involvement (0-5 points): 1 large joint → 0; ≥10 small joints → 5
  • Serology (0-3): negative → 0; low-positive RF or ACPA → 2; high-positive → 3
  • Acute phase reactants (0-1): normal CRP/ESR → 0; abnormal → 1
  • Duration (0-1): < 6 weeks → 0; ≥ 6 weeks → 1

Management

The key principle: early, aggressive DMARD therapy at diagnosis targeting remission. - Firestein & Kelley's Textbook of Rheumatology
Step 1 - Conventional DMARDs (cDMARDs)
  • Methotrexate (MTX): anchor drug - weekly low dose + folate supplementation
  • Leflunomide, hydroxychloroquine, sulfasalazine: alternatives or combinations
  • Glucocorticoids: bridging therapy only; avoid long-term
Step 2 - Biologics (if inadequate cDMARD response)
  • Anti-TNF agents: etanercept, adalimumab, infliximab, certolizumab, golimumab (first-line biologics)
  • Anti-IL-6: tocilizumab, sarilumab
  • Anti-CD20 (B cell depletion): rituximab
  • T cell costimulation blocker: abatacept
  • IL-1 inhibitor: anakinra
Step 3 - JAK inhibitors (targeted synthetic DMARDs)
  • Tofacitinib, baricitinib, upadacitinib - oral; used when biologics fail or are contraindicated

3. Gout & Crystal Arthropathies

Gout

Pathogenesis: Hyperuricemia → monosodium urate (MSU) crystal deposition in joints and soft tissues → intense neutrophilic inflammation. Urate crystals activate the NLRP3 inflammasome → IL-1β release.
Crystals: Needle-shaped, negatively birefringent (yellow parallel to compensator), most common at 1st MTP joint (podagra)
Stages:
  1. Asymptomatic hyperuricemia
  2. Acute gouty arthritis: Sudden, severe, warm, red joint (especially 1st MTP); self-limiting in 5-14 days
  3. Intercritical gout: Symptom-free interval between attacks
  4. Chronic tophaceous gout: Tophi (urate deposits) in soft tissues; chronic destructive arthritis
Triggers: Alcohol, red meat/seafood, diuretics, dehydration, surgery, trauma, acute illness
Investigations: Serum uric acid (may be normal during acute attack), joint aspiration (gold standard), x-ray (punched-out erosions with overhanging edge = "rat bite" lesion in chronic gout)
Management:
  • Acute attack: NSAIDs (indomethacin), colchicine (within 24h), or corticosteroids; do NOT start urate-lowering therapy during acute attack (but continue if already on it)
  • Prevention: Allopurinol (xanthine oxidase inhibitor, first-line), febuxostat; probenecid (uricosuric); target serum uric acid < 6 mg/dL (< 5 in tophi)
  • Colchicine 0.5 mg daily for prophylaxis during initiation of urate-lowering therapy

Pseudogout (CPPD Disease)

  • Calcium pyrophosphate dihydrate crystals: rhomboid-shaped, positively birefringent (blue parallel to compensator)
  • Affects knees and wrists predominantly (vs. gout's predilection for feet)
  • X-ray shows chondrocalcinosis (calcification in cartilage)
  • Managed similarly to acute gout (NSAIDs, colchicine, steroids); no equivalent to urate-lowering therapy

4. Seronegative Spondyloarthropathies (SpA)

A family of conditions sharing HLA-B27 association, enthesitis (inflammation at tendon/ligament insertions), axial involvement, and seronegative (RF-negative) status.
ConditionKey Features
Ankylosing Spondylitis (AS)Chronic inflammation of sacroiliac joints + spine; young men; "bamboo spine" on X-ray; uveitis, aortitis
Psoriatic ArthritisArthritis + psoriasis skin/nail changes; DIP involvement + dactylitis ("sausage digit")
Reactive ArthritisPost-infection (STI with Chlamydia, or GI Salmonella/Shigella/Campylobacter); classic triad: urethritis + conjunctivitis + arthritis
IBD-associated ArthritisPeripheral arthritis with Crohn's or UC; activity tracks bowel disease
Treatment: NSAIDs (first-line), physiotherapy; anti-TNF biologics (adalimumab, etanercept, infliximab) for refractory axial disease; IL-17 inhibitors (secukinumab, ixekizumab) for AS and PsA

5. Septic (Bacterial) Arthritis

A medical emergency - can cause permanent joint destruction within hours/days.
  • Mechanism: Usually hematogenous spread; direct inoculation or contiguous spread less common
  • Pathogens:
    • Adults: S. aureus most common; N. gonorrhoeae in sexually active young adults
    • Neonates: Group B Streptococcus, N. gonorrhoeae
    • Immunocompromised/IVDU: Gram-negatives, Pseudomonas
    • C5-C9 complement deficiency: Recurrent gonococcal infection
  • Presentation: Acute hot, swollen, painful single joint with fever and leukocytosis; restricted ROM
  • Diagnosis: Joint aspiration - WBC > 50,000/µL (neutrophil predominance), Gram stain, culture (sensitivity only 23-36%); elevated procalcitonin (90% specific)
  • Management: IV antibiotics + joint drainage (aspiration or surgical); prompt and aggressive

6. Lyme Arthritis

  • Caused by Borrelia burgdorferi (spirochete), transmitted by Ixodes deer ticks
  • Leading arthropod-borne disease in the US (New England, mid-Atlantic, upper Midwest)
  • Arthritis in < 10% of treated cases; when untreated, ~60-80% develop migratory arthritis (knees most often)
  • Diagnosis: Serology (anti-Borrelia antibodies); PCR of joint fluid (~25% sensitivity)
  • Treatment: Antibiotics (doxycycline, amoxicillin) - curative in 90%; late antibiotic-refractory disease may involve autoimmune mechanisms

Key Comparison: RA vs OA (Visual)

Comparison of joint morphology in Rheumatoid Arthritis vs Osteoarthritis
FIG: RA (left) shows synovial hyperplasia, inflammatory pannus eroding cartilage, and bony/fibrous ankylosis. OA (right) shows osteophytes, loose bodies, thinned/fibrillated cartilage, and subchondral changes with NO ankylosis. - Robbins & Kumar Basic Pathology

Synovial Fluid Analysis - Quick Reference

ParameterNormalOA (Non-inflammatory)RA (Inflammatory)Septic
AppearanceClear, strawClear/yellowTurbid, yellowPurulent
WBC/mm³< 200< 2,0002,000-100,000> 50,000
Neutrophils< 25%< 25%> 50%> 75%
Glucose= serum= serumVery low
CrystalsNoneNoneNoneNone
Crystals on polarized microscopy: Gout = needle-shaped, negative birefringence; CPPD = rhomboid, positive birefringence.

Sources: Robbins & Kumar Basic Pathology 10e; Firestein & Kelley's Textbook of Rheumatology; Goldman-Cecil Medicine; Bailey & Love's Short Practice of Surgery 28e; Goodman & Gilman's Pharmacological Basis of Therapeutics

Make a presentation comparing arthritis types with pathology images and clinical pearls

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

mkdir -p /home/daytona/workspace/arthritis-pptx && ls /home/daytona/workspace/

Writing File

~/arthritis-pptx/create_presentation.js

const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");

// ─── Fetch images ───────────────────────────────────────────────────────────
const imageUrls = [
  "https://cdn.orris.care/cdss_images/9eca3095a6a7a10ade646ec1abc2b62ab291a9fab6b5512a70acbefb669354ec.png",  // 0: OA schematic
  "https://cdn.orris.care/cdss_images/a173f3f06d25797e77922d75ea6e67c129d1a4498a01507705211abf153dcae5.png",  // 1: OA histology
  "https://cdn.orris.care/cdss_images/d37d990e5c309c374da36de8355091f0de550873793358421ff5f7a1e533c9c5.png",  // 2: RA vs OA diagram
  "https://cdn.orris.care/cdss_images/6198dc74f1f73ead171c8ae0f573fbf49af5c9b7da8f36db6006cf5b30146039.png",  // 3: RA pathogenesis
];

console.log("Fetching images...");
let imgs;
try {
  const result = execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`,
    { maxBuffer: 50 * 1024 * 1024 }
  ).toString();
  imgs = JSON.parse(result);
  imgs.forEach((img, i) => {
    if (img.error) console.warn(`Image ${i} failed: ${img.error}`);
    else console.log(`Image ${i} OK`);
  });
} catch (e) {
  console.error("Image fetch failed:", e.message);
  imgs = imageUrls.map(() => ({ base64: null, error: "fetch failed" }));
}

// ─── Presentation setup ──────────────────────────────────────────────────────
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Arthritis: A Comparative Clinical Overview";
pres.author = "Orris Medical";

// ─── Color palette ───────────────────────────────────────────────────────────
const C = {
  navy:    "0D1B2A",   // dominant dark (60%)
  teal:    "1A6B7C",   // supporting
  tealDark:"134F5C",
  gold:    "E8A838",   // sharp accent
  cream:   "F5F0E8",   // light bg
  white:   "FFFFFF",
  lightBg: "EFF4F7",   // slide bg
  red:     "C0392B",   // clinical pearl accent
  green:   "1E7C45",   // management
  purple:  "5B2D8E",   // gout
  orange:  "D4580A",   // spondyloarthropathy
  gray:    "5A6472",
  lightGray:"B0B8C1",
};

// ─── Helper functions ────────────────────────────────────────────────────────
function addDarkHeader(slide, title, subtitle) {
  // Full-width dark header bar
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 1.1, fill: { color: C.navy }, line: { type: "none" } });
  slide.addText(title, { x: 0.3, y: 0.08, w: 9.4, h: 0.62, fontSize: 22, bold: true, color: C.white, fontFace: "Calibri", margin: 0 });
  if (subtitle) {
    slide.addText(subtitle, { x: 0.3, y: 0.68, w: 9.4, h: 0.35, fontSize: 12, color: C.gold, fontFace: "Calibri", italic: true, margin: 0 });
  }
}

function addPearlBox(slide, text, x, y, w, h) {
  slide.addShape(pres.shapes.RECTANGLE, { x, y, w, h, fill: { color: "FFF3CD" }, line: { color: C.gold, pt: 2 } });
  slide.addText([
    { text: "★ CLINICAL PEARL  ", options: { bold: true, color: C.gold, fontSize: 9 } },
    { text: text, options: { color: "4A3800", fontSize: 9 } }
  ], { x: x + 0.08, y: y + 0.05, w: w - 0.16, h: h - 0.1, fontFace: "Calibri", wrap: true, valign: "top" });
}

function addSectionTag(slide, label, color, x, y) {
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y, w: 1.5, h: 0.28, fill: { color }, line: { type: "none" }, rectRadius: 0.05 });
  slide.addText(label, { x, y, w: 1.5, h: 0.28, fontSize: 9, bold: true, color: C.white, align: "center", valign: "middle", fontFace: "Calibri", margin: 0 });
}

function addImage(slide, imgIndex, x, y, w, h, altText) {
  if (imgs[imgIndex] && !imgs[imgIndex].error) {
    slide.addImage({ data: imgs[imgIndex].base64, x, y, w, h, altText });
  } else {
    slide.addShape(pres.shapes.RECTANGLE, { x, y, w, h, fill: { color: "DDDDDD" }, line: { color: C.lightGray } });
    slide.addText("[Image unavailable]", { x, y, w, h, align: "center", valign: "middle", color: C.gray, fontSize: 10 });
  }
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  // Full dark background
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.navy }, line: { type: "none" } });
  // Teal accent strip
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 4.2, w: 10, h: 0.12, fill: { color: C.teal }, line: { type: "none" } });
  // Gold left bar
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.gold }, line: { type: "none" } });

  s.addText("ARTHRITIS", {
    x: 0.5, y: 1.05, w: 9, h: 1.3,
    fontSize: 58, bold: true, color: C.white, fontFace: "Calibri",
    charSpacing: 8, align: "center",
  });
  s.addText("A Comparative Clinical Overview", {
    x: 0.5, y: 2.45, w: 9, h: 0.55,
    fontSize: 20, color: C.gold, fontFace: "Calibri", align: "center", italic: true,
  });
  s.addText("Pathology · Diagnosis · Management", {
    x: 0.5, y: 3.1, w: 9, h: 0.38,
    fontSize: 14, color: C.lightGray, fontFace: "Calibri", align: "center",
  });

  // Type tags
  const types = [
    { label: "Osteoarthritis", color: C.teal },
    { label: "Rheumatoid Arthritis", color: C.red },
    { label: "Gout", color: C.purple },
    { label: "Spondyloarthropathies", color: C.orange },
    { label: "Septic Arthritis", color: "555555" },
  ];
  let tx = 0.55;
  types.forEach(t => {
    const w = t.label.length * 0.11 + 0.3;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: tx, y: 3.75, w, h: 0.32, fill: { color: t.color }, line: { type: "none" }, rectRadius: 0.06 });
    s.addText(t.label, { x: tx, y: 3.75, w, h: 0.32, fontSize: 9, bold: true, color: C.white, align: "center", valign: "middle", fontFace: "Calibri", margin: 0 });
    tx += w + 0.12;
  });

  s.addText("Source: Robbins & Kumar Basic Pathology · Firestein & Kelley's Rheumatology · Goldman-Cecil Medicine", {
    x: 0.5, y: 5.2, w: 9, h: 0.28,
    fontSize: 8, color: C.lightGray, fontFace: "Calibri", align: "center",
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — CLASSIFICATION OVERVIEW TABLE
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightBg }, line: { type: "none" } });
  addDarkHeader(s, "Classification of Arthritis", "Key distinguishing features at a glance");

  const rows = [
    [
      { text: "TYPE", options: { bold: true, color: C.white, fontSize: 9 } },
      { text: "MECHANISM", options: { bold: true, color: C.white, fontSize: 9 } },
      { text: "JOINTS", options: { bold: true, color: C.white, fontSize: 9 } },
      { text: "KEY SEROLOGY", options: { bold: true, color: C.white, fontSize: 9 } },
      { text: "HALLMARK", options: { bold: true, color: C.white, fontSize: 9 } },
    ],
    ["Osteoarthritis", "Degenerative/mechanical", "Weight-bearing (knee, hip, DIP)", "None", "Osteophytes, bone eburnation"],
    ["Rheumatoid Arthritis", "Autoimmune (CD4+/ACPA)", "Small joints bilaterally (MCP, PIP, wrist)", "RF+, ACPA+", "Pannus, fibrous ankylosis"],
    ["Gout", "Urate crystal deposition", "1st MTP (podagra), ankle, knee", "↑ Uric acid", "Negatively birefringent needles"],
    ["Pseudogout (CPPD)", "Calcium pyrophosphate crystals", "Knees, wrists", "None", "Positively birefringent rhomboids"],
    ["Ankylosing Spondylitis", "HLA-B27 autoimmune", "Sacroiliac joints, spine", "HLA-B27+, RF-", "Bamboo spine, enthesitis"],
    ["Septic Arthritis", "Bacterial infection (S. aureus)", "Single large joint (knee, hip)", "WBC↑, cultures", "Emergency — joint destruction"],
    ["Reactive Arthritis", "Post-infectious immune", "Large joints, migratory", "RF-, HLA-B27 variable", "Triad: urethritis/conjunctivitis/arthritis"],
  ];

  const colW = [1.6, 2.0, 2.4, 1.6, 2.2];
  const rowH = 0.5;
  const tableX = 0.15;
  const tableY = 1.18;
  const headerColor = C.tealDark;
  const rowColors = ["FFFFFF", "EFF4F7"];
  const typeColors = [C.teal, C.red, C.purple, "7B4DA0", C.orange, "555555", "2E6830"];

  rows.forEach((row, ri) => {
    let cx = tableX;
    row.forEach((cell, ci) => {
      const isHeader = ri === 0;
      const bgColor = isHeader ? headerColor : (ri % 2 === 1 ? "FFFFFF" : "EFF4F7");
      s.addShape(pres.shapes.RECTANGLE, {
        x: cx, y: tableY + ri * rowH,
        w: colW[ci], h: rowH,
        fill: { color: bgColor },
        line: { color: "CCCCCC", pt: 0.5 }
      });
      let textVal = typeof cell === "string" ? cell : cell;
      let textColor = isHeader ? C.white : C.navy;
      let isBold = isHeader;
      // Color type column
      if (!isHeader && ci === 0) textColor = typeColors[ri - 1];
      s.addText(typeof textVal === "string" ? textVal : textVal, {
        x: cx + 0.08, y: tableY + ri * rowH + 0.05,
        w: colW[ci] - 0.16, h: rowH - 0.1,
        fontSize: isHeader ? 9 : 8.5,
        bold: isBold || (!isHeader && ci === 0),
        color: textColor,
        fontFace: "Calibri",
        valign: "middle",
        wrap: true,
      });
      cx += colW[ci];
    });
  });

  addPearlBox(s, "Morning stiffness > 1 hour → inflammatory arthritis; < 30 min → OA. This single question is a powerful bedside differentiator.", 0.15, 5.05, 9.7, 0.45);
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — OSTEOARTHRITIS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightBg }, line: { type: "none" } });
  // Teal top accent
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.12, fill: { color: C.teal }, line: { type: "none" } });
  addDarkHeader(s, "Osteoarthritis (OA)", "Degenerative Joint Disease — Most common joint disorder");
  addSectionTag(s, "DEGENERATIVE", C.teal, 8.1, 0.08);

  // Left column: pathogenesis + clinical
  const leftX = 0.2;
  s.addText("PATHOGENESIS", { x: leftX, y: 1.18, w: 4.5, h: 0.28, fontSize: 10, bold: true, color: C.teal, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "• Biomechanical stress → chondrocyte injury\n", options: { fontSize: 9 } },
    { text: "• MMPs degrade type II collagen; proteoglycans ↓\n", options: { fontSize: 9 } },
    { text: "• TGF-β, IL-1, IL-6, NO amplify cartilage damage\n", options: { fontSize: 9 } },
    { text: "• BMPs + TGF-β → osteophyte formation\n", options: { fontSize: 9 } },
    { text: "• Inflammation is SECONDARY (not the driver)\n", options: { fontSize: 9, bold: true, color: C.red } },
  ], { x: leftX, y: 1.5, w: 4.5, h: 1.1, fontFace: "Calibri", color: C.navy, valign: "top" });

  s.addText("PATHOLOGY", { x: leftX, y: 2.65, w: 4.5, h: 0.28, fontSize: 10, bold: true, color: C.teal, fontFace: "Calibri", margin: 0 });
  const pathItems = [
    "Cartilage fibrillation (surface clefting)",
    "Bone eburnation (polished ivory subchondral bone)",
    "Subchondral cysts (ball-valve synovial fluid trapping)",
    "Osteophytes (bony outgrowths at joint margins)",
    "Loose bodies = \"joint mice\" (dislodged fragments)",
    "Synovium: only mildly inflamed/fibrotic",
  ];
  s.addText(pathItems.map(t => ({ text: "◆ " + t + "\n", options: { fontSize: 8.5 } })), {
    x: leftX, y: 2.95, w: 4.5, h: 1.3, fontFace: "Calibri", color: C.navy, valign: "top"
  });

  // Right column: images
  addImage(s, 0, 4.85, 1.18, 2.6, 1.7, "OA schematic diagram");
  s.addText("Schematic: OA progression (Robbins)", { x: 4.85, y: 2.9, w: 2.6, h: 0.22, fontSize: 7.5, color: C.gray, fontFace: "Calibri", align: "center" });

  addImage(s, 1, 7.6, 1.18, 2.2, 2.0, "OA histology — cartilage fibrillation and eburnation");
  s.addText("Histology: fibrillation (A) & eburnation (B)", { x: 7.6, y: 3.2, w: 2.2, h: 0.22, fontSize: 7.5, color: C.gray, fontFace: "Calibri", align: "center" });

  // Clinical features box
  s.addShape(pres.shapes.RECTANGLE, { x: 4.85, y: 3.18, w: 4.95, h: 1.62, fill: { color: "E8F4F8" }, line: { color: C.teal, pt: 1 } });
  s.addText("CLINICAL FEATURES", { x: 5.0, y: 3.22, w: 4.65, h: 0.26, fontSize: 9.5, bold: true, color: C.teal, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "• Insidious onset; pain worsened by use, relieved by rest\n", options: { fontSize: 8.5 } },
    { text: "• Morning stiffness < 30 min\n", options: { fontSize: 8.5, bold: true } },
    { text: "• Heberden's nodes (DIP) · Bouchard's nodes (PIP)\n", options: { fontSize: 8.5 } },
    { text: "• Crepitus · joint-line tenderness · no systemic features\n", options: { fontSize: 8.5 } },
    { text: "• X-ray: JSN · subchondral sclerosis · osteophytes · cysts\n", options: { fontSize: 8.5 } },
    { text: "• Rx: Weight loss, PT, NSAIDs/paracetamol, IA steroids, arthroplasty", options: { fontSize: 8.5 } },
  ], { x: 5.0, y: 3.52, w: 4.65, h: 1.22, fontFace: "Calibri", color: C.navy, valign: "top" });

  addPearlBox(s, "40% of people >70 are affected. OA of the DIP joint (Heberden's nodes) is OA, not RA — RA spares the DIP.", 0.15, 4.85, 9.7, 0.6);
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — RHEUMATOID ARTHRITIS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightBg }, line: { type: "none" } });
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.12, fill: { color: C.red }, line: { type: "none" } });
  addDarkHeader(s, "Rheumatoid Arthritis (RA)", "Chronic autoimmune synovitis — 3× more common in women, peak onset 3rd-5th decade");
  addSectionTag(s, "AUTOIMMUNE", C.red, 8.25, 0.08);

  // Pathogenesis left
  s.addText("PATHOGENESIS & MORPHOLOGY", { x: 0.2, y: 1.18, w: 4.6, h: 0.28, fontSize: 10, bold: true, color: C.red, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "• CD4+ T cells react against citrullinated joint antigens\n", options: { fontSize: 8.5 } },
    { text: "• TNF + IL-1 + IL-6 → protease release, cartilage destruction\n", options: { fontSize: 8.5 } },
    { text: "• IL-17 (Th17) → neutrophil/monocyte recruitment\n", options: { fontSize: 8.5 } },
    { text: "• RANKL → osteoclast activation → bone erosion\n", options: { fontSize: 8.5 } },
    { text: "• ACPA: anti-citrullinated protein Ab (60-70% sensitivity, >95% specificity)\n", options: { fontSize: 8.5, bold: true } },
    { text: "• HLA-DR4 = primary genetic risk; molecular mimicry hypothesis\n", options: { fontSize: 8.5 } },
    { text: "\nMorphology:\n", options: { fontSize: 8.5, bold: true } },
    { text: "• Pannus: destructive fibroinflammatory tissue eroding cartilage & bone\n", options: { fontSize: 8.5 } },
    { text: "• Synovial hyperplasia, lymphocyte/plasma cell infiltrate, germinal centers\n", options: { fontSize: 8.5 } },
    { text: "• Rheumatoid nodules: central fibrinoid necrosis + palisaded macrophages\n", options: { fontSize: 8.5 } },
    { text: "• End-stage: fibrous → bony ankylosis", options: { fontSize: 8.5 } },
  ], { x: 0.2, y: 1.5, w: 4.6, h: 2.4, fontFace: "Calibri", color: C.navy, valign: "top" });

  // Images right
  addImage(s, 3, 4.95, 1.18, 2.55, 1.85, "RA pathogenesis diagram");
  s.addText("RA Pathogenesis (Robbins)", { x: 4.95, y: 3.05, w: 2.55, h: 0.22, fontSize: 7.5, color: C.gray, fontFace: "Calibri", align: "center" });

  addImage(s, 2, 7.6, 1.18, 2.2, 2.0, "RA vs OA joint comparison diagram");
  s.addText("RA vs OA — Joint Morphology", { x: 7.6, y: 3.2, w: 2.2, h: 0.22, fontSize: 7.5, color: C.gray, fontFace: "Calibri", align: "center" });

  // 2010 ACR/EULAR criteria + treatment
  s.addShape(pres.shapes.RECTANGLE, { x: 0.2, y: 3.95, w: 4.6, h: 0.26, fill: { color: C.red }, line: { type: "none" } });
  s.addText("2010 ACR/EULAR CRITERIA  (≥ 6/10 = RA)", { x: 0.25, y: 3.95, w: 4.5, h: 0.26, fontSize: 9, bold: true, color: C.white, fontFace: "Calibri", margin: 0, valign: "middle" });
  s.addText([
    { text: "Joints: 1 large=0 → ≥10 small=5   |   RF/ACPA: negative=0, high+=3\n", options: { fontSize: 8.5 } },
    { text: "CRP/ESR abnormal=1   |   Duration ≥6 wks=1", options: { fontSize: 8.5 } },
  ], { x: 0.2, y: 4.22, w: 4.6, h: 0.45, fontFace: "Calibri", color: C.navy });

  // Treatment box
  s.addShape(pres.shapes.RECTANGLE, { x: 4.95, y: 3.32, w: 4.85, h: 2.18, fill: { color: "FFF0EE" }, line: { color: C.red, pt: 1 } });
  s.addText("TREATMENT STRATEGY", { x: 5.1, y: 3.36, w: 4.55, h: 0.26, fontSize: 9.5, bold: true, color: C.red, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "Step 1 — cDMARDs (start at diagnosis):\n", options: { bold: true, fontSize: 8.5 } },
    { text: "  Methotrexate (anchor drug) + folate · Leflunomide · HCQ · Sulfasalazine\n", options: { fontSize: 8.5 } },
    { text: "Step 2 — Biologics (if cDMARD fails):\n", options: { bold: true, fontSize: 8.5 } },
    { text: "  Anti-TNF: etanercept, adalimumab, infliximab\n", options: { fontSize: 8.5 } },
    { text: "  Anti-IL-6: tocilizumab · Anti-CD20: rituximab · CTLA4-Ig: abatacept\n", options: { fontSize: 8.5 } },
    { text: "Step 3 — JAK inhibitors (oral, targeted):\n", options: { bold: true, fontSize: 8.5 } },
    { text: "  Tofacitinib · Baricitinib · Upadacitinib\n", options: { fontSize: 8.5 } },
    { text: "Bridging: short-course glucocorticoids only\n", options: { fontSize: 8.5 } },
    { text: "Monitor: LFTs (MTX), TB screening (anti-TNF), lipids", options: { fontSize: 8.5 } },
  ], { x: 5.1, y: 3.65, w: 4.55, h: 1.8, fontFace: "Calibri", color: C.navy, valign: "top" });

  addPearlBox(s, "DIP spared in RA (unlike OA/PsA). Seronegative RA (20%) — diagnosis is clinical. Anti-TNF therapy requires TB screening before initiation.", 0.15, 5.38, 9.7, 0.12);
  s.addShape(pres.shapes.RECTANGLE, { x: 0.15, y: 5.38, w: 9.7, h: 0.14, fill: { color: "FFF3CD" }, line: { color: C.gold, pt: 1.5 } });
  s.addText("★ PEARL: DIP spared in RA (unlike OA/PsA). Seronegative RA (20%) — diagnose clinically. Anti-TNF requires TB screening (risk of reactivation).", {
    x: 0.25, y: 5.38, w: 9.5, h: 0.14, fontSize: 7.5, color: "4A3800", fontFace: "Calibri", valign: "middle"
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — GOUT & PSEUDOGOUT
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightBg }, line: { type: "none" } });
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.12, fill: { color: C.purple }, line: { type: "none" } });
  addDarkHeader(s, "Crystal Arthropathies: Gout & Pseudogout", "Inflammasome-driven crystal-induced inflammatory arthritis");
  addSectionTag(s, "CRYSTAL", C.purple, 8.4, 0.08);

  // Gout column
  s.addShape(pres.shapes.RECTANGLE, { x: 0.15, y: 1.18, w: 4.7, h: 0.3, fill: { color: C.purple }, line: { type: "none" } });
  s.addText("GOUT — Monosodium Urate (MSU)", { x: 0.2, y: 1.18, w: 4.6, h: 0.3, fontSize: 10, bold: true, color: C.white, fontFace: "Calibri", margin: 0, valign: "middle" });

  s.addText([
    { text: "Pathogenesis:\n", options: { bold: true, fontSize: 8.5 } },
    { text: "Hyperuricemia (>6.8 mg/dL) → MSU crystal precipitation → macrophage phagocytosis → NLRP3 inflammasome → caspase-1 → IL-1β → acute neutrophilic arthritis\n\n", options: { fontSize: 8.5 } },
    { text: "Causes of hyperuricemia:\n", options: { bold: true, fontSize: 8.5 } },
    { text: "  Reduced excretion (90%) · Overproduction · Thiazide diuretics · Alcohol\n", options: { fontSize: 8.5 } },
    { text: "  HGPRT deficiency (Lesch-Nyhan) · Myeloproliferative disorders\n\n", options: { fontSize: 8.5 } },
    { text: "Clinical Stages:\n", options: { bold: true, fontSize: 8.5 } },
    { text: "1. Asymptomatic hyperuricemia\n", options: { fontSize: 8.5 } },
    { text: "2. Acute gout: sudden severe pain, 1st MTP (podagra), knee, ankle\n", options: { fontSize: 8.5, bold: true } },
    { text: "3. Intercritical period (symptom-free)\n", options: { fontSize: 8.5 } },
    { text: "4. Chronic tophaceous gout: tophi + destructive joint disease\n\n", options: { fontSize: 8.5 } },
    { text: "Crystal: Needle-shaped, NEGATIVELY birefringent (yellow || to compensator)\n", options: { fontSize: 8.5, bold: true, color: C.purple } },
    { text: "X-ray (chronic): Punched-out erosions with overhanging edge (\"rat bite\")\n", options: { fontSize: 8.5 } },
  ], { x: 0.2, y: 1.52, w: 4.6, h: 2.88, fontFace: "Calibri", color: C.navy, valign: "top" });

  // Pseudogout column
  s.addShape(pres.shapes.RECTANGLE, { x: 5.15, y: 1.18, w: 4.7, h: 0.3, fill: { color: "7B4DA0" }, line: { type: "none" } });
  s.addText("PSEUDOGOUT — CPPD Crystals", { x: 5.2, y: 1.18, w: 4.6, h: 0.3, fontSize: 10, bold: true, color: C.white, fontFace: "Calibri", margin: 0, valign: "middle" });
  s.addText([
    { text: "Calcium Pyrophosphate Dihydrate (CPPD) crystal deposition\n\n", options: { fontSize: 8.5, bold: true } },
    { text: "Risk factors:\n", options: { bold: true, fontSize: 8.5 } },
    { text: "  Old age · Hyperparathyroidism · Hemochromatosis · Hypomagnesemia\n\n", options: { fontSize: 8.5 } },
    { text: "Joints: Knees (most common), wrists, hips, shoulders\n\n", options: { fontSize: 8.5 } },
    { text: "Crystal: Rhomboid-shaped, POSITIVELY birefringent (blue || to compensator)\n\n", options: { fontSize: 8.5, bold: true, color: "7B4DA0" } },
    { text: "X-ray: Chondrocalcinosis (linear calcification in cartilage)\n\n", options: { fontSize: 8.5 } },
    { text: "Treatment:\n", options: { bold: true, fontSize: 8.5 } },
    { text: "  NSAIDs · Colchicine · Intraarticular/systemic steroids\n", options: { fontSize: 8.5 } },
    { text: "  No equivalent to urate-lowering therapy\n", options: { fontSize: 8.5 } },
  ], { x: 5.2, y: 1.52, w: 4.6, h: 2.5, fontFace: "Calibri", color: C.navy, valign: "top" });

  // Vertical divider
  s.addShape(pres.shapes.RECTANGLE, { x: 4.93, y: 1.18, w: 0.04, h: 3.42, fill: { color: C.lightGray }, line: { type: "none" } });

  // Gout Treatment box
  s.addShape(pres.shapes.RECTANGLE, { x: 0.15, y: 4.42, w: 4.7, h: 1.06, fill: { color: "EDE8F5" }, line: { color: C.purple, pt: 1 } });
  s.addText("GOUT MANAGEMENT", { x: 0.25, y: 4.44, w: 4.5, h: 0.22, fontSize: 9, bold: true, color: C.purple, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "Acute: ", options: { bold: true, fontSize: 8.5 } },
    { text: "NSAIDs (indomethacin) / Colchicine (within 24h) / Corticosteroids\n", options: { fontSize: 8.5 } },
    { text: "Do NOT start urate-lowering therapy during an acute attack\n", options: { fontSize: 8.5, bold: true, color: C.red } },
    { text: "Prevention: ", options: { bold: true, fontSize: 8.5 } },
    { text: "Allopurinol (XO inhibitor, first-line) · Febuxostat · Probenecid\n", options: { fontSize: 8.5 } },
    { text: "Target: uric acid <6 mg/dL (<5 if tophi) · Colchicine 0.5mg/d as prophylaxis", options: { fontSize: 8.5 } },
  ], { x: 0.25, y: 4.68, w: 4.5, h: 0.75, fontFace: "Calibri", color: C.navy, valign: "top" });

  // Crystal comparison box
  s.addShape(pres.shapes.RECTANGLE, { x: 5.15, y: 4.0, w: 4.7, h: 1.5, fill: { color: "EDE8F5" }, line: { color: "7B4DA0", pt: 1 } });
  s.addText("CRYSTAL COMPARISON (Polarized Microscopy)", { x: 5.25, y: 4.04, w: 4.5, h: 0.24, fontSize: 9, bold: true, color: "7B4DA0", fontFace: "Calibri", margin: 0 });

  const crystalData = [
    ["", "GOUT (MSU)", "CPPD"],
    ["Shape", "Needle / acicular", "Rhomboid / rectangular"],
    ["Birefringence", "Negative (−)", "Positive (+)"],
    ["Colour ∥ compensator", "Yellow", "Blue"],
    ["Colour ⊥ compensator", "Blue", "Yellow"],
    ["Typical joint", "1st MTP (podagra)", "Knee, wrist"],
  ];
  const cW = [1.5, 1.5, 1.5];
  const cH = 0.21;
  crystalData.forEach((row, ri) => {
    row.forEach((cell, ci) => {
      const bg = ri === 0 ? "7B4DA0" : (ri % 2 === 0 ? "EDE8F5" : "F8F4FF");
      s.addShape(pres.shapes.RECTANGLE, { x: 5.25 + ci * cW[0], y: 4.3 + ri * cH, w: cW[ci], h: cH, fill: { color: bg }, line: { color: "CCCCCC", pt: 0.5 } });
      s.addText(cell, { x: 5.28 + ci * cW[0], y: 4.3 + ri * cH, w: cW[ci] - 0.06, h: cH, fontSize: 8, bold: ri === 0, color: ri === 0 ? C.white : C.navy, fontFace: "Calibri", valign: "middle" });
    });
  });

  addPearlBox(s, "Serum uric acid may be NORMAL during an acute gout attack. Diagnose by joint aspiration (polarized microscopy). Never start allopurinol during an acute flare — it prolongs the attack.", 0.15, 5.5, 9.7, 0.02);
  s.addShape(pres.shapes.RECTANGLE, { x: 0.15, y: 5.38, w: 9.7, h: 0.19, fill: { color: "FFF3CD" }, line: { color: C.gold, pt: 1.5 } });
  s.addText("★ PEARL: Serum uric acid may be NORMAL during acute gout. Diagnose by joint aspiration (polarized microscopy). Never start allopurinol mid-flare.", {
    x: 0.25, y: 5.38, w: 9.5, h: 0.19, fontSize: 7.5, color: "4A3800", fontFace: "Calibri", valign: "middle"
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — SERONEGATIVE SPONDYLOARTHROPATHIES
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightBg }, line: { type: "none" } });
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.12, fill: { color: C.orange }, line: { type: "none" } });
  addDarkHeader(s, "Seronegative Spondyloarthropathies", "HLA-B27 associated · RF negative · Enthesitis · Axial involvement");
  addSectionTag(s, "HLA-B27", C.orange, 8.35, 0.08);

  const conditions = [
    {
      name: "Ankylosing Spondylitis",
      color: C.orange,
      features: [
        "Young men (M:F = 3:1) · HLA-B27 90%",
        "Sacroiliac joints + spine → \"bamboo spine\"",
        "Enthesitis · Inflammatory back pain (better with exercise)",
        "Extra-articular: uveitis (40%), aortitis, ILD",
        "Rx: NSAIDs → anti-TNF (adalimumab, etanercept) or IL-17i (secukinumab)",
      ]
    },
    {
      name: "Psoriatic Arthritis",
      color: "D44000",
      features: [
        "Arthritis + psoriasis skin/nail changes",
        "DIP involvement + dactylitis (\"sausage digit\")",
        "Asymmetric oligoarthritis OR symmetric polyarthritis patterns",
        "Nail pitting, onycholysis hallmarks",
        "Rx: NSAIDs, MTX, anti-TNF, IL-17i (secukinumab, ixekizumab)",
      ]
    },
    {
      name: "Reactive Arthritis",
      color: "B35A00",
      features: [
        "Post-infectious: STI (Chlamydia) or GI (Salmonella, Shigella, Campylobacter)",
        "Classic triad: Urethritis + Conjunctivitis + Arthritis",
        "\"Can't see, can't pee, can't bend the knee\"",
        "Large joints, asymmetric, usually self-limiting",
        "Rx: NSAIDs (acute) · DMARDs for chronic cases",
      ]
    },
    {
      name: "IBD-associated Arthritis",
      color: "7B4000",
      features: [
        "Peripheral arthritis tracks bowel disease activity",
        "Axial disease (sacroiliitis) independent of IBD",
        "Associated with Crohn's disease and Ulcerative Colitis",
        "Often asymmetric oligoarthritis of large joints",
        "Rx: Treat underlying IBD; anti-TNF (infliximab effective for both)",
      ]
    },
  ];

  conditions.forEach((cond, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.15 : 5.1;
    const y = row === 0 ? 1.2 : 3.45;
    const w = 4.75;
    const h = 2.0;

    s.addShape(pres.shapes.RECTANGLE, { x, y, w, h, fill: { color: C.white }, line: { color: cond.color, pt: 1.5 }, shadow: { type: "outer", color: "000000", blur: 4, offset: 1, angle: 135, opacity: 0.08 } });
    s.addShape(pres.shapes.RECTANGLE, { x, y, w, h: 0.3, fill: { color: cond.color }, line: { type: "none" } });
    s.addText(cond.name, { x: x + 0.1, y, w: w - 0.2, h: 0.3, fontSize: 10, bold: true, color: C.white, fontFace: "Calibri", margin: 0, valign: "middle" });
    s.addText(cond.features.map(f => ({ text: "• " + f + "\n", options: { fontSize: 8.5 } })), {
      x: x + 0.1, y: y + 0.33, w: w - 0.2, h: h - 0.4,
      fontFace: "Calibri", color: C.navy, valign: "top"
    });
  });

  // Common features banner
  s.addShape(pres.shapes.RECTANGLE, { x: 0.15, y: 5.35, w: 9.7, h: 0.22, fill: { color: C.navy }, line: { type: "none" } });
  s.addText("SHARED FEATURES: HLA-B27 positive · RF negative (seronegative) · Enthesitis · Axial joint predominance · Uveitis (HLA-B27 associated) · Negative ACPA", {
    x: 0.25, y: 5.35, w: 9.5, h: 0.22, fontSize: 8, color: C.gold, fontFace: "Calibri", bold: true, valign: "middle"
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — SEPTIC ARTHRITIS & LYME
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightBg }, line: { type: "none" } });
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.12, fill: { color: "444444" }, line: { type: "none" } });
  addDarkHeader(s, "Infectious Arthritis: Septic & Lyme", "Medical emergencies requiring rapid diagnosis and treatment");
  addSectionTag(s, "INFECTIOUS", "555555", 8.25, 0.08);

  // Septic Arthritis
  s.addShape(pres.shapes.RECTANGLE, { x: 0.15, y: 1.18, w: 4.7, h: 0.3, fill: { color: C.red }, line: { type: "none" } });
  s.addText("SEPTIC (BACTERIAL) ARTHRITIS", { x: 0.2, y: 1.18, w: 4.6, h: 0.3, fontSize: 10, bold: true, color: C.white, fontFace: "Calibri", margin: 0, valign: "middle" });
  s.addText([
    { text: "Mechanism: ", options: { bold: true, fontSize: 8.5 } },
    { text: "Hematogenous spread (most common) · Direct inoculation · Contiguous spread\n\n", options: { fontSize: 8.5 } },
    { text: "Causative Organisms:\n", options: { bold: true, fontSize: 8.5 } },
    { text: "  Adults: S. aureus (most common)\n", options: { fontSize: 8.5 } },
    { text: "  Sexually active young adults: N. gonorrhoeae\n", options: { fontSize: 8.5 } },
    { text: "  Neonates: Group B Streptococcus, N. gonorrhoeae\n", options: { fontSize: 8.5 } },
    { text: "  IVDU / immunocompromised: Gram-negatives, Pseudomonas\n", options: { fontSize: 8.5 } },
    { text: "  C5-C9 complement deficiency: Recurrent Neisseria\n\n", options: { fontSize: 8.5 } },
    { text: "Presentation: ", options: { bold: true, fontSize: 8.5 } },
    { text: "Acute hot swollen monoarthritis + fever + leukocytosis\n", options: { fontSize: 8.5 } },
    { text: "Single joint: knee, hip, shoulder, wrist (axial > IVDU)\n\n", options: { fontSize: 8.5 } },
    { text: "Diagnosis: ", options: { bold: true, fontSize: 8.5 } },
    { text: "Joint aspiration GOLD STANDARD\n", options: { fontSize: 8.5 } },
    { text: "WBC >50,000/mm³ (>75% neutrophils), Gram stain/culture\n", options: { fontSize: 8.5 } },
    { text: "Procalcitonin >90% specific for septic arthritis\n\n", options: { fontSize: 8.5 } },
    { text: "Treatment: ", options: { bold: true, fontSize: 8.5 } },
    { text: "IV antibiotics + joint drainage (aspiration or surgical washout)\n", options: { fontSize: 8.5 } },
    { text: "Empiric anti-staph coverage (vancomycin if MRSA risk)", options: { fontSize: 8.5 } },
  ], { x: 0.2, y: 1.52, w: 4.6, h: 3.65, fontFace: "Calibri", color: C.navy, valign: "top" });

  // Lyme arthritis
  s.addShape(pres.shapes.RECTANGLE, { x: 5.15, y: 1.18, w: 4.7, h: 0.3, fill: { color: C.green }, line: { type: "none" } });
  s.addText("LYME ARTHRITIS (Borrelia burgdorferi)", { x: 5.2, y: 1.18, w: 4.6, h: 0.3, fontSize: 10, bold: true, color: C.white, fontFace: "Calibri", margin: 0, valign: "middle" });
  s.addText([
    { text: "Pathogen: ", options: { bold: true, fontSize: 8.5 } },
    { text: "Borrelia burgdorferi spirochete · Ixodes tick vector\n", options: { fontSize: 8.5 } },
    { text: "Leading arthropod-borne disease in the US (New England, Mid-Atlantic)\n\n", options: { fontSize: 8.5 } },
    { text: "3 Clinical Phases:\n", options: { bold: true, fontSize: 8.5 } },
    { text: "1. Early localized: Erythema migrans (bull's-eye rash)\n", options: { fontSize: 8.5 } },
    { text: "2. Early disseminated: Bell's palsy, heart block, meningitis\n", options: { fontSize: 8.5 } },
    { text: "3. Late disseminated: Arthritis (60-80% untreated), neurologic\n\n", options: { fontSize: 8.5 } },
    { text: "Arthritis: ", options: { bold: true, fontSize: 8.5 } },
    { text: "Migratory, <10% with treatment; knees most common\n", options: { fontSize: 8.5 } },
    { text: "May become antibiotic-refractory (autoimmune mechanism)\n\n", options: { fontSize: 8.5 } },
    { text: "Diagnosis: ", options: { bold: true, fontSize: 8.5 } },
    { text: "Serology (ELISA + Western Blot) · PCR of synovial fluid (25% sensitive)\n\n", options: { fontSize: 8.5 } },
    { text: "Treatment: ", options: { bold: true, fontSize: 8.5 } },
    { text: "Doxycycline / Amoxicillin – curative in 90% of cases\n", options: { fontSize: 8.5 } },
    { text: "IV ceftriaxone for neurologic / late disease", options: { fontSize: 8.5 } },
  ], { x: 5.2, y: 1.52, w: 4.6, h: 3.65, fontFace: "Calibri", color: C.navy, valign: "top" });

  // Divider
  s.addShape(pres.shapes.RECTANGLE, { x: 4.93, y: 1.18, w: 0.04, h: 3.65, fill: { color: C.lightGray }, line: { type: "none" } });

  s.addShape(pres.shapes.RECTANGLE, { x: 0.15, y: 4.88, w: 9.7, h: 0.6, fill: { color: "FFE5E5" }, line: { color: C.red, pt: 1.5 } });
  s.addText([
    { text: "⚠ EMERGENCY PEARL: ", options: { bold: true, color: C.red, fontSize: 9 } },
    { text: "Septic arthritis is a surgical emergency — permanent joint destruction can occur within 24-48 hours without treatment. Any febrile monoarthritis must be aspirated immediately, even in a patient with known RA or gout.", options: { color: C.navy, fontSize: 8.5 } }
  ], { x: 0.25, y: 4.88, w: 9.5, h: 0.6, fontFace: "Calibri", valign: "middle", wrap: true });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — SYNOVIAL FLUID + DIAGNOSTIC COMPARISON
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightBg }, line: { type: "none" } });
  addDarkHeader(s, "Diagnostic Comparison & Synovial Fluid Analysis", "Rapid bedside differentiation of arthritis types");

  // Synovial fluid table
  s.addText("SYNOVIAL FLUID ANALYSIS", { x: 0.2, y: 1.18, w: 9.6, h: 0.28, fontSize: 10.5, bold: true, color: C.teal, fontFace: "Calibri", margin: 0 });

  const sfRows = [
    ["Parameter", "Normal", "OA (Non-inflam.)", "RA (Inflammatory)", "Septic", "Gout"],
    ["Appearance", "Clear, straw", "Clear/yellow", "Turbid, yellow", "Purulent", "Turbid yellow"],
    ["Viscosity", "High", "High", "Low", "Very low", "Low"],
    ["WBC /mm³", "<200", "<2,000", "2,000-100,000", ">50,000", "2,000-100,000"],
    ["Neutrophils", "<25%", "<25%", ">50%", ">75%", ">80%"],
    ["Glucose", "= Serum", "= Serum", "↓", "Very low", "Normal/↓"],
    ["Crystals", "None", "None", "None", "None", "Needle, neg. birfr."],
  ];

  const sfColW = [1.55, 1.1, 1.55, 1.85, 1.35, 1.8];
  const sfColColors = ["", "", C.teal, C.red, "444444", C.purple];
  const sfRowH = 0.38;
  const sfY = 1.5;

  sfRows.forEach((row, ri) => {
    let cx = 0.15;
    row.forEach((cell, ci) => {
      const isHeader = ri === 0;
      const bgColor = isHeader ? C.navy : (ri % 2 === 0 ? "FFFFFF" : "EFF4F7");
      s.addShape(pres.shapes.RECTANGLE, { x: cx, y: sfY + ri * sfRowH, w: sfColW[ci], h: sfRowH, fill: { color: bgColor }, line: { color: "CCCCCC", pt: 0.5 } });
      s.addText(cell, {
        x: cx + 0.05, y: sfY + ri * sfRowH + 0.02, w: sfColW[ci] - 0.1, h: sfRowH - 0.04,
        fontSize: isHeader ? 8.5 : 8,
        bold: isHeader || ci === 0,
        color: isHeader ? (ci === 0 ? C.white : (sfColColors[ci] || C.white)) : (ci === 0 ? C.navy : C.navy),
        fontFace: "Calibri", valign: "middle", wrap: true
      });
      cx += sfColW[ci];
    });
  });

  // RA vs OA comparison image
  addImage(s, 2, 0.15, 4.24, 5.5, 1.28, "RA vs OA morphology comparison");
  s.addText("Fig: RA (left) — pannus, ankylosis  vs  OA (right) — osteophytes, loose bodies  [Robbins & Kumar]", {
    x: 0.15, y: 5.4, w: 5.5, h: 0.18, fontSize: 7, color: C.gray, fontFace: "Calibri", italic: true
  });

  // Key differentiators
  s.addShape(pres.shapes.RECTANGLE, { x: 5.75, y: 4.18, w: 4.1, h: 1.35, fill: { color: "FFFBE8" }, line: { color: C.gold, pt: 1.5 } });
  s.addText("KEY DIFFERENTIATORS", { x: 5.85, y: 4.21, w: 3.9, h: 0.24, fontSize: 9.5, bold: true, color: C.navy, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "Morning stiffness: ", options: { bold: true, fontSize: 8 } },
    { text: ">1h = inflammatory · <30min = OA\n", options: { fontSize: 8 } },
    { text: "RF+/ACPA+: ", options: { bold: true, fontSize: 8 } },
    { text: "RA · RF- = seronegative SpA\n", options: { fontSize: 8 } },
    { text: "Crystal: ", options: { bold: true, fontSize: 8 } },
    { text: "Needle/neg = gout · Rhomboid/pos = CPPD\n", options: { fontSize: 8 } },
    { text: "Fever + monoarthritis: ", options: { bold: true, color: C.red, fontSize: 8 } },
    { text: "Septic — aspirate immediately\n", options: { fontSize: 8 } },
    { text: "HLA-B27 + back pain: ", options: { bold: true, fontSize: 8 } },
    { text: "Ankylosing spondylitis", options: { fontSize: 8 } },
  ], { x: 5.85, y: 4.47, w: 3.9, h: 1.0, fontFace: "Calibri", color: C.navy, valign: "top" });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — CLINICAL PEARLS SUMMARY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.navy }, line: { type: "none" } });
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.gold }, line: { type: "none" } });
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 4.8, w: 10, h: 0.08, fill: { color: C.teal }, line: { type: "none" } });

  s.addText("CLINICAL PEARLS", { x: 0.4, y: 0.18, w: 9.2, h: 0.65, fontSize: 28, bold: true, color: C.gold, fontFace: "Calibri", charSpacing: 4 });
  s.addText("High-yield points for clinical practice & examinations", { x: 0.4, y: 0.8, w: 9.2, h: 0.3, fontSize: 13, color: C.lightGray, fontFace: "Calibri", italic: true });

  const pearls = [
    { tag: "OA", color: C.teal, text: "OA involves DIP joints (Heberden's nodes) — RA spares the DIP. Opposite pattern is a classic exam trap." },
    { tag: "OA", color: C.teal, text: "Morning stiffness <30 min in OA vs >1 hour in RA. This single question separates inflammatory from degenerative arthritis." },
    { tag: "RA", color: C.red, text: "ACPAs (anti-CCP) appear years before clinical disease. They are more specific for RA (>95%) than RF (~70-80% sensitive)." },
    { tag: "RA", color: C.red, text: "Screen for latent TB before starting anti-TNF biologics — reactivation is a serious risk. Also check hepatitis B status." },
    { tag: "GOUT", color: C.purple, text: "Never start or stop urate-lowering therapy (allopurinol) during an acute attack — it can precipitate or prolong the flare." },
    { tag: "GOUT", color: C.purple, text: "Serum uric acid may be falsely normal during an acute gout attack. Diagnose by synovial fluid polarized microscopy." },
    { tag: "SpA", color: C.orange, text: "HLA-B27 is associated with all seronegative spondyloarthropathies and with anterior uveitis regardless of joint involvement." },
    { tag: "SEPTIC", color: "555555", text: "Any febrile monoarthritis = septic arthritis until proven otherwise — aspirate the joint immediately. Even RA/gout joints can get superinfected." },
  ];

  pearls.forEach((p, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.35 : 5.2;
    const y = 1.2 + row * 0.87;
    const w = 4.6;
    const h = 0.78;

    s.addShape(pres.shapes.RECTANGLE, { x, y, w, h, fill: { color: "0D2340" }, line: { color: p.color, pt: 1.5 } });
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y, w: 0.7, h: 0.24, fill: { color: p.color }, line: { type: "none" }, rectRadius: 0.04 });
    s.addText(p.tag, { x, y, w: 0.7, h: 0.24, fontSize: 8, bold: true, color: C.white, align: "center", valign: "middle", fontFace: "Calibri", margin: 0 });
    s.addText(p.text, { x: x + 0.08, y: y + 0.27, w: w - 0.16, h: h - 0.35, fontSize: 8.5, color: "D0E4EE", fontFace: "Calibri", wrap: true, valign: "top" });
  });

  s.addText("Source: Robbins & Kumar Basic Pathology · Firestein & Kelley's Textbook of Rheumatology · Goldman-Cecil Medicine", {
    x: 0.4, y: 5.45, w: 9.2, h: 0.2, fontSize: 7.5, color: C.lightGray, fontFace: "Calibri", italic: true
  });
}

// ─── Write file ───────────────────────────────────────────────────────────────
const outPath = "/home/daytona/workspace/arthritis-pptx/Arthritis_Comparative_Overview.pptx";
pres.writeFile({ fileName: outPath })
  .then(() => console.log("✅ Presentation saved to:", outPath))
  .catch(err => { console.error("❌ Error saving:", err); process.exit(1); });
Running Command

cd /home/daytona/workspace/arthritis-pptx && node create_presentation.js 2>&1

Editing File

~/arthritis-pptx/create_presentation.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/arthritis-pptx/create_presentation.js'
Running Command

cd /home/daytona/workspace/arthritis-pptx && node create_presentation.js 2>&1

Your presentation is ready:

Arthritis Comparative Overview

Presentation · PPTX


What's Inside — 9 Slides

SlideContent
1 - TitleDark navy/gold design with all arthritis type tags
2 - ClassificationFull comparison table: mechanism, joints, serology, hallmark for all 7 types
3 - OsteoarthritisPathogenesis, morphology with 2 Robbins textbook images (OA schematic + histology showing fibrillation and eburnation), clinical features, management
4 - Rheumatoid ArthritisACPA/CD4/TNF pathogenesis with RA pathogenesis diagram + RA vs OA joint comparison image, 2010 ACR/EULAR criteria, stepwise DMARD/biologic/JAK treatment
5 - Crystal ArthropathiesGout vs CPPD side-by-side with crystal comparison table (polarized microscopy, birefringence), management protocols
6 - Seronegative SpAFour-panel layout: AS, Psoriatic, Reactive, IBD-associated — each with key features and treatment
7 - Septic & LymeEmergency management, organisms by patient type, Lyme disease phases, emergency pearl box
8 - Synovial Fluid Analysis6-column analysis table (Normal → OA → RA → Septic → Gout) + the RA vs OA morphology diagram
9 - Clinical Pearls8 dark-themed pearl cards (2 columns), color-coded by disease type
Design: Navy/teal/gold clinical color palette, color-coded disease banners, embedded Robbins pathology textbook images, clinical pearl boxes throughout. All images sourced directly from authoritative medical textbooks.
This is a shared conversation. Sign in to Orris to start your own chat.