How to diagnose bronchopneumonia from xray with its diffwrential and clinical sign and symptoms of other emergencies while reading xrays

Reading File
Finding Sources
Finding Sources
Finding Sources
Searching the Web

bronchopneumonia chest xray diagnosis features differential diagnosis radiological

Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Searching the Web

chest xray emergency signs tension pneumothorax aortic dissection pulmonary edema diagnosis radiology

Loading Image
Loading Image
Reading Web Page

https://radiologyassistant.nl/chest/chest-x-ray/lung-disease

Finding Sources
I now have excellent textbook and web content. Let me compile the comprehensive answer.

Bronchopneumonia on Chest X-Ray: Diagnosis, Differentials, and X-Ray Emergencies


1. Pathophysiology - Why Bronchopneumonia Looks Different

Bronchopneumonia (also called lobular pneumonia) begins in the airways as acute bronchitis, then spreads outward into the peribronchiolar alveoli. This contrasts with lobar pneumonia, which starts directly in the alveoli. Because of this airway-first spread, the radiographic pattern is patchy and multifocal, not homogeneous.
  • Fishman's Pulmonary Diseases, p. 2137

2. X-Ray Features of Bronchopneumonia

Classic Signs on CXR

FeatureDescription
Multifocal patchy opacitiesIll-defined, non-homogeneous densities scattered across one or both lungs - the hallmark
Bilateral involvementCommon; approximately 40% of S. aureus bronchopneumonia is bilateral
Lower lobe predominanceMost common in lower lobes, but any lobe can be involved
Segmental distributionFollows bronchopulmonary segments; does NOT cross fissures
Air bronchogramPresent when larger airways are patent within consolidated segments
No lobar consolidationConsolidation is patchy, not homogeneous lobar white-out (unless disease is severe/confluent)
Peribronchial thickeningIncreased bronchovascular markings (thickened bronchial walls)
Possible pleural effusionEspecially in S. aureus (30-50% of cases)
Possible cavitationEspecially S. aureus and Pseudomonas - abscess formation in 15-30%
Key teaching point: Bronchopneumonia leads to "multifocal ill-defined densities." When it progresses it can produce diffuse consolidation, but the disease typically starts in multiple segments and does not cross fissures.
  • Grainger & Allison's Diagnostic Radiology, p. 128

CT Findings (when CXR is equivocal)

  • Centrilobular nodules and branching opacities (tree-in-bud pattern)
  • Lobular, subsegmental, or segmental areas of consolidation
  • Ground-glass opacities
  • Possible abscess formation or necrosis
