A 65 year old asthama paitent comes to opd he has also diabeties mellitus type 2 and a exacreabtion of asthama attack how should i manage the paitent Genrate a ppt

Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/asthma-dm-ppt && ls /home/daytona/workspace/asthma-dm-ppt/

Writing File

~/asthma-dm-ppt/generate.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE";
pres.title = "Acute Asthma Exacerbation in a Diabetic Patient";

// ─── COLOUR PALETTE ───────────────────────────────────────────────────────────
const C = {
  navy:    "0A1628",  // dominant dark bg
  teal:    "0D7377",  // accent
  tealLt:  "14BDAC",  // highlight
  white:   "FFFFFF",
  offWhite:"F0F4F8",
  amber:   "F5A623",  // warning
  red:     "D0021B",  // danger
  slate:   "334155",  // body text
  lightBg: "EAF4F4",  // card bg
  mutedTxt:"64748B",
};

// ─── HELPER ───────────────────────────────────────────────────────────────────
function addSectionBadge(slide, label, color) {
  slide.addShape(pres.ShapeType.roundRect, { x: 0.35, y: 0.18, w: 2.6, h: 0.42, fill: { color: color || C.teal }, line: { type: "none" }, rectRadius: 0.06 });
  slide.addText(label, { x: 0.35, y: 0.18, w: 2.6, h: 0.42, fontSize: 10, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
}

function addFooter(slide) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 7.2, w: 13.3, h: 0.3, fill: { color: C.navy }, line: { type: "none" } });
  slide.addText("Textbook of Family Medicine 9e  |  OPD Case Management Guide", {
    x: 0, y: 7.2, w: 13.3, h: 0.3, fontSize: 8, color: C.offWhite, align: "center", valign: "middle", margin: 0
  });
}

function sectionTitle(slide, mainTitle, subTitle, accent) {
  slide.background = { color: C.navy };
  // Left colour bar
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 7.5, fill: { color: accent || C.teal }, line: { type: "none" } });
  slide.addText(mainTitle, { x: 0.5, y: 2.5, w: 12.3, h: 1.4, fontSize: 44, bold: true, color: C.white, align: "left", valign: "middle" });
  if (subTitle) {
    slide.addText(subTitle, { x: 0.5, y: 3.9, w: 12.3, h: 0.7, fontSize: 20, color: C.tealLt, align: "left" });
  }
}

