Okay. You gave me the priority-wise chapters, uh, along with, you know, the essay's challenges. And my problem is, when I want to open an essay, And, you know, one essay can be of 10 pages. Even if only very few things are important in that, I have to scan through the 10 pages, and that is very overwhelming. So what I want you to do is... I want you to give me a PDF of... The priority by chapters like you gave before. And I want you to break down all the essays into short notes and give me the, you know, Short notes. Like the repeated previous year questions, essays, I want you to break it into short notes, and also the, you know, most important, the most repeated previous year question short notes also. Okay. Pathology tnmgr repeated pyq

Reading File
Asking for Preferences

Mbbs 2 nd year. Pathology

Asking for Preferences
Searching the Web

TNMGR 2nd year MBBS Pathology repeated previous year questions essays important topics

Finding Sources
Reading Web Page

https://medical-junction.com/mbbs-2nd-year-pathology-importa…

Finding Sources
Reading File
Running Command

mkdir -p /home/daytona/workspace/pathology-pyq && ls /home/daytona/workspace/pathology-pyq/

Writing File

~/pathology-pyq/build_pdf.py

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

OUTPUT = "/home/daytona/workspace/pathology-pyq/TNMGR_Pathology_PYQ_ShortNotes.pdf"

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    rightMargin=2*cm, leftMargin=2*cm,
    topMargin=2.5*cm, bottomMargin=2*cm,
    title="TNMGR 2nd Year Pathology - Priority Chapters & PYQ Short Notes",
    author="Orris Study Aid"
)

styles = getSampleStyleSheet()

# Custom styles
title_style = ParagraphStyle('MainTitle', parent=styles['Title'],
    fontSize=20, spaceAfter=8, spaceBefore=4,
    textColor=colors.HexColor('#1a237e'), alignment=TA_CENTER)

subtitle_style = ParagraphStyle('Subtitle', parent=styles['Normal'],
    fontSize=11, spaceAfter=16, alignment=TA_CENTER,
    textColor=colors.HexColor('#37474f'))

part_style = ParagraphStyle('PartHeader', parent=styles['Heading1'],
    fontSize=16, spaceAfter=6, spaceBefore=16,
    textColor=colors.white,
    backColor=colors.HexColor('#1a237e'),
    borderPad=6, leftIndent=-10, rightIndent=-10)

chapter_style = ParagraphStyle('ChapterHeader', parent=styles['Heading2'],
    fontSize=13, spaceAfter=4, spaceBefore=12,
    textColor=colors.white,
    backColor=colors.HexColor('#283593'),
    borderPad=4, leftIndent=-6)

topic_style = ParagraphStyle('TopicHeader', parent=styles['Heading3'],
    fontSize=11, spaceAfter=4, spaceBefore=10,
    textColor=colors.HexColor('#1a237e'),
    borderPad=2)

bullet_style = ParagraphStyle('Bullet', parent=styles['Normal'],
    fontSize=9.5, spaceAfter=2, spaceBefore=1,
    leftIndent=14, bulletIndent=4,
    leading=14)

sub_bullet_style = ParagraphStyle('SubBullet', parent=styles['Normal'],
    fontSize=9, spaceAfter=1, spaceBefore=1,
    leftIndent=28, bulletIndent=16,
    leading=13, textColor=colors.HexColor('#37474f'))

body_style = ParagraphStyle('Body', parent=styles['Normal'],
    fontSize=9.5, spaceAfter=4, spaceBefore=2,
    leading=14, alignment=TA_JUSTIFY)

tag_high = ParagraphStyle('TagHigh', parent=styles['Normal'],
    fontSize=8, textColor=colors.white,
    backColor=colors.HexColor('#c62828'),
    borderPad=2, spaceAfter=6)

tag_med = ParagraphStyle('TagMed', parent=styles['Normal'],
    fontSize=8, textColor=colors.white,
    backColor=colors.HexColor('#e65100'),
    borderPad=2, spaceAfter=6)

note_style = ParagraphStyle('Note', parent=styles['Normal'],
    fontSize=8.5, textColor=colors.HexColor('#1b5e20'),
    backColor=colors.HexColor('#f1f8e9'),
    borderPad=4, spaceAfter=6, leftIndent=4)

def h(text, style=chapter_style):
    return Paragraph(text, style)

def b(text):
    return Paragraph(f"• {text}", bullet_style)

def sb(text):
    return Paragraph(f"– {text}", sub_bullet_style)

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

def sp(n=6):
    return Spacer(1, n)

def hr():
    return HRFlowable(width="100%", thickness=0.5, color=colors.HexColor('#b0bec5'), spaceAfter=4)

def priority_tag(level):
    colors_map = {
        "HIGH": ("#c62828", "★★★ HIGH PRIORITY"),
        "MEDIUM": ("#e65100", "★★ MEDIUM PRIORITY"),
        "LOW": ("#558b2f", "★ LOWER PRIORITY"),
    }
    c, label = colors_map[level]
    return Paragraph(f"<font color='white'><b>{label}</b></font>",
                     ParagraphStyle('tag', parent=styles['Normal'],
                                    fontSize=7.5, backColor=colors.HexColor(c),
                                    borderPad=3, spaceAfter=4))

def repeat_tag(times):
    return Paragraph(f"<font color='white'><b>Repeated {times}x in TNMGR</b></font>",
                     ParagraphStyle('rtag', parent=styles['Normal'],
                                    fontSize=7.5, backColor=colors.HexColor('#1565c0'),
                                    borderPad=3, spaceAfter=6))

# ─────────────────────────────────────────────────────────────────
# CONTENT
# ─────────────────────────────────────────────────────────────────
story = []

# COVER
story.append(sp(30))
story.append(Paragraph("TNMGR 2nd Year MBBS", subtitle_style))
story.append(Paragraph("PATHOLOGY", title_style))
story.append(Paragraph("Priority Chapters + PYQ Essay Short Notes", subtitle_style))
story.append(sp(8))
story.append(hr())
story.append(Paragraph("Paper III: General Pathology & Haematology  |  Paper IV: Systemic Pathology", subtitle_style))
story.append(hr())
story.append(sp(20))
story.append(Paragraph("Based on TNMGR repeated PYQs (2005-2025)", subtitle_style))
story.append(Paragraph("Compiled by Orris Study Aid • July 2026", subtitle_style))
story.append(PageBreak())

# ─────────────────────────────────────────────────────────────────
# PART 1: PRIORITY CHAPTERS
# ─────────────────────────────────────────────────────────────────
story.append(h("PART 1: PRIORITY-WISE CHAPTER LIST", part_style))
story.append(sp(8))
story.append(p("<b>How to use:</b> Study HIGH priority chapters first - they appear every year. "
               "MEDIUM chapters appear most years. LOW chapters appear occasionally."))
story.append(sp(6))

# TABLE OF PRIORITY CHAPTERS
priority_data = [
    ["#", "Chapter", "Paper", "Priority", "Challenge"],
    ["1", "Inflammation (Acute + Chronic)", "P-III", "HIGH ★★★", "Medium"],
    ["2", "Cell Injury, Necrosis & Apoptosis", "P-III", "HIGH ★★★", "High"],
    ["3", "Haematology: Anemias", "P-III", "HIGH ★★★", "Medium"],
    ["4", "Neoplasia (Tumours)", "P-III", "HIGH ★★★", "High"],
    ["5", "Haematology: Leukaemias & Lymphomas", "P-III", "HIGH ★★★", "High"],
    ["6", "Wound Healing & Repair", "P-III", "HIGH ★★★", "Medium"],
    ["7", "Haemodynamic Disorders (Thrombosis, Embolism, Infarction)", "P-III", "HIGH ★★★", "High"],
    ["8", "Carcinoma Cervix & Female Genital Tract", "P-IV", "HIGH ★★★", "Medium"],
    ["9", "Glomerulonephritis & Nephrotic Syndrome", "P-IV", "HIGH ★★★", "High"],
    ["10", "Breast Carcinoma", "P-IV", "HIGH ★★★", "Medium"],
    ["11", "Liver: Hepatitis, Cirrhosis, HCC", "P-IV", "MEDIUM ★★", "High"],
    ["12", "Lung: TB, Pneumonia, Ca Lung", "P-IV", "MEDIUM ★★", "High"],
    ["13", "Immunology & Hypersensitivity", "P-III", "MEDIUM ★★", "High"],
    ["14", "Pathological Calcification & Pigments", "P-III", "MEDIUM ★★", "Low"],
    ["15", "Coagulation Disorders (DIC, Haemophilia)", "P-III", "MEDIUM ★★", "High"],
    ["16", "Cardiovascular: IHD, Atherosclerosis", "P-IV", "MEDIUM ★★", "High"],
    ["17", "GIT: PUD, IBD, Carcinoma Stomach/Colon", "P-IV", "MEDIUM ★★", "Medium"],
    ["18", "CNS Tumours & Meningitis", "P-IV", "LOW ★", "High"],
    ["19", "Endocrine: Thyroid & Adrenal", "P-IV", "LOW ★", "Medium"],
    ["20", "Amyloidosis & Metabolic Disorders", "P-III", "LOW ★", "Medium"],
]

