Analyze this ecg
"anterior myocardial infarction" AND "left anterior fascicular block" ECG
| Parameter | Value | Normal |
|---|---|---|
| PR | 132 ms | 120–200 ms ✅ |
| QRS | 128 ms | <120 ms ⚠️ (widened) |
| QT / QTc | 372 / 474 ms | QTc borderline prolonged ⚠️ |
| RV5/SV1 | 0.40 / 2.316 mV | — |
| P-R-S-T | 74–61–84 | — |
| Priority | Action |
|---|---|
| 1 | Activate Cath Lab / STEMI protocol — door-to-balloon time <90 min |
| 2 | 12-lead serial ECGs every 15–30 min to track evolution |
| 3 | IV access, continuous cardiac monitoring, defibrillator at bedside |
| 4 | Aspirin 325 mg loading + P2Y12 inhibitor (ticagrelor or clopidogrel) |
| 5 | Anticoagulation (heparin or enoxaparin) |
| 6 | Troponin, CK-MB, BMP (electrolytes, renal function) |
| 7 | Watch for AV block progression given LAFB + anterior MI |
| 8 | Avoid QT-prolonging medications (QTc 474 ms) |
⚠️ Clinical Disclaimer: This analysis is intended to support — not replace — clinical judgment. A qualified cardiologist must review the original ECG tracing and assess the patient clinically. Given the acute anteroseptal MI pattern in a 68-year-old female, emergent management is indicated.
Generate a clinical summary document for the medical team
ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or not foun…
mkdir -p /home/daytona/workspace/ecg-report && ls /home/daytona/skills/docx/
~/ecg-report/generate_report.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, VerticalAlign,
ShadingType, PageNumber, Header, Footer
} = require('docx');
const fs = require('fs');
// ── Helpers ────────────────────────────────────────────────────────────────
const RED = "C0392B";
const ORANGE= "E67E22";
const DARK = "1A252F";
const BLUE = "1A5276";
const LIGHT_BLUE = "D6EAF8";
const LIGHT_RED = "FADBD8";
const LIGHT_ORANGE = "FDEBD0";
const LIGHT_GRAY = "F2F3F4";
const WHITE = "FFFFFF";
function heading1(text) {
return new Paragraph({
heading: HeadingLevel.HEADING_1,
spacing: { before: 320, after: 120 },
children: [
new TextRun({
text,
bold: true,
size: 28,
color: WHITE,
font: "Calibri",
}),
],
shading: { type: ShadingType.SOLID, color: BLUE },
indent: { left: 200, right: 200 },
});
}
function heading2(text, color = BLUE) {
return new Paragraph({
spacing: { before: 240, after: 80 },
children: [
new TextRun({ text, bold: true, size: 24, color, font: "Calibri" }),
],
border: {
bottom: { style: BorderStyle.SINGLE, size: 6, color },
},
});
}
function bodyText(text, opts = {}) {
return new Paragraph({
spacing: { after: 80 },
children: [
new TextRun({
text,
size: 20,
font: "Calibri",
color: DARK,
bold: opts.bold || false,
italics: opts.italic || false,
}),
],
});
}
function bulletPoint(text, highlight = null) {
return new Paragraph({
bullet: { level: 0 },
spacing: { after: 60 },
children: [
new TextRun({
text,
size: 20,
font: "Calibri",
color: DARK,
highlight: highlight || undefined,
bold: highlight ? true : false,
}),
],
});
}
function alertBox(text, bgColor, textColor = DARK) {
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
margins: { top: 60, bottom: 60, left: 100, right: 100 },
borders: {
top: { style: BorderStyle.SINGLE, size: 8, color: RED },
bottom: { style: BorderStyle.SINGLE, size: 8, color: RED },
left: { style: BorderStyle.SINGLE, size: 8, color: RED },
right: { style: BorderStyle.SINGLE, size: 8, color: RED },
},
rows: [
new TableRow({
children: [
new TableCell({
shading: { type: ShadingType.SOLID, color: bgColor },
verticalAlign: VerticalAlign.CENTER,
children: [
new Paragraph({
alignment: AlignmentType.CENTER,
children: [
new TextRun({ text, bold: true, size: 22, color: textColor, font: "Calibri" }),
],
}),
],
}),
],
}),
],
});
}
function makeTable(headers, rows, headerBg = BLUE) {
const headerRow = new TableRow({
tableHeader: true,
children: headers.map(h =>
new TableCell({
shading: { type: ShadingType.SOLID, color: headerBg },
verticalAlign: VerticalAlign.CENTER,
children: [
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: h, bold: true, size: 19, color: WHITE, font: "Calibri" })],
}),
],
})
),
});
const dataRows = rows.map((row, i) =>
new TableRow({
children: row.map((cell, j) =>
new TableCell({
shading: { type: ShadingType.SOLID, color: i % 2 === 0 ? LIGHT_GRAY : WHITE },
verticalAlign: VerticalAlign.CENTER,
children: [
new Paragraph({
alignment: j === 0 ? AlignmentType.LEFT : AlignmentType.CENTER,
children: [
new TextRun({
text: cell.text || cell,
size: 19,
font: "Calibri",
bold: cell.bold || false,
color: cell.color || DARK,
}),
],
}),
],
})
),
})
);
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [headerRow, ...dataRows],
});
}
function spacer(lines = 1) {
return new Paragraph({ spacing: { after: 80 * lines }, children: [] });
}
// ── Document Assembly ──────────────────────────────────────────────────────
const doc = new Document({
creator: "Orris Clinical AI",
title: "ECG Clinical Summary — Pushap Devi",
description: "AI-assisted ECG interpretation for medical team handover",
sections: [
{
headers: {
default: new Header({
children: [
new Paragraph({
alignment: AlignmentType.RIGHT,
children: [
new TextRun({ text: "CONFIDENTIAL — CLINICAL DOCUMENT", size: 16, color: "7F8C8D", font: "Calibri", italics: true }),
],
}),
],
}),
},
footers: {
default: new Footer({
children: [
new Paragraph({
alignment: AlignmentType.CENTER,
children: [
new TextRun({ text: "ECG Clinical Summary | Pushap Devi | 68F | Generated: 22-May-2026 | ", size: 16, color: "7F8C8D", font: "Calibri" }),
new TextRun({ children: [new PageNumber()], size: 16, color: "7F8C8D", font: "Calibri" }),
],
}),
],
}),
},
children: [
// ── Title Block ──
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 40 },
children: [
new TextRun({ text: "ECG CLINICAL SUMMARY", bold: true, size: 40, color: BLUE, font: "Calibri" }),
],
}),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { after: 40 },
children: [
new TextRun({ text: "AI-Assisted Interpretation | For Medical Team Review", size: 20, color: "7F8C8D", font: "Calibri", italics: true }),
],
}),
spacer(),
// ── Alert Box ──
alertBox("⚠ URGENT: ACUTE ANTEROSEPTAL STEMI PATTERN — IMMEDIATE CATH LAB ACTIVATION REQUIRED", LIGHT_RED, RED),
spacer(),
// ── Patient Info ──
heading1("1. PATIENT INFORMATION"),
makeTable(
["Field", "Detail"],
[
["Patient Name", "Pushap Devi"],
["Patient ID", "155234"],
["Sex / Age", "Female, 68 Years"],
["Requisition No.", "368"],
["ECG Date & Time", "30-04-2026 at 10:46:26"],
["Reporting Institution", "Bee Emm General Hospital"],
["Document Generated", "22-May-2026 by Orris Clinical AI"],
]
),
spacer(),
// ── ECG Parameters ──
heading1("2. ECG TECHNICAL PARAMETERS"),
makeTable(
["Parameter", "Recorded Value", "Normal Range", "Status"],
[
["Heart Rate", "96 bpm", "60–100 bpm", { text: "Normal ✓", color: "1E8449" }],
["PR Interval", "132 ms", "120–200 ms", { text: "Normal ✓", color: "1E8449" }],
["QRS Duration", "128 ms", "<120 ms", { text: "Widened ⚠", bold: true, color: ORANGE }],
["QT / QTc", "372 / 474 ms", "QTc <450 ms (F)", { text: "Borderline ⚠", bold: true, color: ORANGE }],
["RV5 / SV1", "0.40 / 2.316 mV", "—", "Recorded"],
["P / R / S / T", "74 / –61 / 84 ms", "—", "See analysis"],
["Paper Speed", "25 mm/s", "Standard", "✓"],
["Gain", "10 mm/mV", "Standard", "✓"],
["Filter", "0.67–100 Hz, AC 50", "Standard", "✓"],
]
),
spacer(),
// ── Diagnoses ──
heading1("3. DIAGNOSES & FINDINGS"),
heading2("3a. PRIMARY FINDING — CRITICAL", RED),
spacer(0.5),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({
shading: { type: ShadingType.SOLID, color: LIGHT_RED },
children: [
new Paragraph({
children: [new TextRun({ text: "🔴 ACUTE ANTEROSEPTAL MYOCARDIAL INFARCTION", bold: true, size: 22, color: RED, font: "Calibri" })],
spacing: { after: 80 },
}),
bulletPoint("ST elevation in leads V1–V2 (slight but present) — active injury pattern"),
bulletPoint("QS morphology in lead V1 — established septal necrosis or evolving infarct"),
bulletPoint("Poor R-wave progression in V2–V3 — anterior wall involvement"),
bulletPoint("T-wave abnormality in aVL — lateral extension of ischemia"),
new Paragraph({
spacing: { before: 80, after: 0 },
children: [new TextRun({ text: "Likely culprit vessel: Proximal–mid Left Anterior Descending (LAD) artery", bold: true, size: 20, font: "Calibri", color: RED })],
}),
],
}),
],
}),
],
}),
spacer(),
heading2("3b. CONDUCTION ABNORMALITY", ORANGE),
spacer(0.5),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({
shading: { type: ShadingType.SOLID, color: LIGHT_ORANGE },
children: [
new Paragraph({
children: [new TextRun({ text: "🟠 LEFT ANTERIOR FASCICULAR BLOCK (LAFB)", bold: true, size: 22, color: ORANGE, font: "Calibri" })],
spacing: { after: 80 },
}),
bulletPoint("QRS widened to 128 ms with marked left axis deviation"),
bulletPoint("Indicates block of anterior fascicle of the left bundle branch"),
bulletPoint("LAFB in the setting of acute anterior MI signals conduction system involvement"),
bulletPoint("Risk of progression to complete (3rd degree) AV block — monitor continuously"),
],
}),
],
}),
],
}),
spacer(),
heading2("3c. ADDITIONAL FINDINGS"),
makeTable(
["Finding", "Clinical Significance"],
[
["Sinus Rhythm (96 bpm)", "Normal rhythm; heart rate at upper limit — may reflect pain/catecholamine surge"],
["Right Atrial Enlargement", "Tall peaked P-waves; suggests right heart strain (pulmonary HTN, COPD, or pre-existing)"],
["Prolonged P-wave", "May indicate biatrial abnormality or intra-atrial conduction delay"],
["Borderline QTc (474 ms)", "Avoid QT-prolonging medications; monitor electrolytes (K⁺, Mg²⁺)"],
]
),
spacer(),
// ── Localisation ──
heading1("4. INFARCT LOCALISATION"),
bodyText("Based on the ECG pattern, the infarct territory and likely coronary anatomy are:"),
spacer(0.5),
makeTable(
["ECG Territory", "Leads Affected", "Likely Vessel", "Risk"],
[
[
{ text: "Anteroseptal", bold: true },
"V1, V2 (V3 evolving)",
{ text: "LAD — proximal to mid", bold: true, color: RED },
{ text: "HIGH", bold: true, color: RED },
],
["Lateral (possible extension)", "aVL (T-wave change)", "LAD diagonal branch / LCx", { text: "MODERATE", bold: true, color: ORANGE }],
["Conduction system", "LAFB pattern", "Septal perforator of LAD", { text: "HIGH", bold: true, color: RED }],
]
),
spacer(),
// ── Immediate Actions ──
heading1("5. IMMEDIATE MANAGEMENT PRIORITIES"),
spacer(0.5),
makeTable(
["Priority", "Action", "Target / Goal"],
[
[{ text: "1 — URGENT", bold: true, color: RED }, "Activate STEMI protocol / Cath Lab", "Door-to-balloon time < 90 minutes"],
[{ text: "2 — URGENT", bold: true, color: RED }, "Serial 12-lead ECGs", "Every 15–30 min to track evolution"],
[{ text: "3 — URGENT", bold: true, color: RED }, "IV access + continuous cardiac monitoring", "Defibrillator at bedside; pacing equipment available"],
[{ text: "4 — HIGH", bold: true, color: ORANGE }, "Antiplatelet therapy", "Aspirin 325 mg load + Ticagrelor 180 mg or Clopidogrel 600 mg"],
[{ text: "5 — HIGH", bold: true, color: ORANGE }, "Anticoagulation", "UFH 60 U/kg IV bolus or Enoxaparin 0.5 mg/kg IV"],
[{ text: "6 — HIGH", bold: true, color: ORANGE }, "Labs: Troponin I/T (serial), CK-MB, BMP", "Establish baseline; repeat Troponin at 3h & 6h"],
[{ text: "7 — HIGH", bold: true, color: ORANGE }, "Electrolytes", "Correct K⁺ >4.0 mEq/L and Mg²⁺ >2.0 mg/dL"],
[{ text: "8 — ROUTINE", bold: true, color: "1E8449" }, "Echocardiography (post-stabilisation)", "Assess LVEF, wall motion abnormality, pericardial effusion"],
[{ text: "9 — ROUTINE", bold: true, color: "1E8449" }, "Monitor AV conduction", "LAFB + anterior MI → risk of complete AV block"],
[{ text: "10 — ROUTINE", bold: true, color: "1E8449" }, "Avoid QT-prolonging drugs", "QTc 474 ms — use caution with ondansetron, azithromycin, etc."],
]
),
spacer(),
// ── Differential Diagnoses ──
heading1("6. DIFFERENTIAL DIAGNOSES TO CONSIDER"),
bodyText("The following conditions can mimic the ST/QS pattern — clinical context and serial ECGs are essential:"),
spacer(0.5),
makeTable(
["Differential", "Distinguishing Feature"],
[
["Left Ventricular Aneurysm (old MI)", "Persistent ST elevation without dynamic change; no chest pain"],
["LBBB with anterior pattern", "QRS >120 ms with broad notched morphology; no QS in V1 with this QRS width"],
["Takotsubo Cardiomyopathy", "Stress trigger; often post-menopausal women; no obstructive CAD on cath"],
["Pericarditis / Myocarditis", "Diffuse saddle-shaped ST elevation; PR depression; pleuritic chest pain"],
["Early Repolarization", "J-point notching; no reciprocal changes; benign in isolated form"],
]
),
spacer(),
// ── Disclaimer ──
heading1("7. DISCLAIMER"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({
shading: { type: ShadingType.SOLID, color: LIGHT_GRAY },
children: [
new Paragraph({
children: [
new TextRun({
text: "This document was generated with AI-assisted ECG interpretation (Orris Clinical AI) on 22-May-2026 at 05:20 AM. It is intended as a clinical decision-support tool only and does NOT replace the independent assessment of a qualified cardiologist or emergency physician. All findings must be correlated with the patient's clinical presentation, history, and examination. The treating medical team bears full responsibility for final clinical decisions.",
size: 18,
font: "Calibri",
color: "555555",
italics: true,
}),
],
}),
],
}),
],
}),
],
}),
spacer(),
],
},
],
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync("/home/daytona/workspace/ecg-report/ECG_Clinical_Summary_Pushap_Devi.docx", buffer);
console.log("SUCCESS: Document written.");
}).catch(err => {
console.error("ERROR:", err);
process.exit(1);
});
cd /home/daytona/workspace/ecg-report && node generate_report.js 2>&1
~/ecg-report/generate_report.js
Error: String not found in file: ' Header, Footer, AlignmentType, PageOrientation, LevelFormat, ExternalHyperlink,
InternalHyperlink, Bookmark, FootnoteReferenceRun, PositionalTab,
PositionalTabAlignment, PositionalTabRelativeTo, PositionalTabLeader,
TabStopType, TabStopPosition, Column, SectionType,
TableOfContents, HeadingLevel, BorderStyle, WidthType, ShadingType,
VerticalAlign, PageNumber, PageBreak } = require('docx');'~/ecg-report/generate_report.js
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ecg-report/generate_report.js'
~/ecg-report/generate_report.js
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ecg-report/generate_report.js'
cd /home/daytona/workspace/ecg-report && node generate_report.js 2>&1
python /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/worksp…
ls -lh /home/daytona/workspace/ecg-report/ && python3 -c "import zipfile; z=zipf…
ECG Clinical Summary Pushap Devi
Word Document · DOCX