function cardBullets(slide, x, y, w, h, heading, items, headColor) {
  slide.addShape(pres.ShapeType.roundRect, { x, y, w, h, fill: { color: C.lightBg }, line: { color: C.teal, pt: 1.5 }, rectRadius: 0.08 });
  slide.addText(heading, { x: x + 0.15, y: y + 0.1, w: w - 0.3, h: 0.38, fontSize: 12, bold: true, color: headColor || C.teal, align: "left", margin: 0 });
  const richItems = items.map((t, i) => ({ text: t, options: { bullet: { type: "bullet", indent: 12 }, breakLine: i < items.length - 1, fontSize: 10.5, color: C.slate } }));
  slide.addText(richItems, { x: x + 0.15, y: y + 0.5, w: w - 0.3, h: h - 0.6, valign: "top", margin: 0 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 1  ─  TITLE
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.navy };

  // Decorative accent bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.12, fill: { color: C.teal }, line: { type: "none" } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 7.38, w: 13.3, h: 0.12, fill: { color: C.tealLt }, line: { type: "none" } });

  // Circle decoration
  s.addShape(pres.ShapeType.ellipse, { x: 9.5, y: 0.8, w: 4.5, h: 4.5, fill: { color: C.teal, transparency: 85 }, line: { type: "none" } });
  s.addShape(pres.ShapeType.ellipse, { x: 10.2, y: 2.2, w: 2.8, h: 2.8, fill: { color: C.tealLt, transparency: 75 }, line: { type: "none" } });

  s.addText("Acute Asthma Exacerbation", { x: 0.6, y: 1.4, w: 9.5, h: 0.9, fontSize: 38, bold: true, color: C.white });
  s.addText("in a Type 2 Diabetic Patient", { x: 0.6, y: 2.2, w: 9.5, h: 0.7, fontSize: 32, bold: false, color: C.tealLt });

  // Divider line
  s.addShape(pres.ShapeType.line, { x: 0.6, y: 3.1, w: 8, h: 0, line: { color: C.teal, pt: 2 } });

  s.addText("OPD Case Management Approach", { x: 0.6, y: 3.3, w: 9, h: 0.45, fontSize: 16, color: C.offWhite, italic: true });

  // Patient card
  s.addShape(pres.ShapeType.roundRect, { x: 0.6, y: 4.05, w: 5.5, h: 1.65, fill: { color: C.teal, transparency: 85 }, line: { color: C.teal, pt: 1 }, rectRadius: 0.1 });
  s.addText([
    { text: "Patient Profile", options: { bold: true, breakLine: true, fontSize: 13, color: C.tealLt } },
    { text: "Age: 65 years  |  Known Asthmatic  |  Type 2 DM", options: { fontSize: 12, color: C.white, breakLine: true } },
    { text: "Presenting with acute exacerbation of asthma", options: { fontSize: 12, color: C.white } },
  ], { x: 0.75, y: 4.1, w: 5.2, h: 1.5, valign: "middle" });

  s.addText("For Educational Purposes Only", { x: 0, y: 7.2, w: 13.3, h: 0.3, fontSize: 8.5, color: C.mutedTxt, align: "center" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 2  ─  INITIAL ASSESSMENT
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.offWhite };
  addSectionBadge(s, "STEP 1 — INITIAL ASSESSMENT", C.navy);
  s.addText("Initial OPD Assessment", { x: 0.35, y: 0.65, w: 12.6, h: 0.6, fontSize: 26, bold: true, color: C.navy });

  // Row 1: 3 cards
  cardBullets(s, 0.35, 1.35, 3.8, 2.6, "History & Symptoms",
    ["Progressive dyspnea, wheeze, cough", "Chest tightness duration & onset", "Triggering factors (allergens, URI)", "Prior intubations / ICU admissions", "Frequency of SABA use (>2 canisters/mo = risk)", "Comorbidities: DM, cardiovascular, GERD"],
    C.teal);

  cardBullets(s, 4.4, 1.35, 3.8, 2.6, "Physical Examination",
    ["RR, HR, SpO₂, BP, temperature", "Accessory muscle use, pulsus paradoxus", "Prolonged expiratory phase", "Absent breath sounds (impending failure)", "Mental status assessment", "Signs of hyperglycemia (polyuria, polydipsia)"],
    C.teal);

  cardBullets(s, 8.45, 1.35, 4.5, 2.6, "Objective Measures",
    ["Peak Expiratory Flow Rate (PEFR)", "FEV₁ / FVC — grade obstruction severity", "Pulse oximetry (target SpO₂ ≥95%)", "Blood glucose (baseline for DM)", "ABG if severe / SpO₂ <92%", "CXR only if pneumonia / pneumothorax suspected"],
    C.teal);

  // Severity box
  s.addShape(pres.ShapeType.roundRect, { x: 0.35, y: 4.1, w: 12.6, h: 1.1, fill: { color: C.navy }, line: { type: "none" }, rectRadius: 0.08 });
  s.addText([
    { text: "Severity Classification:  ", options: { bold: true, color: C.tealLt, fontSize: 12 } },
    { text: "Mild — PEFR >70%  |  ", options: { color: C.white, fontSize: 12 } },
    { text: "Moderate — PEFR 40–69%  |  ", options: { color: C.amber, fontSize: 12 } },
    { text: "Severe — PEFR <40%  |  ", options: { color: "FF6B6B", fontSize: 12 } },
    { text: "Life-threatening — silent chest, cyanosis, altered sensorium", options: { color: C.red, fontSize: 12 } },
  ], { x: 0.5, y: 4.1, w: 12.3, h: 1.1, valign: "middle" });

  s.addText("Targets: PEFR return to >70% predicted before discharge | SpO₂ ≥95%", { x: 0.35, y: 5.32, w: 12.6, h: 0.36, fontSize: 10, italic: true, color: C.mutedTxt });

  addFooter(s);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 3  ─  ACUTE PHARMACOTHERAPY
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.offWhite };
  addSectionBadge(s, "STEP 2 — ACUTE PHARMACOTHERAPY", C.teal);
  s.addText("Pharmacological Management of Acute Exacerbation", { x: 0.35, y: 0.65, w: 12.6, h: 0.6, fontSize: 24, bold: true, color: C.navy });

  // Header strip
  const headers = [["1st LINE", C.teal], ["ADJUNCT", C.tealLt], ["SYSTEMIC", C.amber], ["OXYGEN", C.navy]];
  const xPos = [0.35, 3.6, 6.85, 10.1];
  const wCard = 3.0;
  headers.forEach(([h, c], i) => {
    s.addShape(pres.ShapeType.roundRect, { x: xPos[i], y: 1.35, w: wCard, h: 0.38, fill: { color: c }, line: { type: "none" }, rectRadius: 0.06 });
    s.addText(h, { x: xPos[i], y: 1.35, w: wCard, h: 0.38, fontSize: 11, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
  });

  const cardData = [
    {
      bullets: ["Short-acting β₂-agonist (SABA):", "Salbutamol 2.5 mg via nebulizer", "or 4-8 puffs MDI + spacer", "Repeat every 20 min x 3 in 1st hour", "Continue as needed for response", "(SOR: A — NHLBI EPR-3)"]
    },
    {
      bullets: ["Ipratropium bromide:", "0.5 mg nebulized with SABA", "Every 20 min x 3 doses", "Then every 2–4 h as needed", "Not continued during hospitalisation", "Reduces need for hospitalisation"]
    },
    {
      bullets: ["Oral / IV corticosteroids:", "Prednisolone 40–60 mg PO OD", "or Methylprednisolone 60–80 mg IV", "Duration: 5–7 days", "⚠ Monitor blood glucose closely!", "May worsen glycaemic control in DM"]
    },
    {
      bullets: ["Supplemental oxygen:", "Target SpO₂ 93–95%", "Nasal cannula or simple face mask", "Avoid over-oxygenation", "Re-assess ABG if severe", ""]
    }
  ];

  cardData.forEach((cd, i) => {
    s.addShape(pres.ShapeType.roundRect, { x: xPos[i], y: 1.78, w: wCard, h: 3.3, fill: { color: C.white }, line: { color: "DDDDDD", pt: 1 }, rectRadius: 0.06 });
    const rich = cd.bullets.map((t, bi) => ({ text: t, options: { bullet: bi >= 1, breakLine: bi < cd.bullets.length - 1, fontSize: 10.5, color: bi === 0 ? C.teal : C.slate, bold: bi === 0 } }));
    s.addText(rich, { x: xPos[i] + 0.15, y: 1.82, w: wCard - 0.3, h: 3.2, valign: "top", margin: 0 });
  });

  // Warning banner
  s.addShape(pres.ShapeType.roundRect, { x: 0.35, y: 5.2, w: 12.6, h: 0.85, fill: { color: "FFF3E0" }, line: { color: C.amber, pt: 1.5 }, rectRadius: 0.07 });
  s.addText("⚠  Corticosteroid-Induced Hyperglycaemia Alert:", { x: 0.55, y: 5.22, w: 4.5, h: 0.38, fontSize: 11, bold: true, color: "B45309", margin: 0 });
  s.addText("Monitor blood glucose 2–4 hourly. Adjust antidiabetic regimen. Consider short-acting insulin sliding scale if BS >200 mg/dL. Avoid sulfonylureas in uncontrolled hyperglycaemia.", { x: 0.55, y: 5.57, w: 12.1, h: 0.42, fontSize: 10, color: C.slate, margin: 0 });

  addFooter(s);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 4  ─  DIABETES MANAGEMENT DURING EXACERBATION
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.offWhite };
  addSectionBadge(s, "STEP 3 — DIABETES CO-MANAGEMENT", C.amber);
  s.addText("Managing Type 2 DM During Acute Exacerbation", { x: 0.35, y: 0.65, w: 12.6, h: 0.6, fontSize: 24, bold: true, color: C.navy });

  cardBullets(s, 0.35, 1.35, 6.0, 2.5, "Monitoring & Targets",
    ["Blood glucose monitoring every 2–4 hours during exacerbation",
     "Target BG: 140–180 mg/dL (inpatient), <130 mg/dL (fasting) outpatient",
     "HbA1c — assess glycaemic control over past 3 months",
     "Watch for hyperglycaemia from systemic steroids",
     "Watch for hypoglycaemia if oral intake is poor",
     "Assess renal function before metformin continuation"],
    C.amber);

  cardBullets(s, 6.6, 1.35, 6.35, 2.5, "Drug Interactions & Adjustments",
    ["β-agonists (salbutamol) → transient hypokalaemia & hyperglycaemia",
     "Systemic corticosteroids → significant insulin resistance, elevated BG",
     "Metformin: hold if hospitalised / IV contrast / renal impairment",
     "Sulfonylureas: risk of hypoglycaemia if oral intake reduced",
     "Short-acting insulin (SSI) preferred for inpatient BG control",
     "SGLT2 inhibitors: hold if patient is ill / poor intake"],
    C.amber);

  // Lifestyle card
  s.addShape(pres.ShapeType.roundRect, { x: 0.35, y: 4.0, w: 12.6, h: 1.7, fill: { color: C.white }, line: { color: C.teal, pt: 1.5 }, rectRadius: 0.08 });
  s.addText("Long-term DM Goals (ADA / Family Medicine Guidelines)", { x: 0.55, y: 4.05, w: 12, h: 0.38, fontSize: 13, bold: true, color: C.teal, margin: 0 });
  const dmGoals = [
    ["HbA1c Target", "<7% (individualise for elderly/frail patients)"],
    ["Lifestyle", "Healthy diet, regular moderate activity, cessation of smoking"],
    ["Weight", "5–10% reduction from baseline if overweight"],
    ["Pharmacotherapy", "Metformin first-line unless contraindicated; stepwise addition"],
    ["BP & Lipids", "BP <130/80 mmHg; statin therapy for CVD risk reduction"],
  ];
  dmGoals.forEach(([k, v], i) => {
    const col = i < 3 ? 0.55 : 6.8;
    const row = i < 3 ? 4.48 + i * 0.34 : 4.48 + (i - 3) * 0.34;
    s.addText([
      { text: k + ": ", options: { bold: true, color: C.navy, fontSize: 10.5 } },
      { text: v, options: { color: C.slate, fontSize: 10.5 } }
    ], { x: col, y: row, w: 5.8, h: 0.32, margin: 0 });
  });

  addFooter(s);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 5  ─  STEP-UP THERAPY / ASTHMA CONTROLLER
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.offWhite };
  addSectionBadge(s, "STEP 4 — CONTROLLER THERAPY", C.teal);
  s.addText("Long-term Asthma Step-Up Therapy", { x: 0.35, y: 0.65, w: 12.6, h: 0.6, fontSize: 24, bold: true, color: C.navy });

  const steps = [
    { step: "Step 1", label: "Intermittent", color: "4CAF50", rx: "SABA PRN only\n(Salbutamol inhaler)" },
    { step: "Step 2", label: "Mild Persistent", color: C.teal, rx: "Low-dose ICS\n+ SABA PRN" },
    { step: "Step 3", label: "Mod. Persistent", color: C.amber, rx: "Low-dose ICS\n+ LABA  or\nMed-dose ICS" },
    { step: "Step 4", label: "Mod–Severe", color: "FF6B35", rx: "Med-dose ICS\n+ LABA\n± LTRA" },
    { step: "Step 5", label: "Severe", color: C.red, rx: "High-dose ICS\n+ LABA\n+ Oral CS" },
  ];

  steps.forEach((st, i) => {
    const x = 0.35 + i * 2.6;
    // Column bar growing height
    const barH = 0.7 + i * 0.3;
    s.addShape(pres.ShapeType.roundRect, { x: x + 0.1, y: 1.4, w: 2.2, h: 1.0, fill: { color: st.color }, line: { type: "none" }, rectRadius: 0.06 });
    s.addText([
      { text: st.step, options: { bold: true, fontSize: 14, color: C.white, breakLine: true } },
      { text: st.label, options: { fontSize: 10, color: C.white } }
    ], { x: x + 0.1, y: 1.4, w: 2.2, h: 1.0, align: "center", valign: "middle", margin: 0 });

    s.addShape(pres.ShapeType.roundRect, { x: x + 0.1, y: 2.5, w: 2.2, h: 2.5, fill: { color: C.white }, line: { color: st.color, pt: 1.5 }, rectRadius: 0.06 });
    s.addText(st.rx, { x: x + 0.2, y: 2.6, w: 2.0, h: 2.3, fontSize: 11, color: C.slate, align: "center", valign: "middle" });
  });

  // Notes
  s.addShape(pres.ShapeType.roundRect, { x: 0.35, y: 5.15, w: 12.6, h: 0.95, fill: { color: "E8F5E9" }, line: { color: "4CAF50", pt: 1 }, rectRadius: 0.07 });
  s.addText([
    { text: "Key: ", options: { bold: true, color: C.navy, fontSize: 11 } },
    { text: "ICS = Inhaled Corticosteroid  |  LABA = Long-Acting β₂-Agonist  |  LTRA = Leukotriene Receptor Antagonist  |  SABA = Short-Acting β₂-Agonist  |  ", options: { fontSize: 10.5, color: C.slate } },
    { text: "In this 65-yr DM patient consider Step 3–4 if not well controlled. Prefer ICS alone before adding LABA.", options: { bold: true, fontSize: 10.5, color: C.teal } }
  ], { x: 0.5, y: 5.17, w: 12.2, h: 0.9, valign: "middle" });

  addFooter(s);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 6  ─  SPECIAL CONSIDERATIONS IN THE ELDERLY DIABETIC
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.offWhite };
  addSectionBadge(s, "SPECIAL CONSIDERATIONS", C.navy);
  s.addText("Elderly Patient with Dual Comorbidity — Key Considerations", { x: 0.35, y: 0.65, w: 12.6, h: 0.6, fontSize: 22, bold: true, color: C.navy });

  const boxes = [
    {
      icon: "⚠️",
      head: "Drug Cautions",
      color: "FEF3C7",
      border: C.amber,
      hc: "B45309",
      items: [
        "Avoid non-selective β-blockers (worsen bronchospasm)",
        "NSAIDs may worsen both asthma & renal function",
        "ACE inhibitors → cough (may mimic asthma symptom)",
        "Theophylline — narrow therapeutic index in elderly",
        "Aspirin-sensitive asthma — check NSAID history",
      ]
    },
    {
      icon: "🩺",
      head: "Inhaler Technique",
      color: "EFF6FF",
      border: "3B82F6",
      hc: "1D4ED8",
      items: [
        "Assess and teach proper MDI technique",
        "Use spacer device (improves lung deposition)",
        "Nebuliser preferred if coordination is poor",
        "Document adherence at each visit",
        "Salbutamol refills >2 canisters/month = poor control",
      ]
    },
    {
      icon: "📋",
      head: "Written Action Plan",
      color: "F0FDF4",
      border: "22C55E",
      hc: "15803D",
      items: [
        "Provide a peak-flow–based written action plan",
        "Green zone >80% PEFR — continue controller Rx",
        "Yellow zone 50–80% — increase SABA, start prednisolone",
        "Red zone <50% — seek emergency care immediately",
        "Schedule follow-up within 2–4 weeks post-exacerbation",
      ]
    },
    {
      icon: "💉",
      head: "Preventive Care",
      color: "FDF4FF",
      border: "A855F7",
      hc: "7E22CE",
      items: [
        "Annual influenza vaccination (reduces exacerbations)",
        "Pneumococcal vaccine (elderly + DM high-risk)",
        "Smoking cessation counselling",
        "Allergy testing — identify triggers",
        "Assess for GERD / obesity — common asthma worseners",
      ]
    }
  ];

  const positions = [[0.35, 1.35, 5.9, 2.7], [7.05, 1.35, 5.9, 2.7], [0.35, 4.15, 5.9, 2.7], [7.05, 4.15, 5.9, 2.7]];
  boxes.forEach((b, i) => {
    const [x, y, w, h] = positions[i];
    s.addShape(pres.ShapeType.roundRect, { x, y, w, h, fill: { color: b.color }, line: { color: b.border, pt: 1.5 }, rectRadius: 0.08 });
    s.addText(`${b.icon}  ${b.head}`, { x: x + 0.15, y: y + 0.1, w: w - 0.3, h: 0.38, fontSize: 12.5, bold: true, color: b.hc, margin: 0 });
    const rich = b.items.map((t, bi) => ({ text: t, options: { bullet: { type: "bullet" }, breakLine: bi < b.items.length - 1, fontSize: 10.5, color: C.slate } }));
    s.addText(rich, { x: x + 0.2, y: y + 0.52, w: w - 0.35, h: h - 0.62, valign: "top", margin: 0 });
  });

  addFooter(s);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 7  ─  REFERRAL & DISCHARGE CRITERIA
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.offWhite };
  addSectionBadge(s, "STEP 5 — DISPOSITION", C.teal);
  s.addText("Referral, Admission & Discharge Criteria", { x: 0.35, y: 0.65, w: 12.6, h: 0.6, fontSize: 24, bold: true, color: C.navy });

  // 3-column layout
  const cols = [
    {
      head: "✅  Discharge from OPD", color: "22C55E", bg: "F0FDF4", border: "22C55E",
      items: [
        "PEFR / FEV₁ returned to >70% personal best",
        "SpO₂ ≥95% on room air",
        "Minimal symptoms at rest",
        "Blood glucose stable / controlled",
        "Patient able to self-administer inhaler",
        "Written action plan provided",
        "Follow-up arranged within 2–4 weeks"
      ]
    },
    {
      head: "🏥  Admit to Hospital", color: C.amber, bg: "FFFBEB", border: C.amber,
      items: [
        "PEFR 40–70% after initial treatment",
        "Incomplete response to 3 x SABA doses",
        "Severe hypoxia — SpO₂ <92%",
        "Uncontrolled blood glucose (BG >300 mg/dL)",
        "Age ≥65 + multiple comorbidities",
        "Prior ICU admission or intubation",
        "Inability to care for self at home"
      ]
    },
    {
      head: "🚨  ICU / Emergency", color: C.red, bg: "FEF2F2", border: C.red,
      items: [
        "Life-threatening exacerbation",
        "PEFR <40% or silent chest",
        "Altered consciousness / cyanosis",
        "SpO₂ <88% despite O₂",
        "Respiratory acidosis on ABG",
        "DKA / hyperosmolar state (DM emergency)",
        "Impending respiratory arrest"
      ]
    }
  ];

  cols.forEach((col, i) => {
    const x = 0.35 + i * 4.35;
    s.addShape(pres.ShapeType.roundRect, { x, y: 1.35, w: 4.0, h: 0.48, fill: { color: col.color }, line: { type: "none" }, rectRadius: 0.07 });
    s.addText(col.head, { x, y: 1.35, w: 4.0, h: 0.48, fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    s.addShape(pres.ShapeType.roundRect, { x, y: 1.88, w: 4.0, h: 4.4, fill: { color: col.bg }, line: { color: col.border, pt: 1.5 }, rectRadius: 0.07 });
    const rich = col.items.map((t, bi) => ({ text: t, options: { bullet: { type: "bullet" }, breakLine: bi < col.items.length - 1, fontSize: 10.5, color: C.slate } }));
    s.addText(rich, { x: x + 0.15, y: 1.95, w: 3.7, h: 4.2, valign: "top", margin: 0 });
  });

  addFooter(s);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 8  ─  SUMMARY FLOWCHART (TEXT)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.navy };
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 7.5, fill: { color: C.teal }, line: { type: "none" } });
  s.addText("Quick Reference Summary", { x: 0.5, y: 0.2, w: 12, h: 0.6, fontSize: 28, bold: true, color: C.white });

  const flow = [
    { n: "01", t: "Assess severity", d: "PEFR, SpO₂, HR, RR, blood glucose, mental status", c: C.teal },
    { n: "02", t: "Oxygen + SABA", d: "Salbutamol neb q20 min × 3 | SpO₂ target 93–95%", c: "4CAF50" },
    { n: "03", t: "Add ipratropium", d: "0.5 mg neb with SABA × 3 doses (SOR: A)", c: C.tealLt },
    { n: "04", t: "Systemic CS", d: "Prednisolone 40–60 mg PO | Monitor BG every 2–4 h", c: C.amber },
    { n: "05", t: "DM management", d: "Hold metformin if ill | SSI if BG >200 | Avoid sulphonylureas if poor intake", c: "FF6B35" },
    { n: "06", t: "Dispose & plan", d: "Discharge (PEFR >70%) | Admit (40–70%) | ICU (<40% or life-threatening)", c: "A855F7" },
  ];

  flow.forEach((f, i) => {
    const x = i < 3 ? 0.5 : 6.9;
    const y = 0.97 + (i % 3) * 1.7;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 0.65, h: 0.65, fill: { color: f.c }, line: { type: "none" }, rectRadius: 0.08 });
    s.addText(f.n, { x, y, w: 0.65, h: 0.65, fontSize: 16, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    s.addText(f.t, { x: x + 0.75, y: y + 0.03, w: 5.4, h: 0.3, fontSize: 12, bold: true, color: f.c, margin: 0 });
    s.addText(f.d, { x: x + 0.75, y: y + 0.3, w: 5.4, h: 0.35, fontSize: 10.5, color: "CBD5E1", margin: 0 });
  });

  s.addText("Reference: Textbook of Family Medicine 9e  |  NHLBI Expert Panel Report 3  |  ADA Standards of Medical Care", {
    x: 0.5, y: 7.15, w: 12.3, h: 0.28, fontSize: 8.5, color: "64748B", align: "center", italic: true
  });
}