col_widths = [1*cm, 7.5*cm, 1.6*cm, 2.5*cm, 2*cm]
t = Table(priority_data, colWidths=col_widths, repeatRows=1)
t.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a237e')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,0), 9),
    ('ALIGN', (0,0), (-1,-1), 'CENTER'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('FONTSIZE', (0,1), (-1,-1), 8.5),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#f5f5f5')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#b0bec5')),
    ('TOPPADDING', (0,0), (-1,-1), 4),
    ('BOTTOMPADDING', (0,0), (-1,-1), 4),
    # Color HIGH rows
    ('TEXTCOLOR', (3,1), (3,7), colors.HexColor('#b71c1c')),
    ('TEXTCOLOR', (3,8), (3,10), colors.HexColor('#b71c1c')),
    ('TEXTCOLOR', (3,11), (3,17), colors.HexColor('#e65100')),
    ('TEXTCOLOR', (3,18), (3,20), colors.HexColor('#2e7d32')),
    ('FONTNAME', (3,1), (3,-1), 'Helvetica-Bold'),
    ('ALIGN', (1,1), (1,-1), 'LEFT'),
]))
story.append(t)
story.append(PageBreak())

# ─────────────────────────────────────────────────────────────────
# PART 2: MOST REPEATED PYQ TOPICS (Quick Reference)
# ─────────────────────────────────────────────────────────────────
story.append(h("PART 2: MOST REPEATED PYQ TOPICS AT A GLANCE", part_style))
story.append(sp(6))
story.append(p("These topics have appeared <b>3+ times</b> in TNMGR exams. If time is short, master these first."))
story.append(sp(6))

repeated_data = [
    ["Topic", "Paper", "Times Repeated", "Type"],
    ["Iron Deficiency Anaemia", "P-III", "5+", "Essay + Short Note"],
    ["Carcinoma Cervix (etiopathogenesis, morphology)", "P-IV", "5+", "Essay"],
    ["Acute Inflammation", "P-III", "5+", "Essay + Short Note"],
    ["Necrosis (types, morphology)", "P-III", "5+", "Essay + Short Note"],
    ["Nephrotic Syndrome", "P-IV", "4+", "Essay + Short Note"],
    ["Wound Healing (1st & 2nd intention)", "P-III", "4+", "Essay"],
    ["Thrombosis & Embolism", "P-III", "4+", "Essay + Short Note"],
    ["Carcinoma Breast", "P-IV", "4+", "Essay"],
    ["Hodgkin's Lymphoma", "P-III", "4+", "Essay + Short Note"],
    ["Free Radical Injury", "P-III", "4+", "Short Note"],
    ["Glomerulonephritis (PSGN, RPGN)", "P-IV", "4+", "Essay"],
    ["Leukaemia (AML/ALL/CML)", "P-III", "4+", "Essay"],
    ["Liver Cirrhosis", "P-IV", "3+", "Essay"],
    ["Apoptosis", "P-III", "3+", "Short Note"],
    ["Pulmonary TB", "P-IV", "3+", "Essay + Short Note"],
    ["Myocardial Infarction / IHD", "P-IV", "3+", "Essay"],
    ["Hydatidiform Mole", "P-IV", "3+", "Short Note"],
    ["DIC (Disseminated Intravascular Coagulation)", "P-III", "3+", "Short Note"],
    ["Granuloma / Granulomatous Inflammation", "P-III", "3+", "Short Note"],
    ["Atherosclerosis", "P-IV", "3+", "Essay + Short Note"],
]

col_widths2 = [7*cm, 1.8*cm, 2.5*cm, 3.3*cm]
t2 = Table(repeated_data, colWidths=col_widths2, repeatRows=1)
t2.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#c62828')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,0), 9),
    ('ALIGN', (0,0), (-1,-1), 'CENTER'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('FONTSIZE', (0,1), (-1,-1), 8.5),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#fff8e1')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#ffcc80')),
    ('TOPPADDING', (0,0), (-1,-1), 4),
    ('BOTTOMPADDING', (0,0), (-1,-1), 4),
    ('ALIGN', (0,1), (0,-1), 'LEFT'),
    ('FONTNAME', (0,1), (0,-1), 'Helvetica-Bold'),
]))
story.append(t2)
story.append(PageBreak())

# ─────────────────────────────────────────────────────────────────
# PART 3: SHORT NOTES FOR EACH PYQ ESSAY TOPIC
# ─────────────────────────────────────────────────────────────────
story.append(h("PART 3: PYQ ESSAY SHORT NOTES", part_style))
story.append(sp(4))
story.append(p("<b>Format:</b> Each topic is broken into bite-sized bullet points covering Definition → "
               "Etiology → Pathogenesis → Morphology → Clinical features → Complications → Investigations. "
               "Write in exam answer format by expanding each bullet into 1-2 sentences."))
story.append(PageBreak())

# =====================================================================
# GENERAL PATHOLOGY & HAEMATOLOGY
# =====================================================================
story.append(h("SECTION A: GENERAL PATHOLOGY & HAEMATOLOGY (Paper III)", part_style))
story.append(sp(6))

# ──────────────────────────────────────────
# 1. NECROSIS
# ──────────────────────────────────────────
story.append(h("1. NECROSIS", chapter_style))
story.append(repeat_tag("5+"))
story.append(p("<b>Definition:</b> Necrosis = pathological death of cells/tissues in a <i>living</i> organism, "
               "due to irreversible cell injury. Characterised by cell swelling, membrane rupture, and inflammatory response."))
story.append(sp(4))

story.append(h("Types of Necrosis", topic_style))
items = [
    ("Coagulative Necrosis",
     ["Most common type; architecture preserved (ghost cells)", "Caused by ischaemia (e.g., MI, renal infarct)",
      "Gross: firm, pale yellow area; Micro: anucleate cells, preserved cytoplasm outline"]),
    ("Liquefactive Necrosis",
     ["Enzymatic dissolution - tissue becomes liquid", "Seen in: Brain infarcts (neurons + glial cells), Bacterial abscesses",
      "Gross: soft, cystic; Micro: neutrophils + liquefied debris"]),
    ("Caseous Necrosis",
     ["Cheese-like appearance; combination of coagulative + liquefactive", "Hallmark of Tuberculosis (also fungal infections)",
      "Micro: amorphous granular debris, surrounded by granuloma (epithelioid cells + Langhans giant cells)"]),
    ("Fat Necrosis",
     ["Two types: (a) Enzymatic - acute pancreatitis (lipase digests fat) → Saponification (calcium soap deposits)",
      "(b) Traumatic - breast trauma", "Gross: chalky white deposits; Micro: ghost adipocytes + calcium"]),
    ("Gangrenous Necrosis",
     ["Clinical term, not histological type", "Dry gangrene: coagulative + desiccation; arterial occlusion (limbs)",
      "Wet gangrene: liquefactive + bacterial superinfection (diabetic foot, bowel)",
      "Gas gangrene: Clostridium perfringens; crepitus present"]),
    ("Fibrinoid Necrosis",
     ["Seen in vessel walls in hypertension, immune complex disease (SLE)",
      "Micro: bright pink (fibrin-like) material deposited in vessel wall - homogeneous"]),
]
for name, pts in items:
    story.append(b(f"<b>{name}</b>"))
    for pt in pts:
        story.append(sb(pt))

story.append(sp(4))
story.append(h("Nuclear Changes in Necrosis (EXAM FAVOURITE)", topic_style))
story.append(b("<b>Pyknosis</b> - nuclear shrinkage and condensation (dark, small)"))
story.append(b("<b>Karyorrhexis</b> - nuclear fragmentation into pieces"))
story.append(b("<b>Karyolysis</b> - nuclear dissolution/fading (DNAse activity)"))
story.append(sp(4))

