Can you make a note for the topic inflammation [ pathophysiology] for mbbs student. Fmge usmle exams

Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Loading Image
Reading File
Loading Image
I now have all the content needed to write a comprehensive, exam-focused note on Inflammation. Let me compile it.

πŸ”₯ INFLAMMATION - Pathophysiology

MBBS Study Note | FMGE & USMLE Focused

Source: Robbins & Kumar Basic Pathology, Robbins Cotran Pathologic Basis of Disease

DEFINITION

Inflammation is the response of vascularized tissues to infections and tissue damage. It brings cells and molecules of host defense from circulation to the site of injury to eliminate the offending agent and initiate repair.
"Without inflammation, infections would go unchecked, wounds would never heal." - Robbins

TYPES AT A GLANCE

FeatureAcute InflammationChronic Inflammation
OnsetMinutes to hoursWeeks to months
DurationHours to daysProlonged
Predominant cellNeutrophilsMacrophages, lymphocytes, plasma cells
EdemaProminentLess prominent
Tissue injuryUsually mildOften severe
FibrosisAbsentPresent

OVERVIEW DIAGRAM

Sequence of events in an inflammatory reaction
Macrophages, dendritic cells, and mast cells are the "sentinel cells" that first recognize microbes/necrotic tissue and release mediators.

ACUTE INFLAMMATION

Causes (Stimuli) - FMGE High Yield

  • Infections (bacteria, viruses, fungi, parasites) - most common
  • Tissue necrosis (ischemia, trauma, physical/chemical injury)
  • Foreign bodies (splinters, sutures, crystals)
  • Immune reactions (hypersensitivity reactions)

Recognition Mechanisms

  • PRRs (Pattern Recognition Receptors) on macrophages/dendritic cells
    • Toll-like receptors (TLRs) - recognize PAMPs (Pathogen-Associated Molecular Patterns) e.g. LPS, flagellin
    • NLRs (NOD-like receptors) - form inflammasome β†’ activates IL-1
    • DAMPs (Danger/Damage-Associated Molecular Patterns) - from necrotic cells (uric acid, ATP, HMGB-1)

VASCULAR CHANGES (The "5 R's" of vascular response)

1. Vasodilation
  • Begins with transient vasoconstriction (seconds)
  • Then arteriolar vasodilation β†’ ↑ blood flow β†’ rubor (redness) + calor (heat)
  • Mediators: histamine, NO, prostaglandins
2. Increased Vascular Permeability
  • Fluid leaks into interstitium β†’ edema (tumor)
  • Mechanisms:
    • Endothelial contraction (gaps in venules) - most common; triggered by histamine, bradykinin, leukotrienes - RAPID & REVERSIBLE
    • Endothelial injury (direct damage - burns, chemicals) - IMMEDIATE & SUSTAINED
    • Leukocyte-mediated injury - delayed
    • New vessel formation (angiogenesis) - always leaky
3. Stasis
  • As fluid leaves, blood becomes viscous β†’ leukocytes move to periphery (margination)

LEUKOCYTE RECRUITMENT (Step-by-step - HIGH YIELD)

Step 1: Margination & Rolling

  • Leukocytes roll along endothelium
  • Selectins mediate rolling:
    • E-selectin (on endothelium, induced by TNF/IL-1)
    • P-selectin (stored in Weibel-Palade bodies of endothelium; also in platelet granules)
    • L-selectin (on leukocytes)
  • Ligand on leukocyte: Sialyl-Lewis X (PSGL-1)

Step 2: Adhesion (Firm Adhesion)

  • Integrins on leukocytes (LFA-1/Mac-1 = CD11/CD18) bind ICAM-1 on endothelium
  • Integrins activated by chemokines (IL-8/CXCL8)
  • LAD (Leukocyte Adhesion Deficiency) = deficiency of CD18 β†’ recurrent infections, no pus formation, delayed cord separation

Step 3: Transmigration (Diapedesis)

  • Leukocytes squeeze through endothelial junctions (PECAM-1/CD31 mediates this)
  • Neutrophils first (6-24 hrs), then monocytes (24-48 hrs)

Step 4: Chemotaxis

  • Leukocytes migrate toward the stimulus along a chemical gradient
  • Key chemotactic agents:
    • C5a (complement fragment)
    • LTB4 (leukotriene B4)
    • IL-8 (CXCL8)
    • fMLP (bacterial formyl-methionyl peptides)
🧠 Mnemonic: "C5a-LTB4-IL8-fMLP" = "Cats Like Interesting Food"

PHAGOCYTOSIS

Steps: Recognition β†’ Engulfment β†’ Killing
  1. Recognition & Attachment (opsonization enhances)
    • Opsonins: IgG (binds Fc receptor), C3b (binds CR1/complement receptor)
    • Mannose receptor (non-opsonic)
  2. Engulfment β†’ phagosome formation β†’ phagolysosome
  3. Intracellular Killing - TWO mechanisms:
    • Oxygen-dependent (Oxidative burst) - MOST IMPORTANT
      • NADPH oxidase β†’ superoxide β†’ Hβ‚‚Oβ‚‚ β†’ Myeloperoxidase (MPO) + Cl⁻ β†’ HOCl (hypochlorous acid) - most potent microbicidal agent
      • CGD (Chronic Granulomatous Disease) = NADPH oxidase deficiency β†’ recurrent Catalase+ bacterial/fungal infections (Staph, Aspergillus)
      • MPO deficiency = most common neutrophil enzyme defect (usually clinically silent)
    • Oxygen-independent
      • Lysozyme, defensins, lactoferrin, major basic protein, BPI (bactericidal permeability-increasing protein)
  4. Neutrophil Extracellular Traps (NETs)
    • Chromatin + antimicrobial granule proteins released extracellularly
    • Trap and kill bacteria; also contribute to tissue injury

MEDIATORS OF INFLAMMATION (HIGH YIELD TABLE)

NETs - neutrophil extracellular traps

Cell-Derived Mediators

MediatorSourceActionsKey Facts
HistamineMast cells, basophils, plateletsVasodilation, ↑ permeabilityFirst mediator; H1 receptor; blocked by antihistamines
Serotonin (5-HT)Platelets, enterochromaffin cellsVasodilation, ↑ permeabilitySimilar to histamine
Prostaglandins (PGs)Mast cells, leukocytes (via COX)Vasodilation, pain, feverPGE2 = fever; blocked by NSAIDs/aspirin
Leukotrienes (LTs)Mast cells, leukocytes (via LOX)↑ Permeability, chemotaxis, bronchospasmLTB4 = chemotaxis; LTC4/D4/E4 = bronchoconstriction (asthma); blocked by zileuton (LOX inhibitor), montelukast (LTD4 receptor blocker)
PAFLeukocytes, mast cells, endotheliumPlatelet aggregation, vasodilation, bronchoconstrictionVery potent
ROSLeukocytes (oxidative burst)Microbicidal, tissue damage
NOMacrophages, endotheliumVasodilation, microbicidal
IL-1, TNFMacrophages, other cellsFever, acute phase response, leukocyte recruitment"Endogenous pyrogens"; act via PGE2 in hypothalamus
IL-6MacrophagesAcute phase protein production (CRP, fibrinogen)
IL-8 (CXCL8)Macrophages, endotheliumNeutrophil chemotaxis
ChemokinesLeukocytes, activated macrophagesLeukocyte recruitment

Plasma-Derived Mediators (Produced in Liver)

SystemKey MediatorsActions
ComplementC3a, C5a (anaphylatoxins), C3b (opsonin), MAC (C5b-9)C3a/C5a β†’ mast cell degranulation, ↑ permeability; C5a β†’ chemotaxis; C3b β†’ opsonization; MAC β†’ lysis
Kinin systemBradykinin↑ Permeability, vasodilation, pain (most important kininhow of pain in inflammation); bronchoconstriction
Coagulation systemThrombin, fibrin, fibrinopeptides↑ Permeability, chemotaxis, endothelial activation
🧠 Arachidonic Acid Pathway - KEY EXAM POINT:
  • COX pathway β†’ Prostaglandins, Thromboxane, Prostacyclin
  • LOX pathway β†’ Leukotrienes (LTB4, LTC4, LTD4, LTE4)
  • Aspirin/NSAIDs block COX (irreversibly for aspirin)
  • Zileuton blocks 5-LOX
  • Corticosteroids block phospholipase A2 (blocks BOTH pathways)
  • Lipoxins (from arachidonic acid) are ANTI-inflammatory - they suppress neutrophil recruitment

MORPHOLOGIC PATTERNS OF ACUTE INFLAMMATION

PatternCharacteristicsExamples
SerousWatery, protein-poor fluidSkin blisters (burns), pleural effusion (early TB)
FibrinousFibrin exudate (vascular leak > fibrinogen threshold)Fibrinous pericarditis ("bread and butter"), lobar pneumonia
Purulent/SuppurativePus = neutrophils + necrotic debris + bacteriaAcute appendicitis, abscesses
UlcerativeSurface necrosis + inflammation β†’ defectPeptic ulcer, aphthous ulcer
PseudomembranousGray-white membrane on mucosal surfaceC. difficile colitis, diphtheria
HemorrhagicVascular damage + RBC extravasationAnthrax, plague, herpes encephalitis

OUTCOMES OF ACUTE INFLAMMATION

ACUTE INFLAMMATION
       |
  _____|_____________________________
  |           |                     |
Resolution  Chronic              Abscess β†’ Fibrosis/Scarring
(complete    Inflammation
 restoration)
  1. Resolution - complete restoration; occurs when damage is minimal + tissue can regenerate (e.g., lobar pneumonia)
  2. Healing by fibrosis/scarring - when regeneration is not possible
  3. Progression to chronic inflammation
  4. Abscess formation

CHRONIC INFLAMMATION

Definition

Prolonged inflammation (weeks-months) with simultaneous tissue destruction and repair attempts.

Causes

  1. Persistent infections by pathogens that resist eradication (TB, syphilis, fungi, parasites) β†’ often granulomatous
  2. Hypersensitivity/autoimmune diseases (RA, SLE, MS, IBD, asthma)
  3. Prolonged toxic exposures (silica β†’ silicosis; cholesterol β†’ atherosclerosis)

Morphologic Features (triad)

  1. Mononuclear infiltrate (macrophages, lymphocytes, plasma cells)
  2. Tissue destruction (by persistent offending agent or inflammatory cells)
  3. Healing by fibrosis/angiogenesis

Key Cells in Chronic Inflammation

Macrophages (most important cell)
  • Derived from circulating monocytes (activated by IFN-Ξ³ from T-cells)
  • Produce: IL-1, TNF, IL-6, ROS, NO, growth factors (PDGF, TGF-Ξ²), proteases
  • Two phenotypes:
    • M1 (classically activated by IFN-Ξ³) β†’ pro-inflammatory, microbicidal
    • M2 (alternatively activated by IL-4, IL-13) β†’ anti-inflammatory, repair/fibrosis
Lymphocytes
  • CD4+ T-helpers activate macrophages (via IFN-Ξ³)
  • CD8+ T-cytotoxic kill infected cells
  • Bidirectional loop: macrophages activate T-cells; T-cells (IFN-Ξ³) activate macrophages
Plasma cells - produce antibodies against persisting antigens
Eosinophils - in allergic reactions and helminth infections; contain major basic protein (toxic to parasites + host)
Mast cells - present in connective tissue; sentinel cells in both acute and chronic inflammation

GRANULOMATOUS INFLAMMATION (HIGH YIELD)

Definition

A specific form of chronic inflammation characterized by aggregates of activated macrophages called epithelioid cells, often with multinucleated giant cells.

Structure of a Granuloma:

Central zone: Caseous necrosis (in TB) or no necrosis (sarcoid)
   ↑
Epithelioid macrophages (elongated, "footprint" nucleus)
   ↑
Multinucleated Giant Cells (fusion of macrophages)
   ↑
Rim of lymphocytes (CD4+ T-cells)
   ↑
Outer collar of fibroblasts

Types of Giant Cells

TypePatternDisease
Langhans giant cellNuclei at periphery (horseshoe/U-shape)TB
Foreign body giant cellNuclei scattered throughoutForeign material
Touton giant cellNuclei in ring, foamy cytoplasmXanthoma, fat necrosis
Aschoff cell / Anitschkow cellCaterpillar/owl-eye nucleusRheumatic fever

Key Granulomatous Diseases (FMGE/USMLE must-know)

DiseaseGranuloma TypeSpecial Feature
TuberculosisCaseating granulomaLanghans giant cells, ZN stain+
SarcoidosisNon-caseating granuloma"Naked granuloma," Schaumann bodies, asteroid bodies; ↑ACE, ↑Ca²⁺
Crohn's diseaseNon-caseatingTransmural inflammation, skip lesions
LeprosyLepromatous = macrophages packed with bacilli; Tuberculoid = well-formed granulomaWade-Fite stain
SyphilisGummaEndarteritis obliterans
Cat-scratch diseaseStellate/suppurative granulomaBartonella henselae
Fungal (Histo, Cocci)Caseating or non-caseating
BerylliosisNon-caseatingLike sarcoid; occupational
🧠 Mnemonic for caseating granulomas: "THE BCG" = TB, Histoplasma, Eosinophilic granuloma, Brucellosis, Coccidioidomycosis, Giant cell arteritis

SYSTEMIC EFFECTS OF INFLAMMATION (Acute Phase Response)

Triggered by cytokines (IL-1, TNF, IL-6) released from macrophages at inflammatory site:
EffectMediatorMechanism
FeverIL-1, TNF, IL-6 β†’ PGE2Act on hypothalamus β†’ ↑ set point; blocked by aspirin/NSAIDs
LeukocytosisIL-1, TNF, CSFs↑ WBC production from bone marrow + release from storage pools
↑ Acute phase proteinsIL-6 (mainly)Liver produces: CRP, fibrinogen, SAA, complement
↑ ESR↑ FibrinogenFibrinogen coats RBCs β†’ rouleaux formation
AnemiaHepcidin (liver)↓ Iron availability β†’ anemia of chronic disease
Septic shockTNF (mainly)Hypotension, DIC, multi-organ failure

Neutrophilia vs. Other Patterns (Exam High Yield)

ConditionWBC Pattern
Bacterial infectionNeutrophilia (+ left shift = bands)
Viral infectionLymphocytosis
Parasitic/allergicEosinophilia
Whooping coughLymphocytosis (exception to bacterial rule)
TyphoidLeukopenia/neutropenia

CARDINAL SIGNS OF INFLAMMATION

LatinEnglishMechanism
RuborRednessVasodilation β†’ ↑ blood flow
CalorHeat↑ blood flow + metabolic activity
TumorSwelling↑ Vascular permeability β†’ edema
DolorPainBradykinin, PGE2, substance P sensitize pain receptors
Functio laesaLoss of function(added by Virchow) Combined effects

QUICK REVISION - HIGH-YIELD ONE-LINERS (FMGE/USMLE)

  1. First cell to arrive in acute inflammation = Neutrophil (6-24 hrs)
  2. First mediator released = Histamine (preformed)
  3. First complement component activated (classical pathway) = C1q
  4. Most potent chemotactic agent = C5a (also anaphylatoxin)
  5. Most potent opsonin = C3b (also IgG via Fc receptor)
  6. Fever mediator = PGE2 (produced in hypothalamus)
  7. Pain mediator in inflammation = Bradykinin (most potent) + PGE2
  8. LAD (CD18 deficiency) β†’ absent pus, delayed cord separation, recurrent infections
  9. CGD (NADPH oxidase deficiency) β†’ ↑ Catalase+ organisms (Staph, Aspergillus)
  10. Corticosteroids block phospholipase A2 β†’ block both PG and LT synthesis
  11. Aspirin irreversibly inhibits COX (both COX-1 and COX-2)
  12. Sarcoidosis = non-caseating granuloma + ↑ACE + ↑serum calcium + Kveim test
  13. TB = caseating granuloma + Langhans giant cells
  14. Lipoxins = anti-inflammatory arachidonic acid derivatives (inhibit neutrophil recruitment)
  15. Exudate (↑ protein, ↑ SG >1.020) vs. Transudate (↓ protein, ↓ SG <1.012)

PHARMACOLOGY TIE-IN (FMGE/USMLE)

DrugMechanismUse
AspirinIrreversible COX-1/2 inhibitorAnti-inflammatory, analgesic, antipyretic; antiplatelet (low dose)
NSAIDs (ibuprofen)Reversible COX inhibitorAnti-inflammatory, analgesic, antipyretic
CorticosteroidsInhibit phospholipase A2 (via lipocortin/annexin-1)Broad anti-inflammatory
Zileuton5-LOX inhibitor β†’ ↓ all leukotrienesAsthma
Montelukast/ZafirlukastLTD4 receptor antagonistAsthma
AntihistaminesH1 receptor blockAllergy, urticaria
ColchicineInhibits microtubule polymerization β†’ ↓ neutrophil migrationGout, familial Mediterranean fever

