Topic is Describe the clinical features, investigations and principles of management of disorders of small intestine including Short gut syndrome Add relevant pictures to the presentation

Asking for Preferences
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Searching the Web

small intestine disorders clinical features investigations management medical education diagrams

Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/small-intestine-ppt && ls /home/daytona/workspa…

Writing File

~/small-intestine-ppt/create_pptx.js

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

// Fetch images
const imageUrls = [
  "https://cdn.orris.care/cdss_images/158bc9cc39e323c81d9f0cccaa784bfbb067bab526f2241ccac5c8435bc1e400.png",
  "https://cdn.orris.care/cdss_images/d2918e8deba389a22ac8f4bbb21a6215b76958fc3eccdb92b55aa48059500ff8.png"
];

let images = [];
try {
  images = JSON.parse(execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js "${imageUrls[0]}" "${imageUrls[1]}"`
  ).toString());
} catch(e) {
  console.log("Image fetch error:", e.message);
}

const obsImg = images[0] && !images[0].error ? images[0].base64 : null;
const stepImg = images[1] && !images[1].error ? images[1].base64 : null;

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author = "Medical Education";
pres.title = "Disorders of Small Intestine";

// ─── Color palette ───────────────────────────────────────────────────
const C = {
  navy:    "0D2B55",   // dominant dark
  teal:    "1A7A8A",   // supporting
  accent:  "E8A020",   // warm gold accent
  light:   "EEF4F7",   // light background
  white:   "FFFFFF",
  text:    "1C2B36",
  subtext: "4A6070",
  red:     "C0392B",
  green:   "1E8449",
};

// ─── Helper: section slide ───────────────────────────────────────────
function sectionSlide(title, subtitle) {
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 4.8, w: "100%", h: 0.8, fill: { color: C.teal } });
  sl.addShape(pres.ShapeType.rect, { x: 0.5, y: 1.8, w: 0.1, h: 2, fill: { color: C.accent } });
  sl.addText(title, { x: 0.8, y: 1.8, w: 8.5, h: 2, fontSize: 38, bold: true, color: C.white, fontFace: "Calibri" });
  if (subtitle) {
    sl.addText(subtitle, { x: 0.8, y: 3.9, w: 8.5, h: 0.7, fontSize: 18, color: C.accent, fontFace: "Calibri" });
  }
  return sl;
}

// ─── Helper: content slide ───────────────────────────────────────────
function contentSlide(title, bullets, opts = {}) {
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.light } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.85, fill: { color: C.navy } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0.85, w: "100%", h: 0.06, fill: { color: C.accent } });
  sl.addText(title, { x: 0.2, y: 0.08, w: 9.6, h: 0.7, fontSize: 22, bold: true, color: C.white, fontFace: "Calibri", valign: "middle" });

  const bx = opts.imgRight ? 0.3 : 0.3;
  const bw = opts.imgRight ? 5.7 : 9.4;
  const by = 1.05;
  const bh = opts.imgRight ? 4.3 : 4.3;

  const items = bullets.map((b, i) => {
    if (typeof b === "object") {
      const arr = [];
      arr.push({ text: b.head, options: { bullet: { type: "bullet" }, bold: true, color: C.navy, fontSize: b.size || 15, breakLine: true, fontFace: "Calibri" } });
      if (b.sub) {
        b.sub.forEach((s, si) => {
          arr.push({ text: "  " + s, options: { bullet: false, color: C.text, fontSize: (b.size || 15) - 1, breakLine: si < b.sub.length - 1, fontFace: "Calibri" } });
        });
      }
      return arr;
    }
    return { text: b, options: { bullet: { type: "bullet" }, color: C.text, fontSize: 14, breakLine: i < bullets.length - 1, fontFace: "Calibri" } };
  }).flat();

  sl.addText(items, { x: bx, y: by, w: bw, h: bh, valign: "top" });

  if (opts.imgRight && opts.imgData) {
    sl.addImage({ data: opts.imgData, x: 6.15, y: 1.05, w: 3.55, h: 4.3 });
  }
  return sl;
}

// ─── Helper: two-column slide ─────────────────────────────────────────
function twoColSlide(title, leftItems, rightItems, leftTitle, rightTitle) {
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.light } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.85, fill: { color: C.navy } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0.85, w: "100%", h: 0.06, fill: { color: C.accent } });
  sl.addText(title, { x: 0.2, y: 0.08, w: 9.6, h: 0.7, fontSize: 22, bold: true, color: C.white, fontFace: "Calibri", valign: "middle" });

  // Left column
  sl.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.0, w: 4.4, h: 4.5, fill: { color: C.white }, line: { color: C.teal, width: 1.5 } });
  sl.addText(leftTitle, { x: 0.3, y: 1.0, w: 4.4, h: 0.45, fontSize: 14, bold: true, color: C.white, fontFace: "Calibri", align: "center", fill: { color: C.teal } });
  sl.addText(leftItems.map((t, i) => ({ text: t, options: { bullet: { type: "bullet" }, color: C.text, fontSize: 13, breakLine: i < leftItems.length - 1, fontFace: "Calibri" } })),
    { x: 0.4, y: 1.5, w: 4.2, h: 3.9, valign: "top" });

  // Right column
  sl.addShape(pres.ShapeType.rect, { x: 5.3, y: 1.0, w: 4.4, h: 4.5, fill: { color: C.white }, line: { color: C.accent, width: 1.5 } });
  sl.addText(rightTitle, { x: 5.3, y: 1.0, w: 4.4, h: 0.45, fontSize: 14, bold: true, color: C.white, fontFace: "Calibri", align: "center", fill: { color: C.accent } });
  sl.addText(rightItems.map((t, i) => ({ text: t, options: { bullet: { type: "bullet" }, color: C.text, fontSize: 13, breakLine: i < rightItems.length - 1, fontFace: "Calibri" } })),
    { x: 5.4, y: 1.5, w: 4.2, h: 3.9, valign: "top" });

  return sl;
}

// ─────────────────────────────────────────────────────────────────────
// SLIDE 1 – TITLE
// ─────────────────────────────────────────────────────────────────────
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 4.6, w: "100%", h: 1.025, fill: { color: C.teal } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 2.1, w: "100%", h: 0.08, fill: { color: C.accent } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 2.18, w: "100%", h: 0.02, fill: { color: C.white } });
  sl.addText("Disorders of the Small Intestine", {
    x: 0.5, y: 0.3, w: 9, h: 1.8, fontSize: 40, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle"
  });
  sl.addText("Clinical Features  •  Investigations  •  Management", {
    x: 0.5, y: 2.3, w: 9, h: 0.7, fontSize: 20, color: C.accent, fontFace: "Calibri", align: "center"
  });
  sl.addText("Including Short Gut Syndrome", {
    x: 0.5, y: 3.05, w: 9, h: 0.55, fontSize: 18, color: C.light, fontFace: "Calibri", align: "center"
  });
  sl.addText("For MBBS Students  |  General Surgery & Medicine", {
    x: 0.5, y: 4.7, w: 9, h: 0.7, fontSize: 15, color: C.white, fontFace: "Calibri", align: "center", valign: "middle"
  });
}

// ─────────────────────────────────────────────────────────────────────
// SLIDE 2 – OVERVIEW / ANATOMY
// ─────────────────────────────────────────────────────────────────────
contentSlide("Anatomy & Overview of Small Intestine", [
  { head: "Three segments: Duodenum | Jejunum | Ileum", sub: ["Total length: 6–7 m in vivo (3 m contracted)", "Duodenum: 25 cm, retroperitoneal, C-shaped"] },
  { head: "Functions", sub: ["Digestion and absorption of nutrients, water, electrolytes", "Immune surveillance (Peyer's patches, IgA secretion)", "Endocrine functions (GIP, CCK, secretin, motilin)"] },
  { head: "Ileum — unique absorptive sites", sub: ["Vitamin B12 (intrinsic factor complex)", "Bile salts (enterohepatic circulation)", "Fat-soluble vitamins A, D, E, K"] },
  { head: "Key disorders covered in this presentation", sub: ["Crohn's disease | Celiac disease | Tropical sprue", "Intestinal obstruction | Intussusception", "Short gut syndrome | SIBO | Intestinal tumors"] },
]);

// ─────────────────────────────────────────────────────────────────────
// SLIDE 3 – SECTION: INFLAMMATORY DISORDERS
// ─────────────────────────────────────────────────────────────────────
sectionSlide("1. Inflammatory Disorders", "Crohn's Disease  •  Celiac Disease  •  Tropical Sprue");

// ─────────────────────────────────────────────────────────────────────
// SLIDE 4 – CROHN'S DISEASE: CLINICAL FEATURES
// ─────────────────────────────────────────────────────────────────────
contentSlide("Crohn's Disease – Clinical Features", [
  { head: "Definition", sub: ["Transmural, granulomatous, skip-lesion inflammation — anywhere from mouth to anus", "Most common in terminal ileum (ileitis) and ileocaecal region"] },
  { head: "Symptoms (small intestine involvement)", sub: ["Abdominal pain: postprandial, crampy (partial obstruction) in 90%", "Diarrhoea (non-bloody in SI disease), weight loss, anorexia", "Palpable RLQ mass (thickened bowel / abscess / phlegmon)"] },
  { head: "Complications", sub: ["Strictures → bowel obstruction; Fistulas (enteroenteric, enterovesical, enterovaginal)", "Abscess formation; Perianal disease (fissures, fistulas, skin tags) in ~40%"] },
  { head: "Extraintestinal manifestations", sub: ["Joints: ankylosing spondylitis, sacroiliitis, seronegative polyarthritis", "Skin: erythema nodosum, pyoderma gangrenosum", "Eyes: uveitis, episcleritis; Liver: primary sclerosing cholangitis (rare)"] },
]);

// ─────────────────────────────────────────────────────────────────────
// SLIDE 5 – CROHN'S DISEASE: INVESTIGATIONS & MANAGEMENT
// ─────────────────────────────────────────────────────────────────────
twoColSlide("Crohn's Disease – Investigations & Management",
  ["Bloods: FBC (anaemia), ESR/CRP, albumin (low)", "Stool: culture, C. diff toxin, faecal calprotectin ↑↑", "Endoscopy: ileoscopy — cobblestone mucosa, skip lesions, deep ulcers", "CT/MRI enterography: wall thickening, creeping fat, fistulas", "Barium follow-through: string sign of Kantor (stricture)", "Histology: transmural inflammation, non-caseating granulomas"],
  ["5-ASA (mild), corticosteroids (moderate flare)", "Immunomodulators: azathioprine, 6-MP (maintenance)", "Biologics: anti-TNF (infliximab, adalimumab)", "Surgery: resection for obstruction, fistulas, abscess (conservative — preserve bowel)", "Nutritional support: elemental diet, TPN if severe", "Monitor: colonoscopy for dysplasia after 10 yrs"],
  "Investigations", "Management"
);

// ─────────────────────────────────────────────────────────────────────
// SLIDE 6 – CELIAC DISEASE
// ─────────────────────────────────────────────────────────────────────
contentSlide("Celiac Disease (Gluten-Sensitive Enteropathy)", [
  { head: "Pathophysiology", sub: ["Autoimmune enteropathy triggered by gluten (wheat/barley/rye) in genetically predisposed (HLA-DQ2/DQ8)", "IgA anti-gliadin, anti-endomysial (EMA), anti-tTG antibodies → villous atrophy"] },
  { head: "Clinical Features", sub: ["Classic: diarrhoea, steatorrhoea, bloating, weight loss, failure to thrive (children)", "Atypical: iron-deficiency anaemia, osteoporosis, dermatitis herpetiformis, infertility", "Silent: asymptomatic, found on screening"] },
  { head: "Investigations", sub: ["Serology: anti-tTG IgA (sensitivity ~95%), IgA level (exclude deficiency)", "Endoscopy + duodenal biopsy: villous atrophy, crypt hyperplasia, intraepithelial lymphocytes (Marsh III)", "HLA typing (DQ2/DQ8 — high NPV to exclude)"] },
  { head: "Management", sub: ["Strict lifelong gluten-free diet — cornerstone of treatment", "Nutritional supplementation: iron, folate, B12, calcium, vitamin D", "Refractory celiac: corticosteroids, azathioprine"] },
]);

// ─────────────────────────────────────────────────────────────────────
// SLIDE 7 – TROPICAL SPRUE
// ─────────────────────────────────────────────────────────────────────
contentSlide("Tropical Sprue", [
  { head: "Definition", sub: ["Acquired malabsorption disorder in residents of / visitors to tropical regions", "Likely caused by bacterial overgrowth (enterotoxigenic organisms + folate depletion)"] },
  { head: "Clinical Features", sub: ["Diarrhoea (3–10 loose stools/day), steatorrhoea, weight loss", "Macrocytic / megaloblastic anaemia (folate/B12 deficiency)", "Glossitis, oedema, wasting"] },
  { head: "Investigations", sub: ["Blood: megaloblastic anaemia, low serum folate & B12", "D-xylose absorption test: reduced absorption (villous atrophy)", "Biopsy: partial villous atrophy (less severe than celiac), not IgA mediated", "Stool: fat globules, no parasites"] },
  { head: "Management", sub: ["Folic acid + B12 replacement (2–3 months)", "Tetracycline 250 mg QID for 3–6 months (eradicates bacterial overgrowth)", "Response expected within weeks; most achieve full remission"] },
]);

// ─────────────────────────────────────────────────────────────────────
// SLIDE 8 – SECTION: OBSTRUCTIVE DISORDERS
// ─────────────────────────────────────────────────────────────────────
sectionSlide("2. Obstructive Disorders", "Intestinal Obstruction  •  Intussusception  •  Volvulus");

// ─────────────────────────────────────────────────────────────────────
// SLIDE 9 – INTESTINAL OBSTRUCTION (with image)
// ─────────────────────────────────────────────────────────────────────
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.light } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.85, fill: { color: C.navy } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0.85, w: "100%", h: 0.06, fill: { color: C.accent } });
  sl.addText("Intestinal Obstruction – Small Bowel", { x: 0.2, y: 0.08, w: 9.6, h: 0.7, fontSize: 22, bold: true, color: C.white, fontFace: "Calibri", valign: "middle" });

  const bullets = [
    { head: "Causes (80%: hernias, adhesions, intussusception, volvulus)", sub: ["Adhesions (MC in adults — post-surgical)", "Hernias (inguinal, femoral, incisional)", "Neoplasms; Crohn's strictures; Gallstone ileus"] },
    { head: "Clinical Features", sub: ["Colicky abdominal pain, vomiting (bilious early), abdominal distension", "Absolute constipation (no flatus/stool) in complete obstruction", "High-pitched tinkling bowel sounds early; silent in strangulation"] },
    { head: "Investigations", sub: ["X-ray abdomen: dilated loops, air-fluid levels, no gas in colon", "CT abdomen: transition point, identify cause, detect strangulation", "USS: dilated bowel, peristalsis assessment"] },
    { head: "Management", sub: ["Conservative: NBM, NG tube (decompression), IV fluids, electrolyte correction", "Surgery: if strangulation, perforation, or failed conservative — resection/adhesiolysis"] },
  ];

  const items = bullets.map(b => {
    const arr = [];
    arr.push({ text: b.head, options: { bullet: { type: "bullet" }, bold: true, color: C.navy, fontSize: 14, breakLine: true, fontFace: "Calibri" } });
    b.sub.forEach((s, si) => {
      arr.push({ text: "  " + s, options: { bullet: false, color: C.text, fontSize: 13, breakLine: true, fontFace: "Calibri" } });
    });
    return arr;
  }).flat();
  // remove last breakLine
  if (items.length > 0) items[items.length - 1].options.breakLine = false;
  sl.addText(items, { x: 0.3, y: 1.05, w: 5.7, h: 4.4, valign: "top" });

  if (obsImg) {
    sl.addImage({ data: obsImg, x: 6.2, y: 1.1, w: 3.5, h: 3.5 });
    sl.addText("FIG: Four major causes of intestinal obstruction\n(Robbins & Kumar Basic Pathology)", {
      x: 6.1, y: 4.6, w: 3.7, h: 0.7, fontSize: 9, color: C.subtext, fontFace: "Calibri", italic: true, align: "center"
    });
  }
}

// ─────────────────────────────────────────────────────────────────────
// SLIDE 10 – INTUSSUSCEPTION
// ─────────────────────────────────────────────────────────────────────
contentSlide("Intussusception", [
  { head: "Definition", sub: ["Telescoping of a proximal bowel segment (intussusceptum) into the distal segment (intussuscipiens)", "MC cause of intestinal obstruction in children < 2 years"] },
  { head: "Types", sub: ["Idiopathic (infants — reactive Peyer's patch hyperplasia; rotavirus association)", "Secondary to lead point: Meckel's diverticulum, polyp, lymphoma (older children/adults)"] },
  { head: "Clinical Features", sub: ["Classic triad: colicky abdominal pain, redcurrant jelly stools, palpable sausage-shaped mass (RUQ)", "Vomiting, lethargy, intermittent pain episodes", "Dance sign: emptiness in RIF (mass moved toward right)"] },
  { head: "Investigations & Management", sub: ["USS: target sign / doughnut sign (concentric rings)", "Contrast/air enema: diagnostic AND therapeutic (80–90% success in children)", "Surgery if peritonitis, failed reduction, or lead point identified (adults)"] },
]);

// ─────────────────────────────────────────────────────────────────────
// SLIDE 11 – SECTION: NUTRITIONAL/ABSORPTIVE DISORDERS
// ─────────────────────────────────────────────────────────────────────
sectionSlide("3. Malabsorption & Nutritional Disorders", "Short Gut Syndrome  •  SIBO  •  Whipple's Disease");

// ─────────────────────────────────────────────────────────────────────
// SLIDE 12 – SHORT GUT SYNDROME (PATHOPHYSIOLOGY)
// ─────────────────────────────────────────────────────────────────────
contentSlide("Short Gut Syndrome (SGS) – Pathophysiology", [
  { head: "Definition", sub: ["Clinical state where residual intestine cannot maintain adequate absorption of nutrients, fluids, and electrolytes", "Usually follows massive small bowel resection (>50% loss)"] },
  { head: "Common causes", sub: ["Adults: Crohn's disease (most common), mesenteric ischaemia/infarction, trauma, radiation enteritis", "Neonates/Paediatric: NEC (35%), intestinal atresia (25%), gastroschisis (18%), midgut volvulus (14%)"] },
  { head: "Key determinants of outcome", sub: ["Residual bowel length: ≥35–40 cm → 50% chance of weaning off TPN", "Each additional cm increases enteral autonomy rate by 4%", "Presence of ileocaecal valve (acts as surrogate for terminal ileum)", "Colon in continuity: essential for water/electrolyte salvage"] },
  { head: "Intestinal adaptation", sub: ["Physiologic process post-resection: villous hyperplasia, crypt deepening, bowel dilation", "Takes weeks to months; enhanced by enteral feeding and growth factors (GLP-2/teduglutide)"] },
]);

// ─────────────────────────────────────────────────────────────────────
// SLIDE 13 – SHORT GUT SYNDROME: CLINICAL FEATURES & INVESTIGATIONS
// ─────────────────────────────────────────────────────────────────────
contentSlide("Short Gut Syndrome – Clinical Features & Investigations", [
  { head: "Clinical features", sub: ["High-volume diarrhoea / steatorrhoea, dehydration, electrolyte imbalances", "Weight loss, malnutrition, fatigue", "Fat-soluble vitamin deficiencies (A, D, E, K) → coagulopathy, metabolic bone disease", "Vitamin B12 deficiency (ileal loss) → macrocytic anaemia", "D-lactic acidosis (colonic bacterial fermentation) → confusion, ataxia"] },
  { head: "Complications of TPN dependence", sub: ["Catheter-related bloodstream infections (CRBSI)", "TPN-associated liver disease / cholestasis → cirrhosis", "Gallstones (biliary stasis, 100% incidence in severe cases on long-term TPN)", "Metabolic bone disease"] },
  { head: "Investigations", sub: ["Bloods: FBC, LFTs, renal function, electrolytes, vitamins (B12, folate, D, A, E, K)", "Serum zinc, selenium, magnesium, phosphate", "Bone densitometry (DEXA) for osteoporosis; USS liver/gallbladder", "72-hour faecal fat collection (confirms steatorrhoea)", "Barium/CT enterography to assess residual bowel length and anatomy"] },
]);

// ─────────────────────────────────────────────────────────────────────
// SLIDE 14 – SHORT GUT SYNDROME: MANAGEMENT (with image)
// ─────────────────────────────────────────────────────────────────────
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.light } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.85, fill: { color: C.navy } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0.85, w: "100%", h: 0.06, fill: { color: C.accent } });
  sl.addText("Short Gut Syndrome – Principles of Management", { x: 0.2, y: 0.08, w: 9.6, h: 0.7, fontSize: 22, bold: true, color: C.white, fontFace: "Calibri", valign: "middle" });

  // Phases boxes
  const phases = [
    { label: "Phase 1\n(0–3 wks)", text: "Total parenteral nutrition (TPN)\nIV fluid & electrolyte replacement\nAntidiarrhoeals (loperamide, codeine)", col: C.red },
    { label: "Phase 2\n(3 wks–1 yr)", text: "Gradual introduction of oral/enteral feeds\nTPN weaned as tolerance improves\nTrophic feeds stimulate adaptation", col: C.teal },
    { label: "Phase 3\n(>1 yr)", text: "Enteral autonomy if bowel adapts\nTeduglutide (GLP-2 analogue) to enhance adaptation\nProkinetics / antisecretory agents", col: C.green },
  ];

  phases.forEach((p, i) => {
    const x = 0.3 + i * 3.2;
    sl.addShape(pres.ShapeType.rect, { x, y: 1.0, w: 3.0, h: 0.5, fill: { color: p.col } });
    sl.addText(p.label, { x, y: 1.0, w: 3.0, h: 0.5, fontSize: 12, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
    sl.addShape(pres.ShapeType.rect, { x, y: 1.5, w: 3.0, h: 1.5, fill: { color: C.white }, line: { color: p.col, width: 1.5 } });
    sl.addText(p.text, { x: x + 0.08, y: 1.55, w: 2.84, h: 1.4, fontSize: 11, color: C.text, fontFace: "Calibri", valign: "top" });
  });

  // Surgical options
  sl.addText("Surgical Options for Dilated Residual Bowel:", { x: 0.3, y: 3.15, w: 5.5, h: 0.4, fontSize: 14, bold: true, color: C.navy, fontFace: "Calibri" });
  const surgBullets = [
    "Bianchi (LILT): Longitudinal intestinal lengthening — splits bowel into 2 parallel segments, doubles length",
    "STEP (Serial Transverse Enteroplasty): transverse stapling creates zigzag, narrows & lengthens bowel",
    "Small bowel transplantation: last resort for irreversible intestinal failure + TPN complications",
    "Cholecystectomy: prophylactic in long-term TPN patients (100% gallstone risk)",
  ];
  sl.addText(surgBullets.map((t, i) => ({ text: t, options: { bullet: { type: "bullet" }, color: C.text, fontSize: 12, breakLine: i < surgBullets.length - 1, fontFace: "Calibri" } })),
    { x: 0.3, y: 3.55, w: 5.6, h: 1.9, valign: "top" });

  if (stepImg) {
    sl.addImage({ data: stepImg, x: 6.15, y: 3.1, w: 3.55, h: 2.35 });
    sl.addText("FIG: Bianchi (A) & STEP (B) bowel-lengthening procedures\n(Sabiston Textbook of Surgery)", {
      x: 6.05, y: 5.45, w: 3.7, h: 0.4, fontSize: 9, color: C.subtext, fontFace: "Calibri", italic: true, align: "center"
    });
  }
}

// ─────────────────────────────────────────────────────────────────────
// SLIDE 15 – SIBO (Small Intestinal Bacterial Overgrowth)
// ─────────────────────────────────────────────────────────────────────
contentSlide("Small Intestinal Bacterial Overgrowth (SIBO)", [
  { head: "Definition", sub: [">10^5 CFU/mL organisms in proximal small intestine", "Normally kept low by gastric acid, peristalsis, IgA, ileocaecal valve"] },
  { head: "Causes / Predisposing factors", sub: ["Hypomotility: scleroderma, diabetic autonomic neuropathy, post-surgical (Roux-en-Y, blind loops)", "Anatomical: strictures, diverticula, fistulas, SGS", "Achlorhydria (PPI use, gastric surgery); Immunodeficiency"] },
  { head: "Clinical Features", sub: ["Bloating, abdominal discomfort, diarrhoea, steatorrhoea", "Fat-soluble vitamin and B12 deficiency", "D-lactic acidosis (short bowel + colon in continuity)"] },
  { head: "Investigations & Management", sub: ["Hydrogen/methane breath test (lactulose or glucose) — elevated H2/CH4 at <90 min", "Gold standard: jejunal aspirate & culture (>10^5 CFU/mL)", "Rifaximin 550 mg TDS × 14 days (first line); also metronidazole, ciprofloxacin", "Address underlying cause; rotating antibiotics for recurrent SIBO"] },
]);

// ─────────────────────────────────────────────────────────────────────
// SLIDE 16 – SECTION: TUMOURS
// ─────────────────────────────────────────────────────────────────────
sectionSlide("4. Tumours of the Small Intestine", "Benign  •  Malignant  •  Carcinoid / NET");

// ─────────────────────────────────────────────────────────────────────
// SLIDE 17 – SMALL BOWEL TUMOURS
// ─────────────────────────────────────────────────────────────────────
twoColSlide("Small Bowel Tumours – Overview",
  ["Adenoma (tubular/villous — duodenum)", "Leiomyoma / GIST (stromal)", "Lipoma (submucosal)", "Brunner's gland hyperplasia", "Peutz-Jeghers hamartomas (hamartomatous polyps)", "Haemangioma (cause of GI bleeding)"],
  ["Adenocarcinoma (most common malignant — duodenum/jejunum)", "Carcinoid / NET: ileum MC site; secretes serotonin — carcinoid syndrome", "Lymphoma (MALT type; increased risk in celiac)", "GIST (KIT/PDGFRA mutation; CD117+)", "Metastases (melanoma, lung, breast)"],
  "Benign Tumours", "Malignant Tumours"
);

// ─────────────────────────────────────────────────────────────────────
// SLIDE 18 – CARCINOID / NET & INVESTIGATIONS
// ─────────────────────────────────────────────────────────────────────
contentSlide("Carcinoid Syndrome & Small Bowel Tumour Investigations", [
  { head: "Carcinoid Syndrome (when liver metastases present)", sub: ["Episodic flushing, secretory diarrhoea, bronchospasm, right-sided valvular disease (tricuspid)", "Elevated urinary 5-HIAA (>25 mg/24h)", "Serum chromogranin A (tumour marker)"] },
  { head: "Investigations for small bowel tumours", sub: ["CT/MRI enterography: mass, lymphadenopathy, liver metastases", "Capsule endoscopy: best for mid-gut tumours (no biopsy)", "Double-balloon enteroscopy: biopsy + therapy", "Octreotide scan (Ga-68 DOTANOC PET/CT for NETs)", "Upper GI endoscopy + biopsy for duodenal tumours"] },
  { head: "Management principles", sub: ["Surgical resection (curative for localised disease)", "Somatostatin analogues (octreotide/lanreotide) for carcinoid syndrome control", "PRRT (Peptide Receptor Radionuclide Therapy) for metastatic NETs", "Imatinib/sunitinib for GIST; R-CHOP for lymphoma"] },
]);

// ─────────────────────────────────────────────────────────────────────
// SLIDE 19 – SUMMARY TABLE
// ─────────────────────────────────────────────────────────────────────
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.light } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.85, fill: { color: C.navy } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0.85, w: "100%", h: 0.06, fill: { color: C.accent } });
  sl.addText("Summary: At-a-Glance", { x: 0.2, y: 0.08, w: 9.6, h: 0.7, fontSize: 22, bold: true, color: C.white, fontFace: "Calibri", valign: "middle" });

  const rows = [
    ["Condition", "Key Feature", "Diagnostic Test", "Management"],
    ["Crohn's disease", "Transmural, skip lesions, RLQ pain", "CT enterography, ileoscopy", "5-ASA → steroids → biologics"],
    ["Celiac disease", "Gluten enteropathy, villous atrophy", "Anti-tTG IgA + duodenal biopsy", "Lifelong gluten-free diet"],
    ["Tropical sprue", "Tropical region, megaloblastic anaemia", "D-xylose test, biopsy", "Folic acid + tetracycline"],
    ["Intestinal obstruction", "Colicky pain, distension, vomiting", "AXR air-fluid levels, CT", "NBM + NGT; surgery if needed"],
    ["Intussusception", "Redcurrant jelly stool, RUQ mass", "USS target sign", "Air/contrast enema; surgery"],
    ["Short gut syndrome", "Diarrhoea, malnutrition, TPN dependence", "Serum vitamins, CT enterography", "TPN → enteral feeds; STEP/Bianchi"],
    ["SIBO", "Bloating, B12 deficiency, H2 breath test +", "Breath test / jejunal aspirate", "Rifaximin × 14 days"],
    ["Carcinoid/NET", "Flushing, diarrhoea, 5-HIAA ↑", "Octreotide scan, chromogranin A", "Resection + octreotide"],
  ];

  const colW = [1.9, 2.3, 2.5, 2.8];
  const startX = 0.25;
  const startY = 1.0;
  const rowH = 0.46;

  rows.forEach((row, ri) => {
    row.forEach((cell, ci) => {
      const x = startX + colW.slice(0, ci).reduce((a, b) => a + b, 0);
      const y = startY + ri * rowH;
      const isHeader = ri === 0;
      sl.addShape(pres.ShapeType.rect, {
        x, y, w: colW[ci], h: rowH,
        fill: { color: isHeader ? C.teal : (ri % 2 === 0 ? C.white : "D9EFF3") },
        line: { color: C.teal, width: 0.5 }
      });
      sl.addText(cell, {
        x: x + 0.05, y: y + 0.03, w: colW[ci] - 0.1, h: rowH - 0.06,
        fontSize: isHeader ? 11 : 10,
        bold: isHeader,
        color: isHeader ? C.white : C.text,
        fontFace: "Calibri",
        valign: "middle"
      });
    });
  });
}

// ─────────────────────────────────────────────────────────────────────
// SLIDE 20 – THANK YOU / KEY TAKEAWAYS
// ─────────────────────────────────────────────────────────────────────
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 3.8, w: "100%", h: 1.825, fill: { color: C.teal } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 3.75, w: "100%", h: 0.08, fill: { color: C.accent } });
  sl.addText("Key Takeaways", { x: 0.5, y: 0.25, w: 9, h: 0.7, fontSize: 30, bold: true, color: C.accent, fontFace: "Calibri", align: "center" });

  const takeaways = [
    "Crohn's: transmural skip lesions — think complications (stricture, fistula, abscess)",
    "Celiac: anti-tTG + biopsy — treat with STRICT lifelong gluten-free diet",
    "Short gut syndrome: >50% resection → TPN dependence; bowel adapts over months",
    "Intestinal obstruction: closed-loop & strangulation = surgical emergency",
    "SGS surgery: STEP procedure or Bianchi to lengthen and narrow dilated bowel",
    "Carcinoid tumours: ileum is MC site; carcinoid syndrome only with liver metastases",
  ];

  sl.addText(takeaways.map((t, i) => ({
    text: "✦  " + t,
    options: { bullet: false, color: C.white, fontSize: 14, breakLine: i < takeaways.length - 1, fontFace: "Calibri" }
  })), { x: 0.6, y: 1.05, w: 8.8, h: 2.6, valign: "top" });

  sl.addText("Thank You", { x: 0.5, y: 3.85, w: 9, h: 0.6, fontSize: 26, bold: true, color: C.white, fontFace: "Calibri", align: "center" });
  sl.addText("References: Sabiston Surgery 21e  |  Robbins Basic Pathology 11e  |  Sleisenger & Fordtran GI  |  Maingot's Abdominal Operations", {
    x: 0.5, y: 4.5, w: 9, h: 0.7, fontSize: 10, color: "D0E8EF", fontFace: "Calibri", align: "center"
  });
}

pres.writeFile({ fileName: "/home/daytona/workspace/small-intestine-ppt/Small_Intestine_Disorders.pptx" })
  .then(() => console.log("DONE"))
  .catch(e => console.error(e));
Editing File

~/small-intestine-ppt/create_pptx.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/small-intestine-ppt/create_pptx.js'
Running Command

cat > /home/daytona/workspace/small-intestine-ppt/create_pptx.js << 'JSEOF' cons…

Running Command

cd /home/daytona/workspace/small-intestine-ppt && node create_pptx.js

Running Command

cd /home/daytona/workspace/small-intestine-ppt && curl -s -o obs_img.png "https:…

Running Command

cd /home/daytona/workspace/small-intestine-ppt && sed -i 's|// Fetch images.*||'…

Running Command

cd /home/daytona/workspace/small-intestine-ppt && node -e " const pptxgen = requ…

Running Command

cat > /home/daytona/workspace/small-intestine-ppt/build_final.js << 'JSEOF' cons…

Running Command

cd /home/daytona/workspace/small-intestine-ppt && node build_final.js && ls -lh …

This is a shared conversation. Sign in to Orris to start your own chat.