story.append(Paragraph("<b>Necrosis vs Apoptosis - Key Differences</b>", topic_style))
diff_data = [
    ["Feature", "Necrosis", "Apoptosis"],
    ["Cause", "Pathological (injury)", "Physiological or pathological"],
    ["Cell size", "Swells", "Shrinks"],
    ["Membrane", "Disrupted", "Intact (blebs form)"],
    ["Inflammation", "Yes (always)", "No"],
    ["DNA fragmentation", "Random", "Internucleosomal (ladder pattern)"],
    ["Energy", "Not required", "ATP-dependent"],
    ["Outcome", "Necrotic debris", "Apoptotic bodies (phagocytosed)"],
]
tdiff = Table(diff_data, colWidths=[3.5*cm, 4.5*cm, 4.5*cm], repeatRows=1)
tdiff.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 8.5),
    ('ALIGN', (0,0), (-1,-1), 'LEFT'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#e8eaf6')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(tdiff)
story.append(sp(8))

# ──────────────────────────────────────────
# 2. APOPTOSIS
# ──────────────────────────────────────────
story.append(h("2. APOPTOSIS", chapter_style))
story.append(repeat_tag("3+"))
story.append(p("<b>Definition:</b> Programmed cell death - controlled, energy-dependent process of single cell suicide. No inflammation."))
story.append(sp(4))
story.append(h("Pathways", topic_style))
story.append(b("<b>Intrinsic (Mitochondrial) Pathway:</b>"))
story.append(sb("Triggers: DNA damage, hypoxia, oxidative stress, lack of growth factors"))
story.append(sb("p53 upregulates → BAX (pro-apoptotic) increases, BCL-2 (anti-apoptotic) decreases"))
story.append(sb("Cytochrome C released from mitochondria → Apoptosome → activates Caspase 9 → Caspase 3"))
story.append(sb("Caspase 3 = executioner caspase → DNA fragmentation, cell death"))
story.append(b("<b>Extrinsic (Death Receptor) Pathway:</b>"))
story.append(sb("FasL binds Fas (CD95) → DISC formation → activates Caspase 8 → Caspase 3"))
story.append(sb("TNF-alpha binds TNFR1 → same result"))
story.append(sp(4))
story.append(h("Morphological Features", topic_style))
story.append(b("Cell shrinkage, condensed chromatin (pyknosis)"))
story.append(b("Membrane blebbing → Apoptotic bodies (membrane-bound fragments)"))
story.append(b("Phagocytosed by macrophages / neighbouring cells"))
story.append(b("No inflammation"))
story.append(sp(4))
story.append(h("Examples", topic_style))
story.append(b("Physiological: embryogenesis, endometrial shedding, thymic T-cell selection, lactating breast involution"))
story.append(b("Pathological: viral hepatitis (Councilman bodies), cancer radiation/chemo, AIDS (CD4 T-cell loss)"))
story.append(sp(8))

# ──────────────────────────────────────────
# 3. CELL INJURY / FREE RADICAL INJURY
# ──────────────────────────────────────────
story.append(h("3. CELL INJURY & FREE RADICAL INJURY", chapter_style))
story.append(repeat_tag("4+"))
story.append(h("Causes of Cell Injury", topic_style))
story.append(b("Hypoxia/Ischaemia (most common)"))
story.append(b("Physical agents: heat, cold, radiation, trauma"))
story.append(b("Chemical agents: drugs, toxins, heavy metals"))
story.append(b("Infections: bacteria, viruses, parasites"))
story.append(b("Immunological: hypersensitivity, autoimmune"))
story.append(b("Genetic defects"))
story.append(b("Nutritional imbalances"))
story.append(sp(4))
story.append(h("Free Radical Injury (EXAM FAVOURITE Short Note)", topic_style))
story.append(p("Free radicals = atoms with unpaired electron in outer orbit → highly reactive → oxidative damage."))
story.append(b("<b>Types of ROS (Reactive Oxygen Species):</b>"))
story.append(sb("Superoxide (O2•-): generated by mitochondria"))
story.append(sb("Hydrogen peroxide (H2O2): not itself a free radical but reactive"))
story.append(sb("Hydroxyl radical (OH•): most destructive - via Fenton reaction (Fe2+ + H2O2)"))
story.append(sb("Nitric oxide (NO•)"))
story.append(b("<b>Sources:</b> normal metabolism, reperfusion injury, radiation, drugs (CCl4), smoking"))
story.append(b("<b>Damage caused:</b>"))
story.append(sb("Lipid peroxidation - membrane damage"))
story.append(sb("DNA damage - single/double strand breaks"))
story.append(sb("Protein oxidation - enzyme inactivation"))
story.append(b("<b>Antioxidant defences:</b>"))
story.append(sb("SOD (Superoxide Dismutase) - converts O2•- → H2O2"))
story.append(sb("Catalase - converts H2O2 → H2O + O2"))
story.append(sb("Glutathione peroxidase"))
story.append(sb("Vitamins C, E; Ceruloplasmin; Transferrin"))
story.append(sp(8))

# ──────────────────────────────────────────
# 4. ACUTE INFLAMMATION
# ──────────────────────────────────────────
story.append(h("4. ACUTE INFLAMMATION", chapter_style))
story.append(repeat_tag("5+"))
story.append(p("<b>Definition:</b> Rapid host response to injury/infection. Dominated by vascular changes and neutrophil exudation. "
               "Duration: hours to days."))
story.append(sp(4))
story.append(h("Vascular Changes (STEP 1)", topic_style))
story.append(b("Transient vasoconstriction → Vasodilation (histamine, NO) → Increased blood flow → Redness + Heat"))
story.append(b("Increased vascular permeability → Protein-rich exudate leaks out → Oedema"))
story.append(h("Mechanisms of Increased Permeability", topic_style))
story.append(b("Endothelial contraction - histamine, bradykinin, leukotrienes (immediate, reversible)"))
story.append(b("Endothelial injury - direct/neutrophil mediated (delayed, sustained)"))
story.append(b("Transcytosis - VEGF-mediated vesicular transport"))
story.append(sp(4))
story.append(h("Cellular Events (STEP 2) - Neutrophil Emigration", topic_style))
story.append(b("<b>1. Margination</b> - neutrophils move to periphery (slowing blood flow)"))
story.append(b("<b>2. Rolling</b> - loose adhesion via Selectins (E-selectin on endothelium, L-selectin on neutrophil)"))
story.append(b("<b>3. Adhesion</b> - firm adhesion via Integrins (CD11/CD18) + ICAM-1; activated by IL-1, TNF, C5a"))
story.append(b("<b>4. Transmigration (Diapedesis)</b> - through endothelial junctions; PECAM-1 (CD31) important"))
story.append(b("<b>5. Chemotaxis</b> - directed migration toward C5a, LTB4, IL-8, bacterial products (fMLP)"))
story.append(sp(4))
story.append(h("Phagocytosis", topic_style))
story.append(b("Recognition + Opsonisation (IgG, C3b coat the pathogen)"))
story.append(b("Engulfment → Phagosome formation"))
story.append(b("Killing: O2-dependent (ROS via NADPH oxidase) + O2-independent (lysozyme, defensins)"))
story.append(sp(4))
story.append(h("Chemical Mediators of Inflammation", topic_style))
mediator_data = [
    ["Mediator", "Source", "Main Action"],
    ["Histamine", "Mast cells, platelets", "Vasodilation, permeability↑"],
    ["Serotonin", "Platelets", "Vasoconstriction, permeability↑"],
    ["Prostaglandins", "Arachidonic acid (COX)", "Pain, fever, vasodilation"],
    ["Leukotrienes (LTB4)", "Arachidonic acid (LOX)", "Chemotaxis, permeability↑"],
    ["Complement (C3a, C5a)", "Plasma", "Mast cell activation, chemotaxis, opsonisation"],
    ["Bradykinin", "Plasma (kinin system)", "Pain, permeability↑, vasodilation"],
    ["IL-1, TNF", "Macrophages", "Acute phase response, fever, leukocyte activation"],
    ["NO", "Endothelium, macrophages", "Vasodilation, kills microbes"],
]
tm = Table(mediator_data, colWidths=[3.5*cm, 4*cm, 7*cm], repeatRows=1)
tm.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 8),
    ('ALIGN', (0,0), (-1,-1), 'LEFT'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#e8eaf6')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(tm)
story.append(sp(4))
story.append(h("Morphological Forms of Acute Inflammation", topic_style))
story.append(b("<b>Serous</b> - watery exudate; e.g., blister, pleural effusion (viral)"))
story.append(b("<b>Fibrinous</b> - fibrin-rich; e.g., lobar pneumonia, pericarditis"))
story.append(b("<b>Suppurative (Purulent)</b> - pus (dead neutrophils + bacteria); e.g., abscess, empyema"))
story.append(b("<b>Ulcerative</b> - surface epithelium lost; e.g., peptic ulcer"))
story.append(b("<b>Pseudomembranous</b> - membrane of fibrin + necrotic cells; e.g., C. diff colitis, diphtheria"))
story.append(sp(4))
story.append(h("Outcomes", topic_style))
story.append(b("Resolution - complete restoration (if minimal injury, good blood supply)"))
story.append(b("Organisation + Repair - fibrosis if much tissue destroyed"))
story.append(b("Chronicity - chronic inflammation if agent persists"))
story.append(b("Suppuration - abscess formation"))
story.append(sp(8))

# ──────────────────────────────────────────
# 5. CHRONIC INFLAMMATION + GRANULOMA
# ──────────────────────────────────────────
story.append(h("5. CHRONIC INFLAMMATION & GRANULOMA", chapter_style))
story.append(repeat_tag("3+"))
story.append(p("<b>Chronic Inflammation:</b> Prolonged inflammation where tissue destruction and repair occur simultaneously. "
               "Dominated by mononuclear cells (lymphocytes, macrophages, plasma cells)."))
story.append(sp(4))
story.append(h("Causes", topic_style))
story.append(b("Persistent infection (TB, H. pylori, leprosy)"))
story.append(b("Autoimmune disease (RA, SLE)"))
story.append(b("Prolonged toxic exposure (silica, asbestos)"))
story.append(b("Follows acute inflammation"))
story.append(sp(4))
story.append(h("Granulomatous Inflammation", topic_style))
story.append(p("<b>Granuloma:</b> Focal collection of activated macrophages (epithelioid cells), often with Langhans giant cells, "
               "lymphocytes, and sometimes central necrosis."))
story.append(b("<b>Epithelioid cells:</b> activated macrophages with abundant pale cytoplasm, oval nuclei"))
story.append(b("<b>Giant cells:</b>"))
story.append(sb("Langhans giant cell - nuclei arranged at periphery in horseshoe (TB)"))
story.append(sb("Foreign body giant cell - nuclei scattered centrally (suture, talc)"))
story.append(sb("Touton giant cell - foamy cytoplasm centre (xanthoma, fat necrosis)"))
story.append(b("<b>Caseating granuloma</b> - central caseous necrosis; classic for TB, fungal"))
story.append(b("<b>Non-caseating granuloma</b> - no necrosis; sarcoidosis, Crohn's, berylliosis"))
story.append(sp(4))
story.append(Paragraph("<b>Common Granulomatous Diseases:</b>", body_style))
gran_data = [
    ["Disease", "Type of granuloma", "Organism/Cause"],
    ["Tuberculosis", "Caseating", "M. tuberculosis"],
    ["Leprosy", "Non-caseating (tuberculoid) / diffuse (lepromatous)", "M. leprae"],
    ["Sarcoidosis", "Non-caseating (naked granuloma)", "Unknown"],
    ["Crohn's disease", "Non-caseating", "Unknown"],
    ["Silicosis", "Nodular (concentric layers)", "Silica dust"],
    ["Syphilis", "Gumma (extensive necrosis)", "T. pallidum"],
]
tg = Table(gran_data, colWidths=[3.5*cm, 5*cm, 4.5*cm], repeatRows=1)
tg.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 8),
    ('ALIGN', (0,0), (-1,-1), 'LEFT'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#e8eaf6')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(tg)
story.append(sp(8))

# ──────────────────────────────────────────
# 6. WOUND HEALING
# ──────────────────────────────────────────
story.append(h("6. WOUND HEALING & REPAIR", chapter_style))
story.append(repeat_tag("4+"))
story.append(h("Types of Healing", topic_style))
story.append(b("<b>Primary intention (1st intention):</b> Clean wound, edges approximated (sutured)"))
story.append(sb("Minimal inflammation, minimal granulation tissue, thin scar"))
story.append(sb("Timeline: Day 1-3: neutrophils; Day 3-5: macrophages + fibroblasts; Week 1: collagen; Week 2-3: scar maturation"))
story.append(b("<b>Secondary intention (2nd intention):</b> Large gaping wound, cannot be sutured"))
story.append(sb("More inflammation, more granulation tissue (pink, granular), wound contraction (myofibroblasts)"))
story.append(sb("Results in larger, less cosmetic scar"))
story.append(sp(4))
story.append(h("Phases of Wound Healing", topic_style))
story.append(b("<b>1. Inflammation phase (0-3 days):</b> clot forms, neutrophils debride, macrophages arrive"))
story.append(b("<b>2. Proliferative phase (4 days - 3 weeks):</b> angiogenesis (VEGF), fibroblast proliferation, collagen synthesis, epithelialisation"))
story.append(b("<b>3. Remodelling phase (weeks to months):</b> Collagen III → Collagen I, wound gains tensile strength (max 80% of original)"))
story.append(sp(4))
story.append(h("Factors Affecting Wound Healing", topic_style))
story.append(b("<b>Local factors:</b> wound size/depth, blood supply, infection, foreign body, mechanical stress"))
story.append(b("<b>Systemic factors:</b>"))
story.append(sb("Nutrition: Vitamin C (hydroxylation of proline/lysine for collagen), Zinc, Protein"))
story.append(sb("Diabetes mellitus - impaired angiogenesis, susceptibility to infection"))
story.append(sb("Steroids/NSAIDs - inhibit inflammation and collagen synthesis"))
story.append(sb("Anaemia, immunodeficiency, old age"))
story.append(sp(4))
story.append(h("Complications of Wound Healing", topic_style))
story.append(b("<b>Keloid:</b> excessive collagen beyond wound margins; Collagen type III; familial; more in Africans"))
story.append(b("<b>Hypertrophic scar:</b> excessive collagen within wound margins; regresses spontaneously"))
story.append(b("<b>Wound dehiscence</b> (opening) - Vit C deficiency, infection"))
story.append(b("<b>Incisional hernia</b>"))
story.append(b("<b>Contracture</b> - myofibroblast contraction; e.g., Dupuytren's, burn scar"))
story.append(sp(8))

# ──────────────────────────────────────────
# 7. THROMBOSIS & EMBOLISM
# ──────────────────────────────────────────
story.append(h("7. THROMBOSIS, EMBOLISM & INFARCTION", chapter_style))
story.append(repeat_tag("4+"))
story.append(h("Virchow's Triad (always mention)", topic_style))
story.append(b("<b>Endothelial injury</b> - exposes collagen → platelet adhesion (most important in arteries)"))
story.append(b("<b>Abnormal blood flow</b> - stasis (veins, AF) or turbulence (atherosclerosis) → thrombus"))
story.append(b("<b>Hypercoagulability</b> - inherited (Factor V Leiden, Protein C/S deficiency) or acquired (OCP, malignancy, pregnancy)"))
story.append(sp(4))
story.append(h("Fate of Thrombus", topic_style))
story.append(b("<b>Resolution:</b> fibrinolysis (within hours-days)"))
story.append(b("<b>Organisation:</b> fibroblasts + capillaries grow in → recanalisation"))
story.append(b("<b>Propagation:</b> extends along vessel"))
story.append(b("<b>Embolisation:</b> breaks off"))
story.append(sp(4))
story.append(h("Pulmonary Thromboembolism (PTE)", topic_style))
story.append(b("Source: deep vein thrombosis (DVT) of leg veins (95% cases)"))
story.append(b("Saddle embolus at main pulmonary artery bifurcation → sudden death"))
story.append(b("Massive PTE: right heart failure, shock, death"))
story.append(b("Small PTE: may cause pulmonary infarction (haemorrhagic, wedge-shaped, pleuritic pain)"))
story.append(sp(4))
story.append(h("Other Emboli", topic_style))
story.append(b("<b>Fat embolism:</b> long bone fractures; fat globules in lung, brain, kidney; petechiae, confusion, hypoxia"))
story.append(b("<b>Air embolism:</b> >100mL air to right heart; decompression sickness"))
story.append(b("<b>Amniotic fluid embolism:</b> rare, obstetric emergency; DIC + ARDS"))
story.append(b("<b>Tumour embolism, Septic embolism</b>"))
story.append(sp(4))
story.append(h("Infarction", topic_style))
story.append(b("<b>Red (haemorrhagic) infarct:</b> lung (dual blood supply), intestine (soft tissue), reperfused tissue"))
story.append(b("<b>White (anaemic) infarct:</b> heart, kidney, spleen (solid organs, end-arteries)"))
story.append(b("<b>Morphology:</b> pale, wedge-shaped (apex to obstruction), coagulative necrosis after 24 hrs"))
story.append(sp(8))

# ──────────────────────────────────────────
# 8. NEOPLASIA
# ──────────────────────────────────────────
story.append(h("8. NEOPLASIA (TUMOURS)", chapter_style))
story.append(repeat_tag("4+"))
story.append(p("<b>Definition (Willis):</b> Neoplasm = abnormal mass of tissue whose growth exceeds and is uncoordinated with that "
               "of normal tissue, and persists in the same excessive manner after cessation of stimuli."))
story.append(sp(4))
story.append(h("Benign vs Malignant Tumour", topic_style))
bm_data = [
    ["Feature", "Benign", "Malignant"],
    ["Differentiation", "Well differentiated", "Poorly/Anaplastic"],
    ["Growth rate", "Slow", "Fast, uncontrolled"],
    ["Capsule", "Present (encapsulated)", "Absent (infiltrative)"],
    ["Invasion", "No", "Yes (local invasion)"],
    ["Metastasis", "No", "Yes"],
    ["Recurrence", "Rare", "Common"],
    ["Effect on host", "Local pressure only", "Cachexia, destruction"],
    ["Mitoses", "Rare, normal", "Numerous, abnormal"],
]
tbm = Table(bm_data, colWidths=[4*cm, 4.5*cm, 4.5*cm], repeatRows=1)
tbm.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 8.5),
    ('ALIGN', (0,0), (-1,-1), 'LEFT'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#e8eaf6')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(tbm)
story.append(sp(4))
story.append(h("Metastasis - Pathways of Spread", topic_style))
story.append(b("<b>Lymphatic spread</b> - carcinomas (epithelial); sentinel lymph node concept"))
story.append(b("<b>Haematogenous spread</b> - sarcomas (bone, muscle); via veins; liver and lung most common sites"))
story.append(b("<b>Transcoelomic (seeding)</b> - peritoneal/pleural cavities; e.g., ovarian Ca → peritoneal seeding"))
story.append(b("<b>Perineural spread</b> - prostate, pancreatic Ca"))
story.append(b("<b>Direct/Local invasion</b> - infiltrates adjacent tissues"))
story.append(sp(4))
story.append(h("Oncogenes & Tumour Suppressor Genes", topic_style))
story.append(b("Proto-oncogene → Mutation/Amplification → Oncogene → uncontrolled growth signals"))
story.append(b("Examples: RAS (most commonly mutated), MYC, HER2/neu (breast Ca), BCR-ABL (CML)"))
story.append(b("Tumour suppressor genes: TP53 (guardian of genome, mutated in 50% cancers), RB (retinoblastoma), APC (colon Ca)"))
story.append(b("'Two-hit hypothesis' (Knudson) - both alleles must be inactivated for TSG loss"))
story.append(sp(4))
story.append(h("Carcinogenesis - Hallmarks of Cancer (Hanahan & Weinberg)", topic_style))
story.append(b("Self-sufficiency in growth signals"))
story.append(b("Insensitivity to anti-growth signals"))
story.append(b("Evading apoptosis"))
story.append(b("Limitless replicative potential (telomerase activation)"))
story.append(b("Sustained angiogenesis (VEGF)"))
story.append(b("Tissue invasion and metastasis"))
story.append(b("Reprogramming energy metabolism (Warburg effect)"))
story.append(b("Evading immune destruction"))
story.append(sp(8))

# ──────────────────────────────────────────
# 9. IRON DEFICIENCY ANAEMIA
# ──────────────────────────────────────────
story.append(PageBreak())
story.append(h("9. IRON DEFICIENCY ANAEMIA (IDA)", chapter_style))
story.append(repeat_tag("5+"))
story.append(p("<b>Most common anaemia worldwide.</b> Microcytic hypochromic anaemia due to inadequate iron for haemoglobin synthesis."))
story.append(sp(4))
story.append(h("Causes (EXAM: know by age group)", topic_style))
story.append(b("<b>Inadequate intake:</b> infants, toddlers, pregnant women, elderly"))
story.append(b("<b>Increased demand:</b> pregnancy, infancy, adolescence"))
story.append(b("<b>Impaired absorption:</b> coeliac disease, gastrectomy, duodenal bypass"))
story.append(b("<b>Chronic blood loss</b> (most common cause in adults):"))
story.append(sb("Males/post-menopausal women → GI bleeding (PUD, CRC, hookworm)"))
story.append(sb("Pre-menopausal women → Menorrhagia"))
story.append(sp(4))
story.append(h("Stages of IDA", topic_style))
story.append(b("<b>Stage 1 - Storage depletion:</b> serum ferritin ↓, no anaemia yet"))
story.append(b("<b>Stage 2 - Transport depletion:</b> serum iron ↓, TIBC ↑, transferrin saturation ↓"))
story.append(b("<b>Stage 3 - Functional depletion:</b> Hb falls, anaemia develops, RBCs become microcytic hypochromic"))
story.append(sp(4))
story.append(h("Lab Findings (CRITICAL for exam)", topic_style))
ida_data = [
    ["Parameter", "Finding in IDA"],
    ["Haemoglobin", "Decreased"],
    ["MCV", "Low (<80 fL) - microcytic"],
    ["MCH", "Low (<27 pg) - hypochromic"],
    ["Serum Iron", "Decreased"],
    ["TIBC (Transferrin)", "Increased"],
    ["Transferrin Saturation", "Decreased (<16%)"],
    ["Serum Ferritin", "Decreased (earliest marker)"],
    ["Peripheral smear", "Microcytic hypochromic RBCs, pencil cells, anisocytosis"],
    ["Reticulocytes", "Normal or low"],
    ["Bone marrow", "No stainable iron (Prussian blue -ve)"],
]
tida = Table(ida_data, colWidths=[5*cm, 9.5*cm], repeatRows=1)
tida.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 8.5),
    ('ALIGN', (0,0), (-1,-1), 'LEFT'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#fff8e1')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#ffcc80')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(tida)
story.append(sp(4))
story.append(h("Clinical Features", topic_style))
story.append(b("General: fatigue, weakness, pallor, exertional dyspnoea, tachycardia"))
story.append(b("<b>Specific to IDA:</b>"))
story.append(sb("Koilonychia (spoon nails) - brittle, spoon-shaped nails"))
story.append(sb("Angular stomatitis, glossitis (beefy red tongue), cheilosis"))
story.append(sb("Plummer-Vinson syndrome: IDA + dysphagia + oesophageal web (risk of oesophageal Ca)"))
story.append(sb("Pica: craving for non-food items (ice, clay, chalk)"))
story.append(sp(8))

# ──────────────────────────────────────────
# 10. HODGKIN'S LYMPHOMA
# ──────────────────────────────────────────
story.append(h("10. HODGKIN'S LYMPHOMA", chapter_style))
story.append(repeat_tag("4+"))
story.append(p("<b>Definition:</b> Malignant lymphoma characterised by presence of Reed-Sternberg (RS) cells in an appropriate cellular background."))
story.append(sp(4))
story.append(h("Reed-Sternberg (RS) Cell - EXAM FAVOURITE", topic_style))
story.append(b("Large cell (15-45 μm), abundant pale cytoplasm"))
story.append(b("BINUCLEATE or multinucleate with prominent eosinophilic nucleoli ('Owl eye' appearance)"))
story.append(b("CD15+, CD30+ (marker), CD20-, CD45-"))
story.append(b("Lacunar cell variant - in nodular sclerosis type (retraction artifact)"))
story.append(b("Lymphocytic and histiocytic (L&H / 'Popcorn') cell - in lymphocyte predominance type"))
story.append(sp(4))
story.append(h("WHO Classification (Ann Arbor)", topic_style))
hl_data = [
    ["Type", "Frequency", "RS Cells", "Background", "Prognosis"],
    ["Nodular Sclerosis", "65-70%", "Lacunar cells", "Collagen bands", "Good"],
    ["Mixed Cellularity", "25%", "Classic RS", "Mixed (EOS, plasma)", "Intermediate"],
    ["Lymphocyte Rich", "5%", "Rare", "Lymphocytes", "Best"],
    ["Lymphocyte Depleted", "<1%", "Many, pleomorphic", "Few lymphocytes", "Worst"],
    ["Nodular LP", "5%", "Popcorn cells", "B lymphocytes", "Good"],
]
thl = Table(hl_data, colWidths=[3*cm, 2cm, 2.5*cm, 3*cm, 2cm], repeatRows=1)
thl.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 8),
    ('ALIGN', (0,0), (-1,-1), 'CENTER'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#e8eaf6')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
    ('ALIGN', (0,1), (0,-1), 'LEFT'),
]))
story.append(thl)
story.append(sp(4))
story.append(h("Ann Arbor Staging", topic_style))
story.append(b("Stage I: Single lymph node region"))
story.append(b("Stage II: 2+ regions on SAME side of diaphragm"))
story.append(b("Stage III: Both sides of diaphragm"))
story.append(b("Stage IV: Diffuse extra-nodal spread (liver, bone marrow, lung)"))
story.append(b("'B' symptoms: fever >38°C, drenching night sweats, >10% weight loss in 6 months → worse prognosis"))
story.append(sp(8))