Source: Robbins & Kumar Basic Pathology, 11th Ed. | Robbins, Cotran & Kumar Pathologic Basis of Disease, 10th Ed.

Plz make a pdf

Reading File
Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace not found"

Running Command

mkdir -p /home/daytona/workspace/inflammation-notes

Writing File

~/inflammation-notes/generate_pdf.py

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

# ─── Colour palette ───────────────────────────────────────────────────────────
C_BG       = HexColor("#1a1a2e")   # deep navy  (page background)
C_TITLE    = HexColor("#e94560")   # vivid red-pink
C_HEAD1    = HexColor("#0f3460")   # dark blue
C_HEAD2    = HexColor("#16213e")   # slightly lighter navy
C_ACCENT   = HexColor("#e94560")   # same red-pink for borders/bullets
C_YELLOW   = HexColor("#f5a623")   # amber – highlights / mnemonics
C_GREEN    = HexColor("#4caf50")   # green for "high yield" badges
C_WHITE    = HexColor("#f0f0f0")
C_BODY     = HexColor("#d0d0e0")   # light lavender-grey for body text
C_TABLE_H  = HexColor("#e94560")   # table header bg
C_TABLE_R1 = HexColor("#1e1e3a")   # odd row
C_TABLE_R2 = HexColor("#16213e")   # even row
C_BOX_BG   = HexColor("#0f3460")   # callout box bg
C_BOX_BORD = HexColor("#e94560")

OUTPUT = "/home/daytona/workspace/inflammation-notes/Inflammation_Pathophysiology_MBBS.pdf"

# ─── Document ─────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=1.8*cm, rightMargin=1.8*cm,
    topMargin=2*cm, bottomMargin=2*cm,
)

W = A4[0] - 3.6*cm   # usable width

# ─── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, **kw)

sNormal = S("sNormal",
    fontName="Helvetica", fontSize=9, leading=14,
    textColor=C_BODY, spaceBefore=2, spaceAfter=2)

sBody = S("sBody",
    fontName="Helvetica", fontSize=9.5, leading=15,
    textColor=C_BODY, spaceBefore=3, spaceAfter=3, alignment=TA_JUSTIFY)

sTitle = S("sTitle",
    fontName="Helvetica-Bold", fontSize=26, leading=30,
    textColor=C_TITLE, alignment=TA_CENTER, spaceBefore=0, spaceAfter=4)

sSubTitle = S("sSubTitle",
    fontName="Helvetica", fontSize=12, leading=16,
    textColor=C_YELLOW, alignment=TA_CENTER, spaceBefore=2, spaceAfter=2)

sTagLine = S("sTagLine",
    fontName="Helvetica-Oblique", fontSize=10, leading=14,
    textColor=C_WHITE, alignment=TA_CENTER, spaceBefore=2, spaceAfter=8)

sH1 = S("sH1",
    fontName="Helvetica-Bold", fontSize=14, leading=18,
    textColor=C_WHITE, backColor=C_HEAD1,
    spaceBefore=14, spaceAfter=6,
    leftIndent=6, rightIndent=6, borderPad=5)

sH2 = S("sH2",
    fontName="Helvetica-Bold", fontSize=11.5, leading=16,
    textColor=C_YELLOW, spaceBefore=10, spaceAfter=4)

sH3 = S("sH3",
    fontName="Helvetica-BoldOblique", fontSize=10, leading=14,
    textColor=C_ACCENT, spaceBefore=8, spaceAfter=3)

sBullet = S("sBullet",
    fontName="Helvetica", fontSize=9.5, leading=14,
    textColor=C_BODY, leftIndent=14, bulletIndent=4,
    spaceBefore=1, spaceAfter=1)

sHighlight = S("sHighlight",
    fontName="Helvetica-Bold", fontSize=9.5, leading=14,
    textColor=C_YELLOW, leftIndent=14, spaceBefore=1, spaceAfter=1)

sMnemonic = S("sMnemonic",
    fontName="Helvetica-BoldOblique", fontSize=9.5, leading=14,
    textColor=C_YELLOW, backColor=HexColor("#1a3a1a"),
    leftIndent=10, rightIndent=10, borderPad=6,
    spaceBefore=4, spaceAfter=4)

sKeyPoint = S("sKeyPoint",
    fontName="Helvetica-Bold", fontSize=9, leading=13,
    textColor=C_WHITE, backColor=C_BOX_BG,
    leftIndent=10, rightIndent=10, borderPad=5,
    spaceBefore=3, spaceAfter=3)

sSource = S("sSource",
    fontName="Helvetica-Oblique", fontSize=8, leading=12,
    textColor=HexColor("#888888"), alignment=TA_CENTER,
    spaceBefore=6)

# ─── Helpers ──────────────────────────────────────────────────────────────────
def HR(color=C_ACCENT, thickness=1.5):
    return HRFlowable(width="100%", thickness=thickness, color=color,
                      spaceBefore=4, spaceAfter=4)

def h1(text):
    return Paragraph(f"&nbsp; {text}", sH1)

def h2(text):
    return Paragraph(text, sH2)

def h3(text):
    return Paragraph(text, sH3)

def p(text):
    return Paragraph(text, sBody)

def bullet(text):
    return Paragraph(f"β€’ &nbsp;{text}", sBullet)

def highlight(text):
    return Paragraph(f"β˜… &nbsp;{text}", sHighlight)

def mnemonic(text):
    return Paragraph(f"🧠 &nbsp;{text}", sMnemonic)

def keypoint(text):
    return Paragraph(f"⚑ {text}", sKeyPoint)

def space(h=6):
    return Spacer(1, h)

def make_table(header_row, data_rows, col_widths=None):
    """Build a styled dark-theme table."""
    all_rows = [header_row] + data_rows
    if col_widths is None:
        n = len(header_row)
        col_widths = [W/n]*n

    tbl = Table(all_rows, colWidths=col_widths, repeatRows=1)
    style = [
        # Header
        ("BACKGROUND", (0,0), (-1,0), C_TABLE_H),
        ("TEXTCOLOR",  (0,0), (-1,0), C_WHITE),
        ("FONTNAME",   (0,0), (-1,0), "Helvetica-Bold"),
        ("FONTSIZE",   (0,0), (-1,0), 9),
        ("ALIGN",      (0,0), (-1,0), "CENTER"),
        ("VALIGN",     (0,0), (-1,-1), "MIDDLE"),
        ("GRID",       (0,0), (-1,-1), 0.5, HexColor("#333355")),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [C_TABLE_R1, C_TABLE_R2]),
        ("TEXTCOLOR",  (0,1), (-1,-1), C_BODY),
        ("FONTNAME",   (0,1), (-1,-1), "Helvetica"),
        ("FONTSIZE",   (0,1), (-1,-1), 8.5),
        ("LEADING",    (0,0), (-1,-1), 13),
        ("LEFTPADDING",(0,0), (-1,-1), 5),
        ("RIGHTPADDING",(0,0),(-1,-1), 5),
        ("TOPPADDING", (0,0), (-1,-1), 4),
        ("BOTTOMPADDING",(0,0),(-1,-1), 4),
        ("WORDWRAP",   (0,0), (-1,-1), True),
    ]
    tbl.setStyle(TableStyle(style))
    return tbl

def cell(text, bold=False, color=None):
    st = ParagraphStyle("tc",
        fontName="Helvetica-Bold" if bold else "Helvetica",
        fontSize=8.5, leading=13,
        textColor=color or C_BODY)
    return Paragraph(text, st)

def hcell(text):
    return cell(text, bold=True, color=C_WHITE)

# ─── Page background callback ─────────────────────────────────────────────────
def dark_bg(canvas, doc):
    canvas.saveState()
    canvas.setFillColor(C_BG)
    canvas.rect(0, 0, A4[0], A4[1], fill=1, stroke=0)
    # subtle top bar
    canvas.setFillColor(C_HEAD1)
    canvas.rect(0, A4[1]-28, A4[0], 28, fill=1, stroke=0)
    # page number
    canvas.setFillColor(HexColor("#888888"))
    canvas.setFont("Helvetica", 8)
    canvas.drawCentredString(A4[0]/2, 14, f"Page {doc.page}")
    canvas.restoreState()

# ─── Build content ────────────────────────────────────────────────────────────
story = []

# ══════════════════════════════════════════════════════════════════════════════
# COVER / TITLE BLOCK
# ══════════════════════════════════════════════════════════════════════════════
story += [
    space(40),
    Paragraph("πŸ”₯ INFLAMMATION", sTitle),
    Paragraph("PATHOPHYSIOLOGY", sSubTitle),
    HR(C_ACCENT, 2),
    Paragraph("MBBS Study Notes  |  FMGE &amp; USMLE Focused", sTagLine),
    Paragraph("Based on Robbins &amp; Kumar Basic Pathology (11e) | Robbins Cotran Pathologic Basis of Disease (10e)", sSource),
    space(20),
    HR(HexColor("#333355"), 0.5),
    space(10),
]

# ══════════════════════════════════════════════════════════════════════════════
# DEFINITION
# ══════════════════════════════════════════════════════════════════════════════
story += [
    h1("DEFINITION"),
    space(4),
    p("Inflammation is the <b>response of vascularized tissues</b> to infections and tissue damage. "
      "It brings cells and molecules of host defense from the circulation to the site of injury to "
      "<b>eliminate the offending agent</b> and <b>initiate repair</b>."),
    space(4),
    keypoint('"Without inflammation, infections would go unchecked, wounds would never heal, '
             'and injured tissues might remain permanent festering sores." β€” Robbins'),
    space(6),
]

# ══════════════════════════════════════════════════════════════════════════════
# ACUTE VS CHRONIC COMPARISON TABLE
# ══════════════════════════════════════════════════════════════════════════════
story += [
    h1("TYPES AT A GLANCE"),
    space(4),
    make_table(
        [hcell("Feature"), hcell("Acute Inflammation"), hcell("Chronic Inflammation")],
        [
            [cell("Onset"),            cell("Minutes to hours"),                   cell("Weeks to months")],
            [cell("Duration"),         cell("Hours to a few days"),                cell("Prolonged (months-years)")],
            [cell("Predominant Cell"), cell("Neutrophils (PMNs)", bold=True),      cell("Macrophages, Lymphocytes, Plasma cells", bold=True)],
            [cell("Edema"),            cell("Prominent"),                           cell("Less prominent")],
            [cell("Tissue Injury"),    cell("Usually mild, reversible"),            cell("Often severe, progressive")],
            [cell("Fibrosis"),         cell("Absent"),                              cell("Present")],
            [cell("Vascular changes"), cell("Prominent β€” vasodilation, ↑ permeability"), cell("Less prominent")],
        ],
        col_widths=[W*0.22, W*0.39, W*0.39]
    ),
    space(8),
]

# ══════════════════════════════════════════════════════════════════════════════
# CAUSES & RECOGNITION
# ══════════════════════════════════════════════════════════════════════════════
story += [
    h1("ACUTE INFLAMMATION"),
    space(4),
    h2("Causes (Stimuli) β€” FMGE High Yield"),
    bullet("Infections (bacteria, viruses, fungi, parasites) β€” <b>most common</b>"),
    bullet("Tissue necrosis (ischemia, trauma, physical/chemical injury)"),
    bullet("Foreign bodies (splinters, sutures, crystals β€” e.g., gout = urate crystals)"),
    bullet("Immune reactions (hypersensitivity reactions)"),
    space(6),

    h2("Recognition Mechanisms"),
    bullet("<b>PRRs (Pattern Recognition Receptors)</b> on macrophages and dendritic cells"),
    bullet("<b>Toll-like receptors (TLRs)</b> β€” recognise PAMPs (Pathogen-Associated Molecular Patterns): LPS, flagellin, dsRNA"),
    bullet("<b>NLRs (NOD-like receptors)</b> β€” form the <b>INFLAMMASOME</b> β†’ activates caspase-1 β†’ cleaves pro-IL-1Ξ² β†’ active <b>IL-1Ξ²</b>"),
    bullet("<b>DAMPs</b> (Danger/Damage-Associated Molecular Patterns) β€” released from necrotic cells: uric acid, ATP, HMGB-1, heat-shock proteins"),
    space(8),
]

# Vascular Changes
story += [
    h2("VASCULAR CHANGES β€” The \"5 R's\""),
    space(2),
    h3("1. Vasodilation"),
    bullet("Begins with transient vasoconstriction (seconds), then <b>arteriolar vasodilation</b>"),
    bullet("↑ Blood flow β†’ <b>Rubor (redness)</b> + <b>Calor (heat)</b>"),
    bullet("Mediators: <b>Histamine, NO, Prostaglandins</b>"),
    space(4),

    h3("2. Increased Vascular Permeability (Leakage)"),
    bullet("Fluid leaks into interstitium β†’ <b>Tumor (swelling)</b>"),
    make_table(
        [hcell("Mechanism"), hcell("Description"), hcell("Example")],
        [
            [cell("Endothelial contraction", bold=True), cell("Gaps in venule junctions β€” RAPID & REVERSIBLE (15-30 min)"), cell("Histamine, bradykinin, leukotrienes")],
            [cell("Endothelial injury", bold=True),      cell("Direct damage β€” IMMEDIATE & SUSTAINED"),                       cell("Burns, chemicals, radiation")],
            [cell("Leukocyte-mediated injury"),          cell("Delayed (2-12 hrs) β€” ROS and proteases damage endothelium"),   cell("Severe inflammation")],
            [cell("New vessel formation"),               cell("Angiogenic vessels always leaky"),                              cell("Chronic inflammation, tumours")],
        ],
        col_widths=[W*0.28, W*0.42, W*0.30]
    ),
    space(4),

    h3("3. Stasis"),
    bullet("As fluid leaves, blood becomes viscous β†’ leukocytes marginate (move to periphery) β€” <b>Margination</b>"),
    space(8),
]

# Leukocyte Recruitment
story += [
    h2("LEUKOCYTE RECRUITMENT β€” Step by Step (HIGH YIELD)"),
    space(2),
    make_table(
        [hcell("Step"), hcell("Process"), hcell("Key Molecules"), hcell("Notes")],
        [
            [cell("1", bold=True), cell("MARGINATION & ROLLING"),
             cell("P-selectin (endothelium β€” Weibel-Palade bodies)\nE-selectin (induced by TNF/IL-1)\nL-selectin (on leukocytes)"),
             cell("Ligand: Sialyl-Lewis X (PSGL-1)\nSlow rolling along endothelium")],
            [cell("2", bold=True), cell("FIRM ADHESION"),
             cell("Integrins (LFA-1, Mac-1 = CD11/CD18)\nbind ICAM-1 on endothelium"),
             cell("Integrins activated by chemokines (IL-8)\nLAD = CD18 deficiency")],
            [cell("3", bold=True), cell("TRANSMIGRATION (Diapedesis)"),
             cell("PECAM-1 (CD31) β€” between endothelial junctions"),
             cell("Neutrophils first (6-24 h)\nMonocytes follow (24-48 h)")],
            [cell("4", bold=True), cell("CHEMOTAXIS"),
             cell("C5a, LTB4, IL-8 (CXCL8), fMLP"),
             cell("Migration along concentration gradient toward stimulus")],
        ],
        col_widths=[W*0.06, W*0.24, W*0.38, W*0.32]
    ),
    space(4),
    mnemonic("Chemotactic agents: C5a Β· LTB4 Β· IL-8 Β· fMLP  =  \"Cats Like Interesting Food\""),
    space(4),
    keypoint("LAD (Leukocyte Adhesion Deficiency) = CD18 (integrin Ξ²2) deficiency β†’ Recurrent bacterial infections, NO PUS formation, delayed umbilical cord separation"),
    space(8),
]

# Phagocytosis
story += [
    h2("PHAGOCYTOSIS β€” Steps & Killing"),
    space(2),
    h3("Steps: Recognition β†’ Engulfment β†’ Killing"),
    bullet("<b>Step 1 β€” Recognition:</b> Opsonins coat the target β†’ Fc receptor (binds IgG) + CR1 (binds C3b) β†’ enhanced phagocytosis"),
    bullet("<b>Step 2 β€” Engulfment:</b> Phagosome β†’ merges with lysosome β†’ <b>Phagolysosome</b>"),
    bullet("<b>Step 3 β€” Killing:</b>"),
    space(2),

    make_table(
        [hcell("Mechanism"), hcell("Pathway"), hcell("Key Enzyme/Product"), hcell("Disease if Deficient")],
        [
            [cell("Oxygen-DEPENDENT (Oxidative burst)", bold=True),
             cell("NADPH oxidase β†’ O₂⁻ (superoxide) β†’ Hβ‚‚Oβ‚‚ β†’ MPO + Cl⁻ β†’ HOCl (most potent)"),
             cell("NADPH oxidase, MPO"),
             cell("CGD = NADPH oxidase defect β†’ Staph, Aspergillus\nMPO deficiency = usually silent")],
            [cell("Oxygen-INDEPENDENT"),
             cell("Granule proteins in lysosomes"),
             cell("Lysozyme, Defensins, Lactoferrin, BPI, MBP"),
             cell("β€”")],
        ],
        col_widths=[W*0.26, W*0.34, W*0.22, W*0.18]
    ),
    space(4),
    keypoint("CGD (Chronic Granulomatous Disease) = NADPH oxidase deficiency β†’ recurrent infections with CATALASE-POSITIVE organisms: Staph aureus, Aspergillus, Klebsiella, Serratia, Nocardia"),
    space(4),
    h3("Neutrophil Extracellular Traps (NETs)"),
    bullet("Chromatin + antimicrobial granule proteins extruded extracellularly β†’ trap and kill bacteria"),
    bullet("Also contribute to tissue injury, thrombosis, autoimmunity"),
    space(8),
]

