Hematuria
hematuria evaluation management
PMID: 40013563
| Type | Definition |
|---|---|
| Gross hematuria | Visible blood in urine; as little as 1 mL blood per liter of urine turns urine red |
| Microscopic hematuria | ≥ 3 RBCs/high-power field (HPF) on urine microscopy in adults |
| Pediatric threshold | > 5 RBCs/HPF on at least 2 weekly samples is considered abnormal |
Persistence = hematuria in > 50% of urine samples on 2-3 separate occasions.
| Pattern | Likely Origin |
|---|---|
| Initial stream | Prostatic or urethral source |
| Terminal stream | Bladder neck / trigone |
| Throughout stream | Bladder, ureter, or upper tract |
Create a clinical decision flowchart for hematuria evaluation by age/risk
ls /home/daytona/workspace/ 2>/dev/null && echo "---" && ls /home/daytona/workspace/hematuria-flowchart/ 2>/dev/null || echo "no hematuria-flowchart dir yet"
mkdir -p /home/daytona/workspace/hematuria-flowchart
~/hematuria-flowchart/flowchart.js
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3" x 7.5"
pres.title = "Hematuria Clinical Decision Flowchart";
const slide = pres.addSlide();
// ── COLOR PALETTE ──────────────────────────────────────────────────
const C = {
bg: "0D1B2A", // deep navy background
startBox: "1565C0", // blue - entry node
decision: "6A1B9A", // purple - decision diamond
yesPath: "2E7D32", // dark green
noPath: "B71C1C", // dark red
actionBox: "00838F", // teal - action/workup
warningBox:"E65100", // orange - urgent
lowRisk: "1B5E20", // dark green - low risk outcome
highRisk: "880E4F", // dark pink - high risk outcome
nephBox: "4527A0", // deep purple - nephrology
textLight: "FFFFFF",
textDark: "FFFFFF",
accent: "FFD600", // yellow accent
lineYes: "66BB6A",
lineNo: "EF5350",
lineNeutral:"90CAF9",
subtext: "B0BEC5",
};
// ── BACKGROUND ─────────────────────────────────────────────────────
slide.addShape(pres.ShapeType.rect, {
x: 0, y: 0, w: 13.3, h: 7.5,
fill: { color: C.bg }, line: { color: C.bg }
});
// ── TITLE BAR ──────────────────────────────────────────────────────
slide.addShape(pres.ShapeType.rect, {
x: 0, y: 0, w: 13.3, h: 0.55,
fill: { color: "1565C0" }, line: { color: "1565C0" }
});
slide.addText("HEMATURIA | Clinical Decision Flowchart (AUA/SUFU 2025)", {
x: 0, y: 0, w: 10.5, h: 0.55,
fontSize: 13, bold: true, color: "FFFFFF", align: "center", valign: "middle", margin: 0
});
slide.addText("Age & Risk-Stratified Evaluation", {
x: 10.5, y: 0, w: 2.8, h: 0.55,
fontSize: 9, color: "FFD600", align: "right", valign: "middle", margin: 4
});
// ─────────────────────────────────────────────────────────────────────────────
// HELPER FUNCTIONS
// ─────────────────────────────────────────────────────────────────────────────
function box(x, y, w, h, label, sublabel, fillColor, opts = {}) {
const radius = opts.radius !== undefined ? opts.radius : 0.08;
slide.addShape(pres.ShapeType.roundRect, {
x, y, w, h,
fill: { color: fillColor },
line: { color: opts.lineColor || "FFFFFF", width: opts.lineWidth || 1.0, transparency: opts.lineTrans || 40 },
rectRadius: radius,
shadow: { type: "outer", blur: 5, offset: 2, angle: 45, color: "000000", opacity: 0.5 }
});
const lines = [];
if (label) {
lines.push({ text: label, options: { bold: true, breakLine: sublabel ? true : false, fontSize: opts.fontSize || 9.5, color: C.textLight } });
}
if (sublabel) {
lines.push({ text: sublabel, options: { bold: false, fontSize: opts.subFontSize || 7.5, color: opts.subColor || "E0E0E0", breakLine: false } });
}
if (lines.length > 0) {
slide.addText(lines, {
x, y, w, h,
align: "center", valign: "middle", margin: 3, wrap: true
});
}
}
function diamond(x, y, w, h, label, fillColor) {
// Approximate diamond with rotated rectangle - use polygon
const cx = x + w / 2, cy = y + h / 2;
const pts = [
{ x: cx, y: y },
{ x: x + w, y: cy },
{ x: cx, y: y + h },
{ x: x, y: cy }
];
slide.addShape(pres.ShapeType.diamond, {
x, y, w, h,
fill: { color: fillColor },
line: { color: "FFFFFF", width: 1, transparency: 30 },
shadow: { type: "outer", blur: 4, offset: 2, angle: 45, color: "000000", opacity: 0.5 }
});
slide.addText(label, {
x, y, w, h,
fontSize: 8.5, bold: true, color: "FFFFFF",
align: "center", valign: "middle", margin: 2, wrap: true
});
}
function arrow(x1, y1, x2, y2, color, label, labelSide) {
slide.addShape(pres.ShapeType.line, {
x: Math.min(x1, x2),
y: Math.min(y1, y2),
w: Math.abs(x2 - x1) || 0.01,
h: Math.abs(y2 - y1) || 0.01,
line: { color: color, width: 1.5, endArrowType: "arrow" },
flipH: x1 > x2,
flipV: y1 > y2
});
if (label) {
const lx = (x1 + x2) / 2 + (labelSide === "right" ? 0.05 : labelSide === "left" ? -0.35 : 0);
const ly = (y1 + y2) / 2 - 0.14;
slide.addText(label, {
x: lx, y: ly, w: 0.4, h: 0.2,
fontSize: 7, bold: true, color: color, align: "center"
});
}
}
function label(x, y, w, h, text, color, fontSize, align) {
slide.addText(text, {
x, y, w, h,
fontSize: fontSize || 7.5, color: color || C.subtext,
align: align || "center", valign: "middle", bold: false, wrap: true
});
}
// ─────────────────────────────────────────────────────────────────────────────
// FLOWCHART LAYOUT
// Column layout (x positions):
// Col A (left lane): x ≈ 0.15 Pediatric path
// Col B (center-left): x ≈ 2.1 Main entry / shared
// Col C (center): x ≈ 4.8 Gross hematuria
// Col D (center-right): x ≈ 7.5 Micro hematuria
// Col E (right): x ≈ 10.2 Risk stratification
//
// Row layout (y positions):
// R1 0.65 Entry
// R2 1.35 Pseudo/confirm
// R3 2.10 Dipstick/micro confirms
// R4 2.85 Type split
// R5 3.60 Key decisions
// R6 4.40 Workup
// R7 5.20 Findings
// R8 6.00 Outcome
// ─────────────────────────────────────────────────────────────────────────────
// ── ENTRY NODE ────────────────────────────────────────────────────
box(4.85, 0.68, 3.6, 0.5, "BLOOD IN URINE / RED URINE", null, C.startBox, { fontSize: 10, lineColor:"FFD600", lineWidth:1.5, lineTrans:0 });
// ── STEP 1: PSEUDOHEMATURIA ───────────────────────────────────────
diamond(4.85, 1.32, 3.6, 0.65, "Urine Microscopy:\n≥3 RBCs/HPF?", "2C387E");
arrow(6.65, 1.18, 6.65, 1.32, C.lineNeutral, null, null);
// NO → pseudohematuria
arrow(8.45, 1.645, 10.1, 1.645, C.lineNo, "NO", "right");
box(10.1, 1.35, 2.95, 0.6, "PSEUDOHEMATURIA", "Drugs / foods / pigments\nNo further workup", "37474F", { fontSize: 8.5, subFontSize: 7 });
// YES → confirm & exclude benign
arrow(6.65, 1.97, 6.65, 2.18, C.lineYes, "YES", "right");
// ── STEP 2: EXCLUDE BENIGN ────────────────────────────────────────
diamond(4.85, 2.18, 3.6, 0.65, "Benign cause?\n(UTI / menstruation / exercise / trauma)", "455A64");
// YES → treat and repeat
arrow(4.85, 2.505, 2.75, 2.505, C.lineYes, "YES", "left");
box(0.2, 2.22, 2.5, 0.6, "TREAT CAUSE", "Repeat UA in 6 weeks.\nIf resolved → no further workup", C.yesPath, { fontSize: 8.5, subFontSize: 7 });
// NO → proceed
arrow(6.65, 2.83, 6.65, 3.05, C.lineNo, "NO", "right");
// ── STEP 3: GROSS vs MICRO SPLIT ─────────────────────────────────
diamond(4.85, 3.05, 3.6, 0.65, "Type of Hematuria?", "37474F");
// LEFT branch: GROSS hematuria
arrow(4.85, 3.375, 3.15, 3.375, C.lineNeutral, null, null);
arrow(3.15, 3.375, 3.15, 3.75, C.lineNeutral, null, null);
box(1.85, 3.75, 2.55, 0.55, "GROSS HEMATURIA", "Visible blood / ≥1 mL/L", "B71C1C", { fontSize: 9, subFontSize: 7.5 });
// RIGHT branch: MICRO hematuria
arrow(8.45, 3.375, 10.05, 3.375, C.lineNeutral, null, null);
arrow(10.05, 3.375, 10.05, 3.75, C.lineNeutral, null, null);
box(8.8, 3.75, 2.55, 0.55, "MICROSCOPIC HEMATURIA", "≥3 RBCs/HPF confirmed", "1565C0", { fontSize: 9, subFontSize: 7.5 });
// ── GROSS PATH ───────────────────────────────────────────────────
// Urgent workup
box(0.85, 4.5, 3.5, 0.7,
"URGENT WORKUP (ED/Urology)",
"CT Urography • Renal US • BUN/Cr • Urine Cx",
C.warningBox, { fontSize: 8.5, subFontSize: 7.5 });
arrow(3.15, 4.3, 3.15, 4.5, C.lineNeutral, null, null);
// Cystoscopy all ages
box(0.85, 5.4, 3.5, 0.65,
"CYSTOSCOPY (All Ages, Gross Hematuria)",
"Rule out bladder/urethral malignancy",
"4A148C", { fontSize: 8.5, subFontSize: 7.5 });
arrow(3.15, 5.2, 3.15, 5.4, C.lineNeutral, null, null);
// Glomerular signs?
diamond(0.85, 6.18, 3.5, 0.65, "Dysmorphic RBCs / RBC casts / Proteinuria?", "37474F");
arrow(3.15, 6.05, 3.15, 6.18, C.lineNeutral, null, null);
// YES → nephrology
arrow(0.85, 6.505, 0.2, 6.505, C.lineYes, "YES", "left");
// label for nephrology - place label carefully
slide.addText("→ NEPHROLOGY", { x: 0.0, y: 6.3, w: 1.0, h: 0.4, fontSize: 7.5, bold: true, color: "CE93D8", align: "left" });
// NO → urology follow
arrow(4.35, 6.505, 4.85, 6.505, C.lineNo, "NO", "right");
box(4.85, 6.22, 1.65, 0.6, "UROLOGY\nFOLLOW-UP", "Repeat evaluation\n3-5 years if negative", C.lowRisk, { fontSize: 8, subFontSize: 7 });
// ── MICRO PATH (RIGHT SIDE) ────────────────────────────────────────
// AGE / RISK decision
diamond(8.8, 4.5, 3.5, 0.65, "Age ≥35 OR Risk Factors\nfor Malignancy?", C.decision);
arrow(10.05, 4.3, 10.05, 4.5, C.lineNeutral, null, null);
// Risk factors callout box (small)
slide.addShape(pres.ShapeType.roundRect, {
x: 11.65, y: 4.38, w: 1.55, h: 1.0,
fill: { color: "1A237E" }, line: { color: "5C6BC0", width: 0.8 }, rectRadius: 0.06
});
slide.addText([
{ text: "Risk Factors:\n", options: { bold: true, fontSize: 7.5, breakLine: false } },
{ text: "Smoking • Aniline dye\nCyclophosphamide\nChronic UTI • Male sex\nAge >35", options: { fontSize: 6.5, color: "B0BEC5" } }
], { x: 11.67, y: 4.4, w: 1.5, h: 0.96, valign: "top", wrap: true, color: "FFFFFF", margin: 3 });
// HIGH RISK / AGE ≥35 → YES
arrow(8.8, 4.825, 7.4, 4.825, C.lineYes, "YES", "left");
box(5.6, 4.58, 1.75, 0.55, "HIGH RISK\nPATH", null, C.highRisk, { fontSize: 9 });
arrow(6.475, 5.13, 6.475, 5.35, C.lineNeutral, null, null);
box(5.25, 5.35, 2.4, 0.7,
"FULL WORKUP",
"CT Urography + Cystoscopy\n+ BUN/Cr + Urine cytology",
C.warningBox, { fontSize: 8.5, subFontSize: 7.5 });
arrow(6.475, 6.05, 6.475, 6.22, C.lineNeutral, null, null);
box(5.25, 6.22, 2.4, 0.6,
"FINDINGS?",
"Manage per diagnosis\nUrologic / Nephologic",
"37474F", { fontSize: 8.5, subFontSize: 7.5 });
// LOW RISK / AGE <35 → NO
arrow(10.05, 5.15, 10.05, 5.35, C.lineNo, "NO", "right");
box(8.8, 5.35, 3.5, 0.6, "LOW RISK PATH", "Age <35, No risk factors", C.yesPath, { fontSize: 9, subFontSize: 7.5 });
arrow(10.05, 5.95, 10.05, 6.12, C.lineNeutral, null, null);
box(8.8, 6.12, 3.5, 0.65,
"RENAL IMAGING + BUN/Cr",
"Renal US or CT Urography\nIf negative → annual UA x3 yrs",
"00695C", { fontSize: 8.5, subFontSize: 7.5 });
arrow(10.05, 6.77, 10.05, 6.95, C.lineNeutral, null, null);
box(8.8, 6.95, 3.5, 0.42,
"Persistent micro hematuria despite negative workup → repeat evaluation in 3-5 yrs",
null, "263238", { fontSize: 7, lineColor: "546E7A", lineTrans: 20 });
// ── GLOMERULAR SIGNS BOX (shared) ────────────────────────────────
box(4.85, 4.58, 0.65, 0.55, "GN\nSIGNS?", null, "880E4F", { fontSize: 7.5, radius: 0.05 });
arrow(6.475, 4.825, 5.5, 4.825, C.lineNeutral, null, null);
slide.addText("Dysmorphic RBCs,\nRBC casts, Protein", {
x: 4.87, y: 5.18, w: 0.65, h: 0.45,
fontSize: 5.8, color: "CE93D8", align: "center", wrap: true
});
arrow(5.175, 5.13, 5.175, 5.62, C.lineNeutral, null, null);
box(4.35, 5.62, 1.6, 0.55, "NEPHROLOGY\nREFERRAL", "Biopsy / GN workup", C.nephBox, { fontSize: 8, subFontSize: 7 });
// ── PEDIATRIC LANE HEADER ─────────────────────────────────────────
slide.addShape(pres.ShapeType.rect, {
x: 0.15, y: 0.58, w: 0.12, h: 6.5,
fill: { color: "0D47A1" }, line: { color: "0D47A1" }
});
slide.addText("PEDIATRIC NOTE", {
x: 0.15, y: 0.58, w: 0.12, h: 2.5,
fontSize: 6, bold: true, color: "90CAF9", align: "center", valign: "middle",
rotate: 270
});
// ── PEDIATRIC NOTE BOX ────────────────────────────────────────────
box(0.3, 0.62, 1.45, 1.4,
"PEDIATRIC\nThreshold",
">5 RBCs/HPF on\n2 weekly samples\n→ Cystoscopy rarely\n indicated <18 yrs\n→ Prioritize nephrology",
"0D47A1", { fontSize: 7, subFontSize: 6.5, radius: 0.06 });
// ── LEGEND ────────────────────────────────────────────────────────
const lx = 0.18, ly = 2.95;
slide.addShape(pres.ShapeType.rect, {
x: lx, y: ly, w: 1.55, h: 2.55,
fill: { color: "102030" }, line: { color: "1E3A5F", width: 0.8 }
});
slide.addText("LEGEND", {
x: lx, y: ly + 0.04, w: 1.55, h: 0.28,
fontSize: 7.5, bold: true, color: C.accent, align: "center"
});
const legendItems = [
{ color: C.startBox, label: "Entry / Start" },
{ color: "2C387E", label: "Decision" },
{ color: C.warningBox,label: "Urgent workup" },
{ color: C.actionBox, label: "Workup step" },
{ color: C.highRisk, label: "High-risk path" },
{ color: C.yesPath, label: "Low-risk / benign" },
{ color: C.nephBox, label: "Nephrology" },
];
legendItems.forEach((item, i) => {
slide.addShape(pres.ShapeType.rect, {
x: lx + 0.1, y: ly + 0.38 + i * 0.3, w: 0.22, h: 0.2,
fill: { color: item.color }, line: { color: item.color }
});
slide.addText(item.label, {
x: lx + 0.36, y: ly + 0.38 + i * 0.3, w: 1.2, h: 0.2,
fontSize: 6.5, color: "CFD8DC", align: "left", valign: "middle"
});
});
// ── FOOTER ────────────────────────────────────────────────────────
slide.addShape(pres.ShapeType.rect, {
x: 0, y: 7.32, w: 13.3, h: 0.18,
fill: { color: "0A1628" }, line: { color: "0A1628" }
});
slide.addText("Sources: Campbell-Walsh-Wein Urology • Rosen's Emergency Medicine • AUA/SUFU Microhematuria Guideline 2025 (PMID: 40013563) | For clinical reference only", {
x: 0, y: 7.32, w: 13.3, h: 0.18,
fontSize: 5.5, color: "607D8B", align: "center", valign: "middle"
});
// ── WRITE FILE ────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/hematuria-flowchart/Hematuria_Flowchart.pptx" })
.then(() => console.log("Done: Hematuria_Flowchart.pptx"))
.catch(e => { console.error(e); process.exit(1); });
cd /home/daytona/workspace/hematuria-flowchart && node flowchart.js 2>&1
ls -lh /home/daytona/workspace/hematuria-flowchart/ && python /home/daytona/skills/pptx/scripts/thumbnail.py /home/daytona/workspace/hematuria-flowchart/Hematuria_Flowchart.pptx 2>&1 | tail -5
find /home/daytona/workspace/hematuria-flowchart/ -name "*.jpg" -o -name "*.png" 2>/dev/null
find / -maxdepth 4 -name "thumbnails.jpg" 2>/dev/null; find / -maxdepth 4 -name "thumbnail*.jpg" 2>/dev/null | head -5
cp /home/daytona/thumbnails.jpg /home/daytona/workspace/hematuria-flowchart/preview.jpg && echo ok
Hematuria Flowchart
Presentation · PPTX
| Color | Represents |
|---|---|
| 🔵 Blue | Entry node and workup steps |
| 🟣 Purple | Decision diamonds (Yes/No branches) |
| 🟠 Orange | Urgent workup (gross hematuria, high-risk) |
| 🔴 Red/Pink | High-risk malignancy path |
| 🟢 Green | Benign/low-risk path and resolved cases |
| 🟤 Dark Purple | Nephrology referral |