# ──────────────────────────────────────────
# 11. LEUKAEMIA
# ──────────────────────────────────────────
story.append(h("11. LEUKAEMIA", chapter_style))
story.append(repeat_tag("4+"))
story.append(p("<b>Definition:</b> Malignant neoplasm of haematopoietic precursor cells originating in bone marrow, "
               "flooding the blood with abnormal immature cells (blasts)."))
story.append(sp(4))
story.append(h("Classification", topic_style))
story.append(b("<b>Acute:</b> blasts >20% in marrow; aggressive; AML (myeloid) or ALL (lymphoid)"))
story.append(b("<b>Chronic:</b> more mature cells; slower; CML (myeloid) or CLL (lymphoid)"))
story.append(sp(4))
story.append(h("CML - Chronic Myeloid Leukaemia", topic_style))
story.append(b("Philadelphia chromosome: t(9;22) → BCR-ABL fusion gene → uncontrolled tyrosine kinase"))
story.append(b("Peripheral blood: massive leukocytosis (WBC >100,000), all stages of myeloid maturation"))
story.append(b("Basophilia + Eosinophilia characteristic"))
story.append(b("LAP (Leukocyte Alkaline Phosphatase) score: LOW (vs. leukemoid reaction where LAP is HIGH)"))
story.append(b("Splenomegaly (massive)"))
story.append(b("Treatment: Imatinib (Gleevec) - BCR-ABL tyrosine kinase inhibitor"))
story.append(sp(4))
story.append(h("ALL - Acute Lymphoblastic Leukaemia", topic_style))
story.append(b("Most common childhood cancer (peak 2-5 years)"))
story.append(b("Lymphoblasts; TdT+ (terminal deoxynucleotidyl transferase) - marker"))
story.append(b("CD10+ (CALLA) in B-ALL"))
story.append(b("CNS involvement and mediastinal mass (T-ALL)"))
story.append(b("Best prognosis of all leukaemias with treatment"))
story.append(sp(4))
story.append(h("AML - Acute Myeloid Leukaemia", topic_style))
story.append(b("Adults; Auer rods (pink needle-shaped rods in blast cytoplasm) - pathognomonic"))
story.append(b("AML M3 (APL - Acute Promyelocytic): t(15;17); DIC complication; Rx: All-trans retinoic acid (ATRA)"))
story.append(b("Myeloperoxidase+ (MPO)"))
story.append(sp(8))

