Patient age 37 yrs female presents persistent chest pain even treated with injection pantop n Inj tramadol pain not suppressed what could be the ecg findings n diagnosis
chest pain young female ECG T wave inversion lateral leads diagnosis
"T wave inversion" lateral leads chest pain young women
"Sinus node Bradycardia. Cardiac electric axis normal. I aVL V5 V6 Abnormal T wave. Report needs physician confirmation."
| Parameter | Finding |
|---|---|
| Rhythm | Sinus rhythm, regular |
| Rate | ~57 bpm - Sinus Bradycardia |
| P waves | Normal morphology, before every QRS |
| PR interval | ~136 ms (normal) |
| QRS duration | ~94 ms (normal, no bundle branch block) |
| QTc | 412 ms (normal for female <460 ms) |
| Cardiac axis | Normal (~39°) |
| ST segments | No significant ST elevation or depression |
| T waves | Flattening / mild inversion in leads I, aVL, V5, V6 (lateral leads) |
| Investigation | Rationale |
|---|---|
| hs-Troponin I/T (0h + 3h) | Rule in/out MI or myocarditis |
| CK-MB | Myocardial necrosis marker |
| 2D Echocardiogram | Wall motion abnormality, pericardial effusion, EF |
| Serum electrolytes (K+, Mg2+) | T-wave flattening can be from hypokalemia |
| CBC, CRP, ESR | Elevated in myocarditis/pericarditis |
| D-dimer / CT-PA | If PE suspected (especially if on OCPs) |
| Chest X-ray | Cardiomegaly, pulmonary congestion, widened mediastinum |
| Lipid profile, blood glucose | Cardiovascular risk factors |
| ANA / antiphospholipid antibodies | If autoimmune etiology suspected |
The persistence of chest pain despite IV pantoprazole and tramadol strongly argues against GI causes. This patient needs immediate cardiac enzyme testing and cardiology evaluation. Do NOT discharge without troponin results.
Create a summary ECG interpretation document for cardiology consultation
ls /home/daytona/workspace/ && ls /home/daytona/skills/docx/
mkdir -p /home/daytona/workspace/ecg-consult && ls /home/daytona/workspace/ecg-c…
~/ecg-consult/create_ecg_report.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
Header, Footer, AlignmentType, HeadingLevel, BorderStyle, WidthType,
ShadingType, VerticalAlign, PageNumber, NumberFormat, UnderlineType,
TableLayoutType
} = require('docx');
const fs = require('fs');
// ── helper: bold label + normal value inline ──────────────────────────────────
function labelValue(label, value) {
return new Paragraph({
spacing: { after: 60 },
children: [
new TextRun({ text: label + ': ', bold: true, size: 22, font: 'Calibri' }),
new TextRun({ text: value, size: 22, font: 'Calibri' }),
],
});
}
// ── helper: section heading ───────────────────────────────────────────────────
function sectionHeading(text) {
return new Paragraph({
spacing: { before: 220, after: 80 },
border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: '1F4E79' } },
children: [
new TextRun({
text: text.toUpperCase(),
bold: true,
size: 24,
color: '1F4E79',
font: 'Calibri',
}),
],
});
}
// ── helper: bullet paragraph ──────────────────────────────────────────────────
function bullet(text, color) {
return new Paragraph({
spacing: { after: 60 },
indent: { left: 360 },
children: [
new TextRun({ text: '\u2022 ', bold: true, color: color || '000000', size: 22, font: 'Calibri' }),
new TextRun({ text, size: 22, font: 'Calibri' }),
],
});
}
// ── helper: bold bullet ───────────────────────────────────────────────────────
function boldBullet(text, color) {
return new Paragraph({
spacing: { after: 60 },
indent: { left: 360 },
children: [
new TextRun({ text: '\u2022 ' + text, bold: true, color: color || 'C00000', size: 22, font: 'Calibri' }),
],
});
}
// ── helper: table row with shading on first cell ──────────────────────────────
function dataRow(param, finding, flag) {
const flagColor = flag === 'abnormal' ? 'FFE7E7' : flag === 'borderline' ? 'FFF3CD' : 'EBF3FF';
const textColor = flag === 'abnormal' ? 'C00000' : flag === 'borderline' ? '7B5C00' : '1F4E79';
return new TableRow({
children: [
new TableCell({
width: { size: 3600, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: 'F0F7FF' },
children: [new Paragraph({
children: [new TextRun({ text: param, bold: true, size: 21, font: 'Calibri', color: '1F4E79' })],
spacing: { before: 60, after: 60 }, indent: { left: 100 }
})],
verticalAlign: VerticalAlign.CENTER,
}),
new TableCell({
width: { size: 5400, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: flag === 'abnormal' ? 'FFE7E7' : flag === 'borderline' ? 'FFF9E6' : 'FFFFFF' },
children: [new Paragraph({
children: [new TextRun({ text: finding, bold: flag === 'abnormal', size: 21, font: 'Calibri', color: textColor })],
spacing: { before: 60, after: 60 }, indent: { left: 100 }
})],
verticalAlign: VerticalAlign.CENTER,
}),
],
});
}
// ── helper: differential row ─────────────────────────────────────────────────
function diffRow(priority, diagnosis, likelihood, action) {
const bgColors = { '1': 'FFE7E7', '2': 'FFF3E6', '3': 'FFFDE7', '4': 'F0FFF0', '5': 'F0FFF0' };
const bg = bgColors[priority] || 'FFFFFF';
return new TableRow({
children: [
new TableCell({
width: { size: 700, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: bg },
children: [new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: priority, bold: true, size: 21, font: 'Calibri' })],
spacing: { before: 60, after: 60 }
})],
verticalAlign: VerticalAlign.CENTER,
}),
new TableCell({
width: { size: 2900, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: bg },
children: [new Paragraph({
children: [new TextRun({ text: diagnosis, bold: true, size: 21, font: 'Calibri' })],
spacing: { before: 60, after: 60 }, indent: { left: 80 }
})],
verticalAlign: VerticalAlign.CENTER,
}),
new TableCell({
width: { size: 1600, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: bg },
children: [new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: likelihood, bold: true, size: 21, font: 'Calibri' })],
spacing: { before: 60, after: 60 }
})],
verticalAlign: VerticalAlign.CENTER,
}),
new TableCell({
width: { size: 3800, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: bg },
children: [new Paragraph({
children: [new TextRun({ text: action, size: 20, font: 'Calibri' })],
spacing: { before: 60, after: 60 }, indent: { left: 80 }
})],
verticalAlign: VerticalAlign.CENTER,
}),
],
});
}
// ── helper: investigation row ─────────────────────────────────────────────────
function invRow(test, rationale, urgency) {
const urgColor = urgency === 'STAT' ? 'C00000' : urgency === 'Urgent' ? 'E05A00' : '1F4E79';
const urgBg = urgency === 'STAT' ? 'FFE7E7' : urgency === 'Urgent' ? 'FFF0E0' : 'F5F5F5';
return new TableRow({
children: [
new TableCell({
width: { size: 3200, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: 'F8F8F8' },
children: [new Paragraph({
children: [new TextRun({ text: test, bold: true, size: 21, font: 'Calibri' })],
spacing: { before: 60, after: 60 }, indent: { left: 80 }
})],
verticalAlign: VerticalAlign.CENTER,
}),
new TableCell({
width: { size: 4200, type: WidthType.DXA },
children: [new Paragraph({
children: [new TextRun({ text: rationale, size: 20, font: 'Calibri' })],
spacing: { before: 60, after: 60 }, indent: { left: 80 }
})],
verticalAlign: VerticalAlign.CENTER,
}),
new TableCell({
width: { size: 1600, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: urgBg },
children: [new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: urgency, bold: true, size: 21, font: 'Calibri', color: urgColor })],
spacing: { before: 60, after: 60 }
})],
verticalAlign: VerticalAlign.CENTER,
}),
],
});
}
// ─────────────────────────────────────────────────────────────────────────────
// TABLE HEADER helper
// ─────────────────────────────────────────────────────────────────────────────
function headerRow(cols) {
return new TableRow({
tableHeader: true,
children: cols.map(({ text, width }) =>
new TableCell({
width: { size: width, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: '1F4E79' },
children: [new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text, bold: true, size: 22, font: 'Calibri', color: 'FFFFFF' })],
spacing: { before: 80, after: 80 }
})],
verticalAlign: VerticalAlign.CENTER,
})
),
});
}
// ─────────────────────────────────────────────────────────────────────────────
// DOCUMENT
// ─────────────────────────────────────────────────────────────────────────────
const doc = new Document({
styles: {
default: {
document: { run: { font: 'Calibri', size: 22 } },
},
},
sections: [{
properties: {
page: {
margin: { top: 900, bottom: 900, left: 1000, right: 1000 },
},
},
headers: {
default: new Header({
children: [
new Paragraph({
alignment: AlignmentType.CENTER,
border: { bottom: { style: BorderStyle.SINGLE, size: 8, color: '1F4E79' } },
spacing: { after: 120 },
children: [
new TextRun({ text: 'AL ORTHO & MULTISPECIALITY HOSPITAL', bold: true, size: 26, color: '1F4E79', font: 'Calibri' }),
new TextRun({ text: ' | CARDIOLOGY CONSULTATION', size: 22, color: '404040', font: 'Calibri' }),
],
}),
],
}),
},
footers: {
default: new Footer({
children: [
new Paragraph({
alignment: AlignmentType.CENTER,
border: { top: { style: BorderStyle.SINGLE, size: 6, color: 'CCCCCC' } },
spacing: { before: 80 },
children: [
new TextRun({ text: 'CONFIDENTIAL - FOR PHYSICIAN USE ONLY | Page ', size: 18, color: '888888', font: 'Calibri' }),
new TextRun({ children: [new PageNumber()], size: 18, color: '888888', font: 'Calibri' }),
],
}),
],
}),
},
children: [
// ── TITLE BLOCK ─────────────────────────────────────────────────────────
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 300, after: 60 },
children: [
new TextRun({ text: 'ECG INTERPRETATION & CARDIOLOGY CONSULTATION REPORT', bold: true, size: 32, color: '1F4E79', font: 'Calibri' }),
],
}),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { after: 40 },
children: [
new TextRun({ text: 'Urgent Cardiac Evaluation | Refractory Chest Pain', size: 24, color: 'C00000', bold: true, font: 'Calibri' }),
],
}),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { after: 240 },
children: [
new TextRun({ text: 'Date of ECG: 13 July 2026 | Report Generated: 13 July 2026', size: 20, color: '666666', font: 'Calibri' }),
],
}),
// ── PATIENT DEMOGRAPHICS ─────────────────────────────────────────────────
sectionHeading('1. Patient Information'),
new Table({
layout: TableLayoutType.FIXED,
width: { size: 9000, type: WidthType.DXA },
rows: [
new TableRow({ children: [
new TableCell({ width: { size: 4500, type: WidthType.DXA }, shading: { type: ShadingType.CLEAR, fill: 'EBF3FF' }, children: [labelValue('Name', 'Farnasib (as per ECG record)')], }),
new TableCell({ width: { size: 4500, type: WidthType.DXA }, shading: { type: ShadingType.CLEAR, fill: 'EBF3FF' }, children: [labelValue('Age / Sex', '37 Years / Female')], }),
]}),
new TableRow({ children: [
new TableCell({ width: { size: 4500, type: WidthType.DXA }, children: [labelValue('Room / Bed', 'As per admission')], }),
new TableCell({ width: { size: 4500, type: WidthType.DXA }, children: [labelValue('ECG Date & Time', '2026-07-13 | 00:27:12')], }),
]}),
new TableRow({ children: [
new TableCell({ width: { size: 4500, type: WidthType.DXA }, shading: { type: ShadingType.CLEAR, fill: 'EBF3FF' }, children: [labelValue('Referring Department', 'Emergency / General Medicine')], }),
new TableCell({ width: { size: 4500, type: WidthType.DXA }, shading: { type: ShadingType.CLEAR, fill: 'EBF3FF' }, children: [labelValue('Consulting Cardiologist', '_________________________')], }),
]}),
],
}),
// ── CHIEF COMPLAINT ──────────────────────────────────────────────────────
sectionHeading('2. Clinical Presentation'),
new Paragraph({
spacing: { after: 80 },
children: [
new TextRun({ text: 'Chief Complaint: ', bold: true, size: 22, font: 'Calibri' }),
new TextRun({ text: 'Persistent chest pain, not responding to standard analgesic therapy.', size: 22, font: 'Calibri' }),
],
}),
new Paragraph({
spacing: { after: 60 },
children: [new TextRun({ text: 'Treatments Given (Pre-ECG) - Both FAILED to relieve pain:', bold: true, size: 22, color: 'C00000', font: 'Calibri' })],
}),
boldBullet('Inj. Pantoprazole (IV) - Acid suppression: No relief', 'C00000'),
boldBullet('Inj. Tramadol (IV Opioid analgesic) - Strong analgesia: No relief', 'C00000'),
new Paragraph({
spacing: { before: 120, after: 80 },
children: [
new TextRun({
text: 'Clinical Significance: Failure to respond to IV pantoprazole rules out GERD/peptic disease as the primary etiology. Failure to respond to IV tramadol (opioid) indicates visceral pain of non-musculoskeletal origin - strongly suggesting a CARDIAC or VASCULAR cause.',
size: 21, font: 'Calibri', italics: true, color: '444444'
}),
],
}),
// ── ECG TECHNICAL DETAILS ────────────────────────────────────────────────
sectionHeading('3. ECG Technical Details'),
new Table({
layout: TableLayoutType.FIXED,
width: { size: 9000, type: WidthType.DXA },
rows: [
headerRow([
{ text: 'Parameter', width: 3600 },
{ text: 'Value / Finding', width: 5400 },
]),
dataRow('Paper Speed', '25 mm/s (Standard)', 'normal'),
dataRow('Voltage Calibration', '10 mm/mV (Standard)', 'normal'),
dataRow('Leads Recorded', '12-lead (I, II, III, aVR, aVL, aVF, V1-V6)', 'normal'),
dataRow('Quality', 'Adequate for interpretation', 'normal'),
],
}),
// ── ECG MEASUREMENTS ────────────────────────────────────────────────────
sectionHeading('4. ECG Measurements & Findings'),
new Table({
layout: TableLayoutType.FIXED,
width: { size: 9000, type: WidthType.DXA },
rows: [
headerRow([
{ text: 'ECG Parameter', width: 3600 },
{ text: 'Finding & Interpretation', width: 5400 },
]),
dataRow('Heart Rate', '57 bpm - SINUS BRADYCARDIA', 'borderline'),
dataRow('Rhythm', 'Regular sinus rhythm; P wave before every QRS', 'normal'),
dataRow('P Wave', 'Normal morphology, duration < 120 ms', 'normal'),
dataRow('PR Interval', '136 ms (Normal: 120-200 ms)', 'normal'),
dataRow('QRS Duration', '94 ms (Normal: < 120 ms; no BBB)', 'normal'),
dataRow('QT / QTc', '425 ms / 412 ms (Normal for female: < 460 ms)', 'normal'),
dataRow('Cardiac Axis', 'Normal axis (~39 degrees)', 'normal'),
dataRow('ST Segments', 'No significant ST elevation or depression', 'normal'),
dataRow('T Waves - Leads I, aVL', 'FLATTENING / MILD INVERSION (ABNORMAL)', 'abnormal'),
dataRow('T Waves - Leads V5, V6', 'FLATTENING / MILD INVERSION (ABNORMAL)', 'abnormal'),
dataRow('T Waves - Other leads', 'No significant abnormality', 'normal'),
dataRow('Q Waves', 'No pathological Q waves', 'normal'),
dataRow('ST-T Pattern', 'Non-specific lateral repolarization abnormality', 'abnormal'),
],
}),
// ── MACHINE INTERPRETATION ───────────────────────────────────────────────
new Paragraph({ spacing: { before: 200, after: 80 }, children: [
new TextRun({ text: 'Machine-Generated Interpretation (on ECG strip):', bold: true, size: 22, color: '1F4E79', font: 'Calibri' }),
]}),
new Paragraph({
spacing: { after: 200 },
shading: { type: ShadingType.CLEAR, fill: 'FFF9E6' },
border: {
top: { style: BorderStyle.SINGLE, size: 4, color: 'F0A500' },
bottom: { style: BorderStyle.SINGLE, size: 4, color: 'F0A500' },
left: { style: BorderStyle.THICK, size: 12, color: 'F0A500' },
right: { style: BorderStyle.SINGLE, size: 4, color: 'F0A500' },
},
indent: { left: 200, right: 200 },
children: [
new TextRun({ text: '"Sinus node Bradycardia. Cardiac electric axis normal. I aVL V5 V6 Abnormal T wave. Report needs physician confirmation."', italics: true, size: 22, font: 'Calibri', color: '7B5C00' }),
],
}),
// ── ECG DIAGNOSIS ────────────────────────────────────────────────────────
sectionHeading('5. ECG Diagnosis'),
new Paragraph({
spacing: { after: 80 },
children: [new TextRun({ text: 'Primary ECG Diagnosis:', bold: true, size: 24, color: 'C00000', font: 'Calibri' })],
}),
boldBullet('Sinus Bradycardia (57 bpm)', 'C00000'),
boldBullet('Lateral T-Wave Abnormalities - Flattening/Inversion in Leads I, aVL, V5, V6', 'C00000'),
new Paragraph({
spacing: { before: 120, after: 80 },
children: [new TextRun({ text: 'Clinical Interpretation:', bold: true, size: 22, font: 'Calibri', color: '1F4E79' })],
}),
bullet('The lateral T-wave changes (I, aVL, V5, V6) represent a repolarization abnormality of the LATERAL WALL of the left ventricle.'),
bullet('In a symptomatic patient with refractory chest pain, these findings are NON-NORMAL and must be presumed to represent lateral wall ischemia until proven otherwise.'),
bullet('Absence of ST elevation does NOT exclude NSTEMI - up to 50% of NSTEMIs present without ST elevation.'),
bullet('No bundle branch block, no pathological Q waves, QTc within normal limits.'),
// ── DIFFERENTIAL DIAGNOSIS ───────────────────────────────────────────────
sectionHeading('6. Differential Diagnosis'),
new Table({
layout: TableLayoutType.FIXED,
width: { size: 9000, type: WidthType.DXA },
rows: [
headerRow([
{ text: '#', width: 700 },
{ text: 'Diagnosis', width: 2900 },
{ text: 'Likelihood', width: 1600 },
{ text: 'Distinguishing Feature / Action', width: 3800 },
]),
diffRow('1', 'NSTEMI / Unstable Angina', 'HIGH', 'Serial hs-Troponin (0h, 3h); urgent echo; cardiology review'),
diffRow('2', 'Acute Myocarditis', 'HIGH', 'CRP, ESR, troponin (persistently elevated); cardiac MRI if suspected'),
diffRow('3', 'Pericarditis / Myopericarditis', 'MODERATE', 'Look for PR depression, pericardial rub; NSAID trial; echo'),
diffRow('4', 'Takotsubo Cardiomyopathy', 'MODERATE', 'Stress trigger history; echo for apical ballooning; mild troponin rise'),
diffRow('5', 'Pulmonary Embolism', 'MODERATE', 'D-dimer; OCP history; CT pulmonary angiography if Wells score elevated'),
diffRow('5', 'Electrolyte Abnormality', 'POSSIBLE', 'Serum K+, Mg2+ - hypokalemia causes T-wave flattening'),
diffRow('5', 'Normal Variant / Anxiety', 'LOW', 'Diagnosis of EXCLUSION only - cannot assume with active symptoms'),
],
}),
// ── URGENT INVESTIGATIONS ────────────────────────────────────────────────
sectionHeading('7. Recommended Investigations'),
new Table({
layout: TableLayoutType.FIXED,
width: { size: 9000, type: WidthType.DXA },
rows: [
headerRow([
{ text: 'Investigation', width: 3200 },
{ text: 'Rationale', width: 4200 },
{ text: 'Urgency', width: 1600 },
]),
invRow('hs-Troponin I/T (0h + 3h)', 'Rule in/out NSTEMI, myocarditis - MOST CRITICAL TEST', 'STAT'),
invRow('12-lead ECG (serial)', 'Detect evolving ST changes; compare with baseline', 'STAT'),
invRow('2D Echocardiogram', 'Wall motion abnormality, pericardial effusion, LV EF, apical ballooning', 'STAT'),
invRow('CK-MB', 'Myocardial necrosis marker (supplementary to troponin)', 'STAT'),
invRow('Serum Electrolytes (K+, Mg2+)', 'Hypokalemia/hypomagnesemia cause T-wave abnormalities', 'Urgent'),
invRow('CBC + CRP + ESR', 'Inflammatory markers for myocarditis/pericarditis', 'Urgent'),
invRow('D-dimer', 'Exclude pulmonary embolism (especially if on OCP)', 'Urgent'),
invRow('Chest X-Ray (PA view)', 'Cardiomegaly, pulmonary edema, mediastinum width', 'Urgent'),
invRow('Lipid Profile + Blood Glucose', 'Cardiovascular risk factor assessment', 'Routine'),
invRow('ANA / Antiphospholipid Ab', 'Autoimmune cause if myocarditis/vasculitis suspected', 'Routine'),
invRow('Coronary Angiography / CTA', 'If troponin +ve or strong suspicion of CAD', 'As indicated'),
invRow('Cardiac MRI (CMR-LGE)', 'Gold standard for myocarditis - if troponin elevated + echo non-diagnostic', 'As indicated'),
],
}),
// ── RISK STRATIFICATION ─────────────────────────────────────────────────
sectionHeading('8. Risk Stratification'),
new Paragraph({
spacing: { before: 100, after: 80 },
shading: { type: ShadingType.CLEAR, fill: 'FFE7E7' },
border: {
top: { style: BorderStyle.SINGLE, size: 6, color: 'C00000' },
bottom: { style: BorderStyle.SINGLE, size: 6, color: 'C00000' },
left: { style: BorderStyle.THICK, size: 18, color: 'C00000' },
right: { style: BorderStyle.SINGLE, size: 6, color: 'C00000' },
},
indent: { left: 200, right: 200 },
children: [
new TextRun({ text: 'RISK LEVEL: HIGH - ADMIT AND MONITOR', bold: true, size: 26, color: 'C00000', font: 'Calibri' }),
],
}),
new Paragraph({ spacing: { before: 120, after: 60 }, children: [new TextRun({ text: 'Risk factors identified in this presentation:', bold: true, size: 22, font: 'Calibri' })]}),
boldBullet('Pain refractory to IV opioid analgesic (tramadol) - strong cardiac red flag', 'C00000'),
boldBullet('Pain refractory to IV pantoprazole - GI cause excluded', 'C00000'),
boldBullet('Lateral T-wave inversions (I, aVL, V5, V6) - correlates with lateral wall ischemia territory (LAD/LCx distribution)', 'C00000'),
bullet('Young female - atypical presentations of ACS are more common in women'),
bullet('Sinus bradycardia - may reflect vagal response to pain or inferior wall involvement'),
// ── MANAGEMENT RECOMMENDATION ────────────────────────────────────────────
sectionHeading('9. Management Recommendations'),
new Paragraph({ spacing: { after: 60 }, children: [new TextRun({ text: 'Immediate Actions:', bold: true, size: 22, color: 'C00000', font: 'Calibri' })]}),
boldBullet('Do NOT discharge patient - admit to CCU/cardiac monitoring unit', 'C00000'),
boldBullet('Continuous cardiac monitoring (telemetry)', 'C00000'),
boldBullet('Peripheral IV access; O2 saturation monitoring', 'C00000'),
boldBullet('Urgent hs-Troponin - if elevated: activate ACS protocol', 'C00000'),
new Paragraph({ spacing: { before: 120, after: 60 }, children: [new TextRun({ text: 'Pending Troponin Results:', bold: true, size: 22, color: '1F4E79', font: 'Calibri' })]}),
bullet('Aspirin 325 mg loading dose (if ACS not excluded and no contraindication)'),
bullet('Withhold further tramadol; consider IV morphine titrated for pain (after cardiac cause not yet excluded, under monitoring)'),
bullet('Nitroglycerin sublingual/IV if BP allows and no hypotension'),
bullet('Hold anticoagulation decision until troponin result and clinical review'),
new Paragraph({ spacing: { before: 120, after: 60 }, children: [new TextRun({ text: 'If Troponin Positive:', bold: true, size: 22, color: 'C00000', font: 'Calibri' })]}),
boldBullet('Activate NSTEMI / ACS pathway immediately', 'C00000'),
boldBullet('Dual antiplatelet therapy (aspirin + clopidogrel or ticagrelor)', 'C00000'),
boldBullet('Anticoagulation (fondaparinux or LMWH)', 'C00000'),
boldBullet('Urgent cardiology/interventional cardiology consult for coronary angiography', 'C00000'),
new Paragraph({ spacing: { before: 120, after: 60 }, children: [new TextRun({ text: 'If Troponin Negative (0h + 3h):', bold: true, size: 22, color: '1F4E79', font: 'Calibri' })]}),
bullet('Repeat ECG at 6h and 12h'),
bullet('Consider cardiac MRI for myocarditis if clinical picture fits'),
bullet('Echocardiogram mandatory regardless of troponin result'),
bullet('Risk stratify for exercise stress test or CT coronary angiography'),
// ── PHYSICIAN NOTES ─────────────────────────────────────────────────────
sectionHeading('10. Cardiologist Comments / Additions'),
new Paragraph({ spacing: { after: 40 }, children: [new TextRun({ text: 'Clinical Impression:', bold: true, size: 22, font: 'Calibri' })]}),
new Paragraph({ spacing: { after: 60 }, border: { bottom: { style: BorderStyle.DOTTED, size: 4, color: 'AAAAAA' }}, children: [new TextRun({ text: ' ', size: 22 })]}),
new Paragraph({ spacing: { after: 60 }, border: { bottom: { style: BorderStyle.DOTTED, size: 4, color: 'AAAAAA' }}, children: [new TextRun({ text: ' ', size: 22 })]}),
new Paragraph({ spacing: { after: 60 }, border: { bottom: { style: BorderStyle.DOTTED, size: 4, color: 'AAAAAA' }}, children: [new TextRun({ text: ' ', size: 22 })]}),
new Paragraph({ spacing: { before: 120, after: 40 }, children: [new TextRun({ text: 'Plan:', bold: true, size: 22, font: 'Calibri' })]}),
new Paragraph({ spacing: { after: 60 }, border: { bottom: { style: BorderStyle.DOTTED, size: 4, color: 'AAAAAA' }}, children: [new TextRun({ text: ' ', size: 22 })]}),
new Paragraph({ spacing: { after: 60 }, border: { bottom: { style: BorderStyle.DOTTED, size: 4, color: 'AAAAAA' }}, children: [new TextRun({ text: ' ', size: 22 })]}),
new Paragraph({ spacing: { after: 60 }, border: { bottom: { style: BorderStyle.DOTTED, size: 4, color: 'AAAAAA' }}, children: [new TextRun({ text: ' ', size: 22 })]}),
// ── SIGNATURE ────────────────────────────────────────────────────────────
new Paragraph({ spacing: { before: 360, after: 60 }, children: [new TextRun({ text: ' ' })]}),
new Table({
layout: TableLayoutType.FIXED,
width: { size: 9000, type: WidthType.DXA },
rows: [
new TableRow({ children: [
new TableCell({ width: { size: 4500, type: WidthType.DXA }, borders: { top: { style: BorderStyle.NONE }, left: { style: BorderStyle.NONE }, right: { style: BorderStyle.NONE }, bottom: { style: BorderStyle.SINGLE, size: 6, color: '1F4E79' }}, children: [new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: ' ', size: 36, font: 'Calibri' })] })]}),
new TableCell({ width: { size: 500, type: WidthType.DXA }, borders: { top: { style: BorderStyle.NONE }, left: { style: BorderStyle.NONE }, right: { style: BorderStyle.NONE }, bottom: { style: BorderStyle.NONE }}, children: [new Paragraph({ children: [new TextRun({ text: ' ' })] })]}),
new TableCell({ width: { size: 4000, type: WidthType.DXA }, borders: { top: { style: BorderStyle.NONE }, left: { style: BorderStyle.NONE }, right: { style: BorderStyle.NONE }, bottom: { style: BorderStyle.SINGLE, size: 6, color: '1F4E79' }}, children: [new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: ' ', size: 36, font: 'Calibri' })] })]}),
]}),
new TableRow({ children: [
new TableCell({ borders: { top: { style: BorderStyle.NONE }, left: { style: BorderStyle.NONE }, right: { style: BorderStyle.NONE }, bottom: { style: BorderStyle.NONE }}, children: [new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 60 }, children: [new TextRun({ text: 'Reporting Physician Signature & Stamp', size: 18, color: '888888', font: 'Calibri' })] })]}),
new TableCell({ borders: { top: { style: BorderStyle.NONE }, left: { style: BorderStyle.NONE }, right: { style: BorderStyle.NONE }, bottom: { style: BorderStyle.NONE }}, children: [new Paragraph({ children: [new TextRun({ text: ' ' })] })]}),
new TableCell({ borders: { top: { style: BorderStyle.NONE }, left: { style: BorderStyle.NONE }, right: { style: BorderStyle.NONE }, bottom: { style: BorderStyle.NONE }}, children: [new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 60 }, children: [new TextRun({ text: 'Consulting Cardiologist Signature & Date', size: 18, color: '888888', font: 'Calibri' })] })]}),
]}),
],
}),
// ── DISCLAIMER ───────────────────────────────────────────────────────────
new Paragraph({
spacing: { before: 300, after: 60 },
border: { top: { style: BorderStyle.SINGLE, size: 6, color: 'CCCCCC' } },
children: [
new TextRun({ text: 'DISCLAIMER: ', bold: true, size: 18, color: '888888', font: 'Calibri' }),
new TextRun({ text: 'This report is generated as a clinical aid tool based on ECG analysis. All findings must be clinically correlated and confirmed by a licensed cardiologist or physician. This document does not replace clinical judgment. The machine-generated ECG interpretation is advisory only and requires physician verification.', size: 18, color: '888888', font: 'Calibri', italics: true }),
],
}),
],
}],
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync('/home/daytona/workspace/ecg-consult/ECG_Cardiology_Consultation_Report.docx', buffer);
console.log('Document created successfully.');
});
cd /home/daytona/workspace/ecg-consult && node create_ecg_report.js 2>&1
~/ecg-consult/create_ecg_report.js
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ecg-consult/create_ecg_report.js'
~/ecg-consult/create_ecg_report.js
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ecg-consult/create_ecg_report.js'
cd /home/daytona/workspace/ecg-consult && node create_ecg_report.js 2>&1
python3 /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/works…
ls -lh /home/daytona/workspace/ecg-consult/ && python3 -c "import zipfile; z=zip…
ECG Cardiology Consultation Report
Word Document · DOCX
| Section | Content |
|---|---|
| 1. Patient Information | Demographics table (37F, date/time of ECG) |
| 2. Clinical Presentation | Chief complaint + failed treatments (Pantoprazole, Tramadol) with clinical significance note |
| 3. ECG Technical Details | Paper speed, voltage, lead system |
| 4. ECG Measurements | Full parameter table with color-coded normal/borderline/abnormal rows |
| 5. ECG Diagnosis | Primary diagnosis (Sinus Bradycardia + Lateral T-wave inversions I, aVL, V5, V6) with machine report quoted |
| 6. Differential Diagnosis | Priority-ranked table (NSTEMI, Myocarditis, Pericarditis, Takotsubo, PE, electrolytes) |
| 7. Investigations | 12 tests with urgency flags (STAT / Urgent / Routine) |
| 8. Risk Stratification | HIGH RISK box with red formatting, cardiac red flags listed |
| 9. Management Recommendations | Immediate actions + if Troponin +/- pathways |
| 10. Cardiologist Comments | Blank dotted-line fields for physician to write clinical impression + plan |