heart attack in detail point wise manner
"myocardial infarction"[MeSH Terms] AND management


| Artery | % of MIs | Territory Affected |
|---|---|---|
| Left Anterior Descending (LAD) | 40-50% | Anterior LV wall, anterior 2/3 of septum, cardiac apex |
| Right Coronary Artery (RCA) | 30-40% | Right ventricle, posterior LV wall, posterior 1/3 of septum |
| Left Circumflex (LCX) | 15-20% | Lateral left ventricle |
| Time Frame | Gross Features | Light Microscopy | Electron Microscopy |
|---|---|---|---|
| 0-30 min | None (reversible) | None | Relaxation of myofibrils; glycogen loss; mitochondrial swelling |
| 30 min - 4 hrs | None | Variable fiber waviness at border | Sarcolemmal disruption; mitochondrial amorphous densities |
| 4-12 hrs | Occasional dark mottling | Coagulation necrosis onset; edema; hemorrhage | - |
| 12-24 hrs | Dark mottling | Coagulation necrosis; pyknotic nuclei; hypereosinophilic myocytes; early neutrophilic infiltrate | - |
| 1-3 days | Yellow-tan infarct center | Coagulation necrosis with loss of nuclei and striations; increased neutrophils | - |
| 3-7 days | Hyperemic border; central softening | Neutrophil disintegration; macrophage phagocytosis begins at border | - |
| 7-10 days | Maximally yellow-tan and soft | Well-developed macrophage phagocytosis; early granulation tissue at margins | - |
| 10-14 days | Red-gray depressed borders | Well-established granulation tissue | - |
| 2-8 weeks | Gray-white scar forming | Collagen deposition | - |
| >2 months | Dense white scar | Dense collagen scar; fully healed | - |
| Test | Finding |
|---|---|
| ECG | ST elevation (STEMI) or ST/T changes (NSTEMI); Q waves (old MI) |
| Troponin I/T | Rise and fall pattern; most definitive |
| Echo | Wall motion abnormality; LV function |
| Coronary angiography | Confirms occlusion; guides revascularization |
| CXR | May show pulmonary edema or widened mediastinum |
Generate a PDF quick reference guide on MI diagnosis and treatment
ls /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or not found"
~/mi-quickref/generate_mi_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm, cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether
)
from reportlab.platypus.flowables import HRFlowable
import os
OUTPUT_PATH = "/home/daytona/workspace/mi-quickref/MI_Quick_Reference_Guide.pdf"
os.makedirs(os.path.dirname(OUTPUT_PATH), exist_ok=True)
# ── Colour palette ──────────────────────────────────────────────────────────
RED = colors.HexColor("#C0392B")
DARK_RED = colors.HexColor("#922B21")
ORANGE = colors.HexColor("#E67E22")
TEAL = colors.HexColor("#1A6B7C")
TEAL_LIGHT= colors.HexColor("#D6EEF3")
GREY_BG = colors.HexColor("#F4F6F7")
GREY_LINE = colors.HexColor("#BDC3C7")
WHITE = colors.white
BLACK = colors.HexColor("#1C2833")
GREEN = colors.HexColor("#1E8449")
GREEN_LIGHT= colors.HexColor("#D5F5E3")
AMBER = colors.HexColor("#D68910")
AMBER_LIGHT= colors.HexColor("#FEF9E7")
BLUE_HEAD = colors.HexColor("#1B4F72")
# ── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()
def S(name, **kw):
return ParagraphStyle(name, **kw)
Title = S("Title",
fontName="Helvetica-Bold", fontSize=22, textColor=WHITE,
leading=28, alignment=TA_CENTER, spaceAfter=2)
Subtitle = S("Subtitle",
fontName="Helvetica", fontSize=11, textColor=colors.HexColor("#FDFEFE"),
leading=16, alignment=TA_CENTER)
SectionHead = S("SectionHead",
fontName="Helvetica-Bold", fontSize=11, textColor=WHITE,
leading=15, spaceBefore=6, spaceAfter=3,
leftIndent=6, rightIndent=6)
SubHead = S("SubHead",
fontName="Helvetica-Bold", fontSize=9.5, textColor=BLUE_HEAD,
leading=13, spaceBefore=5, spaceAfter=2)
Body = S("Body",
fontName="Helvetica", fontSize=8.5, textColor=BLACK,
leading=12, spaceAfter=2)
BulletStyle = S("Bullet",
fontName="Helvetica", fontSize=8.5, textColor=BLACK,
leading=12, leftIndent=12, firstLineIndent=-8, spaceAfter=1)
BoldBody = S("BoldBody",
fontName="Helvetica-Bold", fontSize=8.5, textColor=BLACK,
leading=12, spaceAfter=2)
SmallGrey = S("SmallGrey",
fontName="Helvetica-Oblique", fontSize=7.5, textColor=colors.HexColor("#7F8C8D"),
leading=10, alignment=TA_CENTER)
CellHead = S("CellHead",
fontName="Helvetica-Bold", fontSize=8.5, textColor=WHITE,
leading=11, alignment=TA_CENTER)
CellBody = S("CellBody",
fontName="Helvetica", fontSize=8, textColor=BLACK, leading=11)
CellBold = S("CellBold",
fontName="Helvetica-Bold", fontSize=8, textColor=BLACK, leading=11)
AlertRed = S("AlertRed",
fontName="Helvetica-Bold", fontSize=9, textColor=RED,
leading=13, spaceAfter=2)
def bullet(text, bold_prefix=None):
if bold_prefix:
return Paragraph(f'<bullet>\u2022</bullet> <b>{bold_prefix}</b> {text}', BulletStyle)
return Paragraph(f'<bullet>\u2022</bullet> {text}', BulletStyle)
def section_bar(text, bg=TEAL):
data = [[Paragraph(text, SectionHead)]]
t = Table(data, colWidths=[175*mm])
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), bg),
('TOPPADDING', (0,0), (-1,-1), 5),
('BOTTOMPADDING', (0,0), (-1,-1), 5),
('LEFTPADDING', (0,0), (-1,-1), 8),
('RIGHTPADDING', (0,0), (-1,-1), 8),
('ROUNDEDCORNERS', [4, 4, 4, 4]),
]))
return t
def hr(color=GREY_LINE, thickness=0.5):
return HRFlowable(width="100%", thickness=thickness, color=color, spaceAfter=3, spaceBefore=3)
# ── Document setup ────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
OUTPUT_PATH,
pagesize=A4,
leftMargin=15*mm, rightMargin=15*mm,
topMargin=12*mm, bottomMargin=12*mm,
title="MI Quick Reference Guide",
author="Orris Medical Reference",
subject="Myocardial Infarction – Diagnosis & Treatment"
)
story = []
W = 175*mm # usable width
# ═══════════════════════════════════════════════════════════════════════════
# HEADER BANNER
# ═══════════════════════════════════════════════════════════════════════════
header_data = [[
Paragraph("MYOCARDIAL INFARCTION", Title),
Paragraph("Quick Reference Guide | Diagnosis & Treatment", Subtitle),
Paragraph("Based on Braunwald's, Robbins, Harrison's, Guyton & Hall", SmallGrey)
]]
header = Table([[
Paragraph("MYOCARDIAL INFARCTION", Title)
], [
Paragraph("Quick Reference Guide \u2022 Diagnosis & Treatment", Subtitle)
], [
Paragraph("Braunwald's \u2022 Robbins \u2022 Harrison's \u2022 Guyton & Hall \u2022 Sabiston", SmallGrey)
]], colWidths=[W])
header.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), RED),
('TOPPADDING', (0,0), (-1,-1), 10),
('BOTTOMPADDING', (0,0), (-1,-1), 10),
('LEFTPADDING', (0,0), (-1,-1), 10),
('RIGHTPADDING', (0,0), (-1,-1), 10),
('ROUNDEDCORNERS', [6, 6, 6, 6]),
]))
story.append(header)
story.append(Spacer(1, 6))
# ═══════════════════════════════════════════════════════════════════════════
# ROW 1: DEFINITION + CLASSIFICATION (2 columns)
# ═══════════════════════════════════════════════════════════════════════════
def box(content_rows, bg=GREY_BG, width=None):
t = Table([[c] for c in content_rows], colWidths=[width or 84*mm])
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), bg),
('TOPPADDING', (0,0), (-1,-1), 5),
('BOTTOMPADDING', (0,0), (-1,-1), 5),
('LEFTPADDING', (0,0), (-1,-1), 7),
('RIGHTPADDING', (0,0), (-1,-1), 7),
('BOX', (0,0), (-1,-1), 0.5, GREY_LINE),
('ROUNDEDCORNERS', [4, 4, 4, 4]),
]))
return t
col_w = 84*mm
gap = 7*mm
# ── DEFINITION box ──────────────────────────────────────────────────────────
def_content = [
section_bar("DEFINITION", DARK_RED),
Spacer(1, 4),
Paragraph("Necrosis of heart muscle from sustained ischemia.", Body),
Paragraph('<b>2018 Universal Definition:</b> "Acute myocardial injury detected by abnormal cardiac biomarkers in the setting of evidence of acute myocardial ischemia."', Body),
hr(),
Paragraph("<b>Key time thresholds:</b>", BoldBody),
bullet("<b>Seconds:</b> Aerobic metabolism ceases; ATP falls"),
bullet("<b>Minutes:</b> Loss of contractility (reversible)"),
bullet("<b>20-40 min:</b> Irreversible cell death begins"),
bullet("<b>3-6 hrs:</b> Full transmural infarct if untreated"),
]
# ── CLASSIFICATION box ───────────────────────────────────────────────────────
class_content = [
section_bar("CLASSIFICATION", TEAL),
Spacer(1, 4),
Paragraph("<b>Type 1 MI</b> – Plaque rupture / thrombosis", BoldBody),
bullet("STEMI: ST elevation + biomarker rise"),
bullet("NSTEMI: No ST elevation; biomarker rise"),
bullet("UA: Ischemia symptoms; no biomarker rise"),
hr(),
Paragraph("<b>Type 2 MI</b> – Supply/demand mismatch", BoldBody),
bullet("Tachycardia, anemia, hypotension, hypertension"),
bullet("Treatment: reduce cardiac O<sub rise='2'>2</sub> demand"),
hr(),
Paragraph("<b>ACS Spectrum:</b> STEMI > NSTEMI > Unstable Angina", Body),
]
row1 = Table([[
Table([[c] for c in def_content], colWidths=[col_w]),
Spacer(gap, 1),
Table([[c] for c in class_content], colWidths=[col_w]),
]], colWidths=[col_w, gap, col_w])
row1.setStyle(TableStyle([
('VALIGN', (0,0), (-1,-1), 'TOP'),
('LEFTPADDING', (0,0), (-1,-1), 0),
('RIGHTPADDING', (0,0), (-1,-1), 0),
('TOPPADDING', (0,0), (-1,-1), 0),
('BOTTOMPADDING', (0,0), (-1,-1), 0),
]))
story.append(row1)
story.append(Spacer(1, 5))
# ═══════════════════════════════════════════════════════════════════════════
# SYMPTOMS & ECG (2 columns)
# ═══════════════════════════════════════════════════════════════════════════
symp_content = [
section_bar("SYMPTOMS", colors.HexColor("#6C3483")),
Spacer(1, 4),
Paragraph("<b>Classic (Type 1):</b>", BoldBody),
bullet("Central crushing/squeezing chest pain >30 min"),
bullet("Radiation: left arm, jaw, neck, back, epigastrium"),
bullet("Diaphoresis, nausea/vomiting, dyspnea"),
bullet("Anxiety, sense of impending doom"),
hr(),
Paragraph("<b>Atypical</b> (women, elderly, diabetics):", BoldBody),
bullet("Epigastric pain or indigestion"),
bullet("Fatigue, jaw or arm pain alone"),
bullet("Silent MI (no pain) – ECG/biomarkers only"),
Paragraph('<font color="#C0392B"><b>! Women presenting without chest pain receive delayed care – higher in-hospital mortality (14.6% vs 10.3%)</b></font>', Body),
]
ecg_content = [
section_bar("ECG CHANGES", colors.HexColor("#1A5276")),
Spacer(1, 4),
Paragraph("<b>Hyperacute (minutes):</b>", BoldBody),
bullet("Tall, peaked T waves"),
Paragraph("<b>Acute STEMI:</b>", BoldBody),
bullet("ST elevation in leads over infarct"),
bullet("Reciprocal ST depression in opposite leads"),
Paragraph("<b>Hours to days:</b>", BoldBody),
bullet("T-wave inversion"),
bullet("Q waves appear (electrically silent necrosis)"),
Paragraph("<b>NSTEMI / UA:</b>", BoldBody),
bullet("ST depression or T-wave changes"),
bullet("No ST elevation; no Q waves"),
hr(),
Paragraph("<b>Lead localisation:</b>", BoldBody),
bullet("V1-V4: Anterior (LAD)"),
bullet("II, III, aVF: Inferior (RCA)"),
bullet("I, aVL, V5-V6: Lateral (LCX)"),
]
row2 = Table([[
Table([[c] for c in symp_content], colWidths=[col_w]),
Spacer(gap, 1),
Table([[c] for c in ecg_content], colWidths=[col_w]),
]], colWidths=[col_w, gap, col_w])
row2.setStyle(TableStyle([
('VALIGN', (0,0), (-1,-1), 'TOP'),
('LEFTPADDING', (0,0), (-1,-1), 0),
('RIGHTPADDING', (0,0), (-1,-1), 0),
('TOPPADDING', (0,0), (-1,-1), 0),
('BOTTOMPADDING', (0,0), (-1,-1), 0),
]))
story.append(row2)
story.append(Spacer(1, 5))
# ═══════════════════════════════════════════════════════════════════════════
# BIOMARKERS TABLE (full width)
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_bar("CARDIAC BIOMARKERS", colors.HexColor("#784212")))
story.append(Spacer(1, 3))
bio_head = [
Paragraph("Marker", CellHead),
Paragraph("Rises", CellHead),
Paragraph("Peaks", CellHead),
Paragraph("Returns to Normal", CellHead),
Paragraph("Notes", CellHead),
]
bio_data = [
["Troponin I / T", "3-6 hrs", "12-24 hrs", "7-14 days (TnT up to 2 wks)", "Most specific & sensitive. Gold standard."],
["CK-MB", "3-6 hrs", "18-24 hrs", "48-72 hrs", "Useful for reinfarction detection"],
["Myoglobin", "1-3 hrs", "6-9 hrs", "24 hrs", "Earliest; not cardiac-specific. Rule-out only."],
["LDH", "24-48 hrs", "3-6 days", "8-14 days", "Historical; largely replaced by troponins"],
]
bio_rows = [bio_head] + [[Paragraph(c, CellBody) for c in row] for row in bio_data]
bio_col = [28*mm, 18*mm, 18*mm, 45*mm, 66*mm]
bio_table = Table(bio_rows, colWidths=bio_col, repeatRows=1)
bio_table.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), colors.HexColor("#784212")),
('BACKGROUND', (0,1), (-1,1), GREY_BG),
('BACKGROUND', (0,2), (-1,2), WHITE),
('BACKGROUND', (0,3), (-1,3), GREY_BG),
('BACKGROUND', (0,4), (-1,4), WHITE),
('GRID', (0,0), (-1,-1), 0.4, GREY_LINE),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 5),
('RIGHTPADDING', (0,0), (-1,-1), 5),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
]))
story.append(bio_table)
story.append(Spacer(1, 5))
# ═══════════════════════════════════════════════════════════════════════════
# INFARCT LOCATION TABLE (full width)
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_bar("INFARCT LOCATION BY VESSEL", colors.HexColor("#1A6B7C")))
story.append(Spacer(1, 3))
loc_head = [
Paragraph("Artery", CellHead),
Paragraph("% of MIs", CellHead),
Paragraph("Territory Affected", CellHead),
Paragraph("ECG Leads", CellHead),
]
loc_data = [
["Left Anterior Descending (LAD)", "40-50%", "Anterior LV wall, anterior 2/3 septum, cardiac apex", "V1-V4"],
["Right Coronary Artery (RCA)", "30-40%", "Right ventricle, posterior LV wall, posterior 1/3 septum", "II, III, aVF"],
["Left Circumflex (LCX)", "15-20%", "Lateral left ventricle", "I, aVL, V5-V6"],
]
loc_rows = [loc_head] + [[Paragraph(c, CellBody) for c in row] for row in loc_data]
loc_col = [50*mm, 22*mm, 73*mm, 30*mm]
loc_table = Table(loc_rows, colWidths=loc_col, repeatRows=1)
loc_table.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), TEAL),
('BACKGROUND', (0,1), (-1,1), TEAL_LIGHT),
('BACKGROUND', (0,2), (-1,2), WHITE),
('BACKGROUND', (0,3), (-1,3), TEAL_LIGHT),
('GRID', (0,0), (-1,-1), 0.4, GREY_LINE),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 5),
('RIGHTPADDING', (0,0), (-1,-1), 5),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
]))
story.append(loc_table)
story.append(Spacer(1, 5))
# ═══════════════════════════════════════════════════════════════════════════
# TREATMENT (2 columns: Acute Meds | Reperfusion)
# ═══════════════════════════════════════════════════════════════════════════
med_content = [
section_bar("ACUTE MEDICATIONS", RED),
Spacer(1, 4),
Paragraph("<b>Antiplatelet:</b>", BoldBody),
bullet("Aspirin 300 mg loading (immediate)"),
bullet("P2Y12 inhibitor: clopidogrel / ticagrelor / prasugrel"),
bullet("GP IIb/IIIa inhibitor (if PCI performed)"),
Paragraph("<b>Anticoagulation:</b>", BoldBody),
bullet("UFH, LMWH, fondaparinux, or bivalirudin"),
Paragraph("<b>Nitrates:</b>", BoldBody),
bullet("Sublingual or IV nitroglycerin"),
Paragraph('<font color="#C0392B"><b>! Avoid nitrates in RV infarction – reduces preload causing catastrophic hypotension</b></font>', Body),
Paragraph("<b>Beta-blockers:</b>", BoldBody),
bullet("Cardioprotective; reduce O2 demand + arrhythmia risk"),
Paragraph('<font color="#C0392B"><b>! Avoid if: hypotension, low EF, bradycardia, cardiogenic shock</b></font>', Body),
Paragraph("<b>Statins:</b>", BoldBody),
bullet("High-intensity (target LDL <70 mg/dL); start early"),
Paragraph("<b>ACE Inhibitors:</b>", BoldBody),
bullet("Reduce ventricular remodeling; start within 24 hrs"),
Paragraph("<b>Oxygen:</b>", BoldBody),
bullet("Only if SpO2 <90% (hyperoxia is harmful)"),
Paragraph("<b>Morphine:</b>", BoldBody),
bullet("Pain unrelieved by nitrates (routine use now questioned)"),
]
reperf_content = [
section_bar("REPERFUSION STRATEGY", GREEN),
Spacer(1, 4),
Paragraph('<b><font color="#1E8449">Primary PCI</font></b> – Gold Standard', BoldBody),
bullet("Percutaneous coronary intervention + stent"),
bullet("Lower mortality than thrombolysis"),
bullet("Lower hemorrhagic stroke risk"),
bullet("<b>Target: <90 min door-to-balloon time</b>"),
bullet("Effective up to 12 hrs from symptom onset"),
hr(),
Paragraph('<b><font color="#D68910">Thrombolysis</font></b> – If PCI unavailable within 2 hrs', BoldBody),
bullet("tPA (alteplase), streptokinase, tenecteplase"),
bullet("Most effective within 12 hrs of symptom onset"),
bullet("Higher bleeding/stroke risk than PCI"),
bullet("Contraindicated: recent surgery, stroke, active bleeding"),
hr(),
Paragraph("<b>NSTEMI:</b>", BoldBody),
bullet("PCI can be delayed up to 72 hrs in stable patients"),
bullet("No systemic thrombolysis"),
hr(),
Paragraph("<b>Post-Reperfusion (long-term):</b>", BoldBody),
bullet("Beta-blockers + ACE inhibitors + Aspirin"),
bullet("P2Y12 inhibitor (duration per stent/bleeding risk)"),
bullet("High-intensity statin"),
bullet("Exercise test 3 wks post-MI (if no angio/PCI)"),
]
row3 = Table([[
Table([[c] for c in med_content], colWidths=[col_w]),
Spacer(gap, 1),
Table([[c] for c in reperf_content], colWidths=[col_w]),
]], colWidths=[col_w, gap, col_w])
row3.setStyle(TableStyle([
('VALIGN', (0,0), (-1,-1), 'TOP'),
('LEFTPADDING', (0,0), (-1,-1), 0),
('RIGHTPADDING', (0,0), (-1,-1), 0),
('TOPPADDING', (0,0), (-1,-1), 0),
('BOTTOMPADDING', (0,0), (-1,-1), 0),
]))
story.append(row3)
story.append(Spacer(1, 5))
# ═══════════════════════════════════════════════════════════════════════════
# COMPLICATIONS (full width, 2-col layout inside table)
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_bar("COMPLICATIONS", colors.HexColor("#6E2F12")))
story.append(Spacer(1, 3))
comp_early = [
Paragraph("<b>Early (hours - days):</b>", BoldBody),
bullet("Ventricular fibrillation / tachycardia"),
bullet("Cardiogenic shock (>40% LV involved; mortality 40-50%)"),
bullet("Acute LV failure / pulmonary oedema"),
bullet("Heart block / bradyarrhythmia (inferior MI - RCA)"),
bullet("RV infarction: low output + clear lungs + JVD"),
bullet("Early pericarditis (24-72 hrs; overlying infarct)"),
]
comp_late = [
Paragraph("<b>Subacute / Late (days - weeks):</b>", BoldBody),
bullet("Papillary muscle rupture - acute mitral regurgitation"),
bullet("VSD from septal rupture (new pansystolic murmur)"),
bullet("Free wall rupture - cardiac tamponade (days 3-7)"),
bullet("Mural thrombus - systemic embolism"),
bullet("LV aneurysm (weeks to months)"),
bullet("Dressler's syndrome: autoimmune pericarditis (2-10 wks)"),
bullet("Chronic heart failure"),
]
comp_table = Table([[
Table([[c] for c in comp_early], colWidths=[col_w]),
Spacer(gap, 1),
Table([[c] for c in comp_late], colWidths=[col_w]),
]], colWidths=[col_w, gap, col_w])
comp_table.setStyle(TableStyle([
('VALIGN', (0,0), (-1,-1), 'TOP'),
('LEFTPADDING', (0,0), (-1,-1), 0),
('RIGHTPADDING', (0,0), (-1,-1), 0),
('TOPPADDING', (0,0), (-1,-1), 0),
('BOTTOMPADDING', (0,0), (-1,-1), 0),
]))
story.append(comp_table)
story.append(Spacer(1, 5))
# ═══════════════════════════════════════════════════════════════════════════
# MORPHOLOGY TIMELINE (condensed table)
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_bar("MORPHOLOGICAL TIMELINE OF MI (Robbins Pathology)", colors.HexColor("#4A235A")))
story.append(Spacer(1, 3))
morph_head = [
Paragraph("Time", CellHead),
Paragraph("Gross Features", CellHead),
Paragraph("Microscopy", CellHead),
]
morph_data = [
["0-4 hrs", "None visible", "Waviness of fibers at border; sarcolemmal disruption on EM"],
["4-24 hrs", "Dark mottling", "Coagulation necrosis; pyknotic nuclei; hypereosinophilic myocytes; neutrophil infiltrate"],
["1-3 days", "Yellow-tan center", "Necrosis with loss of nuclei/striations; heavy neutrophil infiltrate"],
["3-10 days", "Hyperemic border; yellow-tan soft center", "Neutrophil disintegration; macrophage phagocytosis; early granulation tissue"],
["10 days - 8 wks", "Red-gray depressed borders; grey-white scar forming", "Progressive collagen deposition; granulation tissue replaced by scar"],
[">2 months", "Dense white scar", "Dense collagen scar - fully healed (no regeneration)"],
]
morph_rows = [morph_head] + [[Paragraph(c, CellBody) for c in row] for row in morph_data]
morph_col = [28*mm, 45*mm, 102*mm]
morph_table = Table(morph_rows, colWidths=morph_col, repeatRows=1)
row_colors = [colors.HexColor("#4A235A"), GREY_BG, WHITE, GREY_BG, WHITE, GREY_BG, WHITE]
morph_style = [
('BACKGROUND', (0,0), (-1,0), colors.HexColor("#4A235A")),
('GRID', (0,0), (-1,-1), 0.4, GREY_LINE),
('TOPPADDING', (0,0), (-1,-1), 3),
('BOTTOMPADDING', (0,0), (-1,-1), 3),
('LEFTPADDING', (0,0), (-1,-1), 5),
('RIGHTPADDING', (0,0), (-1,-1), 5),
('VALIGN', (0,0), (-1,-1), 'TOP'),
]
for i, c in enumerate(row_colors[1:], 1):
morph_style.append(('BACKGROUND', (0,i), (-1,i), c))
morph_table.setStyle(TableStyle(morph_style))
story.append(morph_table)
story.append(Spacer(1, 5))
# ═══════════════════════════════════════════════════════════════════════════
# FOOTER
# ═══════════════════════════════════════════════════════════════════════════
footer_data = [[
Paragraph(
"Sources: Robbins & Kumar Basic Pathology | Braunwald's Heart Disease | Guyton & Hall Medical Physiology | "
"Ganong's Review of Medical Physiology | Sabiston Textbook of Surgery | Symptom to Diagnosis (4th Ed) | "
"Tietz Textbook of Laboratory Medicine | Harrison's Principles of Internal Medicine",
SmallGrey
)
]]
footer = Table(footer_data, colWidths=[W])
footer.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), colors.HexColor("#EAECEE")),
('TOPPADDING', (0,0), (-1,-1), 5),
('BOTTOMPADDING', (0,0), (-1,-1), 5),
('LEFTPADDING', (0,0), (-1,-1), 8),
('RIGHTPADDING', (0,0), (-1,-1), 8),
('BOX', (0,0), (-1,-1), 0.5, GREY_LINE),
]))
story.append(footer)
# ── Build ─────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF created: {OUTPUT_PATH}")
cd /home/daytona/workspace/mi-quickref && python generate_mi_pdf.py 2>&1
ls -lh /home/daytona/workspace/mi-quickref/MI_Quick_Reference_Guide.pdf
cd /home/daytona/workspace/mi-quickref && python -c " from pypdf import PdfReade…
cd /home/daytona/workspace/mi-quickref && python -c " from pypdf import PdfReade…
MI Quick Reference Guide
PDF Document · PDF
| Section | Content |
|---|---|
| Header | Red title banner with source attribution |
| Definition & Classification | 2018 Universal Definition, key time thresholds, Type 1 vs Type 2 MI, ACS spectrum |
| Symptoms & ECG Changes | Classic vs atypical presentation, ECG evolution (hyperacute → acute → chronic), lead localisation table |
| Cardiac Biomarkers | Colour-coded table: Troponin I/T, CK-MB, Myoglobin, LDH - with rise/peak/normalisation times |
| Infarct Location | LAD / RCA / LCX with % frequency, territory, and ECG leads |
| Acute Medications | Antiplatelet, anticoagulation, nitrates, beta-blockers, statins, ACE inhibitors, oxygen - with red warning boxes for nitrates in RV infarction and beta-blocker contraindications |
| Reperfusion Strategy | Primary PCI vs thrombolysis decision guide, door-to-balloon target, NSTEMI approach, post-reperfusion secondary prevention |
| Complications | Early (VF, cardiogenic shock, pulmonary oedema) and late (papillary rupture, VSD, free wall rupture, Dressler's) |
| Morphological Timeline | Robbins-based table from 0 hrs to >2 months |
| Footer | Full source list from 8 authoritative textbooks |