The following files are required for me to teach students appearing for the INI SS CET CVTS which is a single best answer multiple choice question examination. Generate 3 files from chapter 52 through 55. 1. 10 page High yield notes from all the chapters for teaching with probable questions, and include teaching notes, flowcharts, landmark trials, guidelines, tables, memory aids, exam pearls and most probably INI SS Questions. Also include last minute revision tables. 2. 50 MCQs from all the chapters combined in the INI CET SS standard format single best answer, can have a paragraph questions, vignettes, image based questions, photographs with attributes. Source can be the internet as well. Make sure that the PDF has all 50 questions. 3. Answer key with detailed explanation of the correct answer and explanation of the distractors. Do not copy paste the same explanations loop to all answers. Make sure that the explanation pdf has all 50 explanations. Answers can be either a,b,c or d. Explain every correct answer and give distractor analysis as well. Correct answer, explanation, why each distractor is incorrect, relevant guideline, and learning point. Create 3 pdfs with a direct download link. Make sure the questions are based on decision making, guidelines, landmark trials, operative judgement, hemodynamics, clinical scenarios and imaging interpretation. Please provide all 3 sets in downloadable PDF format only with link.

Reading File
Reading File
Running Command

cd /home/daytona/workspace && python3 -c " import pdfplumber, os files = { …

Running Command

head -200 /tmp/ch52_text.txt

Running Command

head -200 /tmp/ch53_text.txt

Running Command

head -200 /tmp/ch54_text.txt

Running Command

head -200 /tmp/ch55_text.txt

Running Command

sed -n '200,500p' /tmp/ch52_text.txt

Running Command

sed -n '400,700p' /tmp/ch53_text.txt

Running Command

sed -n '400,700p' /tmp/ch54_text.txt

Running Command

sed -n '400,700p' /tmp/ch55_text.txt

Running Command

mkdir -p /home/daytona/workspace/ini-ss-cvts && python3 -c " from reportlab.lib.…

Writing File

~/ini-ss-cvts/build_notes.py

#!/usr/bin/env python3
"""High Yield Notes PDF - Chapters 52-55 for INI SS CET CVTS"""

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

OUTPUT = '/home/daytona/workspace/ini-ss-cvts/HY_Notes_Ch52-55.pdf'

# Colors
NAVY = colors.HexColor('#0D2B5E')
BLUE = colors.HexColor('#1A5276')
TEAL = colors.HexColor('#148F77')
ORANGE = colors.HexColor('#E67E22')
RED = colors.HexColor('#C0392B')
GOLD = colors.HexColor('#D4AC0D')
LGRAY = colors.HexColor('#F2F3F4')
DGRAY = colors.HexColor('#2C3E50')
PEARL = colors.HexColor('#F9EBEA')
GREEN = colors.HexColor('#1E8449')
PURPLE = colors.HexColor('#6C3483')
LTBLUE = colors.HexColor('#D6EAF8')
LTYELLOW = colors.HexColor('#FEF9E7')
LTGREEN = colors.HexColor('#E9F7EF')
LTRED = colors.HexColor('#FDEDEC')

doc = SimpleDocTemplate(OUTPUT, pagesize=A4,
                        rightMargin=1.5*cm, leftMargin=1.5*cm,
                        topMargin=1.5*cm, bottomMargin=1.5*cm)

styles = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, **kw)

# Custom styles
TITLE = S('TITLE', fontSize=22, textColor=colors.white, alignment=TA_CENTER,
          fontName='Helvetica-Bold', spaceAfter=4)
SUBTITLE = S('SUBTITLE', fontSize=12, textColor=colors.white, alignment=TA_CENTER,
             fontName='Helvetica', spaceAfter=2)
CH_HEAD = S('CH_HEAD', fontSize=14, textColor=colors.white, alignment=TA_CENTER,
            fontName='Helvetica-Bold', spaceAfter=2, spaceBefore=2)
SEC_HEAD = S('SEC_HEAD', fontSize=11, textColor=NAVY, fontName='Helvetica-Bold',
             spaceBefore=8, spaceAfter=3)
SUB_HEAD = S('SUB_HEAD', fontSize=10, textColor=BLUE, fontName='Helvetica-Bold',
             spaceBefore=5, spaceAfter=2)
BODY = S('BODY', fontSize=8.5, textColor=DGRAY, fontName='Helvetica',
         spaceBefore=2, spaceAfter=2, leading=12)
BULLET = S('BULLET', fontSize=8.5, textColor=DGRAY, fontName='Helvetica',
           leftIndent=12, spaceBefore=1, spaceAfter=1, leading=11, bulletIndent=4)
PEARL_S = S('PEARL_S', fontSize=8.5, textColor=RED, fontName='Helvetica-Bold',
            leftIndent=8, spaceBefore=1, spaceAfter=1, leading=11)
TABLE_H = S('TABLE_H', fontSize=8, textColor=colors.white, fontName='Helvetica-Bold',
            alignment=TA_CENTER)
TABLE_B = S('TABLE_B', fontSize=7.5, textColor=DGRAY, fontName='Helvetica',
            alignment=TA_LEFT, leading=10)
TABLE_BC = S('TABLE_BC', fontSize=7.5, textColor=DGRAY, fontName='Helvetica',
             alignment=TA_CENTER, leading=10)
MEMORY = S('MEMORY', fontSize=9, textColor=PURPLE, fontName='Helvetica-BoldOblique',
           leftIndent=8, spaceBefore=2, spaceAfter=2)
TRIAL = S('TRIAL', fontSize=8.5, textColor=GREEN, fontName='Helvetica-Bold',
          leftIndent=4, spaceBefore=1, spaceAfter=1)
WARN = S('WARN', fontSize=8.5, textColor=RED, fontName='Helvetica-Bold',
         leftIndent=4, spaceBefore=1, spaceAfter=1)
SMALL = S('SMALL', fontSize=7.5, textColor=DGRAY, fontName='Helvetica',
          spaceBefore=1, spaceAfter=1, leading=10)

def chapter_header(title, subtitle=''):
    data = [[Paragraph(title, CH_HEAD)]]
    if subtitle:
        data.append([Paragraph(subtitle, SUBTITLE)])
    t = Table(data, colWidths=[17.5*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), NAVY),
        ('ROWBACKGROUNDS', (0,0), (-1,-1), [NAVY]),
        ('TOPPADDING', (0,0), (-1,-1), 6),
        ('BOTTOMPADDING', (0,0), (-1,-1), 6),
        ('LEFTPADDING', (0,0), (-1,-1), 8),
        ('RIGHTPADDING', (0,0), (-1,-1), 8),
        ('ROUNDEDCORNERS', [5,5,5,5]),
    ]))
    return t

def section_box(title, bg=LTBLUE):
    data = [[Paragraph(f'<b>{title}</b>', S('sh', fontSize=10, textColor=NAVY,
                       fontName='Helvetica-Bold', alignment=TA_LEFT))]]
    t = Table(data, colWidths=[17.5*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), 8),
        ('RIGHTPADDING', (0,0), (-1,-1), 8),
    ]))
    return t

def pearl_box(items):
    rows = []
    for item in items:
        rows.append([Paragraph(f'⭐ {item}', PEARL_S)])
    t = Table(rows, colWidths=[17.5*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), LTRED),
        ('TOPPADDING', (0,0), (-1,-1), 2),
        ('BOTTOMPADDING', (0,0), (-1,-1), 2),
        ('LEFTPADDING', (0,0), (-1,-1), 6),
        ('RIGHTPADDING', (0,0), (-1,-1), 6),
        ('BOX', (0,0), (-1,-1), 0.5, RED),
    ]))
    return t

def memory_box(text):
    data = [[Paragraph(f'🧠 MEMORY AID: {text}', MEMORY)]]
    t = Table(data, colWidths=[17.5*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), colors.HexColor('#F3E5F5')),
        ('TOPPADDING', (0,0), (-1,-1), 4),
        ('BOTTOMPADDING', (0,0), (-1,-1), 4),
        ('LEFTPADDING', (0,0), (-1,-1), 8),
        ('RIGHTPADDING', (0,0), (-1,-1), 8),
        ('BOX', (0,0), (-1,-1), 0.5, PURPLE),
    ]))
    return t

def trial_box(items):
    rows = []
    for item in items:
        rows.append([Paragraph(f'📋 {item}', TRIAL)])
    t = Table(rows, colWidths=[17.5*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), LTGREEN),
        ('TOPPADDING', (0,0), (-1,-1), 2),
        ('BOTTOMPADDING', (0,0), (-1,-1), 2),
        ('LEFTPADDING', (0,0), (-1,-1), 6),
        ('RIGHTPADDING', (0,0), (-1,-1), 6),
        ('BOX', (0,0), (-1,-1), 0.5, GREEN),
    ]))
    return t

def make_table(headers, rows, col_widths=None):
    if col_widths is None:
        n = len(headers)
        col_widths = [17.5*cm/n]*n
    data = [[Paragraph(h, TABLE_H) for h in headers]]
    for row in rows:
        data.append([Paragraph(str(c), TABLE_BC) for c in row])
    t = Table(data, colWidths=col_widths)
    ts = TableStyle([
        ('BACKGROUND', (0,0), (-1,0), NAVY),
        ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, LGRAY]),
        ('GRID', (0,0), (-1,-1), 0.3, colors.HexColor('#AAAAAA')),
        ('TOPPADDING', (0,0), (-1,-1), 3),
        ('BOTTOMPADDING', (0,0), (-1,-1), 3),
        ('LEFTPADDING', (0,0), (-1,-1), 4),
        ('RIGHTPADDING', (0,0), (-1,-1), 4),
        ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
    ])
    t.setStyle(ts)
    return t

def flowchart_box(title, steps):
    rows = [[Paragraph(f'<b>{title}</b>', S('fct', fontSize=9, textColor=NAVY,
                       fontName='Helvetica-Bold', alignment=TA_CENTER))]]
    for i, step in enumerate(steps):
        arrow = '' if i == len(steps)-1 else ' ▼'
        rows.append([Paragraph(f'{step}{arrow}', S('fcs', fontSize=8.5,
                                textColor=DGRAY, fontName='Helvetica',
                                alignment=TA_CENTER))])
    t = Table(rows, colWidths=[17.5*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (0,0), LTBLUE),
        ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, LGRAY]),
        ('GRID', (0,0), (-1,-1), 0.3, BLUE),
        ('TOPPADDING', (0,0), (-1,-1), 3),
        ('BOTTOMPADDING', (0,0), (-1,-1), 3),
        ('LEFTPADDING', (0,0), (-1,-1), 6),
        ('RIGHTPADDING', (0,0), (-1,-1), 6),
    ]))
    return t

def B(text):
    return Paragraph(f'• {text}', BULLET)

def P(text):
    return Paragraph(text, BODY)

def SP(n=4):
    return Spacer(1, n)

story = []

# ============================================================
# COVER PAGE
# ============================================================
story.append(Spacer(1, 2*cm))
cover_data = [
    [Paragraph('INI SS CET CVTS', S('ct', fontSize=26, textColor=colors.white,
               fontName='Helvetica-Bold', alignment=TA_CENTER))],
    [Paragraph('HIGH YIELD TEACHING NOTES', S('ct2', fontSize=18, textColor=GOLD,
               fontName='Helvetica-Bold', alignment=TA_CENTER))],
    [Paragraph('Chapters 52–55', S('ct3', fontSize=14, textColor=colors.white,
               fontName='Helvetica', alignment=TA_CENTER))],
    [Spacer(1, 0.4*cm)],
    [Paragraph('Chapter 52: Coronary Angiography, Valve &amp; Hemodynamic Assessment', 
               S('ci', fontSize=11, textColor=GOLD, fontName='Helvetica', alignment=TA_CENTER))],
    [Paragraph('Chapter 53: CMR &amp; CCT in Cardiovascular Diagnosis', 
               S('ci', fontSize=11, textColor=GOLD, fontName='Helvetica', alignment=TA_CENTER))],
    [Paragraph('Chapter 54: Nuclear Cardiology &amp; PET', 
               S('ci', fontSize=11, textColor=GOLD, fontName='Helvetica', alignment=TA_CENTER))],
    [Paragraph('Chapter 55: Diagnostic Echocardiography', 
               S('ci', fontSize=11, textColor=GOLD, fontName='Helvetica', alignment=TA_CENTER))],
    [Spacer(1, 0.5*cm)],
    [Paragraph('Includes: Flowcharts • Tables • Landmark Trials • Memory Aids', 
               S('ci', fontSize=9, textColor=colors.white, fontName='Helvetica-Oblique', alignment=TA_CENTER))],
    [Paragraph('Exam Pearls • Probable Questions • Last Minute Revision', 
               S('ci', fontSize=9, textColor=colors.white, fontName='Helvetica-Oblique', alignment=TA_CENTER))],
]
cover_t = Table(cover_data, colWidths=[17.5*cm])
cover_t.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,-1), NAVY),
    ('TOPPADDING', (0,0), (-1,-1), 6),
    ('BOTTOMPADDING', (0,0), (-1,-1), 6),
    ('LEFTPADDING', (0,0), (-1,-1), 20),
    ('RIGHTPADDING', (0,0), (-1,-1), 20),
    ('ROUNDEDCORNERS', [8,8,8,8]),
]))
story.append(cover_t)
story.append(Spacer(1, 1*cm))
story.append(Paragraph('Prepared for INI SS CET 2025-26 | Cardiovascular &amp; Thoracic Surgery | July 2026',
    S('ft', fontSize=9, textColor=colors.grey, fontName='Helvetica-Oblique', alignment=TA_CENTER)))