# ══════════════════════════════════════════════════════════════════════════════
# MEDIATORS
# ══════════════════════════════════════════════════════════════════════════════
story += [
    h1("MEDIATORS OF INFLAMMATION"),
    space(4),
    h2("Cell-Derived Mediators"),
    make_table(
        [hcell("Mediator"), hcell("Source"), hcell("Actions"), hcell("Key Facts / Pharmacology")],
        [
            [cell("Histamine", bold=True),       cell("Mast cells, basophils, platelets"),     cell("Vasodilation, ↑ permeability, endothelial activation"),      cell("FIRST mediator (preformed); H1 receptor; antihistamines block H1")],
            [cell("Serotonin (5-HT)"),            cell("Platelets, enterochromaffin cells"),    cell("Vasodilation, ↑ permeability"),                               cell("Similar to histamine; released during platelet aggregation")],
            [cell("Prostaglandins (PGs)", bold=True), cell("Mast cells, leukocytes (COX pathway)"), cell("Vasodilation, PAIN, FEVER (PGE2)"),                      cell("Blocked by NSAIDs (reversible) and Aspirin (irreversible)")],
            [cell("Leukotrienes (LTs)", bold=True), cell("Mast cells, leukocytes (LOX pathway)"), cell("LTB4: chemotaxis\nLTC4/D4/E4: bronchoconstriction, ↑ permeability"), cell("Zileuton: 5-LOX inhibitor\nMontelukast: LTD4 receptor blocker")],
            [cell("PAF"),                          cell("Leukocytes, mast cells, endothelium"), cell("Platelet aggregation, vasodilation, bronchoconstriction"),    cell("Very potent β€” active at picomolar concentrations")],
            [cell("ROS"),                          cell("Activated neutrophils (oxidative burst)"), cell("Microbicidal, tissue damage"),                            cell("HOCl (from MPO) most potent; can damage host tissue too")],
            [cell("NO"),                           cell("Macrophages (iNOS), endothelium (eNOS)"), cell("Vasodilation, microbicidal"),                              cell("eNOS: homeostatic; iNOS: induced by IFN-Ξ³")],
            [cell("IL-1 & TNF", bold=True),        cell("Macrophages, other cells"),            cell("Fever, acute phase response, leukocyte recruitment, endothelial activation"), cell("'Endogenous pyrogens'; act via PGE2 in hypothalamus")],
            [cell("IL-6"),                         cell("Macrophages, endothelium"),            cell("Acute phase protein production (CRP, fibrinogen, SAA)"),    cell("↑ ESR, ↑ CRP; used to monitor inflammation")],
            [cell("IL-8 (CXCL8)", bold=True),      cell("Macrophages, endothelium"),            cell("Neutrophil chemotaxis & activation"),                        cell("Key chemokine; inhibited by dapsone in some conditions")],
        ],
        col_widths=[W*0.18, W*0.20, W*0.30, W*0.32]
    ),
    space(8),
    h2("Plasma-Derived Mediators (Produced in Liver)"),
    make_table(
        [hcell("System"), hcell("Key Mediators"), hcell("Actions")],
        [
            [cell("Complement System", bold=True), cell("C3a, C5a (anaphylatoxins)\nC3b (opsonin)\nMAC = C5b-9"), cell("C3a/C5a: mast cell degranulation, ↑ permeability\nC5a: #1 chemotactic agent + opsonin\nC3b: opsonization\nMAC: lysis of bacteria")],
            [cell("Kinin System", bold=True),      cell("Bradykinin"),                  cell("↑ Permeability, vasodilation, PAIN (most important)\nBronchoconstriction\nActivated by Hageman factor (F-XII)")],
            [cell("Coagulation System"),           cell("Thrombin, Fibrin, Fibrinopeptides"), cell("↑ Permeability, chemotaxis, endothelial activation\nLinked to kinin system via Hageman factor")],
        ],
        col_widths=[W*0.22, W*0.30, W*0.48]
    ),
    space(6),
    h2("Arachidonic Acid Pathway β€” KEY EXAM POINT"),
    make_table(
        [hcell("Pathway"), hcell("Enzyme"), hcell("Products"), hcell("Blocker")],
        [
            [cell("COX Pathway", bold=True),      cell("Cyclooxygenase (COX-1/COX-2)"), cell("Prostaglandins, Thromboxane A2, Prostacyclin"),       cell("Aspirin (irreversible), NSAIDs (reversible)\nCelecoxib (selective COX-2)")],
            [cell("LOX Pathway", bold=True),      cell("5-Lipoxygenase (5-LOX)"),       cell("LTB4 (chemotaxis), LTC4/D4/E4 (bronchoconstriction)"), cell("Zileuton (5-LOX inhibitor)")],
            [cell("Anti-inflammatory", bold=True), cell("β€”"),                            cell("Lipoxins β€” INHIBIT neutrophil recruitment; promote resolution"), cell("β€”")],
        ],
        col_widths=[W*0.20, W*0.25, W*0.32, W*0.23]
    ),
    space(4),
    keypoint("Corticosteroids block PHOSPHOLIPASE A2 (via lipocortin/annexin-1) β†’ inhibit BOTH COX and LOX pathways = broadest anti-inflammatory"),
    space(8),
]

# ══════════════════════════════════════════════════════════════════════════════
# MORPHOLOGIC PATTERNS
# ══════════════════════════════════════════════════════════════════════════════
story += [
    h1("MORPHOLOGIC PATTERNS OF ACUTE INFLAMMATION"),
    space(4),
    make_table(
        [hcell("Pattern"), hcell("Characteristics"), hcell("Examples")],
        [
            [cell("Serous", bold=True),            cell("Watery, protein-poor fluid exudate"),                                              cell("Skin blisters (burns), pleural effusion (early TB), pericardial effusion")],
            [cell("Fibrinous", bold=True),          cell("Fibrin exudate (vascular leak > fibrinogen threshold)"),                          cell("Fibrinous pericarditis (\"bread and butter\"), lobar pneumonia")],
            [cell("Purulent/Suppurative", bold=True), cell("PUS = neutrophils + necrotic debris + bacteria"),                               cell("Acute appendicitis, abscesses, empyema")],
            [cell("Ulcerative"),                    cell("Surface necrosis + inflammation β†’ mucosal defect"),                               cell("Peptic ulcer, aphthous ulcer")],
            [cell("Pseudomembranous", bold=True),   cell("Gray-white membrane on mucosal surface = necrosis + neutrophils + fibrin"),       cell("C. difficile colitis, diphtheria (pharynx)")],
            [cell("Hemorrhagic"),                   cell("Vascular damage + RBC extravasation"),                                           cell("Anthrax, plague, herpes encephalitis")],
        ],
        col_widths=[W*0.22, W*0.38, W*0.40]
    ),
    space(8),
]

# ══════════════════════════════════════════════════════════════════════════════
# OUTCOMES
# ══════════════════════════════════════════════════════════════════════════════
story += [
    h1("OUTCOMES OF ACUTE INFLAMMATION"),
    space(4),
    make_table(
        [hcell("Outcome"), hcell("Definition"), hcell("When it Occurs")],
        [
            [cell("Resolution", bold=True),     cell("Complete restoration of tissue to normal"),                                           cell("Minimal damage + tissue capable of regeneration (e.g., lobar pneumonia)")],
            [cell("Abscess"),                   cell("Localized pus collection walled off by fibroblasts"),                                 cell("Pyogenic bacterial infection (Staph aureus)")],
            [cell("Fibrosis/Scarring"),         cell("Replacement of damaged tissue with connective tissue"),                               cell("When regeneration is NOT possible (e.g., myocardial infarction)")],
            [cell("Chronic Inflammation", bold=True), cell("Prolonged inflammation when offending agent is not eliminated"),               cell("Persistent infections, autoimmune disease, foreign bodies")],
        ],
        col_widths=[W*0.22, W*0.40, W*0.38]
    ),
    space(8),
]

# ══════════════════════════════════════════════════════════════════════════════
# CHRONIC INFLAMMATION
# ══════════════════════════════════════════════════════════════════════════════
story += [
    h1("CHRONIC INFLAMMATION"),
    space(4),
    h2("Causes"),
    bullet("<b>Persistent infections</b> β€” pathogens resistant to elimination: TB, syphilis, fungi, parasites, H. pylori β†’ often granulomatous"),
    bullet("<b>Hypersensitivity / Autoimmune diseases</b> β€” RA, SLE, MS, IBD, asthma (self-perpetuating immune reaction)"),
    bullet("<b>Prolonged toxic exposures</b> β€” Silica β†’ silicosis; cholesterol β†’ atherosclerosis"),
    space(4),

    h2("Morphologic Features (TRIAD β€” HIGH YIELD)"),
    bullet("1. <b>Mononuclear infiltrate</b> β€” Macrophages, lymphocytes, plasma cells"),
    bullet("2. <b>Tissue destruction</b> β€” by persistent agent or by inflammatory cells themselves"),
    bullet("3. <b>Healing by fibrosis and angiogenesis</b> β€” scar formation"),
    space(4),

    h2("Key Cells in Chronic Inflammation"),
    make_table(
        [hcell("Cell"), hcell("Origin / Activation"), hcell("Functions"), hcell("Key Points")],
        [
            [cell("Macrophages", bold=True),    cell("Blood monocytes\nActivated by IFN-Ξ³ from T-cells"),     cell("Phagocytosis, antigen presentation, produce IL-1, TNF, IL-6, ROS, NO, proteases, growth factors"), cell("M1 (pro-inflammatory) vs M2 (anti-inflammatory/repair)\nKEY CELL of chronic inflammation")],
            [cell("Lymphocytes", bold=True),    cell("CD4+ T-helper (activate macrophages)\nCD8+ T-cytotoxic (kill infected cells)\nB cells β†’ Plasma cells"), cell("IFN-Ξ³ from CD4+ cells activates macrophages\nBidirectional activation loop"), cell("Lymphocytes & macrophages amplify each other")],
            [cell("Plasma cells"),              cell("Activated B-lymphocytes"),                               cell("Produce antibodies against persistent antigens"),   cell("Seen in chronic infections, autoimmune diseases")],
            [cell("Eosinophils"),               cell("Recruited by IL-5"),                                     cell("Kill helminths (Major Basic Protein = toxic to parasites)\nAlso cause tissue damage"), cell("↑ in allergic reactions + helminth infections")],
            [cell("Mast cells"),                cell("Bone marrow precursors β†’ connective tissue"),            cell("IL-4, IL-13 activate β†’ IgE cross-linking β†’ degranulation"), cell("In both acute (fast) and chronic (sustained) inflammation")],
        ],
        col_widths=[W*0.16, W*0.28, W*0.32, W*0.24]
    ),
    space(8),
]

# ══════════════════════════════════════════════════════════════════════════════
# GRANULOMATOUS INFLAMMATION
# ══════════════════════════════════════════════════════════════════════════════
story += [
    PageBreak(),
    h1("GRANULOMATOUS INFLAMMATION β€” HIGH YIELD"),
    space(4),
    p("<b>Definition:</b> A specific form of chronic inflammation characterised by aggregates of activated macrophages "
      "called <b>epithelioid cells</b>, often surrounded by a rim of lymphocytes, with or without central necrosis."),
    space(4),
    h2("Structure of a Granuloma"),
    make_table(
        [hcell("Layer (Outside β†’ In)"), hcell("Cell Type"), hcell("Notes")],
        [
            [cell("Outer collar"),              cell("Fibroblasts + collagen"),                     cell("Walling-off of the lesion")],
            [cell("Lymphocyte rim"),            cell("CD4+ T-helper lymphocytes"),                   cell("Provide IFN-Ξ³ to activate macrophages")],
            [cell("Epithelioid macrophages"),   cell("Activated macrophages β€” elongated, footprint-shaped nucleus"), cell("Fused β†’ form giant cells")],
            [cell("Multinucleated Giant Cells"), cell("Fusion of multiple epithelioid macrophages"), cell("See types below")],
            [cell("Centre (TB only)"),          cell("CASEOUS NECROSIS β€” soft, cheese-like",True),   cell("Absent in sarcoidosis ('naked granuloma')")],
        ],
        col_widths=[W*0.25, W*0.37, W*0.38]
    ),
    space(6),
    h2("Types of Multinucleated Giant Cells"),
    make_table(
        [hcell("Cell Type"), hcell("Nuclear Pattern"), hcell("Associated Disease")],
        [
            [cell("Langhans giant cell", bold=True),      cell("Nuclei at PERIPHERY β€” horseshoe/U-shape"),                     cell("Tuberculosis (classic)")],
            [cell("Foreign body giant cell"),              cell("Nuclei SCATTERED throughout cytoplasm"),                       cell("Foreign material (splinters, sutures, implants)")],
            [cell("Touton giant cell"),                    cell("Nuclei in a RING, foamy cytoplasm outside ring"),              cell("Xanthoma, fat necrosis, juvenile xanthogranuloma")],
            [cell("Aschoff cell / Anitschkow cell"),       cell("'Caterpillar' nucleus or 'owl-eye' nucleus"),                  cell("Rheumatic fever (Aschoff body in myocardium)")],
        ],
        col_widths=[W*0.28, W*0.38, W*0.34]
    ),
    space(6),
    h2("Granulomatous Diseases β€” Must-Know for FMGE/USMLE"),
    make_table(
        [hcell("Disease"), hcell("Granuloma Type"), hcell("Special Features")],
        [
            [cell("Tuberculosis", bold=True),          cell("CASEATING granuloma", bold=True),        cell("Langhans giant cells; ZN stain (acid-fast); Ghon focus β†’ Ghon complex")],
            [cell("Sarcoidosis", bold=True),           cell("NON-CASEATING 'naked' granuloma", bold=True), cell("Schaumann bodies, asteroid bodies; ↑ACE, ↑Serum Ca²⁺, ↑urine Ca²⁺; Kveim test; bilateral hilar lymphadenopathy")],
            [cell("Crohn's disease"),                  cell("Non-caseating"),                         cell("Transmural inflammation, skip lesions, cobblestone mucosa, fistulae")],
            [cell("Leprosy"),                          cell("Tuberculoid = well-formed; Lepromatous = macrophages full of bacilli (no effective granuloma)"), cell("Wade-Fite stain; Virchow cells in lepromatous")],
            [cell("Syphilis"),                         cell("Gumma (tertiary syphilis)"),              cell("Endarteritis obliterans; plasma cells prominent")],
            [cell("Cat-scratch disease"),              cell("Stellate/suppurative granuloma"),         cell("Bartonella henselae; Warthin-Starry silver stain")],
            [cell("Histoplasmosis/Coccidioidomycosis"), cell("Caseating or non-caseating"),           cell("Fungal organisms within macrophages (Histo) or spherules (Cocci)")],
            [cell("Berylliosis"),                      cell("Non-caseating (identical to sarcoid)"),  cell("Occupational exposure; chest X-ray identical to sarcoidosis")],
            [cell("Wegener's/GPA"),                    cell("Necrotising granulomatous vasculitis"),  cell("c-ANCA positive; upper + lower respiratory + kidneys")],
        ],
        col_widths=[W*0.22, W*0.30, W*0.48]
    ),
    space(4),
    mnemonic("Caseating granulomas: THE BCG = TB Β· Histoplasmosis Β· Eosinophilic granuloma Β· Brucellosis Β· Coccidioidomycosis Β· Giant cell arteritis"),
    space(8),
]

