I'm a 4th year MBBS student Create a A4 size presentation of 5 pages on the topic with pictures from the web "Atypical forms of cardiomyopathy in children and adolescents."Now do the same for first topic align every line perfectly i want everything in bullet points 20 lines in each page
atypical cardiomyopathy children adolescents types ARVC LVNC Takotsubo
atypical cardiomyopathy children pediatric images diagrams
ARVC arrhythmogenic right ventricular cardiomyopathy pediatric
left ventricular non-compaction LVNC echocardiogram children
Takotsubo stress cardiomyopathy apical ballooning pediatric adolescent
restrictive cardiomyopathy children echocardiogram biatrial enlargement
pediatric cardiomyopathy classification overview diagram
ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or not found"
mkdir -p /home/daytona/workspace/cardiomyopathy-pptx
~/cardiomyopathy-pptx/build.js
const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");
// Fetch images as base64
const imageUrls = [
// Slide 1 - intro/overview: restrictive CM echocardiogram
"https://cdn.orris.care/cdss_images/pmc_clinical_VQA_24ebe5d5c428d8222d2f458d7b08c986c1c4f84a18fb4e230f5839fa71b2addd.jpg",
// Slide 2 - ARVC: MRI with fibrofatty replacement
"https://cdn.orris.care/cdss_images/pmc_clinical_VQA_ccef375d42502a4932535f5fd1be880aeaf424994e8a3739b42f1dba5c0d308a.jpg",
// Slide 3 - LVNC: echocardiogram
"https://cdn.orris.care/cdss_images/pmc_clinical_VQA_b14e87c30825e40d443dba222c70996ccd7abeceedba0d846c27a8d6cff5e093.jpg",
// Slide 4 - Takotsubo: apical ballooning
"https://cdn.orris.care/cdss_images/pmc_clinical_VQA_c6021993840345b8856726d8526734bbd273e014a562a1a7c11bf144d093da75.jpg",
// Slide 5 - Restrictive CM: pediatric echo
"https://cdn.orris.care/cdss_images/pmc_clinical_VQA_f77febd231498cfd8e8b8f3517742393aefa57e64d32c2283dbe134f5b82c6cb.jpg",
];
console.log("Fetching images...");
let images;
try {
const result = execSync(
`node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`,
{ timeout: 60000 }
).toString();
images = JSON.parse(result);
console.log("Images fetched:", images.map(i => i.error ? "ERROR: " + i.error : "OK"));
} catch (e) {
console.error("Image fetch failed:", e.message);
images = imageUrls.map(u => ({ url: u, base64: null, error: e.message }));
}
// ─── Theme ────────────────────────────────────────────────────────────────────
const BG = "0A1628"; // deep navy
const ACCENT1 = "1E88E5"; // medical blue
const ACCENT2 = "00BCD4"; // teal
const WHITE = "FFFFFF";
const LIGHT = "E3F2FD";
const BULLET_CLR= "90CAF9"; // soft blue bullet
const TITLE_CLR = "FFFFFF";
const SUBTTL = "90CAF9";
const BODY_CLR = "E8F4FD";
const DIM_CLR = "B0BEC5";
// A4 portrait: 8.27" × 11.69"
const W = 8.27;
const H = 11.69;
let pres = new pptxgen();
pres.layout = "LAYOUT_USER";
pres.defineLayout({ name: "A4_PORTRAIT", width: W, height: H });
pres.layout = "A4_PORTRAIT";
pres.author = "MBBS Student - Pediatric Cardiology";
pres.title = "Atypical Forms of Cardiomyopathy in Children and Adolescents";
// ─── Helper: draw a full-slide background ────────────────────────────────────
function addBackground(slide) {
// Gradient background: navy to dark blue
slide.addShape(pres.ShapeType.rect, {
x: 0, y: 0, w: W, h: H,
fill: { color: BG },
});
// Top accent bar
slide.addShape(pres.ShapeType.rect, {
x: 0, y: 0, w: W, h: 0.18,
fill: { color: ACCENT1 },
});
// Bottom accent bar
slide.addShape(pres.ShapeType.rect, {
x: 0, y: H - 0.18, w: W, h: 0.18,
fill: { color: ACCENT1 },
});
// Left vertical accent strip
slide.addShape(pres.ShapeType.rect, {
x: 0, y: 0.18, w: 0.08, h: H - 0.36,
fill: { color: ACCENT2 },
});
}
// ─── Helper: add slide number ─────────────────────────────────────────────────
function addPageNum(slide, num, total) {
slide.addText(`${num} / ${total}`, {
x: W - 1.0, y: H - 0.16, w: 0.9, h: 0.14,
fontSize: 7, color: WHITE, align: "right", valign: "middle",
});
}
// ─── Helper: section tag ──────────────────────────────────────────────────────
function addTag(slide, label) {
slide.addShape(pres.ShapeType.roundRect, {
x: 0.22, y: 0.22, w: 1.5, h: 0.22,
fill: { color: ACCENT1 },
line: { color: ACCENT1 },
rectRadius: 0.05,
});
slide.addText(label.toUpperCase(), {
x: 0.22, y: 0.22, w: 1.5, h: 0.22,
fontSize: 6.5, bold: true, color: WHITE,
align: "center", valign: "middle", margin: 0,
});
}
// ─── Helper: build 20 bullet objects ─────────────────────────────────────────
function bullets(lines, size = 9.5) {
return lines.map((line, i) => ({
text: line,
options: {
bullet: { type: "bullet", characterCode: "2022", indent: 10 },
color: BODY_CLR,
fontSize: size,
breakLine: i < lines.length - 1,
bold: false,
paraSpaceAfter: 1,
},
}));
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — Title / Overview
// ══════════════════════════════════════════════════════════════════════════════
{
const slide = pres.addSlide();
addBackground(slide);
addTag(slide, "Overview");
addPageNum(slide, 1, 5);
// Title block
slide.addShape(pres.ShapeType.rect, {
x: 0.18, y: 0.5, w: W - 0.36, h: 1.3,
fill: { color: "112244" },
line: { color: ACCENT1, pt: 1 },
});
slide.addText("Atypical Forms of Cardiomyopathy", {
x: 0.25, y: 0.53, w: W - 0.5, h: 0.55,
fontSize: 20, bold: true, color: WHITE, align: "center",
});
slide.addText("in Children and Adolescents", {
x: 0.25, y: 1.08, w: W - 0.5, h: 0.38,
fontSize: 14, color: ACCENT2, align: "center", italic: true,
});
slide.addText("4th Year MBBS | Pediatric Cardiology", {
x: 0.25, y: 1.48, w: W - 0.5, h: 0.22,
fontSize: 8.5, color: DIM_CLR, align: "center",
});
// Image (right column)
const imgX = 4.7, imgY = 2.0, imgW = 3.3, imgH = 3.0;
slide.addShape(pres.ShapeType.rect, {
x: imgX - 0.05, y: imgY - 0.05, w: imgW + 0.1, h: imgH + 0.1,
fill: { color: "0D1F3C" }, line: { color: ACCENT1, pt: 1.5 },
});
if (images[0] && !images[0].error) {
slide.addImage({ data: images[0].base64, x: imgX, y: imgY, w: imgW, h: imgH, sizing: { type: "contain", w: imgW, h: imgH } });
}
slide.addText("Pediatric Restrictive CM — Biatrial Enlargement (Echo)", {
x: imgX, y: imgY + imgH + 0.05, w: imgW, h: 0.2,
fontSize: 6, color: DIM_CLR, align: "center", italic: true,
});
// Bullets (left column)
const bLines = [
"Cardiomyopathy: primary myocardial disease with structural dysfunction",
"Annual incidence ~1 per 100,000 children in developed nations",
"Atypical forms: ARVC, LVNC, Takotsubo, Restrictive, & Mixed phenotypes",
"Dilated & hypertrophic types account for ~85% of pediatric cases",
"Atypical types are rarer but carry high morbidity & mortality",
"Genetic mutations in desmosomal & sarcomeric proteins are implicated",
"Presentations range from asymptomatic ECG changes to sudden death",
"Most atypical forms are underdiagnosed due to non-specific symptoms",
"Multi-modality imaging: echo, CMR, PET, and genetic testing essential",
"Pediatric onset before age 18 defines the scope of this discussion",
"Family history screening is crucial in all confirmed index cases",
"Distinguishing atypical forms requires high index of clinical suspicion",
"Exercise-related sudden cardiac death: first presentation in many cases",
"Metabolic & syndromic associations increase phenotypic complexity",
"Naxos disease: rare ARVC variant with palmoplantar keratoderma",
"Cardiac MRI: gold standard for tissue characterization in most types",
"Guidelines: AHA 2019 Classification — structure, function, & genetics",
"Heart transplantation may be required in refractory end-stage disease",
"Early referral to specialized pediatric cardiomyopathy centers advised",
"Slides 2–5 cover ARVC, LVNC, Takotsubo, and Restrictive CM in detail",
];
slide.addText(bullets(bLines, 9.0), {
x: 0.18, y: 2.0, w: 4.4, h: 7.5,
valign: "top", margin: [2, 4, 2, 4],
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — ARVC
// ══════════════════════════════════════════════════════════════════════════════
{
const slide = pres.addSlide();
addBackground(slide);
addTag(slide, "ARVC");
addPageNum(slide, 2, 5);
slide.addShape(pres.ShapeType.rect, {
x: 0.18, y: 0.5, w: W - 0.36, h: 0.65,
fill: { color: "112244" }, line: { color: ACCENT1, pt: 1 },
});
slide.addText("Arrhythmogenic Right Ventricular Cardiomyopathy (ARVC)", {
x: 0.25, y: 0.53, w: W - 0.5, h: 0.36,
fontSize: 15, bold: true, color: WHITE, align: "center",
});
slide.addText("Fibro-fatty replacement of RV myocardium | Autosomal dominant inheritance", {
x: 0.25, y: 0.90, w: W - 0.5, h: 0.2,
fontSize: 8, color: ACCENT2, align: "center", italic: true,
});
// Image
const imgX = 4.7, imgY = 1.3, imgW = 3.3, imgH = 3.2;
slide.addShape(pres.ShapeType.rect, {
x: imgX - 0.05, y: imgY - 0.05, w: imgW + 0.1, h: imgH + 0.1,
fill: { color: "0D1F3C" }, line: { color: ACCENT1, pt: 1.5 },
});
if (images[1] && !images[1].error) {
slide.addImage({ data: images[1].base64, x: imgX, y: imgY, w: imgW, h: imgH, sizing: { type: "contain", w: imgW, h: imgH } });
}
slide.addText("Cardiac MRI: RV dilation & fibrofatty infiltration in ARVC", {
x: imgX, y: imgY + imgH + 0.04, w: imgW, h: 0.2,
fontSize: 6, color: DIM_CLR, align: "center", italic: true,
});
const bLines = [
"Prevalence: 1 in 1,000–5,000 in general population; underdiagnosed in children",
"Pathology: fibrofatty replacement of RV free wall myocardium",
"Genetics: mutations in desmosomal genes (PKP2, DSP, DSG2, DSC2, JUP)",
"Naxos disease: biallelic JUP mutation — cardiomyopathy + curly hair + keratoderma",
"Biventricular involvement increasingly recognized; LV-dominant variants exist",
"Symptoms: palpitations, syncope, exertional chest pain, sudden cardiac death",
"ECG hallmark: T-wave inversions in V1–V4; Epsilon wave in lead V1",
"Late potentials detectable on signal-averaged ECG (SAECG)",
"Echo: RV dilation, wall thinning, regional akinesia, trabecular derangement",
"Cardiac MRI: fibrofatty infiltration, LGE in RV free wall — diagnostic gold standard",
"2010 Revised Task Force Criteria: major & minor criteria across imaging, ECG, genetics",
"Risk stratification: family history of SCD, extensive RV dysfunction, syncope",
"High-intensity exercise worsens phenotypic expression — sport restriction mandatory",
"Management: ICD implantation for high-risk patients with ventricular arrhythmia",
"Antiarrhythmics: sotalol, amiodarone, beta-blockers for symptomatic VT",
"Catheter ablation: palliative for recurrent VT unresponsive to pharmacotherapy",
"Heart failure therapy: diuretics, ACE inhibitors in biventricular dysfunction",
"Genetic cascade screening of all first-degree relatives mandatory",
"Prognosis: progressive disease; transplant-free survival reduced in pediatric onset",
"Differential: normal RV trabeculation, cardiac sarcoid, myocarditis, Uhl anomaly",
];
slide.addText(bullets(bLines, 8.8), {
x: 0.18, y: 1.3, w: 4.4, h: 7.5,
valign: "top", margin: [2, 4, 2, 4],
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — LVNC
// ══════════════════════════════════════════════════════════════════════════════
{
const slide = pres.addSlide();
addBackground(slide);
addTag(slide, "LVNC");
addPageNum(slide, 3, 5);
slide.addShape(pres.ShapeType.rect, {
x: 0.18, y: 0.5, w: W - 0.36, h: 0.65,
fill: { color: "112244" }, line: { color: ACCENT1, pt: 1 },
});
slide.addText("Left Ventricular Non-Compaction Cardiomyopathy (LVNC)", {
x: 0.25, y: 0.53, w: W - 0.5, h: 0.36,
fontSize: 15, bold: true, color: WHITE, align: "center",
});
slide.addText("Arrest of normal compaction of fetal myocardium | Spongy two-layered myocardium", {
x: 0.25, y: 0.90, w: W - 0.5, h: 0.2,
fontSize: 8, color: ACCENT2, align: "center", italic: true,
});
// Image
const imgX = 4.7, imgY = 1.3, imgW = 3.3, imgH = 3.2;
slide.addShape(pres.ShapeType.rect, {
x: imgX - 0.05, y: imgY - 0.05, w: imgW + 0.1, h: imgH + 0.1,
fill: { color: "0D1F3C" }, line: { color: ACCENT1, pt: 1.5 },
});
if (images[2] && !images[2].error) {
slide.addImage({ data: images[2].base64, x: imgX, y: imgY, w: imgW, h: imgH, sizing: { type: "contain", w: imgW, h: imgH } });
}
slide.addText("Echo: non-compacted/compacted ratio >2:1 — diagnostic of LVNC", {
x: imgX, y: imgY + imgH + 0.04, w: imgW, h: 0.2,
fontSize: 6, color: DIM_CLR, align: "center", italic: true,
});
const bLines = [
"Definition: failure of compaction of loose myocardial meshwork in embryogenesis",
"Characterized by prominent LV trabeculations & deep intertrabecular recesses",
"Two-layered myocardium: thin outer compacted + thick inner non-compacted layer",
"Prevalence: ~0.14% in echocardiographic studies; most common in children",
"Associated genes: MYH7, ACTC1, TNNT2, LMNA, SCN5A, TAZ (Barth syndrome)",
"X-linked Barth syndrome: LVNC + dilated CM + cyclic neutropenia in boys",
"May present as isolated LVNC or overlap with DCM, HCM, or congenital HD",
"Clinical triad: heart failure, arrhythmia, and thromboembolic complications",
"Symptoms: dyspnea, exercise intolerance, palpitations, stroke in young patients",
"Jenni echo criteria: NC/C ratio >2:1 at end-systole in short-axis view",
"Petersen CMR criteria: NC/C ratio >2.3 in diastole on multiple segments",
"Color Doppler: blood flow into intertrabecular recesses from LV cavity",
"ECG: LVH pattern, bundle branch blocks, WPW syndrome, VT",
"Cardiac MRI: LGE in compacted layer — associated with adverse outcomes",
"Thromboembolic risk: anticoagulation with warfarin in EF <40% or AF",
"Beta-blockers & ACE inhibitors: standard HFrEF management in LVNC",
"ICD: indicated for LVEF <35% or sustained ventricular arrhythmia",
"Genetic counseling & family screening essential — autosomal dominant in many",
"Spontaneous improvement of LV function reported in some pediatric patients",
"Prognosis: worse in symptomatic pediatric patients; transplant in 10–15% cases",
];
slide.addText(bullets(bLines, 8.8), {
x: 0.18, y: 1.3, w: 4.4, h: 7.5,
valign: "top", margin: [2, 4, 2, 4],
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — Takotsubo / Stress CM
// ══════════════════════════════════════════════════════════════════════════════
{
const slide = pres.addSlide();
addBackground(slide);
addTag(slide, "Takotsubo");
addPageNum(slide, 4, 5);
slide.addShape(pres.ShapeType.rect, {
x: 0.18, y: 0.5, w: W - 0.36, h: 0.65,
fill: { color: "112244" }, line: { color: ACCENT1, pt: 1 },
});
slide.addText("Takotsubo / Stress-Induced Cardiomyopathy in Children", {
x: 0.25, y: 0.53, w: W - 0.5, h: 0.36,
fontSize: 15, bold: true, color: WHITE, align: "center",
});
slide.addText("Transient apical LV ballooning | Catecholamine-mediated myocardial stunning", {
x: 0.25, y: 0.90, w: W - 0.5, h: 0.2,
fontSize: 8, color: ACCENT2, align: "center", italic: true,
});
// Image
const imgX = 4.7, imgY = 1.3, imgW = 3.3, imgH = 3.2;
slide.addShape(pres.ShapeType.rect, {
x: imgX - 0.05, y: imgY - 0.05, w: imgW + 0.1, h: imgH + 0.1,
fill: { color: "0D1F3C" }, line: { color: ACCENT1, pt: 1.5 },
});
if (images[3] && !images[3].error) {
slide.addImage({ data: images[3].base64, x: imgX, y: imgY, w: imgW, h: imgH, sizing: { type: "contain", w: imgW, h: imgH } });
}
slide.addText("Echo A4C view: apical ballooning — hallmark of Takotsubo syndrome", {
x: imgX, y: imgY + imgH + 0.04, w: imgW, h: 0.2,
fontSize: 6, color: DIM_CLR, align: "center", italic: true,
});
const bLines = [
"First described in Japan 1990 — named after octopus-trap shape of LV",
"Rare in children (<1% of all paediatric acute coronary-like presentations)",
"Pathophysiology: catecholamine surge → microvascular spasm → myocardial stunning",
"Triggers: physical stress, surgery, pheochromocytoma, intracranial haemorrhage",
"Emotional triggers: grief, fear, acute psychological trauma in adolescents",
"Variants: apical (most common), mid-ventricular, basal, and focal subtypes",
"Clinical features: acute chest pain, dyspnea, ST elevation mimicking STEMI",
"ECG: STE in anterior leads, followed by deep T-wave inversions (evolution)",
"Troponin elevation: modest, disproportionately low relative to ECG changes",
"Echo hallmark: apical ballooning with hypercontractile basal segments",
"Coronary angiography: non-obstructive coronaries — essential to exclude ACS",
"Cardiac MRI: LGE absent (distinguishes from MI); edema pattern in stunned myocardium",
"BNP/NT-proBNP markedly elevated due to acute LV dysfunction",
"Complications: acute HF, cardiogenic shock, LVOT obstruction, thrombus formation",
"InterTAK Registry: mortality ~2% in hospital; pediatric series show full recovery",
"Management: supportive care — diuretics, cautious vasopressors (avoid catecholamines)",
"Beta-blockers: theoretical benefit; avoid if LVOT obstruction is present",
"Anticoagulation: consider heparin if LV thrombus detected on imaging",
"Recovery: LV function normalizes within 4–8 weeks in majority of pediatric cases",
"Prognosis: excellent short-term; recurrence rate ~5%; long-term follow-up advised",
];
slide.addText(bullets(bLines, 8.8), {
x: 0.18, y: 1.3, w: 4.4, h: 7.5,
valign: "top", margin: [2, 4, 2, 4],
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — Restrictive CM + Summary
// ══════════════════════════════════════════════════════════════════════════════
{
const slide = pres.addSlide();
addBackground(slide);
addTag(slide, "Restrictive CM");
addPageNum(slide, 5, 5);
slide.addShape(pres.ShapeType.rect, {
x: 0.18, y: 0.5, w: W - 0.36, h: 0.65,
fill: { color: "112244" }, line: { color: ACCENT1, pt: 1 },
});
slide.addText("Restrictive Cardiomyopathy & Clinical Summary", {
x: 0.25, y: 0.53, w: W - 0.5, h: 0.36,
fontSize: 15, bold: true, color: WHITE, align: "center",
});
slide.addText("Impaired diastolic filling | Normal or near-normal LV systolic function | High filling pressures", {
x: 0.25, y: 0.90, w: W - 0.5, h: 0.2,
fontSize: 8, color: ACCENT2, align: "center", italic: true,
});
// Image
const imgX = 4.7, imgY = 1.3, imgW = 3.3, imgH = 3.2;
slide.addShape(pres.ShapeType.rect, {
x: imgX - 0.05, y: imgY - 0.05, w: imgW + 0.1, h: imgH + 0.1,
fill: { color: "0D1F3C" }, line: { color: ACCENT1, pt: 1.5 },
});
if (images[4] && !images[4].error) {
slide.addImage({ data: images[4].base64, x: imgX, y: imgY, w: imgW, h: imgH, sizing: { type: "contain", w: imgW, h: imgH } });
}
slide.addText("Restrictive CM: biatrial dilation with normal LV size (Echo A4C)", {
x: imgX, y: imgY + imgH + 0.04, w: imgW, h: 0.2,
fontSize: 6, color: DIM_CLR, align: "center", italic: true,
});
const bLines = [
"RCM: rare (~5% of pediatric CMs); worst prognosis of all childhood cardiomyopathies",
"Pathology: stiff non-compliant ventricles → elevated filling pressures → biatrial dilation",
"Idiopathic RCM is most common; secondary causes: amyloidosis, sarcoidosis, hypereosinophilia",
"Genetic causes: TNNI3, TPM1, MYH7, FLNC mutations; some overlap with HCM",
"Hallmark Echo: massively dilated atria with normal LV cavity size and preserved EF",
"Doppler echo: restrictive filling pattern — E/A ratio >2, short deceleration time (<150 ms)",
"Tissue Doppler: e' velocity markedly reduced; E/e' ratio >15 indicates elevated LVEDP",
"CMR: LGE may be present in infiltrative forms; helpful for differential diagnosis",
"Chest X-ray: cardiomegaly due to massive atrial enlargement, pulmonary venous congestion",
"Symptoms: exercise intolerance, dyspnea, orthopnea, ascites, peripheral edema",
"Arrhythmias: atrial fibrillation/flutter common due to severe atrial remodeling",
"Thromboembolic risk high — anticoagulation recommended in AF or atrial thrombus",
"Pulmonary arterial hypertension develops over time — poor prognostic marker",
"Medical therapy: diuretics for volume overload; no disease-modifying agents available",
"Cardiac transplantation: only curative option; listed early given rapid deterioration",
"5-year survival without transplant: ~50% in pediatric idiopathic RCM",
"Summary — ARVC: fibrofatty RV replacement, desmosomal genes, epsilon wave, ICD",
"Summary — LVNC: spongy two-layer LV, arrest of compaction, NC/C ratio >2:1",
"Summary — Takotsubo: apical ballooning, catecholamine surge, full recovery expected",
"All atypical CMs: genetic counseling, multi-modality imaging, specialist centre referral",
];
slide.addText(bullets(bLines, 8.8), {
x: 0.18, y: 1.3, w: 4.4, h: 7.5,
valign: "top", margin: [2, 4, 2, 4],
});
}
// ─── Save ─────────────────────────────────────────────────────────────────────
const outPath = "/home/daytona/workspace/cardiomyopathy-pptx/Atypical_Cardiomyopathy_Children.pptx";
pres.writeFile({ fileName: outPath })
.then(() => console.log("Saved:", outPath))
.catch(e => { console.error("Save error:", e); process.exit(1); });
cd /home/daytona/workspace/cardiomyopathy-pptx && node build.js 2>&1
~/cardiomyopathy-pptx/build.js
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/cardiomyopathy-pptx/build.js'
cd /home/daytona/workspace/cardiomyopathy-pptx && node build.js 2>&1
Atypical Cardiomyopathy Children
Presentation · PPTX
| Slide | Topic | Clinical Image |
|---|---|---|
| 1 | Overview & Introduction | Pediatric Restrictive CM — biatrial enlargement (Echo) |
| 2 | ARVC (Arrhythmogenic RV Cardiomyopathy) | Cardiac MRI — fibrofatty infiltration, RV dilation |
| 3 | LVNC (Left Ventricular Non-Compaction) | Echo — NC/C ratio >2:1, color Doppler in recesses |
| 4 | Takotsubo / Stress CM | Echo A4C — classic apical ballooning pattern |
| 5 | Restrictive CM + Summary | Echo — biatrial dilation, normal LV cavity |
I want to take print so make it as a perfect a4 size pdf . I want every line in bullet point with perfect alignment and also change the colour and design make it better
mkdir -p /home/daytona/workspace/cardiomyopathy-pdf/images && \ curl -sL "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_24ebe5d5c428d8222d2f458d7b08c986c1c4f84a18fb4e230f5839fa71b2addd.jpg" -o /home/daytona/workspace/cardiomyopathy-pdf/images/slide1.jpg && \ curl -sL "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_ccef375d42502a4932535f5fd1be880aeaf424994e8a3739b42f1dba5c0d308a.jpg" -o /home/daytona/workspace/cardiomyopathy-pdf/images/slide2.jpg && \ curl -sL "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_b14e87c30825e40d443dba222c70996ccd7abeceedba0d846c27a8d6cff5e093.jpg" -o /home/daytona/workspace/cardiomyopathy-pdf/images/slide3.jpg && \ curl -sL "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_c6021993840345b8856726d8526734bbd273e014a562a1a7c11bf144d093da75.jpg" -o /home/daytona/workspace/cardiomyopathy-pdf/images/slide4.jpg && \ curl -sL "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_f77febd231498cfd8e8b8f3517742393aefa57e64d32c2283dbe134f5b82c6cb.jpg" -o /home/daytona/workspace/cardiomyopathy-pdf/images/slide5.jpg && \ ls -lh /home/daytona/workspace/cardiomyopathy-pdf/images/
~/cardiomyopathy-pdf/build_pdf.py
"""
A4 Print-Ready PDF — Atypical Cardiomyopathy in Children & Adolescents
Premium redesign: forest-green/gold medical theme
5 pages, 20 perfectly-aligned bullet points per page, clinical images
"""
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import mm, cm
from reportlab.lib.colors import HexColor, white, black
from reportlab.pdfgen import canvas
from reportlab.lib.utils import ImageReader
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
import os, textwrap
# ── Output ────────────────────────────────────────────────────────────────────
OUT = "/home/daytona/workspace/cardiomyopathy-pdf/Atypical_Cardiomyopathy_A4.pdf"
IMGS = "/home/daytona/workspace/cardiomyopathy-pdf/images"
# ── Palette (deep teal + gold + white — clean medical print) ─────────────────
C_BG = HexColor("#0B2027") # very dark teal (page background)
C_HEADER = HexColor("#0D3B47") # slightly lighter header block
C_ACCENT1 = HexColor("#1B7A8C") # teal accent
C_ACCENT2 = HexColor("#C8A84B") # gold accent
C_TITLE = HexColor("#FFFFFF") # white title text
C_SUBTITLE = HexColor("#C8A84B") # gold subtitle
C_BODY = HexColor("#E8F4F7") # near-white body text
C_BULLET = HexColor("#1FC8E3") # bright cyan bullet dot
C_DIM = HexColor("#8BADB5") # muted caption text
C_TAG_BG = HexColor("#C8A84B") # gold tag background
C_TAG_TEXT = HexColor("#0B2027") # dark tag text
C_RULE = HexColor("#1B7A8C") # horizontal rule
C_IMG_BORD = HexColor("#C8A84B") # gold image border
C_PGNUM = HexColor("#C8A84B") # page number
W, H = A4 # 595.27 x 841.89 pts
# ── Margins ───────────────────────────────────────────────────────────────────
ML = 18*mm # left margin
MR = 18*mm
MT = 18*mm
MB = 14*mm
# ── Font sizes ────────────────────────────────────────────────────────────────
FS_MAINTITLE = 18
FS_SUBTITLE = 9
FS_META = 7.5
FS_TAG = 7
FS_SECTITLE = 14
FS_SUBSEC = 8
FS_BULLET = 8.2
FS_CAPTION = 6.2
FS_PGNUM = 7.5
# ── Slide data ────────────────────────────────────────────────────────────────
slides = [
{
"tag": "OVERVIEW",
"title": "Atypical Forms of Cardiomyopathy",
"subtitle": "in Children and Adolescents",
"meta": "4th Year MBBS · Pediatric Cardiology · 2026",
"img": "slide1.jpg",
"img_caption": "Pediatric Restrictive CM — Massive Biatrial Enlargement (Echo A4C)",
"bullets": [
"Cardiomyopathy: primary myocardial disease with structural and/or electrical dysfunction",
"Annual incidence: ~1 per 100,000 children; higher in infants under 2 years of age",
"Atypical forms include ARVC, LVNC, Takotsubo, Restrictive CM, and mixed phenotypes",
"Dilated and hypertrophic cardiomyopathy account for ~85% of all pediatric cases",
"Atypical types are rarer but carry disproportionately high morbidity and mortality",
"Genetic mutations in desmosomal, sarcomeric, and cytoskeletal proteins are key drivers",
"Presentations range from asymptomatic ECG changes to sudden cardiac death (SCD)",
"Most atypical forms are underdiagnosed due to nonspecific or insidious symptoms",
"Multi-modality imaging: echocardiography, CMR, PET, and CT all play diagnostic roles",
"Pediatric onset is defined as presentation before the age of 18 years",
"Family history screening is mandatory in all confirmed index cases of CM",
"Distinguishing atypical from typical forms requires high index of clinical suspicion",
"Exercise-related SCD may be the first clinical presentation in ARVC and LVNC",
"Metabolic, syndromic, and neuromuscular associations increase phenotypic complexity",
"Naxos disease: rare ARVC variant with palmoplantar keratoderma and woolly hair",
"Cardiac MRI with LGE: gold standard for tissue characterisation in most subtypes",
"AHA 2019 Classification: based on structure, function, genetics, and clinical phenotype",
"Heart transplantation remains the only curative option in refractory end-stage disease",
"Early referral to a specialised paediatric cardiomyopathy centre is strongly recommended",
"Slides 2–5 cover ARVC, LVNC, Takotsubo, and Restrictive CM individually in detail",
],
},
{
"tag": "ARVC",
"title": "Arrhythmogenic Right Ventricular",
"subtitle": "Cardiomyopathy (ARVC)",
"meta": "Fibro-fatty replacement of RV myocardium · Autosomal dominant inheritance",
"img": "slide2.jpg",
"img_caption": "Cardiac MRI: RV dilation with fibrofatty infiltration — hallmark of ARVC",
"bullets": [
"Prevalence: 1 in 1,000–5,000 in the general population; commonly underdiagnosed in children",
"Pathology: progressive fibro-fatty replacement of right ventricular myocardium",
"Genetics: mutations in desmosomal genes — PKP2, DSP, DSG2, DSC2, and JUP",
"PKP2 (plakophilin-2) is the most common mutation, accounting for ~40% of cases",
"Naxos disease: biallelic JUP mutation — ARVC + woolly hair + palmoplantar keratoderma",
"Biventricular involvement is increasingly recognised; LV-dominant variants exist",
"Symptoms: palpitations, exertional syncope, chest pain, sustained VT, sudden death",
"ECG hallmark: T-wave inversions in precordial leads V1–V4; epsilon wave in V1",
"Late potentials detectable on signal-averaged ECG (SAECG) in early disease",
"Echocardiography: RV dilation, free wall thinning, regional akinesia, trabecular derangement",
"Cardiac MRI: fibro-fatty infiltration with LGE in RV free wall — diagnostic gold standard",
"2010 Revised Task Force Criteria: major/minor categories across imaging, ECG, and genetics",
"Risk stratification: family SCD history, extensive RV dysfunction, recurrent syncope",
"High-intensity exercise accelerates phenotypic expression — sport restriction is mandatory",
"ICD implantation: recommended for patients with documented sustained ventricular arrhythmia",
"Antiarrhythmics: sotalol, amiodarone, and beta-blockers used for recurrent symptomatic VT",
"Catheter ablation: palliative option for drug-refractory recurrent ventricular tachycardia",
"Heart failure therapy: diuretics and ACEi/ARB in biventricular dysfunction phenotype",
"Genetic cascade screening of all first-degree relatives is mandatory after index diagnosis",
"Differential: normal RV trabeculation, sarcoidosis, myocarditis, Uhl anomaly, DCM",
],
},
{
"tag": "LVNC",
"title": "Left Ventricular Non-Compaction",
"subtitle": "Cardiomyopathy (LVNC)",
"meta": "Arrest of fetal myocardial compaction · Spongy two-layered ventricular wall",
"img": "slide3.jpg",
"img_caption": "Echo: NC/C ratio 3.27:1 with color Doppler flow in recesses — diagnostic LVNC",
"bullets": [
"Definition: failure of compaction of the loose myocardial meshwork during embryogenesis",
"Characterised by prominent LV trabeculations with deep intertrabecular recesses",
"Two-layered myocardium: thin compacted outer layer + thick non-compacted inner layer",
"Prevalence: ~0.14% in echocardiographic series; among the most common in children",
"Associated genes: MYH7, ACTC1, TNNT2, LMNA, SCN5A, MYBPC3, and TAZ",
"X-linked Barth syndrome: TAZ mutation — LVNC + dilated CM + cyclic neutropenia in boys",
"May occur as isolated LVNC or overlap with DCM, HCM, or congenital heart disease",
"Clinical triad: heart failure, arrhythmia, and systemic thromboembolic complications",
"Symptoms: dyspnea, exercise intolerance, palpitations, stroke in young patients",
"Jenni echo criteria: NC/C ratio >2:1 at end-systole in the short-axis (PSAX) view",
"Petersen CMR criteria: NC/C ratio >2.3 in diastole across multiple myocardial segments",
"Color Doppler: blood flow into deep intertrabecular recesses from the LV cavity confirmed",
"ECG: LVH pattern, LBBB, WPW syndrome, QTc prolongation, and ventricular ectopy",
"CMR LGE in compacted layer: associated with increased risk of adverse clinical outcomes",
"Anticoagulation with warfarin: indicated if LVEF <40%, atrial fibrillation, or LV thrombus",
"Beta-blockers and ACEi: standard HFrEF management applicable to symptomatic LVNC",
"ICD: indicated for LVEF <35% or documented sustained ventricular arrhythmia",
"Genetic counselling and first-degree family screening essential — mostly autosomal dominant",
"Spontaneous improvement of LV function is documented in some paediatric LVNC patients",
"Prognosis: worse in symptomatic children; cardiac transplantation required in 10–15%",
],
},
{
"tag": "TAKOTSUBO",
"title": "Takotsubo / Stress-Induced",
"subtitle": "Cardiomyopathy in Children",
"meta": "Transient apical LV ballooning · Catecholamine-mediated myocardial stunning",
"img": "slide4.jpg",
"img_caption": "Echo A4C: apical ballooning with hypercontractile basal segments — classic Takotsubo",
"bullets": [
"First described in Japan in 1990 — named after the octopus-trap shape of the left ventricle",
"Rare in children — accounts for <1% of acute coronary-like presentations in paediatrics",
"Pathophysiology: catecholamine surge → microvascular spasm → reversible myocardial stunning",
"Physical triggers: surgery, trauma, pheochromocytoma, subarachnoid haemorrhage",
"Emotional triggers: grief, acute fear, or severe psychological stress in adolescents",
"Variants: apical (most common), mid-ventricular, basal (inverted), and focal subtypes",
"Clinical features: acute chest pain, dyspnea, ST elevation mimicking anterior STEMI",
"ECG evolution: initial ST elevation → deep diffuse T-wave inversions → QT prolongation",
"Troponin rise is modest — disproportionately low relative to the degree of ECG changes",
"Echo hallmark: apical LV ballooning + hypercontractile basal segment disparity",
"Coronary angiography: non-obstructive coronaries — essential to definitively exclude ACS",
"CMR: absent LGE (distinguishes from MI); myocardial oedema pattern in stunned segments",
"BNP/NT-proBNP: markedly elevated secondary to acute left ventricular dysfunction",
"Complications: acute HF, cardiogenic shock, LVOT obstruction, LV thrombus formation",
"InterTAK Registry: in-hospital mortality ~2%; paediatric series demonstrate full recovery",
"Management: supportive care — diuretics for congestion; cautious vasopressors if shocked",
"Avoid catecholamine vasopressors (adrenaline/noradrenaline) — worsens catecholamine storm",
"Beta-blockers: theoretical benefit via catecholamine blockade; avoid if LVOT obstruction present",
"Anticoagulation with heparin: indicated if LV thrombus detected on echocardiography or CMR",
"Prognosis: excellent short-term; LV function recovers within 4–8 weeks; recurrence ~5%",
],
},
{
"tag": "RESTRICTIVE CM",
"title": "Restrictive Cardiomyopathy &",
"subtitle": "Clinical Summary",
"meta": "Stiff non-compliant ventricles · Normal EF · Elevated filling pressures · Biatrial dilation",
"img": "slide5.jpg",
"img_caption": "Pediatric RCM: massive biatrial enlargement with preserved ventricular size (Echo A4C)",
"bullets": [
"RCM: rare (~5% of paediatric CMs); carries the worst prognosis of all childhood cardiomyopathies",
"Pathology: stiff non-compliant ventricles → elevated filling pressures → massive biatrial dilation",
"Idiopathic RCM is most common; secondary causes: amyloidosis, sarcoidosis, hypereosinophilia",
"Genetic causes: TNNI3, TPM1, MYH7, FLNC mutations; overlap with HCM phenotype seen",
"Hallmark echocardiogram: massively dilated atria with normal LV cavity size and preserved EF",
"Doppler echo: restrictive filling — E/A ratio >2, deceleration time <150 ms in early disease",
"Tissue Doppler: markedly reduced e' velocity; E/e' ratio >15 indicates elevated LVEDP",
"CMR: LGE present in infiltrative forms; essential for tissue characterisation and aetiology",
"Chest X-ray: cardiomegaly from atrial enlargement; pulmonary venous congestion pattern",
"Symptoms: exertional dyspnea, orthopnea, ascites, hepatomegaly, and peripheral oedema",
"Arrhythmias: AF and atrial flutter are common secondary to severe chronic atrial remodelling",
"Thromboembolic risk is high — anticoagulation recommended in AF or documented atrial thrombus",
"Pulmonary arterial hypertension develops progressively — a major adverse prognostic marker",
"Medical therapy: diuretics for volume overload; no disease-modifying agents currently available",
"Cardiac transplantation: the only curative option; early listing given rapid clinical deterioration",
"5-year survival without transplantation: approximately 50% in paediatric idiopathic RCM",
"SUMMARY — ARVC: fibro-fatty RV replacement, desmosomal genes, epsilon wave, ICD therapy",
"SUMMARY — LVNC: spongy two-layer LV wall, compaction failure, NC/C >2:1 on echo/CMR",
"SUMMARY — Takotsubo: apical ballooning, catecholamine surge, full recovery expected",
"ALL TYPES: genetic counselling, multi-modality imaging, specialised paediatric centre referral",
],
},
]
# ── Canvas helpers ────────────────────────────────────────────────────────────
def draw_background(c):
c.setFillColor(C_BG)
c.rect(0, 0, W, H, fill=1, stroke=0)
def draw_top_bar(c):
# Gold top rule
c.setFillColor(C_ACCENT2)
c.rect(0, H - 6*mm, W, 6*mm, fill=1, stroke=0)
# Teal accent line below gold bar
c.setFillColor(C_ACCENT1)
c.rect(0, H - 7.5*mm, W, 1.5*mm, fill=1, stroke=0)
def draw_bottom_bar(c, page_num, total):
# Teal rule above footer
c.setFillColor(C_ACCENT1)
c.rect(0, MB - 1*mm, W, 1.2*mm, fill=1, stroke=0)
# Bottom dark strip
c.setFillColor(C_HEADER)
c.rect(0, 0, W, MB - 1*mm, fill=1, stroke=0)
# Left label
c.setFillColor(C_DIM)
c.setFont("Helvetica", FS_PGNUM - 1)
c.drawString(ML, 4.5*mm, "MBBS Paediatric Cardiology · 2026")
# Centre topic line
c.setFillColor(C_ACCENT2)
c.setFont("Helvetica-Bold", FS_PGNUM - 0.5)
label = "Atypical Cardiomyopathy in Children & Adolescents"
c.drawCentredString(W/2, 4.5*mm, label)
# Right page num
c.setFillColor(C_PGNUM)
c.setFont("Helvetica-Bold", FS_PGNUM)
c.drawRightString(W - MR, 4.5*mm, f"Page {page_num} of {total}")
def draw_left_accent(c):
c.setFillColor(C_ACCENT1)
c.rect(0, MB + 2*mm, 3.5*mm, H - MB - 8*mm - 2*mm, fill=1, stroke=0)
def draw_tag(c, label, y):
tag_w = len(label) * 4.2 + 12
tag_h = 12
rx = ML + 2*mm
# Gold rounded rect
c.setFillColor(C_TAG_BG)
c.roundRect(rx, y, tag_w, tag_h, 3, fill=1, stroke=0)
c.setFillColor(C_TAG_TEXT)
c.setFont("Helvetica-Bold", FS_TAG)
c.drawString(rx + 5, y + 3.5, label)
return tag_w
def rounded_rect_path(c, x, y, w, h, r):
from reportlab.lib.pagesizes import A4
p = c.beginPath()
p.moveTo(x + r, y)
p.lineTo(x + w - r, y)
p.arcTo(x + w - 2*r, y, x + w, y + 2*r, -90, 90)
p.lineTo(x + w, y + h - r)
p.arcTo(x + w - 2*r, y + h - 2*r, x + w, y + h, 0, 90)
p.lineTo(x + r, y + h)
p.arcTo(x, y + h - 2*r, x + 2*r, y + h, 90, 90)
p.lineTo(x, y + r)
p.arcTo(x, y, x + 2*r, y + 2*r, 180, 90)
p.close()
return p
def draw_title_block(c, title, subtitle, meta, tag, page_num):
# Draw tag first
tag_y = H - 7.5*mm - 12 - 3*mm
draw_tag(c, tag, tag_y)
# Header block
block_x = ML + 2*mm
block_y = H - 7.5*mm - 12 - 3*mm - 38*mm
block_w = W - ML - MR - 4*mm
block_h = 34*mm
c.setFillColor(C_HEADER)
c.roundRect(block_x, block_y, block_w, block_h, 5, fill=1, stroke=0)
# Gold left strip on header
c.setFillColor(C_ACCENT2)
c.rect(block_x, block_y, 3*mm, block_h, fill=1, stroke=0)
# Title line 1
c.setFillColor(C_TITLE)
c.setFont("Helvetica-Bold", FS_MAINTITLE)
c.drawCentredString(W/2, block_y + block_h - 12*mm, title)
# Subtitle line 2 (gold)
c.setFillColor(C_SUBTITLE)
c.setFont("Helvetica-Bold", FS_MAINTITLE - 2)
c.drawCentredString(W/2, block_y + block_h - 20*mm, subtitle)
# Meta line (muted)
c.setFillColor(C_DIM)
c.setFont("Helvetica-Oblique", FS_META)
c.drawCentredString(W/2, block_y + block_h - 27*mm, meta)
# Gold horizontal rule below header
c.setStrokeColor(C_ACCENT2)
c.setLineWidth(1.2)
c.line(block_x + 6*mm, block_y - 3, block_x + block_w - 6*mm, block_y - 3)
return block_y # returns bottom y of header block
def draw_image_box(c, img_path, caption, x, y, w, h):
# Gold outer border
c.setStrokeColor(C_IMG_BORD)
c.setLineWidth(1.5)
c.roundRect(x - 1.5, y - 1.5, w + 3, h + 3, 4, fill=0, stroke=1)
# Dark inner bg
c.setFillColor(C_HEADER)
c.roundRect(x, y, w, h, 3, fill=1, stroke=0)
# Draw image
try:
img = ImageReader(img_path)
iw, ih = img.getSize()
# Scale keeping aspect ratio
scale = min(w / iw, h / ih)
diw, dih = iw * scale, ih * scale
ox = x + (w - diw) / 2
oy = y + (h - dih) / 2
c.drawImage(img_path, ox, oy, width=diw, height=dih, mask='auto')
except Exception as e:
c.setFillColor(C_DIM)
c.setFont("Helvetica", 7)
c.drawCentredString(x + w/2, y + h/2, f"[Image: {e}]")
# Caption below image
c.setFillColor(C_DIM)
c.setFont("Helvetica-Oblique", FS_CAPTION)
# Wrap caption if needed
max_chars = int(w / (FS_CAPTION * 0.45))
wrapped = textwrap.fill(caption, max_chars)
lines = wrapped.split('\n')
cap_y = y - 3.5*mm
for i, ln in enumerate(lines):
c.drawCentredString(x + w/2, cap_y - i * (FS_CAPTION + 1), ln)
def draw_bullets(c, bullets_list, x, y_top, col_w, row_h=13.5):
"""Draw 20 bullets with perfect alignment."""
bullet_char = "\u2022"
indent = 9 # px indent for text after bullet
bullet_x = x + 4*mm
text_x = bullet_x + indent
text_w = col_w - 4*mm - indent - 2*mm
# Column header rule
c.setStrokeColor(C_ACCENT1)
c.setLineWidth(0.5)
c.line(x + 2*mm, y_top + 2, x + col_w - 2*mm, y_top + 2)
for i, line in enumerate(bullets_list):
cy = y_top - (i + 0.8) * row_h
# Alternating subtle row tint
if i % 2 == 0:
c.setFillColor(HexColor("#0D2D3A"))
c.rect(x + 1*mm, cy - 2.5, col_w - 2*mm, row_h - 0.5, fill=1, stroke=0)
# Bullet dot (cyan)
c.setFillColor(C_BULLET)
c.circle(bullet_x, cy + 3, 2, fill=1, stroke=0)
# Number badge (gold) for every 5th line
if (i + 1) % 5 == 0:
badge_x = x + col_w - 6*mm
c.setFillColor(C_ACCENT2)
c.circle(badge_x, cy + 3, 4, fill=1, stroke=0)
c.setFillColor(C_TAG_TEXT)
c.setFont("Helvetica-Bold", 5.5)
c.drawCentredString(badge_x, cy + 1.2, str(i + 1))
# Text — truncate if needed
c.setFillColor(C_BODY)
c.setFont("Helvetica", FS_BULLET)
# Measure and truncate to fit
max_chars = int(text_w / (FS_BULLET * 0.52))
display_line = line if len(line) <= max_chars else line[:max_chars - 2] + "…"
c.drawString(text_x, cy, display_line)
# Thin separator line
c.setStrokeColor(HexColor("#1A3A48"))
c.setLineWidth(0.3)
c.line(text_x, cy - 2, x + col_w - 2*mm, cy - 2)
# ── Build PDF ─────────────────────────────────────────────────────────────────
c = canvas.Canvas(OUT, pagesize=A4)
c.setTitle("Atypical Cardiomyopathy in Children and Adolescents")
c.setAuthor("MBBS Student – Paediatric Cardiology")
c.setSubject("Medical Education – Paediatric Cardiology")
TOTAL = len(slides)
for pg_idx, slide in enumerate(slides):
draw_background(c)
draw_top_bar(c)
draw_left_accent(c)
draw_bottom_bar(c, pg_idx + 1, TOTAL)
header_bottom = draw_title_block(
c,
slide["title"],
slide["subtitle"],
slide["meta"],
slide["tag"],
pg_idx + 1,
)
# ── Layout: left column = bullets, right column = image ──────────────────
content_top = header_bottom - 6*mm
content_bot = MB + 6*mm
content_h = content_top - content_bot
img_w = 71*mm
img_h = 68*mm
gap = 5*mm
col_x = ML + 5*mm
col_w = W - ML - MR - img_w - gap - 10*mm
img_x = col_x + col_w + gap
img_y = content_top - img_h
# Draw image
img_path = os.path.join(IMGS, slide["img"])
draw_image_box(c, img_path, slide["img_caption"], img_x, img_y, img_w, img_h)
# Draw bullets
row_h = content_h / 21.0 # 20 bullets + a little top padding
draw_bullets(c, slide["bullets"], col_x, content_top, col_w, row_h)
c.showPage()
c.save()
print(f"✓ PDF saved: {OUT}")