attachment
attachment

Suggest me a differential diagnosis and line of management in detail for md medicine doctor

analyse_media
Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Finding Sources
I now have comprehensive information. Let me compile the full detailed response.

ECG Analysis & Clinical Management

Patient Details

  • Name: Ramesh Aher | Age: 54 years | Sex: Male
  • Date: 2026-07-11 | Speed: 25 mm/s | Filter: 0.5-35 Hz

ECG Interpretation

ParameterFinding
Heart Rate~51-54 bpm
RhythmRegular
P WaveNormal morphology, upright in II, III, aVF; inverted in aVR
PR Interval177 ms (normal)
QRS Duration93 ms (normal)
QRS Axis90° (vertical axis)
QTc399 ms (normal)
ST SegmentsMild ST flattening/depression in lateral (V5-V6) and inferior leads (II, III, aVF)
T WavesFlattened in lateral leads
Machine InterpretationSinus Bradycardia + Ischemic ST changes + Abnormal ECG
Summary: Sinus Bradycardia (HR ~51 bpm) with ST-segment flattening/depression in lateral and inferior leads - ischemic pattern on a background of bradycardia in a 54-year-old male.

Differential Diagnosis

Priority 1 - Must Rule Out Immediately

1. NSTEMI (Non-ST-Segment Elevation Myocardial Infarction)
  • Most urgent diagnosis to exclude in this clinical context
  • ST depression + T-wave flattening in lateral-inferior leads is the classic ECG signature
  • Sinus bradycardia in this setting may indicate right coronary artery (RCA) involvement (the SA node is supplied by RCA in ~60% of individuals); inferior ischemia stimulates vagal tone causing bradycardia
  • Requires urgent troponin (hsTnI/hsTnT) measurement
  • Distinction from UA: requires rising troponin to confirm myocyte necrosis
2. Unstable Angina (UA)
  • Same ECG pattern as NSTEMI
  • Differentiated only by negative troponin
  • Still an ACS requiring hospital admission and urgent management
3. Inferior + Lateral STEMI (early / hyperacute phase)
  • Although no frank ST elevation is seen, an early evolving inferior STEMI can initially present with ST depression in anterior leads as a "reciprocal" pattern
  • Serial ECGs at 15-30 min intervals are mandatory

Priority 2 - Important Alternatives

4. Vasospastic / Prinzmetal Angina
  • Can cause transient ST depression or elevation with bradycardia
  • Typically occurs at rest, often nocturnal, in younger patients with fewer risk factors
  • Triggered by calcium channel blocker response
5. Myocarditis / Pericarditis
  • Diffuse ST changes, though usually saddle-shaped or concave in pericarditis
  • More common in younger patients with preceding viral illness
  • Troponin elevation helps distinguish from ischemia; echocardiogram is useful
6. Hypokalemia / Electrolyte Disturbance
  • Causes ST depression and T-wave flattening with U-waves
  • Bradycardia can accompany severe electrolyte abnormality
  • Check serum potassium, magnesium
7. Drug Effect / Beta Blocker or Calcium Channel Blocker Toxicity
  • Both classes cause sinus bradycardia + ST-T changes
  • Always take drug history (was the patient already on beta-blocker?)
8. Sick Sinus Syndrome (SSS)
  • Can cause sinus bradycardia; if coexisting coronary disease, gives dual picture
  • Typically in older patients; may require Holter monitoring
9. Hypothyroidism
  • Sinus bradycardia, low voltage, flattened/inverted T waves
  • Check TSH
10. Increased Vagal Tone / Athletic Heart / Vasovagal
  • Well-conditioned athletes may have resting HR of 40-60 bpm
  • Usually no ST changes - this is a diagnosis of exclusion
11. Pulmonary Embolism (PE)
  • Can produce sinus tachycardia (more common) but also bradycardia in massive PE
  • S1Q3T3 pattern classically, though ST depression can occur
  • Consider if risk factors present (immobility, DVT history)
