Make time convenient 5 mark notes in pdf
mkdir -p /tmp/workspace/necrosis-notes && ls /tmp/workspace/necrosis-notes/
~/necrosis-notes/generate_notes.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
OUTPUT = "/tmp/workspace/necrosis-notes/Tissue_Necrosis_5mark_Notes.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=1.8*cm,
leftMargin=1.8*cm,
topMargin=1.5*cm,
bottomMargin=1.5*cm,
)
# ── Colour palette ────────────────────────────────────────────────────────────
NAVY = colors.HexColor("#1a3a5c")
TEAL = colors.HexColor("#0d6e7a")
GOLD = colors.HexColor("#e6a817")
LIGHT = colors.HexColor("#eaf4f6")
PINK = colors.HexColor("#fff0f3")
WHITE = colors.white
DARK = colors.HexColor("#1c1c1c")
GRAY = colors.HexColor("#555555")
styles = getSampleStyleSheet()
# Custom styles
title_style = ParagraphStyle(
"Title", parent=styles["Normal"],
fontName="Helvetica-Bold", fontSize=18,
textColor=WHITE, alignment=TA_CENTER,
spaceAfter=4, leading=22
)
subtitle_style = ParagraphStyle(
"Subtitle", parent=styles["Normal"],
fontName="Helvetica", fontSize=10,
textColor=colors.HexColor("#cce8ec"), alignment=TA_CENTER,
spaceAfter=0
)
h1 = ParagraphStyle(
"H1", parent=styles["Normal"],
fontName="Helvetica-Bold", fontSize=13,
textColor=WHITE, leading=17,
spaceBefore=4, spaceAfter=3
)
h2 = ParagraphStyle(
"H2", parent=styles["Normal"],
fontName="Helvetica-Bold", fontSize=10.5,
textColor=NAVY, leading=14,
spaceBefore=5, spaceAfter=2
)
body = ParagraphStyle(
"Body", parent=styles["Normal"],
fontName="Helvetica", fontSize=9.5,
textColor=DARK, leading=13.5,
spaceAfter=2, leftIndent=6
)
bullet_style = ParagraphStyle(
"Bullet", parent=styles["Normal"],
fontName="Helvetica", fontSize=9.5,
textColor=DARK, leading=13,
spaceAfter=1.5,
leftIndent=14, firstLineIndent=-8
)
bold_label = ParagraphStyle(
"BoldLabel", parent=styles["Normal"],
fontName="Helvetica-Bold", fontSize=9.5,
textColor=TEAL, leading=13,
spaceAfter=1.5, leftIndent=6
)
note_style = ParagraphStyle(
"Note", parent=styles["Normal"],
fontName="Helvetica-Oblique", fontSize=9,
textColor=colors.HexColor("#7a4000"), leading=12,
spaceAfter=1, leftIndent=10,
backColor=colors.HexColor("#fff8e7")
)
def section_header(title, color=TEAL):
"""Returns a coloured section header block."""
data = [[Paragraph(f'<font color="white"><b>{title}</b></font>', h1)]]
t = Table(data, colWidths=[17*cm])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), color),
("ROUNDEDCORNERS", [4,4,4,4]),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 10),
]))
return t
def sub_header(title):
data = [[Paragraph(f'<b>{title}</b>', ParagraphStyle(
"sh", fontName="Helvetica-Bold", fontSize=10, textColor=WHITE,
leading=13
))]]
t = Table(data, colWidths=[17*cm])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), NAVY),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 14),
]))
return t
def bp(text):
return Paragraph(f"• {text}", bullet_style)
def lbl(label, text):
return Paragraph(f'<b><font color="#0d6e7a">{label}:</font></b> {text}', body)
story = []
# ══════════════════════════════════════════════════════════════════════════════
# TITLE PAGE HEADER
# ══════════════════════════════════════════════════════════════════════════════
title_data = [[
Paragraph("TISSUE NECROSIS & APOPTOSIS", title_style),
Paragraph("Quick 5-Mark Revision Notes | Pathology", subtitle_style),
]]
title_table = Table([[
Paragraph("TISSUE NECROSIS & APOPTOSIS", title_style),
]], colWidths=[17*cm])
title_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), NAVY),
("TOPPADDING", (0,0), (-1,-1), 10),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 10),
("ROUNDEDCORNERS", [6,6,6,6]),
]))
subtitle_table = Table([[
Paragraph("Quick 5-Mark Revision Notes | Pathology", subtitle_style),
]], colWidths=[17*cm])
subtitle_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), TEAL),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 10),
]))
story.append(title_table)
story.append(subtitle_table)
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════════
# 1. COAGULATIVE NECROSIS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("1. COAGULATIVE NECROSIS"))
story.append(Spacer(1, 0.15*cm))
story.append(lbl("Definition", "Common type; <b>outline of dead tissue is preserved</b> for few days. Localised area = <b>Infarct</b>."))
story.append(lbl("Causes", "Ischemia (vessel obstruction), potent bacterial toxins, phenol, mercury, corrosive chemicals."))
story.append(Spacer(1, 0.1*cm))
story.append(sub_header("Gross"))
story.append(bp("<b>Organs:</b> All organs <i>except brain</i>. Most common: heart, kidney, spleen."))
story.append(bp("<b>Appearance:</b> Opaque, like boiled meat. Tissue is <b>dry, pale, yellow and soft</b>."))
story.append(sub_header("Microscopy"))
story.append(bp("Outline of dead tissue preserved for some days."))
story.append(bp("Nuclear changes (pyknosis, karyorrhexis, karyolysis) + cytoplasmic changes."))
story.append(Spacer(1, 0.25*cm))
# ══════════════════════════════════════════════════════════════════════════════
# 2. LIQUEFACTIVE (COLLIQUATIVE) NECROSIS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("2. LIQUEFACTIVE (COLLIQUATIVE) NECROSIS"))
story.append(Spacer(1, 0.15*cm))
story.append(lbl("Definition", "Dead tissue <b>rapidly softens</b> and transforms into a liquid viscous mass."))
story.append(lbl("Causes", None))
story.append(bp("Ischemic injury to CNS (brain)."))
story.append(bp("<b>Suppurative infections:</b> Focal bacterial infections stimulate leukocyte accumulation."))
story.append(Spacer(1, 0.1*cm))
story.append(sub_header("Gross"))
story.append(bp("<b>Organs:</b> Brain, abscess (any organ/tissue). Necrotic area is soft, center liquefied."))
story.append(sub_header("Microscopy — Abscess"))
story.append(bp("<b>Abscess</b> = localised collection of pus; cavity containing pus formed by liquefactive necrosis + inflammatory cells."))
story.append(bp("Pus = liquefied necrotic cell debris + dead leukocytes + macrophages."))
story.append(bp("Abscess shows a cavity with pus, surrounded by granulation tissue + inflammatory cells."))
story.append(Spacer(1, 0.25*cm))
# ══════════════════════════════════════════════════════════════════════════════
# 3. CASEOUS NECROSIS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("3. CASEOUS NECROSIS"))
story.append(Spacer(1, 0.15*cm))
story.append(lbl("Definition", "Distinctive type with <b>combined features of coagulative & liquefactive necrosis</b>."))
story.append(lbl("Cause", "Characteristic of <b>Tuberculosis</b>; due to hypersensitivity reaction. Most common site: TB lymph node."))
story.append(Spacer(1, 0.1*cm))
story.append(sub_header("Gross"))
story.append(bp("<b>Organs:</b> Any organ in TB; most common: <b>lung & lymph nodes</b>."))
story.append(bp("<b>Appearance:</b> Yellowish-white, soft, granular, friable, sharply circumscribed."))
story.append(bp("Necrotic tissue resembles dry/crumby <b>cheese</b> — hence the name 'caseous' (cheese-like)."))
story.append(sub_header("Microscopy"))
story.append(bp("Focal lesion = <b>Granuloma</b> (tuberculous granuloma / tubercle)."))
story.append(bp("Granulomas may be <b>caseating</b> (soft granuloma) or <b>non-caseating</b> (hard granuloma)."))
story.append(bp("Caseating granulomas: central area of caseous necrosis — shapeless, eosinophilic, granular material."))
story.append(bp("Necrotic area surrounded by: <b>epithelioid cells + Langhans giant cells</b> (horseshoe nuclei) + lymphocytes + fibroblasts."))
story.append(bp("Caseous material may undergo <b>dystrophic calcification</b>."))
story.append(Spacer(1, 0.25*cm))
# ══════════════════════════════════════════════════════════════════════════════
# 4. FAT NECROSIS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("4. FAT NECROSIS"))
story.append(Spacer(1, 0.15*cm))
story.append(lbl("Definition", "Focal areas of fat destruction affecting <b>adipose tissue</b>."))
story.append(lbl("Types", "<b>Enzymatic</b> (most common) and <b>Traumatic</b>."))
story.append(Spacer(1, 0.1*cm))
story.append(sub_header("A. Enzymatic Fat Necrosis"))
story.append(bp("Peculiar to adipose tissue around the <b>acutely inflamed pancreas (acute pancreatitis)</b>."))
story.append(bp("<b>Mechanism:</b> Pancreatic enzymes leak from injured acinar cells → fat cell damage → lipase destroys fat cells → free fatty acids released → combine with calcium → precipitated as <b>calcium soaps (fat saponification)</b>."))
story.append(bp("<b>Gross:</b> <b>Chalky-white areas</b>."))
story.append(bp("<b>Microscopy:</b> Fat cells with pale, shadowy outlines surrounded by inflammatory reaction."))
story.append(sub_header("B. Traumatic Fat Necrosis"))
story.append(bp("Occurs in tissues with <b>high fat content</b> (breast, thigh) following <b>severe trauma</b>."))
story.append(Spacer(1, 0.25*cm))
# ══════════════════════════════════════════════════════════════════════════════
# 5. FIBRINOID NECROSIS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("5. FIBRINOID NECROSIS"))
story.append(Spacer(1, 0.15*cm))
story.append(lbl("Definition", "Special form; deposition of <b>pink-staining (fibrin-like) proteinaceous material</b>."))
story.append(lbl("Sites", "Arteries, arterioles, glomeruli of kidney."))
story.append(lbl("Cause", "Usually seen in <b>immune-mediated vascular injury</b> (immune complex vasculitis)."))
story.append(Spacer(1, 0.25*cm))
# ══════════════════════════════════════════════════════════════════════════════
# 6. GANGRENE
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("6. GANGRENE (GANGRENOUS NECROSIS)"))
story.append(Spacer(1, 0.15*cm))
story.append(lbl("Definition", "Massive necrosis with <b>superadded putrefaction</b> (bacterial decomposition → foul-smelling gases)."))
story.append(Spacer(1, 0.1*cm))
story.append(sub_header("A. Dry Gangrene — 'Foot Dry Gangrene'"))
story.append(bp("<b>Cause:</b> Arterial occlusion (e.g., atherosclerosis)."))
story.append(bp("<b>Sites:</b> Limbs, distal lower limb (leg, foot, toes)."))
story.append(bp("<b>Gross:</b> Dry, shrunken, shriveled (<i>mummified</i>), dark brown/black. <b>Clear line of demarcation</b> present."))
story.append(bp("<b>Microscopy:</b> Smudging of soft tissue/skin; line of demarcation = granulation tissue + inflammatory cells."))
story.append(sub_header("B. Wet Gangrene — 'Diabetic Foot'"))
story.append(bp("<b>Sites:</b> Moist tissues/organs: bowel, lung, mouth."))
story.append(bp("<b>Cause:</b> Usually <b>venous blockage</b> (strangulated hernia, intussusception, volvulus). In <b>diabetics</b> — high sugar favours bacterial growth."))
story.append(bp("<b>Gross:</b> Soft, swollen, putrid, rotten, dark. <b>No clear line of demarcation</b>."))
story.append(bp("<b>Microscopy:</b> Liquefactive type of necrosis."))
story.append(sub_header("C. Gas Gangrene"))
story.append(bp("Special type of wet gangrene caused by <b>gas-forming anaerobic Clostridia</b>."))
story.append(Spacer(1, 0.25*cm))
# ══════════════════════════════════════════════════════════════════════════════
# DRY vs WET GANGRENE TABLE
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("DRY vs WET GANGRENE — Comparison Table", NAVY))
story.append(Spacer(1, 0.2*cm))
header_style = ParagraphStyle("th", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE, alignment=TA_CENTER, leading=12)
cell_style = ParagraphStyle("td", fontName="Helvetica", fontSize=9, textColor=DARK, alignment=TA_LEFT, leading=12)
feat_style = ParagraphStyle("tf", fontName="Helvetica-Bold", fontSize=9, textColor=NAVY, alignment=TA_LEFT, leading=12)
table_data = [
[Paragraph("Feature", header_style), Paragraph("DRY", header_style), Paragraph("WET", header_style)],
[Paragraph("Common site", feat_style), Paragraph("Limbs", cell_style), Paragraph("Bowels", cell_style)],
[Paragraph("Example", feat_style), Paragraph("Atherosclerotic occlusion", cell_style), Paragraph("Volvulus, intussusception", cell_style)],
[Paragraph("Cause of ischemia", feat_style), Paragraph("Arterial obstruction", cell_style), Paragraph("Commonly venous obstruction", cell_style)],
[Paragraph("Rate of obstruction", feat_style), Paragraph("Slow", cell_style), Paragraph("Abrupt", cell_style)],
[Paragraph("Pathogens", feat_style), Paragraph("Absent", cell_style), Paragraph("May be present / causative", cell_style)],
[Paragraph("Appearance", feat_style), Paragraph("Shriveled, dry (mummified), black", cell_style), Paragraph("Swollen, soft, moist", cell_style)],
[Paragraph("Line of demarcation", feat_style), Paragraph("Clear cut", cell_style), Paragraph("Not clear cut", cell_style)],
[Paragraph("Putrefaction", feat_style), Paragraph("Minimal", cell_style), Paragraph("Marked, may be foul", cell_style)],
[Paragraph("Spread", feat_style), Paragraph("Slow", cell_style), Paragraph("Rapid", cell_style)],
[Paragraph("Prognosis", feat_style), Paragraph("Fair", cell_style), Paragraph("Poor (severe septicemia)", cell_style)],
]
col_w = [5*cm, 5.8*cm, 6.2*cm]
comp_table = Table(table_data, colWidths=col_w, repeatRows=1)
comp_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), TEAL),
("BACKGROUND", (0,1), (-1,-1), colors.white),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.white, LIGHT]),
("GRID", (0,0), (-1,-1), 0.5, colors.HexColor("#b0d0d8")),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 6),
("RIGHTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))
story.append(comp_table)
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════════
# 7. GUMMATOUS NECROSIS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("7. GUMMATOUS NECROSIS"))
story.append(Spacer(1, 0.15*cm))
story.append(bp("Necrotic tissue is <b>firm and rubbery</b>; original architecture visible on histology."))
story.append(bp("Characteristically found in <b>Syphilis</b>."))
story.append(Spacer(1, 0.25*cm))
# ══════════════════════════════════════════════════════════════════════════════
# 8. APOPTOSIS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("8. APOPTOSIS", colors.HexColor("#7b1c2e")))
story.append(Spacer(1, 0.15*cm))
story.append(lbl("Definition", "Programmed cell death — cells <b>activate enzymes that degrade nuclear DNA and cytoplasmic proteins</b>."))
story.append(Spacer(1, 0.1*cm))
story.append(sub_header("Causes of Apoptosis"))
story.append(Paragraph("<b>A. Physiological Situations</b>", bold_label))
story.append(bp("Removal of excess cells during embryogenesis (e.g., disappearance of webbing between fingers/toes)."))
story.append(bp("Elimination of cells after hormonal stimulus (e.g., endometrial shedding)."))
story.append(bp("Deletion of autoreactive lymphocytes."))
story.append(bp("Cell death after immune response (killing by CTLs)."))
story.append(Paragraph("<b>B. Pathological Situations</b>", bold_label))
story.append(bp("DNA damage (radiation, cytotoxic drugs, free radicals)."))
story.append(bp("Accumulation of misfolded proteins."))
story.append(bp("Cell death in certain infections (viral hepatitis, HIV)."))
story.append(bp("Atrophy of hormone-sensitive tissue on hormone withdrawal."))
story.append(Spacer(1, 0.15*cm))
story.append(sub_header("Key Features of Apoptosis"))
apop_feats = [
["Feature", "Detail"],
["Cell size", "Shrinks (vs necrosis: swells)"],
["Nucleus", "Chromatin condensation (pyknosis) → fragmentation"],
["Membrane", "Intact (no rupture, unlike necrosis)"],
["Inflammation", "Absent (phagocytosis by macrophages)"],
["Energy", "ATP-dependent (active process)"],
["Bodies", "Apoptotic bodies formed, phagocytosed"],
]
feat_h = ParagraphStyle("fh", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE, alignment=TA_CENTER, leading=12)
feat_c = ParagraphStyle("fc", fontName="Helvetica", fontSize=9, textColor=DARK, leading=12)
feat_bold = ParagraphStyle("fb", fontName="Helvetica-Bold", fontSize=9, textColor=NAVY, leading=12)
apop_data = [[Paragraph(r[0], feat_h if i==0 else feat_bold),
Paragraph(r[1], feat_h if i==0 else feat_c)]
for i, r in enumerate(apop_feats)]
apop_table = Table(apop_data, colWidths=[5*cm, 12*cm])
apop_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#7b1c2e")),
("ROWBACKGROUNDS", (0,1), (-1,-1), [PINK, colors.white]),
("GRID", (0,0), (-1,-1), 0.5, colors.HexColor("#e8b0ba")),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 7),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))
story.append(apop_table)
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════════
# QUICK RECALL BOX
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("QUICK RECALL — Exam Tips", GOLD))
story.append(Spacer(1, 0.15*cm))
tips = [
("Coagulative", "All organs EXCEPT brain | Outline preserved | Like boiled meat"),
("Liquefactive", "Brain ischemia + suppurative infections | Abscess = pus collection"),
("Caseous", "TB only | Cheese-like | Granuloma with Langhans giant cells"),
("Fat necrosis", "Enzymatic = pancreatitis + chalky white | Traumatic = breast/thigh"),
("Fibrinoid", "Immune complex vasculitis | Arteries + glomeruli | Pink fibrin deposits"),
("Gangrene", "Dry = arterial, mummified, line of demarcation | Wet = venous, no line"),
("Gas gangrene", "Wet type | Anaerobic Clostridia"),
("Gummatous", "Syphilis | Firm & rubbery"),
("Apoptosis", "Programmed, ATP-dependent, NO inflammation, apoptotic bodies"),
]
tip_label = ParagraphStyle("tl", fontName="Helvetica-Bold", fontSize=9, textColor=colors.HexColor("#7a4000"), leading=12)
tip_body = ParagraphStyle("tb", fontName="Helvetica", fontSize=9, textColor=DARK, leading=12)
tip_data = [[Paragraph(t[0], tip_label), Paragraph(t[1], tip_body)] for t in tips]
tip_table = Table(tip_data, colWidths=[4.5*cm, 12.5*cm])
tip_table.setStyle(TableStyle([
("ROWBACKGROUNDS", (0,0), (-1,-1), [colors.HexColor("#fff8e7"), colors.HexColor("#fff3cc")]),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#e6a817")),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))
story.append(tip_table)
story.append(Spacer(1, 0.3*cm))
# Footer note
story.append(HRFlowable(width="100%", thickness=0.5, color=TEAL))
story.append(Paragraph(
"<i>Notes compiled from textbook source — for 5-mark exam preparation in Pathology.</i>",
ParagraphStyle("footer", fontName="Helvetica-Oblique", fontSize=8,
textColor=GRAY, alignment=TA_CENTER, spaceBefore=4)
))
# Build PDF
doc.build(story)
print(f"PDF saved to: {OUTPUT}")
python /tmp/workspace/necrosis-notes/generate_notes.py 2>&1
Tissue Necrosis 5mark Notes
PDF Document · PDF
| Section | Key Points Covered |
|---|---|
| 1. Coagulative Necrosis | Definition, causes, gross (boiled meat, dry/pale/yellow), microscopy |
| 2. Liquefactive Necrosis | Definition, causes (CNS ischemia + suppurative infections), abscess features |
| 3. Caseous Necrosis | TB-specific, cheese-like, granuloma with Langhans giant cells |
| 4. Fat Necrosis | Enzymatic (pancreatitis, chalky white, fat saponification) + Traumatic |
| 5. Fibrinoid Necrosis | Immune complex vasculitis, pink fibrin deposits, arteries/glomeruli |
| 6. Gangrene | Dry vs Wet features + Gas gangrene (Clostridia) |
| 7. Gummatous Necrosis | Syphilis, firm & rubbery |
| 8. Apoptosis | Definition, physiological & pathological causes, comparison table |
| Comparison Table | Dry vs Wet gangrene (all 9 differentiating features) |
| Quick Recall Box | One-liner exam tips for all 9 types |
Make time convenient 5 mark notes in pdf and also in understandable language
mkdir -p /tmp/workspace/rickets-notes
What do you mean by credits are exhausted?