Create visual representation of every point in the uploaded document

Reading File
Running Command

cd /home/daytona/workspace/attachments/e4743328-573f-45a8-b147-fead86676f67/ && …

Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/insulin-pptx && ls /home/daytona/workspace/insu…

Writing File

~/insulin-pptx/create_insulin_pptx.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Insulin";
pres.author = "Dr Sudheer Prudhvi";

// ─── COLOUR PALETTE ─────────────────────────────────────────────────────────
const C = {
  navy:    "0A1628",   // dominant dark bg
  royal:   "1B3A6B",   // secondary panels
  teal:    "0D7377",   // accent
  sky:     "14BDEB",   // highlight / accent2
  gold:    "F5A623",   // warm accent (warnings / special)
  white:   "FFFFFF",
  offWhite:"F0F4FF",
  gray:    "A8B4CC",
  lightBg: "EEF3FB",
  danger:  "E84040",
  green:   "27AE60",
};

// ─── HELPERS ────────────────────────────────────────────────────────────────
function fullBg(slide, color) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 5.625,
    fill: { color },
    line: { type: "none" },
  });
}

function sectionTag(slide, label, x = 0.3, y = 0.18) {
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x, y, w: 2.0, h: 0.32,
    fill: { color: C.teal },
    line: { type: "none" },
    rectRadius: 0.05,
  });
  slide.addText(label, {
    x, y, w: 2.0, h: 0.32,
    fontSize: 9, bold: true, color: C.white,
    align: "center", valign: "middle", margin: 0,
  });
}

function slideTitle(slide, title, sub = "", titleColor = C.white, subColor = C.sky) {
  slide.addText(title, {
    x: 0.4, y: 0.55, w: 9.2, h: 0.65,
    fontSize: 26, bold: true, color: titleColor,
    align: "left", valign: "middle",
  });
  if (sub) {
    slide.addText(sub, {
      x: 0.4, y: 1.2, w: 9.2, h: 0.4,
      fontSize: 13, bold: false, color: subColor,
      align: "left",
    });
  }
}

function divider(slide, y = 1.08, color = C.teal) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0.4, y, w: 9.2, h: 0.04,
    fill: { color },
    line: { type: "none" },
  });
}

