Ppt on diabetes
mkdir -p /home/daytona/workspace/diabetes-ppt
~/diabetes-ppt/create_ppt.js
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Diabetes Mellitus";
pres.author = "Orris Medical AI";
// ─── THEME ───────────────────────────────────────────────────────────────────
const C = {
navy: "0A2342", // dominant dark
teal: "1A7A6E", // supporting accent
tealLight: "2ABFAA", // highlights
amber: "E8A838", // sharp accent
white: "FFFFFF",
offWhite: "F0F4F8",
lightGray: "D4DCE6",
midGray: "6B7D8F",
darkText: "1A2B3C",
};
const FONT = "Calibri";
// ─── HELPERS ─────────────────────────────────────────────────────────────────
function darkBg(slide) {
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.navy } });
}
function lightBg(slide) {
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite } });
}
function accentBar(slide, label, y = 0) {
slide.addShape(pres.ShapeType.rect, { x: 0, y, w: 10, h: 0.08, fill: { color: C.tealLight } });
}
function sectionLabel(slide, text) {
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.42, fill: { color: C.teal } });
slide.addText(text.toUpperCase(), {
x: 0.3, y: 0.04, w: 9.4, h: 0.34, fontSize: 10, bold: true,
color: C.white, fontFace: FONT, charSpacing: 3, valign: "middle", margin: 0
});
}
function slideTitle(slide, title, x = 0.45, y = 0.55, w = 9.1) {
slide.addText(title, {
x, y, w, h: 0.65, fontSize: 26, bold: true,
color: C.navy, fontFace: FONT, valign: "middle"
});
slide.addShape(pres.ShapeType.rect, { x, y: y + 0.68, w: 1.2, h: 0.05, fill: { color: C.amber } });
}
function footerLine(slide, pageNum) {
slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.45, w: 10, h: 0.02, fill: { color: C.lightGray } });
slide.addText("Diabetes Mellitus | Medical Education", {
x: 0.3, y: 5.46, w: 7, h: 0.16, fontSize: 8, color: C.midGray, fontFace: FONT
});
slide.addText(String(pageNum), {
x: 9.5, y: 5.46, w: 0.4, h: 0.16, fontSize: 8, color: C.midGray, fontFace: FONT, align: "right"
});
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 1: TITLE
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
darkBg(s);
// Left accent stripe
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.12, h: 5.625, fill: { color: C.tealLight } });
// Decorative circle
s.addShape(pres.ShapeType.ellipse, { x: 6.5, y: -1.2, w: 5.5, h: 5.5, fill: { color: "122A4A" }, line: { color: "122A4A" } });
s.addShape(pres.ShapeType.ellipse, { x: 7.2, y: -0.5, w: 4.0, h: 4.0, fill: { color: "0D3A60" }, line: { color: "0D3A60" } });
s.addText("DIABETES", {
x: 0.6, y: 1.2, w: 8.5, h: 1.1, fontSize: 58, bold: true,
color: C.white, fontFace: FONT, charSpacing: 8
});
s.addText("MELLITUS", {
x: 0.6, y: 2.15, w: 8.5, h: 1.0, fontSize: 58, bold: true,
color: C.tealLight, fontFace: FONT, charSpacing: 8
});
s.addShape(pres.ShapeType.rect, { x: 0.6, y: 3.2, w: 3.5, h: 0.06, fill: { color: C.amber } });
s.addText("A Comprehensive Clinical Overview", {
x: 0.6, y: 3.35, w: 7, h: 0.4, fontSize: 16,
color: C.lightGray, fontFace: FONT, italic: true
});
s.addText("Harrison's Principles of Internal Medicine · Miller's Anesthesia · Rosen's Emergency Medicine", {
x: 0.6, y: 4.8, w: 9, h: 0.3, fontSize: 8.5,
color: C.midGray, fontFace: FONT, italic: true
});
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 2: AGENDA / OUTLINE
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
lightBg(s);
sectionLabel(s, "Overview");
slideTitle(s, "Topics Covered");
const topics = [
["01", "Definition & Epidemiology"],
["02", "Classification"],
["03", "Pathophysiology"],
["04", "Clinical Features & Diagnosis"],
["05", "Acute Complications"],
["06", "Chronic Complications"],
["07", "Management & Treatment"],
["08", "Prevention & Key Takeaways"],
];
// Two columns
const col1 = topics.slice(0, 4);
const col2 = topics.slice(4);
const startY = 1.5;
const rowH = 0.72;
[col1, col2].forEach((col, ci) => {
col.forEach((item, ri) => {
const x = ci === 0 ? 0.45 : 5.25;
const y = startY + ri * rowH;
// Number badge
s.addShape(pres.ShapeType.rect, { x, y, w: 0.5, h: 0.45, fill: { color: C.teal }, rectRadius: 0.06 });
s.addText(item[0], { x, y: y + 0.02, w: 0.5, h: 0.4, fontSize: 13, bold: true, color: C.white, fontFace: FONT, align: "center", valign: "middle" });
// Topic text
s.addText(item[1], { x: x + 0.6, y: y + 0.04, w: 4.0, h: 0.38, fontSize: 14, color: C.darkText, fontFace: FONT, valign: "middle" });
});
});
footerLine(s, 2);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 3: DEFINITION & EPIDEMIOLOGY
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
lightBg(s);
sectionLabel(s, "Definition & Epidemiology");
slideTitle(s, "What Is Diabetes Mellitus?");
// Definition box
s.addShape(pres.ShapeType.rect, { x: 0.45, y: 1.45, w: 9.1, h: 0.85, fill: { color: C.navy }, rectRadius: 0.1 });
s.addText("Diabetes mellitus is a group of metabolic diseases characterized by hyperglycemia resulting from defects in insulin secretion, insulin action, or both. Chronic hyperglycemia leads to long-term damage and dysfunction of multiple organs.", {
x: 0.6, y: 1.5, w: 8.8, h: 0.75, fontSize: 12, color: C.white, fontFace: FONT, valign: "middle"
});
// Stats cards
const cards = [
{ val: "537M+", label: "Adults with Diabetes\nWorldwide (2021)" },
{ val: "5–10%", label: "of cases are\nType 1 DM" },
{ val: "90–95%", label: "of cases are\nType 2 DM" },
{ val: "2040", label: "Projected major\nglobal rise" },
];
cards.forEach((c, i) => {
const x = 0.45 + i * 2.3;
s.addShape(pres.ShapeType.rect, { x, y: 2.55, w: 2.1, h: 1.3, fill: { color: C.teal }, rectRadius: 0.1 });
s.addText(c.val, { x, y: 2.65, w: 2.1, h: 0.5, fontSize: 22, bold: true, color: C.amber, fontFace: FONT, align: "center" });
s.addText(c.label, { x, y: 3.1, w: 2.1, h: 0.65, fontSize: 11, color: C.white, fontFace: FONT, align: "center", valign: "top" });
});
s.addText("Source: IDF Diabetes Atlas; Harrison's Principles of Internal Medicine 22E", {
x: 0.45, y: 4.95, w: 9.1, h: 0.25, fontSize: 8, color: C.midGray, fontFace: FONT, italic: true
});
footerLine(s, 3);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 4: CLASSIFICATION
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
lightBg(s);
sectionLabel(s, "Classification");
slideTitle(s, "Types of Diabetes Mellitus");
const types = [
{
title: "Type 1 DM",
color: C.navy,
points: [
"Autoimmune destruction of beta cells",
"Absolute insulin deficiency",
"5–10% of all cases",
"Onset: childhood / early adulthood",
"Prone to DKA",
]
},
{
title: "Type 2 DM",
color: C.teal,
points: [
"Progressive beta cell dysfunction",
"Background of insulin resistance",
"90–95% of all cases",
"Associated with obesity & metabolic syndrome",
"Prone to HHS",
]
},
{
title: "Gestational DM",
color: "2E6B9B",
points: [
"Diagnosed during pregnancy",
"Not overt DM prior to gestation",
"2nd or 3rd trimester",
"Risk of future T2DM for mother",
"Managed with diet ± insulin",
]
},
{
title: "Other Specific Types",
color: "4A7B5E",
points: [
"Monogenic: MODY, neonatal DM",
"Exocrine pancreas disease",
"Drug-induced (glucocorticoids, HIV Rx)",
"Post-transplant",
"Endocrinopathies (Cushing's, acromegaly)",
]
},
];
types.forEach((t, i) => {
const x = 0.45 + i * 2.38;
s.addShape(pres.ShapeType.rect, { x, y: 1.45, w: 2.2, h: 0.4, fill: { color: t.color }, rectRadius: 0.07 });
s.addText(t.title, { x, y: 1.5, w: 2.2, h: 0.3, fontSize: 11, bold: true, color: C.white, fontFace: FONT, align: "center", valign: "middle" });
s.addShape(pres.ShapeType.rect, { x, y: 1.88, w: 2.2, h: 3.2, fill: { color: C.white }, line: { color: C.lightGray, pt: 1 }, rectRadius: 0.07 });
s.addText(t.points.map(p => ({ text: p, options: { bullet: { indent: 10 }, breakLine: true, fontSize: 10, color: C.darkText, fontFace: FONT } })),
{ x: x + 0.08, y: 1.95, w: 2.05, h: 3.05 });
});
footerLine(s, 4);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 5: PATHOPHYSIOLOGY
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
// Split dark/light background
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 4.8, h: 5.625, fill: { color: C.navy } });
s.addShape(pres.ShapeType.rect, { x: 4.8, y: 0, w: 5.2, h: 5.625, fill: { color: C.offWhite } });
sectionLabel(s, "Pathophysiology");
// Left: T1DM
s.addText("TYPE 1 DM", {
x: 0.3, y: 0.55, w: 4.2, h: 0.5, fontSize: 18, bold: true, color: C.tealLight, fontFace: FONT, charSpacing: 2
});
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.0, w: 1.5, h: 0.05, fill: { color: C.amber } });
const t1Steps = [
"Genetic susceptibility (HLA loci)",
"Environmental trigger (enterovirus?)",
"Autoantibodies form (anti-GAD65, anti-IA2, anti-insulin)",
"T-cell mediated destruction of beta cells",
"Progressive loss of insulin secretion",
"Absolute insulin deficiency → hyperglycemia",
];
s.addText(t1Steps.map((p, i) => ({
text: `${i + 1}. ${p}`,
options: { breakLine: true, fontSize: 11, color: i < 3 ? C.lightGray : C.white, fontFace: FONT, bold: i >= 4 }
})), { x: 0.3, y: 1.15, w: 4.3, h: 4.0 });
// Right: T2DM
s.addText("TYPE 2 DM", {
x: 5.1, y: 0.55, w: 4.6, h: 0.5, fontSize: 18, bold: true, color: C.navy, fontFace: FONT, charSpacing: 2
});
s.addShape(pres.ShapeType.rect, { x: 5.1, y: 1.0, w: 1.5, h: 0.05, fill: { color: C.teal } });
const t2Steps = [
"Genetic predisposition + obesity",
"Peripheral insulin resistance (muscle, liver, fat)",
"Beta cells compensate with excess insulin",
"Beta cell exhaustion over time",
"Relative insulin deficiency",
"Hyperglycemia + metabolic syndrome",
];
s.addText(t2Steps.map((p, i) => ({
text: `${i + 1}. ${p}`,
options: { breakLine: true, fontSize: 11, color: i < 3 ? C.midGray : C.darkText, fontFace: FONT, bold: i >= 4 }
})), { x: 5.1, y: 1.15, w: 4.6, h: 4.0 });
footerLine(s, 5);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 6: CLINICAL FEATURES & DIAGNOSIS
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
lightBg(s);
sectionLabel(s, "Clinical Features & Diagnosis");
slideTitle(s, "Recognizing & Diagnosing Diabetes");
// Symptoms section
s.addShape(pres.ShapeType.rect, { x: 0.45, y: 1.5, w: 4.2, h: 0.32, fill: { color: C.teal }, rectRadius: 0.06 });
s.addText("CLASSIC SYMPTOMS (4 Polys + Weight Loss)", {
x: 0.55, y: 1.54, w: 4.0, h: 0.24, fontSize: 9.5, bold: true, color: C.white, fontFace: FONT, valign: "middle"
});
const symptoms = ["Polyuria (excessive urination)", "Polydipsia (excessive thirst)", "Polyphagia (excessive hunger)", "Polyneuropathy (tingling / numbness)", "Unexplained weight loss", "Blurred vision, fatigue, poor wound healing"];
s.addText(symptoms.map(p => ({ text: p, options: { bullet: true, breakLine: true, fontSize: 11, color: C.darkText, fontFace: FONT } })),
{ x: 0.55, y: 1.88, w: 4.0, h: 2.5 });
// Diagnostic Criteria box
s.addShape(pres.ShapeType.rect, { x: 4.95, y: 1.45, w: 4.6, h: 3.7, fill: { color: C.navy }, rectRadius: 0.12 });
s.addText("DIAGNOSTIC CRITERIA (ADA)", {
x: 5.05, y: 1.55, w: 4.4, h: 0.35, fontSize: 11, bold: true, color: C.amber, fontFace: FONT, align: "center", charSpacing: 1
});
const criteria = [
{ label: "Random Glucose", val: "> 200 mg/dL + symptoms" },
{ label: "HbA1c", val: "≥ 6.5%" },
{ label: "Fasting Glucose", val: "> 126 mg/dL (8 hr fast)*" },
{ label: "2-hr OGTT", val: "> 200 mg/dL (75 g load)" },
{ label: "Pre-diabetes HbA1c", val: "5.7 – 6.4%" },
{ label: "Impaired Fasting", val: "100 – 125 mg/dL" },
];
criteria.forEach((c, i) => {
const y = 2.02 + i * 0.51;
s.addShape(pres.ShapeType.rect, { x: 5.05, y, w: 2.0, h: 0.38, fill: { color: C.teal }, rectRadius: 0.05 });
s.addText(c.label, { x: 5.1, y: y + 0.04, w: 1.9, h: 0.3, fontSize: 10, bold: true, color: C.white, fontFace: FONT, valign: "middle" });
s.addText(c.val, { x: 7.1, y: y + 0.04, w: 2.35, h: 0.3, fontSize: 10, color: C.lightGray, fontFace: FONT, valign: "middle" });
});
s.addText("* Confirmed by repeat testing", {
x: 5.05, y: 5.1, w: 4.4, h: 0.2, fontSize: 8, color: C.midGray, fontFace: FONT, italic: true
});
footerLine(s, 6);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 7: ACUTE COMPLICATIONS
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
darkBg(s);
sectionLabel(s, "Acute Complications");
s.addText("Acute Complications", {
x: 0.5, y: 0.55, w: 9, h: 0.7, fontSize: 26, bold: true, color: C.white, fontFace: FONT
});
s.addShape(pres.ShapeType.rect, { x: 0.5, y: 1.22, w: 1.2, h: 0.05, fill: { color: C.amber } });
const comps = [
{
title: "Diabetic Ketoacidosis (DKA)",
badge: "T1DM",
color: "B23A2E",
points: [
"Absolute insulin deficiency",
"Glucose > 250 mg/dL, ketones ↑, pH < 7.3",
"Nausea, vomiting, abdominal pain",
"Kussmaul breathing, fruity breath",
"Precipitants: infection, missed insulin, MI",
"Rx: IV fluids, insulin infusion, K⁺ replacement",
]
},
{
title: "Hyperosmolar Hyperglycemic State (HHS)",
badge: "T2DM",
color: "B27A2E",
points: [
"Severe hyperglycemia (> 600 mg/dL)",
"Hyperosmolarity, no significant ketosis",
"Altered consciousness, seizures",
"Associated with acute illness",
"High mortality rate (~15%)",
"Rx: Aggressive IV fluids, gradual insulin",
]
},
{
title: "Hypoglycemia",
badge: "Any DM",
color: "1A7A6E",
points: [
"Glucose < 70 mg/dL",
"Sweating, dizziness, palpitations",
"Severe: < 54 mg/dL → neuroglycopenia",
"Headache, confusion, seizure",
"Hypoglycemic unawareness with recurrence",
"Rx: 15 g fast carbs or IV dextrose",
]
},
];
comps.forEach((c, i) => {
const x = 0.3 + i * 3.2;
s.addShape(pres.ShapeType.rect, { x, y: 1.4, w: 3.05, h: 3.9, fill: { color: "11294A" }, rectRadius: 0.12 });
s.addShape(pres.ShapeType.rect, { x, y: 1.4, w: 3.05, h: 0.5, fill: { color: c.color }, rectRadius: 0.12 });
s.addShape(pres.ShapeType.rect, { x, y: 1.7, w: 3.05, h: 0.2, fill: { color: c.color } });
s.addText(c.title, { x: x + 0.1, y: 1.43, w: 2.4, h: 0.44, fontSize: 10.5, bold: true, color: C.white, fontFace: FONT, valign: "middle" });
// Badge
s.addShape(pres.ShapeType.rect, { x: x + 2.35, y: 1.47, w: 0.62, h: 0.28, fill: { color: C.amber }, rectRadius: 0.05 });
s.addText(c.badge, { x: x + 2.33, y: 1.48, w: 0.66, h: 0.26, fontSize: 8, bold: true, color: C.navy, fontFace: FONT, align: "center", valign: "middle" });
s.addText(c.points.map(p => ({ text: p, options: { bullet: true, breakLine: true, fontSize: 10, color: C.lightGray, fontFace: FONT } })),
{ x: x + 0.12, y: 2.0, w: 2.8, h: 3.1 });
});
footerLine(s, 7);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 8: CHRONIC COMPLICATIONS
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
lightBg(s);
sectionLabel(s, "Chronic Complications");
slideTitle(s, "Long-Term Complications of Diabetes");
// Microvascular
s.addShape(pres.ShapeType.rect, { x: 0.45, y: 1.45, w: 4.3, h: 0.35, fill: { color: C.teal }, rectRadius: 0.07 });
s.addText("MICROVASCULAR (Diabetes-specific)", {
x: 0.55, y: 1.5, w: 4.1, h: 0.25, fontSize: 10, bold: true, color: C.white, fontFace: FONT, valign: "middle"
});
const micro = [
["Retinopathy", "Leading cause of blindness in working-age adults; proliferative & non-proliferative forms"],
["Nephropathy", "Diabetic kidney disease; leading cause of ESRD; presents as proteinuria → CKD"],
["Neuropathy", "Peripheral (glove-stocking), autonomic (gastroparesis, orthostatic hypotension), mononeuropathy"],
];
micro.forEach(([title, desc], i) => {
const y = 1.92 + i * 0.9;
s.addShape(pres.ShapeType.rect, { x: 0.45, y, w: 0.08, h: 0.68, fill: { color: C.tealLight } });
s.addText(title, { x: 0.65, y, w: 4.0, h: 0.3, fontSize: 12, bold: true, color: C.navy, fontFace: FONT });
s.addText(desc, { x: 0.65, y: y + 0.3, w: 4.0, h: 0.38, fontSize: 10, color: C.midGray, fontFace: FONT });
});
// Macrovascular
s.addShape(pres.ShapeType.rect, { x: 5.0, y: 1.45, w: 4.55, h: 0.35, fill: { color: C.navy }, rectRadius: 0.07 });
s.addText("MACROVASCULAR (Shared pathophysiology)", {
x: 5.1, y: 1.5, w: 4.35, h: 0.25, fontSize: 10, bold: true, color: C.white, fontFace: FONT, valign: "middle"
});
const macro = [
["Atherosclerotic CVD", "2-4x higher ASCVD risk; MI, stroke; correlates with HbA1c and postprandial glucose"],
["Peripheral Arterial Disease", "Claudication → critical limb ischemia; major driver of diabetic foot complications"],
["Heart Failure", "Both HFrEF and HFpEF; SGLT2 inhibitors have shown benefit in outcome trials"],
];
macro.forEach(([title, desc], i) => {
const y = 1.92 + i * 0.9;
s.addShape(pres.ShapeType.rect, { x: 5.0, y, w: 0.08, h: 0.68, fill: { color: C.amber } });
s.addText(title, { x: 5.2, y, w: 4.2, h: 0.3, fontSize: 12, bold: true, color: C.navy, fontFace: FONT });
s.addText(desc, { x: 5.2, y: y + 0.3, w: 4.2, h: 0.38, fontSize: 10, color: C.midGray, fontFace: FONT });
});
// Non-vascular footer
s.addShape(pres.ShapeType.rect, { x: 0.45, y: 4.78, w: 9.1, h: 0.38, fill: { color: C.lightGray }, rectRadius: 0.07 });
s.addText("Non-vascular complications also include: infections, skin changes (necrobiosis lipoidica), cheiroarthropathy, hearing loss, fractures, dementia, cognitive impairment", {
x: 0.6, y: 4.82, w: 8.8, h: 0.3, fontSize: 9.5, color: C.darkText, fontFace: FONT, valign: "middle"
});
footerLine(s, 8);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 9: MANAGEMENT — NON-PHARMACOLOGICAL
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
lightBg(s);
sectionLabel(s, "Management");
slideTitle(s, "Non-Pharmacological Management");
const pillars = [
{ icon: "🥗", title: "Medical Nutrition Therapy", points: ["Individualized meal planning", "Low glycemic index foods", "Reduce simple sugars & saturated fat", "Mediterranean or DASH diet patterns"] },
{ icon: "🏃", title: "Physical Activity", points: ["150 min/wk moderate aerobic exercise", "Resistance training 2–3x/week", "Reduces HbA1c by ~0.6–1.0%", "Improves insulin sensitivity"] },
{ icon: "⚖️", title: "Weight Management", points: ["5–10% weight loss significantly improves glycemia", "T2DM remission possible with >15 kg loss", "Bariatric surgery for BMI ≥ 35", "Goal: prevent further beta cell decline"] },
{ icon: "📋", title: "Self-Monitoring & Education", points: ["SMBG or continuous glucose monitoring (CGM)", "HbA1c target: < 7.0% for most adults", "Foot care, eye exams, BP control", "Diabetes self-management education (DSME)"] },
];
pillars.forEach((p, i) => {
const x = 0.45 + i * 2.35;
s.addShape(pres.ShapeType.rect, { x, y: 1.5, w: 2.2, h: 3.8, fill: C.white, line: { color: C.lightGray, pt: 1.5 }, rectRadius: 0.1 });
s.addText(p.icon, { x, y: 1.6, w: 2.2, h: 0.55, fontSize: 26, align: "center" });
s.addShape(pres.ShapeType.rect, { x: x + 0.1, y: 2.15, w: 2.0, h: 0.04, fill: { color: C.tealLight } });
s.addText(p.title, { x: x + 0.05, y: 2.22, w: 2.1, h: 0.45, fontSize: 11, bold: true, color: C.navy, fontFace: FONT, align: "center", wrap: true });
s.addText(p.points.map(pt => ({ text: pt, options: { bullet: true, breakLine: true, fontSize: 10, color: C.darkText, fontFace: FONT } })),
{ x: x + 0.1, y: 2.72, w: 2.0, h: 2.45 });
});
footerLine(s, 9);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 10: MANAGEMENT — PHARMACOLOGICAL
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
lightBg(s);
sectionLabel(s, "Pharmacological Management");
slideTitle(s, "Pharmacotherapy for Type 2 Diabetes");
const drugs = [
{ name: "Metformin (Biguanide)", color: C.navy, badge: "1st Line", details: "↓ hepatic gluconeogenesis; no weight gain; HbA1c ↓ ~1.5%; avoid if GFR < 30" },
{ name: "Sulfonylureas", color: C.teal, badge: "Add-on", details: "Stimulate pancreatic insulin release (glipizide, glimepiride); risk of hypoglycemia" },
{ name: "DPP-4 Inhibitors", color: "2E6B9B", badge: "Add-on", details: "↓ insulin degradation (sitagliptin); once daily; weight neutral; low hypoglycemia risk" },
{ name: "SGLT2 Inhibitors", color: "4A7B5E", badge: "CV Benefit", details: "Block renal glucose reabsorption (empagliflozin); ↓ HF hospitalization, CKD progression" },
{ name: "GLP-1 Receptor Agonists", color: "7B4A2E", badge: "CV + Weight", details: "Incretin mimetics (semaglutide, liraglutide); significant weight loss; CV & renal benefits" },
{ name: "Insulin", color: "5E2E7B", badge: "T1DM / T2DM", details: "Basal-bolus regimens for T1DM; added to T2DM when oral agents fail; various formulations" },
];
drugs.forEach((d, i) => {
const row = Math.floor(i / 3);
const col = i % 3;
const x = 0.45 + col * 3.1;
const y = 1.5 + row * 1.72;
s.addShape(pres.ShapeType.rect, { x, y, w: 2.95, h: 1.55, fill: C.white, line: { color: C.lightGray, pt: 1 }, rectRadius: 0.08 });
s.addShape(pres.ShapeType.rect, { x, y, w: 2.95, h: 0.38, fill: { color: d.color }, rectRadius: 0.08 });
s.addShape(pres.ShapeType.rect, { x, y: 0.3 + y, w: 2.95, h: 0.08, fill: { color: d.color } });
s.addText(d.name, { x: x + 0.07, y: y + 0.04, w: 2.2, h: 0.3, fontSize: 10.5, bold: true, color: C.white, fontFace: FONT, valign: "middle" });
// Badge
s.addShape(pres.ShapeType.rect, { x: x + 2.17, y: y + 0.07, w: 0.7, h: 0.24, fill: { color: C.amber }, rectRadius: 0.04 });
s.addText(d.badge, { x: x + 2.15, y: y + 0.07, w: 0.74, h: 0.24, fontSize: 8, bold: true, color: C.navy, fontFace: FONT, align: "center", valign: "middle" });
s.addText(d.details, { x: x + 0.1, y: y + 0.44, w: 2.75, h: 1.0, fontSize: 10, color: C.darkText, fontFace: FONT, valign: "top", wrap: true });
});
footerLine(s, 10);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 11: INSULIN THERAPY (T1DM focus)
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
darkBg(s);
sectionLabel(s, "Insulin Therapy");
s.addText("Insulin Therapy", {
x: 0.5, y: 0.55, w: 9, h: 0.6, fontSize: 26, bold: true, color: C.white, fontFace: FONT
});
s.addShape(pres.ShapeType.rect, { x: 0.5, y: 1.18, w: 1.2, h: 0.05, fill: { color: C.amber } });
// Table
const headers = ["Insulin Type", "Onset", "Peak", "Duration", "Use"];
const rows = [
["Rapid-acting\n(Lispro, Aspart)", "10–15 min", "1–2 hr", "3–5 hr", "Mealtime bolus"],
["Short-acting\n(Regular)", "30–60 min", "2–4 hr", "5–8 hr", "Mealtime / IV"],
["Intermediate\n(NPH)", "1–3 hr", "4–8 hr", "12–18 hr", "Basal (twice daily)"],
["Long-acting\n(Glargine, Detemir)", "1–2 hr", "Flat", "20–24 hr", "Once-daily basal"],
["Ultra-long\n(Degludec)", "1 hr", "Peakless", "> 42 hr", "Flexible basal"],
];
const colW = [2.2, 1.3, 1.0, 1.2, 2.2];
const startX = 0.45;
let curX = startX;
// Header row
headers.forEach((h, ci) => {
s.addShape(pres.ShapeType.rect, { x: curX, y: 1.35, w: colW[ci], h: 0.35, fill: { color: C.teal } });
s.addText(h, { x: curX + 0.05, y: 1.37, w: colW[ci] - 0.1, h: 0.31, fontSize: 10, bold: true, color: C.white, fontFace: FONT, valign: "middle", align: "center" });
curX += colW[ci] + 0.06;
});
rows.forEach((row, ri) => {
curX = startX;
const y = 1.76 + ri * 0.64;
const rowColor = ri % 2 === 0 ? "112A4A" : "0F2440";
row.forEach((cell, ci) => {
s.addShape(pres.ShapeType.rect, { x: curX, y, w: colW[ci], h: 0.58, fill: { color: rowColor } });
s.addText(cell, { x: curX + 0.05, y: y + 0.04, w: colW[ci] - 0.1, h: 0.5, fontSize: 10, color: ci === 0 ? C.tealLight : C.lightGray, fontFace: FONT, valign: "middle", align: "center", bold: ci === 0, wrap: true });
curX += colW[ci] + 0.06;
});
});
s.addText("The DCCT trial demonstrated intensive insulin therapy reduced retinopathy by 47%, nephropathy by 54%, and neuropathy by 60%.", {
x: 0.45, y: 5.1, w: 9.1, h: 0.25, fontSize: 8.5, color: C.midGray, fontFace: FONT, italic: true
});
footerLine(s, 11);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 12: GLYCEMIC TARGETS
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
lightBg(s);
sectionLabel(s, "Glycemic Targets");
slideTitle(s, "Monitoring & Target Goals (ADA Guidelines)");
const targets = [
{ metric: "HbA1c", goal: "< 7.0%", note: "Most non-pregnant adults; < 8% for elderly / complex" },
{ metric: "Fasting Blood\nGlucose", goal: "80–130 mg/dL", note: "Pre-meal capillary glucose target" },
{ metric: "Post-prandial\nGlucose (2-hr)", goal: "< 180 mg/dL", note: "Peak postprandial capillary glucose" },
{ metric: "Blood Pressure", goal: "< 130/80 mmHg", note: "ACE inhibitors / ARBs preferred if proteinuria" },
{ metric: "LDL Cholesterol", goal: "< 70 mg/dL", note: "Statin therapy for all T2DM patients > 40 yrs" },
{ metric: "BMI / Weight", goal: "< 25 kg/m²", note: "5–10% weight reduction significantly improves control" },
];
targets.forEach((t, i) => {
const col = i % 2;
const row = Math.floor(i / 2);
const x = 0.45 + col * 4.75;
const y = 1.5 + row * 1.18;
s.addShape(pres.ShapeType.rect, { x, y, w: 4.5, h: 1.05, fill: C.white, line: { color: C.lightGray, pt: 1 }, rectRadius: 0.1 });
s.addShape(pres.ShapeType.rect, { x, y, w: 0.1, h: 1.05, fill: { color: C.teal }, rectRadius: 0.04 });
s.addText(t.metric, { x: x + 0.2, y: y + 0.07, w: 2.2, h: 0.42, fontSize: 12, bold: true, color: C.navy, fontFace: FONT, wrap: true });
s.addShape(pres.ShapeType.rect, { x: x + 2.55, y: y + 0.15, w: 1.8, h: 0.36, fill: { color: C.amber }, rectRadius: 0.07 });
s.addText(t.goal, { x: x + 2.52, y: y + 0.15, w: 1.84, h: 0.36, fontSize: 12, bold: true, color: C.navy, fontFace: FONT, align: "center", valign: "middle" });
s.addText(t.note, { x: x + 0.2, y: y + 0.55, w: 4.2, h: 0.42, fontSize: 9.5, color: C.midGray, fontFace: FONT });
});
footerLine(s, 12);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 13: PREVENTION
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
// Gradient-like split
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.navy } });
sectionLabel(s, "Prevention");
s.addText("Prevention of Type 2 Diabetes", {
x: 0.5, y: 0.55, w: 9, h: 0.6, fontSize: 26, bold: true, color: C.white, fontFace: FONT
});
s.addShape(pres.ShapeType.rect, { x: 0.5, y: 1.18, w: 1.5, h: 0.05, fill: { color: C.amber } });
const prevItems = [
{ num: "01", title: "Lifestyle Modification", body: "The Diabetes Prevention Program (DPP) showed 58% reduction in T2DM incidence with 7% weight loss + 150 min/wk exercise in high-risk individuals." },
{ num: "02", title: "Metformin Prophylaxis", body: "In the DPP trial, metformin reduced T2DM incidence by 31% in adults with pre-diabetes, particularly those with BMI > 35 or history of gestational DM." },
{ num: "03", title: "Screen High-Risk Groups", body: "Screen all adults ≥ 35 yrs; overweight/obese adults; those with hypertension, dyslipidemia, family history, GDM, or PCOS. Repeat every 3 years if normal." },
{ num: "04", title: "Cardiovascular Risk Reduction", body: "Statins, BP control, smoking cessation, and antiplatelet therapy (selected patients) significantly reduce ASCVD events in people with DM." },
];
prevItems.forEach((item, i) => {
const x = 0.45 + (i % 2) * 4.9;
const y = 1.4 + Math.floor(i / 2) * 1.9;
s.addShape(pres.ShapeType.rect, { x, y, w: 4.6, h: 1.75, fill: { color: "0F2A4A" }, rectRadius: 0.1 });
s.addShape(pres.ShapeType.rect, { x: x + 0.1, y: y + 0.12, w: 0.45, h: 0.45, fill: { color: C.teal }, rectRadius: 0.07 });
s.addText(item.num, { x: x + 0.1, y: y + 0.12, w: 0.45, h: 0.45, fontSize: 12, bold: true, color: C.white, fontFace: FONT, align: "center", valign: "middle" });
s.addText(item.title, { x: x + 0.68, y: y + 0.12, w: 3.8, h: 0.45, fontSize: 13, bold: true, color: C.tealLight, fontFace: FONT, valign: "middle" });
s.addText(item.body, { x: x + 0.15, y: y + 0.65, w: 4.3, h: 1.0, fontSize: 10, color: C.lightGray, fontFace: FONT, wrap: true });
});
footerLine(s, 13);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 14: KEY TAKEAWAYS
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
darkBg(s);
sectionLabel(s, "Summary");
s.addText("Key Takeaways", {
x: 0.5, y: 0.52, w: 9, h: 0.65, fontSize: 28, bold: true, color: C.white, fontFace: FONT
});
s.addShape(pres.ShapeType.rect, { x: 0.5, y: 1.15, w: 1.2, h: 0.05, fill: { color: C.amber } });
const takeaways = [
"Diabetes mellitus is defined by chronic hyperglycemia from defects in insulin secretion, action, or both — affecting over 537 million adults worldwide.",
"T1DM is autoimmune (absolute insulin deficiency); T2DM involves insulin resistance with progressive beta cell failure; both share similar long-term complications.",
"Diagnosis requires meeting one ADA criterion: HbA1c ≥ 6.5%, fasting glucose > 126, 2-hr OGTT > 200, or random glucose > 200 with symptoms.",
"Microvascular complications (retinopathy, nephropathy, neuropathy) are diabetes-specific; macrovascular complications (ASCVD, PAD, HF) carry higher mortality.",
"Glycemic targets: HbA1c < 7% for most adults; achieved through lifestyle, metformin as first-line, and add-on agents (SGLT2i/GLP-1 RA for CV/renal benefit).",
"Prevention works: 7% weight loss + 150 min/wk exercise reduces T2DM incidence by 58% in high-risk individuals (DPP Trial).",
];
takeaways.forEach((t, i) => {
const y = 1.3 + i * 0.68;
s.addShape(pres.ShapeType.rect, { x: 0.45, y: y + 0.1, w: 0.3, h: 0.3, fill: { color: C.teal }, rectRadius: 0.05 });
s.addText(String(i + 1), { x: 0.45, y: y + 0.1, w: 0.3, h: 0.3, fontSize: 11, bold: true, color: C.white, fontFace: FONT, align: "center", valign: "middle" });
s.addText(t, { x: 0.85, y, w: 8.8, h: 0.65, fontSize: 11, color: C.lightGray, fontFace: FONT, valign: "middle", wrap: true });
});
footerLine(s, 14);
}
// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 15: REFERENCES
// ─────────────────────────────────────────────────────────────────────────────
{
const s = pres.addSlide();
lightBg(s);
sectionLabel(s, "References");
slideTitle(s, "Sources & Further Reading");
const refs = [
"Harrison's Principles of Internal Medicine, 22nd Edition (2025) — Chapter 417: Diabetes Mellitus",
"Miller's Anesthesia, 10th Edition (2022) — Chapter on Perioperative Diabetes Management",
"Rosen's Emergency Medicine, 9th Edition — Chapter 115: Diabetes Mellitus & Hypoglycemic Emergencies",
"Creasy & Resnik's Maternal-Fetal Medicine — Classification of Diabetes in Pregnancy",
"Goodman & Gilman's Pharmacological Basis of Therapeutics — Chapter on Antidiabetic Drugs",
"American Diabetes Association: Standards of Medical Care in Diabetes — Diabetes Care (Annual Supplement)",
"DCCT Research Group: Effect of Intensive Therapy on Diabetic Complications. NEJM 1993.",
"DPP Research Group: Reduction in the Incidence of T2DM with Lifestyle Intervention or Metformin. NEJM 2002.",
];
refs.forEach((r, i) => {
s.addText([
{ text: `${i + 1}. `, options: { bold: true, color: C.teal, fontSize: 11 } },
{ text: r, options: { color: C.darkText, fontSize: 11 } }
], { x: 0.45, y: 1.42 + i * 0.49, w: 9.1, h: 0.45, fontFace: FONT });
});
footerLine(s, 15);
}
// ─────────────────────────────────────────────────────────────────────────────
// WRITE FILE
// ─────────────────────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/diabetes-ppt/Diabetes_Mellitus.pptx" })
.then(() => console.log("✅ Presentation saved successfully!"))
.catch(e => { console.error("❌ Error:", e); process.exit(1); });
cd /home/daytona/workspace/diabetes-ppt && node create_ppt.js
ls -lh /home/daytona/workspace/diabetes-ppt/Diabetes_Mellitus.pptx
Diabetes Mellitus
Presentation · PPTX
| Slide | Topic |
|---|---|
| 1 | Title slide - bold navy/teal design |
| 2 | Agenda / Table of Contents |
| 3 | Definition & Epidemiology (537M+ worldwide, stat cards) |
| 4 | Classification - T1DM / T2DM / GDM / Other (4-column layout) |
| 5 | Pathophysiology - split T1DM vs T2DM comparison |
| 6 | Clinical Features & Diagnostic Criteria (ADA) |
| 7 | Acute Complications - DKA, HHS, Hypoglycemia (dark slide) |
| 8 | Chronic Complications - Microvascular vs Macrovascular |
| 9 | Non-Pharmacological Management (4 pillars with icons) |
| 10 | Pharmacotherapy - 6 drug classes with badges |
| 11 | Insulin Therapy - full comparison table (DCCT data) |
| 12 | Glycemic Targets - 6 ADA targets with goal boxes |
| 13 | Prevention - DPP trial data, screening criteria |
| 14 | Key Takeaways (dark summary slide) |
| 15 | References (8 textbook & trial citations) |