# ══════════════════════════════════════════════════════════════════════════════
# SYSTEMIC EFFECTS
# ══════════════════════════════════════════════════════════════════════════════
story += [
    h1("SYSTEMIC EFFECTS β€” ACUTE PHASE RESPONSE"),
    space(4),
    p("Triggered by cytokines (IL-1, TNF, IL-6) released from activated macrophages:"),
    space(4),
    make_table(
        [hcell("Systemic Effect"), hcell("Mediator"), hcell("Mechanism / Notes")],
        [
            [cell("FEVER", bold=True),                  cell("IL-1, TNF, IL-6 β†’ PGE2"),             cell("Act on hypothalamus anterior region β†’ ↑ set point. PGE2 is the final mediator. Blocked by aspirin/NSAIDs")],
            [cell("LEUKOCYTOSIS", bold=True),            cell("IL-1, TNF, G-CSF, M-CSF"),            cell("↑ WBC production (bone marrow) + mobilisation from marginating pool. Left shift = immature bands")],
            [cell("↑ Acute Phase Proteins"),             cell("IL-6 (main inducer)"),                cell("Liver produces: CRP, Fibrinogen, SAA, Haptoglobin, Ferritin, Complement. CRP activates complement, opsonises")],
            [cell("↑ ESR"),                              cell("↑ Fibrinogen (acute phase protein)"),  cell("Fibrinogen coats RBCs β†’ rouleaux formation β†’ ↑ ESR")],
            [cell("ANEMIA (chronic disease)"),           cell("Hepcidin (liver, induced by IL-6)"),  cell("Hepcidin β†’ ↓ ferroportin β†’ ↓ iron release from macrophages β†’ ↓ available iron β†’ microcytic/normocytic anaemia")],
            [cell("SEPTIC SHOCK", bold=True),            cell("TNF (primarily)"),                    cell("Hypotension, DIC, multi-organ failure. From overwhelming bacterial infection")],
        ],
        col_widths=[W*0.24, W*0.24, W*0.52]
    ),
    space(6),
    h2("WBC Patterns β€” Exam High Yield"),
    make_table(
        [hcell("Condition"), hcell("WBC Pattern"), hcell("Notes")],
        [
            [cell("Bacterial infection"),    cell("Neutrophilia + left shift (bands)", bold=True),  cell("Left shift = ↑ immature neutrophils (bands, metamyelocytes)")],
            [cell("Viral infection"),         cell("Lymphocytosis", bold=True),                      cell("Reactive lymphocytes (Downey cells) in EBV")],
            [cell("Parasitic / Allergic"),    cell("Eosinophilia", bold=True),                       cell("Also in helminth infections, asthma, drug reactions")],
            [cell("Whooping cough (Pertussis)"), cell("Lymphocytosis (exception!)", bold=True),    cell("Exception to the 'bacterial = neutrophilia' rule; due to lymphocyte-promoting factor")],
            [cell("Typhoid fever"),           cell("Leukopenia / Neutropenia", bold=True),          cell("Also neutropenia in rickettsia, some viral infections")],
            [cell("CML (leukaemoid reaction imitation)"), cell("Extreme neutrophilia (>50,000)"), cell("LAP score: ↑ in leukaemoid reaction, ↓ in CML")],
        ],
        col_widths=[W*0.28, W*0.30, W*0.42]
    ),
    space(8),
]

# ══════════════════════════════════════════════════════════════════════════════
# CARDINAL SIGNS
# ══════════════════════════════════════════════════════════════════════════════
story += [
    h1("CARDINAL SIGNS OF INFLAMMATION"),
    space(4),
    make_table(
        [hcell("Latin"), hcell("English"), hcell("Mechanism")],
        [
            [cell("Rubor", bold=True),       cell("Redness"),           cell("Vasodilation β†’ ↑ blood flow to area")],
            [cell("Calor", bold=True),       cell("Heat"),              cell("↑ Blood flow + ↑ metabolic activity at site")],
            [cell("Tumor", bold=True),       cell("Swelling"),          cell("↑ Vascular permeability β†’ fluid leak into interstitium β†’ edema")],
            [cell("Dolor", bold=True),       cell("Pain"),              cell("Bradykinin, PGE2, substance P sensitise nociceptors")],
            [cell("Functio Laesa", bold=True), cell("Loss of function"), cell("Added by Rudolf Virchow; combined effects of all above signs")],
        ],
        col_widths=[W*0.18, W*0.22, W*0.60]
    ),
    space(8),
]

# ══════════════════════════════════════════════════════════════════════════════
# PHARMACOLOGY
# ══════════════════════════════════════════════════════════════════════════════
story += [
    h1("PHARMACOLOGY TIE-IN β€” FMGE/USMLE"),
    space(4),
    make_table(
        [hcell("Drug / Class"), hcell("Mechanism"), hcell("Use / Notes")],
        [
            [cell("Aspirin", bold=True),             cell("IRREVERSIBLE inhibitor of COX-1 & COX-2"),                                cell("Anti-inflammatory, analgesic, antipyretic; antiplatelet (low dose) β†’ ↓ TXA2")],
            [cell("NSAIDs (Ibuprofen, Naproxen)"),   cell("Reversible COX-1 & COX-2 inhibitor"),                                   cell("Anti-inflammatory, analgesic, antipyretic; side effect: peptic ulcer (↓ PGE2 protection)")],
            [cell("Celecoxib"),                       cell("Selective COX-2 inhibitor"),                                             cell("Less GI side effects; ↑ cardiovascular risk (no antiplatelet effect)")],
            [cell("Corticosteroids", bold=True),      cell("Inhibit Phospholipase A2 (via lipocortin/annexin-1)\nβ†’ block BOTH COX and LOX"), cell("Broadest anti-inflammatory; also ↓ cytokine transcription, ↓ prostaglandins, ↓ leukotrienes")],
            [cell("Zileuton"),                        cell("5-LOX inhibitor β†’ ↓ all leukotrienes (LTB4 + cysteinyl LTs)"),         cell("Asthma treatment")],
            [cell("Montelukast / Zafirlukast"),       cell("CysLT1 (LTD4) receptor antagonist"),                                   cell("Asthma, allergic rhinitis")],
            [cell("Antihistamines (1st gen)"),        cell("H1 receptor blocker (sedating)"),                                       cell("Allergy, urticaria, anaphylaxis adjunct")],
            [cell("Colchicine"),                      cell("Inhibits microtubule polymerization β†’ ↓ neutrophil migration & degranulation"), cell("Gout (acute flare), familial Mediterranean fever, pericarditis")],
            [cell("Anti-TNF agents"),                 cell("Block TNF (e.g., infliximab, etanercept, adalimumab)"),                 cell("RA, IBD, ankylosing spondylitis, psoriasis")],
            [cell("Anakinra"),                        cell("IL-1 receptor antagonist"),                                             cell("RA, autoinflammatory syndromes; also used in macrophage activation syndrome")],
        ],
        col_widths=[W*0.24, W*0.38, W*0.38]
    ),
    space(8),
]

# ══════════════════════════════════════════════════════════════════════════════
# QUICK REVISION
# ══════════════════════════════════════════════════════════════════════════════
story += [
    h1("QUICK REVISION β€” HIGH-YIELD ONE-LINERS"),
    space(4),
]

one_liners = [
    ("First cell to arrive in acute inflammation", "NEUTROPHIL (6-24 hrs)"),
    ("First mediator released", "HISTAMINE (preformed, from mast cells)"),
    ("Most potent chemotactic agent", "C5a (also an anaphylatoxin)"),
    ("Most potent opsonins", "C3b + IgG (via Fc receptor)"),
    ("Fever mediator", "PGE2 (produced in hypothalamus); endogenous pyrogens = IL-1, TNF, IL-6"),
    ("Pain mediator", "Bradykinin (most potent) + PGE2 sensitise pain receptors"),
    ("Mediator of increased vascular permeability", "Histamine (early, rapid) + C3a/C5a + Bradykinin + Leukotrienes"),
    ("Molecule for leukocyte rolling", "Selectins (P-, E-, L-)"),
    ("Molecule for firm adhesion", "Integrins (LFA-1/Mac-1 = CD11/CD18) ↔ ICAM-1"),
    ("Molecule for diapedesis", "PECAM-1 (CD31)"),
    ("LAD (CD18 deficiency)", "No pus, delayed cord separation, recurrent bacterial infections"),
    ("CGD (NADPH oxidase deficiency)", "Catalase+ organisms: Staph, Aspergillus, Nocardia, Serratia, Klebsiella"),
    ("Corticosteroids block", "Phospholipase A2 β†’ blocks both PG AND LT synthesis"),
    ("Aspirin", "Irreversibly inhibits COX-1 and COX-2"),
    ("Anti-inflammatory arachidonic acid product", "LIPOXINS β€” inhibit neutrophil recruitment"),
    ("Exudate vs Transudate", "Exudate = ↑protein, SG >1.020 (inflammation); Transudate = ↓protein, SG <1.012 (heart failure, cirrhosis)"),
    ("Sarcoidosis granuloma", "NON-CASEATING 'naked' granuloma + ↑ACE + ↑Ca²⁺"),
    ("TB granuloma", "CASEATING granuloma + Langhans giant cells (peripheral nuclei)"),
    ("Acute phase response main inducer", "IL-6 β†’ CRP, fibrinogen, SAA"),
    ("Most important cell of chronic inflammation", "MACROPHAGE (activated by IFN-Ξ³ from CD4+ T-cells)"),
]

for q, a in one_liners:
    row_data = [[
        Paragraph(f"β€’ {q}", ParagraphStyle("q", fontName="Helvetica", fontSize=9, textColor=C_BODY, leading=13)),
        Paragraph(f"<b>{a}</b>", ParagraphStyle("a", fontName="Helvetica-Bold", fontSize=9, textColor=C_YELLOW, leading=13))
    ]]
    t = Table(row_data, colWidths=[W*0.50, W*0.50])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), C_TABLE_R1),
        ("ROWBACKGROUNDS", (0,0), (-1,-1), [C_TABLE_R1, C_TABLE_R2]),
        ("GRID", (0,0), (-1,-1), 0.3, HexColor("#333355")),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("TOPPADDING", (0,0), (-1,-1), 3),
        ("BOTTOMPADDING", (0,0), (-1,-1), 3),
        ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
    ]))
    story.append(t)

story += [
    space(12),
    HR(HexColor("#333355"), 0.5),
    Paragraph("Based on: Robbins &amp; Kumar Basic Pathology, 11th Ed. | Robbins, Cotran &amp; Kumar Pathologic Basis of Disease, 10th Ed.", sSource),
    Paragraph("Prepared for MBBS students β€” FMGE &amp; USMLE preparation", sSource),
    space(6),
]

# ─── Build PDF ────────────────────────────────────────────────────────────────
doc.build(story, onFirstPage=dark_bg, onLaterPages=dark_bg)
print(f"PDF generated: {OUTPUT}")
Running Command

cd /home/daytona/workspace/inflammation-notes && python generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/inflammation-notes/Inflammation_Pathophysiology_M…

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

Inflammation Pathophysiology MBBS

PDF Document Β· PDF


What's inside the PDF (dark-theme, exam-ready):
  • Cover page with title and source credit
  • Acute vs Chronic comparison table
  • Vascular changes, leukocyte recruitment steps (with selectins, integrins, PECAM-1)
  • Phagocytosis & killing mechanisms (NADPH oxidase, MPO, NETs)
  • Full mediators table (cell-derived + plasma-derived) with pharmacology links
  • Arachidonic acid pathway (COX vs LOX + drug blockers)
  • Morphologic patterns of acute inflammation
  • Outcomes of acute inflammation
  • Chronic inflammation - causes, triad, cells
  • Granulomatous inflammation - structure, giant cell types, disease table
  • Systemic effects / acute phase response + WBC patterns
  • Cardinal signs of inflammation
  • Pharmacology table (aspirin, NSAIDs, steroids, zileuton, colchicine, biologics)
  • 20 high-yield one-liners for quick revision

Can you make pdf of all these details you gave above..with pics ang diagram also ..everything details want to be included

Finding Sources
Running Command

mkdir -p /home/daytona/workspace/inflammation-notes/images && ls /home/daytona/w…

Running Command

cd /home/daytona/workspace/inflammation-notes/images && \ curl -s -o fig2_1_over…

Reading File
Reading File
Reading File
Running Command

cd /home/daytona/workspace/inflammation-notes/images && \ curl -s -o fig2_4_phag…

Reading File
Running Command

cd /home/daytona/workspace/inflammation-notes/images && \ curl -s -o fig2_19_gra…

Reading File
Reading File
Running Command

cd /home/daytona/workspace/inflammation-notes/images && \ curl -s -o fig2_5_phag…

Writing File

~/inflammation-notes/generate_full_pdf.py

#!/usr/bin/env python3
"""
Inflammation Pathophysiology - Full Notes PDF with Images
MBBS / FMGE / USMLE
"""

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

IMG_DIR = "/home/daytona/workspace/inflammation-notes/images"
OUTPUT  = "/home/daytona/workspace/inflammation-notes/Inflammation_Full_Notes_MBBS.pdf"

# ── Colour Palette ────────────────────────────────────────────────────────────
C_BG      = HexColor("#0d1117")
C_CARD    = HexColor("#161b22")
C_CARD2   = HexColor("#1a2233")
C_RED     = HexColor("#e94560")
C_YELLOW  = HexColor("#f5a623")
C_GREEN   = HexColor("#4caf50")
C_BLUE    = HexColor("#58a6ff")
C_PURPLE  = HexColor("#bc8cff")
C_WHITE   = HexColor("#e6edf3")
C_GREY    = HexColor("#8b949e")
C_TEAL    = HexColor("#39d353")
C_TH_BG   = HexColor("#21262d")
C_ROW1    = HexColor("#161b22")
C_ROW2    = HexColor("#1c2128")

PAGE_W, PAGE_H = A4
MARGIN = 1.6*cm
TW = PAGE_W - 2*MARGIN  # usable text width

# ── Document ──────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT, pagesize=A4,
    leftMargin=MARGIN, rightMargin=MARGIN,
    topMargin=2.4*cm, bottomMargin=1.8*cm,
)

# ── Styles ────────────────────────────────────────────────────────────────────
def style(name, **kw):
    return ParagraphStyle(name, **kw)

sTitle  = style("Title",  fontName="Helvetica-Bold",  fontSize=30, leading=36,
                textColor=C_RED, alignment=TA_CENTER, spaceBefore=0, spaceAfter=2)
sSub    = style("Sub",    fontName="Helvetica-Bold",  fontSize=15, leading=20,
                textColor=C_YELLOW, alignment=TA_CENTER, spaceBefore=0, spaceAfter=4)
sTag    = style("Tag",    fontName="Helvetica",       fontSize=10, leading=14,
                textColor=C_WHITE, alignment=TA_CENTER, spaceBefore=0, spaceAfter=4)
sSrc    = style("Src",    fontName="Helvetica-Oblique", fontSize=8, leading=11,
                textColor=C_GREY, alignment=TA_CENTER)

sH1     = style("H1",     fontName="Helvetica-Bold",  fontSize=13, leading=18,
                textColor=C_WHITE, backColor=HexColor("#1f3a5f"),
                spaceBefore=16, spaceAfter=6,
                leftIndent=0, borderPad=6)
sH2     = style("H2",     fontName="Helvetica-Bold",  fontSize=11, leading=15,
                textColor=C_YELLOW, spaceBefore=12, spaceAfter=4)
sH3     = style("H3",     fontName="Helvetica-BoldOblique", fontSize=10, leading=14,
                textColor=C_BLUE, spaceBefore=8, spaceAfter=3)
sBody   = style("Body",   fontName="Helvetica",       fontSize=9.5, leading=15,
                textColor=C_WHITE, spaceBefore=3, spaceAfter=3, alignment=TA_JUSTIFY)
sBullet = style("Bul",    fontName="Helvetica",       fontSize=9.5, leading=14,
                textColor=C_WHITE, leftIndent=14, spaceBefore=1, spaceAfter=1)
sBul2   = style("Bul2",   fontName="Helvetica",       fontSize=9, leading=13,
                textColor=HexColor("#c9d1d9"), leftIndent=26, spaceBefore=1, spaceAfter=1)
sMnem   = style("Mnem",   fontName="Helvetica-BoldOblique", fontSize=9.5, leading=15,
                textColor=C_TEAL, backColor=HexColor("#0d2818"),
                leftIndent=8, rightIndent=8, borderPad=6,
                spaceBefore=5, spaceAfter=5)
sKey    = style("Key",    fontName="Helvetica-Bold",  fontSize=9, leading=13,
                textColor=C_WHITE, backColor=HexColor("#3d1a00"),
                leftIndent=8, rightIndent=8, borderPad=6,
                spaceBefore=4, spaceAfter=4)
sAlert  = style("Alert",  fontName="Helvetica-Bold",  fontSize=9.5, leading=14,
                textColor=HexColor("#ffa657"), backColor=HexColor("#2d1f00"),
                leftIndent=8, rightIndent=8, borderPad=6,
                spaceBefore=4, spaceAfter=4)
sCaption= style("Cap",    fontName="Helvetica-Oblique", fontSize=8, leading=11,
                textColor=C_GREY, alignment=TA_CENTER, spaceBefore=3, spaceAfter=8)
sOL     = style("OL",     fontName="Helvetica",       fontSize=9, leading=13,
                textColor=C_WHITE, leftIndent=14, spaceBefore=1, spaceAfter=1)

# ── Helpers ───────────────────────────────────────────────────────────────────
def SP(h=6):  return Spacer(1, h)
def HR(c=C_RED, t=1.5):
    return HRFlowable(width="100%", thickness=t, color=c, spaceBefore=3, spaceAfter=3)