function accentCard(slide, x, y, w, h, fillColor, lineColor = null) {
  const opts = { x, y, w, h, fill: { color: fillColor }, line: lineColor ? { color: lineColor, pt: 1.5 } : { type: "none" },
    shadow: { type: "outer", color: "000000", blur: 8, offset: 3, angle: 135, opacity: 0.18 } };
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, { ...opts, rectRadius: 0.12 });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);

  // Decorative teal strip left
  s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:0.55, h:5.625, fill:{color:C.teal}, line:{type:"none"} });
  // Gold accent bar
  s.addShape(pres.shapes.RECTANGLE, { x:0.55, y:2.3, w:8.5, h:0.07, fill:{color:C.gold}, line:{type:"none"} });

  s.addText("INSULIN", {
    x: 0.8, y: 0.9, w: 9, h: 1.5,
    fontSize: 72, bold: true, color: C.white, charSpacing: 18,
    align: "left", valign: "middle",
  });
  s.addText("A Comprehensive Pharmacology Overview", {
    x: 0.8, y: 2.55, w: 8, h: 0.55,
    fontSize: 18, color: C.sky, italic: true, align: "left",
  });
  s.addText("Dr Sudheer Prudhvi", {
    x: 0.8, y: 3.25, w: 5, h: 0.45,
    fontSize: 15, bold: true, color: C.gold, align: "left",
  });

  // Pancreas icon text
  s.addText("🔬 Pharmacology  |  Endocrinology", {
    x: 0.8, y: 4.9, w: 8, h: 0.4,
    fontSize: 11, color: C.gray, align: "left",
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 2 – DISCOVERERS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "HISTORY");

  slideTitle(s, "Discovery of Insulin", "Nobel Prize in Physiology or Medicine, 1923");
  divider(s);

  const people = [
    { name: "Frederick\nBanting", role: "Surgeon / Researcher\nLed the discovery", color: C.teal },
    { name: "Charles\nBest",     role: "Medical Student\nIsolated insulin extract", color: C.royal },
    { name: "James\nCollip",     role: "Biochemist\nPurified the extract", color: "1A5276" },
    { name: "John\nMacleod",     role: "Physiologist\nProvided laboratory", color: "0E6655" },
  ];
  people.forEach((p, i) => {
    const x = 0.5 + i * 2.35;
    accentCard(s, x, 1.55, 2.1, 3.3, p.color);
    s.addText("👤", { x, y: 1.65, w: 2.1, h: 0.8, fontSize: 30, align: "center", valign: "middle" });
    s.addText(p.name, {
      x, y: 2.45, w: 2.1, h: 0.7,
      fontSize: 14, bold: true, color: C.white, align: "center",
    });
    s.addText(p.role, {
      x, y: 3.1, w: 2.1, h: 0.7,
      fontSize: 9, color: C.offWhite, align: "center",
    });
  });

  s.addText("First clinical use: January 11, 1922 — Leonard Thompson, Toronto", {
    x: 0.5, y: 5.15, w: 9, h: 0.35,
    fontSize: 10, italic: true, color: C.gold, align: "center",
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 3 – TYPE 1 vs TYPE 2 COMPARISON TABLE
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "PATHOPHYSIOLOGY");
  slideTitle(s, "Type 1 vs Type 2 Diabetes Mellitus");
  divider(s);

  const rows = [
    ["Feature",              "Type 1 DM",                         "Type 2 DM"],
    ["Pathogenesis",         "Autoimmune β-cell destruction",      "Insulin resistance + β-cell dysfunction"],
    ["Insulin Levels",       "Very low / Absent",                  "Normal initially → later ↓"],
    ["Age of Onset",         "Childhood / Adolescence",            ">40 yrs (now younger too)"],
    ["Body Habitus",         "Lean",                               "Overweight / Obese"],
    ["Treatment",            "Insulin MANDATORY",                  "Lifestyle + OHA ± Insulin"],
    ["Associations",         "Other autoimmune diseases",          "Metabolic syndrome"],
  ];

  const colW = [2.5, 3.3, 3.3];
  const colX = [0.35, 2.9, 6.25];
  const rowH = 0.52;
  const startY = 1.35;

  rows.forEach((row, ri) => {
    row.forEach((cell, ci) => {
      const isHeader = ri === 0;
      const isFeature = ci === 0 && ri > 0;
      const bgColor = isHeader ? C.teal : isFeature ? C.royal : (ri % 2 === 0 ? C.navy : "0F1E38");
      s.addShape(pres.shapes.RECTANGLE, {
        x: colX[ci], y: startY + ri * rowH, w: colW[ci], h: rowH,
        fill: { color: bgColor }, line: { color: "2A4070", pt: 0.5 },
      });
      s.addText(cell, {
        x: colX[ci] + 0.06, y: startY + ri * rowH, w: colW[ci] - 0.12, h: rowH,
        fontSize: isHeader ? 11 : 10,
        bold: isHeader || isFeature,
        color: isHeader ? C.white : C.offWhite,
        align: ci === 0 ? "left" : "left",
        valign: "middle",
      });
    });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 4 – DRUGS CAUSING DIABETES
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "PHARMACOLOGY");
  slideTitle(s, "Drugs Causing Diabetes (Diabetogenic Drugs)");
  divider(s);

  const drugGroups = [
    { category: "Corticosteroids", examples: "Prednisolone, Dexamethasone", mechanism: "↓ Insulin sensitivity, ↑ Gluconeogenesis", color: C.danger },
    { category: "Thiazide Diuretics", examples: "Hydrochlorothiazide", mechanism: "↓ Insulin secretion (hypokalemia)", color: "C0392B" },
    { category: "β-Blockers",        examples: "Propranolol", mechanism: "Mask hypoglycemia, ↓ insulin release", color: "8E44AD" },
    { category: "Antipsychotics (Atypical)", examples: "Clozapine, Olanzapine", mechanism: "Weight gain, insulin resistance", color: "1A5276" },
    { category: "Tacrolimus / Cyclosporine", examples: "Immunosuppressants", mechanism: "Direct β-cell toxicity", color: "0E6655" },
    { category: "Niacin (high dose)", examples: "Nicotinic acid", mechanism: "↓ Insulin sensitivity", color: "7D6608" },
  ];

  drugGroups.forEach((d, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.35 + col * 4.85;
    const y = 1.45 + row * 1.35;
    accentCard(s, x, y, 4.6, 1.2, d.color);
    s.addText(d.category, { x: x + 0.15, y: y + 0.08, w: 4.3, h: 0.35, fontSize: 12, bold: true, color: C.white });
    s.addText("💊 " + d.examples, { x: x + 0.15, y: y + 0.42, w: 4.3, h: 0.3, fontSize: 10, color: C.offWhite });
    s.addText("⚙ " + d.mechanism, { x: x + 0.15, y: y + 0.72, w: 4.3, h: 0.3, fontSize: 9.5, color: C.sky });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 5 – RELEASE OF INSULIN (Glucose-stimulated)
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "MECHANISM");
  slideTitle(s, "Release of Insulin", "Glucose-Stimulated Insulin Secretion (GSIS)");
  divider(s);

  // Step-by-step flow boxes
  const steps = [
    { num: "1", label: "Blood glucose ↑", detail: "Glucose enters β-cell via GLUT-2", color: C.teal },
    { num: "2", label: "Glucose → ATP", detail: "Glycolysis + mitochondrial metabolism → ↑ ATP/ADP ratio", color: "1A7A4A" },
    { num: "3", label: "K⁺ channel closes", detail: "ATP-sensitive K⁺ channel (KATP) closes", color: "8E44AD" },
    { num: "4", label: "Membrane depolarizes", detail: "K⁺ efflux blocked → cell depolarises", color: "C0392B" },
    { num: "5", label: "Ca²⁺ influx", detail: "Voltage-gated Ca²⁺ channels open → Ca²⁺ enters", color: "1A5276" },
    { num: "6", label: "Exocytosis", detail: "Insulin granules fuse & insulin is secreted", color: "7D6608" },
  ];

  steps.forEach((st, i) => {
    const x = 0.35 + (i % 3) * 3.1;
    const y = 1.45 + Math.floor(i / 3) * 1.8;
    accentCard(s, x, y, 2.85, 1.6, st.color);
    s.addText(st.num, { x, y: y + 0.06, w: 2.85, h: 0.5, fontSize: 30, bold: true, color: "FFFFFF40", align: "center", valign: "top" });
    s.addText(st.label, { x: x + 0.12, y: y + 0.18, w: 2.6, h: 0.5, fontSize: 13, bold: true, color: C.white, align: "center" });
    s.addText(st.detail, { x: x + 0.12, y: y + 0.7, w: 2.6, h: 0.75, fontSize: 9.5, color: C.offWhite, align: "center" });
    // Arrow between steps (except last in row)
    if (i % 3 !== 2 && i < 5) {
      s.addText("→", { x: x + 2.85, y: y + 0.5, w: 0.25, h: 0.5, fontSize: 18, color: C.gold, align: "center" });
    }
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 6 – TYPES OF RECEPTORS (Overview)
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "PHARMACOLOGY");
  slideTitle(s, "Types of Receptors & Transduction Mechanisms");
  divider(s);

  const receptors = [
    { num: "1", name: "Enzymes / Transporters",          example: "Na⁺/K⁺-ATPase, Adenylyl cyclase", color: C.teal },
    { num: "2", name: "Ligand-Gated Ion Channels",        example: "Ionotropic: nAChR, GABAA, NMDA", color: "8E44AD" },
    { num: "3", name: "G-Protein Coupled Receptors",      example: "Metabotropic: β-adrenergic, M receptors", color: "1A5276" },
    { num: "4", name: "Nuclear Receptors",                 example: "Steroids, Thyroid hormone, Vit D", color: "7D6608" },
    { num: "5", name: "Enzyme-Linked Receptors",           example: "Catalytic: RTK — Insulin, EGF, PDGF, VEGF", color: C.danger },
    { num: "6", name: "Cytokine Receptors / JAK-STAT",    example: "Growth hormone, Prolactin, Erythropoietin", color: "0E6655" },
  ];

  receptors.forEach((r, i) => {
    const x = 0.35 + (i % 2) * 4.8;
    const y = 1.42 + Math.floor(i / 2) * 1.3;
    accentCard(s, x, y, 4.55, 1.18, r.color);
    s.addText(r.num, { x: x + 0.1, y: y + 0.1, w: 0.45, h: 0.95, fontSize: 28, bold: true, color: "FFFFFF30", align: "center", valign: "middle" });
    s.addText(r.name, { x: x + 0.6, y: y + 0.1, w: 3.8, h: 0.45, fontSize: 12, bold: true, color: C.white });
    s.addText(r.example, { x: x + 0.6, y: y + 0.6, w: 3.8, h: 0.45, fontSize: 10, color: C.sky });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 7 – ENZYME-LINKED RECEPTORS (Deep Dive)
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "PHARMACOLOGY");
  slideTitle(s, "Enzyme-Linked Receptors (Catalytic Receptors)");
  divider(s);

  // Sub-types
  const types = [
    {
      name: "Receptor Tyrosine Kinase (RTK)",
      ligands: "Insulin · EGF · PDGF · VEGF",
      desc: "Ligand binding → dimerisation → autophosphorylation of tyrosine residues → intracellular signalling cascade",
      color: C.danger,
    },
    {
      name: "Receptor Serine/Threonine Kinase",
      ligands: "TGF-β",
      desc: "Phosphorylates serine/threonine → SMAD pathway → gene regulation",
      color: "8E44AD",
    },
    {
      name: "Guanylyl Cyclase-Linked Receptor",
      ligands: "ANP · BNP · CNP (Natriuretic Peptides)",
      desc: "Ligand binding → intracellular guanylyl cyclase activated → GTP → cGMP → PKG activation → vasodilation, natriuresis",
      color: C.teal,
    },
  ];

  types.forEach((t, i) => {
    const y = 1.42 + i * 1.35;
    accentCard(s, 0.35, y, 9.3, 1.22, t.color);
    s.addText(t.name, { x: 0.55, y: y + 0.1, w: 5.5, h: 0.38, fontSize: 14, bold: true, color: C.white });
    s.addText("Ligands: " + t.ligands, { x: 0.55, y: y + 0.48, w: 5.5, h: 0.3, fontSize: 11, bold: true, color: C.gold });
    s.addText(t.desc, { x: 0.55, y: y + 0.76, w: 8.7, h: 0.35, fontSize: 9.5, color: C.offWhite });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 8 – INSULIN ACTIONS (Metabolism)
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "PHARMACODYNAMICS");
  slideTitle(s, "Actions of Insulin on Metabolism");
  divider(s);

  const macros = [
    {
      name: "CARBOHYDRATES",
      icon: "🍞",
      color: C.teal,
      actions: [
        "↑ Glucose uptake (Muscle & Adipose via GLUT-4)",
        "↑ Glycogenesis (Liver & Muscle)",
        "↓ Glycogenolysis",
        "↓ Gluconeogenesis",
      ],
      netEffect: "↓ Blood Glucose",
    },
    {
      name: "PROTEINS",
      icon: "💪",
      color: "8E44AD",
      actions: [
        "↑ Amino acid uptake",
        "↑ Protein synthesis",
        "↑ Muscle mass",
        "↓ Proteolysis (anabolic state)",
      ],
      netEffect: "↑ Muscle Mass",
    },
    {
      name: "LIPIDS",
      icon: "🧈",
      color: "1A5276",
      actions: [
        "↑ Lipogenesis (fat synthesis)",
        "↑ Triglyceride storage",
        "↓ Lipolysis (inhibits HSL)",
        "↓ Ketogenesis",
      ],
      netEffect: "↑ Fat Storage",
    },
  ];

  macros.forEach((m, i) => {
    const x = 0.35 + i * 3.15;
    accentCard(s, x, 1.42, 2.95, 3.85, m.color);
    s.addText(m.icon, { x, y: 1.5, w: 2.95, h: 0.6, fontSize: 24, align: "center" });
    s.addText(m.name, { x, y: 2.08, w: 2.95, h: 0.42, fontSize: 13, bold: true, color: C.white, align: "center" });
    m.actions.forEach((a, ai) => {
      s.addText("• " + a, { x: x + 0.12, y: 2.5 + ai * 0.42, w: 2.7, h: 0.4, fontSize: 9.5, color: C.offWhite });
    });
    // Net effect badge
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x: x + 0.3, y: 4.85, w: 2.35, h: 0.33,
      fill: { color: C.gold }, line: { type: "none" }, rectRadius: 0.06,
    });
    s.addText("NET: " + m.netEffect, { x: x + 0.3, y: 4.85, w: 2.35, h: 0.33, fontSize: 10, bold: true, color: C.navy, align: "center", valign: "middle", margin: 0 });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 9 – INSULIN PREPARATIONS TABLE
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "PHARMACOKINETICS");
  slideTitle(s, "Insulin Preparations & Analogues");
  divider(s);

  // Category blocks
  const categories = [
    { label: "RAPID-ACTING", color: C.sky, items: [
        { name: "Lispro",    appear: "Clear", onset: "<0.25", peak: "0.5–1.5", dur: "3–5" },
        { name: "Aspart",    appear: "Clear", onset: "<0.25", peak: "0.5–1.5", dur: "3–5" },
        { name: "Glulisine", appear: "Clear", onset: "<0.25", peak: "0.5–1.5", dur: "3–5" },
    ]},
    { label: "SHORT-ACTING", color: C.green, items: [
        { name: "Regular",   appear: "Clear",  onset: "0.5–1", peak: "2–3",   dur: "4–8" },
    ]},
    { label: "INTERMEDIATE", color: C.gold, items: [
        { name: "NPH",       appear: "Cloudy", onset: "3–4",   peak: "6–10",  dur: "10–16" },
    ]},
    { label: "LONG-ACTING",  color: C.danger, items: [
        { name: "Glargine",  appear: "Clear",  onset: "2–4",   peak: "---",   dur: "20–24" },
        { name: "Detemir",   appear: "Clear",  onset: "1–4",   peak: "---",   dur: "10–24" },
    ]},
  ];

  // Header row
  const hCols = ["Type / Name", "Appearance", "Onset (hrs)", "Peak (hrs)", "Duration (hrs)"];
  const cW =    [2.5,           1.4,           1.4,           1.4,          1.4];
  const cX =    [0.35,          2.9,           4.35,          5.8,          7.25];
  const rowH = 0.44;
  let curY = 1.35;

  hCols.forEach((h, ci) => {
    s.addShape(pres.shapes.RECTANGLE, { x: cX[ci], y: curY, w: cW[ci], h: rowH, fill: { color: C.teal }, line: { color: "2A4070", pt: 0.5 } });
    s.addText(h, { x: cX[ci] + 0.05, y: curY, w: cW[ci] - 0.1, h: rowH, fontSize: 10, bold: true, color: C.white, valign: "middle" });
  });
  curY += rowH;

  categories.forEach(cat => {
    cat.items.forEach((item, ii) => {
      const bg = curY % 0.1 < 0.05 ? "0F1E38" : C.navy; // alternate rows
      const isFirst = ii === 0;

      // Type label cell (span-like: just show on first row of category)
      s.addShape(pres.shapes.RECTANGLE, { x: cX[0], y: curY, w: cW[0], h: rowH, fill: { color: isFirst ? cat.color + "55" : C.navy + "00" }, line: { color: "2A4070", pt: 0.5 } });
      if (isFirst) {
        s.addText(cat.label + " — " + item.name, { x: cX[0] + 0.05, y: curY, w: cW[0] - 0.1, h: rowH, fontSize: 9.5, bold: true, color: cat.color, valign: "middle" });
      } else {
        s.addText("    " + item.name, { x: cX[0] + 0.05, y: curY, w: cW[0] - 0.1, h: rowH, fontSize: 9.5, color: C.offWhite, valign: "middle" });
      }

      [[1, item.appear], [2, item.onset], [3, item.peak], [4, item.dur]].forEach(([ci, val]) => {
        s.addShape(pres.shapes.RECTANGLE, { x: cX[ci], y: curY, w: cW[ci], h: rowH, fill: { color: bg }, line: { color: "2A4070", pt: 0.5 } });
        s.addText(val, { x: cX[ci] + 0.05, y: curY, w: cW[ci] - 0.1, h: rowH, fontSize: 9.5, color: C.offWhite, valign: "middle", align: "center" });
      });
      curY += rowH;
    });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 10 – INSULIN REGIMENS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "CLINICAL USE");
  slideTitle(s, "Insulin Regimens");
  divider(s);

  // Split-Mixed side
  accentCard(s, 0.3, 1.35, 4.4, 3.9, C.royal);
  s.addText("SPLIT-MIXED REGIMEN", { x: 0.5, y: 1.45, w: 4.0, h: 0.45, fontSize: 13, bold: true, color: C.sky });
  const smLines = [
    "• Mix of NPH + Regular insulin",
    "• Given TWICE daily",
    "• Morning: 2/3 of total dose",
    "• Evening: 1/3 of total dose",
    "• Breakfast + Dinner injections",
    "• Less flexible meal timing",
    "• Used in Type 2 DM",
  ];
  smLines.forEach((l, i) => {
    s.addText(l, { x: 0.5, y: 1.92 + i * 0.43, w: 4.0, h: 0.4, fontSize: 10, color: C.offWhite });
  });

  // Basal-Bolus side
  accentCard(s, 5.2, 1.35, 4.4, 3.9, "0E3D5C");
  s.addText("BASAL-BOLUS REGIMEN", { x: 5.4, y: 1.45, w: 4.0, h: 0.45, fontSize: 13, bold: true, color: C.gold });
  const bbLines = [
    "• Basal: Long-acting (Glargine/Detemir)",
    "• Bolus: Rapid-acting before each meal",
    "• Mimics physiological insulin secretion",
    "• FOUR injections per day",
    "• Flexible meal timing",
    "• Better glycaemic control",
    "• Preferred in Type 1 DM",
  ];
  bbLines.forEach((l, i) => {
    s.addText(l, { x: 5.4, y: 1.92 + i * 0.43, w: 4.0, h: 0.4, fontSize: 10, color: C.offWhite });
  });

  s.addText("← Simpler                Physiological →", { x: 0.3, y: 5.2, w: 9.4, h: 0.3, fontSize: 10, color: C.gray, align: "center" });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 11 – INDICATIONS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "INDICATIONS");
  slideTitle(s, "Indications for Insulin Therapy");
  divider(s);

  const indications = [
    { n: "1", label: "Type 1 Diabetes Mellitus",          note: "Absolute requirement — no endogenous insulin", color: C.danger,  icon: "🚨" },
    { n: "2", label: "Type 2 DM (OHA failure)",           note: "When oral hypoglycemic agents are insufficient", color: C.teal,   icon: "💊" },
    { n: "3", label: "Diabetic Ketoacidosis (DKA)",        note: "Emergency — IV insulin drip (0.1 U/kg/hr)",     color: "C0392B", icon: "⚠️" },
    { n: "4", label: "Hyperosmolar Hyperglycemic State",   note: "HHS — cautious rehydration + insulin",          color: "8E44AD", icon: "🌡️" },
    { n: "5", label: "Gestational Diabetes",              note: "Oral agents not preferred in pregnancy",        color: "1A7A4A", icon: "🤰" },
    { n: "6", label: "Perioperative / ICU Patients",      note: "Target BG 140–180 mg/dL in ICU",               color: "1A5276", icon: "🏥" },
    { n: "7", label: "Hyperkalemia",                      note: "Insulin shifts K⁺ INTO cells (with dextrose)",  color: C.gold,   icon: "⚡" },
  ];

  indications.forEach((ind, i) => {
    const col = i % 2 === 0 ? 0 : 1;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.3 : 5.15;
    const y = 1.42 + row * 1.05;
    const w = 4.6;
    accentCard(s, x, y, w, 0.92, ind.color + "44", ind.color);
    s.addText(ind.icon + "  " + ind.n + ".  " + ind.label, { x: x + 0.12, y: y + 0.08, w: w - 0.25, h: 0.38, fontSize: 12, bold: true, color: C.white });
    s.addText(ind.note, { x: x + 0.12, y: y + 0.48, w: w - 0.25, h: 0.35, fontSize: 9.5, color: C.sky });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 12 – KISS MNEMONIC (Hyperkalemia)
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "MNEMONIC");
  slideTitle(s, "KISS Mnemonic — Hyperkalemia Management");
  divider(s);

  // Central KISS badge
  s.addShape(pres.shapes.RECTANGLE, { x: 3.5, y: 1.35, w: 3, h: 1.1, fill: { color: C.gold }, line: { type: "none" } });
  s.addText("K.I.S.S.", { x: 3.5, y: 1.35, w: 3, h: 1.1, fontSize: 36, bold: true, color: C.navy, align: "center", valign: "middle", charSpacing: 10 });

  s.addText("K  Influx  Shifting  Strategy", {
    x: 2.5, y: 2.55, w: 5, h: 0.45,
    fontSize: 14, color: C.sky, align: "center", italic: true,
  });

  // Dual mechanism illustration
  accentCard(s, 0.3, 3.15, 4.3, 2.0, C.danger);
  s.addText("⚡  EPINEPHRINE (β₂)", { x: 0.5, y: 3.22, w: 3.9, h: 0.45, fontSize: 13, bold: true, color: C.white });
  s.addText([
    { text: "β₂ receptor activation\n", options: { breakLine: false } },
    { text: "→ Na⁺/K⁺-ATPase stimulation\n", options: { breakLine: false } },
    { text: "→ K⁺ moves INTO cells", options: {} },
  ], { x: 0.5, y: 3.7, w: 3.9, h: 1.3, fontSize: 10.5, color: C.offWhite });

  accentCard(s, 5.4, 3.15, 4.3, 2.0, C.teal);
  s.addText("💉  INSULIN", { x: 5.6, y: 3.22, w: 3.9, h: 0.45, fontSize: 13, bold: true, color: C.white });
  s.addText([
    { text: "Insulin receptor (RTK)\n", options: { breakLine: false } },
    { text: "→ Na⁺/K⁺-ATPase activation\n", options: { breakLine: false } },
    { text: "→ K⁺ moves INTO cells", options: {} },
  ], { x: 5.6, y: 3.7, w: 3.9, h: 1.3, fontSize: 10.5, color: C.offWhite });

  s.addText("⚠  Always give with IV Dextrose to prevent hypoglycemia", {
    x: 0.3, y: 5.15, w: 9.4, h: 0.33,
    fontSize: 10.5, bold: true, color: C.gold, align: "center",
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 13 – PRESCRIPTION CASE (8-yr-old Type 1)
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "CASE — PRESCRIPTION");
  slideTitle(s, "Prescription Writing: Paediatric Type 1 DM");
  divider(s);

  // Patient box
  accentCard(s, 0.3, 1.35, 9.4, 1.0, C.royal);
  s.addText("👦  Akash | 8 yrs | 15 kg  |  FBG 250 mg/dL  |  HbA1c 7%  |  Type 1 DM", {
    x: 0.5, y: 1.5, w: 9.0, h: 0.5, fontSize: 12, bold: true, color: C.offWhite, align: "center",
  });
  s.addText("Lethargy · Weight loss · Polydipsia · Bedwetting (Enuresis)", {
    x: 0.5, y: 1.93, w: 9.0, h: 0.3, fontSize: 10, color: C.sky, align: "center",
  });

  // Prescription card
  accentCard(s, 0.3, 2.5, 9.4, 2.85, "061424");
  s.addText("℞  INSULIN PRESCRIPTION", { x: 0.5, y: 2.58, w: 9.0, h: 0.42, fontSize: 14, bold: true, color: C.gold });

  const rxLines = [
    ["Regimen:", "Basal-Bolus (physiological — preferred in children)"],
    ["Basal:", "Insulin Glargine 0.2 U/kg SC at bedtime → 3 U at night"],
    ["Bolus:", "Regular Insulin OR Rapid-acting (Lispro) 0.1 U/kg SC 15–30 min before each main meal → ~1.5 U TDS"],
    ["Total daily dose:", "~0.5 U/kg/day = ~7.5 U/day (start low, titrate)"],
    ["Monitoring:", "SMBG 4×/day (pre-meals + bedtime) · HbA1c every 3 months"],
    ["Diet / Lifestyle:", "Consistent carb diet · Education for patient and family · Sick-day rules"],
  ];

  rxLines.forEach((ln, i) => {
    s.addText(ln[0], { x: 0.5, y: 3.05 + i * 0.38, w: 2.2, h: 0.36, fontSize: 10, bold: true, color: C.sky });
    s.addText(ln[1], { x: 2.7, y: 3.05 + i * 0.38, w: 6.8, h: 0.36, fontSize: 10, color: C.offWhite });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 14 – DKA EMERGENCY MANAGEMENT CASE
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "EMERGENCY CASE");
  slideTitle(s, "DKA Management: Mr. Arun");
  divider(s);

  // Case summary
  accentCard(s, 0.3, 1.35, 9.4, 1.0, "3B1212");
  s.addText("🚨  Mr. Arun · Type 1 DM (basal-bolus for 7 months) · Stopped insulin due to poor appetite during RTI", {
    x: 0.5, y: 1.45, w: 9.0, h: 0.4, fontSize: 11, bold: true, color: "#FFB3B3",
  });
  s.addText("Nausea · Vomiting · Abdominal pain · Dehydration · Tachycardia · BG 500 mg/dL · Urine ketones +ve", {
    x: 0.5, y: 1.85, w: 9.0, h: 0.3, fontSize: 10, color: C.offWhite,
  });

  const steps = [
    { icon: "💧", title: "1. FLUID RESUSCITATION", detail: "0.9% NaCl 1L over 1st hour → subsequent bags guided by BP & urine output. Replace K⁺ when K⁺ < 5.5 mEq/L", color: "1A5276" },
    { icon: "💉", title: "2. INSULIN INFUSION", detail: "IV Regular Insulin 0.1 U/kg/hr (ONLY after K⁺ > 3.3 mEq/L). Target: BG fall 50–75 mg/dL/hr", color: C.danger },
    { icon: "⚗️", title: "3. ELECTROLYTE CORRECTION", detail: "K⁺ replacement mandatory (insulin shifts K⁺ in). Monitor Na⁺, Cl⁻, phosphate. Avoid Na bicarbonate unless pH < 6.9", color: "8E44AD" },
    { icon: "🔬", title: "4. MONITORING", detail: "BG every 1 hr · ABG every 2–4 hr · Urine output · ECG (cardiac arrhythmia risk from K⁺ fluctuations)", color: C.teal },
    { icon: "🔄", title: "5. TRANSITION TO SC INSULIN", detail: "When BG < 250 mg/dL → add 5% Dextrose to IV fluids. Resume SC insulin when patient eating & AG normalized", color: "1A7A4A" },
  ];

  steps.forEach((st, i) => {
    const x = 0.3 + (i % 2 === 0 ? 0 : 4.85);
    const y = 2.5 + Math.floor(i / 2) * 1.15;
    if (i === 4) {
      accentCard(s, 0.3, y, 9.4, 1.05, st.color);
      s.addText(st.icon + " " + st.title, { x: 0.5, y: y + 0.08, w: 9.0, h: 0.35, fontSize: 11, bold: true, color: C.white });
      s.addText(st.detail, { x: 0.5, y: y + 0.43, w: 9.0, h: 0.5, fontSize: 9.5, color: C.offWhite });
    } else {
      accentCard(s, x, y, 4.6, 1.05, st.color);
      s.addText(st.icon + " " + st.title, { x: x + 0.15, y: y + 0.08, w: 4.3, h: 0.35, fontSize: 10.5, bold: true, color: C.white });
      s.addText(st.detail, { x: x + 0.15, y: y + 0.43, w: 4.3, h: 0.5, fontSize: 9, color: C.offWhite });
    }
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 15 – ADVERSE DRUG REACTIONS
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);
  sectionTag(s, "ADVERSE EFFECTS");
  slideTitle(s, "Insulin Adverse Drug Reactions (ADRs)");
  divider(s);

  const adrs = [
    {
      name: "HYPOGLYCEMIA",
      num: "1",
      color: C.danger,
      icon: "📉",
      points: [
        "Most common & dangerous ADR",
        "Sx: sweating, tremor, palpitations, confusion",
        "Severe: seizures, coma",
        "Mx: 15g fast-acting carb (rule of 15)",
        "IV Dextrose 25% / IM Glucagon if unconscious",
      ],
    },
    {
      name: "WEIGHT GAIN",
      num: "2",
      color: "7D6608",
      icon: "⚖️",
      points: [
        "Anabolic effect of insulin",
        "↑ Fat deposition, ↓ lipolysis",
        "Managed by diet & exercise",
        "Consider metformin co-therapy",
      ],
    },
    {
      name: "HYPOKALEMIA",
      num: "3",
      color: "8E44AD",
      icon: "⚡",
      points: [
        "Insulin activates Na⁺/K⁺-ATPase",
        "K⁺ shifts intracellularly",
        "Risk of cardiac arrhythmias",
        "Monitor serum K⁺; replace as needed",
      ],
    },
    {
      name: "LIPODYSTROPHY",
      num: "4",
      color: C.teal,
      icon: "💉",
      points: [
        "Lipoatrophy: fat loss at injection site (immune reaction to older insulins)",
        "Lipohypertrophy: fat accumulation from repeated injection at same site",
        "Prevention: rotate injection sites",
      ],
    },
  ];

  adrs.forEach((a, i) => {
    const x = 0.3 + (i % 2) * 4.85;
    const y = 1.42 + Math.floor(i / 2) * 2.0;
    accentCard(s, x, y, 4.6, 1.85, a.color);
    s.addText(a.icon + "  " + a.num + ". " + a.name, { x: x + 0.12, y: y + 0.1, w: 4.35, h: 0.45, fontSize: 14, bold: true, color: C.white });
    a.points.forEach((p, pi) => {
      s.addText("• " + p, { x: x + 0.12, y: y + 0.55 + pi * 0.3, w: 4.35, h: 0.28, fontSize: 9.5, color: C.offWhite });
    });
  });
}

// ════════════════════════════════════════════════════════════════════════════
// SLIDE 16 – THANK YOU / CLOSING
// ════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  fullBg(s, C.navy);

  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.55, h: 5.625, fill: { color: C.gold }, line: { type: "none" } });
  s.addShape(pres.shapes.RECTANGLE, { x: 9.45, y: 0, w: 0.55, h: 5.625, fill: { color: C.gold }, line: { type: "none" } });

  s.addText("THANK YOU", {
    x: 0.7, y: 1.0, w: 8.6, h: 1.5,
    fontSize: 64, bold: true, color: C.white, charSpacing: 12, align: "center",
  });

  s.addShape(pres.shapes.RECTANGLE, { x: 2, y: 2.6, w: 6, h: 0.06, fill: { color: C.gold }, line: { type: "none" } });

  s.addText('"READ TO UNDERSTAND… NOT TO FINISH PAGES"', {
    x: 0.7, y: 2.8, w: 8.6, h: 0.7,
    fontSize: 18, italic: true, color: C.sky, align: "center",
  });

  s.addText("— Dr Sudheer Prudhvi", {
    x: 0.7, y: 3.55, w: 8.6, h: 0.45,
    fontSize: 14, color: C.gold, align: "center", bold: true,
  });

  // Topics summary strip
  const topics = ["History", "Type 1 vs Type 2", "Diabetogenic Drugs", "GSIS Mechanism", "Receptor Types", "Insulin Actions", "Preparations", "Regimens", "Indications", "KISS Mnemonic", "Prescription", "DKA Management", "ADRs"];
  s.addText(topics.join("  ·  "), {
    x: 0.7, y: 4.9, w: 8.6, h: 0.55,
    fontSize: 9, color: C.gray, align: "center",
  });
}

// ─── WRITE FILE ─────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/insulin-pptx/Insulin_Lecture.pptx" })
  .then(() => console.log("✅  Saved: /home/daytona/workspace/insulin-pptx/Insulin_Lecture.pptx"))
  .catch(err => { console.error("❌  Error:", err); process.exit(1); });
Running Command

cd /home/daytona/workspace/insulin-pptx && node create_insulin_pptx.js

Editing File

~/insulin-pptx/create_insulin_pptx.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/insulin-pptx/create_insulin_pptx.js'
Running Command

cd /home/daytona/workspace/insulin-pptx && sed -i \ 's/"FFFFFF40"/"8ABCD1"/g' …

Running Command

cd /home/daytona/workspace/insulin-pptx && node create_insulin_pptx.js 2>&1 | gr…

Running Command

python3 -c " import re with open('/home/daytona/workspace/insulin-pptx/create_i…

Your credits are exhausted. Your daily credits reset tomorrow, or you can purchase a top-up for more.
This is a shared conversation. Sign in to Orris to start your own chat.