Organize well answer for university exam high yeild 10 marks long answer As m pharm student write Easy language ma hooi but also maintain formal language.. easy to understand and write in exam. ….. Definition 1. Classification table 2. Mechanism of each type 3. Examples 4. Pharmacological management 5. Draw the Type I hypersensitivity flowchart 6. End with a one-line conclusion on the clinical importance of hypersensitivity reactions. Questions: Classify hypersensitivity reactions and explain the mechanism, mediators, and examples of each type. Discuss the types of hypersensitivity reactions with suitable examples and pharmacological management. Differentiate Type I, II, III, and IV hypersensitivity Explain Type I (Immediate) hypersensitivity. Explain mediators involved in hypersensitivity reactions.
"Hypersensitivity responses lead to tissue damage: immunopathology. The mechanisms underlying them are the same as those normally employed by the body in combating infection - the problem is they occur with too high an intensity, directed against antigens that pose no threat." - Roitt's Essential Immunology
| Feature | Type I (Immediate) | Type II (Cytotoxic) | Type III (Immune Complex) | Type IV (Delayed/Cell-Mediated) |
|---|---|---|---|---|
| Other Name | Anaphylactic / Atopic | Antibody-Dependent Cytotoxic | Immune Complex-Mediated | Delayed-Type Hypersensitivity (DTH) |
| Immunoglobulin | IgE | IgG, IgM | IgG, IgM | None (T-cell mediated) |
| Effector Mechanism | Mast cell degranulation | Complement + ADCC | Complement activation + neutrophil recruitment | T-lymphocytes + Macrophages |
| Onset Time | Seconds to minutes | Minutes to hours | 6-12 hours | 48-72 hours |
| Key Cells | Mast cells, Basophils, Eosinophils | NK cells, Macrophages, Neutrophils | Neutrophils, Macrophages | CD4+ Th1 cells, CD8+ T cells, Macrophages |
| Complement | Not involved | Involved | Involved | Not involved |
| Mediators | Histamine, Leukotrienes, Prostaglandins | Complement fragments (C3b, MAC) | C5a, C3a, Lysosomal enzymes | IFN-γ, IL-2, TNF-β |
| Example | Anaphylaxis, Asthma, Hay fever | Hemolytic anemia, ABO transfusion reaction | SLE, Post-streptococcal GN, Serum sickness | Contact dermatitis, Tuberculin test, Graft rejection |
| Type | Preformed Mediators | Newly Formed / Secondary Mediators |
|---|---|---|
| Type I | Histamine, Tryptase, Heparin, Eosinophil Chemotactic Factor | Leukotrienes (LTC4, LTD4, LTE4), Prostaglandins (PGD2), PAF, TNF-α, IL-4 |
| Type II | - | Complement fragments (C3b, C5a, MAC), Perforin/Granzymes (ADCC) |
| Type III | - | C3a, C5a (anaphylatoxins), Lysosomal enzymes, Reactive oxygen species |
| Type IV | - | IFN-γ, IL-2, TNF-β, IL-17, Macrophage activating factor (MAF) |
| Disease | Type |
|---|---|
| Anaphylaxis (bee sting, penicillin) | Type I |
| Bronchial Asthma | Type I |
| Hay Fever (Allergic Rhinitis) | Type I |
| Atopic Dermatitis (Eczema) | Type I |
| Hemolytic Transfusion Reaction (ABO mismatch) | Type II |
| Rh hemolytic disease of newborn | Type II |
| Autoimmune Hemolytic Anemia | Type II |
| Goodpasture Syndrome | Type II |
| Graves' Disease (TSH receptor antibody) | Type II (V) |
| Myasthenia Gravis (AChR antibody) | Type II (V) |
| Systemic Lupus Erythematosus (SLE) | Type III |
| Post-streptococcal Glomerulonephritis | Type III |
| Serum Sickness | Type III |
| Arthus Reaction | Type III |
| Contact Dermatitis (poison ivy, nickel) | Type IV |
| Tuberculin (Mantoux) Test | Type IV |
| Graft Rejection (allograft) | Type IV |
| Leprosy (tuberculoid), TB | Type IV |
| Drug Class | Drug Name | Mechanism of Action | Clinical Use |
|---|---|---|---|
| First-line (Anaphylaxis) | Epinephrine (Adrenaline) | Activates α1 (vasoconstriction) and β2 (bronchodilation) receptors; reverses bronchoconstriction and hypotension | Severe anaphylaxis - IM injection |
| H1 Antihistamines | Diphenhydramine, Cetirizine, Loratadine | Competitive block of H1 receptors; reduces vasodilation, pruritus, urticaria | Allergic rhinitis, urticaria, mild allergy |
| Corticosteroids | Prednisolone, Dexamethasone, Hydrocortisone | Inhibit phospholipase A2 → block arachidonic acid cascade → reduces leukotrienes + prostaglandins; suppress cytokine production | Severe allergy, asthma, late-phase reaction |
| Leukotriene Receptor Antagonists (LTRA) | Montelukast, Zafirlukast | Block cysteinyl leukotriene (CysLT1) receptors → reduce bronchoconstriction and mucus secretion | Bronchial asthma, allergic rhinitis |
| Mast Cell Stabilizers | Sodium Cromoglycate, Nedocromil | Prevent mast cell degranulation by blocking chloride channels → inhibit release of histamine and other mediators | Prophylaxis in asthma, allergic rhinitis |
| β2-Agonists | Salbutamol, Formoterol | Bronchodilation by activating β2 receptors on bronchial smooth muscle | Acute asthma attack |
| Xanthines | Theophylline | Inhibit phosphodiesterase → increase cAMP → bronchodilation + mast cell stabilization | Chronic asthma |
| Monoclonal Antibody | Omalizumab (anti-IgE) | Binds free IgE → prevents IgE binding to FcεRI on mast cells → no degranulation | Severe allergic asthma, chronic urticaria |
| Immunotherapy | Allergen desensitization | Repeated low-dose allergen exposure shifts Th2 → Th1, increases IgG4 (blocking antibody), reduces IgE | Long-term allergy treatment |
| Drug / Approach | Mechanism |
|---|---|
| Corticosteroids (Prednisolone) | Suppress antibody production and complement activation |
| Plasma exchange (Plasmapheresis) | Removes circulating autoantibodies and immune complexes |
| IVIG (Intravenous Immunoglobulin) | Saturates FcRn receptors → faster degradation of pathogenic IgG |
| Rituximab (anti-CD20) | Depletes B cells → reduces antibody production |
| Supportive: Blood transfusion for hemolytic anemia | Replace destroyed RBCs |
| Drug / Approach | Mechanism |
|---|---|
| Corticosteroids | Suppress inflammation, inhibit complement activation and neutrophil function |
| NSAIDs | Relieve joint pain and inflammation (COX inhibition) |
| Plasmapheresis | Remove immune complexes from circulation |
| Hydroxychloroquine (in SLE) | Inhibits Toll-like receptor signaling → reduces immune complex deposition |
| Immunosuppressants (Azathioprine, Cyclophosphamide, Mycophenolate) | Reduce B and T cell activity; first-line in SLE nephritis |
| Anti-TNF agents (in vasculitis) | Block TNF-mediated inflammation |
| Antigen removal | Treat underlying infection (e.g., antibiotics for post-streptococcal GN) |
| Drug / Approach | Mechanism |
|---|---|
| Corticosteroids (topical + systemic) | Suppress T-cell activation; reduce cytokine release and macrophage activation - first-line for contact dermatitis |
| Calcineurin Inhibitors (Tacrolimus, Cyclosporine) | Block calcineurin → inhibit IL-2 transcription → suppress T-cell proliferation; used in contact dermatitis and organ transplant rejection |
| Anti-TNF biologics (Infliximab, Adalimumab) | Block TNF-α → reduce macrophage activation and granuloma formation |
| Dapsone | Anti-inflammatory; used in leprosy (Type IV component) |
| Antituberculosis drugs | Treat the cause of Type IV granuloma in TB |
| Avoidance of antigen | Fundamental approach in contact hypersensitivity |
┌─────────────────────────────────────────────────────────┐
│ TYPE I HYPERSENSITIVITY FLOWCHART │
│ (IgE-Mediated / Immediate Type) │
└─────────────────────────────────────────────────────────┘
┌──────────────────────────────────────┐
│ FIRST EXPOSURE TO ALLERGEN │
│ (Pollen, Dust mite, Penicillin, Food) │
└────────────────┬─────────────────────┘
│
▼
┌──────────────────────────────────┐
│ Allergen → APCs present to │
│ Th2 cells │
└─────────────────┬────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ Th2 cells secrete IL-4 and IL-13 │
│ → B cells undergo class switching │
│ → B cells produce IgE antibodies │
└──────────────────┬──────────────────────┘
│
▼
┌────────────────────────────────────────────┐
│ IgE binds to FcεRI receptors on │
│ MAST CELLS and BASOPHILS │
│ (Patient is now SENSITIZED - no symptoms) │
└─────────────────┬──────────────────────────┘
│
═══════════════════════════════════
SECOND EXPOSURE TO ALLERGEN
═══════════════════════════════════
│
▼
┌────────────────────────────────────────────┐
│ Allergen CROSS-LINKS two IgE molecules │
│ on the surface of mast cells │
└──────────────────┬─────────────────────────┘
│
▼
┌──────────────────────────────────────────────────┐
│ MAST CELL DEGRANULATION │
└─────────────┬──────────────────┬─────────────────┘
│ │
┌─────────▼──────┐ ┌───────▼──────────────┐
│ PREFORMED │ │ NEWLY FORMED │
│ MEDIATORS │ │ MEDIATORS │
│ (Released │ │ (Synthesized from │
│ immediately) │ │ Arachidonic acid) │
│ │ │ │
│ • Histamine │ │ • Leukotrienes │
│ • Tryptase │ │ (LTC4, LTD4, LTE4) │
│ • Heparin │ │ • Prostaglandin D2 │
│ • ECF-A │ │ • PAF │
│ (Eosinophil │ │ • TNF-α, IL-4 │
│ Chemo Factor) │ │ │
└──────┬─────────┘ └───────┬───────────────┘
│ │
└──────────┬──────────┘
▼
┌─────────────────────────────────────────────────────┐
│ CLINICAL EFFECTS │
├─────────────────────────────────────────────────────┤
│ Histamine → Vasodilation, Edema, Bronchospasm, │
│ Pruritus, Urticaria │
│ Leukotrienes → Bronchoconstriction, Mucus↑ │
│ PGD2 → Vasodilation, Bronchospasm │
│ PAF → Platelet aggregation, Bronchospasm │
└───────────────────┬─────────────────────────────────┘
│
┌─────────────┴──────────────┐
▼ ▼
┌──────────────────────┐ ┌───────────────────────────┐
│ LOCAL REACTION │ │ SYSTEMIC REACTION │
│ (Atopy) │ │ (Anaphylaxis) │
│ │ │ │
│ • Hay fever │ │ • Hypotension │
│ • Asthma │ │ • Laryngeal edema │
│ • Urticaria │ │ • Bronchospasm │
│ • Eczema │ │ • Cardiovascular collapse │
│ • Food allergy │ │ • Can be FATAL │
└───────────────────────┘ └───────────────────────────┘
Visual reference from Roitt's Essential Immunology (6 types of hypersensitivity):