story.append(PageBreak())

# ============================================================
# CHAPTER 52 - CORONARY ANGIOGRAPHY, VALVE & HEMODYNAMIC ASSESSMENT
# ============================================================
story.append(chapter_header('CHAPTER 52', 'Coronary Angiography: Valve and Hemodynamic Assessment'))
story.append(SP(6))

story.append(section_box('1. VASCULAR ACCESS — KEY FACTS'))
story.append(SP(3))
cols = [6*cm, 5.5*cm, 6*cm]
story.append(make_table(
    ['Feature', 'Femoral (TFA)', 'Radial (TRA)'],
    [
        ['Access site', 'CFA, below inguinal lig', 'Radial artery, snuffbox'],
        ['Complication rate', '2–5% vascular', '<1% major access'],
        ['Bleeding risk', 'Higher', 'Lower (RIFLE)'],
        ['NCDR adoption (2020)', '~47%', '~53%'],
        ['Preferred in ACS', 'Complex anatomy', 'First-line (MATRIX trial)'],
        ['Patency concern', 'None', 'Radial conduit for CABG'],
        ['Cannula used', 'Seldinger / Micropuncture', 'Micropuncture 0.018"'],
    ], col_widths=cols
))
story.append(SP(4))
story.append(pearl_box([
    'EXAM PEARL: MATRIX trial — radial access reduces mortality in STEMI (Eur Heart J 2015)',
    'EXAM PEARL: Radial artery occlusion ~5% — prevented by heparin + patent haemostasis band',
    'EXAM PEARL: Distal transradial ("snuffbox") access — increasing adoption; less RAO risk',
    'EXAM PEARL: Ultrasound-guided femoral access recommended for large-bore access (TAVR, ECMO)',
]))
story.append(SP(4))

story.append(section_box('2. CORONARY ANATOMY & ANGIOGRAPHIC PROJECTIONS'))
story.append(SP(3))
story.append(make_table(
    ['Artery / Segment', 'Best Projection', 'Notes'],
    [
        ['LM ostium', 'Shallow LAO + cranial', 'Dampened pressure = LM lesion'],
        ['LM bifurcation', 'LAO caudal (spider view)', 'Terminal bifurcation / trifurcation'],
        ['Proximal LAD', 'Steep LAO + cranial (50/50)', 'Best for LM-LAD junction'],
        ['Mid/distal LAD', 'RAO caudal / LAO', 'Septal and diagonal branches'],
        ['LCX / Marginals', 'RAO caudal / Spider view', 'AV groove vessel'],
        ['RCA proximal ostium', 'Steep LAO (50°)', 'JR4 catheter default'],
        ['RCA mid', 'LAO / Flat RAO', 'Acute marginal branches here'],
        ['RCA distal (crux)', 'AP + cranial (20-30°)', 'PDA/PLB origin seen here'],
        ['Bypass grafts', 'Flat LAO + RAO', 'SVGs from anterior aorta'],
        ['LIMA', 'AP/RAO cranial + Lateral', 'Subclavian engagement first'],
    ],
    col_widths=[5*cm, 5.5*cm, 7*cm]
))
story.append(SP(4))
story.append(memory_box('Dominance: "Right is Right" — 60% right dominant. LCX gives PDA in 15% left dominant.'))
story.append(SP(4))

story.append(section_box('3. CORONARY PHYSIOLOGY: FFR & BEYOND'))
story.append(SP(3))
story.append(flowchart_box('FFR Decision Algorithm', [
    'Angiographically indeterminate lesion (40–70% stenosis)',
    'Advance 0.014" pressure wire distal to lesion',
    'Induce maximum hyperemia (IV adenosine 140 mcg/kg/min)',
    'FFR = Pd/Pa (distal/proximal pressure)',
    'FFR ≤0.80 → Hemodynamically significant → Revascularize',
    'FFR >0.80 → Not significant → Defer PCI (safe outcome)',
]))
story.append(SP(4))
story.append(make_table(
    ['Index', 'Requires Hyperemia?', 'Threshold', 'Notes'],
    [
        ['FFR (Fractional Flow Reserve)', 'YES (adenosine)', '≤0.80 = significant', 'Gold standard — DEFER, FAME, FAME-2'],
        ['iFR (Instantaneous wave-Free Ratio)', 'No', '≤0.89 = significant', 'DEFINE-FLAIR, iFR-SWEDEHEART trials'],
        ['dPR / RFR / DFR', 'No', '≤0.89', 'Non-hyperemic pressure ratios (NHPRs)'],
        ['QFR (Angiography-derived FFR)', 'No (software)', '≤0.80', 'No wire needed — FAVOR III'],
        ['CT-FFR (HeartFlow)', 'No (AI-CT)', '≤0.80', 'PLATFORM trial — safe deferral'],
    ],
    col_widths=[5*cm, 3.5*cm, 4*cm, 5*cm]
))
story.append(SP(4))
story.append(trial_box([
    'DEFER Trial: FFR >0.75 → safe deferral; 5-yr MACE rates similar to revascularized group',
    'FAME Trial: FFR-guided PCI vs. angio-guided → fewer stents, lower MACE at 2 years',
    'FAME-2 Trial: FFR-positive lesions → PCI superior to medical therapy in stable CAD',
    'DEFINE-FLAIR/iFR-SWEDEHEART: iFR non-inferior to FFR for guiding revascularization',
]))
story.append(SP(4))

story.append(section_box('4. IVUS vs OCT — HIGH YIELD COMPARISON'))
story.append(SP(3))
story.append(make_table(
    ['Parameter', 'IVUS', 'OCT'],
    [
        ['Wave type', 'Ultrasound (40 MHz)', 'Near-infrared light (1.3 μm)'],
        ['Axial resolution', '100–150 μm', '10–15 μm (10× better)'],
        ['Penetration depth', '5–6 mm (full wall)', '1–2 mm (superficial only)'],
        ['Blood clearance needed?', 'No', 'Yes (contrast flush)'],
        ['Best use', 'LM assessment, full wall', 'Plaque composition, dissection'],
        ['LM MLA cutoff (defer)', '>6.0 mm²', 'Not established separately'],
        ['Key trials', 'IVUS-XPL, ULTIMATE', 'ILUMIEN II, ILUMIEN III, OPINION'],
    ],
    col_widths=[5*cm, 6*cm, 6.5*cm]
))
story.append(SP(4))

story.append(section_box('5. HEMODYNAMIC EVALUATION — KEY VALUES'))
story.append(SP(3))
story.append(make_table(
    ['Measurement', 'Normal / Threshold', 'Clinical Significance'],
    [
        ['LVEDP (LV end-diastolic)', '<12 mmHg', '>18 = elevated filling pressures (CHF)'],
        ['Pulm Capillary Wedge Pressure', '6–12 mmHg', '>18 = significant mitral disease / CHF'],
        ['PA systolic pressure', '<25 mmHg', '>40 = pulmonary hypertension'],
        ['Gorlin formula (valve area)', 'AVA = CO / (44.3 × SEP × √ΔP)', 'Gold standard for valve area in cath lab'],
        ['Hakki formula (simplified AVA)', 'AVA = CO / √ΔP', 'Quick estimate; valid at resting HR'],
        ['Cardiac Output (Fick)', 'VO₂ / (CaO₂ - CvO₂) × Hb × 13.6', 'Most accurate in low CO states'],
        ['Cardiac Output (TD)', 'Stewart-Hamilton equation', 'Adequate at normal CO; overestimates low CO'],
        ['Aortic Stenosis: severe', 'AVA <1.0 cm², Vmax >4 m/s', 'MPG >40 mmHg also severe'],
        ['Mitral Stenosis: severe', 'MVA <1.0 cm²', 'PHT >220 ms; MPG >10 mmHg'],
    ],
    col_widths=[5*cm, 5.5*cm, 7*cm]
))
story.append(SP(4))
story.append(pearl_box([
    'EXAM PEARL: Gorlin formula underestimates valve area at low flow — use Hakki or dobutamine challenge',
    'EXAM PEARL: Simultaneous LV-Ao pressure pullback rules out HOCM vs fixed AS (dynamic gradient in HOCM)',
    'EXAM PEARL: Mean PCWP > mean PAP = artifactual wedge (not true wedge)',
    'EXAM PEARL: Ventriculoarterial dissociation on pullback = subvalvular obstruction',
]))
story.append(SP(4))

story.append(section_box('6. SHUNTS & VASCULAR RESISTANCE'))
story.append(SP(3))
story.append(make_table(
    ['Parameter', 'Formula / Normal', 'Key Point'],
    [
        ['Qp:Qs (shunt fraction)', 'Qp/Qs = (SaO₂-MvO₂)/(PvO₂-PaO₂)', 'Qp:Qs >1.5:1 = significant L→R shunt'],
        ['PVR (Wood Units)', 'PVR = (mPAP - PCWP) / CO', '<3 WU = normal; >5 WU = severe PH'],
        ['SVR', 'SVR = (MAP - CVP) / CO × 80', '800-1200 dyn·s/cm⁵ = normal'],
        ['Eisenmenger physiology', 'Qp:Qs <1 + PVR >8 WU', 'Contraindication to repair'],
    ],
    col_widths=[5*cm, 6.5*cm, 6*cm]
))
story.append(SP(4))

story.append(section_box('LAST MINUTE REVISION — CHAPTER 52'))
story.append(SP(3))
lmr_data = [
    [Paragraph('<b>Topic</b>', TABLE_H), Paragraph('<b>One-liner</b>', TABLE_H)],
    [Paragraph('FFR cutoff', TABLE_B), Paragraph('≤0.80 = significant; validated in DEFER/FAME/FAME-2', TABLE_B)],
    [Paragraph('Radial vs femoral in STEMI', TABLE_B), Paragraph('MATRIX: radial reduces net adverse clinical events (NACE)', TABLE_B)],
    [Paragraph('IVUS-LM deferral', TABLE_B), Paragraph('MLA >6 mm² = safe to defer PCI', TABLE_B)],
    [Paragraph('JL4 success rate', TABLE_B), Paragraph('~80% for LM engagement; amplatz for posterior LM', TABLE_B)],
    [Paragraph('Gorlin vs Hakki', TABLE_B), Paragraph('Hakki = simplified; valid at HR ~70; underestimates at low HR', TABLE_B)],
    [Paragraph('Qp:Qs for ASD/VSD repair', TABLE_B), Paragraph('>1.5:1 = surgical/transcatheter closure indicated', TABLE_B)],
    [Paragraph('OCT vs IVUS (resolution)', TABLE_B), Paragraph('OCT: 10–15 μm (better); IVUS: 100–150 μm (deeper)', TABLE_B)],
    [Paragraph('iFR vs FFR', TABLE_B), Paragraph('iFR: ≤0.89 significant; no hyperemia; DEFINE-FLAIR non-inferior', TABLE_B)],
]
lmr_t = Table(lmr_data, colWidths=[6*cm, 11.5*cm])
lmr_t.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), TEAL),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, LGRAY]),
    ('GRID', (0,0), (-1,-1), 0.3, colors.HexColor('#AAAAAA')),
    ('TOPPADDING', (0,0), (-1,-1), 3),
    ('BOTTOMPADDING', (0,0), (-1,-1), 3),
    ('LEFTPADDING', (0,0), (-1,-1), 4),
    ('RIGHTPADDING', (0,0), (-1,-1), 4),
]))
story.append(lmr_t)
story.append(PageBreak())

# ============================================================
# CHAPTER 53 - CMR & CCT
# ============================================================
story.append(chapter_header('CHAPTER 53', 'CMR & CCT in Cardiovascular Diagnosis'))
story.append(SP(6))

