You are an expert HKMLE tutor helping me ACE the Hong Kong Medical Licensing Examination (Papers 1 and 2). Create a high-yield, comprehensive, beginner-friendly study note for the topic below. You are FULLY AUTHORISED to add any sections, mnemonics, tables, diagrams (text-based), clinical pearls, trap warnings, red flags, drug interactions, trial data, comparisons, flowcharts, quick summaries, or anything else you think will help me ACE this exam. --- DIAGRAM REQUIREMENTS --- If you can generate actual images/diagrams, include them. If not, use clear written descriptions instead of text-based ASCII diagrams. --- REQUIREMENTS --- For each major condition, include: - Definition - Classification (with table where helpful) - Aetiology / Causes (with a BOLD mnemonic) - Pathophysiology (step-by-step, beginner-friendly) - Risk factors (with mnemonic) - Symptoms (with mnemonic) - Signs (with mnemonic) - Investigations (with mnemonic). Provide a prioritised diagnostic algorithm (Bedside → Labs → Imaging). - Management (acute and chronic, with mnemonics for treatment steps). Differentiate standard international guidelines from local Hong Kong Hospital Authority (HA) protocols and Centre for Health Protection (CHP) recommendations. Break down emergency steps into explicit verbal orders. - Complications (with mnemonic where possible) - Prognosis (with mnemonic where possible) --- ADD THESE ELEMENTS THROUGHOUT --- - ⚠️ HKMLE TRAP boxes (Highlight where standard US/UK textbook answers will cause me to lose marks on Paper 1 & 2) - 🏢 HA CLINICAL PATHWAY boxes (Specify default drug formulations, staging systems, or referral pathways used in HK public hospitals) - 📋 CHP STATUTORY NOTIFICATION boxes (Explicitly flag if the condition is a statutory notifiable infectious disease in HK) - 🌏 LOCAL EPIDEMIOLOGY VARIANT boxes (Highlight high-prevalence local variations, e.g., Klebsiella liver abscesses, Recurrent Pyogenic Cholangitis, local Thalassemia/G6PD patterns) - 📋 INVESTIGATION INTERPRETATION boxes (Provide a classic raw data result example—e.g., ABG, CSF, ECG—and its 1-sentence interpretation) - ⚖️ LEGAL & ETHICAL ORDINANCE boxes (Flag relevant local legislation, e.g., Cap. 136 Mental Health Ordinance or mandatory reporting rules) - 📌 QUICK SUMMARY boxes - 🚨 RED FLAGS box - ❓ COMMON EXAM QUESTION box - 🔬 BASIC SCIENCE INTEGRATION box --- REQUIRED TABLES AT THE END --- - ⚠️ DRUG TRAPS table - 📊 NOTABLE TRIALS table - 🧠 MASTER MNEMONICS table - 🔗 CROSS-MODULE LINKS --- TOPIC --- Module 1D: Valvular + Pericardial + Cardiomyopathies + Infective Endocarditis Valvular Heart Disease: - Aortic stenosis (AS) — causes (bicuspid, calcific, rheumatic), pathophysiology, symptoms (SAD), signs (slow-rising pulse, narrow pulse pressure, ejection systolic murmur), investigations (Echo, catheterisation), management (TAVI vs SAVR), indications for surgery. - Aortic regurgitation (AR) — causes (rheumatic, bicuspid, endocarditis, aortic dissection, Marfan), pathophysiology, symptoms, signs (wide pulse pressure, collapsing pulse, early diastolic murmur), management (surgical indications). - Mitral stenosis (MS) — causes (rheumatic — most common), pathophysiology, symptoms (dyspnoea, haemoptysis, hoarseness), signs (malar flush, tapping apex, opening snap, mid-diastolic murmur), management (valvotomy, replacement). - Mitral regurgitation (MR) — causes (rheumatic, myxomatous, ischaemic), pathophysiology (acute vs chronic), symptoms, signs (pansystolic murmur at apex radiating to axilla), management (surgical indications). - Rheumatic heart disease — Jones criteria, prophylaxis (secondary penicillin), HK relevance. Generate the complete ace-level pdf note on it.

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Searching Images

aortic stenosis ejection systolic murmur echocardiogram calcified valve

Searching Images

mitral stenosis echocardiogram opening snap malar flush

Searching Images

infective endocarditis vegetations echocardiogram Osler nodes Janeway lesions splinter haemorrhages

Searching Images

cardiac tamponade pericardial effusion echocardiogram ECG electrical alternans

Searching Images

hypertrophic cardiomyopathy myocyte disarray histology and echocardiogram septal hypertrophy

Searching PubMed

"valvular heart disease" guideline management

Reading File
Finding Sources
Finding Sources
Searching Images

Osler nodes Janeway lesions splinter haemorrhage endocarditis

Searching Images

malar flush mitral stenosis

Running Command

python3 -c "import weasyprint" 2>&1 | tail -5; echo "---"; python3 -c "import xhtml2pdf" 2>&1 | tail -5; echo "---"; python3 -c "import markdown" 2>&1 | tail -5; echo "---"; python3 -c "import reportlab; print(reportlab.Version)" 2>&1; echo "---"; python3 -c "import fpdf; print('fpdf ok')" 2>&1 | tail -3

Now I'll build the full document. Given the scope, I'll generate it programmatically with ReportLab (styled headers, colour-coded boxes, and data tables) rather than plain text.
Writing File

