Make a ppt on Hand functions

Reading File
Reading File
Reading File
Finding Sources
Searching Images

hand anatomy grip prehension function

Finding Sources
Searching Images

types of grip power precision pinch hand

Reading File
Reading File
Searching Images

hand muscles intrinsic extrinsic anatomy thenar hypothenar

Finding Sources
Searching Images

hand nerve supply median ulnar radial sensory motor

Running Command

ls /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or not found"

Writing File

~/hand-functions-ppt/create_ppt.js

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

// Fetch images
const imageUrls = [
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_c275dc8a74e2d34595773ec1886892bc9b97ba7d17d3dbed151845f44d2c91fd.jpg", // grip types
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_544fd190ccecf089003cda227a8380b0c9ee84c2bc4dd58effc5316a71dd14b6.jpg", // nerve supply
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_c6a9d6ca410c67bb3679909b3bac119073963164a97ed8a055ffa727d4489312.jpg", // nerve motor exam
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_adb9103eeeb4ac1500aacc4d7153b51028252c0f2f580eaa4de8c1e6ca82b72a.jpg", // grip release test
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_49eb3e2968908c35381d486f0788caeaadba4b42d06518908d0d371d47c0655c.jpg", // hand gestures
];

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(i => i.error ? "FAILED" : "OK"));
} catch(e) {
  console.error("Image fetch failed:", e.message);
  images = imageUrls.map(() => ({ base64: null, error: "fetch failed" }));
}

// ─── Color Palette ────────────────────────────────────────────────
const C = {
  navy:    "0D2B55",   // dominant dark bg
  teal:    "1B7F8E",   // accent bars
  gold:    "E8A838",   // highlight / accent text
  white:   "FFFFFF",
  offWhite:"F0F4F8",
  light:   "B8D4E3",
  mid:     "4A7A99",
  dark:    "061828",
};

let pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title  = "Hand Functions";
pres.author = "Orris Medical";

// ═══════════════════════════════════════════════════════════════════
// HELPER FUNCTIONS
// ═══════════════════════════════════════════════════════════════════
function addSlideHeader(slide, title, subtitle) {
  // Dark header bar
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 10, h: 0.75,
    fill: { color: C.navy },
    line: { color: C.navy },
  });
  // Teal accent strip
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0.75, w: 10, h: 0.06,
    fill: { color: C.teal },
    line: { color: C.teal },
  });
  slide.addText(title, {
    x: 0.3, y: 0.05, w: 9.4, h: 0.65,
    fontSize: 22, bold: true, color: C.white, valign: "middle", margin: 0,
  });
  if (subtitle) {
    slide.addText(subtitle, {
      x: 0.3, y: 0.05, w: 9.4, h: 0.65,
      fontSize: 13, color: C.light, valign: "middle", align: "right", margin: 0,
    });
  }
}

function addFooter(slide, text) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 5.35, w: 10, h: 0.275,
    fill: { color: C.dark },
    line: { color: C.dark },
  });
  slide.addText(text, {
    x: 0.3, y: 5.35, w: 9.4, h: 0.275,
    fontSize: 9, color: C.light, valign: "middle", margin: 0,
  });
}