story.append(section_box('1. CMR vs CCT — PRINCIPLES & COMPARISON'))
story.append(SP(3))
story.append(make_table(
    ['Feature', 'CMR', 'CCT'],
    [
        ['Radiation', 'None (MRI)', '5–21 mSv (modality-dependent)'],
        ['Contrast', 'Gadolinium (optional)', 'Iodinated (mandatory)'],
        ['Temporal resolution', '<40 ms (ECG-gated)', '165–200 ms (half-cycle)'],
        ['Spatial resolution', '1–2 mm in-plane', '0.5 mm isotropic (better)'],
        ['LV volume (reference std)', 'YES — gold standard', 'Comparable'],
        ['Radiation (step-shoot)', 'N/A', '4–6 mSv (lowest)'],
        ['Atrial fibrillation', 'Real-time CMR possible', 'Poor quality — 256/320-slice helps'],
        ['Gadolinium (CKD, eGFR)', 'Risk NSF if eGFR <30', 'Iodinated contrast risk AKI'],
        ['Pacemaker safety', 'CMR-conditional devices OK at 1.5T', 'No restriction'],
    ],
    col_widths=[5*cm, 6*cm, 6.5*cm]
))
story.append(SP(4))
story.append(pearl_box([
    'EXAM PEARL: CMR = gold standard for LV volumes, mass, and EF (reproducibility)',
    'EXAM PEARL: LGE (Late Gadolinium Enhancement) = identifies myocardial scar, edema, fibrosis',
    'EXAM PEARL: LGE imaged 5–10 min after gadolinium injection',
    'EXAM PEARL: CCT preferred acutely; CMR preferred for serial follow-up (no radiation)',
    'EXAM PEARL: CCT step-and-shoot mode = lowest radiation (4–6 mSv)',
]))
story.append(SP(4))

story.append(section_box('2. CMR SEQUENCES — WHAT EACH SHOWS'))
story.append(SP(3))
story.append(make_table(
    ['Sequence', 'Appearance', 'Clinical Use'],
    [
        ['Spin-echo (black blood)', 'Blood = dark; wall = gray', 'Anatomy, tissue characterization'],
        ['Gradient-echo / bSSFP (bright blood)', 'Blood = bright', 'Cine imaging, wall motion, EF'],
        ['LGE (T1-weighted post-Gd)', 'Scar/fibrosis = bright', 'MI, myocarditis, cardiomyopathy'],
        ['T2-weighted', 'Edema = bright', 'Acute myocarditis, myocardial injury'],
        ['T2* mapping', 'Shortened T2*', 'Iron deposition — hemochromatosis'],
        ['Native T1 mapping', 'Elevated T1', 'Amyloidosis, diffuse fibrosis'],
        ['ECV (extracellular volume)', 'Elevated ECV', 'Amyloidosis >40%; HCM fibrosis'],
        ['Phase contrast (flow velocity)', 'Quantitative flow', 'AR, MR regurgitant fraction, Qp:Qs'],
        ['Fat suppression', 'Fat signal suppressed', 'Lipomatous septum, ARVC'],
        ['Real-time CMR', 'Lower resolution', 'Atrial fibrillation / unable to breath-hold'],
    ],
    col_widths=[5*cm, 5*cm, 7.5*cm]
))
story.append(SP(4))

story.append(section_box('3. CMR IN CARDIOMYOPATHIES — LGE PATTERNS (HIGH YIELD TABLE)'))
story.append(SP(3))
story.append(make_table(
    ['Condition', 'LGE Pattern', 'Additional CMR Finding'],
    [
        ['Ischemic cardiomyopathy', 'Subendocardial / transmural (coronary territory)', 'Matches coronary distribution'],
        ['Non-ischemic / Myocarditis', 'Mid-wall / epicardial (non-coronary)', 'T2 bright (edema in acute)'],
        ['Hypertrophic cardiomyopathy (HCM)', 'RV insertion points + hypertrophied areas', 'Asymmetric septal thickening'],
        ['Amyloidosis (AL/ATTR)', 'Diffuse subendocardial / transmural', 'High native T1 + elevated ECV (>40%)'],
        ['Cardiac Sarcoidosis', 'Focal mid-wall / patchy (non-coronary)', 'T2 hyperintensity; FDG-PET positive'],
        ['ARVC', 'RV free wall fatty infiltration', 'Fat suppression; RV dilation'],
        ['Hemochromatosis', 'None typically', 'Depressed T2* (iron deposits)'],
        ['DCM (non-ischemic)', 'Mid-wall linear LGE or absent', 'Global LV dilation'],
    ],
    col_widths=[5*cm, 6*cm, 6.5*cm]
))
story.append(SP(4))
story.append(memory_box('Amyloid LGE: "Can\'t null the myocardium" — diffuse enhancement with abnormal nulling point'))
story.append(SP(4))

story.append(section_box('4. CCT IN TAVR PLANNING — STEP BY STEP'))
story.append(SP(3))
story.append(flowchart_box('Pre-TAVR CCT Protocol', [
    'Double-oblique views → Measure aortic annulus (major/minor diameter + perimeter)',
    'Assess aortic valve: leaflet morphology, bicuspid vs tricuspid, calcification',
    'Measure LVOT diameter for valve sizing',
    'Identify coronary ostia height from annulus (risk of coronary occlusion)',
    'CT iliac/femoral arteries → vessel diameter, calcification, tortuosity (access planning)',
    'Select valve size based on perimeter/area (avoid undersizing → paravalvular leak)',
]))
story.append(SP(4))
story.append(pearl_box([
    'EXAM PEARL: CCT is MANDATORY before TAVR — echocardiography alone insufficient for sizing',
    'EXAM PEARL: Coronary height <10 mm from annulus = high risk of coronary occlusion after TAVR',
    'EXAM PEARL: Aortic annular calcification = risk of annular rupture',
    'EXAM PEARL: CMR preferred over CCT in young patients / congenital HD (radiation concern)',
    'EXAM PEARL: Qp:Qs ratio from phase contrast CMR: >1.5 = significant shunt',
]))
story.append(SP(4))

story.append(section_box('5. THORACIC AORTA: CMR vs CCT'))
story.append(SP(3))
story.append(make_table(
    ['Clinical Scenario', 'Preferred Imaging', 'Reason'],
    [
        ['Acute aortic dissection', 'CCT (gated)', 'Fastest, widely available ER'],
        ['Chronic aortic aneurysm follow-up', 'CMR or non-contrast MRA', 'No radiation; young patients'],
        ['Post-EVAR follow-up', 'CCT preferred', 'Metal struts artifact on CMR'],
        ['Post-surgical repair', 'CCT (if hardware)', 'Assess graft, thrombus, endoleak'],
        ['Post-dissection follow-up', 'CCT at 1, 6, 12 mo then annually', 'Detect expansion, false lumen'],
        ['Aortic coarctation', 'CMR (no radiation)', 'Qp:Qs, gradient, arch anatomy'],
    ],
    col_widths=[5*cm, 5*cm, 7.5*cm]
))
story.append(SP(4))

story.append(section_box('LAST MINUTE REVISION — CHAPTER 53'))
story.append(SP(3))
lmr2 = [
    [Paragraph('<b>Topic</b>', TABLE_H), Paragraph('<b>Key Point</b>', TABLE_H)],
    [Paragraph('LGE timing', TABLE_B), Paragraph('5–10 min after gadolinium injection', TABLE_B)],
    [Paragraph('CMR gold standard for', TABLE_B), Paragraph('LV volumes, mass, EF (most reproducible)', TABLE_B)],
    [Paragraph('Native T1 elevated in', TABLE_B), Paragraph('Amyloidosis (both AL and ATTR), myocarditis, diffuse fibrosis', TABLE_B)],
    [Paragraph('T2* low in', TABLE_B), Paragraph('Hemochromatosis (iron overload)', TABLE_B)],
    [Paragraph('CCT lowest radiation', TABLE_B), Paragraph('Step-and-shoot (prospective gating) = 4–6 mSv', TABLE_B)],
    [Paragraph('NSF risk', TABLE_B), Paragraph('Gadolinium + eGFR <30 → use macrocyclic agents; avoid dialysis patients', TABLE_B)],
    [Paragraph('TAVR planning', TABLE_B), Paragraph('CCT mandatory: annular size, leaflet morphology, coronary heights, access planning', TABLE_B)],
    [Paragraph('Pericardial thickness (CMR)', TABLE_B), Paragraph('Normal ≤3 mm; constriction >6 mm (focal)', TABLE_B)],
    [Paragraph('ARVC diagnosis', TABLE_B), Paragraph('CMR: RV enlargement, fatty infiltration, RV free wall LGE', TABLE_B)],
]
lmr2_t = Table(lmr2, colWidths=[6*cm, 11.5*cm])
lmr2_t.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), TEAL),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, LGRAY]),
    ('GRID', (0,0), (-1,-1), 0.3, colors.HexColor('#AAAAAA')),
    ('TOPPADDING', (0,0), (-1,-1), 3),
    ('BOTTOMPADDING', (0,0), (-1,-1), 3),
    ('LEFTPADDING', (0,0), (-1,-1), 4),
    ('RIGHTPADDING', (0,0), (-1,-1), 4),
]))
story.append(lmr2_t)
story.append(PageBreak())

# ============================================================
# CHAPTER 54 - NUCLEAR CARDIOLOGY & PET
# ============================================================
story.append(chapter_header('CHAPTER 54', 'Nuclear Cardiology & Positron Emission Tomography'))
story.append(SP(6))

story.append(section_box('1. RADIOTRACERS — SPECT & PET'))
story.append(SP(3))
story.append(make_table(
    ['Tracer', 'Modality', 'Mechanism', 'Clinical Use'],
    [
        ['⁹⁹ᵐTc-sestamibi (MIBI)', 'SPECT', 'Lipophilic; mitochondrial trapping', 'Stress MPI — most common in USA'],
        ['⁹⁹ᵐTc-tetrofosmin', 'SPECT', 'Same as MIBI; faster clearance', 'Stress MPI; minimal redistribution'],
        ['²⁰¹Thallium', 'SPECT', 'K⁺ analog; Na/K-ATPase transport', 'MPI + viability (redistribution)'],
        ['¹³N-Ammonia', 'PET', 'Short half-life (10 min)', 'Rest/stress perfusion (flow absolute)'],
        ['⁸²Rubidium', 'PET', 'K⁺ analog; generator-produced', 'Rest/stress perfusion; no cyclotron'],
        ['¹⁸F-FDG', 'PET', 'Glucose analog; hexokinase trap', 'Viability; sarcoidosis diagnosis'],
        ['⁹⁹ᵐTc-PYP / DPD', 'SPECT', 'Bone tracer; binds amyloid', 'Cardiac ATTR amyloidosis diagnosis'],
    ],
    col_widths=[4*cm, 2.2*cm, 5*cm, 6.3*cm]
))
story.append(SP(4))
story.append(pearl_box([
    'EXAM PEARL: FDG-PET = gold standard for myocardial viability (perfusion-metabolism mismatch)',
    'EXAM PEARL: PYP/DPD positive (grade 2-3) with negative blood pool = ATTR amyloidosis diagnosis without biopsy',
    'EXAM PEARL: ⁹⁹ᵐTc agents do NOT redistribute — dual injection needed (stress + rest separately)',
    'EXAM PEARL: ²⁰¹Tl redistributes — single injection + delayed imaging for viability',
    'EXAM PEARL: FDG patient prep: high-fat ketogenic diet 24h + 12h fast before scan (suppress normal cardiac uptake)',
]))
story.append(SP(4))

story.append(section_box('2. ISCHEMIC CASCADE — HIGH YIELD DIAGRAM'))
story.append(SP(3))
story.append(flowchart_box('Ischemic Cascade (Earliest to Latest)', [
    '1. Perfusion abnormality (detectable by SPECT/PET — EARLIEST)',
    '2. Diastolic dysfunction',
    '3. Regional wall motion abnormality (RWMA)',
    '4. ECG changes (ST depression/elevation)',
    '5. Angina (symptoms — LATEST)',
    'Note: Nuclear perfusion detects CAD BEFORE symptoms or ECG changes',
]))
story.append(SP(4))

story.append(section_box('3. STRESS TESTING — PHARMACOLOGIC AGENTS'))
story.append(SP(3))
story.append(make_table(
    ['Agent', 'Mechanism', 'Contraindications', 'Reversal'],
    [
        ['Adenosine', 'Direct A2a vasodilation', 'Asthma/COPD, 2°/3° AV block, SBP <90', 'Theophylline/aminophylline'],
        ['Dipyridamole', 'Blocks adenosine reuptake → endogenous adenosine ↑', 'Same as adenosine; + caffeine (24h hold)', 'Aminophylline'],
        ['Regadenoson (Lexiscan)', 'Selective A2a agonist', 'Fewer AV block/bronchospasm', 'Aminophylline'],
        ['Dobutamine', 'β1 agonist → ↑HR, ↑contractility', 'Severe HTN, LVOTO, arrhythmias', 'β-blocker (esmolol)'],
    ],
    col_widths=[4*cm, 5.5*cm, 5*cm, 3*cm]
))
story.append(SP(4))
story.append(memory_box('ADRR mnemonic for pharmacologic stress: Adenosine, Dipyridamole, Regadenoson (vasodilators), and dobutamine (ionotrope)'))
story.append(SP(4))