~/hkmle-1d/build_note.py

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
HKMLE Module 1D Study Note Builder
Valvular Heart Disease + Rheumatic Heart Disease + Infective Endocarditis
+ Pericardial Disease + Cardiomyopathies
"""
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
                                 PageBreak, HRFlowable, KeepTogether)
from reportlab.lib.enums import TA_LEFT, TA_CENTER
from reportlab.pdfgen import canvas

FULLW = 17.2 * cm

styles = getSampleStyleSheet()

def mk(name, parent='Normal', **kw):
    s = ParagraphStyle(name, parent=styles[parent], **kw)
    styles.add(s)
    return s

title_style = mk('TitleX', fontSize=21, leading=25, textColor=colors.HexColor('#0B2545'),
                  alignment=TA_CENTER, spaceAfter=4, fontName='Helvetica-Bold')
sub_title   = mk('SubTitleX', fontSize=11.5, leading=15, textColor=colors.HexColor('#555555'),
                  alignment=TA_CENTER, spaceAfter=4, fontName='Helvetica-Oblique')
h1s = mk('H1X', fontSize=15, leading=19, textColor=colors.white, fontName='Helvetica-Bold')
h2s = mk('H2X', fontSize=12.5, leading=16, textColor=colors.white, fontName='Helvetica-Bold')
h3s = mk('H3X', fontSize=10.3, leading=13, textColor=colors.HexColor('#B03A2E'),
          fontName='Helvetica-Bold', spaceBefore=7, spaceAfter=2)
body = mk('BodyX', fontSize=9.3, leading=12.6, spaceAfter=3, alignment=TA_LEFT)
bodyb = mk('BodyBX', parent='BodyX', fontName='Helvetica-Bold')
boxtitle = mk('BoxTitleX', fontSize=9.7, leading=12, fontName='Helvetica-Bold', spaceAfter=2)
boxbody = mk('BoxBodyX', fontSize=9, leading=12.2)
cellS = mk('CellX', fontSize=8.3, leading=10.6)
cellH = mk('CellHX', fontSize=8.5, leading=10.6, textColor=colors.white, fontName='Helvetica-Bold')
capS = mk('CapX', fontSize=8, leading=10, textColor=colors.HexColor('#666666'), fontName='Helvetica-Oblique')

story = []

def C(s):
    return Paragraph(str(s), cellS)

def CH(s):
    return Paragraph(str(s), cellH)

def section_header(text, num=None):
    label = f"{num}. {text}" if num else text
    t = Table([[Paragraph(label, h1s)]], colWidths=[FULLW])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0, 0), (-1, -1), colors.HexColor('#0B2545')),
        ('TOPPADDING', (0, 0), (-1, -1), 7), ('BOTTOMPADDING', (0, 0), (-1, -1), 7),
        ('LEFTPADDING', (0, 0), (-1, -1), 9),
    ]))
    story.append(Spacer(1, 10))
    story.append(t)
    story.append(Spacer(1, 6))

def sub_header(text):
    t = Table([[Paragraph(text, h2s)]], colWidths=[FULLW])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0, 0), (-1, -1), colors.HexColor('#3E6690')),
        ('TOPPADDING', (0, 0), (-1, -1), 5), ('BOTTOMPADDING', (0, 0), (-1, -1), 5),
        ('LEFTPADDING', (0, 0), (-1, -1), 9),
    ]))
    story.append(Spacer(1, 6))
    story.append(t)
    story.append(Spacer(1, 4))

def field(label, text):
    story.append(Paragraph(f"<b>{label}:</b> {text}", body))

def sub3(text):
    story.append(Paragraph(text, h3s))

def p(text):
    story.append(Paragraph(text, body))

def box(emoji_title, text, bg, border):
    content = [[Paragraph(emoji_title, boxtitle)], [Paragraph(text, boxbody)]]
    t = Table(content, colWidths=[FULLW])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0, 0), (-1, -1), colors.HexColor(bg)),
        ('BOX', (0, 0), (-1, -1), 0.9, colors.HexColor(border)),
        ('LINEBELOW', (0, 0), (0, 0), 0, colors.HexColor(bg)),
        ('TOPPADDING', (0, 0), (-1, -1), 5), ('BOTTOMPADDING', (0, 0), (-1, -1), 5),
        ('LEFTPADDING', (0, 0), (-1, -1), 9), ('RIGHTPADDING', (0, 0), (-1, -1), 9),
    ]))
    story.append(Spacer(1, 5))
    story.append(t)
    story.append(Spacer(1, 3))

def TRAP(text):    box("⚠️ HKMLE TRAP", text, '#FDECEA', '#E74C3C')
def HA(text):       box("🏢 HA CLINICAL PATHWAY", text, '#E9F7EF', '#27AE60')
def CHP(text):      box("📋 CHP STATUTORY NOTIFICATION", text, '#FFF4E5', '#E67E22')
def EPI(text):       box("🌏 LOCAL EPIDEMIOLOGY VARIANT", text, '#F5EEF8', '#9B59B6')
def INV(text):       box("📋 INVESTIGATION INTERPRETATION", text, '#E8F8F5', '#16A085')
def LAW(text):       box("⚖️ LEGAL & ETHICAL ORDINANCE", text, '#ECF0F1', '#607D8B')
def SUMMARY(text):   box("📌 QUICK SUMMARY", text, '#FEF9E7', '#F1C40F')
def REDFLAG(text):   box("🚨 RED FLAGS", text, '#FDEDEC', '#C0392B')
def EXAMQ(text):     box("❓ COMMON EXAM QUESTION", text, '#EBF5FB', '#2980B9')
def SCI(text):        box("🔬 BASIC SCIENCE INTEGRATION", text, '#F0F7EC', '#7CB342')
def MNEMO(title, text): box("🧠 MNEMONIC — " + title, text, '#FFF8E1', '#F39C12')

def data_table(headers, rows, col_w=None):
    data = [[CH(h) for h in headers]] + [[C(c) for c in r] for r in rows]
    t = Table(data, colWidths=col_w, repeatRows=1)
    style = [
        ('BACKGROUND', (0, 0), (-1, 0), colors.HexColor('#0B2545')),
        ('GRID', (0, 0), (-1, -1), 0.5, colors.HexColor('#AAAAAA')),
        ('VALIGN', (0, 0), (-1, -1), 'TOP'),
        ('ROWBACKGROUNDS', (0, 1), (-1, -1), [colors.white, colors.HexColor('#F2F5F7')]),
        ('TOPPADDING', (0, 0), (-1, -1), 4), ('BOTTOMPADDING', (0, 0), (-1, -1), 4),
        ('LEFTPADDING', (0, 0), (-1, -1), 4), ('RIGHTPADDING', (0, 0), (-1, -1), 4),
    ]
    t.setStyle(TableStyle(style))
    story.append(Spacer(1, 4))
    story.append(t)
    story.append(Spacer(1, 5))

def caption(text):
    story.append(Paragraph(text, capS))

def hr():
    story.append(Spacer(1, 4))
    story.append(HRFlowable(width=FULLW, thickness=0.6, color=colors.HexColor('#BBBBBB')))
    story.append(Spacer(1, 4))

def pagebreak():
    story.append(PageBreak())

# =====================================================================================
# COVER
# =====================================================================================
story.append(Spacer(1, 40))
story.append(Paragraph("HKMLE PAPER 1 &amp; 2 — HIGH-YIELD ACE NOTES", title_style))
story.append(Paragraph("MODULE 1D: Valvular Heart Disease · Rheumatic Heart Disease ·<br/>"
                        "Infective Endocarditis · Pericardial Disease · Cardiomyopathies", sub_title))
story.append(Spacer(1, 10))
story.append(HRFlowable(width=FULLW, thickness=1.2, color=colors.HexColor('#0B2545')))
story.append(Spacer(1, 14))
box("📌 HOW TO USE THIS NOTE",
    "Every condition follows: Definition → Classification → Aetiology (mnemonic) → Pathophysiology "
    "→ Risk Factors → Symptoms → Signs → Investigations (bedside→labs→imaging) → Management "
    "(acute + chronic, guideline vs HA-specific) → Complications → Prognosis. Coloured boxes flag "
    "HKMLE-specific traps, HA/CHP protocols, local epidemiology, and legal ordinances that standard "
    "US/UK textbooks will NOT warn you about.", '#EAF2F8', '#2E86C1')
story.append(Spacer(1, 8))
p("<b>Legend:</b> ⚠️ HKMLE Trap · 🏢 HA Clinical Pathway · 📋 CHP Statutory Notification · "
  "🌏 Local Epidemiology · 📋 Investigation Interpretation · ⚖️ Legal/Ethical · 📌 Quick Summary · "
  "🚨 Red Flags · ❓ Exam Question · 🔬 Basic Science · 🧠 Mnemonic")
pagebreak()

# =====================================================================================
# ORIENTATION: APPROACH TO A MURMUR
# =====================================================================================
section_header("Orientation — The Big Picture of Valvular Heart Disease (VHD)", "0")
p("A murmur question on HKMLE is almost always solved by combining <b>timing</b> (systolic vs diastolic), "
  "<b>site of maximal intensity</b>, <b>radiation</b>, and <b>pulse character</b>. Build the picture bedside "
  "BEFORE reaching for an echo answer.")

data_table(
    ["Lesion", "Timing", "Best heard", "Radiation", "Classic pulse/other clue"],
    [
        ["Aortic Stenosis (AS)", "Ejection systolic", "Aortic area (RUSE), 2nd R ICS", "Carotids", "Slow-rising, narrow pulse pressure"],
        ["Aortic Regurgitation (AR)", "Early diastolic, decrescendo", "Left sternal edge, sitting forward, expiration", "Apex", "Collapsing pulse, wide pulse pressure"],
        ["Mitral Stenosis (MS)", "Mid-diastolic, rumbling", "Apex, left lateral, bell, expiration", "Little radiation", "Opening snap, malar flush, AF"],
        ["Mitral Regurgitation (MR)", "Pansystolic, blowing", "Apex", "Axilla", "Displaced hyperdynamic apex"],
    ],
    col_w=[3.6*cm, 3.2*cm, 4.2*cm, 2.6*cm, 3.6*cm]
)
TRAP("HKMLE loves the phrase '<b>ejection systolic murmur that radiates to the carotids</b>' — this is AS "
     "until proven otherwise, but examiners frequently add a distractor of 'flow murmur of anaemia/pregnancy' "
     "which is ALSO an ejection systolic murmur but does NOT radiate to the carotids and has normal S2. "
     "Always check S2 (soft/absent in severe AS) before committing to the AS answer.")

# =====================================================================================
# 1. AORTIC STENOSIS
# =====================================================================================
section_header("Aortic Stenosis (AS)", "1")

sub3("Definition")
p("Narrowing of the aortic valve orifice obstructing left ventricular (LV) outflow during systole, causing a "
  "pressure gradient between the LV and aorta.")

sub3("Classification (by severity — echocardiographic, ESC/ACC criteria)")
data_table(
    ["Severity", "Aortic Jet Velocity (m/s)", "Mean Gradient (mmHg)", "Valve Area (cm²)"],
    [
        ["Mild", "2.6 – 2.9", "< 20", "> 1.5"],
        ["Moderate", "3.0 – 3.9", "20 – 39", "1.0 – 1.5"],
        ["Severe", "≥ 4.0", "≥ 40", "< 1.0"],
        ["Critical/Very severe", "≥ 5.0", "≥ 60", "< 0.6"],
    ],
    col_w=[3.6*cm, 4.5*cm, 4.5*cm, 4.5*cm]
)
sub3("Aetiology / Causes")
MNEMO("AS = 'ABC' by age", "<b>A</b>ge-related calcific (elderly, >65y — MOST COMMON overall) · "
      "<b>B</b>icuspid aortic valve (calcifies early, presents 40–60y; associated with coarctation, "
      "Turner syndrome, aortic dissection) · <b>C</b>hronic rheumatic heart disease (young adults, "
      "almost always with concurrent mitral valve disease — key HK-relevant cause)")
p("Rare: severe CKD/hyperparathyroidism (accelerated calcification), Paget disease, homozygous familial "
  "hypercholesterolaemia (young), congenital unicuspid valve (infants).")

sub3("Pathophysiology (step-by-step)")
p("1) Valve leaflets thicken/calcify/fuse → orifice narrows.<br/>"
  "2) LV must generate higher pressure to push blood through the fixed narrow orifice → chronic pressure "
  "overload.<br/>"
  "3) LV responds with <b>concentric hypertrophy</b> (sarcomeres added in parallel) to normalise wall stress "
  "(Laplace's law) — LV cavity size preserved, wall thickens.<br/>"
  "4) Hypertrophied LV has ↑ myocardial oxygen demand + relative subendocardial ischaemia (compressed "
  "coronary perforators, ↓ diastolic coronary flow time) → angina even without coronary artery disease.<br/>"
  "5) Hypertrophied, stiff LV → diastolic dysfunction → ↓ compliance → dyspnoea on exertion.<br/>"
  "6) Fixed obstruction means cardiac output cannot rise with exercise/vasodilation → exertional syncope "
  "(inadequate cerebral perfusion, also may be arrhythmic).<br/>"
  "7) Late stage: LV can no longer compensate → dilates, contractility falls → LV failure, low-output state, "
  "and worsened by afterload mismatch.")

SCI("Laplace's Law: Wall stress = (Pressure × Radius) / (2 × Wall thickness). AS ↑ pressure, so the LV "
    "increases wall thickness (not radius) to keep stress normal — this is why AS produces CONCENTRIC "
    "(not eccentric) hypertrophy, unlike AR/MR volume overload which produce eccentric hypertrophy.")

sub3("Risk Factors")
MNEMO("CALCIFY", "<b>C</b>KD/dialysis · <b>A</b>ge >65 · <b>L</b>ipids (dyslipidaemia, same risk factors as "
      "atherosclerosis) · <b>C</b>ongenital bicuspid valve · <b>I</b>nfective/rheumatic history · "
      "<b>F</b>amilial hypercholesterolaemia · s<b>Y</b>smoking &amp; hypertension")

sub3("Symptoms")
MNEMO("SAD", "<b>S</b>yncope (exertional) · <b>A</b>ngina · <b>D</b>yspnoea (exertional, progressing to "
      "orthopnoea/PND in decompensation). Classic teaching: onset of symptoms in severe AS = ~50% "
      "2-year mortality if untreated (angina ~5y average survival, syncope ~3y, dyspnoea/CHF ~2y "
      "survival without AVR).")

sub3("Signs")
p("<b>Pulse:</b> slow-rising ('anacrotic'), narrow pulse pressure, plateau pulse.<br/>"
  "<b>Palpation:</b> sustained, heaving apex beat (pressure-loaded, not displaced until late); systolic thrill "
  "at aortic area/carotids.<br/>"
  "<b>Auscultation:</b> harsh ejection systolic murmur, crescendo-decrescendo, loudest 2nd right "
  "intercostal space, radiates to carotids; soft/absent/paradoxically-split S2 (calcified immobile valve) "
  "in severe disease; S4 (forceful atrial contraction against stiff hypertrophied LV); ejection click in "
  "bicuspid valve (young patients).<br/>"
  "<b>Louder with:</b> squatting/leg raise (↑ preload); <b>softer with:</b> Valsalva strain, standing.")
MNEMO("Severity signs — 'SAD LAD'", "<b>S</b>low-rising pulse · <b>A</b>bsent/soft S2 · <b>D</b>elayed, "
      "quiet, late-peaking murmur (paradox: the SOFTER and LATER-peaking the murmur, the more severe the "
      "stenosis — a classic examiner trick) · <b>L</b>V heave · <b>A</b>4th heart sound · <b>D</b>uration of "
      "murmur long")

sub3("Investigations — prioritised algorithm")
p("<b>Bedside:</b> pulse character + BP (narrow pulse pressure), auscultation with dynamic manoeuvres, "
  "12-lead ECG (LVH — Sokolow-Lyon criteria, strain pattern; may show LBBB/AV block if calcification "
  "extends to conduction system).<br/>"
  "<b>Labs:</b> BNP/NT-proBNP (rises with decompensation, prognostic), routine bloods, coagulation profile "
  "(pre-op), group & save.<br/>"
  "<b>Imaging (gold standard): Transthoracic echocardiogram (TTE)</b> — valve morphology, peak/mean "
  "gradient, aortic valve area (continuity equation), LV size/EF, associated MR/AR. "
  "<b>CXR</b>: post-stenotic dilatation of ascending aorta, valve calcification, normal heart size until late. "
  "<b>Cardiac catheterisation</b>: reserved for discordant echo findings, pre-op coronary assessment "
  "(routine before SAVR in patients with cardiac risk factors), or when TTE/TOE inconclusive — direct "
  "measurement of LV–aortic pressure gradient (Gorlin formula). "
  "<b>Dobutamine stress echo</b>: for 'low-flow low-gradient' AS with reduced EF, to distinguish true-severe "
  "from pseudo-severe AS. <b>CT aortic valve calcium scoring</b>: adjunct when echo gradients and anatomy "
  "are discordant.")
MNEMO("AS work-up — 'ECHO-CATH'", "<b>E</b>CG · <b>C</b>XR · <b>H</b>istory/exam · <b>O</b>2 sats/bedside · "
      "then <b>CATH</b>eterisation/CT if echo equivocal")

INV("A patient with severe AS symptoms has echo: peak velocity 3.2 m/s, mean gradient 28 mmHg, EF 35%. "
    "Interpretation: this looks only 'moderate' by numbers but with a failing LV (low EF) it may be "
    "'low-flow low-gradient severe AS' — pseudo-severe vs true-severe must be differentiated with dobutamine "
    "stress echo before deciding against surgery.")

sub3("Management")
p("<b>General/medical:</b> No drug reverses AS. Treat hypertension cautiously (avoid excessive preload/"
  "afterload reduction — nitrates and ACE-inhibitors can precipitate hypotension/syncope in severe AS). "
  "Statins do NOT halt progression (SEAS, ASTRONOMER trials negative). Avoid strenuous exercise once "
  "symptomatic or severe. Infective endocarditis precautions (dental hygiene).")
MNEMO("AS Rx decision — 'SAVR the SAD patient'", "Symptoms + Severe AS = intervene. Asymptomatic severe "
      "AS is intervened on if: LVEF <50%, very severe (Vmax ≥5 m/s), rapid progression, abnormal exercise "
      "test (symptoms/BP drop), markedly elevated BNP, or undergoing other cardiac surgery.")

data_table(
    ["Indication (ESC/ACC 2021 class I)", "Detail"],
    [["Symptomatic severe AS", "Definite indication regardless of EF"],
     ["Asymptomatic severe AS + LVEF <50%", "Intervene"],
     ["Asymptomatic severe AS + abnormal exercise test", "Symptoms/BP fall/arrhythmia on treadmill"],
     ["Severe AS undergoing other cardiac surgery (e.g. CABG)", "Concomitant AVR"],
     ["Very severe AS (Vmax ≥5 m/s) even if asymptomatic", "Low surgical risk → consider early AVR"]],
    col_w=[8.5*cm, 8.7*cm]
)

sub3("TAVI vs SAVR — the modern decision tree")
data_table(
    ["Factor", "Favours SAVR", "Favours TAVI"],
    [["Age", "<75y", "≥75–80y or frailty"],
     ["Surgical risk (STS/EuroSCORE II)", "Low risk", "Intermediate–high / prohibitive risk"],
     ["Valve anatomy", "Bicuspid valve, small annulus", "Standard tricuspid calcific anatomy"],
     ["Other pathology", "Concomitant CABG/other valve surgery needed", "Isolated AS, transfemoral access feasible"],
     ["Life expectancy", "Long (durability favours surgical bioprosthesis/mechanical)", "Limited life expectancy"],
     ["Landmark trials", "—", "PARTNER, CoreValve, Evolut Low-Risk — TAVI non-inferior/superior even in low-risk pts <75y with good anatomy"]],
    col_w=[4.3*cm, 6.4*cm, 6.5*cm]
)
HA("In HK public hospitals (HA), TAVI is performed at designated cardiac centres (e.g. Queen Mary Hospital, "
   "Grantham Hospital cluster) and is prioritised for patients with prohibitive/high surgical risk, elderly "
   "(often ≥80y), or hostile chest (prior CABG). Bioprosthetic valves are the default HA choice for patients "
   ">65y or with contraindication to anticoagulation; mechanical valves (requiring lifelong warfarin, "
   "target INR ~2.5–3.5 depending on valve type/position) are favoured in younger patients able to comply "
   "with regular Anticoagulation Clinic follow-up and INR monitoring.")
TRAP("HKMLE Paper 1 often frames a 'young patient with bicuspid AS' — the textbook-correct answer is still "
     "<b>surgical AVR</b> (not TAVI), because durability of TAVI valves in young patients is unproven and "
     "bicuspid anatomy is often unfavourable for TAVI deployment. Do not default to 'TAVI is the modern "
     "answer' — age and anatomy dictate the choice.")

sub3("Complications")
MNEMO("AS complications — 'SICK HEART'", "<b>S</b>udden cardiac death (highest risk once symptomatic) · "
      "<b>I</b>nfective endocarditis · <b>C</b>onduction defects (calcification onto AV node → heart block) · "
      "<b>K</b>alcification embolism (calcific emboli → stroke) · <b>H</b>eart failure · "
      "<b>E</b>xertional syncope/death · <b>A</b>rrhythmia (AF, VT) · <b>R</b>elated GI bleed "
      "(Heyde syndrome — acquired vWF deficiency + angiodysplasia bleeding) · <b>T</b>AVI complications "
      "(paravalvular leak, pacemaker need, stroke, vascular access injury)")

sub3("Prognosis")
p("Asymptomatic severe AS: ~1–2%/year sudden death risk, but average time to symptom onset is short "
  "once truly severe. Once symptomatic and untreated: mortality is very high — angina (~5y median "
  "survival), syncope (~3y), heart failure (~1–2y). AVR (surgical or TAVI) restores survival close to "
  "age-matched population if performed before irreversible LV dysfunction.")
MNEMO("Prognosis rule of thumb", "'2-3-5': Dyspnoea/CHF ~2 years, Syncope ~3 years, Angina ~5 years "
      "average survival without AVR once symptoms of severe AS begin.")

hr()

# =====================================================================================
# 2. AORTIC REGURGITATION
# =====================================================================================
section_header("Aortic Regurgitation (AR)", "2")

sub3("Definition")
p("Incompetence of the aortic valve allowing retrograde flow from the aorta into the LV during diastole, "
  "due to either valve leaflet disease or aortic root/annulus dilatation.")

sub3("Classification")
data_table(
    ["Onset", "Mechanism", "Key examples"],
    [["Acute", "Sudden severe regurgitant volume onto a normal, non-compliant LV → no time to dilate", "Infective endocarditis (leaflet destruction), aortic dissection (Type A), chest trauma"],
     ["Chronic", "Gradual regurgitant volume overload allowing compensatory eccentric LV dilatation", "Rheumatic disease, bicuspid valve, degenerative/calcific, connective tissue disease"]],
    col_w=[2.8*cm, 7.4*cm, 7*cm]
)

sub3("Aetiology / Causes")
MNEMO("AR — 'MRS VD' (valve leaflet vs root causes)", "<b>Valve leaflet causes:</b> <b>R</b>heumatic fever "
      "(commonest worldwide, usually with MS) · <b>E</b>ndocarditis (infective, leaflet destruction) · "
      "bicuspid valve · <b>Valve prolapse</b> — <br/><b>Aortic root causes:</b> <b>M</b>arfan syndrome · "
      "<b>D</b>issection (aortic, Type A) · <b>S</b>yphilitic aortitis · <b>A</b>nkylosing spondylitis / "
      "seronegative arthropathy · hypertensive aortic ectasia · <b>V</b>asculitis (Takayasu, giant cell) · "
      "Ehlers-Danlos")

sub3("Pathophysiology (step-by-step)")
p("<b>Chronic AR:</b> 1) Regurgitant jet adds to normal venous return → LV volume overload each diastole. "
  "2) LV dilates (eccentric hypertrophy, sarcomeres added in series) to accommodate increased volume while "
  "keeping wall stress/pressure relatively normal — compensated for years, often asymptomatic. "
  "3) Total stroke volume rises (forward + regurgitant volume) → wide pulse pressure, hyperdynamic "
  "circulation, peripheral signs. 4) Eventually LV systolic function decompensates → LV dilates further, "
  "EF falls, symptoms of heart failure emerge — by this point myocardial damage may already be irreversible, "
  "hence surgery must be timed BEFORE overt symptoms/EF decline.<br/>"
  "<b>Acute AR:</b> 1) Sudden regurgitant volume hits a normal-sized, non-compliant LV with no time to "
  "dilate. 2) LV end-diastolic pressure rises steeply → transmitted back to left atrium and pulmonary "
  "circulation → acute pulmonary oedema. 3) Compensatory tachycardia (shortens diastole, limits "
  "regurgitant time) is the only compensation — this is why acute severe AR is a surgical EMERGENCY.")

sub3("Risk Factors")
MNEMO("AR risk — 'BRIDES'", "<b>B</b>icuspid valve · <b>R</b>heumatic fever history · "
      "<b>I</b>nfective endocarditis risk (IVDU, poor dentition, prosthetic valve) · "
      "<b>D</b>issection risk factors (hypertension, Marfan, bicuspid, pregnancy) · "
      "<b>E</b>hlers-Danlos/connective tissue disease · <b>S</b>yphilis / seronegative arthritis")

sub3("Symptoms")
p("Chronic AR: asymptomatic for years (compensated) → exertional dyspnoea, fatigue, palpitations "
  "(forceful heartbeat awareness — 'pounding heart'), angina (uncommon, from ↓ coronary perfusion "
  "pressure in diastole), orthopnoea/PND as LV fails.<br/>"
  "Acute severe AR: sudden dyspnoea, pulmonary oedema, cardiogenic shock — medical emergency.")

sub3("Signs")
MNEMO("AR eponymous signs — 'Corrigan's Collapsing Circulation'",
      "<b>Corrigan's pulse</b> (collapsing/water-hammer pulse) · "
      "<b>de Musset's sign</b> (head bobbing with each heartbeat) · "
      "<b>Quincke's sign</b> (capillary pulsations in nail bed) · "
      "<b>Duroziez's sign</b> (to-and-fro murmur over femoral artery with light compression) · "
      "<b>Traube's sign</b> ('pistol shot' femoral sounds) · "
      "<b>Muller's sign</b> (pulsatile uvula) · "
      "<b>Hill's sign</b> (popliteal BP >20mmHg higher than brachial) · "
      "<b>Austin Flint murmur</b> (mid-diastolic apical rumble from regurgitant jet hitting anterior mitral "
      "leaflet, mimicking MS — but NO opening snap and NO malar flush)")
p("Core exam signs: wide pulse pressure, collapsing/water-hammer pulse, displaced hyperdynamic apex beat "
  "(volume-loaded), early diastolic decrescendo murmur best heard left sternal edge with patient sitting "
  "forward in expiration (louder with handgrip — ↑ afterload increases regurgitant flow).")

sub3("Investigations")
p("<b>Bedside:</b> pulse pressure, peripheral signs above, ECG (LVH, may show volume-overload pattern).<br/>"
  "<b>Labs:</b> BNP, blood cultures ×3 if endocarditis suspected, syphilis serology if root cause suspected, "
  "HLA-B27/inflammatory markers if seronegative arthropathy suspected.<br/>"
  "<b>Imaging:</b> <b>TTE/TOE</b> — regurgitant jet width/vena contracta, LV size and EF (key for timing "
  "surgery), aortic root diameter. <b>CT aortogram</b> — if root dilatation/dissection/Marfan suspected — "
  "essential before elective surgery to assess root size for concomitant root replacement. Cardiac MRI for "
  "quantifying regurgitant fraction when echo is inconclusive.")

sub3("Management — surgical indications (both AR and 'valve unloading' medical therapy)")
p("<b>Medical (chronic, compensated, mild-moderate or inoperable):</b> vasodilators (ACE-inhibitors/ARBs, "
  "dihydropyridine CCBs) reduce afterload and regurgitant volume — used if surgery contraindicated or to "
  "control hypertension; NOT proven to delay surgery in truly asymptomatic patients with normal LV. "
  "Beta-blockers used cautiously (bradycardia lengthens diastole → more regurgitant time) except in "
  "Marfan syndrome where they slow aortic root dilatation.")
data_table(
    ["Surgical indication (Class I)"],
    [["Symptomatic severe AR (any EF)"],
     ["Asymptomatic severe AR with LVEF ≤50%"],
     ["Asymptomatic severe AR with LV end-systolic diameter >50mm or indexed >25mm/m² (progressive dilatation)"],
     ["Severe AR undergoing other cardiac/aortic surgery"],
     ["Aortic root disease: root diameter ≥50mm (Marfan), ≥45mm (Marfan + risk factors), ≥55mm (non-Marfan/bicuspid), or ≥50mm bicuspid + risk factors"]],
    col_w=[17.2*cm]
)
TRAP("ACUTE severe AR (e.g. type A dissection, endocarditis with leaflet perforation) is a SURGICAL "
     "EMERGENCY even without waiting for 'LV dilatation criteria' — the chronic criteria above do NOT apply. "
     "Do not give beta-blockers in acute severe AR from dissection reflexively for 'rate control' without "
     "recognising the priority is emergency surgical referral; nitroprusside/labetalol are used for BP control "
     "en route to theatre, not as definitive treatment.")

sub3("Complications")
MNEMO("AR complications — 'FAILED'", "<b>F</b>ailure (LV, progressive) · <b>A</b>rrhythmia (AF, VT) · "
      "<b>I</b>nfective endocarditis · <b>L</b>V dilatation irreversible if surgery delayed · "
      "<b>E</b>mbolism (if endocarditis) · <b>D</b>issection (if root pathology)")

sub3("Prognosis")
p("Chronic compensated AR has an excellent prognosis for years (<6%/year progression to symptoms/LV "
  "dysfunction when asymptomatic with normal LV). Once LV dysfunction or symptoms develop, prognosis "
  "worsens rapidly without surgery. Acute severe AR carries a very high mortality without emergency surgery.")

hr()

# =====================================================================================
# 3. MITRAL STENOSIS
# =====================================================================================
section_header("Mitral Stenosis (MS)", "3")

sub3("Definition")
p("Narrowing of the mitral valve orifice impeding left atrial (LA) emptying into the LV during diastole. "
  "Normal mitral valve area ≈ 4–6 cm².")

sub3("Classification (severity)")
data_table(
    ["Severity", "Valve area (cm²)", "Mean gradient (mmHg)", "PASP (mmHg)"],
    [["Mild", "> 1.5", "< 5", "< 30"],
     ["Moderate", "1.0 – 1.5", "5 – 10", "30 – 50"],
     ["Severe", "< 1.0", "> 10", "> 50"]],
    col_w=[4.2*cm, 4.3*cm, 4.3*cm, 4.4*cm]
)

sub3("Aetiology / Causes")
MNEMO("MS — 'RARE Causes but Rheumatic Rules'", "<b>R</b>heumatic heart disease — BY FAR the most common "
      "cause worldwide and in HK's older/immigrant population (>90% of MS) · "
      "<b>A</b>ge-related mitral annular calcification (elderly, mild functional MS) · "
      "<b>R</b>are congenital (parachute mitral valve) · "
      "<b>E</b>xtremely rare: carcinoid syndrome, SLE (Libman-Sacks), amyloidosis, left atrial myxoma "
      "(mimics MS — obstructs orifice mechanically, not a true valve disease)")

sub3("Pathophysiology (step-by-step)")
p("1) Rheumatic inflammation → leaflet thickening, commissural fusion, chordal fusion/shortening → "
  "'fish-mouth' fixed orifice.<br/>"
  "2) Fixed orifice obstructs LA emptying → LA pressure rises to maintain flow across the stenotic valve "
  "(pressure gradient proportional to flow² for a fixed orifice — small ↑ in flow causes large ↑ in "
  "gradient, e.g. in exercise, fever, pregnancy, AF).<br/>"
  "3) Chronically elevated LA pressure → LA dilatation → atrial fibrillation (loss of atrial kick further "
  "reduces LV filling by ~20% and predisposes to stasis/thrombus in the LA appendage).<br/>"
  "4) Elevated LA pressure transmits back to pulmonary veins/capillaries → pulmonary venous congestion → "
  "exertional dyspnoea, and if capillary pressure exceeds oncotic pressure → pulmonary oedema; long-standing "
  "congestion → reactive pulmonary arterial hypertension → right heart strain/failure.<br/>"
  "5) LV is often UNDERFILLED and normal/small in isolated MS (protected from the pressure/volume overload "
  "seen in AS/AR) — 'MS protects the LV but destroys the lungs and RV'.")

SCI("Poiseuille/orifice flow principle: for a fixed stenotic orifice, gradient ∝ flow². This is why MS "
    "patients decompensate dramatically with tachycardia (AF, fever, pregnancy, exercise) — a modest rise "
    "in flow rate causes a disproportionate rise in LA pressure and pulmonary oedema risk.")

sub3("Risk Factors")
MNEMO("MS risk — 'RHEUM'", "<b>R</b>heumatic fever history (esp. childhood strep throat, poor healthcare "
      "access) · <b>H</b>ousehold crowding/low socioeconomic status (↑ streptococcal transmission) · "
      "<b>E</b>thnicity/region (South Asia, older HK Chinese cohort) · <b>U</b>ntreated strep pharyngitis · "
      "<b>M</b>ultiple past episodes of rheumatic fever (recurrence worsens valve damage)")

sub3("Symptoms")
MNEMO("MS symptoms — 'DAPHNE'", "<b>D</b>yspnoea (earliest &amp; most common, exertional → orthopnoea/PND) · "
      "<b>A</b>trial fibrillation-related palpitations · <b>P</b>ulmonary oedema (acute decompensation) · "
      "<b>H</b>aemoptysis (rupture of bronchial varices from pulmonary venous hypertension, or pink frothy "
      "sputum in pulmonary oedema) · <b>N</b>eurological — embolic stroke from LA appendage thrombus (esp. "
      "if AF) · <b>E</b>xertional fatigue / hoarseness (Ortner syndrome — dilated LA compressing left "
      "recurrent laryngeal nerve)")

sub3("Signs")
p("<b>Face:</b> malar flush ('mitral facies' — cyanotic cheeks from chronically low cardiac output and "
  "peripheral vasoconstriction).<br/>"
  "<b>Pulse:</b> may be irregularly irregular (AF is common).<br/>"
  "<b>Palpation:</b> tapping, non-displaced apex beat (palpable S1) — NOT heaving (LV is not "
  "hypertrophied); left parasternal heave if pulmonary hypertension/RV strain develops.<br/>"
  "<b>Auscultation:</b> loud S1 (valve still mobile, snaps shut abruptly) — becomes soft if valve heavily "
  "calcified; <b>opening snap</b> (early diastole, mobile valve) followed by a low-pitched <b>mid-diastolic "
  "rumbling murmur</b> best heard at the apex with the bell, patient in left lateral position, in "
  "expiration, with presystolic accentuation if in sinus rhythm.")
MNEMO("Severity clue on auscultation", "The SHORTER the S2-to-opening-snap interval, and the LONGER the "
      "diastolic murmur, the MORE SEVERE the stenosis (higher LA pressure snaps the valve open earlier).")

sub3("Investigations")
p("<b>Bedside:</b> pulse rhythm (AF?), auscultation as above, ECG — P mitrale (bifid P wave, LA "
  "enlargement) in sinus rhythm, or AF; look for RVH pattern if pulmonary hypertension.<br/>"
  "<b>Labs:</b> BNP, INR if on warfarin for AF/mechanical valve, TFTs before amiodarone if used for AF.<br/>"
  "<b>Imaging: TTE</b> — gold standard: valve area (planimetry/pressure half-time), mean gradient, LA size, "
  "pulmonary artery pressure, valve morphology/mobility (Wilkins score predicts suitability for balloon "
  "valvotomy). <b>CXR</b>: LA enlargement (double right heart border, splaying of carina), pulmonary "
  "venous congestion/Kerley B lines, straightening of left heart border. <b>TOE</b>: better assessment of "
  "LA appendage thrombus before valvotomy/cardioversion. Cardiac catheterisation reserved for discordant "
  "clinical-echo findings or pre-op coronary assessment.")

INV("CXR in a young woman with progressive dyspnoea shows a double density behind the right heart border "
    "and prominent left atrial appendage (straightened left heart border) with upper lobe venous diversion. "
    "Interpretation: classic radiographic triad of left atrial enlargement and pulmonary venous "
    "hypertension seen in mitral stenosis.")

sub3("Management")
p("<b>Medical:</b> rate control for AF (beta-blockers or digoxin — digoxin has a specific role here as it "
  "does not worsen forward flow the way excessive vasodilation can); anticoagulation (warfarin, NOT DOACs — "
  "DOACs are contraindicated in moderate-severe MS with AF and in mechanical valves) for AF or LA "
  "appendage thrombus; diuretics for congestion; secondary rheumatic fever prophylaxis (see RHD section).")
MNEMO("MS intervention ladder — 'BOTV'", "<b>B</b>alloon mitral valvotomy (percutaneous, valve of choice if "
      "anatomy favourable — Wilkins score ≤8, no LA thrombus, no more than mild MR) → "
      "<b>O</b>pen surgical commissurotomy (if balloon unsuitable but valve repairable) → "
      "<b>T</b>otal valve replacement (calcified/rigid valve, significant MR, LA thrombus, unfavourable "
      "anatomy) → <b>V</b>alve chosen: bioprosthetic (elderly/anticoagulation-unsuitable) vs mechanical "
      "(younger, already needs anticoagulation e.g. for AF)")
HA("HA cardiology centres perform percutaneous balloon mitral valvotomy as first-line for suitable "
   "rheumatic MS (young patient, pliable non-calcified valve, no LA thrombus on TOE, minimal MR) — this "
   "avoids open-heart surgery and is especially relevant given HK's ageing rheumatic-heart-disease cohort "
   "from earlier-generation immigrants. Surgical valve replacement is reserved for calcified/rigid valves "
   "or failed valvotomy, done in cardiothoracic centres (e.g. Queen Mary Hospital, Grantham).")

sub3("Complications")
MNEMO("MS complications — 'PHAT LAG'", "<b>P</b>ulmonary hypertension · <b>H</b>aemoptysis · "
      "<b>A</b>trial fibrillation · <b>T</b>hromboembolism/stroke · <b>L</b>A enlargement/thrombus · "
      "<b>A</b>rrhythmia · <b>G</b>iant LA / right heart failure")

sub3("Prognosis")
p("Very slow progression over decades from initial rheumatic fever to symptomatic MS (often 20–40 year "
  "latency). Once symptomatic (NYHA II+), 10-year survival without intervention is poor (~0–15% for "
  "severe symptomatic disease); successful valvotomy/replacement restores good long-term survival.")

hr()

# =====================================================================================
# 4. MITRAL REGURGITATION
# =====================================================================================
section_header("Mitral Regurgitation (MR)", "4")

sub3("Definition")
p("Incompetence of the mitral valve allowing retrograde flow from the LV into the LA during systole.")

sub3("Classification")
data_table(
    ["Type", "Mechanism", "Examples"],
    [["Primary (organic/degenerative)", "Intrinsic leaflet/chordal/apparatus pathology", "Myxomatous "
      "degeneration/prolapse (MVP — commonest cause in developed world incl. HK younger adults), rheumatic, "
      "infective endocarditis, chordal rupture, congenital cleft"],
     ["Secondary (functional/ischaemic)", "Normal leaflets, but LV dilatation/papillary muscle "
      "displacement causes leaflet tethering and annular dilatation → failure of leaflet coaptation",
      "Post-MI papillary muscle dysfunction/rupture, dilated cardiomyopathy, chronic LV remodelling"]],
    col_w=[4.5*cm, 6*cm, 6.7*cm]
)
data_table(
    ["Onset", "Features"],
    [["Acute", "Papillary muscle rupture (post-MI, typically postero-medial papillary muscle, occurs "
      "2–7 days post-MI), chordal rupture, endocarditis leaflet perforation — sudden severe regurgitation "
      "onto an unprepared, normal-sized non-compliant LA/LV → flash pulmonary oedema/cardiogenic shock"],
     ["Chronic", "Gradual regurgitant volume allows LA and LV to dilate and compensate — may be "
      "asymptomatic for years before decompensation"]],
    col_w=[3*cm, 14.2*cm]
)

sub3("Aetiology / Causes")
MNEMO("MR — 'MITRAL FAILS'", "<b>M</b>yxomatous degeneration/prolapse (Barlow's disease) · "
      "<b>I</b>nfective endocarditis · <b>T</b>rauma (chordal rupture) · <b>R</b>heumatic heart disease "
      "(usually mixed MS+MR) · <b>A</b>nnular calcification (elderly) · <b>L</b>V dilatation "
      "(cardiomyopathy — functional MR) · <b>F</b>ailed papillary muscle (post-MI rupture/dysfunction) · "
      "<b>A</b>utoimmune (SLE — Libman-Sacks endocarditis) · <b>I</b>schaemic tethering · "
      "<b>L</b>eaflet cleft (congenital) · <b>S</b>yndromic connective tissue disease (Marfan, "
      "Ehlers-Danlos → prolapse)")

sub3("Pathophysiology (acute vs chronic — step-by-step)")
p("<b>Chronic compensated MR:</b> 1) Part of LV stroke volume regurgitates into the low-pressure LA during "
  "systole instead of forward into the aorta. 2) LV compensates with eccentric hypertrophy and dilatation "
  "to maintain adequate FORWARD (effective) stroke volume — total stroke volume increases even as forward "
  "output stays normal. 3) LA dilates over time to accommodate the extra volume at relatively low "
  "pressure → often asymptomatic for years, may present incidentally or with AF from LA stretch.<br/>"
  "<b>Chronic decompensated MR:</b> 4) Eventually LV contractile reserve is exhausted → LV dilates further, "
  "EF falls, forward output drops → symptoms of heart failure emerge, often insidiously (EF may look "
  "'preserved' at 50-55% but is actually already reduced for MR, because regurgitant fraction inflates "
  "apparent EF — a key exam trap).<br/>"
  "<b>Acute MR:</b> 1) Sudden regurgitant volume hits a normal-sized, non-compliant LA and LV with no time "
  "to dilate. 2) LA pressure rises acutely and transmits directly to pulmonary capillaries → flash "
  "pulmonary oedema. 3) Forward stroke volume falls acutely → hypotension/cardiogenic shock. This is a "
  "surgical emergency, particularly post-MI papillary muscle rupture.")

TRAP("HKMLE trap: in chronic severe MR, a 'normal' EF of 55–60% is actually ALREADY REDUCED because the "
     "LV is ejecting a large fraction backward into the low-resistance LA (falsely inflates EF). Surgery is "
     "recommended once EF falls to ≤60% in severe MR (NOT the usual <50% threshold used for AS/AR) — "
     "candidates often miss this lower threshold and answer '<50%' from AS/AR reflex.")

sub3("Risk Factors")
MNEMO("MR risk — 'PROLAPSE'", "<b>P</b>rior rheumatic fever · <b>R</b>uptured chordae/papillary muscle "
      "(post-MI) · <b>O</b>lder age (annular calcification) · <b>L</b>V dilated cardiomyopathy · "
      "<b>A</b>ge-related myxomatous change · <b>P</b>rior endocarditis · <b>S</b>LE/connective tissue "
      "disease · <b>E</b>hlers-Danlos/Marfan (prolapse)")

sub3("Symptoms")
p("Chronic: often asymptomatic for years; then exertional dyspnoea, fatigue, palpitations (AF), symptoms "
  "of right heart failure late (pulmonary hypertension). Acute: sudden severe dyspnoea/pulmonary oedema, "
  "hypotension, shock — especially days after an MI (suspect papillary muscle rupture with a new murmur "
  "and haemodynamic collapse).")

sub3("Signs")
p("<b>Palpation:</b> displaced, hyperdynamic (volume-loaded) apex beat; systolic thrill at apex if severe.<br/>"
  "<b>Auscultation:</b> soft S1 (incomplete leaflet coaptation), <b>pansystolic ('holosystolic') blowing "
  "murmur at the apex radiating to the axilla</b>; S3 may be present (rapid LV filling in early diastole "
  "from the large regurgitant volume returning); wide splitting of S2 if severe (early aortic valve "
  "closure due to shortened LV ejection). Mid-systolic click before a late systolic murmur suggests MVP "
  "specifically. In acute severe MR the murmur may paradoxically be SOFT or absent (rapid equalisation of "
  "LV-LA pressures) — do not be reassured by a quiet murmur in a shocked post-MI patient.")

sub3("Investigations")
p("<b>Bedside:</b> auscultation, ECG (LA enlargement/P mitrale, AF, or acute ST changes if post-MI "
  "papillary rupture).<br/>"
  "<b>Labs:</b> troponin/CK if ischaemic MR suspected, BNP, blood cultures if endocarditis suspected.<br/>"
  "<b>Imaging: TTE/TOE</b> — mechanism (prolapse/flail leaflet/functional), regurgitant volume/fraction, "
  "vena contracta, LV/LA size and EF (key for timing surgery), pulmonary artery pressure. TOE is superior "
  "for pre-operative planning (repairability assessment) and for suspected endocarditis vegetations. "
  "Coronary angiography if ischaemic MR suspected or pre-operatively in older patients.")

sub3("Management")
p("<b>Acute severe MR (e.g. papillary muscle rupture):</b> stabilise with afterload reduction "
  "(IV nitroprusside/vasodilators to reduce regurgitant fraction), intra-aortic balloon pump if "
  "cardiogenic shock (reduces afterload, augments coronary perfusion), urgent/emergency surgical "
  "referral — this does not wait for standard 'chronic MR criteria'.<br/>"
  "<b>Chronic MR — medical:</b> ACE-inhibitors/ARBs and beta-blockers for functional/secondary MR "
  "(part of standard heart failure therapy — GDMT); rate control/anticoagulation if AF develops. "
  "Medical therapy does NOT reverse primary/organic MR — surgery is definitive.")
data_table(
    ["Surgical indication (Class I, primary severe MR)"],
    [["Symptomatic severe primary MR"],
     ["Asymptomatic severe primary MR with LVEF ≤60% and/or LV end-systolic diameter ≥40mm"],
     ["Asymptomatic severe MR with new-onset AF or pulmonary hypertension (PASP >50mmHg)"],
     ["Mitral valve repair strongly preferred over replacement whenever anatomically feasible (better survival, preserved LV geometry, no anticoagulation needed)"]],
    col_w=[17.2*cm]
)
p("Secondary/functional MR: primarily treat underlying LV disease first (GDMT, CRT if indicated); "
  "transcatheter edge-to-edge repair (MitraClip) is an option for select severe symptomatic secondary MR "
  "despite optimal medical therapy in patients unsuitable for surgery (COAPT trial showed benefit; "
  "MITRA-FR was neutral — patient selection matters).")

sub3("Complications")
MNEMO("MR complications — 'FLAP'", "<b>F</b>ailure (LV, progressive) · <b>L</b>A enlargement/AF · "
      "<b>A</b>rrhythmia · <b>P</b>ulmonary hypertension/oedema")

sub3("Prognosis")
p("Chronic mild-moderate MR: good prognosis, slow progression. Severe chronic primary MR: once "
  "symptomatic or LV dysfunction develops, prognosis worsens rapidly without repair — early repair "
  "(before LV dysfunction) gives near-normal life expectancy. Acute severe MR (e.g. papillary rupture) has "
  "very high mortality without emergency surgery.")

hr()

# =====================================================================================
# 5. RHEUMATIC HEART DISEASE
# =====================================================================================
section_header("Rheumatic Fever &amp; Rheumatic Heart Disease (RHD)", "5")

sub3("Definition")
p("Acute rheumatic fever (ARF) is a delayed, non-suppurative autoimmune inflammatory response occurring "
  "2–4 weeks after Group A Streptococcus (GAS) pharyngitis (NOT skin infection), due to molecular mimicry "
  "between streptococcal M-protein and cardiac/joint/CNS tissue antigens. Rheumatic heart disease is the "
  "chronic valvular damage (predominantly mitral, then aortic) resulting from recurrent/severe ARF.")

sub3("Classification — Revised Jones Criteria (2015 AHA update, risk-stratified)")
p("Diagnosis of INITIAL ARF requires evidence of preceding GAS infection PLUS 2 major, or 1 major + 2 "
  "minor criteria. For RECURRENT ARF, 2 major OR 1 major+2 minor OR 3 minor may suffice. Criteria differ "
  "by population risk (low-risk vs moderate/high-risk, e.g. most of Asia including HK's historical burden "
  "is considered higher-risk, lowering diagnostic thresholds).")
data_table(
    ["Major criteria — 'JONES'", "Minor criteria"],
    [["<b>J</b>oints — migratory polyarthritis (large joints)\n"
      "<b>O</b> (heart) — carditis (pancarditis: endo/myo/pericarditis; new murmur, esp. MR)\n"
      "<b>N</b>odules — subcutaneous nodules (extensor surfaces, painless)\n"
      "<b>E</b>rythema marginatum — pink serpiginous rash, trunk/limbs, spares face\n"
      "<b>S</b>ydenham chorea ('St Vitus dance' — involuntary movements, can appear months later alone)",
      "Fever\nArthralgia (if arthritis not counted as major)\nRaised ESR/CRP\nProlonged PR interval on ECG\n"
      "(High-risk population thresholds are lower, e.g. monoarthralgia counts, fever ≥38°C vs ≥38.5°C "
      "in low-risk)"]],
    col_w=[9*cm, 8.2*cm]
)
MNEMO("Jones Criteria — 'JONES'", "<b>J</b>oints (polyarthritis) · <b>O</b> = carditis (heart, shaped "
      "like the letter O) · <b>N</b>odules · <b>E</b>rythema marginatum · <b>S</b>ydenham chorea. "
      "Evidence of preceding GAS infection is MANDATORY (throat culture/rapid antigen, or rising/elevated "
      "ASOT / anti-DNase B titres) — without it, the diagnosis of ARF cannot be made except in pure chorea "
      "or indolent carditis presenting late.")

sub3("Aetiology")
p("Group A beta-haemolytic Streptococcus (Streptococcus pyogenes) pharyngitis triggers an autoimmune cross-"
  "reactive response (molecular mimicry: streptococcal M-protein epitopes resemble cardiac myosin/valve "
  "glycoproteins) — this is a Type II hypersensitivity reaction. Skin GAS infections do NOT cause rheumatic "
  "fever (but can cause post-streptococcal glomerulonephritis — a key discriminator on exams).")

sub3("Pathophysiology (step-by-step)")
p("1) GAS pharyngitis (often subclinical/mild, may go unnoticed) → immune response generates antibodies "
  "against M-protein.<br/>"
  "2) Antibodies cross-react with cardiac tissue (valve endothelium, myosin), joint tissue, and CNS basal "
  "ganglia (molecular mimicry) → 2–4 week latency before symptoms.<br/>"
  "3) Acute carditis: valvulitis (esp. mitral valve — verrucous vegetations along the line of leaflet "
  "closure), can also cause myocarditis and pericarditis. Chordal inflammation can lead to acute severe MR.<br/>"
  "4) Recurrent episodes cause progressive fibrosis, leaflet thickening, commissural fusion, and chordal "
  "shortening → chronic RHD, classically mitral stenosis (most common late lesion) ± MR, and aortic valve "
  "involvement in more severe/recurrent disease.<br/>"
  "5) Each subsequent GAS infection risks reactivating rheumatic carditis and worsening valve damage — "
  "hence the critical importance of secondary antibiotic prophylaxis.")

sub3("Risk Factors")
MNEMO("RHD risk — 'CROWD'", "<b>C</b>rowded living conditions · <b>R</b>ecurrent GAS pharyngitis, untreated "
      "· <b>O</b>verseas/developing-region origin (South Asia, Sub-Saharan Africa, Pacific Islands) · "
      "<b>W</b>eak access to healthcare/antibiotics · <b>D</b>eprivation (low socioeconomic status), "
      "age 5–15 years peak")

sub3("Symptoms")
p("Sore throat 2–4 weeks prior (may be forgotten/mild), fever, migratory joint pain, chest "
  "discomfort/palpitations (carditis), involuntary jerky movements (chorea, can be isolated and delayed), "
  "skin rash.")

sub3("Signs")
p("New or changed heart murmur (classically MR in acute carditis), pericardial rub, tachycardia "
  "disproportionate to fever, migratory arthritis with warm/red/swollen large joints, erythema marginatum, "
  "subcutaneous nodules, choreiform movements + emotional lability.")

sub3("Investigations")
p("<b>Bedside:</b> full joint exam, cardiac auscultation, ECG (prolonged PR interval, may show "
  "myopericarditis changes).<br/>"
  "<b>Labs:</b> throat swab culture, rapid antigen test, ASOT (anti-streptolysin O) and anti-DNase B "
  "titres (rising titre or elevated single titre supports recent GAS infection — anti-DNase B remains "
  "elevated longer, useful if chorea presents late), ESR/CRP (minor criteria, also for monitoring).<br/>"
  "<b>Imaging:</b> Echocardiography — even with a normal exam, echo may detect subclinical carditis (WHF "
  "criteria for echocardiographic diagnosis of RHD); essential in all suspected/confirmed cases and for "
  "long-term valve surveillance. CXR if heart failure suspected.")

sub3("Management")
p("<b>Acute rheumatic fever:</b> Bed rest during active carditis/arthritis. <b>Anti-streptococcal "
  "treatment</b>: single dose IM benzathine penicillin G (or oral penicillin V 10 days / amoxicillin) to "
  "eradicate GAS, regardless of throat culture positivity at diagnosis. <b>Anti-inflammatory</b>: "
  "high-dose aspirin or NSAIDs for arthritis/fever; corticosteroids for moderate-severe carditis/heart "
  "failure. Haloperidol/carbamazepine/valproate for chorea if severe/disabling. Manage heart failure "
  "supportively if carditis severe (diuretics, ACE-inhibitors).")
sub3("Secondary Prophylaxis (the HKMLE-critical part)")
data_table(
    ["Regimen", "Detail"],
    [["First-line", "Benzathine penicillin G 1.2 million units IM every 4 weeks (every 3 weeks in "
      "high-risk populations/recurrence) — IM route strongly preferred over oral due to much better "
      "compliance and efficacy"],
     ["Oral alternative", "Penicillin V 250mg PO twice daily (lower efficacy than IM due to adherence)"],
     ["Penicillin allergy", "Erythromycin or azithromycin"],
     ["Duration — no carditis", "5 years after last episode OR until age 21 (whichever is longer)"],
     ["Duration — carditis, resolved/mild residual disease", "10 years after last episode OR until age 21 (whichever is longer)"],
     ["Duration — severe valve disease / post-valve surgery", "Lifelong prophylaxis"]],
    col_w=[5.5*cm, 11.7*cm]
)
MNEMO("Duration rule — 'No-Ten-Life'", "<b>No</b> carditis = 5 yrs/until 21 · Carditis resolved = "
      "<b>Ten</b> yrs/until 21 · Severe RHD = <b>Life</b>long")

EPI("Hong Kong is generally considered a LOW-INCIDENCE region for acute rheumatic fever today "
    "(improved living standards, antibiotic access), BUT chronic RHD remains clinically relevant in HK "
    "due to (1) an ageing population who acquired RHD decades ago before modern antibiotic availability, "
    "presenting now with severe MS/MR requiring valvotomy or replacement, and (2) new immigrants/domestic "
    "workers from higher-incidence regions (South/Southeast Asia). HKMLE examiners commonly frame RHD "
    "questions around an elderly patient with a long-forgotten childhood 'rheumatic fever' history "
    "presenting with new AF or dyspnoea from previously undiagnosed severe MS.")

sub3("Complications")
MNEMO("RHD complications — 'MASH'", "<b>M</b>itral stenosis/regurgitation (chronic) · "
      "<b>A</b>trial fibrillation/embolic stroke · <b>S</b>ubacute infective endocarditis (damaged valve "
      "is a nidus) · <b>H</b>eart failure")

sub3("Prognosis")
p("Single episode of ARF without carditis: good prognosis, no long-term cardiac sequelae if compliant "
  "with prophylaxis. Carditis at first presentation is the strongest predictor of chronic RHD. Each "
  "recurrence significantly worsens valve damage — the single most important prognostic intervention is "
  "adherence to secondary penicillin prophylaxis.")

REDFLAG("New murmur + fever + recent sore throat in a child/young adult = think ARF until proven "
        "otherwise. Isolated chorea can present MONTHS after the strep infection with a completely normal "
        "ASOT by that time — do not exclude rheumatic fever purely on a normal current ASOT if chorea is "
        "the presentation.")

hr()

# =====================================================================================
# 6. INFECTIVE ENDOCARDITIS
# =====================================================================================
section_header("Infective Endocarditis (IE)", "6")

sub3("Definition")
p("Infection of the endocardial surface of the heart, most commonly affecting heart valves (native or "
  "prosthetic), caused by microbial colonisation of a thrombus/fibrin deposit (vegetation) that forms at "
  "sites of endothelial damage or turbulent flow.")

sub3("Classification")
data_table(
    ["Axis", "Categories"],
    [["By valve", "Native valve endocarditis (NVE) vs Prosthetic valve endocarditis (PVE — early <1 yr "
      "post-op = usually healthcare-associated organisms; late >1yr = resembles NVE organism profile)"],
     ["By course", "Acute (fulminant, days, destructive — classically S. aureus) vs Subacute (indolent, "
      "weeks-months, classically viridans streptococci on already-damaged/rheumatic valves)"],
     ["By setting", "Community-acquired vs Healthcare-associated (IV lines, haemodialysis, recent "
      "procedures) vs IV drug use-associated (classically right-sided, tricuspid valve, S. aureus)"]],
    col_w=[3.5*cm, 13.7*cm]
)
sub3("Diagnostic Classification — Modified Duke Criteria (2023 update)")
p("Definite IE = 2 major, OR 1 major + 3 minor, OR 5 minor criteria. Possible IE = 1 major + 1 minor, OR "
  "3 minor criteria.")
data_table(
    ["Major criteria", "Minor criteria"],
    [["<b>1. Blood culture positive</b> for typical IE organism (viridans strep, S. bovis, HACEK, "
      "S. aureus, community-acquired enterococci) in 2 separate cultures; or persistently positive "
      "cultures; or single positive culture for Coxiella burnetii/phase I IgG titre >1:800\n\n"
      "<b>2. Evidence of endocardial involvement:</b> echocardiogram showing vegetation, abscess, new "
      "partial dehiscence of prosthetic valve, OR new valvular regurgitation (worsening/changing "
      "pre-existing murmur alone is insufficient) — 2023 update also accepts cardiac CT findings and "
      "abnormal activity on PET/CT around a prosthetic valve",
      "1. Predisposing condition (predisposing heart lesion or IV drug use)\n"
      "2. Fever ≥38°C\n"
      "3. Vascular phenomena (major arterial emboli, septic pulmonary infarcts, mycotic aneurysm, "
      "intracranial haemorrhage, conjunctival haemorrhage, Janeway lesions)\n"
      "4. Immunologic phenomena (glomerulonephritis, Osler nodes, Roth spots, rheumatoid factor)\n"
      "5. Microbiological evidence not meeting major criteria (single positive culture of an atypical "
      "organism, or serological evidence)"]],
    col_w=[9*cm, 8.2*cm]
)
MNEMO("Duke criteria — 'BE FIVE'", "<b>B</b>lood culture positive · <b>E</b>ndocardial "
      "involvement (echo) = 2 MAJOR. <b>F</b>ever · <b>I</b>mmunologic phenomena · <b>V</b>ascular "
      "phenomena · <b>E</b>xisting predisposition · atypical organism = 5 MINOR")

sub3("Aetiology / Causes (organisms)")
MNEMO("IE organisms by clinical scenario — 'SAVE HACEK'", "<b>S</b>. aureus — acute, native or IVDU, "
      "most common cause overall now in developed healthcare settings · "
      "<b>A</b>ureus again for prosthetic valve <2 months post-op (often Staph epidermidis/coagulase-neg) "
      "· <b>V</b>iridans streptococci — subacute, on previously damaged/rheumatic valve, classically "
      "after dental procedures · <b>E</b>nterococci — after GU/GI procedures, elderly, healthcare-"
      "associated · <b>H</b>ACEK organisms (Haemophilus, Aggregatibacter, Cardiobacterium, Eikenella, "
      "Kingella) — fastidious gram-negatives, culture-negative IE, slow-growing · "
      "<b>C</b>oxiella burnetii/Bartonella/Chlamydia — culture-negative IE (Q fever, cat/homeless "
      "exposure) · <b>E</b>-Coli/Strep bovis (Streptococcus gallolyticus) bacteraemia → screen for "
      "COLON CANCER · <b>K</b>lebsiella and other Enterobacteriaceae — less common but relevant locally "
      "(see below)")

EPI("Streptococcus bovis (S. gallolyticus) bacteraemia/endocarditis has a well-documented association "
    "with colorectal neoplasia — any patient with S. bovis endocarditis should be referred for "
    "colonoscopy. Separately, Klebsiella pneumoniae is a disproportionately important pathogen in Hong "
    "Kong/East Asia generally in the context of pyogenic liver abscess and can occasionally cause "
    "endocarditis or metastatic seeding (endophthalmitis) — a distinctly higher local prevalence pattern "
    "than in Western textbooks, reflecting a hypermucoviscous K1/K2 Klebsiella serotype common in this "
    "region.")

sub3("Pathophysiology (step-by-step)")
p("1) Endothelial damage (turbulent flow across a damaged/abnormal valve, prosthetic material, or direct "
  "endothelial injury from an indwelling catheter/IVDU needle) exposes subendothelial collagen and tissue "
  "factor.<br/>"
  "2) Platelets and fibrin deposit at the site → sterile 'non-bacterial thrombotic endocarditis' (NBTE) "
  "vegetation.<br/>"
  "3) Transient bacteraemia (dental work, GI/GU procedures, skin infection, IVDU, indwelling lines) seeds "
  "organisms that adhere to this fibrin-platelet matrix via surface adhesins (e.g. FimH, fibronectin-"
  "binding proteins).<br/>"
  "4) Bacteria proliferate within the vegetation, protected from host immune clearance and antibiotics by "
  "the fibrin coat and biofilm formation — hence prolonged high-dose bactericidal antibiotic courses are "
  "required (bacteriostatic agents generally inadequate).<br/>"
  "5) Local destructive effects: valve leaflet perforation/erosion → new regurgitation; extension into "
  "the annulus → abscess, fistula, conduction system involvement (heart block).<br/>"
  "6) Systemic effects: septic emboli (vegetation fragments) → stro
Reading File
Running Command

wc -l /tmp/workspace/hkmle-1d/build_note.py; tail -5 /tmp/workspace/hkmle-1d/build_note.py

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