# ──────────────────────────────────────────
# 12. DIC
# ──────────────────────────────────────────
story.append(h("12. DIC - DISSEMINATED INTRAVASCULAR COAGULATION", chapter_style))
story.append(repeat_tag("3+"))
story.append(p("<b>Definition:</b> Thrombohaemorrhagic disorder - simultaneous widespread microvascular thrombosis "
               "consuming coagulation factors and platelets, leading to bleeding."))
story.append(sp(4))
story.append(h("Causes", topic_style))
story.append(b("Obstetric: amniotic fluid embolism, abruptio placentae, eclampsia, septic abortion"))
story.append(b("Infections: gram-negative sepsis (LPS triggers), meningococcemia"))
story.append(b("Malignancy: AML M3 (APL) - most common haematological cause; mucin-secreting adenocarcinomas"))
story.append(b("Massive transfusion, snake bite, liver disease"))
story.append(sp(4))
story.append(h("Lab Findings", topic_style))
story.append(b("PT, PTT: prolonged (factors consumed)"))
story.append(b("Platelets: decreased (thrombocytopenia)"))
story.append(b("Fibrinogen: decreased (consumed)"))
story.append(b("<b>D-dimers: INCREASED</b> (hallmark - fibrin degradation products)"))
story.append(b("Peripheral smear: Schistocytes (microangiopathic haemolytic anaemia)"))
story.append(sp(8))