story.append(section_box('4. MYOCARDIAL VIABILITY — PET vs SPECT (KEY TABLE)'))
story.append(SP(3))
story.append(make_table(
    ['Scenario', 'Perfusion', 'FDG Metabolism', 'Diagnosis'],
    [
        ['Normal myocardium', 'Normal', 'Normal (fatty acid use)', 'Normal'],
        ['Scar / Infarct', 'Reduced ↓', 'Reduced ↓ (matched)', 'Non-viable → No benefit from revascularization'],
        ['Hibernating / Viable myocardium', 'Reduced ↓', 'Preserved / ↑ (MISMATCHED)', 'VIABLE → Revascularize to improve EF + survival'],
        ['Stunning (post-reperfusion)', 'Normal', 'Normal', 'Viable — will recover without revascularization'],
    ],
    col_widths=[4*cm, 3.5*cm, 4.5*cm, 5.5*cm]
))
story.append(SP(4))
story.append(trial_box([
    'STICH Trial (NEJM 2011): CABG + medical therapy vs. medical therapy alone in ischemic LV dysfunction (EF ≤35%)',
    '→ No improvement in all-cause mortality at 56 months; BUT cardiovascular death lower with CABG (28% vs 33%)',
    'STICH Viability Substudy: Viability on imaging (SPECT/echo) did NOT predict differential benefit of CABG vs. medical Rx',
    'PARR-2 Trial: Trend toward improved 1-year outcome with PET-FDG guided therapy vs. standard care',
    'Meta-analysis (24 studies, >3000 pts): Viable myocardium → 3.2% annual mortality with revascularization vs 16% with medical Rx',
]))
story.append(SP(4))

story.append(section_box('5. CARDIAC AMYLOIDOSIS (PYP IMAGING) & SARCOIDOSIS (FDG-PET)'))
story.append(SP(3))
story.append(make_table(
    ['Condition', 'Imaging', 'Protocol / Positive Criteria', 'Key Point'],
    [
        ['ATTR amyloidosis', '⁹⁹ᵐTc-PYP or DPD SPECT', 'H/CL ratio ≥1.5 (1h) or ≥1.3 (3h); Grade 2-3', '>90% sensitivity/specificity; no biopsy needed if no M-protein'],
        ['AL amyloidosis', 'PYP SPECT (usually negative)', 'Grade 0-1 (minimal uptake)', 'Negative PYP + amyloid → biopsy for AL'],
        ['Cardiac sarcoidosis', '¹⁸F-FDG PET + perfusion MPI', 'Focal FDG uptake + perfusion defect', 'Pre-scan: ketogenic diet to suppress normal cardiac FDG'],
        ['Sarcoidosis (diagnosis)', 'FDG-PET + CMR', 'FDG in granulomas; LGE on CMR', 'FDG + CMR complementary; both used'],
    ],
    col_widths=[4*cm, 3.5*cm, 5*cm, 5*cm]
))
story.append(SP(4))
story.append(pearl_box([
    'EXAM PEARL: ATTR amyloidosis — tafamidis treatment; early diagnosis with PYP critical',
    'EXAM PEARL: Cardiac sarcoidosis — high risk sudden death → ICD implantation criteria',
    'EXAM PEARL: Dual isotope protocol (201Tl rest + 99mTc stress) — higher radiation → largely abandoned',
    'EXAM PEARL: Stress-only imaging valid if normal — <1% annualized event rate on follow-up',
]))
story.append(SP(4))

story.append(section_box('LAST MINUTE REVISION — CHAPTER 54'))
story.append(SP(3))
lmr3 = [
    [Paragraph('<b>Topic</b>', TABLE_H), Paragraph('<b>One-liner</b>', TABLE_H)],
    [Paragraph('Earliest ischemia sign', TABLE_B), Paragraph('Perfusion defect (SPECT/PET) — before ECG or symptoms', TABLE_B)],
    [Paragraph('FDG viability mismatch', TABLE_B), Paragraph('Reduced perfusion + preserved FDG = hibernating myocardium → revascularize', TABLE_B)],
    [Paragraph('PYP SPECT (ATTR)', TABLE_B), Paragraph('H/CL ≥1.5 at 1h or Grade 2-3 → ATTR amyloidosis diagnosed without biopsy', TABLE_B)],
    [Paragraph('Regadenoson advantage', TABLE_B), Paragraph('Selective A2a agonist; fewer AV block + bronchospasm vs adenosine', TABLE_B)],
    [Paragraph('STICH trial key message', TABLE_B), Paragraph('CABG improves CV death (not all-cause mortality) in ischemic CM with EF ≤35%', TABLE_B)],
    [Paragraph('Stress-only MPI', TABLE_B), Paragraph('If normal stress → no rest needed; reduces radiation and cost', TABLE_B)],
    [Paragraph('Post-CABG: restenosis window', TABLE_B), Paragraph('3–9 months: SPECT MPI most accurate for detecting restenosis', TABLE_B)],
    [Paragraph('Viability NPV vs PPV', TABLE_B), Paragraph('Dobutamine echo: PPV 84%; Nuclear: PPV 75%; Nuclear NPV 80% (better NPV)', TABLE_B)],
]
lmr3_t = Table(lmr3, colWidths=[6*cm, 11.5*cm])
lmr3_t.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), TEAL),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, LGRAY]),
    ('GRID', (0,0), (-1,-1), 0.3, colors.HexColor('#AAAAAA')),
    ('TOPPADDING', (0,0), (-1,-1), 3),
    ('BOTTOMPADDING', (0,0), (-1,-1), 3),
    ('LEFTPADDING', (0,0), (-1,-1), 4),
    ('RIGHTPADDING', (0,0), (-1,-1), 4),
]))
story.append(lmr3_t)
story.append(PageBreak())

# ============================================================
# CHAPTER 55 - DIAGNOSTIC ECHOCARDIOGRAPHY
# ============================================================
story.append(chapter_header('CHAPTER 55', 'Diagnostic Echocardiography'))
story.append(SP(6))

story.append(section_box('1. ECHO MODALITIES — COMPARISON TABLE'))
story.append(SP(3))
story.append(make_table(
    ['Modality', 'Key Feature', 'Clinical Use'],
    [
        ['TTE (Transthoracic)', '2D standard windows (parasternal, apical, subcostal, SSN)', 'First-line for all cardiac assessment'],
        ['TEE (Transesophageal)', 'Posterior cardiac structures (better); semi-invasive', 'LAA thrombus, endocarditis, aorta, MV, TAVI guidance'],
        ['Epicardial echo', 'Direct contact intraoperative', 'Intraoperative cardiac surgery guidance'],
        ['ICE (Intracardiac echo)', 'Catheter-based imaging', 'Electrophysiology lab, structural procedures (ASD, LAA closure)'],
        ['Contrast echo (agitated saline)', 'Opacify RA/RV; detects shunts', 'PFO/ASD detection; shunts within 3 cycles = intracardiac'],
        ['Microbubble contrast', 'LV opacification; transpulmonary', 'LV wall motion, LV thrombus, myocardial perfusion'],
        ['M-mode echo', 'Single dimension over time', 'Valve motion, LV dimensions (LVEDD, LVESD)'],
        ['3D echo', 'Volumetric; accurate LV/RV volumes', 'HCM assessment, MV anatomy, RV function'],
    ],
    col_widths=[4*cm, 6*cm, 7.5*cm]
))
story.append(SP(4))
story.append(pearl_box([
    'EXAM PEARL: LA thrombus — TEE near 100% sensitivity/specificity; TTE unreliable',
    'EXAM PEARL: Intracardiac shunt → bubbles within 3 cardiac cycles = intracardiac; >5 cycles = intrapulmonary',
    'EXAM PEARL: Acoustic shadowing from mechanical prosthesis → use TEE (posterior window bypasses shadow)',
    'EXAM PEARL: Vegetations = mobile masses on UPSTREAM side of valve (ventricular side of aortic valve)',
]))
story.append(SP(4))

story.append(section_box('2. VALVULAR HEART DISEASE — ECHO PARAMETERS'))
story.append(SP(3))
story.append(make_table(
    ['Valve / Parameter', 'Mild', 'Moderate', 'Severe', 'Key Formula'],
    [
        ['Aortic Stenosis — Vmax', '<3 m/s', '3–4 m/s', '>4 m/s', 'PG = 4V² (Bernoulli)'],
        ['AS — Mean gradient', '<20 mmHg', '20–40 mmHg', '>40 mmHg', '—'],
        ['AS — AVA', '>1.5 cm²', '1.0–1.5 cm²', '<1.0 cm²', 'Continuity eq.'],
        ['AS — Indexed AVA', '—', '—', '<0.6 cm²/m²', 'Small BSA patients'],
        ['Aortic Regurgitation — PHT', 'Long PHT (>400 ms)', '300-400 ms', '<200 ms', 'Shorter = more severe'],
        ['AR — Holodiastolic flow reversal', 'Absent', 'Partial', 'Complete reversal in desc. Ao', 'CWD aorta; severe AR'],
        ['Mitral Stenosis — MVA (PHT)', '>1.5 cm²', '1.0–1.5 cm²', '<1.0 cm²', 'MVA=220/PHT'],
        ['Mitral Stenosis — Mean gradient', '<5 mmHg', '5–10 mmHg', '>10 mmHg', '—'],
        ['Mitral Regurgitation — Vena contracta', '<3 mm', '3–7 mm', '>7 mm', 'Proximal flow width'],
    ],
    col_widths=[4*cm, 2.8*cm, 2.8*cm, 4*cm, 3.9*cm]
))
story.append(SP(4))
story.append(memory_box('SEVERE AS: "4-4-1": Vmax >4 m/s, MPG >40 mmHg, AVA <1.0 cm²'))
story.append(memory_box('MVA by PHT: MVA = 220 / PHT; severe MS when PHT >220 ms (MVA <1.0 cm²)'))
story.append(SP(4))

story.append(section_box('3. DIASTOLIC DYSFUNCTION — GRADING ALGORITHM (ASE 2016)'))
story.append(SP(3))
story.append(flowchart_box('ASE 2016 Diastolic Function Algorithm', [
    'Step 1: Mitral inflow E/A ratio',
    'E/A < 0.8 + E velocity <50 cm/s → Grade I (impaired relaxation)',
    'E/A > 2 → Grade III (restrictive physiology)',
    'E/A 0.8–2 (indeterminate) → Evaluate 3 criteria:',
    '  (1) Average E/e\' >14  |  (2) TR velocity >2.8 m/s  |  (3) LA volume index >34 mL/m²',
    '2 or 3 positive → Grade II (pseudonormal) | 2 or 3 negative → Normal LAP',
    '1 positive + 1 negative (only 2 available) → Cannot determine LAP',
]))
story.append(SP(4))
story.append(pearl_box([
    'EXAM PEARL: Annulus paradoxus = E/e\' preserved (≤14) despite constrictive pericarditis',
    'EXAM PEARL: Grade III diastolic dysfunction = reversible (Grade IIIa) vs irreversible (Grade IIIb)',
    'EXAM PEARL: In HFpEF: E/A >0.8, E/e\' >14, TR >2.8 m/s, LAVI >34 mL/m²',
    'EXAM PEARL: Constrictive pericarditis: Septal bounce + E/e\' normal + hepatic vein flow reversal',
]))
story.append(SP(4))

story.append(section_box('4. CARDIOMYOPATHIES — ECHO FEATURES'))
story.append(SP(3))
story.append(make_table(
    ['Cardiomyopathy', 'Key Echo Finding', 'Specific Feature'],
    [
        ['HCM (asymmetric septal hypertrophy)', 'Septal wall thickness >15 mm', 'SAM of MV → LVOTO; dynamic Doppler'],
        ['HCM — LVOT obstruction', 'Late-peaking "dagger-shaped" CWD', 'Peak gradient ≥30 mmHg at rest; inducible with Valsalva'],
        ['Cardiac amyloidosis', 'Concentric LV thickening, granular sparkling, biatrial enlargement', '"Cherry on top" GLS — apical sparing'],
        ['Restrictive cardiomyopathy', 'Normal LV wall thickness; diastolic dysfunction Grade III', 'Biatrial enlargement; elevated RVSP'],
        ['LVNC (non-compaction)', 'Spongy myocardium; NC/C ratio >2.0', 'Apical segments most affected'],
        ['Dilated cardiomyopathy', 'Dilated LV + low EF; thin walls', 'Functional MR from tethering; secondary TR'],
        ['Takotsubo (stress CMP)', 'Apical ballooning + basal hyper-contractility', 'Excess catecholamines; resolves within weeks'],
    ],
    col_widths=[4.5*cm, 6*cm, 7*cm]
))
story.append(SP(4))

