Pattern in inicet for medicine

Searching the Web

INICET 2025 2026 Medicine subject pattern important topics analysis

Searching the Web

INICET medicine questions frequency cardiology nephrology gastroenterology pattern

Reading Web Page

https://www.prepladder.com/neet-pg-study-material/exam-patte…

Here is a detailed breakdown of the INICET Medicine pattern based on 5-year trend analysis:

INICET - Medicine Pattern & High-Yield Analysis

Overall Exam Structure (2026)

ParameterDetails
Total Questions200 MCQs
Duration3 hours (4 sections x 50 Qs x 45 min each)
FormatComputer-Based Test (CBT), twice yearly
Marking+1 correct, -1/3 wrong
Question typesSingle best answer + Multiple correct answers

Medicine's Share in the Exam

  • ~18-25 questions per session (with Dermatology + Venereology = ~26 questions, ~13% weightage)
  • Medicine is consistently the single most tested clinical subject
  • 50-60% of the total paper comes from Medicine, Surgery, OBG, Pharmacology, Pathology, and Biochemistry combined

Top Sub-specialties Tested in Medicine (Ranked by Frequency)

RankSub-specialtyWhat to Focus On
1CardiologyECG interpretation, heart failure management, ACS, arrhythmias, valvular disease, AHA/ESC 2023 guidelines
2EndocrinologyDiabetes (T1 + T2 + complications), thyroid disorders, adrenal disorders, pituitary tumors, PCOS
3NeurologyStroke (ischemic vs hemorrhagic), meningitis, epilepsy, Parkinson's, MS, GBS
4NephrologyCKD staging, AKI, glomerulonephritis patterns, dialysis indications, RTA
5Infectious DiseasesMalaria, TB (RNTCP updates), HIV (opportunistic infections, ART), fever with rash pattern, vaccine schedules
6GastroenterologyCirrhosis complications, IBD, peptic ulcer disease, liver function tests, hepatitis
7RheumatologySLE (ANA, anti-dsDNA), RA, vasculitis, crystal arthropathies
8RespiratoryCOPD, asthma stepwise management, pleural effusion, ILD
9HematologyAnemia workup, coagulation disorders, leukemia overview

Question Type Trends (Key Shift Post-2024)

TypeProportionNotes
Clinical vignettes60-65%Patient scenario asking diagnosis/management - the dominant format
Image-based15-20% (~30-40 Qs in full paper)ECGs, X-rays, CT scans, peripheral blood smears, histology slides
Recall/direct factsDecreasingPure factual questions are being replaced by applied questions
Pharmacology integrationIncreasing"Which drug to use/avoid in this patient with comorbidities?"
Guideline-basedIncreasingAHA, ESC, WHO, RNTCP updated guidelines

High-Yield Specific Topics for Medicine

Cardiology:
  • ECG reading (AF, LBBB, AV blocks, STEMI territory)
  • Heart failure: HFrEF vs HFpEF, drug choices
  • 2023 ESC Guidelines on Cardiovascular Disease in Diabetes
Endocrinology:
  • Diabetic emergencies (DKA vs HHS)
  • Thyroid - interpretation of TSH/T4 in various states
  • MEN syndromes
Neurology:
  • Thrombolysis criteria in stroke
  • Status epilepticus management
  • CSF findings across meningitis types
Nephrology:
  • KDIGO CKD staging
  • Nephrotic vs Nephritic syndrome differentiation
  • Hyponatremia/Hypernatremia correction
Infectious Diseases:
  • HIV CD4 count thresholds for OIs
  • Updated TB treatment regimens
  • Dengue vs malaria clinical differentiation

Preparation Strategy for Medicine

  1. Prioritize Cardiology + Endocrinology + Neurology - these 3 alone cover ~40-50% of Medicine questions
  2. Practice ECGs daily - image-based questions are a reliable scoring area
  3. Read updated guidelines - especially AHA 2023, ESC Diabetes guidelines, RNTCP
  4. Clinical vignettes - solve previous AIIMS PG and INICET papers; pattern-match the case structure
  5. Integrate Pharmacology - for every Medicine condition, know the drug of choice, contraindications, and interactions
  6. Attempt all 4 sections strategically - since each section is timed separately (45 min/50 Qs), time management within sections matters

Bottom line: Medicine in INICET has shifted heavily toward applied clinical reasoning. The days of pure recall are fading - you need to be able to manage a patient on paper, read an ECG, interpret a CXR, and apply the latest guidelines. Cardiology, Endocrinology, and Neurology are your highest-return investments.

Create a high-yield study guide PDF for cardiology in INICET

Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Running Command

mkdir -p /home/daytona/workspace/inicet-cardiology && ls /home/daytona/workspace…

Writing File

~/inicet-cardiology/generate_pdf.py

#!/usr/bin/env python3
"""INICET High-Yield Cardiology Study Guide PDF Generator"""

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

OUTPUT_PATH = "/home/daytona/workspace/inicet-cardiology/INICET_Cardiology_HighYield.pdf"

# ── Color Palette ────────────────────────────────────────────────
DARK_BLUE    = HexColor("#1A3A5C")
MED_BLUE     = HexColor("#2B6CB0")
LIGHT_BLUE   = HexColor("#EBF8FF")
ACCENT_RED   = HexColor("#C53030")
ACCENT_GREEN = HexColor("#276749")
YELLOW_BG    = HexColor("#FFFFF0")
ORANGE       = HexColor("#C05621")
GRAY_BG      = HexColor("#F7FAFC")
GRAY_BORDER  = HexColor("#CBD5E0")
WHITE        = colors.white
BLACK        = colors.black
LIGHT_GRAY   = HexColor("#EDF2F7")
TEAL         = HexColor("#2C7A7B")
PURPLE       = HexColor("#553C9A")

# ── Styles ────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def make_style(name, parent='Normal', **kwargs):
    return ParagraphStyle(name=name, parent=styles[parent], **kwargs)

# Title styles
cover_title = make_style('CoverTitle', fontSize=32, textColor=WHITE,
    fontName='Helvetica-Bold', alignment=TA_CENTER, leading=40, spaceAfter=8)
cover_sub = make_style('CoverSub', fontSize=16, textColor=HexColor("#BEE3F8"),
    fontName='Helvetica', alignment=TA_CENTER, leading=22, spaceAfter=6)
cover_tag = make_style('CoverTag', fontSize=12, textColor=HexColor("#90CDF4"),
    fontName='Helvetica-Oblique', alignment=TA_CENTER, leading=16)

# Section header
sec_header = make_style('SectionHeader', fontSize=17, textColor=WHITE,
    fontName='Helvetica-Bold', alignment=TA_LEFT, leading=22,
    spaceBefore=4, spaceAfter=4, leftIndent=0)

# Sub-section
subsec = make_style('SubSec', fontSize=13, textColor=DARK_BLUE,
    fontName='Helvetica-Bold', spaceBefore=10, spaceAfter=4, leading=17)

# Body
body = make_style('Body', fontSize=10, textColor=HexColor("#2D3748"),
    fontName='Helvetica', leading=15, spaceAfter=4, alignment=TA_JUSTIFY)

# Bullet
bullet = make_style('Bullet', fontSize=10, textColor=HexColor("#2D3748"),
    fontName='Helvetica', leading=14, spaceAfter=3, leftIndent=14,
    bulletIndent=4)

# Key fact (red highlight)
keyfact = make_style('KeyFact', fontSize=10, textColor=ACCENT_RED,
    fontName='Helvetica-Bold', leading=14, spaceAfter=3, leftIndent=14)

# Mnemonic
mnemonic = make_style('Mnemonic', fontSize=11, textColor=TEAL,
    fontName='Helvetica-Bold', leading=16, spaceAfter=3,
    leftIndent=10, borderPad=4)

# Table header text
th_style = make_style('TH', fontSize=9, textColor=WHITE,
    fontName='Helvetica-Bold', alignment=TA_CENTER, leading=13)
td_style = make_style('TD', fontSize=9, textColor=HexColor("#2D3748"),
    fontName='Helvetica', alignment=TA_LEFT, leading=13)
td_c_style = make_style('TDC', fontSize=9, textColor=HexColor("#2D3748"),
    fontName='Helvetica', alignment=TA_CENTER, leading=13)

# Warning box
warn_style = make_style('Warn', fontSize=10, textColor=HexColor("#7B341E"),
    fontName='Helvetica-Bold', leading=14, leftIndent=8, rightIndent=8)

# Note box
note_style = make_style('Note', fontSize=9.5, textColor=HexColor("#234E52"),
    fontName='Helvetica-Oblique', leading=14, leftIndent=8, rightIndent=8)

# ── Helper Functions ──────────────────────────────────────────────

def section_banner(title, color=DARK_BLUE):
    """Colored section banner."""
    data = [[Paragraph(title, sec_header)]]
    t = Table(data, colWidths=[17*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), color),
        ('TOPPADDING', (0,0), (-1,-1), 8),
        ('BOTTOMPADDING', (0,0), (-1,-1), 8),
        ('LEFTPADDING', (0,0), (-1,-1), 14),
        ('RIGHTPADDING', (0,0), (-1,-1), 8),
        ('ROUNDEDCORNERS', [4,4,4,4]),
    ]))
    return t

def warn_box(text, bg=HexColor("#FFF5F5"), border=ACCENT_RED):
    data = [[Paragraph(f"⚠  {text}", warn_style)]]
    t = Table(data, colWidths=[17*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), bg),
        ('TOPPADDING', (0,0), (-1,-1), 6),
        ('BOTTOMPADDING', (0,0), (-1,-1), 6),
        ('LEFTPADDING', (0,0), (-1,-1), 10),
        ('BOX', (0,0), (-1,-1), 1.2, border),
        ('ROUNDEDCORNERS', [3,3,3,3]),
    ]))
    return t

def note_box(text, bg=HexColor("#E6FFFA"), border=TEAL):
    data = [[Paragraph(f"💡  {text}", note_style)]]
    t = Table(data, colWidths=[17*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), bg),
        ('TOPPADDING', (0,0), (-1,-1), 6),
        ('BOTTOMPADDING', (0,0), (-1,-1), 6),
        ('LEFTPADDING', (0,0), (-1,-1), 10),
        ('BOX', (0,0), (-1,-1), 1.2, border),
        ('ROUNDEDCORNERS', [3,3,3,3]),
    ]))
    return t

def mnemonic_box(title, items, bg=HexColor("#FAF5FF"), border=PURPLE):
    rows = [[Paragraph(f"🧠  {title}", mnemonic)]]
    for item in items:
        rows.append([Paragraph(f"  {item}", bullet)])
    t = Table(rows, colWidths=[17*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), bg),
        ('TOPPADDING', (0,0), (-1,-1), 4),
        ('BOTTOMPADDING', (0,0), (-1,-1), 4),
        ('LEFTPADDING', (0,0), (-1,-1), 10),
        ('BOX', (0,0), (-1,-1), 1.5, border),
    ]))
    return t

def make_table(headers, rows, col_widths=None):
    """Styled two-tone table."""
    if col_widths is None:
        w = 17 * cm / len(headers)
        col_widths = [w] * len(headers)
    data = [[Paragraph(h, th_style) for h in headers]]
    for row in rows:
        data.append([Paragraph(str(c), td_style) for c in row])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    style_cmds = [
        ('BACKGROUND', (0,0), (-1,0), MED_BLUE),
        ('ROWBACKGROUNDS', (0,1), (-1,-1), [WHITE, LIGHT_GRAY]),
        ('GRID', (0,0), (-1,-1), 0.5, GRAY_BORDER),
        ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
        ('TOPPADDING', (0,0), (-1,-1), 5),
        ('BOTTOMPADDING', (0,0), (-1,-1), 5),
        ('LEFTPADDING', (0,0), (-1,-1), 6),
    ]
    t.setStyle(TableStyle(style_cmds))
    return t

def bp(text):
    """Bullet point paragraph."""
    return Paragraph(f"• {text}", bullet)

def kf(text):
    """Key fact paragraph."""
    return Paragraph(f"★  {text}", keyfact)

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

# ── Build Content ─────────────────────────────────────────────────