// ─── WRITE ────────────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/asthma-dm-ppt/Asthma_DM_OPD_Management.pptx" })
  .then(() => console.log("✅  File written successfully"))
  .catch(e => { console.error("❌  Error:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/asthma-dm-ppt && node generate.js

Running Command

ls -lh /home/daytona/workspace/asthma-dm-ppt/

Your presentation is ready:

Asthma DM OPD Management

Presentation · PPTX


What's in the 8-slide deck

SlideContent
1Title slide — Patient profile (65-yr, Asthma + T2DM, acute exacerbation)
2Initial Assessment — History, PE, objective measures (PEFR, SpO₂, BG), severity classification table
3Acute Pharmacotherapy — SABA (salbutamol), ipratropium, systemic corticosteroids, oxygen targets; corticosteroid-hyperglycaemia warning banner
4Diabetes Co-management — BG monitoring targets, drug interactions (β-agonists → BG↑, steroids → insulin resistance, metformin hold criteria), ADA long-term goals
5Step-Up Controller Therapy — NHLBI 5-step visual (Step 1 SABA PRN → Step 5 high-dose ICS+LABA+OCS) with a note for this patient
6Special Considerations — Drug cautions (avoid β-blockers, NSAIDs), inhaler technique, written action plan (Green/Yellow/Red zones), preventive vaccines
7Disposition — Discharge criteria (PEFR >70%), admission criteria (40–70%), ICU/emergency triggers
8Quick Reference Summary — 6-step flowchart for rapid recall
Key clinical points covered:
  • Corticosteroids (essential for exacerbation) cause significant hyperglycaemia — monitor BG every 2–4 h and use a sliding-scale insulin if BG >200 mg/dL
  • Hold metformin if the patient is acutely unwell or receives IV contrast
  • β-agonists themselves can transiently raise BG and lower potassium
  • PEFR >70% = safe discharge; <40% = ICU escalation
Sources: Textbook of Family Medicine 9e | NHLBI Expert Panel Report 3 | ADA Standards of Care

A 65 year old asthama paitent comes to opd he has also diabeties mellitus type 2 and a exacreabtion of asthama attack how should i manage the paitent Genrate a ppt

Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Reading File
Finding Sources
Running Command

mkdir -p /home/daytona/workspace/asthma-dm2-ppt

Writing File

~/asthma-dm2-ppt/build.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3" x 7.5"
pres.title = "Asthma Exacerbation Management in Type 2 Diabetic Patient";

// ─── PALETTE ──────────────────────────────────────────────────────────────────
const CLR = {
  deepBlue:  "0B1F3A",  // dominant dark
  teal:      "0E7C86",  // primary accent
  tealLight: "17B8C4",  // secondary accent
  sky:       "E8F6F8",  // card bg light
  white:     "FFFFFF",
  offWhite:  "F4F8FB",
  amber:     "F59E0B",  // warning
  amberLt:   "FEF3C7",
  red:       "DC2626",  // danger
  redLt:     "FEE2E2",
  green:     "16A34A",  // safe/discharge
  greenLt:   "DCFCE7",
  slate:     "1E3A5F",
  gray:      "64748B",
  grayLt:    "F1F5F9",
};

// ─── HELPERS ──────────────────────────────────────────────────────────────────
function footer(slide) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 7.2, w: 13.3, h: 0.3,
    fill: { color: CLR.deepBlue }, line: { type: "none" }
  });
  slide.addText(
    "Source: Textbook of Family Medicine 9e  |  NHLBI Expert Panel Report 3  |  ADA Standards of Care",
    { x: 0, y: 7.2, w: 13.3, h: 0.3, fontSize: 7.5, color: "8EAFC2", align: "center", valign: "middle", margin: 0 }
  );
}

