Treatment of arrhythmias ,causes and investigations Make a PDF DOCUMENT FOR 20 marks short note
mkdir -p /home/daytona/workspace/arrhythmia-pdf && ls /home/daytona/workspace/ar…
~/arrhythmia-pdf/generate_arrhythmia_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
OUTPUT = "/home/daytona/workspace/arrhythmia-pdf/Arrhythmias_Short_Note_20Marks.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=2*cm, leftMargin=2*cm,
topMargin=2*cm, bottomMargin=2*cm
)
styles = getSampleStyleSheet()
# Custom styles
title_style = ParagraphStyle(
'TitleStyle',
parent=styles['Title'],
fontSize=20,
textColor=colors.HexColor('#1a237e'),
spaceAfter=4,
alignment=TA_CENTER,
fontName='Helvetica-Bold',
)
subtitle_style = ParagraphStyle(
'SubtitleStyle',
fontSize=11,
textColor=colors.HexColor('#1565c0'),
spaceAfter=2,
alignment=TA_CENTER,
fontName='Helvetica',
)
marks_style = ParagraphStyle(
'MarksStyle',
fontSize=10,
textColor=colors.HexColor('#c62828'),
spaceAfter=10,
alignment=TA_CENTER,
fontName='Helvetica-Bold',
)
section_style = ParagraphStyle(
'SectionStyle',
fontSize=13,
textColor=colors.white,
spaceBefore=10,
spaceAfter=4,
fontName='Helvetica-Bold',
leftIndent=0,
borderPad=6,
)
subheading_style = ParagraphStyle(
'SubheadingStyle',
fontSize=11,
textColor=colors.HexColor('#1a237e'),
spaceBefore=8,
spaceAfter=3,
fontName='Helvetica-Bold',
)
body_style = ParagraphStyle(
'BodyStyle',
parent=styles['Normal'],
fontSize=10,
textColor=colors.HexColor('#212121'),
spaceAfter=4,
leading=15,
alignment=TA_JUSTIFY,
fontName='Helvetica',
)
bullet_style = ParagraphStyle(
'BulletStyle',
parent=styles['Normal'],
fontSize=10,
textColor=colors.HexColor('#212121'),
spaceAfter=3,
leading=14,
leftIndent=16,
bulletIndent=4,
fontName='Helvetica',
)
ref_style = ParagraphStyle(
'RefStyle',
fontSize=8,
textColor=colors.HexColor('#546e7a'),
spaceAfter=2,
fontName='Helvetica-Oblique',
alignment=TA_CENTER,
)
def section_header(text, color_hex='#1565c0'):
data = [[Paragraph(text, ParagraphStyle(
'sh', fontSize=13, textColor=colors.white,
fontName='Helvetica-Bold', alignment=TA_LEFT, leading=16
))]]
t = Table(data, colWidths=[17*cm])
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), colors.HexColor(color_hex)),
('TOPPADDING', (0,0), (-1,-1), 6),
('BOTTOMPADDING', (0,0), (-1,-1), 6),
('LEFTPADDING', (0,0), (-1,-1), 10),
('RIGHTPADDING', (0,0), (-1,-1), 10),
('ROUNDEDCORNERS', [4,4,4,4]),
]))
return t
def colored_subhead(text):
return Paragraph(f'<font color="#0d47a1"><b>{text}</b></font>', body_style)
def bullet(text):
return Paragraph(f'• {text}', bullet_style)
def info_table(data, col_widths, header_color='#1565c0'):
header = data[0]
styled_header = [[Paragraph(f'<b>{c}</b>', ParagraphStyle(
'th', fontSize=10, textColor=colors.white, fontName='Helvetica-Bold',
alignment=TA_CENTER, leading=13
)) for c in header]]
styled_body = []
for row in data[1:]:
styled_body.append([Paragraph(str(c), ParagraphStyle(
'td', fontSize=9.5, textColor=colors.HexColor('#212121'),
fontName='Helvetica', leading=13
)) for c in row])
t = Table(styled_header + styled_body, colWidths=col_widths)
style = [
('BACKGROUND', (0,0), (-1,0), colors.HexColor(header_color)),
('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#b0bec5')),
('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#e3f2fd'), colors.white]),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 5),
('BOTTOMPADDING', (0,0), (-1,-1), 5),
('LEFTPADDING', (0,0), (-1,-1), 6),
('RIGHTPADDING', (0,0), (-1,-1), 6),
]
t.setStyle(TableStyle(style))
return t
story = []
# ─── TITLE BLOCK ────────────────────────────────────────────────────
story.append(Paragraph("CARDIAC ARRHYTHMIAS", title_style))
story.append(Paragraph("Causes · Investigations · Treatment", subtitle_style))
story.append(Paragraph("[Short Note — 20 Marks]", marks_style))
story.append(HRFlowable(width="100%", thickness=2, color=colors.HexColor('#1a237e'), spaceAfter=10))
# ─── INTRODUCTION ───────────────────────────────────────────────────
story.append(section_header("1. INTRODUCTION", '#1565c0'))
story.append(Spacer(1, 6))
story.append(Paragraph(
"A cardiac arrhythmia is any deviation from the normal sinus rhythm of the heart — an abnormality in the rate, "
"regularity, or site of origin of the cardiac impulse, or a disturbance in conduction that causes an abnormal "
"sequence of activation. Arrhythmias range from clinically insignificant to immediately life-threatening and "
"represent a major cause of morbidity and mortality worldwide. They arise from disturbances in automaticity, "
"triggered activity, or re-entry within the cardiac conduction system.",
body_style
))
# ─── CLASSIFICATION ─────────────────────────────────────────────────
story.append(Spacer(1, 6))
story.append(section_header("2. CLASSIFICATION", '#1565c0'))
story.append(Spacer(1, 6))
cls_data = [
['Category', 'Examples'],
['Supraventricular (SVT)', 'Sinus tachycardia, AF, AFL, AVNRT, WPW syndrome'],
['Ventricular', 'PVCs, VT (monomorphic/polymorphic), VF, Torsades de pointes'],
['Bradyarrhythmias', 'Sinus bradycardia, SAN disease, AV block (1°, 2°, 3°)'],
['Channelopathies', 'Long QT syndrome, Brugada syndrome, Short QT syndrome'],
]
story.append(info_table(cls_data, [5.5*cm, 11.5*cm]))
# ─── CAUSES / AETIOLOGY ─────────────────────────────────────────────
story.append(Spacer(1, 8))
story.append(section_header("3. CAUSES / AETIOLOGY", '#0277bd'))
story.append(Spacer(1, 6))
story.append(colored_subhead("A. Cardiac Causes"))
cardiac_causes = [
"Coronary artery disease (CAD) and acute myocardial infarction — most common cause of VT/VF",
"Cardiomyopathies: dilated, hypertrophic (HCM), arrhythmogenic right ventricular cardiomyopathy (ARVC)",
"Valvular heart disease (mitral stenosis, aortic stenosis) — predisposes to AF",
"Congenital heart disease (ASD, VSD, Ebstein anomaly)",
"Myocarditis and pericarditis — inflammation disrupts conduction",
"Heart failure — elevated wall stress and neurohormonal activation promote arrhythmias",
"Pre-excitation syndromes (Wolff-Parkinson-White syndrome)",
"Cardiac surgery / catheterisation — direct mechanical injury to conduction tissue",
]
for c in cardiac_causes:
story.append(bullet(c))
story.append(Spacer(1, 4))
story.append(colored_subhead("B. Metabolic and Electrolyte Disturbances"))
meta_causes = [
"Hypokalaemia — increased automaticity and triggered activity (after-depolarisations); increased risk with digoxin",
"Hyperkalaemia — depresses ectopic pacemakers; slows conduction; can cause fatal VF",
"Hypomagnesaemia — precipitates Torsades de Pointes, refractory AF",
"Hypocalcaemia — prolonged QT interval",
"Hyperthyroidism — common reversible cause of AF; TSH should be checked at diagnosis",
"Hypothyroidism — bradyarrhythmias and prolonged QT",
"Acidosis and alkalosis — alter ion channel kinetics",
]
for c in meta_causes:
story.append(bullet(c))
story.append(Spacer(1, 4))
story.append(colored_subhead("C. Drug-Induced (Proarrhythmia)"))
drug_causes = [
"Class I antiarrhythmics (flecainide, quinidine) — proarrhythmia in structural heart disease",
"Class III drugs (sotalol, amiodarone) — QT prolongation → Torsades de Pointes",
"QT-prolonging agents: macrolides (erythromycin), fluoroquinolones, antipsychotics, TCAs, methadone",
"Digoxin toxicity — PVCs, bigeminy, VT, AV block (especially with hypokalaemia)",
"Sympathomimetics (adrenaline, cocaine, amphetamines) — catecholamine excess",
]
for c in drug_causes:
story.append(bullet(c))
story.append(Spacer(1, 4))
story.append(colored_subhead("D. Autonomic and Systemic Causes"))
auto_causes = [
"Increased sympathetic tone: anxiety, phaeochromocytoma, exercise, caffeine, alcohol",
"Increased vagal tone: vasovagal syncope, carotid sinus hypersensitivity",
"Obstructive sleep apnea — nocturnal AF, bradyarrhythmias",
"Sepsis and critical illness — multifactorial arrhythmogenesis",
"Pulmonary embolism — acute right heart strain, AF, sinus tachycardia",
"Genetic syndromes: Long QT (LQTS), Brugada, CPVT, Short QT — channelopathies without structural disease",
]
for c in auto_causes:
story.append(bullet(c))
# ─── INVESTIGATIONS ──────────────────────────────────────────────────
story.append(Spacer(1, 8))
story.append(section_header("4. INVESTIGATIONS", '#2e7d32'))
story.append(Spacer(1, 6))
story.append(colored_subhead("A. Electrocardiography (ECG) — First-line and Most Important"))
ecg_points = [
"12-lead ECG: identifies arrhythmia type, heart rate, axis, PR/QRS/QT intervals, delta waves (WPW), ST changes",
"Q waves → prior silent MI; ventricular hypertrophy; Brugada pattern (coved ST elevation V1-V2)",
"Long QT syndrome: QTc >450 ms (men), >470 ms (women); risk of Torsades de Pointes",
"During sinus rhythm: PVCs, bundle branch block, pre-excitation may be visible",
"Ambulatory ECG (Holter Monitor, 24–48 h): documents intermittent arrhythmias correlated with symptoms",
"Event recorder / implantable loop recorder (ILR): for infrequent, unexplained syncope over months to years",
"Exercise stress test (EST): reveals exercise-induced VT, CPVT; assesses rate response",
]
for p in ecg_points:
story.append(bullet(p))
story.append(Spacer(1, 4))
story.append(colored_subhead("B. Laboratory Investigations"))
lab_data = [
['Test', 'Rationale / What to Look For'],
['Serum electrolytes (K⁺, Na⁺, Mg²⁺, Ca²⁺)', 'Electrolyte imbalance as precipitant or perpetuator'],
['Thyroid function tests (TSH, T3, T4)', 'Hyper-/hypothyroidism — reversible cause of AF'],
['Full blood count (FBC)', 'Anaemia → compensatory tachycardia'],
['Cardiac biomarkers (Troponin I/T, CK-MB)', 'Acute MI or myocarditis as substrate'],
['Renal function (urea, creatinine)', 'Renal failure → hyperkalaemia, drug accumulation'],
['Liver function tests (LFTs)', 'Liver disease → reduced drug metabolism (amiodarone)'],
['Drug levels', 'Digoxin toxicity; therapeutic monitoring of antiarrhythmics'],
['Arterial Blood Gas (ABG)', 'Acidosis/alkalosis in critically ill patients'],
['BNP / NT-proBNP', 'Heart failure assessment; elevated in structural heart disease'],
]
story.append(info_table(lab_data, [7*cm, 10*cm], '#2e7d32'))
story.append(Spacer(1, 6))
story.append(colored_subhead("C. Cardiac Imaging"))
imaging_points = [
"Transthoracic Echocardiography (TTE): LV/RV function (EF), wall motion, hypertrophy, valvular disease, pericardial effusion — most common initial imaging",
"Cardiac MRI with gadolinium: detects myocardial scar (late gadolinium enhancement) — key in VT workup; identifies ARVC, myocarditis, HCM",
"Coronary angiography / CT coronary angiography: excludes obstructive CAD as arrhythmia substrate",
"Nuclear imaging (MIBG scan): sympathetic innervation mapping in HF-related arrhythmias",
]
for p in imaging_points:
story.append(bullet(p))
story.append(Spacer(1, 4))
story.append(colored_subhead("D. Electrophysiological Study (EPS)"))
eps_points = [
"Invasive intracardiac study — maps conduction system, induces and localises arrhythmia circuit",
"Indications: risk stratification in VT/VF survivors, unexplained syncope, ablation planning, WPW",
"Programmed electrical stimulation (PES): triggers VT in patients with scar-mediated re-entry",
"Head-up tilt table test: diagnoses vasovagal syncope and POTS",
]
for p in eps_points:
story.append(bullet(p))
# ─── TREATMENT ───────────────────────────────────────────────────────
story.append(Spacer(1, 8))
story.append(section_header("5. TREATMENT OF ARRHYTHMIAS", '#6a1b9a'))
story.append(Spacer(1, 6))
story.append(Paragraph(
"Treatment is guided by: (1) type of arrhythmia (tachy vs brady, SVT vs VT), "
"(2) haemodynamic stability, (3) presence of structural heart disease, "
"(4) symptom burden, and (5) risk of sudden cardiac death. "
"The mere detection of an arrhythmia does not automatically mandate pharmacologic suppression.",
body_style
))
story.append(Spacer(1, 4))
story.append(colored_subhead("A. General / Conservative Measures"))
gen_tx = [
"Treat the underlying cause: correct electrolytes, manage ischaemia, treat thyroid disease, control infection",
"Avoid precipitants: limit caffeine, alcohol, sympathomimetic drugs, QT-prolonging agents",
"Reassurance and lifestyle modification for benign, structurally normal-heart arrhythmias",
]
for t in gen_tx:
story.append(bullet(t))
story.append(Spacer(1, 4))
story.append(colored_subhead("B. Pharmacological Treatment — Vaughan Williams Classification"))
story.append(Spacer(1, 3))
drug_data = [
['Class', 'Mechanism', 'Key Drugs', 'Clinical Use'],
['Ia', 'Na⁺ block + K⁺ block\n(moderate use-dependent)', 'Quinidine, Procainamide,\nDisopyramide', 'AF, VT (limited — proarrhythmic)'],
['Ib', 'Na⁺ block\n(fast-dissociation)', 'Lignocaine (IV),\nMexiletine', 'Acute VT/VF (lignocaine IV);\nVentricular arrhythmias'],
['Ic', 'Na⁺ block\n(slow-dissociation)', 'Flecainide,\nPropafenone', 'AF/AFL in structurally\nnormal hearts; AVNRT'],
['II', 'β-adrenergic blockade\n(sympatholytic)', 'Metoprolol, Atenolol,\nCarvedilol, Propranolol', '1st-line: most VAs, AF rate\ncontrol, exercise-induced VT'],
['III', 'K⁺ channel block\n(prolongs repolarisation)', 'Amiodarone, Sotalol,\nDofetilide, Ibutilide', 'VT/VF, AF/AFL rhythm\ncontrol; drug of choice in\nstructural heart disease'],
['IV', 'Ca²⁺ channel block\n(non-DHP)', 'Verapamil,\nDiltiazem', 'AF/AFL rate control;\nAVNRT; idiopathic VT\n(verapamil-sensitive)'],
['V', 'Other / Multiple', 'Digoxin, Adenosine,\nMagnesium', 'AF rate control (HF);\nSVT termination;\nTorsades de Pointes'],
]
story.append(info_table(drug_data, [1.7*cm, 4*cm, 4.2*cm, 7.1*cm], '#6a1b9a'))
story.append(Spacer(1, 6))
story.append(colored_subhead("C. Special Treatment Scenarios"))
story.append(Spacer(1, 3))
scenario_data = [
['Arrhythmia', 'Acute Management', 'Long-term Strategy'],
['Haemodynamically\nunstable SVT/VT/VF', 'Immediate DC cardioversion\n(synchronised/unsynchronised)', 'ICD ± antiarrhythmic drug;\ncatheter ablation'],
['Stable SVT (AVNRT)', 'Vagal manoeuvres → IV adenosine\n(6 mg, repeat 12 mg)', 'Ablation (curative); CCB or\nβ-blocker for prevention'],
['Atrial Fibrillation', 'Rate control: BB/CCB/digoxin;\nDC cardioversion if haemodynamic compromise;\nanticoagulation (NOAC/warfarin)', 'Rate vs rhythm control;\nablation (PV isolation);\nstroke prevention essential'],
['Ventricular Tachycardia\n(stable, structural heart disease)', 'IV amiodarone (300 mg over 20–60 min);\nor IV lignocaine', 'ICD implantation;\ncatheter ablation;\namiodarone or sotalol'],
['Torsades de Pointes', 'IV Magnesium sulphate 2 g over 5 min;\ntemporary pacing to increase rate;\nstop QT-prolonging drugs', 'Correct underlying cause;\nICD if recurrent'],
['Bradyarrhythmia\n(symptomatic)', 'Atropine 0.5–1 mg IV;\nor Isoprenaline infusion', 'Permanent pacemaker (PPM)\nimplantation'],
['Complete Heart Block\n(3° AV block)', 'Temporary transvenous pacing', 'Permanent pacemaker'],
]
story.append(info_table(scenario_data, [3.8*cm, 6.1*cm, 7.1*cm], '#6a1b9a'))
story.append(Spacer(1, 6))
story.append(colored_subhead("D. Non-Pharmacological / Interventional Treatments"))
nonpharm = [
"DC Cardioversion: synchronised (VT/SVT) or unsynchronised defibrillation (VF/pulseless VT) — first line for haemodynamic instability",
"Catheter Ablation: radiofrequency (RF) or cryoablation to destroy arrhythmia focus or re-entry circuit. Curative for AVNRT (>95%), AF (PV isolation 60–80%), accessory pathways (WPW), idiopathic VT",
"Implantable Cardioverter-Defibrillator (ICD): primary or secondary prevention of sudden cardiac death in VT/VF; detects and terminates life-threatening arrhythmia automatically",
"Cardiac Resynchronisation Therapy (CRT): biventricular pacing in HF with LBBB (QRS >150 ms, EF <35%) — reduces arrhythmic burden",
"Permanent Pacemaker (PPM): indicated for symptomatic bradyarrhythmias, SAN disease, 2°/3° AV block — single/dual/rate-responsive chamber devices",
"Surgical ablation (Cox-Maze procedure): for AF during concomitant cardiac surgery",
"Left cardiac sympathetic denervation (LCSD): for refractory LQTS, CPVT, or VT storm",
]
for n in nonpharm:
story.append(bullet(n))
# ─── IMPORTANT NOTES ─────────────────────────────────────────────────
story.append(Spacer(1, 8))
story.append(section_header("6. KEY CLINICAL POINTS FOR EXAMS", '#e65100'))
story.append(Spacer(1, 6))
key_data = [
['Point', 'Detail'],
['Proarrhythmia risk', 'All antiarrhythmic drugs can CAUSE arrhythmias (proarrhythmia). Risk is highest in patients with structural heart disease (Class Ic drugs contraindicated post-MI)'],
['CAST Trial', 'Cardiac Arrhythmia Suppression Trial — showed increased mortality with flecainide/encainide post-MI despite PVC suppression. Established "treat the patient, not the rhythm" principle'],
['Rate vs Rhythm control', 'In AF, rate control (BB/CCB) shown equivalent or superior to rhythm control in AFFIRM trial for most patients. Anticoagulation for stroke prevention is mandatory regardless of strategy'],
['ICD superiority', 'ICD is superior to antiarrhythmic drugs (including amiodarone) for secondary prevention of cardiac arrest (AVID, CIDS, CASH trials)'],
['Amiodarone toxicity', 'Pulmonary toxicity, thyroid dysfunction (hypo/hyperthyroidism), corneal microdeposits, hepatotoxicity, photosensitivity, peripheral neuropathy — multiple organ monitoring required'],
['Adenosine', 'Half-life 10 seconds — terminates most SVTs. Contraindicated in asthma; can reveal underlying atrial flutter/fibrillation'],
]
story.append(info_table(key_data, [4.5*cm, 12.5*cm], '#e65100'))
# ─── SUMMARY TABLE ────────────────────────────────────────────────────
story.append(Spacer(1, 8))
story.append(section_header("7. SUMMARY", '#37474f'))
story.append(Spacer(1, 6))
story.append(Paragraph(
"Arrhythmias result from disturbances in automaticity, triggered activity, or re-entry. "
"Common causes include ischaemic heart disease, electrolyte imbalance, drug toxicity, and channelopathies. "
"Investigation centres on the 12-lead ECG, ambulatory monitoring, echocardiography, and selective EPS. "
"Treatment follows a stepwise approach: correct the reversible cause, use antiarrhythmic drugs (Vaughan Williams I-V) appropriately, "
"and deploy device therapy (ICD, PPM, CRT) or catheter ablation for definitive management. "
"The overarching goal is to reduce symptoms and prevent sudden cardiac death while minimising proarrhythmic risk.",
body_style
))
# ─── REFERENCES ──────────────────────────────────────────────────────
story.append(Spacer(1, 10))
story.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor('#90a4ae'), spaceAfter=4))
story.append(Paragraph("References", ParagraphStyle('ref_hd', fontSize=9, fontName='Helvetica-Bold', textColor=colors.HexColor('#546e7a'))))
refs = [
"Harrison's Principles of Internal Medicine, 22nd Edition (2025), Chapter 259 — Approach to the Patient with Arrhythmias",
"Katzung's Basic and Clinical Pharmacology, 16th Edition — Chapter 14: Antiarrhythmic Drugs",
"Goodman & Gilman's The Pharmacological Basis of Therapeutics — Antiarrhythmic Drugs",
"Braunwald's Heart Disease, A Textbook of Cardiovascular Medicine",
"Goldman-Cecil Medicine, International Edition — Ventricular Arrhythmias",
]
for r in refs:
story.append(Paragraph(f"• {r}", ref_style))
doc.build(story)
print(f"PDF generated: {OUTPUT}")
cd /home/daytona/workspace/arrhythmia-pdf && python generate_arrhythmia_pdf.py
ls -lh /home/daytona/workspace/arrhythmia-pdf/
Arrhythmias Short Note 20Marks
PDF Document · PDF
| Section | Content |
|---|---|
| 1. Introduction | Definition, mechanisms (automaticity, re-entry, triggered activity) |
| 2. Classification | SVT, Ventricular, Bradyarrhythmias, Channelopathies table |
| 3. Causes / Aetiology | Cardiac (CAD, cardiomyopathy, valvular, WPW), Electrolyte (K⁺, Mg²⁺, Ca²⁺), Drug-induced proarrhythmia, Autonomic/systemic |
| 4. Investigations | 12-lead ECG, Holter, EPS, Lab tests table (K, TFT, troponin, BNP), Echo, Cardiac MRI |
| 5. Treatment | Vaughan Williams Class I-V table; scenario-based management table (AF, VT, Torsades, CHB); Non-pharmacological (DC cardioversion, ICD, catheter ablation, PPM, CRT) |
| 6. Key Exam Points | CAST trial, AFFIRM trial, ICD vs amiodarone, proarrhythmia, adenosine |
| 7. Summary | Concise paragraph tying everything together |