Detailed internal medicine presentation on viral hepatitis

Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Searching Images

hepatitis B serological markers timeline acute infection

Searching Images

hepatitis C virus liver histology cirrhosis

Reading File
Searching Images

hepatitis A virus transmission fecal oral epidemiology

Searching Images

hepatitis treatment algorithm antiviral therapy DAA

Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/viral-hepatitis-pptx && ls /home/daytona/worksp…

Writing File

~/viral-hepatitis-pptx/build.js

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

// ─── Fetch images as base64 ───────────────────────────────────────────────────
const imageUrls = [
  "https://cdn.orris.care/cdss_images/HARRISON_1763033460065_c3d3e24a-7619-4eff-a877-88960cb74c8e.png",   // 0 - Acute HBV serology timeline
  "https://cdn.orris.care/cdss_images/GLGCA_2558842_1766507565974_8efea364-b689-40e6-b608-5553ff2978a1_478aea1c-31e7-4a47-8b7f-8b864093fd55.png",  // 1 - Acute vs Chronic HBV
  "https://cdn.orris.care/cdss_images/HARRISON_1763031941963_b8714721-0c5c-4031-a531-da171f3c8e24.png",   // 2 - Chronic HBV timeline
  "https://cdn.orris.care/cdss_images/bf0678a73add35492ce7b8b1bd9f9c4bfb1d7de22918f4b6fd9b9493980b2ce7.png", // 3 - HCV serology
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_c6e8860216024ad472b39587963637caf7249be8157e8dbd71023629c946faec.jpg", // 4 - HCV-HCC progression
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_44b28c54ef7dd2682a3553293b44b3f4cdb793661e768ea60186a75dc545305e.jpg", // 5 - HCV cirrhosis mechanism
  "https://cdn.orris.care/cdss_images/e8dc7b1c3a4f58dba10a352069391d2d9844c2a7afaf35c4362002f4f68fd37f.png",  // 6 - HAV serology
];