function bulletList(items, opts) {
  return items.map((item, i) => ({
    text: item,
    options: {
      bullet: { type: "bullet", indent: 15 },
      color: opts.color || C.dark,
      fontSize: opts.fontSize || 14,
      breakLine: i < items.length - 1,
      bold: opts.bold || false,
    },
  }));
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE SLIDE
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();

  // Full bg
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 10, h: 5.625,
    fill: { color: C.navy }, line: { color: C.navy },
  });

  // Decorative teal diagonal band
  s.addShape(pres.ShapeType.rect, {
    x: 6.5, y: 0, w: 3.5, h: 5.625,
    fill: { color: C.teal }, line: { color: C.teal },
    rotate: 0,
  });
  s.addShape(pres.ShapeType.rtTriangle, {
    x: 5.2, y: 0, w: 1.5, h: 5.625,
    fill: { color: C.teal }, line: { color: C.teal },
  });

  // Gold accent bar
  s.addShape(pres.ShapeType.rect, {
    x: 0.4, y: 2.2, w: 4.5, h: 0.08,
    fill: { color: C.gold }, line: { color: C.gold },
  });

  // Main title
  s.addText("HAND FUNCTIONS", {
    x: 0.4, y: 0.8, w: 5.8, h: 1.2,
    fontSize: 40, bold: true, color: C.white,
    charSpacing: 3, valign: "middle", margin: 0,
  });

  // Subtitle
  s.addText("Anatomy • Grip Types • Nerve Supply • Clinical Assessment", {
    x: 0.4, y: 2.35, w: 5.8, h: 0.6,
    fontSize: 14, color: C.light, valign: "top", margin: 0,
  });

  // Tagline
  s.addText("The hand — a mechanical and sensory tool", {
    x: 0.4, y: 3.1, w: 5.2, h: 0.5,
    fontSize: 12, italic: true, color: C.gold, valign: "top", margin: 0,
  });

  // Right panel text overlay
  s.addText("Gray's Anatomy for Students", {
    x: 6.6, y: 4.8, w: 3.1, h: 0.4,
    fontSize: 9, color: "CCEEFF", align: "center", valign: "middle", margin: 0,
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 2 — OVERVIEW / TABLE OF CONTENTS
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{color: C.offWhite}, line:{color: C.offWhite} });
  addSlideHeader(s, "Overview", "Hand Functions");

  const topics = [
    { num: "01", title: "Anatomy of the Hand", desc: "Bones, joints, compartments" },
    { num: "02", title: "Intrinsic & Extrinsic Muscles", desc: "Thenar, hypothenar, interossei, lumbricals" },
    { num: "03", title: "Types of Grip & Prehension", desc: "Power grip, precision grip, pinch" },
    { num: "04", title: "Nerve Supply", desc: "Median, ulnar, radial innervation" },
    { num: "05", title: "Thumb Function", desc: "Opposition, the most important digit" },
    { num: "06", title: "Sensory Function", desc: "Two-point discrimination, tactile feedback" },
    { num: "07", title: "Clinical Assessment", desc: "Grip strength, dexterity tests, nerve exam" },
  ];

  topics.forEach((t, i) => {
    const col = i < 4 ? 0 : 1;
    const row = i < 4 ? i : i - 4;
    const x = col === 0 ? 0.3 : 5.3;
    const y = 1.0 + row * 1.05;

    // Card bg
    s.addShape(pres.ShapeType.roundRect, {
      x: x, y: y, w: 4.6, h: 0.88,
      fill: { color: C.navy }, line: { color: C.teal }, rectRadius: 0.05,
    });
    // Number badge
    s.addShape(pres.ShapeType.rect, {
      x: x, y: y, w: 0.48, h: 0.88,
      fill: { color: C.teal }, line: { color: C.teal },
    });
    s.addText(t.num, {
      x: x, y: y, w: 0.48, h: 0.88,
      fontSize: 14, bold: true, color: C.white, align: "center", valign: "middle", margin: 0,
    });
    s.addText(t.title, {
      x: x + 0.55, y: y + 0.05, w: 3.9, h: 0.38,
      fontSize: 13, bold: true, color: C.white, valign: "middle", margin: 0,
    });
    s.addText(t.desc, {
      x: x + 0.55, y: y + 0.45, w: 3.9, h: 0.35,
      fontSize: 10, color: C.light, valign: "top", margin: 0,
    });
  });

  addFooter(s, "Hand Functions  |  Anatomy & Clinical Medicine");
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 3 — ANATOMY OF THE HAND
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{color: C.offWhite}, line:{color: C.offWhite} });
  addSlideHeader(s, "Anatomy of the Hand", "Bones & Structure");

  // Left column — content
  s.addShape(pres.ShapeType.rect, { x:0.3, y:0.92, w:5.6, h:0.36,
    fill:{color: C.navy}, line:{color: C.navy} });
  s.addText("Three Regions of the Hand", {
    x:0.3, y:0.92, w:5.6, h:0.36,
    fontSize:14, bold:true, color:C.gold, valign:"middle", margin:8,
  });

  const regions = [
    { label: "Carpus (Wrist)", items: [
      "8 carpal bones in 2 rows",
      "Proximal: Scaphoid, Lunate, Triquetrum, Pisiform",
      "Distal: Trapezium, Trapezoid, Capitate, Hamate",
    ]},
    { label: "Metacarpus", items: [
      "5 metacarpal bones (I–V)",
      "Form the bony framework of the palm",
      "Metacarpal I (thumb) has increased CMC joint mobility",
    ]},
    { label: "Digits (Fingers)", items: [
      "Thumb: 2 phalanges (proximal + distal)",
      "Fingers: 3 phalanges each (proximal, middle, distal)",
      "Normal resting: flexed arcade, little > index",
    ]},
  ];

  let yPos = 1.35;
  regions.forEach(r => {
    s.addText(r.label, {
      x:0.4, y:yPos, w:5.3, h:0.28,
      fontSize:12, bold:true, color:C.teal, margin:0, valign:"middle",
    });
    yPos += 0.28;
    r.items.forEach(item => {
      s.addText(`• ${item}`, {
        x:0.55, y:yPos, w:5.15, h:0.26,
        fontSize:10.5, color:C.dark, margin:0, valign:"top",
      });
      yPos += 0.26;
    });
    yPos += 0.08;
  });

  // Right: Key fact boxes
  const facts = [
    { title: "Joints", body: "CMC • MCP\nPIP • DIP" },
    { title: "Thumb", body: "Rotated 90°\nto other digits" },
    { title: "Arches", body: "Longitudinal &\nTransverse arches" },
    { title: "Surface", body: "Palmar (anterior)\n& Dorsal" },
  ];
  facts.forEach((f, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 6.2 + col * 1.82;
    const y = 1.0 + row * 1.52;
    s.addShape(pres.ShapeType.roundRect, {
      x, y, w:1.7, h:1.35,
      fill:{color: C.navy}, line:{color: C.teal}, rectRadius:0.07,
    });
    s.addShape(pres.ShapeType.rect, {
      x, y, w:1.7, h:0.35,
      fill:{color: C.teal}, line:{color: C.teal},
    });
    s.addText(f.title, {
      x, y, w:1.7, h:0.35,
      fontSize:11, bold:true, color:C.white, align:"center", valign:"middle", margin:0,
    });
    s.addText(f.body, {
      x, y:y+0.38, w:1.7, h:0.9,
      fontSize:11, color:C.white, align:"center", valign:"middle", margin:0,
    });
  });

  addFooter(s, "Source: Gray's Anatomy for Students  |  Hand: Bones & Joints");
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 4 — INTRINSIC & EXTRINSIC MUSCLES
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{color: C.offWhite}, line:{color: C.offWhite} });
  addSlideHeader(s, "Muscles of the Hand", "Intrinsic & Extrinsic");

  // Two column layout
  const cols = [
    {
      title: "INTRINSIC MUSCLES",
      color: C.teal,
      groups: [
        { label: "Thenar Group (Median N.)", items: ["Abductor pollicis brevis", "Flexor pollicis brevis", "Opponens pollicis", "Adductor pollicis (Ulnar N.)"] },
        { label: "Hypothenar Group (Ulnar N.)", items: ["Abductor digiti minimi", "Flexor digiti minimi brevis", "Opponens digiti minimi"] },
        { label: "Deep Intrinsics (Ulnar N.)", items: ["4 Dorsal interossei — ABduction", "3 Palmar interossei — ADduction", "4 Lumbricals — MCP flex, IP extend"] },
      ]
    },
    {
      title: "EXTRINSIC MUSCLES",
      color: C.gold,
      groups: [
        { label: "Flexors (from forearm)", items: ["Flexor digitorum superficialis", "Flexor digitorum profundus", "Flexor pollicis longus"] },
        { label: "Extensors (from forearm)", items: ["Extensor digitorum communis", "Extensor indicis", "Extensor digiti minimi", "Extensor pollicis longus/brevis"] },
        { label: "Mnemonic", items: ["DAB = Dorsal interossei ABduct", "PAD = Palmar interossei ADduct"] },
      ]
    }
  ];

  cols.forEach((col, ci) => {
    const x = ci === 0 ? 0.25 : 5.15;
    s.addShape(pres.ShapeType.rect, {
      x, y:0.85, w:4.65, h:0.36,
      fill:{color: ci===0 ? C.navy : C.navy}, line:{color: ci===0 ? C.teal : C.gold},
    });
    s.addText(col.title, {
      x, y:0.85, w:4.65, h:0.36,
      fontSize:13, bold:true, color: ci===0 ? C.teal : C.gold, align:"center", valign:"middle", margin:0,
    });

    let yPos = 1.28;
    col.groups.forEach(g => {
      s.addText(g.label, {
        x:x+0.05, y:yPos, w:4.5, h:0.26,
        fontSize:11, bold:true, color:ci===0 ? C.teal : C.gold, margin:0, valign:"middle",
      });
      yPos += 0.26;
      g.items.forEach(item => {
        s.addText(`› ${item}`, {
          x:x+0.2, y:yPos, w:4.3, h:0.235,
          fontSize:10, color:C.dark, margin:0, valign:"top",
        });
        yPos += 0.235;
      });
      yPos += 0.12;
    });
  });

  // Vertical divider
  s.addShape(pres.ShapeType.line, {
    x:5.0, y:0.85, w:0, h:4.5,
    line:{color:C.mid, width:1, dashType:"dash"},
  });

  addFooter(s, "Mnemonic: DAB = Dorsal interossei ABduct  |  PAD = Palmar interossei ADduct");
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 5 — TYPES OF GRIP & PREHENSION (with image)
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{color: C.offWhite}, line:{color: C.offWhite} });
  addSlideHeader(s, "Types of Grip & Prehension", "Power vs. Precision");

  // Left — text content
  const gripData = [
    {
      type: "POWER GRIP",
      color: C.teal,
      desc: "Fingers and thumb wrap around object; whole hand force",
      examples: ["Cylindrical grip — holding a rod/glass", "Spherical grip — holding a ball", "Hook grip — carrying a bag by handle"],
    },
    {
      type: "PRECISION GRIP (Prehension)",
      color: C.gold,
      desc: "Object held between finger pads and thumb; fine control",
      examples: ["Pad-to-pad pinch (palmar pinch)", "Tip-to-tip pinch — fine manipulation", "Lateral (key) pinch — thumb vs. index side", "Tripod pinch — thumb + index + middle"],
    },
    {
      type: "DIGIT ROLES",
      color: C.mid,
      desc: "Each digit has a specialized contribution",
      examples: [
        "Thumb: primary opposing force; 40–50% disability if lost",
        "Index + Middle: pinch precision",
        "Ring + Little: power grip (4th & 5th digits)",
      ],
    },
  ];

  let yPos = 0.95;
  gripData.forEach(g => {
    s.addShape(pres.ShapeType.rect, {
      x:0.25, y:yPos, w:0.08, h:1.35,
      fill:{color:g.color}, line:{color:g.color},
    });
    s.addText(g.type, {
      x:0.4, y:yPos, w:5.1, h:0.3,
      fontSize:12, bold:true, color:g.color, margin:0, valign:"middle",
    });
    s.addText(g.desc, {
      x:0.4, y:yPos+0.3, w:5.1, h:0.28,
      fontSize:10, italic:true, color:C.dark, margin:0, valign:"top",
    });
    g.examples.forEach((ex, ei) => {
      s.addText(`• ${ex}`, {
        x:0.55, y:yPos+0.58+(ei*0.24), w:4.95, h:0.24,
        fontSize:10, color:C.dark, margin:0, valign:"top",
      });
    });
    yPos += 1.5;
  });

  // Right — image
  if (images[0] && !images[0].error) {
    s.addImage({ data: images[0].base64, x: 5.7, y: 0.88, w: 4.0, h: 4.0 });
    s.addShape(pres.ShapeType.rect, {
      x:5.7, y:0.88, w:4.0, h:0.28,
      fill:{color:"00000077"}, line:{color:"00000077"},
    });
    s.addText("Six grasp types used in ADL assessment", {
      x:5.7, y:0.88, w:4.0, h:0.28,
      fontSize:8.5, color:C.white, align:"center", valign:"middle", margin:0,
    });
  }

  addFooter(s, "Source: Roberts & Hedges' Clinical Procedures  |  Thumb loss → 40–50% hand disability");
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 6 — NERVE SUPPLY (with image)
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{color: C.offWhite}, line:{color: C.offWhite} });
  addSlideHeader(s, "Nerve Supply of the Hand", "Median • Ulnar • Radial");

  const nerves = [
    {
      name: "MEDIAN NERVE",
      color: "E07020",
      motor: ["Thenar muscles (APB, FPB, OP)", "Lateral two lumbricals (1st & 2nd)", '"LOAF" muscles mnemonic'],
      sensory: ["Thumb, index, middle, radial half of ring", "Palmar surface (primary)"],
      injury: 'Ape hand deformity; loss of thumb opposition; "Oath hand"',
    },
    {
      name: "ULNAR NERVE",
      color: "C03060",
      motor: ["Hypothenar muscles", "Interossei (all 7)", "Medial two lumbricals (3rd & 4th)", "Adductor pollicis"],
      sensory: ["Little finger & ulnar half of ring finger", "Both palmar and dorsal surfaces"],
      injury: 'Claw hand (ring & little); Froment\'s sign; loss of grip power',
    },
    {
      name: "RADIAL NERVE",
      color: "407840",
      motor: ["Wrist & finger extensors (in forearm)", "No intrinsic hand muscles"],
      sensory: ["Dorsum of hand — radial 2/3", "Thumb & proximal digits (dorsal)"],
      injury: 'Wrist drop; intact grip (intrinsics via median/ulnar)',
    },
  ];

  nerves.forEach((n, i) => {
    const x = 0.25 + i * 3.25;
    // Card
    s.addShape(pres.ShapeType.roundRect, {
      x, y:0.92, w:3.1, h:4.42,
      fill:{color: C.navy}, line:{color: n.color, width:2}, rectRadius:0.08,
    });
    // Header
    s.addShape(pres.ShapeType.roundRect, {
      x, y:0.92, w:3.1, h:0.45,
      fill:{color: n.color}, line:{color: n.color}, rectRadius:0.05,
    });
    s.addText(n.name, {
      x, y:0.92, w:3.1, h:0.45,
      fontSize:12, bold:true, color:C.white, align:"center", valign:"middle", margin:0,
    });

    s.addText("Motor", {
      x:x+0.1, y:1.44, w:2.9, h:0.28,
      fontSize:11, bold:true, color: n.color, margin:0, valign:"middle",
    });
    let yy = 1.72;
    n.motor.forEach(m => {
      s.addText(`• ${m}`, {
        x:x+0.15, y:yy, w:2.85, h:0.25,
        fontSize:9.5, color:C.white, margin:0, valign:"top",
      });
      yy += 0.25;
    });

    s.addShape(pres.ShapeType.line, {
      x:x+0.1, y:yy+0.05, w:2.8, h:0,
      line:{color:n.color, width:0.5},
    });
    s.addText("Sensory", {
      x:x+0.1, y:yy+0.1, w:2.9, h:0.28,
      fontSize:11, bold:true, color: n.color, margin:0, valign:"middle",
    });
    yy += 0.38;
    n.sensory.forEach(sens => {
      s.addText(`• ${sens}`, {
        x:x+0.15, y:yy, w:2.85, h:0.28,
        fontSize:9.5, color:C.white, margin:0, valign:"top",
      });
      yy += 0.28;
    });

    s.addShape(pres.ShapeType.rect, {
      x:x+0.05, y:yy+0.08, w:2.95, h:0.04,
      fill:{color: n.color}, line:{color: n.color},
    });
    s.addText("Injury Pattern", {
      x:x+0.1, y:yy+0.15, w:2.9, h:0.26,
      fontSize:10, bold:true, color: C.gold, margin:0, valign:"middle",
    });
    s.addText(n.injury, {
      x:x+0.15, y:yy+0.42, w:2.85, h:0.65,
      fontSize:9, color:C.light, margin:0, valign:"top",
    });
  });

  addFooter(s, "Mnemonic: LOAF = Lumbricals 1&2, Opponens pollicis, Abductor pollicis brevis, Flexor pollicis brevis (all Median N.)");
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 7 — NERVE MAP IMAGE SLIDE
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{color: C.offWhite}, line:{color: C.offWhite} });
  addSlideHeader(s, "Cutaneous Nerve Map of the Hand", "Sensory Territories");

  if (images[1] && !images[1].error) {
    s.addImage({ data: images[1].base64, x:0.5, y:0.88, w:5.0, h:4.2 });
  }

  if (images[2] && !images[2].error) {
    s.addImage({ data: images[2].base64, x:5.7, y:0.88, w:4.0, h:4.0 });
  }

  // Labels
  s.addText("Palmar & Dorsal sensory territories", {
    x:0.5, y:4.95, w:5.0, h:0.35,
    fontSize:10, italic:true, color:C.mid, align:"center", margin:0, valign:"middle",
  });
  s.addText("Motor nerve testing maneuvers\n(Median | Ulnar | Radial)", {
    x:5.7, y:4.75, w:4.0, h:0.5,
    fontSize:10, italic:true, color:C.mid, align:"center", margin:0, valign:"middle",
  });

  // Key box
  const keyItems = [
    { color: "E07020", label: "Median N." },
    { color: "C03060", label: "Ulnar N." },
    { color: "407840", label: "Radial N." },
  ];
  // Embedded color legend
  keyItems.forEach((k, i) => {
    s.addShape(pres.ShapeType.rect, {
      x: 0.6 + i*1.6, y:4.88, w:0.16, h:0.18,
      fill:{color: k.color}, line:{color: k.color},
    });
    s.addText(k.label, {
      x:0.8 + i*1.6, y:4.86, w:1.3, h:0.22,
      fontSize:9, color:C.dark, margin:0, valign:"middle",
    });
  });

  addFooter(s, "Autonomous zones: Middle fingertip = Median  |  Little fingertip = Ulnar  |  1st dorsal webspace = Radial");
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 8 — THUMB FUNCTION
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{color: C.offWhite}, line:{color: C.offWhite} });
  addSlideHeader(s, "Thumb Function", "The Most Important Digit");

  // Central stat
  s.addShape(pres.ShapeType.ellipse, {
    x: 3.9, y: 1.1, w: 2.2, h: 2.2,
    fill:{color: C.navy}, line:{color: C.gold, width:3},
  });
  s.addText("40–50%", {
    x:3.9, y:1.4, w:2.2, h:0.9,
    fontSize:28, bold:true, color:C.gold, align:"center", valign:"middle", margin:0,
  });
  s.addText("disability\nif thumb lost", {
    x:3.9, y:2.25, w:2.2, h:0.65,
    fontSize:11, color:C.white, align:"center", valign:"top", margin:0,
  });

  // Left panels
  const leftItems = [
    { title: "Opposition", body: "Unique multi-plane movement: abduction + flexion + medial rotation. Enables pad-to-pad contact with all fingers." },
    { title: "Thumb Movements", body: "Flexion/Extension in plane of palm\nAbduction/Adduction perpendicular to palm\nOpposition + Reposition" },
    { title: "CMC Joint", body: "Saddle-shaped carpometacarpal joint; highly mobile, enabling the 90° rotation of the thumb relative to the fingers." },
  ];
  leftItems.forEach((item, i) => {
    s.addShape(pres.ShapeType.roundRect, {
      x:0.25, y:1.0+i*1.42, w:3.4, h:1.28,
      fill:{color: C.navy}, line:{color: C.teal}, rectRadius:0.06,
    });
    s.addText(item.title, {
      x:0.35, y:1.05+i*1.42, w:3.2, h:0.3,
      fontSize:12, bold:true, color:C.teal, margin:0, valign:"middle",
    });
    s.addText(item.body, {
      x:0.35, y:1.38+i*1.42, w:3.2, h:0.82,
      fontSize:10, color:C.white, margin:0, valign:"top",
    });
  });

  // Right panels
  const rightItems = [
    { title: "Pollicization", body: "Surgical creation of a thumb from another digit (e.g., index finger) when thumb is amputated/absent." },
    { title: "Replantation Priority", body: "Aggressive replantation attempts warranted for amputated thumbs due to high functional significance." },
    { title: "Nerve Supply", body: "Motor: Median N. (thenar group)\nSensory: Median N. (palmar)\nRadial N. (dorsal base)" },
  ];
  rightItems.forEach((item, i) => {
    s.addShape(pres.ShapeType.roundRect, {
      x:6.35, y:1.0+i*1.42, w:3.4, h:1.28,
      fill:{color: C.navy}, line:{color: C.gold}, rectRadius:0.06,
    });
    s.addText(item.title, {
      x:6.45, y:1.05+i*1.42, w:3.2, h:0.3,
      fontSize:12, bold:true, color:C.gold, margin:0, valign:"middle",
    });
    s.addText(item.body, {
      x:6.45, y:1.38+i*1.42, w:3.2, h:0.82,
      fontSize:10, color:C.white, margin:0, valign:"top",
    });
  });

  addFooter(s, "Source: Roberts & Hedges' Clinical Procedures  |  Thumb = 40–50% of hand function");
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 9 — SENSORY FUNCTION
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{color: C.offWhite}, line:{color: C.offWhite} });
  addSlideHeader(s, "Sensory Function of the Hand", "Tactile Feedback & Discrimination");

  // Left column
  const sensorySections = [
    {
      heading: "Sensory Modalities",
      items: [
        "Light touch — Meissner's corpuscles (fingertips)",
        "Deep pressure — Pacinian corpuscles",
        "Vibration — Pacinian corpuscles",
        "Temperature & pain — free nerve endings",
        "Joint position sense (proprioception)",
      ],
    },
    {
      heading: "Two-Point Discrimination",
      items: [
        "Fingertip: normal ≤ 6 mm static 2PD",
        "Tests median nerve integrity",
        "Best assessed with Semmes-Weinstein monofilaments",
        "Critical for stereognosis (object recognition by touch)",
      ],
    },
    {
      heading: "Clinical Importance",
      items: [
        "Sensory feedback guides grip force modulation",
        "Without sensation, grip is unsafe (crushing delicate objects)",
        "Glabrous palmar skin is most densely innervated",
      ],
    },
  ];

  let yPos = 0.95;
  sensorySections.forEach(sec => {
    s.addShape(pres.ShapeType.rect, {
      x:0.25, y:yPos, w:5.4, h:0.3,
      fill:{color: C.navy}, line:{color: C.teal},
    });
    s.addText(sec.heading, {
      x:0.35, y:yPos, w:5.2, h:0.3,
      fontSize:12, bold:true, color:C.gold, margin:0, valign:"middle",
    });
    yPos += 0.3;
    sec.items.forEach(item => {
      s.addText(`• ${item}`, {
        x:0.45, y:yPos, w:5.1, h:0.28,
        fontSize:10.5, color:C.dark, margin:0, valign:"top",
      });
      yPos += 0.28;
    });
    yPos += 0.15;
  });

  // Right side: summary table
  s.addShape(pres.ShapeType.roundRect, {
    x:5.9, y:0.92, w:3.85, h:4.42,
    fill:{color: C.navy}, line:{color: C.teal, width:2}, rectRadius:0.07,
  });
  s.addShape(pres.ShapeType.rect, {
    x:5.9, y:0.92, w:3.85, h:0.38,
    fill:{color: C.teal}, line:{color: C.teal},
  });
  s.addText("Sensory Tests at a Glance", {
    x:5.9, y:0.92, w:3.85, h:0.38,
    fontSize:12, bold:true, color:C.white, align:"center", valign:"middle", margin:0,
  });

  const tests = [
    ["Test", "Assesses", "Normal"],
    ["Static 2PD", "Slowly adapting fibers", "≤ 6 mm"],
    ["Moving 2PD", "Quickly adapting fibers", "≤ 3 mm"],
    ["Semmes-Weinstein", "Pressure threshold", "< 2.83 g"],
    ["Tinel's sign", "Nerve regeneration/compression", "—"],
    ["Weber test", "Tactile spatial acuity", "≤ 6 mm"],
    ["Stereognosis", "Cortical sensory integration", "Identifies object"],
  ];

  tests.forEach((row, ri) => {
    const isHeader = ri === 0;
    const yy = 1.36 + ri * 0.46;
    const bg = isHeader ? C.mid : (ri % 2 === 0 ? "0F3656" : "0A2438");
    s.addShape(pres.ShapeType.rect, {
      x:5.9, y:yy, w:3.85, h:0.44,
      fill:{color: bg}, line:{color: C.navy},
    });
    row.forEach((cell, ci) => {
      const widths = [1.3, 1.5, 1.05];
      const xs = [5.95, 7.25, 8.75];
      s.addText(cell, {
        x:xs[ci], y:yy+0.04, w:widths[ci], h:0.36,
        fontSize: isHeader ? 9.5 : 9,
        bold: isHeader,
        color: isHeader ? C.gold : C.white,
        valign:"middle", margin:0,
      });
    });
  });

  addFooter(s, "Fingertip is the most densely innervated area of the body  |  Glabrous skin = specialized mechanoreceptors");
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 10 — CLINICAL ASSESSMENT
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{color: C.offWhite}, line:{color: C.offWhite} });
  addSlideHeader(s, "Clinical Assessment of Hand Function", "Examination & Tests");

  // Left — assessment tools
  const assessments = [
    {
      cat: "Grip Strength",
      color: C.teal,
      items: [
        "Jamar dynamometer — gold standard",
        "Normal adult male: ~46 kg; female: ~26 kg",
        "5-position test assesses grip at different spans",
        "10-second grip & release test (myelopathy): < 20 cycles = impaired",
      ],
    },
    {
      cat: "Dexterity & Fine Motor",
      color: C.gold,
      items: [
        "Nine-Hole Peg Test — timed, assesses fine motor",
        "Purdue Pegboard Test",
        "Jebsen-Taylor Hand Function Test",
        "DASH / QuickDASH questionnaire (patient-reported)",
      ],
    },
    {
      cat: "Nerve Function Tests",
      color: C.mid,
      items: [
        "Froment's sign — Adductor pollicis (Ulnar N.)",
        "Phalen's / Tinel's — Carpal tunnel (Median N.)",
        "Finkelstein's — De Quervain's tenosynovitis",
        "Allen's test — Arterial supply adequacy",
      ],
    },
  ];

  let yPos = 0.92;
  assessments.forEach(a => {
    s.addShape(pres.ShapeType.rect, {
      x:0.25, y:yPos, w:0.08, h:1.38,
      fill:{color:a.color}, line:{color:a.color},
    });
    s.addText(a.cat, {
      x:0.4, y:yPos, w:5.1, h:0.28,
      fontSize:12, bold:true, color:a.color, margin:0, valign:"middle",
    });
    let yy = yPos+0.28;
    a.items.forEach(item => {
      s.addText(`• ${item}`, {
        x:0.55, y:yy, w:4.95, h:0.26,
        fontSize:10, color:C.dark, margin:0, valign:"top",
      });
      yy += 0.26;
    });
    yPos += 1.52;
  });

  // Right — image (grip & release test)
  if (images[3] && !images[3].error) {
    s.addImage({ data: images[3].base64, x:5.7, y:0.92, w:4.05, h:3.3 });
  }
  if (images[4] && !images[4].error) {
    s.addImage({ data: images[4].base64, x:5.7, y:4.1, w:4.05, h:1.15 });
  }

  s.addText("10-second Grip & Release Test\n(Cervical Myelopathy Assessment)", {
    x:5.7, y:4.2, w:4.05, h:0.5,
    fontSize:8.5, italic:true, color:C.mid, align:"center", margin:0, valign:"middle",
  });

  addFooter(s, "Source: Roberts & Hedges' Clinical Procedures  |  Jamar dynamometer = gold standard for grip strength");
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 11 — SUMMARY / KEY TAKEAWAYS
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{color: C.navy}, line:{color: C.navy} });

  // Gold accent line
  s.addShape(pres.ShapeType.rect, {
    x:0, y:0.7, w:10, h:0.06,
    fill:{color: C.gold}, line:{color: C.gold},
  });

  s.addText("Key Takeaways", {
    x:0.5, y:0.1, w:9, h:0.6,
    fontSize:26, bold:true, color:C.white, valign:"middle", margin:0,
  });

  const takeaways = [
    { icon: "01", text: "The hand has 3 regions: carpus (8 bones), metacarpus (5 bones), and digits (14 phalanges). Thumb has only 2 phalanges." },
    { icon: "02", text: "Intrinsic muscles (within the hand) control fine movement; extrinsic muscles (from forearm) provide power. DAB/PAD for interossei." },
    { icon: "03", text: "Two main grip types: Power Grip (cylindrical, spherical, hook) and Precision Grip (pad-to-pad, tip-to-tip, lateral pinch)." },
    { icon: "04", text: "Median nerve: LOAF muscles + sensation to lateral 3½ fingers. Ulnar nerve: all interossei + medial 1½ digits. Radial: extensors." },
    { icon: "05", text: "Thumb = 40–50% of hand function. Its loss requires replantation, pollicization, or toe-to-thumb transfer." },
    { icon: "06", text: "Fingertip sensory testing: static 2PD ≤6 mm normal. Grip strength by Jamar dynamometer. Dexterity by 9-Hole Peg Test." },
  ];

  takeaways.forEach((t, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.3 : 5.3;
    const y = 0.88 + row * 1.48;
    s.addShape(pres.ShapeType.roundRect, {
      x, y, w:4.7, h:1.35,
      fill:{color:"0F3050"}, line:{color: C.teal}, rectRadius:0.06,
    });
    s.addShape(pres.ShapeType.rect, {
      x, y, w:0.5, h:1.35,
      fill:{color: C.teal}, line:{color: C.teal},
    });
    s.addText(t.icon, {
      x, y, w:0.5, h:1.35,
      fontSize:13, bold:true, color:C.white, align:"center", valign:"middle", margin:0,
    });
    s.addText(t.text, {
      x:x+0.56, y:y+0.12, w:4.0, h:1.1,
      fontSize:10, color:C.white, margin:0, valign:"top",
      paraSpaceAfter: 2,
    });
  });
}

// ─── Write file ──────────────────────────────────────────────────
const outputPath = "/home/daytona/workspace/hand-functions-ppt/Hand_Functions.pptx";
pres.writeFile({ fileName: outputPath }).then(() => {
  console.log("✅ Presentation saved to:", outputPath);
}).catch(err => {
  console.error("❌ Error:", err);
});
Reading File
Editing File

~/hand-functions-ppt/create_ppt.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/hand-functions-ppt/create_ppt.js'
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.