# =====================================================================
# SYSTEMIC PATHOLOGY
# =====================================================================
story.append(PageBreak())
story.append(h("SECTION B: SYSTEMIC PATHOLOGY (Paper IV)", part_style))
story.append(sp(6))

# ──────────────────────────────────────────
# 13. NEPHROTIC SYNDROME + GN
# ──────────────────────────────────────────
story.append(h("13. NEPHROTIC SYNDROME & GLOMERULONEPHRITIS", chapter_style))
story.append(repeat_tag("4+"))
story.append(h("Nephrotic Syndrome - Features", topic_style))
story.append(b("Proteinuria >3.5 g/day (massive)"))
story.append(b("Hypoalbuminaemia (<3 g/dL)"))
story.append(b("Generalised oedema (anasarca) - pitting, periorbital (worse in morning)"))
story.append(b("Hyperlipidaemia + Lipiduria (oval fat bodies, 'Maltese cross' polarised light)"))
story.append(b("Hypercoagulability (loss of AT-III, Protein C/S)"))
story.append(sp(4))
story.append(h("Minimal Change Disease (Lipoid Nephrosis)", topic_style))
story.append(b("Most common nephrotic syndrome in CHILDREN"))
story.append(b("LM: normal glomeruli; EM: effacement (fusion) of podocyte foot processes"))
story.append(b("No immune deposits (IF negative)"))
story.append(b("Excellent response to steroids"))
story.append(sp(4))
story.append(h("Membranous Nephropathy", topic_style))
story.append(b("Most common nephrotic syndrome in ADULTS"))
story.append(b("LM: diffuse capillary wall thickening; 'spike and dome' pattern on EM"))
story.append(b("Granular IgG + C3 deposits on IF (subepithelial)"))
story.append(b("Associations: HBV, malaria, drugs (gold, penicillamine), SLE, Ca colon"))
story.append(sp(4))
story.append(h("Post-Streptococcal GN (Nephritic Syndrome)", topic_style))
story.append(b("2-3 weeks after Group A beta-haemolytic strep infection (pharyngitis > skin)"))
story.append(b("Haematuria (cola/smoky urine), hypertension, oliguria, oedema"))
story.append(b("LM: diffuse hypercellular glomeruli (endocapillary proliferation), neutrophils"))
story.append(b("EM: subepithelial 'humps' (immune complex deposits)"))
story.append(b("IF: granular IgG + C3 ('lumpy bumpy' pattern)"))
story.append(b("ASO titre elevated; C3 low; prognosis good in children"))
story.append(sp(4))
story.append(h("Crescentic GN (RPGN)", topic_style))
story.append(b("Rapidly Progressive GN: rapid decline in renal function over days-weeks"))
story.append(b("Hallmark: Epithelial crescents (compressed, obliterated capillaries)"))
story.append(b("Type I: Anti-GBM (Goodpasture's) - linear IgG on IF; lung haemorrhage + nephritis"))
story.append(b("Type II: Immune complex (SLE, PSGN) - granular IF"))
story.append(b("Type III: Pauci-immune (ANCA-associated - Wegener's, MPA) - no/little IF deposits"))
story.append(sp(8))

# ──────────────────────────────────────────
# 14. CARCINOMA CERVIX
# ──────────────────────────────────────────
story.append(h("14. CARCINOMA CERVIX", chapter_style))
story.append(repeat_tag("5+"))
story.append(p("<b>Most common gynaecological malignancy in India.</b> Squamous cell carcinoma (80%) or adenocarcinoma (20%)."))
story.append(sp(4))
story.append(h("Etiopathogenesis", topic_style))
story.append(b("<b>HPV (Human Papillomavirus)</b> - causative agent in >99% cases"))
story.append(sb("High-risk types: HPV 16 (squamous), HPV 18 (adenocarcinoma)"))
story.append(sb("HPV E6 protein → inactivates p53 (apoptosis loss)"))
story.append(sb("HPV E7 protein → inactivates pRb (cell cycle dysregulation)"))
story.append(b("Risk factors: early coitarche, multiple sexual partners, multiparity, immunosuppression, smoking, OCP"))
story.append(b("Precursor lesion: <b>CIN (Cervical Intraepithelial Neoplasia)</b>"))
story.append(sb("CIN I (mild dysplasia) → CIN II (moderate) → CIN III (severe/CIS) → Invasive carcinoma"))
story.append(sb("Koilocytes = HPV-infected cells (perinuclear halo, raisinoid nucleus)"))
story.append(sp(4))
story.append(h("Morphology", topic_style))
story.append(b("<b>Site:</b> Squamocolumnar junction (transformation zone)"))
story.append(b("<b>Gross:</b> Exophytic (cauliflower), endophytic (ulcerative/barrel-shaped)"))
story.append(b("<b>Micro:</b> Squamous cell Ca - nests of epithelial cells with keratin pearls, intercellular bridges"))
story.append(sp(4))
story.append(h("Spread", topic_style))
story.append(b("Direct: vagina, parametrium, bladder, rectum"))
story.append(b("Lymphatic: external iliac, internal iliac nodes"))
story.append(b("Haematogenous: lungs, liver, bone (late)"))
story.append(sp(4))
story.append(h("Investigations", topic_style))
story.append(b("Pap smear (Papanicolaou) - screening; looks for koilocytes, dysplastic cells"))
story.append(b("Colposcopy + biopsy - definitive diagnosis"))
story.append(b("HPV DNA typing (PCR)"))
story.append(sp(8))

# ──────────────────────────────────────────
# 15. CARCINOMA BREAST
# ──────────────────────────────────────────
story.append(h("15. CARCINOMA BREAST", chapter_style))
story.append(repeat_tag("4+"))
story.append(p("<b>Most common cancer in women worldwide.</b>"))
story.append(sp(4))
story.append(h("Risk Factors", topic_style))
story.append(b("Female gender, increasing age (>50 years)"))
story.append(b("Positive family history (1st degree relative)"))
story.append(b("BRCA1 (chromosome 17q) and BRCA2 (chromosome 13q) mutations - hereditary"))
story.append(b("Early menarche, late menopause, nulliparity, late first pregnancy"))
story.append(b("HRT (oestrogen + progesterone), obesity, alcohol"))
story.append(b("Precursor lesions: LCIS, DCIS, atypical ductal hyperplasia"))
story.append(sp(4))
story.append(h("Types", topic_style))
story.append(b("<b>Non-invasive:</b>"))
story.append(sb("DCIS (Ductal Carcinoma In Situ) - comedo type has central necrosis (calcification on mammogram)"))
story.append(sb("LCIS (Lobular Carcinoma In Situ) - risk marker, bilateral tendency"))
story.append(b("<b>Invasive/Infiltrating:</b>"))
story.append(sb("IDC-NOS (Invasive Ductal Carcinoma - Not Otherwise Specified) - 70%; hard stony mass"))
story.append(sb("ILC (Invasive Lobular Carcinoma) - 10%; single file pattern ('Indian file'), signet ring cells"))
story.append(sb("Medullary Ca - well circumscribed, lymphoplasmacytic infiltrate, BRCA1-associated"))
story.append(sb("Mucinous (colloid) Ca - elderly, gelatinous, good prognosis"))
story.append(sb("Paget's disease of nipple - intraepidermal spread of ductal Ca; eczema-like nipple change"))
story.append(sp(4))
story.append(h("Spread", topic_style))
story.append(b("Lymphatic: axillary nodes (most common); also supraclavicular, internal mammary"))
story.append(b("Haematogenous: bones (lytic/sclerotic), lung, liver, brain"))
story.append(sp(4))
story.append(h("Prognostic Markers", topic_style))
story.append(b("<b>ER/PR positive</b> - respond to hormonal therapy (tamoxifen/aromatase inhibitors), better prognosis"))
story.append(b("<b>HER2/neu (c-erbB2) positive</b> - aggressive; responds to Trastuzumab"))
story.append(b("<b>Triple negative</b> (ER-, PR-, HER2-) - worst prognosis; only chemotherapy"))
story.append(sp(8))

