Answer all question from harsh mohan for professional exam
cd /home/daytona/workspace/attachments/da8cb3b7-8325-4332-9995-7fce3d37c23f && python3 -c " from pypdf import PdfReader reader = PdfReader('Pathology_Paper_2.pdf') print(f'Total pages: {len(reader.pages)}') for i, page in enumerate(reader.pages): print(f'=== PAGE {i+1} ===') print(page.extract_text()) print() "
You are a medical expert answering pathology exam questions from Harsh Mohan's textbook (Pathology Papa 2) for a professional/postgraduate exam. Use the medical library database (query_library_db) extensively to find detailed answers. Search for each topic and return comprehensive, exam-ready answers. **TOPICS TO COVER (Part 1: Blood Vessels, Heart, Respiratory System):** BLOOD VESSELS & LYMPHATICS: 1. Atherosclerotic Plaque - risk factors, morphology 2. Aneurysm - types, causes, Abdominal Aortic Aneurysm - gross features 3. Atherosclerosis - complications; risk factors; pathogenesis; gross; microscopy HEART: 1. Acute Myocardial Infarction - complications; laboratory diagnosis; define infarct, enzymes used in diagnosis, gross and microscopic features as per age of infarct; pathogenesis; morphological changes 2. Hypertensive Heart Disease - morphology 3. Extracardiac Lesions in Rheumatic Heart Disease 4. Rheumatic vs Bacterial Endocarditis - differentiate 5. Rheumatic Heart Disease - etiopathogenesis, extracardiac lesions 6. Causes of Vegetations in Heart, Subacute Bacterial Endocarditis 7. Ischemic Heart Disease - classify; MI gross, microscopy RESPIRATORY SYSTEM: 1. Lung abscess - etiology and morphology; clinical features 2. Lung Carcinoma - histologic classification, clinical presentations, Small Cell Carcinoma morphology 3. Pathogenesis of Emphysema; gross, microscopic features 4. Bronchiectasis - morphology, complications, gross, microscopic features 5. Lobar Pneumonia - stages, microscopy, gross of each stage; etiopathogenesis, complications 6. Lung Tumors - WHO classification, etiopathogenesis, morphology INSTRUCTIONS: - Use query_library_db with paragraphs_fts and headings_fts to find relevant sections - Read the file blocks using read_file to get detailed content - Use SQL like: SELECT book_title, section_heading, '/textbooks/' || block_file_path AS file_path, line_start, line_end, snippet(paragraphs_fts, 0, '>>>', '<<<', '...', 30) as snippet FROM paragraphs_fts WHERE paragraphs_fts MATCH 'atherosclerosis' ORDER BY rank LIMIT 5 - For headings: SELECT title, book_title, '/textbooks/' || block_file_path AS file_path, line_number, para_line_ranges, para_count FROM headings_fts WHERE headings_fts MATCH 'atherosclerosis' ORDER BY rank LIMIT 5 - After finding the file_path and line numbers, read the actual content with read_file(file_path=..., offset=line_number-1, limit=100) - Provide complete, structured answers with headings for each topic - Format answers as: **TOPIC NAME** followed by detailed bullet points or numbered lists - Return ALL answers in a single well-formatted response covering all topics above
You are a medical expert answering pathology exam questions from Harsh Mohan's textbook (Pathology Paper 2) for a professional/postgraduate exam. Use the medical library database (query_library_db) extensively to find detailed answers. Search for each topic and return comprehensive, exam-ready answers. **TOPICS TO COVER (Part 2: GI, Liver, Kidney, Reproductive, Breast, Skin, Endocrine, Musculoskeletal, Nervous System, and Basic Pathology):** GASTROINTESTINAL TRACT: 1. Gastritis - classification; Acute Gastritis etiologic agents 2. Gastric Carcinoma - morphology; gross, microscopic appearance; etiopathogenesis 3. H. Pylori Gastritis 4. Ulcerative Lesions of Small and Large Intestine 5. Chronic Peptic Ulcer - risk factors, pathogenesis 6. Difference between Ulcerative Colitis and Crohn's Disease 7. Typhoid and Tubercular Ulcers of Intestine - differentiating features 8. Benign vs Malignant Gastric Ulcer - differentiate 9. Role of H. Pylori in Peptic Ulcer 10. Ulcerative Colitis - gross, microscopic features 11. Carcinoma Rectum; Carcinoma Colon - etiology, gross, microscopic findings, spread LIVER, BILIARY TRACT AND EXOCRINE PANCREAS: 1. Alcoholic Liver Disease - morphological lesions; pathogenesis, morphology, histology, complications 2. Acute Viral Hepatitis - morphologic features 3. LFT differences in Hemolytic, Hepatocellular, Obstructive Jaundice (tabulate) 4. Primary Carcinoma of Liver - pathogenesis, morphological features 5. Obstructive Jaundice - laboratory findings 6. Fatty Liver - etiopathogenesis 7. Serologic Markers for Hepatitis B Viral Hepatitis in Acute Infection 8. Amoebic Liver Abscess - clinical presentation, gross, microscopic features 9. Jaundice - define/classify/causes; Obstructive Jaundice - laboratory diagnosis 10. Cirrhosis - define, classify; Post Necrotic Cirrhosis - etiopathogenesis, morphology KIDNEY AND LOWER URINARY TRACT: 1. Renal Cell Carcinoma - gross and microscopic features 2. Glomerular Diseases classification; Membranous Glomerulopathy morphology 3. Chronic Pyelonephritis - gross, microscopic appearance 4. Rapidly Progressive Glomerulonephritis - classification, pathogenesis 5. Nephrotic Syndrome - features 6. Post-Streptococcal Glomerulonephritis - etiology, gross, microscopic features; etiopathogenesis, clinical course 7. Acute Proliferative Glomerulonephritis etiopathogenesis, morphology, clinical course MALE & FEMALE REPRODUCTIVE SYSTEM: 1. Teratoma of Testis - gross, microscopic features; define, classify, extragonadal sites 2. Seminoma - gross, microscopic features; classical seminoma morphology, modes of spread 3. Testicular Tumors - classify; Testicular Germ Cell Tumors 4. Fibroid Uterus - gross, microscopic, complications 5. Germ Cell Tumors of Ovary - classify; Dysgerminoma - gross, microscopic findings BREAST: 1. Fibroadenoma Breast - gross and microscopic features 2. Prognostic, Predictive factors in Carcinoma Breast 3. Classify Breast Tumours 4. Breast Carcinoma - classify, grading, staging, prognostic factors; risk factors; Invasive Ductal Carcinoma SKIN: 1. Squamous Carcinoma Skin - pathogenesis, morphology 2. Melanoma of Skin ENDOCRINE SYSTEM: 1. MEN Syndromes 2. Oral GTT - indications, interpretation, method 3. Tumors of Thyroid - classify; Colloid Goitre 4. Glycosylated Hemoglobin 5. Hashimoto's Thyroiditis - gross, morphologic features, complications 6. Diabetes Mellitus - diagnostic criteria; Diabetic Glomerulosclerosis - pathogenesis, morphology; Diabetic Nephropathy; laboratory investigations; etiology, classification MUSCULOSKELETAL SYSTEM: 1. Osteogenic Sarcoma - radiologic, gross, microscopic findings 2. Rheumatoid Arthritis 3. Primary Bone Tumours - classify; Osteosarcoma - morphology, clinical course 4. Osteomyelitis - define; Pyogenic Osteomyelitis - gross, microscopic features, clinical course NERVOUS SYSTEM: 1. CSF examination differences in Pyogenic, Tuberculous, Viral Meningitis (tabulate) 2. Meningioma - gross, microscopic features 3. Acute Leptomeningitis - morphology, CSF findings 4. Pyogenic Meningitis - aetiology, CSF findings in Pyogenic and Tuberculous Meningitis BASIC PATHOLOGY (Cell Injury, Inflammation, Neoplasia, Haematology): 1. Fatty Liver - etiopathogenesis 2. Classify Pigment; Disorders of Melanin Pigmentation 3. Classification of Amyloidosis 4. Differences between Acute and Chronic Inflammation 5. Pulmonary Tuberculosis - morphological features 6. Paraneoplastic Syndromes 7. Utility of Frozen Sections 8. Neoplasia - define, etiopathogenesis 9. Hodgkin's Lymphoma - classify; Mixed Cellularity type; Reed Sternberg Cell and its variants; gross, microscopic features 10. Splenomegaly - list associated diseases; classification 11. Non-Hodgkin's Lymphoma - classify INSTRUCTIONS: - Use query_library_db with paragraphs_fts and headings_fts to find relevant sections - Use SQL like: SELECT book_title, section_heading, '/textbooks/' || block_file_path AS file_path, line_start, line_end, snippet(paragraphs_fts, 0, '>>>', '<<<', '...', 30) as snippet FROM paragraphs_fts WHERE paragraphs_fts MATCH 'topic' ORDER BY rank LIMIT 5 - After finding the file_path and line numbers, read the actual content with read_file(file_path=..., offset=line_number-1, limit=100) - Provide complete, structured answers with headings for each topic - Format answers as: **TOPIC NAME** followed by detailed bullet points or numbered lists - Return ALL answers in a single well-formatted response covering all topics above
Compress this pdf but keep the information same and compress the pdf into less pages for quick revision
cd "/home/daytona/workspace/attachments/da8cb3b7-8325-4332-9995-7fce3d37c23f" && python3 -c " from pypdf import PdfReader reader = PdfReader('f19dbda6-8061-4fdc-84c0-4bfb7b62c758 (1).pdf') print(f'Total pages: {len(reader.pages)}') for i, page in enumerate(reader.pages): print(f'=== PAGE {i+1} ===') print(page.extract_text()) print() "
mkdir -p /home/daytona/workspace/compressed-pathology && python3 << 'PYEOF' from reportlab.lib.pagesizes import A4 from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import mm, cm from reportlab.lib.colors import HexColor, black, white, Color from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable, KeepTogether from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY from reportlab.pdfgen import canvas from reportlab.platypus import BaseDocTemplate, Frame, PageTemplate import re # ─── PAGE SETUP ──────────────────────────────────────────────────────────────── PAGE_W, PAGE_H = A4 MARGIN = 10 * mm # ─── COLORS ──────────────────────────────────────────────────────────────────── C_RED = HexColor('#C0392B') C_BLUE = HexColor('#1A5276') C_GREEN = HexColor('#1E8449') C_ORANGE = HexColor('#D35400') C_PURPLE = HexColor('#6C3483') C_LGRAY = HexColor('#F2F3F4') C_DGRAY = HexColor('#2C3E50') C_YELLOW = HexColor('#F9E79F') C_THEAD = HexColor('#1A5276') C_TROW = HexColor('#EAF2FF') # ─── STYLES ──────────────────────────────────────────────────────────────────── styles = getSampleStyleSheet() def S(name, **kw): return ParagraphStyle(name, **kw) BASE = 7.2 sTitle = S('sTitle', fontName='Helvetica-Bold', fontSize=13, textColor=white, spaceAfter=2, spaceBefore=4, leading=15, alignment=TA_CENTER) sH1 = S('sH1', fontName='Helvetica-Bold', fontSize=9.5, textColor=white, spaceAfter=1, spaceBefore=5, leading=11, leftIndent=0) sH2 = S('sH2', fontName='Helvetica-Bold', fontSize=8.5, textColor=C_BLUE, spaceAfter=1, spaceBefore=4, leading=10, leftIndent=0) sH3 = S('sH3', fontName='Helvetica-Bold', fontSize=7.8, textColor=C_RED, spaceAfter=0, spaceBefore=3, leading=9.5, leftIndent=0) sBody = S('sBody', fontName='Helvetica', fontSize=BASE, textColor=C_DGRAY, spaceAfter=0, spaceBefore=0, leading=9, leftIndent=0) sBullet = S('sBullet', fontName='Helvetica', fontSize=BASE, textColor=C_DGRAY, spaceAfter=0, spaceBefore=0, leading=9, leftIndent=8, bulletIndent=2) sBold = S('sBold', fontName='Helvetica-Bold', fontSize=BASE, textColor=C_DGRAY, spaceAfter=0, spaceBefore=0, leading=9, leftIndent=0) sNote = S('sNote', fontName='Helvetica-Oblique', fontSize=6.5, textColor=HexColor('#7F8C8D'), spaceAfter=1, spaceBefore=0, leading=8) # ─── TABLE STYLE ─────────────────────────────────────────────────────────────── def tStyle(col_widths=None): return TableStyle([ ('BACKGROUND', (0,0), (-1,0), C_THEAD), ('TEXTCOLOR', (0,0), (-1,0), white), ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'), ('FONTSIZE', (0,0), (-1,-1), 6.0), ('LEADING', (0,0), (-1,-1), 7.5), ('ROWBACKGROUNDS',(0,1),(-1,-1), [white, C_TROW]), ('GRID', (0,0), (-1,-1), 0.3, HexColor('#AEB6BF')), ('VALIGN', (0,0), (-1,-1), 'TOP'), ('LEFTPADDING', (0,0), (-1,-1), 2), ('RIGHTPADDING', (0,0), (-1,-1), 2), ('TOPPADDING', (0,0), (-1,-1), 1), ('BOTTOMPADDING',(0,0), (-1,-1), 1), ]) def section_header(text, color=C_BLUE): data = [[Paragraph(f'<font color="white"><b>{text}</b></font>', sH1)]] t = Table(data, colWidths=[PAGE_W - 2*MARGIN]) t.setStyle(TableStyle([ ('BACKGROUND', (0,0), (-1,-1), color), ('LEFTPADDING',(0,0),(-1,-1), 4), ('RIGHTPADDING',(0,0),(-1,-1), 4), ('TOPPADDING',(0,0),(-1,-1), 2), ('BOTTOMPADDING',(0,0),(-1,-1), 2), ])) return t def subsec(text, color=C_BLUE): return Paragraph(f'<font color="#{color.hexval()[2:]}"><b>{text}</b></font>', sH2) def h3(text): return Paragraph(f'<b><font color="#C0392B">{text}</font></b>', sH3) def p(text): # Convert markdown bold **text** to <b>text</b> text = re.sub(r'\*\*(.*?)\*\*', r'<b>\1</b>', text) text = re.sub(r'\*(.*?)\*', r'<i>\1</i>', text) return Paragraph(text, sBody) def b(text): text = re.sub(r'\*\*(.*?)\*\*', r'<b>\1</b>', text) text = re.sub(r'\*(.*?)\*', r'<i>\1</i>', text) return Paragraph(f'• {text}', sBullet) def sp(h=1): return Spacer(1, h*mm) def hr(color=C_BLUE, thickness=0.5): return HRFlowable(width='100%', thickness=thickness, color=color, spaceAfter=1, spaceBefore=1) W = PAGE_W - 2*MARGIN # usable width # ─── TABLES ──────────────────────────────────────────────────────────────────── def tbl(headers, rows, col_ratios=None): if col_ratios: total = sum(col_ratios) cw = [W * r/total for r in col_ratios] else: cw = [W/len(headers)] * len(headers) data = [[Paragraph(f'<b>{h}</b>', S('th', fontName='Helvetica-Bold', fontSize=6, textColor=white, leading=7.5)) for h in headers]] for row in rows: data.append([Paragraph(re.sub(r'\*\*(.*?)\*\*', r'<b>\1</b>', str(c)), S('td', fontName='Helvetica', fontSize=6, textColor=C_DGRAY, leading=7.5)) for c in row]) t = Table(data, colWidths=cw, repeatRows=1) t.setStyle(tStyle()) return t # ══════════════════════════════════════════════════════════════════════════════ # BUILD STORY # ══════════════════════════════════════════════════════════════════════════════ story = [] # ── TITLE BANNER ────────────────────────────────────────────────────────────── title_data = [[Paragraph('<font color="white"><b>PATHOLOGY PAPER II — QUICK REVISION GUIDE</b></font><br/><font color="#F9E79F" size="8">Blood Vessels • Heart • Respiratory System | Based on Harsh Mohan / Robbins Pathology</font>', S('tt', fontName='Helvetica-Bold', fontSize=12, textColor=white, leading=16, alignment=TA_CENTER))]] title_tbl = Table(title_data, colWidths=[W]) title_tbl.setStyle(TableStyle([ ('BACKGROUND', (0,0),(-1,-1), HexColor('#1A252F')), ('LEFTPADDING',(0,0),(-1,-1),6),('RIGHTPADDING',(0,0),(-1,-1),6), ('TOPPADDING',(0,0),(-1,-1),5),('BOTTOMPADDING',(0,0),(-1,-1),5), ('ROUNDEDCORNERS', (0,0),(-1,-1), 3), ])) story += [title_tbl, sp(2)] # ══════════════════════════════════════════════════════════════════════════════ # SECTION 1 — BLOOD VESSELS # ══════════════════════════════════════════════════════════════════════════════ story += [section_header('SECTION 1: BLOOD VESSELS & LYMPHATICS', C_RED), sp(1)] # 1A. Atherosclerosis story += [subsec('1. ATHEROSCLEROSIS', C_RED), sp(0.5)] story += [h3('Definition'), p('Chronic inflammatory response of arterial wall to endothelial injury ("response-to-injury" hypothesis). Underlies CAD, cerebrovascular disease, peripheral vascular disease.'), sp(0.5)] story += [h3('Risk Factors')] story += [tbl(['NONMODIFIABLE','MODIFIABLE (MAJOR)','MINOR/ADDITIONAL'], [['Genetics/family Hx, Age, Male sex, FH (familial hypercholesterolemia)', '↑LDL/↓HDL, Hypertension, Cigarette smoking, Diabetes mellitus', '↑CRP, Homocysteinemia, Metabolic syndrome, Lipoprotein(a), Obesity, Inactivity']], [1,1,1]), sp(0.5)] story += [p('Key numbers: 2 RF → 4× MI risk | 3 RF → 7× | HTN → 60% ↑IHD | DM → doubles MI risk | Smoking → doubles IHD death'), sp(0.5)] story += [h3('Pathogenesis (Response-to-Injury)')] steps = [ '**Endothelial injury** (turbulent flow, hypercholesterolaemia, smoking, TNF) → ↑permeability, leukocyte adhesion', '**Lipid accumulation** → LDL enters intima → oxidised → taken up by macrophages via scavenger Rs → **foam cells**', '**NLRP3 inflammasome** activation by cholesterol crystals → IL-1β → recruit monocytes/T cells', '**Monocyte adhesion** → intima → macrophages → foam cells → **fatty streaks**', 'T cells (IFN-γ) activate macrophages + SMCs', '**SMC proliferation** (PDGF, FGF, TGF-α) → migrate to intima → collagen → **fibrofatty atheroma**', '**Calcification** of ECM + necrotic debris (late)' ] for s in steps: story.append(b(s)) story.append(sp(0.5)) story += [h3('Gross Morphology')] story += [p('**Fatty streaks**: flat yellow macules/streaks; foam cells; earliest lesion (infants → adolescents)')] story += [p('**Atherosclerotic plaque**: white-yellow, raised, eccentric; 0.3–1.5 cm; distribution: infrarenal aorta > coronaries > popliteal > ICA')] story += [tbl(['COMPONENT','DETAIL'], [['Fibrous cap','SMCs + dense collagen; thin cap = vulnerable plaque'], ['Necrotic core','Lipid, foam cells, necrotic debris, fibrin; cholesterol clefts'], ['Shoulder region','Macrophages, T cells, SMCs — site of rupture'], ['Stable plaque','Thick cap, small lipid core, minimal inflammation'], ['Vulnerable plaque','Thin cap, large lipid core, many macrophages/T cells']], [1,2]), sp(0.5)] story += [h3('Complications')] comps = ['Stenosis: critical ≥70% (stable angina); ≥90% (rest symptoms)', '**Plaque rupture/erosion** → thrombosis → ACS/MI', 'Intraplaque hemorrhage → rapid expansion', 'Atheroembolism → microemboli', 'Aneurysm (SMC loss → wall weakening)', 'MI (coronary), Stroke (carotid), Gangrene (PVD)'] for c in comps: story.append(b(c)) story.append(sp(1)) # 1B. Aneurysm story += [subsec('2. ANEURYSM', C_RED)] story += [tbl(['TYPE BY WALL','DESCRIPTION','EXAMPLE'], [['True','All 3 layers (intima-media-adventitia)','Atherosclerotic, congenital, ventricular post-MI'], ['False (pseudoaneurysm)','Wall defect → hematoma communicates with lumen','Ventricular rupture contained by pericardium'], ['Dissection','Blood enters wall, splits layers','Aortic dissection']], [1,2,2]), sp(0.5)] story += [tbl(['SHAPE','DESCRIPTION'], [['Saccular','Discrete outpouching; often thrombosed'], ['Fusiform','Circumferential dilation; aortic arch, abdominal aorta, iliac'], ['Mycotic','From septic embolus/infection; rapid growth/rupture']], [1,3]), sp(0.5)] story += [h3('Pathogenesis: ECM imbalance')] story += [b('↑ECM degradation: macrophage MMPs (atherosclerotic inflammation)')] story += [b('↓ECM synthesis: Marfan (defective fibrillin → ↑TGF-β → elastic tissue loss)')] story += [b('SMC loss: atherosclerosis → inner media ischemia; HTN → vasa vasorum narrowing → cystic medial degeneration')] story += [b('Causes: Atherosclerosis + Smoking (abdominal AAA) | HTN (ascending) | Syphilis (ascending thoracic)'), sp(0.5)] story += [h3('Abdominal Aortic Aneurysm (AAA) — Gross')] facts = ['Location: between renal arteries and aortic bifurcation', 'Saccular or fusiform; up to 15 cm diameter, 25 cm length', 'Thinning/destruction of underlying media', 'Lumen: bland laminated mural thrombus', '≤4 cm: almost never ruptures | >5.5 cm: HIGH RISK → surgical repair', 'Complications: branch vessel occlusion, embolism, vertebral erosion, pulsatile mass, rupture → fatal hemorrhage'] for f in facts: story.append(b(f)) story.append(sp(2)) # ══════════════════════════════════════════════════════════════════════════════ # SECTION 2 — HEART # ══════════════════════════════════════════════════════════════════════════════ story += [section_header('SECTION 2: HEART', HexColor('#922B21')), sp(1)] # IHD story += [subsec('1. ISCHEMIC HEART DISEASE (IHD) — Classification', HexColor('#922B21'))] story += [tbl(['SYNDROME','DESCRIPTION'], [['Stable angina','≥70% stenosis; exertional chest pain; relieved by rest/nitrates'], ['Prinzmetal angina','Coronary spasm at rest; responds to vasodilators'], ['Unstable angina','Plaque disruption + thrombosis; increasing frequency/severity → ACS'], ['MI (STEMI/NSTEMI)','Ischemia → cardiomyocyte death; complete vs partial occlusion'], ['Chronic IHD','Progressive cardiac decompensation post-MI'], ['SCD','Ventricular fibrillation from ischemia; often first presentation']], [1,3]), sp(0.5)] story += [p('Coronary territories: LAD 40–50% (ant. LV, septum, apex) | LCX 15–20% (lat. LV) | RCA 30–40% (RV, post. septum, post. LV)'), sp(1)] # MI story += [subsec('2. MYOCARDIAL INFARCTION (MI)', HexColor('#922B21'))] story += [h3('Pathogenesis')] story += [b('Plaque disruption → subendothelial collagen exposed → platelet adhesion/activation (TXA2, ADP, serotonin) → thrombus → complete occlusion')] story += [b('Subendocardium most vulnerable (last to receive blood; highest pressure); wavefront: subendocardium → transmural over 3–6 h'), sp(0.5)] story += [h3('Gross & Microscopic Changes by Age')] story += [tbl(['TIME','GROSS','MICROSCOPY'], [['0–4 h','None','None / wavy fibers at border'], ['4–12 h','Dark mottling','Coagulative necrosis; edema; hemorrhage'], ['12–24 h','Dark mottling','Pyknotic nuclei; hypereosinophilic myocytes; early neutrophils'], ['1–3 d','Yellow-tan center','Loss of nuclei/striations; ↑neutrophils'], ['3–7 d','Hyperemic border; yellow-tan softening','Disintegrating myofibers; dying neutrophils; early macrophage phagocytosis'], ['7–14 d','Maximally soft; depressed margins','Granulation tissue; new vessels; collagen deposition'], ['2–8 wk','Gray-white scar forming','↑Collagen; ↓cellularity'], ['>2 mo','Complete scar','Dense collagenous scar']], [1,2,3]), sp(0.5)] story += [p('TTC stain: infarcted area = pale (no LDH) | Vital stain = detects infarcts >3 h'), sp(0.5)] story += [h3('Cardiac Enzymes (Lab Diagnosis)')] story += [tbl(['MARKER','ONSET','PEAK','NORMAL','NOTE'], [['Myoglobin','1–3 h','6–12 h','24 h','Earliest; least specific'], ['CK-MB','2–4 h','24–48 h','~72 h','High specificity for myocardium'], ['**Troponin I/T**','2–4 h','48 h','**7–10 days**','Gold standard; allows late diagnosis'], ['LDH','2–3 d','3–6 d','8–14 d','Late marker; historical']], [2,1,1,1,2]), sp(0.5)] story += [h3('Complications of MI')] story += [tbl(['COMPLICATION','TIMING','KEY DETAIL'], [['Arrhythmias','Any; peak 1st hr','~90% pts; VF = most dangerous; most pre-hospital deaths'], ['Contractile dysfunction','Acute','LV failure; cardiogenic shock if ≥40% LV infarcted (~10%)'], ['Free wall rupture','3–7 d (peak)','→ hemopericardium → tamponade; fatal'], ['Septal rupture (VSD)','3–7 d','Most common rupture'], ['Papillary muscle rupture','3–7 d','→ Acute severe MR'], ['Pericarditis','2–3 d','Fibrinohemorrhagic; Dressler syndrome (weeks later)'], ['Mural thrombus','Any time','→ systemic embolism'], ['Ventricular aneurysm','Wks–months','Anteroseptal scar; → thrombi/arrhythmias; does NOT rupture'], ['RV infarction','Acute','RCA occlusion; 1–3%; right HF']], [2,1,3]), sp(1)] # Hypertensive HD story += [subsec('3. HYPERTENSIVE HEART DISEASE', HexColor('#922B21'))] story += [h3('Gross')] story += [b('Concentric LVH (essential feature); heart wt >500 g (normal 320–360 g); LV wall >2 cm (normal 1.2–1.4 cm)')] story += [b('LA dilation (↑LV stiffness → impaired diastolic filling); late → eccentric hypertrophy with dilation'), sp(0.5)] story += [h3('Microscopy')] story += [b('Cardiomyocyte hypertrophy (↑transverse diameter)')] story += [b('"Boxcar nuclei" (prominent nuclear enlargement + hyperchromasia)')] story += [b('Intercellular fibrosis'), sp(0.5)] story += [p('Cor pulmonale: RV hypertrophy + dilation from pulmonary HTN (acute = PE → only dilation; chronic → RV wall = LV wall thickness)'), sp(1)] # RHD story += [subsec('4. RHEUMATIC HEART DISEASE', HexColor('#922B21'))] story += [h3('Etiopathogenesis (Molecular Mimicry)')] story += [b('Gp A Strep (S. pyogenes) pharyngitis → antibodies + CD4+ T cells vs M proteins → cross-react with cardiac antigens')] story += [b('2–3 wk delay; genetic susceptibility (only 0.3–3% develop RF); recurrent attacks → cumulative damage'), sp(0.5)] story += [h3('Jones Criteria (2 major OR 1 major + 2 minor + evidence of Strep infection)')] story += [tbl(['MAJOR (CASES)','MINOR'], [['Carditis (pancarditis)','Fever'], ['Migratory polyarthritis (large joints)','Arthralgias'], ['Subcutaneous nodules (extensor surfaces)','↑ESR/CRP'], ['Erythema marginatum (circinate skin rash)','Prolonged PR interval'], ['Sydenham chorea (involuntary rapid movements)','']], [1,1]), sp(0.5)] story += [h3('Extracardiac Lesions')] story += [tbl(['SITE','LESION'], [['Joints','Migratory polyarthritis; no residual disability'], ['Skin','Erythema marginatum (irregular circinate rash)'], ['Subcutaneous tissue','Firm, painless nodules on extensor surfaces'], ['CNS','Sydenham chorea (weeks–months after; self-resolving)'], ['Pericardium','Fibrinous exudate; resolves without sequelae'], ['Pleura','Serositis, effusion']], [1,2]), sp(0.5)] story += [h3('Cardiac Morphology')] story += [p('**Aschoff bodies** (pathognomonic): lymphocytes + Anitschkow cells ("caterpillar cells" — plump macrophages, wavy chromatin ribbon) + fibrinoid necrosis → found in all 3 layers (pancarditis)')] story += [b('Pericarditis: "bread-and-butter" fibrinous exudate')] story += [b('Myocardium: Aschoff bodies → dilation → functional MR')] story += [b('Valves: Verrucae (1–2 mm) along lines of closure; MacCallum plaques (LA subendocardium)')] story += [p('**Chronic RHD**: Mitral (70%) > Mitral+Aortic (25%); leaflet thickening, commissural fusion, chordae fusion, "fishmouth/buttonhole" stenosis, neovascularisation'), sp(0.5)] story += [p('Consequences: LA dilation → AF → thrombi → embolism; pulm HTN → RVH → RV failure'), sp(1)] # Endocarditis comparison story += [subsec('5. VEGETATIONS ON HEART VALVES — Comparison', HexColor('#922B21'))] story += [tbl(['FEATURE','RHD (VERRUCAE)','SUBACUTE IE','ACUTE IE','NBTE','LIBMAN-SACKS'], [['Cause','Immune (no organisms)','S. viridans, HACEK, Enterococci','S. aureus (most common)','Sterile; malignancy/DIC','SLE/APS immune complexes'], ['Size','1–2 mm; row-like','Larger, irregular','Large, bulky, destructive','1–5 mm; bland','Small–medium'], ['Site','Line of closure','Cusps → chordae','Cusps → myocardium','Line of closure','BOTH surfaces (unique)'], ['Friable','No','Yes','Very yes','No','No'], ['Organisms','Absent','Present (less virulent)','Present (virulent)','Absent','Absent'], ['Destruction','Chronic scarring','Less','Extensive','None','Mild']], [1.5,1.5,1.5,1.5,1.5,1.5]), sp(0.5)] story += [h3('SBE Key Points')] story += [b('Organisms: S. viridans (50–60%), Enterococci, HACEK (oral commensals)')] story += [b('Predisposing: RHD, MVP, degenerative calcific stenosis, bicuspid AV, prosthetic valves')] story += [b('Peripheral stigmata: Janeway lesions (palms/soles; septic emboli) | Osler nodes (fingertip; immune complex) | Roth spots (retina) | Splinter hemorrhages')] story += [b('Treatment: antibiotics ≥6 wk ± surgery; S. viridans cure 98%'), sp(2)] # ══════════════════════════════════════════════════════════════════════════════ # SECTION 3 — RESPIRATORY # ══════════════════════════════════════════════════════════════════════════════ story += [section_header('SECTION 3: RESPIRATORY SYSTEM', C_GREEN), sp(1)] # Lobar pneumonia story += [subsec('1. LOBAR PNEUMONIA', C_GREEN)] story += [p('Etiology: **S. pneumoniae** (most common); H. influenzae, Klebsiella, S. aureus, Legionella, Mycoplasma'), sp(0.5)] story += [h3('Four Stages')] story += [tbl(['STAGE','TIMING','GROSS','MICROSCOPY'], [['1. Congestion','Day 1–2','Heavy, wet, RED','Vascular engorgement; fluid; few PMNs; many bacteria'], ['2. Red hepatization','Day 2–4','RED, firm, liver-like','Neutrophils + RBCs + fibrin fill alveoli'], ['3. Gray hepatization','Day 4–8','GRAY-BROWN, firm','RBC disintegration; fibrinopurulent exudate'], ['4. Resolution','Day 8+','Returning to normal','Macrophage phagocytosis; enzymatic digestion; restoration']], [1.5,1,2,3]), sp(0.5)] story += [h3('Complications')] for c in ['Abscess formation (tissue necrosis)','Empyema (spread to pleura)','Bacteraemia → endocarditis, meningitis, septic arthritis','Fibrous pleuritis → adhesions']: story.append(b(c)) story.append(sp(1)) # Lung abscess story += [subsec('2. LUNG ABSCESS', C_GREEN)] story += [h3('Etiology')] story += [tbl(['CAUSE','DETAIL'], [['Aspiration (most common)','Carious teeth/infected sinuses; during surgery, coma, alcoholism; right side predominant'], ['Post-necrotising pneumonia','S. aureus, Klebsiella, Pseudomonas, type 3 pneumococci'], ['Bronchial obstruction','Tumour/foreign body → impaired drainage → abscess'], ['Septic embolism','Right-sided IE → multiple bilateral abscesses'], ['Haematogenous','Staphylococcal bacteraemia → multiple abscesses'], ['Fungi/TB/parasites','Aspergillus, Cryptococcus, M.tb, E. histolytica, hydatid']], [2,3]), sp(0.5)] story += [p('**Most common organisms**: anaerobes (Prevotella, Fusobacterium, Bacteroides, Peptostreptococcus) — exclusive in 1/3–2/3'), sp(0.5)] story += [h3('Morphology')] story += [b('Gross: few mm → 5–6 cm cavities; air-fluid level on CXR; aspiration → right side posterior; septic emboli → multiple')] story += [b('Microscopy: suppurative focus + mononuclear infiltrate; fibrous scarring (chronic)'), sp(0.5)] story += [h3('Clinical Features')] story += [b('Foul-smelling purulent/sanguineous sputum; spiking fever; haemoptysis')] story += [b('Clubbing, weight loss, anaemia (chronic)')] story += [b('10–15% lung cancer patients → always exclude carcinoma')] story += [b('Complications: brain abscess, secondary amyloidosis | Mortality: ~10%'), sp(1)] # Emphysema story += [subsec('3. EMPHYSEMA', C_GREEN)] story += [p('Definition: **Permanent enlargement** of air spaces distal to terminal bronchioles with **destruction of walls, NO fibrosis**'), sp(0.5)] story += [tbl(['TYPE','LOCATION','ASSOCIATION'], [['Centriacinar (centrilobular)','Central/proximal acinus; upper lobes','**Cigarette smoking** (20× more common)'], ['Panacinar (panlobular)','Entire acinus uniformly; lower lobes','**α1-antitrypsin deficiency**'], ['Distal acinar (paraseptal)','Distal acinus, near pleura','Young adults; spontaneous pneumothorax; bullae'], ['Irregular','Irregular; always scarred','Clinically insignificant']], [1.5,2,2.5]), sp(0.5)] story += [h3('Pathogenesis: Protease-Antiprotease Imbalance')] story += [b('Neutrophils/macrophages/T cells → elastase + MMPs → destroy elastin/ECM')] story += [b('α1-AT deficiency (Pi locus, chr 14; ZZ homozygous) → ↓antiprotease → panacinar emphysema')] story += [b('Oxidative stress (cigarette smoke) → ↑ROS → tissue damage + ↓elastic recoil')] story += [b('Loss of elastic recoil → bronchioles collapse on expiration → airflow obstruction'), sp(0.5)] story += [h3('Morphology')] story += [b('Gross: voluminous pale lungs (panacinar); barrel chest; bullae (distal acinar)')] story += [b('Microscopy: enlarged air spaces; ↓capillaries; no fibrosis; deformed bronchioles')] story += [p('Clinical: "Pink puffer" (barrel chest, dyspnoea, prolonged expiration); ↓FEV1/FVC; pulm HTN → cor pulmonale in 20–30%'), sp(1)] # Bronchiectasis story += [subsec('4. BRONCHIECTASIS', C_GREEN)] story += [p('Definition: **Permanent dilation** of bronchi/bronchioles from destruction of SM + elastic tissue; always secondary to another condition'), sp(0.5)] story += [h3('Etiology')] story += [b('Bronchial obstruction (tumour, FB, mucus impaction)')] story += [b('Cystic fibrosis (most severe diffuse), Immunodeficiency, Primary ciliary dyskinesia')] story += [b('Necrotising pneumonia (S. aureus, Klebsiella); Post-TB')] story += [h3('Morphology')] story += [b('Gross: lower lobes bilaterally; airways dilated 4×; traceable to pleural surface')] story += [b('Microscopy: acute + chronic inflammatory exudate; epithelial desquamation/ulceration; peribronchial fibrosis')] story += [h3('Complications')] story += [b('Brain abscess | Secondary amyloidosis | Cor pulmonale | Empyema | Pulm HTN'), sp(1)] # Lung Carcinoma story += [subsec('5. LUNG CARCINOMA', C_GREEN)] story += [p('Leading cause of cancer death (men + women). Peak: 50s–60s. >50% distant mets at diagnosis. 5-yr survival ~20%.'), sp(0.5)] story += [h3('WHO 2021 Classification')] story += [tbl(['TYPE','FREQ','KEY FEATURES'], [['Adenocarcinoma','Most common','Peripheral; women/nonsmokers; EGFR/KRAS/ALK; TTF-1+; early mets'], ['Squamous Cell Ca','2nd','Central; smoking; keratin pearls; late mets; cavitates'], ['Large Cell Ca','~10%','Diagnosis of exclusion; undifferentiated; poor Px'], ['Small Cell Ca (SCLC)','15–20%','Central; most aggressive; neuroendocrine; TP53+RB; always metastasised; chemo-sensitive but recurs'], ['Carcinoid','~5%','Low-grade NE; typical (>85% 5yr) vs atypical (~56% 5yr)'], ['Large cell NE Ca','Rare','NE markers +; poor Px']], [2,1,4]), sp(0.5)] story += [h3('Etiopathogenesis')] story += [b('Smoking: 90% of cases; 60× risk (2 packs×20yr); women more susceptible; passive smoking also increases risk')] story += [b('Asbestos: 5× alone; 55× combined with smoking')] story += [b('Molecular: chr 3p loss (early) → TP53/KRAS mutations (late)')] story += [b('Adenocarcinoma: EGFR mutations (nonsmoking women) → gefitinib/erlotinib; KRAS ~30%; ALK/ROS1 fusions 4–6%')] story += [b('SCLC: TP53 + RB mutations (~90%); no EGFR/KRAS'), sp(0.5)] story += [h3('SCLC — Detailed Morphology')] story += [b('Gross: pale gray central mass; hilar/mediastinal LN at diagnosis')] story += [b('Micro: small cells (lymphocyte-sized); scant cytoplasm; "salt-and-pepper" chromatin; NO nucleoli; sheets of cells; high mitoses; necrosis')] story += [b('Azzopardi effect: DNA from fragile cells encrusts vessel walls; crush artifact on biopsy')] story += [b('IHC: chromogranin+, synaptophysin+, CD56+; no mucin')] story += [b('Paraneoplastic: ACTH (Cushing), ADH (SIADH), GRP, calcitonin')] story += [b('Surgery NOT curative; responds to chemo/RT but invariably recurs; median survival 1 yr'), sp(0.5)] story += [h3('SCLC vs NSCLC — Key Differences')] story += [tbl(['FEATURE','SCLC','NSCLC'], [['Cytoplasm','Scant','Abundant'], ['Chromatin','Fine (salt & pepper)','Coarse'], ['Nucleoli','Absent','Prominent'], ['NE markers','+ (chromogranin, synaptophysin)','Absent'], ['RB mutations','~90%','~20%'], ['TP53','~90%','~50%'], ['EGFR/KRAS','Absent','Present (adenoCA)'], ['Chemo/RT response','Often complete; always recurs','Incomplete'], ['Checkpoint inhibitors','Unresponsive','Responsive'], ['Surgery','Not curative','Curative (if resectable)'], ['Hormones','ACTH, ADH, GRP, calcitonin','PTHrP (SCC → hypercalcaemia)']], [2,2,2]), sp(0.5)] story += [h3('Clinical Presentations')] story += [tbl(['CATEGORY','MANIFESTATIONS'], [['Local','Cough, haemoptysis, atelectasis/pneumonitis (central), hoarseness (RLN), chest pain'], ['Regional','SVC syndrome | Horner syndrome (Pancoast → ptosis, miosis, enophthalmos, anhidrosis) | Pancoast syndrome (+ ulnar pain + rib erosion)'], ['Distant mets','Brain, liver, bones, adrenals; Virchow\'s node (left supraclavicular)'], ['Paraneoplastic','Hypercalcaemia/PTHrP (SCC) | Cushing/ACTH (SCLC) | SIADH/ADH (SCLC) | Eaton-Lambert syndrome | Clubbing + HPOA | Trousseau syndrome']], [1,3]), sp(1)] # ══════════════════════════════════════════════════════════════════════════════ # QUICK REFERENCE SUMMARY TABLES # ══════════════════════════════════════════════════════════════════════════════ story += [section_header('QUICK REFERENCE SUMMARY TABLES', C_PURPLE), sp(1)] story += [subsec('MI ENZYME TIMELINE', C_PURPLE)] story += [tbl(['MARKER','RISES','PEAKS','NORMALISES','USE'], [['Myoglobin','1–3 h','6–12 h','24 h','Earliest (non-specific)'], ['CK-MB','2–4 h','24–48 h','~72 h','Reinfarction monitoring'], ['Troponin I/T','2–4 h','48 h','7–10 days','Gold standard; late diagnosis'], ['LDH','2–3 d','3–6 d','8–14 d','Historical; late diagnosis']], [2,1,1,1,2]), sp(1)] story += [subsec('VEGETATIONS COMPARISON', C_PURPLE)] story += [tbl(['','RHD','SBE','Acute IE','NBTE','Libman-Sacks'], [['Size','1–2 mm','Large, irregular','Large, bulky','1–5 mm','Small-medium'], ['Site','Line of closure','Cusps → chordae','Cusps → myocardium','Line of closure','BOTH surfaces'], ['Friable','No','Yes','Very friable','No','No'], ['Organisms','Absent','Present','Present','Absent','Absent'], ['Destruction','Chronic scar','Less','Extensive','None','Mild'], ['Inflammation','Yes (fibrinoid)','Yes','Yes','No','Yes (fibrinoid)']], [1.5,1.5,1.5,1.5,1.5,1.5]), sp(1)] story += [subsec('LOBAR PNEUMONIA STAGES', C_PURPLE)] story += [tbl(['STAGE','GROSS','MICROSCOPY','KEY FEATURE'], [['Congestion (D1–2)','Heavy, wet, red','Engorgement; fluid; bacteria','Protein-rich oedema'], ['Red hepatization (D2–4)','Red, firm, liver-like','PMNs + RBCs + fibrin fill alveoli','"Red liver" texture'], ['Gray hepatization (D4–8)','Gray-brown, firm','RBC disintegration; fibrinopurulent exudate','Colour change (no RBCs)'], ['Resolution (D8+)','Soft, normalising','Macrophage phagocytosis; enzymatic digestion','Complete recovery (usually)']], [2,2,3,2]), sp(1)] story += [subsec('EMPHYSEMA TYPES', C_PURPLE)] story += [tbl(['TYPE','LOCATION','CAUSE','CLINICAL'], [['Centriacinar','Proximal acinus; upper lobes','Cigarette smoking','"Pink puffer"; COPD'], ['Panacinar','Entire acinus; lower lobes','α1-AT deficiency','Severe, early onset'], ['Distal acinar','Near pleura/septa','Unknown','Spontaneous pneumothorax; bullae'], ['Irregular','Around scars','Any injury','Usually asymptomatic']], [1.5,2,2,2]), sp(1)] story += [subsec('ATHEROSCLEROSIS — RISK FACTOR MNEMONIC', C_PURPLE)] story += [p('<b>H</b>ypertension | <b>H</b>yperlipidaemia (↑LDL ↓HDL) | <b>S</b>moking | <b>D</b>iabetes | <b>A</b>ge/genetics | <b>O</b>besity/inactivity | <b>C</b>RP (inflammation) | <b>H</b>omocysteinaemia')] story += [p('2 major RF → 4× MI risk | 3 RF (HTN+hyperlipidaemia+smoking) → 7× MI risk'), sp(1)] # Footer note story += [hr(C_DGRAY, 0.3)] story += [Paragraph('<i>Quick Revision PDF | Pathology Paper II | Sources: Harsh Mohan Textbook of Pathology & Robbins Pathologic Basis of Disease | Compressed for exam revision</i>', sNote)] # ══════════════════════════════════════════════════════════════════════════════ # BUILD PDF # ══════════════════════════════════════════════════════════════════════════════ OUTPUT = '/home/daytona/workspace/compressed-pathology/Pathology_Paper2_Quick_Revision.pdf' doc = SimpleDocTemplate( OUTPUT, pagesize=A4, leftMargin=MARGIN, rightMargin=MARGIN, topMargin=MARGIN, bottomMargin=MARGIN + 4*mm, ) doc.build(story) print(f"PDF generated: {OUTPUT}") from pypdf import PdfReader r = PdfReader(OUTPUT) print(f"Total pages: {len(r.pages)}") PYEOF
python3 -c " from pypdf import PdfReader r = PdfReader('/home/daytona/workspace/compressed-pathology/Pathology_Paper2_Quick_Revision.pdf') print(f'Pages: {len(r.pages)}') import os size = os.path.getsize('/home/daytona/workspace/compressed-pathology/Pathology_Paper2_Quick_Revision.pdf') print(f'File size: {size/1024:.1f} KB') # Print first page preview print('--- Page 1 text preview ---') print(r.pages[0].extract_text()[:800]) "
Pathology Paper2 Quick Revision
PDF Document · PDF
| Original | Compressed |
|---|---|
| 39 pages | 4 pages |
| Large font, verbose text | Compact 7.2pt font |
| Paragraph-heavy prose | Structured tables + bullet points |
| Redundant explanations | Key facts only |
| Large spacing | Tight dense layout |
Compress this pdf but keep the information same and compress the pdf into less pages for quick revision
cd "/home/daytona/workspace/attachments/da8cb3b7-8325-4332-9995-7fce3d37c23f" && python3 -c " from pypdf import PdfReader reader = PdfReader('928b0382-636a-4791-893d-47f92b382ba2.pdf') print(f'Total pages: {len(reader.pages)}') for i, page in enumerate(reader.pages): print(f'=== PAGE {i+1} ===') print(page.extract_text()) print() "
mkdir -p /home/daytona/workspace/compressed-pathology && python3 << 'PYEOF' from reportlab.lib.pagesizes import A4 from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import mm from reportlab.lib.colors import HexColor, white from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable from reportlab.lib.enums import TA_LEFT, TA_CENTER import re PAGE_W, PAGE_H = A4 MARGIN = 9 * mm W = PAGE_W - 2*MARGIN # Colors C_NAVY = HexColor('#1A3A5C') C_RED = HexColor('#B03A2E') C_GREEN = HexColor('#1E6B3C') C_PURPLE = HexColor('#5B2C6F') C_ORANGE = HexColor('#CA6F1E') C_TEAL = HexColor('#117A65') C_BROWN = HexColor('#784212') C_GRAY = HexColor('#2C3E50') C_THEAD = HexColor('#1A3A5C') C_TROW = HexColor('#EBF5FB') C_LGRAY = HexColor('#F4F6F7') BASE = 7.0 def S(name, **kw): return ParagraphStyle(name, **kw) sH1 = S('h1', fontName='Helvetica-Bold', fontSize=8.5, textColor=white, spaceAfter=1, spaceBefore=4, leading=10) sH2 = S('h2', fontName='Helvetica-Bold', fontSize=7.8, textColor=C_NAVY, spaceAfter=0, spaceBefore=3, leading=9.5) sH3 = S('h3', fontName='Helvetica-Bold', fontSize=7.2, textColor=C_RED, spaceAfter=0, spaceBefore=2, leading=9) sBody = S('bd', fontName='Helvetica', fontSize=BASE, textColor=C_GRAY, spaceAfter=0, spaceBefore=0, leading=8.5) sBul = S('bu', fontName='Helvetica', fontSize=BASE, textColor=C_GRAY, spaceAfter=0, spaceBefore=0, leading=8.5, leftIndent=7, bulletIndent=1) sNote = S('nt', fontName='Helvetica-Oblique', fontSize=6.2, textColor=HexColor('#7F8C8D'), leading=7.5) def sec_hdr(text, color=C_NAVY): d = [[Paragraph(f'<font color="white"><b>{text}</b></font>', sH1)]] t = Table(d, colWidths=[W]) t.setStyle(TableStyle([ ('BACKGROUND',(0,0),(-1,-1),color), ('LEFTPADDING',(0,0),(-1,-1),4),('RIGHTPADDING',(0,0),(-1,-1),4), ('TOPPADDING',(0,0),(-1,-1),2),('BOTTOMPADDING',(0,0),(-1,-1),2), ])) return t def h2(text, color=C_NAVY): hex_c = color.hexval()[2:] return Paragraph(f'<font color="#{hex_c}"><b>{text}</b></font>', sH2) def h3(text): return Paragraph(f'<b><font color="#B03A2E">{text}</font></b>', sH3) def p(text): text = re.sub(r'\*\*(.*?)\*\*', r'<b>\1</b>', str(text)) text = re.sub(r'\*(.*?)\*', r'<i>\1</i>', text) return Paragraph(text, sBody) def b(text): text = re.sub(r'\*\*(.*?)\*\*', r'<b>\1</b>', str(text)) text = re.sub(r'\*(.*?)\*', r'<i>\1</i>', text) return Paragraph(f'• {text}', sBul) def sp(h=1): return Spacer(1, h*mm) def hr(): return HRFlowable(width='100%', thickness=0.4, color=HexColor('#AEB6BF'), spaceAfter=1, spaceBefore=1) def tbl(headers, rows, ratios=None): if ratios: total = sum(ratios) cw = [W*r/total for r in ratios] else: cw = [W/len(headers)]*len(headers) def cell(txt, bold=False): txt = re.sub(r'\*\*(.*?)\*\*', r'<b>\1</b>', str(txt)) fn = 'Helvetica-Bold' if bold else 'Helvetica' return Paragraph(txt, S('c', fontName=fn, fontSize=6.0, textColor=white if bold else C_GRAY, leading=7.5)) data = [[cell(h, bold=True) for h in headers]] for row in rows: data.append([cell(c) for c in row]) t = Table(data, colWidths=cw, repeatRows=1) t.setStyle(TableStyle([ ('BACKGROUND',(0,0),(-1,0), C_THEAD), ('ROWBACKGROUNDS',(0,1),(-1,-1),[white, C_TROW]), ('GRID',(0,0),(-1,-1),0.3,HexColor('#AEB6BF')), ('VALIGN',(0,0),(-1,-1),'TOP'), ('LEFTPADDING',(0,0),(-1,-1),2),('RIGHTPADDING',(0,0),(-1,-1),2), ('TOPPADDING',(0,0),(-1,-1),1),('BOTTOMPADDING',(0,0),(-1,-1),1), ])) return t # ══════════════════════════════════════════════════════ story = [] # TITLE title_data = [[Paragraph( '<font color="white"><b>PATHOLOGY PAPER I — QUICK REVISION GUIDE</b></font><br/>' '<font color="#F9E79F" size="8">General Pathology • Haematology | Based on Harsh Mohan / Robbins Pathology</font>', S('tt', fontName='Helvetica-Bold', fontSize=11, textColor=white, leading=15, alignment=TA_CENTER))]] tb = Table(title_data, colWidths=[W]) tb.setStyle(TableStyle([ ('BACKGROUND',(0,0),(-1,-1),HexColor('#1A252F')), ('LEFTPADDING',(0,0),(-1,-1),6),('RIGHTPADDING',(0,0),(-1,-1),6), ('TOPPADDING',(0,0),(-1,-1),5),('BOTTOMPADDING',(0,0),(-1,-1),5), ])) story += [tb, sp(2)] # ══════ SECTION 1: CELL INJURY & ADAPTATION ══════════════════ story += [sec_hdr('SECTION 1: CELL INJURY, ADAPTATION & AGING', C_NAVY), sp(0.5)] story += [h2('1. CALCIFICATION — Types & Differences', C_NAVY)] story += [tbl(['FEATURE','DYSTROPHIC','METASTATIC'], [['Tissue','Dead/necrotic','Normal/viable'], ['Serum Ca²⁺','**Normal**','**Elevated** (hypercalcaemia)'], ['Causes','Necrosis, TB, atheroma, dead parasites','Hyperparathyroidism, Vit D toxicity, bone destruction, renal failure'], ['Sites','Local (site of injury)','Widespread: lung, kidney, gastric mucosa, vessels'], ['Gross','Chalky-white, gritty deposits','Similar'], ['Significance','Common, usually harmless','Can impair organ function']], [1.2,2,2.3]), sp(0.5)] story += [h2('2. APOPTOSIS', C_NAVY)] story += [h3('Morphological Changes')] story += [b('Cell shrinkage → chromatin condensation (pyknosis) → nuclear fragmentation (karyorrhexis) → apoptotic bodies → phagocytosis (NO inflammation)'), sp(0.5)] story += [tbl(['PATHWAY','TRIGGER','MECHANISM'], [['**Intrinsic (mitochondrial)**','DNA damage, oxidative stress, growth factor loss','↓Bcl-2/Bcl-XL → cytochrome c → apoptosome + Apaf-1 → caspase-9 → effector caspases 3,6,7'], ['**Extrinsic (death receptor)**','FasL-Fas or TNF-TNFR1','FADD → caspase-8 → effector caspases']], [1.5,1.5,3.5]), sp(0.5)] story += [b('Physiological: embryogenesis, endometrial involution, deletion of auto-reactive T cells, tumour regression')] story += [b('Pathological: DNA damage (radiation, drugs), viral infections (HIV, HBV), ischaemia'), sp(0.5)] story += [h2('3. NECROSIS — Types', C_NAVY)] story += [tbl(['TYPE','PREDOMINANT MECHANISM','GROSS','MICRO','EXAMPLE'], [['**Coagulative**','Protein denaturation > digestion; architecture preserved','Pale, firm, chalky','Ghost cells, anucleate eosinophilic','MI, renal/splenic infarct'], ['**Liquefactive**','Enzymatic digestion > coagulation','Creamy pus or cystic cavity','Debris, neutrophils, liquefied','Brain abscess, cerebral infarct'], ['**Caseous**','TB unique: coagulative + liquefactive','Friable white-yellow "cheesy"','Amorphous granular debris; granuloma (epithelioid + Langhans); NO architecture','Lung/LN in TB'], ['**Fat**','Lipase on adipose (pancreatitis)','Chalky white (saponification)','Shadowy fat cells + basophilic Ca deposits','Acute pancreatitis'], ['**Fibrinoid**','Vascular immune complex + plasma proteins','—','Bright pink homogeneous deposits in vessel walls','Malignant HTN, PAN'], ['**Gangrenous**','Coagulative ± liquefactive','Dry/wet gangrene','—','Limb ischaemia']], [1.5,2,1.5,2.5,2]), sp(0.5)] story += [h2('4. REPERFUSION INJURY', C_NAVY)] story += [b('ROS burst (xanthine oxidase/mitochondria) on reoxygenation → neutrophil influx → Ca²⁺ overload → MPT pore opens → cytochrome c → apoptosis')] story += [b('Result: Larger infarct despite restored flow. Relevant: post-PCI MI, stroke, organ transplantation'), sp(0.5)] story += [h2('5. FREE RADICAL INJURY', C_NAVY)] story += [tbl(['ROS','SOURCE','REMOVAL'], [['Superoxide (O₂•⁻)','Mitochondrial ET chain; NADPH oxidase','SOD → H₂O₂'], ['H₂O₂','Dismutation of O₂•⁻','Catalase → H₂O + O₂; Glutathione peroxidase'], ['OH• (hydroxyl)','Fenton reaction (Fe²⁺ + H₂O₂) — most reactive','Antioxidants: Vit E, C, β-carotene']], [2,3,2.5]), sp(0.5)] story += [b('Cell injury mechanisms: Lipid peroxidation (membrane destruction) | Protein oxidation | DNA damage (strand breaks, base modifications → cancer, ageing)'), sp(0.5)] story += [h2('6. CELLULAR ADAPTATIONS', C_NAVY)] story += [tbl(['ADAPTATION','DEFINITION','EXAMPLES'], [['Hypertrophy','↑ cell SIZE (no division)','Cardiac HTN, skeletal muscle (exercise), pregnant uterus'], ['Hyperplasia','↑ cell NUMBER (mitosis)','Endometrial (oestrogen), BPH, compensatory liver, thyroid (iodine deficiency)'], ['Atrophy','↓ cell SIZE (± ↓ number by apoptosis)','Disuse, denervation, ischaemia, malnutrition, endocrine loss'], ['Metaplasia','One adult cell type → another (reversible)','Squamous: bronchus (smokers), Barrett: columnar in oesophagus (GERD)']], [1.5,2,3]), sp(0.5)] story += [p('**Brown atrophy**: shrunken heart in elderly/cachexia; lipofuscin granules at nuclear poles; tortuous coronary arteries'), sp(0.5)] story += [h2('7. ENDOGENOUS PIGMENTS', C_NAVY)] story += [tbl(['PIGMENT','ORIGIN','COLOR','SIGNIFICANCE'], [['Hemosiderin','Hb degradation (Fe-containing)','Golden-brown','Bruising; systemic: haemosiderosis/haemochromatosis'], ['Bilirubin','Hb degradation (Fe-free)','Yellow-green','Jaundice (pre-hepatic/hepatic/post-hepatic)'], ['Melanin','Tyrosine → tyrosinase in melanocytes','Brown-black','UV protection; excess: Addison\'s disease'], ['Lipofuscin','"Wear-and-tear"; lipid peroxidation','Yellow-brown','Brown atrophy; marker oxidative damage'], ['Haematin (haemozoin)','Plasmodium digests Hb','Dark brown-black','Malaria: slate-grey brain, black spleen']], [1.5,2,1.5,2.5]), sp(0.5)] story += [p('**Stains**: Hemosiderin = Prussian blue (Perls\'). Haemochromatosis: liver cirrhosis + pancreatic fibrosis (bronze diabetes) + cardiomyopathy + hypogonadism'), sp(0.5)] story += [h2('8. FATTY LIVER — Etiopathogenesis & Morphology', C_NAVY)] story += [b('Causes: Alcohol (most common), obesity, DM Type 2, protein malnutrition, hepatotoxins (CCl4)')] story += [b('Mechanisms: ↑FFA delivery | ↓β-oxidation (alcohol: NADH excess) | ↑esterification | ↓apoprotein synthesis → ↓VLDL export')] story += [b('Gross: Enlarged (3–6 kg), pale yellow, greasy, soft')] story += [b('Micro: Macrovesicular (alcoholic/NASH — large vacuole, peripheral nucleus) or Microvesicular (acute fatty liver pregnancy, Reye syndrome)')] story += [b('Stain: Oil Red O on frozen sections'), sp(1)] # ══════ SECTION 2: IMMUNOPATHOLOGY & AMYLOIDOSIS ══════════════════ story += [sec_hdr('SECTION 2: IMMUNOPATHOLOGY & AMYLOIDOSIS', C_PURPLE), sp(0.5)] story += [h2('1. HYPERSENSITIVITY REACTIONS — Gell & Coombs', C_PURPLE)] story += [tbl(['TYPE','NAME','MECHANISM','EXAMPLES'], [['I','Immediate/Anaphylactic','IgE-mediated mast cell degranulation','Anaphylaxis, asthma, allergic rhinitis, urticaria, food allergy'], ['II','Cytotoxic/Ab-dependent','IgG/IgM vs cell surface → complement/ADCC','Haemolytic anaemia, Goodpasture, Myasthenia gravis, ABO incompatibility'], ['III','Immune complex','Ag-Ab complexes → complement → neutrophil recruitment','SLE, serum sickness, post-strep GN, Arthus reaction'], ['IV','Delayed/Cell-mediated','T cell-mediated; NO antibody','TB, contact dermatitis, graft rejection, MS']], [0.5,1.5,2.5,3]), sp(0.5)] story += [h3('Type I — Detailed Pathogenesis')] story += [b('Sensitisation: Allergen → Th2 → IL-4/IL-5 → IgE class switch → IgE binds FcεRI on mast cells')] story += [b('Re-exposure: Allergen cross-links IgE → mast cell degranulation')] story += [b('Pre-formed mediators (minutes): Histamine, heparin, eosinophil/neutrophil chemotactic factors')] story += [b('Newly synthesised (2–24 h): LTC4/D4/E4 (potent bronchoconstrictors > histamine), PGD2, PAF, IL-4, IL-5, TNF')] story += [b('Anaphylaxis: Massive degranulation → vasodilatory shock + bronchospasm + laryngeal oedema → treat with EPINEPHRINE'), sp(0.5)] story += [h2('2. AMYLOID', C_PURPLE)] story += [p('Definition: Pathological extracellular deposits of fibrillar proteins with **β-pleated sheet configuration**; resistance to proteolysis')] story += [tbl(['TYPE','PRECURSOR','SETTING'], [['AL (amyloid light chain)','Ig light chains (λ>κ)','Primary amyloidosis, multiple myeloma'], ['AA (amyloid-associated)','Serum amyloid A (SAA)','Secondary/reactive (RA, TB, Crohn\'s)'], ['Aβ','APP (amyloid precursor protein)','Alzheimer disease'], ['ATTR','Transthyretin (TTR)','Familial neuropathy; senile systemic amyloidosis'], ['Aβ₂M','β-2 microglobulin','Long-term haemodialysis'], ['AIAPP','Islet amyloid polypeptide','Type 2 diabetes (pancreatic islets)']], [1,2,3.5]), sp(0.5)] story += [h3('Special Stains')] story += [b('**Congo red**: salmon-pink/orange (light); **apple-green birefringence under polarised light** = PATHOGNOMONIC')] story += [b('PAS positive | Metachromatic (crystal violet) | Thioflavin T/S (fluorescence) | EM: 7.5–10 nm non-branching fibrils'), sp(0.5)] story += [h3('Spleen Amyloid')] story += [b('**Sago spleen**: Early — amyloid in Malpighian corpuscles (white pulp); discrete translucent grey sago-grain nodules')] story += [b('**Lardaceous spleen**: Late — amyloid in red pulp; markedly enlarged, firm, waxy, lard-like'), sp(0.5)] story += [h2('3. AUTOIMMUNITY — Mechanisms', C_PURPLE)] story += [b('Failure of central tolerance (AIRE gene defect → self-reactive T/B cells escape thymus/BM deletion)')] story += [b('Failure of peripheral tolerance (defective anergy, ↓Tregs)')] story += [b('Molecular mimicry (Strep M protein ↔ cardiac myosin in RHD)')] story += [b('Bystander activation, polyclonal B-cell activation (EBV, LPS)')] story += [b('Exposure of sequestered antigens (lens, sperm, myelin after trauma)'), sp(0.5)] story += [h2('4. AIDS', C_PURPLE)] story += [h3('Virology')] story += [b('HIV-1 (worldwide); HIV-2 (W. Africa). Retrovirus. gp120 (CD4 + CCR5/CXCR4), gp41 (fusion)')] story += [h3('Natural History')] story += [tbl(['PHASE','TIMING','FEATURES'], [['Acute HIV syndrome','2–4 wks post-exposure','Flu-like; high viraemia; CD4 drops transiently; seroconversion'], ['Chronic latent','Months–10 yrs','Asymptomatic/PGL; CD4 gradually 500→200; ongoing viral replication in LN'], ['AIDS','CD4 <200 or AIDS-defining illness','OIs (PCP, CMV, Cryptococcus, Toxoplasma); KS, NHL; wasting; dementia']], [2,2,4]), sp(0.5)] story += [h3('Diagnosis')] story += [tbl(['TEST','USE'], [['ELISA (4th gen: p24 Ag + Ab)','Screening (sensitivity >99.5%)'], ['Western blot','Confirmatory'], ['HIV RNA PCR (viral load)','Monitor treatment; neonatal diagnosis'], ['CD4 count','Stage disease: <200 = AIDS; <50 = severe']], [1.5,4]), sp(0.5)] story += [h3('Neoplasms in HIV/AIDS')] story += [b('Kaposi sarcoma (HHV-8; most common AIDS-defining cancer); Non-Hodgkin lymphoma (EBV; Burkitt, large B-cell); CNS lymphoma (EBV — pathognomonic of AIDS); Cervical/anal carcinoma (HPV); Hodgkin lymphoma (mixed cellularity)'), sp(1)] # ══════ SECTION 3: HAEMODYNAMICS ══════════════════ story += [sec_hdr('SECTION 3: DERANGEMENTS OF HAEMOSTASIS & HAEMODYNAMICS', C_TEAL), sp(0.5)] story += [h2('1. INFARCT', C_TEAL)] story += [tbl(['TYPE','CAUSE','GROSS','EXAMPLES'], [['**White (pale/anaemic)**','Arterial occlusion in solid organs; end-arteries','Wedge-shaped, pale, firm; coagulative necrosis','MI, renal infarct, splenic infarct'], ['**Red (haemorrhagic)**','Venous occlusion; dual blood supply; reperfusion; loose tissue','Wedge-shaped, red/haemorrhagic','Pulmonary infarct, intestinal infarct, brain infarct (reperfused), testicular torsion']], [1.5,2,2,2]), sp(0.5)] story += [h2('2. OEDEMA & TRANSUDATE vs EXUDATE', C_TEAL)] story += [b('Causes: ↑hydrostatic (HF, venous obstruction) | ↓oncotic (nephrotic, cirrhosis, malnutrition) | lymphatic obstruction (filariasis) | Na/H₂O retention | ↑vascular permeability (inflammation)')] story += [tbl(['FEATURE','TRANSUDATE','EXUDATE'], [['Protein','>3 g/dL','<3 g/dL'],['Sp. gravity','<1.012','>1.020'], ['LDH','Low','High'],['Appearance','Clear, watery','Turbid, cloudy'], ['Cause','Non-inflammatory (hydrostatic/oncotic)','Inflammatory (infection, tumour)'], ['Examples','CCF, cirrhosis, nephrotic syndrome','Pneumonia, TB pleuritis, peritonitis']], [2,2,3]), sp(0.5)] story += [h2('3. VIRCHOW\'S TRIAD + THROMBUS', C_TEAL)] story += [b('**Endothelial injury** (most important): exposes collagen + TF; trauma, HTN, atherosclerosis')] story += [b('**Stasis/turbulence**: AF, venous stasis, aneurysms; disrupts laminar flow')] story += [b('**Hypercoagulability**: Primary (Factor V Leiden, prothrombin mutation, AT-III/protein C/S deficiency); Secondary (malignancy, pregnancy, OCP, APS, smoking)')] story += [p('**Thrombus Gross**: Lines of Zahn (alternating pale platelet/fibrin + dark RBC layers) = ANTEMORTEM (vs post-mortem = homogeneous). **Fate**: Propagation → Embolisation → Dissolution → Organisation/recanalisation'), sp(0.5)] story += [h2('4. PULMONARY THROMBOEMBOLISM', C_TEAL)] story += [b('Source: 95% DVT (femoral, popliteal, iliac veins)')] story += [tbl(['SIZE','EFFECT'], [['Massive (>60% blocked)','Sudden death; acute cor pulmonale; cardiovascular collapse'], ['Moderate (subsegmental)','Pulmonary infarction (red/haemorrhagic, wedge-shaped, pleural surface)'], ['Small/microemboli','Asymptomatic; pulmonary HTN if recurrent']], [2,5]), sp(0.5)] story += [h2('5. RIGHT HEART FAILURE — Liver & Spleen', C_TEAL)] story += [b('**Nutmeg liver**: Enlarged, tense, dark-red; centrilobular congestion (dark red) + peripheral fatty change (pale) = mottled nutmeg pattern')] story += [b('Micro: Centrilobular (zone 3) sinusoidal dilation + RBCs + hepatocyte necrosis; chronic → cardiac cirrhosis')] story += [b('**Congestive splenomegaly**: Enlarged (~500g); dilated sinusoids; Gamna-Gandy bodies (haemosiderin + Ca deposits from old haemorrhage; visible on MRI)'), sp(0.5)] story += [h2('6. EMBOLISM — Types', C_TEAL)] story += [tbl(['TYPE','SOURCE','EFFECTS'], [['Thromboembolism (99%)','DVT (most common)','PTE; arterial emboli → MI, stroke, limb ischaemia'], ['Fat embolism','Long bone fractures; liposuction','Fat embolism syndrome: dyspnoea, petechiae, neuro signs (24–72h post)'], ['Air/gas embolism','IV injection, diving (caisson disease)','>100 mL air → death; "mill-wheel" murmur; treat: left lateral Trendelenburg'], ['Amniotic fluid','Obstetric emergency','DIC, respiratory failure'], ['Septic embolism','IE vegetations','Abscesses at landing sites'], ['Atheromatous','Plaque rupture','Blue-toe syndrome; cholesterol crystal emboli']], [1.5,2,4]), sp(1)] # ══════ SECTION 4: INFLAMMATION & HEALING ══════════════════ story += [sec_hdr('SECTION 4: INFLAMMATION & HEALING', C_GREEN), sp(0.5)] story += [h2('1. ACUTE INFLAMMATION', C_GREEN)] story += [p('Definition: Immediate early response; exudation of fluid + plasma proteins + emigration of neutrophils')] story += [h3('Vascular Events')] story += [b('Vasoconstriction (transient) → vasodilation → ↑permeability → protein-rich exudate → stasis')] story += [b('Permeability mechanisms: Endothelial contraction (histamine, bradykinin; venules); Direct injury; Leukocyte-mediated; Transcytosis (VEGF)'), sp(0.5)] story += [h3('Cellular Events')] story += [tbl(['STEP','MOLECULE','DETAIL'], [['Margination','—','Leukocytes move to periphery (stasis)'], ['Rolling','Selectins','P-selectin (EC) + PSGL-1 (leukocyte); L-selectin; E-selectin'], ['Adhesion','Integrins','LFA-1/MAC-1 (leukocyte) + ICAM-1 (EC); upregulated by TNF, IL-1'], ['Transmigration','PECAM-1/CD31','Migration through endothelial junctions'], ['Chemotaxis','C5a, LTB4, IL-8, fMLP','Directed migration along gradient'], ['Phagocytosis','FcR, CR3','Opsonisation (IgG, C3b) → phagosome → ROS killing (MPO→HOCl) + oxygen-independent (defensins, lysozyme)']], [1.5,2,4]), sp(0.5)] story += [h3('Chemical Mediators')] story += [tbl(['MEDIATOR','SOURCE','ACTION'], [['Histamine','Mast cells, basophils','Vasodilation, ↑permeability (early)'], ['LTC4/LTD4/LTE4 (SRSA)','Arachidonic acid (lipoxygenase)','Potent bronchoconstriction > histamine; ↑permeability'], ['LTB4','Arachidonic acid','Potent neutrophil chemotaxis'], ['PGE2/PGI2','COX pathway','Vasodilation, fever, pain'], ['C3a, C5a','Complement','Anaphylatoxins (mast cell degranulation); C5a = chemotaxis'], ['C5b-9 (MAC)','Complement','Direct cell lysis'], ['TNF, IL-1','Macrophages','Fever (pyrogens), acute phase reaction, leukocyte adhesion (↑ICAM-1)'], ['IL-8 (CXCL8)','Macrophages, ECs','Potent neutrophil chemotaxis'], ['Bradykinin','Kinin system','Vasodilation, ↑permeability, pain'], ['NO','Endothelium','Vasodilation, anti-platelet']], [2,2,3.5]), sp(0.5)] story += [h3('Types of Acute Inflammation')] story += [b('Serous: thin watery; skin blisters | Fibrinous: fibrin-rich; "bread-and-butter" pericarditis/pleuritis')] story += [b('Suppurative (purulent): neutrophilic; pus; abscess/empyema | Ulcerative: surface necrosis + acute exudate'), sp(0.5)] story += [h2('2. WOUND HEALING', C_GREEN)] story += [h3('Primary vs Secondary Intention')] story += [tbl(['FEATURE','PRIMARY (1° UNION)','SECONDARY (2° UNION)'], [['Wound type','Clean surgical, apposed edges','Large, infected, tissue loss; edges NOT apposed'], ['Day 1–3','Clot + neutrophils; epidermis bridges 24–48h','Same but slower'], ['Day 3–5','Granulation tissue; macrophages replace PMNs','More granulation tissue; myofibroblast contraction begins'], ['Week 1–2','Collagen bridges; adnexal regeneration','Greater scar formation'], ['Month+','Type III → Type I collagen; 70–80% tensile strength (3 mo)','Larger scar; more contracture risk']], [2,3,3]), sp(0.5)] story += [h3('Granulation Tissue')] story += [b('Pink-red, granular, soft; appears Day 3–5')] story += [b('Micro: Proliferating capillary buds (VEGF/bFGF) + fibroblasts (TGF-β) + myofibroblasts (α-SMA) + loose ECM + macrophages'), sp(0.5)] story += [h3('Factors Affecting Healing')] story += [tbl(['LOCAL','SYSTEMIC'], [['Wound size/depth; infection (most important); foreign body; ischaemia; radiation; wound tension', 'Malnutrition (Vit C/protein/zinc deficiency); DM; glucocorticoids; immunosuppression; uraemia; old age; anaemia']], [3,3.5]), sp(0.5)] story += [h3('Complications')] story += [b('Infection | Dehiscence | Keloid (beyond wound margins; dark skin) | Hypertrophic scar (within margins) | Contracture | Marjolin\'s ulcer (SCC in chronic scar/burn)'), sp(0.5)] story += [h2('3. TUBERCULOSIS', C_GREEN)] story += [h3('Pathogenesis of Primary TB')] story += [b('Inhalation → lower upper lobe / upper lower lobe → alveolar macrophages phagocytose → bacteria survive (inhibit phagolysosome fusion)')] story += [b('3–8 wks: T cells + IFN-γ → macrophage activation → epithelioid granuloma + central caseous necrosis (Type IV/DTH)')] story += [b('**Ghon complex** = Ghon focus + lymphangitis + hilar lymphadenopathy')] story += [b('Outcome: 90–95% healing → fibrosis + calcification = **Ranke complex**; 5–10% progressive/miliary (immunocompromised)'), sp(0.5)] story += [h3('Evolution of Tubercle')] story += [b('Exudative → Productive (epithelioid granuloma; Langhans giant cells) → Caseous → Healing (fibrosis/calcification)'), sp(0.5)] story += [h2('4. LEPROSY', C_GREEN)] story += [tbl(['TYPE','IMMUNITY','SKIN LESIONS','BACILLI','LEPROMIN','HISTOLOGY'], [['TT (Tuberculoid)','High CMI','Few (<5), well-defined, anaesthetic','0 (BI=0)','Strongly +','Epithelioid granulomas; no bacilli; Grenz zone'], ['BT–BB–BL','Intermediate','Intermediate','+ to +++','Variable','Intermediate features'], ['LL (Lepromatous)','Absent CMI','Numerous, symmetric; leonine facies','++++ (BI=6)','Negative','Foamy Virchow macrophages (lepra cells) packed with AFB; Grenz zone; NO epithelioid granulomas']], [1.5,1.5,2,1,1,3]), sp(1)] # ══════ SECTION 5: NEOPLASIA ══════════════════ story += [sec_hdr('SECTION 5: NEOPLASIA', C_RED), sp(0.5)] story += [h2('1. PRECANCEROUS LESIONS', C_RED)] story += [tbl(['LESION','SITE','CANCER'], [['Leukoplakia/Erythroplakia (higher risk)','Oral cavity, vulva','Squamous carcinoma'], ['Barrett oesophagus','Lower oesophagus','Adenocarcinoma'], ['Chronic atrophic gastritis/intestinal metaplasia','Stomach','Gastric adenocarcinoma'], ['CIN (cervical intraepithelial neoplasia)','Cervix','Cervical SCC'], ['Villous adenoma/Ulcerative colitis','Colon','Colorectal carcinoma'], ['Cirrhosis','Liver','HCC'], ['Xeroderma pigmentosum','Skin','Melanoma, BCC, SCC'], ['Paget\'s disease of bone','Bone','Osteosarcoma'], ['Solar keratosis/Bowen\'s disease','Skin','SCC']], [3,2,2.5]), sp(0.5)] story += [h2('2. TUMOUR MARKERS', C_RED)] story += [tbl(['MARKER','TUMOUR'], [['PSA','Prostate carcinoma'], ['AFP','HCC; yolk sac tumour'], ['CEA','Colorectal, gastric, pancreatic, breast'], ['β-hCG','Choriocarcinoma; germ cell tumours'], ['CA-125','Ovarian carcinoma'], ['CA 19-9','Pancreatic carcinoma'], ['CA 15-3','Breast carcinoma'], ['Calcitonin','Medullary thyroid carcinoma'], ['Thyroglobulin','Differentiated thyroid carcinoma (post-thyroidectomy)'], ['LDH','Testicular GCT (prognosis)'], ['S-100','Melanoma, neural tumours']], [2,4.5]), sp(0.5)] story += [h2('3. ANAPLASTIC TUMOUR — Morphology', C_RED)] story += [b('Pleomorphism (variation in cell/nuclear size and shape)')] story += [b('Nuclear changes: Hyperchromatism; ↑N:C ratio (may be 1:1); enlarged prominent nucleoli; coarse irregular chromatin')] story += [b('Abnormal/tripolar/multipolar mitoses | Tumour giant cells | Loss of polarity | Neoangiogenesis + desmoplasia'), sp(0.5)] story += [h2('4. ONCOGENIC VIRUSES', C_RED)] story += [tbl(['VIRUS','TYPE','CANCER'], [['HPV 16, 18','DNA (papovavirus)','Cervical SCC; oropharyngeal; anal/vulval/penile'], ['EBV (HHV-4)','DNA (herpesvirus)','Burkitt lymphoma; Hodgkin (mixed cellularity); NPC; CNS lymphoma (AIDS); post-transplant LPD'], ['HBV','DNA (hepadnavirus)','HCC'], ['HCV','RNA (flavivirus)','HCC; B-cell lymphoma'], ['HTLV-1','RNA (retrovirus)','Adult T-cell leukaemia/lymphoma (ATL)'], ['HHV-8 (KSHV)','DNA (herpesvirus)','Kaposi sarcoma; primary effusion lymphoma'], ['H. pylori','Bacterium','Gastric MALToma; gastric adenocarcinoma']], [2,2,4]), sp(0.5)] story += [h2('5. CHEMICAL CARCINOGENESIS', C_RED)] story += [tbl(['STEP','KEY FEATURES','EXAMPLES'], [['Initiation','Irreversible DNA mutation; procarcinogen → ultimate carcinogen (CYP450); cell permanently mutated','Polycyclic hydrocarbons (DMBA, benzo[a]pyrene); alkylating agents; aflatoxin B1 (G→T TP53 codon 249)'], ['Promotion','Reversible; repeated exposure; not mutagenic alone; stimulates proliferation of initiated cell','Phorbol esters (TPA); oestrogen (breast); bile salts (colon); saccharin'], ['Progression','Additional mutations; malignant phenotype (invasion, mets); genomic instability','—']], [1,2,4.5]), sp(0.5)] story += [b('Key carcinogens: PAH (cigarette smoke → lung/skin) | Aromatic amines/β-naphthylamine (→bladder) | Aflatoxin B1 (→HCC) | Vinyl chloride (→hepatic angiosarcoma) | Asbestos (→mesothelioma; 55× risk with smoking) | Nitrosamines (→gastric/oesophageal)'), sp(0.5)] story += [h2('6. PARANEOPLASTIC SYNDROMES', C_RED)] story += [tbl(['SYNDROME','MECHANISM','TUMOUR'], [['Cushing syndrome','Ectopic ACTH','SCLC, carcinoid'], ['SIADH (hyponatraemia)','Ectopic ADH','SCLC'], ['Hypercalcaemia','PTHrP (most common)','SCC lung, breast, renal, myeloma'], ['Polycythaemia','Ectopic erythropoietin','Renal cell Ca, HCC, cerebellar haemangioblastoma'], ['Eaton-Lambert','Anti-VGCC antibodies','SCLC'], ['Trousseau sign','Mucin hypercoagulability','Pancreatic, GI carcinomas'], ['DIC','Procoagulants','APL (M3), adenocarcinomas'], ['Acanthosis nigricans','Growth factors','Gastric, lung, GI']], [2,2.5,3]), sp(1)] # ══════ SECTION 6: GENETICS ══════════════════ story += [sec_hdr('SECTION 6: GENETIC & PAEDIATRIC DISEASES', C_BROWN), sp(0.5)] story += [h2('DOWN SYNDROME (Trisomy 21)', C_BROWN)] story += [b('Karyotype: Trisomy 21 (94%); Robertsonian translocation (5%); Mosaicism (1%). Maternal meiosis I non-disjunction (90%)')] story += [b('Features: ID (IQ 25–50); flat facies; epicanthal folds; simian crease; hypotonia; protruding tongue; small ears')] story += [b('Associations: CHD 40–50% (AV canal defect — most characteristic; VSD; ASD); duodenal atresia; Hirschsprung; ↑ALL/AML (M7); Alzheimer (nearly 100% by age 40); hypothyroidism'), sp(0.5)] story += [h2('KLINEFELTER SYNDROME (47,XXY)', C_BROWN)] story += [b('Most common male hypogonadism. Tall; eunuchoid habitus; small testes (azoospermia → infertility); gynaecomastia; sparse hair; ↑FSH/LH; ↓testosterone; Barr body present')] story += [b('Associations: ↑breast cancer (20×); extragonadal GCTs; SLE'), sp(1)] # ══════ SECTION 7: HAEMATOLOGY ══════════════════ story += [sec_hdr('SECTION 7: HAEMATOLOGY', C_TEAL), sp(0.5)] story += [h2('1. ANAEMIA — Classification', C_TEAL)] story += [tbl(['MORPHOLOGY','MCV','CAUSES'], [['Microcytic hypochromic','<80 fL','IDA (most common), thalassaemia, sideroblastic, ACD (sometimes)'], ['Normocytic normochromic','80–100 fL','Aplastic, haemolytic, acute blood loss, ACD, renal failure'], ['Macrocytic','>100 fL','Megaloblastic (B12/folate); non-megaloblastic (liver disease, hypothyroidism, MDS, alcohol, drugs)']], [2,1.5,5]), sp(0.5)] story += [p('Definitions: Men <13 g/dL | Women <12 g/dL | Pregnant <11 g/dL'), sp(0.5)] story += [h2('2. IRON DEFICIENCY ANAEMIA (IDA)', C_TEAL)] story += [b('Causes: Chronic blood loss (most common: menorrhagia, GI bleed — PU/hookworm); inadequate intake; malabsorption')] story += [tbl(['STAGE','FERRITIN','IRON','TIBC','Hb'], [['Pre-latent (depleted stores)','↓ (EARLIEST)','Normal','Normal','Normal'], ['Latent (transport Fe deficient)','↓','↓','↑','Normal'], ['IDA (functional deficiency)','↓','↓','↑','↓ (microcytic hypochromic)']], [2,1.5,1.5,1.5,2]), sp(0.5)] story += [b('PBS: Microcytosis + hypochromia + anisocytosis + poikilocytosis + pencil (cigar) cells + target cells')] story += [b('Serum ferritin = BEST single test (earliest); Transferrin saturation <16%; ↑sTfR; BM: Perls\' stain negative'), sp(0.5)] story += [h2('3. MEGALOBLASTIC ANAEMIA', C_TEAL)] story += [b('Cause: B12 or folate deficiency → ↓DNA synthesis → nuclear-cytoplasmic asynchrony')] story += [h3('Peripheral Blood Smear')] story += [b('**Macro-ovalocytes** (most characteristic); **Hypersegmented neutrophils** (≥5 lobes in >5% = PATHOGNOMONIC; or any cell ≥6 lobes)')] story += [b('Anisocytosis + poikilocytosis; leucopenia + thrombocytopenia (severe); MCV >100 fL'), sp(0.5)] story += [h3('Bone Marrow')] story += [b('Megaloblasts (14–20 µm; finely stippled immature chromatin + normal haemoglobinised cytoplasm = nuclear-cytoplasmic asynchrony)')] story += [b('Giant metamyelocytes/band forms; hypercellular marrow (ineffective erythropoiesis); giant megakaryocytes'), sp(0.5)] story += [h2('4. SICKLE CELL ANAEMIA', C_TEAL)] story += [b('AR inheritance; HbS = Glu → Val at β-globin position 6 (GAG→GTG); homozygous SS = disease; SA = trait')] story += [b('Deoxy-HbS polymerizes → rigid sickled RBCs → haemolysis + vaso-occlusion')] story += [b('Protective: HbF (inhibits polymerization), low MCHC, short transit time')] story += [h3('PBS Findings')] story += [b('Sickle cells (drepanocytes) + target cells + polychromasia + nucleated RBCs + Howell-Jolly bodies (autosplenectomy) + poikilocytosis/anisocytosis')] story += [h3('Lab Investigations')] story += [b('Hb 6–9 g/dL; sickling test (Na metabisulphite); Hb electrophoresis (HbS, no HbA = diagnostic); ↑reticulocytes; ↑unconjugated bilirubin; ↑LDH'), sp(0.5)] story += [h2('5. HAEMOLYTIC ANAEMIA — Lab Evidence', C_TEAL)] story += [tbl(['LAB FINDING','SIGNIFICANCE'], [['↑Reticulocytes (reticulocytosis)','Most consistent; compensatory'], ['↑Unconjugated bilirubin','Haemoglobin catabolism → jaundice'], ['↓Haptoglobin','Binds free Hb; consumed; most sensitive for intravascular haemolysis'], ['↑LDH','Released from lysed RBCs'], ['Haemoglobinaemia + haemoglobinuria','Intravascular haemolysis (pink plasma; brown/red urine)'], ['↑Urobilinogen in urine','↑bilirubin load'], ['DAT (Coombs)','Positive in immune haemolytic anaemia (AIHA)'], ['BM: erythroid hyperplasia','↑M:E ratio (reversed)']], [2.5,5]), sp(0.5)] story += [h2('6. MACROCYTIC ANAEMIA — Causes', C_TEAL)] story += [tbl(['MEGALOBLASTIC','NON-MEGALOBLASTIC'], [['B12 deficiency (pernicious anaemia, vegetarian diet, malabsorption, gastrectomy, fish tapeworm)','Liver disease; hypothyroidism; alcohol; MDS'], ['Folate deficiency (malnutrition, pregnancy, methotrexate, phenytoin, alcohol)','Aplastic anaemia; reticulocytosis; drugs (hydroxyurea, zidovudine); post-splenectomy']], [3.5,4.5]), sp(0.5)] story += [h2('7. LEUKAEMIA', C_TEAL)] story += [p('Definition: Malignant clonal proliferation of haematopoietic cells; accumulation in BM, blood, organs')] story += [h3('CML — Key Features')] story += [b('WBC often >100×10⁹/L; full myeloid spectrum ("myelocyte peak"); basophilia + eosinophilia; thrombocytosis; NAP score LOW (cf. leukaemoid reaction = HIGH)')] story += [b('BCR-ABL fusion (Philadelphia chromosome t(9;22)) — pathognomonic; detected by FISH/PCR')] story += [b('Clinical: Massive splenomegaly (most prominent); fatigue; hyperuricaemia; blast crisis → acute leukaemia'), sp(0.5)] story += [h3('AML — FAB Classification')] story += [tbl(['FAB','MORPHOLOGY','SPECIAL FEATURE'], [['M0','Minimally differentiated','No granules; MPO+ EM only'], ['M1','Without maturation','>90% blasts; MPO+'], ['M2','With maturation','Blasts + maturation; t(8;21); **Auer rods**'], ['M3 APL','Hypergranular promyelocytes','**Auer rods (faggot cells); t(15;17); DIC; ATRA treatment**'], ['M4','Myelomonocytic','Myeloid + monocytic; inv(16)'], ['M5','Monocytic','Monocytes >80%; gum/skin infiltration'], ['M6','Erythroleukaemia','>50% erythroids; dysplastic erythroid precursors'], ['M7','Megakaryoblastic','Down syndrome; platelet peroxidase EM']], [0.8,2.5,4]), sp(0.5)] story += [p('**Auer rods** = needle-like azurophilic inclusions in blast cytoplasm; PATHOGNOMONIC of AML; MPO+ | **TdT**: ALL+ vs AML−'), sp(0.5)] story += [h3('ALL — FAB Classification')] story += [tbl(['FAB','CELLS','COMMON IN'], [['L1','Small, uniform blasts; scant cytoplasm; inconspicuous nucleoli','Childhood (most common)'], ['L2','Large, heterogeneous; irregular nuclei; prominent nucleoli','Adults'], ['L3','Large, uniform; deeply basophilic cytoplasm with vacuoles','Burkitt type']], [1,3,2.5]), sp(0.5)] story += [b('BM: >20% blasts; PAS coarse block positivity; **TdT+ (key ALL marker)**; CD10 (CALLA), CD19, CD20 (B-ALL); CD3, CD7 (T-ALL)'), sp(0.5)] story += [h2('8. HAEMOPHILIA', C_TEAL)] story += [b('Haemophilia A: Factor VIII deficiency (1:5000 males; X-linked recessive) | Haemophilia B: Factor IX (Christmas disease)')] story += [b('Clinical: Haemarthroses (knee/elbow/ankle); muscle haematomas; severity: severe <1%, moderate 1–5%, mild >5%')] story += [b('Lab: ↑aPTT; normal PT, BT, platelet count; specific factor assay for diagnosis'), sp(0.5)] story += [h2('9. SCREENING TESTS FOR BLEEDING DISORDERS', C_TEAL)] story += [tbl(['TEST','EVALUATES','ABNORMAL IN'], [['Platelet count','Thrombocytopenia','ITP, aplastic anaemia, DIC'], ['Bleeding time','Platelet function + vascular','Thrombocytopenia, Bernard-Soulier, Glanzmann, vWD, aspirin'], ['PT (INR)','Extrinsic + common (VII, X, V, II, fibrinogen)','Warfarin, liver disease, Vit K deficiency, DIC, factor VII deficiency'], ['aPTT','Intrinsic + common (XII, XI, IX, VIII, X, V, II, fibrinogen)','Haemophilia A/B, lupus anticoagulant, DIC'], ['Thrombin time (TT)','Fibrinogen quality/quantity','Dysfibrinogenaemia, DIC, heparin'], ['D-dimer','FDP (fibrin degradation)','DIC, PE (screening)']], [2,2.5,4]), sp(0.5)] story += [h3('Causes of Thrombocytopenia')] story += [b('↓Production: Aplastic, BM infiltration, megaloblastic, MDS, chemotherapy')] story += [b('↑Destruction: ITP (anti-GPIIb/IIIa); HIT (heparin); TTP (ADAMTS13 deficiency); HUS (Shiga toxin E.coli O157:H7); DIC; hypersplenism; SLE/APS'), sp(0.5)] story += [h2('10. BLOOD TRANSFUSION REACTIONS', C_TEAL)] story += [tbl(['REACTION','TIMING','MECHANISM','MANAGEMENT'], [['**Immediate haemolytic** (most dangerous)','During/immediately','ABO incompatibility; IgM → complement → intravascular haemolysis; DIC','STOP transfusion; IV fluids; diuretics; treat DIC'], ['Delayed haemolytic','3–14 days','Anamnestic IgG (Rh, Kidd, Duffy); extravascular; indirect Coombs+','Supportive'], ['**Febrile non-haemolytic** (most common)','During','Anti-HLA antibodies against donor WBCs; cytokines in stored blood','Antipyretics; leukocyte-depleted blood'], ['Allergic/Anaphylaxis','During','IgE vs plasma proteins; IgA-deficient (anaphylaxis)','Antihistamine; epinephrine for anaphylaxis'], ['**TRALI** (leading cause of mortality)','Within 6h','Donor anti-HLA/anti-neutrophil Ab → non-cardiogenic pulmonary oedema','Supportive; no diuretics'], ['GVHD','Days–weeks','Donor T cells attack immunocompromised recipient','Prevent by irradiation of blood products']], [2,1.5,3,2]), sp(0.5)] story += [h2('11. COOMBS TEST', C_TEAL)] story += [tbl(['TEST','DETECTS','PROCEDURE','INDICATIONS'], [['Direct (DAT)','Ab/complement ALREADY bound to patient\'s RBCs (in vivo)','Patient\'s washed RBCs + anti-human globulin → agglutination','AIHA (warm IgG/cold C3); HDN; drug-induced HA; haemolytic transfusion reaction'], ['Indirect (IAT)','Free antibody in patient\'s SERUM','Patient serum + donor RBCs → wash → anti-human globulin','Pre-transfusion crossmatch; Rh antibody screening in pregnancy; irregular antibody detection']], [1.5,2,2.5,3]), sp(0.5)] story += [h2('12. BLOOD DONOR SELECTION', C_TEAL)] story += [tbl(['PARAMETER','CRITERION'], [['Age','18–65 years'],['Weight','≥45 kg'],['Hb','≥12.5 g/dL'], ['BP','Systolic 100–180; Diastolic 60–100 mmHg'], ['Pulse','60–100/min regular'],['Donation interval','≥3 months (12 weeks)'], ['**Permanent deferral**','HIV, HBsAg, HCV+; haemophilia; major organ disease; malignancy; epilepsy/psychosis'], ['**Temporary deferral**','Pregnancy (6 mo); fever (4 wk); tattoo (12 mo); surgery (6–12 mo); malaria (3 yr after Rx); recent vaccination (2–4 wk)']], [2,5]), sp(0.5)] story += [h2('13. UTERINE LEIOMYOMA (FIBROID)', C_TEAL)] story += [b('Most common benign uterine tumour; smooth muscle origin')] story += [b('Sites: Intramural (most common) > subserosal > submucosal > pedunculated > cervical')] story += [b('Gross: Well-circumscribed, firm, whorled white-grey; pseudocapsule; cut surface whorled/trabeculated')] story += [b('Micro: Interlacing bundles of uniform elongated SMCs; blunt-ended nuclei; no pleomorphism; <5 mitoses/10 HPF')] story += [b('Degenerations: Hyaline (most common) > cystic > myxomatous > red/carneous (pregnancy; painful) > calcification')] story += [b('Complications: Menorrhagia → IDA; subfertility; recurrent miscarriage; pressure effects (urinary frequency, constipation, hydronephrosis); malignant transformation (RARE, <0.5%)'), sp(1)] # FOOTER story += [hr()] story += [Paragraph('<i>Quick Revision PDF | Pathology Paper I — General Pathology & Haematology | Sources: Harsh Mohan Textbook of Pathology & Robbins Pathologic Basis of Disease</i>', sNote)] # BUILD OUTPUT = '/home/daytona/workspace/compressed-pathology/Pathology_Paper1_Quick_Revision.pdf' doc = SimpleDocTemplate(OUTPUT, pagesize=A4, leftMargin=MARGIN, rightMargin=MARGIN, topMargin=MARGIN, bottomMargin=MARGIN+3*mm) doc.build(story) from pypdf import PdfReader import os r = PdfReader(OUTPUT) print(f"Pages: {len(r.pages)}") print(f"File size: {os.path.getsize(OUTPUT)/1024:.1f} KB") print(f"Saved: {OUTPUT}") PYEOF
Pathology Paper1 Quick Revision
PDF Document · PDF
| Original | Compressed |
|---|---|
| 54 pages | 6 pages |
| Verbose prose | Dense tables + bullet points |
| Large spacing | Tight 7pt font layout |
| Redundant text | Key facts only |
Generate an Excel file with pathology comparison tables for easy revision