attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment

Make a powerful ppt presentation on only this photos resourses & make it as topic vice

analyse_media
analyse_media
analyse_media
analyse_media
analyse_media
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/tb-pharmacology-ppt

Writing File

~/tb-pharmacology-ppt/build.js

const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");

// Download the 10 lecture images
const imageUrls = [
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/113925-1783520658968-r2erzb.jpg",
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/113926-1783520661846-t9gz8g.jpg",
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/113927-1783520683950-kejnaq.jpg",
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/113928-1783520687065-yhv7sc.jpg",
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/113930-1783520688645-bwo5zx.jpg",
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/113931-1783520689283-rtvhsq.jpg",
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/113932-1783520690319-4h6g2k.jpg",
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/113934-1783520691465-c35qkp.jpg",
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/113935-1783520692876-2lrk0w.jpg",
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/113936-1783520694517-uilhjr.jpg"
];

console.log("Fetching images...");
const fetchCmd = `node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`;
const imagesRaw = execSync(fetchCmd, { maxBuffer: 50 * 1024 * 1024 }).toString();
const images = JSON.parse(imagesRaw);
console.log(`Fetched ${images.length} images, errors: ${images.filter(i=>i.error).length}`);

// ─── Color palette ───────────────────────────────────────────────
const DARK_BG    = "0D1B2A";  // deep navy
const MID_BG     = "1B2A3B";  // slightly lighter navy
const ACCENT1    = "E63946";  // red-scarlet
const ACCENT2    = "F4A261";  // warm amber
const ACCENT3    = "2A9D8F";  // teal-green
const WHITE      = "FFFFFF";
const LIGHT_GRAY = "D9E4EE";
const YELLOW     = "FFD60A";
const PURPLE     = "C77DFF";
const GREEN      = "57CC99";

let pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author  = "Cerebellum | Get the Balance Right";
pres.title   = "Anti-TB Drugs – Pharmacology";

// ─── Helper: section-header bar ──────────────────────────────────
function addSectionBar(slide, text, color) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 10, h: 0.72,
    fill: { color: color || ACCENT1 }, line: { type: "none" }
  });
  slide.addText(text, {
    x: 0.25, y: 0, w: 9.5, h: 0.72,
    fontSize: 22, bold: true, color: WHITE, valign: "middle", margin: 0
  });
}

// ─── Helper: full dark background ────────────────────────────────
function darkBg(slide) {
  slide.background = { color: DARK_BG };
}
function midBg(slide) {
  slide.background = { color: MID_BG };
}

// ====================================================
// SLIDE 1 – TITLE SLIDE
// ====================================================
{
  let slide = pres.addSlide();
  darkBg(slide);

  // Decorative rectangles
  slide.addShape(pres.ShapeType.rect, { x:0, y:0, w:0.18, h:5.625, fill:{ color: ACCENT1 }, line:{ type:"none" } });
  slide.addShape(pres.ShapeType.rect, { x:0.18, y:0, w:0.08, h:5.625, fill:{ color: ACCENT2 }, line:{ type:"none" } });
  slide.addShape(pres.ShapeType.rect, { x:0, y:4.9, w:10, h:0.725, fill:{ color: ACCENT3 }, line:{ type:"none" } });

  slide.addText("ANTI-TB DRUGS", {
    x:0.5, y:0.7, w:9, h:1.2,
    fontSize:52, bold:true, color:WHITE, align:"center", charSpacing:6
  });
  slide.addText("Pharmacology of Tuberculosis Treatment", {
    x:0.5, y:1.9, w:9, h:0.6,
    fontSize:22, color:ACCENT2, align:"center", italic:true
  });
  slide.addShape(pres.ShapeType.line, { x:1, y:2.65, w:8, h:0, line:{ color:ACCENT1, width:2 } });

  slide.addText([
    { text: "Topics Covered:", options: { bold:true, color:ACCENT2, breakLine:true } },
    { text: "β€’ Drug Classification (1st & 2nd Line)   β€’ Drug Properties   β€’ Bactericidal Activity", options:{ color:LIGHT_GRAY, breakLine:true } },
    { text: "β€’ Isoniazid (MOA, ADRs, Metabolism)   β€’ Rifampicin (MOA, Properties, Comparison)", options:{ color:LIGHT_GRAY } }
  ], { x:0.6, y:2.85, w:8.8, h:1.8, fontSize:15 });

  slide.addText("Cerebellum | Get the Balance Right", {
    x:0, y:4.9, w:10, h:0.725,
    fontSize:14, color:WHITE, align:"center", valign:"middle", bold:true, margin:0
  });
}