# ──────────────────────────────────────────
# 16. LIVER CIRRHOSIS
# ──────────────────────────────────────────
story.append(h("16. LIVER CIRRHOSIS & HEPATITIS", chapter_style))
story.append(repeat_tag("3+"))
story.append(p("<b>Cirrhosis:</b> Irreversible end-stage liver disease characterised by fibrosis and nodular regeneration, "
               "disrupting liver architecture."))
story.append(sp(4))
story.append(h("Causes", topic_style))
story.append(b("Alcoholic liver disease (most common in West)"))
story.append(b("Chronic viral hepatitis B and C (most common globally)"))
story.append(b("NAFLD/NASH (Non-alcoholic fatty liver disease)"))
story.append(b("Wilson's disease, Haemochromatosis, Alpha-1 antitrypsin deficiency"))
story.append(b("Primary biliary cirrhosis (autoimmune)"))
story.append(sp(4))
story.append(h("Morphology", topic_style))
story.append(b("<b>Micronodular</b> (<3mm): Alcoholic cirrhosis, haemochromatosis; uniform small nodules"))
story.append(b("<b>Macronodular</b> (>3mm): post-viral hepatitis B/C; variable large nodules"))
story.append(b("<b>Mixed</b>"))
story.append(b("Micro: fibrous septa, regenerative nodules, loss of normal lobular architecture"))
story.append(sp(4))
story.append(h("Complications", topic_style))
story.append(b("<b>Portal hypertension:</b>"))
story.append(sb("Oesophageal varices (bleed → haematemesis)"))
story.append(sb("Splenomegaly → hypersplenism"))
story.append(sb("Caput medusae (dilated abdominal wall veins)"))
story.append(sb("Ascites (portal HT + hypoalbuminaemia)"))
story.append(b("<b>Hepatic encephalopathy:</b> ammonia accumulation, asterixis (flapping tremor)"))
story.append(b("<b>Hepatorenal syndrome, Hepatopulmonary syndrome</b>"))
story.append(b("<b>Hepatocellular carcinoma (HCC)</b> - risk with HBV, HCV, haemochromatosis"))
story.append(sp(4))
story.append(h("Hepatitis Comparison (Short Note)", topic_style))
hep_data = [
    ["Feature", "Hep A", "Hep B", "Hep C", "Hep D", "Hep E"],
    ["Transmission", "Faeco-oral", "Blood/sexual", "Blood (IVDU)", "Blood (needs B)", "Faeco-oral"],
    ["Chronicity", "No", "5-10%", "85%", "Yes (w/B)", "No"],
    ["Marker", "Anti-HAV IgM", "HBsAg, HBeAg", "Anti-HCV", "HBsAg+anti-HDV", "Anti-HEV IgM"],
    ["Vaccine", "Yes", "Yes", "No", "HBV vaccine", "Yrs (some countries)"],
    ["Cancer risk", "No", "Yes (HCC)", "Yes (HCC)", "Yes", "No"],
]
thep = Table(hep_data, colWidths=[2.5*cm, 1.8*cm, 2.5*cm, 2*cm, 2.5*cm, 2.5*cm], repeatRows=1)
thep.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 7.5),
    ('ALIGN', (0,0), (-1,-1), 'LEFT'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#e8eaf6')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(thep)
story.append(sp(8))

# ──────────────────────────────────────────
# 17. PULMONARY TB
# ──────────────────────────────────────────
story.append(h("17. PULMONARY TUBERCULOSIS", chapter_style))
story.append(repeat_tag("3+"))
story.append(p("<b>Mycobacterium tuberculosis</b> (aerobic, acid-fast bacillus). Droplet nuclei transmission."))
story.append(sp(4))
story.append(h("Primary TB", topic_style))
story.append(b("<b>Ghon's focus:</b> subpleural consolidation (usually mid-zone)"))
story.append(b("<b>Ghon's complex:</b> Ghon's focus + hilar lymph node enlargement"))
story.append(b("Usually asymptomatic; heals by calcification (Ranke complex)"))
story.append(b("Hypersensitivity develops (Mantoux +ve after 3-6 weeks)"))
story.append(sp(4))
story.append(h("Secondary (Post-Primary) TB", topic_style))
story.append(b("Apical/posterior segments of upper lobe (high O2 tension)"))
story.append(b("Simon's focus: reactivation of calcified primary focus"))
story.append(b("<b>Caseous pneumonia → cavitation → fibrosis/calcification</b>"))
story.append(b("Fibrocaseous TB: classic with cavities, fibrosis, calcification"))
story.append(sp(4))
story.append(h("Complications", topic_style))
story.append(b("Haemoptysis (cavitary erosion)"))
story.append(b("Miliary TB - haematogenous spread; 1-2mm millet-seed lesions in multiple organs"))
story.append(b("TB meningitis, Pott's disease (vertebral TB), TB peritonitis"))
story.append(b("Aspergilloma in old cavity"))
story.append(sp(4))
story.append(h("Histology", topic_style))
story.append(b("Caseating granuloma with Langhans giant cells + epithelioid histiocytes + lymphocytes"))
story.append(b("ZN stain (Ziehl-Neelsen): acid-fast bacilli appear red on blue background"))
story.append(sp(8))

# ──────────────────────────────────────────
# 18. MYOCARDIAL INFARCTION
# ──────────────────────────────────────────
story.append(h("18. MYOCARDIAL INFARCTION & ATHEROSCLEROSIS", chapter_style))
story.append(repeat_tag("3+"))
story.append(h("Atherosclerosis", topic_style))
story.append(b("Chronic inflammatory disease of intima of large/medium arteries"))
story.append(b("<b>Risk factors:</b> Hypertension, Dyslipidaemia (LDL↑, HDL↓), DM, Smoking, Obesity, Family history"))
story.append(b("<b>Pathogenesis (Response to Injury hypothesis):</b>"))
story.append(sb("Endothelial injury → LDL enters intima → Oxidised LDL → Macrophage engulf → Foam cells"))
story.append(sb("Fatty streak (earliest lesion, reversible) → Fibrous plaque → Complicated plaque"))
story.append(b("<b>Fibrous plaque:</b> Smooth muscle + collagen cap; lipid core; calcification"))
story.append(b("<b>Complications:</b> Stenosis, Thrombosis, Ulceration, Aneurysm, Embolism"))
story.append(sp(4))
story.append(h("Myocardial Infarction", topic_style))
story.append(b("Coagulative necrosis of myocardium due to ischaemia (usually LAD occlusion > 90% cases)"))
story.append(b("<b>Gross + Micro timeline:</b>"))
mi_data = [
    ["Time", "Gross Changes", "Microscopic Changes"],
    ["0-4 hrs", "None visible", "None (EM: reversible changes)"],
    ["4-12 hrs", "Dark mottling", "Wavy fibres, early coagulative necrosis"],
    ["12-24 hrs", "Pale/mottled", "Coagulative necrosis, PMN infiltration begins"],
    ["1-4 days", "Yellow-white pale", "Intense PMN infiltration"],
    ["5-10 days", "Yellow centre, red rim", "Macrophages, granulation tissue at edges"],
    ["2-8 weeks", "Grey-white scar", "Progressive fibrosis"],
    ">2 months", "Dense white scar", "Dense collagenous scar"],
]
tmi = Table(mi_data, colWidths=[2*cm, 5*cm, 6.5*cm], repeatRows=1)
tmi.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 8),
    ('ALIGN', (0,0), (-1,-1), 'LEFT'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#fff3e0')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#ffcc80')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(tmi)
story.append(sp(4))
story.append(b("<b>Serum markers:</b> Troponin I/T (most sensitive, specific; rises 3-4 hrs, peaks 24-48 hrs); CK-MB; LDH"))
story.append(b("<b>Complications:</b> Arrhythmia (most common, 1st 24 hrs), Cardiac rupture (3-7 days), Ventricular aneurysm, Pericarditis (Dressler's)"))
story.append(sp(8))

# ──────────────────────────────────────────
# 19. HYDATIDIFORM MOLE
# ──────────────────────────────────────────
story.append(h("19. HYDATIDIFORM MOLE (Vesicular Mole)", chapter_style))
story.append(repeat_tag("3+"))
story.append(p("<b>Definition:</b> Benign tumour of trophoblastic tissue; hydropic degeneration of chorionic villi."))
story.append(sp(4))
mole_data = [
    ["Feature", "Complete Mole", "Partial Mole"],
    ["Karyotype", "46XX (diploid, all paternal)", "69XXY (triploid)"],
    ["Fetal tissue", "Absent", "Present (abnormal)"],
    ["Villous hydrops", "All villi", "Some villi"],
    ["Beta-hCG", "Very high", "Moderately elevated"],
    ["Risk of malignancy", "2-3%", "<1%"],
    ["Trophoblastic proliferation", "Diffuse", "Focal"],
]
tmole = Table(mole_data, colWidths=[4*cm, 4.5*cm, 4.5*cm], repeatRows=1)
tmole.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 8.5),
    ('ALIGN', (0,0), (-1,-1), 'LEFT'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#e8eaf6')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(tmole)
story.append(sp(4))
story.append(b("<b>Clinical features:</b> Uterus large for dates, snow-storm pattern on USG, beta-hCG very high, passage of grape-like vesicles"))
story.append(b("<b>Complications:</b> Invasive mole, Choriocarcinoma (gestational), hyperthyroidism (hCG has TSH-like activity)"))
story.append(sp(8))

# ──────────────────────────────────────────
# 20. PATHOLOGICAL CALCIFICATION / PIGMENTS
# ──────────────────────────────────────────
story.append(h("20. PATHOLOGICAL CALCIFICATION & PIGMENTS", chapter_style))
story.append(repeat_tag("3+"))
calc_data = [
    ["Feature", "Dystrophic Calcification", "Metastatic Calcification"],
    ["Serum calcium", "Normal", "Elevated (hypercalcaemia)"],
    ["Cause", "Dead/dying tissue", "Normal tissue (systemic Ca abnormality)"],
    ["Mechanism", "Local pH changes, phospholipids from dead cells", "High Ca x Phosphate product"],
    ["Sites", "TB lesions, atherosclerosis, psammoma bodies", "Lungs, kidneys, gastric mucosa, blood vessels"],
    ["Examples", "Caseous necrosis, aortic valve, dead parasites", "Hyperparathyroidism, Vit D toxicity, sarcoidosis"],
]
tcalc = Table(calc_data, colWidths=[3*cm, 5.5*cm, 5*cm], repeatRows=1)
tcalc.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 8),
    ('ALIGN', (0,0), (-1,-1), 'LEFT'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#e8eaf6')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
    ('FONTNAME', (0,1), (0,-1), 'Helvetica-Bold'),
]))
story.append(tcalc)
story.append(sp(4))
story.append(h("Important Pigments", topic_style))
pig_data = [
    ["Pigment", "Type", "Disease/Association", "Stain"],
    ["Lipofuscin", "Endogenous (lipid)", "Old age, atrophy ('wear and tear' pigment)", "PAS+, Sudan Black+"],
    ["Melanin", "Endogenous", "Addison's, albinism (absence)", "Masson-Fontana"],
    ["Haemosiderin", "Endogenous (iron)", "Haemochromatosis, old haemorrhage", "Prussian Blue+"],
    ["Bilirubin", "Endogenous", "Jaundice, cholestasis", "Hall's bile stain"],
    ["Haematoidin", "Endogenous", "Old haematoma (no iron)", "No iron stain"],
    ["Carbon (anthracosis)", "Exogenous", "Coal workers, smokers", "Black in macrophages"],
    ["Tatoo pigments", "Exogenous", "Tattoo", "Varies by pigment"],
]
tpig = Table(pig_data, colWidths=[3*cm, 2.5*cm, 5*cm, 3*cm], repeatRows=1)
tpig.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 8),
    ('ALIGN', (0,0), (-1,-1), 'LEFT'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#e8eaf6')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(tpig)
story.append(sp(8))

# ──────────────────────────────────────────
# QUICK REVISION TABLE
# ──────────────────────────────────────────
story.append(PageBreak())
story.append(h("QUICK REVISION: EXAM MNEMONICS & KEY FACTS", part_style))
story.append(sp(6))

story.append(h("Pathognomonic / Hallmark Features", topic_style))
path_data = [
    ["Finding", "Disease"],
    ["Reed-Sternberg cells (Owl-eye nucleoli)", "Hodgkin's Lymphoma"],
    ["Auer rods in blasts", "AML (myeloid leukaemia)"],
    ["Philadelphia chromosome t(9;22)", "CML"],
    ["Koilocytes", "HPV infection / CIN"],
    ["Lacunar cells + collagen bands", "Nodular Sclerosis HL"],
    ["Psammoma bodies (concentric calcification)", "Papillary thyroid Ca, Meningioma, Ovarian serous Ca, Mesothelioma (PMOM)"],
    ["Signet ring cells", "Gastric carcinoma / Krukenberg tumour"],
    ["'Owl-eye' intranuclear inclusions", "CMV infection"],
    ["Cowdry A bodies", "HSV / CMV"],
    ["Councilman bodies", "Viral hepatitis (apoptotic hepatocytes)"],
    ["Mallory-Denk bodies", "Alcoholic hepatitis"],
    ["Call-Exner bodies", "Granulosa cell tumour"],
    ["Schiller-Duval bodies", "Yolk sac tumour"],
    ["Reinke crystals", "Leydig cell tumour"],
    ["Microcalcifications on mammogram", "DCIS (comedo type)"],
    ["Subepithelial humps (EM)", "Post-streptococcal GN"],
    ["Spike and dome (EM)", "Membranous nephropathy"],
    ["Foot process effacement (EM)", "Minimal change disease"],
    ["Foam cells in intima", "Atherosclerosis fatty streak"],
]
tpath = Table(path_data, colWidths=[8*cm, 7*cm], repeatRows=1)
tpath.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#c62828')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 8.5),
    ('ALIGN', (0,0), (-1,-1), 'LEFT'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#ffebee')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#ef9a9a')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
    ('FONTNAME', (0,1), (0,-1), 'Helvetica-Bold'),
]))
story.append(tpath)
story.append(sp(8))