story.append(section_box('5. PERICARDIAL DISEASE & TAMPONADE'))
story.append(SP(3))
story.append(make_table(
    ['Finding', 'Tamponade', 'Constriction'],
    [
        ['RA collapse', 'Systolic RA collapse (early sign)', 'Absent'],
        ['RV collapse', 'Diastolic RV collapse (specific)', 'Absent'],
        ['IVC dilation', 'Yes (plethoric IVC)', 'Yes'],
        ['Respiratory variation mitral inflow', '>25% (inspiratory decrease)', '>25% (expiratory ↓)'],
        ['Septal bounce', 'Absent', 'Present (ventricular interdependence)'],
        ['E/e\' ratio', 'Variable', 'Normal or low (annulus paradoxus)'],
        ['Hepatic vein', 'Expiratory diastolic reversal', 'Expiratory reversal'],
        ['Diagnosis', 'Clinical + echo (Beck\'s triad)', 'Echo + CT/CMR pericardial thickness >6mm'],
    ],
    col_widths=[5*cm, 6*cm, 6.5*cm]
))
story.append(SP(4))
story.append(pearl_box([
    'EXAM PEARL: Tamponade = hemodynamic emergency; RV diastolic collapse = most specific echo sign',
    'EXAM PEARL: Diastolic RA collapse duration >1/3 of cardiac cycle = highly specific for tamponade',
    'EXAM PEARL: Constrictive pericarditis — surgical pericardiectomy; >50% thickened pericardium NOT always present',
    'EXAM PEARL: Post-cardiac surgery = loculated effusion; may cause selective chamber compression',
    'EXAM PEARL: "Pulsus paradoxus" >10 mmHg = clinical tamponade (echo shows respiratory MV variation >25%)',
]))
story.append(SP(4))

story.append(section_box('6. AORTIC DISEASE, CARDIAC MASSES & PERIOPERATIVE ECHO'))
story.append(SP(3))
story.append(make_table(
    ['Topic', 'Key Echo Finding', 'Clinical Decision'],
    [
        ['Type A aortic dissection', 'Intimal flap in ascending Ao; AR; hemopericardium', 'Emergency surgery — do not delay for imaging'],
        ['Type B dissection', 'Descending Ao flap by TEE', 'Medical management / TEVAR'],
        ['Left atrial myxoma', 'Pedunculated mass from IAS; mobile', 'Most common benign cardiac tumor; surgical excision'],
        ['Papillary fibroelastoma', 'Small mobile valve mass (usually aortic valve)', 'Surgery if embolic or >1 cm'],
        ['LV apical thrombus', 'Filling defect apically; no contrast uptake', 'TTE sensitivity 95%, specificity 88%; anticoagulate'],
        ['PFO detection', 'Agitated saline: bubbles <3 cycles after RA opacification', 'Consider closure if cryptogenic stroke'],
        ['Aortic root dilation', 'Parasternal long axis; sinus of Valsalva dilation', 'Replace ascending Ao if >5.5 cm (4.5 cm in Marfan)'],
    ],
    col_widths=[4.5*cm, 6*cm, 7*cm]
))
story.append(SP(4))
story.append(memory_box('Myxoma vs thrombus: Myxoma = STALK on IAS (fossa ovalis); Thrombus = base on infarcted/stagnant area'))
story.append(SP(4))

story.append(section_box('LAST MINUTE REVISION — CHAPTER 55'))
story.append(SP(3))
lmr4 = [
    [Paragraph('<b>Topic</b>', TABLE_H), Paragraph('<b>One-liner</b>', TABLE_H)],
    [Paragraph('Severe AS (4-4-1)', TABLE_B), Paragraph('Vmax >4 m/s, MPG >40 mmHg, AVA <1.0 cm²', TABLE_B)],
    [Paragraph('Low-flow Low-gradient AS', TABLE_B), Paragraph('Classical: EF <50%; Paradoxical: EF >50% but small LV', TABLE_B)],
    [Paragraph('MVA formula', TABLE_B), Paragraph('MVA = 220/PHT (cm²); PHT >220 ms = severe MS', TABLE_B)],
    [Paragraph('LVOT obstruction HCM', TABLE_B), Paragraph('Late-peaking CWD; SAM of MV; dynamic — worsens with Valsalva/exercise', TABLE_B)],
    [Paragraph('Tamponade vs constriction', TABLE_B), Paragraph('Tamponade: RV diastolic collapse; Constriction: septal bounce + annulus paradoxus', TABLE_B)],
    [Paragraph('LA thrombus', TABLE_B), Paragraph('TEE ~100% sensitivity; TTE unreliable; rule out before cardioversion', TABLE_B)],
    [Paragraph('Amyloid echo pattern', TABLE_B), Paragraph('"Cherry on top" GLS = apical sparing; granular sparkling; thick walls; biatrial dilation', TABLE_B)],
    [Paragraph('Shunt detection echo', TABLE_B), Paragraph('Agitated saline: bubbles <3 cycles = intracardiac; >5 cycles = intrapulmonary', TABLE_B)],
    [Paragraph('Perioperative TEE', TABLE_B), Paragraph('Grade C recommendation for all cardiac surgery; detects acute complications', TABLE_B)],
    [Paragraph('Dobutamine echo viability', TABLE_B), Paragraph('Biphasic response = hibernating; sustained wall motion = stunned; no change = scar', TABLE_B)],
]
lmr4_t = Table(lmr4, colWidths=[6*cm, 11.5*cm])
lmr4_t.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), TEAL),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, LGRAY]),
    ('GRID', (0,0), (-1,-1), 0.3, colors.HexColor('#AAAAAA')),
    ('TOPPADDING', (0,0), (-1,-1), 3),
    ('BOTTOMPADDING', (0,0), (-1,-1), 3),
    ('LEFTPADDING', (0,0), (-1,-1), 4),
    ('RIGHTPADDING', (0,0), (-1,-1), 4),
]))
story.append(lmr4_t)
story.append(PageBreak())

# ============================================================
# MASTER LAST MINUTE REVISION TABLE (ALL CHAPTERS)
# ============================================================
story.append(chapter_header('MASTER REVISION TABLE', 'All Chapters 52–55 | Most Probable INI SS Questions'))
story.append(SP(6))

story.append(section_box('PROBABLE INI SS CET QUESTIONS — KEY POINTS'))
story.append(SP(3))
prob_q = [
    [Paragraph('<b>Topic</b>', TABLE_H), Paragraph('<b>Key Point (Exam Answer)</b>', TABLE_H), Paragraph('<b>Chapter</b>', TABLE_H)],
    [Paragraph('FAME trial outcome', TABLE_B), Paragraph('FFR-guided PCI: fewer stents + lower MACE at 2 years vs. angio-guided', TABLE_B), Paragraph('52', TABLE_BC)],
    [Paragraph('FFR gray zone', TABLE_B), Paragraph('0.75–0.80: "gray zone"; treat if physiologically significant by symptoms', TABLE_B), Paragraph('52', TABLE_BC)],
    [Paragraph('IVUS LM MLA cutoff', TABLE_B), Paragraph('MLA >6 mm² = safe deferral; MLD >3 mm = alternative', TABLE_B), Paragraph('52', TABLE_BC)],
    [Paragraph('LVOT obstruction diagnosis', TABLE_B), Paragraph('Simultaneous LV + Ao pressures: dynamic gradient (↑ with Valsalva) = HOCM; Fixed = AS', TABLE_B), Paragraph('52', TABLE_BC)],
    [Paragraph('LGE pattern in myocarditis', TABLE_B), Paragraph('Mid-wall / epicardial, non-coronary distribution', TABLE_B), Paragraph('53', TABLE_BC)],
    [Paragraph('CCT radiation — lowest mode', TABLE_B), Paragraph('Step-and-shoot (prospective gating) = 4–6 mSv', TABLE_B), Paragraph('53', TABLE_BC)],
    [Paragraph('ATTR amyloidosis diagnosis', TABLE_B), Paragraph('PYP SPECT: Grade 2-3 + H/CL ≥1.5 without monoclonal protein → ATTR confirmed, no biopsy', TABLE_B), Paragraph('54', TABLE_BC)],
    [Paragraph('FDG-PET viability mismatch', TABLE_B), Paragraph('↓ perfusion + ↑ FDG = hibernation (viable) → revascularization expected benefit', TABLE_B), Paragraph('54', TABLE_BC)],
    [Paragraph('Ischemic cascade order', TABLE_B), Paragraph('Perfusion → Diastolic dysfunction → RWMA → ECG → Angina', TABLE_B), Paragraph('54', TABLE_BC)],
    [Paragraph('STICH trial message', TABLE_B), Paragraph('CABG: no improvement in all-cause mortality; but ↓ CV death (28% vs 33%)', TABLE_B), Paragraph('54', TABLE_BC)],
    [Paragraph('Severe AS: which formula?', TABLE_B), Paragraph('Continuity equation (AVA = LVOT CSA × VTILVOT / VTIAo); severe <1.0 cm²', TABLE_B), Paragraph('55', TABLE_BC)],
    [Paragraph('Low-gradient severe AS management', TABLE_B), Paragraph('Dobutamine stress echo: if ≥0.3 cm² increase in AVA + no reserve → nonsevere', TABLE_B), Paragraph('55', TABLE_BC)],
    [Paragraph('Pericardial constriction CMR', TABLE_B), Paragraph('Pericardial thickness >6 mm + focal; calcification on CCT; septal bounce on echo', TABLE_B), Paragraph('53+55', TABLE_BC)],
    [Paragraph('TEE before cardioversion', TABLE_B), Paragraph('Rule out LAA thrombus; TEE ~100% sensitivity/specificity', TABLE_B), Paragraph('55', TABLE_BC)],
    [Paragraph('Intraoperative TEE indication', TABLE_B), Paragraph('All cardiac surgery patients (valve, CABG, TAVR, structural); ACC/AHA Class I', TABLE_B), Paragraph('55', TABLE_BC)],
    [Paragraph('MVA by PHT formula', TABLE_B), Paragraph('MVA = 220 / PHT; PHT >220 ms = MVA <1.0 cm² = severe MS', TABLE_B), Paragraph('55', TABLE_BC)],
    [Paragraph('Best imaging for post-EVAR', TABLE_B), Paragraph('CCT preferred (metal artifacts on CMR)', TABLE_B), Paragraph('53', TABLE_BC)],
    [Paragraph('Best imaging for young aortic aneurysm', TABLE_B), Paragraph('CMR / CE-MRA (no radiation — critical in young/congenital HD patients)', TABLE_B), Paragraph('53', TABLE_BC)],
]
prob_t = Table(prob_q, colWidths=[6*cm, 9.5*cm, 2*cm])
prob_t.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), ORANGE),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, LTYELLOW]),
    ('GRID', (0,0), (-1,-1), 0.3, colors.HexColor('#AAAAAA')),
    ('TOPPADDING', (0,0), (-1,-1), 3),
    ('BOTTOMPADDING', (0,0), (-1,-1), 3),
    ('LEFTPADDING', (0,0), (-1,-1), 4),
    ('RIGHTPADDING', (0,0), (-1,-1), 4),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
]))
story.append(prob_t)
story.append(SP(8))

story.append(section_box('LANDMARK TRIALS SUMMARY — ALL CHAPTERS'))
story.append(SP(3))
trials = [
    [Paragraph('<b>Trial</b>', TABLE_H), Paragraph('<b>Intervention</b>', TABLE_H), Paragraph('<b>Key Finding</b>', TABLE_H)],
    [Paragraph('DEFER', TABLE_B), Paragraph('FFR-guided deferral of PCI (FFR >0.75)', TABLE_B), Paragraph('5-yr MACE same as revascularized; safe deferral', TABLE_B)],
    [Paragraph('FAME', TABLE_B), Paragraph('FFR-guided vs angio-guided multivessel PCI', TABLE_B), Paragraph('Fewer stents, lower MACE at 1 year', TABLE_B)],
    [Paragraph('FAME-2', TABLE_B), Paragraph('FFR-guided PCI vs. optimal medical therapy', TABLE_B), Paragraph('PCI superior in FFR-positive lesions — reduced urgent revascularization', TABLE_B)],
    [Paragraph('DEFINE-FLAIR', TABLE_B), Paragraph('iFR vs FFR for coronary stenosis assessment', TABLE_B), Paragraph('iFR non-inferior to FFR; fewer adenosine side effects', TABLE_B)],
    [Paragraph('iFR-SWEDEHEART', TABLE_B), Paragraph('iFR vs FFR in Sweden registry', TABLE_B), Paragraph('iFR non-inferior to FFR at 12 months', TABLE_B)],
    [Paragraph('MATRIX', TABLE_B), Paragraph('Radial vs. femoral access in ACS (NSTEMI/STEMI)', TABLE_B), Paragraph('Radial: lower NACE (net adverse clinical events)', TABLE_B)],
    [Paragraph('IVUS-XPL', TABLE_B), Paragraph('IVUS-guided vs angio-guided PCI (long lesions)', TABLE_B), Paragraph('IVUS: lower 1-yr MACE; better stent expansion', TABLE_B)],
    [Paragraph('STICH', TABLE_B), Paragraph('CABG + medical therapy vs. medical therapy (EF ≤35%)', TABLE_B), Paragraph('No difference all-cause mortality; ↓ CV death with CABG', TABLE_B)],
    [Paragraph('PARR-2', TABLE_B), Paragraph('FDG-PET guided vs. standard care in ICM', TABLE_B), Paragraph('Trend toward improved 1-yr outcomes with PET guidance', TABLE_B)],
    [Paragraph('FAVOR III', TABLE_B), Paragraph('QFR (angiography-derived FFR) vs. standard PCI', TABLE_B), Paragraph('QFR-guided: lower 1-yr MACE', TABLE_B)],
]
trials_t = Table(trials, colWidths=[3*cm, 7.5*cm, 7*cm])
trials_t.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), GREEN),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, LTGREEN]),
    ('GRID', (0,0), (-1,-1), 0.3, colors.HexColor('#AAAAAA')),
    ('TOPPADDING', (0,0), (-1,-1), 3),
    ('BOTTOMPADDING', (0,0), (-1,-1), 3),
    ('LEFTPADDING', (0,0), (-1,-1), 4),
    ('RIGHTPADDING', (0,0), (-1,-1), 4),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
]))
story.append(trials_t)
story.append(SP(8))

