Make me visualize pathophysiology and clinical features with indications of vericose veins with treatment In a video format
mkdir -p /home/daytona/workspace/varicose-veins && ls /home/daytona/workspace/va…
~/varicose-veins/create_presentation.js
const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");
// Fetch clinical images
const imageUrls = [
"https://cdn.orris.care/cdss_images/509b332c283189a25e2b78c788bb1484900d4a37016f24dd930f1b9f2ed0b4e0.png",
"https://cdn.orris.care/cdss_images/b855054b5ec6df6d6df17a1e7fb7e421f2934cd3e22e5472170ae1af9d7864f3.png"
];
let imageData = [];
try {
const result = execSync(
`node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`
).toString();
imageData = JSON.parse(result);
} catch (e) {
console.warn("Image fetch failed, continuing without images:", e.message);
}
const img1 = imageData[0] && !imageData[0].error ? imageData[0].base64 : null;
const img2 = imageData[1] && !imageData[1].error ? imageData[1].base64 : null;
// ──────────────────────────────────────────────
// COLOR PALETTE (deep venous burgundy + clinical white/grey)
// ──────────────────────────────────────────────
const C = {
darkBg: "1A0A12", // near-black burgundy (dominant dark)
midBg: "2E1020", // supporting dark
accent: "C0392B", // arterial red accent
accent2: "E74C3C", // lighter red
blue: "2980B9", // venous blue
lightBlue: "5DADE2", // lighter blue
gold: "F39C12", // highlight gold
white: "FFFFFF",
offWhite: "F5F5F5",
lightGrey: "CCCCCC",
teal: "1ABC9C",
purple: "8E44AD",
orange: "E67E22",
};
let pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Varicose Veins - Pathophysiology, Clinical Features & Treatment";
pres.author = "Medical Education";
// ══════════════════════════════════════════════
// HELPER: dark slide background
// ══════════════════════════════════════════════
function darkBg(slide, color) {
slide.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: "100%",
fill: { color: color || C.darkBg }, line: { color: color || C.darkBg }
});
}
function accentBar(slide, color, y, h) {
slide.addShape(pres.shapes.RECTANGLE, {
x: 0, y: y || 5.1, w: "100%", h: h || 0.5,
fill: { color: color || C.accent }, line: { color: color || C.accent }
});
}
// ══════════════════════════════════════════════
// SLIDE 1 — TITLE
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s);
// Left accent stripe
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: 0.08, h: "100%",
fill: { color: C.accent }, line: { color: C.accent }
});
// Top subtle band
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.06,
fill: { color: C.accent2 }, line: { color: C.accent2 }
});
// Main title
s.addText("VARICOSE VEINS", {
x: 0.4, y: 0.8, w: 9.2, h: 1.4,
fontSize: 52, fontFace: "Arial Black", bold: true,
color: C.white, align: "center", charSpacing: 4,
glow: { size: 10, color: C.accent2, opacity: 0.5 }
});
// Subtitle band
s.addShape(pres.shapes.RECTANGLE, {
x: 1.2, y: 2.4, w: 7.6, h: 0.85,
fill: { color: C.accent }, line: { color: C.accent },
shadow: { type: "outer", color: "000000", blur: 12, offset: 4, angle: 135, opacity: 0.5 }
});
s.addText("Pathophysiology · Clinical Features · Indications · Treatment", {
x: 1.2, y: 2.4, w: 7.6, h: 0.85,
fontSize: 18, fontFace: "Arial", bold: false,
color: C.white, align: "center", valign: "middle"
});
// 4 topic pills
const topics = ["Anatomy & Mechanism", "Clinical Presentation", "CEAP Classification", "Modern Treatment"];
const cols = [0.25, 2.75, 5.25, 7.75];
topics.forEach((t, i) => {
s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x: cols[i], y: 3.55, w: 2.3, h: 0.55,
fill: { color: C.midBg }, line: { color: C.lightBlue, pt: 1.5 },
rectRadius: 0.1
});
s.addText(t, {
x: cols[i], y: 3.55, w: 2.3, h: 0.55,
fontSize: 10.5, color: C.lightBlue, align: "center", valign: "middle",
bold: true, margin: 0
});
});
// Source tag
s.addText("Sources: Robbins Pathology · Bailey & Love · Schwartz's Surgery · Fitzpatrick's Dermatology", {
x: 0.4, y: 5.0, w: 9.2, h: 0.35,
fontSize: 8, color: C.lightGrey, align: "center", italic: true
});
// Bottom bar
accentBar(s, C.accent, 5.42, 0.2);
}
// ══════════════════════════════════════════════
// SLIDE 2 — EPIDEMIOLOGY & OVERVIEW
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s, C.midBg);
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.accent }, line: { color: C.accent }
});
s.addText("OVERVIEW & EPIDEMIOLOGY", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 22, bold: true, color: C.white, valign: "middle", charSpacing: 2
});
const stats = [
{ val: "20-50%", label: "Adults affected", color: C.accent2 },
{ val: "3x", label: "Higher in females", color: C.lightBlue },
{ val: "#1", label: "Venous disease worldwide", color: C.gold },
{ val: "80%", label: "Superficial venous origin", color: C.teal },
];
const sx = [0.2, 2.65, 5.1, 7.55];
stats.forEach((st, i) => {
s.addShape(pres.shapes.RECTANGLE, {
x: sx[i], y: 0.85, w: 2.3, h: 1.6,
fill: { color: "1C0E18" }, line: { color: st.color, pt: 2 },
shadow: { type: "outer", color: "000000", blur: 8, offset: 3, angle: 135, opacity: 0.4 }
});
s.addText(st.val, {
x: sx[i], y: 0.85, w: 2.3, h: 0.95,
fontSize: 36, bold: true, color: st.color, align: "center", valign: "middle", margin: 0
});
s.addText(st.label, {
x: sx[i], y: 1.8, w: 2.3, h: 0.65,
fontSize: 11, color: C.offWhite, align: "center", valign: "top", margin: 0
});
});
// Risk factors
s.addShape(pres.shapes.RECTANGLE, {
x: 0.2, y: 2.6, w: 9.6, h: 0.45,
fill: { color: C.accent }, line: { color: C.accent }
});
s.addText("RISK FACTORS", {
x: 0.2, y: 2.6, w: 9.6, h: 0.45,
fontSize: 14, bold: true, color: C.white, valign: "middle", charSpacing: 3, margin: 8
});
const risks = [
"Female sex (hormonal venodilation)", "Pregnancy (IVC compression by gravid uterus)",
"Obesity (increased intra-abdominal pressure)", "Prolonged standing/sitting",
"Family history (faulty venous wall development)", "Advanced age",
"DVT (secondary varicosities)", "Tall stature / high BMI"
];
const col1 = risks.slice(0, 4);
const col2 = risks.slice(4);
col1.forEach((r, i) => {
s.addText([{ text: "▶ " + r, options: {} }], {
x: 0.3, y: 3.15 + i * 0.45, w: 4.6, h: 0.42,
fontSize: 11, color: C.offWhite
});
});
col2.forEach((r, i) => {
s.addText([{ text: "▶ " + r, options: {} }], {
x: 5.1, y: 3.15 + i * 0.45, w: 4.7, h: 0.42,
fontSize: 11, color: C.offWhite
});
});
}
// ══════════════════════════════════════════════
// SLIDE 3 — ANATOMY OF VENOUS SYSTEM
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s);
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.blue }, line: { color: C.blue }
});
s.addText("VENOUS ANATOMY OF THE LOWER LIMB", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 21, bold: true, color: C.white, valign: "middle", charSpacing: 2
});
// Diagram title
s.addText("Three Compartment System", {
x: 0.3, y: 0.8, w: 9.4, h: 0.4,
fontSize: 15, bold: true, color: C.gold, align: "center"
});
// Three boxes side by side
const boxes = [
{ title: "DEEP VEINS", icon: "🩸", items: ["Femoral vein", "Popliteal vein", "Tibial veins", "Carries 80-90% venous return", "Higher pressure system"], color: C.blue },
{ title: "PERFORATORS", icon: "⟺", items: ["Connect superficial→deep", "Normally allow only inward flow (valves)", "Dodd/Boyd/Cockett perforators", "Incompetence = key mechanism", "Bidirectional flow in disease"], color: C.gold },
{ title: "SUPERFICIAL VEINS", icon: "🔵", items: ["Great Saphenous Vein (GSV)", "Small Saphenous Vein (SSV)", "Affected in varicose disease", "60% cases: GSV system", "20% cases: SSV system"], color: C.teal },
];
boxes.forEach((b, i) => {
const bx = 0.2 + i * 3.3;
s.addShape(pres.shapes.RECTANGLE, {
x: bx, y: 1.3, w: 3.1, h: 3.7,
fill: { color: "12080F" }, line: { color: b.color, pt: 2 }
});
s.addShape(pres.shapes.RECTANGLE, {
x: bx, y: 1.3, w: 3.1, h: 0.55,
fill: { color: b.color }, line: { color: b.color }
});
s.addText(b.title, {
x: bx, y: 1.3, w: 3.1, h: 0.55,
fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle", margin: 0
});
b.items.forEach((item, j) => {
s.addText("• " + item, {
x: bx + 0.1, y: 1.95 + j * 0.5, w: 2.9, h: 0.46,
fontSize: 10, color: C.offWhite
});
});
});
// Bottom note
s.addText("Valves prevent retrograde flow; incompetence at SFJ or SSJ initiates varicosity cascade", {
x: 0.3, y: 5.15, w: 9.4, h: 0.35,
fontSize: 9.5, color: C.lightGrey, align: "center", italic: true
});
}
// ══════════════════════════════════════════════
// SLIDE 4 — PATHOPHYSIOLOGY (detailed)
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s, "12060E");
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.purple }, line: { color: C.purple }
});
s.addText("PATHOPHYSIOLOGY", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 24, bold: true, color: C.white, valign: "middle", charSpacing: 3
});
// Cascade flow chart
const steps = [
{ title: "TRIGGERING FACTORS", body: "Prolonged standing · Pregnancy · Obesity · DVT · Age-related degeneration · Congenital valve absence", color: C.orange, icon: "⚡" },
{ title: "VEIN WALL STRUCTURAL CHANGES", body: "↑ Collagen, ↓ Elastin · ↑ TGF-β1 & FGF-β · Altered MMP activity · Hemodynamic stress (hypoxia, low shear stress) → extracellular matrix remodeling", color: C.purple, icon: "🔬" },
{ title: "VENOUS HYPERTENSION", body: "Increased intraluminal pressure (up to 10× normal) in superficial veins during standing · Deep venous pressure transmitted to superficial system", color: C.accent, icon: "⬆" },
{ title: "VALVULAR INCOMPETENCE", body: "Valve leaflets unable to coapt properly · Develops at SFJ, SSJ, then propagates distally · Often multicentric, discontinuous segments", color: C.gold, icon: "🔓" },
{ title: "RETROGRADE FLOW (REFLUX) + DILATION", body: "Bidirectional flow → further dilation → tortuous elongation → visible varicosities · Positive feedback loop worsens disease", color: C.teal, icon: "🔄" },
];
const stX = [0.15, 0.15, 0.15, 0.15, 0.15];
const stY = [0.8, 1.68, 2.56, 3.44, 4.32];
steps.forEach((st, i) => {
// Side accent
s.addShape(pres.shapes.RECTANGLE, {
x: stX[i], y: stY[i], w: 0.06, h: 0.72,
fill: { color: st.color }, line: { color: st.color }
});
// Box
s.addShape(pres.shapes.RECTANGLE, {
x: stX[i] + 0.1, y: stY[i], w: 9.4, h: 0.72,
fill: { color: "1A0A18" }, line: { color: st.color, pt: 0.5 }
});
s.addText(st.icon + " " + st.title, {
x: stX[i] + 0.2, y: stY[i] + 0.02, w: 2.7, h: 0.36,
fontSize: 10.5, bold: true, color: st.color, valign: "middle", margin: 2
});
s.addText(st.body, {
x: stX[i] + 3.0, y: stY[i] + 0.02, w: 6.6, h: 0.68,
fontSize: 9.5, color: C.offWhite, valign: "middle", margin: 2
});
// Arrow between boxes
if (i < steps.length - 1) {
s.addText("▼", {
x: 0.0, y: stY[i] + 0.7, w: 0.5, h: 0.25,
fontSize: 10, color: C.lightGrey, align: "center"
});
}
});
}
// ══════════════════════════════════════════════
// SLIDE 5 — CLINICAL FEATURES
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s, "0E1420");
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.teal }, line: { color: C.teal }
});
s.addText("CLINICAL FEATURES", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 24, bold: true, color: C.white, valign: "middle", charSpacing: 3
});
// Left column: Symptoms
s.addShape(pres.shapes.RECTANGLE, {
x: 0.2, y: 0.75, w: 4.55, h: 0.45,
fill: { color: C.teal }, line: { color: C.teal }
});
s.addText("🩺 SYMPTOMS (Subjective)", {
x: 0.2, y: 0.75, w: 4.55, h: 0.45,
fontSize: 12, bold: true, color: C.darkBg, align: "center", valign: "middle", margin: 0
});
const symptoms = [
["Aching & heaviness", "Worse with prolonged standing/sitting"],
["Throbbing & burning", "Over affected limb segments"],
["Pruritus (itching)", "Especially with skin complications"],
["Leg fatigue", "Early fatigue of affected limb"],
["Ankle edema", "Mild; worse at end of day"],
["Symptom relief", "Leg elevation or compression"],
];
symptoms.forEach(([sym, detail], i) => {
s.addShape(pres.shapes.RECTANGLE, {
x: 0.2, y: 1.28 + i * 0.62, w: 4.55, h: 0.55,
fill: { color: "0A1420" }, line: { color: C.teal, pt: 0.5 }
});
s.addText(sym, {
x: 0.3, y: 1.3 + i * 0.62, w: 2.4, h: 0.3,
fontSize: 10.5, bold: true, color: C.offWhite, margin: 0
});
s.addText(detail, {
x: 0.3, y: 1.58 + i * 0.62, w: 4.3, h: 0.22,
fontSize: 9, color: C.lightGrey, italic: true, margin: 0
});
});
// Right column: Signs
s.addShape(pres.shapes.RECTANGLE, {
x: 5.05, y: 0.75, w: 4.75, h: 0.45,
fill: { color: C.gold }, line: { color: C.gold }
});
s.addText("👁 SIGNS (Objective)", {
x: 5.05, y: 0.75, w: 4.75, h: 0.45,
fontSize: 12, bold: true, color: C.darkBg, align: "center", valign: "middle", margin: 0
});
const signs = [
["Tortuous dilated veins", "Subcutaneous; GSV 60%, SSV 20%"],
["Telangiectasias", "Fine spider veins; reticular veins"],
["Hyperpigmentation", "Haemosiderin from lysed RBCs"],
["Lipodermatosclerosis", "Woody induration; brawny skin"],
["Venous eczema", "Stasis dermatitis; perilesional"],
["Venous ulceration", "Gaiter area; medial malleolus"],
];
signs.forEach(([sign, detail], i) => {
s.addShape(pres.shapes.RECTANGLE, {
x: 5.05, y: 1.28 + i * 0.62, w: 4.75, h: 0.55,
fill: { color: "140E04" }, line: { color: C.gold, pt: 0.5 }
});
s.addText(sign, {
x: 5.15, y: 1.3 + i * 0.62, w: 2.6, h: 0.3,
fontSize: 10.5, bold: true, color: C.offWhite, margin: 0
});
s.addText(detail, {
x: 5.15, y: 1.58 + i * 0.62, w: 4.5, h: 0.22,
fontSize: 9, color: C.lightGrey, italic: true, margin: 0
});
});
}
// ══════════════════════════════════════════════
// SLIDE 6 — CLINICAL PHOTO + Complications
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s);
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.accent }, line: { color: C.accent }
});
s.addText("CLINICAL PRESENTATION & COMPLICATIONS", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 20, bold: true, color: C.white, valign: "middle", charSpacing: 2
});
// Clinical photo
if (img1) {
s.addImage({ data: img1, x: 0.2, y: 0.75, w: 3.2, h: 4.6 });
s.addText("Pre-operative marking of GSV varicosities\n(Bailey & Love, 28th Ed.)", {
x: 0.2, y: 5.35, w: 3.2, h: 0.25,
fontSize: 7.5, color: C.lightGrey, align: "center", italic: true
});
}
// Complication categories
const comps = [
{
type: "ACUTE", color: C.accent2,
items: [
"Superficial vein thrombosis (thrombophlebitis) — painful, cord-like",
"Haemorrhage — spontaneous or traumatic bleeding",
"Rupture — rare but can be dramatic"
]
},
{
type: "CHRONIC SKIN", color: C.gold,
items: [
"Haemosiderosis — brown pigmentation from iron deposits",
"Lipodermatosclerosis — fibrotic skin induration",
"Venous eczema — stasis dermatitis, weeping",
"Atrophie blanche — white sclerotic patches"
]
},
{
type: "ULCERATION", color: C.orange,
items: [
"Venous ulcer — 80-85% of all leg ulcers",
"Gaiter area (medial malleolus) most common",
"Venous disease = #1 cause of chronic leg ulcers",
"Community prevalence 0.1-0.3%; 2-4% elderly"
]
},
];
comps.forEach((c, i) => {
const cy = 0.8 + i * 1.55;
s.addShape(pres.shapes.RECTANGLE, {
x: 3.65, y: cy, w: 0.06, h: 1.4,
fill: { color: c.color }, line: { color: c.color }
});
s.addShape(pres.shapes.RECTANGLE, {
x: 3.75, y: cy, w: 5.95, h: 1.4,
fill: { color: "110908" }, line: { color: c.color, pt: 1 }
});
s.addText(c.type, {
x: 3.85, y: cy + 0.06, w: 5.75, h: 0.35,
fontSize: 12, bold: true, color: c.color, margin: 0, charSpacing: 2
});
c.items.forEach((item, j) => {
s.addText("• " + item, {
x: 3.85, y: cy + 0.42 + j * 0.3, w: 5.75, h: 0.28,
fontSize: 9.5, color: C.offWhite, margin: 0
});
});
});
}
// ══════════════════════════════════════════════
// SLIDE 7 — CEAP CLASSIFICATION
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s, "080E18");
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.blue }, line: { color: C.blue }
});
s.addText("CEAP CLASSIFICATION OF CHRONIC VENOUS DISEASE", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 19, bold: true, color: C.white, valign: "middle", charSpacing: 2
});
const ceap = [
{ cls: "C0", desc: "No visible/palpable venous disease", color: C.teal, img: "" },
{ cls: "C1", desc: "Telangiectasias or reticular veins", color: C.lightBlue, img: "" },
{ cls: "C2", desc: "Varicose veins (>3mm diameter)", color: C.gold, img: "" },
{ cls: "C2r", desc: "Recurrent varicose veins", color: C.orange, img: "" },
{ cls: "C3", desc: "Edema of venous origin", color: C.gold, img: "" },
{ cls: "C4a", desc: "Pigmentation / venous eczema", color: C.accent2, img: "" },
{ cls: "C4b", desc: "Lipodermatosclerosis / atrophie blanche", color: C.accent2, img: "" },
{ cls: "C4c", desc: "Corona phlebectatica", color: C.accent, img: "" },
{ cls: "C5", desc: "Healed venous ulcer", color: C.purple, img: "" },
{ cls: "C6", desc: "Active venous ulcer", color: C.accent, img: "" },
{ cls: "C6r", desc: "Recurrent active venous ulcer", color: C.accent, img: "" },
];
// Two-column grid
ceap.forEach((c, i) => {
const col = i < 6 ? 0 : 1;
const row = i < 6 ? i : i - 6;
const cx = col === 0 ? 0.2 : 5.2;
const cy = 0.8 + row * 0.73;
s.addShape(pres.shapes.RECTANGLE, {
x: cx, y: cy, w: 4.6, h: 0.62,
fill: { color: "0C111E" }, line: { color: c.color, pt: 1.5 }
});
s.addShape(pres.shapes.RECTANGLE, {
x: cx, y: cy, w: 0.7, h: 0.62,
fill: { color: c.color }, line: { color: c.color }
});
s.addText(c.cls, {
x: cx, y: cy, w: 0.7, h: 0.62,
fontSize: 11, bold: true, color: C.darkBg, align: "center", valign: "middle", margin: 0
});
s.addText(c.desc, {
x: cx + 0.8, y: cy, w: 3.7, h: 0.62,
fontSize: 11, color: C.offWhite, valign: "middle", margin: 4
});
});
s.addText("CEAP = Clinical · Etiological · Anatomical · Pathophysiological | Treatment indicated at C2 and above", {
x: 0.2, y: 5.22, w: 9.6, h: 0.3,
fontSize: 8.5, color: C.lightGrey, italic: true, align: "center"
});
}
// ══════════════════════════════════════════════
// SLIDE 8 — INVESTIGATIONS & DIAGNOSIS
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s, "0A1208");
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.teal }, line: { color: C.teal }
});
s.addText("INVESTIGATIONS & DIAGNOSIS", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 22, bold: true, color: C.darkBg, valign: "middle", charSpacing: 3
});
const invests = [
{
title: "DUPLEX ULTRASOUND", icon: "🔊", color: C.teal,
pts: [
"GOLD STANDARD — mandatory before intervention",
"Identifies reflux at SFJ, SSJ, and perforators",
"Reflux defined as retrograde flow >0.5 sec on calf squeeze release",
"Maps GSV/SSV diameter and competency",
"Guides ablation catheter placement"
]
},
{
title: "CLINICAL EXAMINATION", icon: "🔍", color: C.gold,
pts: [
"Trendelenburg test — identifies SFJ incompetence",
"Tourniquet test — locates highest incompetent perforator",
"Perthes test — assesses deep vein patency before surgery",
"Tap test — transmitted impulse along connected varix"
]
},
{
title: "ADDITIONAL STUDIES", icon: "📊", color: C.purple,
pts: [
"Air plethysmography — quantifies venous reflux volume",
"Ambulatory venous pressure (AVP) — gold standard for CVI severity",
"CT/MR venography — pelvic origin varicosities, May-Thurner syndrome",
"Venography — rarely needed; invasive"
]
},
];
invests.forEach((inv, i) => {
const iy = 0.78 + i * 1.55;
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: iy, w: 9.7, h: 1.42,
fill: { color: "080E06" }, line: { color: inv.color, pt: 1.5 }
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: iy, w: 2.4, h: 1.42,
fill: { color: inv.color }, line: { color: inv.color }
});
s.addText(inv.icon + "\n" + inv.title, {
x: 0.15, y: iy, w: 2.4, h: 1.42,
fontSize: 12, bold: true, color: C.darkBg, align: "center", valign: "middle",
margin: 4
});
inv.pts.forEach((pt, j) => {
s.addText("• " + pt, {
x: 2.7, y: iy + 0.1 + j * 0.26, w: 7.0, h: 0.24,
fontSize: 9.5, color: C.offWhite, margin: 0
});
});
});
}
// ══════════════════════════════════════════════
// SLIDE 9 — INDICATIONS FOR TREATMENT
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s, "0E0A18");
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.purple }, line: { color: C.purple }
});
s.addText("INDICATIONS FOR TREATMENT", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 24, bold: true, color: C.white, valign: "middle", charSpacing: 3
});
// Two panels: Absolute & Relative
const panels = [
{
title: "ABSOLUTE INDICATIONS", color: C.accent,
items: [
"Haemorrhage from varicosity (acute or recurrent)",
"Active venous ulceration (CEAP C6)",
"Healed venous ulcer to prevent recurrence (C5)",
"Lipodermatosclerosis (C4b) — prevent ulceration",
"Superficial thrombophlebitis (recurrent episodes)",
"Significant skin changes at risk of ulceration"
]
},
{
title: "RELATIVE / SYMPTOMATIC INDICATIONS", color: C.gold,
items: [
"Disabling symptoms not relieved by compression",
"Cosmetic concern with significant impact on QoL",
"Symptomatic varicosities in pregnancy (post-partum)",
"Symptoms worsening despite conservative Rx",
"Aching, heaviness, oedema interfering with work",
"Patient preference after failed conservative measures"
]
}
];
panels.forEach((p, i) => {
const px = i === 0 ? 0.15 : 5.05;
s.addShape(pres.shapes.RECTANGLE, {
x: px, y: 0.78, w: 4.65, h: 0.48,
fill: { color: p.color }, line: { color: p.color }
});
s.addText(p.title, {
x: px, y: 0.78, w: 4.65, h: 0.48,
fontSize: 11.5, bold: true, color: C.white, align: "center", valign: "middle",
charSpacing: 1, margin: 0
});
p.items.forEach((item, j) => {
s.addShape(pres.shapes.RECTANGLE, {
x: px, y: 1.32 + j * 0.62, w: 4.65, h: 0.56,
fill: { color: i === 0 ? "140608" : "140E04" }, line: { color: p.color, pt: 0.5 }
});
s.addShape(pres.shapes.RECTANGLE, {
x: px, y: 1.32 + j * 0.62, w: 0.05, h: 0.56,
fill: { color: p.color }, line: { color: p.color }
});
s.addText(item, {
x: px + 0.12, y: 1.32 + j * 0.62, w: 4.45, h: 0.56,
fontSize: 10, color: C.offWhite, valign: "middle", margin: 4
});
});
});
// NICE/SVS guideline footnote
s.addText("Per SVS/AVF 2022 guidelines: Treatment is recommended for symptomatic C2+ with confirmed reflux on duplex | NICE CG168: offer treatment to patients with confirmed truncal reflux + symptoms", {
x: 0.2, y: 5.22, w: 9.6, h: 0.3,
fontSize: 7.5, color: C.lightGrey, italic: true, align: "center"
});
}
// ══════════════════════════════════════════════
// SLIDE 10 — CONTRAINDICATIONS
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s, "120808");
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.accent }, line: { color: C.accent }
});
s.addText("CONTRAINDICATIONS TO TREATMENT", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 22, bold: true, color: C.white, valign: "middle", charSpacing: 3
});
const contras = [
{
title: "ABSOLUTE CONTRAINDICATIONS", color: C.accent,
items: [
"Active DVT or acute superficial thrombosis of target vein",
"Severe peripheral arterial disease (ABI < 0.5)",
"Immobility / inability to ambulate post-procedure",
"Known hypercoagulable state without anticoagulation",
"Active cellulitis overlying target vein"
]
},
{
title: "RELATIVE CONTRAINDICATIONS", color: C.orange,
items: [
"Pregnancy — treat only if very symptomatic; post-partum preferred",
"Moderate PAD (ABI 0.5–0.8) — caution with compression",
"Lymphoedema co-existing — careful compression management",
"Allergy to sclerosant agent — choose alternative agent",
"Poor skin condition / infection at access site"
]
},
{
title: "SPECIAL CONSIDERATIONS", color: C.gold,
items: [
"Pelvic congestion syndrome — treat pelvic source first",
"Recurrent varicosities — thorough re-mapping essential",
"Prior DVT — confirm deep system adequacy before superficial ablation"
]
}
];
contras.forEach((c, i) => {
const cy = 0.78 + i * 1.55;
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: cy, w: 9.7, h: 1.4,
fill: { color: "0E0606" }, line: { color: c.color, pt: 1.5 }
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: cy, w: 0.06, h: 1.4,
fill: { color: c.color }, line: { color: c.color }
});
s.addText(c.title, {
x: 0.3, y: cy + 0.04, w: 9.3, h: 0.32,
fontSize: 12, bold: true, color: c.color, margin: 0, charSpacing: 1
});
c.items.forEach((item, j) => {
s.addText("• " + item, {
x: 0.35, y: cy + 0.38 + j * 0.22, w: 9.2, h: 0.2,
fontSize: 9.5, color: C.offWhite, margin: 0
});
});
});
}
// ══════════════════════════════════════════════
// SLIDE 11 — CONSERVATIVE TREATMENT
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s, "06121C");
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.lightBlue }, line: { color: C.lightBlue }
});
s.addText("CONSERVATIVE MANAGEMENT", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 22, bold: true, color: C.darkBg, valign: "middle", charSpacing: 3
});
const cons = [
{
title: "COMPRESSION HOSIERY", icon: "🧦", color: C.lightBlue,
body: [
"Class I (15-21 mmHg): mild symptoms, telangiectasias",
"Class II (23-32 mmHg): moderate varicosities, edema — MOST COMMON",
"Class III (34-46 mmHg): severe CVI, post-thrombotic syndrome",
"Class IV (>49 mmHg): lymphedema",
"Knee-high preferred; compression from toe to knee",
"Worn during waking hours; provides symptom relief in majority"
]
},
{
title: "LIFESTYLE MODIFICATIONS", icon: "🏃", color: C.teal,
body: [
"Leg elevation above heart level — reduces hydrostatic pressure",
"Regular walking — activates calf muscle pump mechanism",
"Weight reduction — decreases intra-abdominal pressure",
"Avoid prolonged standing/sitting without movement",
"Cold water immersion / walking — promotes venous return"
]
},
{
title: "PHARMACOTHERAPY (Adjunctive)", icon: "💊", color: C.gold,
body: [
"Micronised purified flavonoid fraction (MPFF/Daflon) — venotonic",
"Horse chestnut seed extract — reduces oedema, improves tone",
"NSAIDs — for superficial thrombophlebitis pain relief",
"Note: pharmacotherapy is adjunctive only; does not eliminate varicosities"
]
},
];
cons.forEach((c, i) => {
const cy = 0.78 + i * 1.56;
const h = i === 0 ? 1.5 : 1.4;
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: cy, w: 9.7, h: h,
fill: { color: "060D14" }, line: { color: c.color, pt: 1.5 }
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: cy, w: 1.8, h: h,
fill: { color: c.color }, line: { color: c.color }
});
s.addText(c.icon + "\n" + c.title, {
x: 0.15, y: cy, w: 1.8, h: h,
fontSize: 10, bold: true, color: C.darkBg, align: "center", valign: "middle",
margin: 4
});
c.body.forEach((pt, j) => {
s.addText("• " + pt, {
x: 2.1, y: cy + 0.08 + j * 0.22, w: 7.6, h: 0.2,
fontSize: 9, color: C.offWhite, margin: 0
});
});
});
}
// ══════════════════════════════════════════════
// SLIDE 12 — INTERVENTIONAL TREATMENT
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s, "100C00");
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.gold }, line: { color: C.gold }
});
s.addText("INTERVENTIONAL TREATMENT", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 22, bold: true, color: C.darkBg, valign: "middle", charSpacing: 3
});
const tx = [
{
title: "SCLEROTHERAPY", color: C.lightBlue,
items: [
"Mechanism: sclerosant destroys venous endothelium → fibrosis",
"Agents: polidocanol 0.5-3%, sodium tetradecyl sulfate, hypertonic saline",
"Foam sclerotherapy: US-guided; foam fills larger lumen more effectively",
"Best for: telangiectasias (C1), reticular veins, small branch varicosities",
"Post-procedure: compression bandage × 3-5 days then stockings × 2 weeks",
"Complications: hyperpigmentation, thrombophlebitis, skin necrosis, rare DVT"
]
},
{
title: "ENDOVENOUS THERMAL ABLATION", color: C.orange,
items: [
"Endovenous Laser Ablation (EVLA) — 810-1470nm laser; 90-95% occlusion rate",
"Radiofrequency Ablation (RFA) — ClosureFast; thermal energy via catheter",
"Both: tumescent anaesthesia injected perivenously before energy delivery",
"Target: GSV/SSV reflux confirmed on duplex; C2+ symptomatic",
"NICE/SVS preferred over surgery for truncal reflux",
"Advantage: day case; rapid return to activity; low morbidity"
]
},
];
tx.forEach((t, i) => {
const ty = 0.78 + i * 2.0;
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: ty, w: 9.7, h: 1.82,
fill: { color: "0C0A02" }, line: { color: t.color, pt: 1.5 }
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: ty, w: 9.7, h: 0.4,
fill: { color: t.color }, line: { color: t.color }
});
s.addText(t.title, {
x: 0.25, y: ty, w: 9.5, h: 0.4,
fontSize: 13, bold: true, color: C.darkBg, valign: "middle", charSpacing: 2, margin: 0
});
t.items.forEach((item, j) => {
s.addText("• " + item, {
x: 0.3, y: ty + 0.45 + j * 0.23, w: 9.3, h: 0.22,
fontSize: 9.5, color: C.offWhite, margin: 0
});
});
});
// Non-thermal
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: 4.82, w: 9.7, h: 0.65,
fill: { color: "0C0A02" }, line: { color: C.teal, pt: 1 }
});
s.addText("NON-THERMAL ABLATION: Mechanochemical (MOCA/ClariVein) — combines mechanical injury + sclerosant · Cyanoacrylate glue (VenaSeal) — no tumescent anaesthesia needed · NTNT = no needle, no thermal, no tumescent", {
x: 0.25, y: 4.82, w: 9.5, h: 0.65,
fontSize: 9, color: C.teal, valign: "middle", margin: 4
});
}
// ══════════════════════════════════════════════
// SLIDE 13 — SURGICAL TREATMENT
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s, "080C18");
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.blue }, line: { color: C.blue }
});
s.addText("SURGICAL TREATMENT", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 24, bold: true, color: C.white, valign: "middle", charSpacing: 3
});
// If we have the stab avulsion image
// Main procedure boxes
const procs = [
{
title: "HIGH LIGATION & STRIPPING (Trendelenburg operation)", color: C.blue, icon: "✂",
body: "Flush ligation of SFJ or SSJ + tributaries · GSV stripped thigh to knee · SSV mapped carefully (variable anatomy) · Combined with stab avulsions for branch varicosities · Tumescent anaesthesia reduces bruising · Recurrence rate: 20-30% at 10 years"
},
{
title: "STAB AVULSION (Hook phlebectomy)", color: C.lightBlue, icon: "🔧",
body: "2mm stab incisions over marked varicosities · Vein hooked out with phlebectomy hook · No ligation needed — avulsion controls bleeding · Performed as adjunct to EVLA/RFA or as standalone for tributaries · Excellent cosmesis; minimal scarring"
},
{
title: "AMBULATORY PHLEBECTOMY", color: C.teal, icon: "🏥",
body: "Office/day-case procedure under local anaesthesia · Single-hook avulsion of superficial varices · Compression post-procedure × 2 weeks · Can treat extensive branch varicosities in one session · Complements endovenous trunk ablation"
},
];
procs.forEach((p, i) => {
const py = 0.8 + i * 1.52;
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: py, w: 9.7, h: 1.38,
fill: { color: "050810" }, line: { color: p.color, pt: 1.5 }
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: py, w: 1.1, h: 1.38,
fill: { color: p.color }, line: { color: p.color }
});
s.addText(p.icon, {
x: 0.15, y: py, w: 1.1, h: 1.38,
fontSize: 28, color: C.darkBg, align: "center", valign: "middle", margin: 0
});
s.addText(p.title, {
x: 1.35, y: py + 0.1, w: 8.35, h: 0.35,
fontSize: 11, bold: true, color: p.color, margin: 0
});
s.addText(p.body, {
x: 1.35, y: py + 0.45, w: 8.35, h: 0.82,
fontSize: 9.5, color: C.offWhite, margin: 0
});
});
// Surgical note
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: 5.36, w: 9.7, h: 0.25,
fill: { color: "0A0D18" }, line: { color: C.lightGrey, pt: 0.5 }
});
s.addText("Current guideline: Endovenous ablation > Surgery for truncal reflux (SVS 2022, NICE 2013/updated) · Surgery reserved for anatomy unsuitable for endovenous access", {
x: 0.25, y: 5.36, w: 9.5, h: 0.25,
fontSize: 7.5, color: C.lightGrey, align: "center", italic: true, margin: 0
});
}
// ══════════════════════════════════════════════
// SLIDE 14 — TREATMENT ALGORITHM
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s);
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.teal }, line: { color: C.teal }
});
s.addText("TREATMENT ALGORITHM", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 24, bold: true, color: C.darkBg, valign: "middle", charSpacing: 3
});
// Flow boxes
const algo = [
{ label: "VARICOSE VEINS PATIENT", color: C.gold, x: 3.3, y: 0.78, w: 3.4, h: 0.55 },
{ label: "History + Examination\n+ CEAP Classification", color: C.lightBlue, x: 3.3, y: 1.52, w: 3.4, h: 0.6 },
{ label: "Duplex Ultrasound\n(Mandatory)", color: C.orange, x: 3.3, y: 2.35, w: 3.4, h: 0.6 },
];
algo.forEach(a => {
s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x: a.x, y: a.y, w: a.w, h: a.h,
fill: { color: a.color }, line: { color: a.color }, rectRadius: 0.1
});
s.addText(a.label, {
x: a.x, y: a.y, w: a.w, h: a.h,
fontSize: 11, bold: true, color: C.darkBg, align: "center", valign: "middle", margin: 0
});
// Arrow
s.addText("▼", { x: a.x + 1.4, y: a.y + a.h, w: 0.6, h: 0.22, fontSize: 12, color: C.lightGrey, align: "center" });
});
// Three outcome paths
const paths = [
{
label: "Asymptomatic\nC0-C1", sub: "Reassurance\nLifestyle advice\nOptional sclerotherapy (cosmetic)",
color: C.teal, x: 0.15, y: 3.12
},
{
label: "Symptomatic\nC2-C3", sub: "Compression 6-8 weeks\n→ Endovenous Ablation (EVLA/RFA)\n→ Stab avulsion for tributaries",
color: C.gold, x: 3.5, y: 3.12
},
{
label: "Complicated\nC4-C6", sub: "Prompt intervention\nEndovenous ablation\nWound care / ulcer management\nCompression",
color: C.accent2, x: 6.85, y: 3.12
},
];
paths.forEach(p => {
s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
x: p.x, y: p.y, w: 3.0, h: 0.6,
fill: { color: p.color }, line: { color: p.color }, rectRadius: 0.1
});
s.addText(p.label, {
x: p.x, y: p.y, w: 3.0, h: 0.6,
fontSize: 11, bold: true, color: C.darkBg, align: "center", valign: "middle", margin: 0
});
s.addShape(pres.shapes.RECTANGLE, {
x: p.x, y: p.y + 0.65, w: 3.0, h: 1.5,
fill: { color: "0C1020" }, line: { color: p.color, pt: 1 }
});
s.addText(p.sub, {
x: p.x + 0.1, y: p.y + 0.7, w: 2.8, h: 1.4,
fontSize: 10, color: C.offWhite, valign: "top", margin: 4
});
});
s.addText("Algorithm based on SVS/AVF 2022 Clinical Practice Guidelines and NICE CG168", {
x: 0.3, y: 5.28, w: 9.4, h: 0.25,
fontSize: 8, color: C.lightGrey, italic: true, align: "center"
});
}
// ══════════════════════════════════════════════
// SLIDE 15 — KEY TAKEAWAYS
// ══════════════════════════════════════════════
{
let s = pres.addSlide();
darkBg(s, C.darkBg);
// Dark gradient-like band at top
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: "100%", h: 0.65,
fill: { color: C.accent }, line: { color: C.accent }
});
s.addText("KEY TAKEAWAYS", {
x: 0.3, y: 0, w: 9.4, h: 0.65,
fontSize: 26, bold: true, color: C.white, valign: "middle", charSpacing: 4
});
const takes = [
{ n: "01", text: "Varicose veins result from vein wall structural changes → valvular incompetence → venous hypertension → retrograde flow; NOT simply valve failure first.", color: C.accent2 },
{ n: "02", text: "Present in up to 50% of adults; risk factors: female sex, pregnancy, obesity, prolonged standing, DVT, family history.", color: C.gold },
{ n: "03", text: "CEAP classification guides management: C2 = varicose veins (intervention warranted if symptomatic), C6 = active ulcer (urgent treatment).", color: C.teal },
{ n: "04", text: "Duplex ultrasound is MANDATORY before intervention; identifies reflux, maps anatomy, guides ablation.", color: C.lightBlue },
{ n: "05", text: "First-line intervention: Endovenous ablation (EVLA/RFA) preferred over surgery per SVS 2022 and NICE guidelines.", color: C.orange },
{ n: "06", text: "Absolute indications: haemorrhage, active ulceration, lipodermatosclerosis. Compression alone for asymptomatic cases.", color: C.purple },
];
takes.forEach((t, i) => {
const ty = 0.82 + i * 0.77;
s.addShape(pres.shapes.RECTANGLE, {
x: 0.15, y: ty, w: 0.6, h: 0.62,
fill: { color: t.color }, line: { color: t.color }
});
s.addText(t.n, {
x: 0.15, y: ty, w: 0.6, h: 0.62,
fontSize: 18, bold: true, color: C.darkBg, align: "center", valign: "middle", margin: 0
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.8, y: ty, w: 9.05, h: 0.62,
fill: { color: "1A0A12" }, line: { color: t.color, pt: 0.5 }
});
s.addText(t.text, {
x: 0.9, y: ty, w: 8.9, h: 0.62,
fontSize: 10.5, color: C.offWhite, valign: "middle", margin: 4
});
});
}
// ══════════════════════════════════════════════
// WRITE FILE
// ══════════════════════════════════════════════
pres.writeFile({ fileName: "/home/daytona/workspace/varicose-veins/Varicose_Veins_Visual_Guide.pptx" })
.then(() => console.log("✅ Presentation saved successfully!"))
.catch(err => { console.error("❌ Error:", err); process.exit(1); });
cd /home/daytona/workspace/varicose-veins && node create_presentation.js 2>&1
ls -lh /home/daytona/workspace/varicose-veins/ && echo "---" && python3 -c " imp…
which libreoffice && which ffmpeg && echo "Both available"
mkdir -p /home/daytona/workspace/varicose-veins/slides && libreoffice --headless…
# Try exporting to JPG and use a temp dir mkdir -p /tmp/vv_slides && libreoffice…
# LibreOffice only exported 1 file (all slides in one image). Use python-pptx to…
# Convert PDF pages to PNG images, then stitch into video python3 -c " from pdf2…
# Create video: each slide shown for 7 seconds = 105 sec total video ffmpeg -y -…
# Try concat method instead ls /tmp/vv_slides/slide_*.png | wc -l # Write conca…
Generate a video with narration voiceover for the slides
ls /tmp/vv_slides/slide_*.png | sort && echo "---" && python3 -c "import pyttsx3…
python3 -c "from gtts import gTTS; print('gTTS ok')" 2>&1; espeak --version 2>&1…
# Check all available TTS options pip install --user gtts 2>&1 | tail -3 pip ins…
pip install --user gtts pyttsx3 2>&1 | tail -5 && python3 -c "from gtts import g…
~/varicose-veins/generate_video.py
#!/usr/bin/env python3
"""
Varicose Veins - Narrated Video Generator
Generates TTS audio for each slide, then combines with slide images into MP4.
"""
import os
import subprocess
import time
from gtts import gTTS
# ──────────────────────────────────────────────
# NARRATION SCRIPTS (one per slide)
# ──────────────────────────────────────────────
NARRATIONS = [
# Slide 1 – Title
"""Welcome to this medical education video on Varicose Veins.
In this presentation, we will cover the pathophysiology, clinical features, indications for treatment,
and the full range of modern treatment options — from conservative management to surgical intervention.
This content is sourced from authoritative surgical and pathology textbooks including Robbins Pathology,
Bailey and Love's Surgery, and Schwartz's Principles of Surgery.""",
# Slide 2 – Epidemiology
"""Varicose veins are one of the most prevalent vascular conditions worldwide.
They affect between twenty and fifty percent of the adult population.
Females are approximately three times more commonly affected than males.
Key risk factors include: female sex due to hormonal effects on venous tone,
pregnancy — where the gravid uterus compresses the inferior vena cava,
obesity, prolonged standing, family history, advanced age,
and prior deep vein thrombosis causing secondary varicosities.
Understanding these risk factors is essential for both prevention and patient counselling.""",
# Slide 3 – Anatomy
"""To understand varicose veins, we must first understand the venous anatomy of the lower limb.
The venous system has three compartments working together.
The deep veins — including the femoral, popliteal, and tibial veins — carry eighty to ninety percent of venous return.
The superficial veins — the Great Saphenous Vein and Small Saphenous Vein — are the primary sites of varicosity.
The perforating veins connect these two systems, normally allowing only inward flow through one-way valves.
In health, the calf muscle pump compresses deep veins during walking, driving blood toward the heart.
Incompetence at the sapheno-femoral junction — where the Great Saphenous Vein meets the femoral vein —
is the most common starting point for varicose disease.""",
# Slide 4 – Pathophysiology
"""The pathophysiology of varicose veins involves a self-perpetuating cascade.
Step one: Triggering factors such as prolonged standing, pregnancy, obesity, or deep vein thrombosis initiate the process.
Step two: Structural changes occur in the vein wall itself — increased collagen, decreased elastin,
and elevated levels of transforming growth factor beta-one — weakening the wall before valve damage occurs.
This is an important modern concept: vein wall changes PRECEDE valve failure, not the other way around.
Step three: Venous hypertension develops, with pressures up to TEN TIMES normal in dependent superficial veins.
Step four: Valvular incompetence follows, with valve leaflets unable to coapt, allowing retrograde blood flow.
Step five: Reflux and progressive dilation complete the positive feedback loop — more dilation causes more incompetence,
causing more dilation, ultimately producing the tortuous, visible varicosities we see clinically.""",
# Slide 5 – Clinical Features
"""Clinically, varicose veins present with both symptoms and signs.
On the SYMPTOMS side: patients describe aching, heaviness, throbbing, and burning — classically worse after prolonged standing
and relieved by leg elevation or compression hosiery. Pruritus and ankle swelling are also common.
On the SIGNS side: the hallmark is tortuous, dilated subcutaneous veins — affecting the Great Saphenous Vein system
in sixty percent of cases and the Small Saphenous Vein in twenty percent.
Advanced signs include hyperpigmentation from haemosiderin deposits — iron released by lysed red blood cells —
lipodermatosclerosis — which is woody fibrotic induration of the skin and subcutaneous tissue —
venous eczema or stasis dermatitis, and ultimately venous ulceration.
An important point: symptom severity does NOT always correlate with the extent of visible disease.""",
# Slide 6 – Complications
"""Varicose veins can cause both acute and chronic complications.
ACUTE complications include: superficial vein thrombosis — presenting as a painful, tender, cord-like vein —
and haemorrhage, which can be dramatic but is controlled by limb elevation and direct pressure.
CHRONIC SKIN complications form a spectrum: haemosiderosis produces the characteristic brown pigmentation,
lipodermatosclerosis causes brawny induration — the so-called 'brawny colour' comes from haemolysis of extravasated red cells —
and venous eczema produces weeping, itchy skin changes.
The most serious complication is VENOUS ULCERATION, responsible for eighty to eighty-five percent of all chronic leg ulcers.
These ulcers typically occur in the 'gaiter area' — around the medial malleolus — and carry significant morbidity,
especially in the elderly, with community prevalence of two to four percent in older adults.""",
# Slide 7 – CEAP
"""The CEAP classification provides a standardised framework for staging chronic venous disease.
C-zero: no visible or palpable disease.
C-one: telangiectasias or reticular veins — the fine spider veins.
C-two: true varicose veins, defined as dilated veins greater than three millimetres in diameter.
C-two-R: recurrent varicose veins after previous treatment.
C-three: oedema of venous origin.
C-four-A: pigmentation or venous eczema.
C-four-B: lipodermatosclerosis or atrophie blanche — the white, sclerotic skin patches.
C-five: healed venous ulcer.
C-six: active venous ulcer.
This classification — Clinical, Etiological, Anatomical, Pathophysiological — guides treatment decisions.
As a general rule, interventional treatment is indicated from C-two upwards when symptoms are present.""",
# Slide 8 – Investigations
"""Investigation of varicose veins begins with a thorough clinical examination and duplex ultrasound scanning.
DUPLEX ULTRASOUND is the gold standard and is MANDATORY before any intervention.
It identifies reflux at the sapheno-femoral junction, sapheno-popliteal junction, and perforators.
Reflux is defined as retrograde flow lasting more than half a second after calf compression release.
It maps the diameter and competency of the Great and Small Saphenous Veins and guides catheter placement.
CLINICAL TESTS include: the Trendelenburg test to identify sapheno-femoral incompetence,
the tourniquet test to locate the highest incompetent perforator,
and the Perthes test to assess deep vein patency before surgery.
In complex cases — particularly pelvic origin varicosities or May-Thurner syndrome —
CT or MR venography may be required. Invasive venography is rarely needed today.""",
# Slide 9 – Indications
"""Treatment indications fall into two categories: absolute and relative.
ABSOLUTE INDICATIONS where treatment must be offered include:
haemorrhage — either acute or recurrent — from a varicosity;
active venous ulceration, CEAP C-six;
healed ulcer to prevent recurrence, C-five;
lipodermatosclerosis to prevent future ulceration;
and recurrent superficial thrombophlebitis.
RELATIVE INDICATIONS include disabling symptoms not controlled by compression,
cosmetic concerns significantly impacting quality of life,
symptoms worsening despite conservative management,
and patient preference after failed conservative measures.
Per the 2022 Society for Vascular Surgery guidelines and NICE guidance,
treatment should be offered to patients with confirmed truncal reflux on duplex
who have symptomatic disease at CEAP C-two or above.""",
# Slide 10 – Contraindications
"""Before treating varicose veins, we must identify contraindications.
ABSOLUTE CONTRAINDICATIONS include: active deep vein thrombosis,
severe peripheral arterial disease with ankle-brachial index below zero-point-five,
inability to mobilise post-procedure, uncontrolled hypercoagulable states,
and active cellulitis over the target vein.
RELATIVE CONTRAINDICATIONS include pregnancy — treatment is generally deferred until post-partum
unless symptoms are severe — moderate peripheral arterial disease where compression must be used cautiously,
lymphoedema, and allergy to a specific sclerosant agent.
Special considerations apply for pelvic congestion syndrome — where the pelvic venous source must be treated first —
and for recurrent varicosities requiring thorough re-mapping of the venous anatomy.""",
# Slide 11 – Conservative
"""Conservative management is the first step and remains important for all patients.
COMPRESSION HOSIERY is the cornerstone. Class one — fifteen to twenty-one millimetres of mercury — for mild symptoms.
Class two — twenty-three to thirty-two millimetres — is the most commonly prescribed, covering moderate varicosities and oedema.
Class three — thirty-four to forty-six millimetres — for severe chronic venous insufficiency.
Stockings should be knee-high, worn during waking hours, and fitted properly to the patient.
They provide effective symptom relief in the majority of patients.
LIFESTYLE MODIFICATIONS are equally important: regular leg elevation above heart level,
walking to activate the calf muscle pump, weight reduction,
and avoiding prolonged static standing.
PHARMACOTHERAPY plays an adjunctive role: micronised purified flavonoid fraction — also called Daflon —
and horse chestnut seed extract improve venous tone and reduce oedema.
Note that pharmacotherapy does NOT eliminate varicosities — it manages symptoms only.""",
# Slide 12 – Interventional
"""When conservative measures are insufficient or indications are absolute, interventional treatment is required.
SCLEROTHERAPY involves injecting a sclerosant agent — such as polidocanol or sodium tetradecyl sulfate —
which destroys the venous endothelium and leads to fibrosis and occlusion.
Foam sclerotherapy, where the agent is mixed with air or gas into a foam, is used for larger veins under ultrasound guidance.
It is ideal for telangiectasias, reticular veins, and small branch varicosities.
ENDOVENOUS THERMAL ABLATION — specifically Endovenous Laser Ablation and Radiofrequency Ablation —
are the current first-line interventions for truncal reflux per international guidelines.
A catheter is placed in the Great or Small Saphenous Vein under ultrasound guidance.
Tumescent anaesthesia is injected perivenously. Thermal energy is then delivered along the vein, causing occlusion.
These achieve ninety to ninety-five percent occlusion rates with minimal morbidity as day-case procedures.
NON-THERMAL options include mechanochemical ablation — combining mechanical injury with sclerosant —
and cyanoacrylate glue — which requires no tumescent anaesthesia and no heat delivery.""",
# Slide 13 – Surgical
"""Surgical treatment remains an important option, particularly when endovenous access is not feasible.
HIGH LIGATION AND STRIPPING — the Trendelenburg operation — involves flush ligation of the sapheno-femoral
or sapheno-popliteal junction, followed by stripping of the Great Saphenous Vein from groin to knee.
It is combined with stab avulsions to address branch varicosities in the same sitting.
Recurrence rates are approximately twenty to thirty percent at ten years.
STAB AVULSION — or hook phlebectomy — uses two-millimetre stab incisions over marked varicosities.
The vein is hooked out and avulsed with no attempt at formal ligation.
Bleeding is controlled by elevation and tumescent anaesthesia.
This provides excellent cosmesis with minimal scarring.
AMBULATORY PHLEBECTOMY is the office-based equivalent — performed under local anaesthesia,
it complements endovenous trunk ablation beautifully.
Current guidelines recommend endovenous ablation OVER surgery for truncal reflux,
with surgery reserved for anatomy unsuitable for catheter-based access.""",
# Slide 14 – Algorithm
"""Putting it all together, this treatment algorithm guides clinical decision-making.
All patients begin with a history, examination, and CEAP classification.
Duplex ultrasound is then performed — this is MANDATORY before any intervention.
For ASYMPTOMATIC patients at C-zero to C-one: reassure, advise lifestyle changes,
and offer optional sclerotherapy for cosmetic concerns.
For SYMPTOMATIC patients at C-two to C-three: offer a six to eight week trial of compression,
followed by endovenous ablation — laser or radiofrequency — for confirmed truncal reflux,
with stab avulsion for tributary varicosities.
For COMPLICATED patients at C-four to C-six: prompt intervention is required.
Endovenous ablation should be performed alongside wound care and ulcer management,
with ongoing compression to support healing and prevent recurrence.
This algorithm follows the 2022 Society for Vascular Surgery and American Venous Forum guidelines.""",
# Slide 15 – Key Takeaways
"""Let us close with the six key takeaways from this presentation.
One: Varicose veins begin with vein WALL structural changes — not simply valve failure.
The wall weakens first, then valves become incompetent.
Two: Up to fifty percent of adults are affected. Female sex, pregnancy, obesity, and DVT are the major risk factors.
Three: CEAP classification is essential. C-two means varicose veins — intervention is warranted if symptomatic.
C-six means active ulceration — this requires urgent treatment.
Four: Duplex ultrasound is MANDATORY before any intervention. It identifies reflux, maps anatomy, and guides treatment.
Five: Endovenous ablation — laser or radiofrequency — is the preferred first-line intervention,
superior to open surgery per current international guidelines.
Six: Absolute indications for treatment are haemorrhage, active ulceration, and lipodermatosclerosis.
Compression alone is appropriate for asymptomatic disease.
Thank you for watching this educational video on varicose veins.""",
]
# ──────────────────────────────────────────────
# GENERATE AUDIO FILES
# ──────────────────────────────────────────────
AUDIO_DIR = "/tmp/vv_audio"
SLIDES_DIR = "/tmp/vv_slides"
OUTPUT_VIDEO = "/home/daytona/workspace/varicose-veins/Varicose_Veins_Narrated.mp4"
os.makedirs(AUDIO_DIR, exist_ok=True)
print("Generating TTS audio for 15 slides...")
for i, narration in enumerate(NARRATIONS, start=1):
out_path = f"{AUDIO_DIR}/audio_{i:02d}.mp3"
if not os.path.exists(out_path):
print(f" Generating audio for slide {i}...")
tts = gTTS(text=narration.strip(), lang='en', slow=False)
tts.save(out_path)
time.sleep(0.5) # small delay to avoid rate limiting
else:
print(f" Slide {i} audio already exists, skipping.")
print("All audio files generated.")
# ──────────────────────────────────────────────
# GET AUDIO DURATIONS
# ──────────────────────────────────────────────
def get_duration(path):
result = subprocess.run(
["ffprobe", "-v", "error", "-show_entries", "format=duration",
"-of", "default=noprint_wrappers=1:nokey=1", path],
capture_output=True, text=True
)
return float(result.stdout.strip())
durations = []
for i in range(1, 16):
d = get_duration(f"{AUDIO_DIR}/audio_{i:02d}.mp3")
durations.append(d)
print(f" Slide {i:2d} audio duration: {d:.1f}s")
total = sum(durations)
print(f"\nTotal video duration: {total:.0f}s ({total/60:.1f} min)")
# ──────────────────────────────────────────────
# BUILD PER-SLIDE VIDEO SEGMENTS
# ──────────────────────────────────────────────
SEGMENTS_DIR = "/tmp/vv_segments"
os.makedirs(SEGMENTS_DIR, exist_ok=True)
print("\nBuilding per-slide video segments...")
for i in range(1, 16):
slide_img = f"{SLIDES_DIR}/slide_{i:02d}.png"
audio_file = f"{AUDIO_DIR}/audio_{i:02d}.mp3"
out_seg = f"{SEGMENTS_DIR}/segment_{i:02d}.mp4"
dur = durations[i-1] + 0.5 # tiny buffer after audio ends
cmd = [
"ffmpeg", "-y",
"-loop", "1", "-i", slide_img,
"-i", audio_file,
"-vf", "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2:color=#1A0A12",
"-c:v", "libx264", "-preset", "fast", "-crf", "22",
"-c:a", "aac", "-b:a", "128k",
"-shortest",
"-t", str(dur),
"-pix_fmt", "yuv420p",
"-r", "25",
out_seg
]
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode == 0:
print(f" Segment {i:2d}: OK ({dur:.1f}s)")
else:
print(f" Segment {i:2d}: FAILED")
print(result.stderr[-500:])
# ──────────────────────────────────────────────
# CONCATENATE ALL SEGMENTS
# ──────────────────────────────────────────────
print("\nConcatenating all segments into final video...")
concat_file = "/tmp/vv_segments/concat.txt"
with open(concat_file, "w") as f:
for i in range(1, 16):
f.write(f"file '/tmp/vv_segments/segment_{i:02d}.mp4'\n")
cmd = [
"ffmpeg", "-y",
"-f", "concat", "-safe", "0", "-i", concat_file,
"-c:v", "libx264", "-preset", "fast", "-crf", "22",
"-c:a", "aac", "-b:a", "128k",
"-pix_fmt", "yuv420p",
OUTPUT_VIDEO
]
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode == 0:
size = os.path.getsize(OUTPUT_VIDEO)
print(f"\n✅ Video saved: {OUTPUT_VIDEO}")
print(f" File size: {size/1024/1024:.1f} MB")
print(f" Duration: {total:.0f}s (~{total/60:.1f} min)")
else:
print("❌ Concatenation failed:")
print(result.stderr[-1000:])
cd /home/daytona/workspace/varicose-veins && python3 generate_video.py 2>&1