def h1(t):  return Paragraph(f"&nbsp;β–Ά {t}", sH1)
def h2(t):  return Paragraph(t, sH2)
def h3(t):  return Paragraph(t, sH3)
def p(t):   return Paragraph(t, sBody)
def b(t):   return Paragraph(f"● &nbsp;{t}", sBullet)
def b2(t):  return Paragraph(f"β—¦ &nbsp;{t}", sBul2)
def mnem(t): return Paragraph(f"🧠 &nbsp;{t}", sMnem)
def key(t):  return Paragraph(f"⚑ {t}", sKey)
def alert(t):return Paragraph(f"⚠ {t}", sAlert)

def img(fname, w=TW, caption=None):
    path = os.path.join(IMG_DIR, fname)
    if not os.path.exists(path) or os.path.getsize(path) < 500:
        return []
    ratio = 1
    try:
        from PIL import Image as PILImg
        im = PILImg.open(path)
        iw, ih = im.size
        ratio = ih / iw
    except Exception:
        ratio = 0.6
    h = min(w * ratio, 14*cm)
    items = [Image(path, width=w, height=h)]
    if caption:
        items.append(Paragraph(caption, sCaption))
    return items

def tc(text, bold=False, color=None, size=8.5, align=TA_LEFT):
    st = ParagraphStyle("tc_", fontName="Helvetica-Bold" if bold else "Helvetica",
        fontSize=size, leading=13, textColor=color or C_WHITE, alignment=align)
    return Paragraph(text, st)

def th(text): return tc(text, bold=True, color=C_WHITE, align=TA_CENTER)