story.append(section_box('FINAL MEMORY AIDS & MNEMONICS'))
story.append(SP(3))
mnem_data = [
    [Paragraph('<b>Mnemonic</b>', TABLE_H), Paragraph('<b>Stands For</b>', TABLE_H)],
    [Paragraph('"4-4-1" for Severe AS', TABLE_B), Paragraph('Vmax >4 m/s | MPG >40 mmHg | AVA <1.0 cm²', TABLE_B)],
    [Paragraph('"PERFECT" for cardiac tamponade echo signs', TABLE_B), Paragraph('Pericardial fluid + RA/RV collapse + Plethoric IVC + Expiratory variation + Respiratory variation >25% + Cardiac swinging', TABLE_B)],
    [Paragraph('"STUN vs HIBER" viability', TABLE_B), Paragraph('STUNning = normal flow + reduced function (post-ischemia, recovers); HIBERnation = reduced flow + reduced function (FDG preserved = viable)', TABLE_B)],
    [Paragraph('"FAST-H" for LGE patterns', TABLE_B), Paragraph('Fibrosis/ischemic = Subendocardial; Amyloid = Diffuse; Sarcoid = Focal midwall; Takotsubo = None; HCM = RV insertion points', TABLE_B)],
    [Paragraph('"MATCH" for pharmacologic stress CI', TABLE_B), Paragraph('Methylxanthines (hold caffeine 24h) | Asthma/COPD (avoid adenosine) | Theophylline (reversal) | Conduction block (2°/3° AV block) | Hypotension (SBP <90)', TABLE_B)],
]
mnem_t = Table(mnem_data, colWidths=[5*cm, 12.5*cm])
mnem_t.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,0), PURPLE),
    ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#F3E5F5')]),
    ('GRID', (0,0), (-1,-1), 0.3, colors.HexColor('#AAAAAA')),
    ('TOPPADDING', (0,0), (-1,-1), 3),
    ('BOTTOMPADDING', (0,0), (-1,-1), 3),
    ('LEFTPADDING', (0,0), (-1,-1), 4),
    ('RIGHTPADDING', (0,0), (-1,-1), 4),
    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
]))
story.append(mnem_t)
story.append(SP(6))
story.append(Paragraph('END OF HIGH YIELD NOTES — Good Luck at INI SS CET 2025-26!',
    S('end', fontSize=10, textColor=NAVY, fontName='Helvetica-Bold', alignment=TA_CENTER)))

doc.build(story)
print('Notes PDF created successfully at', OUTPUT)
Running Command

cd /home/daytona/workspace/ini-ss-cvts && python3 build_notes.py

Update progress

Running Command

ls -lh /home/daytona/workspace/ini-ss-cvts/ 2>/dev/null && echo "---" && ls /hom…

Writing File

~/ini-ss-cvts/build_mcq.py

#!/usr/bin/env python3
"""50 MCQ PDF - INI SS CET CVTS - Chapters 52-55"""

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

OUTPUT = '/home/daytona/workspace/ini-ss-cvts/MCQ_50Q_Ch52-55.pdf'

NAVY  = colors.HexColor('#0D2B5E')
TEAL  = colors.HexColor('#148F77')
ORANGE= colors.HexColor('#D35400')
LGRAY = colors.HexColor('#F2F3F4')
DGRAY = colors.HexColor('#2C3E50')
GOLD  = colors.HexColor('#D4AC0D')
LTBLUE= colors.HexColor('#D6EAF8')
LTYLW = colors.HexColor('#FDFAE5')
RED   = colors.HexColor('#C0392B')
GREEN = colors.HexColor('#1E8449')

doc = SimpleDocTemplate(OUTPUT, pagesize=A4,
                        rightMargin=1.8*cm, leftMargin=1.8*cm,
                        topMargin=1.8*cm, bottomMargin=1.8*cm)

def S(name, **kw):
    return ParagraphStyle(name, **kw)

TITLE_S = S('T', fontSize=20, textColor=colors.white, alignment=TA_CENTER,
            fontName='Helvetica-Bold', spaceAfter=3)
SUB_S   = S('Sub', fontSize=11, textColor=GOLD, alignment=TA_CENTER,
            fontName='Helvetica-Bold', spaceAfter=2)
INFO_S  = S('Info', fontSize=9, textColor=colors.white, alignment=TA_CENTER,
            fontName='Helvetica', spaceAfter=2)
QNUM_S  = S('Qn', fontSize=10, textColor=NAVY, fontName='Helvetica-Bold',
            spaceBefore=8, spaceAfter=2)
QSTEM_S = S('Qs', fontSize=9.5, textColor=DGRAY, fontName='Helvetica',
            spaceBefore=2, spaceAfter=4, leading=14)
OPT_S   = S('Opt', fontSize=9.5, textColor=DGRAY, fontName='Helvetica',
            leftIndent=16, spaceBefore=1, spaceAfter=1, leading=13)
VIGN_S  = S('Vgn', fontSize=9, textColor=colors.HexColor('#1A5276'),
            fontName='Helvetica-Oblique', leftIndent=8,
            spaceBefore=2, spaceAfter=2, leading=13,
            backColor=LTBLUE, borderPadding=(4,6,4,6))
TOPIC_S = S('Topic', fontSize=8, textColor=colors.HexColor('#555555'),
            fontName='Helvetica-Oblique', spaceBefore=0, spaceAfter=4)
HR_S    = S('hr', fontSize=4, spaceBefore=2, spaceAfter=2)

def cover():
    data = [
        [Paragraph('INI SS CET CVTS — QUESTION BANK', TITLE_S)],
        [Paragraph('50 Single Best Answer MCQs | Chapters 52–55', SUB_S)],
        [Spacer(1, 0.3*cm)],
        [Paragraph('Ch 52: Coronary Angiography &amp; Hemodynamics  |  Ch 53: CMR &amp; CCT', INFO_S)],
        [Paragraph('Ch 54: Nuclear Cardiology &amp; PET  |  Ch 55: Diagnostic Echocardiography', INFO_S)],
        [Spacer(1, 0.3*cm)],
        [Paragraph('Format: Single Best Answer  |  Topics: Guidelines, Decision-making, Imaging, Haemodynamics, Operative Judgement', INFO_S)],
        [Paragraph('Landmark Trials, Clinical Scenarios, Vignettes, Image-based Questions', INFO_S)],
    ]
    t = Table(data, colWidths=[16.4*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), NAVY),
        ('TOPPADDING', (0,0), (-1,-1), 5),
        ('BOTTOMPADDING', (0,0), (-1,-1), 5),
        ('LEFTPADDING', (0,0), (-1,-1), 14),
        ('RIGHTPADDING', (0,0), (-1,-1), 14),
    ]))
    return t

def instr():
    rows = [
        [Paragraph('<b>INSTRUCTIONS</b>', S('ih', fontSize=9, textColor=NAVY,
                    fontName='Helvetica-Bold'))],
        [Paragraph('• Each question has ONE single best answer (a, b, c, or d)', S('ib', fontSize=8.5,
                    textColor=DGRAY, fontName='Helvetica', leading=12))],
        [Paragraph('• Questions may be standalone, clinical vignette, haemodynamic scenario, or image-based', S('ib', fontSize=8.5,
                    textColor=DGRAY, fontName='Helvetica', leading=12))],
        [Paragraph('• All questions are based on current guidelines (ACC/AHA/ESC/ASE/SCMR)', S('ib', fontSize=8.5,
                    textColor=DGRAY, fontName='Helvetica', leading=12))],
        [Paragraph('• Negative marking: as per exam rules. Time: 50 questions = 50 minutes (recommended)', S('ib', fontSize=8.5,
                    textColor=DGRAY, fontName='Helvetica', leading=12))],
    ]
    t = Table(rows, colWidths=[16.4*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), LTYLW),
        ('TOPPADDING', (0,0), (-1,-1), 3),
        ('BOTTOMPADDING', (0,0), (-1,-1), 3),
        ('LEFTPADDING', (0,0), (-1,-1), 10),
        ('RIGHTPADDING', (0,0), (-1,-1), 10),
        ('BOX', (0,0), (-1,-1), 0.5, ORANGE),
    ]))
    return t

def Q(num, topic, stem, opts, vignette=None):
    """Build one question block."""
    items = []
    items.append(Paragraph(f'<b>Q{num}.</b>  [{topic}]', QNUM_S))
    if vignette:
        items.append(Paragraph(vignette, VIGN_S))
    items.append(Paragraph(stem, QSTEM_S))
    letters = ['a', 'b', 'c', 'd']
    for i, opt in enumerate(opts):
        items.append(Paragraph(f'({letters[i]})  {opt}', OPT_S))
    items.append(HRFlowable(width='100%', thickness=0.4, color=colors.HexColor('#CCCCCC'),
                             spaceAfter=2, spaceBefore=4))
    return KeepTogether(items)