def build_story():
    story = []

    # ═══════════════════════════════════════════
    # COVER PAGE
    # ═══════════════════════════════════════════
    cover_bg_data = [[Paragraph("", make_style('X', fontSize=1))]]
    cover_table = Table([[
        Paragraph("INICET", cover_title),
    ]], colWidths=[17*cm])
    cover_table.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), DARK_BLUE),
        ('TOPPADDING', (0,0), (-1,-1), 40),
        ('BOTTOMPADDING', (0,0), (-1,-1), 10),
        ('LEFTPADDING', (0,0), (-1,-1), 20),
        ('RIGHTPADDING', (0,0), (-1,-1), 20),
    ]))
    story.append(cover_table)

    sub_table = Table([[
        Paragraph("HIGH-YIELD CARDIOLOGY", make_style('CH', fontSize=22, textColor=DARK_BLUE,
            fontName='Helvetica-Bold', alignment=TA_CENTER, leading=28)),
        ]], colWidths=[17*cm])
    sub_table.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), HexColor("#EBF8FF")),
        ('TOPPADDING', (0,0), (-1,-1), 14),
        ('BOTTOMPADDING', (0,0), (-1,-1), 14),
    ]))
    story.append(sub_table)

    story.append(S(12))
    story.append(Paragraph("STUDY GUIDE", make_style('SG', fontSize=28, textColor=DARK_BLUE,
        fontName='Helvetica-Bold', alignment=TA_CENTER, leading=34)))
    story.append(S(6))
    story.append(Paragraph("Comprehensive | Clinical Vignette-Focused | Guideline-Based",
        make_style('CV', fontSize=12, textColor=MED_BLUE,
        fontName='Helvetica-Oblique', alignment=TA_CENTER)))
    story.append(S(10))
    story.append(HRFlowable(width="80%", thickness=2, color=MED_BLUE, spaceAfter=10))

    badges = [
        ["Cardiology", "Arrhythmias", "Heart Failure", "ACS / STEMI"],
        ["Hypertension", "Valvular Disease", "Pericarditis", "ECG Patterns"],
    ]
    badge_style = make_style('Badge', fontSize=10, textColor=WHITE,
        fontName='Helvetica-Bold', alignment=TA_CENTER)
    for row in badges:
        cells = [Paragraph(r, badge_style) for r in row]
        bt = Table([cells], colWidths=[4.25*cm]*4)
        bt.setStyle(TableStyle([
            ('BACKGROUND', (0,0), (-1,-1), MED_BLUE),
            ('TOPPADDING', (0,0), (-1,-1), 6),
            ('BOTTOMPADDING', (0,0), (-1,-1), 6),
            ('GRID', (0,0), (-1,-1), 1, WHITE),
            ('ROUNDEDCORNERS', [4,4,4,4]),
        ]))
        story.append(bt)
        story.append(S(4))

    story.append(S(16))
    story.append(Paragraph("Sources: Braunwald's Heart Disease | Harrison's Internal Medicine 22e",
        make_style('Src', fontSize=8.5, textColor=HexColor("#718096"),
        fontName='Helvetica-Oblique', alignment=TA_CENTER)))
    story.append(Paragraph("Goldman-Cecil Medicine | Fuster & Hurst's The Heart 15e | Washington Manual",
        make_style('Src2', fontSize=8.5, textColor=HexColor("#718096"),
        fontName='Helvetica-Oblique', alignment=TA_CENTER)))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 1: EXAM PATTERN OVERVIEW
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 1 — CARDIOLOGY IN INICET: EXAM OVERVIEW", MED_BLUE))
    story.append(S(8))
    story.append(Paragraph("Why Cardiology is #1 in INICET Medicine", subsec))
    story.append(bp("Cardiology accounts for the highest share of Medicine questions (~6-8 per session)"))
    story.append(bp("Top 3 Medicine sub-specialties tested: Cardiology > Endocrinology > Neurology"))
    story.append(bp("~60-65% of questions are clinical vignettes - expect ECG + case scenarios"))
    story.append(bp("15-20% image-based questions: ECG, Chest X-ray, Echo, angiography findings"))
    story.append(S(6))

    story.append(make_table(
        ["Sub-topic", "Expected Qs/Session", "Priority"],
        [
            ["ECG Interpretation", "2-3", "MUST MASTER"],
            ["Heart Failure (HFrEF/HFpEF)", "2-3", "Very High"],
            ["ACS / STEMI / NSTEMI", "2-3", "Very High"],
            ["Arrhythmias (AF, VT, heart blocks)", "1-2", "Very High"],
            ["Hypertension", "1-2", "High"],
            ["Valvular Heart Disease", "1", "High"],
            ["Pericarditis / Myocarditis", "1", "Moderate"],
            ["Cardiomyopathy", "1", "Moderate"],
        ],
        col_widths=[7*cm, 5*cm, 5*cm]
    ))
    story.append(S(8))
    story.append(note_box("INICET favors guideline-based management questions. Know AHA/ACC and ESC 2023 recommendations cold."))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 2: ECG PATTERNS
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 2 — ECG PATTERNS (HIGH YIELD)", ACCENT_RED))
    story.append(S(8))
    story.append(Paragraph("Normal ECG Values", subsec))
    story.append(make_table(
        ["Parameter", "Normal Value", "Abnormal if"],
        [
            ["PR interval", "120-200 ms (3-5 small sq)", ">200 ms = 1st degree HB"],
            ["QRS duration", "<120 ms (<3 small sq)", ">120 ms = bundle branch block"],
            ["QTc", "Male <440 ms, Female <460 ms", ">500 ms = high TdP risk"],
            ["ST segment", "Isoelectric", "Elevation >1mm limb / >2mm precordial"],
            ["P-wave axis", "0-75°", "Negative in II = ectopic atrial rhythm"],
            ["T-wave", "Upright in I, II, V3-V6", "Inversion = ischemia/strain"],
        ],
        col_widths=[5*cm, 6*cm, 6*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("STEMI Localisation — Must Know", subsec))
    story.append(make_table(
        ["Leads with ST Elevation", "Territory", "Artery Occluded"],
        [
            ["II, III, aVF", "Inferior wall", "RCA (80%) or LCx (20%)"],
            ["V1-V4", "Anterior wall", "LAD"],
            ["V4-V6, I, aVL", "Anterolateral", "LAD or LCx"],
            ["I, aVL", "High lateral", "LCx or Diagonal"],
            ["V1-V2 (tall R, ST depression)", "Posterior wall", "RCA or LCx"],
            ["V4R, ST elevation", "Right ventricle", "Proximal RCA"],
        ],
        col_widths=[5.5*cm, 5.5*cm, 6*cm]
    ))
    story.append(S(6))
    story.append(warn_box("Posterior STEMI = reciprocal ST depression in V1-V2 + tall R wave. Do right-sided leads (V4R) for RV MI. Avoid nitrates in RV MI!"))
    story.append(S(8))

    story.append(Paragraph("Bundle Branch Blocks", subsec))
    story.append(make_table(
        ["Feature", "LBBB", "RBBB"],
        [
            ["QRS", ">120 ms, broad notched R", ">120 ms, RSR' ('M pattern')"],
            ["Best lead to see", "V5, V6, I, aVL", "V1, V2"],
            ["V1 morphology", "Broad S, QS pattern", "RSR' ('rabbit ears')"],
            ["V6 morphology", "Tall broad R, no Q", "Wide S wave"],
            ["Clinical significance", "New LBBB = STEMI equivalent", "Often benign; can be normal"],
            ["Discordant ST-T", "Yes - opposite to QRS", "Yes - opposite to terminal QRS"],
        ],
        col_widths=[4.5*cm, 6.25*cm, 6.25*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Heart Blocks", subsec))
    story.append(make_table(
        ["Type", "ECG Finding", "Treatment"],
        [
            ["1st Degree", "PR >200 ms, all P's conduct", "None required"],
            ["2nd Degree Mobitz I (Wenckebach)", "Progressive PR prolongation then dropped beat", "Usually no treatment; monitor"],
            ["2nd Degree Mobitz II", "Fixed PR, sudden dropped QRS (unpredictable)", "Pacemaker - risk of complete block"],
            ["3rd Degree (Complete)", "P waves and QRS dissociated; slow escape rhythm", "Immediate pacemaker"],
            ["High-grade 2nd Degree", "≥2 consecutive P waves not conducted", "Pacemaker"],
        ],
        col_widths=[4*cm, 7.5*cm, 5.5*cm]
    ))
    story.append(S(6))
    story.append(note_box("Mobitz II > Wenckebach in risk. Mobitz II can suddenly deteriorate to complete heart block without warning. Always pace Mobitz II."))
    story.append(S(8))

    story.append(Paragraph("Key ECG Patterns - Quick Reference", subsec))
    story.append(make_table(
        ["Condition", "Classic ECG Finding"],
        [
            ["Atrial Fibrillation", "Irregularly irregular, no P waves, narrow QRS (unless aberrant)"],
            ["Atrial Flutter", "Sawtooth flutter waves at ~300 bpm, 2:1 or 4:1 block"],
            ["WPW Syndrome", "Short PR, delta wave, wide QRS (pseudo-LBBB or RBBB)"],
            ["Long QT Syndrome", "QTc >500 ms, risk of Torsades de Pointes (TdP)"],
            ["Hyperkalemia", "Peaked T waves → wide QRS → sine wave → asystole"],
            ["Hypokalemia", "Flattened T, U waves, ST depression"],
            ["Pericarditis (acute)", "Diffuse saddle-shaped ST elevation, PR depression"],
            ["Pulmonary Embolism", "S1Q3T3, right heart strain, sinus tachycardia (most common)"],
            ["Digoxin toxicity", "Scooped ST (reverse tick sign), bradyarrhythmias, AV blocks"],
            ["Brugada Syndrome", "Coved ST elevation V1-V3, right bundle pattern"],
        ],
        col_widths=[6*cm, 11*cm]
    ))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 3: HEART FAILURE
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 3 — HEART FAILURE", MED_BLUE))
    story.append(S(8))
    story.append(Paragraph("Classification by EF (Goldman-Cecil Medicine)", subsec))
    story.append(make_table(
        ["Type", "EF", "Key Features", "Treatment Focus"],
        [
            ["HFrEF", "≤40%", "Systolic dysfunction; dilated LV; most evidence-based Rx", "GDMT (4 pillars)"],
            ["HFmrEF", "41-49%", "Mildly reduced; intermediate phenotype", "Treat like HFrEF"],
            ["HFpEF", "≥50%", "Diastolic dysfunction; stiff LV; elderly, HTN, DM, AF", "Diuretics + SGLT2i"],
        ],
        col_widths=[3.5*cm, 2.5*cm, 6.5*cm, 4.5*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("HFrEF - Guideline-Directed Medical Therapy (GDMT): 4 Pillars", subsec))
    story.append(mnemonic_box(
        "GDMT 4 Pillars (All reduce mortality in HFrEF)",
        [
            "1. ACEi / ARB / ARNI (sacubitril-valsartan) — start with ACEi; upgrade to ARNI if tolerated",
            "2. Beta-blocker — carvedilol, metoprolol succinate, bisoprolol (only these 3 are proven)",
            "3. Mineralocorticoid Receptor Antagonist (MRA) — spironolactone / eplerenone (EF ≤35%)",
            "4. SGLT2 inhibitor — dapagliflozin / empagliflozin (added benefit even in non-diabetics)",
        ]
    ))
    story.append(S(6))
    story.append(kf("ARNI (sacubitril-valsartan) is superior to enalapril in HFrEF - PARADIGM-HF trial. Cannot combine ARNI with ACEi (risk of angioedema)."))
    story.append(S(6))

    story.append(Paragraph("Device Therapy in HF", subsec))
    story.append(make_table(
        ["Device", "Indication", "Criteria"],
        [
            ["ICD (Implantable Cardioverter-Defibrillator)",
             "Primary prevention of SCD",
             "EF ≤35%, NYHA class II-III, >3 months optimal GDMT, life expectancy >1 yr"],
            ["CRT (Cardiac Resynchronisation Therapy)",
             "Dyssynchrony in HF",
             "EF ≤35%, LBBB with QRS ≥150 ms, NYHA II-IV, sinus rhythm"],
            ["CRT-D",
             "CRT + ICD combined",
             "Same criteria + ICD indication"],
        ],
        col_widths=[4.5*cm, 5*cm, 7.5*cm]
    ))
    story.append(S(6))

    story.append(Paragraph("Acute Decompensated Heart Failure (ADHF)", subsec))
    story.append(bp("Warm-Wet (most common): Diuresis with IV furosemide (first-line)"))
    story.append(bp("Cold-Wet: Add inotropes (dobutamine), consider vasopressors if hypotensive"))
    story.append(bp("Warm-Dry: Optimize oral GDMT, search for precipitating cause"))
    story.append(bp("Cold-Dry: Cardiogenic shock - IV fluids cautiously, inotropes, IABP/MCS"))
    story.append(S(4))
    story.append(kf("BNP >400 pg/mL or NT-proBNP >1000 pg/mL supports HF diagnosis. BNP-guided therapy reduces HF hospitalization."))
    story.append(S(6))

    story.append(Paragraph("NYHA Functional Classification", subsec))
    story.append(make_table(
        ["Class", "Symptoms", "Approximate EF Range"],
        [
            ["I", "No symptoms with ordinary activity", "Often normal or mildly reduced"],
            ["II", "Slight limitation with ordinary activity", "Variable"],
            ["III", "Marked limitation; comfortable at rest only", "Often ≤40%"],
            ["IV", "Symptoms at rest; unable to carry on activity", "Often ≤20-25%"],
        ],
        col_widths=[2.5*cm, 9*cm, 5.5*cm]
    ))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 4: ACUTE CORONARY SYNDROME
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 4 — ACUTE CORONARY SYNDROME (ACS)", ACCENT_GREEN))
    story.append(S(8))

    story.append(Paragraph("ACS Classification (Goldman-Cecil)", subsec))
    story.append(make_table(
        ["Type", "Troponin", "ST Change", "Management Strategy"],
        [
            ["Unstable Angina (UA)", "Negative", "ST depression / T inversion or normal", "Anti-ischemic + antiplatelet"],
            ["NSTEMI", "Positive", "ST depression / T inversion (no ST elevation)", "Invasive strategy within 2-72h"],
            ["STEMI", "Positive", "ST elevation >1mm (2mm in V1-V3) in ≥2 leads", "Reperfusion within 90 min (primary PCI)"],
        ],
        col_widths=[3.5*cm, 2.5*cm, 5.5*cm, 5.5*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("STEMI Management — Reperfusion Strategy", subsec))
    story.append(kf("Primary PCI is preferred over thrombolysis if door-to-balloon time ≤90 min at a PCI-capable center (AHA/ACC)."))
    story.append(bp("If PCI not available within 120 min of first medical contact: give thrombolysis, then transfer for angiography within 3-24h"))
    story.append(bp("Thrombolytics: tPA (alteplase), streptokinase, tenecteplase"))
    story.append(bp("Aspirin (300mg) + P2Y12 inhibitor (ticagrelor 180mg or clopidogrel 600mg) loading ASAP"))
    story.append(S(6))

    story.append(Paragraph("Contraindications to Thrombolysis", subsec))
    story.append(make_table(
        ["Absolute Contraindications", "Relative Contraindications"],
        [
            ["Prior intracranial hemorrhage (ever)", "SBP >180 or DBP >110 mmHg"],
            ["Ischemic stroke within 3 months", "Current anticoagulant use"],
            ["Known intracranial neoplasm/AVM", "Traumatic CPR >10 min"],
            ["Active internal bleeding (not menstrual)", "Major surgery within 3 weeks"],
            ["Suspected aortic dissection", "Pregnancy"],
            ["Head/face trauma within 3 months", "Peptic ulcer disease"],
        ],
        col_widths=[8.5*cm, 8.5*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Post-MI Drug Therapy", subsec))
    story.append(make_table(
        ["Drug", "Indication", "Duration/Notes"],
        [
            ["Aspirin", "All ACS", "Lifelong 75-100mg/day"],
            ["Ticagrelor / Clopidogrel (P2Y12i)", "ACS + PCI", "12 months (dual antiplatelet)"],
            ["Beta-blocker", "All MI with EF ≤40%", "Start within 24h if stable; lifelong"],
            ["ACEi / ARB", "MI + EF ≤40%, HTN, DM, CKD", "Lifelong; start within 24h"],
            ["High-intensity statin", "All ACS regardless of LDL", "Atorvastatin 40-80mg or Rosuvastatin 20-40mg"],
            ["Aldosterone antagonist", "MI + EF ≤40% + HF or DM, no CKD/hyperK", "Eplerenone; reduces mortality"],
            ["Nicorandil", "Refractory angina", "Potassium channel opener"],
        ],
        col_widths=[4.5*cm, 5*cm, 7.5*cm]
    ))
    story.append(S(6))
    story.append(warn_box("Do NOT use NSAIDs post-MI - increase re-infarction and mortality. Morphine may mask ischemia - use with caution; oxygen only if SaO2 <90%."))
    story.append(S(8))

    story.append(Paragraph("Complications of MI — Timeline", subsec))
    story.append(make_table(
        ["Time", "Complication", "Mechanism / Notes"],
        [
            ["0-24h", "Ventricular fibrillation", "Electrical instability - most common cause of out-of-hospital death"],
            ["0-24h", "Cardiogenic shock", "Loss of >40% LV mass; mortality 50-80%"],
            ["24-72h", "Free wall rupture", "Haemopericardium, tamponade; often fatal"],
            ["3-5 days", "Papillary muscle rupture", "Acute MR; pulmonary edema; new holosystolic murmur"],
            ["3-7 days", "VSD (ventricular septal defect)", "New harsh holosystolic murmur at LLSB"],
            ["2-3 weeks", "Dressler's syndrome", "Pericarditis + pleuritis (autoimmune); treat with NSAIDs"],
            ["Weeks-months", "LV aneurysm", "Persistent ST elevation; mural thrombus risk"],
            ["Any time", "Complete heart block", "Esp. with inferior MI (RCA); may need temporary pacing"],
        ],
        col_widths=[2.5*cm, 5.5*cm, 9*cm]
    ))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 5: ARRHYTHMIAS
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 5 — ARRHYTHMIAS", HexColor("#6B46C1")))
    story.append(S(8))

    story.append(Paragraph("Atrial Fibrillation (AF) — Most Tested Arrhythmia", subsec))
    story.append(make_table(
        ["Aspect", "Details"],
        [
            ["Definition", "Irregularly irregular rhythm, absent P waves, fibrillatory baseline"],
            ["Paroxysmal", "Terminates spontaneously within 7 days"],
            ["Persistent", "Lasts >7 days; requires cardioversion"],
            ["Long-standing persistent", ">1 year duration"],
            ["Permanent", "Decision made not to restore sinus rhythm"],
            ["Most common cause", "Hypertension; others: valvular (mitral), hyperthyroidism, alcohol ('holiday heart')"],
            ["Stroke risk", "Similar in paroxysmal and persistent AF"],
        ],
        col_widths=[5*cm, 12*cm]
    ))
    story.append(S(6))

    story.append(Paragraph("CHA2DS2-VASc Score — Stroke Risk in AF", subsec))
    story.append(make_table(
        ["Risk Factor", "Score"],
        [
            ["C — Congestive Heart Failure / LV dysfunction", "1"],
            ["H — Hypertension", "1"],
            ["A2 — Age ≥75 years", "2"],
            ["D — Diabetes mellitus", "1"],
            ["S2 — Stroke / TIA / thromboembolism (prior)", "2"],
            ["V — Vascular disease (prior MI, PAD, aortic plaque)", "1"],
            ["A — Age 65-74 years", "1"],
            ["Sc — Sex category (Female)", "1"],
        ],
        col_widths=[13*cm, 4*cm]
    ))
    story.append(S(4))
    story.append(kf("Anticoagulate if score ≥2 (men) or ≥3 (women). Score of 1 in men: consider anticoagulation. NOACs preferred over warfarin (except rheumatic AF - use warfarin)."))
    story.append(S(8))

    story.append(Paragraph("Rate vs Rhythm Control in AF", subsec))
    story.append(make_table(
        ["Strategy", "Goal", "Drugs Used", "When Preferred"],
        [
            ["Rate Control",
             "HR <80 bpm at rest; <110 on exertion",
             "Beta-blockers, diltiazem, verapamil, digoxin",
             "Older patients, permanent AF, asymptomatic"],
            ["Rhythm Control",
             "Restore + maintain sinus rhythm",
             "Flecainide, propafenone (no structural disease); amiodarone, sotalol",
             "Young symptomatic, paroxysmal AF, HF"],
        ],
        col_widths=[3*cm, 4*cm, 5*cm, 5*cm]
    ))
    story.append(S(4))
    story.append(note_box("Cardioversion: anticoagulate for ≥3 weeks before and ≥4 weeks after if AF >48h (or unknown duration). Alternatively do TEE to exclude thrombus."))
    story.append(S(8))

    story.append(Paragraph("Ventricular Tachycardia (VT) vs Supraventricular Tachycardia (SVT)", subsec))
    story.append(make_table(
        ["Feature", "VT", "SVT with Aberrancy"],
        [
            ["QRS", ">120 ms (always wide)", ">120 ms (may be wide due to BBB)"],
            ["AV dissociation", "YES - P waves unrelated to QRS", "NO - P waves precede QRS"],
            ["Fusion beats", "YES (diagnostic)", "No"],
            ["Capture beats", "YES (pathognomonic)", "No"],
            ["Brugada criteria", "Positive (no RS in precordial)", "Negative"],
            ["Favored in", "Structural heart disease, post-MI", "Young patients, no heart disease"],
            ["Treatment (stable)", "Amiodarone IV / DC cardioversion", "Adenosine IV first"],
            ["Treatment (unstable)", "Immediate DC synchronized cardioversion", "Immediate DC cardioversion"],
        ],
        col_widths=[4.5*cm, 6.25*cm, 6.25*cm]
    ))
    story.append(S(6))
    story.append(warn_box("In WPW with AF: NEVER use AV nodal blockers (adenosine, verapamil, digoxin, beta-blockers) - can cause rapid conduction via accessory pathway and VF. Use procainamide or DC cardioversion."))
    story.append(S(8))

    story.append(Paragraph("Long QT and Torsades de Pointes (TdP)", subsec))
    story.append(bp("QTc >500 ms = high risk for TdP"))
    story.append(bp("Congenital Long QT: Romano-Ward (AD, no deafness), Jervell-Lange-Nielsen (AR, with deafness)"))
    story.append(bp("Acquired causes: drugs (sotalol, amiodarone, haloperidol, clarithromycin, methadone), hypokalemia, hypomagnesemia, bradycardia"))
    story.append(bp("TdP: polymorphic VT with twisting QRS around baseline; may cause syncope or sudden death"))
    story.append(kf("Treatment of TdP: IV Magnesium sulfate 2g (first-line). If drug-induced: stop offending drug + magnesium. If bradycardia-related: pacing."))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 6: HYPERTENSION
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 6 — HYPERTENSION", TEAL))
    story.append(S(8))

    story.append(Paragraph("Classification and Targets (JNC 8 / AHA 2017 / ESC 2018)", subsec))
    story.append(make_table(
        ["Stage", "SBP (mmHg)", "DBP (mmHg)", "Action"],
        [
            ["Normal", "<120", "<80", "Lifestyle measures"],
            ["Elevated", "120-129", "<80", "Lifestyle - no drugs yet"],
            ["Stage 1 HTN", "130-139", "80-89", "Lifestyle ± drugs if high CV risk"],
            ["Stage 2 HTN", "≥140", "≥90", "Lifestyle + drugs"],
            ["Hypertensive Urgency", "≥180", "≥110", "No acute organ damage; oral meds; reduce over 24-48h"],
            ["Hypertensive Emergency", "≥180", "≥120", "Acute organ damage; IV meds; reduce MAP by 25% in 1h"],
        ],
        col_widths=[4.5*cm, 3*cm, 3*cm, 6.5*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Drug Choice Based on Compelling Indication", subsec))
    story.append(make_table(
        ["Condition", "Preferred Drug(s)", "Avoid"],
        [
            ["Heart Failure (HFrEF)", "ACEi/ARB + BB + MRA + SGLT2i", "Non-DHP CCB (verapamil, diltiazem)"],
            ["Post-MI", "ACEi + Beta-blocker", "Non-DHP CCB initially"],
            ["Diabetes + Proteinuria", "ACEi or ARB (first-line)", "Combo ACEi + ARB"],
            ["CKD with proteinuria", "ACEi or ARB", "K+-sparing diuretics"],
            ["Pregnancy", "Methyldopa, Labetalol, Nifedipine", "ACEi, ARB, direct renin inhibitors"],
            ["Isolated Systolic HTN (elderly)", "Thiazides, DHP-CCB (amlodipine)", "Beta-blockers (less effective)"],
            ["Hypertensive + BPH", "Alpha-1 blockers (doxazosin)", "—"],
            ["Hypertensive + Migraine", "Beta-blocker or CCB", "—"],
            ["Hypertensive Emergency", "IV labetalol, IV nicardipine, IV nitroprusside", "Nifedipine sublingual (dangerous)"],
        ],
        col_widths=[4.5*cm, 7*cm, 5.5*cm]
    ))
    story.append(S(6))
    story.append(warn_box("Nitroprusside is gold standard for most hypertensive emergencies BUT causes cyanide toxicity with prolonged use. Use with caution in renal/hepatic failure."))
    story.append(S(6))
    story.append(note_box("Target BP in most patients: <130/80 mmHg. In elderly >65y without comorbidities: <130 SBP if tolerated."))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 7: VALVULAR HEART DISEASE
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 7 — VALVULAR HEART DISEASE", ORANGE))
    story.append(S(8))

    story.append(Paragraph("Auscultation Quick Reference", subsec))
    story.append(make_table(
        ["Valve Lesion", "Murmur Type", "Best Heard", "Radiation", "Classic Clue"],
        [
            ["Aortic Stenosis (AS)", "Harsh systolic ejection", "2nd RICS", "Carotids", "Pulsus parvus et tardus; most common in elderly"],
            ["Aortic Regurgitation (AR)", "Early diastolic decrescendo", "3rd LICS (Erb's)", "—", "Wide pulse pressure; Corrigan's (water hammer) pulse"],
            ["Mitral Stenosis (MS)", "Mid-diastolic rumble", "Apex", "—", "Opening snap after S2; AF common; rheumatic fever"],
            ["Mitral Regurgitation (MR)", "Holosystolic blowing", "Apex", "Axilla", "Displaced apex; S3; MVP most common cause in developed countries"],
            ["Tricuspid Regurgitation", "Holosystolic", "LLSB", "—", "↑ with inspiration (Carvallo's sign); JVP raised"],
            ["Pulmonary Stenosis", "Ejection systolic", "2nd LICS", "—", "Wide split S2; right ventricular heave"],
            ["MVP (Mitral Valve Prolapse)", "Mid-systolic click + late systolic murmur", "Apex", "—", "Click moves earlier with standing/Valsalva"],
        ],
        col_widths=[3.5*cm, 3.5*cm, 2.5*cm, 2.5*cm, 5*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Aortic Stenosis — Severity and Surgery", subsec))
    story.append(make_table(
        ["Parameter", "Mild", "Moderate", "Severe"],
        [
            ["Valve Area (cm²)", ">1.5", "1.0-1.5", "<1.0 (critical: <0.6)"],
            ["Mean Gradient (mmHg)", "<25", "25-40", ">40"],
            ["Peak Velocity (m/s)", "<3", "3-4", ">4"],
        ],
        col_widths=[5*cm, 4*cm, 4*cm, 4*cm]
    ))
    story.append(S(4))
    story.append(mnemonic_box(
        "Symptoms of Severe AS — SAP (Surgery Indicated When These Appear)",
        ["S — Syncope (exertional)",
         "A — Angina",
         "P — Pulmonary edema / Dyspnea (HF symptoms)"]
    ))
    story.append(S(4))
    story.append(kf("Mean survival after onset of symptoms: Angina = 5 yrs, Syncope = 3 yrs, HF = 1-2 yrs. AVR indicated when symptoms develop."))
    story.append(S(6))
    story.append(Paragraph("TAVI (Transcatheter Aortic Valve Implantation): For severe AS in patients at high or prohibitive surgical risk.", body))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 8: PERICARDITIS & TAMPONADE
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 8 — PERICARDITIS, MYOCARDITIS & TAMPONADE", HexColor("#C05621")))
    story.append(S(8))

    story.append(Paragraph("Acute Pericarditis", subsec))
    story.append(make_table(
        ["Feature", "Details"],
        [
            ["Most common cause", "Viral (Coxsackie B, Echovirus, CMV, EBV); also idiopathic"],
            ["Chest pain character", "Sharp, pleuritic; worse supine; relieved by leaning forward"],
            ["Classic sign", "Pericardial friction rub (scratchy, 3-component)"],
            ["ECG (Stage 1)", "Diffuse concave ST elevation + PR segment depression (pathognomonic)"],
            ["ECG (Stage 4)", "T-wave inversions (may persist)"],
            ["Diagnosis", "Any 2 of: chest pain, rub, typical ECG changes, pericardial effusion"],
            ["Treatment (viral/idiopathic)", "NSAIDs (ibuprofen or aspirin) + Colchicine x 3 months (prevents recurrence)"],
            ["Avoid", "Anticoagulants (risk of hemorrhagic conversion), corticosteroids (increase recurrence)"],
        ],
        col_widths=[5*cm, 12*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Cardiac Tamponade", subsec))
    story.append(mnemonic_box(
        "Beck's Triad (Tamponade)",
        ["Hypotension (low output)",
         "Elevated JVP (↑ venous pressure)",
         "Muffled heart sounds"]
    ))
    story.append(S(6))
    story.append(make_table(
        ["Feature", "Details"],
        [
            ["Mechanism", "Pericardial fluid compresses heart → impaired diastolic filling → ↓ CO"],
            ["Key sign", "Pulsus paradoxus: >10 mmHg drop in SBP during inspiration"],
            ["ECG", "Sinus tachycardia + low voltage + electrical alternans (pathognomonic)"],
            ["Echo", "Right atrial and RV collapse in diastole; respiratory variation of flows"],
            ["CXR", "Enlarged flask-shaped cardiac silhouette ('water bottle heart')"],
            ["Treatment", "Pericardiocentesis (emergency). Surgical window if recurrent."],
            ["Avoid", "Diuretics and vasodilators (reduce preload → worsen hemodynamics)"],
        ],
        col_widths=[5*cm, 12*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Constrictive Pericarditis vs Restrictive Cardiomyopathy", subsec))
    story.append(make_table(
        ["Feature", "Constrictive Pericarditis", "Restrictive Cardiomyopathy"],
        [
            ["JVP", "↑, Kussmaul's sign positive", "↑, Kussmaul's may be present"],
            ["Pericardial knock", "Present (early diastole)", "Absent"],
            ["Calcification on CXR/CT", "May be present (TB, post-cardiac surgery)", "Absent"],
            ["Septal bounce on Echo", "Yes ('septal shudder')", "No"],
            ["PCWP vs RVEDP", "Equalization of pressures", "LVEDP > RVEDP by >5 mmHg"],
            ["Tissue Doppler E'", "Increased (>8 cm/s)", "Reduced (<8 cm/s)"],
            ["Causes", "TB (most common worldwide), post-radiation, post-cardiac surgery", "Amyloid, sarcoid, hemochromatosis, Fabry's"],
            ["Treatment", "Pericardiectomy (curative)", "Treat underlying cause; diuretics"],
        ],
        col_widths=[4.5*cm, 6.25*cm, 6.25*cm]
    ))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 9: CARDIOMYOPATHIES
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 9 — CARDIOMYOPATHIES", HexColor("#2C7A7B")))
    story.append(S(8))

    story.append(make_table(
        ["Type", "Mechanism", "Echo Findings", "Key Clinical Features", "Treatment"],
        [
            ["Dilated (DCM)",
             "Systolic dysfunction; dilated LV; ↓EF",
             "4-chamber dilation, ↓EF",
             "Most common; viral, alcohol, peripartum, familial (lamin A/C), idiopathic",
             "GDMT for HFrEF; ICD if EF ≤35%"],
            ["Hypertrophic (HCM)",
             "Asymmetric LV hypertrophy (usually septal); LVOT obstruction",
             "Asymmetric septal hypertrophy; SAM of mitral valve; LVOT gradient",
             "Young athletes, sudden death; FHx; autosomal dominant (sarcomere mutations)",
             "Beta-blocker / verapamil; avoid vasodilators; ICD if high-risk; septal myectomy"],
            ["Restrictive (RCM)",
             "Stiff, non-compliant LV; diastolic failure; normal or ↓EF",
             "Bi-atrial enlargement; normal LV size; diastolic dysfunction",
             "Amyloid most common; also sarcoid, hemochromatosis, Fabry",
             "Treat cause; diuretics; avoid digoxin in amyloid"],
            ["ARVC (Arrhythmogenic Right Ventricular Cardiomyopathy)",
             "Fibrofatty replacement of RV",
             "RV dilation and dysfunction; RV aneurysms",
             "Young males; epsilon wave on ECG (V1-V3); VT with LBBB morphology; sudden death",
             "ICD; antiarrhythmics; cardiac transplant if severe"],
        ],
        col_widths=[2.5*cm, 3.5*cm, 3.5*cm, 4*cm, 3.5*cm]
    ))
    story.append(S(6))
    story.append(warn_box("HCM: DO NOT give digoxin, vasodilators (nitroglycerin), or diuretics aggressively - worsen LVOT obstruction. Murmur increases with Valsalva and standing, decreases with squatting (opposite to most murmurs)."))
    story.append(S(8))

    story.append(Paragraph("Peripartum Cardiomyopathy", subsec))
    story.append(bp("Dilated cardiomyopathy occurring in last month of pregnancy or within 5 months postpartum"))
    story.append(bp("EF typically <45%; exclusion of other causes required"))
    story.append(bp("Risk factors: multiparity, older age, preeclampsia, African descent"))
    story.append(bp("Treatment: Standard HF therapy; avoid ACEi/ARBs during pregnancy (use hydralazine + nitrates instead)"))
    story.append(kf("~50% recover normal EF within 6 months. Subsequent pregnancy carries risk of relapse."))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 10: INFECTIVE ENDOCARDITIS
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 10 — INFECTIVE ENDOCARDITIS", ACCENT_RED))
    story.append(S(8))

    story.append(Paragraph("Duke Criteria for Diagnosis", subsec))
    story.append(make_table(
        ["Category", "Criteria"],
        [
            ["MAJOR — 1", "Positive blood cultures: ≥2 separate cultures with typical organisms (S. viridans, S. bovis, HACEK, S. aureus, Enterococcus) OR persistently positive cultures"],
            ["MAJOR — 2", "Evidence of endocardial involvement: new valvular regurgitation on echo OR positive echo (vegetation, abscess, dehiscence)"],
            ["MINOR — 1", "Predisposing heart condition or IV drug use"],
            ["MINOR — 2", "Fever >38°C"],
            ["MINOR — 3", "Vascular phenomena: septic emboli, Janeway lesions, intracranial hemorrhage"],
            ["MINOR — 4", "Immunologic phenomena: Osler nodes, Roth spots, glomerulonephritis, RF positive"],
            ["MINOR — 5", "Microbiological evidence not meeting major criteria"],
        ],
        col_widths=[4*cm, 13*cm]
    ))
    story.append(S(4))
    story.append(kf("Definite IE: 2 major OR 1 major + 3 minor OR 5 minor criteria. Possible IE: 1 major + 1 minor OR 3 minor."))
    story.append(S(6))

    story.append(Paragraph("Organisms and Clinical Associations", subsec))
    story.append(make_table(
        ["Organism", "Association", "Notes"],
        [
            ["Streptococcus viridans", "Native valve IE; most common overall", "After dental procedures"],
            ["Staphylococcus aureus", "Acute IE; IVDU; prosthetic valve; most common in IVDU", "Aggressive; high mortality"],
            ["Enterococcus faecalis", "GI/GU procedures; elderly", "Requires synergistic therapy (amp + gentamicin)"],
            ["Streptococcus bovis (gallolyticus)", "Colon cancer association", "Always do colonoscopy!"],
            ["HACEK organisms", "Subacute IE; culture-negative", "H. influenzae, Actinobacillus, Cardiobacterium, Eikenella, Kingella"],
            ["Coagulase-negative Staph", "Prosthetic valve IE (early <1yr)", "S. epidermidis; biofilm producers"],
            ["Coxiella burnetii", "Q fever endocarditis; culture-negative IE", "Farmers, animal contact; serology-based diagnosis"],
        ],
        col_widths=[4.5*cm, 5*cm, 7.5*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Classic Peripheral Signs", subsec))
    story.append(make_table(
        ["Sign", "Description", "Mechanism"],
        [
            ["Osler nodes", "Painful nodules on fingers/toes", "Immune complex deposition"],
            ["Janeway lesions", "Non-tender hemorrhagic macules on palms/soles", "Septic emboli"],
            ["Roth spots", "Oval retinal hemorrhages with pale center", "Immune complex / emboli"],
            ["Splinter hemorrhages", "Linear hemorrhages under nails", "Microemboli"],
            ["Clubbing", "Finger clubbing", "Chronic hypoxia / inflammation"],
        ],
        col_widths=[4*cm, 6.5*cm, 6.5*cm]
    ))
    story.append(S(6))
    story.append(note_box("Osler = painful (O = Ouch!). Janeway = painless (Jane = gentle). Easy memory trick!"))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 11: HIGH-YIELD PHARMACOLOGY
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 11 — HIGH-YIELD CARDIAC PHARMACOLOGY", MED_BLUE))
    story.append(S(8))

    story.append(Paragraph("Antiarrhythmic Drugs — Vaughan Williams Classification", subsec))
    story.append(make_table(
        ["Class", "Mechanism", "Drugs", "Key Use"],
        [
            ["IA", "Na+ channel block (moderate); ↑ QT", "Quinidine, Procainamide, Disopyramide", "AF, VT (largely obsolete)"],
            ["IB", "Na+ channel block (weak); ↓ QT", "Lidocaine, Mexiletine, Phenytoin", "Acute VT (post-MI); lidocaine IV"],
            ["IC", "Strong Na+ channel block; wide QRS", "Flecainide, Propafenone", "AF/Flutter — no structural disease"],
            ["II", "Beta-adrenergic block", "Metoprolol, Atenolol, Carvedilol", "AF rate control, post-MI, VT"],
            ["III", "K+ channel block; ↑ QT", "Amiodarone, Sotalol, Dofetilide, Dronedarone", "AF rhythm control; VT/VF"],
            ["IV", "Ca2+ channel block (non-DHP)", "Verapamil, Diltiazem", "AF/Flutter rate control; SVT"],
            ["Other", "Na+/K+ ATPase inhibition", "Digoxin", "AF rate control in HF; narrow therapeutic index"],
        ],
        col_widths=[1.5*cm, 4.5*cm, 5*cm, 6*cm]
    ))
    story.append(S(6))
    story.append(kf("Amiodarone: Class III but has class I, II, III, IV properties. Longest half-life (40-55 days). Toxicities: pulmonary fibrosis, thyroid (hypo/hyper), hepatotoxicity, corneal deposits, photosensitivity, peripheral neuropathy. Check TFTs, LFTs, PFTs regularly."))
    story.append(S(8))

    story.append(Paragraph("Drugs that Prolong QT (TdP Risk)", subsec))
    story.append(make_table(
        ["Category", "Examples"],
        [
            ["Antiarrhythmics", "Sotalol, quinidine, amiodarone, dofetilide"],
            ["Antibiotics", "Clarithromycin, azithromycin, fluoroquinolones, chloroquine"],
            ["Antipsychotics", "Haloperidol, thioridazine, ziprasidone, clozapine"],
            ["Antidepressants", "TCAs (amitriptyline), citalopram"],
            ["Antiemetics", "Ondansetron (high dose IV), metoclopramide, domperidone"],
            ["Others", "Methadone, arsenic trioxide, pentamidine"],
        ],
        col_widths=[5*cm, 12*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Diuretics in Cardiology", subsec))
    story.append(make_table(
        ["Drug", "Mechanism", "Use in Cardiology", "Key Side Effect"],
        [
            ["Furosemide (loop)", "Inhibit Na-K-2Cl in loop of Henle", "ADHF, hypertension, edema", "Hypokalemia, hyponatremia, ototoxicity"],
            ["Spironolactone/Eplerenone", "Aldosterone antagonist", "HFrEF (EF ≤35%), post-MI, resistant HTN", "Hyperkalemia; gynecomastia (spironolactone)"],
            ["Thiazides (HCTZ)", "NaCl cotransporter inhibitor", "Hypertension first-line; mild HF", "Hypokalemia, hyponatremia, hyperuricemia, hyperglycemia"],
            ["Acetazolamide", "Carbonic anhydrase inhibitor", "Altitude sickness; alkalosis in HF", "Metabolic acidosis"],
        ],
        col_widths=[3.5*cm, 4.5*cm, 4.5*cm, 4.5*cm]
    ))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 12: RAPID REVISION TABLE
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 12 — RAPID REVISION: HIGH-YIELD FACTS", HexColor("#1A3A5C")))
    story.append(S(8))

    story.append(make_table(
        ["Fact", "Answer"],
        [
            ["Most common cause of heart failure worldwide", "Ischemic heart disease / Coronary artery disease"],
            ["Gold standard for diagnosing heart failure", "Echocardiography (Echo)"],
            ["BNP level diagnostic of HF", ">400 pg/mL (BNP) or >1000 pg/mL (NT-proBNP)"],
            ["Door-to-balloon time for STEMI (PCI)", "≤90 minutes"],
            ["Door-to-needle time for STEMI (thrombolysis)", "≤30 minutes"],
            ["PCI center transfer time limit (STEMI)", "≤120 min from first medical contact"],
            ["Most common cause of acute MR", "Papillary muscle rupture post-MI (3-7 days)"],
            ["Most common cause of MR overall (developed world)", "Mitral Valve Prolapse (MVP)"],
            ["Most common cause of MS", "Rheumatic fever (worldwide)"],
            ["AS severity: critical valve area", "<0.6 cm²"],
            ["Definitive treatment of AS", "Aortic Valve Replacement (AVR) or TAVI"],
            ["Anticoagulant for mechanical heart valves", "Warfarin (NOACs insufficient; not recommended)"],
            ["Target INR: mitral mechanical valve", "2.5-3.5"],
            ["Target INR: aortic mechanical valve", "2.0-3.0"],
            ["Most common cause of IE in IVDU", "S. aureus (tricuspid valve most affected)"],
            ["IE associated with colon cancer", "Streptococcus bovis (S. gallolyticus)"],
            ["Most common cause of constrictive pericarditis (worldwide)", "Tuberculosis"],
            ["First-line Rx for acute pericarditis", "NSAIDs + Colchicine"],
            ["Tamponade: pathognomonic ECG finding", "Electrical alternans"],
            ["Pathognomonic finding in HCM on Echo", "SAM (Systolic Anterior Motion) of mitral valve"],
            ["Epsilon wave is seen in", "ARVC (Arrhythmogenic RV Cardiomyopathy)"],
            ["Most dangerous antiarrhythmic drug in structural heart disease (pro-arrhythmic)", "Flecainide / Propafenone (class IC - CAST trial)"],
            ["WPW: antidromic tachycardia morphology", "Wide QRS tachycardia (mimics VT)"],
            ["Wenckebach block: location", "AV node (proximal); benign"],
            ["Mobitz II block: location", "Bundle of His (infranodal); dangerous"],
            ["Drug of choice: narrow complex SVT (acute)", "Adenosine IV 6mg (can repeat 12mg)"],
            ["Drug of choice: VT with pulse (acute)", "IV Amiodarone"],
            ["Drug of choice: TdP", "IV Magnesium Sulfate 2g"],
            ["CHA2DS2-VASc when to start OAC in AF", "Score ≥2 (men), ≥3 (women)"],
            ["AF in rheumatic mitral stenosis: anticoagulant", "Warfarin (not NOACs)"],
            ["Hypertensive emergency: first drug if aortic dissection", "IV Labetalol or esmolol + nitroprusside"],
            ["Hypertensive emergency: max MAP reduction in 1 hour", "25% of presenting MAP"],
            ["Best initial test to exclude PE", "D-dimer (if low pre-test probability)"],
            ["ECG sign of massive PE", "S1Q3T3 + sinus tachycardia (most sensitive)"],
        ],
        col_widths=[8.5*cm, 8.5*cm]
    ))
    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # SECTION 13: CLINICAL VIGNETTE PRACTICE
    # ═══════════════════════════════════════════
    story.append(section_banner("SECTION 13 — CLINICAL VIGNETTE PRACTICE (INICET-STYLE)", HexColor("#276749")))
    story.append(S(8))

    vignettes = [
        {
            "q": "Q1. A 68-year-old man presents with 6 months of exertional dyspnea. Exam shows a harsh systolic murmur radiating to the carotids, slow-rising pulse, and reverse splitting of S2. BP 110/80 mmHg. Echo: AV area 0.7 cm², mean gradient 48 mmHg. What is the indication for surgery?",
            "a": "Answer: Severe symptomatic aortic stenosis (mean gradient >40 mmHg, AV area <1.0 cm²) with symptoms of dyspnea (HF). AVR is indicated. This patient has dyspnea + critical AV area (0.7 cm²). TAVI is considered if surgical risk is high.",
            "key": "Key: Severe AS (area <1.0, gradient >40) + ANY symptom (SAP) = Surgery indicated."
        },
        {
            "q": "Q2. A 55-year-old woman with AF presents for cardioversion. AF was detected incidentally 3 days ago. She has no structural heart disease. CHA2DS2-VASc = 0. How do you proceed?",
            "a": "Answer: AF duration >48h (uncertain) - TEE to exclude LAA thrombus, then cardioversion. Since CHA2DS2-VASc = 0 (male; female gets +1 for sex = 1, borderline), if truly score 0 (male), no long-term anticoagulation needed post-cardioversion. Anticoagulate peri-cardioversion as usual. For a female with score = 1 from sex alone, individualize decision.",
            "key": "Key: AF >48h → anticoagulate 3 weeks before OR do TEE before cardioversion. Anticoagulate 4 weeks after regardless."
        },
        {
            "q": "Q3. A 45-year-old man post-STEMI 4 days ago develops sudden severe dyspnea. Exam: loud holosystolic murmur at LLSB, thrill, RV heave, S3. O2 sat 88%. What is the diagnosis and next step?",
            "a": "Answer: Post-MI ventricular septal defect (VSD). Develops 3-7 days post-MI. Holosystolic murmur at LLSB with thrill. Confirmed by Echo showing left-to-right shunt. Urgent surgical repair or percutaneous closure. IABP/mechanical support as bridge.",
            "key": "Key: Post-MI VSD vs acute MR - both cause holosystolic murmur. VSD: LLSB + thrill. MR: apex + radiates to axilla. Echo differentiates."
        },
        {
            "q": "Q4. A 32-year-old woman at 36 weeks gestation develops progressive dyspnea and orthopnea. Echo: EF 30%, dilated LV, no prior cardiac history. Troponin negative. What is the diagnosis and how do you manage?",
            "a": "Answer: Peripartum cardiomyopathy. Dilated cardiomyopathy in last month of pregnancy or within 5 months postpartum. Treat with: Hydralazine + nitrates (not ACEi in pregnancy), beta-blocker (labetalol/metoprolol), diuretics cautiously. Deliver baby if near term. Post-partum: transition to standard GDMT (ACEi, beta-blocker).",
            "key": "Key: Peripartum CM = DCM in late pregnancy/early postpartum. ACEi/ARBs CONTRAINDICATED in pregnancy (teratogenic). Use hydralazine + nitrates instead."
        },
        {
            "q": "Q5. A 28-year-old man collapses during a marathon. He is resuscitated. ECG: RBBB pattern in V1-V3 with coved ST elevation, no ischemic changes. FHx: brother died suddenly at 25. Diagnosis?",
            "a": "Answer: Brugada Syndrome. Type 1 (coved) pattern: downsloping ST elevation >2mm in V1-V3 with RBBB morphology. Autosomal dominant (SCN5A mutation - sodium channel). Triggered by fever, flecainide, cocaine. Treatment: ICD implantation.",
            "key": "Key: Brugada = Coved ST elevation V1-V3 + RBBB pattern + history of sudden death. ICD is the ONLY effective therapy. Fever unmasks the pattern."
        },
        {
            "q": "Q6. An elderly patient on digoxin presents with nausea, xanthopsia (yellow-green vision), and palpitations. ECG: bidirectional VT, AV blocks. K+ = 2.8 mEq/L. Management?",
            "a": "Answer: Digoxin toxicity. Precipitated by hypokalemia. Features: GI (nausea, vomiting), visual (xanthopsia, halos), cardiac (AV blocks, bradycardia, bidirectional VT - pathognomonic). Management: Stop digoxin, correct hypokalemia (IV KCl), Digoxin-specific antibody fragments (Digibind) for life-threatening toxicity. Avoid calcium (worsens toxicity).",
            "key": "Key: Bidirectional VT = digoxin toxicity until proven otherwise. Hypokalemia potentiates digoxin toxicity. Digibind is the antidote."
        },
    ]

    vig_q_style = make_style('VigQ', fontSize=10, textColor=DARK_BLUE,
        fontName='Helvetica-Bold', leading=14, spaceAfter=4, leftIndent=0)
    vig_a_style = make_style('VigA', fontSize=10, textColor=HexColor("#276749"),
        fontName='Helvetica', leading=14, spaceAfter=4, leftIndent=10)
    vig_k_style = make_style('VigK', fontSize=10, textColor=ACCENT_RED,
        fontName='Helvetica-Bold', leading=14, spaceAfter=8, leftIndent=10)

    for i, v in enumerate(vignettes):
        q_data = [[Paragraph(v["q"], vig_q_style)]]
        q_t = Table(q_data, colWidths=[17*cm])
        q_t.setStyle(TableStyle([
            ('BACKGROUND', (0,0), (-1,-1), HexColor("#EBF8FF")),
            ('TOPPADDING', (0,0), (-1,-1), 8),
            ('BOTTOMPADDING', (0,0), (-1,-1), 8),
            ('LEFTPADDING', (0,0), (-1,-1), 10),
            ('BOX', (0,0), (-1,-1), 1, MED_BLUE),
        ]))
        a_data = [[Paragraph(v["a"], vig_a_style)]]
        a_t = Table(a_data, colWidths=[17*cm])
        a_t.setStyle(TableStyle([
            ('BACKGROUND', (0,0), (-1,-1), HexColor("#F0FFF4")),
            ('TOPPADDING', (0,0), (-1,-1), 6),
            ('BOTTOMPADDING', (0,0), (-1,-1), 6),
            ('LEFTPADDING', (0,0), (-1,-1), 14),
            ('BOX', (0,0), (-1,-1), 1, ACCENT_GREEN),
        ]))
        k_data = [[Paragraph(v["key"], vig_k_style)]]
        k_t = Table(k_data, colWidths=[17*cm])
        k_t.setStyle(TableStyle([
            ('BACKGROUND', (0,0), (-1,-1), HexColor("#FFF5F5")),
            ('TOPPADDING', (0,0), (-1,-1), 5),
            ('BOTTOMPADDING', (0,0), (-1,-1), 5),
            ('LEFTPADDING', (0,0), (-1,-1), 10),
            ('BOX', (0,0), (-1,-1), 1, ACCENT_RED),
        ]))
        story.append(KeepTogether([q_t, S(3), a_t, S(3), k_t, S(10)]))

    story.append(PageBreak())

    # ═══════════════════════════════════════════
    # BACK PAGE: STUDY STRATEGY
    # ═══════════════════════════════════════════
    story.append(section_banner("STUDY STRATEGY FOR CARDIOLOGY — INICET", DARK_BLUE))
    story.append(S(10))

    strategy_data = [
        ["Week 1-2", "ECG mastery - practice reading 30 ECGs/day. Know all blocks, ischemia patterns, arrhythmias."],
        ["Week 3-4", "Heart Failure - HFrEF vs HFpEF, GDMT, NYHA, devices. Do 50 HF vignettes."],
        ["Week 5", "ACS - STEMI vs NSTEMI, reperfusion timings, post-MI drugs, complications timeline."],
        ["Week 6", "Arrhythmias - AF, VT, SVT, long QT. Focus on management algorithms."],
        ["Week 7", "Valvular disease - auscultation, severity criteria, surgical indications."],
        ["Week 8", "Pharmacology integration - antiarrhythmics, diuretics, QT-prolonging drugs."],
        ["Ongoing", "Solve 20 INICET/AIIMS previous year cardiology MCQs per day. Review guidelines summaries."],
        ["Final week", "Rapid revision of Section 12 (High-Yield Facts table) and Section 13 vignettes."],
    ]
    strat_k = make_style('SK', fontSize=10, textColor=WHITE, fontName='Helvetica-Bold', alignment=TA_CENTER)
    strat_v = make_style('SV', fontSize=10, textColor=HexColor("#2D3748"), fontName='Helvetica', leading=14)
    s_data = [[Paragraph(r[0], strat_k), Paragraph(r[1], strat_v)] for r in strategy_data]
    s_t = Table(s_data, colWidths=[3*cm, 14*cm])
    s_t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (0,-1), DARK_BLUE),
        ('ROWBACKGROUNDS', (1,0), (1,-1), [WHITE, LIGHT_GRAY]),
        ('GRID', (0,0), (-1,-1), 0.5, GRAY_BORDER),
        ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
        ('TOPPADDING', (0,0), (-1,-1), 8),
        ('BOTTOMPADDING', (0,0), (-1,-1), 8),
        ('LEFTPADDING', (0,0), (-1,-1), 8),
    ]))
    story.append(s_t)
    story.append(S(16))
    story.append(HRFlowable(width="100%", thickness=1.5, color=MED_BLUE, spaceAfter=10))
    story.append(Paragraph(
        "This guide is compiled from Braunwald's Heart Disease | Harrison's Internal Medicine 22e | Goldman-Cecil Medicine | Fuster & Hurst's The Heart 15e | Washington Manual of Medical Therapeutics",
        make_style('Footer', fontSize=8, textColor=HexColor("#718096"),
        fontName='Helvetica-Oblique', alignment=TA_CENTER)
    ))
    story.append(Paragraph(
        "For INICET preparation — July 2026",
        make_style('Footer2', fontSize=8, textColor=HexColor("#A0AEC0"),
        fontName='Helvetica-Oblique', alignment=TA_CENTER)
    ))

    return story


# ── Page Layout with Header/Footer ────────────────────────────────

def add_page_decorations(canvas, doc):
    """Add header and footer to each page (except cover)."""
    canvas.saveState()
    page_num = doc.page
    if page_num == 1:
        canvas.restoreState()
        return

    w, h = A4
    # Header bar
    canvas.setFillColor(DARK_BLUE)
    canvas.rect(1.5*cm, h - 1.3*cm, w - 3*cm, 0.55*cm, fill=1, stroke=0)
    canvas.setFont("Helvetica-Bold", 8)
    canvas.setFillColor(WHITE)
    canvas.drawString(1.8*cm, h - 1.05*cm, "INICET HIGH-YIELD CARDIOLOGY STUDY GUIDE")
    canvas.drawRightString(w - 1.8*cm, h - 1.05*cm, "Braunwald's · Harrison's · Goldman-Cecil")

    # Footer
    canvas.setFillColor(MED_BLUE)
    canvas.rect(1.5*cm, 0.8*cm, w - 3*cm, 0.4*cm, fill=1, stroke=0)
    canvas.setFont("Helvetica", 8)
    canvas.setFillColor(WHITE)
    canvas.drawString(1.8*cm, 0.93*cm, "Cardiology | INICET Medicine")
    canvas.drawRightString(w - 1.8*cm, 0.93*cm, f"Page {page_num}")

    canvas.restoreState()


# ── Build PDF ─────────────────────────────────────────────────────

def build():
    doc = SimpleDocTemplate(
        OUTPUT_PATH,
        pagesize=A4,
        rightMargin=2*cm,
        leftMargin=2*cm,
        topMargin=2*cm,
        bottomMargin=1.8*cm,
        title="INICET High-Yield Cardiology Study Guide",
        author="Orris Medical AI",
        subject="INICET Medicine - Cardiology",
    )
    story = build_story()
    doc.build(story, onFirstPage=add_page_decorations, onLaterPages=add_page_decorations)
    print(f"PDF saved: {OUTPUT_PATH}")

if __name__ == "__main__":
    build()
Running Command

cd /home/daytona/workspace/inicet-cardiology && python generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/inicet-cardiology/INICET_Cardiology_HighYield.pdf

Your INICET High-Yield Cardiology Study Guide PDF is ready:

INICET Cardiology HighYield

PDF Document · PDF


What's inside (13 sections):
SectionContent
1Exam overview - Cardiology's weight in INICET, expected question counts
2ECG Patterns - Normal values, STEMI localisation, BBB, heart blocks, classic ECG findings
3Heart Failure - HFrEF/HFmrEF/HFpEF, GDMT 4 pillars, devices (ICD/CRT), ADHF
4ACS / STEMI - Classification, reperfusion timings, thrombolysis contraindications, post-MI drugs, MI complications timeline
5Arrhythmias - AF (CHA2DS2-VASc, rate vs rhythm), VT vs SVT, Long QT / TdP, WPW
6Hypertension - Staging, compelling indications, hypertensive emergencies
7Valvular Heart Disease - Auscultation guide, AS severity, surgical indications
8Pericarditis / Tamponade - Beck's triad, ECG stages, constrictive vs restrictive
9Cardiomyopathies - DCM, HCM, RCM, ARVC, Peripartum CM
10Infective Endocarditis - Duke criteria, organisms, peripheral signs (Osler vs Janeway)
11Cardiac Pharmacology - Vaughan Williams classes, QT-prolonging drugs, diuretics
12Rapid Revision Table - 34 high-yield facts in Q&A format
136 INICET-style clinical vignettes with detailed answers and key takeaways
Sources: Braunwald's Heart Disease, Harrison's Internal Medicine 22e, Goldman-Cecil Medicine, Fuster & Hurst's The Heart 15e, Washington Manual.

Similarly can u give it for Neurology

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Writing File

~/inicet-neurology/generate_neuro_pdf.py

#!/usr/bin/env python3
"""INICET High-Yield Neurology Study Guide PDF Generator"""

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, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.lib.colors import HexColor
import os

os.makedirs("/home/daytona/workspace/inicet-neurology", exist_ok=True)
OUTPUT_PATH = "/home/daytona/workspace/inicet-neurology/INICET_Neurology_HighYield.pdf"

# ── Color Palette ─────────────────────────────────────────────────
DARK_NAVY   = HexColor("#1A2A4A")
MED_BLUE    = HexColor("#2B6CB0")
LIGHT_BLUE  = HexColor("#EBF8FF")
ACCENT_RED  = HexColor("#C53030")
DARK_GREEN  = HexColor("#276749")
TEAL        = HexColor("#2C7A7B")
PURPLE      = HexColor("#553C9A")
ORANGE      = HexColor("#C05621")
GRAY_BG     = HexColor("#F7FAFC")
LIGHT_GRAY  = HexColor("#EDF2F7")
GRAY_BORDER = HexColor("#CBD5E0")
WHITE       = colors.white
BLACK       = colors.black
INDIGO      = HexColor("#434190")
WINE        = HexColor("#702459")

# ── Styles ────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def ms(name, parent='Normal', **kw):
    return ParagraphStyle(name=name, parent=styles[parent], **kw)

sec_header = ms('SH', fontSize=17, textColor=WHITE, fontName='Helvetica-Bold',
    alignment=TA_LEFT, leading=22, spaceBefore=4, spaceAfter=4, leftIndent=0)
subsec     = ms('SS', fontSize=13, textColor=DARK_NAVY, fontName='Helvetica-Bold',
    spaceBefore=10, spaceAfter=4, leading=17)
body       = ms('BD', fontSize=10, textColor=HexColor("#2D3748"), fontName='Helvetica',
    leading=15, spaceAfter=4, alignment=TA_JUSTIFY)
bullet     = ms('BL', fontSize=10, textColor=HexColor("#2D3748"), fontName='Helvetica',
    leading=14, spaceAfter=3, leftIndent=14, bulletIndent=4)
keyfact    = ms('KF', fontSize=10, textColor=ACCENT_RED, fontName='Helvetica-Bold',
    leading=14, spaceAfter=3, leftIndent=14)
mnemonic   = ms('MN', fontSize=11, textColor=TEAL, fontName='Helvetica-Bold',
    leading=16, spaceAfter=3, leftIndent=10)
th_style   = ms('TH', fontSize=9, textColor=WHITE, fontName='Helvetica-Bold',
    alignment=TA_CENTER, leading=13)
td_style   = ms('TD', fontSize=9, textColor=HexColor("#2D3748"), fontName='Helvetica',
    alignment=TA_LEFT, leading=13)
warn_s     = ms('WS', fontSize=10, textColor=HexColor("#7B341E"), fontName='Helvetica-Bold',
    leading=14, leftIndent=8, rightIndent=8)
note_s     = ms('NS', fontSize=9.5, textColor=HexColor("#234E52"), fontName='Helvetica-Oblique',
    leading=14, leftIndent=8, rightIndent=8)

# ── Helpers ───────────────────────────────────────────────────────
def banner(title, color=DARK_NAVY):
    t = Table([[Paragraph(title, sec_header)]], colWidths=[17*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), color),
        ('TOPPADDING', (0,0), (-1,-1), 8),
        ('BOTTOMPADDING', (0,0), (-1,-1), 8),
        ('LEFTPADDING', (0,0), (-1,-1), 14),
    ]))
    return t

def warn(text, bg=HexColor("#FFF5F5"), border=ACCENT_RED):
    t = Table([[Paragraph(f"⚠  {text}", warn_s)]], colWidths=[17*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), bg),
        ('TOPPADDING', (0,0), (-1,-1), 6), ('BOTTOMPADDING', (0,0), (-1,-1), 6),
        ('LEFTPADDING', (0,0), (-1,-1), 10),
        ('BOX', (0,0), (-1,-1), 1.2, border),
    ]))
    return t

def note(text, bg=HexColor("#E6FFFA"), border=TEAL):
    t = Table([[Paragraph(f"💡  {text}", note_s)]], colWidths=[17*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), bg),
        ('TOPPADDING', (0,0), (-1,-1), 6), ('BOTTOMPADDING', (0,0), (-1,-1), 6),
        ('LEFTPADDING', (0,0), (-1,-1), 10),
        ('BOX', (0,0), (-1,-1), 1.2, border),
    ]))
    return t

def mbox(title, items, bg=HexColor("#FAF5FF"), border=PURPLE):
    rows = [[Paragraph(f"🧠  {title}", mnemonic)]]
    for item in items:
        rows.append([Paragraph(f"  {item}", bullet)])
    t = Table(rows, colWidths=[17*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), bg),
        ('TOPPADDING', (0,0), (-1,-1), 4), ('BOTTOMPADDING', (0,0), (-1,-1), 4),
        ('LEFTPADDING', (0,0), (-1,-1), 10),
        ('BOX', (0,0), (-1,-1), 1.5, border),
    ]))
    return t

def tbl(headers, rows, col_widths=None):
    if col_widths is None:
        w = 17*cm / len(headers)
        col_widths = [w]*len(headers)
    data = [[Paragraph(h, th_style) for h in headers]]
    for row in rows:
        data.append([Paragraph(str(c), td_style) for c in row])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,0), MED_BLUE),
        ('ROWBACKGROUNDS', (0,1), (-1,-1), [WHITE, LIGHT_GRAY]),
        ('GRID', (0,0), (-1,-1), 0.5, GRAY_BORDER),
        ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
        ('TOPPADDING', (0,0), (-1,-1), 5),
        ('BOTTOMPADDING', (0,0), (-1,-1), 5),
        ('LEFTPADDING', (0,0), (-1,-1), 6),
    ]))
    return t

def bp(text): return Paragraph(f"• {text}", bullet)
def kf(text): return Paragraph(f"★  {text}", keyfact)
def S(n=6):   return Spacer(1, n)

# ── Build Story ───────────────────────────────────────────────────
def build_story():
    story = []

    # ══════════ COVER ══════════
    top = Table([[Paragraph("INICET", ms('CT', fontSize=32, textColor=WHITE,
        fontName='Helvetica-Bold', alignment=TA_CENTER, leading=40))]], colWidths=[17*cm])
    top.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),DARK_NAVY),
        ('TOPPADDING',(0,0),(-1,-1),40),('BOTTOMPADDING',(0,0),(-1,-1),10),
        ('LEFTPADDING',(0,0),(-1,-1),20),('RIGHTPADDING',(0,0),(-1,-1),20)]))
    story.append(top)

    sub = Table([[Paragraph("HIGH-YIELD NEUROLOGY", ms('CN', fontSize=22,
        textColor=DARK_NAVY, fontName='Helvetica-Bold', alignment=TA_CENTER, leading=28))]], colWidths=[17*cm])
    sub.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),LIGHT_BLUE),
        ('TOPPADDING',(0,0),(-1,-1),14),('BOTTOMPADDING',(0,0),(-1,-1),14)]))
    story.append(sub)

    story.append(S(12))
    story.append(Paragraph("STUDY GUIDE", ms('SG', fontSize=28, textColor=DARK_NAVY,
        fontName='Helvetica-Bold', alignment=TA_CENTER, leading=34)))
    story.append(S(6))
    story.append(Paragraph("Clinical Vignette-Focused | Guideline-Based | INICET Pattern",
        ms('CV', fontSize=12, textColor=MED_BLUE, fontName='Helvetica-Oblique', alignment=TA_CENTER)))
    story.append(S(10))
    story.append(HRFlowable(width="80%", thickness=2, color=MED_BLUE, spaceAfter=10))

    badge_s = ms('BS', fontSize=10, textColor=WHITE, fontName='Helvetica-Bold', alignment=TA_CENTER)
    for row in [["Stroke", "Epilepsy", "Meningitis", "Headache"],
                ["Parkinson's", "Multiple Sclerosis", "GBS", "Myasthenia Gravis"]]:
        bt = Table([[Paragraph(r, badge_s) for r in row]], colWidths=[4.25*cm]*4)
        bt.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),MED_BLUE),
            ('TOPPADDING',(0,0),(-1,-1),6),('BOTTOMPADDING',(0,0),(-1,-1),6),
            ('GRID',(0,0),(-1,-1),1,WHITE)]))
        story.append(bt); story.append(S(4))

    story.append(S(16))
    story.append(Paragraph(
        "Sources: Bradley & Daroff's Neurology | Adams & Victor's Principles of Neurology | Plum & Posner's Stupor and Coma",
        ms('Src', fontSize=8.5, textColor=HexColor("#718096"), fontName='Helvetica-Oblique', alignment=TA_CENTER)))
    story.append(Paragraph(
        "Harrison's Internal Medicine 22e | Tintinalli's Emergency Medicine | Goodman & Gilman's Pharmacology",
        ms('Src2', fontSize=8.5, textColor=HexColor("#718096"), fontName='Helvetica-Oblique', alignment=TA_CENTER)))
    story.append(PageBreak())

    # ══════════ S1: EXAM OVERVIEW ══════════
    story.append(banner("SECTION 1 — NEUROLOGY IN INICET: EXAM OVERVIEW", MED_BLUE))
    story.append(S(8))
    story.append(Paragraph("Neurology's Weight in INICET Medicine", subsec))
    story.append(bp("Neurology = 3rd highest contributor to Medicine questions after Cardiology and Endocrinology"))
    story.append(bp("Approx 4-6 questions per session; rising trend with clinical vignette emphasis"))
    story.append(bp("INICET strongly favors clinical scenario questions: 'A 60-yr-old presents with sudden weakness…'"))
    story.append(bp("Image-based questions: CT head (bleed vs infarct), MRI patterns, fundoscopy"))
    story.append(S(6))
    story.append(tbl(
        ["Sub-topic", "Qs/Session", "Priority"],
        [
            ["Stroke (ischemic + hemorrhagic)", "1-2", "MUST MASTER"],
            ["Epilepsy / Status Epilepticus", "1-2", "Very High"],
            ["Meningitis / Encephalitis (CSF analysis)", "1", "Very High"],
            ["Headache (migraine, cluster, SAH)", "1", "High"],
            ["Parkinson's Disease", "1", "High"],
            ["Multiple Sclerosis", "1", "High"],
            ["GBS / CIDP", "1", "High"],
            ["Myasthenia Gravis", "1", "Moderate"],
            ["Dementia (Alzheimer's, etc.)", "0-1", "Moderate"],
            ["Neuromuscular / Peripheral neuropathy", "0-1", "Moderate"],
        ],
        col_widths=[7.5*cm, 3*cm, 6.5*cm]
    ))
    story.append(S(6))
    story.append(note("INICET tests MANAGEMENT more than pure diagnosis in neurology. Know drug doses, contraindications, and timelines cold."))
    story.append(PageBreak())

    # ══════════ S2: STROKE ══════════
    story.append(banner("SECTION 2 — STROKE (ISCHEMIC & HEMORRHAGIC)", ACCENT_RED))
    story.append(S(8))
    story.append(Paragraph("Classification of Stroke", subsec))
    story.append(tbl(
        ["Type", "Mechanism", "CT Findings", "Onset / Clues"],
        [
            ["Ischemic (87%)", "Thrombotic (large vessel), embolic, lacunar, cryptogenic",
             "Normal in first 6-12h; hypodensity/infarct later; dense MCA sign",
             "Sudden focal deficit; AF/carotid disease risk factors"],
            ["Intracerebral Hemorrhage (ICH, 10%)", "Hypertension (#1), amyloid angiopathy, AVM",
             "Hyperdense (bright) lesion; usually in basal ganglia/thalamus/pons",
             "Sudden onset; HTN; headache + focal deficit"],
            ["Subarachnoid Hemorrhage (SAH, 3%)", "Ruptured berry aneurysm (#1); AVM",
             "Blood in cisterns/sulci; LP if CT negative (xanthochromia)",
             "'Thunderclap' worst headache of life; meningism"],
        ],
        col_widths=[3.5*cm, 5*cm, 4.5*cm, 4*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Ischemic Stroke — Acute Management", subsec))
    story.append(kf("IV alteplase (tPA) 0.9 mg/kg (max 90 mg): 10% as bolus + 90% over 60 min. Approved within 3 hours (selected patients up to 4.5 hours)."))
    story.append(S(4))
    story.append(tbl(
        ["Time Window", "Intervention", "Notes"],
        [
            ["0-3 hours", "IV tPA (all eligible patients)", "Door-to-needle goal: ≤60 min"],
            ["0-4.5 hours", "IV tPA (selected: NIHSS ≤25, no DM+prior stroke, no anticoagulation)", "Extended window (ECASS-III trial)"],
            ["0-24 hours", "Mechanical thrombectomy (large vessel occlusion)", "ASPECTS score ≥6; LVO on CTA; perfusion mismatch"],
            ["Up to 6 hours", "Mechanical thrombectomy (standard)", "ICA, M1/M2 MCA occlusion"],
            [">24 hours", "Thrombectomy in selected patients", "MR CLEAN LATE, DAWN trial criteria"],
        ],
        col_widths=[3*cm, 5.5*cm, 8.5*cm]
    ))
    story.append(S(6))

    story.append(Paragraph("Contraindications to IV tPA", subsec))
    story.append(tbl(
        ["Absolute Contraindications", "Relative Contraindications"],
        [
            ["Intracranial hemorrhage on CT", "Seizure at stroke onset"],
            ["Ischemic stroke within 3 months", "Major surgery within 14 days"],
            ["SBP >185 or DBP >110 mmHg (must treat first)", "GI/urinary bleed within 21 days"],
            ["Active internal bleeding", "MI within 3 months"],
            ["Platelets <100,000; INR >1.7; aPTT >40s", "Rapidly improving stroke (resolving)"],
            ["Blood glucose <50 or >400 mg/dL", "Recent lumbar puncture"],
        ],
        col_widths=[8.5*cm, 8.5*cm]
    ))
    story.append(S(6))
    story.append(warn("Blood pressure MUST be ≤185/110 before tPA administration. Target BP <180/105 during and 24h after tPA. Do NOT use antiplatelets/anticoagulants for 24h post-tPA."))
    story.append(S(8))

    story.append(Paragraph("Stroke Syndromes — Localization", subsec))
    story.append(tbl(
        ["Artery / Region", "Classic Syndrome", "Key Features"],
        [
            ["MCA (dominant)", "Contralateral hemiplegia (arm > leg), hemisensory loss, aphasia (Broca/Wernicke)", "Most common stroke territory"],
            ["MCA (non-dominant)", "Contralateral hemiplegia, hemisensory, hemispatial neglect, anosognosia", "Patient unaware of deficit"],
            ["ACA", "Contralateral leg weakness > arm; urinary incontinence; abulia", "Frontal lobe involvement"],
            ["PCA", "Homonymous hemianopia (macular sparing); thalamic pain; memory deficits", "Occipital + thalamic"],
            ["PICA (Wallenberg/Lateral medullary)", "Ipsilateral face + Horner's; contralateral body pain/temp loss; dysphagia, vertigo, nystagmus", "Crossed sensory deficits"],
            ["Basilar artery", "Locked-in syndrome; coma; quadriplegia; CN palsies", "Pontine infarct - emergency"],
            ["Lacunar (small vessel)", "Pure motor, pure sensory, ataxic hemiplegia, dysarthria-clumsy hand", "HTN/DM; internal capsule/pons/thalamus"],
        ],
        col_widths=[3.5*cm, 6.5*cm, 7*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Subarachnoid Hemorrhage (SAH)", subsec))
    story.append(bp("Thunderclap headache — 'worst headache of life,' reaching maximum intensity in <1 min"))
    story.append(bp("CT head (non-contrast): hyperdense blood in basal cisterns — sensitivity 98% within 12 hours"))
    story.append(bp("If CT negative and clinical suspicion high: LP for xanthochromia (yellow CSF) ≥2h after onset"))
    story.append(bp("Grading: Hunt & Hess scale (clinical); Fisher scale (CT blood burden)"))
    story.append(bp("Cause: Ruptured berry (saccular) aneurysm ~85% — common sites: ACoA, PCoA, MCA bifurcation"))
    story.append(kf("Management: Nimodipine (60mg q4h x 21 days) to prevent vasospasm. Secure aneurysm: coiling (endovascular) or surgical clipping."))
    story.append(S(4))
    story.append(note("Re-bleeding highest within 24h (20%) and first 2 weeks. Prevent with BP control (SBP <160). Hydrocephalus = late complication → EVD/shunt."))
    story.append(PageBreak())

    # ══════════ S3: EPILEPSY ══════════
    story.append(banner("SECTION 3 — EPILEPSY & STATUS EPILEPTICUS", PURPLE))
    story.append(S(8))

    story.append(Paragraph("Classification of Seizures (ILAE 2017)", subsec))
    story.append(tbl(
        ["Type", "Subtype", "Features"],
        [
            ["Focal (Partial)", "Focal aware (simple partial)", "Consciousness preserved; motor/sensory/autonomic/psychic"],
            ["Focal", "Focal impaired awareness (complex partial)", "Impaired consciousness; automatisms; post-ictal confusion"],
            ["Focal", "Focal to bilateral tonic-clonic", "Secondary generalization"],
            ["Generalized", "Absence", "Brief (<30s); staring; 3 Hz spike-wave on EEG; no post-ictal state"],
            ["Generalized", "Myoclonic", "Sudden brief muscle jerks; morning; JME"],
            ["Generalized", "Tonic-clonic (GTCS)", "Tonic phase then clonic; post-ictal confusion"],
            ["Generalized", "Atonic (drop attacks)", "Sudden loss of tone; falls; Lennox-Gastaut"],
            ["Unknown onset", "Epileptic spasm", "Infantile spasms (West syndrome)"],
        ],
        col_widths=[3*cm, 5*cm, 9*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Antiepileptic Drug Choice", subsec))
    story.append(tbl(
        ["Seizure Type / Syndrome", "First-Line Drug(s)", "Avoid"],
        [
            ["Focal seizures", "Carbamazepine, Lamotrigine, Levetiracetam, Oxcarbazepine", "—"],
            ["Generalized tonic-clonic (GTCS)", "Valproate, Lamotrigine, Levetiracetam", "Carbamazepine may worsen absence"],
            ["Absence seizures", "Ethosuximide (#1), Valproate, Lamotrigine", "Carbamazepine, Phenytoin, Vigabatrin"],
            ["Juvenile Myoclonic Epilepsy (JME)", "Valproate (#1), Levetiracetam, Lamotrigine", "Carbamazepine, Oxcarbazepine"],
            ["West Syndrome (Infantile spasms)", "ACTH, Vigabatrin (for TSC)", "—"],
            ["Lennox-Gastaut Syndrome", "Valproate + Clobazam; Rufinamide", "—"],
            ["Trigeminal neuralgia (not epilepsy, but test favorite)", "Carbamazepine (#1 drug)", "—"],
        ],
        col_widths=[5*cm, 6*cm, 6*cm]
    ))
    story.append(S(6))
    story.append(tbl(
        ["Drug", "Key Side Effects / Notes"],
        [
            ["Valproate", "Hepatotoxicity, pancreatitis, neural tube defects (teratogenic - AVOID in pregnancy), weight gain, tremor, hair loss, thrombocytopenia"],
            ["Carbamazepine", "Aplastic anemia, SIADH, Stevens-Johnson syndrome (HLA-B*1502 in Asians), enzyme inducer"],
            ["Phenytoin", "Gingival hyperplasia, hirsutism, ataxia, nystagmus, folate deficiency, teratogen (fetal hydantoin syndrome), zero-order kinetics"],
            ["Lamotrigine", "Stevens-Johnson syndrome (if titrated rapidly); safe in pregnancy relative to others"],
            ["Levetiracetam", "Behavioral/psychiatric (irritability, depression); well tolerated overall; renal clearance"],
            ["Ethosuximide", "Absence only; GI side effects; SLE-like syndrome"],
            ["Vigabatrin", "Irreversible visual field defects; used in infantile spasms (TSC)"],
            ["Phenobarbital", "Sedation; enzyme inducer; neonatal seizures IV"],
        ],
        col_widths=[3.5*cm, 13.5*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Status Epilepticus — Management Protocol", subsec))
    story.append(kf("Definition: Seizure lasting >5 minutes OR ≥2 seizures without recovery between them."))
    story.append(S(4))
    story.append(tbl(
        ["Time", "Intervention", "Drug / Dose"],
        [
            ["0-5 min", "Stabilize: ABC, O2, IV access, glucose, thiamine", "Glucose 50 mL of 50% dextrose; Thiamine 100 mg IV (before glucose in alcoholics)"],
            ["5-20 min (Phase 1)", "Benzodiazepine — FIRST LINE", "Lorazepam IV 0.1 mg/kg (max 4mg) OR Diazepam IV/PR OR Midazolam IM/buccal"],
            ["20-40 min (Phase 2)", "Antiepileptic loading (if benzo failed)", "Levetiracetam 60 mg/kg IV OR Valproate 40 mg/kg IV OR Fosphenytoin 20 mg PE/kg IV"],
            ["40-60 min (Phase 3)", "Refractory SE — Anesthesia/intubation", "Propofol infusion OR Midazolam infusion OR Thiopental / Pentobarbital coma"],
            [">60 min", "Super-refractory SE — consider EEG monitoring, ICU", "Ketamine, immunotherapy (steroids, IVIG) if immune-mediated suspected"],
        ],
        col_widths=[2.5*cm, 4*cm, 10.5*cm]
    ))
    story.append(S(6))
    story.append(warn("In alcoholics/malnourished: ALWAYS give thiamine BEFORE glucose to prevent Wernicke's encephalopathy precipitation."))
    story.append(PageBreak())

    # ══════════ S4: MENINGITIS & ENCEPHALITIS ══════════
    story.append(banner("SECTION 4 — MENINGITIS & ENCEPHALITIS", TEAL))
    story.append(S(8))

    story.append(Paragraph("CSF Analysis — Quick Reference", subsec))
    story.append(tbl(
        ["Parameter", "Normal", "Bacterial", "Viral", "TB / Fungal", "SAH"],
        [
            ["Opening pressure", "70-200 mmH₂O", "↑↑", "Normal/↑", "↑", "↑"],
            ["Appearance", "Clear", "Turbid/purulent", "Clear", "Turbid/xanthochromic", "Xanthochromic"],
            ["WBC (/mm³)", "<5", "1000-10,000 (PMN)", "50-1000 (lympho)", "100-500 (lympho)", "RBCs present"],
            ["Protein (mg/dL)", "15-45", ">100 (very high)", "50-100 (mild ↑)", "100-500", "Elevated"],
            ["Glucose (mg/dL)", "50-80 (2/3 of serum)", "<40 (very low)", "Normal", "<45 (low)", "Normal"],
            ["CSF:Serum glucose", ">0.6", "<0.4", ">0.6", "<0.4", "Normal"],
            ["Gram stain", "Negative", "Positive in 70-90%", "Negative", "Negative (AFB +/-)", "Negative"],
        ],
        col_widths=[3*cm, 2.5*cm, 3*cm, 3*cm, 3*cm, 2.5*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Bacterial Meningitis — Organisms by Age", subsec))
    story.append(tbl(
        ["Age Group", "Common Organisms", "Empiric Antibiotic"],
        [
            ["Neonates (<1 month)", "GBS (S. agalactiae), E. coli, Listeria monocytogenes", "Ampicillin + Cefotaxime (± Gentamicin)"],
            ["1-3 months", "GBS, E. coli, S. pneumoniae, H. influenzae, Listeria", "Ampicillin + Cefotaxime/Ceftriaxone"],
            ["Children 3mo - 18y", "S. pneumoniae, N. meningitidis", "Ceftriaxone + Vancomycin"],
            ["Adults 18-50y", "S. pneumoniae (#1), N. meningitidis", "Ceftriaxone + Vancomycin + Dexamethasone"],
            ["Elderly (>50y) / Immunocompromised", "S. pneumoniae, N. meningitidis, Listeria, Gram-negatives", "Ampicillin + Ceftriaxone + Vancomycin"],
            ["Post-neurosurgery / Hospital-acquired", "S. aureus, Gram-negatives (Pseudomonas)", "Vancomycin + Ceftazidime/Meropenem"],
        ],
        col_widths=[3.5*cm, 6*cm, 7.5*cm]
    ))
    story.append(S(6))
    story.append(kf("Dexamethasone 0.15 mg/kg q6h x 4 days: Give BEFORE or WITH first antibiotic dose in suspected pneumococcal meningitis. Reduces hearing loss and neurological sequelae."))
    story.append(S(4))
    story.append(note("LP contraindicated if: papilledema, focal neuro deficits, altered consciousness, immunocompromised, recent seizure → CT head first then LP."))
    story.append(S(8))

    story.append(Paragraph("Encephalitis — Viral Causes & Key Features", subsec))
    story.append(tbl(
        ["Virus", "Classic Feature", "Treatment"],
        [
            ["HSV-1 (most common in adults)", "Temporal lobe encephalitis; temporal lobe hemorrhagic changes on MRI/CT; Cowdry A inclusions", "Acyclovir IV 10 mg/kg q8h x 14-21 days"],
            ["HSV-2 (neonates)", "Disseminated; meningoencephalitis", "Acyclovir IV x 21 days"],
            ["CMV", "Immunocompromised (AIDS); periventricular enhancement; retinitis", "Ganciclovir / Valganciclovir"],
            ["EBV", "Lymphocytic meningitis; Monospot test positive; atypical lymphocytes", "Supportive (steroids if severe)"],
            ["Rabies", "Hydrophobia, aerophobia, Negri bodies in hippocampus/cerebellum", "Pre/post-exposure prophylaxis; no cure once symptoms develop"],
            ["Japanese Encephalitis (JE)", "Asia; Culex mosquito; basal ganglia involvement; Eosinophilic intranuclear inclusions", "Supportive; JE vaccine available"],
            ["NMDA-receptor encephalitis (autoimmune)", "Young women; psychiatric symptoms → seizures → autonomic instability; ovarian teratoma", "IV methylprednisolone + IVIG; tumor removal"],
        ],
        col_widths=[4*cm, 7*cm, 6*cm]
    ))
    story.append(PageBreak())

    # ══════════ S5: HEADACHE ══════════
    story.append(banner("SECTION 5 — HEADACHE DISORDERS", ORANGE))
    story.append(S(8))

    story.append(Paragraph("Headache Classification — Key Differentials", subsec))
    story.append(tbl(
        ["Type", "Character", "Duration", "Associated Features", "Treatment"],
        [
            ["Migraine without aura", "Unilateral, throbbing, moderate-severe", "4-72 hours", "Nausea, vomiting, photophobia, phonophobia; worsened by activity",
             "Acute: Triptans (#1), NSAIDs, ergotamine\nProphylaxis: Propranolol, Topiramate, Valproate, Amitriptyline"],
            ["Migraine with aura", "Same + aura (visual—scotoma, zigzag; sensory; speech)",
             "Aura: 20-60 min", "Aura precedes headache", "Same; Triptans contraindicated in hemiplegic migraine"],
            ["Tension-type", "Bilateral, pressure/tightening, mild-moderate", "30 min - 7 days", "No nausea/vomiting; no aura; not worsened by activity",
             "Acute: NSAIDs, paracetamol\nProphylaxis: Amitriptyline"],
            ["Cluster", "Severe unilateral periorbital/temporal; boring/stabbing", "15-180 min; 1-8/day in clusters", "Ipsilateral: lacrimation, rhinorrhea, conjunctival injection, ptosis, miosis (Horner's), restlessness",
             "Acute: 100% O₂ 15 L/min (first-line), SC sumatriptan\nProphylaxis: Verapamil (#1), short-course steroids"],
            ["SAH", "Thunderclap — peaks in seconds", "Persistent", "Meningism, vomiting, LOC, seizure",
             "EMERGENCY — see stroke section"],
            ["Idiopathic Intracranial HTN (IIH)", "Bilateral, worse morning, posture; pulsatile tinnitus", "Daily/chronic", "Papilledema; visual obscurations; obese young women; empty sella",
             "Weight loss; Acetazolamide (#1); LP (therapeutic); ventriculo-peritoneal shunt"],
        ],
        col_widths=[3*cm, 3.5*cm, 2.5*cm, 4*cm, 4*cm]
    ))
    story.append(S(6))
    story.append(warn("Red flags in headache (SNOPP): Sudden onset, New pattern in >50y, Onset with exertion/Valsalva, Progressive worsening, Postural component, Papilledema — ALL require urgent workup."))
    story.append(S(6))
    story.append(kf("Cluster headache: Males >> females (3:1); alcohol is a classic trigger during cluster period. Verapamil is first-line prophylaxis — check ECG before starting."))
    story.append(PageBreak())

    # ══════════ S6: PARKINSON'S DISEASE ══════════
    story.append(banner("SECTION 6 — PARKINSON'S DISEASE & MOVEMENT DISORDERS", HexColor("#6B46C1")))
    story.append(S(8))

    story.append(Paragraph("Parkinson's Disease — Core Features", subsec))
    story.append(mbox(
        "Cardinal Features of Parkinson's Disease — TRAP",
        ["T — Tremor (resting, pill-rolling, 4-6 Hz; disappears with movement)",
         "R — Rigidity (cogwheel or lead-pipe)",
         "A — Akinesia / Bradykinesia (slowness; micrographia; hypophonia)",
         "P — Postural instability (late feature; fall risk)"]
    ))
    story.append(S(6))
    story.append(tbl(
        ["Feature", "Parkinson's Disease", "Essential Tremor", "Cerebellar Tremor"],
        [
            ["Tremor type", "Resting (4-6 Hz)", "Action/postural (8-12 Hz)", "Intention (worsens toward target)"],
            ["Relieved by", "Movement", "Alcohol, beta-blockers", "Nothing"],
            ["Associated features", "Rigidity, bradykinesia, freezing", "Head/voice tremor; FHx", "Dysmetria, dysdiadochokinesia, nystagmus"],
            ["Treatment", "Levodopa/Carbidopa", "Propranolol, Primidone", "Treat underlying cause"],
        ],
        col_widths=[3.5*cm, 4.5*cm, 4.5*cm, 4.5*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Parkinson's Disease — Drug Therapy", subsec))
    story.append(tbl(
        ["Drug / Class", "Mechanism", "Notes"],
        [
            ["Levodopa + Carbidopa (Sinemet)", "L-DOPA crosses BBB; carbidopa blocks peripheral conversion",
             "Most effective drug; gold standard. Side effects: dyskinesia (long-term), on-off phenomenon, nausea, hallucinations"],
            ["Dopamine agonists: Pramipexole, Ropinirole, Rotigotine",
             "D2/D3 receptor agonists",
             "Used early or add-on; avoid in elderly (hallucinations, impulse control disorders)"],
            ["MAO-B inhibitors: Selegiline, Rasagiline",
             "Inhibit MAO-B → ↑ synaptic dopamine",
             "Mild; may slow disease progression; tyramine interaction (like MAO-A; less risk)"],
            ["COMT inhibitors: Entacapone, Tolcapone",
             "Block dopamine breakdown; extend levodopa effect",
             "Tolcapone: hepatotoxic (monitor LFTs); Entacapone: safer"],
            ["Amantadine",
             "↑ dopamine release; NMDA antagonist",
             "Used for drug-induced dyskinesia; early PD; antiviral (influenza A)"],
            ["Anticholinergics: Trihexyphenidyl, Benztropine",
             "Reduce cholinergic activity",
             "For tremor in young patients; AVOID in elderly (confusion, urinary retention, glaucoma)"],
        ],
        col_widths=[4*cm, 4*cm, 9*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Parkinson-Plus Syndromes (Atypical Parkinsonism)", subsec))
    story.append(tbl(
        ["Syndrome", "Key Distinguishing Features", "Response to Levodopa"],
        [
            ["Progressive Supranuclear Palsy (PSP)",
             "Vertical gaze palsy (downward first); axial rigidity; frequent falls backward; 'surprised expression'; midbrain atrophy ('hummingbird sign' on MRI)",
             "Poor"],
            ["Multiple System Atrophy (MSA)",
             "Parkinsonism + autonomic failure (orthostatic hypotension, impotence, incontinence) + cerebellar ataxia; 'hot cross bun sign' on MRI pons",
             "Poor/transient"],
            ["Corticobasal Syndrome (CBS)",
             "Asymmetric rigidity + apraxia; 'alien limb' phenomenon; cortical sensory loss; myoclonus",
             "Poor"],
            ["Lewy Body Dementia (DLB)",
             "Dementia before or within 1 year of parkinsonism; visual hallucinations; REM sleep behavior disorder; fluctuating cognition",
             "Moderate; AVOID antipsychotics (severe neuroleptic sensitivity)"],
            ["Drug-induced Parkinsonism",
             "Metoclopramide, haloperidol, reserpine; symmetric; no resting tremor usually",
             "Resolves with drug withdrawal"],
        ],
        col_widths=[3.5*cm, 8.5*cm, 5*cm]
    ))
    story.append(PageBreak())

    # ══════════ S7: MULTIPLE SCLEROSIS ══════════
    story.append(banner("SECTION 7 — MULTIPLE SCLEROSIS (MS)", INDIGO))
    story.append(S(8))
    story.append(Paragraph("MS — Key Concepts", subsec))
    story.append(bp("Demyelinating disease of CNS; young women (F:M = 2:1); temperate > tropical; HLA-DR2 association"))
    story.append(bp("Pathology: Periventricular plaques; Dawson's fingers (periventricular demyelination perpendicular to ventricles) on MRI"))
    story.append(bp("Criterion: Dissemination in SPACE (multiple CNS regions) and TIME (multiple episodes) — McDonald Criteria"))
    story.append(S(6))
    story.append(tbl(
        ["Course Type", "Features", "% of Cases"],
        [
            ["Relapsing-Remitting (RRMS)", "Discrete attacks with full/partial recovery; most common; good response to DMT", "85%"],
            ["Secondary Progressive (SPMS)", "RRMS that becomes progressively worsening; less relapses over time", "—"],
            ["Primary Progressive (PPMS)", "Progressive from onset; no clear relapses; older onset; less DMT responsive; Ocrelizumab (anti-CD20)", "10-15%"],
            ["Progressive-Relapsing", "Progressive from onset + superimposed relapses", "Rare"],
        ],
        col_widths=[4.5*cm, 9*cm, 3.5*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("MS — Clinical Features (INICET Favorites)", subsec))
    story.append(tbl(
        ["Feature", "Details"],
        [
            ["Optic Neuritis", "Unilateral painful vision loss; afferent pupillary defect (APD/Marcus Gunn pupil); color desaturation; may be first presentation of MS"],
            ["Internuclear Ophthalmoplegia (INO)", "MLF lesion; impaired ipsilateral adduction + contralateral nystagmus; bilateral INO = MS until proven otherwise"],
            ["Lhermitte's Sign", "Electric shock sensation down spine with neck flexion; posterior column demyelination in cervical cord"],
            ["Uhthoff's Phenomenon", "Worsening of symptoms with heat (fever, exercise, hot bath); distinguish from true relapse (no new MRI lesion)"],
            ["Trigeminal Neuralgia", "Young patient with TN = consider MS (demyelination of trigeminal root entry zone)"],
            ["Bladder symptoms", "Urinary urgency, hesitancy, incontinence; very common (80%)"],
            ["Fatigue", "Most common and disabling symptom; treat with Amantadine or Modafinil"],
            ["Spasticity", "Treat with Baclofen (GABA-B agonist), Tizanidine"],
        ],
        col_widths=[4.5*cm, 12.5*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("MS Treatment", subsec))
    story.append(tbl(
        ["Category", "Drugs", "Notes"],
        [
            ["Acute relapse", "IV Methylprednisolone 1g/day x 3-5 days",
             "Speeds recovery; does NOT alter long-term course"],
            ["Disease-modifying therapy (1st line)", "Interferon beta-1a/1b, Glatiramer acetate, Teriflunomide, Dimethyl fumarate",
             "Injectable/oral; reduce relapse rate ~30%"],
            ["DMT (2nd line / high efficacy)", "Natalizumab (anti-VLA4), Fingolimod, Ocrelizumab (anti-CD20), Alemtuzumab",
             "Natalizumab: risk of PML (JC virus); check JCV antibody. Fingolimod: bradycardia on first dose; macular edema"],
            ["PPMS", "Ocrelizumab (only FDA-approved for PPMS)",
             "Anti-CD20 monoclonal antibody"],
        ],
        col_widths=[3.5*cm, 6.5*cm, 7*cm]
    ))
    story.append(PageBreak())

    # ══════════ S8: GBS & CIDP ══════════
    story.append(banner("SECTION 8 — GUILLAIN-BARRÉ SYNDROME (GBS) & CIDP", DARK_GREEN))
    story.append(S(8))

    story.append(Paragraph("GBS — Key Features", subsec))
    story.append(bp("Acute inflammatory demyelinating polyradiculoneuropathy (AIDP) — most common GBS variant in Western countries"))
    story.append(bp("Trigger: Campylobacter jejuni (#1 worldwide), CMV, EBV, HIV, influenza vaccination (rare), COVID-19"))
    story.append(bp("Presentation: Ascending flaccid weakness; areflexia; starts in legs, ascends to arms and cranial nerves"))
    story.append(bp("Autonomic involvement: Tachycardia, BP fluctuations, urinary retention — major cause of mortality"))
    story.append(bp("Respiratory failure in ~30% — monitor FVC; intubate if FVC <20 mL/kg or <50% predicted"))
    story.append(S(6))
    story.append(tbl(
        ["Investigation", "Finding in GBS"],
        [
            ["CSF", "Albuminocytologic dissociation: high protein (>45 mg/dL) + normal WBC (<10 cells) - classic"],
            ["EMG/NCS", "Prolonged F-wave, slowed conduction velocity, conduction block (AIDP); axonal loss in AMAN/AMSAN"],
            ["Anti-ganglioside Ab", "Anti-GM1: AMAN variant; Anti-GQ1b: Miller-Fisher syndrome (ophthalmoplegia + ataxia + areflexia)"],
            ["MRI spine", "Enhancement of cauda equina nerve roots (supporting finding)"],
        ],
        col_widths=[3.5*cm, 13.5*cm]
    ))
    story.append(S(6))
    story.append(kf("Treatment: IVIG (0.4 g/kg/day x 5 days) OR Plasmapheresis — equally effective. Do NOT combine. Steroids are NOT beneficial in GBS (may worsen)."))
    story.append(S(6))
    story.append(tbl(
        ["GBS Variant", "Features", "Associated Antibody"],
        [
            ["AIDP", "Classic ascending weakness; demyelinating", "—"],
            ["AMAN (Acute Motor Axonal Neuropathy)", "Pure motor; axonal; faster recovery; common in China/Asia post-C. jejuni", "Anti-GM1, Anti-GD1a"],
            ["AMSAN", "Motor + sensory axonal; severe; poor recovery", "Anti-GD1a"],
            ["Miller-Fisher Syndrome (MFS)", "Triad: Ophthalmoplegia + Ataxia + Areflexia; descending; may not have limb weakness", "Anti-GQ1b (90%+)"],
            ["Bickerstaff Encephalitis", "MFS + encephalopathy + hyperreflexia", "Anti-GQ1b"],
        ],
        col_widths=[4*cm, 8*cm, 5*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("CIDP vs GBS", subsec))
    story.append(tbl(
        ["Feature", "GBS (Acute)", "CIDP (Chronic)"],
        [
            ["Onset", "Acute (<4 weeks peak)", "Insidious (>8 weeks progression)"],
            ["Course", "Monophasic; self-limiting", "Relapsing-remitting or progressive"],
            ["Trigger", "Infection 2-4 weeks before", "Often no clear trigger"],
            ["Autonomic", "Prominent", "Less prominent"],
            ["Treatment", "IVIG or Plasmapheresis", "Steroids, IVIG, Plasmapheresis (all effective)"],
        ],
        col_widths=[4*cm, 6.5*cm, 6.5*cm]
    ))
    story.append(PageBreak())

    # ══════════ S9: MYASTHENIA GRAVIS ══════════
    story.append(banner("SECTION 9 — MYASTHENIA GRAVIS (MG)", WINE))
    story.append(S(8))

    story.append(Paragraph("MG — Pathophysiology & Clinical Features", subsec))
    story.append(bp("Autoimmune NMJ disorder: Antibodies against post-synaptic acetylcholine receptors (AChR-Ab in 85%) or MuSK-Ab (10%)"))
    story.append(bp("Hallmark: Fatigable weakness — worsens with repetitive activity, improves with rest"))
    story.append(bp("Ocular muscles first: ptosis + diplopia (50% present with ocular symptoms only → ocular MG)"))
    story.append(bp("Bulbar involvement: dysphagia, dysarthria, nasal voice ('morning glory' — worse by evening)"))
    story.append(bp("Thymoma association: 10-15% of MG patients have thymoma; 30% of thymoma patients have MG"))
    story.append(S(6))

    story.append(tbl(
        ["Investigation", "Finding / Notes"],
        [
            ["Edrophonium (Tensilon) test", "Short-acting AChEi; transient improvement in ptosis/diplopia = positive. Positive in myasthenic crisis (not cholinergic crisis). Have atropine ready for bradycardia."],
            ["AChR antibody", "Positive in 85% generalized MG; 50% ocular MG"],
            ["Anti-MuSK antibody", "AChR-Ab negative MG; more bulbar + respiratory involvement"],
            ["CT chest", "Thymoma (10-15%); thymic hyperplasia"],
            ["Repetitive nerve stimulation (RNS)", "Decremental response on low-frequency (3 Hz) RNS — diagnostic"],
            ["Single-fiber EMG", "Most sensitive test; increased jitter — gold standard for NMJ disease"],
            ["Ice pack test", "Improvement in ptosis with ice = MG (cooling improves AChR function)"],
        ],
        col_widths=[4*cm, 13*cm]
    ))
    story.append(S(6))

    story.append(Paragraph("MG Treatment", subsec))
    story.append(tbl(
        ["Drug / Intervention", "Role", "Notes"],
        [
            ["Pyridostigmine (Mestinon)", "AChEi — symptomatic relief", "First-line symptomatic; dose: 30-60mg q4-8h; overuse → cholinergic crisis"],
            ["Prednisolone / Corticosteroids", "Immunosuppression — first-line", "Slow onset (weeks); initial worsening may occur"],
            ["Azathioprine", "Steroid-sparing agent", "Slow onset (months); check TPMT enzyme; pancreatitis risk"],
            ["Mycophenolate mofetil", "Steroid-sparing alternative", "Teratogenic"],
            ["Thymectomy", "Treatment (especially with thymoma)", "Benefit in generalized MG in young patients even without thymoma; MGTX trial"],
            ["IVIG / Plasmapheresis", "Short-term rapid immunotherapy", "For myasthenic crisis; pre-surgical preparation"],
            ["Eculizumab (anti-C5)", "Complement inhibitor", "Approved for AChR+ generalized MG refractory to standard therapy"],
        ],
        col_widths=[4*cm, 4*cm, 9*cm]
    ))
    story.append(S(6))
    story.append(tbl(
        ["Crisis Type", "Mechanism", "Edrophonium Test", "HR / Secretions", "Treatment"],
        [
            ["Myasthenic Crisis", "Inadequate AChEi / disease exacerbation → respiratory failure",
             "Improvement in strength", "Tachycardia; no secretions", "IVIG / Plasmapheresis + intubation if needed"],
            ["Cholinergic Crisis", "Excess AChEi → depolarization block",
             "Worsening of strength", "Bradycardia; SLUDGE (Salivation, Lacrimation, Urination, Defecation, GI cramps, Emesis)", "Stop pyridostigmine; Atropine; intubation"],
        ],
        col_widths=[3*cm, 4*cm, 3*cm, 3.5*cm, 3.5*cm]
    ))
    story.append(S(4))
    story.append(warn("Drugs that WORSEN MG: Aminoglycosides, Fluoroquinolones, Macrolides, Chloroquine, Magnesium, Beta-blockers, CCB, D-penicillamine. AVOID in MG patients!"))
    story.append(PageBreak())

    # ══════════ S10: DEMENTIA ══════════
    story.append(banner("SECTION 10 — DEMENTIA & COGNITIVE DISORDERS", HexColor("#744210")))
    story.append(S(8))
    story.append(tbl(
        ["Type", "% of Dementia", "Key Features", "Pathology / Markers"],
        [
            ["Alzheimer's Disease", "60-70%",
             "Episodic memory loss first (short-term); word-finding difficulty; gradual progressive; temporal-parietal atrophy; bilateral hippocampal atrophy",
             "Amyloid-beta plaques + Neurofibrillary tangles (tau); ApoE4 risk allele; low Aβ42 + high tau in CSF; amyloid PET positive"],
            ["Vascular Dementia", "15-20%",
             "Stepwise decline; HTN/DM/AF/stroke risk factors; focal neurological deficits; subcortical pattern",
             "White matter lesions (lacunar infarcts); Binswanger's disease"],
            ["Lewy Body Dementia", "10-15%",
             "Cognitive fluctuations; visual hallucinations (well-formed); parkinsonism (within 1 year of dementia); REM sleep behavior disorder; neuroleptic sensitivity",
             "Alpha-synuclein (Lewy bodies) in cortex; DaT-SPECT reduced"],
            ["Frontotemporal Dementia (FTD)", "5-10%",
             "Personality change, disinhibition, executive dysfunction (frontal) OR progressive aphasia (temporal); younger age (50-65y); frontal/temporal atrophy",
             "TDP-43, FUS, tau; FTD/ALS overlap; Pick bodies in Pick's disease (3R tau)"],
            ["Normal Pressure Hydrocephalus (NPH)", "Reversible!",
             "Triad: Wet-Wacky-Wobbly (Urinary incontinence, Dementia, Gait ataxia/magnetic gait); prominent ventricles; no sulcal enlargement",
             "Enlarged ventricles with narrow sulci on CT; LP with large volume removal improves gait"],
            ["CJD (Creutzfeldt-Jakob)", "Rapid",
             "Rapidly progressive dementia (<1 year); myoclonus; periodic sharp wave complexes on EEG; 'pulvinar sign' on MRI DWI",
             "Prion disease (PrPSc); CSF 14-3-3 protein elevated"],
        ],
        col_widths=[3.5*cm, 2.5*cm, 6*cm, 5*cm]
    ))
    story.append(S(6))
    story.append(kf("Alzheimer's Treatment: Mild-moderate — Donepezil/Rivastigmine/Galantamine (AChEi). Moderate-severe — add Memantine (NMDA antagonist). Lecanemab/Donanemab (anti-amyloid mAb) — new approved for early AD."))
    story.append(S(4))
    story.append(warn("In Lewy Body Dementia: AVOID conventional antipsychotics (haloperidol, risperidone) — severe neuroleptic sensitivity, can be fatal. Use quetiapine or clozapine if needed."))
    story.append(PageBreak())

    # ══════════ S11: PERIPHERAL NEUROPATHY ══════════
    story.append(banner("SECTION 11 — PERIPHERAL NEUROPATHY & NERVE INJURIES", TEAL))
    story.append(S(8))

    story.append(Paragraph("Mononeuropathies — Common Nerve Entrapments", subsec))
    story.append(tbl(
        ["Nerve", "Entrapment Site", "Clinical Features", "Test"],
        [
            ["Median", "Carpal tunnel (wrist)", "Thenar wasting; sensory loss over thumb/index/middle; Tinel's sign; Phalen's test; CTS - most common",
             "NCS: prolonged distal motor/sensory latency"],
            ["Ulnar", "Cubital tunnel (medial elbow)", "Claw hand (4th+5th digits); wasting of hypothenar + interossei; 'Benediction hand' with OK sign abnormal",
             "Froment's sign (thumb adduction weakness)"],
            ["Radial", "Spiral groove (humerus)", "Wrist drop; extensor paralysis; spares sensation over thumb (superficial branch spared at wrist)",
             "'Saturday night palsy' (arm draped over chair)"],
            ["Common Peroneal", "Fibular neck", "Foot drop; loss of dorsiflexion + eversion; high stepping gait; lateral leg/dorsum foot sensory loss",
             "Most common lower limb mononeuropathy"],
            ["Femoral", "Inguinal ligament / pelvic mass", "Quadriceps weakness; knee extension loss; sensory loss anteromedial thigh/leg",
             "Diabetes is major cause"],
            ["Long Thoracic", "Axilla or surgery", "Winged scapula (serratus anterior palsy)",
             "Push against wall → scapular winging"],
        ],
        col_widths=[3*cm, 3.5*cm, 6.5*cm, 4*cm]
    ))
    story.append(S(8))

    story.append(Paragraph("Polyneuropathy Patterns", subsec))
    story.append(tbl(
        ["Pattern", "Causes", "Notes"],
        [
            ["Distal symmetric sensorimotor (glove-and-stocking)", "Diabetes (#1), alcohol, B12 deficiency, uremia, HIV, drugs (INH, vincristine, metronidazole)",
             "Length-dependent; starts distally; EMG axonal pattern"],
            ["Acute ascending motor", "GBS, AMAN", "See GBS section"],
            ["Demyelinating (slow NCS)", "CIDP, CMT disease, paraprotein neuropathy",
             "F-wave prolonged, conduction velocity <38 m/s"],
            ["Pure motor", "AMAN, multifocal motor neuropathy (MMN), lead poisoning",
             "MMN: anti-GM1 antibodies; responds to IVIG"],
            ["Mononeuritis multiplex", "Vasculitis (#1), diabetes, leprosy, sarcoidosis, HIV",
             "Multiple individual nerve involvement; not glove-stocking"],
            ["Autonomic neuropathy", "Diabetes, amyloid, paraneoplastic (anti-Hu)",
             "Orthostatic hypotension, gastroparesis, impotence, anhidrosis"],
        ],
        col_widths=[4*cm, 6.5*cm, 6.5*cm]
    ))
    story.append(PageBreak())

    # ══════════ S12: RAPID REVISION ══════════
    story.append(banner("SECTION 12 — RAPID REVISION: HIGH-YIELD NEUROLOGY FACTS", DARK_NAVY))
    story.append(S(8))
    story.append(tbl(
        ["Question", "Answer"],
        [
            ["IV tPA dose for ischemic stroke", "0.9 mg/kg (max 90 mg): 10% bolus, rest over 60 min"],
            ["Time window for IV tPA (standard)", "≤3 hours from symptom onset (up to 4.5h in selected patients)"],
            ["Most common location of lacunar infarcts", "Putamen/posterior limb internal capsule > pons > thalamus > caudate"],
            ["Berry aneurysm most common site in SAH", "Anterior communicating artery (ACoA)"],
            ["Drug to prevent vasospasm in SAH", "Nimodipine (oral) 60 mg q4h x 21 days"],
            ["First-line benzo for status epilepticus", "Lorazepam IV (or diazepam if no IV access)"],
            ["AED for absence seizures", "Ethosuximide (first-line pure absence); Valproate (if GTCS + absence)"],
            ["AED to AVOID in absence seizures", "Carbamazepine, Phenytoin, Vigabatrin"],
            ["Most teratogenic AED", "Valproate (neural tube defects, cardiac malformations)"],
            ["CSF in TB meningitis", "High protein, low glucose, lymphocytes, elevated opening pressure; ADA elevated"],
            ["CSF 'albuminocytologic dissociation'", "GBS — high protein, normal WBC"],
            ["HSV encephalitis treatment", "Acyclovir IV 10 mg/kg q8h x 14-21 days"],
            ["NMDA-receptor encephalitis associated tumor", "Ovarian teratoma (young women)"],
            ["MS diagnostic criteria", "McDonald criteria: Dissemination in space + time"],
            ["Pathognomonic MRI finding in MS", "Dawson's fingers (periventricular plaques perpendicular to ventricles)"],
            ["MS drug causing PML (brain infection)", "Natalizumab (JC virus reactivation; check JCV antibody)"],
            ["PPMS: only approved DMT", "Ocrelizumab (anti-CD20)"],
            ["Cardinal features of PD", "TRAP: Tremor (resting, pill-rolling), Rigidity, Akinesia, Postural instability"],
            ["Most effective drug for Parkinson's", "Levodopa + Carbidopa (Sinemet)"],
            ["MRI hummingbird sign", "Progressive Supranuclear Palsy (PSP) — midbrain atrophy"],
            ["MRI hot cross bun sign", "Multiple System Atrophy (MSA) — pontine atrophy"],
            ["Treatment of MG crisis", "IVIG or Plasmapheresis + ICU support; pyridostigmine may be held"],
            ["Most sensitive test for MG", "Single-fiber EMG (increased jitter)"],
            ["Drug used in Edrophonium test", "Edrophonium (short-acting AChEi); Tension test"],
            ["GBS treatment", "IVIG (0.4 g/kg x 5 days) OR Plasmapheresis — NOT steroids"],
            ["Miller-Fisher syndrome antibody", "Anti-GQ1b antibody"],
            ["MG drugs to avoid", "Aminoglycosides, fluoroquinolones, magnesium, beta-blockers"],
            ["NPH triad", "Wet + Wobbly + Wacky (Incontinence + Gait ataxia + Dementia)"],
            ["Prion disease rapid dementia marker", "14-3-3 protein in CSF; periodic sharp waves on EEG"],
            ["Dementia + Parkinsonism + visual hallucinations", "Lewy Body Dementia (DLB)"],
            ["Most common nerve entrapment syndrome", "Carpal tunnel syndrome (median nerve at wrist)"],
            ["Wrist drop nerve", "Radial nerve (spiral groove of humerus)"],
            ["Foot drop nerve", "Common peroneal nerve (fibular neck)"],
            ["Mononeuritis multiplex — #1 cause", "Vasculitis (systemic)"],
            ["Thunderclap headache = until proven otherwise", "Subarachnoid hemorrhage (SAH)"],
            ["First-line prophylaxis for cluster headache", "Verapamil"],
            ["Idiopathic intracranial hypertension: first-line drug", "Acetazolamide + weight loss"],
        ],
        col_widths=[9*cm, 8*cm]
    ))
    story.append(PageBreak())

    # ══════════ S13: VIGNETTES ══════════
    story.append(banner("SECTION 13 — CLINICAL VIGNETTE PRACTICE (INICET-STYLE)", DARK_GREEN))
    story.append(S(8))

    vig_q = ms('VQ', fontSize=10, textColor=DARK_NAVY, fontName='Helvetica-Bold', leading=14, spaceAfter=4)
    vig_a = ms('VA', fontSize=10, textColor=DARK_GREEN, fontName='Helvetica', leading=14, spaceAfter=4, leftIndent=10)
    vig_k = ms('VK', fontSize=10, textColor=ACCENT_RED, fontName='Helvetica-Bold', leading=14, spaceAfter=8, leftIndent=10)

    vignettes = [
        {
            "q": "Q1. A 68-year-old man with hypertension presents to ER with sudden onset left-sided weakness and slurred speech that began 2 hours ago. BP 195/105 mmHg. NIHSS = 14. CT head shows no hemorrhage. How do you proceed?",
            "a": "Answer: Acute ischemic stroke within 3-hour window. BP must be lowered to ≤185/110 before tPA. Administer IV labetalol (10-20mg IV) to achieve BP target, then give IV alteplase (tPA) 0.9 mg/kg (max 90mg). Simultaneously, obtain CT angiography (CTA) to assess for large vessel occlusion (LVO) — if LVO present (e.g., M1 MCA), arrange mechanical thrombectomy. Target BP <180/105 during and 24h after tPA. Hold antiplatelets/anticoagulants for 24h.",
            "key": "Key: BP control to ≤185/110 is MANDATORY before tPA. Always do CTA to look for LVO — thrombectomy adds benefit even after tPA."
        },
        {
            "q": "Q2. A 25-year-old woman presents with 3 episodes of 'electric shock' sensation shooting down her spine when she bends her neck. She also had an episode of right eye blurred vision with eye pain 1 year ago that resolved completely. MRI brain shows periventricular T2 lesions perpendicular to the ventricles. CSF shows oligoclonal bands. Diagnosis?",
            "a": "Answer: Multiple Sclerosis (MS). Lhermitte's sign (neck flexion → electric shock = cervical cord posterior column demyelination). Optic neuritis 1 year ago = first episode. Current Lhermitte's = second episode in different site. Dawson's fingers (periventricular perpendicular lesions) on MRI. Oligoclonal bands in CSF. McDonald criteria met: Dissemination in space AND time. Start disease-modifying therapy (DMT).",
            "key": "Key: Optic neuritis in a young woman = MS until proven otherwise. Two episodes in different regions = MS (McDonald criteria met). Dawson's fingers = classic MS MRI."
        },
        {
            "q": "Q3. A 55-year-old man has a 6-week history of ascending weakness that started in his legs. He had diarrhea 3 weeks ago. Examination: flaccid weakness, areflexia, bilateral facial weakness. Respiratory rate increasing. FVC = 1.4 L (predicted 3.2 L). Management?",
            "a": "Answer: Guillain-Barré Syndrome (GBS). Post-Campylobacter jejuni trigger. Ascending flaccid weakness + areflexia = classic. FVC <20 mL/kg (1.4L vs predicted 3.2L = 44% predicted) + bulbar involvement (facial weakness) → IMMEDIATE intubation. Treatment: IVIG 0.4 g/kg/day x 5 days OR Plasmapheresis. Do NOT give steroids. Admit to ICU for monitoring.",
            "key": "Key: 20-50 rule in GBS — intubate if FVC <20 mL/kg, MIP worse than -30 cmH2O, or MEP <40 cmH2O. IVIG = Plasmapheresis in efficacy. NO steroids."
        },
        {
            "q": "Q4. A 30-year-old woman presents to ER with a 1-month history of psychiatric symptoms (agitation, hallucinations), followed by seizures and now unresponsiveness. She has autonomic instability (BP fluctuations, hyperthermia). MRI shows faint FLAIR changes in medial temporal lobes. Anti-NMDAR antibody is positive. What should be done next?",
            "a": "Answer: Anti-NMDA receptor encephalitis. Classic: young woman; psychiatric prodrome → seizures → reduced consciousness → autonomic instability. Check for underlying ovarian teratoma (pelvic ultrasound/MRI pelvis). Treatment: IV methylprednisolone 1g/day x 5 days + IVIG, and/or Plasmapheresis (first-line immunotherapy). If no response in 4-6 weeks: Rituximab or cyclophosphamide. Tumor removal (teratoma) is essential — dramatically improves outcome.",
            "key": "Key: Anti-NMDAR encephalitis = most common autoimmune encephalitis. Young woman + psychiatric symptoms + seizures + anti-NMDAR antibody = look for ovarian teratoma. Tumor removal + immunotherapy."
        },
        {
            "q": "Q5. A 70-year-old man presents with a 2-year history of forgetfulness, slowness, and reduced arm swing. He has resting tremor in the right hand and cogwheel rigidity. You start Levodopa/Carbidopa. 6 years later he has unpredictable 'off' periods and writhing involuntary movements. What are these movements called and how do you manage?",
            "a": "Answer: Levodopa-induced dyskinesias (choreiform movements) — a long-term complication. 'Off' periods = wearing-off phenomenon (end-of-dose effect). Management of dyskinesias: Amantadine (most effective for dyskinesias); Reduce each levodopa dose and increase frequency; Consider COMT inhibitor (entacapone) to smooth dopamine levels; Deep Brain Stimulation (DBS) of subthalamic nucleus or globus pallidus for refractory motor complications.",
            "key": "Key: Long-term levodopa complications: Dyskinesias (treat with Amantadine), On-off phenomenon (COMT inhibitor, DBS). DBS is the only surgical option with Class I evidence for PD motor complications."
        },
        {
            "q": "Q6. A 45-year-old woman presents with fluctuating diplopia and ptosis, worse in the evening. She can carry the groceries in the morning but her arms fatigue quickly. Examination shows ptosis that worsens with sustained upgaze. Repetitive nerve stimulation at 3Hz shows 30% decrement in CMAP amplitude. Ice placed on eyelid briefly improves ptosis. Diagnosis and treatment?",
            "a": "Answer: Myasthenia Gravis (MG). Classic fatigable weakness worse in evening. Ptosis worsens with sustained upgaze (fatigability). Decremental response on RNS at 3 Hz (>10% decrement = abnormal) = diagnostic. Ice pack test positive. Check: AChR antibody, CT chest for thymoma. Treatment: Pyridostigmine (symptomatic), Prednisolone (immunosuppression), Thymectomy (even if no thymoma in generalized MG in young patients).",
            "key": "Key: Fatigable weakness + decremental response on RNS = MG. Always do CT chest (thymoma). RNS decrement >10% at 3 Hz = positive. Ice test = bedside clinical test."
        },
    ]

    for v in vignettes:
        q_t = Table([[Paragraph(v["q"], vig_q)]], colWidths=[17*cm])
        q_t.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),LIGHT_BLUE),
            ('TOPPADDING',(0,0),(-1,-1),8),('BOTTOMPADDING',(0,0),(-1,-1),8),
            ('LEFTPADDING',(0,0),(-1,-1),10),('BOX',(0,0),(-1,-1),1,MED_BLUE)]))
        a_t = Table([[Paragraph(v["a"], vig_a)]], colWidths=[17*cm])
        a_t.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),HexColor("#F0FFF4")),
            ('TOPPADDING',(0,0),(-1,-1),6),('BOTTOMPADDING',(0,0),(-1,-1),6),
            ('LEFTPADDING',(0,0),(-1,-1),14),('BOX',(0,0),(-1,-1),1,DARK_GREEN)]))
        k_t = Table([[Paragraph(v["key"], vig_k)]], colWidths=[17*cm])
        k_t.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),HexColor("#FFF5F5")),
            ('TOPPADDING',(0,0),(-1,-1),5),('BOTTOMPADDING',(0,0),(-1,-1),5),
            ('LEFTPADDING',(0,0),(-1,-1),10),('BOX',(0,0),(-1,-1),1,ACCENT_RED)]))
        story.append(KeepTogether([q_t, S(3), a_t, S(3), k_t, S(10)]))

    story.append(PageBreak())

    # ══════════ STUDY STRATEGY ══════════
    story.append(banner("STUDY STRATEGY FOR NEUROLOGY — INICET", DARK_NAVY))
    story.append(S(10))

    strat_rows = [
        ["Week 1", "Stroke: Ischemic vs hemorrhagic, tPA criteria, thrombectomy, SAH management. Solve 40 stroke MCQs."],
        ["Week 2", "Epilepsy: AED selection, Status epilepticus algorithm, special situations (pregnancy, elderly, absence)."],
        ["Week 3", "Meningitis/Encephalitis: CSF profiles, organisms by age, antibiotic choices, HSV/NMDAR encephalitis."],
        ["Week 4", "MS: McDonald criteria, MS subtypes, DMT drugs, side effects (PML with natalizumab)."],
        ["Week 5", "Parkinson's + Parkinson-Plus: TRAP, drug mechanisms, levodopa complications, imaging clues."],
        ["Week 6", "GBS, MG: Edrophonium test, crisis distinction, NCS patterns, treatment protocols."],
        ["Week 7", "Headache + Neuropathy: Cluster vs migraine, red flags, nerve entrapments, neuropathy patterns."],
        ["Week 8", "Dementia + Rapid Revision: Alzheimer's vs DLB vs FTD vs NPH. Review all tables in this guide."],
    ]
    sk = ms('SK2', fontSize=10, textColor=WHITE, fontName='Helvetica-Bold', alignment=TA_CENTER)
    sv = ms('SV2', fontSize=10, textColor=HexColor("#2D3748"), fontName='Helvetica', leading=14)
    s_data = [[Paragraph(r[0], sk), Paragraph(r[1], sv)] for r in strat_rows]
    s_t = Table(s_data, colWidths=[2.5*cm, 14.5*cm])
    s_t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (0,-1), DARK_NAVY),
        ('ROWBACKGROUNDS', (1,0), (1,-1), [WHITE, LIGHT_GRAY]),
        ('GRID', (0,0), (-1,-1), 0.5, GRAY_BORDER),
        ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
        ('TOPPADDING', (0,0), (-1,-1), 8),
        ('BOTTOMPADDING', (0,0), (-1,-1), 8),
        ('LEFTPADDING', (0,0), (-1,-1), 8),
    ]))
    story.append(s_t)
    story.append(S(16))
    story.append(HRFlowable(width="100%", thickness=1.5, color=MED_BLUE, spaceAfter=10))
    story.append(Paragraph(
        "Sources: Bradley & Daroff's Neurology in Clinical Practice | Adams & Victor's Principles of Neurology 12e | Plum & Posner's Diagnosis and Treatment of Stupor and Coma",
        ms('F1', fontSize=8, textColor=HexColor("#718096"), fontName='Helvetica-Oblique', alignment=TA_CENTER)))
    story.append(Paragraph(
        "Harrison's Internal Medicine 22e | Tintinalli's Emergency Medicine | Goodman & Gilman's Pharmacology | Lippincott Pharmacology",
        ms('F2', fontSize=8, textColor=HexColor("#A0AEC0"), fontName='Helvetica-Oblique', alignment=TA_CENTER)))
    story.append(Paragraph("For INICET preparation — July 2026",
        ms('F3', fontSize=8, textColor=HexColor("#A0AEC0"), fontName='Helvetica-Oblique', alignment=TA_CENTER)))

    return story


# ── Page decorations ──────────────────────────────────────────────
def decorate(canvas, doc):
    canvas.saveState()
    if doc.page == 1:
        canvas.restoreState(); return
    w, h = A4
    canvas.setFillColor(DARK_NAVY)
    canvas.rect(1.5*cm, h-1.3*cm, w-3*cm, 0.55*cm, fill=1, stroke=0)
    canvas.setFont("Helvetica-Bold", 8); canvas.setFillColor(WHITE)
    canvas.drawString(1.8*cm, h-1.05*cm, "INICET HIGH-YIELD NEUROLOGY STUDY GUIDE")
    canvas.drawRightString(w-1.8*cm, h-1.05*cm, "Bradley & Daroff · Adams & Victor · Harrison's")
    canvas.setFillColor(MED_BLUE)
    canvas.rect(1.5*cm, 0.8*cm, w-3*cm, 0.4*cm, fill=1, stroke=0)
    canvas.setFont("Helvetica", 8); canvas.setFillColor(WHITE)
    canvas.drawString(1.8*cm, 0.93*cm, "Neurology | INICET Medicine")
    canvas.drawRightString(w-1.8*cm, 0.93*cm, f"Page {doc.page}")
    canvas.restoreState()


# ── Build ─────────────────────────────────────────────────────────
def build():
    doc = SimpleDocTemplate(
        OUTPUT_PATH, pagesize=A4,
        rightMargin=2*cm, leftMargin=2*cm,
        topMargin=2*cm, bottomMargin=1.8*cm,
        title="INICET High-Yield Neurology Study Guide",
        author="Orris Medical AI",
        subject="INICET Medicine - Neurology",
    )
    doc.build(build_story(), onFirstPage=decorate, onLaterPages=decorate)
    print(f"PDF saved: {OUTPUT_PATH}")

if __name__ == "__main__":
    build()
Running Command

cd /home/daytona/workspace/inicet-neurology && python generate_neuro_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/inicet-neurology/INICET_Neurology_HighYield.pdf

Your INICET High-Yield Neurology Study Guide PDF is ready:

INICET Neurology HighYield

PDF Document · PDF


What's inside (13 sections):
SectionContent
1Exam overview — Neurology's weight in INICET, sub-topic question estimates
2Stroke — Ischemic vs ICH vs SAH, tPA criteria/contraindications, stroke syndromes localization table, Wallenberg/Lateral medullary
3Epilepsy — ILAE 2017 classification, AED drug choice by seizure type, AED side effects, Status Epilepticus protocol (time-based algorithm)
4Meningitis & Encephalitis — CSF profile comparison table (bacterial/viral/TB/SAH), organisms by age, empiric antibiotics, HSV/NMDAR/rabies/CMV encephalitis
5Headache — Migraine vs tension vs cluster vs SAH vs IIH, red flags, drug management
6Parkinson's Disease — TRAP mnemonic, tremor differentiation, all PD drugs + mechanisms, Parkinson-Plus syndromes (PSP/MSA/DLB/CBS)
7Multiple Sclerosis — MS course types, clinical features (Lhermitte's, INO, Uhthoff's, optic neuritis), DMT table, PML risk
8GBS & CIDP — Albuminocytologic dissociation, GBS variants (AIDP/AMAN/Miller-Fisher), Anti-GQ1b, intubation criteria
9Myasthenia Gravis — Edrophonium test, RNS decrement, crisis distinction, drugs to avoid
10Dementia — Alzheimer's vs Vascular vs DLB vs FTD vs NPH vs CJD
11Peripheral Neuropathy — Nerve entrapments, mononeuropathy patterns, polyneuropathy causes
12Rapid Revision Table — 38 high-yield Q&A facts
136 INICET-style clinical vignettes with full explanations and key takeaways
Sources: Bradley & Daroff's Neurology, Adams & Victor's Principles of Neurology, Plum & Posner's Stupor and Coma, Harrison's 22e, Tintinalli's Emergency Medicine, Goodman & Gilman's Pharmacology.
This is a shared conversation. Sign in to Orris to start your own chat.