TABLE_STYLE = TableStyle([
    ("BACKGROUND",   (0,0), (-1,0),  C_TH_BG),
    ("TEXTCOLOR",    (0,0), (-1,0),  C_WHITE),
    ("FONTNAME",     (0,0), (-1,0),  "Helvetica-Bold"),
    ("FONTSIZE",     (0,0), (-1,0),  9),
    ("ALIGN",        (0,0), (-1,0),  "CENTER"),
    ("VALIGN",       (0,0), (-1,-1), "MIDDLE"),
    ("ROWBACKGROUNDS",(0,1),(-1,-1), [C_ROW1, C_ROW2]),
    ("TEXTCOLOR",    (0,1), (-1,-1), C_WHITE),
    ("FONTNAME",     (0,1), (-1,-1), "Helvetica"),
    ("FONTSIZE",     (0,1), (-1,-1), 8.5),
    ("LEADING",      (0,0), (-1,-1), 13),
    ("GRID",         (0,0), (-1,-1), 0.4, HexColor("#30363d")),
    ("LEFTPADDING",  (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("TOPPADDING",   (0,0), (-1,-1), 4),
    ("BOTTOMPADDING",(0,0), (-1,-1), 4),
])

def tbl(headers, rows, widths=None):
    n = len(headers)
    if not widths: widths = [TW/n]*n
    data = [[th(h) for h in headers]] + rows
    t = Table(data, colWidths=widths, repeatRows=1)
    t.setStyle(TABLE_STYLE)
    return t

# ── Background + header ───────────────────────────────────────────────────────
def page_bg(canvas, doc):
    canvas.saveState()
    canvas.setFillColor(C_BG)
    canvas.rect(0, 0, PAGE_W, PAGE_H, fill=1, stroke=0)
    # top bar
    canvas.setFillColor(HexColor("#1f3a5f"))
    canvas.rect(0, PAGE_H-26, PAGE_W, 26, fill=1, stroke=0)
    # page number
    canvas.setFillColor(C_GREY)
    canvas.setFont("Helvetica", 8)
    canvas.drawCentredString(PAGE_W/2, 14, f"β€” {doc.page} β€”")
    # title in header bar
    canvas.setFillColor(C_WHITE)
    canvas.setFont("Helvetica-Bold", 9)
    canvas.drawString(MARGIN, PAGE_H-17, "πŸ”₯ INFLAMMATION β€” PATHOPHYSIOLOGY")
    canvas.setFont("Helvetica", 8)
    canvas.setFillColor(C_YELLOW)
    canvas.drawRightString(PAGE_W-MARGIN, PAGE_H-17, "MBBS | FMGE | USMLE")
    canvas.restoreState()

# ══════════════════════════════════════════════════════════════════════════════
# STORY
# ══════════════════════════════════════════════════════════════════════════════
S = []   # the story list

# ─── COVER ───────────────────────────────────────────────────────────────────
S += [
    SP(50),
    Paragraph("πŸ”₯ INFLAMMATION", sTitle),
    Paragraph("Pathophysiology", sSub),
    HR(C_RED, 2), SP(4),
    Paragraph("MBBS Study Notes &nbsp;|&nbsp; FMGE &amp; USMLE", sTag),
    SP(8),
    Paragraph("Based on: <b>Robbins &amp; Kumar Basic Pathology (11e)</b> and <b>Robbins Cotran Pathologic Basis of Disease (10e)</b>", sSrc),
    SP(6), HR(HexColor("#30363d"), 0.5), SP(8),
]

# overview diagram
S += img("fig2_1_overview.png", TW, "FIG 2.1  Sequence of events in inflammation. Sentinel cells recognise microbes/necrotic tissue β†’ release mediators β†’ vascular changes + leukocyte recruitment β†’ elimination β†’ resolution or repair. (Robbins Basic Pathology)")
S += [SP(8)]

# ─── DEFINITION ──────────────────────────────────────────────────────────────
S += [
    h1("DEFINITION"),
    p("Inflammation is the <b>response of vascularized tissues to infections and tissue damage</b> that brings "
      "cells and molecules of host defense from the circulation to the sites where they are needed, in order "
      "to eliminate the offending agents. It is a <b>protective response</b> that is essential for survival β€” "
      "it rids the host of the initial cause of cell injury and initiates repair."),
    key('"Without inflammation, infections would go unchecked, wounds would never heal, and injured tissues '
        'might remain permanent festering sores." β€” Robbins & Kumar Basic Pathology'),
    SP(8),
]

# ─── TYPES TABLE ─────────────────────────────────────────────────────────────
S += [
    h1("TYPES AT A GLANCE"),
    SP(4),
    tbl(["Feature", "Acute Inflammation", "Chronic Inflammation"],
        [
            [tc("Onset"),           tc("Minutes to hours"),                tc("Slow β€” days to weeks")],
            [tc("Duration"),        tc("Hours to a few days"),             tc("Weeks to months to years")],
            [tc("Predominant Cell", bold=True), tc("Neutrophils (PMNs)", bold=True, color=C_YELLOW), tc("Macrophages, Lymphocytes, Plasma cells", bold=True, color=C_YELLOW)],
            [tc("Edema"),           tc("Prominent"),                       tc("Less prominent")],
            [tc("Tissue injury"),   tc("Usually mild, self-limited"),      tc("May be severe and progressive")],
            [tc("Fibrosis"),        tc("Absent"),                          tc("Present (attempts at repair)")],
            [tc("Vascular changes"), tc("Vasodilation, ↑ permeability β€” PROMINENT"), tc("Less prominent")],
            [tc("Examples"),        tc("Acute appendicitis, lobar pneumonia, abscess"), tc("TB, RA, Crohn's, sarcoidosis")],
        ],
        widths=[TW*0.22, TW*0.39, TW*0.39]),
    SP(10),
]

# ─── ACUTE INFLAMMATION ──────────────────────────────────────────────────────
S += [
    h1("ACUTE INFLAMMATION"),
    h2("Causes (Stimuli)"),
    b("<b>Infections</b> β€” bacteria, viruses, fungi, parasites β€” <i>most common cause</i>"),
    b("<b>Tissue necrosis</b> β€” ischemia (MI, stroke), trauma, burns, physical/chemical injury"),
    b("<b>Foreign bodies</b> β€” splinters, sutures, crystals (urate in gout, calcium pyrophosphate in pseudogout)"),
    b("<b>Immune reactions</b> β€” hypersensitivity (allergic, autoimmune)"),
    SP(6),

    h2("Recognition β€” Pattern Recognition Receptors (PRRs)"),
    p("Macrophages, dendritic cells, and mast cells act as <b>sentinel cells</b> that constantly patrol the tissues. "
      "They recognise foreign or danger signals through several receptor families:"),
    b("<b>Toll-like receptors (TLRs)</b> β€” recognise PAMPs (Pathogen-Associated Molecular Patterns) on microbes: "
      "lipopolysaccharide (LPS) from gram-negative bacteria, flagellin, bacterial DNA (CpG), double-stranded viral RNA"),
    b("<b>NOD-like receptors (NLRs)</b> β€” cytoplasmic; assemble the <b>INFLAMMASOME</b> (multiprotein complex) "
      "β†’ activates caspase-1 β†’ cleaves pro-IL-1Ξ² β†’ active <b>IL-1Ξ²</b> secreted"),
    b("<b>DAMPs</b> (Damage-Associated Molecular Patterns) β€” 'danger signals' from necrotic cells: "
      "uric acid crystals, ATP, HMGB-1, heat-shock proteins, oxidised lipids"),
    SP(8),
]

# Vascular Changes
S += [
    h2("VASCULAR CHANGES"),
    h3("1. Vasodilation"),
    b("Brief initial vasoconstriction (seconds), followed by <b>arteriolar vasodilation</b>"),
    b("Vasodilation β†’ ↑ blood flow β†’ produces <b>Rubor (redness)</b> and <b>Calor (heat)</b>"),
    b("Mediators: <b>Histamine, Nitric Oxide (NO), Prostaglandins (PGI2, PGE2)</b>"),
    SP(6),

    h3("2. Increased Vascular Permeability (Most Important)"),
    p("Normally, the endothelium acts as a semi-permeable barrier. In inflammation, increased permeability "
      "allows protein-rich fluid to escape β†’ <b>Tumor (oedema / swelling)</b>."),
    SP(4),
    tbl(["Mechanism", "Description", "Onset/Duration", "Example Triggers"],
        [
            [tc("Endothelial cell contraction", bold=True, color=C_YELLOW),
             tc("Gaps form between endothelial cells in venules. MOST COMMON mechanism"),
             tc("RAPID (15–30 min) & REVERSIBLE"),
             tc("Histamine, bradykinin, leukotrienes, substance P")],
            [tc("Direct endothelial injury"),
             tc("Endothelium damaged directly β†’ necrosis β†’ sustained leak"),
             tc("IMMEDIATE & SUSTAINED (hours)"),
             tc("Severe burns, toxins, radiation, chemicals")],
            [tc("Leukocyte-mediated injury"),
             tc("Activated leukocytes release ROS and proteases that damage the endothelium"),
             tc("DELAYED (2–12 hrs)"),
             tc("Severe or prolonged inflammation")],
            [tc("New vessel formation (angiogenesis)"),
             tc("Newly formed vessels in repair/tumours are always leaky"),
             tc("Chronic inflammation"),
             tc("Wound healing, tumour growth")],
        ],
        widths=[TW*0.23, TW*0.32, TW*0.20, TW*0.25]),
    SP(6),
]
S += img("fig2_2_exudate_transudate.png", TW*0.9,
         "FIG 2.2  Exudate vs Transudate. (A) Normal vessel β€” balanced hydrostatic/osmotic pressures. "
         "(B) Exudate β€” inflammation causes endothelial gaps, protein-rich fluid escapes. "
         "(C) Transudate β€” ↑ hydrostatic or ↓ osmotic pressure (no inflammation). (Robbins)")
S += [SP(6),
    tbl(["Feature", "Exudate", "Transudate"],
        [
            [tc("Cause"),       tc("Inflammation β€” ↑ vascular permeability"), tc("↑ Hydrostatic pressure / ↓ Osmotic pressure")],
            [tc("Protein"),     tc("> 3 g/dL  (HIGH)", bold=True, color=C_YELLOW), tc("< 2 g/dL (LOW)")],
            [tc("Sp. gravity"), tc("> 1.020", bold=True), tc("< 1.012")],
            [tc("LDH"),         tc("HIGH"),  tc("LOW")],
            [tc("Appearance"),  tc("Turbid/cloudy, may contain cells"), tc("Clear, pale yellow")],
            [tc("Examples"),    tc("Pneumonia (exudate), empyema, peritonitis"), tc("CCF, nephrotic syndrome, cirrhosis")],
        ],
        widths=[TW*0.22, TW*0.39, TW*0.39]),
    SP(6),

    h3("3. Stasis"),
    b("As protein-rich fluid leaks out, blood viscosity ↑ β†’ red cells pile up centrally, "
      "leukocytes marginate to vessel wall β€” called <b>Margination</b>"),
    b("Grossly β†’ localized redness and heat (rubor and calor) at the inflammatory site"),
    SP(10),
]

# ─── LEUKOCYTE RECRUITMENT ────────────────────────────────────────────────────
S += [
    h1("LEUKOCYTE RECRUITMENT β€” Step-by-Step"),
    p("The journey of leukocytes from the vessel lumen to the tissue involves: "
      "<b>Rolling β†’ Adhesion β†’ Transmigration β†’ Chemotaxis</b>. Each step is mediated by specific molecules."),
    SP(6),
]
S += img("fig2_3_leukocyte_migration.png", TW,
         "FIG 2.3  Multistep leukocyte migration. Selectins mediate rolling; chemokines activate integrins; "
         "integrins mediate firm adhesion; PECAM-1 (CD31) mediates transmigration through the endothelium. (Robbins)")
S += [
    SP(8),
    tbl(["Step", "Process", "Key Molecules", "Important Notes"],
        [
            [tc("1",bold=True,color=C_RED),
             tc("MARGINATION &\nROLLING", bold=True),
             tc("P-selectin (Weibel-Palade bodies of endothelium)\nE-selectin (induced by TNF/IL-1 in ~4 hrs)\nL-selectin (on leukocytes)\nLigand: Sialyl-Lewis X (PSGL-1) on leukocytes"),
             tc("Leukocytes roll loosely like \"pebbles in a stream\"\nSelectins bind carbohydrate ligands (lectin domain)")],
            [tc("2",bold=True,color=C_YELLOW),
             tc("FIRM ADHESION\n(Arrest)", bold=True),
             tc("Integrins: LFA-1 (CD11a/CD18), Mac-1 (CD11b/CD18)\nbind ICAM-1 and ICAM-2 on endothelium\nActivation of integrins by chemokines (IL-8)"),
             tc("LAD (CD18 deficiency) = NO pus, delayed cord\nseparation, recurrent bacterial infections")],
            [tc("3",bold=True,color=C_BLUE),
             tc("TRANSMIGRATION\n(Diapedesis)", bold=True),
             tc("PECAM-1 (CD31) β€” leukocyte squeezes through\nendothelial cell junctions\nAlso crosses basement membrane (collagenase)"),
             tc("Neutrophils first: 6–24 hrs\nMonocytes follow: 24–48 hrs")],
            [tc("4",bold=True,color=C_TEAL),
             tc("CHEMOTAXIS", bold=True),
             tc("C5a (complement fragment) β€” MOST POTENT\nLTB4 (leukotriene B4)\nIL-8 (CXCL8)\nfMLP (bacterial formyl peptides)\nCytokines"),
             tc("Migration along chemical concentration gradient\ntoward the offending stimulus")],
        ],
        widths=[TW*0.06, TW*0.20, TW*0.40, TW*0.34]),
    SP(4),
    mnem("Chemotactic agents: C5a Β· LTB4 Β· IL-8 Β· fMLP  =  'Cats Like Interesting Food'"),
    SP(4),
    alert("LAD = Leukocyte Adhesion Deficiency (CD18/integrin Ξ²2 mutation) β†’ Absent neutrophil migration, NO pus formation, delayed umbilical cord separation (> 3 weeks), recurrent life-threatening bacterial infections"),
    SP(10),
]

# ─── PHAGOCYTOSIS ─────────────────────────────────────────────────────────────
S += [
    h1("PHAGOCYTOSIS & INTRACELLULAR KILLING"),
    p("After arriving at the site, leukocytes (mainly neutrophils and macrophages) perform phagocytosis β€” "
      "the ingestion of particulate material β€” followed by intracellular killing of the ingested agent."),
    SP(6),
    h2("Steps of Phagocytosis"),
    b("<b>Step 1 β€” Recognition & Attachment (Opsonization enhances this):</b>"),
    b2("Opsonins coat the target microbe β†’ recognised by phagocyte receptors"),
    b2("<b>IgG Fc</b> β†’ binds Fc receptor (FcΞ³R) on phagocytes"),
    b2("<b>C3b</b> (complement) β†’ binds CR1 (complement receptor 1)"),
    b2("<b>Mannose receptor</b> on phagocytes directly recognises terminal mannose on microbial glycoproteins (non-opsonic)"),
    b("<b>Step 2 β€” Engulfment:</b> Phagocyte membrane extends around particle β†’ <b>Phagosome</b> formed β†’ fuses with lysosome β†’ <b>Phagolysosome</b>"),
    b("<b>Step 3 β€” Intracellular Killing</b> (see below)"),
    SP(6),
]
S += img("fig2_5_phagocytosis.png", TW,
         "FIG 2.5  Phagocytosis and intracellular killing. (A) Opsonin-coated bacterium engulfed into phagolysosome. "
         "(B) NADPH oxidase assembles in phagosomal membrane β†’ generates O₂⁻ β†’ Hβ‚‚Oβ‚‚ β†’ MPO β†’ HOCl. "
         "(C) NO generated by iNOS reacts with O₂⁻ β†’ peroxynitrite. (Robbins)")
S += [
    SP(6),
    h2("Intracellular Killing Mechanisms"),
    tbl(["Mechanism", "Pathway", "Key Enzyme / Product", "Disease if Deficient"],
        [
            [tc("OXYGEN-DEPENDENT\n(Oxidative burst)", bold=True, color=C_YELLOW),
             tc("NADPH oxidase β†’ Superoxide (O₂⁻) β†’ Hβ‚‚Oβ‚‚\nMPO + Cl⁻ β†’ HOCl (hypochlorous acid)\nMost efficient bactericidal system"),
             tc("NADPH oxidase\nMyeloperoxidase (MPO)\nHOCl = most potent"),
             tc("CGD (NADPH oxidase defect)\nMPO deficiency (usually silent)")],
            [tc("OXYGEN-INDEPENDENT"),
             tc("Lysosomal granule contents released into phagolysosome during fusion"),
             tc("Lysozyme (cleaves peptidoglycan)\nDefensins (membrane pores)\nLactoferrin (sequesters iron)\nBPI (gram-negative bacteria)\nElastase, cathepsins"),
             tc("β€”")],
        ],
        widths=[TW*0.22, TW*0.33, TW*0.27, TW*0.18]),
    SP(4),
    alert("CGD (Chronic Granulomatous Disease) = NADPH oxidase deficiency β†’ Hβ‚‚Oβ‚‚ NOT generated. "
          "Catalase-positive organisms destroy their own Hβ‚‚Oβ‚‚ β†’ escape killing. "
          "Organisms: Staph aureus, Aspergillus, Nocardia, Serratia marcescens, Klebsiella. "
          "NBT (nitroblue tetrazolium) test NEGATIVE in CGD."),
    SP(6),
    h2("Neutrophil Extracellular Traps (NETs)"),
    p("Activated neutrophils expel their nuclear chromatin + antimicrobial granule proteins (histones, "
      "MPO, elastase) into the extracellular space. These fibrillar networks physically trap and kill bacteria, "
      "fungi, and other microbes. NETs also contribute to <b>tissue injury, thrombosis, and autoimmunity</b> "
      "(e.g., SLE, anti-neutrophil antibodies against NET components)."),
    SP(4),
]
S += img("fig_nets.png", TW*0.75,
         "FIG: Neutrophil Extracellular Traps (NETs). (A) Healthy neutrophils (red = nucleus, green = cytoplasm). "
         "(B) Neutrophil releasing nuclear material forming NETs. "
         "(C) Electron micrograph showing bacteria (staphylococci) trapped in NETs. (Robbins)")
S += [SP(10)]

# ─── MEDIATORS ────────────────────────────────────────────────────────────────
S += [
    h1("MEDIATORS OF INFLAMMATION"),
    p("Chemical mediators are the <b>molecules that initiate, amplify, and terminate inflammation</b>. "
      "They are derived from plasma (produced in the liver and circulate as inactive precursors) "
      "or from cells (produced or stored in cells and released on activation). "
      "Most mediators are <b>short-lived</b> β€” they quickly decay, are inactivated by enzymes, or are scavenged."),
    SP(8),
    h2("A. Cell-Derived Mediators"),
    SP(4),
    tbl(["Mediator", "Source", "Actions", "Pharmacology / Key Facts"],
        [
            [tc("HISTAMINE",bold=True,color=C_YELLOW),
             tc("Mast cells (main source), basophils, platelets\n(stored preformed in granules)"),
             tc("β€’ Vasodilation of arterioles\nβ€’ ↑ Venule permeability\nβ€’ Endothelial activation"),
             tc("FIRST mediator released (preformed)\nH1 receptor on endothelium\nAntihistamines block H1 (e.g. diphenhydramine)\nTriggered by IgE, C3a/C5a, cold, trauma")],
            [tc("SEROTONIN (5-HT)"),
             tc("Platelets, enterochromaffin cells of GI"),
             tc("β€’ Vasodilation\nβ€’ ↑ Vascular permeability"),
             tc("Similar to histamine\nReleased during platelet aggregation")],
            [tc("PROSTAGLANDINS\n(PGs)",bold=True,color=C_YELLOW),
             tc("Mast cells, leukocytes\nvia COX-1/COX-2 from arachidonic acid"),
             tc("β€’ Vasodilation (PGI2, PGE1, PGE2)\nβ€’ PAIN sensitisation\nβ€’ FEVER (PGE2 acts on hypothalamus)\nβ€’ ↑ Permeability"),
             tc("Blocked by:\nβ€’ Aspirin (irreversible COX inhibitor)\nβ€’ NSAIDs (reversible COX inhibitor)\nβ€’ Corticosteroids (block phospholipase A2)")],
            [tc("LEUKOTRIENES\n(LTs)",bold=True,color=C_YELLOW),
             tc("Mast cells, eosinophils, leukocytes\nvia 5-LOX from arachidonic acid"),
             tc("β€’ LTB4 β†’ chemotaxis, neutrophil activation\nβ€’ LTC4, LTD4, LTE4 β†’ vasoconstriction, bronchoconstriction, ↑ permeability"),
             tc("Key in ASTHMA\nBlocked by:\nβ€’ Zileuton (5-LOX inhibitor)\nβ€’ Montelukast/Zafirlukast (LTD4 receptor blocker)\nβ€’ Corticosteroids (phospholipase A2 inhibition)")],
            [tc("PAF\n(Platelet-Activating Factor)"),
             tc("Leukocytes, mast cells, endothelium, platelets"),
             tc("β€’ Platelet aggregation\nβ€’ Vasodilation, ↑ permeability\nβ€’ Bronchospasm (potent)\nβ€’ Neutrophil priming"),
             tc("Active at picomolar concentrations\nPlays role in anaphylaxis and severe asthma")],
            [tc("ROS\n(Reactive Oxygen Species)"),
             tc("Neutrophils, macrophages (oxidative burst)"),
             tc("β€’ Microbicidal (HOCl most potent)\nβ€’ Tissue injury (host damage too)\nβ€’ Inactivate antiproteases"),
             tc("Generated by NADPH oxidase\nHOCl from MPO is most potent\nCan damage own host tissues")],
            [tc("NITRIC OXIDE (NO)"),
             tc("Endothelium (eNOS β€” constitutive)\nMacrophages (iNOS β€” induced by IFN-Ξ³)"),
             tc("β€’ Vasodilation (key homeostatic role)\nβ€’ Microbicidal in macrophages\nβ€’ Inhibits platelet aggregation"),
             tc("eNOS: always on β€” vascular tone\niNOS: induced during inflammation\nReacts with O₂⁻ β†’ Peroxynitrite (ONOO⁻) β€” very toxic")],
            [tc("IL-1 & TNF",bold=True,color=C_RED),
             tc("Macrophages mainly\nAlso: endothelium, mast cells, T-cells"),
             tc("β€’ FEVER (via PGE2 in hypothalamus)\nβ€’ Acute phase response\nβ€’ Leukocyte recruitment\nβ€’ Endothelial activation\nβ€’ Catabolism, weight loss"),
             tc("'ENDOGENOUS PYROGENS'\nTNF also: Septic shock, DIC\nBlocked by: Infliximab, etanercept, adalimumab\nIL-1 blocked by: Anakinra")],
            [tc("IL-6"),
             tc("Macrophages, endothelium, T-cells"),
             tc("β€’ Induces acute phase proteins in liver (CRP, fibrinogen, SAA)\nβ€’ ↑ ESR\nβ€’ B cell differentiation"),
             tc("Main inducer of acute phase response\nBlocked by: Tocilizumab (IL-6 receptor)\nCRP activates complement, opsonises")],
            [tc("IL-8 (CXCL8)",bold=True,color=C_YELLOW),
             tc("Macrophages, endothelium, T-cells"),
             tc("β€’ NEUTROPHIL chemotaxis (primary chemokine)\nβ€’ Activates integrins on neutrophils"),
             tc("Key CXC chemokine\nMajor regulator of neutrophil recruitment")],
        ],
        widths=[TW*0.16, TW*0.20, TW*0.31, TW*0.33]),
    SP(10),
]

# Arachidonic Acid
S += [
    h2("B. Arachidonic Acid Pathway β€” KEY EXAM DIAGRAM"),
    SP(6),
]
S += img("fig2_6_arachidonic.png", TW,
         "FIG 2.6  Arachidonic acid metabolites and their roles in inflammation. "
         "COX pathway β†’ prostaglandins and thromboxane. 5-LOX pathway β†’ leukotrienes. "
         "Lipoxins are anti-inflammatory. Clinically relevant drug targets shown in red. (Robbins)")
S += [
    SP(6),
    tbl(["Pathway", "Enzyme", "Products", "Drug Inhibitor"],
        [
            [tc("COX Pathway",bold=True,color=C_YELLOW),
             tc("Cyclooxygenase (COX-1, COX-2)"),
             tc("β€’ Prostaglandins (PGE2, PGI2, PGD2) β€” vasodilation, pain, fever\nβ€’ Thromboxane A2 (TXA2) β€” platelet aggregation, vasoconstriction\nβ€’ Prostacyclin (PGI2) β€” inhibits platelet aggregation, vasodilation"),
             tc("Aspirin (irreversible, COX-1+2)\nNSAIDs (reversible, COX-1+2)\nCelecoxib (selective COX-2)\nCorticosteroids (upstream β€” PLA2)")],
            [tc("5-LOX Pathway",bold=True,color=C_YELLOW),
             tc("5-Lipoxygenase (5-LOX)"),
             tc("β€’ LTB4 β€” chemotaxis of neutrophils\nβ€’ LTC4, LTD4, LTE4 (cysteinyl LTs) β€” bronchoconstriction, vasoconstriction, ↑ permeability\n(Key in ASTHMA)"),
             tc("Zileuton (5-LOX inhibitor)\nMontelukast/Zafirlukast (LTD4 receptor)\nCorticosteroids (upstream β€” PLA2)")],
            [tc("Lipoxin Pathway\n(Anti-inflammatory)",bold=True,color=C_TEAL),
             tc("12-LOX / 5-LOX in collaboration with platelets"),
             tc("β€’ Lipoxins (LXA4, LXB4) β€” INHIBIT neutrophil recruitment\nβ€’ Resolvins β€” promote resolution of acute inflammation"),
             tc("Aspirin-triggered lipoxins (ATL) β€” formed when aspirin-acetylated COX-2 generates 15-HETE intermediates")],
        ],
        widths=[TW*0.18, TW*0.20, TW*0.38, TW*0.24]),
    SP(4),
    key("CORTICOSTEROIDS block PHOSPHOLIPASE A2 (via lipocortin/annexin-1) β†’ NO arachidonic acid released β†’ BOTH prostaglandins AND leukotrienes blocked. This is why steroids have the broadest anti-inflammatory effect."),
    SP(10),
]

# Plasma-derived mediators
S += [
    h2("C. Plasma-Derived Mediators"),
    SP(4),
    tbl(["System", "Key Components", "Actions in Inflammation"],
        [
            [tc("COMPLEMENT SYSTEM",bold=True,color=C_YELLOW),
             tc("C1q, C2, C3, C4, C5, MAC (C5b-9)\nActivated by:\nβ€’ Classical (antigen-antibody)\nβ€’ Lectin (MBL pathway)\nβ€’ Alternative (microbial surfaces)"),
             tc("C3a, C5a β†’ ANAPHYLATOXINS β†’ mast cell degranulation β†’ histamine release\nC5a β†’ CHEMOTAXIS (most potent chemotactic agent) + ↑ permeability\nC3b β†’ OPSONIN (coats microbes for phagocytosis by CR1)\nMAC (C5b-9) β†’ LYSIS of gram-negative bacteria and cells")],
            [tc("KININ SYSTEM",bold=True,color=C_YELLOW),
             tc("Hageman factor (F-XII) activates\n→ Prekallikrein → Kallikrein\n→ Kininogen → BRADYKININ"),
             tc("Bradykinin (most important kinin):\nβ€’ ↑ Vascular permeability\nβ€’ Vasodilation\nβ€’ PAIN (most important pain mediator in inflammation)\nβ€’ Bronchoconstriction\nInactivated by ACE (kininase II)")],
            [tc("COAGULATION SYSTEM"),
             tc("F-XII activates both kinin and coagulation\nThrombin, Fibrin, Fibrinopeptides"),
             tc("Thrombin: ↑ permeability, endothelial activation\nFibrinopeptides: chemotaxis\nLinked to kinin system via Hageman factor")],
        ],
        widths=[TW*0.22, TW*0.32, TW*0.46]),
    SP(10),
]

# ─── MORPHOLOGIC PATTERNS ─────────────────────────────────────────────────────
S += [
    h1("MORPHOLOGIC PATTERNS OF ACUTE INFLAMMATION"),
    SP(4),
    tbl(["Pattern", "Characteristics", "Classic Examples"],
        [
            [tc("SEROUS",bold=True,color=C_BLUE),
             tc("Watery, low-protein fluid (from plasma or mesothelial cells)\nNo pus; minimal cell content"),
             tc("Skin blisters (burns, vesicles in herpes)\nPleural effusion (early TB)\nPericardial effusion\n'Straw-coloured' fluid")],
            [tc("FIBRINOUS",bold=True,color=C_YELLOW),
             tc("Fibrin exudate when vascular leak is large enough for fibrinogen\n→ Fibrin strands form meshwork on surfaces"),
             tc("Fibrinous PERICARDITIS β€” 'bread and butter' pericarditis (friction rub)\nLobar pneumonia (red/grey hepatisation)\nFibrinous peritonitis")],
            [tc("PURULENT\n(SUPPURATIVE)",bold=True,color=C_RED),
             tc("PUS = neutrophils + necrotic cell debris + bacteria + edema fluid\nLiquefactive necrosis\nAbscesses = walled-off pus collections"),
             tc("Acute appendicitis\nBrain abscess (staph/strep)\nEmpyema (pus in pleural cavity)\nFurunculosis (boil)")],
            [tc("ULCERATIVE"),
             tc("Surface necrosis + inflammation β†’ defect (excavation)\nBoth acute and chronic inflammation may coexist"),
             tc("Peptic ulcer (stomach/duodenum)\nAphthous ulcer (mouth)\nVaricose ulcer (venous stasis)")],
            [tc("PSEUDOMEMBRANOUS",bold=True,color=C_PURPLE),
             tc("Necrotic cells + neutrophils + fibrin form grey-white membrane\non mucosal surfaces that peels off ('pseudo' as it is not real)"),
             tc("C. difficile colitis ('pseudomembranous colitis')\nDiphtheria (pharynx/larynx)\nNecrotising enterocolitis (neonates)")],
            [tc("HEMORRHAGIC"),
             tc("Severe vascular damage β†’ extravasation of RBCs into exudate"),
             tc("Anthrax (malignant pustule)\nPlague (Yersinia)\nHerpes encephalitis\nCapnocytophaga infections")],
        ],
        widths=[TW*0.18, TW*0.37, TW*0.45]),
    SP(8),
]
S += img("fig2_10_fibrinous.png", TW*0.8,
         "FIG 2.10  Fibrinous pericarditis. (A) Gross β€” fibrin deposits on pericardium giving the classic 'bread and butter' appearance. "
         "(B) Histology β€” pink meshwork of fibrin (F) overlying pericardial surface (P). (Robbins)")
S += [SP(6)]
S += img("fig2_11_abscess.png", TW*0.85,
         "FIG 2.11  Purulent inflammation β€” lung abscess. (A) Multiple bacterial abscesses in bronchopneumonia. "
         "(B) Abscess = central neutrophils + necrotic debris surrounded by congested blood vessels. (Robbins)")
S += [SP(10)]

# ─── OUTCOMES ─────────────────────────────────────────────────────────────────
S += [
    h1("OUTCOMES OF ACUTE INFLAMMATION"),
    SP(4),
]
S += img("fig2_13_outcomes.png", TW,
         "FIG 2.13  Outcomes of acute inflammation. Three possible outcomes: (1) Resolution β€” complete tissue restoration; "
         "(2) Chronic inflammation β€” when injurious agent persists; (3) Healing by fibrosis/scarring. (Robbins)")
S += [
    SP(6),
    tbl(["Outcome", "When?", "What Happens?", "Examples"],
        [
            [tc("RESOLUTION",bold=True,color=C_TEAL),
             tc("Minimal damage; tissue capable of regeneration"),
             tc("Complete restoration of tissue to normal structure\nEdema resorbed, leukocytes die/leave, tissue regenerates"),
             tc("Lobar pneumonia (complete resolution)\nSkin laceration in a healthy person")],
            [tc("ABSCESS FORMATION",bold=True,color=C_YELLOW),
             tc("Pyogenic bacterial infection"),
             tc("Central necrosis + pus walled off by fibrous capsule\nMay drain spontaneously or need I&D"),
             tc("Staphylococcal skin abscess\nBrain abscess")],
            [tc("FIBROSIS / SCARRING",bold=True,color=C_PURPLE),
             tc("Tissue that cannot regenerate; severe damage"),
             tc("Granulation tissue β†’ connective tissue replacement\nLoss of normal architecture"),
             tc("Myocardial infarction β†’ cardiac scar\nLiver cirrhosis β†’ hepatic fibrosis")],
            [tc("CHRONIC INFLAMMATION",bold=True,color=C_RED),
             tc("Offending agent not eliminated; persistent irritant"),
             tc("Transition to chronic state with mononuclear infiltrate\nTissue destruction + repair occur simultaneously"),
             tc("TB (persistent mycobacteria)\nCrohn's disease\nRheumatoid arthritis")],
        ],
        widths=[TW*0.20, TW*0.22, TW*0.30, TW*0.28]),
    SP(10),
]

# ─── CHRONIC INFLAMMATION ─────────────────────────────────────────────────────
S += [
    PageBreak(),
    h1("CHRONIC INFLAMMATION"),
    p("Chronic inflammation is characterised by <b>prolonged inflammation (weeks to months to years)</b> "
      "in which tissue destruction and repair attempts occur <b>simultaneously</b>. "
      "It is not simply a prolonged acute inflammation β€” it has distinct features."),
    SP(6),
    h2("Causes"),
    b("<b>Persistent infections</b> β€” pathogens that resist eradication: "
      "TB (Mycobacterium), syphilis (Treponema), fungal infections, helminths β€” these typically cause <b>granulomatous</b> inflammation"),
    b("<b>Hypersensitivity and Autoimmune Diseases</b> β€” the immune reaction becomes self-perpetuating: "
      "Rheumatoid arthritis, SLE, MS, IBD (Crohn's, UC), asthma, autoimmune hepatitis"),
    b("<b>Prolonged exposure to potentially toxic agents</b> β€” exogenous (silica dust β†’ silicosis; asbestos β†’ mesothelioma) "
      "or endogenous (cholesterol β†’ atherosclerosis, urate crystals β†’ gout)"),
    b("<b>Some forms without obvious inciting stimulus</b> β€” Alzheimer's disease (neuroinflammation), metabolic syndrome, Type 2 DM, obesity"),
    SP(6),
    h2("Morphologic Features of Chronic Inflammation (TRIAD)"),
    tbl(["Feature", "Description"],
        [
            [tc("1. Mononuclear infiltrate",bold=True,color=C_YELLOW),
             tc("Macrophages (predominant), lymphocytes (T and B cells), plasma cells")],
            [tc("2. Tissue destruction",bold=True,color=C_RED),
             tc("Caused by persistent offending agent AND by inflammatory cells themselves (ROS, proteases, cytokines)")],
            [tc("3. Repair / Fibrosis",bold=True,color=C_BLUE),
             tc("Simultaneous attempts at healing: angiogenesis (new vessel formation) + fibroblast activation + collagen deposition β†’ SCAR")],
        ],
        widths=[TW*0.30, TW*0.70]),
    SP(8),
]

S += img("fig2_14_chronic.png", TW*0.8,
         "FIG 2.14  Chronic inflammation in the lung. Dense infiltrate of lymphocytes and macrophages in the lung parenchyma. "
         "Note the absence of the predominant neutrophilic infiltrate seen in acute inflammation. (Robbins)")
S += [SP(8)]

# Cells of chronic inflammation
S += [
    h2("Key Cells in Chronic Inflammation"),
    SP(4),
    h3("Macrophages β€” THE MOST IMPORTANT CELL"),
    p("Macrophages are the central mediators of chronic inflammation. They are derived from circulating blood monocytes "
      "that differentiate in tissues. Some tissue-resident macrophages (Kupffer cells in liver, microglia in brain, "
      "alveolar macrophages in lung) are derived from embryonic precursors."),
    SP(4),
]
S += img("fig2_16_macrophage.png", TW*0.85,
         "FIG 2.16  Macrophage maturation. (A) Most tissue macrophages in inflammatory reactions are derived from bone marrow haematopoietic stem cells. "
         "(B) Some tissue-resident macrophages (Kupffer cells, microglia) are derived from embryonic yolk sac precursors. (Robbins)")
S += [SP(6)]
S += img("fig2_17_m1_m2.png", TW,
         "FIG 2.17  Classical (M1) vs Alternative (M2) macrophage activation. "
         "M1 macrophages (activated by IFN-Ξ³, LPS) are pro-inflammatory and microbicidal. "
         "M2 macrophages (activated by IL-4, IL-13) are anti-inflammatory and promote repair/fibrosis. (Robbins)")
S += [
    SP(6),
    tbl(["Property", "M1 Macrophage (Classical)", "M2 Macrophage (Alternative)"],
        [
            [tc("Activation stimulus"),    tc("IFN-Ξ³ (from T-helper cells), LPS (microbial)"),    tc("IL-4, IL-13 (from Th2 cells, mast cells, eosinophils)")],
            [tc("Functions",bold=True),    tc("Pro-inflammatory: kill microbes, produce ROS/NO\nKill tumour cells\nPresent antigens to T-cells"), tc("Anti-inflammatory: tissue repair\nCollagen synthesis via TGF-Ξ²\nAngiogenesis via VEGF")],
            [tc("Cytokines produced"),     tc("IL-1, TNF, IL-6, IL-12 (pro-inflammatory)"),       tc("IL-10, TGF-Ξ² (anti-inflammatory), PDGF, VEGF")],
            [tc("Role in pathology"),      tc("Tissue injury in chronic inflammation\nImportant for killing intracellular pathogens"),            tc("Fibrosis in chronic disease\nTumour progression (tumour-associated macrophages)")],
        ],
        widths=[TW*0.22, TW*0.39, TW*0.39]),
    SP(8),

    h3("Other Key Cells"),
    tbl(["Cell", "Activation / Origin", "Key Functions", "Disease Associations"],
        [
            [tc("CD4+ T-helper\nLymphocytes",bold=True,color=C_YELLOW),
             tc("Activated by macrophage (antigen presentation + IL-12)"),
             tc("β€’ Secrete IFN-Ξ³ β†’ activate macrophages (M1)\nβ€’ Amplify inflammation\nβ€’ Coordinate adaptive immunity"),
             tc("Central to granuloma formation\nTB, Sarcoidosis, Crohn's")],
            [tc("CD8+ T-cytotoxic\nLymphocytes"),
             tc("Activated by MHC I presentation (viral/tumour antigens)"),
             tc("β€’ Kill virus-infected cells and tumour cells\nβ€’ Perforin/granzyme pathway + FasL"),
             tc("Viral infections\nAutoimmune tissue damage")],
            [tc("B Lymphocytes\n→ Plasma cells"),
             tc("Activated by antigen + T-cell help (CD40L, IL-4)"),
             tc("β€’ Differentiate into plasma cells β†’ produce antibodies\nβ€’ Antibodies opsonise antigens"),
             tc("RA (anti-CCP), SLE (anti-dsDNA)\nSjΓΆgren's syndrome")],
            [tc("Eosinophils",bold=True,color=C_BLUE),
             tc("Recruited by IL-5 (from Th2 cells, mast cells)"),
             tc("β€’ Kill helminths (Major Basic Protein, eosinophil cationic protein)\nβ€’ Release ROS, enzymes β€” also cause tissue damage"),
             tc("Allergic diseases (asthma, allergic rhinitis)\nHelminth infections\nEosinophilic oesophagitis")],
            [tc("Mast cells"),
             tc("Bone marrow precursors β†’ reside in connective tissue"),
             tc("β€’ Sentinel cells β€” IgE cross-linking β†’ degranulation\nβ€’ Release histamine, heparin, proteases, cytokines"),
             tc("Acute allergic reactions (anaphylaxis)\nAlso contribute to chronic inflammation")],
        ],
        widths=[TW*0.16, TW*0.24, TW*0.32, TW*0.28]),
    SP(10),
]

# ─── GRANULOMATOUS ────────────────────────────────────────────────────────────
S += [
    h1("GRANULOMATOUS INFLAMMATION"),
    p("Granulomatous inflammation is a <b>distinctive pattern of chronic inflammation</b> characterised by "
      "aggregates of activated macrophages called <b>epithelioid cells</b>, often with "
      "<b>multinucleated giant cells</b>, surrounded by a rim of lymphocytes."),
    SP(6),
    h2("Structure of a Granuloma"),
    tbl(["Layer (outer to inner)", "Cell/Content", "Notes"],
        [
            [tc("Outer fibrotic rim"),         tc("Fibroblasts + collagen (mature lesion)"),    tc("Walls off the lesion β€” prevents spread")],
            [tc("Lymphocyte rim",bold=True),   tc("CD4+ T-helper lymphocytes"),                  tc("Provide IFN-Ξ³ to maintain macrophage activation")],
            [tc("Epithelioid cells",bold=True,color=C_YELLOW),
             tc("Activated macrophages β€” elongated, pale cytoplasm, 'footprint-shaped' nucleus"),
             tc("'Epithelioid' = they look like epithelial cells but are macrophages")],
            [tc("Multinucleated Giant Cells",bold=True,color=C_YELLOW),
             tc("Fusion of multiple epithelioid macrophages"),
             tc("See types table below")],
            [tc("Central Zone",bold=True,color=C_RED),
             tc("CASEOUS NECROSIS (TB) β€” cheesy, amorphous, eosinophilic\nOR: No necrosis (Sarcoidosis = 'naked granuloma')"),
             tc("Presence of caseous necrosis strongly suggests TB")],
        ],
        widths=[TW*0.24, TW*0.40, TW*0.36]),
    SP(6),
]
S += img("fig2_19_granuloma.png", TW*0.8,
         "FIG 2.19  Granulomatous inflammation (TB). Central zone of caseous necrosis surrounded by "
         "epithelioid macrophages, multinucleated Langhans giant cells, and a rim of lymphocytes. (Robbins)")
S += [
    SP(6),
    h2("Types of Multinucleated Giant Cells β€” HIGH YIELD"),
    tbl(["Giant Cell Type", "Nuclear Pattern", "Disease / Context"],
        [
            [tc("LANGHANS Giant Cell",bold=True,color=C_RED),
             tc("Nuclei arranged at PERIPHERY of the cell β€” horseshoe / U-shaped arrangement\n(like soldiers at the rim)"),
             tc("TUBERCULOSIS (classic β€” Mycobacterium tuberculosis)\nAlso: other mycobacterial infections, brucellosis")],
            [tc("Foreign Body Giant Cell"),
             tc("Nuclei SCATTERED RANDOMLY throughout the cytoplasm\n(like stars in the sky)"),
             tc("Foreign material: splinters, sutures, talc, silica, urate crystals in gout, breast implants")],
            [tc("TOUTON Giant Cell",bold=True,color=C_YELLOW),
             tc("Nuclei arranged in a RING, with foamy (lipid-laden) cytoplasm outside the ring"),
             tc("Xanthoma, fat necrosis, juvenile xanthogranuloma, dermatofibroma")],
            [tc("ASCHOFF Cell\n(Aschoff Giant Cell)"),
             tc("'Caterpillar nucleus' (Anitschkow cell) or multinucleated Aschoff cell\n'Owl-eye' chromatin pattern"),
             tc("RHEUMATIC FEVER β€” Aschoff bodies in myocardium\n(Aschoff body = granuloma of rheumatic carditis)")],
            [tc("Warthin-Finkeldey Giant Cell"),
             tc("Very large, many nuclei β€” lymphoid follicles"),
             tc("MEASLES (pathognomonic) β€” also in HIV lymph nodes")],
        ],
        widths=[TW*0.24, TW*0.38, TW*0.38]),
    SP(6),
    h2("Granulomatous Diseases β€” Must Know"),
    tbl(["Disease", "Granuloma Type", "Special Features / Histology"],
        [
            [tc("TUBERCULOSIS",bold=True,color=C_RED),
             tc("CASEATING granuloma"),
             tc("Langhans giant cells; ZN stain acid-fast bacilli; Ghon focus (primary); ghon complex (+ lymph node + calcification)")],
            [tc("SARCOIDOSIS",bold=True,color=C_YELLOW),
             tc("NON-CASEATING 'naked' granuloma"),
             tc("Schaumann bodies (concentric calcification), asteroid bodies\n↑ ACE, ↑ Serum + urine calcium\nKveim test (now rarely done)\nBilateral hilar lymphadenopathy on CXR")],
            [tc("CROHN'S DISEASE"),
             tc("Non-caseating granuloma (in ~50% of biopsies)"),
             tc("Transmural inflammation, skip lesions, cobblestone mucosa, fistulae, fissures; perianal disease")],
            [tc("LEPROSY"),
             tc("Tuberculoid: well-formed, few bacilli\nLepromatous: macrophages packed with bacilli (Virchow cells) β€” NO granuloma"),
             tc("Wade-Fite stain for bacilli\nLepromin test: positive in tuberculoid, negative in lepromatous")],
            [tc("SYPHILIS (tertiary)"),
             tc("Gumma β€” rubbery granuloma-like lesion"),
             tc("Endarteritis obliterans (adventitial fibrosis, vessel lumen narrowed)\nPlasma cells prominent")],
            [tc("CAT-SCRATCH DISEASE"),
             tc("Stellate/suppurative granuloma β€” central necrosis"),
             tc("Bartonella henselae\nWarthin-Starry silver stain for organisms")],
            [tc("HISTOPLASMOSIS\nCOCCIDIOIDOMYCOSIS"),
             tc("Caseating or non-caseating"),
             tc("Histo: small oval yeast IN macrophages (GMS stain)\nCocci: spherules with endospores (20–60 Β΅m)")],
            [tc("BERYLLIOSIS"),
             tc("Non-caseating (identical to sarcoidosis)"),
             tc("Occupational exposure (aerospace, nuclear, electronics)\nCXR identical to sarcoidosis β€” need exposure history")],
            [tc("WEGENER'S / GPA"),
             tc("Necrotising GRANULOMATOUS vasculitis"),
             tc("c-ANCA (PR3) positive; upper + lower respiratory tract + kidneys (rapidly progressive GN)")],
        ],
        widths=[TW*0.18, TW*0.23, TW*0.59]),
    SP(4),
    mnem("Caseating granulomas: THE BCG = TB Β· Histoplasmosis Β· Eosinophilic granuloma Β· Brucellosis Β· Coccidioidomycosis Β· Giant cell arteritis"),
    SP(10),
]

# ─── SYSTEMIC EFFECTS ─────────────────────────────────────────────────────────
S += [
    h1("SYSTEMIC EFFECTS OF INFLAMMATION β€” ACUTE PHASE RESPONSE"),
    p("Even when inflammation is localised, cytokines released by activated macrophages (IL-1, TNF, IL-6) "
      "enter the circulation and cause systemic effects. These are more severe in acute than chronic inflammation."),
    SP(6),
    tbl(["Systemic Effect", "Key Mediator(s)", "Mechanism & Notes"],
        [
            [tc("FEVER",bold=True,color=C_RED),
             tc("IL-1, TNF, IL-6 β†’ PGE2 (final mediator)"),
             tc("Cytokines stimulate COX in hypothalamic vascular cells β†’ PGE2 β†’ acts on anterior hypothalamus β†’ ↑ thermostat set-point\nFever: 'fight' against infection (bacteriostatic β€” impairs bacterial replication)\nBlocked by: Aspirin, NSAIDs (↓ PGE2 synthesis)")],
            [tc("LEUKOCYTOSIS",bold=True,color=C_YELLOW),
             tc("IL-1, TNF, G-CSF, M-CSF"),
             tc("↑ Bone marrow production + mobilisation from marginating/storage pools\nBacterial: Neutrophilia + LEFT SHIFT (bands = immature neutrophils)\nLeukocytosis > 40,000 = LEUKEMOID REACTION (benign; ↑ LAP score vs CML where LAP is low)")],
            [tc("↑ ACUTE PHASE\nPROTEINS (APPs)"),
             tc("IL-6 (main inducer)\nAlso IL-1, TNF"),
             tc("Liver produces:\nβ€’ CRP (C-reactive protein) β€” activates complement, opsonises; rises 1000x, very sensitive\nβ€’ Fibrinogen β†’ ↑ ESR (rouleaux formation)\nβ€’ SAA (Serum Amyloid A) β€” chronic β†’ AA amyloidosis if sustained\nβ€’ Haptoglobin, ferritin, complement proteins\n↑ ESR and ↑ CRP = markers of inflammation")],
            [tc("ANAEMIA\n(Chronic Disease)",bold=True),
             tc("Hepcidin (liver, induced by IL-6)"),
             tc("Hepcidin β†’ degrades ferroportin β†’ ↓ iron release from macrophages + ↓ GI iron absorption\nβ†’ ↓ serum iron despite adequate stores β†’ normocytic/microcytic anaemia\n(Serum ferritin HIGH, serum iron LOW, TIBC LOW β€” differentiates from iron-deficiency where TIBC is HIGH)")],
            [tc("WEIGHT LOSS /\nCACHEXIA",bold=True),
             tc("TNF (primary), IL-1, IL-6"),
             tc("TNF suppresses appetite, increases energy expenditure, induces lipolysis\nSeen in chronic infection (TB), cancer, AIDS\nAlso called 'cachexin' (old name for TNF)")],
            [tc("SEPTIC SHOCK",bold=True,color=C_RED),
             tc("TNF (massive release)\n+ IL-1, IL-6, IL-12"),
             tc("Overwhelming gram-negative sepsis (LPS) β†’ massive TNF β†’ vasodilation, ↑ permeability\nβ†’ Hypotension + DIC + Multi-organ failure (MODS)\nTreatment: vasopressors, broad-spectrum antibiotics, supportive care")],
        ],
        widths=[TW*0.18, TW*0.20, TW*0.62]),
    SP(8),
]

# WBC patterns
S += [
    h2("WBC Patterns β€” HIGH YIELD EXAM TABLE"),
    tbl(["Condition / Disease", "WBC Pattern", "Specific Notes"],
        [
            [tc("Bacterial infection (most)",bold=True,color=C_YELLOW),
             tc("Neutrophilia + Left shift (bands)", bold=True),
             tc("'Left shift' = ↑ immature neutrophils (bands, metamyelocytes, myelocytes)")],
            [tc("Viral infection"),               tc("Lymphocytosis",bold=True,color=C_BLUE),      tc("Reactive lymphocytes / atypical lymphocytes in EBV")],
            [tc("Allergic / Parasitic"),           tc("Eosinophilia",bold=True,color=C_TEAL),       tc("Also: drug reactions, Churg-Strauss, hypereosinophilic syndrome")],
            [tc("Whooping cough (Pertussis)",bold=True), tc("LYMPHOCYTOSIS (exception!)",bold=True,color=C_RED), tc("Exception! Bacterial but causes lymphocytosis due to lymphocyte-promoting factor toxin")],
            [tc("Typhoid fever (Salmonella typhi)"),tc("Leukopenia / Neutropenia",bold=True),      tc("Relative lymphocytosis; also: rickettsial infections, brucellosis, dengue")],
            [tc("Infectious mononucleosis (EBV)"), tc("Lymphocytosis + atypical lymphocytes",bold=True), tc("Downey cells (large, purple, coffee-bean nucleus); Monospot test +ve")],
        ],
        widths=[TW*0.28, TW*0.30, TW*0.42]),
    SP(10),
]

# ─── CARDINAL SIGNS ───────────────────────────────────────────────────────────
S += [
    h1("CARDINAL SIGNS OF INFLAMMATION"),
    SP(4),
    tbl(["Latin Term", "English", "Mechanism", "Mediator(s)"],
        [
            [tc("RUBOR",bold=True,color=C_RED),     tc("Redness"),           tc("Vasodilation β†’ ↑ blood flow"),                              tc("Histamine, NO, PGs")],
            [tc("CALOR",bold=True,color=C_YELLOW),  tc("Heat"),              tc("↑ Blood flow + ↑ local metabolic activity"),                 tc("Histamine, NO, PGs")],
            [tc("TUMOR",bold=True,color=C_BLUE),    tc("Swelling"),          tc("↑ Vascular permeability β†’ fluid leak β†’ oedema"),             tc("Histamine, bradykinin, C3a/C5a, LTs")],
            [tc("DOLOR",bold=True,color=C_PURPLE),  tc("Pain"),              tc("Sensitisation of nociceptors (pain threshold ↓)"),           tc("Bradykinin (most potent), PGE2, substance P")],
            [tc("FUNCTIO LAESA",bold=True),         tc("Loss of function"),  tc("Combined effects of all above + inhibition of movement"),    tc("All mediators (added by Rudolf Virchow)")],
        ],
        widths=[TW*0.18, TW*0.16, TW*0.36, TW*0.30]),
    SP(10),
]

# ─── PHARMACOLOGY ─────────────────────────────────────────────────────────────
S += [
    h1("PHARMACOLOGY OF ANTI-INFLAMMATORY DRUGS"),
    SP(4),
    tbl(["Drug / Class", "Mechanism of Action", "Clinical Use", "Key Side Effects"],
        [
            [tc("ASPIRIN",bold=True,color=C_RED),
             tc("IRREVERSIBLE inhibitor of COX-1 and COX-2\n(acetylates serine residue)\nβ†’ ↓ PGs, ↓ TXA2"),
             tc("β€’ Anti-inflammatory (high dose)\nβ€’ Antipyretic\nβ€’ Analgesic\nβ€’ Antiplatelet (low dose 81 mg/day)"),
             tc("GI ulceration (↓ PGE2 mucosal protection)\nReye's syndrome in children (viral illness)\nAspirin-exacerbated asthma\nTinnitus (high dose)")],
            [tc("NSAIDs\n(Ibuprofen, Naproxen,\nDiclofenac)",bold=True,color=C_YELLOW),
             tc("REVERSIBLE inhibitor of COX-1 and COX-2\nβ†’ ↓ Prostaglandins"),
             tc("β€’ Anti-inflammatory\nβ€’ Antipyretic\nβ€’ Analgesic"),
             tc("GI ulcers (COX-1 blockade)\nRenal impairment (↓ renal PGs)\nFluid retention\nHypertension")],
            [tc("CELECOXIB\n(selective COX-2)",bold=True),
             tc("Selective COX-2 inhibitor\nβ†’ ↓ PGs at inflammation site\nSpares COX-1 (GI protection, platelet TXA2)"),
             tc("β€’ Anti-inflammatory\nβ€’ Analgesic\nβ€’ RA, OA"),
             tc("↑ CV risk (TXA2 still active, PGI2 reduced)\nLess GI side effects than non-selective NSAIDs")],
            [tc("CORTICOSTEROIDS\n(Prednisolone,\nDexamethasone)",bold=True,color=C_RED),
             tc("Inhibit PHOSPHOLIPASE A2 via\nlipocortin/annexin-1 induction\nβ†’ Block BOTH PG and LT synthesis\nAlso: ↓ cytokine transcription (NF-ΞΊB inhibition),\n↓ adhesion molecule expression"),
             tc("β€’ Severe acute inflammation\nβ€’ Autoimmune disease (RA, SLE)\nβ€’ Allergic reactions\nβ€’ Asthma\nβ€’ Transplant rejection\nβ€’ Adrenal insufficiency"),
             tc("Diabetes, Osteoporosis, Cushing's\nImmunosuppression β†’ infections\nHypertension, Peptic ulcer\nCataracts, Glaucoma\nAdrenal suppression (HPA axis)")],
            [tc("ZILEUTON"),
             tc("5-LOX (5-lipoxygenase) inhibitor\n→ Blocks ALL leukotriene synthesis\n(LTB4 + cysteinyl LTs)"),
             tc("β€’ Asthma (add-on)"),
             tc("↑ Liver enzymes (monitor LFTs)")],
            [tc("MONTELUKAST\nZAFIRLUKAST"),
             tc("CysLT1 (LTD4/LTE4) receptor antagonist\nβ†’ Block bronchoconstriction and ↑ permeability"),
             tc("β€’ Asthma\nβ€’ Allergic rhinitis"),
             tc("Generally well tolerated\nMontelukast: neuropsychiatric side effects (FDA warning)")],
            [tc("ANTIHISTAMINES\n1st gen (Diphenhydramine)\n2nd gen (Cetirizine)"),
             tc("H1 receptor antagonist\nβ†’ Block histamine's effects\n(vasodilation, ↑ permeability, smooth muscle)"),
             tc("β€’ Allergic rhinitis\nβ€’ Urticaria\nβ€’ Anaphylaxis (adjunct)\nβ€’ Insomnia (1st gen)"),
             tc("1st gen: sedating (CNS penetration)\n2nd gen: non-sedating (less CNS penetration)")],
            [tc("COLCHICINE"),
             tc("Inhibits microtubule polymerisation\nβ†’ ↓ neutrophil migration and degranulation\nβ†’ ↓ NLRP3 inflammasome activation (↓ IL-1Ξ²)"),
             tc("β€’ Acute gout flare\nβ€’ Gout prophylaxis\nβ€’ Familial Mediterranean fever (FMF)\nβ€’ Pericarditis"),
             tc("GI side effects (diarrhoea, nausea)\nMyopathy (rare)\nNarrowing of therapeutic window")],
            [tc("ANTI-TNF BIOLOGICS\n(Infliximab, Etanercept\nAdalimumab)"),
             tc("Block TNF β†’ ↓ downstream inflammation\n(endothelial activation, leukocyte recruitment, fever)"),
             tc("β€’ Rheumatoid arthritis\nβ€’ IBD (Crohn's, UC)\nβ€’ Ankylosing spondylitis\nβ€’ Psoriatic arthritis"),
             tc("↑ Infection risk (reactivation of TB β€” screen before use!)\nLymphoma risk\nDemyelinating disease risk")],
            [tc("ANAKINRA"),
             tc("IL-1 receptor antagonist (recombinant)\n→ Blocks IL-1α and IL-1β signalling"),
             tc("β€’ Rheumatoid arthritis\nβ€’ Autoinflammatory syndromes (FMF, CAPS)\nβ€’ Macrophage activation syndrome"),
             tc("Injection site reactions\n↑ Infection risk")],
        ],
        widths=[TW*0.18, TW*0.27, TW*0.28, TW*0.27]),
    SP(10),
]

# ─── QUICK REVISION ───────────────────────────────────────────────────────────
S += [
    h1("QUICK REVISION β€” HIGH-YIELD ONE-LINERS (FMGE / USMLE)"),
    SP(4),
]
ol = [
    ("First cell in acute inflammation", "NEUTROPHIL (6-24 hrs) β†’ then monocyte/macrophage (24-48 hrs)"),
    ("First mediator released in acute inflammation", "HISTAMINE (preformed in mast cell granules β€” released immediately)"),
    ("Most potent chemotactic agent", "C5a (also anaphylatoxin β€” causes mast cell degranulation)"),
    ("Most potent opsonins", "IgG (Fc receptor) + C3b (CR1 receptor)"),
    ("Fever mediator (final)", "PGE2 (produced by hypothalamic vascular cells in response to IL-1/TNF/IL-6)"),
    ("Most important mediator of pain in inflammation", "Bradykinin (lowers pain threshold most potently) + PGE2 sensitises"),
    ("Molecule for leukocyte ROLLING", "Selectins (P-selectin, E-selectin, L-selectin) + Sialyl-Lewis X"),
    ("Molecule for FIRM ADHESION", "Integrins LFA-1/Mac-1 (CD11/CD18) binding ICAM-1 on endothelium"),
    ("Molecule for TRANSMIGRATION (diapedesis)", "PECAM-1 (CD31)"),
    ("LAD (Leukocyte Adhesion Deficiency)", "CD18 deficiency β†’ NO pus, delayed umbilical cord separation (>3 wks), recurrent infections"),
    ("CGD (Chronic Granulomatous Disease)", "NADPH oxidase defect β†’ infections with CATALASE+ organisms: Staph, Aspergillus, Serratia, Nocardia"),
    ("NBT test positive in...", "Normal cells (blue) β€” NEGATIVE in CGD (colourless/yellow)"),
    ("Corticosteroids block", "Phospholipase A2 β†’ no AA released β†’ both PG AND LT synthesis blocked"),
    ("Aspirin mechanism", "IRREVERSIBLY inhibits COX-1 + COX-2 (acetylation) β†’ ↓ PG + ↓ TXA2"),
    ("Anti-inflammatory arachidonic acid products", "LIPOXINS + Resolvins β€” inhibit neutrophil recruitment, promote resolution"),
    ("Exudate vs Transudate", "Exudate = ↑ protein > 3g/dL, SG > 1.020 (inflammation) | Transudate = ↓ protein, SG < 1.012 (CCF, cirrhosis)"),
    ("TB granuloma type", "CASEATING granuloma + Langhans giant cells (peripheral nuclei)"),
    ("Sarcoidosis granuloma type", "NON-CASEATING 'naked' granuloma + ↑ACE + ↑Ca²⁺ + Schaumann/asteroid bodies"),
    ("Main inducer of acute phase response (CRP, fibrinogen)", "IL-6 (produced by macrophages)"),
    ("Most important cell in chronic inflammation", "MACROPHAGE (activated by IFN-Ξ³ from CD4+ T-cells)"),
    ("Touton giant cell", "Xanthoma, fat necrosis β€” nuclei in ring with foamy cytoplasm outside"),
    ("Aschoff body / Aschoff cell", "Rheumatic carditis β€” Aschoff cell has 'caterpillar/owl-eye' nucleus"),
    ("Whooping cough WBC paradox", "LYMPHOCYTOSIS (despite bacterial infection β€” due to lymphocyte-promoting factor toxin)"),
    ("TNF's role in septic shock", "Massive TNF β†’ hypotension + DIC + multi-organ failure"),
    ("Hepcidin's role in chronic disease anaemia", "↑ Hepcidin (from IL-6) β†’ ↓ ferroportin β†’ ↓ iron release β†’ ↓ Hb"),
]

for i, (q, a) in enumerate(ol):
    bg = C_ROW1 if i % 2 == 0 else C_ROW2
    row_data = [[
        Paragraph(f"<b>{i+1}.</b> {q}", ParagraphStyle(f"q{i}", fontName="Helvetica",
            fontSize=9, textColor=C_WHITE, leading=13, leftIndent=3)),
        Paragraph(f"<font color='#f5a623'><b>{a}</b></font>",
            ParagraphStyle(f"a{i}", fontName="Helvetica", fontSize=9, leading=13, leftIndent=3))
    ]]
    t = Table(row_data, colWidths=[TW*0.44, TW*0.56])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg),
        ("GRID", (0,0), (-1,-1), 0.3, HexColor("#30363d")),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("TOPPADDING", (0,0), (-1,-1), 3),
        ("BOTTOMPADDING", (0,0), (-1,-1), 3),
        ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
    ]))
    S.append(t)