# ====== 50 QUESTIONS ======
questions = [

# ---- CHAPTER 52: CORONARY ANGIOGRAPHY & HEMODYNAMICS (Q1–Q14) ----

Q(1, "Ch52 | Vascular Access", 
  "In the National Cardiovascular Data Registry CathPCI report (Q4 2020), what percentage of coronary angiography procedures in the United States were performed via the transradial approach?",
  ["~16%", "~30%", "~53%", "~70%"]),

Q(2, "Ch52 | Coronary Physiology",
  "A 58-year-old male undergoes coronary angiography revealing a 60% stenosis of the mid-LAD. Fractional flow reserve (FFR) is measured at 0.82 with IV adenosine. What is the most appropriate management?",
  ["Proceed with PCI of mid-LAD",
   "Defer PCI; treat medically with optimal therapy",
   "Perform IVUS to reassess lesion severity",
   "Refer for CABG surgery"],
  vignette="BP 130/80 mmHg. Echo: Normal LV function. No prior MI. Patient has exertional chest pain."),

Q(3, "Ch52 | Coronary Physiology",
  "The FAME trial demonstrated that FFR-guided PCI for multivessel disease compared to angiography-guided PCI resulted in which of the following outcomes at 2 years?",
  ["Fewer stents, lower MACE, and reduced treatment costs",
   "Increased use of CABG referral",
   "Higher all-cause mortality",
   "No significant difference in outcomes"]),

Q(4, "Ch52 | Coronary Physiology",
  "Which non-hyperemic pressure ratio has been validated as non-inferior to FFR for guiding coronary revascularization in the DEFINE-FLAIR and iFR-SWEDEHEART trials?",
  ["Coronary flow reserve (CFR)",
   "Instantaneous wave-free ratio (iFR)",
   "Quantitative flow ratio (QFR)",
   "Diastolic pressure ratio (dPR)"]),

Q(5, "Ch52 | Intravascular Imaging",
  "A 62-year-old woman undergoes PCI for a left main (LM) coronary artery lesion. IVUS is used to guide the procedure. What is the accepted IVUS-derived minimal lumen area (MLA) threshold BELOW which revascularization should be performed in the LM?",
  ["3.0 mm²",
   "4.5 mm²",
   "6.0 mm²",
   "8.0 mm²"]),

Q(6, "Ch52 | Intravascular Imaging",
  "Compared to IVUS, which of the following best describes a key advantage of Optical Coherence Tomography (OCT) in coronary imaging?",
  ["Greater tissue penetration depth (5–6 mm)",
   "Does not require blood clearance during imaging",
   "Superior axial resolution (~10–15 μm) for plaque characterization",
   "Better assessment of full vessel wall thickness"]),

Q(7, "Ch52 | Hemodynamics — Valve",
  "A patient with severe aortic stenosis is referred for cardiac catheterization. The Gorlin formula is used to calculate aortic valve area. In which clinical scenario would the Gorlin formula most likely UNDERESTIMATE the true valve area?",
  ["High cardiac output state (e.g., severe anemia)",
   "Low cardiac output state (e.g., cardiogenic shock)",
   "Normal resting heart rate and cardiac output",
   "Moderate aortic stenosis with preserved EF"]),

Q(8, "Ch52 | Hemodynamics",
  "During right heart catheterization, a patient's oxygen saturation values are: SVC 68%, RV 82%, PA 81%, PV 98%, Aorta 97%. Which diagnosis does this pattern MOST suggest?",
  ["Tricuspid regurgitation",
   "Ventricular septal defect (VSD) — left-to-right shunt",
   "Atrial septal defect (ASD)",
   "Patent ductus arteriosus (PDA)"],
  vignette="O2 saturation step-up is noted between SVC (68%) and RV (82%). The PA saturation is 81%."),

Q(9, "Ch52 | Vascular Access",
  "During a transradial procedure in a 55-year-old male, the operator encounters a tortuous subclavian artery. Which alternative radial access approach provides the BEST access for IMA engagement in the same patient?",
  ["Contralateral (left) radial approach",
   "Switch to femoral artery access",
   "Ipsilateral (right) radial approach — right IMA planned",
   "Brachial artery access"],
  vignette="Right radial access attempted for coronary angiography prior to CABG. LIMA to LAD planned."),

Q(10, "Ch52 | Coronary Angiography",
  "Which angiographic projection is BEST for visualizing the left main coronary artery bifurcation into LAD and LCX?",
  ["RAO 30° + cranial 25°",
   "LAO 60° + cranial 25°",
   "LAO 45°–50° + caudal 20° (spider view)",
   "AP + cranial 30°"]),

Q(11, "Ch52 | Hemodynamics",
  "A patient with known mitral stenosis undergoes right heart catheterization. Mean pulmonary capillary wedge pressure is 22 mmHg, mean PA pressure 35 mmHg, and cardiac output 4.5 L/min. What is the pulmonary vascular resistance (PVR)?",
  ["2.9 Wood Units",
   "4.4 Wood Units",
   "5.7 Wood Units",
   "7.8 Wood Units"]),

Q(12, "Ch52 | Clinical Scenario",
  "A 49-year-old postpartum woman presents with acute chest pain. Coronary angiography reveals a smooth tapering of the mid-LAD with a hazy lumen. No atherosclerosis is seen. IVUS shows a large intramural hematoma between the intimal and adventitial layers. What is the MOST LIKELY diagnosis?",
  ["Atherosclerotic plaque rupture",
   "Coronary artery spasm (Prinzmetal angina)",
   "Spontaneous coronary artery dissection (SCAD)",
   "Takayasu arteritis involving coronary arteries"]),

Q(13, "Ch52 | Guidelines",
  "According to current ACC/AHA guidelines, which of the following represents an ABSOLUTE contraindication to diagnostic cardiac catheterization?",
  ["Severe contrast allergy",
   "Advanced renal dysfunction (eGFR 20 mL/min)",
   "Procedure not aligned with patient's treatment goals (terminal non-cardiac illness)",
   "Uncontrolled hypertension (SBP 190 mmHg)"]),

Q(14, "Ch52 | Coronary Physiology",
  "An angiography-derived FFR software (QFR) is used to assess a 55% stenosis of the RCA. The QFR value is 0.76. What is the most appropriate next step?",
  ["Perform pressure wire FFR for confirmation before PCI",
   "Medical therapy only — QFR >0.75 safe for deferral",
   "Proceed with PCI based on QFR — functional significance confirmed",
   "Refer for CABG — multivessel assessment needed"]),

# ---- CHAPTER 53: CMR & CCT (Q15–Q27) ----

Q(15, "Ch53 | CMR Principles",
  "Which CMR imaging sequence is considered the GOLD STANDARD for assessing left ventricular volumes, mass, and ejection fraction?",
  ["T1-weighted spin-echo",
   "Late gadolinium enhancement (LGE)",
   "Balanced steady-state free precession (bSSFP) cine",
   "T2-weighted with fat suppression"]),

Q(16, "Ch53 | LGE Patterns",
  "A 32-year-old male presents with new-onset chest pain and elevated troponins 5 days after a viral illness. CMR demonstrates mid-wall / epicardial LGE in a non-coronary distribution with T2 hyperintensity. What is the MOST LIKELY diagnosis?",
  ["Acute myocardial infarction",
   "Hypertrophic cardiomyopathy",
   "Acute myocarditis",
   "Cardiac amyloidosis"],
  vignette="Coronary angiography was normal. ECG shows diffuse ST elevation. Age 32. Recent flu-like illness."),

Q(17, "Ch53 | LGE Patterns",
  "A 68-year-old man with progressive exertional dyspnoea and bilateral leg swelling undergoes CMR. LGE shows diffuse subendocardial to transmural enhancement that cannot be nulled despite inversion time optimization. Native T1 is markedly elevated and ECV is 52%. What is the MOST LIKELY diagnosis?",
  ["Ischemic cardiomyopathy",
   "Hypertrophic cardiomyopathy",
   "Cardiac amyloidosis",
   "Cardiac sarcoidosis"],
  vignette="Echo: concentric LV thickening, granular sparkling, E/A >2, biatrial enlargement. Serum FLC abnormal."),

Q(18, "Ch53 | CCT — Radiation",
  "A 45-year-old woman requires cardiac CT angiography for evaluation of stable chest pain. To minimize radiation exposure, which CCT acquisition mode should be used?",
  ["Helical mode with low pitch",
   "Step-and-shoot (prospective gating)",
   "High-pitch helical acquisition",
   "Multicycle reconstruction"]),

Q(19, "Ch53 | TAVR Planning",
  "A 78-year-old patient is being planned for transcatheter aortic valve replacement (TAVR). Which of the following measurements is PRIMARILY obtained from pre-TAVR CCT to guide valve sizing?",
  ["Mean aortic pressure gradient",
   "Aortic annular perimeter and area",
   "Aortic valve peak velocity",
   "LV ejection fraction"],
  vignette="Severe calcific AS confirmed. Echo AVA 0.75 cm², Vmax 4.3 m/s. Decision made to proceed with TAVR."),

Q(20, "Ch53 | CMR — Aorta",
  "A 38-year-old man with Marfan syndrome requires surveillance imaging of the thoracic aorta. He has no prior surgery. What is the PREFERRED imaging modality for long-term follow-up?",
  ["CT angiography (gated)",
   "Transthoracic echocardiography",
   "CMR / CE-MRA",
   "Transesophageal echocardiography"]),

Q(21, "Ch53 | CMR — Congenital HD",
  "Phase contrast CMR is performed in a 24-year-old woman with a sinus venosus ASD. Pulmonary artery phase contrast shows a peak flow of 6 L/min and ascending aorta shows 3 L/min. What is the Qp:Qs ratio and its clinical significance?",
  ["Qp:Qs = 0.5 — right-to-left shunt; Eisenmenger physiology",
   "Qp:Qs = 1.0 — no haemodynamically significant shunt",
   "Qp:Qs = 2.0 — significant left-to-right shunt; consider closure",
   "Qp:Qs = 3.0 — severe shunt with irreversible PH; contraindicated for closure"]),

Q(22, "Ch53 | CMR — Pericardial Disease",
  "A 55-year-old man with prior tuberculosis presents with progressive exertional dyspnoea and peripheral oedema. CMR shows pericardial thickening of 8 mm (focal, over RV free wall) with tagging sequences demonstrating loss of pericardial sliding. What is the MOST APPROPRIATE next step?",
  ["Start pericardiocentesis",
   "Initiate anti-tuberculous therapy and repeat CMR in 3 months",
   "Refer for surgical pericardiectomy",
   "Implant a pacemaker for heart block"]),

Q(23, "Ch53 | CMR — ARVC",
  "A 26-year-old competitive athlete presents with palpitations and syncope during exercise. ECG shows epsilon waves in V1-V3. CMR with fat suppression reveals fatty infiltration of the RV free wall with RV dilation and reduced RV EF. What is the diagnosis?",
  ["Hypertrophic cardiomyopathy",
   "Arrhythmogenic right ventricular cardiomyopathy (ARVC)",
   "Cardiac sarcoidosis",
   "Dilated cardiomyopathy"]),

Q(24, "Ch53 | CCT — Aortic Dissection",
  "A 65-year-old man presents to the emergency department with sudden-onset tearing chest pain radiating to the back, BP 180/100 mmHg (L arm) and 145/90 mmHg (R arm). The MOST APPROPRIATE immediate imaging is:",
  ["Transthoracic echocardiography",
   "Cardiac MRI",
   "ECG-gated CT aortography",
   "Coronary angiography"]),

Q(25, "Ch53 | CMR — HCM",
  "A 44-year-old with HCM and prior septal myectomy has CMR follow-up. LGE is present at the RV-LV junction insertion points and in the hypertrophied segments. Which of the following is the primary clinical implication of extensive LGE in HCM?",
  ["Predicts need for repeat myectomy",
   "Correlates with LVOT gradient severity",
   "Predicts adverse events including sudden cardiac death — may influence ICD decision",
   "Indicates worsening valvular mitral regurgitation"]),

Q(26, "Ch53 | CCT — Follow-up",
  "A 62-year-old patient underwent endovascular aortic repair (EVAR) 3 years ago for a 6.2 cm abdominal aortic aneurysm. He is now due for annual surveillance imaging. What is the PREFERRED modality?",
  ["Contrast-enhanced MRA",
   "Transthoracic echocardiography",
   "CT angiography (CCT)",
   "Duplex ultrasound alone"]),

Q(27, "Ch53 | CMR Gadolinium Safety",
  "A 70-year-old woman with chronic kidney disease (eGFR 25 mL/min/1.73 m²) requires cardiac imaging for evaluation of a possible cardiac mass on TTE. Which statement regarding gadolinium contrast use is MOST CORRECT?",
  ["Gadolinium can be used freely in CKD — it is safer than iodinated contrast",
   "Macrocyclic gadolinium agents have lower NSF risk than linear agents and can be used at eGFR 25 with caution",
   "Gadolinium is absolutely contraindicated at any eGFR below 30",
   "Gadolinium causes acute tubular necrosis similar to iodinated contrast"]),

# ---- CHAPTER 54: NUCLEAR CARDIOLOGY & PET (Q28–Q40) ----

Q(28, "Ch54 | Radiotracers",
  "A patient undergoes rest-stress myocardial perfusion imaging using ⁹⁹ᵐTc-sestamibi. Compared to ²⁰¹Thallium, which property of sestamibi is most clinically important?",
  ["It redistributes over 4 hours — allowing single injection protocols",
   "It does NOT redistribute significantly — separate rest and stress injections required",
   "It has a longer half-life allowing delayed imaging up to 24 hours",
   "It directly measures myocardial metabolic activity"]),

Q(29, "Ch54 | Viability",
  "PET viability imaging in a 63-year-old man with ischemic cardiomyopathy (EF 28%) shows reduced resting perfusion in the anterior wall with preserved FDG uptake in the same region. What does this pattern indicate and what is the recommended treatment?",
  ["Scar tissue — optimal medical therapy; revascularization unlikely to improve EF",
   "Stunned myocardium — EF will recover spontaneously without intervention",
   "Hibernating myocardium — revascularization expected to improve regional and global function",
   "Artifact — repeat imaging with attenuation correction recommended"],
  vignette="13N-Ammonia PET: severely reduced perfusion anterior wall. FDG-PET: uptake preserved (perfusion-metabolism mismatch)."),

Q(30, "Ch54 | STICH Trial",
  "The STICH trial randomized patients with ischemic LV dysfunction (EF ≤35%) to CABG + medical therapy versus medical therapy alone. Which statement BEST reflects the primary outcome?",
  ["CABG significantly reduced all-cause mortality at 56 months",
   "CABG reduced cardiovascular death but not all-cause mortality at median 56 months",
   "Medical therapy was superior to CABG in reducing hospitalizations",
   "CABG was beneficial only in patients with viable myocardium on imaging"]),

Q(31, "Ch54 | Ischemic Cascade",
  "In the ischemic cascade, which abnormality appears FIRST after the onset of myocardial ischemia?",
  ["ST-segment depression on ECG",
   "Angina pectoris",
   "Regional wall motion abnormality on echo",
   "Myocardial perfusion defect on SPECT"]),

Q(32, "Ch54 | Pharmacologic Stress",
  "A 72-year-old man with COPD and inability to exercise requires pharmacologic stress MPI. Adenosine and dipyridamole are contraindicated. Which agent is MOST APPROPRIATE?",
  ["Dobutamine at 40 mcg/kg/min",
   "Regadenoson (Lexiscan)",
   "Atropine IV",
   "Isoproterenol infusion"]),

Q(33, "Ch54 | Cardiac Amyloidosis",
  "A 75-year-old man with heart failure with preserved EF (HFpEF) and a 6 mm IVS thickness undergoes ⁹⁹ᵐTc-PYP scintigraphy. Planar imaging shows grade 3 cardiac uptake (greater than rib uptake). SPECT/CT confirms myocardial (not blood pool) uptake. Serum and urine protein electrophoresis are normal. What is the diagnosis?",
  ["AL amyloidosis — biopsy required",
   "Transthyretin (ATTR) amyloidosis — confirmed without biopsy",
   "Cardiac sarcoidosis",
   "Normal PYP study — cannot make diagnosis"]),

Q(34, "Ch54 | Cardiac Sarcoidosis",
  "A 40-year-old woman with known pulmonary sarcoidosis presents with complete heart block requiring temporary pacing. FDG-PET shows focal myocardial FDG uptake in the basal septum with corresponding perfusion defect on rest SPECT. What is the MOST APPROPRIATE long-term management beyond corticosteroids?",
  ["Permanent pacemaker implantation only",
   "ICD implantation due to high risk of sudden cardiac death",
   "Heart transplantation referral",
   "Continued corticosteroid therapy with repeat FDG-PET at 6 months only"]),

Q(35, "Ch54 | Viability — SPECT",
  "On stress-rest ²⁰¹Thallium SPECT, a patient has reduced uptake in the inferior wall during stress that shows IMPROVED uptake on 4-hour redistribution imaging. What does this represent?",
  ["Fixed defect — scar; no viable myocardium",
   "Reversible perfusion defect — stress-induced ischemia with viable myocardium",
   "Thallium redistribution — confirms hibernation (chronic ischemia)",
   "Attenuation artifact from diaphragm"]),

Q(36, "Ch54 | PET — Quantitative MBF",
  "Quantitative myocardial blood flow (MBF) measurement by PET can diagnose which condition that angiographic stenosis assessment and qualitative SPECT MPI may MISS?",
  ["Proximal LAD total occlusion",
   "Multivessel balanced ischemia and coronary microvascular disease",
   "LV hypertrophy as a cause of ST changes",
   "Right ventricular infarction"]),

Q(37, "Ch54 | Post-Revascularization",
  "Following CABG, SPECT MPI detects restenosis most accurately during which time window?",
  ["Within 1 month post-surgery",
   "3–9 months post-surgery",
   "12–18 months post-surgery",
   ">5 years post-surgery"]),

Q(38, "Ch54 | Viability — Meta-analysis",
  "A meta-analysis of 24 studies examining myocardial viability in ischemic cardiomyopathy (mean EF 32%) found that patients with demonstrated viability treated medically had an annual mortality of approximately:",
  ["3%",
   "6%",
   "10%",
   "16%"]),

Q(39, "Ch54 | Stress-Only Imaging",
  "A 55-year-old woman undergoes stress-only ⁹⁹ᵐTc-sestamibi MPI. The study is entirely normal. Which statement is MOST CORRECT?",
  ["Rest imaging must always follow to exclude a fixed defect",
   "A normal stress-only study is associated with <1% annual cardiac event rate — rest imaging can be omitted",
   "Stress-only protocols are invalid and not guideline-recommended",
   "The patient requires repeat imaging with ²⁰¹Thallium for viability"]),

Q(40, "Ch54 | Hybrid Imaging",
  "Hybrid PET/CCTA imaging combines anatomic and functional data. Compared to either modality alone, what is the PRIMARY advantage of hybrid PET/CCTA in CAD assessment?",
  ["Lower radiation dose than standalone CCT",
   "Eliminates the need for pharmacologic stress",
   "Superior diagnostic accuracy for both stenosis anatomy and functional significance",
   "Gadolinium contrast can replace iodinated contrast for CCT"]),

# ---- CHAPTER 55: DIAGNOSTIC ECHOCARDIOGRAPHY (Q41–50) ----

Q(41, "Ch55 | Aortic Stenosis",
  "A 72-year-old man with aortic stenosis undergoes echocardiography. Peak aortic velocity is 4.6 m/s, mean gradient 52 mmHg, and aortic valve area by continuity equation is 0.85 cm². LVEF is 35%. What is the MOST ACCURATE characterisation of his AS?",
  ["Moderate AS — low EF reduces gradients; not truly severe",
   "Severe classical low-flow, low-gradient AS — true severity underestimated by gradients",
   "Severe high-gradient AS with LV systolic dysfunction",
   "Paradoxical low-flow AS — LVEF is above 50% threshold"],
  vignette="Stroke volume index (SVI) is 28 mL/m². LV is dilated. MPG 52 mmHg."),

Q(42, "Ch55 | Aortic Stenosis",
  "A 78-year-old woman has severe aortic stenosis with AVA 0.95 cm² but a mean gradient of only 28 mmHg and a peak velocity of 3.6 m/s. LVEF is 68%. SVI is 30 mL/m². What category of AS does this represent and what test should be performed next?",
  ["Classical low-flow, low-gradient AS — dobutamine stress echo",
   "Paradoxical low-flow, low-gradient AS — reassess with dobutamine stress echo or CT calcium scoring",
   "Moderate AS — no further testing; annual echo follow-up",
   "Severe high-gradient AS — proceed directly to AVR"]),

Q(43, "Ch55 | Valvular — MS",
  "A 45-year-old woman with rheumatic heart disease has exertional dyspnoea. TTE shows a thickened, calcified, domed mitral valve. PHT is 240 ms. What is the calculated mitral valve area?",
  ["0.7 cm²",
   "0.9 cm²",
   "1.2 cm²",
   "1.5 cm²"]),

Q(44, "Ch55 | Diastolic Function",
  "A 65-year-old hypertensive male undergoes echocardiography for dyspnoea. Mitral inflow E/A = 1.2. Average E/e' = 16. TR velocity = 3.1 m/s. LA volume index = 38 mL/m². Based on ASE 2016 guidelines, what is the grade of diastolic dysfunction?",
  ["Normal diastolic function",
   "Grade I (impaired relaxation)",
   "Grade II (pseudonormal) with elevated filling pressures",
   "Cannot determine — indeterminate"]),

Q(45, "Ch55 | Cardiac Tamponade",
  "A 58-year-old woman 3 days post-cardiac surgery presents with hypotension (BP 80/50 mmHg), tachycardia, and muffled heart sounds. Which echocardiographic finding is MOST SPECIFIC for cardiac tamponade?",
  ["Large pericardial effusion with IVC plethora",
   "Systolic right atrial free wall collapse",
   "Diastolic right ventricular free wall collapse",
   "Mitral inflow E/A ratio <1"]),

Q(46, "Ch55 | Hypertrophic Cardiomyopathy",
  "A 28-year-old athlete has a family history of sudden cardiac death. Echocardiography shows an IVS of 20 mm with LVOT peak velocity of 4.9 m/s at rest that increases to 6.2 m/s with Valsalva. Late-peaking 'dagger-shaped' CWD is noted. What is the LVOT gradient at rest (simplified Bernoulli)?",
  ["48 mmHg",
   "62 mmHg",
   "96 mmHg",
   "128 mmHg"]),

Q(47, "Ch55 | Cardiac Masses",
  "A 52-year-old woman with atrial fibrillation for 6 months is referred for cardioversion. TEE is performed to rule out LA thrombus. A mobile 1.8 × 2.2 cm mass is seen in the LAA with low-velocity flow. TTE had not identified this. What is the NEXT BEST step?",
  ["Proceed with cardioversion — TEE finding is artifact",
   "Anticoagulate for at least 3 weeks and reimage before cardioversion",
   "Schedule DC cardioversion immediately under TEE guidance",
   "Refer for surgical resection of the LAA mass"],
  vignette="No anticoagulation prior. LAA thrombus visualized on TEE."),

Q(48, "Ch55 | Echocardiography — Amyloidosis",
  "A 70-year-old man with HFpEF undergoes TTE. Findings include: IVS 17 mm, PW 16 mm, biatrial enlargement, granular sparkling myocardial texture, E/A >2, global longitudinal strain (GLS) = -8% with relative apical sparing. What is the MOST SPECIFIC echocardiographic sign confirming this diagnosis?",
  ["Granular sparkling texture of the myocardium",
   "Biatrial enlargement",
   "Apical sparing pattern on GLS bull's-eye plot ('cherry on top')",
   "E/A ratio >2 (restrictive filling)"]),

Q(49, "Ch55 | Constrictive Pericarditis",
  "A 48-year-old man post-mediastinal radiation therapy (10 years ago) has progressive dyspnoea, elevated JVP, and ascites. Echocardiography shows normal LVEF, septal bounce, IVC plethora, E/e' of 10 (normal). Which finding on Doppler echo is MOST characteristic of constrictive pericarditis?",
  ["E/A <0.8 with impaired relaxation",
   "Exaggerated respiratory variation in mitral inflow (>25% decrease on inspiration) with preserved myocardial relaxation",
   "Aortic valve pressure half-time >400 ms",
   "Transmitral E/A ratio >2 with no respiratory variation"]),

Q(50, "Ch55 | Perioperative Echo",
  "A 65-year-old man is undergoing mitral valve repair for severe degenerative MR (P2 prolapse). Following CPB separation, intraoperative TEE shows a residual MR jet with effective regurgitant orifice area (EROA) of 0.22 cm² and systolic anterior motion (SAM) of the anterior mitral leaflet with LVOT gradient of 45 mmHg. What is the MOST APPROPRIATE immediate surgical decision?",
  ["Accept the result — residual MR <moderate and SAM usually resolves spontaneously",
   "Return to CPB for surgical revision — residual significant MR + SAM post-repair",
   "Administer IV phenylephrine and increase preload — SAM likely to resolve haemodynamically",
   "Convert to mitral valve replacement"],
  vignette="SAM noted immediately after repair. LVOT gradient 45 mmHg. EROA 0.22 cm². BP 90/60 mmHg on low-dose vasopressors."),
]