12. Raised Intracranial Pressure (Cushing's Reflex)
  • Bradycardia + hypertension + irregular respiration
  • Unlikely here unless neurological symptoms are present

Investigations

Urgent (Immediate, within minutes-hours)

TestRationale
Serial ECGs (every 15-30 min)Detect dynamic ischemic changes, evolving STEMI
High-sensitivity Troponin I/T (0h, 1h, 3h)Rule in/out NSTEMI vs UA
IV access + continuous ECG monitoringArrhythmia surveillance
SpO2 / ABGHypoxia contributing to ischemia
Blood pressure (both arms)Rule out aortic dissection

Urgent Blood Work

  • CBC (anemia aggravating ischemia)
  • Serum electrolytes (K+, Mg++, Na+)
  • Renal function (creatinine, eGFR - guides anticoagulant dosing)
  • Blood glucose + HbA1c
  • Lipid profile
  • LFT, coagulation profile
  • Thyroid function (TSH)
  • CXR (pulmonary edema, cardiomegaly)

Semi-urgent (within 24-48 h if stable)

  • 2D Echocardiogram - wall motion abnormalities (regional = ischemia), LV function, pericardial effusion
  • Stress testing / CTCA - if low-intermediate probability ACS (GRACE score) and troponin negative

Line of Management

Immediate - MONA + Anti-platelet + Anticoagulation

Note: Do NOT give beta blockers initially because HR is already ~51 bpm (beta blockers are contraindicated if HR <50 bpm per guidelines - Harrison's, 2025).

1. Anti-ischemic Treatment

(Based on Harrison's Principles of Internal Medicine 22E, Chapter 285)
  • Bed rest with continuous ECG monitoring; oxygen only if SpO2 <90%
  • Nitroglycerin (NTG) 0.3-0.6 mg sublingual if chest pain is present; if symptoms persist after 3 doses 5 min apart → IV NTG 5-10 mcg/min, titrate up by 10 mcg/min every 3-5 min (max 200 mcg/min)
    • Avoid if hypotension, RV infarct suspected, or recent PDE-5 inhibitor use
  • Morphine 1-5 mg IV every 5-30 min if severe chest pain persisting despite nitrates (use with caution - may blunt P2Y12 inhibitor absorption)
  • Beta blockers: Hold until HR is confirmed >60 bpm and hemodynamic stability; then start oral metoprolol 25-50 mg BD targeted to HR 50-60 bpm
    • Avoid in: HR <50, PR >240 ms, 2nd/3rd degree AV block, acute HF, bronchospasm, cardiogenic shock

2. Antiplatelet Therapy (Dual - DAPT)

  • Aspirin 325 mg loading dose (chewed), then 75-100 mg/day maintenance
  • P2Y12 Inhibitor loading:
    • Ticagrelor 180 mg loading → 90 mg BD (preferred - faster onset, reversible), OR
    • Clopidogrel 300-600 mg loading → 75 mg/day (if ticagrelor unavailable or contraindicated)

3. Anticoagulation

  • Fondaparinux 2.5 mg SC OD (preferred - superior efficacy/safety balance in NSTE-ACS), OR
  • Low Molecular Weight Heparin (LMWH): Enoxaparin 1 mg/kg SC BD (adjust for renal function)
  • Unfractionated Heparin (UFH) IV if going for early PCI (<24h)

4. Statin Therapy

  • High-intensity statin: Rosuvastatin 40 mg OD or Atorvastatin 80 mg OD - start immediately regardless of baseline lipids

5. Managing the Sinus Bradycardia

  • If asymptomatic and hemodynamically stable (BP adequate, no syncope, no hypoperfusion): Observation only - no specific treatment needed
  • If symptomatic (syncope, hypotension, pre-syncope):
    • Atropine 0.5-1 mg IV every 3-5 min to maximum 3 mg
    • If refractory: Dopamine infusion (5-10 mcg/kg/min) or Epinephrine infusion
    • Transcutaneous pacing if drug-refractory with hemodynamic compromise
  • In context of possible inferior ischemia: avoid agents that worsen bradycardia; check for RV involvement (right-sided ECG leads V3R, V4R)
    • If RV infarct: IV fluids challenge (maintain preload), avoid nitrates, avoid diuretics
(Rosen's Emergency Medicine, Chapter 65; Harrison's 22E)

6. Risk Stratification with GRACE Score

  • Calculate GRACE 2.0 score using: age, HR, BP, creatinine, Killip class, ST deviation, elevated troponin, cardiac arrest at presentation
  • High GRACE score (>140): early invasive strategy (coronary angiography within 24 h) with PCI/CABG as appropriate
  • Intermediate score (109-140): invasive within 72 h
  • Low score (<109): conservative/ischemia-guided strategy

7. Monitoring

  • Continuous telemetry for 24-48 h
  • Watch for: VT/VF, complete heart block, cardiogenic shock, acute pulmonary edema
  • Repeat ECGs at 30 min, 6 h, 12 h
  • Repeat troponin at 0h, 1h (or 3h) - using 0/1h algorithm for hsTn

Summary Algorithm

54M | Sinus Bradycardia + Lateral-Inferior ST Depression
              |
    ┌---------+----------┐
    ↓                    ↓
Troponin POSITIVE    Troponin NEGATIVE
(NSTEMI)             (UA or Non-ACS)
    ↓                    ↓
DAPT + Anticoag +    Serial ECG + 
GRACE Score →        Repeat Troponin +
Early Invasive       Stress Test / CTCA
(Angio ≤24-72h)          |
                     If positive → ACS pathway
                     If negative → Non-cardiac cause
                     (electrolytes, thyroid, drug effect)

Key Drugs - Quick Reference

DrugDoseRoute
Aspirin325 mg load → 75 mg/dayOral
Ticagrelor180 mg load → 90 mg BDOral
Enoxaparin1 mg/kg BD (adjust for CrCl)SC
Rosuvastatin40 mg ODOral
NTG0.3-0.6 mg SL / 5-200 mcg/min IVSL/IV
Atropine (if bradycardia symptomatic)0.5-1 mg IV, repeat q3-5 min (max 3 mg)IV
Metoprolol (once HR >60 and stable)25-50 mg BDOral

Sources: Harrison's Principles of Internal Medicine 22E (2025) - Chapter 285 NSTE-ACS; Rosen's Emergency Medicine - Chapter 65 Sinus Bradycardia; Goldman-Cecil Medicine - ACS Chapter
Clinical Note: This ECG in a 54-year-old male must be treated as ACS (NSTEMI/UA) until proven otherwise. The combination of sinus bradycardia with lateral-inferior ST changes raises strong suspicion for RCA-territory ischemia affecting the SA node. Serial troponins and repeat ECGs every 15-30 minutes are the most time-critical initial actions. Beta blockers are relatively contraindicated at this heart rate - delay until HR stabilizes above 60 bpm.

Create a detailed management flowchart PDF for NSTEMI diagnosis and risk stratification

Reading File
Running Command

mkdir -p /home/daytona/workspace/nstemi-flowchart && ls /home/daytona/workspace/…

Writing File

~/nstemi-flowchart/generate_flowchart.py

#!/usr/bin/env python3
"""
NSTEMI Diagnosis & Management Flowchart PDF
Using reportlab for professional medical flowchart
"""

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm, cm
from reportlab.pdfgen import canvas
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.platypus import Paragraph
from reportlab.lib.enums import TA_CENTER, TA_LEFT
import textwrap

# ─── Color Palette ────────────────────────────────────────────────────────────
C_RED       = colors.HexColor("#C0392B")
C_ORANGE    = colors.HexColor("#E67E22")
C_GREEN     = colors.HexColor("#1A7A3F")
C_BLUE      = colors.HexColor("#1A5276")
C_LBLUE     = colors.HexColor("#2980B9")
C_PURPLE    = colors.HexColor("#6C3483")
C_TEAL      = colors.HexColor("#117A65")
C_YELLOW    = colors.HexColor("#D4AC0D")
C_GRAY      = colors.HexColor("#566573")
C_LGRAY     = colors.HexColor("#D5D8DC")
C_WHITE     = colors.white
C_BLACK     = colors.black
C_BG        = colors.HexColor("#F0F3F4")

# ─── Page Setup ───────────────────────────────────────────────────────────────
PAGE_W, PAGE_H = A4  # 595 x 842 pt
OUTPUT = "/home/daytona/workspace/nstemi-flowchart/NSTEMI_Management_Flowchart.pdf"


def draw_rounded_box(c, x, y, w, h, fill_color, stroke_color=None, radius=6,
                     text=None, text_color=C_WHITE, font_size=8, bold=False,
                     subtext=None, sub_font_size=6.5):
    """Draw a rounded rectangle with centered text."""
    if stroke_color is None:
        stroke_color = fill_color
    c.setFillColor(fill_color)
    c.setStrokeColor(stroke_color)
    c.setLineWidth(1)
    c.roundRect(x, y, w, h, radius, fill=1, stroke=1)

    if text:
        lines = text.split('\n')
        total_lines = len(lines)
        line_h = font_size * 1.3
        sub_h = sub_font_size * 1.3 if subtext else 0
        sub_lines = subtext.split('\n') if subtext else []
        sub_total = len(sub_lines)

        total_height = total_lines * line_h + (sub_total * sub_h if subtext else 0)
        start_y = y + h / 2 + total_height / 2 - line_h * 0.8

        c.setFillColor(text_color)
        font_name = "Helvetica-Bold" if bold else "Helvetica"
        c.setFont(font_name, font_size)
        for i, line in enumerate(lines):
            c.drawCentredString(x + w / 2, start_y - i * line_h, line)

        if subtext:
            c.setFont("Helvetica", sub_font_size)
            c.setFillColor(text_color)
            sub_start_y = start_y - total_lines * line_h + line_h * 0.3
            for j, sline in enumerate(sub_lines):
                c.drawCentredString(x + w / 2, sub_start_y - j * sub_h, sline)


def draw_diamond(c, cx, cy, half_w, half_h, fill_color, text, font_size=7.5,
                 text_color=C_WHITE):
    """Draw a diamond decision box."""
    path = c.beginPath()
    path.moveTo(cx, cy + half_h)
    path.lineTo(cx + half_w, cy)
    path.lineTo(cx, cy - half_h)
    path.lineTo(cx - half_w, cy)
    path.close()
    c.setFillColor(fill_color)
    c.setStrokeColor(fill_color)
    c.setLineWidth(1)
    c.drawPath(path, fill=1, stroke=1)

    lines = text.split('\n')
    line_h = font_size * 1.3
    start_y = cy + (len(lines) - 1) * line_h / 2
    c.setFillColor(text_color)
    c.setFont("Helvetica-Bold", font_size)
    for i, line in enumerate(lines):
        c.drawCentredString(cx, start_y - i * line_h, line)


def arrow(c, x1, y1, x2, y2, label=None, label_color=C_BLACK,
          color=C_GRAY, lw=1.2):
    """Draw an arrow from (x1,y1) to (x2,y2)."""
    c.setStrokeColor(color)
    c.setLineWidth(lw)
    c.line(x1, y1, x2, y2)
    # arrowhead
    import math
    angle = math.atan2(y2 - y1, x2 - x1)
    aw = 5
    ah = 3
    c.setFillColor(color)
    path = c.beginPath()
    path.moveTo(x2, y2)
    path.lineTo(x2 - aw * math.cos(angle) + ah * math.sin(angle),
                y2 - aw * math.sin(angle) - ah * math.cos(angle))
    path.lineTo(x2 - aw * math.cos(angle) - ah * math.sin(angle),
                y2 - aw * math.sin(angle) + ah * math.cos(angle))
    path.close()
    c.drawPath(path, fill=1, stroke=0)

    if label:
        mx = (x1 + x2) / 2
        my = (y1 + y2) / 2
        c.setFont("Helvetica-Bold", 6.5)
        c.setFillColor(label_color)
        c.drawCentredString(mx + 8, my, label)


def h_arrow(c, x1, y, x2, label=None, label_side="top", color=C_GRAY, lw=1.2):
    arrow(c, x1, y, x2, y, label=label, label_color=color, color=color, lw=lw)


def v_arrow(c, x, y1, y2, label=None, color=C_GRAY, lw=1.2):
    arrow(c, x, y1, x, y2, label=label, color=color, lw=lw)


def draw_page1(c):
    """Page 1: Initial Presentation → Diagnosis → Risk Stratification"""
    c.setPageSize(A4)

    # ── Background ────────────────────────────────────────────────────────────
    c.setFillColor(C_BG)
    c.rect(0, 0, PAGE_W, PAGE_H, fill=1, stroke=0)

    # ── Header ────────────────────────────────────────────────────────────────
    c.setFillColor(C_BLUE)
    c.rect(0, PAGE_H - 52, PAGE_W, 52, fill=1, stroke=0)
    c.setFillColor(C_WHITE)
    c.setFont("Helvetica-Bold", 15)
    c.drawCentredString(PAGE_W / 2, PAGE_H - 22, "NSTEMI: Diagnosis & Risk Stratification")
    c.setFont("Helvetica", 8)
    c.drawCentredString(PAGE_W / 2, PAGE_H - 38,
        "Based on ACC/AHA 2014 Guidelines & Harrison's Principles of Internal Medicine 22E (2025)")

    # ── Footer ────────────────────────────────────────────────────────────────
    c.setFillColor(C_BLUE)
    c.rect(0, 0, PAGE_W, 18, fill=1, stroke=0)
    c.setFillColor(C_WHITE)
    c.setFont("Helvetica", 6.5)
    c.drawCentredString(PAGE_W / 2, 5, "Page 1 of 2  |  For clinical use by qualified medical professionals only")

    # ─── Layout constants ─────────────────────────────────────────────────────
    BW = 155   # box width
    BH = 30    # box height standard
    CX = PAGE_W / 2  # center x

    # ─── BOX 1: Patient Presentation ──────────────────────────────────────────
    y1 = PAGE_H - 90
    draw_rounded_box(c, CX - BW/2, y1, BW, BH+4, C_BLUE,
        text="CHEST PAIN / ACS PRESENTATION\n(Suspected Acute Coronary Syndrome)",
        font_size=8, bold=True, radius=8)

    # ─── Presentation features box ────────────────────────────────────────────
    feat_y = y1 - 58
    feat_w = 390
    draw_rounded_box(c, CX - feat_w/2, feat_y, feat_w, 45, C_LBLUE,
        text="Chest pain ≥10 min at rest  |  Onset within 2 weeks  |  Crescendo pattern\nRadiation to arm/jaw  |  Diaphoresis, nausea, dyspnea  |  Age >40, DM, HTN, smoking history",
        font_size=7.5, bold=False)

    v_arrow(c, CX, y1, y1 - 10)
    v_arrow(c, CX, feat_y + 45, feat_y + 45 - 2)

    # ─── BOX 2: Immediate Actions ─────────────────────────────────────────────
    imm_y = feat_y - 65
    imm_w = 390
    draw_rounded_box(c, CX - imm_w/2, imm_y, imm_w, 52, C_TEAL,
        text="IMMEDIATE ACTIONS (0-10 minutes)\n"
             "IV Access  |  12-Lead ECG  |  Continuous ECG monitoring  |  SpO₂\n"
             "O₂ if SaO₂ <90%  |  Aspirin 325mg chewed  |  IV NTG SL if pain ongoing\n"
             "Blood: hsTnI/T (0h), CBC, BMP, Lipids, Coags, CXR",
        font_size=7.5, bold=False, subtext=None)

    v_arrow(c, CX, feat_y, imm_y + 52)

    # ─── Diamond: ECG Interpretation ──────────────────────────────────────────
    ecg_y = imm_y - 48
    draw_diamond(c, CX, ecg_y, 105, 30, C_PURPLE,
                 "ECG: ST-Elevation\npresent?", font_size=7.5)

    v_arrow(c, CX, imm_y, ecg_y + 30)

    # STEMI branch → right
    stemi_x = CX + 140
    stemi_y = ecg_y - 5
    draw_rounded_box(c, stemi_x, stemi_y - 14, 115, 28, C_RED,
        text="→ STEMI Protocol\nActivate Cath Lab\n(PCI within 90 min)", font_size=7, bold=True)
    h_arrow(c, CX + 105, ecg_y, stemi_x, label="YES", color=C_RED, lw=1.5)

    # NO branch → down
    v_arrow(c, CX, ecg_y - 30, ecg_y - 55, label="NO", color=C_GREEN, lw=1.5)

    # ─── NSTE-ACS box ─────────────────────────────────────────────────────────
    nste_y = ecg_y - 88
    nste_w = 390
    draw_rounded_box(c, CX - nste_w/2, nste_y, nste_w, 32, C_ORANGE,
        text="NSTE-ACS: No ST elevation, but ST depression / T-wave changes / Normal ECG\n"
             "→ Differentiate: NSTEMI vs Unstable Angina (UA) vs Non-cardiac",
        font_size=7.5, bold=True)

    v_arrow(c, CX, nste_y, nste_y - 8)

    # ─── Troponin box ─────────────────────────────────────────────────────────
    trop_y = nste_y - 55
    trop_w = 380
    draw_rounded_box(c, CX - trop_w/2, trop_y, trop_w, 44, C_BLUE,
        text="HIGH-SENSITIVITY TROPONIN (hsTn) STRATEGY\n"
             "0h / 1h Algorithm (preferred) or 0h / 3h Algorithm\n"
             "Measure: hsTnI or hsTnT at presentation AND 1h (or 3h)",
        font_size=7.5)

    v_arrow(c, CX, nste_y - 8, trop_y + 44)

    # ─── Diamond: Troponin result ──────────────────────────────────────────────
    trop_d_y = trop_y - 45
    draw_diamond(c, CX, trop_d_y, 105, 30, C_ORANGE,
                 "hsTn ELEVATED\nor rising?", font_size=7.5)
    v_arrow(c, CX, trop_y, trop_d_y + 30)

    # NSTEMI → left
    nstemi_box_x = CX - 260
    nstemi_box_y = trop_d_y - 16
    draw_rounded_box(c, nstemi_box_x, nstemi_box_y - 12, 130, 28, C_RED,
        text="NSTEMI\n(Troponin +ve)\nAdmit to CCU/HDU", font_size=7, bold=True)
    arrow(c, CX - 105, trop_d_y, nstemi_box_x + 130, nstemi_box_y,
          label="YES", color=C_RED, lw=1.5)

    # UA → right
    ua_box_x = CX + 125
    ua_box_y = trop_d_y - 16
    draw_rounded_box(c, ua_box_x, ua_box_y - 12, 115, 28, C_YELLOW,
        text="UA or Non-cardiac\n(Troponin -ve)\nRepeat at 3h / 6h", font_size=7, bold=True,
        text_color=C_BLACK)
    h_arrow(c, CX + 105, trop_d_y, ua_box_x, label="NO", color=C_YELLOW, lw=1.5)

    v_arrow(c, CX, trop_d_y - 30, trop_d_y - 52)

    # ─── GRACE Risk Stratification ────────────────────────────────────────────
    grace_y = trop_d_y - 95
    grace_w = 410

    # Title bar
    draw_rounded_box(c, CX - grace_w/2, grace_y + 5, grace_w, 22, C_BLUE,
        text="GRACE 2.0 RISK SCORE — Stratification for NSTE-ACS",
        font_size=8.5, bold=True)

    # Three risk columns
    col_w = grace_w / 3 - 4
    col_h = 52

    # Low risk
    draw_rounded_box(c, CX - grace_w/2, grace_y - col_h - 2, col_w, col_h, C_GREEN,
        text="LOW RISK\nGRACE <109\n\nTroponin -ve\nNo ECG changes\nEarly discharge\nStress test / CTCA",
        font_size=7)

    # Intermediate
    draw_rounded_box(c, CX - grace_w/2 + col_w + 4, grace_y - col_h - 2, col_w, col_h,
                     C_ORANGE,
        text="INTERMEDIATE\nGRACE 109-140\n\nTroponin borderline\nMinor ST changes\nAngio within 72h\nInpatient monitoring",
        font_size=7)

    # High risk
    draw_rounded_box(c, CX - grace_w/2 + 2*(col_w + 4), grace_y - col_h - 2, col_w, col_h,
                     C_RED,
        text="HIGH RISK\nGRACE >140\n\nTroponin +ve\nST depression ≥0.5mm\nEarly angio ≤24h\nICU admission",
        font_size=7)

    # ─── GRACE inputs note ────────────────────────────────────────────────────
    c.setFillColor(C_GRAY)
    c.setFont("Helvetica-Oblique", 6.5)
    c.drawCentredString(CX, grace_y - col_h - 60,
        "GRACE inputs: Age, HR, SBP, Creatinine, Killip Class, ST deviation, Cardiac arrest, Elevated troponin")

    # ─── Section divider ──────────────────────────────────────────────────────
    c.setStrokeColor(C_LGRAY)
    c.setLineWidth(0.5)
    c.line(30, grace_y - col_h - 68, PAGE_W - 30, grace_y - col_h - 68)

    c.setFont("Helvetica-Bold", 7)
    c.setFillColor(C_BLUE)
    c.drawCentredString(CX, grace_y - col_h - 78,
        "Continued on Page 2 → Medical Treatment & Invasive Strategy")

    c.showPage()


def draw_page2(c):
    """Page 2: Medical Treatment + Invasive Strategy + Disposition"""
    c.setPageSize(A4)

    # ── Background ────────────────────────────────────────────────────────────
    c.setFillColor(C_BG)
    c.rect(0, 0, PAGE_W, PAGE_H, fill=1, stroke=0)

    # ── Header ────────────────────────────────────────────────────────────────
    c.setFillColor(C_BLUE)
    c.rect(0, PAGE_H - 52, PAGE_W, 52, fill=1, stroke=0)
    c.setFillColor(C_WHITE)
    c.setFont("Helvetica-Bold", 15)
    c.drawCentredString(PAGE_W / 2, PAGE_H - 22,
        "NSTEMI: Medical Treatment & Invasive Strategy")
    c.setFont("Helvetica", 8)
    c.drawCentredString(PAGE_W / 2, PAGE_H - 38,
        "Based on ACC/AHA 2014 Guidelines & Harrison's Principles of Internal Medicine 22E (2025)")

    # ── Footer ────────────────────────────────────────────────────────────────
    c.setFillColor(C_BLUE)
    c.rect(0, 0, PAGE_W, 18, fill=1, stroke=0)
    c.setFillColor(C_WHITE)
    c.setFont("Helvetica", 6.5)
    c.drawCentredString(PAGE_W / 2, 5, "Page 2 of 2  |  For clinical use by qualified medical professionals only")

    CX = PAGE_W / 2
    y = PAGE_H - 70

    # ─── DAPT section header ──────────────────────────────────────────────────
    draw_rounded_box(c, 20, y, PAGE_W - 40, 22, C_BLUE,
        text="STEP 1: ANTIPLATELET THERAPY (DAPT) — Start Immediately",
        font_size=9, bold=True)
    y -= 56

    # Two columns: Aspirin | P2Y12
    col_w = (PAGE_W - 50) / 2
    draw_rounded_box(c, 20, y, col_w, 48, C_LBLUE,
        text="ASPIRIN\n• Loading: 325 mg (chewed)\n• Maintenance: 75-100 mg/day\n• Continue indefinitely",
        font_size=8)
    draw_rounded_box(c, 25 + col_w, y, col_w, 48, C_TEAL,
        text="P2Y12 INHIBITOR (choose one)\n• Ticagrelor 180mg load → 90mg BD (preferred)\n• Clopidogrel 300-600mg load → 75mg/day\n• Prasugrel (post-PCI, no prior TIA/stroke)",
        font_size=8)

    y -= 32

    # ─── Anticoagulation ──────────────────────────────────────────────────────
    draw_rounded_box(c, 20, y, PAGE_W - 40, 22, C_BLUE,
        text="STEP 2: ANTICOAGULATION", font_size=9, bold=True)
    y -= 56
    col_w3 = (PAGE_W - 60) / 3
    draw_rounded_box(c, 20, y, col_w3, 48, C_PURPLE,
        text="FONDAPARINUX\n2.5 mg SC OD\n(Preferred — reduces\nbleeding vs LMWH)\nAvoid if CrCl <20",
        font_size=7.5)
    draw_rounded_box(c, 25 + col_w3, y, col_w3, 48, C_LBLUE,
        text="ENOXAPARIN (LMWH)\n1 mg/kg SC BD\nReduce to 1mg/kg OD\nif CrCl 15-30\nHold 12h pre-PCI",
        font_size=7.5)
    draw_rounded_box(c, 30 + 2 * col_w3, y, col_w3, 48, C_ORANGE,
        text="UFH (Unfractionated)\nBolus 60 U/kg IV\n(max 4000U)\nIf early PCI planned\nor CrCl <15",
        font_size=7.5)

    y -= 32

    # ─── Anti-ischemic section ────────────────────────────────────────────────
    draw_rounded_box(c, 20, y, PAGE_W - 40, 22, C_BLUE,
        text="STEP 3: ANTI-ISCHEMIC TREATMENT", font_size=9, bold=True)
    y -= 56

    col_w2 = (PAGE_W - 60) / 4
    draw_rounded_box(c, 20, y, col_w2, 48, C_TEAL,
        text="NITRATES\nSL NTG 0.3-0.6mg\nIV NTG 5-200mcg/min\nAvoid: SBP<90,\nRV infarct, PDE5i",
        font_size=7)
    draw_rounded_box(c, 25 + col_w2, y, col_w2, 48, C_LBLUE,
        text="BETA-BLOCKER\nMetoprolol 25-50mg BD\nTarget HR 50-60/min\nAvoid: HR<50, PR>240,\nKillip III/IV",
        font_size=7)
    draw_rounded_box(c, 30 + 2*col_w2, y, col_w2, 48, C_PURPLE,
        text="CCB (if BB CI)\nDiltiazem / Verapamil\nAvoid short-acting\nnifedipine\nAvoid in LV dysfunction",
        font_size=7)
    draw_rounded_box(c, 35 + 3*col_w2, y, col_w2, 48, C_GRAY,
        text="MORPHINE\n1-5mg IV q5-30min\nOnly if severe pain\ndespite nitrates\nMay blunt P2Y12",
        font_size=7)

    y -= 32

    # ─── Other meds ───────────────────────────────────────────────────────────
    draw_rounded_box(c, 20, y, PAGE_W - 40, 22, C_BLUE,
        text="STEP 4: ADDITIONAL MEDICAL THERAPY", font_size=9, bold=True)
    y -= 40
    col_w2b = (PAGE_W - 50) / 2
    draw_rounded_box(c, 20, y, col_w2b, 32, C_TEAL,
        text="HIGH-INTENSITY STATIN (start immediately)\nAtorvastatin 80mg OD  OR  Rosuvastatin 40mg OD",
        font_size=7.5)
    draw_rounded_box(c, 25 + col_w2b, y, col_w2b, 32, C_LBLUE,
        text="ACE INHIBITOR / ARB (if LVEF <40%, HTN, DM, CKD)\nRamipril 2.5-10mg OD  |  Start within 24h if stable",
        font_size=7.5)

    y -= 36

    # ─── Invasive strategy decision ───────────────────────────────────────────
    draw_rounded_box(c, 20, y, PAGE_W - 40, 22, C_BLUE,
        text="STEP 5: INVASIVE vs. CONSERVATIVE STRATEGY", font_size=9, bold=True)
    y -= 8

    # Diamond
    draw_diamond(c, CX, y - 28, 100, 26, C_RED,
                 "High-risk features?", font_size=8)
    v_arrow(c, CX, y, y - 2)

    # Yes branch - early invasive
    inv_y = y - 88
    ei_w = 168
    draw_rounded_box(c, CX - ei_w - 5, inv_y, ei_w, 55, C_RED,
        text="EARLY INVASIVE STRATEGY\n(Angiography ≤24h)\n\nGRACE >140 / Refractory ischemia\nHemodynamic instability\nElevated troponin  |  ST depression\nSustained VT / VF",
        font_size=7, bold=True)
    arrow(c, CX - 100, y - 28, CX - ei_w + ei_w, inv_y + 55,
          label="YES", color=C_RED, lw=1.5)

    # No branch - conservative
    draw_rounded_box(c, CX + 5, inv_y, ei_w, 55, C_GREEN,
        text="CONSERVATIVE STRATEGY\n(Angiography if needed)\n\nGRACE <109 / Low-risk\nTroponin -ve / No ECG changes\nStress test or CTCA first\nAngio only if ischemia confirmed",
        font_size=7, bold=True)
    h_arrow(c, CX + 100, y - 28, CX + 5, label="NO", color=C_GREEN, lw=1.5)

    y = inv_y - 30

    # ─── Post-PCI / Discharge box ─────────────────────────────────────────────
    draw_rounded_box(c, 20, y, PAGE_W - 40, 22, C_BLUE,
        text="STEP 6: DISCHARGE PLANNING & SECONDARY PREVENTION",
        font_size=9, bold=True)
    y -= 44
    draw_rounded_box(c, 20, y, PAGE_W - 40, 38, C_TEAL,
        text="DAPT for 12 months (aspirin + ticagrelor/clopidogrel)  |  Statin lifelong  |  ACEi/ARB  |  Beta-blocker\n"
             "Cardiac rehab  |  Smoking cessation  |  BP <130/80  |  LDL <55 mg/dL  |  HbA1c <7% in DM\n"
             "Repeat Echo at 6 weeks  |  Follow-up clinic 4-6 weeks post-discharge",
        font_size=7.5)

    # ─── Legend ───────────────────────────────────────────────────────────────
    legend_y = y - 20
    c.setFillColor(C_LGRAY)
    c.roundRect(20, legend_y - 12, PAGE_W - 40, 14, 4, fill=1, stroke=0)
    c.setFont("Helvetica-Bold", 6.5)
    c.setFillColor(C_BLUE)
    c.drawString(30, legend_y - 7,
        "Abbreviations: DAPT=Dual Antiplatelet Therapy | LMWH=Low Mol. Wt. Heparin | "
        "UFH=Unfractionated Heparin | CCB=Ca-Channel Blocker | PDE5i=Phosphodiesterase-5 Inhibitor | "
        "CI=Contraindicated | BB=Beta Blocker")

    c.showPage()


# ─── Main ─────────────────────────────────────────────────────────────────────
def main():
    c = canvas.Canvas(OUTPUT, pagesize=A4)
    c.setTitle("NSTEMI Diagnosis & Management Flowchart")
    c.setAuthor("Orris Medical AI")
    c.setSubject("NSTEMI Clinical Management Protocol")
    c.setCreator("reportlab")

    draw_page1(c)
    draw_page2(c)

    c.save()
    print(f"PDF saved to: {OUTPUT}")


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

cd /home/daytona/workspace/nstemi-flowchart && python3 generate_flowchart.py 2>&…

Running Command

ls -lh /home/daytona/workspace/nstemi-flowchart/NSTEMI_Management_Flowchart.pdf

Your NSTEMI flowchart PDF is ready:

NSTEMI Management Flowchart

PDF Document · PDF


What's Inside the PDF (2 Pages)

Page 1 - Diagnosis & Risk Stratification

  • Presentation recognition - chest pain features, ACS suspicion criteria
  • Immediate 0-10 minute actions - IV access, 12-lead ECG, SpO2, Aspirin, bloods
  • ECG decision diamond - ST elevation (STEMI pathway) vs no elevation (NSTE-ACS)
  • hsTroponin 0h/1h algorithm - distinguishes NSTEMI (troponin +ve) from UA (troponin -ve)
  • GRACE 2.0 risk stratification - three-column color coded:
    • Green: Low risk (GRACE <109) - stress test / CTCA
    • Orange: Intermediate (109-140) - angiography within 72h
    • Red: High risk (>140) - early angiography ≤24h, ICU

Page 2 - Medical Treatment & Invasive Strategy

  • Step 1: DAPT - Aspirin loading + P2Y12 inhibitor (Ticagrelor preferred, Clopidogrel, Prasugrel)
  • Step 2: Anticoagulation - Fondaparinux (preferred), Enoxaparin, UFH with dosing
  • Step 3: Anti-ischemic - Nitrates, Beta-blockers (with contraindications), CCB, Morphine
  • Step 4: Additional - High-intensity statin + ACEi/ARB criteria
  • Step 5: Invasive vs Conservative - decision diamond based on risk features
  • Step 6: Discharge & Secondary Prevention - DAPT 12 months, cardiac rehab, targets (LDL <55, BP <130/80)
  • Abbreviations legend at the bottom
Source: ACC/AHA 2014 Guidelines + Harrison's Principles of Internal Medicine 22E (2025), Chapter 285

Detail interpreting this ecg

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
I now have all the information needed. Here is the complete, detailed ECG interpretation:

Detailed ECG Interpretation

Patient: Ramesh Aher | Age: 54 years | Sex: Male Date/Time: 2026-07-11, 14:17:59 | Speed: 25 mm/s | Gain: 10 mm/mV | Filter: 0.5-35 Hz

Step 1 - Technical Adequacy

ParameterStatus
Paper speed25 mm/s (standard) → 1 small square = 40 ms, 1 large square = 200 ms
Amplitude calibration10 mm/mV (standard) → 1 mm = 0.1 mV
All 12 leads presentYes (I, II, III, aVR, aVL, aVF, V1-V6)
BaselineStable, no significant artifact

Step 2 - Heart Rate

Printed HR: 51-54 bpm
Calculation method:
  • 300 rule: 300 ÷ number of large squares between R-R intervals
  • R-R interval spans ~5.5-6 large squares → 300 ÷ 5.8 ≈ 52 bpm
  • Confirmation: Rate 51-54 bpm = Sinus Bradycardia (normal: 60-100 bpm)

Step 3 - Rhythm

Regular sinus rhythm with bradycardia.
Criteria met:
  • Every P wave is followed by a QRS complex (1:1 conduction)
  • Every QRS is preceded by a P wave
  • P waves are upright in leads I, II, aVF → sinus origin (not ectopic atrial)
  • P waves are inverted in aVR (expected in normal sinus rhythm)
  • P-P intervals are regular (no variation >10%)
  • R-R intervals are regular
Conclusion: Normal sinus rhythm, rate ~51 bpm - Sinus Bradycardia

Step 4 - P Wave Analysis

FeatureFindingNormal
MorphologyNormal, smooth, roundedSmooth, monophasic
AxisUpright I, II, aVF; inverted aVR0° to +75°
DurationNormal (<120 ms)<120 ms
AmplitudeNormal (<2.5 mm)<2.5 mm in II
NotchingNoneNone
  • No P mitrale (bifid P in II → left atrial enlargement)
  • No P pulmonale (peaked P >2.5 mm in II → right atrial enlargement)

Step 5 - PR Interval

Printed: 177 ms
  • Normal range: 120-200 ms
  • 177 ms = within normal limits (no first-degree AV block)
  • No PR shortening (rules out WPW/pre-excitation)
  • PR is consistent beat-to-beat (no Wenckebach/Mobitz II pattern)
Conclusion: Normal PR interval. No AV conduction abnormality.

Step 6 - QRS Complex

FeatureFindingNormal
Duration93 ms (printed)<120 ms
MorphologyNormal narrow complexNo BBB
R wave progressionNormal V1→V6Positive deflection increasing V1-V5
Pathological Q wavesNone definitively identified<40 ms wide, <25% R amplitude
Fragmented QRSNot evidentAbsent in normals
  • Duration 93 ms = narrow QRS → no bundle branch block
  • No left bundle branch block (no broad notched R in I/V5-V6)
  • No right bundle branch block (no RSR' pattern in V1)
  • R wave progression: normal transition across precordial leads
Conclusion: Normal narrow QRS complex. No bundle branch block. No definite pathological Q waves.

Step 7 - QRS Axis

Printed: QRS axis = +90°
Using the hexaxial reference system:
  • Lead I: Near isoelectric / mildly positive
  • Lead aVF: Strongly positive
  • This places the axis at approximately +80° to +90° - borderline vertical
Axis RangeClassification
-30° to +90°Normal
-30° to -90°Left axis deviation (LAD)
+90° to +180°Right axis deviation (RAD)
+180° to -90°Extreme axis deviation
  • +90° = upper limit of normal / borderline vertical axis
  • Not pathological RAD (which starts >+90°)
  • No cause for left axis deviation
Conclusion: Normal to vertical QRS axis at +90°. Not pathological.

Step 8 - ST Segment Analysis (Most Critical Finding)

Machine interpretation: "Ischemic ST-segment changes"

ST Morphology Types

The ST segment is measured at the J-point (junction of QRS end and ST start), then assessed 60-80 ms after the J-point.
Lead GroupST FindingSignificance
Lateral (V5, V6)Mild flattening / depressionLateral wall ischemia
Inferior (II, III, aVF)Mild flatteningInferior wall ischemia
Anterior (V1-V4)Normal / no significant changeNo anterior involvement
aVLMildly flatHigh lateral

Significance of ST Depression Pattern

ST depression in lateral (V5-V6) and inferior (II, III, aVF) leads simultaneously suggests:
  1. Subendocardial ischemia - the most common cause; typically indicates demand ischemia or non-obstructive coronary disease
  2. Posterior STEMI - posterior wall infarction manifests as ST depression in V1-V4 (reciprocal); less likely here as anterior leads appear normal
  3. Multi-vessel disease - diffuse ST depression affecting multiple territories
The pattern here (lateral + inferior simultaneously) is most consistent with:
  • Non-ST-elevation ischemia (NSTEMI/UA territory) affecting the lateral and inferior walls
  • Possible Left Circumflex (LCx) artery territory (lateral) and/or Right Coronary Artery (RCA) territory (inferior)

Step 9 - T Wave Analysis

LeadT WaveSignificance
II, III, aVF (Inferior)FlattenedNon-specific ischemic change
V5, V6 (Lateral)FlattenedLateral ischemia
V1-V3 (Anterior)Normal/uprightNo anterior ischemia
aVRUpright (normal - should be inverted or flat)Possible diffuse subendocardial change
T-wave flattening (less than 1/8 the height of R wave) in lateral-inferior leads is a non-specific but clinically significant finding in context of this patient's presentation.
  • No hyperacute T waves (tall, broad, peaked T - seen in very early STEMI)
  • No deep symmetric T-wave inversions (seen in NSTEMI, Wellens syndrome)
  • No biphasic T waves

Step 10 - QT / QTc Interval

Printed: QT = 410 ms | QTc = 399 ms | QTcF = 352 ms
Bazett's formula: QTc = QT / √(RR interval in seconds)
  • RR interval at HR 52 bpm ≈ 1.15 sec → √1.15 ≈ 1.07
  • QTc = 410 / 1.07 ≈ 383 ms (consistent with printed 399 ms)
GenderNormal QTcBorderlineProlonged
Male<440 ms440-460 ms>460 ms
  • QTc 399 ms = Normal (well within limits)
  • No risk of Torsades de Pointes from QTc alone
  • QT does not appear short (rules out short QT syndrome)

Step 11 - Voltage / Hypertrophy

RV5 = 1.454 mV (14.54 mm) | SV1 = 0.476 mV | RV5+SV1 = 0.978 mV (9.78 mm)

Left Ventricular Hypertrophy (LVH) Criteria:

CriterionThresholdThis ECG
Sokolow-Lyon: SV1 + RV5 or RV6>35 mm9.78 mm → Absent
Cornell: RaVL + SV3>28mm (M)Not calculated
R in aVL>11 mmNot evident
  • No LVH by Sokolow-Lyon criterion
  • RV5+SV1 = 9.78 mm is well below the 35 mm threshold

Right Ventricular Hypertrophy (RVH):

  • No R > S in V1, no right axis deviation >+110°, no P pulmonale
  • No RVH

Step 12 - Complete Summary

ECG SYSTEMATIC REPORT — Ramesh Aher, 54M
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

RATE        : 51-54 bpm  ← ABNORMAL (Sinus Bradycardia)
RHYTHM      : Regular, Sinus origin
P WAVES     : Normal morphology, axis, duration ✓
PR INTERVAL : 177 ms — Normal ✓
QRS         : 93 ms — Narrow, no BBB ✓
QRS AXIS    : +90° — Normal to vertical ✓
ST SEGMENTS : Mild flattening/depression lateral (V5-V6)
              + inferior (II, III, aVF) ← ABNORMAL
T WAVES     : Flattened lateral-inferior leads ← ABNORMAL
QTc         : 399 ms — Normal ✓
VOLTAGE     : No LVH / RVH ✓
P. Q WAVES  : None identified ✓

Pathophysiological Correlation

The co-occurrence of sinus bradycardia + inferior-lateral ST-T changes in a 54-year-old male is highly significant:
Mechanism of Bradycardia in Inferior Ischemia: The SA node receives its blood supply from the SA nodal artery, which arises from the RCA in ~60% of people and from the LCx in ~40%. When the RCA or LCx is ischemic, the SA node may be underperfused, causing bradycardia. Additionally, inferior wall ischemia activates the Bezold-Jarisch reflex - a vagally mediated reflex causing bradycardia, hypotension, and vasodilation. This is why sinus bradycardia is the most common arrhythmia seen in inferior/posterior MI (Goodman & Gilman's Pharmacological Basis of Therapeutics; Harrison's 22E).
Clinical Interpretation: This ECG is NOT normal and MUST be treated as ACS until proven otherwise. The machine-generated report correctly flags "Ischemic ST-segment changes" and "Abnormal ECG." In a 54-year-old male with cardiac risk factors:
  1. Sinus bradycardia at 51 bpm - possibly vagally mediated from inferior ischemia
  2. Lateral ST-T flattening (V5-V6) - lateral wall ischemia (LCx territory)
  3. Inferior ST flattening (II, III, aVF) - inferior wall ischemia (RCA territory)
  4. Normal QRS - no completed infarction yet / no bundle branch block
Final ECG Diagnosis:
Sinus Bradycardia (51 bpm) with Ischemic ST-T Changes in Lateral and Inferior Leads - Abnormal ECG. Clinical correlation with high-sensitivity troponin and serial ECGs is mandatory. Treat as NSTEMI/UA until biomarkers return.

Sources: Harrison's Principles of Internal Medicine 22E (2025) - Chapter on SA Nodal Dysfunction; Fuster & Hurst's The Heart 15E - Electrical Complications of MI; Goodman & Gilman's Pharmacological Basis of Therapeutics; Rosen's Emergency Medicine
This is a shared conversation. Sign in to Orris to start your own chat.