function slideHeader(slide, tag, tagColor, title) {
  // top bar
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.08, fill: { color: tagColor || CLR.teal }, line: { type: "none" } });
  // tag pill
  slide.addShape(pres.ShapeType.roundRect, { x: 0.35, y: 0.15, w: 3.0, h: 0.4, fill: { color: tagColor || CLR.teal }, line: { type: "none" }, rectRadius: 0.05 });
  slide.addText(tag, { x: 0.35, y: 0.15, w: 3.0, h: 0.4, fontSize: 9.5, bold: true, color: CLR.white, align: "center", valign: "middle", margin: 0 });
  // title
  slide.addText(title, { x: 0.35, y: 0.62, w: 12.6, h: 0.55, fontSize: 23, bold: true, color: CLR.deepBlue, margin: 0 });
  // underline
  slide.addShape(pres.ShapeType.line, { x: 0.35, y: 1.22, w: 12.6, h: 0, line: { color: tagColor || CLR.teal, pt: 1.5 } });
}

function card(slide, x, y, w, h, heading, headColor, bgColor, borderColor, items) {
  slide.addShape(pres.ShapeType.roundRect, { x, y, w, h, fill: { color: bgColor || CLR.sky }, line: { color: borderColor || CLR.teal, pt: 1.5 }, rectRadius: 0.08 });
  slide.addText(heading, { x: x + 0.15, y: y + 0.1, w: w - 0.3, h: 0.36, fontSize: 11.5, bold: true, color: headColor || CLR.teal, margin: 0 });
  const rich = items.map((t, i) => ({
    text: t,
    options: { bullet: { type: "bullet", indent: 10 }, breakLine: i < items.length - 1, fontSize: 10, color: CLR.slate }
  }));
  slide.addText(rich, { x: x + 0.18, y: y + 0.5, w: w - 0.36, h: h - 0.62, valign: "top", margin: 0 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 1 — TITLE
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: CLR.deepBlue };

  // Decorative circles
  s.addShape(pres.ShapeType.ellipse, { x: 9.2, y: -0.5, w: 5.5, h: 5.5, fill: { color: CLR.teal, transparency: 82 }, line: { type: "none" } });
  s.addShape(pres.ShapeType.ellipse, { x: 10.5, y: 1.5, w: 3.2, h: 3.2, fill: { color: CLR.tealLight, transparency: 78 }, line: { type: "none" } });
  s.addShape(pres.ShapeType.ellipse, { x: -1.0, y: 5.5, w: 3.5, h: 3.5, fill: { color: CLR.teal, transparency: 85 }, line: { type: "none" } });

  // Top accent bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.1, fill: { color: CLR.teal }, line: { type: "none" } });

  s.addText("Acute Asthma Exacerbation", { x: 0.6, y: 1.2, w: 9.5, h: 0.9, fontSize: 40, bold: true, color: CLR.white, margin: 0 });
  s.addText("in the Type 2 Diabetic Patient", { x: 0.6, y: 2.05, w: 9.5, h: 0.72, fontSize: 30, color: CLR.tealLight, margin: 0 });

  s.addShape(pres.ShapeType.line, { x: 0.6, y: 2.9, w: 8.0, h: 0, line: { color: CLR.teal, pt: 2 } });

  s.addText("OPD Case-Based Management Guide", { x: 0.6, y: 3.1, w: 9, h: 0.42, fontSize: 16, italic: true, color: "A8C5D6", margin: 0 });

  // Patient info box
  s.addShape(pres.ShapeType.roundRect, { x: 0.6, y: 3.75, w: 6.5, h: 1.8, fill: { color: CLR.teal, transparency: 80 }, line: { color: CLR.teal, pt: 1.5 }, rectRadius: 0.1 });
  s.addText([
    { text: "Patient at a Glance\n", options: { bold: true, fontSize: 13, color: CLR.tealLight, breakLine: true } },
    { text: "Age: ", options: { bold: true, fontSize: 12, color: CLR.white } },
    { text: "65 years\n", options: { fontSize: 12, color: CLR.white, breakLine: true } },
    { text: "Known Diagnoses: ", options: { bold: true, fontSize: 12, color: CLR.white } },
    { text: "Bronchial Asthma  +  Type 2 Diabetes Mellitus\n", options: { fontSize: 12, color: CLR.white, breakLine: true } },
    { text: "Presenting With: ", options: { bold: true, fontSize: 12, color: CLR.white } },
    { text: "Acute exacerbation of asthma in the OPD", options: { fontSize: 12, color: CLR.white } },
  ], { x: 0.8, y: 3.82, w: 6.1, h: 1.65, valign: "middle" });

  s.addText("For Educational / Clinical Reference Use", { x: 0, y: 7.2, w: 13.3, h: 0.3, fontSize: 8, color: "4A6A80", align: "center", margin: 0 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 2 — INITIAL ASSESSMENT
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: CLR.offWhite };
  slideHeader(s, "STEP 1 — INITIAL ASSESSMENT", CLR.deepBlue, "Rapid Assessment at OPD");

  card(s, 0.35, 1.35, 4.0, 2.8, "History", CLR.teal, CLR.sky, CLR.teal, [
    "Duration & severity of breathlessness, cough, wheeze",
    "Chest tightness — onset and progression",
    "Known triggers (allergens, cold air, URTIs)",
    "Previous exacerbations — any ICU admissions / intubations?",
    "SABA use: >2 canisters/month = poor control",
    "Current asthma + DM medications",
    "Last blood glucose reading & HbA1c",
  ]);

  card(s, 4.55, 1.35, 4.0, 2.8, "Physical Examination", CLR.teal, CLR.sky, CLR.teal, [
    "Respiratory rate, heart rate, BP, temperature",
    "SpO₂ on pulse oximetry",
    "Use of accessory muscles; nasal flaring",
    "Prolonged expiratory phase; audible wheeze",
    "Pulsus paradoxus (severe if >12 mmHg)",
    "Mental status — agitation / drowsiness (impending failure)",
    "Signs of hyperglycaemia: Kussmaul breathing, fruity breath",
  ]);

  card(s, 8.75, 1.35, 4.2, 2.8, "Investigations", CLR.teal, CLR.sky, CLR.teal, [
    "Peak Expiratory Flow Rate (PEFR) — grading",
    "FEV₁ / FVC — spirometry if feasible",
    "Blood glucose (immediate — steroids will raise BG)",
    "ABG if SpO₂ <92% or deteriorating",
    "CXR — only if pneumonia / pneumothorax suspected",
    "Serum K⁺ — β-agonists cause hypokalaemia",
    "HbA1c + renal function (metformin decision)",
  ]);

  // Severity scale bar
  s.addShape(pres.ShapeType.roundRect, { x: 0.35, y: 4.28, w: 12.6, h: 1.05, fill: { color: CLR.white }, line: { color: CLR.teal, pt: 1 }, rectRadius: 0.07 });
  s.addText("PEFR-Based Severity:", { x: 0.55, y: 4.32, w: 2.8, h: 0.38, fontSize: 11, bold: true, color: CLR.deepBlue, margin: 0 });

  const sevs = [
    ["Mild", ">70% PEFR", CLR.green, CLR.greenLt],
    ["Moderate", "40–69% PEFR", CLR.amber, CLR.amberLt],
    ["Severe", "<40% PEFR", CLR.red, CLR.redLt],
    ["Life-Threatening", "Silent Chest / Cyanosis", "991B1B", "FFE4E4"],
  ];
  sevs.forEach(([lbl, val, c, bg], i) => {
    const x = 3.5 + i * 2.35;
    s.addShape(pres.ShapeType.roundRect, { x, y: 4.34, w: 2.15, h: 0.85, fill: { color: bg }, line: { color: c, pt: 1 }, rectRadius: 0.06 });
    s.addText([
      { text: lbl, options: { bold: true, fontSize: 10.5, color: c, breakLine: true } },
      { text: val, options: { fontSize: 9.5, color: CLR.slate } },
    ], { x, y: 4.34, w: 2.15, h: 0.85, align: "center", valign: "middle", margin: 0 });
  });

  s.addText("Target: PEFR >70% predicted personal best before discharge  |  SpO₂ ≥95% on room air", {
    x: 0.35, y: 5.42, w: 12.6, h: 0.3, fontSize: 9.5, italic: true, color: CLR.gray, align: "center"
  });

  footer(s);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 3 — IMMEDIATE PHARMACOTHERAPY
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: CLR.offWhite };
  slideHeader(s, "STEP 2 — ACUTE PHARMACOTHERAPY", CLR.teal, "Immediate Drug Treatment of Exacerbation");

  // 4 treatment columns
  const cols = [
    {
      hdr: "SABA\n(1st Line)", hdrC: CLR.teal,
      sub: "Salbutamol / Albuterol",
      body: [
        "2.5 mg via nebuliser",
        "or 4–8 puffs MDI + spacer",
        "Repeat every 20 min × 3",
        "Then as needed for response",
        "SOR: A (NHLBI EPR-3)",
      ]
    },
    {
      hdr: "Ipratropium\n(Anticholinergic)", hdrC: "0E5C7E",
      sub: "Add to SABA in ED/OPD",
      body: [
        "0.5 mg nebulised with SABA",
        "Every 20 min × 3 doses",
        "Then every 2–4 h PRN",
        "Not continued during admission",
        "Reduces hospitalisation risk",
      ]
    },
    {
      hdr: "Systemic\nCorticosteroids", hdrC: CLR.amber,
      sub: "Essential — start early",
      body: [
        "Prednisolone 40–60 mg PO OD",
        "or Methylprednisolone 60–80 mg IV",
        "Duration: 5–7 days (no taper needed)",
        "⚠ Monitor BG every 2–4 hours",
        "Will cause significant BG rise in DM",
      ]
    },
    {
      hdr: "Supplemental\nOxygen", hdrC: CLR.deepBlue,
      sub: "Target SpO₂ 93–95%",
      body: [
        "Nasal cannula 2–4 L/min",
        "Simple face mask if needed",
        "Avoid excessive O₂ (hyperoxia)",
        "Reassess every 15–30 minutes",
        "ABG if SpO₂ not improving",
      ]
    },
  ];

  cols.forEach((col, i) => {
    const x = 0.35 + i * 3.25;
    const w = 3.05;
    // Header box
    s.addShape(pres.ShapeType.roundRect, { x, y: 1.35, w, h: 0.85, fill: { color: col.hdrC }, line: { type: "none" }, rectRadius: 0.07 });
    s.addText(col.hdr, { x, y: 1.35, w, h: 0.85, fontSize: 12.5, bold: true, color: CLR.white, align: "center", valign: "middle", margin: 0 });
    // Sub label
    s.addText(col.sub, { x, y: 2.23, w, h: 0.3, fontSize: 9.5, italic: true, color: col.hdrC, align: "center", margin: 0 });
    // Body card
    s.addShape(pres.ShapeType.roundRect, { x, y: 2.56, w, h: 2.75, fill: { color: CLR.white }, line: { color: col.hdrC, pt: 1 }, rectRadius: 0.06 });
    const rich = col.body.map((t, bi) => ({
      text: t,
      options: { bullet: { type: "bullet", indent: 10 }, breakLine: bi < col.body.length - 1, fontSize: 10.5, color: bi === 4 && col.hdrC === CLR.amber ? CLR.red : CLR.slate, bold: t.startsWith("⚠") }
    }));
    s.addText(rich, { x: x + 0.15, y: 2.62, w: w - 0.3, h: 2.6, valign: "top", margin: 0 });
  });

  // Steroid-DM warning
  s.addShape(pres.ShapeType.roundRect, { x: 0.35, y: 5.45, w: 12.6, h: 0.9, fill: { color: CLR.amberLt }, line: { color: CLR.amber, pt: 2 }, rectRadius: 0.08 });
  s.addText([
    { text: "⚠  Steroid Alert for Diabetic Patients:  ", options: { bold: true, fontSize: 11, color: "92400E" } },
    { text: "Corticosteroids cause marked insulin resistance. Monitor blood glucose every 2–4 h. If BG >200 mg/dL, initiate ", options: { fontSize: 10.5, color: CLR.slate } },
    { text: "short-acting insulin sliding scale.", options: { bold: true, fontSize: 10.5, color: CLR.red } },
    { text: "  Hold metformin if systemically unwell. Avoid sulfonylureas if oral intake reduced.", options: { fontSize: 10.5, color: CLR.slate } },
  ], { x: 0.55, y: 5.47, w: 12.2, h: 0.86, valign: "middle" });

  footer(s);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 4 — DIABETES CO-MANAGEMENT
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: CLR.offWhite };
  slideHeader(s, "STEP 3 — DIABETES MANAGEMENT", CLR.amber, "Managing Type 2 DM During Acute Exacerbation");

  card(s, 0.35, 1.35, 6.1, 2.65, "Blood Glucose Monitoring & Targets", CLR.amber, CLR.amberLt, CLR.amber, [
    "Check BG immediately on presentation — establish baseline",
    "Monitor every 2–4 hours during steroid course",
    "Inpatient BG target: 140–180 mg/dL (ADA/AACE)",
    "Fasting outpatient target: 90–130 mg/dL",
    "HbA1c <7% (individualise for elderly — may tolerate <7.5–8%)",
    "Check serum K⁺ — β-agonists + steroids both lower potassium",
    "Assess renal function (Cr, eGFR) before restarting metformin",
  ]);

  card(s, 6.65, 1.35, 6.3, 2.65, "Antidiabetic Drug Adjustments", CLR.amber, CLR.amberLt, CLR.amber, [
    "Metformin: HOLD if acutely ill, eGFR <30, or IV contrast given",
    "Sulfonylureas: CAUTION — hypoglycaemia risk if eating poorly",
    "SGLT2 inhibitors: HOLD during acute illness (risk of euglycaemic DKA)",
    "Short-acting insulin (SSI): preferred for in-OPD/inpatient BG control",
    "β-agonists (salbutamol): transient BG rise + hypokalaemia — monitor",
    "Systemic steroids: cause post-prandial > fasting hyperglycaemia",
    "Insulin dose may need 20–40% increase during steroid course",
  ]);

  // Goals table strip
  s.addShape(pres.ShapeType.roundRect, { x: 0.35, y: 4.15, w: 12.6, h: 2.0, fill: { color: CLR.white }, line: { color: CLR.teal, pt: 1.5 }, rectRadius: 0.08 });
  s.addText("Long-term T2DM Goals (ADA / Family Medicine Guidelines)", {
    x: 0.55, y: 4.2, w: 12.2, h: 0.36, fontSize: 12, bold: true, color: CLR.teal, margin: 0
  });

  const goals = [
    ["HbA1c", "<7% (or individualised for elderly/frail)"],
    ["Blood Pressure", "<130/80 mmHg"],
    ["LDL Cholesterol", "<70 mg/dL (high CVD risk)"],
    ["Lifestyle", "Healthy diet, 150 min/wk moderate activity, smoking cessation"],
    ["Pharmacotherapy", "Metformin first-line → stepwise addition; consider cardiorenal agents (GLP-1, SGLT2)"],
    ["Self-Monitoring", "SMBG technique education; never blame patient for BG fluctuations"],
  ];

  goals.forEach(([k, v], i) => {
    const col = i < 3 ? 0.55 : 6.85;
    const row = 4.6 + (i % 3) * 0.48;
    s.addText([
      { text: k + ":  ", options: { bold: true, fontSize: 10.5, color: CLR.deepBlue } },
      { text: v, options: { fontSize: 10, color: CLR.slate } },
    ], { x: col, y: row, w: 5.9, h: 0.42, margin: 0 });
  });

  footer(s);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 5 — ASTHMA STEP-UP CONTROLLER THERAPY
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: CLR.offWhite };
  slideHeader(s, "STEP 4 — CONTROLLER THERAPY", CLR.teal, "Stepwise Long-Term Asthma Management (NHLBI EPR-3)");

  const steps = [
    { n: "1", label: "Intermittent", col: "22C55E", rx: "SABA PRN only\n(Salbutamol)", note: "No daily controller\nneeded" },
    { n: "2", label: "Mild\nPersistent", col: CLR.teal, rx: "Low-dose ICS\n+ SABA PRN", note: "E.g. Budesonide\n200–400 mcg/d" },
    { n: "3", label: "Moderate\nPersistent", col: CLR.amber, rx: "Low-dose ICS\n+ LABA  or\nMedium ICS", note: "Preferred in\nthis patient" },
    { n: "4", label: "Moderate–\nSevere", col: "F97316", rx: "Medium ICS\n+ LABA\n± LTRA", note: "Add montelukast\nif needed" },
    { n: "5", label: "Severe\nPersistent", col: CLR.red, rx: "High-dose ICS\n+ LABA\n+ Oral CS", note: "Refer specialist;\nomalizumab option" },
  ];

  steps.forEach((st, i) => {
    const x = 0.4 + i * 2.55;
    const w = 2.35;
    // Header badge
    s.addShape(pres.ShapeType.roundRect, { x, y: 1.35, w, h: 1.0, fill: { color: st.col }, line: { type: "none" }, rectRadius: 0.08 });
    s.addText([
      { text: `Step ${st.n}\n`, options: { bold: true, fontSize: 15, breakLine: true, color: CLR.white } },
      { text: st.label, options: { fontSize: 10, color: CLR.white } },
    ], { x, y: 1.35, w, h: 1.0, align: "center", valign: "middle", margin: 0 });

    // Rx body
    s.addShape(pres.ShapeType.roundRect, { x, y: 2.42, w, h: 1.9, fill: { color: CLR.white }, line: { color: st.col, pt: 1.5 }, rectRadius: 0.07 });
    s.addText(st.rx, { x, y: 2.46, w, h: 1.82, fontSize: 11, color: CLR.slate, align: "center", valign: "middle", margin: 4 });

    // Note
    s.addShape(pres.ShapeType.roundRect, { x, y: 4.38, w, h: 0.9, fill: { color: CLR.grayLt }, line: { color: "CBD5E1", pt: 1 }, rectRadius: 0.06 });
    s.addText(st.note, { x, y: 4.4, w, h: 0.86, fontSize: 9.5, italic: true, color: CLR.gray, align: "center", valign: "middle", margin: 0 });
  });

  // Arrow between steps
  for (let i = 0; i < 4; i++) {
    s.addShape(pres.ShapeType.line, { x: 2.72 + i * 2.55, y: 1.85, w: 0.28, h: 0, line: { color: CLR.gray, pt: 1.5, endArrowType: "open" } });
  }

  // Bottom annotation
  s.addShape(pres.ShapeType.roundRect, { x: 0.35, y: 5.45, w: 12.6, h: 0.9, fill: { color: "EFF6FF" }, line: { color: "3B82F6", pt: 1.5 }, rectRadius: 0.07 });
  s.addText([
    { text: "For this 65-yr patient (elderly + T2DM):  ", options: { bold: true, fontSize: 11, color: "1D4ED8" } },
    { text: "Start at Step 3 if moderate persistent asthma. Prefer ICS alone before adding LABA. ", options: { fontSize: 10.5, color: CLR.slate } },
    { text: "ICS does not significantly worsen glycaemia at standard doses. Avoid oral CS long-term. ", options: { fontSize: 10.5, color: CLR.slate } },
    { text: "Reassess control in 2–6 weeks; step down when stable for ≥3 months.", options: { italic: true, fontSize: 10.5, color: CLR.gray } },
  ], { x: 0.55, y: 5.47, w: 12.2, h: 0.86, valign: "middle" });

  footer(s);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 6 — SPECIAL CONSIDERATIONS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: CLR.offWhite };
  slideHeader(s, "SPECIAL CONSIDERATIONS", CLR.deepBlue, "Elderly Diabetic Asthmatic — Key Clinical Points");

  const quads = [
    {
      icon: "⚠", title: "Drug Cautions", bg: CLR.amberLt, border: CLR.amber, hc: "92400E",
      items: [
        "Non-selective β-blockers (atenolol) — CONTRAINDICATED in asthma",
        "NSAIDs / Aspirin — can precipitate exacerbations (aspirin-sensitive asthma)",
        "ACE inhibitors → dry cough — may be confused with asthma worsening",
        "Theophylline — narrow therapeutic index; multiple drug interactions",
        "Sedatives / opioids — may suppress respiratory drive",
      ]
    },
    {
      icon: "💨", title: "Inhaler Technique & Adherence", bg: "EFF6FF", border: "3B82F6", hc: "1D4ED8",
      items: [
        "Assess technique at every visit — poor technique is the #1 adherence issue",
        "Use spacer device with MDI (improves deposition 2–4×)",
        "Nebuliser preferred if dexterity or coordination is impaired",
        "Document SABA canister use — >2/month signals inadequate control",
        "Teach patient / caregiver to differentiate reliever vs controller inhalers",
      ]
    },
    {
      icon: "📋", title: "Written Asthma Action Plan", bg: CLR.greenLt, border: CLR.green, hc: "166534",
      items: [
        "Green Zone (>80% PEFR): continue usual medications",
        "Yellow Zone (50–80%): increase SABA, start prednisolone course",
        "Red Zone (<50%): urgent medical review / emergency department",
        "Identify personal triggers and avoidance strategies",
        "Follow-up appointment within 2–4 weeks post-exacerbation",
      ]
    },
    {
      icon: "🛡", title: "Preventive & Comorbidity Care", bg: "F5F3FF", border: "7C3AED", hc: "5B21B6",
      items: [
        "Annual influenza vaccine — strongly recommended (elderly + DM)",
        "Pneumococcal vaccine (PCV13 + PPSV23) — high risk group",
        "Smoking cessation — single most effective asthma intervention",
        "Screen for GERD — common asthma trigger; treat with PPI",
        "Assess for obstructive sleep apnoea — worsens both asthma & DM",
      ]
    },
  ];

  quads.forEach((q, i) => {
    const x = i < 2 ? 0.35 + i * 6.5 : 0.35 + (i - 2) * 6.5;
    const y = i < 2 ? 1.35 : 4.1;
    const w = 6.2;
    const h = 2.6;
    s.addShape(pres.ShapeType.roundRect, { x, y, w, h, fill: { color: q.bg }, line: { color: q.border, pt: 1.5 }, rectRadius: 0.08 });
    s.addText(`${q.icon}  ${q.title}`, { x: x + 0.18, y: y + 0.1, w: w - 0.36, h: 0.38, fontSize: 12, bold: true, color: q.hc, margin: 0 });
    const rich = q.items.map((t, bi) => ({
      text: t,
      options: { bullet: { type: "bullet", indent: 10 }, breakLine: bi < q.items.length - 1, fontSize: 10, color: CLR.slate }
    }));
    s.addText(rich, { x: x + 0.2, y: y + 0.52, w: w - 0.4, h: h - 0.62, valign: "top", margin: 0 });
  });

  footer(s);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 7 — DISPOSITION
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: CLR.offWhite };
  slideHeader(s, "STEP 5 — DISPOSITION", CLR.teal, "Discharge, Admission & ICU Escalation Criteria");

  const disp = [
    {
      head: "✅  Discharge from OPD", hdrC: CLR.green, bg: CLR.greenLt, border: CLR.green,
      items: [
        "PEFR / FEV₁ returned to >70% personal best",
        "SpO₂ ≥95% on room air",
        "Minimal or no symptoms at rest",
        "Blood glucose stable (<200 mg/dL)",
        "Patient able to self-administer inhaler correctly",
        "Written asthma action plan provided",
        "Prednisolone course prescribed (5–7 days)",
        "Follow-up booked within 2–4 weeks",
      ]
    },
    {
      head: "🏥  Admit to Hospital", hdrC: CLR.amber, bg: CLR.amberLt, border: CLR.amber,
      items: [
        "PEFR 40–70% after initial treatment",
        "Incomplete response after 3 × SABA doses",
        "SpO₂ <92% or rising CO₂ on ABG",
        "Uncontrolled BG >300 mg/dL despite SSI",
        "Age ≥65 + multiple comorbidities",
        "Prior ICU admission or intubation for asthma",
        "Lives alone / unable to manage at home",
        "Significant comorbidity decompensation",
      ]
    },
    {
      head: "🚨  ICU / Emergency", hdrC: CLR.red, bg: CLR.redLt, border: CLR.red,
      items: [
        "PEFR <40% or absent breath sounds (silent chest)",
        "Cyanosis, altered consciousness, exhaustion",
        "SpO₂ <88% despite high-flow oxygen",
        "Respiratory acidosis (pH <7.35, ↑PaCO₂)",
        "DKA or hyperosmolar hyperglycaemic state",
        "Haemodynamic instability / impending arrest",
        "Failure to respond to aggressive OPD therapy",
      ]
    },
  ];

  disp.forEach((d, i) => {
    const x = 0.35 + i * 4.35;
    const w = 4.1;
    s.addShape(pres.ShapeType.roundRect, { x, y: 1.35, w, h: 0.52, fill: { color: d.hdrC }, line: { type: "none" }, rectRadius: 0.07 });
    s.addText(d.head, { x, y: 1.35, w, h: 0.52, fontSize: 12, bold: true, color: CLR.white, align: "center", valign: "middle", margin: 0 });
    s.addShape(pres.ShapeType.roundRect, { x, y: 1.93, w, h: 5.0, fill: { color: d.bg }, line: { color: d.border, pt: 1.5 }, rectRadius: 0.07 });
    const rich = d.items.map((t, bi) => ({
      text: t,
      options: { bullet: { type: "bullet", indent: 10 }, breakLine: bi < d.items.length - 1, fontSize: 10.5, color: CLR.slate }
    }));
    s.addText(rich, { x: x + 0.18, y: 2.0, w: w - 0.36, h: 4.8, valign: "top", margin: 0 });
  });

  footer(s);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 8 — SUMMARY FLOWCHART
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: CLR.deepBlue };

  // Side accent
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.2, h: 7.5, fill: { color: CLR.teal }, line: { type: "none" } });

  s.addText("Management at a Glance", { x: 0.45, y: 0.18, w: 12.4, h: 0.58, fontSize: 28, bold: true, color: CLR.white, margin: 0 });
  s.addShape(pres.ShapeType.line, { x: 0.45, y: 0.8, w: 12.4, h: 0, line: { color: CLR.teal, pt: 1.5 } });

  const steps6 = [
    { num: "01", title: "Assess Severity",       detail: "PEFR, SpO₂, BG, HR, RR, mental status", c: CLR.teal },
    { num: "02", title: "Oxygen + SABA",          detail: "Salbutamol neb q20 min × 3 | SpO₂ target ≥93%", c: "22C55E" },
    { num: "03", title: "Ipratropium",            detail: "0.5 mg neb with SABA × 3 doses (SOR: A)", c: CLR.tealLight },
    { num: "04", title: "Systemic Steroids",      detail: "Prednisolone 40–60 mg PO | Monitor BG q2–4 h", c: CLR.amber },
    { num: "05", title: "DM Management",          detail: "Hold metformin | SSI if BG >200 | Watch K⁺", c: "F97316" },
    { num: "06", title: "Dispose & Follow Up",   detail: "PEFR >70% → Discharge | 40–70% → Admit | <40% → ICU", c: "A855F7" },
  ];

  steps6.forEach((st, i) => {
    const col = i < 3 ? 0 : 1;
    const row = i % 3;
    const x = col === 0 ? 0.45 : 7.1;
    const y = 0.98 + row * 1.72;

    // Number circle
    s.addShape(pres.ShapeType.ellipse, { x, y, w: 0.72, h: 0.72, fill: { color: st.c }, line: { type: "none" } });
    s.addText(st.num, { x, y, w: 0.72, h: 0.72, fontSize: 15, bold: true, color: CLR.white, align: "center", valign: "middle", margin: 0 });

    // Content
    s.addText(st.title, { x: x + 0.85, y: y + 0.04, w: 5.4, h: 0.32, fontSize: 12.5, bold: true, color: st.c, margin: 0 });
    s.addText(st.detail, { x: x + 0.85, y: y + 0.34, w: 5.4, h: 0.36, fontSize: 10.5, color: "A8C5D6", margin: 0 });

    // Connector line (except last in column)
    if (row < 2) {
      s.addShape(pres.ShapeType.line, { x: x + 0.36, y: y + 0.74, w: 0, h: 0.95, line: { color: "334155", pt: 1, dashType: "sysDash" } });
    }
  });

  // Divider between columns
  s.addShape(pres.ShapeType.line, { x: 6.7, y: 0.98, w: 0, h: 5.7, line: { color: "1E3A5F", pt: 1.5, dashType: "sysDash" } });

  s.addText("Textbook of Family Medicine 9e  |  NHLBI EPR-3  |  ADA Standards of Care in Diabetes", {
    x: 0.45, y: 7.15, w: 12.4, h: 0.28, fontSize: 8, color: "4A6A80", align: "center", italic: true
  });
}