// ====================================================
// SLIDE 2 – TB DRUG CLASSIFICATION
// ====================================================
{
  let slide = pres.addSlide();
  midBg(slide);
  addSectionBar(slide, "TOPIC 1 β€” TB Drug Classification", ACCENT1);

  // TB box
  slide.addShape(pres.ShapeType.rect, { x:4, y:1.0, w:2, h:0.7, fill:{ color:ACCENT1 }, line:{color:WHITE, width:2} });
  slide.addText("TB", { x:4, y:1.0, w:2, h:0.7, fontSize:28, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });

  // Left branch line
  slide.addShape(pres.ShapeType.line, { x:3.1, y:1.35, w:0.9, h:0, line:{ color:WHITE, width:2 } });
  // Right branch line
  slide.addShape(pres.ShapeType.line, { x:6, y:1.35, w:0.9, h:0, line:{ color:WHITE, width:2 } });

  // 1st Line box (left)
  slide.addShape(pres.ShapeType.rect, { x:1.2, y:0.85, w:1.9, h:0.65, fill:{color:ACCENT3}, line:{color:WHITE,width:1.5} });
  slide.addText("1st Line", { x:1.2, y:0.85, w:1.9, h:0.65, fontSize:18, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });

  // 2nd Line box (right)
  slide.addShape(pres.ShapeType.rect, { x:6.9, y:0.85, w:1.9, h:0.65, fill:{color:ACCENT2}, line:{color:WHITE,width:1.5} });
  slide.addText("2nd Line", { x:6.9, y:0.85, w:1.9, h:0.65, fontSize:18, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });

  // 1st Line drugs
  const drugs1 = [
    ["H", "Isoniazid",    ACCENT1,  "Most important; bactericidal"],
    ["R", "Rifampicin",   ACCENT2,  "Most effective; enzyme inducer"],
    ["Z", "Pyrazinamide", PURPLE,   "Best sterilizing; avoid in pregnancy"],
    ["E", "Ethambutol",   ACCENT3,  "Bacteriostatic; given orally"],
    ["S", "Streptomycin", LIGHT_GRAY,"Extracellular; C/I in pregnancy"],
  ];
  drugs1.forEach(([abbr, name, col, note], i) => {
    const y = 1.75 + i * 0.68;
    slide.addShape(pres.ShapeType.rect, { x:0.3, y, w:0.55, h:0.55, fill:{color:col}, line:{type:"none"} });
    slide.addText(abbr, { x:0.3, y, w:0.55, h:0.55, fontSize:20, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
    slide.addText(name, { x:1.0, y:y+0.03, w:2.5, h:0.5, fontSize:16, bold:true, color:WHITE, valign:"middle" });
    slide.addText(note, { x:3.6, y:y+0.03, w:3.2, h:0.5, fontSize:12, color:LIGHT_GRAY, valign:"middle" });
  });

  // ORAL label
  slide.addText("ORAL β†’", { x:0.3, y:1.75, w:0.9, h:2.8, fontSize:13, color:ACCENT2, bold:true, rotate:270, valign:"middle", align:"center" });

  // 2nd Line note
  slide.addShape(pres.ShapeType.rect, { x:6.8, y:1.75, w:2.9, h:3.5, fill:{color:"1A2A3A"}, line:{color:ACCENT2,width:1.5} });
  slide.addText([
    { text:"2nd Line Drugs Include:", options:{bold:true, color:ACCENT2, breakLine:true} },
    { text:"β€’ Fluoroquinolones\n  (Levofloxacin, Moxifloxacin)", options:{color:LIGHT_GRAY, breakLine:true} },
    { text:"β€’ Injectable agents\n  (Amikacin, Capreomycin)", options:{color:LIGHT_GRAY, breakLine:true} },
    { text:"β€’ Cycloserine\nβ€’ Ethionamide\nβ€’ PAS", options:{color:LIGHT_GRAY} }
  ], { x:6.9, y:1.8, w:2.7, h:3.3, fontSize:12, valign:"top" });

  // Blue underline for S
  slide.addShape(pres.ShapeType.line, { x:0.3, y:5.27, w:6.5, h:0, line:{color:ACCENT1,width:1.5,dashType:"dash"} });
  slide.addText("β˜… S (Streptomycin) is NOT oral β€” given by injection", {
    x:0.3, y:5.3, w:6.4, h:0.3, fontSize:11, color:ACCENT2, italic:true
  });
}

// ====================================================
// SLIDE 3 – DRUG PROPERTIES TABLE
// ====================================================
{
  let slide = pres.addSlide();
  midBg(slide);
  addSectionBar(slide, "TOPIC 2 β€” Drug Properties: Activity, Type, Hepatotoxicity & Pregnancy", ACCENT3);

  const headers = ["Drug", "Activity", "Type", "Hepatotoxic", "Pregnancy"];
  const colW = [0.9, 1.55, 1.65, 1.85, 1.85];
  const colX = [0.25, 1.15, 2.7, 4.35, 6.2];
  const rowH = 0.72;
  const startY = 0.85;

  // Header row
  headers.forEach((h, i) => {
    slide.addShape(pres.ShapeType.rect, { x:colX[i], y:startY, w:colW[i], h:0.5, fill:{color:ACCENT1}, line:{type:"none"} });
    slide.addText(h, { x:colX[i], y:startY, w:colW[i], h:0.5, fontSize:13, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
  });

  const rows = [
    { drug:"H", fullName:"Isoniazid",    activity:"Cidal", type:"Both (I/C + E/C)", hepato:"βœ“", hepatoCol:ACCENT1, pregnancy:"βœ“ Safe", pregCol:GREEN },
    { drug:"R", fullName:"Rifampicin",   activity:"Cidal", type:"Both (I/C + E/C)", hepato:"βœ“", hepatoCol:ACCENT1, pregnancy:"βœ“ Safe", pregCol:GREEN },
    { drug:"Z", fullName:"Pyrazinamide", activity:"Cidal", type:"I/C Only",         hepato:"βœ“βœ“βœ“ Max",hepatoCol:"CC0000", pregnancy:"⚠ AVOID", pregCol:ACCENT2 },
    { drug:"E", fullName:"Ethambutol",   activity:"Static",type:"Both (I/C + E/C)", hepato:"βœ— No",  hepatoCol:ACCENT3, pregnancy:"βœ“ Safe", pregCol:GREEN },
    { drug:"S", fullName:"Streptomycin", activity:"Cidal", type:"E/C Only",         hepato:"βœ— No",  hepatoCol:ACCENT3, pregnancy:"βœ— C/I",  pregCol:ACCENT1 },
  ];

  rows.forEach((row, i) => {
    const y = startY + 0.5 + (i * rowH);
    const bg = i % 2 === 0 ? "162030" : "1E2E42";
    slide.addShape(pres.ShapeType.rect, { x:0.25, y, w:9.5, h:rowH-0.04, fill:{color:bg}, line:{type:"none"} });
    // Drug abbr
    slide.addShape(pres.ShapeType.rect, { x:colX[0]+0.05, y:y+0.1, w:0.5, h:0.52, fill:{color:ACCENT1}, line:{type:"none"} });
    slide.addText(row.drug, { x:colX[0]+0.05, y:y+0.1, w:0.5, h:0.52, fontSize:18, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
    // Full name below
    slide.addText(row.fullName, { x:colX[0]+0.05, y:y+0.42, w:0.85, h:0.25, fontSize:8, color:LIGHT_GRAY, align:"center" });
    // Activity
    const actCol = row.activity === "Static" ? ACCENT2 : GREEN;
    slide.addShape(pres.ShapeType.roundRect, { x:colX[1]+0.1, y:y+0.12, w:1.2, h:0.45, fill:{color:actCol}, line:{type:"none"}, rectRadius:0.1 });
    slide.addText(row.activity, { x:colX[1]+0.1, y:y+0.12, w:1.2, h:0.45, fontSize:13, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
    // Type
    slide.addText(row.type, { x:colX[2]+0.05, y:y+0.1, w:1.55, h:0.52, fontSize:12, color:LIGHT_GRAY, valign:"middle" });
    // Hepatotoxic
    slide.addShape(pres.ShapeType.roundRect, { x:colX[3]+0.2, y:y+0.12, w:1.2, h:0.45, fill:{color:row.hepatoCol}, line:{type:"none"}, rectRadius:0.1 });
    slide.addText(row.hepato, { x:colX[3]+0.2, y:y+0.12, w:1.2, h:0.45, fontSize:12, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
    // Pregnancy
    slide.addShape(pres.ShapeType.roundRect, { x:colX[4]+0.2, y:y+0.12, w:1.35, h:0.45, fill:{color:row.pregCol}, line:{type:"none"}, rectRadius:0.1 });
    slide.addText(row.pregnancy, { x:colX[4]+0.2, y:y+0.12, w:1.35, h:0.45, fontSize:12, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
  });

  // Key note
  slide.addText("β˜… Z = Most hepatotoxic | E = Only Bacteriostatic | S = Contraindicated in Pregnancy", {
    x:0.25, y:5.22, w:9.5, h:0.35,
    fontSize:12, color:ACCENT2, bold:true, align:"center"
  });
}

// ====================================================
// SLIDE 4 – BACTERICIDAL ACTIVITY (Fast/Intermittent/Slow)
// ====================================================
{
  let slide = pres.addSlide();
  midBg(slide);
  addSectionBar(slide, "TOPIC 3 β€” Bactericidal Activity by Growth Rate", ACCENT2);

  const groups = [
    {
      speed: "FAST Growing",
      loc: "Wall of Cavity",
      drug: "H (Isoniazid)",
      label: "BEST Overall",
      col: ACCENT1,
      icon: "πŸ”΄",
      desc: "Isoniazid is BEST for fast-growing bacilli found in the wall of cavities. Bactericidal."
    },
    {
      speed: "INTERMITTENT (Spurters)",
      loc: "Caseous Necrosis",
      drug: "R (Rifampicin)",
      label: "Caseous Foci",
      col: ACCENT2,
      icon: "🟠",
      desc: "Rifampicin targets intermittently growing bacilli (spurters) in caseous necrosis."
    },
    {
      speed: "SLOW Growing",
      loc: "Intracellular (I/C)",
      drug: "Z (Pyrazinamide)",
      label: "BEST Sterilizing",
      col: PURPLE,
      icon: "🟣",
      desc: "Pyrazinamide has the BEST sterilizing activity against slow/intracellular bacilli. Active in acidic pH."
    }
  ];

  groups.forEach((g, i) => {
    const y = 0.9 + i * 1.5;
    // Speed badge
    slide.addShape(pres.ShapeType.rect, { x:0.25, y, w:2.6, h:0.6, fill:{color:g.col}, line:{type:"none"} });
    slide.addText(g.speed, { x:0.25, y, w:2.6, h:0.6, fontSize:14, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
    // Arrow
    slide.addShape(pres.ShapeType.line, { x:2.85, y:y+0.3, w:0.4, h:0, line:{color:g.col, width:2} });
    // Location
    slide.addShape(pres.ShapeType.roundRect, { x:3.25, y:y+0.05, w:2.2, h:0.5, fill:{color:"1A2A3A"}, line:{color:g.col,width:1.5}, rectRadius:0.1 });
    slide.addText(g.loc, { x:3.25, y:y+0.05, w:2.2, h:0.5, fontSize:13, color:WHITE, align:"center", valign:"middle", margin:0 });
    // Arrow 2
    slide.addShape(pres.ShapeType.line, { x:5.45, y:y+0.3, w:0.4, h:0, line:{color:g.col,width:2} });
    // Drug badge
    slide.addShape(pres.ShapeType.rect, { x:5.85, y, w:2.0, h:0.6, fill:{color:g.col}, line:{type:"none"} });
    slide.addText(g.drug, { x:5.85, y, w:2.0, h:0.6, fontSize:15, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
    // Label
    slide.addShape(pres.ShapeType.roundRect, { x:7.95, y, w:1.8, h:0.6, fill:{color:DARK_BG}, line:{color:YELLOW,width:1.5}, rectRadius:0.1 });
    slide.addText(g.label, { x:7.95, y, w:1.8, h:0.6, fontSize:12, bold:true, color:YELLOW, align:"center", valign:"middle", margin:0 });
    // Description
    slide.addText(g.desc, { x:0.35, y:y+0.65, w:9.3, h:0.55, fontSize:12, color:LIGHT_GRAY, italic:true });
    // Divider
    if (i < 2) slide.addShape(pres.ShapeType.line, { x:0.25, y:y+1.38, w:9.5, h:0, line:{color:"2A3A4A", width:1} });
  });

  slide.addText("Slow acetylators accumulate more INH β†’ Higher risk of Peripheral Neuropathy (Pyridoxine deficiency)", {
    x:0.25, y:5.22, w:9.5, h:0.35, fontSize:11, color:ACCENT2, italic:true, align:"center"
  });
}

// ====================================================
// SLIDE 5 – ISONIAZID: MOA
// ====================================================
{
  let slide = pres.addSlide();
  midBg(slide);
  addSectionBar(slide, "TOPIC 4 β€” Isoniazid (H): Mechanism of Action", ACCENT1);

  // Drug label box
  slide.addShape(pres.ShapeType.rect, { x:0.3, y:0.9, w:1.5, h:0.65, fill:{color:ACCENT1}, line:{type:"none"} });
  slide.addText("β‘  H", { x:0.3, y:0.9, w:1.5, h:0.65, fontSize:22, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
  slide.addShape(pres.ShapeType.rect, { x:1.95, y:0.9, w:1.6, h:0.65, fill:{color:"1A2A3A"}, line:{color:ACCENT1,width:2} });
  slide.addText("MOA", { x:1.95, y:0.9, w:1.6, h:0.65, fontSize:22, bold:true, color:ACCENT2, align:"center", valign:"middle", margin:0 });

  // Flow chart
  const steps = [
    { text:"Isoniazid (H) β€” Prodrug", col:ACCENT1, y:1.75 },
    { text:"↓  Activated by  Catalase-Peroxidase  (Kat G)*", col:ACCENT2, y:2.3 },
    { text:"Active Metabolite", col:GREEN, y:2.85 },
    { text:"↓  Inhibits  ACP reductase  (Inh A)*", col:ACCENT2, y:3.4 },
    { text:"βŠ–  Mycolic Acid Synthesis  BLOCKED", col:ACCENT1, y:3.95 },
    { text:"β†’  Cell wall destruction β†’ Bactericidal", col:GREEN, y:4.5 },
  ];

  steps.forEach(s => {
    const isBig = [1.75, 2.85, 3.95].includes(s.y);
    slide.addShape(pres.ShapeType.rect, {
      x: 1.5, y: s.y, w: 7.2, h: 0.48,
      fill: { color: isBig ? "1E2E42" : DARK_BG },
      line: { color: s.col, width: isBig ? 2 : 1 }
    });
    slide.addText(s.text, {
      x:1.55, y:s.y+0.02, w:7.1, h:0.44,
      fontSize: isBig ? 16 : 14,
      bold: isBig,
      color: s.col,
      align:"center", valign:"middle"
    });
  });

  // Side note
  slide.addText("* Kat G mutations β†’ INH resistance   |   * Inh A mutations β†’ Low-level INH resistance", {
    x:0.3, y:5.2, w:9.4, h:0.35, fontSize:11, color:LIGHT_GRAY, italic:true, align:"center"
  });
}

// ====================================================
// SLIDE 6 – ISONIAZID: SIDE EFFECTS (Pyridoxine & SHIP)
// ====================================================
{
  let slide = pres.addSlide();
  midBg(slide);
  addSectionBar(slide, "TOPIC 5 β€” Isoniazid: Side Effects β€” Pyridoxine Deficiency & SHIP Mnemonic", PURPLE);

  // Left panel: Pyridoxine deficiency
  slide.addShape(pres.ShapeType.rect, { x:0.2, y:0.85, w:4.5, h:2.4, fill:{color:"1A2A3A"}, line:{color:PURPLE,width:2} });
  slide.addText("β‘‘ Pyridoxine (B₆) Deficiency", {
    x:0.3, y:0.9, w:4.3, h:0.45,
    fontSize:14, bold:true, color:PURPLE
  });
  slide.addText([
    { text:"INH competes with/depletes Pyridoxal phosphate", options:{color:LIGHT_GRAY, breakLine:true} },
    { text:"β†’ Peripheral Neuropathy (PN)", options:{color:ACCENT1, bold:true, breakLine:true} },
    { text:"\nPrevention: Vitamin B₆ supplement", options:{color:GREEN, breakLine:true} },
    { text:"Treatment: Vitamin B₆ (high dose)", options:{color:GREEN} }
  ], { x:0.3, y:1.4, w:4.3, h:1.75, fontSize:13 });

  // Right panel: SHIP
  slide.addShape(pres.ShapeType.rect, { x:5.0, y:0.85, w:4.7, h:2.4, fill:{color:"1A2A3A"}, line:{color:ACCENT2,width:2} });
  slide.addText("β‘’ S.H.I.P Mnemonic β€” Side Effects", {
    x:5.1, y:0.9, w:4.5, h:0.45,
    fontSize:14, bold:true, color:ACCENT2
  });
  const ship = [
    { letter:"S", full:"Seizures / CNS effects" },
    { letter:"H", full:"Hepatotoxicity" },
    { letter:"I", full:"INH β†’ SLE-like syndrome (via Acetylation)" },
    { letter:"P", full:"Peripheral Neuropathy (B₆ deficiency)" }
  ];
  ship.forEach((item, i) => {
    slide.addShape(pres.ShapeType.rect, { x:5.1, y:1.4+i*0.4, w:0.38, h:0.34, fill:{color:ACCENT2}, line:{type:"none"} });
    slide.addText(item.letter, { x:5.1, y:1.4+i*0.4, w:0.38, h:0.34, fontSize:14, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
    slide.addText(item.full, { x:5.55, y:1.42+i*0.4, w:4.0, h:0.34, fontSize:12, color:LIGHT_GRAY, valign:"middle" });
  });

  // Bottom: Acetylation & SLE
  slide.addShape(pres.ShapeType.rect, { x:0.2, y:3.45, w:9.5, h:1.95, fill:{color:"162030"}, line:{color:ACCENT1,width:2} });
  slide.addText("β‘’ Acetylation Genetics β†’ Drug-Induced SLE", {
    x:0.35, y:3.5, w:9.2, h:0.42,
    fontSize:15, bold:true, color:ACCENT1
  });
  slide.addText([
    { text:"β€’ Slow Acetylators: ", options:{bold:true, color:ACCENT2} },
    { text:"More PN (peripheral neuropathy)  |  Higher INH plasma levels  |  More SLE risk", options:{color:LIGHT_GRAY, breakLine:true} },
    { text:"β€’ Fast Acetylators: ", options:{bold:true, color:ACCENT2} },
    { text:"More Hepatotoxicity  |  Lower plasma levels  |  Less PN", options:{color:LIGHT_GRAY, breakLine:true} },
    { text:"β€’ SLE-inducing drugs: S-H-I-P  β†’ ", options:{bold:true, color:PURPLE} },
    { text:"all undergo Acetylation metabolism", options:{color:LIGHT_GRAY} }
  ], { x:0.35, y:3.96, w:9.2, h:1.38, fontSize:12 });
}

// ====================================================
// SLIDE 7 – ISONIAZID: ACETYLATION & HEPATOTOXICITY
// ====================================================
{
  let slide = pres.addSlide();
  midBg(slide);
  addSectionBar(slide, "TOPIC 6 β€” Isoniazid: Acetylation Metabolism & Hepatotoxicity", ACCENT1);

  // Flow: INH acetylation pathway
  slide.addText("INH Metabolism β€” Acetylation Pathway", {
    x:0.3, y:0.85, w:9.4, h:0.45,
    fontSize:16, bold:true, color:ACCENT2, align:"center"
  });

  // Central INH box
  slide.addShape(pres.ShapeType.rect, { x:3.8, y:1.45, w:2.4, h:0.65, fill:{color:ACCENT1}, line:{type:"none"} });
  slide.addText("INH", { x:3.8, y:1.45, w:2.4, h:0.65, fontSize:22, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });

  // Fast path (top)
  slide.addShape(pres.ShapeType.line, { x:3.8, y:1.77, w:-1.2, h:0, line:{color:PURPLE,width:2} });
  slide.addText("Fast Acetylators", { x:1.2, y:1.5, w:1.6, h:0.55, fontSize:12, bold:true, color:PURPLE, align:"center" });

  // Slow path (bottom-left arrow to PN box)
  slide.addShape(pres.ShapeType.line, { x:3.8, y:1.77, w:0, h:0.8, line:{color:ACCENT2,width:2} });
  slide.addText("Slow Acetylators β†’", { x:1.2, y:2.7, w:2.2, h:0.45, fontSize:12, bold:true, color:ACCENT2 });

  // NAT enzyme
  slide.addShape(pres.ShapeType.roundRect, { x:1.4, y:2.0, w:2.1, h:0.48, fill:{color:"1A2A3A"}, line:{color:PURPLE,width:1.5}, rectRadius:0.1 });
  slide.addText("NAT (N-Acetyltransferase)", { x:1.4, y:2.0, w:2.1, h:0.48, fontSize:11, color:PURPLE, align:"center", valign:"middle" });

  // Acetyl-INH
  slide.addShape(pres.ShapeType.rect, { x:3.5, y:2.55, w:3, h:0.6, fill:{color:"1A2A3A"}, line:{color:ACCENT2,width:2} });
  slide.addText("Acetyl-INH", { x:3.5, y:2.55, w:3, h:0.6, fontSize:16, bold:true, color:ACCENT2, align:"center", valign:"middle", margin:0 });
  slide.addShape(pres.ShapeType.line, { x:5, y:3.15, w:0, h:0.35, line:{color:ACCENT2,width:2} });

  // Acetyl hydrazine
  slide.addShape(pres.ShapeType.rect, { x:3.3, y:3.5, w:3.4, h:0.55, fill:{color:"1A2A3A"}, line:{color:ACCENT1,width:2} });
  slide.addText("Acetyl Hydrazine", { x:3.3, y:3.5, w:3.4, h:0.55, fontSize:15, bold:true, color:ACCENT1, align:"center", valign:"middle", margin:0 });
  slide.addShape(pres.ShapeType.line, { x:5, y:4.05, w:0, h:0.35, line:{color:ACCENT1,width:2} });

  // Hepatotoxic
  slide.addShape(pres.ShapeType.rect, { x:3.0, y:4.4, w:4, h:0.7, fill:{color:ACCENT1}, line:{color:"CC0000",width:3} });
  slide.addText("⚠ HEPATOTOXIC", { x:3.0, y:4.4, w:4, h:0.7, fontSize:20, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });

  // PN box (slow acetylators)
  slide.addShape(pres.ShapeType.rect, { x:0.2, y:3.5, w:2.7, h:1.5, fill:{color:"162030"}, line:{color:ACCENT2,width:2} });
  slide.addText([
    { text:"Slow Acetylators\n", options:{bold:true, color:ACCENT2, breakLine:true} },
    { text:"βœ“ More Peripheral Neuropathy\n", options:{color:LIGHT_GRAY, breakLine:true} },
    { text:"βœ“ More SLE\n", options:{color:LIGHT_GRAY, breakLine:true} },
    { text:"βœ“ Less Hepatotoxicity", options:{color:GREEN} }
  ], { x:0.3, y:3.55, w:2.5, h:1.4, fontSize:12, valign:"top" });

  // Fast acetylators note
  slide.addShape(pres.ShapeType.rect, { x:7.1, y:3.5, w:2.7, h:1.5, fill:{color:"162030"}, line:{color:PURPLE,width:2} });
  slide.addText([
    { text:"Fast Acetylators\n", options:{bold:true, color:PURPLE, breakLine:true} },
    { text:"βœ“ More Hepatotoxicity\n", options:{color:ACCENT1, breakLine:true} },
    { text:"βœ“ Less PN/SLE\n", options:{color:LIGHT_GRAY, breakLine:true} },
    { text:"βœ“ More INH β†’ PN (INHβ†’PN): slow", options:{color:LIGHT_GRAY} }
  ], { x:7.2, y:3.55, w:2.5, h:1.4, fontSize:12, valign:"top" });
}

// ====================================================
// SLIDE 8 – RIFAMPICIN: MOA
// ====================================================
{
  let slide = pres.addSlide();
  midBg(slide);
  addSectionBar(slide, "TOPIC 7 β€” Rifampicin (R): Mechanism of Action", ACCENT3);

  slide.addShape(pres.ShapeType.rect, { x:0.3, y:0.9, w:1.5, h:0.65, fill:{color:ACCENT3}, line:{type:"none"} });
  slide.addText("β‘‘ R", { x:0.3, y:0.9, w:1.5, h:0.65, fontSize:22, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
  slide.addShape(pres.ShapeType.rect, { x:1.95, y:0.9, w:1.6, h:0.65, fill:{color:"1A2A3A"}, line:{color:ACCENT3,width:2} });
  slide.addText("MOA", { x:1.95, y:0.9, w:1.6, h:0.65, fontSize:22, bold:true, color:ACCENT2, align:"center", valign:"middle", margin:0 });

  // rpoB gene note
  slide.addShape(pres.ShapeType.roundRect, { x:6.5, y:0.85, w:3.2, h:0.72, fill:{color:"1A2A3A"}, line:{color:YELLOW,width:2}, rectRadius:0.1 });
  slide.addText("β˜… Gene: rpoB β€” Resistance marker", { x:6.5, y:0.85, w:3.2, h:0.72, fontSize:13, bold:true, color:YELLOW, align:"center", valign:"middle" });

  // Flow diagram
  const rSteps = [
    { label:"Rifampicin", col:ACCENT3, y:1.75 },
    { label:"Binds Ξ²-subunit of RNA Polymerase (rpoB)", col:ACCENT2, y:2.35 },
    { label:"βŠ– Inhibits Transcription", col:ACCENT1, y:2.95 },
    { label:"No mRNA β†’ No Protein Synthesis", col:LIGHT_GRAY, y:3.55 },
    { label:"Bacterial Cell Death β†’ BACTERICIDAL", col:GREEN, y:4.15 },
  ];
  rSteps.forEach((s, i) => {
    const big = i % 2 === 0;
    slide.addShape(pres.ShapeType.rect, { x:1.5, y:s.y, w:7.5, h:0.52, fill:{color:big?"1E2E42":DARK_BG}, line:{color:s.col,width:big?2:1} });
    slide.addText(s.text || s.label, { x:1.55, y:s.y+0.02, w:7.4, h:0.48, fontSize:big?16:14, bold:big, color:s.col, align:"center", valign:"middle" });
    if (i < rSteps.length-1) {
      slide.addShape(pres.ShapeType.line, { x:5.25, y:s.y+0.52, w:0, h:0.3, line:{color:s.col,width:2} });
    }
  });

  slide.addText("rpoB gene mutation β†’ Rifampicin resistance (used as marker for MDR-TB diagnosis by GeneXpert)", {
    x:0.3, y:4.88, w:9.4, h:0.38, fontSize:11, color:ACCENT2, italic:true, align:"center"
  });
}

// ====================================================
// SLIDE 9 – RIFAMPICIN: KEY PHARMACOLOGICAL FEATURES
// ====================================================
{
  let slide = pres.addSlide();
  midBg(slide);
  addSectionBar(slide, "TOPIC 8 β€” Rifampicin: Key Pharmacological Features & Drug Interactions", ACCENT2);

  const features = [
    {
      letter:"a)", label:"Empty Stomach",
      col: ACCENT3,
      body:"Must be taken on an EMPTY STOMACH for optimal absorption. Food significantly reduces bioavailability."
    },
    {
      letter:"b)", label:"Excreted in Bile",
      col: ACCENT1,
      body:"Rifampicin is excreted in bile β†’ enterohepatic circulation. Can colour bile orange."
    },
    {
      letter:"c)", label:"Enzyme Inducer (CYP450)",
      col: ACCENT2,
      body:"Potent CYP450 inducer β†’ reduces levels of: Warfarin (β†’ use Heparin), OCP (β†’ use other method), Anti-HIV drugs (β†’ switch to Rifabutin)"
    },
  ];

  features.forEach((f, i) => {
    const y = 0.9 + i * 1.5;
    slide.addShape(pres.ShapeType.rect, { x:0.25, y, w:0.55, h:1.28, fill:{color:f.col}, line:{type:"none"} });
    slide.addText(f.letter, { x:0.25, y, w:0.55, h:1.28, fontSize:16, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
    slide.addShape(pres.ShapeType.rect, { x:0.8, y, w:9.0, h:1.28, fill:{color:"162030"}, line:{color:f.col,width:2} });
    slide.addText(f.label, { x:0.95, y:y+0.05, w:8.7, h:0.42, fontSize:15, bold:true, color:f.col });
    slide.addText(f.body, { x:0.95, y:y+0.5, w:8.7, h:0.7, fontSize:12, color:LIGHT_GRAY });
  });

  slide.addText("Anti-HIV + Rifampicin β†’ Replace Rifampicin with RIFABUTIN (less enzyme induction, safer for HIV patients)", {
    x:0.25, y:5.22, w:9.5, h:0.35, fontSize:11, color:YELLOW, bold:true, align:"center"
  });
}

// ====================================================
// SLIDE 10 – RIFAMPICIN vs RIFABUTIN COMPARISON
// ====================================================
{
  let slide = pres.addSlide();
  midBg(slide);
  addSectionBar(slide, "TOPIC 9 β€” Rifampicin vs Rifabutin: Head-to-Head Comparison", ACCENT1);

  const cols = [
    { name:"Rifampicin (Rcin)", col:ACCENT1, x:0.3 },
    { name:"Rifabutin",         col:ACCENT3, x:5.2 }
  ];

  cols.forEach(c => {
    slide.addShape(pres.ShapeType.rect, { x:c.x, y:0.85, w:4.6, h:0.6, fill:{color:c.col}, line:{type:"none"} });
    slide.addText(c.name, { x:c.x, y:0.85, w:4.6, h:0.6, fontSize:18, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
  });

  const rows = [
    { label:"TB Efficacy",     rcin:"Most Effective βœ“βœ“βœ“", rfb:"Less Effective βœ“" },
    { label:"MAC Efficacy",    rcin:"Less Effective",      rfb:"More Effective βœ“" },
    { label:"Enzyme Induction",rcin:"Strong (CYP450) βœ“βœ“βœ“",rfb:"Weaker (less induction)" },
    { label:"HIV Compatibility",rcin:"Avoid (↓ ART levels)",rfb:"Preferred with HIV/ART βœ“" },
    { label:"Hepatotoxicity",  rcin:"Yes βœ“",               rfb:"Same" },
    { label:"Unique ADR",      rcin:"Pseudojaundice",       rfb:"Uveitis β˜…" },
    { label:"Body Secretions", rcin:"Orange (urine/tears)", rfb:"Orange (same)" },
  ];

  rows.forEach((row, i) => {
    const y = 1.55 + i*0.55;
    const bg = i%2===0?"162030":"1A2A3A";
    slide.addShape(pres.ShapeType.rect, { x:0.3, y, w:9.5, h:0.52, fill:{color:bg}, line:{type:"none"} });
    slide.addText(row.label, { x:0.35, y:y+0.05, w:1.6, h:0.42, fontSize:11, bold:true, color:ACCENT2, valign:"middle" });
    slide.addShape(pres.ShapeType.line, { x:1.95, y:y+0.05, w:0, h:0.42, line:{color:"2A3A4A",width:1} });
    slide.addText(row.rcin, { x:2.0, y:y+0.05, w:3.0, h:0.42, fontSize:12, color: row.rcin.includes("βœ“")?GREEN:(row.rcin.includes("Avoid"))?ACCENT1:LIGHT_GRAY, valign:"middle" });
    slide.addShape(pres.ShapeType.line, { x:5.15, y:y+0.05, w:0, h:0.42, line:{color:"2A3A4A",width:1} });
    slide.addText(row.rfb, { x:5.2, y:y+0.05, w:3.4, h:0.42, fontSize:12, color: row.rfb.includes("βœ“")||row.rfb.includes("Preferred")?GREEN:(row.rfb.includes("Uveitis"))?ACCENT1:LIGHT_GRAY, valign:"middle" });
  });

  slide.addText("Key Takeaway: Use Rifabutin instead of Rifampicin when patient is on Anti-HIV (ART) therapy", {
    x:0.3, y:5.4, w:9.4, h:0.2, fontSize:11, color:YELLOW, bold:true, align:"center"
  });
}

// ====================================================
// SLIDE 11 – RIFAMPICIN: ORANGE SECRETIONS
// ====================================================
{
  let slide = pres.addSlide();
  midBg(slide);
  addSectionBar(slide, "TOPIC 10 β€” Rifampicin: Orange Coloured Secretions", ACCENT2);

  slide.addText("d) All Body Secretions Turn Orange-Red", {
    x:0.3, y:0.85, w:9.4, h:0.5,
    fontSize:18, bold:true, color:ACCENT2, align:"center"
  });

  const secretions = [
    { label:"Urine", icon:"πŸ’§", note:"Classic finding β€” orange/red urine. Do NOT confuse with haematuria.", col:ACCENT1 },
    { label:"Tears", icon:"😒", note:"Tears turn orange β†’ causes permanent contact lens staining.", col:ACCENT3 },
    { label:"Sweat", icon:"πŸ’¦", note:"Sweat, saliva, sputum β€” all body fluids stained orange.", col:PURPLE },
    { label:"Breast Milk", icon:"🍼", note:"Orange-coloured breast milk β€” important in lactating mothers.", col:ACCENT2 },
  ];

  secretions.forEach((s, i) => {
    const col = i % 2 === 0 ? 0 : 5;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.3 : 5.2;
    const y = 1.55 + row * 2.0;
    slide.addShape(pres.ShapeType.rect, { x, y, w:4.6, h:1.75, fill:{color:"162030"}, line:{color:s.col,width:2} });
    slide.addShape(pres.ShapeType.rect, { x, y, w:4.6, h:0.55, fill:{color:s.col}, line:{type:"none"} });
    slide.addText(`${s.icon}  ${s.label}`, { x:x+0.1, y, w:4.4, h:0.55, fontSize:16, bold:true, color:WHITE, valign:"middle" });
    slide.addText(s.note, { x:x+0.15, y:y+0.65, w:4.3, h:1.0, fontSize:13, color:LIGHT_GRAY });
  });

  slide.addText("⚠ Warn patients about orange discolouration β€” it is harmless but alarming. Avoid soft contact lenses.", {
    x:0.3, y:5.4, w:9.4, h:0.2, fontSize:11, color:ACCENT2, italic:true, align:"center"
  });
}

// ====================================================
// SLIDE 12 – SUMMARY / QUICK REVISION
// ====================================================
{
  let slide = pres.addSlide();
  darkBg(slide);

  slide.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:0.8, fill:{color:ACCENT1}, line:{type:"none"} });
  slide.addText("QUICK REVISION β€” Anti-TB Drugs at a Glance", {
    x:0.2, y:0, w:9.6, h:0.8,
    fontSize:20, bold:true, color:WHITE, align:"center", valign:"middle", margin:0
  });

  const summary = [
    { drug:"H (Isoniazid)",    highlight:"MOA: Inhibits Mycolic Acid (Kat G β†’ Active β†’ βŠ– ACP)", adr:"Peripheral Neuropathy (give B₆), Hepatotoxicity (fast acetylators), SLE-like" },
    { drug:"R (Rifampicin)",   highlight:"MOA: Inhibits RNA Polymerase (rpoB) β†’ βŠ– Transcription", adr:"CYP inducer, Orange secretions, Hepatotoxicity, Pseudojaundice" },
    { drug:"Z (Pyrazinamide)", highlight:"Best sterilizing activity, acts on intracellular (slow) bacilli", adr:"Most hepatotoxic, Hyperuricaemia (gout), Avoid in pregnancy" },
    { drug:"E (Ethambutol)",   highlight:"Only bacteriostatic, targets both I/C and E/C bacilli", adr:"Retrobulbar Neuritis β†’ visual colour defect (Red-Green), Safe in pregnancy" },
    { drug:"S (Streptomycin)", highlight:"Extracellular only, injectable aminoglycoside", adr:"Ototoxicity, Nephrotoxicity, C/I in Pregnancy" },
  ];

  summary.forEach((row, i) => {
    const y = 0.9 + i * 0.92;
    const bg = i%2===0?"162030":"1A2A3A";
    slide.addShape(pres.ShapeType.rect, { x:0.2, y, w:9.6, h:0.88, fill:{color:bg}, line:{type:"none"} });
    slide.addShape(pres.ShapeType.rect, { x:0.2, y:y+0.1, w:1.9, h:0.68, fill:{color:ACCENT1}, line:{type:"none"} });
    slide.addText(row.drug, { x:0.2, y:y+0.1, w:1.9, h:0.68, fontSize:12, bold:true, color:WHITE, align:"center", valign:"middle", margin:0 });
    slide.addText(row.highlight, { x:2.2, y:y+0.06, w:4.0, h:0.42, fontSize:11, bold:true, color:ACCENT2 });
    slide.addText("ADR: " + row.adr, { x:2.2, y:y+0.48, w:7.5, h:0.35, fontSize:10, color:LIGHT_GRAY });
  });
}

// ====================================================
// SLIDE 13 – FINAL / THANK YOU
// ====================================================
{
  let slide = pres.addSlide();
  darkBg(slide);

  slide.addShape(pres.ShapeType.rect, { x:0, y:0, w:0.18, h:5.625, fill:{color:ACCENT1}, line:{type:"none"} });
  slide.addShape(pres.ShapeType.rect, { x:0.18, y:0, w:0.08, h:5.625, fill:{color:ACCENT2}, line:{type:"none"} });
  slide.addShape(pres.ShapeType.rect, { x:0, y:4.9, w:10, h:0.725, fill:{color:ACCENT3}, line:{type:"none"} });

  slide.addText("THANK YOU", {
    x:0.5, y:1.0, w:9, h:1.2,
    fontSize:54, bold:true, color:WHITE, align:"center", charSpacing:10
  });
  slide.addText("Master Anti-TB Pharmacology with Cerebellum", {
    x:0.5, y:2.3, w:9, h:0.55,
    fontSize:20, color:ACCENT2, align:"center", italic:true
  });
  slide.addShape(pres.ShapeType.line, { x:1, y:3.0, w:8, h:0, line:{color:ACCENT1,width:2} });
  slide.addText([
    { text:"Key Takeaways:\n", options:{bold:true, color:ACCENT2, breakLine:true} },
    { text:"β€’ HRZE = 1st Line oral drugs   β€’  S = Streptomycin (inject)   β€’  Z = Best sterilizing\n", options:{color:LIGHT_GRAY, breakLine:true} },
    { text:"β€’ H MOA = Mycolic Acid inhibition   β€’  R MOA = RNA Polymerase inhibition\n", options:{color:LIGHT_GRAY, breakLine:true} },
    { text:"β€’ INH β†’ B6 deficiency β†’ PN   β€’  Rifampicin β†’ Orange secretions + CYP inducer", options:{color:LIGHT_GRAY} }
  ], { x:0.8, y:3.1, w:8.4, h:1.65, fontSize:13 });

  slide.addText("Cerebellum | Get the Balance Right", {
    x:0, y:4.9, w:10, h:0.725,
    fontSize:14, color:WHITE, align:"center", valign:"middle", bold:true, margin:0
  });
}

// ─── Write file ──────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/tb-pharmacology-ppt/Anti_TB_Drugs_Pharmacology.pptx" })
  .then(() => console.log("SUCCESS: PPT written"))
  .catch(e => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/tb-pharmacology-ppt && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/tb-pharmacology-ppt/

Your presentation is ready! 🎯

Anti TB Drugs Pharmacology

Presentation Β· PPTX


What's inside β€” 13 slides, fully topic-wise:
SlideTopic
1Title slide β€” Anti-TB Drugs Pharmacology
2TOPIC 1 β€” TB Drug Classification (1st Line HRZES vs 2nd Line)
3TOPIC 2 β€” Drug Properties Table (Activity, Type, Hepatotoxicity, Pregnancy)
4TOPIC 3 β€” Bactericidal Activity by Growth Rate (Fast/Intermittent/Slow β†’ H, R, Z)
5TOPIC 4 β€” Isoniazid: Mechanism of Action (Kat G β†’ Mycolic Acid)
6TOPIC 5 β€” Isoniazid: Side Effects (Pyridoxine/B₆ deficiency + SHIP mnemonic + SLE)
7TOPIC 6 β€” Isoniazid: Acetylation Metabolism & Hepatotoxicity (Fast vs Slow acetylators)
8TOPIC 7 β€” Rifampicin: MOA (RNA Polymerase / rpoB / Transcription inhibition)
9TOPIC 8 β€” Rifampicin: Key Features (Empty stomach, Bile, CYP Enzyme Inducer, Drug interactions)
10TOPIC 9 β€” Rifampicin vs Rifabutin (head-to-head comparison table)
11TOPIC 10 β€” Rifampicin: Orange Secretions (Urine, Tears, Contact lens staining)
12Quick Revision β€” All 5 drugs at a glance
13Summary / Thank You
Design: Deep navy background with red/amber/teal accents, colour-coded drug badges, flow diagrams, comparison tables, and mnemonic highlight boxes - built from your Cerebellum lecture images.
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment

Make ppt as this photos only

Writing File

~/tb-pharmacology-ppt/build2.js

const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");

// Download the 10 lecture images
const imageUrls = [
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/113937-1783521389200-cqghg4.jpg",  // 0: Rifampicin Other Uses
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/114178-1783521401379-hg0fcx.jpg",  // 1: Z & E ADRs
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/114179-1783521404272-zlavhh.jpg",  // 2: Streptomycin
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/114180-1783521405418-pe1gmn.jpg",  // 3: 2nd Line Cidal
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/114181-1783521406228-yh0ij7.jpg",  // 4: 2nd Line Static
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/114182-1783521410389-pdx8a0.jpg",  // 5: New Drugs
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/114183-1783521411498-vxnkcq.jpg",  // 6: Treatment NTEP
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/114184-1783521412257-o1m8ly.jpg",  // 7: Resistance Classification
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/114185-1783521413505-sed50q.jpg",  // 8: H-Resistant TB
  "https://d361swluvexzqs.cloudfront.net/chats-attachments/114186-1783521414154-r8pz8r.jpg",  // 9: Groups for DR-TB
];

console.log("Fetching images...");
const fetchCmd = `node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`;
const imagesRaw = execSync(fetchCmd, { maxBuffer: 60 * 1024 * 1024 }).toString();
const images = JSON.parse(imagesRaw);
console.log(`Fetched ${images.length} images, errors: ${images.filter(i=>i.error).length}`);

// ─── Palette ─────────────────────────────────────────────────────
const DARK_BG    = "0D1B2A";
const MID_BG     = "132237";
const ACCENT1    = "E63946";   // red
const ACCENT2    = "F4A261";   // amber
const ACCENT3    = "2A9D8F";   // teal
const WHITE      = "FFFFFF";
const LIGHT_GRAY = "C8D8E8";
const YELLOW     = "FFD60A";
const PURPLE     = "C77DFF";
const GREEN      = "57CC99";
const DARK_CARD  = "162030";

let pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author  = "Cerebellum | Get the Balance Right";
pres.title   = "Anti-TB Drugs – Part 2 (2nd Line, Treatment & Resistance)";

// ─── Helpers ─────────────────────────────────────────────────────
function darkBg(s) { s.background = { color: DARK_BG }; }
function midBg(s)  { s.background = { color: MID_BG  }; }

function topBar(slide, text, color) {
  slide.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:0.72, fill:{color: color||ACCENT1}, line:{type:"none"} });
  slide.addText(text, { x:0.25, y:0, w:9.5, h:0.72, fontSize:21, bold:true, color:WHITE, valign:"middle", margin:0 });
}

function card(slide, x, y, w, h, borderColor, bgColor) {
  slide.addShape(pres.ShapeType.rect, { x, y, w, h, fill:{color: bgColor||DARK_CARD}, line:{color:borderColor||ACCENT1, width:2} });
}

// ====================================================
// SLIDE 1 – TITLE
// ====================================================
{
  let s = pres.addSlide();
  darkBg(s);
  s.addShape(pres.ShapeType.rect, { x:0,y:0,w:0.18,h:5.625, fill:{color:ACCENT1}, line:{type:"none"} });
  s.addShape(pres.ShapeType.rect, { x:0.18,y:0,w:0.08,h:5.625, fill:{color:ACCENT2}, line:{type:"none"} });
  s.addShape(pres.ShapeType.rect, { x:0,y:4.9,w:10,h:0.725, fill:{color:ACCENT3}, line:{type:"none"} });

  s.addText("ANTI-TB DRUGS", {
    x:0.5,y:0.65,w:9,h:1.1,
    fontSize:50,bold:true,color:WHITE,align:"center",charSpacing:6
  });
  s.addText("Part 2 β€” 2nd Line Drugs, New Drugs, Treatment & Drug Resistance", {
    x:0.5,y:1.82,w:9,h:0.6,
    fontSize:19,color:ACCENT2,align:"center",italic:true
  });
  s.addShape(pres.ShapeType.line, {x:1,y:2.55,w:8,h:0,line:{color:ACCENT1,width:2}});

  s.addText([
    { text:"Topics Covered:", options:{bold:true,color:ACCENT2,breakLine:true} },
    { text:"β€’ Rifampicin Other Uses  β€’ Pyrazinamide & Ethambutol ADRs  β€’ Streptomycin\n", options:{color:LIGHT_GRAY,breakLine:true} },
    { text:"β€’ 2nd Line Cidal & Static Drugs  β€’ New Drugs (BPaL)  β€’ NTEP Treatment Protocol", options:{color:LIGHT_GRAY,breakLine:true} },
    { text:"β€’ Drug Resistance Classification  β€’ H-Resistant TB  β€’ Groups for DR-TB", options:{color:LIGHT_GRAY} },
  ], { x:0.6,y:2.7,w:8.8,h:2.0,fontSize:14 });

  s.addText("Cerebellum | Get the Balance Right", {
    x:0,y:4.9,w:10,h:0.725,
    fontSize:14,color:WHITE,align:"center",valign:"middle",bold:true,margin:0
  });
}

// ====================================================
// SLIDE 2 – RIFAMPICIN: OTHER USES
// ====================================================
{
  let s = pres.addSlide();
  midBg(s);
  topBar(s, "TOPIC 1 β€” Rifampicin (R): Other Clinical Uses", ACCENT2);

  // heading label
  s.addShape(pres.ShapeType.roundRect, {x:0.25,y:0.85,w:1.8,h:0.52, fill:{color:ACCENT2}, line:{type:"none"}, rectRadius:0.1});
  s.addText("e) Other Uses", {x:0.25,y:0.85,w:1.8,h:0.52, fontSize:14,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});

  const uses = [
    { icon:"β˜…", head:"Leprosy",   body:"Rifampicin is a key component of Multi-Drug Therapy (MDT) for leprosy.", col:GREEN },
    { icon:"β˜…", head:"Meningococcal Prophylaxis (M.Mo)",
      body:"Was previously DOC; now replaced by Ciprofloxacin for meningococcal prophylaxis.", col:ACCENT2 },
    { icon:"β˜…", head:"Brucellosis β€” DOC",
      body:"DOC: Doxycycline + Rifampicin (Doxy + R) β€” combination therapy for brucellosis.", col:ACCENT1 },
    { icon:"β˜…", head:"Gram +ve: MRSA",
      body:"Active against MRSA infections (Gram positive). Used in combination.", col:PURPLE },
    { icon:"β˜…", head:"Gram -ve: Pseudomonas  βœ— Vancomycin",
      body:"Rifampicin active in Gram -ve (Pseudomonas). Vancomycin NOT effective against Gram -ve.", col:ACCENT3 },
  ];

  uses.forEach((u,i) => {
    const y = 1.5 + i*0.78;
    s.addShape(pres.ShapeType.rect, {x:0.2,y,w:0.38,h:0.62, fill:{color:u.col}, line:{type:"none"}});
    s.addText(u.icon, {x:0.2,y,w:0.38,h:0.62, fontSize:18,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
    s.addShape(pres.ShapeType.rect, {x:0.58,y,w:9.2,h:0.62, fill:{color:DARK_CARD}, line:{color:u.col,width:1.5}});
    s.addText(u.head, {x:0.68,y:y+0.02,w:9.0,h:0.3, fontSize:13,bold:true,color:u.col});
    s.addText(u.body, {x:0.68,y:y+0.32,w:9.0,h:0.28, fontSize:11,color:LIGHT_GRAY});
  });

  // MRSA alternate box
  card(s, 0.2, 5.1, 9.6, 0.42, ACCENT1, "0A1520");
  s.addText("MRSA Alternatives: a) Vancomycin  b) Teicoplanin  c) Cefepime  d) Rifampicin (Rcin)", {
    x:0.35,y:5.13,w:9.3,h:0.38, fontSize:12,bold:true,color:ACCENT1,valign:"middle"
  });
}

// ====================================================
// SLIDE 3 – PYRAZINAMIDE (Z) & ETHAMBUTOL (E)
// ====================================================
{
  let s = pres.addSlide();
  midBg(s);
  topBar(s, "TOPIC 2 β€” Pyrazinamide (Z) & Ethambutol (E): Properties & Adverse Effects", PURPLE);

  // ── Z section ──
  s.addShape(pres.ShapeType.rect, {x:0.2,y:0.85,w:0.7,h:3.1, fill:{color:PURPLE}, line:{type:"none"}});
  s.addText("β‘’ Z", {x:0.2,y:0.85,w:0.7,h:3.1, fontSize:20,bold:true,color:WHITE,align:"center",valign:"middle",rotate:0});

  card(s, 0.9, 0.85, 4.2, 3.1, PURPLE);
  s.addText("Pyrazinamide (Z)", {x:1.0,y:0.9,w:4.0,h:0.45, fontSize:16,bold:true,color:PURPLE});
  s.addText([
    {text:"β€’ Bactericidal\n", options:{color:GREEN,bold:true,breakLine:true}},
    {text:"β€’ Intracellular (I/C) β†’ Best Sterilizing Activity\n", options:{color:LIGHT_GRAY,breakLine:true}},
    {text:"β€’ Hepatotoxic β€” Maximum (most of all TB drugs)\n", options:{color:ACCENT1,bold:true,breakLine:true}},
    {text:"β€’ ↑ Uric Acid (Hyperuricaemia) β€” Key Side Effect β†’ Gout\n", options:{color:ACCENT2,bold:true,breakLine:true}},
    {text:"β€’ Avoid in Pregnancy", options:{color:ACCENT1}},
  ], {x:1.0,y:1.42,w:4.0,h:2.3, fontSize:12});

  // Uric Acid badge
  s.addShape(pres.ShapeType.rect, {x:1.5,y:3.1,w:3.0,h:0.5, fill:{color:ACCENT2}, line:{type:"none"}});
  s.addText("⚠ ↑ Uric Acid β†’ Gout (Main SE)", {x:1.5,y:3.1,w:3.0,h:0.5, fontSize:13,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});

  // ── E section ──
  s.addShape(pres.ShapeType.rect, {x:5.5,y:0.85,w:0.7,h:3.1, fill:{color:ACCENT3}, line:{type:"none"}});
  s.addText("β‘£ E", {x:5.5,y:0.85,w:0.7,h:3.1, fontSize:20,bold:true,color:WHITE,align:"center",valign:"middle"});

  card(s, 6.2, 0.85, 3.6, 3.1, ACCENT3);
  s.addText("Ethambutol (E)", {x:6.3,y:0.9,w:3.4,h:0.45, fontSize:16,bold:true,color:ACCENT3});
  s.addText([
    {text:"β€’ Bacteriostatic (STATIC)\n", options:{color:ACCENT2,bold:true,breakLine:true}},
    {text:"β€’ NOT Hepatotoxic βœ—\n", options:{color:GREEN,breakLine:true}},
    {text:"β€’ Safe in Pregnancy βœ“\n", options:{color:GREEN,breakLine:true}},
    {text:"\nEye (ADR): Optic Neuritis\n", options:{color:ACCENT1,bold:true,breakLine:true}},
    {text:"β†’ Red-Green Colour Blindness\n", options:{color:ACCENT1,breakLine:true}},
    {text:"β†’ C/I in Children < 6 yrs\n  (cannot report visual symptoms)", options:{color:LIGHT_GRAY}},
  ], {x:6.3,y:1.42,w:3.4,h:2.3, fontSize:12});

  // Eye badge
  s.addShape(pres.ShapeType.rect, {x:6.0,y:3.1,w:3.6,h:0.5, fill:{color:ACCENT1}, line:{type:"none"}});
  s.addText("⚠ Optic Neuritis β†’ Red-Green Blindness", {x:6.0,y:3.1,w:3.6,h:0.5, fontSize:12,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});

  s.addText("β˜… Z = Most Hepatotoxic of ALL TB drugs   |   β˜… E = Only Bacteriostatic 1st Line drug β€” Causes Optic Neuritis", {
    x:0.2,y:3.78,w:9.6,h:0.38, fontSize:12,bold:true,color:YELLOW,align:"center"
  });

  // Lecture image strip at bottom
  if (!images[1].error) {
    s.addImage({ data: images[1].base64, x:0.2, y:4.2, w:4.0, h:1.3 });
  }
  if (!images[0].error) {
    s.addImage({ data: images[0].base64, x:5.0, y:4.2, w:4.8, h:1.3 });
  }
}

// ====================================================
// SLIDE 4 – STREPTOMYCIN (S)
// ====================================================
{
  let s = pres.addSlide();
  midBg(s);
  topBar(s, "TOPIC 3 β€” Streptomycin (S): Properties & Adverse Effects", ACCENT1);

  s.addShape(pres.ShapeType.rect, {x:0.2,y:0.85,w:0.7,h:4.2, fill:{color:ACCENT1}, line:{type:"none"}});
  s.addText("β‘€ S", {x:0.2,y:0.85,w:0.7,h:4.2, fontSize:20,bold:true,color:WHITE,align:"center",valign:"middle"});

  // Properties cards
  const props = [
    { label:"Route",        val:"Injection – IM (Intramuscular) only",               col:ACCENT2 },
    { label:"Activity",     val:"BACTERICIDAL",                                       col:GREEN },
    { label:"Location",     val:"Extracellular (E/C) only",                           col:ACCENT3 },
    { label:"Hepatotoxic",  val:"NOT hepatotoxic βœ—",                                  col:GREEN },
    { label:"Nephrotoxic",  val:"Yes β€” Nephrotoxicity is the key ADR βœ“",              col:ACCENT1 },
    { label:"Pregnancy",    val:"CONTRAINDICATED (C/I) β€” causes fetal ototoxicity",   col:ACCENT1 },
  ];

  props.forEach((p, i) => {
    const y = 0.9 + i * 0.64;
    s.addShape(pres.ShapeType.rect, {x:0.95,y,w:2.0,h:0.56, fill:{color:p.col}, line:{type:"none"}});
    s.addText(p.label, {x:0.95,y,w:2.0,h:0.56, fontSize:13,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
    s.addShape(pres.ShapeType.rect, {x:2.95,y,w:6.8,h:0.56, fill:{color:DARK_CARD}, line:{color:p.col,width:1.5}});
    s.addText(p.val, {x:3.05,y:y+0.04,w:6.6,h:0.48, fontSize:13,color:LIGHT_GRAY,valign:"middle"});
  });

  // Key note
  s.addShape(pres.ShapeType.rect, {x:0.2,y:4.92,w:9.6,h:0.55, fill:{color:"0A1520"}, line:{color:ACCENT1,width:2}});
  s.addText("β˜… Streptomycin: the ONLY non-oral 1st Line drug | C/I in Pregnancy | Nephrotoxic | Extracellular only", {
    x:0.3,y:4.95,w:9.4,h:0.5, fontSize:12,bold:true,color:ACCENT2,valign:"middle"
  });
}

// ====================================================
// SLIDE 5 – 2ND LINE DRUGS: CIDAL GROUP
// ====================================================
{
  let s = pres.addSlide();
  midBg(s);
  topBar(s, "TOPIC 4 β€” 2nd Line Drugs: Group β‘  CIDAL (Fluoroquinolones + Injectables)", ACCENT3);

  s.addText("2nd Line Drugs β€” Used in Drug-Resistant TB (MDR / XDR)", {
    x:0.2,y:0.82,w:9.6,h:0.42, fontSize:14,color:ACCENT2,align:"center",italic:true
  });

  // FQ column
  card(s, 0.2, 1.32, 4.5, 3.2, ACCENT3);
  s.addShape(pres.ShapeType.rect, {x:0.2,y:1.32,w:4.5,h:0.5, fill:{color:ACCENT3}, line:{type:"none"}});
  s.addText("a) Fluoroquinolones (FQ)", {x:0.2,y:1.32,w:4.5,h:0.5, fontSize:15,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});

  const fqs = [
    { name:"Ofloxacin",    note:"Not recommended βœ—", col:ACCENT1 },
    { name:"Moxifloxacin", note:"Preferred βœ“",       col:GREEN },
    { name:"Gatifloxacin", note:"Not recommended βœ—", col:ACCENT1 },
    { name:"Levofloxacin", note:"Preferred βœ“",       col:GREEN },
  ];
  fqs.forEach((f,i) => {
    const y = 1.92 + i*0.56;
    s.addShape(pres.ShapeType.roundRect, {x:0.4,y,w:2.3,h:0.48, fill:{color:"1A2A3A"}, line:{color:f.col,width:1.5}, rectRadius:0.1});
    s.addText(f.name, {x:0.4,y,w:2.3,h:0.48, fontSize:13,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
    s.addShape(pres.ShapeType.roundRect, {x:2.8,y,w:1.7,h:0.48, fill:{color:f.col}, line:{type:"none"}, rectRadius:0.1});
    s.addText(f.note, {x:2.8,y,w:1.7,h:0.48, fontSize:12,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
  });

  s.addText("XDR-TB: FQ resistance is defining criterion", {
    x:0.3,y:4.05,w:4.2,h:0.38, fontSize:11,color:YELLOW,italic:true
  });

  // Injectable column
  card(s, 5.0, 1.32, 4.8, 3.2, ACCENT2);
  s.addShape(pres.ShapeType.rect, {x:5.0,y:1.32,w:4.8,h:0.5, fill:{color:ACCENT2}, line:{type:"none"}});
  s.addText("b) Injectables (IM)", {x:5.0,y:1.32,w:4.8,h:0.5, fontSize:15,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});

  const injs = [
    { name:"Streptomycin",  note:"Safe in pregnancy βœ“", col:GREEN  },
    { name:"Capreomycin",   note:"C/I pregnancy βœ—",     col:ACCENT1},
    { name:"Kanamycin",     note:"C/I pregnancy βœ—",     col:ACCENT1},
    { name:"Amikacin",      note:"Safe βœ“",              col:GREEN  },
  ];
  injs.forEach((inj,i) => {
    const y = 1.92 + i*0.56;
    s.addShape(pres.ShapeType.roundRect, {x:5.15,y,w:2.5,h:0.48, fill:{color:"1A2A3A"}, line:{color:inj.col,width:1.5}, rectRadius:0.1});
    s.addText(inj.name, {x:5.15,y,w:2.5,h:0.48, fontSize:13,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
    s.addShape(pres.ShapeType.roundRect, {x:7.75,y,w:1.9,h:0.48, fill:{color:inj.col}, line:{type:"none"}, rectRadius:0.1});
    s.addText(inj.note, {x:7.75,y,w:1.9,h:0.48, fontSize:11,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
  });

  // Pregnancy note
  s.addShape(pres.ShapeType.rect, {x:5.15,y:4.05,w:3.5,h:0.38, fill:{color:ACCENT1}, line:{type:"none"}});
  s.addText("All injectables: C/I in Pregnancy (except Streptomycin)", {x:5.15,y:4.05,w:3.5,h:0.38, fontSize:10,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});

  s.addShape(pres.ShapeType.rect, {x:0.2,y:4.6,w:9.6,h:0.85, fill:{color:"0A1520"}, line:{color:ACCENT3,width:2}});
  s.addText("All 2nd Line Cidal drugs are ALL BACTERICIDAL.\nPreferred FQ: Moxifloxacin & Levofloxacin | XDR-TB = Resistance to H+R + FQ", {
    x:0.35,y:4.63,w:9.3,h:0.8, fontSize:12,color:ACCENT2
  });
}

// ====================================================
// SLIDE 6 – 2ND LINE DRUGS: STATIC GROUP + HEPATOTOXIC ADES
// ====================================================
{
  let s = pres.addSlide();
  midBg(s);
  topBar(s, "TOPIC 5 β€” 2nd Line Drugs: Group β‘‘ STATIC + Hepatotoxic ADEs", PURPLE);

  // Hepatotoxic ADE column (left)
  card(s, 0.2, 0.82, 2.8, 2.5, ACCENT1);
  s.addShape(pres.ShapeType.rect, {x:0.2,y:0.82,w:2.8,h:0.5, fill:{color:ACCENT1}, line:{type:"none"}});
  s.addText("Hepatotoxic ADEs", {x:0.2,y:0.82,w:2.8,h:0.5, fontSize:14,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
  const hepa = ["a) H (Isoniazid)", "b) R (Rifampicin)", "c) Ethionamide βœ“", "d) S (Streptomycin) β€” in box"];
  hepa.forEach((h,i) => {
    s.addText(h, {x:0.35,y:1.42+i*0.44,w:2.5,h:0.4, fontSize:12,color: i===2?ACCENT2:(i===3?ACCENT1:LIGHT_GRAY)});
  });

  // Static Group (a) β€” right
  card(s, 3.2, 0.82, 6.6, 2.5, PURPLE);
  s.addShape(pres.ShapeType.rect, {x:3.2,y:0.82,w:6.6,h:0.5, fill:{color:PURPLE}, line:{type:"none"}});
  s.addText("β‘‘ Static Group β€” (a) Oral Agents", {x:3.2,y:0.82,w:6.6,h:0.5, fontSize:14,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});

  const staticA = [
    { drug:"Cycloserine",    adr:"Psychosis / CNS toxicity",          col:ACCENT1 },
    { drug:"Ethionamide",    adr:"Hepatotoxic + Hypothyroidism",      col:ACCENT1 },
    { drug:"PAS",            adr:"Hepatotoxic",                       col:ACCENT2 },
    { drug:"Thioacetazone",  adr:"HIV βœ—βœ— (Steven-Johnson Syndrome)",  col:"CC0000" },
  ];
  staticA.forEach((d,i) => {
    const y = 1.42+i*0.44;
    s.addShape(pres.ShapeType.roundRect, {x:3.3,y,w:2.2,h:0.38, fill:{color:"1A2A3A"}, line:{color:d.col,width:1.5}, rectRadius:0.1});
    s.addText(d.drug, {x:3.3,y,w:2.2,h:0.38, fontSize:12,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
    s.addShape(pres.ShapeType.line, {x:5.52,y:y+0.19,w:0.25,h:0, line:{color:d.col,width:1.5}});
    s.addText(d.adr, {x:5.8,y,w:3.8,h:0.38, fontSize:11,color:d.col,valign:"middle"});
  });

  // Static Group (b) β€” Linezolide + Clofazimine
  card(s, 0.2, 3.45, 9.6, 1.65, ACCENT3);
  s.addShape(pres.ShapeType.rect, {x:0.2,y:3.45,w:9.6,h:0.5, fill:{color:ACCENT3}, line:{type:"none"}});
  s.addText("β‘‘ Static Group β€” (b) Special Purpose Agents", {x:0.2,y:3.45,w:9.6,h:0.5, fontSize:14,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});

  const specialDrugs = [
    { drug:"Linezolide",    use:"DOC for VRSA Pneumonia",  col:YELLOW },
    { drug:"Clofazimine",   use:"Leprosy treatment",       col:GREEN  },
  ];
  specialDrugs.forEach((d,i) => {
    const x = i===0 ? 0.5 : 5.2;
    card(s, x, 4.0, 4.3, 1.0, d.col);
    s.addText(d.drug, {x:x+0.15,y:4.05,w:4.0,h:0.42, fontSize:16,bold:true,color:d.col});
    s.addText("Use: "+d.use, {x:x+0.15,y:4.5,w:4.0,h:0.42, fontSize:13,color:LIGHT_GRAY});
  });
}

// ====================================================
// SLIDE 7 – NEW DRUGS (BEDAQUILINE, PRETOMANID, DELAMANID)
// ====================================================
{
  let s = pres.addSlide();
  midBg(s);
  topBar(s, "TOPIC 6 β€” New Anti-TB Drugs: Bedaquiline, Pretomanid & Delamanid", GREEN);

  s.addText("β‘’ New Drugs β€” All BACTERICIDAL", {
    x:0.2,y:0.85,w:9.6,h:0.45, fontSize:16,bold:true,color:GREEN,align:"center"
  });

  // Drug trio
  const newDrugs = [
    { name:"Bedaquiline",  col:PURPLE },
    { name:"Pretomanid",   col:ACCENT2 },
    { name:"Delamanid",    col:ACCENT3 },
  ];
  newDrugs.forEach((d,i) => {
    const x = 0.2 + i*3.25;
    card(s, x, 1.4, 3.0, 0.75, d.col);
    s.addText(d.name, {x:x+0.1,y:1.4,w:2.8,h:0.75, fontSize:16,bold:true,color:d.col,align:"center",valign:"middle"});
  });

  s.addShape(pres.ShapeType.line, {x:1.7,y:2.15,w:0,h:0.4, line:{color:PURPLE,width:2}});
  s.addShape(pres.ShapeType.line, {x:4.95,y:2.15,w:0,h:0.4, line:{color:ACCENT2,width:2}});
  s.addShape(pres.ShapeType.line, {x:8.2,y:2.15,w:0,h:0.4, line:{color:ACCENT3,width:2}});

  // MOA section
  card(s, 0.2, 2.55, 9.6, 2.55, YELLOW, "0A1520");
  s.addShape(pres.ShapeType.rect, {x:0.2,y:2.55,w:9.6,h:0.48, fill:{color:"1A2A3A"}, line:{type:"none"}});
  s.addText("Mechanisms of Action (MOA)", {x:0.2,y:2.55,w:9.6,h:0.48, fontSize:15,bold:true,color:YELLOW,align:"center",valign:"middle",margin:0});

  s.addShape(pres.ShapeType.roundRect, {x:0.4,y:3.1,w:4.4,h:0.8, fill:{color:DARK_CARD}, line:{color:PURPLE,width:2}, rectRadius:0.1});
  s.addText([
    {text:"Bedaquiline\n", options:{bold:true,color:PURPLE,breakLine:true}},
    {text:"βŠ– ATP Synthase β†’ Blocks energy production", options:{color:LIGHT_GRAY}},
  ], {x:0.5,y:3.12,w:4.2,h:0.76, fontSize:13,valign:"top"});

  s.addShape(pres.ShapeType.roundRect, {x:5.0,y:3.1,w:4.6,h:0.8, fill:{color:DARK_CARD}, line:{color:ACCENT2,width:2}, rectRadius:0.1});
  s.addText([
    {text:"Pretomanid & Delamanid\n", options:{bold:true,color:ACCENT2,breakLine:true}},
    {text:"βŠ– Mycolic Acid + Generates toxic NO (nitric oxide)", options:{color:LIGHT_GRAY}},
  ], {x:5.1,y:3.12,w:4.4,h:0.76, fontSize:13,valign:"top"});

  // ADR: QT prolongation
  s.addShape(pres.ShapeType.rect, {x:0.2,y:4.05,w:9.6,h:0.75, fill:{color:ACCENT1}, line:{type:"none"}});
  s.addText("⚠ Key ADR: ↑ QT Prolongation β€” Risk of fatal arrhythmias (monitor ECG)", {
    x:0.3,y:4.08,w:9.4,h:0.7, fontSize:15,bold:true,color:WHITE,align:"center",valign:"middle",margin:0
  });

  s.addShape(pres.ShapeType.rect, {x:0.2,y:4.88,w:9.6,h:0.6, fill:{color:"0A1520"}, line:{color:GREEN,width:2}});
  s.addText("These are used for MDR-TB & XDR-TB. BPaL regimen = Bedaquiline + Pretomanid + Linezolid", {
    x:0.3,y:4.9,w:9.4,h:0.56, fontSize:12,bold:true,color:GREEN,align:"center",valign:"middle"
  });
}

// ====================================================
// SLIDE 8 – TB TREATMENT: NTEP PROTOCOL
// ====================================================
{
  let s = pres.addSlide();
  midBg(s);
  topBar(s, "TOPIC 7 β€” TB Treatment: NTEP Protocol (National TB Elimination Programme)", ACCENT2);

  // NTEP box
  s.addShape(pres.ShapeType.rect, {x:3.5,y:0.88,w:3,h:0.6, fill:{color:ACCENT1}, line:{type:"none"}});
  s.addText("NTEP", {x:3.5,y:0.88,w:3,h:0.6, fontSize:22,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});

  // Two branches
  s.addShape(pres.ShapeType.line, {x:3.5,y:1.18,w:-1.2,h:0, line:{color:WHITE,width:2}});
  s.addShape(pres.ShapeType.line, {x:6.5,y:1.18,w:1.2,h:0, line:{color:WHITE,width:2}});

  // Drug Sensitive (left)
  card(s, 0.2, 1.55, 4.5, 3.65, ACCENT3, "0A1520");
  s.addShape(pres.ShapeType.rect, {x:0.2,y:1.55,w:4.5,h:0.52, fill:{color:ACCENT3}, line:{type:"none"}});
  s.addText("Drug Sensitive TB", {x:0.2,y:1.55,w:4.5,h:0.52, fontSize:15,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});

  s.addText("Standard 6-Month Regimen:", {x:0.35,y:2.15,w:4.2,h:0.38, fontSize:13,bold:true,color:ACCENT2});

  // IP box
  s.addShape(pres.ShapeType.rect, {x:0.35,y:2.6,w:1.0,h:0.7, fill:{color:ACCENT1}, line:{type:"none"}});
  s.addText("IP", {x:0.35,y:2.6,w:1.0,h:0.7, fontSize:18,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
  s.addShape(pres.ShapeType.rect, {x:1.4,y:2.6,w:3.1,h:0.7, fill:{color:DARK_CARD}, line:{color:ACCENT1,width:2}});
  s.addText("2 months HRZE", {x:1.4,y:2.6,w:3.1,h:0.7, fontSize:16,bold:true,color:ACCENT1,align:"center",valign:"middle"});

  // CP box
  s.addShape(pres.ShapeType.rect, {x:0.35,y:3.42,w:1.0,h:0.7, fill:{color:PURPLE}, line:{type:"none"}});
  s.addText("CP", {x:0.35,y:3.42,w:1.0,h:0.7, fontSize:18,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
  s.addShape(pres.ShapeType.rect, {x:1.4,y:3.42,w:3.1,h:0.7, fill:{color:DARK_CARD}, line:{color:PURPLE,width:2}});
  s.addText("4 months HRE", {x:1.4,y:3.42,w:3.1,h:0.7, fontSize:16,bold:true,color:PURPLE,align:"center",valign:"middle"});

  s.addText("IP = Intensive Phase (first 2 months)\nCP = Continuation Phase (next 4 months)", {
    x:0.35,y:4.2,w:4.2,h:0.7, fontSize:11,color:LIGHT_GRAY
  });

  // Drug Resistant (right)
  card(s, 5.1, 1.55, 4.7, 3.65, ACCENT1, "0A1520");
  s.addShape(pres.ShapeType.rect, {x:5.1,y:1.55,w:4.7,h:0.52, fill:{color:ACCENT1}, line:{type:"none"}});
  s.addText("Drug Resistant TB", {x:5.1,y:1.55,w:4.7,h:0.52, fontSize:15,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});

  const drTypes = [
    { label:"Mono-drug R",    body:"Resistant to ONE drug (H/Z/E)", col:ACCENT2 },
    { label:"Poly-drug R",    body:"Resistant to >1 drug",          col:ACCENT2 },
    { label:"MDR-TB",         body:"H + R resistance",              col:ACCENT1 },
    { label:"Pre-XDR",        body:"H+R + FQ resistance",           col:PURPLE  },
    { label:"XDR-TB",         body:"H+R + FQ + injectable",         col:"CC0000"},
  ];
  drTypes.forEach((t,i) => {
    const y = 2.15+i*0.56;
    s.addShape(pres.ShapeType.roundRect, {x:5.2,y,w:2.0,h:0.48, fill:{color:t.col}, line:{type:"none"}, rectRadius:0.1});
    s.addText(t.label, {x:5.2,y,w:2.0,h:0.48, fontSize:11,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
    s.addText(t.body, {x:7.3,y:y+0.04,w:2.3,h:0.4, fontSize:11,color:LIGHT_GRAY,valign:"middle"});
  });

  s.addShape(pres.ShapeType.rect, {x:0.2,y:5.28,w:9.6,h:0.3, fill:{color:"0A1520"}, line:{type:"none"}});
  s.addText("Total Duration: 6 months (Drug Sensitive) | 9-20 months (MDR/XDR depending on regimen)", {
    x:0.3,y:5.28,w:9.4,h:0.3, fontSize:11,color:ACCENT2,align:"center"
  });
}

// ====================================================
// SLIDE 9 – DRUG RESISTANCE CLASSIFICATION
// ====================================================
{
  let s = pres.addSlide();
  midBg(s);
  topBar(s, "TOPIC 8 β€” Drug Resistance Classification & Treatment Regimens", ACCENT1);

  s.addText("Classification of TB Drug Resistance", {
    x:0.2,y:0.82,w:9.6,h:0.42, fontSize:15,bold:true,color:ACCENT2,align:"center"
  });

  const classifs = [
    { num:"1", type:"Mono-drug Resistance",    def:"Resistant to ONE drug: H, Z, or E",             reg:"Adjust regimen β€” replace the resistant drug",                   col:GREEN   },
    { num:"2", type:"Poly-drug Resistance",    def:"Resistant to >1 drug (but not H+R together)",   reg:"Adjust regimen based on DST",                                   col:ACCENT2 },
    { num:"3", type:"Rifampicin Resistance (RR)", def:"Resistant to R but Sensitive to H",           reg:"Treat as MDR-TB",                                               col:ACCENT2 },
    { num:"4", type:"MDR-TB",                  def:"Resistant to BOTH H + R",                        reg:"H+R backbone + FQ (Moxifloxacin/Levofloxacin)",                col:ACCENT1 },
    { num:"5β˜…","type":"Pre-XDR",               def:"H+R resistance + FQ resistance",                reg:"H+R + FQ + Bedaquiline or Linezolide",                          col:PURPLE  },
    { num:"6", type:"XDR-TB",                  def:"H+R + FQ + 2nd Line injectable resistance",     reg:"H+R + FQ + Bedaquiline or Linezolide (BPaL regimen)",           col:"CC0000" },
  ];

  classifs.forEach((c,i) => {
    const y = 1.35 + i*0.67;
    s.addShape(pres.ShapeType.rect, {x:0.2,y,w:0.65,h:0.6, fill:{color:c.col}, line:{type:"none"}});
    s.addText(c.num, {x:0.2,y,w:0.65,h:0.6, fontSize:16,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
    s.addShape(pres.ShapeType.rect, {x:0.85,y,w:9.0,h:0.6, fill:{color:i%2===0?DARK_CARD:"162840"}, line:{color:c.col,width:1.5}});
    s.addText(c.type, {x:0.95,y:y+0.02,w:2.4,h:0.3, fontSize:12,bold:true,color:c.col});
    s.addText(c.def, {x:0.95,y:y+0.32,w:2.4,h:0.26, fontSize:10,color:LIGHT_GRAY});
    s.addShape(pres.ShapeType.line, {x:3.42,y:y+0.08,w:0,h:0.44, line:{color:"2A3A4A",width:1}});
    s.addText("Regimen: "+c.reg, {x:3.55,y:y+0.06,w:6.15,h:0.5, fontSize:11,color:LIGHT_GRAY,valign:"middle"});
  });

  s.addText("β˜… Pre-XDR is a new WHO 2021 classification | XDR = Extensively Drug Resistant TB", {
    x:0.2,y:5.4,w:9.6,h:0.2, fontSize:10,color:ACCENT2,italic:true,align:"center"
  });
}

// ====================================================
// SLIDE 10 – H-RESISTANT TB REGIMEN
// ====================================================
{
  let s = pres.addSlide();
  midBg(s);
  topBar(s, "TOPIC 9 β€” H-Resistant TB: Treatment Regimen", ACCENT3);

  // H-resistant box
  s.addShape(pres.ShapeType.rect, {x:2.0,y:0.9,w:6,h:0.85, fill:{color:"0A1520"}, line:{color:ACCENT1,width:3}});
  s.addText("H-Resistant TB", {x:2.0,y:0.9,w:6,h:0.85, fontSize:26,bold:true,color:ACCENT1,align:"center",valign:"middle",margin:0});

  // Regimen
  s.addText("Treatment Regimen:", {x:0.5,y:2.0,w:9,h:0.48, fontSize:16,bold:true,color:ACCENT2,align:"center"});

  s.addShape(pres.ShapeType.rect, {x:1.0,y:2.58,w:8,h:1.1, fill:{color:"0A1520"}, line:{color:GREEN,width:3}});
  s.addText("6–9 RZE + Lf", {x:1.0,y:2.58,w:8,h:1.1, fontSize:36,bold:true,color:GREEN,align:"center",valign:"middle",margin:0});

  // Breakdown cards
  const regParts = [
    { abbr:"R",  full:"Rifampicin",    col:ACCENT2 },
    { abbr:"Z",  full:"Pyrazinamide",  col:PURPLE  },
    { abbr:"E",  full:"Ethambutol",    col:ACCENT3 },
    { abbr:"Lf", full:"Levofloxacin",  col:GREEN   },
  ];
  regParts.forEach((r,i) => {
    const x = 0.8 + i*2.1;
    s.addShape(pres.ShapeType.rect, {x,y:3.82,w:1.8,h:0.7, fill:{color:r.col}, line:{type:"none"}});
    s.addText(r.abbr, {x,y:3.82,w:1.8,h:0.4, fontSize:18,bold:true,color:WHITE,align:"center",valign:"bottom",margin:0});
    s.addText(r.full, {x,y:4.22,w:1.8,h:0.3, fontSize:11,color:WHITE,align:"center",valign:"top",margin:0});
  });

  s.addShape(pres.ShapeType.rect, {x:0.5,y:4.68,w:9,h:0.72, fill:{color:"0A1520"}, line:{color:ACCENT2,width:2}});
  s.addText([
    {text:"Duration: 6–9 months   ", options:{bold:true,color:ACCENT2}},
    {text:"H (Isoniazid) is dropped from the regimen since it is resistant.  ", options:{color:LIGHT_GRAY}},
    {text:"Lf = Levofloxacin added to compensate.", options:{color:GREEN}},
  ], {x:0.65,y:4.7,w:8.7,h:0.68, fontSize:12,valign:"middle"});
}

// ====================================================
// SLIDE 11 – GROUPS FOR DR-TB (A, B, C)
// ====================================================
{
  let s = pres.addSlide();
  midBg(s);
  topBar(s, "TOPIC 10 β€” WHO Groups for Drug-Resistant TB (DR-TB)", ACCENT2);

  s.addText("Drugs grouped by priority for MDR/XDR-TB regimen construction", {
    x:0.2,y:0.82,w:9.6,h:0.38, fontSize:13,color:LIGHT_GRAY,align:"center",italic:true
  });

  const groups = [
    {
      label:"Group A", sublabel:"Priority (Use ALL if possible)", col:GREEN,
      drugs:["Levofloxacin or Moxifloxacin", "Bedaquiline", "Linezolide"]
    },
    {
      label:"Group B", sublabel:"Add next", col:ACCENT2,
      drugs:["Clofazimine", "Cycloserine or Terizidone"]
    },
    {
      label:"Group C", sublabel:"Use when A & B insufficient", col:ACCENT1,
      drugs:["Z (Pyrazinamide)", "E (Ethambutol)", "Carbapenems", "Ethionamide", "PAS", "Delamanid", "Amikacin or Streptomycin"]
    },
  ];

  groups.forEach((g,i) => {
    const y = 1.3 + i*1.35;
    const h = g.drugs.length > 4 ? 1.25 : (g.drugs.length > 2 ? 1.1 : 0.95);
    s.addShape(pres.ShapeType.rect, {x:0.2,y,w:2.2,h, fill:{color:g.col}, line:{type:"none"}});
    s.addText(g.label, {x:0.2,y,w:2.2,h:0.55, fontSize:18,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
    s.addText(g.sublabel, {x:0.2,y:y+0.55,w:2.2,h:h-0.55, fontSize:10,color:WHITE,align:"center",valign:"top"});
    s.addShape(pres.ShapeType.rect, {x:2.4,y,w:7.4,h, fill:{color:DARK_CARD}, line:{color:g.col,width:2}});
    g.drugs.forEach((d,di) => {
      const dy = y + 0.12 + di*(h/g.drugs.length);
      s.addShape(pres.ShapeType.roundRect, {x:2.6,y:dy,w:0.3,h:0.28, fill:{color:g.col}, line:{type:"none"}, rectRadius:0.1});
      s.addText(d, {x:3.05,y:dy,w:6.5,h:0.28, fontSize:13,color:LIGHT_GRAY,valign:"middle"});
    });
  });

  s.addShape(pres.ShapeType.rect, {x:0.2,y:5.22,w:9.6,h:0.38, fill:{color:"0A1520"}, line:{color:ACCENT2,width:2}});
  s.addText("Group A drugs are CORE of MDR-TB regimen. Minimum 3 Group A+B drugs recommended by WHO 2022.", {
    x:0.3,y:5.24,w:9.4,h:0.34, fontSize:11,bold:true,color:ACCENT2,align:"center"
  });
}

// ====================================================
// SLIDE 12 – SUMMARY / THANK YOU
// ====================================================
{
  let s = pres.addSlide();
  darkBg(s);
  s.addShape(pres.ShapeType.rect, {x:0,y:0,w:10,h:0.75, fill:{color:ACCENT1}, line:{type:"none"}});
  s.addText("QUICK REVISION β€” Part 2 Summary", {x:0.2,y:0,w:9.6,h:0.75, fontSize:22,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});

  const summary = [
    { topic:"Rifampicin Other Uses", detail:"Leprosy βœ“ | Was DOC M.Mo (now Cipro) | DOC Brucellosis: Doxy+R | MRSA βœ“ | Not Pseudomonas", col:ACCENT2 },
    { topic:"Pyrazinamide (Z)",      detail:"Cidal | I/C | Best Sterilizing | Max Hepatotoxic | ↑Uric acid (Gout) | Avoid Pregnancy",        col:PURPLE },
    { topic:"Ethambutol (E)",        detail:"Static | Not Hepatotoxic | Optic Neuritis β†’ Red-Green Colour Blindness | C/I < 6 yrs",           col:ACCENT3 },
    { topic:"Streptomycin (S)",      detail:"Injection IM | Cidal | E/C | Not Hepatotoxic | Nephrotoxic | C/I Pregnancy",                     col:ACCENT1 },
    { topic:"2nd Line Cidal",        detail:"FQ: Moxi βœ“ Levo βœ“ | Injectables: Strep βœ“ Amikacin βœ“ | All C/I in Pregnancy (except Strep)",     col:ACCENT3 },
    { topic:"New Drugs (BPaL)",      detail:"Bedaquiline (ATP βŠ–) + Pretomanid/Delamanid (Mycolic βŠ–, NO toxic) | ADR: ↑QT",                   col:GREEN   },
    { topic:"NTEP Treatment",        detail:"Drug Sensitive: IP=2HRZE | CP=4HRE | MDR: H+R+FQ | XDR: BPaL",                                  col:ACCENT2 },
    { topic:"H-Resistant TB",        detail:"Regimen: 6-9 RZE + Lf (Levofloxacin) β€” 6 to 9 months",                                          col:GREEN   },
  ];

  summary.forEach((r,i) => {
    const y = 0.85 + i*0.58;
    s.addShape(pres.ShapeType.rect, {x:0.2,y,w:9.6,h:0.54, fill:{color:i%2===0?DARK_CARD:"162030"}, line:{type:"none"}});
    s.addShape(pres.ShapeType.rect, {x:0.2,y:y+0.06,w:2.3,h:0.42, fill:{color:r.col}, line:{type:"none"}});
    s.addText(r.topic, {x:0.2,y:y+0.06,w:2.3,h:0.42, fontSize:11,bold:true,color:WHITE,align:"center",valign:"middle",margin:0});
    s.addText(r.detail, {x:2.6,y:y+0.06,w:7.1,h:0.42, fontSize:10,color:LIGHT_GRAY,valign:"middle"});
  });

  s.addShape(pres.ShapeType.rect, {x:0,y:5.35,w:10,h:0.275, fill:{color:ACCENT3}, line:{type:"none"}});
  s.addText("Cerebellum | Get the Balance Right", {x:0,y:5.35,w:10,h:0.275, fontSize:12,color:WHITE,align:"center",valign:"middle",bold:true,margin:0});
}

// ─── Write file ──────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/tb-pharmacology-ppt/Anti_TB_Drugs_Part2.pptx" })
  .then(() => console.log("SUCCESS: PPT written"))
  .catch(e => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/tb-pharmacology-ppt && node build2.js 2>&1

Running Command

ls -lh /home/daytona/workspace/tb-pharmacology-ppt/

Your Part 2 presentation is ready!

Anti TB Drugs Part2

Presentation Β· PPTX


12 slides, fully topic-wise from your 10 images:
SlideTopic
1Title β€” Anti-TB Drugs Part 2
2TOPIC 1 β€” Rifampicin Other Uses (Leprosy, M.Mo prophylaxis, Brucellosis DOC=Doxy+R, MRSA, Pseudomonas)
3TOPIC 2 β€” Pyrazinamide (Z): Cidal, I/C, Best Sterilizing, Max Hepatotoxic, ↑Uric Acid + Ethambutol (E): Static, Optic Neuritis, Red-Green Colour Blindness, C/I <6 yrs
4TOPIC 3 β€” Streptomycin (S): IM injection, Cidal, E/C, Nephrotoxic, C/I Pregnancy
5TOPIC 4 β€” 2nd Line Cidal Drugs: FQ (Moxi βœ“, Levo βœ“) + Injectables (Strep, Capreo, Kana, Amikacin)
6TOPIC 5 β€” 2nd Line Static Drugs: Cycloserine (Psychosis), Ethionamide (Hepatotoxic+Hypothyroid), PAS, Thioacetazone (C/I HIV) + Linezolide (VRSA) + Clofazimine (Leprosy)
7TOPIC 6 β€” New Drugs: Bedaquiline (ATP Synthase βŠ–) + Pretomanid & Delamanid (Mycolic Acid βŠ– + NO toxic) β€” ADR: ↑QT
8TOPIC 7 β€” NTEP Treatment: Drug Sensitive (IP=2HRZE, CP=4HRE) vs Drug Resistant
9TOPIC 8 β€” Resistance Classification: Mono β†’ Poly β†’ RR β†’ MDR β†’ Pre-XDR β†’ XDR with regimens
10TOPIC 9 β€” H-Resistant TB: Regimen = 6-9 RZE + Lf (Levofloxacin)
11TOPIC 10 β€” WHO Groups for DR-TB: Group A (Levo/Moxi, Beda, Linezolide) + B (Clofa, Cyclo) + C
12Quick Revision Summary
This is a shared conversation. Sign in to Orris to start your own chat.