Here is an actual CT scan showing bilateral peripheral areas of consolidation (arrows) in a patient with E. coli bronchopneumonia:
CT scan showing bilateral peripheral consolidations in bronchopneumonia - E. coli
Fig. - E. coli pneumonia: bilateral peripheral areas of consolidation on minimum-intensity projection CT (Grainger & Allison's)
And a chest X-ray showing bilateral consolidations with ill-defined margins in H. influenzae bronchopneumonia:
CXR showing bilateral ill-defined consolidations in H. influenzae pneumonia
Fig. - H. influenzae bronchopneumonia: bilateral areas of consolidation with ill-defined margins (arrows) (Grainger & Allison's)

3. Clinical Signs and Symptoms of Bronchopneumonia

SystemFindings
FeverHigh fever, chills, rigors
CoughProductive cough - purulent or mucopurulent sputum
RespiratoryDyspnoea, tachypnoea
PleuriticPleuritic chest pain (variable)
AuscultationCrepitations (crackles), reduced breath sounds, bronchial breathing over consolidation
PercussionDullness to percussion over consolidated areas
GeneralTachycardia, malaise, dehydration; may be septic if severe

4. Organisms Causing Bronchopneumonic Pattern (and their X-ray clues)

OrganismKey X-Ray Clues
Staphylococcus aureusBilateral bronchopneumonia; cavitation, pneumatoceles, pleural effusion (30-50%), abscess (15-30%)
Escherichia coliMultilobar, predominantly lower lobes, bilateral peripheral consolidations
Pseudomonas aeruginosaConfluent bronchopneumonia, frequently cavitates; multifocal upper lobe consolidation, tree-in-bud, pleural effusion
Haemophilus influenzaeBilateral areas with ill-defined margins; lower lobes
Mycoplasma pneumoniaeFocal reticulonodular opacification in single lobe; patchy segmental/lobular ground-glass opacity or consolidation; centrilobular nodules
Klebsiella pneumoniaeDense lobar or patchy bronchopneumonia; volume expansion with fissure bulging; rapid cavitation
Viral (Influenza A)Bilateral ground-glass opacities; rapid progression can resemble pulmonary oedema
  • Grainger & Allison's Diagnostic Radiology, p. 128-129; Fishman's Pulmonary Diseases, p. 2137

5. Differential Diagnosis of Bronchopneumonic Pattern on CXR

Acute Consolidation Differentials

ConditionDistinguishing X-Ray FeatureClinical Clue
Lobar pneumoniaHomogeneous lobar consolidation, air-bronchogram, respects fissuresFever, productive cough; pneumococcal most common
Pulmonary oedema (cardiogenic)Bilateral perihilar bat-wing opacification; Kerley B lines; upper lobe venous diversion; cardiomegaly; bilateral pleural effusionsOrthopnoea, PND, raised JVP, cardiac history
Pulmonary haemorrhageBilateral alveolar consolidation/ground-glass; may clear rapidly (24-48 hrs)Haemoptysis, anaemia; associated with vasculitis
ARDSDiffuse bilateral airspace consolidation; no cardiomegaly; no Kerley linesRecent sepsis/trauma/aspiration; low PaO2/FiO2 ratio
Aspiration pneumonitisDependent lobe consolidation (posterior upper lobes if supine; lower lobes if upright); right side more commonAspiration event, reduced consciousness, swallowing disorder
Bronchoalveolar carcinoma (adenocarcinoma in situ)Persistent or progressive consolidation; may show air-bronchogram; fails to resolve with antibioticsChronic non-productive cough; no fever improvement
Cryptogenic Organizing Pneumonia (COP/BOOP)Migratory peripheral consolidations; does not resolve with antibioticsSubacute course; responds to steroids
Pulmonary infarction (PE)Wedge-shaped peripheral opacity (Hampton's hump); raised hemidiaphragm; pleural effusionPleuritic chest pain, haemoptysis, DVT risk factors; prominent vascular signs
Sarcoidosis (alveolar form)Multiple small ill-defined opacities; hilar lymphadenopathyOften younger patients; systemic symptoms
TuberculosisUpper lobe consolidation with cavitation; satellite nodules; lymphadenopathyPPD positive; contact history; slow course
Key rule: Always ask - is the consolidation acute or chronic? Chronic consolidation (>6 weeks) shifts the differential heavily toward malignancy, organizing pneumonia, or chronic infection (TB, fungal).

6. Critical X-Ray Emergencies You Must Not Miss While Reading Chest X-Rays

These are the findings you must identify immediately - missing any one can be fatal:

6.1 Tension Pneumothorax

X-ray signs:
  • Complete collapse of the affected lung
  • Tracheal deviation away from the affected side
  • Shift of mediastinum away from the affected side
  • Depression/inversion of the ipsilateral hemidiaphragm
  • Widening of ipsilateral intercostal spaces
Clinical emergency signs:
  • Sudden severe dyspnoea, tachycardia, hypotension
  • Absent breath sounds on the affected side
  • Tracheal deviation (away from the lesion)
  • Distended neck veins (JVD)
  • Cyanosis and cardiovascular collapse
  • Note: Do NOT wait for X-ray confirmation - treat clinically with needle decompression at the 2nd intercostal space, mid-clavicular line

6.2 Massive Pleural Effusion / Haemothorax

X-ray signs:
  • Uniform white-out of one hemithorax
  • Trachea and mediastinum deviated away from the effusion (if massive)
  • Loss of diaphragm and costophrenic angle
  • Opposite lung may show compensatory hyperinflation
Clinical signs:
  • Dullness to percussion at base
  • Absent breath sounds
  • Reduced chest expansion
  • Dyspnoea, tachycardia

6.3 Pneumonia with Sepsis (Extensive Bronchopneumonia)

X-ray signs:
  • Bilateral multilobar consolidation
  • Bilateral pleural effusions (high-risk sign)
  • Cavitation (suggests necrotizing pneumonia)
Clinical signs:
  • High fever, rigors, tachycardia, hypotension
  • Confusion/altered mental status (CURB-65 criteria)
  • SpO2 dropping

6.4 Pulmonary Oedema (Acute Left Heart Failure)

X-ray signs:
  • Bilateral perihilar "bat-wing" or "butterfly" shadowing
  • Upper lobe blood diversion (prominent upper lobe vessels)
  • Kerley B lines (horizontal short lines at lung periphery)
  • Cardiomegaly
  • Bilateral pleural effusions (usually)
  • Fluid in the horizontal fissure
Clinical signs:
  • Acute dyspnoea, orthopnoea, PND
  • Pink frothy sputum
  • Bilateral fine crepitations (basal)
  • Raised JVP, S3 gallop
  • History of cardiac disease

6.5 Aortic Dissection

X-ray signs:
  • Widened mediastinum (>8 cm on PA film - key sign)
  • Loss of aortic knuckle clarity
  • Left pleural effusion
  • Deviation of trachea or nasogastric tube to the right
  • "Double density" aortic wall
Clinical signs:
  • Sudden tearing/ripping chest pain radiating to the back
  • Unequal blood pressures in both arms (>20 mmHg difference)
  • Pulse deficits
  • Syncope, neurological deficits
  • Immediately escalate for CT angiography

6.6 Pneumomediastinum

X-ray signs:
  • Air tracking along the mediastinal borders
  • "Continuous diaphragm sign" (air under mediastinum outlines the diaphragm continuously)
  • Air around the heart (pneumopericardium)
Clinical signs:
  • Subcutaneous emphysema (neck/chest crepitus on palpation)
  • Hamman's sign: mediastinal crunch on auscultation
  • Can indicate oesophageal rupture (Boerhaave syndrome) - surgical emergency

6.7 Rib Fractures / Flail Chest (Trauma)

X-ray signs:
  • Multiple adjacent rib fractures visible
  • Underlying lung contusion (patchy consolidation)
  • Associated pneumothorax/haemothorax
Clinical signs:
  • Paradoxical chest wall movement
  • Extreme pain on respiration
  • Crepitus on palpation

7. Systematic Approach to Reading a Chest X-Ray (ABCDE)

Use a structured approach so you never miss an emergency:
LetterWhat to Check
A - AirwayTrachea - midline or deviated?
B - BonesRibs, clavicles, scapulae - fractures?
C - CardiacCardiac size, shape, mediastinal width
D - DiaphragmLevel, shape, free air under it?
E - Everything elseLung fields, hila, pleural spaces, soft tissues, lines/tubes

Summary Table: Bronchopneumonia vs. Key Differentials

FeatureBronchopneumoniaLobar PneumoniaPulmonary OedemaTBARDS
DistributionMultifocal, patchy, bilateralSingle lobe/segment, homogeneousBilateral perihilar/basalUpper lobeDiffuse bilateral
BordersIll-definedLobar marginPerihilar "butterfly"Ill-defined with cavitiesDiffuse
Air bronchogramPossibleClassicAbsent (usually)AbsentPresent
CavitationYes (Staph, Pseudomonas)RareNoCommonRare
Pleural effusionPossiblePossible (parapneumonic)Yes (bilateral)PossibleUncommon
CardiomegalyNoNoYesNoNo
Kerley B linesNoNoYesNoNo
Clinical courseAcute, fever, productive coughAcute, fever, single-lobe symptomsAcute dyspnoea, orthopnoeaSubacute/chronic, weight loss, night sweatsPost-insult; no cardiac history

Sources:

How to diagnose bronchopneumonia from xray with its diffwrential and clinical sign and symptoms of other emergencies while reading xrays

I already answered this question in detail just above. Here's a quick summary of everything covered, so you can navigate the full answer easily:

What Was Covered

1. Bronchopneumonia X-Ray Features

  • Multifocal patchy, ill-defined opacities (bilateral or unilateral)
  • Lower lobe predominance, segmental distribution, does NOT cross fissures
  • Air bronchogram may be present
  • Possible cavitation (Staph, Pseudomonas), pleural effusion
  • CT: tree-in-bud pattern, centrilobular nodules, lobular consolidation

2. Clinical Signs and Symptoms

  • Fever, productive cough, dyspnoea, pleuritic chest pain
  • Crackles, bronchial breathing, dullness to percussion
  • Tachycardia, sepsis features in severe cases

3. Organism-Specific X-Ray Clues

  • S. aureus: cavitation + pneumatoceles + effusion
  • Pseudomonas: confluent cavitating bronchopneumonia
  • H. influenzae: bilateral ill-defined lower lobe consolidation
  • Mycoplasma: reticulonodular, single lobe
  • Klebsiella: fissure bulging, rapid cavitation

4. Differential Diagnosis

Lobar pneumonia, pulmonary oedema, ARDS, TB, aspiration, bronchoalveolar carcinoma, COP, pulmonary infarction, sarcoidosis - each with distinguishing X-ray and clinical features

5. X-Ray Emergencies (with clinical signs)

EmergencyKey X-Ray SignKey Clinical Sign
Tension pneumothoraxTracheal deviation away, lung collapseAbsent breath sounds, JVD, hypotension
Massive pleural effusionWhite-out, mediastinal shift awayDullness, absent breath sounds
Acute pulmonary oedemaBat-wing shadowing, Kerley B, cardiomegalyOrthopnoea, frothy sputum, S3
Aortic dissectionWide mediastinum (>8 cm)Tearing back pain, unequal BP arms
PneumomediastinumAir along mediastinal bordersHamman's crunch, subcutaneous emphysema
Necrotizing/septic pneumoniaBilateral multilobar consolidation + cavitationSeptic shock, confusion

6. Systematic Reading (ABCDE)

Airway - Bones - Cardiac - Diaphragm - Everything else

Scroll up to see the full detailed answer with X-ray images, comparison tables, and textbook citations. Let me know if you want me to go deeper on any specific section.

Make a presentation on chest X-ray interpretation (bronchopneumonia & emergencies)

Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/chest-xray-pptx && ls /home/daytona/workspace/chest-xray-pptx

Running Command

node /home/daytona/skills/shared/scripts/fetch_images.js \ "https://cdn.orris.care/cdss_images/3cbc4636bf5eab3b8a5ba1bd65db2ed1e1e1ff08138b9a178cb1d5f9ec6cd70d.png" \ "https://cdn.orris.care/cdss_images/10da1b7fd41ebfc0d092754cbd55c84ca41f93229dd401fb2eae77d575bfdc5d.png" \ "https://cdn.orris.care/cdss_images/49da3cf81ecd2aceeaf66aa4136991bef125b21d49fcb46b5db151f3dc42225c.png" \ 2>/dev/null | node -e "const d=require('fs').readFileSync('/dev/stdin','utf8'); const arr=JSON.parse(d); arr.forEach((x,i)=>console.log(i, x.error ? 'ERROR:'+x.error : 'OK len='+x.base64.length));"

Writing File

~/chest-xray-pptx/build.js

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

// ── FETCH IMAGES ──────────────────────────────────────────────────────────────
const imgUrls = [
  "https://cdn.orris.care/cdss_images/3cbc4636bf5eab3b8a5ba1bd65db2ed1e1e1ff08138b9a178cb1d5f9ec6cd70d.png", // CT E.coli bronchopneumonia
  "https://cdn.orris.care/cdss_images/10da1b7fd41ebfc0d092754cbd55c84ca41f93229dd401fb2eae77d575bfdc5d.png", // CXR H.influenzae
  "https://cdn.orris.care/cdss_images/49da3cf81ecd2aceeaf66aa4136991bef125b21d49fcb46b5db151f3dc42225c.png", // CT Pseudomonas abscess
];
const imgs = JSON.parse(
  execSync(`node /home/daytona/skills/shared/scripts/fetch_images.js ${imgUrls.map(u => `"${u}"`).join(" ")}`).toString()
);

// ── PALETTE ───────────────────────────────────────────────────────────────────
const C = {
  navy:    "0B1F3A",   // dominant dark bg
  teal:    "1B8A8F",   // accent
  amber:   "E8A020",   // warning / emergency accent
  red:     "C0392B",   // emergency red
  white:   "FFFFFF",
  offWhite:"F0F4F8",
  silver:  "BDC9D7",
  darkCard:"112940",   // slightly lighter than navy for cards
  midCard: "163352",   // card surface
};

// ── HELPERS ───────────────────────────────────────────────────────────────────
function navyBg(slide) {
  slide.addShape("rect", { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.navy }, line: { color: C.navy } });
}
function tealBar(slide, x, y, w, h) {
  slide.addShape("rect", { x, y, w, h, fill: { color: C.teal }, line: { color: C.teal } });
}
function amberBar(slide, x, y, w, h) {
  slide.addShape("rect", { x, y, w, h, fill: { color: C.amber }, line: { color: C.amber } });
}
function redBar(slide, x, y, w, h) {
  slide.addShape("rect", { x, y, w, h, fill: { color: C.red }, line: { color: C.red } });
}
function card(slide, x, y, w, h, color) {
  slide.addShape("rect", {
    x, y, w, h,
    fill: { color: color || C.midCard },
    line: { color: color || C.midCard },
    shadow: { type: "outer", color: "000000", blur: 8, offset: 3, angle: 135, opacity: 0.25 }
  });
}
function sectionLabel(slide, text, color) {
  slide.addText(text, {
    x: 0, y: 0, w: 10, h: 0.38,
    fill: { color: color || C.teal },
    fontSize: 11, bold: true, color: C.white,
    align: "center", valign: "middle", margin: 0,
    charSpacing: 3
  });
}
function slideTitle(slide, text, color) {
  slide.addText(text, {
    x: 0.45, y: 0.45, w: 9.1, h: 0.7,
    fontSize: 26, bold: true, color: color || C.white,
    fontFace: "Calibri", margin: 0
  });
}
function accentLine(slide, color) {
  tealBar(slide, 0.45, 1.18, 1.0, 0.05);
  // override color if needed
}

// ══════════════════════════════════════════════════════════════════════════════
// BUILD PRESENTATION
// ══════════════════════════════════════════════════════════════════════════════
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title  = "Chest X-Ray Interpretation: Bronchopneumonia & Emergencies";
pres.author = "Orris Medical";

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  // large teal left strip
  sl.addShape("rect", { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.teal }, line: { color: C.teal } });
  // amber accent strip
  sl.addShape("rect", { x: 0.18, y: 0, w: 0.07, h: 5.625, fill: { color: C.amber }, line: { color: C.amber } });

  sl.addText("CHEST X-RAY\nINTERPRETATION", {
    x: 0.55, y: 0.9, w: 9.1, h: 2.0,
    fontSize: 46, bold: true, color: C.white,
    fontFace: "Calibri", charSpacing: 2,
    align: "left", valign: "top"
  });
  sl.addText("Bronchopneumonia Diagnosis · Differential Diagnosis · Radiological Emergencies", {
    x: 0.55, y: 2.95, w: 9.1, h: 0.55,
    fontSize: 16, color: C.silver, fontFace: "Calibri", align: "left"
  });
  // bottom bar
  sl.addShape("rect", { x: 0, y: 5.1, w: 10, h: 0.525, fill: { color: C.teal }, line: { color: C.teal } });
  sl.addText("Based on Grainger & Allison's Diagnostic Radiology · Fishman's Pulmonary Diseases", {
    x: 0.3, y: 5.1, w: 9.4, h: 0.525,
    fontSize: 11, color: C.white, italic: true, align: "center", valign: "middle", margin: 0
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — AGENDA / OUTLINE
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "OVERVIEW", C.teal);
  slideTitle(sl, "What We Will Cover");
  sl.addShape("rect", { x: 0.45, y: 1.22, w: 1.0, h: 0.05, fill: { color: C.teal }, line: { color: C.teal } });

  const topics = [
    ["01", "Systematic CXR Reading — ABCDE Approach"],
    ["02", "Bronchopneumonia: Pathophysiology & X-Ray Pattern"],
    ["03", "Bronchopneumonia: Clinical Signs & Symptoms"],
    ["04", "Organism-Specific Radiological Clues"],
    ["05", "Differential Diagnosis of Consolidation"],
    ["06", "X-Ray Emergencies & Their Clinical Alarms"],
    ["07", "Summary Comparison Table"],
  ];

  topics.forEach(([num, title], i) => {
    const row = Math.floor(i / 2);
    const col = i % 2;
    const x = col === 0 ? 0.45 : 5.3;
    const y = 1.45 + row * 0.95;
    card(sl, x, y, 4.6, 0.78, C.midCard);
    sl.addText(num, { x: x + 0.12, y: y + 0.08, w: 0.55, h: 0.62, fontSize: 22, bold: true, color: C.teal, valign: "middle", margin: 0 });
    sl.addText(title, { x: x + 0.7, y: y + 0.08, w: 3.75, h: 0.62, fontSize: 13, color: C.white, valign: "middle", fontFace: "Calibri", margin: 0 });
    // If last item (odd count), center it
    if (i === topics.length - 1 && topics.length % 2 !== 0) {
      // already placed at col=0; just leave it
    }
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — ABCDE SYSTEMATIC APPROACH
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "SYSTEMATIC APPROACH", C.teal);
  slideTitle(sl, "ABCDE Method for Reading Chest X-Rays");
  sl.addShape("rect", { x: 0.45, y: 1.22, w: 1.0, h: 0.05, fill: { color: C.teal }, line: { color: C.teal } });

  const rows = [
    { letter: "A", label: "AIRWAY", desc: "Trachea — midline or deviated? Carina angle (<70°)?", color: C.teal },
    { letter: "B", label: "BONES & SOFT TISSUE", desc: "Ribs, clavicles, scapulae — fractures? Subcutaneous emphysema?", color: "1A7A6E" },
    { letter: "C", label: "CARDIAC & MEDIASTINUM", desc: "Heart size (CTR <50%), mediastinal width (<8 cm on PA), aortic knuckle clarity", color: C.amber },
    { letter: "D", label: "DIAPHRAGM", desc: "Level (R higher than L), contour, free subdiaphragmatic air?", color: "7B5EA7" },
    { letter: "E", label: "EVERYTHING ELSE", desc: "Lung fields, hila, pleural spaces, costophrenic angles, lines & tubes", color: C.teal },
  ];

  rows.forEach((r, i) => {
    const y = 1.4 + i * 0.79;
    card(sl, 0.4, y, 9.2, 0.72, C.midCard);
    sl.addShape("rect", { x: 0.4, y, w: 0.6, h: 0.72, fill: { color: r.color }, line: { color: r.color } });
    sl.addText(r.letter, { x: 0.4, y: y + 0.04, w: 0.6, h: 0.64, fontSize: 26, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    sl.addText(r.label, { x: 1.1, y: y + 0.06, w: 2.5, h: 0.28, fontSize: 12, bold: true, color: C.amber, margin: 0 });
    sl.addText(r.desc, { x: 1.1, y: y + 0.35, w: 8.3, h: 0.3, fontSize: 11.5, color: C.silver, margin: 0, fontFace: "Calibri" });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — BRONCHOPNEUMONIA PATHOPHYSIOLOGY
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "BRONCHOPNEUMONIA", C.teal);
  slideTitle(sl, "Pathophysiology: Why It Looks Patchy");
  sl.addShape("rect", { x: 0.45, y: 1.22, w: 1.0, h: 0.05, fill: { color: C.teal }, line: { color: C.teal } });

  // Left: flow diagram
  const steps = [
    { label: "Acute Bronchitis", sub: "Infection starts in bronchi/bronchioles" },
    { label: "Peribronchial Spread", sub: "Inflammatory exudate fills surrounding alveoli" },
    { label: "Multifocal Consolidation", sub: "Multiple patchy opacities in same/multiple lobes" },
    { label: "Confluent Disease", sub: "Segments coalesce → diffuse consolidation (severe)" },
  ];
  steps.forEach((s, i) => {
    const y = 1.38 + i * 0.96;
    card(sl, 0.4, y, 5.2, 0.78, C.midCard);
    sl.addShape("rect", { x: 0.4, y, w: 0.45, h: 0.78, fill: { color: C.teal }, line: { color: C.teal } });
    sl.addText(`${i + 1}`, { x: 0.4, y: y + 0.1, w: 0.45, h: 0.58, fontSize: 20, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    sl.addText(s.label, { x: 0.95, y: y + 0.06, w: 4.5, h: 0.28, fontSize: 13, bold: true, color: C.amber, margin: 0 });
    sl.addText(s.sub, { x: 0.95, y: y + 0.36, w: 4.5, h: 0.3, fontSize: 11.5, color: C.silver, margin: 0 });
    // Arrow between steps
    if (i < steps.length - 1) {
      sl.addText("▼", { x: 2.5, y: y + 0.78, w: 0.6, h: 0.18, fontSize: 11, color: C.teal, align: "center", margin: 0 });
    }
  });

  // Right: vs lobar pneumonia
  card(sl, 5.9, 1.38, 3.75, 3.82, C.darkCard);
  sl.addText("vs. LOBAR PNEUMONIA", { x: 6.0, y: 1.48, w: 3.5, h: 0.35, fontSize: 12, bold: true, color: C.amber, align: "center", margin: 0 });
  sl.addShape("rect", { x: 6.2, y: 1.85, w: 3.1, h: 0.04, fill: { color: C.teal }, line: { color: C.teal } });

  const compare = [
    ["Feature", "Bronchopneumonia", "Lobar Pneumonia"],
    ["Origin", "Airways (bronchi)", "Alveoli directly"],
    ["Pattern", "Patchy / multifocal", "Homogeneous lobar"],
    ["Fissures", "Does NOT cross", "Bounded by fissures"],
    ["Air-bronchogram", "Variable", "Classic feature"],
    ["Organism", "Staph, Pseudomonas, H.flu", "Pneumococcus"],
  ];
  compare.forEach(([f, b, l], i) => {
    const y = 1.95 + i * 0.5;
    const hdr = i === 0;
    sl.addText(f, { x: 5.95, y, w: 1.15, h: 0.42, fontSize: hdr ? 10 : 10.5, bold: hdr, color: hdr ? C.amber : C.silver, valign: "middle", margin: 0 });
    sl.addText(b, { x: 7.12, y, w: 1.25, h: 0.42, fontSize: hdr ? 10 : 10, bold: hdr, color: hdr ? C.amber : C.white, valign: "middle", margin: 0 });
    sl.addText(l, { x: 8.38, y, w: 1.22, h: 0.42, fontSize: hdr ? 10 : 10, bold: hdr, color: hdr ? C.amber : C.white, valign: "middle", margin: 0 });
    if (!hdr) sl.addShape("rect", { x: 5.95, y: y + 0.42, w: 3.65, h: 0.02, fill: { color: "1D3F5E" }, line: { color: "1D3F5E" } });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — CXR FEATURES WITH IMAGE
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "BRONCHOPNEUMONIA — RADIOLOGY", C.teal);
  slideTitle(sl, "Classic X-Ray & CT Features");
  sl.addShape("rect", { x: 0.45, y: 1.22, w: 1.0, h: 0.05, fill: { color: C.teal }, line: { color: C.teal } });

  // Left: feature list
  const features = [
    { icon: "●", text: "Multifocal patchy, ill-defined opacities — the hallmark" },
    { icon: "●", text: "Bilateral involvement (~40% of S. aureus cases)" },
    { icon: "●", text: "Lower lobe predominance (though any lobe can be affected)" },
    { icon: "●", text: "Segmental distribution — does NOT cross fissures" },
    { icon: "●", text: "Air bronchogram may be present" },
    { icon: "●", text: "Possible cavitation (Staph, Pseudomonas, Klebsiella)" },
    { icon: "●", text: "Pleural effusion 30–50% (Staph aureus)" },
    { icon: "CT", text: "Tree-in-bud pattern, centrilobular nodules (CT finding)" },
  ];

  features.forEach((f, i) => {
    const y = 1.38 + i * 0.47;
    const isCT = f.icon === "CT";
    sl.addShape("rect", { x: 0.4, y: y + 0.05, w: 0.38, h: 0.32,
      fill: { color: isCT ? C.amber : C.teal }, line: { color: isCT ? C.amber : C.teal } });
    sl.addText(isCT ? "CT" : "●", { x: 0.4, y: y + 0.05, w: 0.38, h: 0.32, fontSize: isCT ? 9 : 14, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    sl.addText(f.text, { x: 0.85, y: y + 0.06, w: 4.4, h: 0.33, fontSize: 12, color: C.white, valign: "middle", fontFace: "Calibri", margin: 0 });
  });

  // Right: actual CT image
  card(sl, 5.55, 1.33, 4.1, 3.82, C.darkCard);
  if (imgs[0] && !imgs[0].error) {
    sl.addImage({ data: imgs[0].base64, x: 5.65, y: 1.43, w: 3.9, h: 3.3 });
  }
  sl.addText("CT: E. coli Bronchopneumonia — bilateral peripheral consolidations (arrows)", {
    x: 5.55, y: 4.78, w: 4.1, h: 0.38,
    fontSize: 9, color: C.silver, italic: true, align: "center", valign: "middle", margin: 0
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — CLINICAL SIGNS & SYMPTOMS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "BRONCHOPNEUMONIA — CLINICAL", C.teal);
  slideTitle(sl, "Clinical Signs & Symptoms");
  sl.addShape("rect", { x: 0.45, y: 1.22, w: 1.0, h: 0.05, fill: { color: C.teal }, line: { color: C.teal } });

  const categories = [
    {
      title: "CONSTITUTIONAL", color: C.teal,
      items: ["High fever & rigors", "Malaise, fatigue", "Tachycardia", "Dehydration signs"]
    },
    {
      title: "RESPIRATORY", color: C.amber,
      items: ["Productive cough (purulent/mucopurulent sputum)", "Dyspnoea & tachypnoea", "Pleuritic chest pain (variable)", "Reduced chest expansion"]
    },
    {
      title: "AUSCULTATION", color: "1A7A6E",
      items: ["Crepitations (coarse crackles)", "Bronchial breathing over consolidation", "Reduced breath sounds", "Pleural rub (if effusion)"]
    },
    {
      title: "PERCUSSION & OTHER", color: "7B5EA7",
      items: ["Dullness to percussion over consolidation", "Tachypnoea (RR >20)", "SpO2 drop", "CURB-65 score for severity (ICU if ≥3)"]
    },
  ];

  categories.forEach((cat, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.4 : 5.15;
    const y = 1.38 + row * 2.1;
    card(sl, x, y, 4.5, 1.95, C.midCard);
    sl.addShape("rect", { x, y, w: 4.5, h: 0.38, fill: { color: cat.color }, line: { color: cat.color } });
    sl.addText(cat.title, { x: x + 0.12, y: y + 0.04, w: 4.26, h: 0.3, fontSize: 11, bold: true, color: C.white, charSpacing: 2, margin: 0 });
    sl.addText(cat.items.map(it => `• ${it}`).join("\n"), {
      x: x + 0.12, y: y + 0.45, w: 4.26, h: 1.4,
      fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top", margin: 0
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — ORGANISM-SPECIFIC CXR CLUES WITH CXR IMAGE
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "ORGANISM-SPECIFIC PATTERNS", C.teal);
  slideTitle(sl, "Radiological Clues by Pathogen");
  sl.addShape("rect", { x: 0.45, y: 1.22, w: 1.0, h: 0.05, fill: { color: C.teal }, line: { color: C.teal } });

  const orgs = [
    { name: "S. aureus", clue: "Bilateral; cavitation, pneumatoceles, pleural effusion (30–50%)", color: C.red },
    { name: "E. coli", clue: "Multilobar lower lobe consolidations; bilateral peripheral pattern", color: C.amber },
    { name: "Pseudomonas", clue: "Confluent + cavitating; upper lobe predominance; tree-in-bud", color: "C06A15" },
    { name: "H. influenzae", clue: "Bilateral ill-defined lower lobe consolidations", color: C.teal },
    { name: "Klebsiella", clue: "Dense lobar consolidation; fissure bulging; rapid cavitation", color: "7B5EA7" },
    { name: "Mycoplasma", clue: "Focal reticulonodular in one lobe; segmental/lobular GGO", color: "1A7A6E" },
    { name: "Viral (Influenza)", clue: "Bilateral GGO; rapid progression resembling pulmonary oedema", color: "2A6699" },
  ];

  orgs.forEach((o, i) => {
    const y = 1.38 + i * 0.56;
    card(sl, 0.4, y, 5.65, 0.48, C.midCard);
    sl.addShape("rect", { x: 0.4, y, w: 1.6, h: 0.48, fill: { color: o.color }, line: { color: o.color } });
    sl.addText(o.name, { x: 0.4, y: y + 0.04, w: 1.6, h: 0.4, fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    sl.addText(o.clue, { x: 2.1, y: y + 0.06, w: 3.85, h: 0.36, fontSize: 11.5, color: C.white, valign: "middle", fontFace: "Calibri", margin: 0 });
  });

  // Right: CXR image
  card(sl, 6.3, 1.33, 3.35, 3.82, C.darkCard);
  if (imgs[1] && !imgs[1].error) {
    sl.addImage({ data: imgs[1].base64, x: 6.4, y: 1.43, w: 3.15, h: 3.3 });
  }
  sl.addText("CXR: H. influenzae bronchopneumonia — bilateral ill-defined consolidations (arrows)", {
    x: 6.3, y: 4.78, w: 3.35, h: 0.38,
    fontSize: 9, color: C.silver, italic: true, align: "center", valign: "middle", margin: 0
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — DIFFERENTIAL DIAGNOSIS OF CONSOLIDATION
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "DIFFERENTIAL DIAGNOSIS", C.teal);
  slideTitle(sl, "Differential Diagnosis of Consolidation on CXR");
  sl.addShape("rect", { x: 0.45, y: 1.22, w: 1.0, h: 0.05, fill: { color: C.teal }, line: { color: C.teal } });

  // Rule at top
  card(sl, 0.4, 1.3, 9.2, 0.52, "0E3352");
  sl.addText("⚠  KEY RULE: First ask — Is this ACUTE or CHRONIC? Chronic (>6 weeks) shifts DDx toward malignancy, organizing pneumonia, or TB/fungal.", {
    x: 0.55, y: 1.35, w: 8.9, h: 0.4, fontSize: 11.5, color: C.amber, bold: true, valign: "middle", margin: 0
  });

  const diffs = [
    { cond: "Lobar Pneumonia", xray: "Homogeneous lobar consolidation; air-bronchogram; respects fissures", clue: "Fever, productive cough; pneumococcal", color: C.teal },
    { cond: "Pulmonary Oedema", xray: "Bat-wing perihilar shadowing; Kerley B lines; upper lobe diversion; cardiomegaly", clue: "Orthopnoea, PND, raised JVP; cardiac history", color: C.amber },
    { cond: "ARDS", xray: "Diffuse bilateral consolidation; no cardiomegaly; no Kerley lines", clue: "Post-sepsis/trauma; PaO2/FiO2 <300", color: C.red },
    { cond: "Aspiration Pneumonitis", xray: "Dependent lobe consolidation (posterior upper / lower lobes); right-sided", clue: "Aspiration event, reduced consciousness, swallowing disorder", color: "C06A15" },
    { cond: "TB", xray: "Upper lobe consolidation + cavitation; satellite nodules; lymphadenopathy", clue: "Subacute course, weight loss, night sweats; contact history", color: "7B5EA7" },
    { cond: "Bronchoalveolar Ca / COP", xray: "Persistent consolidation failing to resolve with antibiotics; may migrate (COP)", clue: "Chronic non-productive cough; steroid-responsive (COP)", color: "1A7A6E" },
    { cond: "Pulmonary Infarction (PE)", xray: "Hampton's hump (wedge peripheral opacity); raised hemidiaphragm; effusion", clue: "Pleuritic pain, haemoptysis, DVT risk factors", color: "2A6699" },
  ];

  diffs.forEach((d, i) => {
    const y = 1.9 + i * 0.5;
    card(sl, 0.4, y, 9.2, 0.44, C.midCard);
    sl.addShape("rect", { x: 0.4, y, w: 1.8, h: 0.44, fill: { color: d.color }, line: { color: d.color } });
    sl.addText(d.cond, { x: 0.45, y: y + 0.04, w: 1.7, h: 0.36, fontSize: 10.5, bold: true, color: C.white, valign: "middle", align: "center", margin: 0 });
    sl.addText(d.xray, { x: 2.28, y: y + 0.04, w: 4.15, h: 0.36, fontSize: 10, color: C.white, valign: "middle", margin: 0 });
    sl.addShape("rect", { x: 6.45, y: y + 0.04, w: 0.03, h: 0.36, fill: { color: C.silver }, line: { color: C.silver } });
    sl.addText(d.clue, { x: 6.52, y: y + 0.04, w: 3.0, h: 0.36, fontSize: 10, color: C.silver, valign: "middle", italic: true, margin: 0 });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — EMERGENCY 1: Tension Pneumothorax
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "RADIOLOGICAL EMERGENCIES", C.red);
  // Red alert banner
  sl.addShape("rect", { x: 0, y: 0.38, w: 10, h: 0.75, fill: { color: C.red }, line: { color: C.red } });
  sl.addText("⚡  TENSION PNEUMOTHORAX", {
    x: 0.3, y: 0.38, w: 9.4, h: 0.75,
    fontSize: 26, bold: true, color: C.white, valign: "middle", fontFace: "Calibri", charSpacing: 1, margin: 0
  });

  // Warning note
  card(sl, 0.4, 1.25, 9.2, 0.5, "3B0A0A");
  sl.addText("⚠  DO NOT WAIT FOR CXR — Diagnose clinically. Immediate needle decompression at 2nd ICS, mid-clavicular line.", {
    x: 0.55, y: 1.3, w: 8.9, h: 0.4, fontSize: 11.5, color: C.amber, bold: true, valign: "middle", margin: 0
  });

  // Two columns
  card(sl, 0.4, 1.85, 4.4, 3.4, C.midCard);
  sl.addShape("rect", { x: 0.4, y: 1.85, w: 4.4, h: 0.38, fill: { color: C.red }, line: { color: C.red } });
  sl.addText("CXR SIGNS", { x: 0.52, y: 1.88, w: 4.15, h: 0.32, fontSize: 12, bold: true, color: C.white, charSpacing: 2, margin: 0 });

  const xraySigns = [
    "Complete lung collapse (ipsilateral)",
    "Tracheal deviation AWAY from affected side",
    "Mediastinal shift away from affected side",
    "Depression/inversion of ipsilateral hemidiaphragm",
    "Widening of ipsilateral intercostal spaces",
    "Absent lung markings on affected side",
  ];
  sl.addText(xraySigns.map(s => `• ${s}`).join("\n"), {
    x: 0.55, y: 2.3, w: 4.1, h: 2.8, fontSize: 12, color: C.white, fontFace: "Calibri", valign: "top", margin: 0
  });

  card(sl, 5.2, 1.85, 4.4, 3.4, C.midCard);
  sl.addShape("rect", { x: 5.2, y: 1.85, w: 4.4, h: 0.38, fill: { color: "7B1818" }, line: { color: "7B1818" } });
  sl.addText("CLINICAL SIGNS", { x: 5.32, y: 1.88, w: 4.15, h: 0.32, fontSize: 12, bold: true, color: C.white, charSpacing: 2, margin: 0 });

  const clinSigns = [
    "Sudden severe dyspnoea & tachycardia",
    "Hypotension — obstructive shock",
    "Absent breath sounds on affected side",
    "Tracheal deviation (away from lesion)",
    "Distended neck veins (JVD)",
    "Cyanosis & cardiovascular collapse",
  ];
  sl.addText(clinSigns.map(s => `• ${s}`).join("\n"), {
    x: 5.35, y: 2.3, w: 4.1, h: 2.8, fontSize: 12, color: C.white, fontFace: "Calibri", valign: "top", margin: 0
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 10 — EMERGENCY 2: Acute Pulmonary Oedema
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "RADIOLOGICAL EMERGENCIES", C.red);
  sl.addShape("rect", { x: 0, y: 0.38, w: 10, h: 0.75, fill: { color: "1B5E9A" }, line: { color: "1B5E9A" } });
  sl.addText("⚡  ACUTE PULMONARY OEDEMA (LVF)", {
    x: 0.3, y: 0.38, w: 9.4, h: 0.75,
    fontSize: 24, bold: true, color: C.white, valign: "middle", fontFace: "Calibri", charSpacing: 1, margin: 0
  });

  card(sl, 0.4, 1.25, 4.55, 4.0, C.midCard);
  sl.addShape("rect", { x: 0.4, y: 1.25, w: 4.55, h: 0.38, fill: { color: "1B5E9A" }, line: { color: "1B5E9A" } });
  sl.addText("CXR SIGNS", { x: 0.52, y: 1.28, w: 4.28, h: 0.32, fontSize: 12, bold: true, color: C.white, charSpacing: 2, margin: 0 });
  const oedXray = [
    "Cardiomegaly (CTR >50%)",
    "Bilateral perihilar 'bat-wing' / butterfly shadowing",
    "Upper lobe blood diversion (prominent upper lobe vessels)",
    "Kerley B lines (short horizontal peripheral lines)",
    "Bilateral pleural effusions (usually)",
    "Fluid in horizontal (minor) fissure",
    "Patchy bilateral airspace opacification",
  ];
  sl.addText(oedXray.map(s => `• ${s}`).join("\n"), {
    x: 0.55, y: 1.7, w: 4.25, h: 3.4, fontSize: 11.5, color: C.white, fontFace: "Calibri", valign: "top", margin: 0
  });

  card(sl, 5.2, 1.25, 4.45, 4.0, C.midCard);
  sl.addShape("rect", { x: 5.2, y: 1.25, w: 4.45, h: 0.38, fill: { color: "0D3F6E" }, line: { color: "0D3F6E" } });
  sl.addText("CLINICAL SIGNS", { x: 5.32, y: 1.28, w: 4.18, h: 0.32, fontSize: 12, bold: true, color: C.white, charSpacing: 2, margin: 0 });
  const oedClin = [
    "Acute onset dyspnoea & orthopnoea",
    "Paroxysmal nocturnal dyspnoea (PND)",
    "Pink frothy sputum",
    "Bilateral fine crepitations (basal → apical)",
    "Raised JVP",
    "S3 gallop rhythm",
    "History of cardiac disease / hypertension",
    "Cold peripheries, diaphoresis",
  ];
  sl.addText(oedClin.map(s => `• ${s}`).join("\n"), {
    x: 5.35, y: 1.7, w: 4.15, h: 3.4, fontSize: 11.5, color: C.white, fontFace: "Calibri", valign: "top", margin: 0
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 11 — EMERGENCY 3: Aortic Dissection + Pneumomediastinum
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "RADIOLOGICAL EMERGENCIES", C.red);

  // Top half: Aortic dissection
  sl.addShape("rect", { x: 0, y: 0.38, w: 10, h: 0.65, fill: { color: "6B1010" }, line: { color: "6B1010" } });
  sl.addText("⚡  AORTIC DISSECTION", { x: 0.3, y: 0.38, w: 9.4, h: 0.65, fontSize: 22, bold: true, color: C.white, valign: "middle", margin: 0 });

  card(sl, 0.4, 1.1, 4.4, 2.05, C.midCard);
  sl.addShape("rect", { x: 0.4, y: 1.1, w: 4.4, h: 0.35, fill: { color: "6B1010" }, line: { color: "6B1010" } });
  sl.addText("CXR SIGNS", { x: 0.52, y: 1.13, w: 4.15, h: 0.28, fontSize: 11, bold: true, color: C.white, charSpacing: 2, margin: 0 });
  sl.addText([
    { text: "• Widened mediastinum ", options: { breakLine: true } },
    { text: "  (>8 cm on PA — KEY sign)\n", options: { bold: true, color: C.amber, breakLine: true } },
    { text: "• Loss of aortic knuckle clarity\n", options: { breakLine: true } },
    { text: "• Left pleural effusion\n", options: { breakLine: true } },
    { text: "• Trachea/NGT deviation to right\n", options: { breakLine: true } },
    { text: "• 'Double density' aortic wall", options: {} },
  ], { x: 0.55, y: 1.5, w: 4.1, h: 1.55, fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top", margin: 0 });

  card(sl, 5.2, 1.1, 4.4, 2.05, C.midCard);
  sl.addShape("rect", { x: 5.2, y: 1.1, w: 4.4, h: 0.35, fill: { color: "4A0808" }, line: { color: "4A0808" } });
  sl.addText("CLINICAL SIGNS", { x: 5.32, y: 1.13, w: 4.15, h: 0.28, fontSize: 11, bold: true, color: C.white, charSpacing: 2, margin: 0 });
  sl.addText([
    { text: "• Sudden TEARING pain → back (hallmark)\n", options: { bold: true, color: C.amber, breakLine: true } },
    { text: "• Unequal BP both arms (>20 mmHg)\n", options: { breakLine: true } },
    { text: "• Pulse deficits\n", options: { breakLine: true } },
    { text: "• Syncope, neurological deficits\n", options: { breakLine: true } },
    { text: "• Escalate immediately — CT angiography", options: { bold: true, color: C.amber } },
  ], { x: 5.35, y: 1.5, w: 4.1, h: 1.55, fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top", margin: 0 });

  // Divider
  sl.addShape("rect", { x: 0.4, y: 3.22, w: 9.2, h: 0.04, fill: { color: C.teal }, line: { color: C.teal } });

  // Bottom half: Pneumomediastinum
  sl.addText("⚡  PNEUMOMEDIASTINUM / BOERHAAVE SYNDROME", { x: 0.4, y: 3.3, w: 9.2, h: 0.45, fontSize: 18, bold: true, color: C.amber, valign: "middle", margin: 0 });

  card(sl, 0.4, 3.82, 4.4, 1.48, C.midCard);
  sl.addText("CXR: Air along mediastinal borders • Continuous diaphragm sign • Air around heart", {
    x: 0.55, y: 3.92, w: 4.1, h: 1.25, fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top", margin: 0
  });
  card(sl, 5.2, 3.82, 4.4, 1.48, C.midCard);
  sl.addText("Clinical: Subcutaneous emphysema (neck crepitus) • Hamman's sign (mediastinal crunch) • Severe chest pain after forceful vomiting → SURGICAL EMERGENCY", {
    x: 5.35, y: 3.92, w: 4.1, h: 1.25, fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top", margin: 0
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 12 — EMERGENCY 4: Massive Effusion + Necrotizing Pneumonia
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "RADIOLOGICAL EMERGENCIES", C.red);

  // Top: Massive Pleural Effusion/Haemothorax
  sl.addShape("rect", { x: 0, y: 0.38, w: 10, h: 0.65, fill: { color: "3A2700" }, line: { color: "3A2700" } });
  sl.addText("⚡  MASSIVE PLEURAL EFFUSION / HAEMOTHORAX", { x: 0.3, y: 0.38, w: 9.4, h: 0.65, fontSize: 20, bold: true, color: C.amber, valign: "middle", margin: 0 });

  card(sl, 0.4, 1.1, 4.4, 1.9, C.midCard);
  sl.addShape("rect", { x: 0.4, y: 1.1, w: 4.4, h: 0.35, fill: { color: "3A2700" }, line: { color: "3A2700" } });
  sl.addText("CXR SIGNS", { x: 0.52, y: 1.13, w: 4.15, h: 0.28, fontSize: 11, bold: true, color: C.white, charSpacing: 2, margin: 0 });
  sl.addText("• Uniform white-out of one hemithorax\n• Trachea & mediastinum deviated AWAY from effusion (if massive)\n• Loss of diaphragm & costophrenic angle\n• Meniscus sign (smaller effusions)", {
    x: 0.55, y: 1.5, w: 4.1, h: 1.4, fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top", margin: 0
  });
  card(sl, 5.2, 1.1, 4.4, 1.9, C.midCard);
  sl.addShape("rect", { x: 5.2, y: 1.1, w: 4.4, h: 0.35, fill: { color: "2A1A00" }, line: { color: "2A1A00" } });
  sl.addText("CLINICAL SIGNS", { x: 5.32, y: 1.13, w: 4.15, h: 0.28, fontSize: 11, bold: true, color: C.white, charSpacing: 2, margin: 0 });
  sl.addText("• Stony dullness to percussion\n• Absent breath sounds at base\n• Reduced chest expansion\n• Dyspnoea, tachycardia, hypoxia\n• Trauma history (haemothorax)", {
    x: 5.35, y: 1.5, w: 4.1, h: 1.4, fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top", margin: 0
  });

  sl.addShape("rect", { x: 0.4, y: 3.08, w: 9.2, h: 0.04, fill: { color: C.teal }, line: { color: C.teal } });

  // Bottom: Necrotizing/Septic Pneumonia
  sl.addText("⚡  NECROTIZING PNEUMONIA / SEPTIC SHOCK", { x: 0.4, y: 3.17, w: 9.2, h: 0.45, fontSize: 18, bold: true, color: C.red, valign: "middle", margin: 0 });

  card(sl, 0.4, 3.68, 4.4, 1.65, C.midCard);
  sl.addShape("rect", { x: 0.4, y: 3.68, w: 4.4, h: 0.35, fill: { color: C.red }, line: { color: C.red } });
  sl.addText("CXR SIGNS", { x: 0.52, y: 3.71, w: 4.15, h: 0.28, fontSize: 11, bold: true, color: C.white, charSpacing: 2, margin: 0 });
  sl.addText("• Bilateral multilobar consolidation\n• Bilateral pleural effusions (high-mortality sign)\n• Cavitation within consolidation → abscess\n• Rapid progression on serial films", {
    x: 0.55, y: 4.08, w: 4.1, h: 1.2, fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top", margin: 0
  });
  card(sl, 5.2, 3.68, 4.4, 1.65, C.midCard);
  sl.addShape("rect", { x: 5.2, y: 3.68, w: 4.4, h: 0.35, fill: { color: "7B1010" }, line: { color: "7B1010" } });
  sl.addText("CLINICAL SIGNS", { x: 5.32, y: 3.71, w: 4.15, h: 0.28, fontSize: 11, bold: true, color: C.white, charSpacing: 2, margin: 0 });
  sl.addText("• High fever, rigors, tachycardia\n• Hypotension (septic shock)\n• Confusion / altered mental status\n• CURB-65 ≥3 → ICU admission\n• SpO2 dropping despite O2", {
    x: 5.35, y: 4.08, w: 4.1, h: 1.2, fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top", margin: 0
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 13 — SUMMARY COMPARISON TABLE
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "SUMMARY", C.teal);
  slideTitle(sl, "Bronchopneumonia vs. Key Differentials — At a Glance");
  sl.addShape("rect", { x: 0.45, y: 1.22, w: 1.0, h: 0.05, fill: { color: C.teal }, line: { color: C.teal } });

  // Table header
  const headers = ["Feature", "Bronchopneumonia", "Lobar Pneumonia", "Pulm. Oedema", "TB", "ARDS"];
  const colW = [1.7, 1.64, 1.64, 1.64, 1.64, 1.64];
  const startX = [0.15, 1.85, 3.49, 5.13, 6.77, 8.41];
  const headerY = 1.38;

  headers.forEach((h, i) => {
    sl.addShape("rect", { x: startX[i], y: headerY, w: colW[i], h: 0.42, fill: { color: i === 0 ? C.teal : C.midCard }, line: { color: C.navy } });
    sl.addText(h, { x: startX[i] + 0.05, y: headerY + 0.04, w: colW[i] - 0.1, h: 0.34, fontSize: 10.5, bold: true, color: i === 0 ? C.white : C.amber, valign: "middle", align: "center", margin: 0 });
  });

  const rows = [
    ["Distribution", "Multifocal patchy bilateral", "Single lobe homogeneous", "Bilateral perihilar/basal", "Upper lobe", "Diffuse bilateral"],
    ["Borders", "Ill-defined", "Lobar margin", "Bat-wing perihilar", "Cavities/nodules", "Diffuse"],
    ["Air bronchogram", "Variable", "Classic (YES)", "Absent (usually)", "Absent", "Present"],
    ["Cavitation", "YES (Staph/Pseudomonas)", "Rare", "No", "Common", "Rare"],
    ["Pleural effusion", "Possible (Staph 30–50%)", "Parapneumonic possible", "Bilateral", "Possible", "Uncommon"],
    ["Cardiomegaly", "No", "No", "YES", "No", "No"],
    ["Kerley B lines", "No", "No", "YES", "No", "No"],
    ["Clinical key", "Fever + productive cough", "Fever + single-lobe sx", "Orthopnoea + JVD", "Wt loss + night sweats", "Post-insult + no cardiac"],
  ];

  const rowColors = ["0E2440", C.midCard, "0E2440", C.midCard, "0E2440", C.midCard, "0E2440", C.midCard];

  rows.forEach((row, ri) => {
    const y = 1.8 + ri * 0.455;
    row.forEach((cell, ci) => {
      sl.addShape("rect", { x: startX[ci], y, w: colW[ci], h: 0.44, fill: { color: rowColors[ri] }, line: { color: C.navy } });
      const highlight = (cell.toUpperCase().includes("YES") || cell.includes("Classic")) ? C.amber : C.white;
      sl.addText(cell, {
        x: startX[ci] + 0.04, y: y + 0.03, w: colW[ci] - 0.08, h: 0.38,
        fontSize: ci === 0 ? 10 : 9.5,
        bold: ci === 0,
        color: ci === 0 ? C.amber : highlight,
        valign: "middle", align: ci === 0 ? "left" : "center", margin: 0
      });
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 14 — CT IMAGE SLIDE: Pseudomonas Abscess
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sectionLabel(sl, "RADIOLOGY IN FOCUS", C.teal);
  slideTitle(sl, "Cavitation & Abscess Formation in Bronchopneumonia");
  sl.addShape("rect", { x: 0.45, y: 1.22, w: 1.0, h: 0.05, fill: { color: C.amber }, line: { color: C.amber } });

  // Image
  card(sl, 0.4, 1.35, 5.5, 3.9, C.darkCard);
  if (imgs[2] && !imgs[2].error) {
    sl.addImage({ data: imgs[2].base64, x: 0.5, y: 1.45, w: 5.3, h: 3.5 });
  }
  sl.addText("CT: Pseudomonas aeruginosa Pneumonia — extensive right upper lobe consolidation with necrosis and abscess formation (arrows). Vascular structures visible within consolidated lung (arrowheads).", {
    x: 0.4, y: 5.28, w: 5.5, h: 0.32, fontSize: 9, color: C.silver, italic: true, align: "center", margin: 0
  });

  // Key points
  card(sl, 6.15, 1.35, 3.5, 3.9, C.midCard);
  sl.addShape("rect", { x: 6.15, y: 1.35, w: 3.5, h: 0.38, fill: { color: C.amber }, line: { color: C.amber } });
  sl.addText("CAVITATION — CAUSES", { x: 6.27, y: 1.38, w: 3.25, h: 0.3, fontSize: 11, bold: true, color: C.navy, charSpacing: 2, margin: 0 });

  const cavItems = [
    { org: "S. aureus", note: "Pneumatoceles in children; abscesses in adults (15–30%)" },
    { org: "Pseudomonas", note: "Confluent; frequently cavitates; upper lobe" },
    { org: "Klebsiella", note: "Rapid cavitation; fissure bulging; lung gangrene" },
    { org: "Anaerobes", note: "Aspiration-related; foul-smelling sputum" },
    { org: "TB", note: "Upper lobe; thick-walled; satellite nodules" },
  ];
  cavItems.forEach((item, i) => {
    const y = 1.85 + i * 0.66;
    sl.addText(item.org, { x: 6.27, y, w: 1.1, h: 0.28, fontSize: 11, bold: true, color: C.amber, margin: 0 });
    sl.addText(item.note, { x: 6.27, y: y + 0.28, w: 3.25, h: 0.32, fontSize: 10.5, color: C.silver, fontFace: "Calibri", margin: 0 });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 15 — CONCLUSION / KEY TAKEAWAYS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  navyBg(sl);
  sl.addShape("rect", { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.teal }, line: { color: C.teal } });
  sl.addShape("rect", { x: 0.18, y: 0, w: 0.07, h: 5.625, fill: { color: C.amber }, line: { color: C.amber } });

  sl.addText("KEY TAKEAWAYS", {
    x: 0.55, y: 0.3, w: 9.1, h: 0.6,
    fontSize: 28, bold: true, color: C.teal, charSpacing: 3, margin: 0
  });

  const takeaways = [
    { n: "1", t: "Bronchopneumonia = patchy, multifocal, airway-first spread. Does NOT cross fissures.", c: C.teal },
    { n: "2", t: "Always correlate CXR with clinical context — consolidation has many causes (infection, oedema, ARDS, cancer, PE).", c: C.amber },
    { n: "3", t: "Cavitation on CXR → think S. aureus, Pseudomonas, Klebsiella, TB, anaerobes.", c: "1A7A6E" },
    { n: "4", t: "Emergency #1: Tension pneumothorax — diagnose and treat CLINICALLY. Do not wait for CXR.", c: C.red },
    { n: "5", t: "Emergency #2: Wide mediastinum (>8 cm) → Aortic dissection until proven otherwise. Escalate immediately.", c: "7B1818" },
    { n: "6", t: "Bat-wing shadowing + Kerley B + cardiomegaly → pulmonary oedema, NOT pneumonia.", c: "1B5E9A" },
    { n: "7", t: "Use ABCDE systematically — missing an emergency on CXR can be fatal.", c: "7B5EA7" },
  ];

  takeaways.forEach((t, i) => {
    const y = 1.0 + i * 0.63;
    sl.addShape("rect", { x: 0.55, y: y + 0.06, w: 0.35, h: 0.44, fill: { color: t.c }, line: { color: t.c } });
    sl.addText(t.n, { x: 0.55, y: y + 0.06, w: 0.35, h: 0.44, fontSize: 16, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    sl.addText(t.t, { x: 1.0, y: y + 0.08, w: 8.5, h: 0.44, fontSize: 12.5, color: C.white, valign: "middle", fontFace: "Calibri", margin: 0 });
  });

  sl.addShape("rect", { x: 0, y: 5.2, w: 10, h: 0.425, fill: { color: C.teal }, line: { color: C.teal } });
  sl.addText("Sources: Grainger & Allison's Diagnostic Radiology · Fishman's Pulmonary Diseases · Radiology Assistant · Radiology Masterclass", {
    x: 0.3, y: 5.2, w: 9.4, h: 0.425, fontSize: 9.5, color: C.white, italic: true, align: "center", valign: "middle", margin: 0
  });
}

// ── WRITE FILE ─────────────────────────────────────────────────────────────
const outPath = "/home/daytona/workspace/chest-xray-pptx/ChestXray_Bronchopneumonia_Emergencies.pptx";
pres.writeFile({ fileName: outPath }).then(() => {
  console.log("SUCCESS:", outPath);
}).catch(err => {
  console.error("ERROR:", err);
});
Running Command

cd /home/daytona/workspace/chest-xray-pptx && node build.js

Running Command

cd /home/daytona/workspace/chest-xray-pptx && \ node /home/daytona/skills/shared/scripts/fetch_images.js \ "https://cdn.orris.care/cdss_images/3cbc4636bf5eab3b8a5ba1bd65db2ed1e1e1ff08138b9a178cb1d5f9ec6cd70d.png" \ > img0.json && \ node /home/daytona/skills/shared/scripts/fetch_images.js \ "https://cdn.orris.care/cdss_images/10da1b7fd41ebfc0d092754cbd55c84ca41f93229dd401fb2eae77d575bfdc5d.png" \ > img1.json && \ node /home/daytona/skills/shared/scripts/fetch_images.js \ "https://cdn.orris.care/cdss_images/49da3cf81ecd2aceeaf66aa4136991bef125b21d49fcb46b5db151f3dc42225c.png" \ > img2.json && \ echo "Done saving image JSONs"

Editing File

~/chest-xray-pptx/build.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/chest-xray-pptx/build.js'
Running Command

cd /home/daytona/workspace/chest-xray-pptx && node build.js

Running Command

ls -lh /home/daytona/workspace/chest-xray-pptx/ChestXray_Bronchopneumonia_Emergencies.pptx

Your presentation is ready! Download it here:

ChestXray Bronchopneumonia Emergencies

Presentation · PPTX


What's Inside — 15 Slides

#SlideContent
1Title SlideDark navy design with teal/amber accents
2Agenda7-topic overview with numbered cards
3ABCDE ApproachSystematic CXR reading — Airway → Everything else
4PathophysiologyBronchopneumonia vs Lobar pneumonia comparison table
5CXR & CT FeaturesAll X-ray signs + real CT image (E. coli bronchopneumonia)
6Clinical Signs4-category grid: constitutional, respiratory, auscultation, percussion
7Organism Patterns7 organisms with X-ray clues + real CXR image (H. influenzae)
8Differential Diagnosis7 differentials with X-ray + clinical distinguishing features
9Emergency: Tension PneumothoraxRed alert slide; CXR signs vs clinical signs
10Emergency: Pulmonary OedemaBat-wing, Kerley B, cardiomegaly vs clinical
11Emergency: Aortic Dissection + PneumomediastinumWide mediastinum, tearing pain; Hamman's sign
12Emergency: Massive Effusion + Necrotizing PneumoniaWhite-out, haemothorax, septic shock signs
13Summary TableBronchopneumonia vs 4 key differentials across 7 features
14CT Focus: CavitationReal CT of Pseudomonas abscess + cavitation causes by organism
15Key Takeaways7 bold clinical pearls with color-coded cards
Design: Navy/teal/amber palette — dark background for authority, amber highlights for critical findings, red for emergencies. All 3 real radiological images from Grainger & Allison's / Fishman's textbooks are embedded.

Give me a list of different triads of symptoms for different disorder that help me in diagnosis

Reading File
Finding Sources
Searching the Web

classic diagnostic triads symptoms medicine list neurology cardiology gastroenterology

Finding Sources
Finding Sources
Finding Sources
Reading Web Page

https://en.wikipedia.org/wiki/List_of_medical_triads,_tetrad…

I now have comprehensive, textbook-verified data. Let me compile the full, well-organized answer.

Complete List of Diagnostic Triads in Medicine

Organized by specialty for quick reference. Textbook-verified where noted.

EMERGENCY & TRAUMA

Triad NameThree ComponentsDiagnosis
Beck's TriadMuffled/distant heart sounds + Distended neck veins (raised JVP) + HypotensionCardiac Tamponade
Cushing's TriadHypertension + Bradycardia + Irregular respirationsRaised Intracranial Pressure (impending herniation)
Lethal Triad / Trauma Triad of DeathHypothermia + Coagulopathy + Metabolic acidosisTrauma - imminent death
Ruptured AAA TriadSevere abdominal/back pain + Hypotension + Pulsatile abdominal massRuptured Abdominal Aortic Aneurysm
Opioid Overdose TriadPinpoint pupils (miosis) + CNS depression/unconsciousness + Respiratory depressionOpioid Toxicity
Bergman's TriadMental status change + Petechiae (axilla/thorax) + DyspnoeaFat Embolism Syndrome
Abdominal Compartment SyndromeOliguria + Elevated peak airway pressure + Elevated intra-abdominal pressureAbdominal Compartment Syndrome
Beck's triad confirmed in Rosen's Emergency Medicine and Schwartz's Principles of Surgery. Cushing's triad confirmed in Neuroanatomy through Clinical Cases 3rd Ed, Bailey & Love's Surgery.

CARDIOLOGY

Triad NameThree ComponentsDiagnosis
Beck's TriadMuffled heart sounds + JVD + HypotensionCardiac Tamponade
Triad of Aortic StenosisAngina (chest pain) + Syncope + Heart failure (dyspnoea)Aortic Stenosis
Congestive Heart Failure TriadTachycardia + Tachypnoea + Tender hepatomegalyCHF (Paediatric)
Pheochromocytoma TriadHeadache + Diaphoresis (profuse sweating) + PalpitationsPhaeochromocytoma
Carcinoid TriadFlushing + Diarrhoea + Right-sided heart failureCarcinoid Syndrome

NEUROLOGY

Triad NameThree ComponentsDiagnosis
Charcot's Neurological TriadScanning/staccato speech + Intention tremor + NystagmusMultiple Sclerosis
Wernicke's Encephalopathy TriadConfusion (delirium) + Ophthalmoplegia + AtaxiaWernicke's Encephalopathy (Thiamine deficiency)
Hakim's Triad / NPH TriadGait disturbance (wet) + Urinary incontinence (wobbly) + Dementia/cognitive decline (wacky)Normal Pressure Hydrocephalus
Horner's Syndrome TriadPtosis + Miosis + AnhidrosisHorner's Syndrome (sympathetic chain interruption)
Botulism TriadNo fever + Clear sensorium + Symmetric descending flaccid paralysis with cranial nerve involvementBotulism
Cushing's TriadHypertension + Bradycardia + Irregular breathingRaised ICP / Impending herniation
Wernicke's, NPH, and botulism triads confirmed in Washington Manual of Medical Therapeutics.

GASTROENTEROLOGY & HEPATOLOGY

Triad NameThree ComponentsDiagnosis
Charcot's Cholangitis TriadRight upper quadrant pain + Fever with rigors + JaundiceAscending Cholangitis
Reynolds' Pentad (extension of Charcot's)Above 3 + Confusion + HypotensionSevere/Suppurative Cholangitis
Budd-Chiari Syndrome TriadAbdominal pain + Ascites + HepatomegalyBudd-Chiari Syndrome
Acute Liver Failure TriadJaundice + Coagulopathy + EncephalopathyAcute Liver Failure
Rigler's TriadGallstones + Pneumobilia (air in bile ducts) + Small bowel obstructionGallstone Ileus
Whipple's TriadHypoglycaemic symptoms during fasting/exercise + Low blood glucose (<3 mmol/L) + Relief of symptoms with glucose administrationInsulinoma
Achalasia TriadDysphagia + Regurgitation + Weight lossAchalasia
Borchardt's TriadSevere epigastric pain + Retching without vomiting + Inability to pass NG tubeAcute Gastric Volvulus
Saint's TriadGallstones + Diverticulosis + Hiatus herniaSaint's Triad (coincident conditions)
Acute DiverticulitisLeft lower quadrant pain + Fever + LeukocytosisSigmoid Diverticulitis
Charcot's triad confirmed in Bailey & Love's, Sleisenger & Fordtran's, Schwartz's Surgery, Rosen's Emergency Medicine.

RESPIRATORY

Triad NameThree ComponentsDiagnosis
Samter's Triad (Aspirin Triad)Aspirin/NSAID sensitivity + Nasal polyps + AsthmaAspirin-Exacerbated Respiratory Disease (AERD)
Allergic/Atopic TriadEczema (atopic dermatitis) + Allergic rhinitis + AsthmaAtopy
Mackler's Triad / Boerhaave SyndromeVomiting + Lower thoracic pain + Subcutaneous emphysemaOesophageal Perforation (Boerhaave Syndrome)

INFECTIOUS DISEASES

Triad NameThree ComponentsDiagnosis
Weil's Disease Triad (Leptospirosis)Meningitis + Liver damage (jaundice) + Renal dysfunctionWeil Disease (severe leptospirosis)
Austrian Syndrome TriadPneumonia + Endocarditis + Meningitis (all from S. pneumoniae)Austrian Syndrome
Rocky Mountain Spotted FeverFever + Headache + Petechial rash (centripetal spread, distal → central)RMSF (Rickettsia rickettsii)
Congenital Toxoplasmosis TriadChorioretinitis + Hydrocephalus + Intracranial calcificationsCongenital Toxoplasmosis
Congenital Rubella Triad (Gregg's Triad)Cataracts + Patent ductus arteriosus + Sensorineural hearing lossCongenital Rubella Syndrome
RMSF triad confirmed in Washington Manual of Medical Therapeutics. Leptospirosis triad confirmed in Quick Compendium of Clinical Pathology 5th Ed.

RHEUMATOLOGY

Triad NameThree ComponentsDiagnosis
Reiter's Syndrome / Reactive Arthritis Triad"Can't see" (conjunctivitis/uveitis) + "Can't pee" (urethritis) + "Can't climb a tree" (arthritis)Reactive Arthritis
Behcet's Disease TriadRecurrent oral aphthous ulcers + Genital ulcers + Iridocyclitis (uveitis)Behcet's Disease

NEPHROLOGY & UROLOGY

Triad NameThree ComponentsDiagnosis
Acute Interstitial Nephritis (AIN) TriadFever + Maculopapular rash + Peripheral eosinophiliaAcute Interstitial Nephritis
Fanconi Syndrome TriadAminoaciduria + Proteinuria + PhosphaturiaFanconi Syndrome
Alport Syndrome TriadSensorineural deafness + Progressive renal failure + Ocular anomaliesAlport Syndrome
Dietl's CrisisRenal colic + Loin swelling (disappears after urination) + Nausea/vomitingHydronephrosis
AIN triad confirmed in Frameworks for Internal Medicine.

ENDOCRINOLOGY & METABOLIC

Triad NameThree ComponentsDiagnosis
MEN 1 (Wermer's Syndrome)Pituitary adenoma + Parathyroid hyperplasia + Pancreatic tumour (3 P's)MEN Type 1
MEN 2A TriadMedullary thyroid carcinoma + Phaeochromocytoma + Parathyroid hyperplasiaMEN Type 2A
Cushing's Syndrome TriadCentral obesity + Striae + HypertensionCushing's Syndrome
Pellagra Triad (3 D's)Dermatitis + Diarrhoea + DementiaPellagra (Niacin/B3 deficiency)
Acute Intermittent Porphyria TriadSevere abdominal pain + Red/port-wine urine + Neuropsychiatric symptomsAIP
Biotin Deficiency TriadAlopecia + Glossitis + DermatitisBiotin (B7) deficiency

OBSTETRICS & GYNAECOLOGY

Triad NameThree ComponentsDiagnosis
Pre-eclampsia TriadHypertension + Proteinuria + OedemaPre-eclampsia
Ectopic Pregnancy TriadAmenorrhoea + Abdominal pain + Vaginal bleedingEctopic Pregnancy
Female Athlete TriadEating disorder/low energy availability + Amenorrhoea + Decreased bone mineral densityRelative Energy Deficiency in Sport

ORTHOPAEDICS & MUSCULOSKELETAL

Triad NameThree ComponentsDiagnosis
Unhappy Triad (O'Donoghue's)ACL tear + MCL tear + Medial/lateral meniscus tearKnee Injury ("Blown Knee")
Osteomyelitis TriadFever + Swelling + Tenderness/pain over boneAcute Osteomyelitis
Leriche Syndrome TriadButtock claudication + Erectile dysfunction (impotence) + Symmetrical lower limb atrophyLeriche Syndrome (Aortoiliac occlusion)
Osteomyelitis triad confirmed in Campbell's Operative Orthopaedics 15th Ed.

ENT / HEAD & NECK

Triad NameThree ComponentsDiagnosis
Meniere's Disease TriadEpisodic vertigo + Tinnitus + Sensorineural hearing lossMeniere's Disease
Trotter's TriadConductive deafness + Immobility of homolateral soft palate + Trigeminal neuralgiaNasopharyngeal Carcinoma
Pierre Robin TriadMicrognathia (small jaw) + Glossoptosis (tongue falling back) + Airway compromisePierre Robin Sequence
Plummer-Vinson Syndrome TriadDysphagia + Iron-deficiency anaemia + Oesophageal webPlummer-Vinson Syndrome

OPHTHALMOLOGY

Triad NameThree ComponentsDiagnosis
Horner's SyndromePtosis + Miosis + AnhidrosisSympathetic chain interruption
Congenital ToxoplasmosisChorioretinitis + Hydrocephalus + Intracranial calcificationsCongenital Toxoplasmosis

HAEMATOLOGY & ONCOLOGY

Triad NameThree ComponentsDiagnosis
Virchow's TriadStasis (slow blood flow) + Hypercoagulability + Endothelial/vessel wall injuryVenous Thromboembolism (DVT/PE)
Alkaptonuria TriadOchronotic arthritis + Ochronotic pigmentation + Urine darkens on standingAlkaptonuria

PAEDIATRICS / GENETICS

Triad NameThree ComponentsDiagnosis
Congenital Rubella (Gregg's)Cataracts + PDA + Sensorineural deafnessCongenital Rubella
Congenital ToxoplasmosisChorioretinitis + Hydrocephalus + Intracranial calcificationsCongenital Toxoplasmosis
Tetany in ChildrenStridor + Carpopedal spasm + ConvulsionsHypocalcaemic Tetany
Down Syndrome Screening (Triple Test)hCG + Oestriol (uE3) + AFPDown Syndrome (prenatal screening)

QUICK MEMORY SUMMARY (Most High-Yield)

Mnemonic / KeywordTriadDiagnosis
Beck's = Bag (muffled) + Bulging (JVD) + BP downMuffled sounds + JVD + HypotensionCardiac Tamponade
Charcot's (biliary) = Pain + Fever + YellowRUQ pain + Fever + JaundiceAscending Cholangitis
Charcot's (neuro) = SINSpeech + Intention tremor + NystagmusMultiple Sclerosis
Cushing's = HBOHypertension + Bradycardia + (ir)regular breathingRaised ICP
Wernicke's = COAConfusion + Ophthalmoplegia + AtaxiaThiamine deficiency
NPH / Hakim's = 3 W'sWet + Wobbly + WackyNormal Pressure Hydrocephalus
Virchow's = SHEStasis + Hypercoagulability + Endothelial injuryDVT/PE
Reactive Arthritis = 3 C'sCan't see + Can't pee + Can't climbReiter's/Reactive Arthritis
Pellagra = 3 D'sDermatitis + Diarrhoea + DementiaNiacin deficiency
Opioid OD = PPRPinpoint pupils + CNS depression + Respiratory depressionOpioid toxicity
Meniere's = VTHVertigo + Tinnitus + Hearing lossMeniere's disease
Boerhaave = VPSVomiting + Pain (thoracic) + Subcutaneous emphysemaOesophageal perforation
Lethal Triad = HACHypothermia + Acidosis + CoagulopathyTrauma death

Sources: Bailey & Love's Surgery, Rosen's Emergency Medicine, Washington Manual, Frameworks for Internal Medicine, Sleisenger & Fordtran's GI, Schwartz's Surgery, Campbell's Orthopaedics, Neuroanatomy through Clinical Cases, Quick Compendium of Clinical Pathology - all confirmed across multiple authoritative textbooks.

Create comparison tables for similar triads with a cheat sheet design include maxm symptoms

Reading File
Running Command

mkdir -p /home/daytona/workspace/triads-cheatsheet && ls /home/daytona/workspace/triads-cheatsheet

Writing File

~/triads-cheatsheet/build.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3 x 7.5 — wide format for cheat sheet density
pres.title = "Medical Triads Cheat Sheet";

// ── PALETTE ───────────────────────────────────────────────────────────────────
const C = {
  bg:      "0D1B2A",   // deep navy bg
  panel:   "112236",   // slightly lighter panel
  card:    "162C46",   // card bg
  border:  "1A3A5C",   // subtle border
  white:   "FFFFFF",
  silver:  "B8C8D8",
  gold:    "F0A500",   // accent headings
  teal:    "17B8BE",   // neuro
  red:     "E8354A",   // emergency
  orange:  "E87525",   // cardio
  green:   "27AE60",   // GI
  purple:  "8E44AD",   // neuro2
  blue:    "2980B9",   // infective
  pink:    "E91E8C",   // OB/GYN
  lime:    "7CB518",   // ortho
  cyan:    "00BCD4",   // ENT
  maroon:  "C0392B",   // heme
};

// ── HELPERS ───────────────────────────────────────────────────────────────────
function bg(sl) {
  sl.addShape("rect", { x:0, y:0, w:13.3, h:7.5, fill:{color:C.bg}, line:{color:C.bg} });
}

function hdr(sl, text, color, x, y, w, h) {
  sl.addShape("rect", { x, y, w, h, fill:{color:color}, line:{color:color} });
  sl.addText(text, { x:x+0.06, y:y+0.02, w:w-0.12, h:h-0.04,
    fontSize:9, bold:true, color:C.white, valign:"middle", align:"center", margin:0, charSpacing:1 });
}

function cell(sl, text, x, y, w, h, opts={}) {
  const bgColor = opts.bg || C.card;
  const fColor  = opts.fc || C.white;
  const fSize   = opts.fs || 8.5;
  sl.addShape("rect", { x, y, w, h, fill:{color:bgColor}, line:{color:C.border} });
  sl.addText(text, { x:x+0.05, y:y+0.02, w:w-0.1, h:h-0.04,
    fontSize:fSize, color:fColor, valign:"middle", align:opts.align||"left",
    bold:!!opts.bold, italic:!!opts.italic, margin:0, fontFace:"Calibri",
    wrap: true });
}

function sectionTitle(sl, text, color, x, y, w) {
  sl.addShape("rect", { x, y, w, h:0.28, fill:{color:color}, line:{color:color} });
  sl.addShape("rect", { x, y:y+0.28, w, h:0.03, fill:{color:C.gold}, line:{color:C.gold} });
  sl.addText(text, { x:x+0.08, y:y, w:w-0.16, h:0.28,
    fontSize:9.5, bold:true, color:C.white, valign:"middle", charSpacing:2, margin:0 });
}

// ═══════════════════════════════════════════════════════════════════════════════
//  SLIDE 1 — TITLE / COVER
// ═══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  bg(sl);
  // Decorative stripes
  const stripes = [C.red,C.orange,C.green,C.teal,C.purple,C.blue,C.pink,C.lime,C.cyan,C.gold];
  stripes.forEach((c,i) => {
    sl.addShape("rect",{x:0,y:i*0.75,w:0.22,h:0.75,fill:{color:c},line:{color:c}});
  });
  sl.addShape("rect",{x:0.22,y:0,w:0.06,h:7.5,fill:{color:C.gold},line:{color:C.gold}});

  sl.addText("MEDICAL TRIADS", {
    x:0.55, y:1.2, w:12.5, h:1.6,
    fontSize:72, bold:true, color:C.white, fontFace:"Calibri",
    charSpacing:8, align:"left", margin:0
  });
  sl.addText("DIAGNOSTIC CHEAT SHEET", {
    x:0.55, y:2.9, w:12.5, h:0.65,
    fontSize:28, bold:false, color:C.gold, fontFace:"Calibri",
    charSpacing:5, align:"left", margin:0
  });
  sl.addText("Comparison Tables by Specialty · Maximum Symptoms per Triad · Emergency Flags", {
    x:0.55, y:3.65, w:12.5, h:0.45,
    fontSize:15, color:C.silver, align:"left", margin:0
  });

  // Specialty pills at bottom
  const specs = [
    {t:"EMERGENCY", c:C.red}, {t:"CARDIOLOGY", c:C.orange}, {t:"NEUROLOGY", c:C.teal},
    {t:"GI/HEPATOLOGY", c:C.green}, {t:"INFECTIOUS", c:C.blue}, {t:"RHEUMATOLOGY", c:C.purple},
    {t:"NEPHROLOGY", c:"1A8A9A"}, {t:"ENDOCRINE", c:C.gold}, {t:"OB/GYN", c:C.pink},
    {t:"ORTHOPAEDICS", c:C.lime}, {t:"ENT", c:C.cyan}, {t:"HAEMATOLOGY", c:C.maroon},
  ];
  specs.forEach((s,i) => {
    const x = 0.55 + (i % 6) * 2.1;
    const y = 4.35 + Math.floor(i/6) * 0.52;
    sl.addShape("rect",{x,y,w:1.95,h:0.38,fill:{color:s.c},line:{color:s.c},
      shadow:{type:"outer",color:"000000",blur:4,offset:2,angle:135,opacity:0.2}});
    sl.addText(s.t,{x:x+0.05,y:y+0.03,w:1.85,h:0.32,fontSize:9,bold:true,color:C.white,
      align:"center",valign:"middle",margin:0,charSpacing:1});
  });

  sl.addShape("rect",{x:0,y:7.1,w:13.3,h:0.4,fill:{color:C.gold},line:{color:C.gold}});
  sl.addText("Sources: Bailey & Love's Surgery · Rosen's Emergency Medicine · Washington Manual · Frameworks for Internal Medicine · Sleisenger & Fordtran's GI · Schwartz's Surgery",{
    x:0.2,y:7.1,w:12.9,h:0.4,fontSize:8,color:C.bg,align:"center",valign:"middle",margin:0});
}

// ═══════════════════════════════════════════════════════════════════════════════
//  SLIDE 2 — EMERGENCY & CARDIOVASCULAR TRIADS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  bg(sl);

  // Title bar
  sl.addShape("rect",{x:0,y:0,w:13.3,h:0.38,fill:{color:C.red},line:{color:C.red}});
  sl.addText("⚡  EMERGENCY & CARDIOVASCULAR TRIADS — Comparison Table",{
    x:0.15,y:0,w:13,h:0.38,fontSize:13,bold:true,color:C.white,valign:"middle",charSpacing:1,margin:0});

  // ── TABLE HEADERS ──────────────────────────────────────────────────────────
  const cols = { name:0.12, dx:3.2, s1:5.1, s2:7.1, s3:9.1, extra:11.1 };
  const cw   = { name:3.06, dx:1.88, s1:1.98, s2:1.98, s3:1.98, extra:2.18 };
  const hy = 0.42;

  hdr(sl,"TRIAD NAME",         cols.name, hy, cw.name, 0.3, C.red);
  hdr(sl,"DIAGNOSIS",          cols.dx,   hy, cw.dx,   0.3, "8B1A1A");
  hdr(sl,"SYMPTOM 1",          cols.s1,   hy, cw.s1,   0.3, "1A3A6B");
  hdr(sl,"SYMPTOM 2",          cols.s2,   hy, cw.s2,   0.3, "1A3A6B");
  hdr(sl,"SYMPTOM 3",          cols.s3,   hy, cw.s3,   0.3, "1A3A6B");
  hdr(sl,"ADDITIONAL SIGNS",   cols.extra,hy, cw.extra, 0.3, "0D2B4A");

  const rows = [
    {
      name:"Beck's Triad", dx:"CARDIAC TAMPONADE",
      s1:"Muffled / distant heart sounds",
      s2:"Distended neck veins (raised JVP)",
      s3:"Hypotension (↓BP)",
      extra:"Pulsus paradoxus >10 mmHg · Tachycardia · Dyspnoea · Chest pain · Kussmaul sign · Friction rub (early) · Echocardiography confirms",
      nc:C.red, flag:"🚨 EMERGENCY"
    },
    {
      name:"Cushing's Triad", dx:"RAISED ICP (Impending Herniation)",
      s1:"Hypertension (widened pulse pressure)",
      s2:"Bradycardia (reflex vagal)",
      s3:"Irregular respirations (Cheyne-Stokes)",
      extra:"Papilloedema · Fixed dilated pupil · Altered GCS · Vomiting (projectile) · Headache (worse AM) · Decerebrate posturing · Impending tonsillar herniation",
      nc:C.red, flag:"🚨 EMERGENCY"
    },
    {
      name:"Triad of Aortic Stenosis", dx:"AORTIC STENOSIS",
      s1:"Angina (exertional chest pain)",
      s2:"Syncope (exertional)",
      s3:"Heart failure (dyspnoea)",
      extra:"Harsh ejection systolic murmur · Slow-rising pulse · Narrow pulse pressure · Heaving apex · Ejection click · Calcified valve on echo · Mean survival: angina 5yr, syncope 3yr, HF 2yr",
      nc:C.orange, flag:""
    },
    {
      name:"Pheochromocytoma Triad", dx:"PHAEOCHROMOCYTOMA",
      s1:"Headache (severe, pulsating)",
      s2:"Diaphoresis (profuse sweating)",
      s3:"Palpitations / tachycardia",
      extra:"Hypertensive crisis · Pallor · Anxiety/panic · Hyperglycaemia · Weight loss · Elevated urinary catecholamines · VMA/metanephrines in urine · Adrenal mass on CT",
      nc:C.orange, flag:""
    },
    {
      name:"Carcinoid Triad", dx:"CARCINOID SYNDROME",
      s1:"Episodic flushing (skin redness)",
      s2:"Secretory diarrhoea",
      s3:"Right-sided heart failure (tricuspid/pulmonary valve lesions)",
      extra:"Bronchospasm · Wheezing · Hepatomegaly (liver mets) · Elevated 5-HIAA urine · Serotonin responsible · Carcinoid crisis risk during surgery · Octreotide for treatment",
      nc:C.orange, flag:""
    },
    {
      name:"Lethal Triad (Trauma)", dx:"TRAUMA — IMMINENT DEATH",
      s1:"Hypothermia (<35°C)",
      s2:"Coagulopathy (↑PT/aPTT, ↓platelets)",
      s3:"Metabolic acidosis (↓pH, ↑lactate)",
      extra:"Each element worsens the others (vicious cycle) · Treat with damage control resuscitation · Massive transfusion protocol · Warm blood products · 1:1:1 pRBC:FFP:Plt · Target pH >7.35",
      nc:C.red, flag:"🚨 EMERGENCY"
    },
    {
      name:"Ruptured AAA Triad", dx:"RUPTURED AORTIC ANEURYSM",
      s1:"Severe abdominal / back pain (tearing)",
      s2:"Hypotension / shock",
      s3:"Pulsatile abdominal mass",
      extra:"Pain may radiate to groin/flank · May mimic renal colic · Haematuria possible · Retroperitoneal haematoma · CT angiography if stable · Emergency repair if unstable · High mortality without surgery",
      nc:C.red, flag:"🚨 EMERGENCY"
    },
  ];

  rows.forEach((r, i) => {
    const y = 0.76 + i * 0.91;
    const rh = 0.88;
    const alt = i%2===0 ? C.card : C.panel;

    // Name cell with color tag
    sl.addShape("rect",{x:cols.name,y,w:cw.name,h:rh,fill:{color:alt},line:{color:C.border}});
    sl.addShape("rect",{x:cols.name,y,w:0.18,h:rh,fill:{color:r.nc},line:{color:r.nc}});
    sl.addText(r.name,{x:cols.name+0.22,y:y+0.02,w:cw.name-0.28,h:0.28,
      fontSize:9,bold:true,color:C.gold,margin:0});
    if(r.flag) sl.addText(r.flag,{x:cols.name+0.22,y:y+0.3,w:cw.name-0.28,h:0.2,
      fontSize:7.5,bold:true,color:C.red,margin:0});

    cell(sl, r.dx, cols.dx, y, cw.dx, rh, {bg:alt, fc:C.silver, fs:8, bold:true});
    cell(sl, r.s1, cols.s1, y, cw.s1, rh, {bg:alt, fc:C.white,  fs:8.5});
    cell(sl, r.s2, cols.s2, y, cw.s2, rh, {bg:alt, fc:C.white,  fs:8.5});
    cell(sl, r.s3, cols.s3, y, cw.s3, rh, {bg:alt, fc:C.white,  fs:8.5});
    cell(sl, r.extra, cols.extra, y, cw.extra, rh, {bg:alt, fc:C.silver, fs:7.5, italic:true});
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
//  SLIDE 3 — NEUROLOGY TRIADS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  bg(sl);

  sl.addShape("rect",{x:0,y:0,w:13.3,h:0.38,fill:{color:C.teal},line:{color:C.teal}});
  sl.addText("🧠  NEUROLOGY TRIADS — Comparison Table",{
    x:0.15,y:0,w:13,h:0.38,fontSize:13,bold:true,color:C.white,valign:"middle",charSpacing:1,margin:0});

  const cols = { name:0.12, dx:3.2, s1:5.1, s2:7.1, s3:9.1, extra:11.1 };
  const cw   = { name:3.06, dx:1.88, s1:1.98, s2:1.98, s3:1.98, extra:2.18 };
  const hy = 0.42;

  hdr(sl,"TRIAD NAME",       cols.name, hy, cw.name,  0.3, C.teal);
  hdr(sl,"DIAGNOSIS",        cols.dx,   hy, cw.dx,    0.3, "0D5F62");
  hdr(sl,"SYMPTOM 1",        cols.s1,   hy, cw.s1,    0.3, "1A3A6B");
  hdr(sl,"SYMPTOM 2",        cols.s2,   hy, cw.s2,    0.3, "1A3A6B");
  hdr(sl,"SYMPTOM 3",        cols.s3,   hy, cw.s3,    0.3, "1A3A6B");
  hdr(sl,"ADDITIONAL SIGNS", cols.extra,hy, cw.extra,  0.3, "0D2B4A");

  const rows = [
    {
      name:"Charcot's Neurological Triad", dx:"MULTIPLE SCLEROSIS",
      s1:"Scanning/staccato speech (dysarthria)",
      s2:"Intention tremor (cerebellar)",
      s3:"Nystagmus (horizontal)",
      extra:"Optic neuritis (↓visual acuity, Marcus Gunn pupil) · Uhthoff's phenomenon (worsens with heat) · Internuclear ophthalmoplegia · Lhermitte's sign · Fatigue · MRI: periventricular plaques · CSF: oligoclonal bands",
      nc:C.teal
    },
    {
      name:"Wernicke's Encephalopathy Triad", dx:"THIAMINE (B1) DEFICIENCY",
      s1:"Confusion / delirium (global confusion)",
      s2:"Ophthalmoplegia (bilateral lateral rectus palsy, conjugate gaze palsy)",
      s3:"Ataxia (gait — wide-based, cerebellar)",
      extra:"Seen in alcoholics, malnourished, hyperemesis gravidarum · If untreated → Korsakoff syndrome (anterograde amnesia + confabulation) · Treat URGENTLY: IV thiamine before glucose · Full triad in only 10-16%",
      nc:C.teal
    },
    {
      name:"Hakim's Triad (NPH)", dx:"NORMAL PRESSURE HYDROCEPHALUS",
      s1:"Gait disturbance (magnetic gait — 'Wet, Wobbly')",
      s2:"Urinary incontinence ('Wet')",
      s3:"Dementia / cognitive decline ('Wacky')",
      extra:"Gait disturbance appears FIRST · CT/MRI: dilated ventricles disproportionate to cortical atrophy · LP test: improvement after CSF drainage · Treatment: VP shunt · Normal opening CSF pressure on LP · Treatable cause of dementia",
      nc:C.teal
    },
    {
      name:"Horner's Syndrome Triad", dx:"SYMPATHETIC CHAIN INTERRUPTION",
      s1:"Ptosis (drooping upper eyelid — partial)",
      s2:"Miosis (constricted pupil — anisocoria)",
      s3:"Anhidrosis (loss of sweating — ipsilateral face)",
      extra:"Also: enophthalmos (apparent) · Causes: Pancoast tumour, carotid dissection, brainstem stroke, syringomyelia, neuroblastoma · Cocaine test: pupil doesn't dilate in Horner's · Hydroxyamphetamine test localises lesion",
      nc:C.purple
    },
    {
      name:"Botulism Triad", dx:"CLOSTRIDIUM BOTULINUM TOXIN",
      s1:"Absence of fever (afebrile)",
      s2:"Clear sensorium (alert, orientated)",
      s3:"Symmetric DESCENDING flaccid paralysis starting with cranial nerves (ptosis, diplopia, dysarthria, dysphagia → respiratory failure)",
      extra:"Autonomic features: dry mouth, blurred vision, constipation, urinary retention · Nausea/vomiting (food-borne) · Anti-toxin administration · ICU + ventilatory support · Differentials: GBS (ascending), myasthenia gravis",
      nc:C.blue
    },
    {
      name:"Opioid Overdose Triad", dx:"OPIOID TOXICITY",
      s1:"Pinpoint pupils (bilateral miosis)",
      s2:"CNS depression / unconsciousness",
      s3:"Respiratory depression (↓RR, shallow breathing)",
      extra:"Cyanosis · Bradycardia · Hypothermia · Bradypnoea (<12 breaths/min) · Naloxone (IV/IM/intranasal) reverses all features · Short half-life of naloxone → repeat dosing needed · Pulmonary oedema in severe cases",
      nc:C.red
    },
  ];

  rows.forEach((r,i) => {
    const y = 0.76 + i * 0.92;
    const rh = 0.89;
    const alt = i%2===0 ? C.card : C.panel;
    sl.addShape("rect",{x:cols.name,y,w:cw.name,h:rh,fill:{color:alt},line:{color:C.border}});
    sl.addShape("rect",{x:cols.name,y,w:0.18,h:rh,fill:{color:r.nc},line:{color:r.nc}});
    sl.addText(r.name,{x:cols.name+0.22,y:y+0.02,w:cw.name-0.28,h:0.28,fontSize:9,bold:true,color:C.gold,margin:0});
    cell(sl, r.dx,    cols.dx,    y, cw.dx,    rh, {bg:alt,fc:C.silver,fs:8,bold:true});
    cell(sl, r.s1,    cols.s1,    y, cw.s1,    rh, {bg:alt,fc:C.white, fs:8.5});
    cell(sl, r.s2,    cols.s2,    y, cw.s2,    rh, {bg:alt,fc:C.white, fs:8.5});
    cell(sl, r.s3,    cols.s3,    y, cw.s3,    rh, {bg:alt,fc:C.white, fs:8.5});
    cell(sl, r.extra, cols.extra, y, cw.extra, rh, {bg:alt,fc:C.silver,fs:7.5,italic:true});
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
//  SLIDE 4 — GASTROENTEROLOGY / HEPATOLOGY TRIADS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  bg(sl);

  sl.addShape("rect",{x:0,y:0,w:13.3,h:0.38,fill:{color:C.green},line:{color:C.green}});
  sl.addText("🫀  GASTROENTEROLOGY & HEPATOLOGY TRIADS — Comparison Table",{
    x:0.15,y:0,w:13,h:0.38,fontSize:13,bold:true,color:C.white,valign:"middle",charSpacing:1,margin:0});

  const cols = {name:0.12,dx:3.2,s1:5.1,s2:7.1,s3:9.1,extra:11.1};
  const cw   = {name:3.06,dx:1.88,s1:1.98,s2:1.98,s3:1.98,extra:2.18};
  const hy=0.42;
  hdr(sl,"TRIAD NAME",       cols.name,hy,cw.name,0.3,C.green);
  hdr(sl,"DIAGNOSIS",        cols.dx,  hy,cw.dx,  0.3,"145A2E");
  hdr(sl,"SYMPTOM 1",        cols.s1,  hy,cw.s1,  0.3,"1A3A6B");
  hdr(sl,"SYMPTOM 2",        cols.s2,  hy,cw.s2,  0.3,"1A3A6B");
  hdr(sl,"SYMPTOM 3",        cols.s3,  hy,cw.s3,  0.3,"1A3A6B");
  hdr(sl,"ADDITIONAL SIGNS", cols.extra,hy,cw.extra,0.3,"0D2B4A");

  const rows = [
    {
      name:"Charcot's Cholangitis Triad", dx:"ASCENDING CHOLANGITIS",
      s1:"Right upper quadrant pain (biliary colic)",
      s2:"Fever with rigors / chills",
      s3:"Jaundice (obstructive — pale stools, dark urine)",
      extra:"Present in ~70% · Reynolds' Pentad adds: confusion + hypotension (septic shock) → immediate intervention · Blood cultures · IV antibiotics · ERCP for decompression · LFTs: raised ALP/GGT/bilirubin · Gallstone most common cause",
      nc:C.green, flag:"🚨 EMERGENCY"
    },
    {
      name:"Budd-Chiari Syndrome Triad", dx:"HEPATIC VEIN THROMBOSIS",
      s1:"Abdominal pain (acute, RUQ/diffuse)",
      s2:"Ascites (massive, rapid-onset)",
      s3:"Hepatomegaly (tender)",
      extra:"Splenomegaly · Jaundice · Varices · Liver biopsy: centrilobular necrosis, congestion · US Doppler: absent/reversed hepatic vein flow · Associated with hypercoagulable states, OCP, polycythaemia vera · Treatment: anticoagulation, TIPS, transplant",
      nc:C.green
    },
    {
      name:"Acute Liver Failure Triad", dx:"ACUTE LIVER FAILURE",
      s1:"Jaundice (rapidly deepening)",
      s2:"Coagulopathy (↑PT/INR, bleeding)",
      s3:"Hepatic encephalopathy (confusion → coma)",
      extra:"Cerebral oedema · Hypoglycaemia · Renal failure · Infections · Coagulopathy: PT/INR > 1.5 · Causes: paracetamol OD (#1), viral hepatitis, Wilson's disease, Amanita phalloides · N-acetylcysteine for paracetamol · Transplant assessment",
      nc:C.green
    },
    {
      name:"Whipple's Triad", dx:"INSULINOMA",
      s1:"Hypoglycaemic symptoms during fasting/exercise (sweating, tremor, confusion)",
      s2:"Documented low blood glucose (<2.2 mmol/L during attack)",
      s3:"Complete relief of symptoms with glucose administration",
      extra:"Sympathetic: sweating, palpitations, tremor, hunger · Neuroglycopenic: confusion, seizures, coma · 72-hour fast test for diagnosis · CT/MRI: pancreatic mass · Elevated insulin:glucose ratio · Elevated C-peptide · Surgery is curative",
      nc:C.gold
    },
    {
      name:"Rigler's Triad", dx:"GALLSTONE ILEUS",
      s1:"Gallstones (history of cholelithiasis)",
      s2:"Pneumobilia (air in bile ducts on X-ray/CT)",
      s3:"Small bowel obstruction (dilated loops, air-fluid levels)",
      extra:"Large gallstone erodes through cholecystoduodenal fistula · Ectopic gallstone in terminal ileum (commonest site) · Ectopic stone at Bouveret's level (duodenum) · CT is investigation of choice · Treatment: enterolithotomy · Older female patients",
      nc:C.green
    },
    {
      name:"Achalasia Triad", dx:"ACHALASIA (OESOPHAGEAL)",
      s1:"Dysphagia (progressive — both solids AND liquids)",
      s2:"Regurgitation (undigested food)",
      s3:"Weight loss (progressive)",
      extra:"Nocturnal regurgitation · Aspiration pneumonia · Retrosternal chest pain (early) · Manometry: ↑LES pressure + absent peristalsis (GOLD STANDARD) · Barium swallow: 'bird-beak' sign · Heller's myotomy or pneumatic dilation",
      nc:C.green
    },
    {
      name:"Borchardt's Triad", dx:"ACUTE GASTRIC VOLVULUS",
      s1:"Severe epigastric pain (sudden onset)",
      s2:"Retching without vomiting (unproductive vomiting)",
      s3:"Inability to pass nasogastric tube",
      extra:"Associated with diaphragmatic hernia · Gaseous distension of stomach · CXR: gas-filled viscus in chest · Often elderly females · Prone to strangulation and infarction · Gastroscopy often impossible · Emergency surgery required",
      nc:C.red, flag:"🚨 EMERGENCY"
    },
  ];

  rows.forEach((r,i) => {
    const y = 0.76 + i * 0.91;
    const rh = 0.88;
    const alt = i%2===0 ? C.card : C.panel;
    sl.addShape("rect",{x:cols.name,y,w:cw.name,h:rh,fill:{color:alt},line:{color:C.border}});
    sl.addShape("rect",{x:cols.name,y,w:0.18,h:rh,fill:{color:r.nc},line:{color:r.nc}});
    sl.addText(r.name,{x:cols.name+0.22,y:y+0.02,w:cw.name-0.28,h:0.28,fontSize:9,bold:true,color:C.gold,margin:0});
    if(r.flag) sl.addText(r.flag,{x:cols.name+0.22,y:y+0.3,w:cw.name-0.28,h:0.2,fontSize:7.5,bold:true,color:C.red,margin:0});
    cell(sl,r.dx,    cols.dx,    y,cw.dx,    rh,{bg:alt,fc:C.silver,fs:8,bold:true});
    cell(sl,r.s1,    cols.s1,    y,cw.s1,    rh,{bg:alt,fc:C.white, fs:8.5});
    cell(sl,r.s2,    cols.s2,    y,cw.s2,    rh,{bg:alt,fc:C.white, fs:8.5});
    cell(sl,r.s3,    cols.s3,    y,cw.s3,    rh,{bg:alt,fc:C.white, fs:8.5});
    cell(sl,r.extra, cols.extra, y,cw.extra, rh,{bg:alt,fc:C.silver,fs:7.5,italic:true});
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
//  SLIDE 5 — INFECTIOUS, RHEUMATOLOGY & NEPHROLOGY TRIADS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  bg(sl);

  sl.addShape("rect",{x:0,y:0,w:13.3,h:0.38,fill:{color:C.blue},line:{color:C.blue}});
  sl.addText("🦠  INFECTIOUS DISEASE · RHEUMATOLOGY · NEPHROLOGY TRIADS",{
    x:0.15,y:0,w:13,h:0.38,fontSize:13,bold:true,color:C.white,valign:"middle",charSpacing:1,margin:0});

  const cols={name:0.12,dx:3.2,s1:5.1,s2:7.1,s3:9.1,extra:11.1};
  const cw  ={name:3.06,dx:1.88,s1:1.98,s2:1.98,s3:1.98,extra:2.18};
  const hy=0.42;
  hdr(sl,"TRIAD NAME",       cols.name,hy,cw.name,0.3,C.blue);
  hdr(sl,"DIAGNOSIS",        cols.dx,  hy,cw.dx,  0.3,"0D3B6E");
  hdr(sl,"SYMPTOM 1",        cols.s1,  hy,cw.s1,  0.3,"1A3A6B");
  hdr(sl,"SYMPTOM 2",        cols.s2,  hy,cw.s2,  0.3,"1A3A6B");
  hdr(sl,"SYMPTOM 3",        cols.s3,  hy,cw.s3,  0.3,"1A3A6B");
  hdr(sl,"ADDITIONAL SIGNS", cols.extra,hy,cw.extra,0.3,"0D2B4A");

  const rows = [
    {
      name:"Weil's Disease Triad (Leptospirosis)", dx:"LEPTOSPIROSIS (Weil disease)",
      s1:"Meningitis (severe headache, neck stiffness, photophobia)",
      s2:"Liver damage (jaundice, elevated LFTs, haemorrhage)",
      s3:"Renal dysfunction (AKI, oliguria, uraemia)",
      extra:"Biphasic illness: 1st phase — flu-like (4-7 days) → 2nd phase (immune): Weil triad · Conjunctival suffusion (hallmark) · Leptospiraemia → serology/PCR diagnosis · Penicillin/doxycycline · Rodent urine exposure",
      nc:C.blue
    },
    {
      name:"Reactive Arthritis Triad (Reiter's)", dx:"REACTIVE ARTHRITIS",
      s1:"Conjunctivitis / uveitis ('Can't SEE')",
      s2:"Urethritis / cervicitis ('Can't PEE')",
      s3:"Arthritis — asymmetric, large joints ('Can't climb a TREE')",
      extra:"Also: mouth ulcers · Keratoderma blennorrhagica (soles) · Circinate balanitis · Triggered by Chlamydia (STI) or enteric infection (Salmonella/Shigella/Campylobacter) · HLA-B27 positive · NSAIDs + physiotherapy",
      nc:C.purple
    },
    {
      name:"Behcet's Disease Triad", dx:"BEHCET'S DISEASE",
      s1:"Recurrent oral aphthous ulcers (painful, multiple, ≥3×/year)",
      s2:"Genital ulcers (painful, scarring)",
      s3:"Iridocyclitis / uveitis (anterior or posterior)",
      extra:"Pathergy test positive · Skin lesions (pseudofolliculitis, erythema nodosum) · Large vessel vasculitis (DVT, Budd-Chiari) · Neurological involvement · Common in 'Silk Road' countries · Colchicine for mucocutaneous disease · Immunosuppressants for eye/CNS",
      nc:C.purple
    },
    {
      name:"AIN Triad (Acute Interstitial Nephritis)", dx:"ACUTE INTERSTITIAL NEPHRITIS",
      s1:"Fever",
      s2:"Maculopapular rash",
      s3:"Peripheral eosinophilia",
      extra:"All 3 present in only 10% of cases · AKI (↑creatinine) · Eosinophiluria on urine dipstick · Drugs: NSAIDs, PPIs, beta-lactam antibiotics, sulfonamides · Sterile pyuria · White cell casts · Renal biopsy confirms · Steroids if drug-related",
      nc:"1A8A9A"
    },
    {
      name:"Austrian Syndrome Triad", dx:"AUSTRIAN SYNDROME (S. pneumoniae)",
      s1:"Pneumonia (lobar consolidation)",
      s2:"Endocarditis (new murmur, vegetations)",
      s3:"Meningitis (neck stiffness, photophobia, altered GCS)",
      extra:"All three from S. pneumoniae · Blood cultures + Echo + LP · Penicillin G treatment · High mortality · Associated alcoholism/asplenia · Aortic valve most commonly affected · Simultaneous seeding via bacteraemia",
      nc:C.blue
    },
    {
      name:"Congenital Rubella Triad (Gregg's)", dx:"CONGENITAL RUBELLA SYNDROME",
      s1:"Cataracts (bilateral nuclear cataracts)",
      s2:"Patent ductus arteriosus (continuous machinery murmur)",
      s3:"Sensorineural hearing loss (bilateral)",
      extra:"Also: microcephaly · Microphthalmia · 'Blueberry muffin' rash (dermal haematopoiesis) · Cardiac defects: PDA, VSD, pulmonary artery stenosis · Rubella IgM titre · Prevention: MMR vaccine pre-pregnancy",
      nc:C.blue
    },
    {
      name:"Congenital Toxoplasmosis Triad (Sabin's)", dx:"CONGENITAL TOXOPLASMOSIS",
      s1:"Chorioretinitis (retinochoroiditis — visual impairment, squint)",
      s2:"Hydrocephalus (large head circumference, bulging fontanelle)",
      s3:"Intracranial calcifications (periventricular, on CT skull)",
      extra:"Also: psychomotor retardation · Seizures · Microcephaly · Toxoplasma gondii (cat faeces) · Maternal infection in 3rd trimester → worst fetal outcome · IgG avidity + PCR of amniotic fluid · Pyrimethamine + sulphadiazine",
      nc:C.blue
    },
  ];

  rows.forEach((r,i) => {
    const y = 0.76 + i * 0.91;
    const rh = 0.88;
    const alt = i%2===0 ? C.card : C.panel;
    sl.addShape("rect",{x:cols.name,y,w:cw.name,h:rh,fill:{color:alt},line:{color:C.border}});
    sl.addShape("rect",{x:cols.name,y,w:0.18,h:rh,fill:{color:r.nc},line:{color:r.nc}});
    sl.addText(r.name,{x:cols.name+0.22,y:y+0.02,w:cw.name-0.28,h:0.28,fontSize:9,bold:true,color:C.gold,margin:0});
    cell(sl,r.dx,    cols.dx,    y,cw.dx,    rh,{bg:alt,fc:C.silver,fs:8,bold:true});
    cell(sl,r.s1,    cols.s1,    y,cw.s1,    rh,{bg:alt,fc:C.white, fs:8.5});
    cell(sl,r.s2,    cols.s2,    y,cw.s2,    rh,{bg:alt,fc:C.white, fs:8.5});
    cell(sl,r.s3,    cols.s3,    y,cw.s3,    rh,{bg:alt,fc:C.white, fs:8.5});
    cell(sl,r.extra, cols.extra, y,cw.extra, rh,{bg:alt,fc:C.silver,fs:7.5,italic:true});
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
//  SLIDE 6 — ENDOCRINE · OB/GYN · ORTHO · ENT · MISC
// ═══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  bg(sl);

  sl.addShape("rect",{x:0,y:0,w:13.3,h:0.38,fill:{color:C.gold},line:{color:C.gold}});
  sl.addText("💊  ENDOCRINE · OB/GYN · ORTHOPAEDICS · ENT · RESPIRATORY — Comparison Table",{
    x:0.15,y:0,w:13,h:0.38,fontSize:13,bold:true,color:C.bg,valign:"middle",charSpacing:1,margin:0});

  const cols={name:0.12,dx:3.2,s1:5.1,s2:7.1,s3:9.1,extra:11.1};
  const cw  ={name:3.06,dx:1.88,s1:1.98,s2:1.98,s3:1.98,extra:2.18};
  const hy=0.42;
  hdr(sl,"TRIAD NAME",       cols.name,hy,cw.name,0.3,"8A6800");
  hdr(sl,"DIAGNOSIS",        cols.dx,  hy,cw.dx,  0.3,"5A4200");
  hdr(sl,"SYMPTOM 1",        cols.s1,  hy,cw.s1,  0.3,"1A3A6B");
  hdr(sl,"SYMPTOM 2",        cols.s2,  hy,cw.s2,  0.3,"1A3A6B");
  hdr(sl,"SYMPTOM 3",        cols.s3,  hy,cw.s3,  0.3,"1A3A6B");
  hdr(sl,"ADDITIONAL SIGNS", cols.extra,hy,cw.extra,0.3,"0D2B4A");

  const rows = [
    {
      name:"Pellagra Triad (3 D's)", dx:"PELLAGRA — NIACIN (B3) DEFICIENCY",
      s1:"Dermatitis (Casal's necklace — sun-exposed photosensitive rash)",
      s2:"Diarrhoea (watery, bloody — GI mucosal damage)",
      s3:"Dementia / neuropsychiatric symptoms (depression, psychosis, confusion)",
      extra:"4th D = Death (if untreated) · Also: glossitis, stomatitis, hyperpigmentation · Common in maize-eating populations, alcoholics, isoniazid use · Nicotinamide treatment · Hartnup disease (tryptophan malabsorption) as cause",
      nc:"D4A017"
    },
    {
      name:"Pre-eclampsia Triad", dx:"PRE-ECLAMPSIA",
      s1:"Hypertension (≥140/90 mmHg after 20 weeks)",
      s2:"Proteinuria (≥300 mg/24h, or dipstick ≥++)",
      s3:"Oedema (especially face, hands — sudden pitting)",
      extra:"Headache · Visual disturbances (scotomata) · Epigastric pain (liver capsule stretch) · ↑Uric acid · ↑Creatinine · HELLP syndrome (Haemolysis + Elevated LFTs + Low Platelets) · Delivery is definitive treatment · MgSO4 for seizure prophylaxis",
      nc:C.pink
    },
    {
      name:"Ectopic Pregnancy Triad", dx:"ECTOPIC PREGNANCY",
      s1:"Amenorrhoea (missed period — 6-8 weeks LMP)",
      s2:"Abdominal pain (unilateral, lower quadrant — may be sudden/severe if ruptured)",
      s3:"Vaginal bleeding (dark brown, irregular spotting)",
      extra:"Shoulder-tip pain (if ruptured — diaphragmatic irritation by blood) · Cervical excitation on PV exam · ↑βhCG but below expected for dates · TV USS: no IUP, adnexal mass · Risk factors: PID, previous ectopic, IUD, IVF · Methotrexate or salpingectomy",
      nc:C.pink, flag:"🚨 EMERGENCY if ruptured"
    },
    {
      name:"Unhappy Triad (O'Donoghue's)", dx:"KNEE INJURY (Blown Knee)",
      s1:"ACL tear (anterior cruciate — Lachman test positive)",
      s2:"MCL tear (medial collateral — valgus stress test positive)",
      s3:"Medial/lateral meniscus tear (McMurray test positive)",
      extra:"Mechanism: valgus + rotation force (contact sports) · Haemarthrosis (rapid swelling within hours) · MRI is investigation of choice · Reconstruction: ACL graft + meniscal repair · Associated with high-level sport · Medial meniscus more common in classic description",
      nc:C.lime
    },
    {
      name:"Samter's Triad (Aspirin Triad)", dx:"ASPIRIN-EXACERBATED RESPIRATORY DISEASE",
      s1:"Aspirin / NSAID sensitivity (bronchospasm within 30-60 min of ingestion)",
      s2:"Nasal polyps (bilateral, eosinophilic)",
      s3:"Asthma (often severe, steroid-dependent)",
      extra:"Also: chronic rhinosinusitis · Eosinophilic airway inflammation · Arachidonic acid pathway: ↑LTC4/D4/E4 leukotrienes · COX-1 inhibitors all trigger · Avoid aspirin/NSAIDs · Leukotriene receptor antagonists helpful · Aspirin desensitisation possible",
      nc:C.teal
    },
    {
      name:"Meniere's Disease Triad", dx:"MENIERE'S DISEASE",
      s1:"Episodic vertigo (rotational, severe, spontaneous — 20 min to 12 hrs)",
      s2:"Tinnitus (low-frequency roaring, worsens during attacks)",
      s3:"Sensorineural hearing loss (unilateral, fluctuating, low-frequency early)",
      extra:"Aural fullness (4th hallmark) · Endolymphatic hydrops on MRI (gadolinium) · Caloric testing: reduced vestibular response · Audiogram: low-frequency notch · Low-salt diet + betahistine · Intratympanic gentamicin or steroids · Endolymphatic sac surgery",
      nc:C.cyan
    },
    {
      name:"Leriche Syndrome Triad", dx:"AORTOILIAC OCCLUSIVE DISEASE",
      s1:"Buttock/thigh claudication (bilateral, exertional)",
      s2:"Erectile dysfunction (impotence — loss of pelvic blood flow)",
      s3:"Symmetrical atrophy of both lower extremities",
      extra:"Cool, pale limbs · Absent femoral pulses bilaterally · ABI <0.9 · CT angiography confirms occlusion at aortic bifurcation · Risk factors: smoking (#1), diabetes, dyslipidaemia · Aortobifemoral bypass or endovascular stenting",
      nc:C.orange
    },
  ];

  rows.forEach((r,i) => {
    const y = 0.76 + i * 0.91;
    const rh = 0.88;
    const alt = i%2===0 ? C.card : C.panel;
    sl.addShape("rect",{x:cols.name,y,w:cw.name,h:rh,fill:{color:alt},line:{color:C.border}});
    sl.addShape("rect",{x:cols.name,y,w:0.18,h:rh,fill:{color:r.nc},line:{color:r.nc}});
    sl.addText(r.name,{x:cols.name+0.22,y:y+0.02,w:cw.name-0.28,h:0.28,fontSize:9,bold:true,color:C.gold,margin:0});
    if(r.flag) sl.addText(r.flag,{x:cols.name+0.22,y:y+0.3,w:cw.name-0.28,h:0.2,fontSize:7,bold:true,color:C.red,margin:0});
    cell(sl,r.dx,    cols.dx,    y,cw.dx,    rh,{bg:alt,fc:C.silver,fs:8,bold:true});
    cell(sl,r.s1,    cols.s1,    y,cw.s1,    rh,{bg:alt,fc:C.white, fs:8.5});
    cell(sl,r.s2,    cols.s2,    y,cw.s2,    rh,{bg:alt,fc:C.white, fs:8.5});
    cell(sl,r.s3,    cols.s3,    y,cw.s3,    rh,{bg:alt,fc:C.white, fs:8.5});
    cell(sl,r.extra, cols.extra, y,cw.extra, rh,{bg:alt,fc:C.silver,fs:7.5,italic:true});
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
//  SLIDE 7 — QUICK-FIRE CHEAT SHEET (MNEMONICS + FLASHCARD GRID)
// ═══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  bg(sl);
  sl.addShape("rect",{x:0,y:0,w:13.3,h:0.42,fill:{color:"1A1A2E"},line:{color:"1A1A2E"}});
  sl.addText("⚡  QUICK-FIRE MNEMONICS & CHEAT SHEET — All Key Triads at a Glance",{
    x:0.15,y:0,w:13,h:0.42,fontSize:13,bold:true,color:C.gold,valign:"middle",charSpacing:2,margin:0});

  const cards = [
    // Row 1
    {name:"Beck's",             diag:"Cardiac Tamponade",         s:"Muffled hearts\nJVD / Neck veins up\nHypotension",        mnem:"BBB: Bag + Bulge + BP↓", c:C.red},
    {name:"Cushing's",          diag:"Raised ICP",                s:"Hypertension\nBradycardia\nIrregular respiration",       mnem:"HBO: HBP + Bradycardia + O2↓", c:C.red},
    {name:"Charcot's (biliary)",diag:"Ascending Cholangitis",     s:"RUQ Pain\nFever + Rigors\nJaundice",                    mnem:"PFJ: Pain-Fever-Jaundice", c:C.green},
    {name:"Charcot's (neuro)",  diag:"Multiple Sclerosis",        s:"Scanning speech\nIntention tremor\nNystagmus",           mnem:"SIN: Speech-Intention-Nystagmus", c:C.teal},
    {name:"Wernicke's",         diag:"Thiamine Deficiency",       s:"Confusion\nOphthalmoplegia\nAtaxia",                    mnem:"COA: Confusion-Ophthalm-Ataxia", c:C.teal},
    // Row 2
    {name:"NPH / Hakim's",      diag:"Normal Pressure Hydrocephalus",s:"Gait disturbance\nUrinary incontinence\nDementia",    mnem:"3 W's: Wobbly-Wet-Wacky", c:C.purple},
    {name:"Virchow's",          diag:"Venous Thrombosis (DVT/PE)", s:"Stasis\nHypercoagulability\nEndothelial injury",        mnem:"SHE: Stasis-Hyper-Endothelial", c:C.maroon},
    {name:"Reactive Arthritis", diag:"Reiter's Syndrome",          s:"Conjunctivitis\nUrethritis\nArthritis",                 mnem:"Can't SEE, PEE, climb a TREE", c:C.purple},
    {name:"Opioid OD",          diag:"Opioid Toxicity",            s:"Pinpoint pupils\nCNS depression\nRespiratory↓",         mnem:"PPR: Pupils-Peristalsis-Respiration", c:C.red},
    {name:"Pellagra (3 D's)",   diag:"Niacin (B3) Deficiency",    s:"Dermatitis\nDiarrhoea\nDementia",                      mnem:"3 D's + Death = 4 D's", c:"D4A017"},
    // Row 3
    {name:"Pheochromocytoma",   diag:"Phaeochromocytoma",          s:"Headache\nDiaphoresis\nPalpitations",                   mnem:"HDP: Head-Diaphoresis-Palp", c:C.orange},
    {name:"Horner's Syndrome",  diag:"Sympathetic interruption",   s:"Ptosis\nMiosis\nAnhidrosis",                           mnem:"PMA: Ptosis-Miosis-Anhidrosis", c:C.purple},
    {name:"Meniere's",          diag:"Meniere's Disease",          s:"Vertigo\nTinnitus\nHearing loss",                      mnem:"VTH: Vertigo-Tinnitus-Hearing", c:C.cyan},
    {name:"Ruptured AAA",       diag:"AAA Rupture",                s:"Abdominal pain\nHypotension/shock\nPulsatile mass",     mnem:"APP: Abdo-Pressure↓-Pulsatile", c:C.red},
    {name:"Lethal Triad",       diag:"Trauma Death",               s:"Hypothermia\nCoagulopathy\nAcidosis",                  mnem:"HCA: Hypo-Coagulo-Acidosis", c:C.red},
    // Row 4
    {name:"Boerhaave (Mackler)", diag:"Oesophageal Perforation",   s:"Vomiting\nThoracic pain\nSubcut. emphysema",            mnem:"VPS: Vomit-Pain-SubcutEmphysema", c:"C06A15"},
    {name:"Rigler's",           diag:"Gallstone Ileus",            s:"Gallstones\nPneumobilia\nSmall bowel obstruction",      mnem:"GPS: Gallstones-Pneumo-SBO", c:C.green},
    {name:"Samter's Triad",     diag:"NSAID-exacerbated Asthma",   s:"Aspirin sensitivity\nNasal polyps\nAsthma",             mnem:"ANA: Aspirin-Nasal-Asthma", c:C.teal},
    {name:"Congenital Rubella", diag:"Rubella Syndrome",           s:"Cataracts\nPDA\nDeafness",                             mnem:"CPD: Cataract-PDA-Deaf", c:C.blue},
    {name:"Aortic Stenosis",    diag:"Aortic Stenosis",            s:"Angina\nSyncope\nHeart failure",                       mnem:"ASH: Angina-Syncope-HF", c:C.orange},
  ];

  const cardsPerRow = 5;
  const cardW = 2.53;
  const cardH = 1.55;
  const startX = 0.12;
  const startY = 0.52;
  const gapX = 0.06;
  const gapY = 0.06;

  cards.forEach((card, i) => {
    const row = Math.floor(i / cardsPerRow);
    const col = i % cardsPerRow;
    const x = startX + col * (cardW + gapX);
    const y = startY + row * (cardH + gapY);

    // Card bg
    sl.addShape("rect",{x,y,w:cardW,h:cardH,fill:{color:C.card},line:{color:C.border},
      shadow:{type:"outer",color:"000000",blur:5,offset:2,angle:135,opacity:0.2}});
    // Color top bar
    sl.addShape("rect",{x,y,w:cardW,h:0.22,fill:{color:card.c},line:{color:card.c}});
    // Triad name
    sl.addText(card.name,{x:x+0.06,y:y+0.01,w:cardW-0.12,h:0.2,fontSize:8.5,bold:true,color:C.white,valign:"middle",margin:0});
    // Diagnosis
    sl.addText(card.diag,{x:x+0.06,y:y+0.22,w:cardW-0.12,h:0.22,fontSize:7.5,bold:true,color:C.gold,valign:"middle",margin:0,italic:true});
    // Symptoms
    sl.addText(card.s,{x:x+0.06,y:y+0.44,w:cardW-0.12,h:0.62,fontSize:8,color:C.white,valign:"top",margin:0,fontFace:"Calibri"});
    // Mnemonic
    sl.addShape("rect",{x:x+0.05,y:y+cardH-0.35,w:cardW-0.1,h:0.3,fill:{color:"0D1B2A"},line:{color:card.c}});
    sl.addText(card.mnem,{x:x+0.08,y:y+cardH-0.34,w:cardW-0.16,h:0.28,fontSize:7,color:card.c,bold:true,valign:"middle",margin:0,italic:true});
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
//  SLIDE 8 — COMPARISON: TRIADS WITH OVERLAPPING SYMPTOMS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  bg(sl);

  sl.addShape("rect",{x:0,y:0,w:13.3,h:0.42,fill:{color:C.purple},line:{color:C.purple}});
  sl.addText("🔍  TRIADS WITH SIMILAR SYMPTOMS — How to Tell Them Apart",{
    x:0.15,y:0,w:13,h:0.42,fontSize:13,bold:true,color:C.white,valign:"middle",charSpacing:1,margin:0});

  // ── GROUP 1: Triads with Jaundice ──────────────────────────────────────────
  sectionTitle(sl,"GROUP 1: TRIADS INVOLVING JAUNDICE",C.green,0.12,0.5,5.5);
  const jCols = {name:0.12,s1:2.1,s2:3.85,s3:5.7,key:7.5};
  const jW    = {name:1.96,s1:1.73,s2:1.83,s3:1.78,key:1.8};
  hdr(sl,"CONDITION",jCols.name,0.82,jW.name,0.25,C.green);
  hdr(sl,"SYMPTOM 1", jCols.s1,  0.82,jW.s1,  0.25,"1A5A3A");
  hdr(sl,"SYMPTOM 2", jCols.s2,  0.82,jW.s2,  0.25,"1A5A3A");
  hdr(sl,"SYMPTOM 3", jCols.s3,  0.82,jW.s3,  0.25,"1A5A3A");
  hdr(sl,"KEY DIFF",  jCols.key, 0.82,jW.key,  0.25,"0B3B22");

  const jRows = [
    {name:"Charcot's Triad",  s1:"RUQ pain",         s2:"Fever + rigors",       s3:"Jaundice",          key:"Acute onset, gallstones, ↑ALP",c:C.green},
    {name:"Budd-Chiari",      s1:"Abdominal pain",   s2:"Ascites (massive)",    s3:"Hepatomegaly",      key:"Slow onset, no fever, Doppler↓",c:C.green},
    {name:"Acute Liver Fail", s1:"Jaundice",         s2:"Coagulopathy (↑INR)",  s3:"Encephalopathy",    key:"No pain, ↑↑PT, paracetamol Hx",c:C.green},
    {name:"Weil's Disease",   s1:"Meningitis signs", s2:"Jaundice",             s3:"Renal failure (AKI)",key:"Rodent/water exposure, biphasic",c:C.blue},
    {name:"Austrian Synd.",   s1:"Pneumonia",        s2:"Endocarditis",         s3:"Meningitis",         key:"All from S. pneumoniae, no jaundice",c:C.blue},
  ];
  jRows.forEach((r,i)=>{
    const y=1.1+i*0.44;const rh=0.42;const alt=i%2===0?C.card:C.panel;
    cell(sl,r.name,jCols.name,y,jW.name,rh,{bg:alt,fc:C.gold,fs:8.5,bold:true});
    cell(sl,r.s1,  jCols.s1,  y,jW.s1,  rh,{bg:alt,fc:C.white,fs:8});
    cell(sl,r.s2,  jCols.s2,  y,jW.s2,  rh,{bg:alt,fc:C.white,fs:8});
    cell(sl,r.s3,  jCols.s3,  y,jW.s3,  rh,{bg:alt,fc:C.white,fs:8});
    cell(sl,r.key, jCols.key, y,jW.key,  rh,{bg:alt,fc:C.gold, fs:7.5,italic:true});
  });

  // ── GROUP 2: Triads with Hypotension ─────────────────────────────────────
  sectionTitle(sl,"GROUP 2: TRIADS INVOLVING HYPOTENSION / SHOCK",C.red,0.12,3.3,5.5);
  const hRows = [
    {name:"Beck's Triad",      s1:"Muffled heart sounds",s2:"JVD / ↑JVP",      s3:"Hypotension",     key:"Pulsus paradoxus, after trauma/pericarditis"},
    {name:"Ruptured AAA",      s1:"Abdominal pain",      s2:"Hypotension",      s3:"Pulsatile mass",  key:"Elderly, smoker, absent femoral pulses"},
    {name:"Lethal Triad",      s1:"Hypothermia",         s2:"Coagulopathy",     s3:"Acidosis",        key:"Trauma context, serial ABGs/labs"},
    {name:"Botulism",          s1:"No fever (afebrile)", s2:"Clear sensorium",  s3:"Descending paralysis",key:"Food source, autonomic signs, no sensory loss"},
    {name:"Opioid OD",         s1:"Pinpoint pupils",     s2:"CNS depression",   s3:"Resp. depression",key:"Naloxone reversal, drug context"},
  ];
  hRows.forEach((r,i)=>{
    const y=3.58+i*0.44;const rh=0.42;const alt=i%2===0?C.card:C.panel;
    cell(sl,r.name,jCols.name,y,jW.name,rh,{bg:alt,fc:C.gold,fs:8.5,bold:true});
    cell(sl,r.s1,  jCols.s1,  y,jW.s1,  rh,{bg:alt,fc:C.white,fs:8});
    cell(sl,r.s2,  jCols.s2,  y,jW.s2,  rh,{bg:alt,fc:C.white,fs:8});
    cell(sl,r.s3,  jCols.s3,  y,jW.s3,  rh,{bg:alt,fc:C.white,fs:8});
    cell(sl,r.key, jCols.key, y,jW.key,  rh,{bg:alt,fc:C.gold, fs:7.5,italic:true});
  });

  // ── GROUP 3: NEUROLOGICAL ─────────────────────────────────────────────────
  sectionTitle(sl,"GROUP 3: NEUROLOGICAL TRIADS",C.teal,7.1,0.5,6.1);
  const nCols={name:7.1,s1:8.9,s2:10.55,s3:12.15};
  const nW  ={name:1.78,s1:1.63,s2:1.58,s3:1.15};
  hdr(sl,"CONDITION",nCols.name,0.82,nW.name,0.25,C.teal);
  hdr(sl,"SYMPTOM 1", nCols.s1,  0.82,nW.s1,  0.25,"0D5F62");
  hdr(sl,"SYMPTOM 2", nCols.s2,  0.82,nW.s2,  0.25,"0D5F62");
  hdr(sl,"SYMPTOM 3", nCols.s3,  0.82,nW.s3,  0.25,"0D5F62");

  const nRows = [
    {name:"Charcot (neuro)",s1:"Scanning speech",    s2:"Intention tremor",   s3:"Nystagmus",         c:C.teal},
    {name:"Wernicke's",     s1:"Confusion",          s2:"Ophthalmoplegia",    s3:"Ataxia",            c:C.teal},
    {name:"NPH / Hakim's",  s1:"Gait disturbance",   s2:"Incontinence",       s3:"Dementia",          c:C.teal},
    {name:"Horner's",       s1:"Ptosis (partial)",   s2:"Miosis (anisocoria)",s3:"Anhidrosis (face)", c:C.purple},
    {name:"Cushing's",      s1:"Hypertension",       s2:"Bradycardia",        s3:"Irreg. respiration",c:C.red},
    {name:"Botulism",       s1:"No fever",           s2:"Clear sensorium",    s3:"Descend. paralysis",c:C.blue},
    {name:"Opioid OD",      s1:"Pinpoint pupils",    s2:"CNS depression",     s3:"Resp. depression",  c:C.red},
  ];
  nRows.forEach((r,i)=>{
    const y=1.1+i*0.44;const rh=0.42;const alt=i%2===0?C.card:C.panel;
    sl.addShape("rect",{x:nCols.name,y,w:nW.name,h:rh,fill:{color:alt},line:{color:C.border}});
    sl.addShape("rect",{x:nCols.name,y,w:0.14,h:rh,fill:{color:r.c},line:{color:r.c}});
    sl.addText(r.name,{x:nCols.name+0.17,y:y+0.06,w:nW.name-0.2,h:0.3,fontSize:8.5,bold:true,color:C.gold,margin:0});
    cell(sl,r.s1,nCols.s1,y,nW.s1,rh,{bg:alt,fc:C.white,fs:8});
    cell(sl,r.s2,nCols.s2,y,nW.s2,rh,{bg:alt,fc:C.white,fs:8});
    cell(sl,r.s3,nCols.s3,y,nW.s3,rh,{bg:alt,fc:C.white,fs:8});
  });

  // ── GROUP 4: Congenital ────────────────────────────────────────────────────
  sectionTitle(sl,"GROUP 4: CONGENITAL TRIADS",C.blue,7.1,4.22,6.1);
  const conRows = [
    {name:"Congenital Rubella",    s1:"Cataracts",             s2:"PDA",                s3:"Sensorineural deafness"},
    {name:"Congenital Toxoplasma", s1:"Chorioretinitis",       s2:"Hydrocephalus",      s3:"Intracranial calcifications"},
    {name:"Congenital Syphilis",   s1:"Interstitial keratitis",s2:"Hutchinson's teeth", s3:"8th nerve deafness (Hutchinson's Triad)"},
  ];
  conRows.forEach((r,i)=>{
    const y=4.5+i*0.44;const rh=0.42;const alt=i%2===0?C.card:C.panel;
    sl.addShape("rect",{x:nCols.name,y,w:nW.name,h:rh,fill:{color:alt},line:{color:C.border}});
    sl.addShape("rect",{x:nCols.name,y,w:0.14,h:rh,fill:{color:C.blue},line:{color:C.blue}});
    sl.addText(r.name,{x:nCols.name+0.17,y:y+0.06,w:nW.name-0.2,h:0.3,fontSize:8.5,bold:true,color:C.gold,margin:0});
    cell(sl,r.s1,nCols.s1,y,nW.s1,rh,{bg:alt,fc:C.white,fs:8});
    cell(sl,r.s2,nCols.s2,y,nW.s2,rh,{bg:alt,fc:C.white,fs:8});
    cell(sl,r.s3,nCols.s3,y,nW.s3,rh,{bg:alt,fc:C.white,fs:8});
  });
}

// ── WRITE ──────────────────────────────────────────────────────────────────────
const outPath = "/home/daytona/workspace/triads-cheatsheet/Medical_Triads_CheatSheet.pptx";
pres.writeFile({fileName:outPath}).then(()=>{
  console.log("SUCCESS:", outPath);
}).catch(err=>console.error("ERROR:",err));
Running Command

cd /home/daytona/workspace/triads-cheatsheet && node build.js 2>&1

Running Command

cd /home/daytona/workspace/triads-cheatsheet && node -e " const pptxgen = require('pptxgenjs'); const p = new pptxgen(); const sl = p.addSlide(); // test shadow sl.addShape('rect',{x:0,y:0,w:2,h:1,fill:{color:'FF0000'},line:{color:'FF0000'},shadow:{type:'outer',color:'000000',blur:5,offset:2,angle:135,opacity:0.2}}); p.writeFile({fileName:'/tmp/test.pptx'}).then(()=>console.log('OK')).catch(e=>console.error('ERR',e.message)); " 2>&1

Running Command

cd /home/daytona/workspace/triads-cheatsheet && node -e " const pptxgen = require('pptxgenjs'); const p = new pptxgen(); p.layout='LAYOUT_WIDE'; const C={bg:'0D1B2A',gold:'F0A500',teal:'17B8BE',red:'E8354A'}; const sl=p.addSlide(); // test the hdr function function hdr(sl,text,color,x,y,w,h) { sl.addShape('rect',{x,y,w,h,fill:{color:color},line:{color:color}}); sl.addText(text,{x:x+0.06,y:y+0.02,w:w-0.12,h:h-0.04,fontSize:9,bold:true,color:'FFFFFF',valign:'middle',align:'center',margin:0,charSpacing:1}); } hdr(sl,'TEST',C.red,0,0,2,0.3); p.writeFile({fileName:'/tmp/test2.pptx'}).then(()=>console.log('OK')).catch(e=>console.error('ERR',e.message)); " 2>&1

Running Command

cd /home/daytona/workspace/triads-cheatsheet && node -e " // Test the card function from slide 7 - specifically the line border around mnemonic box const pptxgen = require('pptxgenjs'); const p = new pptxgen(); p.layout='LAYOUT_WIDE'; const C={bg:'0D1B2A',card:'162C46',border:'1A3A5C',white:'FFFFFF',gold:'F0A500',red:'E8354A',orange:'E87525',teal:'17B8BE'}; const sl=p.addSlide(); // Simulate the flashcard from slide 7 const cardColor='E8354A'; const x=0.12,y=0.52,cardW=2.53,cardH=1.55; sl.addShape('rect',{x,y,w:cardW,h:cardH,fill:{color:C.card},line:{color:C.border},shadow:{type:'outer',color:'000000',blur:5,offset:2,angle:135,opacity:0.2}}); sl.addShape('rect',{x,y,w:cardW,h:0.22,fill:{color:cardColor},line:{color:cardColor}}); sl.addText('Name',{x:x+0.06,y:y+0.01,w:cardW-0.12,h:0.2,fontSize:8.5,bold:true,color:C.white,valign:'middle',margin:0}); sl.addText('Diag',{x:x+0.06,y:y+0.22,w:cardW-0.12,h:0.22,fontSize:7.5,bold:true,color:C.gold,valign:'middle',margin:0,italic:true}); sl.addText('s1\ns2\ns3',{x:x+0.06,y:y+0.44,w:cardW-0.12,h:0.62,fontSize:8,color:C.white,valign:'top',margin:0}); // The mnemonic line with card.c as border color sl.addShape('rect',{x:x+0.05,y:y+cardH-0.35,w:cardW-0.1,h:0.3,fill:{color:'0D1B2A'},line:{color:cardColor}}); sl.addText('mnem',{x:x+0.08,y:y+cardH-0.34,w:cardW-0.16,h:0.28,fontSize:7,color:cardColor,bold:true,valign:'middle',margin:0,italic:true}); p.writeFile({fileName:'/tmp/test3.pptx'}).then(()=>console.log('OK')).catch(e=>console.error('ERR',e.message)); " 2>&1

Running Command

cd /home/daytona/workspace/triads-cheatsheet && node build.js 2>&1 | head -5 # Let me add slide-by-slide error isolation node -e " process.on('unhandledRejection',(r)=>console.error('UNHANDLED',r)); " 2>&1 # Check if the issue is the rich text array with bold/color options node -e " const pptxgen=require('pptxgenjs'); const p=new pptxgen();p.layout='LAYOUT_WIDE'; const sl=p.addSlide(); sl.addShape('rect',{x:0,y:0,w:13.3,h:7.5,fill:{color:'0D1B2A'},line:{color:'0D1B2A'}}); sl.addText([ {text:'• Widened mediastinum ', options:{breakLine:true}}, {text:' test\n', options:{bold:true,color:'F0A500',breakLine:true}}, {text:'• Other signs', options:{}}, ],{x:0.5,y:0.5,w:4,h:1.5,fontSize:11,color:'FFFFFF',fontFace:'Calibri',valign:'top',margin:0}); p.writeFile({fileName:'/tmp/test4.pptx'}).then(()=>console.log('OK')).catch(e=>console.error('ERR',e.message)); " 2>&1

Running Command

grep -n "breakLine.*color\|color.*breakLine" /home/daytona/workspace/triads-cheatsheet/build.js | head -20

Running Command

grep -n "addText\(\[" /home/daytona/workspace/triads-cheatsheet/build.js

Running Command

node -e " const fs=require('fs'); const code=fs.readFileSync('/home/daytona/workspace/triads-cheatsheet/build.js','utf8'); // Find all lines with 'options' in rich text that have both 'color' and might be problematic const lines=code.split('\n'); lines.forEach((l,i)=>{if(l.includes('options:') && (l.includes('color:C') || l.includes('color:')) ) console.log(i+1,l.trim().slice(0,100));}); " 2>&1 | head -30

Running Command

# Narrow down which slide causes the error by running slides one at a time node -e " const pptxgen=require('pptxgenjs'); const fs=require('fs'); // Run just slides 1-4 by checking if the error comes from the wrap:true in cell function // The cell function uses wrap:true - check if that's the issue const p=new pptxgen();p.layout='LAYOUT_WIDE'; const sl=p.addSlide(); sl.addShape('rect',{x:0,y:0,w:2,h:1,fill:{color:'162C46'},line:{color:'1A3A5C'}}); sl.addText('Test wrap',{x:0.05,y:0.02,w:1.9,h:0.96,fontSize:8.5,color:'FFFFFF',valign:'middle',align:'left',bold:false,italic:false,margin:0,fontFace:'Calibri',wrap:true}); p.writeFile({fileName:'/tmp/t5.pptx'}).then(()=>console.log('OK')).catch(e=>console.error('ERR wrap',e.message)); " 2>&1

Running Command

# Try writing just slide 1 from the actual build file to isolate node -e " const pptxgen=require('pptxgenjs'); const p=new pptxgen();p.layout='LAYOUT_WIDE'; const C={bg:'0D1B2A',panel:'112236',card:'162C46',border:'1A3A5C',white:'FFFFFF',silver:'B8C8D8',gold:'F0A500',teal:'17B8BE',red:'E8354A',orange:'E87525',green:'27AE60',purple:'8E44AD',blue:'2980B9',pink:'E91E8C',lime:'7CB518',cyan:'00BCD4',maroon:'C0392B'}; function bg(sl){sl.addShape('rect',{x:0,y:0,w:13.3,h:7.5,fill:{color:C.bg},line:{color:C.bg}});} const sl=p.addSlide();bg(sl); const stripes=[C.red,C.orange,C.green,C.teal,C.purple,C.blue,C.pink,C.lime,C.cyan,C.gold]; stripes.forEach((c,i)=>{sl.addShape('rect',{x:0,y:i*0.75,w:0.22,h:0.75,fill:{color:c},line:{color:c}});}); sl.addShape('rect',{x:0.22,y:0,w:0.06,h:7.5,fill:{color:C.gold},line:{color:C.gold}}); sl.addText('MEDICAL TRIADS',{x:0.55,y:1.2,w:12.5,h:1.6,fontSize:72,bold:true,color:C.white,fontFace:'Calibri',charSpacing:8,align:'left',margin:0}); const specs=[{t:'EMERGENCY',c:C.red},{t:'CARDIOLOGY',c:C.orange},{t:'NEUROLOGY',c:C.teal}]; specs.forEach((s,i)=>{const x=0.55+(i%6)*2.1;const y=4.35+Math.floor(i/6)*0.52;sl.addShape('rect',{x,y,w:1.95,h:0.38,fill:{color:s.c},line:{color:s.c},shadow:{type:'outer',color:'000000',blur:4,offset:2,angle:135,opacity:0.2}});sl.addText(s.t,{x:x+0.05,y:y+0.03,w:1.85,h:0.32,fontSize:9,bold:true,color:C.white,align:'center',valign:'middle',margin:0,charSpacing:1});}); p.writeFile({fileName:'/tmp/s1.pptx'}).then(()=>console.log('Slide1 OK')).catch(e=>console.error('Slide1 ERR',e.message)); " 2>&1

Running Command

# The error says line 5481 - "at slideObjectToXml" - this is text color in run. # Check if the problem is that 'color' in the text options for the card (nc:'D4A017') # is being passed where pptxgenjs expects a global color option but the run-level color conflicts. # The nc for pellagra is "D4A017" as a LITERAL hex string - this is fine. # Let me check if there are any color values that might not be strings in the data: node -e " const C={bg:'0D1B2A',gold:'F0A500'}; // Check what '\"D4A017\"' is as a value console.log(typeof 'D4A017', 'D4A017'.replace); // should be function // The issue is more subtle - let me check the cell function // which has 'fc' being passed as color, and some nc values // In slide 6 row pellagra: nc:'D4A017' - this is a bare hex, fine // But in the card in slide 7, c:'D4A017' is used as card.c // and passed as line:{color:card.c} and fill:{color:card.c} // Let me check the exact card colors in slide 7 const cards=[ {c:'E8354A'},{c:'E87525'},{c:'27AE60'},{c:'17B8BE'},{c:'8E44AD'}, {c:'8E44AD'},{c:'C0392B'},{c:'8E44AD'},{c:'E8354A'},{c:'D4A017'}, {c:'E87525'},{c:'8E44AD'},{c:'00BCD4'},{c:'E8354A'},{c:'E8354A'}, {c:'C06A15'},{c:'27AE60'},{c:'17B8BE'},{c:'2980B9'},{c:'E87525'}, ]; cards.forEach((c,i)=>{ if(typeof c.c !== 'string') console.log('NON-STRING at index',i,c.c); else if(!/^[0-9A-Fa-f]{6}$/.test(c.c)) console.log('INVALID HEX at',i,c.c); }); console.log('All card colors valid'); " 2>&1

Running Command

# The error is at line 5481 in slideObjectToXml which processes text runs. # Check if the issue is the 'italic' option in addText - when italic is passed as a # boolean, some versions have issues. Let me check the `cell` function: # cell uses: italic:!!opts.italic - this would be false if undefined # But in addText the italic property should be boolean. # Actually - the issue could be that the `nc` field used as 'D4A017' in slide 6 # might end up getting passed in the row color check. # Let me run the build.js with a try/catch per slide to find WHICH slide fails: node -e " // Write a modified version that catches per-section const fs = require('fs'); let code = fs.readFileSync('/home/daytona/workspace/triads-cheatsheet/build.js','utf8'); // Replace writeFile to see if we even get there code = code.replace('pres.writeFile', 'console.log(\"Reached writeFile\"); pres.writeFile'); // Wrap entire script execution try { eval(code); } catch(e) { console.error('SYNC ERROR:', e.message, e.stack.split('\n')[1]); } " 2>&1 | head -10

Editing File

~/triads-cheatsheet/build.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/triads-cheatsheet/build.js'
Running Command

cd /home/daytona/workspace/triads-cheatsheet && node build.js 2>&1

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.
This is a shared conversation. Sign in to Orris to start your own chat.