# Build PDF
story = []
story.append(cover())
story.append(Spacer(1, 0.4*cm))
story.append(instr())
story.append(Spacer(1, 0.4*cm))

# Chapter dividers
ch_breaks = {1: 'CHAPTER 52: Coronary Angiography, Valve &amp; Hemodynamic Assessment (Q1–Q14)',
             15: 'CHAPTER 53: CMR &amp; CCT in Cardiovascular Diagnosis (Q15–Q27)',
             28: 'CHAPTER 54: Nuclear Cardiology &amp; Positron Emission Tomography (Q28–Q40)',
             41: 'CHAPTER 55: Diagnostic Echocardiography (Q41–Q50)'}

for i, q in enumerate(questions):
    qnum = i + 1
    if qnum in ch_breaks:
        if qnum > 1:
            story.append(Spacer(1, 0.3*cm))
        div_data = [[Paragraph(ch_breaks[qnum], S('cd', fontSize=9.5, textColor=colors.white,
                               fontName='Helvetica-Bold', alignment=TA_CENTER))]]
        div_t = Table(div_data, colWidths=[16.4*cm])
        div_t.setStyle(TableStyle([
            ('BACKGROUND', (0,0), (-1,-1), TEAL),
            ('TOPPADDING', (0,0), (-1,-1), 5),
            ('BOTTOMPADDING', (0,0), (-1,-1), 5),
            ('LEFTPADDING', (0,0), (-1,-1), 10),
            ('RIGHTPADDING', (0,0), (-1,-1), 10),
        ]))
        story.append(div_t)
        story.append(Spacer(1, 0.2*cm))
    story.append(q)

# Footer note
story.append(Spacer(1, 0.5*cm))
foot_data = [[Paragraph('END OF QUESTION PAPER | 50 Questions | INI SS CET CVTS | Chapters 52–55',
              S('f', fontSize=8.5, textColor=colors.white, fontName='Helvetica-Bold',
                alignment=TA_CENTER))]]
foot_t = Table(foot_data, colWidths=[16.4*cm])
foot_t.setStyle(TableStyle([
    ('BACKGROUND', (0,0), (-1,-1), NAVY),
    ('TOPPADDING', (0,0), (-1,-1), 6),
    ('BOTTOMPADDING', (0,0), (-1,-1), 6),
    ('LEFTPADDING', (0,0), (-1,-1), 10),
    ('RIGHTPADDING', (0,0), (-1,-1), 10),
]))
story.append(foot_t)

doc.build(story)
print('MCQ PDF created at', OUTPUT)
Running Command

cd /home/daytona/workspace/ini-ss-cvts && python3 build_mcq.py

Running Command

cd /home/daytona/workspace/ini-ss-cvts && python3 -c " import re with open('bui…

Running Command

cd /home/daytona/workspace/ini-ss-cvts && python3 -c " with open('build_mcq.py',…

Running Command

grep -n " < " /home/daytona/workspace/ini-ss-cvts/build_mcq.py | head -30

Running Command

grep -n "<1%" /home/daytona/workspace/ini-ss-cvts/build_mcq.py; grep -n "< 1" /h…

Running Command

cd /home/daytona/workspace/ini-ss-cvts && python3 -c " with open('build_mcq.py',…

Update progress

Running Command

ls -lh /home/daytona/workspace/ini-ss-cvts/

Update progress

Files ready ?

Running Command

ls -lh /home/daytona/workspace/ini-ss-cvts/

Update progress

Why is the progress getting stopped at 90%

Meanwhile can you give me the download links to the ready pdfs please

Why is the process stalling? What are the budget limits resetting between conversations? What can I do to get the task done? I have enough credits right? Do I need to purchase more credits?

Update

This is a shared conversation. Sign in to Orris to start your own chat.