console.log("Fetching images...");
let images = [];
try {
  const result = execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`,
    { maxBuffer: 50 * 1024 * 1024 }
  ).toString();
  images = JSON.parse(result);
  console.log("Images fetched:", images.map((img, i) => `${i}: ${img.error ? 'ERROR: ' + img.error : 'OK'}`));
} catch (e) {
  console.error("Image fetch error:", e.message);
  images = imageUrls.map(() => ({ base64: null, error: "fetch failed" }));
}

// ─── Color Palette ────────────────────────────────────────────────────────────
const C = {
  navy:      "0D2B45",   // deep navy - dominant background
  teal:      "1A7A7A",   // teal accent
  gold:      "E8A020",   // amber/gold highlight
  white:     "FFFFFF",
  offwhite:  "F0F4F7",
  lightgray: "D0DBE5",
  slate:     "3A5068",
  red:       "C0392B",
  green:     "1E8449",
  light_teal:"2AADAD",
  pale_teal: "A8DDDD",
};

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Viral Hepatitis";
pres.author = "Internal Medicine";

// ─── Helper functions ─────────────────────────────────────────────────────────
function navyBg(slide) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.navy }, line: { color: C.navy }
  });
}
function tealBar(slide, h = 0.06) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 5.625 - h, w: 10, h, fill: { color: C.teal }, line: { color: C.teal }
  });
}
function sectionHeader(slide, title, subtitle = "") {
  navyBg(slide);
  // Teal accent left strip
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.12, h: 5.625, fill: { color: C.teal }, line: { color: C.teal } });
  slide.addText(title, {
    x: 0.3, y: 2.1, w: 9.4, h: 1.0,
    fontSize: 36, bold: true, color: C.white, fontFace: "Calibri", align: "center"
  });
  if (subtitle) {
    slide.addText(subtitle, {
      x: 0.3, y: 3.2, w: 9.4, h: 0.5,
      fontSize: 18, color: C.pale_teal, fontFace: "Calibri", align: "center", italic: true
    });
  }
  tealBar(slide);
}

function contentSlide(slide) {
  // White content area on navy
  navyBg(slide);
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 0.9, w: 9.3, h: 4.4,
    fill: { color: C.offwhite }, line: { color: C.lightgray, pt: 0.5 },
    shadow: { type: "outer", color: "000000", blur: 8, offset: 3, angle: 135, opacity: 0.2 }
  });
}

function slideTitle(slide, text) {
  // Title bar
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.85, fill: { color: C.teal }, line: { color: C.teal } });
  slide.addText(text, {
    x: 0.25, y: 0.0, w: 9.5, h: 0.85,
    fontSize: 22, bold: true, color: C.white, fontFace: "Calibri", valign: "middle", margin: 0
  });
  tealBar(slide);
}

function bulletBlock(slide, items, opts = {}) {
  const { x = 0.55, y = 1.0, w = 8.9, h = 4.1, fontSize = 14, color = C.navy } = opts;
  const textArr = items.map((item, i) => {
    const isLast = i === items.length - 1;
    if (typeof item === "string") {
      return { text: item, options: { bullet: { indent: 15 }, breakLine: !isLast, fontSize, color, fontFace: "Calibri", paraSpaceAfter: 4 } };
    }
    return item;
  });
  slide.addText(textArr, { x, y, w, h, valign: "top" });
}

function addImg(slide, imgObj, x, y, w, h, caption = "") {
  if (imgObj && imgObj.base64 && !imgObj.error) {
    slide.addImage({ data: imgObj.base64, x, y, w, h });
  } else {
    slide.addShape(pres.shapes.RECTANGLE, { x, y, w, h, fill: { color: C.lightgray }, line: { color: C.slate, pt: 1 } });
    slide.addText("[Image unavailable]", { x, y, w, h, fontSize: 10, color: C.slate, align: "center", valign: "middle" });
  }
  if (caption) {
    slide.addText(caption, { x, y: y + h + 0.02, w, h: 0.2, fontSize: 8, color: C.slate, italic: true, align: "center" });
  }
}

// ─── SLIDE 1: Title ───────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  // Bold teal accent top bar
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.12, fill: { color: C.teal }, line: { color: C.teal } });
  // Gold bottom bar
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 5.46, w: 10, h: 0.165, fill: { color: C.gold }, line: { color: C.gold } });

  // Centered main title
  s.addText("VIRAL HEPATITIS", {
    x: 0.5, y: 1.3, w: 9, h: 1.1,
    fontSize: 48, bold: true, color: C.white, fontFace: "Calibri",
    align: "center", charSpacing: 4
  });
  s.addShape(pres.shapes.RECTANGLE, { x: 2.5, y: 2.5, w: 5, h: 0.04, fill: { color: C.teal }, line: { color: C.teal } });
  s.addText("An Internal Medicine Comprehensive Review", {
    x: 0.5, y: 2.65, w: 9, h: 0.55,
    fontSize: 20, color: C.pale_teal, fontFace: "Calibri", align: "center", italic: true
  });

  // Info row
  s.addText([
    { text: "HEPATITIS A  •  B  •  C  •  D  •  E", options: { fontSize: 13, color: C.gold, bold: true, charSpacing: 1 } },
  ], { x: 0.5, y: 3.45, w: 9, h: 0.35, align: "center" });

  s.addText("Epidemiology  |  Pathology  |  Serology  |  Treatment  |  Complications", {
    x: 0.5, y: 3.9, w: 9, h: 0.3,
    fontSize: 12, color: C.lightgray, fontFace: "Calibri", align: "center"
  });

  // Source badge
  s.addText("Based on Robbins Basic Pathology • Harrison's Principles of Internal Medicine", {
    x: 0.5, y: 5.0, w: 9, h: 0.25,
    fontSize: 9, color: C.slate, fontFace: "Calibri", align: "center", italic: true
  });
}

// ─── SLIDE 2: Overview / Table of Contents ────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Lecture Overview");

  const topics = [
    { num: "01", text: "Introduction & Classification of Hepatitis Viruses", col: C.teal },
    { num: "02", text: "Hepatitis A (HAV) — Epidemiology & Clinical Features", col: C.teal },
    { num: "03", text: "Hepatitis B (HBV) — Virology, Serology & Outcomes", col: C.gold },
    { num: "04", text: "Hepatitis C (HCV) — Chronic Disease & Treatment", col: C.gold },
    { num: "05", text: "Hepatitis D & E — Special Considerations", col: C.light_teal },
    { num: "06", text: "Acute Hepatitis — Pathology & Clinical Presentation", col: C.light_teal },
    { num: "07", text: "Chronic Hepatitis — Progression to Cirrhosis & HCC", col: C.red },
    { num: "08", text: "Management & Prevention", col: C.red },
  ];

  topics.forEach((t, i) => {
    const col = i % 2 === 0 ? 0 : 5;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.35 : 5.15;
    const y = 0.95 + row * 1.0;
    s.addShape(pres.shapes.RECTANGLE, { x, y, w: 4.6, h: 0.82, fill: { color: C.slate }, line: { color: t.col, pt: 1.5 } });
    s.addShape(pres.shapes.RECTANGLE, { x, y, w: 0.55, h: 0.82, fill: { color: t.col }, line: { color: t.col } });
    s.addText(t.num, { x, y, w: 0.55, h: 0.82, fontSize: 16, bold: true, color: C.navy, align: "center", valign: "middle" });
    s.addText(t.text, { x: x + 0.65, y, w: 3.85, h: 0.82, fontSize: 11, color: C.white, valign: "middle", fontFace: "Calibri" });
  });
}

// ─── SLIDE 3: Classification Table ───────────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Classification of Hepatotropic Viruses");

  const rows = [
    ["Feature", "HAV", "HBV", "HCV", "HDV", "HEV"],
    ["Genome", "ssRNA", "Partial dsDNA", "ssRNA", "Circular ssRNA", "ssRNA"],
    ["Family", "Hepatovirus", "Hepadnavirus", "Flaviviridae", "Deltaviridae", "Hepeviridae"],
    ["Transmission", "Fecal-oral", "Parenteral/ sexual/ perinatal", "Parenteral", "Parenteral", "Fecal-oral"],
    ["Incubation", "2–6 wks", "2–26 wks", "4–26 wks", "Same as HBV", "4–5 wks"],
    ["Chronicity", "Never", "5–10%", ">80%", "10–100%*", "Rare†"],
    ["Carrier state", "No", "Yes", "Yes", "Depends on HBV", "No"],
    ["Vaccine", "✓ Available", "✓ Available", "✗ None", "✗ (HBV vaccine)", "✗ None"],
  ];

  const colW = [1.7, 1.35, 1.35, 1.35, 1.35, 1.35];
  const colX = [0.3];
  for (let i = 1; i < colW.length; i++) colX.push(colX[i-1] + colW[i-1]);

  rows.forEach((row, ri) => {
    const isHeader = ri === 0;
    const y = 0.92 + ri * 0.57;
    row.forEach((cell, ci) => {
      const bgColor = isHeader ? C.teal : (ri % 2 === 0 ? C.slate : C.navy);
      const txtColor = isHeader ? C.white : (ci === 0 ? C.pale_teal : C.white);
      s.addShape(pres.shapes.RECTANGLE, {
        x: colX[ci], y, w: colW[ci], h: 0.55,
        fill: { color: bgColor }, line: { color: C.navy, pt: 0.5 }
      });
      s.addText(cell, {
        x: colX[ci], y, w: colW[ci], h: 0.55,
        fontSize: isHeader ? 11 : 10, bold: isHeader || ci === 0, color: txtColor,
        align: "center", valign: "middle", fontFace: "Calibri"
      });
    });
  });

  s.addText("*10% coinfection; 90–100% superinfection   †Only in immunocompromised hosts", {
    x: 0.3, y: 5.3, w: 9.4, h: 0.2,
    fontSize: 8, color: C.lightgray, italic: true
  });
}

// ─── SLIDE 4: HAV ─────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Hepatitis A Virus (HAV)");

  // Left panel - text
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 0.92, w: 5.1, h: 4.35, fill: { color: C.slate }, line: { color: C.teal, pt: 1 } });

  const bullets = [
    [{ text: "Epidemiology & Virology", options: { bold: true, fontSize: 13, color: C.gold, breakLine: true } }],
    "Nonenveloped, positive-strand RNA picornavirus (Hepatovirus genus)",
    "Accounts for ~25% of acute hepatitis worldwide",
    "Endemic in resource-limited countries; ~2,800 cases/yr in USA (post-vaccine)",
    "Spread fecal-oral: contaminated water, food (shellfish), person-to-person",
    [{ text: "\nClinical Features", options: { bold: true, fontSize: 13, color: C.gold, breakLine: true } }],
    "Incubation 2–6 weeks; self-limited febrile illness with jaundice",
    "HAV does NOT cause chronic hepatitis; fulminant rare (<0.1%)",
    "Fecal shedding 2–3 wks before + 1 wk after jaundice onset",
    [{ text: "\nDiagnosis & Prevention", options: { bold: true, fontSize: 13, color: C.gold, breakLine: true } }],
    "IgM anti-HAV — diagnostic marker of acute infection",
    "IgG anti-HAV — appears after recovery; confers lifelong immunity",
    "Vaccine available since 1995 (>95% reduction in US cases)",
  ];

  const textArr = [];
  bullets.forEach((b, i) => {
    const isLast = i === bullets.length - 1;
    if (Array.isArray(b)) {
      textArr.push(...b);
    } else {
      textArr.push({ text: b, options: { bullet: { indent: 12 }, breakLine: !isLast, fontSize: 11, color: C.white, fontFace: "Calibri", paraSpaceAfter: 2 } });
    }
  });
  s.addText(textArr, { x: 0.45, y: 0.98, w: 4.85, h: 4.15, valign: "top" });

  // Right panel - serology image
  s.addShape(pres.shapes.RECTANGLE, { x: 5.55, y: 0.92, w: 4.15, h: 2.5, fill: { color: C.offwhite }, line: { color: C.teal, pt: 1 } });
  addImg(s, images[6], 5.6, 0.97, 4.05, 2.35, "HAV Serological Markers Over Time");

  // Key concept box
  s.addShape(pres.shapes.RECTANGLE, { x: 5.55, y: 3.55, w: 4.15, h: 1.72, fill: { color: C.navy }, line: { color: C.gold, pt: 1.5 } });
  s.addText([
    { text: "Key Pathogenesis Point\n", options: { bold: true, fontSize: 12, color: C.gold, breakLine: true } },
    { text: "HAV is NOT directly cytopathic. Hepatocellular injury is immune-mediated via cytotoxic CD8+ T cells. Viremia is transient → blood screening not required.", options: { fontSize: 11, color: C.white } }
  ], { x: 5.65, y: 3.62, w: 3.95, h: 1.58, valign: "top", fontFace: "Calibri" });
}

// ─── SLIDE 5: HBV Virology & Epidemiology ────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Hepatitis B Virus (HBV) — Virology & Epidemiology");

  // Top stats row
  const stats = [
    { val: "2 Billion", label: "Ever infected worldwide" },
    { val: "250 M", label: "Chronic carriers globally" },
    { val: "75%", label: "Carriers in Asia & Pacific" },
    { val: "5–10%", label: "Acute → Chronic (adults)" },
  ];
  stats.forEach((st, i) => {
    const x = 0.3 + i * 2.35;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y: 0.92, w: 2.2, h: 1.05, fill: { color: C.slate }, line: { color: C.teal, pt: 1 }, rectRadius: 0.08 });
    s.addText(st.val, { x, y: 0.95, w: 2.2, h: 0.55, fontSize: 20, bold: true, color: C.gold, align: "center", fontFace: "Calibri" });
    s.addText(st.label, { x, y: 1.5, w: 2.2, h: 0.42, fontSize: 10, color: C.pale_teal, align: "center", fontFace: "Calibri" });
  });

  // Left: Virology
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 2.1, w: 4.5, h: 3.18, fill: { color: C.slate }, line: { color: C.teal, pt: 1 } });
  s.addText("Virology", { x: 0.35, y: 2.15, w: 4.4, h: 0.35, fontSize: 13, bold: true, color: C.gold, fontFace: "Calibri" });
  const virItems = [
    "Partially double-stranded DNA virus — Hepadnaviridae family",
    "4 overlapping ORFs: S (surface), C (core), P (polymerase), X (regulatory)",
    "3 surface particles: Dane particle (complete virion), spherical & filamentous HBsAg",
    "HBcAg (core) — intracellular only",
    "HBeAg — soluble marker of active replication",
    "Integrates into host genome → risk of HCC even without cirrhosis",
    "Transmitted: parenteral, sexual, perinatal (vertical in endemic areas)",
  ];
  s.addText(virItems.map((t, i) => ({
    text: t, options: { bullet: { indent: 12 }, breakLine: i < virItems.length - 1, fontSize: 11, color: C.white, fontFace: "Calibri", paraSpaceAfter: 3 }
  })), { x: 0.45, y: 2.55, w: 4.25, h: 2.65, valign: "top" });

  // Right: Outcomes spectrum
  s.addShape(pres.shapes.RECTANGLE, { x: 4.95, y: 2.1, w: 4.75, h: 3.18, fill: { color: C.slate }, line: { color: C.gold, pt: 1 } });
  s.addText("Clinical Outcomes of HBV Infection", { x: 5.0, y: 2.15, w: 4.65, h: 0.35, fontSize: 13, bold: true, color: C.gold, fontFace: "Calibri" });
  const outcomes = [
    ["Acute hepatitis + recovery", C.green, "Most common in immunocompetent adults"],
    ["Fulminant hepatitis", C.red, "Massive necrosis; rare but life-threatening"],
    ["Healthy carrier state", C.light_teal, "HBsAg+ with normal liver histology"],
    ["Nonprogressive chronic hepatitis", C.light_teal, "Mild inflammation, no fibrosis"],
    ["Progressive chronic hepatitis", C.red, "→ Cirrhosis → HCC"],
  ];
  outcomes.forEach((o, i) => {
    const y = 2.58 + i * 0.58;
    s.addShape(pres.shapes.RECTANGLE, { x: 5.05, y, w: 0.06, h: 0.44, fill: { color: o[1] }, line: { color: o[1] } });
    s.addText([
      { text: o[0] + "\n", options: { bold: true, fontSize: 11, color: C.white } },
      { text: o[2], options: { fontSize: 10, color: C.pale_teal } }
    ], { x: 5.18, y, w: 4.45, h: 0.48, valign: "middle", fontFace: "Calibri" });
  });
}

// ─── SLIDE 6: HBV Serology ────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Hepatitis B — Serological Markers");

  // Serology table
  const serRows = [
    ["Marker", "Significance", "Acute Inf.", "Recovery", "Chronic", "Immunity"],
    ["HBsAg", "Active infection (surface antigen)", "✓", "↓ clears", "✓ persist", "✗"],
    ["Anti-HBs", "Immunity (vaccine or recovery)", "✗", "✓ late", "✗", "✓"],
    ["HBcAg", "Core antigen — intrahepatic only", "—", "—", "—", "—"],
    ["IgM Anti-HBc", "Acute/recent infection marker", "✓", "↓", "✗/low", "✗"],
    ["IgG Anti-HBc", "Prior exposure (past or chronic)", "✓ late", "✓", "✓", "✗"],
    ["HBeAg", "Active replication, high infectivity", "✓", "↓", "Variable", "✗"],
    ["Anti-HBe", "Seroconversion — low replication", "✗", "✓", "Variable", "✗"],
    ["HBV DNA", "Active replication — gold standard", "✓ High", "↓ zero", "Variable", "✗"],
  ];

  const sColW = [1.55, 2.85, 0.95, 0.95, 0.95, 0.95];
  const sColX = [0.25]; for (let i = 1; i < sColW.length; i++) sColX.push(sColX[i-1] + sColW[i-1]);

  serRows.forEach((row, ri) => {
    const isH = ri === 0;
    const y = 0.88 + ri * 0.52;
    row.forEach((cell, ci) => {
      const bg = isH ? C.teal : (ri % 2 === 0 ? C.slate : C.navy);
      const fc = isH ? C.white : (ci <= 1 ? C.pale_teal : (cell === "✓" ? C.green : cell === "✗" ? C.red : C.white));
      s.addShape(pres.shapes.RECTANGLE, { x: sColX[ci], y, w: sColW[ci], h: 0.5, fill: { color: bg }, line: { color: C.navy, pt: 0.5 } });
      s.addText(cell, { x: sColX[ci], y, w: sColW[ci], h: 0.5, fontSize: isH ? 10 : 10, bold: isH || ci <= 1, color: fc, align: "center", valign: "middle", fontFace: "Calibri" });
    });
  });

  // Window period note
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.25, y: 5.2, w: 9.5, h: 0.28, fill: { color: C.gold }, line: { color: C.gold }, rectRadius: 0.05 });
  s.addText("⚠ Window Period: HBsAg cleared but Anti-HBs not yet detectable — IgM Anti-HBc is the ONLY positive marker during this interval", {
    x: 0.3, y: 5.2, w: 9.4, h: 0.28, fontSize: 10, bold: true, color: C.navy, align: "center", valign: "middle"
  });
}

// ─── SLIDE 7: HBV Serology Image ─────────────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "HBV — Acute vs. Chronic Serological Course");

  // Acute image left
  s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 0.92, w: 4.65, h: 3.5, fill: { color: C.offwhite }, line: { color: C.teal, pt: 1 } });
  addImg(s, images[0], 0.3, 0.97, 4.55, 3.35, "Acute HBV — resolution & seroconversion");

  // Chronic image right
  s.addShape(pres.shapes.RECTANGLE, { x: 5.1, y: 0.92, w: 4.65, h: 3.5, fill: { color: C.offwhite }, line: { color: C.gold, pt: 1 } });
  addImg(s, images[2], 5.15, 0.97, 4.55, 3.35, "Chronic HBV — persistent HBsAg, HBV DNA");

  // Bottom comparison
  s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 4.55, w: 9.5, h: 0.92, fill: { color: C.slate }, line: { color: C.lightgray, pt: 0.5 } });
  s.addText([
    { text: "ACUTE HBV (Recovery): ", options: { bold: true, color: C.teal, fontSize: 11 } },
    { text: "HBsAg clears within 6 months → Anti-HBs appears → IgM Anti-HBc transient   |   ", options: { color: C.white, fontSize: 11 } },
    { text: "CHRONIC HBV: ", options: { bold: true, color: C.gold, fontSize: 11 } },
    { text: "HBsAg persists >6 months → IgM Anti-HBc disappears → IgG Anti-HBc + HBsAg remain", options: { color: C.white, fontSize: 11 } }
  ], { x: 0.35, y: 4.58, w: 9.3, h: 0.86, valign: "middle", fontFace: "Calibri" });
}

// ─── SLIDE 8: HBV Treatment ───────────────────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Hepatitis B — Treatment & Management");

  // Treatment indications box
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 0.92, w: 4.5, h: 2.25, fill: { color: C.slate }, line: { color: C.teal, pt: 1.5 } });
  s.addText("Treatment Indications", { x: 0.35, y: 0.96, w: 4.4, h: 0.3, fontSize: 13, bold: true, color: C.gold });
  const indications = [
    "HBV DNA >2,000 IU/mL + elevated ALT",
    "Any HBV DNA with significant fibrosis (F2+)",
    "Cirrhosis regardless of HBV DNA level",
    "HBeAg+ with high viral load",
    "Pre-immunosuppression (HBsAg+ or anti-HBc+)",
  ];
  s.addText(indications.map((t, i) => ({
    text: t, options: { bullet: { indent: 12 }, breakLine: i < indications.length - 1, fontSize: 11, color: C.white, fontFace: "Calibri", paraSpaceAfter: 3 }
  })), { x: 0.45, y: 1.3, w: 4.25, h: 1.75, valign: "top" });

  // Drugs box
  s.addShape(pres.shapes.RECTANGLE, { x: 4.95, y: 0.92, w: 4.75, h: 2.25, fill: { color: C.slate }, line: { color: C.gold, pt: 1.5 } });
  s.addText("Antiviral Agents", { x: 5.0, y: 0.96, w: 4.65, h: 0.3, fontSize: 13, bold: true, color: C.gold });
  const drugs = [
    { drug: "Tenofovir (TDF/TAF)", detail: "1st-line; high barrier to resistance; preferred" },
    { drug: "Entecavir", detail: "1st-line; high efficacy; avoid in lamivudine-resistant" },
    { drug: "Pegylated IFN-α", detail: "Finite duration (48 wks); seroconversion advantage" },
    { drug: "Lamivudine / Adefovir", detail: "Older agents; high resistance rates — not preferred" },
  ];
  drugs.forEach((d, i) => {
    const y = 1.32 + i * 0.44;
    s.addText([
      { text: d.drug + "  ", options: { bold: true, fontSize: 11, color: C.light_teal } },
      { text: d.detail, options: { fontSize: 10, color: C.white } }
    ], { x: 5.1, y, w: 4.5, h: 0.4, valign: "middle", fontFace: "Calibri" });
    if (i < drugs.length - 1) s.addShape(pres.shapes.RECTANGLE, { x: 5.1, y: y + 0.38, w: 4.5, h: 0.02, fill: { color: C.navy }, line: { color: C.navy } });
  });

  // Goals & monitoring
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 3.3, w: 9.4, h: 1.98, fill: { color: C.navy }, line: { color: C.teal, pt: 1 } });
  s.addText("Treatment Goals & Monitoring", { x: 0.4, y: 3.35, w: 9.2, h: 0.3, fontSize: 13, bold: true, color: C.gold });
  const goals = [
    "Suppress HBV DNA to undetectable — primary endpoint",
    "HBeAg seroconversion (loss of HBeAg, gain of anti-HBe) — indicates immune control",
    "HBsAg loss (functional cure) — rare but achievable; HBsAg seroconversion = complete cure",
    "Monitor: HBV DNA q3–6 months, LFTs, AFP (HCC surveillance), fibroscan/imaging",
    "Screen ALL HBsAg+ patients for HCC with ultrasound ± AFP every 6 months",
  ];
  s.addText(goals.map((t, i) => ({
    text: t, options: { bullet: { indent: 12 }, breakLine: i < goals.length - 1, fontSize: 11, color: C.white, fontFace: "Calibri", paraSpaceAfter: 2 }
  })), { x: 0.45, y: 3.68, w: 9.1, h: 1.52, valign: "top" });
}

// ─── SLIDE 9: HCV ─────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Hepatitis C Virus (HCV) — Epidemiology & Virology");

  // Left stats
  const hcvStats = [
    { val: ">170M", label: "Chronic HCV worldwide" },
    { val: ">80%", label: "Acute → Chronic" },
    { val: "95%+", label: "Cure rate with DAAs" },
    { val: "6+", label: "Genotypes (1–6)" },
  ];
  hcvStats.forEach((st, i) => {
    const x = 0.3 + i * 2.35;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y: 0.92, w: 2.2, h: 1.05, fill: { color: C.slate }, line: { color: C.gold, pt: 1.2 }, rectRadius: 0.08 });
    s.addText(st.val, { x, y: 0.94, w: 2.2, h: 0.55, fontSize: 20, bold: true, color: C.gold, align: "center", fontFace: "Calibri" });
    s.addText(st.label, { x, y: 1.5, w: 2.2, h: 0.42, fontSize: 10, color: C.pale_teal, align: "center", fontFace: "Calibri" });
  });

  // Virology panel
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 2.1, w: 4.5, h: 3.18, fill: { color: C.slate }, line: { color: C.gold, pt: 1 } });
  s.addText("Virology & Pathogenesis", { x: 0.35, y: 2.15, w: 4.4, h: 0.32, fontSize: 13, bold: true, color: C.gold });
  const virHCV = [
    "Positive-sense ssRNA flavivirus; 6 major genotypes",
    "No proofreading → hypermutation → quasispecies formation",
    "Quasispecies → immune evasion → chronicity (>80%)",
    "Replicates in ER-derived membranous webs",
    "NS3 (protease), NS5A, NS5B (RNA polymerase) — DAA targets",
    "NOT directly cytopathic — T-cell mediated injury",
    "Risk factors: IVDU, transfusion pre-1992, hemodialysis, tattoos",
    "Sexual/perinatal transmission possible but less efficient",
  ];
  s.addText(virHCV.map((t, i) => ({
    text: t, options: { bullet: { indent: 12 }, breakLine: i < virHCV.length - 1, fontSize: 11, color: C.white, fontFace: "Calibri", paraSpaceAfter: 2 }
  })), { x: 0.45, y: 2.5, w: 4.25, h: 2.65, valign: "top" });

  // Serology image
  s.addShape(pres.shapes.RECTANGLE, { x: 4.95, y: 2.1, w: 4.75, h: 3.18, fill: { color: C.offwhite }, line: { color: C.teal, pt: 1 } });
  addImg(s, images[3], 5.0, 2.15, 4.65, 2.85, "HCV serological markers — acute and chronic disease");
  s.addText("Diagnosis: Anti-HCV ELISA (screening) → HCV RNA PCR (confirmation) → Genotyping (guides therapy)", {
    x: 5.0, y: 5.05, w: 4.65, h: 0.2, fontSize: 9, color: C.slate, italic: true, align: "center"
  });
}

// ─── SLIDE 10: HCV Treatment (DAAs) ──────────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Hepatitis C — Direct-Acting Antivirals (DAAs)");

  // DAA classes
  const daaClasses = [
    { cls: "NS3/4A Protease Inhibitors", suffix: "-previr", examples: "Glecaprevir, Grazoprevir, Voxilaprevir", color: C.teal },
    { cls: "NS5A Inhibitors", suffix: "-asvir", examples: "Elbasvir, Ledipasvir, Pibrentasvir, Velpatasvir", color: C.gold },
    { cls: "NS5B Nucleoside Inhibitors", suffix: "-buvir", examples: "Sofosbuvir (pangenotypic backbone)", color: C.light_teal },
  ];

  daaClasses.forEach((d, i) => {
    const y = 0.92 + i * 1.2;
    s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y, w: 5.9, h: 1.1, fill: { color: C.slate }, line: { color: d.color, pt: 1.5 } });
    s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y, w: 0.1, h: 1.1, fill: { color: d.color }, line: { color: d.color } });
    s.addText([
      { text: d.cls + "\n", options: { bold: true, fontSize: 13, color: d.color, breakLine: true } },
      { text: "Suffix: " + d.suffix + "   |   ", options: { fontSize: 10, color: C.lightgray, italic: true } },
      { text: d.examples, options: { fontSize: 11, color: C.white } }
    ], { x: 0.5, y: y + 0.05, w: 5.6, h: 1.0, valign: "middle", fontFace: "Calibri" });
  });

  // First-line regimens box
  s.addShape(pres.shapes.RECTANGLE, { x: 6.35, y: 0.92, w: 3.35, h: 3.65, fill: { color: C.navy }, line: { color: C.gold, pt: 1.5 } });
  s.addText("Preferred Regimens", { x: 6.4, y: 0.97, w: 3.25, h: 0.32, fontSize: 13, bold: true, color: C.gold, align: "center" });
  const regimens = [
    { name: "Sofosbuvir/Velpatasvir", detail: "Pangenotypic (G1–6); 12 wks" },
    { name: "Glecaprevir/Pibrentasvir", detail: "Pangenotypic; 8 wks (no cirrhosis)" },
    { name: "Ledipasvir/Sofosbuvir", detail: "Genotype 1, 4, 5, 6; 8–12 wks" },
    { name: "Elbasvir/Grazoprevir", detail: "Genotype 1, 4; 12 wks" },
  ];
  regimens.forEach((r, i) => {
    const y = 1.38 + i * 0.8;
    s.addShape(pres.shapes.RECTANGLE, { x: 6.45, y, w: 3.15, h: 0.72, fill: { color: C.slate }, line: { color: C.teal, pt: 0.5 } });
    s.addText([
      { text: r.name + "\n", options: { bold: true, fontSize: 11, color: C.light_teal, breakLine: true } },
      { text: r.detail, options: { fontSize: 10, color: C.white } }
    ], { x: 6.5, y: y + 0.05, w: 3.05, h: 0.62, valign: "middle", fontFace: "Calibri" });
  });

  // SVR info
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 4.68, w: 9.4, h: 0.72, fill: { color: C.teal }, line: { color: C.teal } });
  s.addText([
    { text: "SVR12 (Sustained Virologic Response at 12 weeks post-treatment) = CURE   ", options: { bold: true, fontSize: 13, color: C.white } },
    { text: "Achieved in >95% of patients with current DAA regimens regardless of genotype", options: { fontSize: 12, color: C.offwhite } }
  ], { x: 0.4, y: 4.72, w: 9.2, h: 0.62, valign: "middle", fontFace: "Calibri", align: "center" });
}

// ─── SLIDE 11: HDV & HEV ─────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Hepatitis D & E — Special Considerations");

  // HDV panel
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 0.92, w: 4.5, h: 4.35, fill: { color: C.slate }, line: { color: C.teal, pt: 1.5 } });
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 0.92, w: 4.5, h: 0.4, fill: { color: C.teal }, line: { color: C.teal } });
  s.addText("Hepatitis D Virus (HDV) — Delta Agent", { x: 0.35, y: 0.92, w: 4.4, h: 0.4, fontSize: 13, bold: true, color: C.white, valign: "middle" });

  const hdvItems = [
    "Defective RNA virus — REQUIRES HBV (HBsAg) for envelope",
    "Prevents HDV with HBV vaccination",
    "~15 million infected worldwide (5% of HBV carriers)",
    "Endemic: Amazon basin, Africa, Middle East, S. Italy",
    "",
    "Coinfection (HDV + HBV simultaneously):",
    "  → Usually self-limited, similar to acute HBV",
    "  → Higher risk of fulminant hepatitis (in IVDU)",
    "",
    "Superinfection (HDV infects chronic HBV carrier):",
    "  → Chronic HDV in >80% of cases",
    "  → Rapid progression to cirrhosis",
    "  → Higher HCC risk",
    "",
    "Treatment: Pegylated interferon-α (limited efficacy)",
    "Bulevirtide — novel entry inhibitor (EU approved 2020)",
  ];
  s.addText(hdvItems.map((t, i) => ({
    text: t, options: {
      bullet: t && !t.startsWith("  ") && !t.startsWith("Co") && !t.startsWith("Su") && !t.startsWith("Tr") && !t.startsWith("Bu") ? false : (t ? { indent: 12 } : false),
      breakLine: i < hdvItems.length - 1, fontSize: 10.5, color: t.startsWith("  ") ? C.pale_teal : C.white, fontFace: "Calibri", paraSpaceAfter: 1
    }
  })), { x: 0.42, y: 1.38, w: 4.28, h: 3.75, valign: "top" });

  // HEV panel
  s.addShape(pres.shapes.RECTANGLE, { x: 4.95, y: 0.92, w: 4.75, h: 4.35, fill: { color: C.slate }, line: { color: C.gold, pt: 1.5 } });
  s.addShape(pres.shapes.RECTANGLE, { x: 4.95, y: 0.92, w: 4.75, h: 0.4, fill: { color: C.gold }, line: { color: C.gold } });
  s.addText("Hepatitis E Virus (HEV)", { x: 5.0, y: 0.92, w: 4.65, h: 0.4, fontSize: 13, bold: true, color: C.navy, valign: "middle" });

  const hevItems = [
    "ssRNA, Hepeviridae; 4 main genotypes (1–4)",
    "Genotypes 1 & 2: human-only, epidemic in Asia/Africa",
    "Genotypes 3 & 4: zoonotic (pigs, deer); sporadic in developed countries",
    "Transmission: fecal-oral, waterborne (large epidemics in South Asia)",
    "Self-limited in immunocompetent individuals",
    "Does NOT cause chronic hepatitis (except in immunocompromised)",
    "",
    "⚠ Pregnant women (HEV G1):",
    "  → Fulminant hepatic failure in 20% of cases in 3rd trimester",
    "  → Maternal mortality 15–25%",
    "  → Vertical transmission risk",
    "",
    "Diagnosis: IgM/IgG anti-HEV; HEV RNA (PCR)",
    "Treatment: Supportive; Ribavirin for immunocompromised",
    "Vaccine (HEV 239) approved in China; not globally available",
  ];
  s.addText(hevItems.map((t, i) => ({
    text: t, options: {
      bullet: t ? { indent: 12 } : false,
      breakLine: i < hevItems.length - 1, fontSize: 10.5, color: t.startsWith("  ") ? C.pale_teal : (t.startsWith("⚠") ? C.gold : C.white), fontFace: "Calibri", paraSpaceAfter: 1
    }
  })), { x: 5.05, y: 1.38, w: 4.55, h: 3.75, valign: "top" });
}

// ─── SLIDE 12: Acute Hepatitis — Pathology ────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Acute Viral Hepatitis — Pathology & Clinical Presentation");

  // Left: pathological features
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 0.92, w: 4.5, h: 4.35, fill: { color: C.slate }, line: { color: C.teal, pt: 1 } });
  s.addText("Histopathological Features", { x: 0.35, y: 0.97, w: 4.4, h: 0.32, fontSize: 13, bold: true, color: C.gold });

  const histoItems = [
    { heading: "Hepatocyte Injury:", bullets: ["Ballooning degeneration", "Acidophil bodies (Councilman bodies) — apoptotic hepatocytes", "Spotty (focal) hepatocyte necrosis"] },
    { heading: "Inflammation:", bullets: ["Portal tract expansion with mononuclear infiltrate", "Lobular disarray — loss of normal plate architecture", "Kupffer cell hypertrophy and hyperplasia"] },
    { heading: "Cholestasis (variable):", bullets: ["Bile plugs in canaliculi", "Bilirubin in hepatocytes"] },
    { heading: "Fulminant:", bullets: ["Massive or submassive hepatic necrosis", "Panacinar necrosis with collapse of reticulin framework"] },
  ];

  let yOff = 1.38;
  histoItems.forEach(item => {
    s.addText(item.heading, { x: 0.42, y: yOff, w: 4.28, h: 0.25, fontSize: 11, bold: true, color: C.light_teal, fontFace: "Calibri" });
    yOff += 0.26;
    item.bullets.forEach(b => {
      s.addText("• " + b, { x: 0.55, y: yOff, w: 4.1, h: 0.22, fontSize: 10.5, color: C.white, fontFace: "Calibri" });
      yOff += 0.22;
    });
    yOff += 0.08;
  });

  // Right: clinical presentation
  s.addShape(pres.shapes.RECTANGLE, { x: 4.95, y: 0.92, w: 4.75, h: 4.35, fill: { color: C.slate }, line: { color: C.gold, pt: 1 } });
  s.addText("Clinical Presentation", { x: 5.0, y: 0.97, w: 4.65, h: 0.32, fontSize: 13, bold: true, color: C.gold });

  const phases = [
    { phase: "Prodromal Phase (1–2 weeks)", sx: ["Malaise, fatigue, anorexia", "Nausea, vomiting, RUQ discomfort", "Fever, arthralgias, myalgias", "Dark urine (bilirubinuria)"] },
    { phase: "Icteric Phase (2–6 weeks)", sx: ["Jaundice + scleral icterus", "Tender hepatomegaly", "Pruritus (cholestasis)", "LFTs peak: ALT/AST often >1000"] },
    { phase: "Recovery Phase", sx: ["Symptoms resolve over weeks", "LFTs normalize (except HCV→chronic)", "Fatigue may persist months"] },
  ];

  let yR = 1.35;
  phases.forEach(p => {
    s.addShape(pres.shapes.RECTANGLE, { x: 5.05, y: yR, w: 0.08, h: 0.28, fill: { color: C.gold }, line: { color: C.gold } });
    s.addText(p.phase, { x: 5.2, y: yR, w: 4.4, h: 0.28, fontSize: 11, bold: true, color: C.light_teal, fontFace: "Calibri", valign: "middle" });
    yR += 0.3;
    p.sx.forEach(sx => {
      s.addText("• " + sx, { x: 5.2, y: yR, w: 4.4, h: 0.22, fontSize: 10.5, color: C.white, fontFace: "Calibri" });
      yR += 0.22;
    });
    yR += 0.15;
  });

  // Lab values box
  s.addShape(pres.shapes.RECTANGLE, { x: 4.95, y: 4.45, w: 4.75, h: 0.82, fill: { color: C.navy }, line: { color: C.red, pt: 1.5 } });
  s.addText([
    { text: "⚠ Alarm Features → Fulminant Hepatic Failure:\n", options: { bold: true, fontSize: 11, color: C.red, breakLine: true } },
    { text: "PT/INR >1.5  |  Encephalopathy  |  Rapidly shrinking liver  |  Hypoglycemia  |  Ascites", options: { fontSize: 10.5, color: C.white } }
  ], { x: 5.05, y: 4.5, w: 4.55, h: 0.72, valign: "middle", fontFace: "Calibri" });
}

// ─── SLIDE 13: Chronic Hepatitis Progression ──────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Chronic Hepatitis — Progression & Staging");

  // METAVIR scheme
  s.addText("METAVIR Fibrosis Staging (Liver Biopsy)", {
    x: 0.3, y: 0.93, w: 9.4, h: 0.32, fontSize: 13, bold: true, color: C.gold, fontFace: "Calibri"
  });

  const stages = [
    { stage: "F0", label: "No Fibrosis", color: C.green, detail: "Normal portal tracts" },
    { stage: "F1", label: "Portal Fibrosis", color: "#7FBA00", detail: "Expanded portal tracts, no septa" },
    { stage: "F2", label: "Periportal", color: C.gold, detail: "Few septa / portal-portal bridging" },
    { stage: "F3", label: "Bridging Fibrosis", color: "#E67E22", detail: "Numerous septa without cirrhosis" },
    { stage: "F4", label: "Cirrhosis", color: C.red, detail: "Complete distortion + regenerative nodules" },
  ];

  stages.forEach((st, i) => {
    const x = 0.3 + i * 1.88;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y: 1.32, w: 1.75, h: 0.55, fill: { color: st.color }, line: { color: st.color }, rectRadius: 0.08 });
    s.addText(st.stage, { x, y: 1.32, w: 1.75, h: 0.55, fontSize: 22, bold: true, color: C.white, align: "center", valign: "middle" });
    s.addText(st.label, { x, y: 1.9, w: 1.75, h: 0.25, fontSize: 10, bold: true, color: C.lightgray, align: "center" });
    s.addText(st.detail, { x, y: 2.18, w: 1.75, h: 0.4, fontSize: 9, color: C.pale_teal, align: "center", fontFace: "Calibri" });
    if (i < stages.length - 1) {
      s.addText("→", { x: x + 1.76, y: 1.45, w: 0.12, h: 0.3, fontSize: 16, color: C.lightgray, align: "center" });
    }
  });

  // Progression image
  s.addShape(pres.shapes.RECTANGLE, { x: 5.1, y: 2.65, w: 4.6, h: 2.6, fill: { color: C.offwhite }, line: { color: C.teal, pt: 1 } });
  addImg(s, images[4], 5.15, 2.7, 4.5, 2.4, "HCV-related HCC progression: Normal → Chronic Hepatitis → Cirrhosis → HCC");

  // Left panel complications
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 2.65, w: 4.65, h: 2.6, fill: { color: C.slate }, line: { color: C.red, pt: 1 } });
  s.addText("Complications of Cirrhosis", { x: 0.35, y: 2.7, w: 4.55, h: 0.32, fontSize: 13, bold: true, color: C.red, fontFace: "Calibri" });
  const complications = [
    "Portal hypertension → varices (esophageal/gastric)",
    "Ascites → risk of SBP (spontaneous bacterial peritonitis)",
    "Hepatic encephalopathy (↑ ammonia)",
    "Hepatorenal syndrome",
    "Coagulopathy (↓ factor synthesis)",
    "Hepatocellular carcinoma (HCC)",
    "  → HBV: HCC even WITHOUT cirrhosis possible",
    "  → HCV: requires cirrhosis in most cases",
  ];
  s.addText(complications.map((t, i) => ({
    text: t, options: { bullet: { indent: 12 }, breakLine: i < complications.length - 1, fontSize: 10.5, color: t.startsWith("  ") ? C.pale_teal : C.white, fontFace: "Calibri", paraSpaceAfter: 2 }
  })), { x: 0.42, y: 3.06, w: 4.45, h: 2.12, valign: "top" });
}

// ─── SLIDE 14: HCC Surveillance & Prevention ─────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Complications — HCC Surveillance & Prevention");

  // HCC risk factors box
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 0.92, w: 4.5, h: 2.5, fill: { color: C.slate }, line: { color: C.red, pt: 1.5 } });
  s.addText("HCC Risk Factors", { x: 0.35, y: 0.97, w: 4.4, h: 0.3, fontSize: 13, bold: true, color: C.red });
  const hccRisk = [
    "HBV: cirrhosis, HBeAg+, high HBV DNA, HBV genotype C, co-infection",
    "HCV: cirrhosis (primary risk), co-infection with HBV/HIV, alcohol",
    "HDV superinfection amplifies HCC risk",
    "Male sex, older age, alcohol, aflatoxin exposure, NAFLD",
    "HBV can cause HCC WITHOUT cirrhosis (viral DNA integration)",
  ];
  s.addText(hccRisk.map((t, i) => ({
    text: t, options: { bullet: { indent: 12 }, breakLine: i < hccRisk.length - 1, fontSize: 11, color: C.white, fontFace: "Calibri", paraSpaceAfter: 3 }
  })), { x: 0.42, y: 1.32, w: 4.3, h: 1.98, valign: "top" });

  // Surveillance box
  s.addShape(pres.shapes.RECTANGLE, { x: 4.95, y: 0.92, w: 4.75, h: 2.5, fill: { color: C.slate }, line: { color: C.gold, pt: 1.5 } });
  s.addText("HCC Surveillance Protocol", { x: 5.0, y: 0.97, w: 4.65, h: 0.3, fontSize: 13, bold: true, color: C.gold });
  const surv = [
    "Ultrasound ± AFP every 6 months for HIGH-RISK patients:",
    "  • All HBsAg+ patients (with/without cirrhosis)",
    "  • All HCV cirrhosis patients (even after SVR)",
    "  • Any hepatitis-related cirrhosis",
    "AFP >20 ng/mL or suspicious lesion → CT/MRI (LI-RADS system)",
    "Nodule >1 cm meeting LI-RADS-5 criteria = diagnose HCC",
  ];
  s.addText(surv.map((t, i) => ({
    text: t, options: { bullet: t.startsWith("  ") ? { indent: 22 } : { indent: 12 }, breakLine: i < surv.length - 1, fontSize: 11, color: t.startsWith("  ") ? C.pale_teal : C.white, fontFace: "Calibri", paraSpaceAfter: 2 }
  })), { x: 5.05, y: 1.32, w: 4.55, h: 1.98, valign: "top" });

  // Prevention section
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 3.55, w: 9.4, h: 1.72, fill: { color: C.navy }, line: { color: C.teal, pt: 1 } });
  s.addText("Prevention Strategies", { x: 0.4, y: 3.6, w: 9.2, h: 0.32, fontSize: 13, bold: true, color: C.gold, align: "center" });

  const preventCols = [
    { title: "HAV Vaccine", items: ["2-dose series", "Travelers to endemic areas", "MSM, IVDU, chronic liver disease"] },
    { title: "HBV Vaccine", items: ["3-dose series (0, 1, 6 months)", "Universal infant vaccination", "Healthcare workers", "Anti-HBs ≥10 mIU/mL = protected"] },
    { title: "Post-Exposure (HBV)", items: ["HBIG + HBV vaccine", "Given to unvaccinated contacts", "Needle-stick, newborns of HBsAg+"] },
    { title: "HCV Prevention", items: ["No vaccine available", "Harm reduction (IVDU programs)", "Safe injection practices", "DAA therapy prevents transmission"] },
  ];

  preventCols.forEach((col, i) => {
    const x = 0.35 + i * 2.35;
    s.addShape(pres.shapes.RECTANGLE, { x, y: 4.0, w: 2.25, h: 1.2, fill: { color: C.slate }, line: { color: C.teal, pt: 0.5 } });
    s.addText(col.title, { x, y: 4.03, w: 2.25, h: 0.28, fontSize: 11, bold: true, color: C.light_teal, align: "center" });
    s.addText(col.items.join("\n"), { x: x + 0.05, y: 4.33, w: 2.15, h: 0.85, fontSize: 9, color: C.white, fontFace: "Calibri", valign: "top" });
  });
}

// ─── SLIDE 15: Diagnostic Algorithm ──────────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Diagnostic Approach to Suspected Viral Hepatitis");

  // Step boxes
  const steps = [
    { step: "1", title: "Initial Workup", items: ["LFTs (ALT, AST, ALP, GGT, bilirubin)", "PT/INR, albumin", "CBC, metabolic panel", "Hepatitis serology panel"] },
    { step: "2", title: "Serology Panel", items: ["Anti-HAV IgM (acute HAV)", "HBsAg + IgM anti-HBc (acute HBV)", "Anti-HCV ELISA (HCV screening)", "Anti-HEV IgM (if travel history)"] },
    { step: "3", title: "Confirmatory Testing", items: ["HCV RNA PCR if anti-HCV+", "HBV DNA if HBsAg+", "HCV genotype (guides therapy)", "HDV serology if HBsAg+"] },
  ];

  steps.forEach((st, i) => {
    const x = 0.3 + i * 3.2;
    s.addShape(pres.shapes.RECTANGLE, { x, y: 0.92, w: 3.05, h: 2.85, fill: { color: C.slate }, line: { color: C.teal, pt: 1 } });
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: x + 0.1, y: 0.98, w: 0.55, h: 0.55, fill: { color: C.teal }, line: { color: C.teal }, rectRadius: 0.08 });
    s.addText(st.step, { x: x + 0.1, y: 0.98, w: 0.55, h: 0.55, fontSize: 18, bold: true, color: C.white, align: "center", valign: "middle" });
    s.addText(st.title, { x: x + 0.75, y: 1.0, w: 2.2, h: 0.5, fontSize: 13, bold: true, color: C.gold, valign: "middle" });
    s.addText(st.items.map((t, i2) => ({
      text: t, options: { bullet: { indent: 12 }, breakLine: i2 < st.items.length - 1, fontSize: 11, color: C.white, fontFace: "Calibri", paraSpaceAfter: 3 }
    })), { x: x + 0.15, y: 1.6, w: 2.8, h: 1.96, valign: "top" });
    if (i < steps.length - 1) s.addText("→", { x: x + 3.06, y: 1.5, w: 0.18, h: 0.5, fontSize: 22, color: C.teal, align: "center" });
  });

  // Acute hepatitis panel info
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 3.88, w: 9.4, h: 0.6, fill: { color: C.gold }, line: { color: C.gold } });
  s.addText("ACUTE HEPATITIS PANEL (CPT 80074): IgM Anti-HAV  +  IgM Anti-HBc  +  HBsAg  +  Anti-HCV", {
    x: 0.35, y: 3.91, w: 9.3, h: 0.55, fontSize: 12, bold: true, color: C.navy, align: "center", valign: "middle"
  });

  // Clinical clues
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 4.55, w: 9.4, h: 0.82, fill: { color: C.slate }, line: { color: C.lightgray, pt: 0.5 } });
  const clues = [
    { label: "HAV", hint: "Recent travel / shellfish / daycare cluster → fecal-oral" },
    { label: "HBV", hint: "IVDU, MSM, healthcare worker, neonatal exposure" },
    { label: "HCV", hint: "IVDU (major), pre-1992 transfusion, hemodialysis" },
    { label: "HEV", hint: "Pregnancy + fulminant hepatitis + travel to South Asia" },
  ];
  clues.forEach((c, i) => {
    const x = 0.38 + i * 2.36;
    s.addText([
      { text: c.label + ": ", options: { bold: true, color: C.gold, fontSize: 10 } },
      { text: c.hint, options: { color: C.white, fontSize: 10 } }
    ], { x, y: 4.58, w: 2.3, h: 0.76, valign: "middle", fontFace: "Calibri" });
  });
}

// ─── SLIDE 16: Extrahepatic Manifestations ────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Extrahepatic Manifestations of Viral Hepatitis");

  const conditions = [
    { virus: "HBV", manifestations: ["Polyarteritis nodosa (PAN)", "Membranous nephropathy (HBsAg deposits)", "Mixed cryoglobulinemia (rare)", "Aplastic anemia (rare)", "Serum sickness-like (prodrome)"], color: C.teal },
    { virus: "HCV", manifestations: ["Mixed cryoglobulinemia (vasculitis)", "Membranoproliferative GN (MPGN)", "Porphyria cutanea tarda", "Lichen planus", "B-cell non-Hodgkin lymphoma", "Sjögren's-like syndrome", "Thyroid disorders"], color: C.gold },
    { virus: "HAV/HEV", manifestations: ["Cholestatic jaundice (prolonged)", "Relapsing hepatitis (HAV)", "Acute kidney injury (HEV in pregnancy)", "Neurological manifestations (rare)"], color: C.light_teal },
  ];

  conditions.forEach((c, i) => {
    const x = 0.3 + i * 3.2;
    s.addShape(pres.shapes.RECTANGLE, { x, y: 0.92, w: 3.1, h: 4.35, fill: { color: C.slate }, line: { color: c.color, pt: 2 } });
    s.addShape(pres.shapes.RECTANGLE, { x, y: 0.92, w: 3.1, h: 0.42, fill: { color: c.color }, line: { color: c.color } });
    s.addText(c.virus, { x, y: 0.92, w: 3.1, h: 0.42, fontSize: 18, bold: true, color: C.white, align: "center", valign: "middle" });
    s.addText(c.manifestations.map((t, i2) => ({
      text: t, options: { bullet: { indent: 12 }, breakLine: i2 < c.manifestations.length - 1, fontSize: 12, color: C.white, fontFace: "Calibri", paraSpaceAfter: 4 }
    })), { x: x + 0.1, y: 1.42, w: 2.9, h: 3.72, valign: "top" });
  });

  // Key note
  s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 5.3, w: 9.4, h: 0.22, fill: { color: C.navy }, line: { color: C.navy } });
  s.addText("HCV has the BROADEST extrahepatic manifestations — cryoglobulinemia is the hallmark immune-complex disease of HCV", {
    x: 0.3, y: 5.3, w: 9.4, h: 0.22, fontSize: 9, color: C.lightgray, italic: true, align: "center"
  });
}

// ─── SLIDE 17: Summary ────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  navyBg(s);
  slideTitle(s, "Summary — High-Yield Points for Internal Medicine");

  const highYield = [
    { icon: "🅰", text: "HAV: Self-limited, fecal-oral, NO chronicity, NO blood screening needed. IgM anti-HAV = acute; IgG = immunity. Vaccine available.", color: C.teal },
    { icon: "🅱", text: "HBV: Partial dsDNA; 5–10% chronicity in adults. Window period → IgM anti-HBc only positive. Treat: TDF/TAF or Entecavir. HCC without cirrhosis possible.", color: C.gold },
    { icon: "🆈", text: "HCV: ssRNA flavivirus; >80% chronicity; quasispecies → immune evasion. DAAs (SOF-based) cure >95%. SVR12 = cure. Screen all adults born 1945–1965 (CDC).", color: C.light_teal },
    { icon: "🅳", text: "HDV: Defective RNA — needs HBV. Superinfection = worse prognosis. HBV vaccine prevents HDV. Bulevirtide = new treatment.", color: C.pale_teal },
    { icon: "🅴", text: "HEV: Fecal-oral zoonotic; self-limited EXCEPT in pregnancy (20% fulminant) and immunocompromised (chronic). No global vaccine.", color: C.lightgray },
    { icon: "⚡", text: "ALL hepatitis viruses: Monitor for HCC (HBsAg+ and HCV cirrhosis). Screen with US ± AFP q6 months. Cirrhosis staging = METAVIR F0–F4.", color: C.red },
  ];

  highYield.forEach((item, i) => {
    const y = 0.92 + i * 0.76;
    s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y, w: 9.4, h: 0.7, fill: { color: C.slate }, line: { color: item.color, pt: 1 } });
    s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y, w: 0.55, h: 0.7, fill: { color: item.color }, line: { color: item.color } });
    s.addText(item.icon, { x: 0.3, y, w: 0.55, h: 0.7, fontSize: 16, align: "center", valign: "middle" });
    s.addText(item.text, { x: 0.95, y: y + 0.05, w: 8.65, h: 0.62, fontSize: 11, color: C.white, fontFace: "Calibri", valign: "middle" });
  });
}

// ─── Write file ───────────────────────────────────────────────────────────────
const outPath = "/home/daytona/workspace/viral-hepatitis-pptx/Viral_Hepatitis_Internal_Medicine.pptx";
pres.writeFile({ fileName: outPath }).then(() => {
  console.log("✅ Presentation saved:", outPath);
}).catch(err => {
  console.error("Error writing file:", err);
});
Your credits are exhausted. Your daily credits reset tomorrow, or you can purchase a top-up for more.
This is a shared conversation. Sign in to Orris to start your own chat.