| Parameter | Type I | Type II | Type III | Type IV |
|---|---|---|---|---|
| Antibody | IgE | IgG/IgM | IgG/IgM | None |
| Complement | No | Yes | Yes | No |
| Cells involved | Mast cell, Basophil | NK cell, Macrophage | Neutrophil | T-cell, Macrophage |
| Onset | Seconds - minutes | Minutes | 6-12 hours | 48-72 hours |
| Passive transfer possible by | Serum (IgE) | Serum (IgG) | Serum (IgG) | Cells (T cells) |
| Skin test reaction | Wheal and flare (immediate) | - | Arthus (6 hrs) | Induration (48-72 hrs) |
| Characteristic disease | Anaphylaxis | Hemolytic anemia | SLE | Contact dermatitis |
| Histopathology | Mast cell degranulation | Cell lysis, opsonization | Neutrophilic infiltrate | Mononuclear infiltrate, granuloma |
Generate a DOCX summary of this answer for printing and revision
mkdir -p /home/daytona/workspace/hypersensitivity && ls /home/daytona/workspace/hypersensitivity
~/hypersensitivity/generate.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
VerticalAlign, LevelFormat, PageNumber, PageBreak,
Header, Footer, TabStopType, TabStopPosition
} = require('docx');
const fs = require('fs');
// ─── Colour palette ────────────────────────────────────────────────
const BLUE_DARK = "1F3864"; // deep navy – headings
const BLUE_MID = "2E5EA6"; // medium blue – sub-headings
const BLUE_LIGHT = "D6E4F0"; // pale blue – table header fill
const TEAL = "1D7874"; // teal accent
const YELLOW_BG = "FFF9C4"; // soft yellow – definition box
const WHITE = "FFFFFF";
const GRAY_LIGHT = "F2F2F2"; // alternating table row
const BLACK = "000000";
// ─── Numbering config ──────────────────────────────────────────────
const numberingConfig = [
{
reference: "bullets",
levels: [{
level: 0, format: LevelFormat.BULLET, text: "\u2022",
alignment: AlignmentType.LEFT,
style: {
paragraph: { indent: { left: 360, hanging: 180 }, spacing: { after: 60 } },
run: { font: "Arial", size: 20 }
}
}]
},
{
reference: "numbered",
levels: [{
level: 0, format: LevelFormat.DECIMAL, text: "%1.",
alignment: AlignmentType.LEFT,
style: {
paragraph: { indent: { left: 360, hanging: 240 }, spacing: { after: 60 } },
run: { font: "Arial", size: 20 }
}
}]
}
];
// ─── Helper functions ──────────────────────────────────────────────
function h1(text) {
return new Paragraph({
heading: HeadingLevel.HEADING_1,
children: [new TextRun({ text, font: "Arial", size: 32, bold: true, color: WHITE })],
shading: { type: ShadingType.SOLID, color: BLUE_DARK, fill: BLUE_DARK },
spacing: { before: 300, after: 160 },
indent: { left: 120, right: 120 }
});
}
function h2(text) {
return new Paragraph({
heading: HeadingLevel.HEADING_2,
children: [new TextRun({ text, font: "Arial", size: 26, bold: true, color: WHITE })],
shading: { type: ShadingType.SOLID, color: BLUE_MID, fill: BLUE_MID },
spacing: { before: 240, after: 120 },
indent: { left: 80 }
});
}
function h3(text) {
return new Paragraph({
children: [new TextRun({ text, font: "Arial", size: 22, bold: true, color: BLUE_DARK, underline: {} })],
spacing: { before: 200, after: 80 }
});
}
function h4(text) {
return new Paragraph({
children: [new TextRun({ text, font: "Arial", size: 21, bold: true, color: TEAL })],
spacing: { before: 140, after: 60 }
});
}
function para(text, options = {}) {
return new Paragraph({
children: [new TextRun({ text, font: "Arial", size: 20, color: BLACK, ...options })],
spacing: { after: 100 }
});
}
function bullet(text) {
return new Paragraph({
numbering: { reference: "bullets", level: 0 },
children: [new TextRun({ text, font: "Arial", size: 20, color: BLACK })],
spacing: { after: 60 }
});
}
function numberedItem(text) {
return new Paragraph({
numbering: { reference: "numbered", level: 0 },
children: [new TextRun({ text, font: "Arial", size: 20, color: BLACK })],
spacing: { after: 60 }
});
}
function boldPara(text, rest = "") {
return new Paragraph({
children: [
new TextRun({ text, font: "Arial", size: 20, bold: true, color: BLUE_DARK }),
new TextRun({ text: rest, font: "Arial", size: 20, color: BLACK })
],
spacing: { after: 80 }
});
}
function spacer(pts = 120) {
return new Paragraph({ children: [new TextRun("")], spacing: { after: pts } });
}
function pageBreak() {
return new Paragraph({ children: [new PageBreak()] });
}
// Highlighted box (definition / conclusion)
function boxPara(text, fillColor = YELLOW_BG) {
return new Paragraph({
children: [new TextRun({ text, font: "Arial", size: 20, color: BLACK })],
shading: { type: ShadingType.SOLID, color: fillColor, fill: fillColor },
indent: { left: 180, right: 180 },
spacing: { before: 80, after: 80 },
border: {
top: { style: BorderStyle.SINGLE, size: 4, color: TEAL },
bottom: { style: BorderStyle.SINGLE, size: 4, color: TEAL },
left: { style: BorderStyle.THICK, size: 8, color: TEAL },
right: { style: BorderStyle.SINGLE, size: 4, color: TEAL }
}
});
}
// Table cell helpers
function hdrCell(text, width, options = {}) {
return new TableCell({
width: { size: width, type: WidthType.DXA },
shading: { type: ShadingType.SOLID, color: BLUE_DARK, fill: BLUE_DARK },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({
children: [new TextRun({ text, font: "Arial", size: 18, bold: true, color: WHITE })],
alignment: AlignmentType.CENTER
})],
...options
});
}
function subHdrCell(text, width) {
return new TableCell({
width: { size: width, type: WidthType.DXA },
shading: { type: ShadingType.SOLID, color: BLUE_MID, fill: BLUE_MID },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({
children: [new TextRun({ text, font: "Arial", size: 17, bold: true, color: WHITE })],
alignment: AlignmentType.CENTER
})]
});
}
function dataCell(text, width, fill = WHITE, bold = false) {
return new TableCell({
width: { size: width, type: WidthType.DXA },
shading: { type: ShadingType.SOLID, color: fill, fill },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({
children: [new TextRun({ text, font: "Arial", size: 18, color: BLACK, bold })],
spacing: { after: 40 }
})]
});
}
function tableNoBorder(rows) {
return new Table({
width: { size: 9026, type: WidthType.DXA },
borders: {
top: { style: BorderStyle.SINGLE, size: 2, color: "AAAAAA" },
bottom: { style: BorderStyle.SINGLE, size: 2, color: "AAAAAA" },
left: { style: BorderStyle.SINGLE, size: 2, color: "AAAAAA" },
right: { style: BorderStyle.SINGLE, size: 2, color: "AAAAAA" },
insideH: { style: BorderStyle.SINGLE, size: 1, color: "CCCCCC" },
insideV: { style: BorderStyle.SINGLE, size: 1, color: "CCCCCC" }
},
rows
});
}
// ─── Document content ──────────────────────────────────────────────
const doc = new Document({
numbering: { config: numberingConfig },
styles: {
default: {
document: { run: { font: "Arial", size: 20, color: BLACK } }
},
paragraphStyles: [
{ id: "Heading1", name: "Heading 1", basedOn: "Normal", next: "Normal", quickFormat: true,
run: { font: "Arial", size: 32, bold: true, color: WHITE },
paragraph: { spacing: { before: 300, after: 160 }, outlineLevel: 0 } },
{ id: "Heading2", name: "Heading 2", basedOn: "Normal", next: "Normal", quickFormat: true,
run: { font: "Arial", size: 26, bold: true, color: WHITE },
paragraph: { spacing: { before: 240, after: 120 }, outlineLevel: 1 } }
]
},
sections: [{
properties: {
page: {
size: { width: 11906, height: 16838 }, // A4
margin: { top: 1080, right: 1080, bottom: 1080, left: 1080 }
}
},
headers: {
default: new Header({
children: [
new Paragraph({
children: [
new TextRun({ text: "HYPERSENSITIVITY REACTIONS | M. Pharm Exam Revision", font: "Arial", size: 16, color: BLUE_MID, bold: true }),
],
alignment: AlignmentType.CENTER,
border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: BLUE_LIGHT } }
})
]
})
},
footers: {
default: new Footer({
children: [
new Paragraph({
children: [
new TextRun({ text: "Sources: Jawetz Medical Microbiology 28e | Roitt's Essential Immunology 13e | Janeway's Immunobiology 10e | Page ", font: "Arial", size: 14, color: "888888" }),
new TextRun({ children: [PageNumber.CURRENT], font: "Arial", size: 14, color: "888888" }),
new TextRun({ text: " of ", font: "Arial", size: 14, color: "888888" }),
new TextRun({ children: [PageNumber.TOTAL_PAGES], font: "Arial", size: 14, color: "888888" })
],
alignment: AlignmentType.CENTER,
border: { top: { style: BorderStyle.SINGLE, size: 2, color: BLUE_LIGHT } }
})
]
})
},
children: [
// ══════════════════════════════════════════
// TITLE BLOCK
// ══════════════════════════════════════════
new Paragraph({
children: [new TextRun({ text: "HYPERSENSITIVITY REACTIONS", font: "Arial", size: 44, bold: true, color: WHITE })],
shading: { type: ShadingType.SOLID, color: BLUE_DARK, fill: BLUE_DARK },
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 0 },
indent: { left: 0, right: 0 },
border: {
top: { style: BorderStyle.THICK, size: 12, color: TEAL },
bottom: { style: BorderStyle.THICK, size: 12, color: TEAL }
}
}),
new Paragraph({
children: [new TextRun({ text: "Classification | Mechanism | Mediators | Examples | Pharmacological Management", font: "Arial", size: 22, color: BLUE_DARK, italics: true })],
alignment: AlignmentType.CENTER,
shading: { type: ShadingType.SOLID, color: BLUE_LIGHT, fill: BLUE_LIGHT },
spacing: { before: 0, after: 0 }
}),
new Paragraph({
children: [new TextRun({ text: "M. Pharm | Immunopharmacology & Pharmacology | 10 Marks Long Answer", font: "Arial", size: 19, color: "555555" })],
alignment: AlignmentType.CENTER,
spacing: { before: 100, after: 200 }
}),
// ══════════════════════════════════════════
// DEFINITION
// ══════════════════════════════════════════
h1("DEFINITION"),
boxPara("Hypersensitivity is defined as an exaggerated or augmented immune response to an antigen (allergen) that is harmful to the host. It requires a presensitized state — the harmful response occurs upon second or subsequent exposure to the same antigen."),
spacer(80),
boldPara("Classified by: ", "Gell and Coombs (1963) into 4 types: Type I, II, III (antibody-mediated) and Type IV (T-cell mediated)."),
spacer(100),
// ══════════════════════════════════════════
// CLASSIFICATION TABLE
// ══════════════════════════════════════════
h1("1. CLASSIFICATION TABLE — Gell and Coombs"),
spacer(80),
tableNoBorder([
// Header row
new TableRow({
tableHeader: true,
children: [
hdrCell("Feature", 1200),
hdrCell("Type I\n(Immediate)", 1700),
hdrCell("Type II\n(Cytotoxic)", 1700),
hdrCell("Type III\n(Immune Complex)", 1950),
hdrCell("Type IV\n(Delayed / DTH)", 1976)
]
}),
// Data rows
new TableRow({ children: [subHdrCell("Other Name", 1200), dataCell("Anaphylactic / Atopic", 1700, GRAY_LIGHT), dataCell("Antibody-Dependent Cytotoxic", 1700, GRAY_LIGHT), dataCell("Immune Complex-Mediated", 1950, GRAY_LIGHT), dataCell("Delayed-Type Hypersensitivity", 1976, GRAY_LIGHT)] }),
new TableRow({ children: [subHdrCell("Immunoglobulin", 1200), dataCell("IgE", 1700), dataCell("IgG, IgM", 1700), dataCell("IgG, IgM", 1950), dataCell("None (T-cell mediated)", 1976)] }),
new TableRow({ children: [subHdrCell("Effector", 1200), dataCell("Mast cell degranulation", 1700, GRAY_LIGHT), dataCell("Complement + ADCC", 1700, GRAY_LIGHT), dataCell("Complement + Neutrophils", 1950, GRAY_LIGHT), dataCell("CD4+ Th1 + Macrophages", 1976, GRAY_LIGHT)] }),
new TableRow({ children: [subHdrCell("Onset", 1200), dataCell("Seconds–minutes", 1700), dataCell("Minutes–hours", 1700), dataCell("6–12 hours", 1950), dataCell("48–72 hours", 1976)] }),
new TableRow({ children: [subHdrCell("Complement", 1200), dataCell("Not involved", 1700, GRAY_LIGHT), dataCell("Involved", 1700, GRAY_LIGHT), dataCell("Involved", 1950, GRAY_LIGHT), dataCell("Not involved", 1976, GRAY_LIGHT)] }),
new TableRow({ children: [subHdrCell("Key Mediators", 1200), dataCell("Histamine, Leukotrienes, PGD2", 1700), dataCell("C3b, MAC, Perforin", 1700), dataCell("C3a, C5a, Lysosomal enzymes", 1950), dataCell("IFN-γ, IL-2, TNF-β", 1976)] }),
new TableRow({ children: [subHdrCell("Classic Example", 1200), dataCell("Anaphylaxis, Asthma", 1700, GRAY_LIGHT), dataCell("Hemolytic anemia, ABO reaction", 1700, GRAY_LIGHT), dataCell("SLE, Serum sickness", 1950, GRAY_LIGHT), dataCell("Contact dermatitis, Tuberculin test", 1976, GRAY_LIGHT)] }),
new TableRow({ children: [subHdrCell("Skin Test", 1200), dataCell("Wheal & flare (immediate)", 1700), dataCell("—", 1700), dataCell("Arthus (6 hrs)", 1950), dataCell("Induration (48–72 hrs)", 1976)] })
]),
spacer(160),
pageBreak(),
// ══════════════════════════════════════════
// MECHANISMS
// ══════════════════════════════════════════
h1("2. MECHANISM OF EACH TYPE"),
spacer(80),
// TYPE I
h2("Type I — Immediate (IgE-Mediated) Hypersensitivity"),
h3("Phase 1: Sensitization (First Exposure)"),
numberedItem("Allergen (pollen, penicillin, dust mite) enters the body for the first time"),
numberedItem("APCs present antigen to Th2 cells → Th2 cells release IL-4 and IL-13"),
numberedItem("B cells undergo class-switching → produce IgE antibodies"),
numberedItem("IgE binds by its Fc portion to high-affinity FcεRI receptors on mast cells and basophils"),
numberedItem("Patient is now SENSITIZED — no clinical symptoms yet"),
h3("Phase 2: Elicitation (Re-exposure)"),
numberedItem("Same allergen cross-links two or more IgE molecules on mast cell surface"),
numberedItem("Cross-linking triggers MAST CELL DEGRANULATION"),
numberedItem("Preformed mediators (histamine, tryptase, heparin) are released immediately"),
numberedItem("Newly formed mediators (leukotrienes, prostaglandins, PAF) are synthesized from arachidonic acid"),
numberedItem("Results in: vasodilation, bronchospasm, increased vascular permeability, pruritus"),
spacer(80),
// Mediators table
h4("Mediators of Type I Hypersensitivity"),
tableNoBorder([
new TableRow({ tableHeader: true, children: [hdrCell("Category", 2200), hdrCell("Mediator", 3000), hdrCell("Effect", 3826)] }),
new TableRow({ children: [subHdrCell("Preformed (granule)", 2200), dataCell("Histamine", 3000, GRAY_LIGHT), dataCell("Vasodilation, increased permeability, bronchospasm, pruritus", 3826, GRAY_LIGHT)] }),
new TableRow({ children: [subHdrCell("Preformed (granule)", 2200), dataCell("Tryptase, Heparin, ECF-A", 3000), dataCell("Proteolysis, anticoagulation, eosinophil recruitment", 3826)] }),
new TableRow({ children: [subHdrCell("Newly Formed", 2200), dataCell("Leukotrienes C4, D4, E4 (SRS-A)", 3000, GRAY_LIGHT), dataCell("Bronchoconstriction, increased mucus (100x stronger than histamine)", 3826, GRAY_LIGHT)] }),
new TableRow({ children: [subHdrCell("Newly Formed", 2200), dataCell("Prostaglandin D2 (PGD2)", 3000), dataCell("Bronchospasm, vasodilation", 3826)] }),
new TableRow({ children: [subHdrCell("Newly Formed", 2200), dataCell("PAF (Platelet Activating Factor)", 3000, GRAY_LIGHT), dataCell("Platelet aggregation, bronchoconstriction", 3826, GRAY_LIGHT)] }),
new TableRow({ children: [subHdrCell("Cytokines", 2200), dataCell("TNF-α, IL-4, IL-5", 3000), dataCell("Inflammation, IgE production, eosinophil activation (late phase)", 3826)] })
]),
spacer(140),
// TYPE II
h2("Type II — Cytotoxic (Antibody-Dependent) Hypersensitivity"),
numberedItem("IgG or IgM antibodies are directed against cell-surface antigens or extracellular matrix"),
numberedItem("Antibody binding activates complement via classical pathway → MAC (membrane attack complex) → cell lysis"),
numberedItem("Cells coated with IgG are also destroyed by ADCC (NK cells and macrophages via FcγR)"),
numberedItem("Opsonization: C3b-coated cells are phagocytosed by macrophages"),
numberedItem("Drugs (e.g., penicillin) can haptenize RBCs → antibody formation against drug-RBC complex → hemolysis"),
numberedItem("Special case (Type V): Antibodies to cell surface receptors stimulate/block function without lysis — e.g., Graves' disease (TSH-R antibody)"),
spacer(80),
// TYPE III
h2("Type III — Immune Complex-Mediated Hypersensitivity"),
numberedItem("Antigen-antibody (IgG/IgM) complexes form in excess in circulation"),
numberedItem("When complexes persist and are not cleared, they deposit in tissues (glomeruli, joints, vessel walls)"),
numberedItem("Deposited immune complexes activate complement → C3a and C5a (anaphylatoxins)"),
numberedItem("C5a is a potent chemoattractant → recruits neutrophils to the site"),
numberedItem("Neutrophils release lysosomal enzymes and ROS → tissue damage and inflammation (vasculitis, nephritis, arthritis)"),
spacer(60),
h4("Two Subtypes:"),
bullet("Arthus Reaction (Local): IgG + injected antigen → local complement activation within 12 hours"),
bullet("Serum Sickness (Systemic): Large antigen excess → systemic immune complex deposition at 6–21 days"),
spacer(80),
// TYPE IV
h2("Type IV — Delayed-Type (Cell-Mediated) Hypersensitivity"),
numberedItem("No antibody involved — purely T-cell mediated"),
numberedItem("First exposure: Antigen processed by APCs (Langerhans cells) → presented to CD4+ Th1 cells via MHC Class II → memory T cells form"),
numberedItem("Re-exposure (48–72 hrs later): Antigen re-presented to sensitized T cells"),
numberedItem("Activated Th1 cells release cytokines: IFN-γ, IL-2, TNF-β"),
numberedItem("IFN-γ activates macrophages → release TNF and lysosomal enzymes → granuloma formation, induration, necrosis"),
spacer(60),
h4("Subtypes of Type IV:"),
bullet("Contact Hypersensitivity: Chemicals (nickel, urushiol from poison ivy) act as haptens → sensitize skin T cells"),
bullet("Tuberculin-Type: Tuberculin skin test — positive = induration in 24–72 hrs (CD4+ Th1 response)"),
bullet("Granulomatous: Chronic macrophage activation — e.g., tuberculosis, leprosy, sarcoidosis"),
spacer(160),
pageBreak(),
// ══════════════════════════════════════════
// EXAMPLES
// ══════════════════════════════════════════
h1("3. EXAMPLES — Disease Classification"),
spacer(80),
tableNoBorder([
new TableRow({ tableHeader: true, children: [hdrCell("Disease / Condition", 5000), hdrCell("Type of Hypersensitivity", 4026)] }),
new TableRow({ children: [dataCell("Anaphylaxis (bee sting, penicillin injection)", 5000, GRAY_LIGHT), dataCell("Type I", 4026, GRAY_LIGHT, true)] }),
new TableRow({ children: [dataCell("Bronchial Asthma", 5000), dataCell("Type I", 4026, WHITE, true)] }),
new TableRow({ children: [dataCell("Hay Fever (Allergic Rhinitis)", 5000, GRAY_LIGHT), dataCell("Type I", 4026, GRAY_LIGHT, true)] }),
new TableRow({ children: [dataCell("Atopic Dermatitis (Eczema)", 5000), dataCell("Type I", 4026, WHITE, true)] }),
new TableRow({ children: [dataCell("Food Allergy (shellfish, peanuts)", 5000, GRAY_LIGHT), dataCell("Type I", 4026, GRAY_LIGHT, true)] }),
new TableRow({ children: [dataCell("Hemolytic Transfusion Reaction (ABO mismatch)", 5000), dataCell("Type II", 4026, WHITE, true)] }),
new TableRow({ children: [dataCell("Rh Hemolytic Disease of Newborn", 5000, GRAY_LIGHT), dataCell("Type II", 4026, GRAY_LIGHT, true)] }),
new TableRow({ children: [dataCell("Autoimmune Hemolytic Anemia", 5000), dataCell("Type II", 4026, WHITE, true)] }),
new TableRow({ children: [dataCell("Goodpasture Syndrome", 5000, GRAY_LIGHT), dataCell("Type II", 4026, GRAY_LIGHT, true)] }),
new TableRow({ children: [dataCell("Graves' Disease (TSH-R antibody)", 5000), dataCell("Type II (V)", 4026, WHITE, true)] }),
new TableRow({ children: [dataCell("Myasthenia Gravis (AChR antibody)", 5000, GRAY_LIGHT), dataCell("Type II (V)", 4026, GRAY_LIGHT, true)] }),
new TableRow({ children: [dataCell("Systemic Lupus Erythematosus (SLE)", 5000), dataCell("Type III", 4026, WHITE, true)] }),
new TableRow({ children: [dataCell("Post-Streptococcal Glomerulonephritis", 5000, GRAY_LIGHT), dataCell("Type III", 4026, GRAY_LIGHT, true)] }),
new TableRow({ children: [dataCell("Serum Sickness", 5000), dataCell("Type III", 4026, WHITE, true)] }),
new TableRow({ children: [dataCell("Arthus Reaction", 5000, GRAY_LIGHT), dataCell("Type III (local)", 4026, GRAY_LIGHT, true)] }),
new TableRow({ children: [dataCell("Contact Dermatitis (poison ivy, nickel, formaldehyde)", 5000), dataCell("Type IV", 4026, WHITE, true)] }),
new TableRow({ children: [dataCell("Tuberculin (Mantoux) Test", 5000, GRAY_LIGHT), dataCell("Type IV", 4026, GRAY_LIGHT, true)] }),
new TableRow({ children: [dataCell("Organ Graft Rejection (allograft)", 5000), dataCell("Type IV", 4026, WHITE, true)] }),
new TableRow({ children: [dataCell("Tuberculosis granuloma / Leprosy (tuberculoid)", 5000, GRAY_LIGHT), dataCell("Type IV", 4026, GRAY_LIGHT, true)] })
]),
spacer(160),
pageBreak(),
// ══════════════════════════════════════════
// PHARMACOLOGICAL MANAGEMENT
// ══════════════════════════════════════════
h1("4. PHARMACOLOGICAL MANAGEMENT"),
spacer(80),
// Type I management
h2("Type I Hypersensitivity — Management"),
spacer(60),
tableNoBorder([
new TableRow({ tableHeader: true, children: [hdrCell("Drug / Class", 2200), hdrCell("Example(s)", 1800), hdrCell("Mechanism of Action", 2600), hdrCell("Clinical Use", 2426)] }),
new TableRow({ children: [subHdrCell("EPINEPHRINE (First-line)", 2200), dataCell("Adrenaline", 1800, GRAY_LIGHT), dataCell("α1 (vasoconstriction) + β2 (bronchodilation); reverses anaphylaxis", 2600, GRAY_LIGHT), dataCell("Severe anaphylaxis — IM injection", 2426, GRAY_LIGHT)] }),
new TableRow({ children: [subHdrCell("H1 Antihistamines", 2200), dataCell("Diphenhydramine, Cetirizine, Loratadine", 1800), dataCell("Competitive block of H1 receptors → reduce vasodilation, pruritus, urticaria", 2600), dataCell("Allergic rhinitis, urticaria, mild allergy", 2426)] }),
new TableRow({ children: [subHdrCell("Corticosteroids", 2200), dataCell("Prednisolone, Dexamethasone, Hydrocortisone", 1800, GRAY_LIGHT), dataCell("Inhibit phospholipase A2 → block arachidonic acid → reduce LTs + PGs; suppress cytokines", 2600, GRAY_LIGHT), dataCell("Severe allergy, asthma, late-phase reaction", 2426, GRAY_LIGHT)] }),
new TableRow({ children: [subHdrCell("Leukotriene Antagonists (LTRA)", 2200), dataCell("Montelukast, Zafirlukast", 1800), dataCell("Block CysLT1 receptors → reduce bronchoconstriction and mucus secretion", 2600), dataCell("Bronchial asthma, allergic rhinitis", 2426)] }),
new TableRow({ children: [subHdrCell("Mast Cell Stabilizers", 2200), dataCell("Sodium Cromoglycate, Nedocromil", 1800, GRAY_LIGHT), dataCell("Block Cl- channels → prevent mast cell degranulation → inhibit histamine + mediator release", 2600, GRAY_LIGHT), dataCell("Prophylaxis in asthma, allergic rhinitis", 2426, GRAY_LIGHT)] }),
new TableRow({ children: [subHdrCell("Beta-2 Agonists", 2200), dataCell("Salbutamol, Formoterol", 1800), dataCell("Activate β2 receptors on bronchial smooth muscle → bronchodilation", 2600), dataCell("Acute asthma attack", 2426)] }),
new TableRow({ children: [subHdrCell("Xanthines", 2200), dataCell("Theophylline", 1800, GRAY_LIGHT), dataCell("Inhibit phosphodiesterase → increase cAMP → bronchodilation + mast cell stabilization", 2600, GRAY_LIGHT), dataCell("Chronic asthma", 2426, GRAY_LIGHT)] }),
new TableRow({ children: [subHdrCell("Anti-IgE Monoclonal Ab", 2200), dataCell("Omalizumab", 1800), dataCell("Binds free IgE → prevents IgE binding to FcεRI on mast cells → no degranulation", 2600), dataCell("Severe allergic asthma, chronic urticaria", 2426)] }),
new TableRow({ children: [subHdrCell("Allergen Immunotherapy", 2200), dataCell("Desensitization shots", 1800, GRAY_LIGHT), dataCell("Repeated low-dose allergen shifts Th2→Th1, increases IgG4 (blocking Ab), reduces IgE", 2600, GRAY_LIGHT), dataCell("Long-term allergy management", 2426, GRAY_LIGHT)] })
]),
spacer(140),
// Type II management
h2("Type II Hypersensitivity — Management"),
spacer(60),
tableNoBorder([
new TableRow({ tableHeader: true, children: [hdrCell("Drug / Approach", 3000), hdrCell("Mechanism", 3000), hdrCell("Use", 3026)] }),
new TableRow({ children: [dataCell("Corticosteroids (Prednisolone)", 3000, GRAY_LIGHT), dataCell("Suppress antibody production and complement activation", 3000, GRAY_LIGHT), dataCell("Autoimmune hemolytic anemia, Goodpasture syndrome", 3026, GRAY_LIGHT)] }),
new TableRow({ children: [dataCell("Plasmapheresis", 3000), dataCell("Removes circulating autoantibodies and immune complexes", 3000), dataCell("Goodpasture syndrome, myasthenia gravis", 3026)] }),
new TableRow({ children: [dataCell("IVIG", 3000, GRAY_LIGHT), dataCell("Saturates FcRn receptors → faster degradation of pathogenic IgG", 3000, GRAY_LIGHT), dataCell("Autoimmune conditions, ITP", 3026, GRAY_LIGHT)] }),
new TableRow({ children: [dataCell("Rituximab (anti-CD20 mAb)", 3000), dataCell("Depletes B cells → reduces autoantibody production", 3000), dataCell("Autoimmune hemolytic anemia, vasculitis", 3026)] })
]),
spacer(140),
// Type III management
h2("Type III Hypersensitivity — Management"),
spacer(60),
tableNoBorder([
new TableRow({ tableHeader: true, children: [hdrCell("Drug / Approach", 3000), hdrCell("Mechanism", 3000), hdrCell("Use", 3026)] }),
new TableRow({ children: [dataCell("Corticosteroids", 3000, GRAY_LIGHT), dataCell("Suppress complement activation, neutrophil function, cytokine production", 3000, GRAY_LIGHT), dataCell("SLE, vasculitis, serum sickness", 3026, GRAY_LIGHT)] }),
new TableRow({ children: [dataCell("NSAIDs", 3000), dataCell("COX inhibition → reduce prostaglandin-mediated inflammation", 3000), dataCell("Joint pain in SLE, serum sickness", 3026)] }),
new TableRow({ children: [dataCell("Hydroxychloroquine", 3000, GRAY_LIGHT), dataCell("Inhibit TLR signaling → reduce immune complex deposition and flares", 3000, GRAY_LIGHT), dataCell("SLE (first-line adjunct)", 3026, GRAY_LIGHT)] }),
new TableRow({ children: [dataCell("Immunosuppressants (Azathioprine, MMF, Cyclophosphamide)", 3000), dataCell("Reduce B and T cell activity → less immune complex formation", 3000), dataCell("Lupus nephritis (Type III), vasculitis", 3026)] }),
new TableRow({ children: [dataCell("Plasmapheresis", 3000, GRAY_LIGHT), dataCell("Physically removes circulating immune complexes", 3000, GRAY_LIGHT), dataCell("Severe SLE, cryoglobulinemia", 3026, GRAY_LIGHT)] })
]),
spacer(140),
// Type IV management
h2("Type IV Hypersensitivity — Management"),
spacer(60),
tableNoBorder([
new TableRow({ tableHeader: true, children: [hdrCell("Drug / Approach", 3000), hdrCell("Mechanism", 3000), hdrCell("Use", 3026)] }),
new TableRow({ children: [dataCell("Topical/Systemic Corticosteroids", 3000, GRAY_LIGHT), dataCell("Suppress T-cell activation; reduce cytokine release and macrophage activation", 3000, GRAY_LIGHT), dataCell("Contact dermatitis (first-line)", 3026, GRAY_LIGHT)] }),
new TableRow({ children: [dataCell("Calcineurin Inhibitors (Tacrolimus, Cyclosporine)", 3000), dataCell("Block calcineurin → inhibit IL-2 transcription → suppress T-cell proliferation", 3000), dataCell("Contact dermatitis, organ transplant rejection", 3026)] }),
new TableRow({ children: [dataCell("Anti-TNF Biologics (Infliximab, Adalimumab)", 3000, GRAY_LIGHT), dataCell("Block TNF-α → reduce macrophage activation and granuloma formation", 3000, GRAY_LIGHT), dataCell("TB granuloma complications, Crohn's disease", 3026, GRAY_LIGHT)] }),
new TableRow({ children: [dataCell("Antituberculosis Drugs (HRZE)", 3000), dataCell("Treat the causative organism driving Type IV granuloma in TB", 3000), dataCell("Tuberculosis", 3026)] }),
new TableRow({ children: [dataCell("Antigen Avoidance", 3000, GRAY_LIGHT), dataCell("Fundamental — remove sensitizing antigen entirely", 3000, GRAY_LIGHT), dataCell("Contact dermatitis (nickel, latex)", 3026, GRAY_LIGHT)] })
]),
spacer(160),
pageBreak(),
// ══════════════════════════════════════════
// FLOWCHART
// ══════════════════════════════════════════
h1("5. TYPE I HYPERSENSITIVITY — MECHANISM FLOWCHART"),
spacer(80),
// The flowchart is represented as a series of visually styled boxes using shaded paragraphs
new Paragraph({
children: [new TextRun({ text: "FIRST EXPOSURE TO ALLERGEN", font: "Arial", size: 22, bold: true, color: WHITE })],
shading: { type: ShadingType.SOLID, color: BLUE_MID, fill: BLUE_MID },
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 0 },
border: { top: { style: BorderStyle.THICK, size: 6, color: TEAL }, bottom: { style: BorderStyle.THICK, size: 6, color: TEAL }, left: { style: BorderStyle.THICK, size: 6, color: TEAL }, right: { style: BorderStyle.THICK, size: 6, color: TEAL } }
}),
new Paragraph({ children: [new TextRun({ text: "(Pollen, dust mite, penicillin, food antigen)", font: "Arial", size: 18, italics: true, color: "555555" })], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 80 } }),
new Paragraph({ children: [new TextRun({ text: "▼", font: "Arial", size: 28, bold: true, color: TEAL })], alignment: AlignmentType.CENTER, spacing: { after: 40 } }),
new Paragraph({
children: [new TextRun({ text: "Allergen → APCs present to Th2 cells → IL-4 and IL-13 released", font: "Arial", size: 20, color: BLUE_DARK })],
shading: { type: ShadingType.SOLID, color: BLUE_LIGHT, fill: BLUE_LIGHT },
alignment: AlignmentType.CENTER, spacing: { before: 0, after: 0 },
border: { top: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID }, bottom: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID }, left: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID }, right: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID } }
}),
new Paragraph({ children: [new TextRun({ text: "▼", font: "Arial", size: 28, bold: true, color: TEAL })], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 40 } }),
new Paragraph({
children: [new TextRun({ text: "B cells undergo class-switching → Produce IgE antibodies", font: "Arial", size: 20, color: BLUE_DARK })],
shading: { type: ShadingType.SOLID, color: BLUE_LIGHT, fill: BLUE_LIGHT },
alignment: AlignmentType.CENTER, spacing: { before: 0, after: 0 },
border: { top: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID }, bottom: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID }, left: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID }, right: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID } }
}),
new Paragraph({ children: [new TextRun({ text: "▼", font: "Arial", size: 28, bold: true, color: TEAL })], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 40 } }),
new Paragraph({
children: [new TextRun({ text: "IgE binds to FcεRI receptors on MAST CELLS and BASOPHILS → Patient is SENSITIZED", font: "Arial", size: 20, bold: true, color: BLUE_DARK })],
shading: { type: ShadingType.SOLID, color: BLUE_LIGHT, fill: BLUE_LIGHT },
alignment: AlignmentType.CENTER, spacing: { before: 0, after: 0 },
border: { top: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID }, bottom: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID }, left: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID }, right: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID } }
}),
spacer(80),
new Paragraph({
children: [new TextRun({ text: "SECOND EXPOSURE TO SAME ALLERGEN", font: "Arial", size: 22, bold: true, color: WHITE })],
shading: { type: ShadingType.SOLID, color: "C0392B", fill: "C0392B" },
alignment: AlignmentType.CENTER,
spacing: { before: 40, after: 0 },
border: { top: { style: BorderStyle.THICK, size: 6, color: "922B21" }, bottom: { style: BorderStyle.THICK, size: 6, color: "922B21" }, left: { style: BorderStyle.THICK, size: 6, color: "922B21" }, right: { style: BorderStyle.THICK, size: 6, color: "922B21" } }
}),
new Paragraph({ children: [new TextRun({ text: "▼", font: "Arial", size: 28, bold: true, color: TEAL })], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 40 } }),
new Paragraph({
children: [new TextRun({ text: "Allergen cross-links two IgE molecules on mast cell surface", font: "Arial", size: 20, color: BLACK })],
shading: { type: ShadingType.SOLID, color: "FDECEA", fill: "FDECEA" },
alignment: AlignmentType.CENTER, spacing: { before: 0, after: 0 },
border: { top: { style: BorderStyle.SINGLE, size: 4, color: "C0392B" }, bottom: { style: BorderStyle.SINGLE, size: 4, color: "C0392B" }, left: { style: BorderStyle.SINGLE, size: 4, color: "C0392B" }, right: { style: BorderStyle.SINGLE, size: 4, color: "C0392B" } }
}),
new Paragraph({ children: [new TextRun({ text: "▼", font: "Arial", size: 28, bold: true, color: TEAL })], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 40 } }),
new Paragraph({
children: [new TextRun({ text: "MAST CELL DEGRANULATION", font: "Arial", size: 24, bold: true, color: WHITE })],
shading: { type: ShadingType.SOLID, color: "922B21", fill: "922B21" },
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 0 },
border: { top: { style: BorderStyle.THICK, size: 8, color: "641E16" }, bottom: { style: BorderStyle.THICK, size: 8, color: "641E16" }, left: { style: BorderStyle.THICK, size: 8, color: "641E16" }, right: { style: BorderStyle.THICK, size: 8, color: "641E16" } }
}),
spacer(80),
// Two-column mediators
tableNoBorder([
new TableRow({
children: [
new TableCell({
width: { size: 4513, type: WidthType.DXA },
shading: { type: ShadingType.SOLID, color: "D6EAF8", fill: "D6EAF8" },
borders: { top: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID }, bottom: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID }, left: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID }, right: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID } },
children: [
new Paragraph({ children: [new TextRun({ text: "PREFORMED MEDIATORS", font: "Arial", size: 20, bold: true, color: BLUE_DARK })], alignment: AlignmentType.CENTER }),
new Paragraph({ children: [new TextRun({ text: "(Released immediately)", font: "Arial", size: 17, italics: true, color: "555555" })], alignment: AlignmentType.CENTER, spacing: { after: 60 } }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Histamine", font: "Arial", size: 19 })] }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Tryptase", font: "Arial", size: 19 })] }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Heparin", font: "Arial", size: 19 })] }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "ECF-A (Eosinophil Chemotactic Factor)", font: "Arial", size: 19 })] })
]
}),
new TableCell({
width: { size: 4513, type: WidthType.DXA },
shading: { type: ShadingType.SOLID, color: "FDEDEC", fill: "FDEDEC" },
borders: { top: { style: BorderStyle.SINGLE, size: 4, color: "C0392B" }, bottom: { style: BorderStyle.SINGLE, size: 4, color: "C0392B" }, left: { style: BorderStyle.SINGLE, size: 4, color: "C0392B" }, right: { style: BorderStyle.SINGLE, size: 4, color: "C0392B" } },
children: [
new Paragraph({ children: [new TextRun({ text: "NEWLY FORMED MEDIATORS", font: "Arial", size: 20, bold: true, color: "922B21" })], alignment: AlignmentType.CENTER }),
new Paragraph({ children: [new TextRun({ text: "(From arachidonic acid)", font: "Arial", size: 17, italics: true, color: "555555" })], alignment: AlignmentType.CENTER, spacing: { after: 60 } }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Leukotrienes C4, D4, E4", font: "Arial", size: 19 })] }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Prostaglandin D2 (PGD2)", font: "Arial", size: 19 })] }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "PAF (Platelet Activating Factor)", font: "Arial", size: 19 })] }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "TNF-α, IL-4, IL-5", font: "Arial", size: 19 })] })
]
})
]
})
]),
spacer(80),
new Paragraph({ children: [new TextRun({ text: "▼", font: "Arial", size: 28, bold: true, color: TEAL })], alignment: AlignmentType.CENTER, spacing: { before: 20, after: 20 } }),
tableNoBorder([
new TableRow({
children: [
new TableCell({
width: { size: 4513, type: WidthType.DXA },
shading: { type: ShadingType.SOLID, color: "E8F8F5", fill: "E8F8F5" },
borders: { top: { style: BorderStyle.SINGLE, size: 4, color: TEAL }, bottom: { style: BorderStyle.SINGLE, size: 4, color: TEAL }, left: { style: BorderStyle.SINGLE, size: 4, color: TEAL }, right: { style: BorderStyle.SINGLE, size: 4, color: TEAL } },
children: [
new Paragraph({ children: [new TextRun({ text: "LOCAL REACTION (Atopy)", font: "Arial", size: 20, bold: true, color: TEAL })], alignment: AlignmentType.CENTER }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Hay Fever", font: "Arial", size: 19 })] }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Asthma", font: "Arial", size: 19 })] }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Urticaria / Eczema", font: "Arial", size: 19 })] }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Food allergy", font: "Arial", size: 19 })] })
]
}),
new TableCell({
width: { size: 4513, type: WidthType.DXA },
shading: { type: ShadingType.SOLID, color: "FDEDEC", fill: "FDEDEC" },
borders: { top: { style: BorderStyle.SINGLE, size: 4, color: "C0392B" }, bottom: { style: BorderStyle.SINGLE, size: 4, color: "C0392B" }, left: { style: BorderStyle.SINGLE, size: 4, color: "C0392B" }, right: { style: BorderStyle.SINGLE, size: 4, color: "C0392B" } },
children: [
new Paragraph({ children: [new TextRun({ text: "SYSTEMIC REACTION (Anaphylaxis)", font: "Arial", size: 20, bold: true, color: "922B21" })], alignment: AlignmentType.CENTER }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Hypotension / Shock", font: "Arial", size: 19 })] }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Laryngeal edema", font: "Arial", size: 19 })] }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Bronchospasm", font: "Arial", size: 19 })] }),
new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun({ text: "Cardiovascular collapse — FATAL", font: "Arial", size: 19, bold: true })] })
]
})
]
})
]),
spacer(160),
// ══════════════════════════════════════════
// CONCLUSION
// ══════════════════════════════════════════
h1("CONCLUSION"),
spacer(80),
boxPara("Hypersensitivity reactions represent a spectrum of immune-mediated tissue damage with distinct mechanisms, mediators, and clinical presentations — their understanding is clinically indispensable for the rational selection of pharmacological agents, from epinephrine in anaphylaxis to calcineurin inhibitors in delayed-type hypersensitivity, and forms the immunological basis for treating allergic, autoimmune, and inflammatory diseases in clinical practice.", "E8F8F5"),
spacer(120),
// References
h2("References"),
bullet("Jawetz, Melnick & Adelberg's Medical Microbiology, 28th Edition — Chapter: Hypersensitivity (pp. 150-153)"),
bullet("Roitt's Essential Immunology, 13th Edition — Chapter 14: Allergy and Other Hypersensitivities"),
bullet("Janeway's Immunobiology, 10th Edition — Chapter 14: Allergic Diseases and Hypersensitivity Reactions"),
bullet("Goodman & Gilman's The Pharmacological Basis of Therapeutics, 14th Edition"),
bullet("Katzung's Basic and Clinical Pharmacology, 16th Edition"),
spacer(80)
]
}]
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync("/home/daytona/workspace/hypersensitivity/Hypersensitivity_Reactions_MPharm.docx", buffer);
console.log("DOCX generated successfully.");
}).catch(err => {
console.error("Error:", err);
process.exit(1);
});
cd /home/daytona/workspace/hypersensitivity && node generate.js 2>&1
python3 /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/workspace/hypersensitivity/Hypersensitivity_Reactions_MPharm.docx 2>&1
ls -lh /home/daytona/workspace/hypersensitivity/ && python3 -c "import zipfile; z=zipfile.ZipFile('/home/daytona/workspace/hypersensitivity/Hypersensitivity_Reactions_MPharm.docx'); print('Valid ZIP - files:', z.namelist()[:8])"
Hypersensitivity Reactions MPharm
Word Document · DOCX
| Section | Content |
|---|---|
| Title block | Styled header with subject, degree level, and marks |
| Header / Footer | Book sources on every page + page numbers |
| Definition | Highlighted teal-bordered box |
| Classification Table | Full 8-row Gell & Coombs comparison (all 4 types) |
| Mechanism — Type I | Step-by-step sensitization + elicitation phases, mediators table |
| Mechanism — Type II, III, IV | Detailed numbered steps with subtypes |
| Examples Table | 20 diseases mapped to their type |
| Pharmacological Management | 4 separate tables - one per type, with drug name, mechanism, clinical use |
| Type I Flowchart | Visual flow using colour-coded boxes (blue sensitization → red elicitation → dual outcome local/systemic) |
| Conclusion | One-line highlighted clinical importance statement |
| References | 5 standard textbooks cited |