S += [
    SP(12),
    HR(HexColor("#30363d"), 0.5),
    SP(4),
    Paragraph("Source: <b>Robbins &amp; Kumar Basic Pathology, 11th Edition</b> | "
              "<b>Robbins, Cotran &amp; Kumar Pathologic Basis of Disease, 10th Edition</b>", sSrc),
    Paragraph("Prepared for MBBS students β€” FMGE &amp; USMLE examination preparation", sSrc),
    SP(6),
]

# ── Build ─────────────────────────────────────────────────────────────────────
doc.build(S, onFirstPage=page_bg, onLaterPages=page_bg)
print(f"PDF generated successfully: {OUTPUT}")
Running Command

cd /home/daytona/workspace/inflammation-notes && python generate_full_pdf.py 2>&…

Running Command

ls -lh /home/daytona/workspace/inflammation-notes/Inflammation_Full_Notes_MBBS.p…

Your full PDF is ready β€” 12 MB with all images and diagrams!

Inflammation Full Notes MBBS

PDF Document Β· PDF


What's included in this complete PDF:
Diagrams & Histology Images (directly from Robbins textbook):
  • Fig 2.1 - Full overview diagram of the inflammatory sequence (macrophages β†’ mediators β†’ vascular changes β†’ recruitment β†’ resolution/repair)
  • Fig 2.2 - Exudate vs Transudate formation diagram
  • Fig 2.3 - Leukocyte migration multistep diagram (rolling β†’ adhesion β†’ diapedesis)
  • Fig 2.5 - Phagocytosis + NADPH oxidase / MPO killing diagram
  • Fig 2.6 - Arachidonic acid pathway flowchart (COX/LOX, drugs)
  • Fig 2.10 - Fibrinous pericarditis (gross + histology)
  • Fig 2.11 - Purulent lung abscesses (gross + histology)
  • Fig 2.13 - Outcomes of acute inflammation diagram
  • Fig 2.14 - Chronic inflammation histology
  • Fig 2.16 - Macrophage maturation diagram
  • Fig 2.17 - M1 vs M2 macrophage activation diagram
  • Fig 2.19 - Granuloma histology (TB)
  • NETs electron micrograph
Content sections:
  • Definition, Types at a glance, Causes, PRR recognition
  • Vascular changes (vasodilation, permeability mechanisms, stasis)
  • Exudate vs Transudate table
  • Leukocyte recruitment step-by-step (all 4 steps with molecules)
  • Phagocytosis + intracellular killing (oxygen-dependent/independent)
  • All mediators tables (histamine through anti-TNF biologics)
  • Morphologic patterns (serous/fibrinous/purulent/pseudomembranous etc.)
  • Outcomes, Chronic inflammation, Granulomatous inflammation
  • Giant cell types, granulomatous disease table
  • Systemic effects / acute phase response
  • WBC patterns table
  • Cardinal signs, Full pharmacology table
  • 25 high-yield one-liners
This is a shared conversation. Sign in to Orris to start your own chat.