Create a PowerPoint presentation for diabetes mellitus and diabetic emergencies covering essential physiology, definitions, Pathophysiology, clinical features, natural history, investigations, and management
diabetes mellitus pathophysiology insulin glucose mechanism
diabetic ketoacidosis DKA pathophysiology treatment algorithm
diabetes complications microvascular macrovascular retinopathy nephropathy neuropathy
mkdir -p /home/daytona/workspace/diabetes-pptx && ls /home/daytona/workspace/diabetes-pptx/
~/diabetes-pptx/create_pptx.js
const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");
// Fetch images as base64
const imageUrls = [
"https://cdn.orris.care/cdss_images/pmc_clinical_VQA_941c21066dfd3864f40b5622a42c85b1791757b3d5bc203e73b2853099bfe1a8.jpg", // insulin signaling
"https://cdn.orris.care/cdss_images/pmc_clinical_VQA_813a248f26e63929707d7321e9dd648d0663b85caf1f97e30270cebb42bc33b6.jpg", // obesity->T2DM->complications
"https://cdn.orris.care/cdss_images/pmc_clinical_VQA_102b96ba8f3f670845b3e31d4c8ac898fa119a78e5babe19cc600103962cd244.jpg", // diabetic foot
"https://cdn.orris.care/cdss_images/pmc_clinical_VQA_71d3003edcc2a813ec4021c6862a60f156a23fffe7656d6138554444b23f0a69.jpg", // retinopathy
"https://cdn.orris.care/cdss_images/HARRISON_1763035986492_e2de3a37-3e6e-4ec4-9178-bf8624edacba.png", // DKA/HHS lab values table
];
console.log("Fetching images...");
let images = [];
try {
const result = execSync(
`node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`,
{ maxBuffer: 50 * 1024 * 1024 }
).toString();
images = JSON.parse(result);
console.log("Images fetched:", images.map(i => i.error ? "ERROR: " + i.error : "OK"));
} catch (e) {
console.error("Image fetch error:", e.message);
images = imageUrls.map(url => ({ url, base64: null, error: e.message }));
}
// ─── COLOUR PALETTE ────────────────────────────────────────────────────────
const C = {
navy: "0D1F4F", // dominant dark
blue: "1565C0", // primary accent
teal: "00838F", // secondary accent
amber: "F57F17", // highlight / warning
red: "C62828", // danger / emergency
white: "FFFFFF",
offwhite:"F5F7FA",
light: "E3F2FD",
muted: "90A4AE",
text: "212121",
subtext: "455A64",
};
let pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author = "Orris Medical Education";
pres.title = "Diabetes Mellitus & Diabetic Emergencies";
// ─── HELPERS ────────────────────────────────────────────────────────────────
function addBg(slide, color) {
slide.background = { color };
}
function addAccentBar(slide, color, h = 0.08) {
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h, fill: { color } });
}
function addBottomBar(slide, color = C.navy) {
slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.45, w: "100%", h: 0.18, fill: { color } });
}
function sectionTitle(slide, label, bgColor = C.navy) {
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: bgColor } });
slide.addShape(pres.ShapeType.rect, { x: 0.4, y: 2.3, w: 0.12, h: 1.2, fill: { color: C.amber } });
slide.addText(label, {
x: 0.7, y: 2.2, w: 8.6, h: 1.5,
fontSize: 42, bold: true, color: C.white,
fontFace: "Calibri", valign: "middle"
});
}
function contentHeader(slide, title, sub = "") {
addBg(slide, C.offwhite);
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.75, fill: { color: C.navy } });
slide.addText(title, {
x: 0.3, y: 0.05, w: 9.4, h: 0.65,
fontSize: 22, bold: true, color: C.white, fontFace: "Calibri", valign: "middle"
});
if (sub) {
slide.addText(sub, {
x: 0.3, y: 0.72, w: 9.4, h: 0.28,
fontSize: 10, color: C.subtext, fontFace: "Calibri", italic: true
});
}
addBottomBar(slide);
}
function bullets(slide, items, x, y, w, h, fontSize = 13, color = C.text) {
const textItems = items.map((item, i) => {
if (typeof item === "string") {
return { text: item, options: { bullet: { type: "bullet" }, breakLine: i < items.length - 1, fontSize, color, fontFace: "Calibri", paraSpaceBefore: 4 } };
}
return { text: item.text, options: { bullet: item.bullet !== false ? { type: "bullet" } : false, bold: item.bold || false, breakLine: i < items.length - 1, fontSize: item.size || fontSize, color: item.color || color, fontFace: "Calibri", paraSpaceBefore: item.space || 4, indentLevel: item.indent || 0 } };
});
slide.addText(textItems, { x, y, w, h, valign: "top" });
}
function box(slide, x, y, w, h, bgColor, title, titleColor, bodyItems, bodyFontSize = 11) {
slide.addShape(pres.ShapeType.rect, { x, y, w, h, fill: { color: bgColor }, line: { color: C.muted, pt: 0.5 }, shadow: { type: "outer", blur: 4, offset: 2, angle: 45, color: "888888", opacity: 0.3 } });
if (title) {
slide.addText(title, { x: x + 0.1, y: y + 0.06, w: w - 0.2, h: 0.3, fontSize: 12, bold: true, color: titleColor || C.white, fontFace: "Calibri" });
}
if (bodyItems && bodyItems.length) {
const textItems = bodyItems.map((item, i) => ({
text: typeof item === "string" ? item : item.text,
options: {
bullet: { type: "bullet" },
breakLine: i < bodyItems.length - 1,
fontSize: bodyFontSize,
color: C.text,
fontFace: "Calibri",
paraSpaceBefore: 3,
bold: typeof item === "object" && item.bold,
}
}));
slide.addText(textItems, { x: x + 0.1, y: y + (title ? 0.38 : 0.1), w: w - 0.2, h: h - (title ? 0.45 : 0.2), valign: "top" });
}
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
// Gradient-like layered shapes
s.addShape(pres.ShapeType.rect, { x: 6.5, y: 0, w: 3.5, h: "100%", fill: { color: C.blue }, transparency: 60 });
s.addShape(pres.ShapeType.rect, { x: 0, y: 4.8, w: "100%", h: 0.82, fill: { color: C.teal }, transparency: 40 });
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: "100%", fill: { color: C.amber } });
s.addText("DIABETES MELLITUS", {
x: 0.5, y: 0.8, w: 9, h: 0.9,
fontSize: 38, bold: true, color: C.white, fontFace: "Calibri", charSpacing: 3
});
s.addText("& DIABETIC EMERGENCIES", {
x: 0.5, y: 1.65, w: 9, h: 0.7,
fontSize: 28, bold: false, color: C.amber, fontFace: "Calibri", charSpacing: 2
});
s.addShape(pres.ShapeType.line, { x: 0.5, y: 2.48, w: 6, h: 0, line: { color: C.teal, pt: 2 } });
s.addText("Physiology • Pathophysiology • Clinical Features\nNatural History • Investigations • Management", {
x: 0.5, y: 2.65, w: 8.5, h: 0.8,
fontSize: 14, color: C.muted, fontFace: "Calibri", lineSpacingMultiple: 1.4
});
s.addText("Goldman-Cecil Medicine | Harrison's Principles of Internal Medicine\nFamily Medicine | Rosen's Emergency Medicine", {
x: 0.5, y: 4.9, w: 9, h: 0.55,
fontSize: 10, color: C.white, fontFace: "Calibri", italic: true, transparency: 20
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — TABLE OF CONTENTS
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Table of Contents");
const sections = [
{ num: "01", label: "Normal Glucose Physiology & Insulin Secretion" },
{ num: "02", label: "Definition & Classification of Diabetes Mellitus" },
{ num: "03", label: "Pathophysiology — Type 1 & Type 2 DM" },
{ num: "04", label: "Clinical Features & Natural History" },
{ num: "05", label: "Investigations & Diagnostic Criteria" },
{ num: "06", label: "Management of Diabetes Mellitus" },
{ num: "07", label: "Chronic Complications (Micro & Macrovascular)" },
{ num: "08", label: "Diabetic Ketoacidosis (DKA)" },
{ num: "09", label: "Hyperosmolar Hyperglycaemic State (HHS)" },
{ num: "10", label: "Hypoglycaemia" },
];
sections.forEach((sec, i) => {
const col = i < 5 ? 0 : 1;
const row = i < 5 ? i : i - 5;
const x = col === 0 ? 0.3 : 5.2;
const y = 0.95 + row * 0.85;
s.addShape(pres.ShapeType.rect, { x, y, w: 4.7, h: 0.72, fill: { color: col === 0 ? C.navy : C.blue }, shadow: { type: "outer", blur: 3, offset: 2, angle: 45, color: "555555", opacity: 0.25 } });
s.addText(sec.num, { x: x + 0.1, y, w: 0.55, h: 0.72, fontSize: 20, bold: true, color: C.amber, fontFace: "Calibri", valign: "middle", align: "center" });
s.addShape(pres.ShapeType.line, { x: x + 0.65, y: y + 0.12, w: 0, h: 0.48, line: { color: C.teal, pt: 1.5 } });
s.addText(sec.label, { x: x + 0.75, y, w: 3.85, h: 0.72, fontSize: 11.5, color: C.white, fontFace: "Calibri", valign: "middle" });
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SECTION DIVIDER — PHYSIOLOGY
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
sectionTitle(s, "01 Normal Glucose Physiology\n & Insulin Secretion", C.navy);
s.addText("Foundation: Understanding normal before the pathological", {
x: 0.7, y: 3.8, w: 8, h: 0.4, fontSize: 14, color: C.teal, fontFace: "Calibri", italic: true
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — GLUCOSE PHYSIOLOGY
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Normal Glucose Homeostasis", "Glucose-Insulin axis");
// Left column
box(s, 0.3, 0.9, 4.2, 2.1, C.navy, "Insulin Secretion (Pancreatic β-Cells)", C.amber, [
"Glucose enters β-cells via GLUT-2 transporter",
"Glycolysis → ATP ↑ → K⁺ ATP channels close",
"Membrane depolarization → Ca²⁺ influx",
"Insulin granule exocytosis",
"First phase: rapid (0–10 min); Second phase: sustained",
], 11);
box(s, 0.3, 3.1, 4.2, 2.1, C.teal, "Insulin Actions on Target Tissues", C.white, [
"Muscle: GLUT-4 translocation → glucose uptake",
"Liver: glycogenesis ↑, gluconeogenesis ↓",
"Adipose: lipogenesis ↑, lipolysis ↓",
"Protein synthesis ↑, K⁺ uptake ↑",
"Counter-regulatory: glucagon, cortisol, GH, epinephrine",
], 11);
// Right column - image
if (images[0] && images[0].base64) {
s.addImage({ data: images[0].base64, x: 4.75, y: 0.88, w: 4.9, h: 3.2 });
s.addText("Insulin signalling pathway — GLUT-4 translocation (PMC)", {
x: 4.75, y: 4.08, w: 4.9, h: 0.25, fontSize: 8, color: C.muted, italic: true, fontFace: "Calibri"
});
} else {
box(s, 4.75, 0.88, 4.9, 3.4, C.light, "Insulin Signalling Pathway", C.navy, [
"Insulin → binds receptor → IRS phosphorylation",
"PI3K → AKT → PDK1 activation",
"GLUT-4 vesicles exocytosed to membrane",
"Glucose enters cell → metabolism or storage",
], 12);
}
// Normal values box
s.addShape(pres.ShapeType.rect, { x: 4.75, y: 4.35, w: 4.9, h: 0.85, fill: { color: C.amber }, transparency: 15 });
s.addText([
{ text: "Normal Fasting Glucose: ", options: { bold: true, fontSize: 11, color: C.navy } },
{ text: "3.9–5.5 mmol/L (70–99 mg/dL) ", options: { fontSize: 11, color: C.text } },
{ text: "Normal 2-hr OGTT: ", options: { bold: true, fontSize: 11, color: C.navy } },
{ text: "<7.8 mmol/L (<140 mg/dL)", options: { fontSize: 11, color: C.text } },
], { x: 4.85, y: 4.42, w: 4.7, h: 0.7, valign: "middle", wrap: true });
}
// ══════════════════════════════════════════════════════════════════════════════
// SECTION DIVIDER — CLASSIFICATION
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
sectionTitle(s, "02 Definition & Classification\n of Diabetes Mellitus", C.blue);
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — DEFINITION & CLASSIFICATION
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Definition & Classification of Diabetes Mellitus");
// Definition
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.85, w: 9.4, h: 0.65, fill: { color: C.light } });
s.addText([
{ text: "Definition: ", options: { bold: true, fontSize: 13, color: C.navy } },
{ text: "Diabetes mellitus is a chronic metabolic disorder characterised by hyperglycaemia resulting from absolute or relative insulin deficiency, insulin resistance, or both — leading to long-term micro- and macrovascular complications.", options: { fontSize: 12, color: C.text } }
], { x: 0.45, y: 0.87, w: 9.1, h: 0.6, valign: "middle", wrap: true });
const types = [
{ title: "Type 1 DM", color: C.red, items: ["Autoimmune β-cell destruction", "Absolute insulin deficiency", "Prone to DKA", "~5–10% of all DM", "Peak onset: childhood / adolescence"] },
{ title: "Type 2 DM", color: C.blue, items: ["Insulin resistance + relative deficiency", "Progressive β-cell failure", "~90–95% of all DM", "Associated with obesity, sedentary lifestyle", "Insidious onset"] },
{ title: "Gestational DM", color: C.teal, items: ["First detected in pregnancy", "Placental diabetogenic hormones", "~6% of pregnancies", "↑ risk of T2DM later in life", "Resolves post-delivery (usually)"] },
{ title: "Other Types", color: C.subtext, items: ["MODY (monogenic diabetes)", "Secondary: pancreatitis, drugs", "Cushing's, acromegaly", "Neonatal DM", "Post-transplant DM"] },
];
types.forEach((t, i) => {
const x = 0.3 + i * 2.37;
s.addShape(pres.ShapeType.rect, { x, y: 1.6, w: 2.2, h: 0.4, fill: { color: t.color } });
s.addText(t.title, { x, y: 1.6, w: 2.2, h: 0.4, fontSize: 12, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
s.addShape(pres.ShapeType.rect, { x, y: 2.0, w: 2.2, h: 3.22, fill: { color: C.white }, line: { color: t.color, pt: 1.5 } });
const textItems = t.items.map((item, idx) => ({
text: item,
options: { bullet: { type: "bullet" }, breakLine: idx < t.items.length - 1, fontSize: 10.5, color: C.text, fontFace: "Calibri", paraSpaceBefore: 6 }
}));
s.addText(textItems, { x: x + 0.1, y: 2.05, w: 2.0, h: 3.1, valign: "top" });
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SECTION DIVIDER — PATHOPHYSIOLOGY
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
sectionTitle(s, "03 Pathophysiology\n Type 1 & Type 2 DM", C.navy);
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — PATHOPHYSIOLOGY TYPE 1
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Pathophysiology — Type 1 Diabetes Mellitus");
// Flow diagram boxes
const steps = [
{ label: "Genetic\nSusceptibility", detail: "HLA-DR3, DR4\nHLA-DQ genes", color: C.navy },
{ label: "Environmental\nTrigger", detail: "Viral infection\nDietary factors", color: C.blue },
{ label: "Autoimmune\nActivation", detail: "CD4/CD8 T-cells\nIslet antibodies (ICA, anti-GAD, IA-2)", color: C.teal },
{ label: "β-Cell\nDestruction", detail: "Insulitis → progressive\nloss of β-cell mass", color: C.amber },
{ label: "Absolute Insulin\nDeficiency", detail: "→ DKA, hyperglycaemia\nketo-acidosis", color: C.red },
];
const bw = 1.68, bh = 1.55, startX = 0.3, startY = 0.88;
steps.forEach((st, i) => {
const x = startX + i * 1.92;
s.addShape(pres.ShapeType.rect, { x, y: startY, w: bw, h: bh, fill: { color: st.color } });
s.addText(st.label, { x, y: startY + 0.1, w: bw, h: 0.55, fontSize: 11.5, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
s.addShape(pres.ShapeType.line, { x: x + 0.15, y: startY + 0.66, w: bw - 0.3, h: 0, line: { color: C.white, pt: 0.8, transparency: 50 } });
s.addText(st.detail, { x: x + 0.1, y: startY + 0.72, w: bw - 0.2, h: 0.75, fontSize: 9.5, color: C.white, fontFace: "Calibri", align: "center", valign: "top" });
if (i < steps.length - 1) {
s.addShape(pres.ShapeType.rect, { x: x + bw, y: startY + 0.6, w: 0.24, h: 0.35, fill: { color: C.amber } });
s.addText("▶", { x: x + bw, y: startY + 0.6, w: 0.24, h: 0.35, fontSize: 14, color: C.white, align: "center", valign: "middle" });
}
});
// Antibodies section
box(s, 0.3, 2.55, 4.5, 1.2, C.light, "Islet Autoantibodies (Diagnostic Markers)", C.navy, [
"ICA (Islet cell antibody) — 70–80% of T1DM",
"Anti-GAD65 — most sensitive (80–95%)",
"IA-2 / IA-2β — tyrosine phosphatase antibodies",
"ZnT8 antibody — zinc transporter 8",
], 10.5);
// Honeymoon phase
box(s, 4.9, 2.55, 4.75, 1.2, "FFF9C4", "Honeymoon Phase", C.navy, [
"Transient recovery of residual β-cell function",
"Occurs weeks–months after diagnosis",
"Insulin requirement ↓ temporarily",
"Eventually lost as destruction continues",
], 10.5);
// Bottom note
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 3.85, w: 9.35, h: 0.85, fill: { color: C.red }, transparency: 85 });
s.addText("When >80% of β-cell mass is destroyed, overt DM manifests. Without exogenous insulin, patients are prone to life-threatening diabetic ketoacidosis (DKA).", {
x: 0.5, y: 3.9, w: 9.15, h: 0.75, fontSize: 11.5, color: C.text, fontFace: "Calibri", italic: false, valign: "middle"
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — PATHOPHYSIOLOGY TYPE 2
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Pathophysiology — Type 2 Diabetes Mellitus", "The 'Ominous Octet' (DeFronzo)");
// Left column - pathophysiology
box(s, 0.3, 0.85, 4.7, 1.55, C.navy, "Core Defects", C.amber, [
"Insulin resistance in muscle, liver & adipose tissue",
"Progressive β-cell dysfunction (↓ insulin secretion)",
"↑ Hepatic glucose production (gluconeogenesis)",
"↑ Lipolysis → free fatty acids → lipotoxicity",
"Incretin defect: ↓ GLP-1 response",
], 11);
box(s, 0.3, 2.5, 4.7, 1.25, C.teal, "Ominous Octet (DeFronzo)", C.white, [
"↑ Hepatic glucose output ↓ Muscle glucose uptake",
"↓ Incretin effect ↑ Glucagon secretion (α-cells)",
"↑ Renal glucose reabsorption ↓ Brain insulin signalling",
"↑ Lipolysis ↓ β-cell insulin secretion",
], 11);
box(s, 0.3, 3.85, 4.7, 0.85, "FFF9C4", "Risk Factors", C.navy, [
"Obesity (BMI ≥35 → 90× ↑ risk) | Physical inactivity | Family history | Age >45 years",
"Ethnicity (South Asian, African, Hispanic) | Hypertension | Dyslipidaemia | PCOS",
], 10.5);
// Right — image or visual
if (images[1] && images[1].base64) {
s.addImage({ data: images[1].base64, x: 5.2, y: 0.85, w: 4.45, h: 3.2 });
s.addText("Obesity → Inflammation → T2DM → Vascular Complications (PMC)", {
x: 5.2, y: 4.05, w: 4.45, h: 0.25, fontSize: 8, color: C.muted, italic: true, fontFace: "Calibri"
});
} else {
box(s, 5.2, 0.85, 4.45, 3.4, C.light, "Pathophysiological Cascade", C.navy, [
"Caloric excess & sedentary lifestyle",
"→ Central obesity & visceral fat",
"→ Adipokine imbalance (↓ adiponectin, ↑ TNF-α, IL-6)",
"→ Hepatic & peripheral insulin resistance",
"→ Compensatory hyperinsulinaemia",
"→ β-cell exhaustion & failure",
"→ Overt T2DM with hyperglycaemia",
], 12);
}
}
// ══════════════════════════════════════════════════════════════════════════════
// SECTION DIVIDER — CLINICAL FEATURES
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
sectionTitle(s, "04 Clinical Features\n & Natural History", C.teal);
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — CLINICAL FEATURES
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Clinical Features of Diabetes Mellitus");
// Classic triad
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.85, w: 9.4, h: 0.4, fill: { color: C.amber }, transparency: 20 });
s.addText("Classic Triad (when glucose >180–200 mg/dL / 10–11.1 mmol/L — exceeding renal threshold)", {
x: 0.4, y: 0.88, w: 9.2, h: 0.35, fontSize: 12, bold: true, color: C.navy, fontFace: "Calibri", valign: "middle"
});
const triad = [
{ sym: "POLYURIA", detail: "Glycosuria → osmotic diuresis\nUrine output >3 L/day", color: C.blue },
{ sym: "POLYDIPSIA", detail: "Secondary to hypovolaemia\nThirst & fluid intake ↑↑", color: C.teal },
{ sym: "WEIGHT LOSS", detail: "Catabolism, glycosuria\nMuscle wasting (T1DM)", color: C.red },
];
triad.forEach((t, i) => {
const x = 0.3 + i * 3.15;
s.addShape(pres.ShapeType.rect, { x, y: 1.35, w: 2.9, h: 1.15, fill: { color: t.color } });
s.addText(t.sym, { x, y: 1.35, w: 2.9, h: 0.42, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
s.addText(t.detail, { x, y: 1.77, w: 2.9, h: 0.7, fontSize: 10, color: C.white, fontFace: "Calibri", align: "center" });
});
// Other symptoms
box(s, 0.3, 2.6, 4.5, 2.1, C.navy, "Type 1 DM Presentation", C.amber, [
"Acute onset (days to weeks)",
"Marked weight loss, ketosis, DKA",
"Predominantly children/young adults",
"Polyphagia (hunger despite eating)",
"Blurred vision, fatigue",
"Nausea/vomiting if DKA",
], 11);
box(s, 5.0, 2.6, 4.65, 2.1, C.blue, "Type 2 DM Presentation", C.white, [
"Insidious onset (months to years)",
"Often asymptomatic at diagnosis",
"Frequently found on screening",
"Recurrent infections (UTI, candidiasis)",
"Visual blurring, neuropathic symptoms",
"May present with complications first",
], 11);
// Bottom bar: prediabetes note
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 4.75, w: 9.35, h: 0.55, fill: { color: C.light } });
s.addText([
{ text: "Prediabetes: ", options: { bold: true, fontSize: 11.5, color: C.navy } },
{ text: "Impaired fasting glucose (IFG): 5.6–6.9 mmol/L (100–125 mg/dL) | Impaired glucose tolerance (IGT): 2-hr OGTT 7.8–11.0 mmol/L | HbA1c 39–47 mmol/mol (5.7–6.4%)", options: { fontSize: 10.5, color: C.text } }
], { x: 0.45, y: 4.78, w: 9.15, h: 0.5, valign: "middle", wrap: true });
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — NATURAL HISTORY
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Natural History of Diabetes Mellitus");
// Timeline for T2DM
s.addText("Type 2 DM Natural History — Progressive β-cell Failure", {
x: 0.3, y: 0.88, w: 9.4, h: 0.35, fontSize: 13, bold: true, color: C.navy, fontFace: "Calibri"
});
const timeline = [
{ phase: "Normal\nGlucose", year: "Years\n−10 to −5", color: C.teal },
{ phase: "Insulin\nResistance", year: "~5 yrs\nbefore Dx", color: C.blue },
{ phase: "Pre-\ndiabetes", year: "~2–5 yrs\nbefore Dx", color: C.amber },
{ phase: "Overt\nDiabetes", year: "Diagnosis", color: C.red },
{ phase: "Progressive\nComplications", year: "Years\nafter Dx", color: "8B0000" },
];
timeline.forEach((t, i) => {
const x = 0.3 + i * 1.92;
s.addShape(pres.ShapeType.rect, { x, y: 1.3, w: 1.7, h: 0.8, fill: { color: t.color } });
s.addText(t.phase, { x, y: 1.3, w: 1.7, h: 0.8, fontSize: 11, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
s.addText(t.year, { x, y: 2.1, w: 1.7, h: 0.5, fontSize: 9, color: C.subtext, fontFace: "Calibri", align: "center" });
if (i < timeline.length - 1) {
s.addText("→", { x: x + 1.7, y: 1.45, w: 0.22, h: 0.5, fontSize: 18, bold: true, color: C.amber, align: "center" });
}
});
// T1DM vs T2DM comparison
box(s, 0.3, 2.7, 4.5, 1.95, C.navy, "Type 1 DM — Natural History", C.amber, [
"Abrupt destruction of β-cells (months)",
"Insulin-dependent from diagnosis",
"Honeymoon phase: transient remission",
"Complications begin ~5 yrs post-diagnosis",
"Life expectancy ↓ ~10–15 yrs if uncontrolled",
], 11);
box(s, 5.0, 2.7, 4.65, 1.95, C.blue, "Type 2 DM — Prognosis", C.white, [
"Life expectancy ↓ ~6 yrs at age 50 years",
"40–50% have complications at diagnosis",
"CVD is leading cause of death (2–2.5× ↑ risk)",
"Progression can be halted with lifestyle & treatment",
"Remission possible with weight loss/bariatric surgery",
], 11);
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 4.72, w: 9.35, h: 0.55, fill: { color: "FFF9C4" } });
s.addText("Every 18 mg/dL (1.0 mmol/L) increase in fasting glucose → estimated 17% increase in cardiovascular events or death (Goldman-Cecil Medicine)", {
x: 0.45, y: 4.75, w: 9.15, h: 0.5, fontSize: 11, color: C.text, fontFace: "Calibri", italic: true, valign: "middle"
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SECTION DIVIDER — INVESTIGATIONS
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
sectionTitle(s, "05 Investigations &\n Diagnostic Criteria", C.blue);
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — DIAGNOSTIC CRITERIA
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Diagnostic Criteria for Diabetes Mellitus", "ADA / WHO criteria");
// Diagnostic criteria table header
const headers = ["Test", "Normal", "Prediabetes", "Diabetes"];
const hColors = [C.navy, C.teal, C.amber, C.red];
const colW = [2.8, 2.1, 2.3, 2.4];
const colX = [0.3, 3.1, 5.2, 7.5];
headers.forEach((h, i) => {
s.addShape(pres.ShapeType.rect, { x: colX[i], y: 0.85, w: colW[i], h: 0.42, fill: { color: hColors[i] } });
s.addText(h, { x: colX[i], y: 0.85, w: colW[i], h: 0.42, fontSize: 12, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
});
const rows = [
["Fasting Plasma Glucose", "<5.6 mmol/L\n(<100 mg/dL)", "5.6–6.9 mmol/L\n(100–125 mg/dL)", "≥7.0 mmol/L\n(≥126 mg/dL)"],
["2-hr OGTT (75g)", "<7.8 mmol/L\n(<140 mg/dL)", "7.8–11.0 mmol/L\n(140–199 mg/dL)", "≥11.1 mmol/L\n(≥200 mg/dL)"],
["HbA1c", "<39 mmol/mol\n(<5.7%)", "39–47 mmol/mol\n(5.7–6.4%)", "≥48 mmol/mol\n(≥6.5%)"],
["Random Plasma Glucose", "N/A", "N/A", "≥11.1 mmol/L + symptoms"],
];
const rowBg = [C.white, "F5F5F5", C.white, "F5F5F5"];
rows.forEach((row, ri) => {
const y = 1.27 + ri * 0.72;
row.forEach((cell, ci) => {
s.addShape(pres.ShapeType.rect, { x: colX[ci], y, w: colW[ci], h: 0.7, fill: { color: rowBg[ri] }, line: { color: C.muted, pt: 0.5 } });
s.addText(cell, { x: colX[ci] + 0.08, y: y + 0.03, w: colW[ci] - 0.16, h: 0.64, fontSize: ci === 0 ? 10.5 : 10, bold: ci === 0, color: C.text, fontFace: "Calibri", valign: "middle", align: ci === 0 ? "left" : "center" });
});
});
// Note boxes
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 4.2, w: 4.5, h: 0.55, fill: { color: C.light } });
s.addText("⚠ Without symptoms: 2 abnormal tests on separate occasions required for diagnosis", {
x: 0.4, y: 4.23, w: 4.3, h: 0.5, fontSize: 10, color: C.navy, fontFace: "Calibri", valign: "middle"
});
s.addShape(pres.ShapeType.rect, { x: 5.0, y: 4.2, w: 4.65, h: 0.55, fill: { color: "FFF9C4" } });
s.addText("✓ With classic symptoms + random glucose ≥11.1 mmol/L: diagnosis confirmed without repeat testing", {
x: 5.1, y: 4.23, w: 4.45, h: 0.5, fontSize: 10, color: C.text, fontFace: "Calibri", valign: "middle"
});
box(s, 0.3, 4.82, 9.35, 0.43, C.navy, null, null, null);
s.addText("Additional investigations: Islet autoantibodies (T1DM), C-peptide levels, fasting lipids, renal function, urine ACR, retinal screening, ECG, foot examination", {
x: 0.4, y: 4.84, w: 9.2, h: 0.38, fontSize: 10, color: C.white, fontFace: "Calibri", valign: "middle"
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SECTION DIVIDER — MANAGEMENT
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
sectionTitle(s, "06 Management of\n Diabetes Mellitus", C.navy);
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 10 — MANAGEMENT OVERVIEW
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Management of Diabetes Mellitus — Overview");
// Glycaemic targets
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.85, w: 9.4, h: 0.38, fill: { color: C.teal } });
s.addText("Glycaemic Targets: HbA1c <53 mmol/mol (<7.0%) for most adults | Fasting: 4.4–7.2 mmol/L | Post-prandial: <10 mmol/L", {
x: 0.4, y: 0.87, w: 9.2, h: 0.34, fontSize: 11, bold: true, color: C.white, fontFace: "Calibri", valign: "middle"
});
const pillars = [
{ title: "1 Lifestyle\nModification", items: ["Medical Nutrition Therapy: calorie deficit, low glycaemic index, <10% saturated fat", "Physical activity: ≥150 min/wk moderate aerobic exercise", "Weight loss: 5–10% reduces HbA1c by 0.5–2.0%", "Smoking cessation, alcohol moderation"], color: C.teal },
{ title: "2 Pharmacological\nTherapy", items: ["T2DM: Metformin first-line (if tolerated)", "Add SGLT2i or GLP-1 RA if CVD/CKD/HF", "Stepwise intensification to combination therapy", "T1DM: Insulin (basal-bolus regimen) from diagnosis"], color: C.blue },
{ title: "3 Monitoring &\nScreening", items: ["HbA1c every 3 months until stable, then 6-monthly", "Self-monitoring of blood glucose (SMBG)", "Annual: retinal exam, urine ACR, renal function", "Annual foot examination, lipids, BP"], color: C.navy },
];
pillars.forEach((p, i) => {
const x = 0.3 + i * 3.18;
box(s, x, 1.3, 2.95, 3.35, p.color, p.title, C.amber, p.items, 10.5);
});
// Oral agents table
s.addText("Key Pharmacological Agents", {
x: 0.3, y: 4.72, w: 4.0, h: 0.32, fontSize: 12, bold: true, color: C.navy, fontFace: "Calibri"
});
const drugs = ["Metformin — ↓ hepatic glucose output, weight neutral", "SGLT2 inhibitors — ↓ renal reabsorption, cardioprotective", "GLP-1 receptor agonists — ↑ insulin, ↓ glucagon, weight loss", "DPP-4 inhibitors — ↑ incretin, weight neutral, safe in CKD", "Sulfonylureas — ↑ insulin secretion, risk hypoglycaemia", "Thiazolidinediones — ↓ insulin resistance, risk HF, fractures"];
const textItems = drugs.map((d, i) => ({
text: d,
options: { bullet: { type: "bullet" }, breakLine: i < drugs.length - 1, fontSize: 10, color: C.text, fontFace: "Calibri", paraSpaceBefore: 2 }
}));
s.addText(textItems, { x: 0.3, y: 5.05, w: 9.4, h: 0.6, valign: "top" });
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 11 — INSULIN THERAPY
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Insulin Therapy");
const insulinTypes = [
{ type: "Rapid-Acting Analogue", examples: "Lispro, Aspart, Glulisine", onset: "5–15 min", peak: "30–90 min", duration: "3–5 hr", use: "Mealtime bolus" },
{ type: "Short-Acting (Regular)", examples: "Actrapid, Humulin R", onset: "30–60 min", peak: "2–4 hr", duration: "6–8 hr", use: "Mealtime, IV infusions" },
{ type: "Intermediate (NPH)", examples: "Insulatard, Humulin N", onset: "1–3 hr", peak: "5–8 hr", duration: "12–18 hr", use: "Basal (twice daily)" },
{ type: "Long-Acting Analogue", examples: "Glargine, Detemir, Degludec", onset: "1–4 hr", peak: "None/flat", duration: "20–42 hr", use: "Once-daily basal" },
{ type: "Pre-mixed", examples: "30/70, 50/50 mixtures", onset: "Varies", peak: "Biphasic", duration: "10–16 hr", use: "Twice-daily convenience" },
];
const cols = ["Insulin Type", "Examples", "Onset", "Peak", "Duration", "Use"];
const cw = [2.2, 2.0, 0.85, 1.0, 0.9, 1.75];
const cx = [0.3, 2.5, 4.5, 5.35, 6.35, 7.25];
cols.forEach((c, i) => {
s.addShape(pres.ShapeType.rect, { x: cx[i], y: 0.85, w: cw[i], h: 0.38, fill: { color: C.navy } });
s.addText(c, { x: cx[i], y: 0.85, w: cw[i], h: 0.38, fontSize: 11, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
});
const rBg = [C.white, "F0F4FF", C.white, "F0F4FF", C.white];
insulinTypes.forEach((row, ri) => {
const y = 1.23 + ri * 0.62;
const rowData = [row.type, row.examples, row.onset, row.peak, row.duration, row.use];
rowData.forEach((cell, ci) => {
s.addShape(pres.ShapeType.rect, { x: cx[ci], y, w: cw[ci], h: 0.6, fill: { color: rBg[ri] }, line: { color: C.muted, pt: 0.4 } });
s.addText(cell, { x: cx[ci] + 0.05, y: y + 0.03, w: cw[ci] - 0.1, h: 0.54, fontSize: ci === 0 ? 10.5 : 10, bold: ci === 0, color: C.text, fontFace: "Calibri", valign: "middle", align: ci === 0 ? "left" : "center" });
});
});
box(s, 0.3, 4.4, 4.5, 0.85, C.light, "Basal-Bolus Regimen (T1DM)", C.navy, [
"Basal insulin: once/twice daily long-acting (40–50% TDD)",
"Bolus insulin: rapid-acting before each meal (carb counting)",
"Target: HbA1c <53 mmol/mol (<7%) without hypoglycaemia",
], 10.5);
box(s, 5.0, 4.4, 4.65, 0.85, "FFF0F0", "Insulin Storage & Safety", C.red, [
"Unopened: refrigerate 2–8°C | In use: room temp up to 28 days",
"Hypoglycaemia = main adverse effect → always carry glucose",
"Weight gain, lipodystrophy at injection sites",
], 10.5);
}
// ══════════════════════════════════════════════════════════════════════════════
// SECTION DIVIDER — COMPLICATIONS
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
sectionTitle(s, "07 Chronic Complications", C.teal);
s.addText("Microvascular & Macrovascular", {
x: 0.7, y: 3.6, w: 8, h: 0.5, fontSize: 22, color: C.amber, fontFace: "Calibri"
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 12 — COMPLICATIONS
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Chronic Complications of Diabetes Mellitus");
// Micro
box(s, 0.3, 0.85, 4.5, 3.5, C.navy, "Microvascular Complications", C.amber, [
"RETINOPATHY — most common cause of blindness",
" Non-proliferative: microaneurysms, hard exudates",
" Proliferative: neovascularisation, vitreous haemorrhage",
" Screen: annual fundoscopy",
"NEPHROPATHY — leading cause of ESKD",
" Microalbuminuria → proteinuria → CKD",
" ACEi/ARB: first-line nephroprotection",
" Screen: annual urine ACR + eGFR",
"NEUROPATHY — affects up to 50% of diabetics",
" Peripheral: stocking-glove sensory loss, burning",
" Autonomic: gastroparesis, orthostatic hypotension",
" Painful neuropathy: amitriptyline, gabapentin",
], 10.5);
// Macro
box(s, 5.0, 0.85, 4.65, 2.1, C.red, "Macrovascular Complications", C.white, [
"Coronary artery disease: 2–2.5× ↑ risk MI",
"Stroke / cerebrovascular disease",
"Peripheral vascular disease → diabetic foot",
"Heart failure: independent risk factor",
"Aggressive risk factor control essential",
], 11);
// Diabetic foot image
if (images[2] && images[2].base64) {
s.addImage({ data: images[2].base64, x: 5.0, y: 2.98, w: 4.65, h: 2.3 });
s.addText("Diabetic Foot Syndrome — neuropathy + ischaemia (PMC)", {
x: 5.0, y: 5.28, w: 4.65, h: 0.2, fontSize: 8, color: C.muted, italic: true, fontFace: "Calibri"
});
} else {
box(s, 5.0, 2.98, 4.65, 2.2, "FFF0F0", "Diabetic Foot", C.red, [
"Combination of neuropathy + peripheral vascular disease",
"Impaired pain sensation → unnoticed injuries",
"Impaired healing → chronic ulcers → infection",
"Leading cause of non-traumatic amputations",
"Screen: annual foot examination + monofilament test",
], 11);
}
}
// ══════════════════════════════════════════════════════════════════════════════
// SECTION DIVIDER — DKA
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
sectionTitle(s, "08 Diabetic Ketoacidosis\n (DKA)", C.red);
s.addText("Acute metabolic emergency — mortality ~4%", {
x: 0.7, y: 3.7, w: 8, h: 0.4, fontSize: 16, color: C.amber, fontFace: "Calibri"
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 13 — DKA PATHOPHYSIOLOGY & CLINICAL
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Diabetic Ketoacidosis — Pathophysiology & Clinical Features");
// Diagnostic triad
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.85, w: 9.4, h: 0.38, fill: { color: C.red } });
s.addText("Diagnostic Triad (DKA): D — Hyperglycaemia ≥13.9 mmol/L (or known DM) | K — Ketonuria ≥2+ or ketonaemia ≥3 mmol/L | A — pH <7.3 or HCO₃⁻ <15 mmol/L", {
x: 0.4, y: 0.87, w: 9.1, h: 0.33, fontSize: 10.5, bold: true, color: C.white, fontFace: "Calibri", valign: "middle"
});
// Pathophysiology cascade
box(s, 0.3, 1.3, 4.55, 2.55, C.navy, "Pathophysiology", C.amber, [
"↓ Insulin + ↑ counter-regulatory hormones",
"→ ↑ Lipolysis → free fatty acids to liver",
"→ ↑ Ketogenesis: β-hydroxybutyrate, acetoacetate",
"→ Metabolic acidosis (anion gap ↑)",
"→ ↑ Hepatic glucose output + ↓ utilisation",
"→ Hyperglycaemia → osmotic diuresis",
"→ Dehydration + electrolyte loss (K⁺, Na⁺, PO₄)",
"Total body K⁺ depleted despite serum K⁺ normal/↑",
], 11);
// Precipitants
box(s, 0.3, 3.92, 4.55, 1.35, C.teal, "Common Precipitants", C.white, [
"New-onset T1DM | Missed insulin / poor adherence",
"Infection (most common — UTI, pneumonia, sepsis)",
"Acute coronary syndrome | Surgery / trauma",
"SGLT-2 inhibitors (euglycaemic DKA)",
], 11);
// Clinical features
box(s, 5.05, 1.3, 4.6, 2.1, C.blue, "Clinical Features", C.white, [
"Polyuria, polydipsia, vomiting, abdominal pain",
"Dehydration: dry mucosae, sunken eyes, ↓ skin turgor",
"Kussmaul breathing: deep, rapid (compensatory)",
"Smell of acetone (fruity breath)",
"Tachycardia, hypotension (if severe dehydration)",
"Altered consciousness → coma (severe)",
], 11);
// Severity
s.addShape(pres.ShapeType.rect, { x: 5.05, y: 3.47, w: 4.6, h: 0.3, fill: { color: C.subtext } });
s.addText("Severity Classification", { x: 5.05, y: 3.47, w: 4.6, h: 0.3, fontSize: 11, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
const sevCols = ["Severity", "pH", "HCO₃⁻", "Mentation"];
const sevW = [1.0, 1.0, 1.1, 1.5];
const sevX = [5.05, 6.05, 7.05, 8.15];
sevCols.forEach((c, i) => {
s.addShape(pres.ShapeType.rect, { x: sevX[i], y: 3.77, w: sevW[i], h: 0.32, fill: { color: C.navy } });
s.addText(c, { x: sevX[i], y: 3.77, w: sevW[i], h: 0.32, fontSize: 9, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
});
const sevRows = [
["Mild", "7.25–7.30", "15–18", "Alert"],
["Moderate", "7.00–7.24", "10–14", "Alert/drowsy"],
["Severe", "<7.00", "<10", "Stupor/coma"],
];
const sevRBg = [C.white, "F5F5F5", "FFEBEE"];
sevRows.forEach((row, ri) => {
const y = 4.09 + ri * 0.43;
row.forEach((cell, ci) => {
s.addShape(pres.ShapeType.rect, { x: sevX[ci], y, w: sevW[ci], h: 0.41, fill: { color: sevRBg[ri] }, line: { color: C.muted, pt: 0.4 } });
s.addText(cell, { x: sevX[ci] + 0.04, y, w: sevW[ci] - 0.08, h: 0.41, fontSize: 9.5, bold: ri === 2, color: ri === 2 ? C.red : C.text, fontFace: "Calibri", valign: "middle", align: "center" });
});
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 14 — DKA MANAGEMENT
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "DKA Management — The 5 Rs");
const Rs = [
{ r: "1 RESUSCITATE", items: ["IV access × 2, O₂, cardiac monitor, urinary catheter", "Assessment: GCS, capillary glucose, ketones, VBG", "NBM if vomiting/↓ GCS"], color: C.red },
{ r: "2 REHYDRATE", items: ["0.9% NaCl: 1L over 1st hour", "Then 1L/hr × 2, then 1L/2hr × 2, then guided by UO", "Switch to 0.45% NaCl if Na⁺ >150 mmol/L"], color: C.blue },
{ r: "3 REPLACE K⁺", items: ["Check K⁺ before insulin", "K⁺ >5.5: withhold KCl | K⁺ 3.5–5.5: add 40 mmol/L bag", "K⁺ <3.5: replace first, delay insulin"], color: C.teal },
{ r: "4 REDUCE KETONES", items: ["Fixed-rate IV insulin infusion: 0.1 units/kg/hr", "Target: ketones ↓ 0.5 mmol/L/hr, glucose ↓ 3 mmol/L/hr", "Add 10% dextrose if glucose <14 mmol/L"], color: C.amber },
{ r: "5 REVERSE CAUSE", items: ["Identify & treat precipitant", "If infection: appropriate antibiotics", "Thromboprophylaxis (dehydration ↑ DVT risk)"], color: C.navy },
];
Rs.forEach((r, i) => {
const col = i < 3 ? 0 : 1;
const row = i < 3 ? i : i - 3;
const x = col === 0 ? 0.3 : 5.05;
const y = 0.85 + row * 1.52;
box(s, x, y, 4.55, 1.42, r.color, r.r, C.white, r.items, 11);
});
// Monitoring box
box(s, 5.05, 3.95, 4.55, 1.32, "FFF9C4", "Monitoring Targets", C.navy, [
"Hourly: capillary glucose + ketones",
"1-2 hourly: VBG (pH, bicarbonate, K⁺)",
"Resolution: ketones <0.3 mmol/L, pH >7.3, HCO₃⁻ >15",
"Transition to SC insulin: when eating + drinking",
], 11);
}
// ══════════════════════════════════════════════════════════════════════════════
// SECTION DIVIDER — HHS
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
sectionTitle(s, "09 Hyperosmolar Hyperglycaemic\n State (HHS)", "8B0000");
s.addText("Mortality up to 20% — predominantly elderly T2DM patients", {
x: 0.7, y: 3.9, w: 8.5, h: 0.4, fontSize: 14, color: C.amber, fontFace: "Calibri"
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 15 — HHS
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Hyperosmolar Hyperglycaemic State (HHS)");
// Definition
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.85, w: 9.4, h: 0.5, fill: { color: "8B0000" } });
s.addText("Diagnostic Criteria: Glucose ≥33.3 mmol/L (600 mg/dL) | Osmolality ≥320 mOsm/kg | pH ≥7.3 | HCO₃⁻ ≥18 mmol/L | Minimal ketonaemia", {
x: 0.4, y: 0.87, w: 9.1, h: 0.45, fontSize: 11, bold: true, color: C.white, fontFace: "Calibri", valign: "middle"
});
box(s, 0.3, 1.45, 4.5, 1.75, C.navy, "Pathophysiology", C.amber, [
"Relative insulin deficiency (not absolute — prevents DKA)",
"Profound hyperglycaemia → osmotic diuresis",
"Severe dehydration (fluid deficit 8–15 L)",
"Impaired ability to drink (elderly, cognitively impaired)",
"Effective serum osmolality: 2×Na + glucose >320 mOsm/kg",
], 11);
box(s, 0.3, 3.28, 4.5, 1.98, C.blue, "Clinical Features", C.white, [
"Insidious onset over days to weeks",
"Extreme dehydration, weakness",
"Neurological: confusion, focal deficits, seizures",
"Absent Kussmaul breathing (no acidosis)",
"No acetone breath",
"Coma in severe cases",
], 11);
box(s, 5.05, 1.45, 4.6, 1.75, C.teal, "Management Principles", C.white, [
"Slow rehydration: 0.9% NaCl — target 50% correction in 12 hrs",
"Insulin: low-dose IV infusion AFTER fluid resuscitation",
"K⁺ replacement: as per DKA protocol",
"Glucose lowering: target 5 mmol/L reduction/hr",
"Anticoagulation: LMWH (very high thrombotic risk)",
], 11);
// DKA vs HHS comparison
s.addShape(pres.ShapeType.rect, { x: 5.05, y: 3.28, w: 4.6, h: 0.32, fill: { color: C.subtext } });
s.addText("DKA vs HHS — Key Differences", { x: 5.05, y: 3.28, w: 4.6, h: 0.32, fontSize: 11, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
const compareRows = [
["Feature", "DKA", "HHS"],
["Typical patient", "T1DM, young", "T2DM, elderly"],
["Glucose", "13.9–33.3 mmol/L", ">33.3 mmol/L"],
["pH", "<7.30", "≥7.30"],
["Ketones", "+++", "Absent/trace"],
["Osmolality", "300–320", ">320 mOsm/kg"],
["Mortality", "~4%", "~20%"],
];
const cmpW = [1.6, 1.5, 1.5];
const cmpX = [5.05, 6.65, 8.15];
compareRows.forEach((row, ri) => {
const y = 3.6 + ri * 0.38;
const bg = ri === 0 ? C.navy : ri % 2 === 0 ? "F5F5F5" : C.white;
row.forEach((cell, ci) => {
s.addShape(pres.ShapeType.rect, { x: cmpX[ci], y, w: cmpW[ci], h: 0.36, fill: { color: bg }, line: { color: C.muted, pt: 0.4 } });
s.addText(cell, { x: cmpX[ci] + 0.05, y, w: cmpW[ci] - 0.1, h: 0.36, fontSize: ri === 0 ? 10 : 9.5, bold: ri === 0 || ci === 0, color: ri === 0 ? C.white : C.text, fontFace: "Calibri", valign: "middle", align: "center" });
});
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SECTION DIVIDER — HYPOGLYCAEMIA
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
sectionTitle(s, "10 Hypoglycaemia", C.amber);
s.addText("Most common acute complication — can be life-threatening", {
x: 0.7, y: 3.9, w: 8, h: 0.4, fontSize: 15, color: C.white, fontFace: "Calibri"
});
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 16 — HYPOGLYCAEMIA
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
contentHeader(s, "Hypoglycaemia — Definition, Features & Management");
// Definition
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.85, w: 9.4, h: 0.4, fill: { color: C.amber } });
s.addText("Definition: Glucose <3.9 mmol/L (<70 mg/dL) | Severe if requires assistance | Level 3 (severe): <3.0 mmol/L with cognitive impairment", {
x: 0.4, y: 0.87, w: 9.1, h: 0.36, fontSize: 11, bold: true, color: C.navy, fontFace: "Calibri", valign: "middle"
});
box(s, 0.3, 1.32, 3.05, 2.25, C.navy, "Causes", C.amber, [
"Excess insulin dose",
"Skipped / delayed meal",
"Increased physical activity",
"Alcohol (inhibits gluconeogenesis)",
"Renal failure (↓ insulin clearance)",
"Sulfonylurea / meglitinide use",
"Insulinoma (rare)",
], 11);
box(s, 3.5, 1.32, 3.05, 2.25, C.blue, "Clinical Features (Whipple's Triad)", C.white, [
"Autonomic (early): sweating, palpitations, tremor, anxiety",
"Neuroglycopaenic: confusion, slurred speech, focal deficit",
"Severe: seizures, loss of consciousness, coma",
"Symptoms resolve with glucose normalisation",
"Hypoglycaemia unawareness: ↓ counter-regulatory response",
], 11);
box(s, 6.65, 1.32, 3.0, 2.25, C.teal, "Whipple's Triad", C.white, [
"1. Symptoms consistent with hypoglycaemia",
"2. Low plasma glucose (<3.9 mmol/L)",
"3. Symptom relief with glucose correction",
], 11.5);
// Management — Rule of 15
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 3.65, w: 9.4, h: 0.32, fill: { color: C.amber } });
s.addText("MANAGEMENT — RULE OF 15", { x: 0.4, y: 3.65, w: 9.1, h: 0.32, fontSize: 12, bold: true, color: C.navy, fontFace: "Calibri", align: "center", valign: "middle" });
box(s, 0.3, 3.97, 4.5, 1.25, "FFF9C4", "Conscious Patient", C.navy, [
"15–20g fast-acting carbohydrate (4 glucose tabs, 150 ml juice)",
"Recheck glucose after 15 minutes",
"If still <4 mmol/L: repeat 15g carbohydrate",
"Once >4 mmol/L: long-acting carbohydrate meal",
], 11);
box(s, 5.0, 3.97, 4.65, 1.25, "FFEBEE", "Unconscious / Unable to Swallow", C.red, [
"IV Dextrose 50%: 50 mL (25g) via large vein IV",
"Or Glucagon 1 mg IM/SC (if no IV access)",
"Recovery: follow with long-acting carbohydrate",
"Investigate cause, adjust medications",
], 11);
}
// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 17 — SUMMARY
// ══════════════════════════════════════════════════════════════════════════════
{
let s = pres.addSlide();
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.2, h: "100%", fill: { color: C.amber } });
s.addShape(pres.ShapeType.rect, { x: 0, y: 4.9, w: "100%", h: 0.73, fill: { color: C.teal }, transparency: 30 });
s.addText("Key Take-Home Messages", {
x: 0.5, y: 0.18, w: 9.2, h: 0.55, fontSize: 24, bold: true, color: C.amber, fontFace: "Calibri", charSpacing: 1
});
s.addShape(pres.ShapeType.line, { x: 0.5, y: 0.75, w: 5, h: 0, line: { color: C.teal, pt: 2 } });
const points = [
"DM is a metabolic disorder of hyperglycaemia — T1 (autoimmune) & T2 (insulin resistance) are distinct entities",
"Diagnosis requires: FPG ≥7.0 mmol/L, 2-hr OGTT ≥11.1 mmol/L, HbA1c ≥48 mmol/mol (≥6.5%), or random glucose ≥11.1 + symptoms",
"T2DM management: lifestyle first, then metformin; SGLT2i or GLP-1 RA if CVD/CKD/HF co-exist",
"DKA = Hyperglycaemia + Ketonaemia + Acidosis → treat with fluids, insulin, K⁺ replacement & find cause",
"HHS = Extreme hyperglycaemia + hyperosmolality without significant ketosis → slow rehydration + careful insulin",
"Hypoglycaemia (<3.9 mmol/L) → Rule of 15 (conscious) or IV dextrose/IM glucagon (unconscious)",
"Complications prevention: HbA1c control + BP + lipids + annual screening for eyes, kidneys, feet & nerves",
];
const textItems = points.map((p, i) => ({
text: `${i + 1}. ${p}`,
options: { bullet: false, breakLine: i < points.length - 1, fontSize: 11.5, color: C.white, fontFace: "Calibri", paraSpaceBefore: 7 }
}));
s.addText(textItems, { x: 0.5, y: 0.82, w: 9.2, h: 4.0, valign: "top" });
s.addText("Sources: Goldman-Cecil Medicine 2024 · Harrison's Principles of Internal Medicine 22e · Rosen's Emergency Medicine · Family Medicine 9e", {
x: 0.4, y: 4.94, w: 9.2, h: 0.45, fontSize: 9, color: C.white, fontFace: "Calibri", italic: true, transparency: 20
});
}
// ══════════════════════════════════════════════════════════════════════════════
// WRITE FILE
// ══════════════════════════════════════════════════════════════════════════════
pres.writeFile({ fileName: "/home/daytona/workspace/diabetes-pptx/Diabetes_Mellitus_and_Emergencies.pptx" })
.then(() => console.log("✅ PPTX created successfully!"))
.catch(err => { console.error("❌ Error:", err); process.exit(1); });