story.append(h("Stains to Remember", topic_style))
stain_data = [
    ["Stain", "Stains What", "Use For"],
    ["H&E", "Nuclei (blue), cytoplasm (pink)", "Routine histology"],
    ["Ziehl-Neelsen (ZN)", "Acid-fast bacilli (red)", "TB, leprosy, Nocardia"],
    ["Periodic Acid-Schiff (PAS)", "Glycogen, fungi, basement membranes", "Glycogen storage, fungal infections"],
    ["Prussian Blue (Perls)", "Haemosiderin (blue)", "Iron overload, haemochromatosis"],
    ["Congo Red", "Amyloid (apple-green birefringence)", "Amyloidosis"],
    ["Van Gieson", "Collagen (red), muscle (yellow)", "Fibrosis"],
    ["Masson Trichrome", "Collagen (blue/green)", "Liver fibrosis, cardiac fibrosis"],
    ["Silver stain", "Reticulin fibres, fungi", "Liver architecture, Pneumocystis"],
    ["Oil Red O", "Lipids (red)", "Fat - must use frozen sections"],
    ["Toluidine Blue", "Mast cells (metachromatic)", "Mastocytosis, heparin"],
    ["Alcian Blue", "Mucin (acid mucopolysaccharides)", "Goblet cells, mesothelioma"],
]
tstain = Table(stain_data, colWidths=[3.5*cm, 5.5*cm, 4.5*cm], repeatRows=1)
tstain.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1a237e')),
    ('TEXTCOLOR', (0,0), (-1,0), colors.white),
    ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
    ('FONTSIZE', (0,0), (-1,-1), 8.5),
    ('ALIGN', (0,0), (-1,-1), 'LEFT'),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#e8eaf6')]),
    ('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
    ('TOPPADDING', (0,0), (-1,-1), 3), ('BOTTOMPADDING', (0,0), (-1,-1), 3),
    ('FONTNAME', (0,1), (0,-1), 'Helvetica-Bold'),
]))
story.append(tstain)
story.append(sp(12))
story.append(hr())
story.append(Paragraph("TNMGR 2nd Year MBBS Pathology | PYQ Short Notes | Compiled July 2026", subtitle_style))
story.append(Paragraph("Best of luck with your exams!", ParagraphStyle('end', parent=styles['Normal'],
    fontSize=10, alignment=TA_CENTER, textColor=colors.HexColor('#1a237e'), spaceBefore=4)))

# ─────────────────────────────────────────────────────────────────
# BUILD
# ─────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF created: {OUTPUT}")
Running Command

cd /home/daytona/workspace/pathology-pyq && python build_pdf.py 2>&1

Editing File

~/pathology-pyq/build_pdf.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/pathology-pyq/build_pdf.py'
Running Command

cd /home/daytona/workspace/pathology-pyq && python build_pdf.py 2>&1

Reading File
Editing File

~/pathology-pyq/build_pdf.py

build_pdf.pyPython
1
2
3
4
5
6

Structuring content...

This can take a few minutes — feel free to come back later.

Make it fast

Running Command

cd /home/daytona/workspace/pathology-pyq && sed -i 's/ ">2 months", "Dense white scar", "Dense collagenous scar"],/ [">2 months", "Dense white scar", "Dense collagenous scar"],/' build_pdf.py && python build_pdf.py 2>&1

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.

Generate a Word document with PYQ short notes instead (faster)

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.
This is a shared conversation. Sign in to Orris to start your own chat.