// ─── WRITE FILE ───────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/asthma-dm2-ppt/Asthma_DM_OPD_Management.pptx" })
  .then(() => console.log("SUCCESS"))
  .catch(e => { console.error(e); process.exit(1); });
Running Command

cd /home/daytona/workspace/asthma-dm2-ppt && node build.js

Running Command

ls -lh /home/daytona/workspace/asthma-dm2-ppt/

Your presentation is ready for download:

Asthma DM OPD Management

Presentation · PPTX


What's inside — 8 slides

#SlideKey Content
1TitlePatient profile: 65-yr, asthma + T2DM, acute exacerbation
2Initial AssessmentHistory, PE, investigations (PEFR, SpO₂, BG, ABG), severity scale (Mild/Moderate/Severe/Life-threatening)
3Acute PharmacotherapySABA (salbutamol), ipratropium, systemic corticosteroids, oxygen — with a steroid-hyperglycaemia alert banner
4Diabetes Co-managementBG monitoring frequency, antidiabetic drug adjustments (hold metformin/SGLT2, caution with SU, use SSI), long-term ADA goals
5Stepwise Controller TherapyNHLBI EPR-3 Steps 1–5 visual, with a note recommending Step 3 start for this patient
6Special ConsiderationsDrug cautions (β-blockers, NSAIDs, ACEi, theophylline), inhaler technique, written action plan (Green/Yellow/Red zones), vaccines
7DispositionDischarge criteria (PEFR >70%), admission criteria (40–70%), ICU escalation (<40%, silent chest, DKA)
8Summary Flowchart6-step rapid-reference guide for the entire management pathway

Critical clinical pearls covered

  • Corticosteroids are essential for the exacerbation but cause marked insulin resistance — monitor BG every 2–4 h; start sliding-scale insulin if BG >200 mg/dL
  • Hold metformin if the patient is acutely unwell, eGFR <30, or IV contrast is planned
  • β-agonists (salbutamol) transiently raise BG and lower potassium — check K⁺
  • Non-selective β-blockers are contraindicated in asthma — common mistake in DM patients on carvedilol
  • Inhaled corticosteroids at standard doses do not significantly worsen glycaemic control
Sources: Textbook of Family Medicine 9e | NHLBI Expert Panel Report 3 | ADA Standards of Medical Care
This is a shared conversation. Sign in to Orris to start your own chat.