Give me the notes of bhms 2nd year pathology 1st chapter
BHMS 2nd year pathology 1st chapter syllabus cell injury adaptation
| Term | Definition |
|---|---|
| Etiology | The origin (cause) of a disease, including genetic susceptibility + environmental triggers |
| Pathogenesis | The steps in development of disease - how a disease progresses from initial trigger to structural/functional abnormalities |
| Category | Examples |
|---|---|
| Hypoxia & Ischemia | O2 deficiency; reduced blood supply - most common cause; ischemia also reduces nutrients |
| Physical agents | Mechanical trauma, extremes of temperature, radiation, electric shock |
| Chemical agents/drugs | Glucose, salt (hyper/hypo-osmotic), O2 at high concentrations, poisons, air pollutants |
| Infectious agents | Viruses, bacteria, fungi, parasites |
| Immunologic reactions | Autoimmune diseases, hypersensitivity reactions |
| Genetic derangements | Congenital malformations, enzyme defects (e.g., sickle cell disease) |
| Nutritional imbalances | Protein-calorie malnutrition, vitamin deficiencies, excess calories |
| Feature | Necrosis | Apoptosis |
|---|---|---|
| Cell size | Enlarged (swollen) | Reduced (shrunken) |
| Nucleus | Pyknosis, karyorrhexis, karyolysis | Fragmentation into nucleosome-sized fragments |
| Plasma membrane | Disrupted | Intact, but altered structure |
| Cell contents | Enzymatic digestion; leakage | Intact; released in apoptotic bodies |
| Inflammation | Yes (prominent) | No |
| Pathologic or physiologic | Always pathologic | Often physiologic; may be pathologic |
| Type | Description | Example |
|---|---|---|
| Coagulative necrosis | Cell architecture preserved (ghost cells); protein denaturation dominates | Myocardial infarction, kidney infarct |
| Liquefactive necrosis | Complete digestion of dead cells; liquid, pus-like | Brain infarcts, abscesses |
| Caseous necrosis | "Cheese-like," friable; combination of coagulative + liquefactive | Tuberculosis (TB) |
| Fat necrosis | Chalky white deposits; fatty acid + calcium form soaps | Acute pancreatitis |
| Fibrinoid necrosis | Immune complex deposition in vessel walls; pink, amorphous | Vasculitis, malignant hypertension |
| Gangrenous necrosis | Large tissue death; wet (infected) or dry | Diabetic foot, vascular occlusion |
Clinically useful: Necrotic cells release tissue-specific proteins into blood (e.g., cardiac troponin for myocardial damage, transaminases for liver damage, alkaline phosphatase for bile ducts).
| Substance | Cause | Example |
|---|---|---|
| Fatty change (Steatosis) | Toxins, malnutrition, diabetes, obesity, alcohol | Fatty liver (hepatic steatosis) |
| Cholesterol/esters | Impaired lipid metabolism, increased intake | Atherosclerosis, foam cells |
| Proteins | Excess reabsorption, synthesis | Hyaline droplets in kidney (nephrotic syndrome), Russell bodies |
| Glycogen | Abnormal glucose/glycogen metabolism | Diabetes mellitus, glycogen storage diseases |
| Pigments: | ||
| - Exogenous: Carbon/anthracosis | Inhalation, phagocytosed by macrophages | Coal worker's pneumoconiosis |
| - Endogenous: Lipofuscin | Oxidative cell injury; "wear and tear" pigment | Brown atrophy in aging |
| - Hemosiderin | Excess iron; derived from ferritin | Hemosiderosis, hemochromatosis |
| - Melanin | Excess production | Freckles, nevi |
| - Bilirubin | Hemolysis, liver disease | Jaundice |
| Mechanism | Details |
|---|---|
| Telomere shortening | Repetitive DNA at chromosome ends; shortens with each division; when too short → cell cycle arrest (senescence) or apoptosis. Cancer cells bypass this by activating telomerase |
| Accumulation of DNA damage | Caused by ROS, chemicals, radiation; repair mechanisms decline with age |
| Defective protein homeostasis | Misfolded proteins accumulate (chaperone function declines); proteasome activity decreases |
| Metabolic alterations | Caloric restriction extends lifespan by reducing ROS production and IGF-1 signaling |
| Epigenetic changes | Altered gene expression patterns with age |
| Inflammation | Low-grade chronic inflammation ("inflammaging") contributes to aging and age-related diseases |
Create a study guide PDF for this chapter
ls -la /tmp/workspace/ 2>/dev/null || echo "workspace does not exist yet"
mkdir -p /tmp/workspace/pathology-study-guide
~/pathology-study-guide/generate_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,
HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import ListFlowable, ListItem
OUTPUT = "/tmp/workspace/pathology-study-guide/Pathology_Chapter1_StudyGuide.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
leftMargin=2*cm, rightMargin=2*cm,
topMargin=2.5*cm, bottomMargin=2.5*cm,
title="BHMS 2nd Year Pathology - Chapter 1 Study Guide",
author="Orris AI"
)
# ── Colour palette ──────────────────────────────────────────────────────────
NAVY = colors.HexColor("#1A3557")
TEAL = colors.HexColor("#0E7C86")
LIME = colors.HexColor("#4CAF50")
AMBER = colors.HexColor("#FF8F00")
RED = colors.HexColor("#C0392B")
LIGHT_BG = colors.HexColor("#EAF4FB")
TEAL_BG = colors.HexColor("#E0F5F5")
AMBER_BG = colors.HexColor("#FFF8E1")
RED_BG = colors.HexColor("#FDECEA")
GREEN_BG = colors.HexColor("#E8F5E9")
GREY_BG = colors.HexColor("#F5F5F5")
WHITE = colors.white
# ── Styles ──────────────────────────────────────────────────────────────────
base = getSampleStyleSheet()
def S(name, **kw):
return ParagraphStyle(name, **kw)
COVER_TITLE = S("CoverTitle", fontSize=28, textColor=WHITE, alignment=TA_CENTER, fontName="Helvetica-Bold", leading=34, spaceAfter=6)
COVER_SUB = S("CoverSub", fontSize=14, textColor=WHITE, alignment=TA_CENTER, fontName="Helvetica", leading=20)
COVER_BADGE = S("CoverBadge", fontSize=11, textColor=NAVY, alignment=TA_CENTER, fontName="Helvetica-Bold", leading=16)
CH_HEAD = S("ChHead", fontSize=20, textColor=WHITE, alignment=TA_CENTER, fontName="Helvetica-Bold", leading=26, spaceAfter=4)
SEC_HEAD = S("SecHead", fontSize=13, textColor=WHITE, fontName="Helvetica-Bold", leading=18, spaceBefore=10, spaceAfter=4, leftIndent=0)
SUB_HEAD = S("SubHead", fontSize=11, textColor=NAVY, fontName="Helvetica-Bold", leading=15, spaceBefore=8, spaceAfter=3)
BODY = S("Body", fontSize=9.5, textColor=colors.HexColor("#222222"), fontName="Helvetica", leading=14, spaceAfter=3, alignment=TA_JUSTIFY)
BULLET = S("Bullet", fontSize=9.5, textColor=colors.HexColor("#222222"), fontName="Helvetica", leading=13, spaceAfter=2, leftIndent=14, firstLineIndent=-10)
KEY = S("Key", fontSize=9, textColor=NAVY, fontName="Helvetica-Bold", leading=13)
BOX_TITLE = S("BoxTitle", fontSize=10, textColor=WHITE, fontName="Helvetica-Bold", alignment=TA_CENTER, leading=14)
BOX_BODY = S("BoxBody", fontSize=9, textColor=colors.HexColor("#1A1A1A"), fontName="Helvetica", leading=13, leftIndent=6, spaceAfter=2)
NOTE = S("Note", fontSize=8.5, textColor=colors.HexColor("#555555"), fontName="Helvetica-Oblique", leading=12, spaceAfter=2)
FOOTER_STYLE = S("Footer", fontSize=7.5, textColor=colors.grey, alignment=TA_CENTER)
TOC_ITEM = S("TocItem", fontSize=10, textColor=NAVY, fontName="Helvetica", leading=16, leftIndent=12)
TOC_NUM = S("TocNum", fontSize=10, textColor=TEAL, fontName="Helvetica-Bold", leading=16)
# ── Helper builders ──────────────────────────────────────────────────────────
def colored_heading(text, bg=NAVY, style=SEC_HEAD, pad=5):
tbl = Table([[Paragraph(text, style)]], colWidths=["100%"])
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), bg),
("TOPPADDING", (0,0), (-1,-1), pad),
("BOTTOMPADDING",(0,0),(-1,-1), pad),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING",(0,0), (-1,-1), 8),
("ROUNDEDCORNERS", [4]),
]))
return tbl
def subsection(text):
return Paragraph(text, SUB_HEAD)
def body(text):
return Paragraph(text, BODY)
def bullet(items, color=TEAL):
rows = []
for item in items:
rows.append(Paragraph(f"<font color='#{color.hexval()[2:]}'>•</font> {item}", BULLET))
return rows
def make_table(headers, rows, col_widths=None, header_bg=NAVY):
page_w = A4[0] - 4*cm
if col_widths is None:
w = page_w / max(len(headers), 1)
col_widths = [w] * len(headers)
data = [[Paragraph(f"<font color='white'><b>{h}</b></font>", KEY) for h in headers]]
for i, row in enumerate(rows):
data.append([Paragraph(str(c), BODY) for c in row])
style = TableStyle([
("BACKGROUND", (0,0), (-1,0), header_bg),
("BACKGROUND", (0,1), (-1,-1), GREY_BG),
("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, GREY_BG]),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("RIGHTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
])
t = Table(data, colWidths=col_widths, repeatRows=1)
t.setStyle(style)
return t
def tip_box(title, items, bg=AMBER_BG, title_bg=AMBER):
content = " ".join([f"• {i}" for i in items])
inner = [[
Paragraph(title, BOX_TITLE),
Paragraph(content, BOX_BODY)
]]
t = Table(inner, colWidths=[3.5*cm, None])
t.setStyle(TableStyle([
("BACKGROUND", (0,0),(0,-1), title_bg),
("BACKGROUND", (1,0),(1,-1), bg),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("TOPPADDING", (0,0),(-1,-1), 6),
("BOTTOMPADDING",(0,0),(-1,-1), 6),
("LEFTPADDING", (0,0),(-1,-1), 6),
("RIGHTPADDING", (0,0),(-1,-1), 6),
("BOX", (0,0),(-1,-1), 0.5, colors.HexColor("#BBBBBB")),
]))
return t
def sp(h=6):
return Spacer(1, h)
def hr(color=TEAL, thickness=0.8):
return HRFlowable(width="100%", thickness=thickness, color=color, spaceAfter=4, spaceBefore=4)
# ── Page number footer ────────────────────────────────────────────────────────
def add_page_number(canvas, doc):
canvas.saveState()
canvas.setFont("Helvetica", 7.5)
canvas.setFillColor(colors.grey)
page_num = canvas.getPageNumber()
canvas.drawCentredString(A4[0]/2, 1.2*cm, f"BHMS 2nd Year Pathology · Chapter 1: Cell Injury, Adaptations & Cell Death · Page {page_num}")
canvas.restoreState()
# ════════════════════════════════════════════════════════════════════════════
# BUILD CONTENT
# ════════════════════════════════════════════════════════════════════════════
story = []
# ── COVER PAGE ───────────────────────────────────────────────────────────────
cover_data = [[
Paragraph("BHMS 2nd Year", COVER_SUB),
Paragraph("PATHOLOGY", COVER_TITLE),
Paragraph("Chapter 1", COVER_SUB),
Paragraph("Cell Injury, Adaptations & Cell Death", S("CT2", fontSize=16, textColor=WHITE, alignment=TA_CENTER, fontName="Helvetica-Bold", leading=22)),
sp(10),
Paragraph("Complete Study Guide", S("CT3", fontSize=11, textColor=colors.HexColor("#A8D8EA"), alignment=TA_CENTER, fontName="Helvetica-Oblique", leading=16)),
sp(6),
Paragraph("Based on Robbins & Kumar Basic Pathology", S("CT4", fontSize=9, textColor=colors.HexColor("#CCE5FF"), alignment=TA_CENTER, fontName="Helvetica", leading=14)),
]]
cover_tbl = Table(cover_data, colWidths=["100%"])
cover_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,-1), NAVY),
("TOPPADDING", (0,0),(-1,-1), 24),
("BOTTOMPADDING", (0,0),(-1,-1), 24),
("LEFTPADDING", (0,0),(-1,-1), 20),
("RIGHTPADDING", (0,0),(-1,-1), 20),
("BOX", (0,0),(-1,-1), 2, TEAL),
]))
story.append(cover_tbl)
story.append(sp(18))
# badge row
badges = [["Etiology", "Pathogenesis", "Cell Injury", "Necrosis", "Apoptosis", "Adaptation", "Aging"]]
badge_tbl = Table(badges, colWidths=[None]*7)
badge_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,-1), TEAL_BG),
("TEXTCOLOR", (0,0),(-1,-1), NAVY),
("FONTNAME", (0,0),(-1,-1), "Helvetica-Bold"),
("FONTSIZE", (0,0),(-1,-1), 8),
("ALIGN", (0,0),(-1,-1), "CENTER"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING", (0,0),(-1,-1), 5),
("BOX", (0,0),(-1,-1), 0.5, TEAL),
("INNERGRID", (0,0),(-1,-1), 0.3, TEAL),
]))
story.append(badge_tbl)
story.append(PageBreak())
# ── SECTION 1: Introduction ──────────────────────────────────────────────────
story.append(colored_heading("1. INTRODUCTION TO PATHOLOGY", NAVY))
story.append(sp(4))
story.append(body("Pathology is the study of <b>causes of disease</b> and the changes in cells, tissues, and organs associated with disease. It forms the scientific foundation of medicine."))
story.append(sp(4))
intro_rows = [
["Etiology", "The <i>origin/cause</i> of disease — includes genetic susceptibility and environmental triggers. Why a disease arises."],
["Pathogenesis", "The <i>steps</i> in disease development from initial trigger to structural/functional abnormalities. How a disease develops."],
["Morphology", "Gross or microscopic appearance of cells/tissues used to diagnose disease."],
["Precision Medicine", "Therapies tailored to each individual's specific molecular disease profile."],
]
story.append(make_table(["Term", "Definition"], intro_rows, col_widths=[4*cm, None]))
story.append(sp(8))
# ── SECTION 2: Overview of Cellular Responses ───────────────────────────────
story.append(colored_heading("2. OVERVIEW OF CELLULAR RESPONSES TO STRESS", TEAL))
story.append(sp(4))
story.append(body("Cells continuously adjust structure and function to maintain <b>homeostasis</b>. When stressed, they respond in three ways:"))
story.append(sp(3))
responses = [
["<b>Adaptation</b>", "New steady state achieved; viability preserved (hypertrophy, hyperplasia, atrophy, metaplasia)"],
["<b>Reversible Injury</b>", "Structural/functional change that resolves if stimulus is removed"],
["<b>Irreversible Injury / Death</b>", "Severe or prolonged stress → necrosis or apoptosis"],
]
story.append(make_table(["Response", "Description"], responses, col_widths=[4.5*cm, None], header_bg=TEAL))
story.append(sp(8))
# ── SECTION 3: Causes of Cell Injury ────────────────────────────────────────
story.append(colored_heading("3. CAUSES OF CELL INJURY", NAVY))
story.append(sp(4))
causes = [
["Hypoxia & Ischemia", "Most common cause; O₂ deficiency; ischemia also reduces nutrients"],
["Physical Agents", "Mechanical trauma, extreme temperature, radiation, electric shock"],
["Chemical Agents / Drugs", "Hyper/hypotonic solutions, O₂ at high concentration, toxins, poisons"],
["Infectious Agents", "Viruses, bacteria, fungi, parasites"],
["Immunologic Reactions", "Autoimmune diseases, hypersensitivity reactions (Type I–IV)"],
["Genetic Derangements", "Congenital malformations, enzyme defects (e.g., sickle cell disease)"],
["Nutritional Imbalances", "Protein-calorie malnutrition, vitamin deficiencies, excess calories"],
]
story.append(make_table(["Cause", "Details"], causes, col_widths=[4.5*cm, None]))
story.append(sp(8))
# ── SECTION 4: Reversible vs Irreversible Injury ────────────────────────────
story.append(colored_heading("4. CELL INJURY — REVERSIBLE vs. IRREVERSIBLE", TEAL))
story.append(sp(4))
story.append(subsection("4.1 Reversible Cell Injury"))
story.append(body("Early, mild injury — cell recovers if stimulus removed. Features:"))
for b in bullet(["Cellular swelling (most common / earliest finding in almost all cell injury)",
"Fatty change (steatosis) — lipid vacuoles in cytoplasm",
"Plasma membrane blebs; ER and mitochondria swelling",
"Clumping of nuclear chromatin"]):
story.append(b)
story.append(sp(6))
story.append(subsection("4.2 Necrosis vs. Apoptosis — Comparison"))
story.append(sp(3))
nva = [
["Cell size", "Enlarged (swollen)", "Reduced (shrunken)"],
["Nucleus", "Pyknosis → karyorrhexis → karyolysis", "Fragmented into nucleosome-sized pieces"],
["Plasma membrane", "Disrupted", "Intact (altered structure)"],
["Cell contents", "Enzymatic digestion; leaks out", "Intact, released in apoptotic bodies"],
["Inflammation", "Yes (prominent)", "No"],
["Nature", "Always pathologic", "Physiologic OR pathologic"],
]
story.append(make_table(["Feature", "NECROSIS", "APOPTOSIS"], nva, col_widths=[4*cm, None, None]))
story.append(sp(8))
# ── SECTION 5: Necrosis ──────────────────────────────────────────────────────
story.append(colored_heading("5. NECROSIS — PATTERNS", RED))
story.append(sp(4))
story.append(body("Necrosis = cell death with membrane disruption + enzymatic digestion. Always <b>pathologic</b>."))
story.append(sp(4))
nec_patterns = [
["<b>Coagulative</b>", "Architecture preserved (ghost cells); protein denaturation dominates", "Myocardial infarction, renal infarct"],
["<b>Liquefactive</b>", "Complete digestion → liquid, pus-like", "Brain infarcts, bacterial abscesses"],
["<b>Caseous</b>", "Cheese-like, friable; combo of coagulative + liquefactive", "Tuberculosis (TB)"],
["<b>Fat Necrosis</b>", "Chalky white; fatty acids + calcium → soaps (saponification)", "Acute pancreatitis"],
["<b>Fibrinoid</b>", "Immune complex deposition in vessel walls; pink amorphous", "Vasculitis, malignant hypertension"],
["<b>Gangrenous</b>", "Large area death; dry (arterial) or wet (infected)", "Diabetic foot, vascular occlusion"],
]
story.append(make_table(["Type", "Description", "Classic Example"], nec_patterns,
col_widths=[3.5*cm, None, 4.5*cm], header_bg=RED))
story.append(sp(6))
story.append(tip_box(
"CLINICAL TIP",
["Cardiac troponin → myocardial necrosis",
"Transaminases (ALT/AST) → hepatocyte necrosis",
"Alkaline phosphatase → bile duct necrosis"],
bg=AMBER_BG, title_bg=AMBER
))
story.append(sp(8))
# ── SECTION 6: Apoptosis ─────────────────────────────────────────────────────
story.append(colored_heading("6. APOPTOSIS", NAVY))
story.append(sp(4))
story.append(body("<b>Apoptosis</b> = programmed cell death; enzymes degrade own DNA + proteins. Fragments into <b>apoptotic bodies</b> rapidly phagocytosed by macrophages — <u>no inflammation</u>."))
story.append(sp(5))
story.append(subsection("6.1 Causes of Apoptosis"))
apo_causes = [
["Embryogenesis", "Loss of growth factor signaling", "Physiologic"],
["Tissue turnover", "Loss of survival signals", "Physiologic"],
["Hormone involution (endometrium)", "Reduced hormone levels", "Physiologic"],
["Immune response decline", "Leukocyte survival signal eliminated", "Physiologic"],
["Elimination of self-reactive lymphocytes", "Strong self-antigen recognition", "Physiologic"],
["DNA damage", "Activation of pro-apoptotic BH3-only proteins", "Pathologic"],
["Misfolded proteins", "ER stress → BH3-only protein activation", "Pathologic"],
["Viral infections", "Viral proteins activate caspases; CTL killing", "Pathologic"],
]
story.append(make_table(["Condition", "Mechanism", "Type"], apo_causes,
col_widths=[5*cm, None, 2.8*cm]))
story.append(sp(6))
story.append(subsection("6.2 Mechanisms of Apoptosis — Two Pathways"))
path_rows = [
["<b>Intrinsic\n(Mitochondrial)</b>",
"DNA damage, oxidative stress, misfolded proteins",
"BAX/BAK → cytochrome c release → caspase-9 → effector caspases",
"Bcl-2 (anti-apoptotic); BH3-only proteins (pro-apoptotic)"],
["<b>Extrinsic\n(Death Receptor)</b>",
"FasL or TNF binding to death receptors",
"Adaptor proteins → caspase-8 → effector caspases",
"Used by cytotoxic T lymphocytes (CTLs)"],
]
story.append(make_table(["Pathway", "Triggers", "Mechanism", "Key Regulators"], path_rows,
col_widths=[3*cm, 3.5*cm, None, 4*cm], header_bg=TEAL))
story.append(sp(6))
story.append(subsection("6.3 Morphology of Apoptosis"))
for b in bullet(["Cell shrinkage",
"Chromatin condensation and margination (crescent-shaped chromatin under nuclear membrane)",
"Nuclear fragmentation",
"Cytoplasmic blebs → apoptotic bodies",
"Rapid phagocytosis by macrophages — NO inflammatory response"]):
story.append(b)
story.append(sp(8))
# ── SECTION 7: Autophagy ────────────────────────────────────────────────────
story.append(colored_heading("7. AUTOPHAGY", TEAL))
story.append(sp(4))
for b in bullet([
"Cellular self-digestion: organelles/proteins sequestered in <b>autophagosomes</b> (double-membrane vesicles)",
"Protective during <b>nutrient deprivation</b> — provides recycled building blocks",
"Excessive autophagy can activate apoptosis",
"Role in: aging, neurodegenerative diseases (Parkinson, Alzheimer), cancer"
]):
story.append(b)
story.append(sp(8))
# ── SECTION 8: Mechanisms of Cell Injury ────────────────────────────────────
story.append(colored_heading("8. MECHANISMS OF CELL INJURY", NAVY))
story.append(sp(4))
story.append(subsection("8.1 Mitochondrial Dysfunction"))
for b in bullet([
"Damaged mitochondria release <b>cytochrome c</b> → triggers intrinsic apoptosis",
"ATP depletion → failure of Na⁺/K⁺ ATPase → cell swelling → membrane damage → necrosis",
"Formation of <b>MPTP</b> (mitochondrial permeability transition pore) → loss of membrane potential",
]):
story.append(b)
story.append(sp(4))
story.append(subsection("8.2 Oxidative Stress & Reactive Oxygen Species (ROS)"))
rос = [
["Superoxide (O₂•⁻)", "Normal metabolism, leukocyte oxidative burst, reperfusion"],
["H₂O₂", "Dismutation of superoxide"],
["Hydroxyl radical (OH•)","Most reactive; generated via Fenton reaction"],
]
story.append(make_table(["ROS Species", "Source"], rос, col_widths=[5*cm, None]))
story.append(sp(3))
story.append(body("<b>ROS Damage:</b>"))
for b in bullet([
"Lipid peroxidation → membrane damage",
"Protein oxidation → fragmentation/dysfunction",
"DNA strand breaks → mutations, apoptosis",
]):
story.append(b)
story.append(sp(3))
story.append(body("<b>Antioxidant Defenses:</b> Glutathione peroxidase, Catalase, SOD (superoxide dismutase), Vitamins C & E"))
story.append(sp(4))
story.append(subsection("8.3 Membrane Damage — Three Key Sites"))
mem_sites = [
["Mitochondrial membrane", "Loss of membrane potential → energy failure + apoptosis"],
["Plasma membrane", "Loss of osmotic balance; influx of fluids/ions; cell lysis"],
["Lysosomal membrane", "Leakage of acid hydrolases → autodigestion → irreversible necrosis"],
]
story.append(make_table(["Site", "Consequence"], mem_sites, col_widths=[5*cm, None]))
story.append(sp(4))
story.append(subsection("8.4 Calcium Homeostasis Disturbance"))
for b in bullet([
"Normal cytosolic Ca²⁺ very low (~0.1 μmol) vs. extracellular (1.3 mmol)",
"Ischemia/toxins → excess intracellular Ca²⁺ release from ER + mitochondria",
"Activates: proteases, phospholipases, endonucleases, ATPases → membrane damage, DNA fragmentation",
]):
story.append(b)
story.append(sp(4))
story.append(subsection("8.5 Endoplasmic Reticulum (ER) Stress"))
for b in bullet([
"Misfolded proteins accumulate → activate <b>Unfolded Protein Response (UPR)</b>",
"UPR: increases chaperones, reduces protein translation (protective)",
"If overwhelmed → pro-apoptotic signals → apoptosis via mitochondrial pathway",
"Implicated in: Alzheimer's disease, Type 2 diabetes, neurodegeneration",
]):
story.append(b)
story.append(sp(4))
story.append(subsection("8.6 DNA Damage"))
for b in bullet([
"Caused by: radiation, ROS, chemicals",
"<b>p53</b> accumulates → cell cycle arrest for repair; if irreparable → apoptosis",
"DNA damage implicated in: aging, cancer, cell death",
]):
story.append(b)
story.append(sp(4))
story.append(subsection("8.7 Clinicopathologic Examples"))
story.append(sp(3))
cpex = [
["Hypoxia/Ischemia", "Reduced O₂ → ↓ oxidative phosphorylation → ATP depletion → Na⁺/K⁺ pump fails → cell swelling → membrane damage → necrosis"],
["Ischemia-Reperfusion Injury","Restoration of blood flow paradoxically worsens injury: massive ROS + neutrophil influx + complement activation. Key in: MI treated with thrombolytics/angioplasty"],
["Toxic Cell Injury", "Direct: HgCl₂ binds membrane proteins → permeability. Metabolic: CCl₄ → CCl₃• in liver → lipid peroxidation → fatty change → necrosis"],
]
story.append(make_table(["Example", "Mechanism"], cpex, col_widths=[4*cm, None]))
story.append(sp(8))
story.append(PageBreak())
# ── SECTION 9: Cellular Adaptations ─────────────────────────────────────────
story.append(colored_heading("9. CELLULAR ADAPTATIONS TO STRESS", TEAL))
story.append(sp(4))
story.append(body("Adaptations are <b>reversible changes</b> in number, size, phenotype, metabolism, or function of cells in response to environmental stress."))
story.append(sp(5))
story.append(subsection("9.1 Hypertrophy — Increase in Cell SIZE"))
story.append(body("Enlargement of cells → increase in organ size. <i>No new cells formed.</i> Occurs in cells with limited division capacity (cardiac/skeletal muscle)."))
story.append(sp(3))
hyp_rows = [
["Physiologic", "Uterus in pregnancy (estrogen); skeletal muscle with exercise"],
["Pathologic", "Cardiac hypertrophy in hypertension or aortic stenosis"],
["Mechanism", "Stretch → growth factors + adrenergic hormones → gene expression → more myofilaments. α-myosin heavy chain → β form (more efficient)"],
["Complication","Sustained stress → degenerative changes → ventricular dilation → cardiac failure"],
]
story.append(make_table(["Type", "Details"], hyp_rows, col_widths=[3.5*cm, None], header_bg=TEAL))
story.append(sp(5))
story.append(subsection("9.2 Hyperplasia — Increase in Cell NUMBER"))
story.append(body("Increase in number of cells by proliferation. Occurs in cells capable of division (epithelium, glandular tissue)."))
story.append(sp(3))
hplas_rows = [
["Physiologic - Hormonal", "Breast/uterus during puberty and pregnancy"],
["Physiologic - Compensatory", "Liver regeneration after partial hepatectomy"],
["Pathologic", "Endometrial hyperplasia (excess estrogen); BPH; psoriasis; wound healing"],
["Risk", "Sustained hyperplasia can be a precursor to cancer"],
]
story.append(make_table(["Type", "Example"], hplas_rows, col_widths=[4.5*cm, None], header_bg=TEAL))
story.append(sp(5))
story.append(subsection("9.3 Atrophy — Decrease in Cell SIZE (and sometimes NUMBER)"))
story.append(body("Shrinkage of cell size due to loss of cell substance."))
story.append(sp(3))
story.append(tip_box("CAUSES Mnemonic: DISH-M",
["Disuse (immobilization)",
"Innervation loss (denervation atrophy)",
"Supply reduction (ischemia)",
"Hormone withdrawal (endocrine atrophy)",
"Malnutrition / pressure"],
bg=GREEN_BG, title_bg=LIME))
story.append(sp(3))
story.append(body("<b>Mechanism:</b> ↓ protein synthesis + ↑ protein degradation via <b>ubiquitin-proteasome pathway</b> and autophagy. May involve apoptosis if severe."))
story.append(sp(5))
story.append(subsection("9.4 Metaplasia — Change in CELL TYPE"))
story.append(body("Reversible replacement of one adult cell type by another better adapted to the stress. Caused by reprogramming of tissue stem cells."))
story.append(sp(3))
meta_rows = [
["Columnar → Squamous", "Respiratory epithelium in smokers; Barrett's esophagus (squamous → reverts from columnar)", "Squamous cell carcinoma risk"],
["Squamous → Columnar (Intestinal)", "Barrett's esophagus (acid reflux — squamous → intestinal columnar)", "Adenocarcinoma risk"],
["Connective tissue → Bone", "Myositis ossificans (trauma)", "Functional impairment"],
]
story.append(make_table(["Change", "Example", "Cancer Risk"], meta_rows,
col_widths=[4.5*cm, None, 4*cm], header_bg=TEAL))
story.append(sp(8))
# ── SECTION 10: Intracellular Depositions ───────────────────────────────────
story.append(colored_heading("10. INTRACELLULAR AND EXTRACELLULAR DEPOSITIONS", NAVY))
story.append(sp(4))
story.append(subsection("10.1 Intracellular Accumulations"))
depo_rows = [
["Fatty Change (Steatosis)", "Toxins, malnutrition, diabetes, obesity, alcohol", "Fatty liver (hepatic steatosis)"],
["Cholesterol / Esters", "Impaired lipid metabolism; atherosclerosis", "Foam cells in atherosclerotic plaques"],
["Proteins", "Excess reabsorption or synthesis", "Hyaline droplets (nephrotic syndrome); Russell bodies"],
["Glycogen", "Abnormal glucose/glycogen metabolism", "DM; glycogen storage diseases"],
["Lipofuscin", "Oxidative cell injury — 'wear & tear pigment'", "Brown atrophy in aging; liver, heart"],
["Hemosiderin", "Excess iron; derived from ferritin", "Hemochromatosis, hemosiderosis"],
["Carbon / Anthracosis", "Exogenous; inhaled, phagocytosed by macrophages", "Coal worker's pneumoconiosis"],
["Melanin", "Excess production", "Freckles, nevi, melanoma"],
["Bilirubin", "Hemolysis, liver disease", "Jaundice"],
]
story.append(make_table(["Substance", "Cause", "Example"], depo_rows,
col_widths=[4*cm, None, 5*cm]))
story.append(sp(6))
story.append(subsection("10.2 Extracellular Deposits — Pathologic Calcification"))
calc_rows = [
["<b>Dystrophic Calcification</b>",
"Dead or dying tissue (necrotic areas)",
"<b>Normal</b>",
"TB nodules, atherosclerotic plaques, dead parasites, heart valve deposits"],
["<b>Metastatic Calcification</b>",
"Normal tissue",
"<b>HIGH (hypercalcemia)</b>",
"Hyperparathyroidism, bone metastases, vitamin D toxicity, sarcoidosis → kidneys, lungs, gastric mucosa, cornea"],
]
story.append(make_table(["Type", "Site of Deposition", "Serum Ca²⁺", "Causes/Sites"], calc_rows,
col_widths=[4*cm, 3*cm, 3.5*cm, None], header_bg=RED))
story.append(sp(8))
# ── SECTION 11: Cellular Aging ───────────────────────────────────────────────
story.append(colored_heading("11. CELLULAR AGING", TEAL))
story.append(sp(4))
story.append(body("Cells can undergo a finite number of divisions (<b>Hayflick limit</b> ≈ 50–70 divisions). Aging is driven by multiple mechanisms:"))
story.append(sp(4))
aging_rows = [
["Telomere Shortening", "Repetitive DNA at chromosome ends shortens with each division → cell cycle arrest (senescence) or apoptosis. Cancer cells bypass this via <b>telomerase</b>."],
["Accumulated DNA Damage", "ROS, chemicals, radiation; DNA repair mechanisms decline with age."],
["Defective Protein Homeostasis","Misfolded proteins accumulate; chaperone function and proteasome activity decline."],
["Metabolic Alterations", "Caloric restriction → ↓ ROS + ↓ IGF-1 signaling → extended lifespan."],
["Epigenetic Changes", "Altered methylation and histone modification patterns with age."],
["Inflammaging", "Low-grade chronic inflammation contributes to aging and age-related diseases."],
]
story.append(make_table(["Mechanism", "Details"], aging_rows, col_widths=[4.5*cm, None], header_bg=TEAL))
story.append(sp(8))
# ── RAPID REVIEW / SUMMARY TABLES ────────────────────────────────────────────
story.append(PageBreak())
story.append(colored_heading("RAPID REVIEW — KEY POINTS AT A GLANCE", RED))
story.append(sp(6))
# Adaptations summary
story.append(subsection("Cellular Adaptations — Quick Comparison"))
adapt_sum = [
["Hypertrophy", "↑ cell size", "Cells cannot divide (cardiac, skeletal muscle)", "Cardiac hypertrophy, uterus in pregnancy"],
["Hyperplasia", "↑ cell number", "Cells CAN divide (epithelium, glandular)", "BPH, endometrial hyperplasia, liver regeneration"],
["Atrophy", "↓ cell size", "Any cell type", "Denervation, disuse, ischemia, starvation"],
["Metaplasia", "Cell type change","Stem cell reprogramming", "Smoker's airways, Barrett's esophagus"],
]
story.append(make_table(["Adaptation", "Change", "Occurs in", "Example"], adapt_sum,
col_widths=[3*cm, 3*cm, None, 4.5*cm]))
story.append(sp(6))
# Necrosis quick ref
story.append(subsection("Necrosis Patterns — Quick Reference"))
nec_sum = [
["Coagulative", "Solid organ infarcts (heart, kidney)"],
["Liquefactive", "Brain infarcts; bacterial/fungal abscesses"],
["Caseous", "TB (granulomatous diseases)"],
["Fat", "Pancreatic necrosis; breast trauma"],
["Fibrinoid", "Immune vasculitis; malignant hypertension"],
["Gangrenous", "Limb/foot ischemia ± infection"],
]
story.append(make_table(["Necrosis Type", "Classic Association"], nec_sum,
col_widths=[4.5*cm, None], header_bg=RED))
story.append(sp(6))
# Mechanisms summary
story.append(subsection("Mechanisms of Cell Injury — Quick Reference"))
mech_sum = [
["ATP Depletion", "Na⁺/K⁺ pump fails → cell swelling → necrosis"],
["ROS", "Lipid peroxidation, DNA breaks, protein damage"],
["Ca²⁺ excess", "Enzyme activation: proteases, phospholipases → membrane/DNA damage"],
["Membrane Damage", "Lysosomal leakage → autodigestion; plasma membrane → osmotic lysis"],
["ER Stress (UPR)", "Misfolded proteins → apoptosis via mitochondrial pathway"],
["DNA Damage", "p53 → arrest → repair or apoptosis"],
]
story.append(make_table(["Mechanism", "Result"], mech_sum, col_widths=[4.5*cm, None]))
story.append(sp(6))
# Calcification summary
story.append(subsection("Calcification — Comparison"))
calc_sum = [
["Dystrophic", "Normal", "Necrotic/dying tissue", "TB, atherosclerosis"],
["Metastatic", "High", "Normal viable tissue", "Hyperparathyroidism, bone mets, Vit D toxicity"],
]
story.append(make_table(["Type", "Serum Ca²⁺", "Site", "Cause"], calc_sum,
col_widths=[3.5*cm, 3*cm, None, 5*cm], header_bg=RED))
story.append(sp(8))
# ── MEMORY AIDS / MNEMONICS ───────────────────────────────────────────────────
story.append(colored_heading("MEMORY AIDS & MNEMONICS", AMBER))
story.append(sp(6))
mnemonics = [
tip_box("Causes of Atrophy\n'DISH-M'",
["Disuse", "Innervation loss", "Supply of blood ↓", "Hormone withdrawal", "Malnutrition/Pressure"],
bg=AMBER_BG, title_bg=AMBER),
sp(6),
tip_box("Necrosis Types\n'CLC-FFG'",
["Coagulative", "Liquefactive", "Caseous", "Fat necrosis", "Fibrinoid", "Gangrenous"],
bg=TEAL_BG, title_bg=TEAL),
sp(6),
tip_box("Apoptosis Pathways",
["Intrinsic = Mitochondrial → cytochrome c → Caspase-9",
"Extrinsic = Death receptor → Caspase-8",
"Both converge on Effector Caspases (3, 6, 7)"],
bg=GREEN_BG, title_bg=LIME),
sp(6),
tip_box("ROS Antioxidants\n'GCSVE'",
["Glutathione peroxidase", "Catalase", "SOD (superoxide dismutase)", "Vitamin C", "Vitamin E"],
bg=RED_BG, title_bg=RED),
]
for item in mnemonics:
story.append(item)
story.append(sp(8))
story.append(hr(NAVY, 1))
story.append(sp(4))
story.append(Paragraph("Source: Robbins & Kumar Basic Pathology (Robbins Pathology), Chapter 1, pp. 16–129 | Compiled by Orris AI", NOTE))
# ── BUILD PDF ─────────────────────────────────────────────────────────────────
doc.build(story, onFirstPage=add_page_number, onLaterPages=add_page_number)
print(f"PDF successfully created: {OUTPUT}")
python /tmp/workspace/pathology-study-guide/generate_pdf.py 2>&1
ls -lh /tmp/workspace/pathology-study-guide/
Pathology Chapter1 StudyGuide
PDF Document · PDF
| Section | Content |
|---|---|
| Cover Page | Title banner with topic badges |
| 1. Introduction to Pathology | Etiology, Pathogenesis, Morphology defined in a table |
| 2. Cellular Responses to Stress | Adaptation → Reversible → Irreversible pathway |
| 3. Causes of Cell Injury | 7 categories in a clean table |
| 4. Reversible vs. Irreversible Injury | Necrosis vs. Apoptosis comparison table |
| 5. Necrosis Patterns | All 6 types with classic examples + clinical tip box |
| 6. Apoptosis | Causes table, both pathways (intrinsic/extrinsic), morphology |
| 7. Autophagy | Role and significance |
| 8. Mechanisms of Cell Injury | ATP depletion, ROS, Ca²⁺, Membrane damage, ER stress, DNA damage, clinical examples |
| 9. Cellular Adaptations | Hypertrophy, Hyperplasia, Atrophy (DISH-M mnemonic), Metaplasia with cancer risk |
| 10. Intracellular Depositions | Steatosis, cholesterol, pigments (9 types) + Dystrophic vs. Metastatic calcification |
| 11. Cellular Aging | Telomere shortening, inflammaging, all 6 mechanisms |
| Rapid Review | 4 quick-reference tables |
| Memory Aids | 4 mnemonic boxes (DISH-M, CLC-FFG, Apoptosis pathways, GCSVE) |
Generate a comparison poster: Necrosis vs. Apoptosis
A detailed medical education comparison poster titled "Necrosis vs. Apoptosis" for BHMS 2nd year pathology students. Split into two vertical columns side by side. Left column has a dark red header "NECROSIS" and right column has a teal/green header "APOPTOSIS". Each column contains clearly labeled comparison rows for: Cell Size (swollen/enlarged vs shrunken), Nucleus (pyknosis → karyorrhexis → karyolysis vs fragmented into nucleosome-sized pieces), Plasma Membrane (disrupted vs intact but altered), Cell Contents (enzymatic digestion and leakage vs intact, released in apoptotic bodies), Inflammation (prominent YES vs NO), Nature (always pathologic vs physiologic or pathologic), Causes (ischemia/toxins/infections vs DNA damage/growth factor withdrawal/immune killing), Morphology appearance (cartoon cell showing swelling and rupture vs cartoon cell showing shrinkage and budding), and Outcome (tissue destruction vs clean removal by macrophages). Include a bottom section showing the two apoptosis pathways: Intrinsic (mitochondrial) and Extrinsic (death receptor). Use a white background, bold headers, icons/symbols for each row, color-coded red for necrosis and teal for apoptosis. Professional medical poster style with clean typography and organized layout.
Give me pdf like this handwriting and page and format
python3 -c " from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont import os # Check what handwriting-style fonts are available on the system import subprocess result = subprocess.run(['fc-list'], capture_output=True, text=True) lines = [l for l in result.stdout.split('\n') if any(k in l.lower() for k in ['caveat','indie','dancing','kalam','shadow','hand','cursive','comic','patrick','schoolbell','architects','gloria','permanent','edu','satisfy','cookie','pacifico','sacramento','nothing','sriracha','gochi','itim','mali','pangolin','fuzzy'])] print('\n'.join(lines[:30])) "
pip install --user requests 2>/dev/null | tail -1 # Download a free handwriting font (Caveat or Kalam from Google Fonts) python3 -c " import urllib.request, os os.makedirs('/tmp/workspace/pathology-study-guide/fonts', exist_ok=True) # Download Caveat-Regular (handwriting font) from Google Fonts CDN url = 'https://fonts.gstatic.com/s/caveat/v18/WnznHAc5bAfYB2QRah7pcpNvOx-pjfJ9eIWpZA.woff2' # Use a TTF version instead urls = [ ('https://github.com/google/fonts/raw/main/ofl/caveat/Caveat%5Bwght%5D.ttf', 'Caveat.ttf'), ] for url, fname in urls: try: urllib.request.urlretrieve(url, f'/tmp/workspace/pathology-study-guide/fonts/{fname}') print(f'Downloaded {fname}') except Exception as e: print(f'Failed {fname}: {e}') "
python3 -c " # Also download a bold variant or use same font for bold import urllib.request, os # Download Kalam font (also great handwriting) urls = [ ('https://github.com/google/fonts/raw/main/ofl/kalam/Kalam-Regular.ttf', 'Kalam-Regular.ttf'), ('https://github.com/google/fonts/raw/main/ofl/kalam/Kalam-Bold.ttf', 'Kalam-Bold.ttf'), ] for url, fname in urls: try: urllib.request.urlretrieve(url, f'/tmp/workspace/pathology-study-guide/fonts/{fname}') sz = os.path.getsize(f'/tmp/workspace/pathology-study-guide/fonts/{fname}') print(f'Downloaded {fname} ({sz} bytes)') except Exception as e: print(f'Failed {fname}: {e}') "
~/pathology-study-guide/generate_handwriting_pdf.py
"""
Handwriting-style pathology notes PDF
Mimics the style in the uploaded image:
- Cream/off-white background
- Green headings: [A] Title : with underline
- Navy/dark blue body text with bullet points
- Kalam handwriting font
- Generous line spacing
"""
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, HRFlowable,
PageBreak, Table, TableStyle, KeepTogether
)
from reportlab.lib.styles import ParagraphStyle
from reportlab.lib.enums import TA_LEFT, TA_CENTER
import os
# ── Register fonts ────────────────────────────────────────────────────────────
FONT_DIR = "/tmp/workspace/pathology-study-guide/fonts"
pdfmetrics.registerFont(TTFont("Kalam", f"{FONT_DIR}/Kalam-Regular.ttf"))
pdfmetrics.registerFont(TTFont("Kalam-Bold", f"{FONT_DIR}/Kalam-Bold.ttf"))
# ── Colors ────────────────────────────────────────────────────────────────────
CREAM = colors.HexColor("#FAFAF5") # page background (off-white)
GREEN_HDG = colors.HexColor("#2E7D32") # heading green (like in photo)
NAVY_BODY = colors.HexColor("#1A237E") # dark navy/blue for body text
LIGHT_LINE = colors.HexColor("#C8E6C9") # soft green underline
# ── Styles ────────────────────────────────────────────────────────────────────
HDG = ParagraphStyle(
"Heading",
fontName="Kalam-Bold",
fontSize=20,
textColor=GREEN_HDG,
leading=28,
spaceBefore=22,
spaceAfter=2,
)
BODY = ParagraphStyle(
"Body",
fontName="Kalam",
fontSize=14,
textColor=NAVY_BODY,
leading=26,
spaceAfter=6,
leftIndent=0,
)
BULLET_STYLE = ParagraphStyle(
"Bullet",
fontName="Kalam",
fontSize=14,
textColor=NAVY_BODY,
leading=26,
spaceAfter=10,
leftIndent=28,
firstLineIndent=-18,
)
SUB_HDG = ParagraphStyle(
"SubHdg",
fontName="Kalam-Bold",
fontSize=15,
textColor=NAVY_BODY,
leading=22,
spaceBefore=10,
spaceAfter=4,
leftIndent=0,
)
NOTE_STYLE = ParagraphStyle(
"Note",
fontName="Kalam",
fontSize=11,
textColor=colors.HexColor("#555555"),
leading=16,
spaceAfter=4,
leftIndent=14,
)
TABLE_HDR = ParagraphStyle(
"TableHdr",
fontName="Kalam-Bold",
fontSize=13,
textColor=colors.white,
leading=18,
alignment=TA_CENTER,
)
TABLE_CELL = ParagraphStyle(
"TableCell",
fontName="Kalam",
fontSize=12,
textColor=NAVY_BODY,
leading=18,
)
# ── Helpers ───────────────────────────────────────────────────────────────────
def heading(label, title):
"""[A] Title : in green, with underline drawn via HR"""
text = f"[{label}] {title} :"
return [
Paragraph(f'<font color="#2E7D32">{text}</font>', HDG),
HRFlowable(width="98%", thickness=1.5, color=GREEN_HDG,
spaceBefore=0, spaceAfter=10),
]
def bullet(text):
return Paragraph(f"• {text}", BULLET_STYLE)
def sub(text):
return Paragraph(text, SUB_HDG)
def body(text):
return Paragraph(text, BODY)
def sp(h=8):
return Spacer(1, h)
def make_table(headers, rows, col_widths=None):
page_w = A4[0] - 4*cm
if col_widths is None:
w = page_w / len(headers)
col_widths = [w] * len(headers)
data = [[Paragraph(h, TABLE_HDR) for h in headers]]
for row in rows:
data.append([Paragraph(str(c), TABLE_CELL) for c in row])
t = Table(data, colWidths=col_widths, repeatRows=1)
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), GREEN_HDG),
("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.HexColor("#F1F8E9"),
colors.HexColor("#FAFAF5")]),
("GRID", (0,0), (-1,-1), 0.5, colors.HexColor("#A5D6A7")),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 8),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))
return t
# ── Page background ───────────────────────────────────────────────────────────
def draw_background(canvas, doc):
canvas.saveState()
canvas.setFillColor(CREAM)
canvas.rect(0, 0, A4[0], A4[1], fill=1, stroke=0)
# subtle left margin line (like ruled paper)
canvas.setStrokeColor(colors.HexColor("#E8F5E9"))
canvas.setLineWidth(0.8)
canvas.line(1.6*cm, 0, 1.6*cm, A4[1])
# page number
canvas.setFont("Kalam", 10)
canvas.setFillColor(colors.HexColor("#888888"))
canvas.drawCentredString(A4[0]/2, 1*cm,
f"Pathology · Chapter 1: Cell Injury & Adaptations · Page {canvas.getPageNumber()}")
canvas.restoreState()
# ════════════════════════════════════════════════════════════════════════════
# CONTENT
# ════════════════════════════════════════════════════════════════════════════
story = []
# ── TITLE PAGE ────────────────────────────────────────────────────────────────
title_box = Table([[
Paragraph('<font color="#2E7D32"><b>Pathology Notes</b></font>',
ParagraphStyle("T1", fontName="Kalam-Bold", fontSize=30,
textColor=GREEN_HDG, alignment=TA_CENTER, leading=38)),
Paragraph('<font color="#1A237E">BHMS 2nd Year</font>',
ParagraphStyle("T2", fontName="Kalam", fontSize=18,
textColor=NAVY_BODY, alignment=TA_CENTER, leading=26)),
Paragraph('<font color="#1A237E">Chapter 1 : Cell Injury, Adaptations & Cell Death</font>',
ParagraphStyle("T3", fontName="Kalam-Bold", fontSize=16,
textColor=NAVY_BODY, alignment=TA_CENTER, leading=24)),
Paragraph('<font color="#555555">Based on Robbins & Kumar Basic Pathology</font>',
ParagraphStyle("T4", fontName="Kalam", fontSize=12,
textColor=colors.HexColor("#555555"), alignment=TA_CENTER, leading=18)),
]], colWidths=["100%"])
title_box.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), colors.HexColor("#F1F8E9")),
("TOPPADDING", (0,0), (-1,-1), 18),
("BOTTOMPADDING", (0,0), (-1,-1), 18),
("LEFTPADDING", (0,0), (-1,-1), 20),
("RIGHTPADDING", (0,0), (-1,-1), 20),
("BOX", (0,0), (-1,-1), 1.5, GREEN_HDG),
]))
story.append(sp(20))
story.append(title_box)
story.append(PageBreak())
# ═════════════════════════════════════════════════════════
# SECTION 1 - Introduction to Pathology
# ═════════════════════════════════════════════════════════
story += heading("1", "Introduction to Pathology")
story.append(bullet("Pathology = study of <b>causes of disease</b> and changes in cells, tissues & organs."))
story.append(bullet("Provides the <b>scientific foundation</b> for the practice of medicine."))
story.append(sp(4))
story.append(sub("Key Terms :"))
story.append(bullet("<b>Etiology</b> — The origin/cause of disease ; includes genetic susceptibility + environmental triggers. Tells us WHY a disease arises."))
story.append(bullet("<b>Pathogenesis</b> — Steps in the development of disease from initial trigger to structural/functional abnormalities. Tells us HOW a disease develops."))
story.append(bullet("<b>Morphology</b> — Gross or microscopic appearance of cells & tissues used for diagnosis."))
story.append(bullet("<b>Precision Medicine</b> — Therapies tailored to each individual's specific molecular disease profile."))
story.append(PageBreak())
# ═════════════════════════════════════════════════════════
# SECTION 2 - Causes of Cell Injury
# ═════════════════════════════════════════════════════════
story += heading("2", "Causes of Cell Injury")
story.append(bullet("<b>Hypoxia & Ischemia</b> — Most common cause ; O₂ deficiency + reduced blood supply."))
story.append(bullet("<b>Physical Agents</b> — Mechanical trauma, extreme temperature, radiation, electric shock."))
story.append(bullet("<b>Chemical Agents / Drugs</b> — Toxins, poisons, hyper/hypotonic solutions, O₂ at high concentration."))
story.append(bullet("<b>Infectious Agents</b> — Viruses, bacteria, fungi, parasites."))
story.append(bullet("<b>Immunologic Reactions</b> — Autoimmune diseases, hypersensitivity reactions (Type I–IV)."))
story.append(bullet("<b>Genetic Derangements</b> — Congenital malformations, enzyme defects (e.g., sickle cell disease)."))
story.append(bullet("<b>Nutritional Imbalances</b> — Protein-calorie malnutrition, vitamin deficiencies, excess calories."))
story.append(sp(8))
# ═════════════════════════════════════════════════════════
# SECTION 3 - Reversible Cell Injury
# ═════════════════════════════════════════════════════════
story += heading("3", "Reversible Cell Injury")
story.append(bullet("Cell can <b>recover</b> if stimulus is removed in time."))
story.append(bullet("<b>Cellular Swelling</b> — Most common & earliest finding in almost all cell injury. Due to failure of Na⁺/K⁺ ATPase pump."))
story.append(bullet("<b>Fatty Change (Steatosis)</b> — Lipid vacuoles appear in cytoplasm (most common in liver)."))
story.append(sp(4))
story.append(sub("Morphology :"))
story.append(bullet("Pale, swollen cytoplasm"))
story.append(bullet("Plasma membrane blebs"))
story.append(bullet("Swelling of ER and mitochondria"))
story.append(bullet("Clumping of nuclear chromatin"))
story.append(PageBreak())
# ═════════════════════════════════════════════════════════
# SECTION A - Necrosis
# ═════════════════════════════════════════════════════════
story += heading("A", "Necrosis")
story.append(bullet("Cell death with <b>disruption of cell membranes</b> + enzymatic digestion of cell contents."))
story.append(bullet("Always <b>PATHOLOGIC</b> — never occurs in normal physiology."))
story.append(bullet("<b>Inflammation is prominent</b> — cellular contents leak and trigger immune response."))
story.append(sp(4))
story.append(sub("Features :"))
story.append(bullet("Cell size — Enlarged (swollen)"))
story.append(bullet("Nucleus — Pyknosis (shrinks) → Karyorrhexis (fragmentation) → Karyolysis (dissolution)"))
story.append(bullet("Plasma membrane — Disrupted"))
story.append(bullet("Cell contents — Enzymatic digestion ; leaks out into tissue"))
story.append(bullet("Inflammation — YES (prominent)"))
story.append(sp(10))
# ═════════════════════════════════════════════════════════
# SECTION B - Types of Necrosis
# ═════════════════════════════════════════════════════════
story += heading("B", "Types of Necrosis")
story.append(sp(4))
story.append(sub("[i] Coagulative Necrosis :"))
story.append(bullet("Most common type."))
story.append(bullet("Cell architecture is <b>preserved</b> (ghost cells visible under microscope)."))
story.append(bullet("Protein denaturation dominates over enzymatic digestion."))
story.append(bullet("Characteristic of <b>solid organ infarcts</b> (heart, kidney, spleen)."))
story.append(sp(8))
story.append(sub("[ii] Liquefactive Necrosis :"))
story.append(bullet("Dead cells are <b>completely digested</b> — leaves liquid, pus-like material."))
story.append(bullet("Enzymatic digestion dominates over protein denaturation."))
story.append(bullet("Characteristic of :"))
story.append(Paragraph(" ◦ <b>Brain infarcts</b> (neurons have little structural proteins)", BULLET_STYLE))
story.append(Paragraph(" ◦ <b>Bacterial/fungal abscesses</b> (neutrophil enzymes digest tissue)", BULLET_STYLE))
story.append(sp(8))
story.append(sub("[iii] Caseous Necrosis :"))
story.append(bullet("Term 'Caseous' (cheese-like) is derived from the <b>friable white appearance</b> of the area of Necrosis."))
story.append(bullet("Tissue is <b>Soft & Friable</b>."))
story.append(bullet("<b>Combination</b> of Coagulative & Liquefactive Necrosis."))
story.append(bullet("Characteristic of <b>Granulomatous inflammation</b> due to <b>Tuberculosis</b> or <b>Fungal Infection</b>."))
story.append(sp(8))
story.append(sub("[iv] Fat Necrosis :"))
story.append(bullet("Necrotic adipose tissue with <b>Chalky-white appearance</b> due to deposition of Calcium."))
story.append(bullet("Characteristic of Trauma of Fat (breast) and <b>Pancreatitis</b>-mediated damage of Peripancreatic Fat."))
story.append(bullet("Fatty acid released by Trauma (e.g., to breast) or Lipase (e.g., Pancreatitis) join Calcium via <b>Saponification</b>."))
story.append(sp(8))
story.append(sub("[v] Fibrinoid Necrosis :"))
story.append(bullet("<b>Immune complex deposition</b> in vessel walls — pink amorphous appearance."))
story.append(bullet("Characteristic of <b>Vasculitis</b> & Malignant Hypertension."))
story.append(bullet("Seen in immune-mediated vascular diseases (e.g., polyarteritis nodosa)."))
story.append(sp(8))
story.append(sub("[vi] Gangrenous Necrosis :"))
story.append(bullet("Large area of tissue death ; not a specific pattern but a clinical term."))
story.append(bullet("<b>Dry Gangrene</b> — coagulative necrosis from arterial occlusion (e.g., diabetic foot)."))
story.append(bullet("<b>Wet Gangrene</b> — liquefactive necrosis from secondary bacterial infection."))
story.append(sp(6))
story.append(Note := Paragraph(
" Clinical Note : Necrotic cells release tissue-specific proteins into blood "
"— Cardiac Troponin (myocardial damage), ALT/AST (liver damage), "
"Alkaline Phosphatase (bile duct damage).",
ParagraphStyle("NoteBox", fontName="Kalam", fontSize=12, textColor=colors.HexColor("#1B5E20"),
leading=20, leftIndent=10, rightIndent=10, spaceAfter=6,
borderColor=GREEN_HDG, borderWidth=1, borderPadding=8,
backColor=colors.HexColor("#E8F5E9"))
))
story.append(PageBreak())
# ═════════════════════════════════════════════════════════
# SECTION C - Apoptosis
# ═════════════════════════════════════════════════════════
story += heading("C", "Apoptosis")
story.append(bullet("<b>Programmed cell death</b> — cells activate enzymes that degrade their own DNA & proteins."))
story.append(bullet("Fragments into <b>apoptotic bodies</b> rapidly phagocytosed by macrophages."))
story.append(bullet("<b>No inflammation</b> — cellular contents do NOT leak out."))
story.append(sp(4))
story.append(sub("Features :"))
story.append(bullet("Cell size — Reduced (shrunken)"))
story.append(bullet("Nucleus — Fragmented into <b>nucleosome-sized pieces</b>"))
story.append(bullet("Plasma membrane — <b>Intact</b> (but altered structure)"))
story.append(bullet("Cell contents — Intact ; released in apoptotic bodies"))
story.append(bullet("Inflammation — <b>NO</b>"))
story.append(sp(8))
story.append(sub("Causes of Apoptosis :"))
story.append(sp(3))
story.append(Paragraph(" Physiologic :", ParagraphStyle("P2", fontName="Kalam-Bold", fontSize=13,
textColor=GREEN_HDG, leading=20, spaceAfter=4, leftIndent=14)))
story.append(bullet("During <b>embryogenesis</b> — organ development & digit formation."))
story.append(bullet("Turnover of proliferative tissues (intestinal epithelium, lymphocytes)."))
story.append(bullet("Involution of hormone-dependent tissues (e.g., endometrium)."))
story.append(bullet("Decline of leukocytes at end of immune response."))
story.append(bullet("Elimination of <b>self-reactive lymphocytes</b> (prevents autoimmunity)."))
story.append(sp(5))
story.append(Paragraph(" Pathologic :", ParagraphStyle("P3", fontName="Kalam-Bold", fontSize=13,
textColor=colors.HexColor("#C62828"), leading=20, spaceAfter=4, leftIndent=14)))
story.append(bullet("<b>DNA damage</b> (radiation, toxins) — activation of pro-apoptotic BH3-only proteins."))
story.append(bullet("Accumulation of <b>misfolded proteins</b> (ER stress)."))
story.append(bullet("Certain <b>viral infections</b> — viral proteins activate caspases."))
story.append(bullet("<b>CTL-mediated killing</b> — cytotoxic T lymphocytes activate caspases in target cells."))
story.append(PageBreak())
# ═════════════════════════════════════════════════════════
# SECTION D - Mechanisms of Apoptosis
# ═════════════════════════════════════════════════════════
story += heading("D", "Mechanisms of Apoptosis")
story.append(sp(4))
story.append(sub("[i] Intrinsic (Mitochondrial) Pathway :"))
story.append(bullet("Triggered by : DNA damage, oxidative stress, misfolded proteins."))
story.append(bullet("Pro-apoptotic proteins <b>BAX / BAK</b> increase mitochondrial permeability."))
story.append(bullet("<b>Cytochrome c</b> released from mitochondria → activates <b>Caspase-9</b> → Effector caspases (3, 6, 7)."))
story.append(bullet("Key regulators :"))
story.append(Paragraph(" ◦ <b>Anti-apoptotic</b> : Bcl-2, Bcl-XL (keep mitochondria intact)", BULLET_STYLE))
story.append(Paragraph(" ◦ <b>Pro-apoptotic</b> : BAX, BH3-only proteins (promote cytochrome c release)", BULLET_STYLE))
story.append(sp(8))
story.append(sub("[ii] Extrinsic (Death Receptor) Pathway :"))
story.append(bullet("Triggered by : FasL or TNF binding to <b>death receptors</b> (Fas, TNFR)."))
story.append(bullet("Adaptor proteins recruited → activate <b>Caspase-8</b> → Effector caspases."))
story.append(bullet("Used by <b>Cytotoxic T Lymphocytes (CTLs)</b> to kill infected or tumor cells."))
story.append(sp(8))
story.append(sub("Morphology of Apoptosis :"))
story.append(bullet("Cell shrinkage"))
story.append(bullet("Chromatin condensation & margination (crescent-shaped under nuclear membrane)"))
story.append(bullet("Nuclear fragmentation"))
story.append(bullet("Cytoplasmic blebs → Apoptotic bodies"))
story.append(bullet("Rapid phagocytosis by macrophages — NO inflammatory response"))
story.append(PageBreak())
# ═════════════════════════════════════════════════════════
# SECTION E - Necrosis vs Apoptosis Comparison
# ═════════════════════════════════════════════════════════
story += heading("E", "Necrosis vs. Apoptosis — Comparison Table")
story.append(sp(6))
nva = [
["Feature", "Necrosis", "Apoptosis"],
["Cell size", "Enlarged (swollen)", "Reduced (shrunken)"],
["Nucleus", "Pyknosis → karyorrhexis → karyolysis","Nucleosome-sized fragments"],
["Plasma membrane", "Disrupted", "Intact (altered structure)"],
["Cell contents", "Leaks out ; enzymatic digestion", "Intact in apoptotic bodies"],
["Inflammation", "YES (prominent)", "NO"],
["Nature", "Always PATHOLOGIC", "Physiologic OR Pathologic"],
["Phagocytosis", "By neutrophils/macrophages", "By macrophages (no inflammation)"],
["Energy (ATP)", "Not required (passive)", "Required (active process)"],
["Caspases", "Not involved", "Central role"],
]
story.append(make_table(nva[0], nva[1:], col_widths=[4.5*cm, None, None]))
story.append(PageBreak())
# ═════════════════════════════════════════════════════════
# SECTION F - Autophagy
# ═════════════════════════════════════════════════════════
story += heading("F", "Autophagy")
story.append(bullet("Cellular self-digestion : organelles/proteins sequestered in <b>autophagosomes</b> (double-membrane vesicles)."))
story.append(bullet("Protective during <b>nutrient deprivation</b> — provides recycled building blocks."))
story.append(bullet("Excessive autophagy can activate apoptosis."))
story.append(bullet("Role in : Aging, Parkinson's disease, Alzheimer's disease, Cancer."))
story.append(sp(10))
# ═════════════════════════════════════════════════════════
# SECTION G - Mechanisms of Cell Injury
# ═════════════════════════════════════════════════════════
story += heading("G", "Mechanisms of Cell Injury")
story.append(sp(4))
story.append(sub("[i] Mitochondrial Dysfunction :"))
story.append(bullet("Damaged mitochondria release <b>cytochrome c</b> → triggers intrinsic apoptosis."))
story.append(bullet("ATP depletion → failure of Na⁺/K⁺ ATPase → cell swelling → membrane damage → necrosis."))
story.append(bullet("Formation of <b>MPTP</b> (mitochondrial permeability transition pore) → loss of membrane potential."))
story.append(sp(8))
story.append(sub("[ii] Oxidative Stress (ROS) :"))
story.append(bullet("ROS : Superoxide (O₂•⁻), Hydrogen peroxide (H₂O₂), Hydroxyl radical (OH•)"))
story.append(bullet("Damage caused :"))
story.append(Paragraph(" ◦ Lipid peroxidation → membrane damage", BULLET_STYLE))
story.append(Paragraph(" ◦ Protein oxidation → fragmentation/dysfunction", BULLET_STYLE))
story.append(Paragraph(" ◦ DNA strand breaks → mutations, apoptosis", BULLET_STYLE))
story.append(bullet("Antioxidant defenses : Glutathione peroxidase, Catalase, SOD, Vitamins C & E."))
story.append(sp(8))
story.append(sub("[iii] Membrane Damage :"))
story.append(bullet("Mitochondrial membrane — Loss of membrane potential → energy failure."))
story.append(bullet("Plasma membrane — Loss of osmotic balance ; influx of fluids & ions."))
story.append(bullet("Lysosomal membrane — Leakage of acid hydrolases → autodigestion → irreversible necrosis."))
story.append(sp(8))
story.append(sub("[iv] Calcium Homeostasis Disturbance :"))
story.append(bullet("Normal cytosolic Ca²⁺ ~0.1 μmol vs. extracellular 1.3 mmol."))
story.append(bullet("Ischemia / toxins → excess intracellular Ca²⁺."))
story.append(bullet("Activates : <b>Proteases, Phospholipases, Endonucleases, ATPases</b> → membrane & DNA damage."))
story.append(sp(8))
story.append(sub("[v] ER Stress :"))
story.append(bullet("Misfolded proteins accumulate → activate <b>Unfolded Protein Response (UPR)</b>."))
story.append(bullet("If overwhelmed → pro-apoptotic signals → apoptosis via mitochondrial pathway."))
story.append(bullet("Implicated in : Alzheimer's disease, Type 2 diabetes, neurodegeneration."))
story.append(sp(8))
story.append(sub("[vi] DNA Damage :"))
story.append(bullet("Caused by : Radiation, ROS, Chemicals."))
story.append(bullet("<b>p53</b> accumulates → cell cycle arrest for repair ; if irreparable → apoptosis."))
story.append(PageBreak())
# ═════════════════════════════════════════════════════════
# SECTION H - Cellular Adaptations
# ═════════════════════════════════════════════════════════
story += heading("H", "Cellular Adaptations to Stress")
story.append(bullet("Reversible changes in number, size, phenotype, or function of cells in response to stress."))
story.append(sp(6))
story.append(sub("[i] Hypertrophy — ↑ Cell SIZE (no new cells) :"))
story.append(bullet("Occurs in cells with <b>limited capacity to divide</b> (cardiac & skeletal muscle)."))
story.append(bullet("<b>Physiologic</b> : Uterus in pregnancy ; Skeletal muscle with exercise."))
story.append(bullet("<b>Pathologic</b> : Cardiac hypertrophy in hypertension or aortic stenosis."))
story.append(bullet("Mechanism : Stretch → growth factors + adrenergic hormones → more myofilaments."))
story.append(bullet("Sustained stress → degenerative changes → ventricular dilation → cardiac failure."))
story.append(sp(8))
story.append(sub("[ii] Hyperplasia — ↑ Cell NUMBER :"))
story.append(bullet("Occurs in cells <b>capable of division</b> (epithelium, glandular tissue)."))
story.append(bullet("<b>Physiologic</b> : Breast/uterus in puberty & pregnancy ; Liver regeneration."))
story.append(bullet("<b>Pathologic</b> : Endometrial hyperplasia (excess estrogen) ; BPH ; Psoriasis."))
story.append(bullet("Sustained pathologic hyperplasia → precursor to <b>cancer</b>."))
story.append(sp(8))
story.append(sub("[iii] Atrophy — ↓ Cell SIZE & Function :"))
story.append(Paragraph(
" Causes (Mnemonic <b>DISH-M</b>) : Disuse, Innervation loss, Supply of blood ↓, Hormone withdrawal, Malnutrition/Pressure.",
ParagraphStyle("Mne", fontName="Kalam-Bold", fontSize=13, textColor=colors.HexColor("#1B5E20"),
leading=20, leftIndent=14, spaceAfter=8,
backColor=colors.HexColor("#E8F5E9"), borderPadding=6)
))
story.append(bullet("Mechanism : ↓ protein synthesis + ↑ protein degradation via <b>ubiquitin-proteasome pathway</b>."))
story.append(sp(8))
story.append(sub("[iv] Metaplasia — Change in CELL TYPE :"))
story.append(bullet("Reversible replacement of one adult cell type by another."))
story.append(bullet("<b>Columnar → Squamous</b> : Respiratory epithelium in smokers."))
story.append(bullet("<b>Squamous → Columnar</b> : Barrett's esophagus (acid reflux)."))
story.append(bullet("If stimulus persists → can predispose to <b>cancer</b>."))
story.append(PageBreak())
# ═════════════════════════════════════════════════════════
# SECTION I - Intracellular Depositions
# ═════════════════════════════════════════════════════════
story += heading("I", "Intracellular Accumulations")
story.append(sp(4))
story.append(sub("[i] Fatty Change (Steatosis) :"))
story.append(bullet("Abnormal accumulation of <b>triglycerides</b> within parenchymal cells (most common in liver)."))
story.append(bullet("Causes : Toxins, Protein malnutrition, Diabetes, Obesity, Alcohol, Anoxia."))
story.append(sp(6))
story.append(sub("[ii] Pigments :"))
story.append(bullet("<b>Lipofuscin</b> — 'Wear & tear pigment' ; brownish-yellow ; accumulates in aging cells."))
story.append(bullet("<b>Hemosiderin</b> — Excess iron ; golden-yellow granules ; seen in hemochromatosis."))
story.append(bullet("<b>Carbon (Anthracosis)</b> — Inhaled ; phagocytosed by alveolar macrophages ; coal worker's pneumoconiosis."))
story.append(bullet("<b>Bilirubin</b> — Excess → Jaundice."))
story.append(sp(8))
story += heading("J", "Pathologic Calcification")
story.append(sp(4))
calc = [
["Feature", "Dystrophic Calcification", "Metastatic Calcification"],
["Site", "Dead / necrotic tissue", "Normal viable tissue"],
["Serum Ca²⁺", "NORMAL", "HIGH (hypercalcemia)"],
["Examples", "TB, atherosclerosis, heart valves", "Hyperparathyroidism, bone metastases, Vit D toxicity"],
]
story.append(make_table(calc[0], calc[1:], col_widths=[4*cm, None, None]))
story.append(PageBreak())
# ═════════════════════════════════════════════════════════
# SECTION K - Cellular Aging
# ═════════════════════════════════════════════════════════
story += heading("K", "Cellular Aging")
story.append(bullet("Cells can undergo finite divisions → <b>Hayflick Limit</b> (≈ 50–70 divisions for most human cells)."))
story.append(sp(5))
story.append(sub("Mechanisms :"))
story.append(bullet("<b>Telomere Shortening</b> — Repetitive DNA at chromosome ends shortens with each division → senescence or apoptosis. Cancer cells bypass via <b>Telomerase</b>."))
story.append(bullet("<b>Accumulated DNA Damage</b> — ROS, chemicals, radiation ; repair mechanisms decline with age."))
story.append(bullet("<b>Defective Protein Homeostasis</b> — Misfolded proteins accumulate ; chaperone & proteasome activity decline."))
story.append(bullet("<b>Metabolic Alterations</b> — Caloric restriction → ↓ ROS + ↓ IGF-1 signaling → extended lifespan."))
story.append(bullet("<b>Epigenetic Changes</b> — Altered methylation & histone modification patterns with age."))
story.append(bullet("<b>Inflammaging</b> — Low-grade chronic inflammation contributes to age-related diseases."))
story.append(sp(14))
# ── Footer note ───────────────────────────────────────────────────────────────
story.append(HRFlowable(width="100%", thickness=1, color=GREEN_HDG, spaceBefore=4, spaceAfter=6))
story.append(Paragraph(
"Source : Robbins & Kumar Basic Pathology (Robbins Pathology), Chapter 1, pp. 16–129 | Notes compiled by Orris AI",
ParagraphStyle("Src", fontName="Kalam", fontSize=10, textColor=colors.HexColor("#777777"),
alignment=TA_CENTER, leading=14)
))
# ════════════════════════════════════════════════════════════════════════════
# BUILD
# ════════════════════════════════════════════════════════════════════════════
OUTPUT = "/tmp/workspace/pathology-study-guide/Pathology_Handwriting_Notes.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
leftMargin=2.2*cm,
rightMargin=2*cm,
topMargin=2.2*cm,
bottomMargin=2*cm,
title="Pathology Chapter 1 - Handwriting Notes",
author="Orris AI",
)
doc.build(story, onFirstPage=draw_background, onLaterPages=draw_background)
print(f"PDF created: {OUTPUT}")
import os
print(f"Size: {os.path.getsize(OUTPUT)/1024:.1f} KB")
python3 /tmp/workspace/pathology-study-guide/generate_handwriting_pdf.py 2>&1
Pathology Handwriting Notes
PDF Document · PDF
| Style Element | Your Image | This PDF |
|---|---|---|
| Font | Neat cursive-print hybrid | Kalam handwriting font |
| Heading color | Medium-dark green | #2E7D32 green |
| Body text color | Dark navy/blue | #1A237E navy |
| Heading format | [D] Caseous Necrosis : | Same - [A] Title : |
| Underline | Green line under heading | Green HR line |
| Background | Off-white / cream | #FAFAF5 cream |
| Bullets | Simple dots, indented | • with left indent |
| Spacing | Airy, generous gaps | Large leading & spaceBefore |
| Left margin | Faint vertical line | Subtle green margin line |