Download index.html from DrZayed/repro-ecg-reasoning-explainer: direct link, hf CLI and curl.
- Browser
- Download file 19.8 kB
-
https://huggingface.co/spaces/DrZayed/repro-ecg-reasoning-explainer/resolve/main/index.html
- Command line
-
hf download hf://spaces/DrZayed/repro-ecg-reasoning-explainer/index.html
-
curl -L -o index.html https://huggingface.co/spaces/DrZayed/repro-ecg-reasoning-explainer/resolve/main/index.html
19.8 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | |
| <title>ECG-Reasoning-Benchmark — Interactive Explainer (arXiv 2603.14326)</title> | |
| <style> | |
| :root { | |
| --bg: #0b1020; | |
| --surface: #131a2e; | |
| --surface-2: #1a233d; | |
| --border: #283457; | |
| --text: #e8edf7; | |
| --muted: #9aa7c7; | |
| --accent: #60a5fa; | |
| --accent-2: #34d399; | |
| --warn: #fbbf24; | |
| --danger: #f87171; | |
| --purple: #a78bfa; | |
| } | |
| * { box-sizing: border-box; } | |
| body { | |
| margin: 0; | |
| font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif; | |
| background: var(--bg); | |
| color: var(--text); | |
| line-height: 1.5; | |
| } | |
| .wrap { max-width: 1120px; margin: 0 auto; padding: 24px 18px 56px; } | |
| .banner { | |
| background: linear-gradient(135deg, #172554, #1e1b4b); | |
| border: 1px solid var(--border); | |
| border-radius: 14px; | |
| padding: 22px 24px; | |
| margin-bottom: 20px; | |
| } | |
| .disclaimer { | |
| display: inline-block; | |
| background: rgba(251, 191, 36, 0.14); | |
| color: var(--warn); | |
| border: 1px solid rgba(251, 191, 36, 0.35); | |
| padding: 4px 10px; | |
| border-radius: 999px; | |
| font-size: 12px; | |
| font-weight: 600; | |
| letter-spacing: 0.02em; | |
| margin-bottom: 10px; | |
| } | |
| h1 { margin: 4px 0 8px; font-size: 26px; line-height: 1.2; } | |
| h2 { margin: 0 0 8px; font-size: 18px; } | |
| p.lead { margin: 0; color: var(--muted); font-size: 15px; } | |
| .kpis { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); | |
| gap: 12px; | |
| margin: 18px 0 24px; | |
| } | |
| .kpi { | |
| background: var(--surface); | |
| border: 1px solid var(--border); | |
| border-radius: 12px; | |
| padding: 14px 16px; | |
| } | |
| .kpi .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; } | |
| .kpi .val { font-size: 24px; font-weight: 700; margin: 4px 0; } | |
| .kpi .sub { font-size: 12px; color: var(--muted); } | |
| .grid-2 { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); | |
| gap: 18px; | |
| margin-bottom: 20px; | |
| } | |
| .card { | |
| background: var(--surface); | |
| border: 1px solid var(--border); | |
| border-radius: 14px; | |
| padding: 18px 20px; | |
| margin-bottom: 18px; | |
| } | |
| .card-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; } | |
| .pill { | |
| display: inline-block; | |
| padding: 2px 8px; | |
| border-radius: 6px; | |
| font-size: 11px; | |
| font-weight: 600; | |
| background: rgba(96, 165, 250, 0.16); | |
| color: var(--accent); | |
| } | |
| .pill.pending { background: rgba(251, 191, 36, 0.16); color: var(--warn); } | |
| .pill.danger { background: rgba(248, 113, 113, 0.16); color: var(--danger); } | |
| .pill.ok { background: rgba(52, 211, 153, 0.16); color: var(--accent-2); } | |
| .audio-grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); | |
| gap: 14px; | |
| } | |
| .audio-box { | |
| background: var(--surface-2); | |
| border: 1px solid var(--border); | |
| border-radius: 10px; | |
| padding: 12px 14px; | |
| } | |
| .audio-box label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; } | |
| audio { width: 100%; height: 38px; } | |
| .controls { | |
| display: flex; | |
| flex-wrap: wrap; | |
| gap: 10px; | |
| margin-bottom: 12px; | |
| align-items: center; | |
| } | |
| input, select { | |
| background: var(--surface-2); | |
| color: var(--text); | |
| border: 1px solid var(--border); | |
| border-radius: 8px; | |
| padding: 7px 11px; | |
| font-size: 13px; | |
| } | |
| .table-wrap { overflow-x: auto; } | |
| table { width: 100%; border-collapse: collapse; font-size: 13px; } | |
| th, td { | |
| padding: 8px 10px; | |
| border-bottom: 1px solid var(--border); | |
| text-align: left; | |
| white-space: nowrap; | |
| } | |
| th { color: var(--muted); font-weight: 600; font-size: 12px; } | |
| tr:hover td { background: rgba(255, 255, 255, 0.03); } | |
| svg { width: 100%; height: auto; display: block; } | |
| .footer { color: var(--muted); font-size: 12px; margin-top: 24px; text-align: center; } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="wrap"> | |
| <div class="banner"> | |
| <div class="disclaimer">Research only, not for clinical use.</div> | |
| <h1>ECG-Reasoning-Benchmark — Interactive Explainer</h1> | |
| <p class="lead"> | |
| Empirical reproduction across <strong>3,084 PTB-XL cases</strong> (2,698 patient clusters; | |
| arXiv <a href="https://arxiv.org/abs/2603.14326" style="color:var(--accent)">2603.14326</a>) | |
| plus Organ-ROI boundary sensitivity on <strong>40 Learn2Reg Abdomen CT pairs</strong> | |
| (arXiv <a href="https://arxiv.org/abs/2509.23355" style="color:var(--accent)">2509.23355</a>; | |
| Brain MRI excluded under DUA). | |
| </p> | |
| </div> | |
| <div class="kpis" id="kpis"> | |
| <div class="kpi"><div class="label">Loading…</div><div class="val">—</div><div class="sub">Reading data.json</div></div> | |
| </div> | |
| <div class="grid-2"> | |
| <div class="card"> | |
| <h2>1. The Teacher-Forcing Illusion <span class="pill ok">Qwen3-VL-8B</span></h2> | |
| <p class="card-sub"> | |
| Diagnosis accuracy surges to <strong>87.42%</strong> when handed ground-truth reasoning (GT-RDA), | |
| yet step-by-step Completion (Hard) is <strong>5.84%</strong>. | |
| </p> | |
| <div id="chart-tf"></div> | |
| </div> | |
| <div class="card"> | |
| <h2>2. The Specialist Trap <span class="pill danger">ECG-R1-8B-RL</span></h2> | |
| <p class="card-sub"> | |
| ECG-R1 hits <strong>85.80%</strong> IDA (PTB-XL training exposure flagged per 2603.14326v2 §5.3), | |
| yet collapses to <strong>22.73%</strong> when given ground-truth reasoning (GT-RDA). | |
| </p> | |
| <div id="chart-trap"></div> | |
| </div> | |
| </div> | |
| <div class="card"> | |
| <h2>3. Organ-ROI Boundary Discovery <span class="pill danger">arXiv 2509.23355</span></h2> | |
| <p class="card-sub"> | |
| 40 Learn2Reg Abdomen CT pairs (Brain MRI excluded under DUA). Locked primary <code>organ_union</code> ROI | |
| is <strong>falsified</strong> (translation r=0.3656, affine r=0.3282 < 0.4), while <code>body_hu</code> sensitivity | |
| tracks the paper (0.7307, 0.6978, 0.6916, 0.4788). | |
| </p> | |
| <div id="chart-roi"></div> | |
| </div> | |
| <div class="card"> | |
| <h2>4. Gate 3 Status & Audio Walkthrough</h2> | |
| <p class="card-sub" id="gate3-line">Gate 3 (C3-E1 autonomous chain & C3-E2 blank-ECG control): loading…</p> | |
| <div class="audio-grid"> | |
| <div class="audio-box"> | |
| <label for="audio-ecg">45s ECG Explainer Walkthrough</label> | |
| <audio id="audio-ecg" controls preload="metadata" src="assets/audio/ecg_explainer_45s_v4.mp3"></audio> | |
| </div> | |
| <div class="audio-box"> | |
| <label for="audio-intro">30s Portfolio Overview</label> | |
| <audio id="audio-intro" controls preload="metadata" src="assets/audio/portfolio_intro_30s.mp3"></audio> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="card"> | |
| <h2>5. 17-Diagnosis CSV Breakdown (3,084 PTB-XL Cases)</h2> | |
| <p class="card-sub">Compare Qwen3-VL-8B-Instruct vs ECG-R1-8B-RL across every PTB-XL diagnostic class.</p> | |
| <div class="controls"> | |
| <input id="dx-search" type="search" placeholder="Filter diagnosis (e.g. Ischemia, Block)..." /> | |
| <select id="dx-sort"> | |
| <option value="diagnosis">Sort: Diagnosis (A–Z)</option> | |
| <option value="qwen_ida">Sort: Qwen3-VL IDA (high → low)</option> | |
| <option value="ecgr1_ida">Sort: ECG-R1 IDA (high → low)</option> | |
| <option value="qwen_gt_rda">Sort: Qwen3-VL GT-RDA (high → low)</option> | |
| <option value="ecgr1_gt_rda">Sort: ECG-R1 GT-RDA (high → low)</option> | |
| <option value="qwen_comp_hard">Sort: Qwen3-VL Comp Hard (high → low)</option> | |
| <option value="qwen_depth">Sort: Qwen3-VL Depth (high → low)</option> | |
| </select> | |
| </div> | |
| <div class="table-wrap"> | |
| <table> | |
| <thead> | |
| <tr> | |
| <th>Diagnosis</th> | |
| <th>Cases</th> | |
| <th>Qwen3-VL IDA</th> | |
| <th>ECG-R1 IDA</th> | |
| <th>Qwen3-VL Comp Hard</th> | |
| <th>ECG-R1 Comp Hard</th> | |
| <th>Qwen3-VL Depth</th> | |
| <th>Qwen3-VL GT-RDA</th> | |
| <th>ECG-R1 GT-RDA</th> | |
| </tr> | |
| </thead> | |
| <tbody id="dx-tbody"> | |
| <tr><td colspan="9">Loading data.json…</td></tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| <div class="footer"> | |
| Research only, not for clinical use. Measured numbers sourced strictly from verified ledger outputs in <code>data.json</code>. | |
| <br>PTB-XL CC-BY-4.0 · ECG-Reasoning QA ODbL · AbdomenCTCT CC-BY-4.0 (Brain MRI excluded under DUA) · Code Apache-2.0 | |
| </div> | |
| </div> | |
| <script> | |
| function hBars(containerId, items, maxVal, unit) { | |
| const el = document.getElementById(containerId); | |
| const w = 480, rowH = 38, padL = 165, padR = 72, padT = 10; | |
| const barW = w - padL - padR; | |
| const h = padT + items.length * rowH + 8; | |
| let svg = `<svg viewBox="0 0 ${w} ${h}" role="img" aria-label="bar chart">`; | |
| items.forEach((it, idx) => { | |
| const y = padT + idx * rowH; | |
| const pct = it.value === null ? 0 : Math.max(0, Math.min(1, it.value / maxVal)); | |
| const bw = Math.round(pct * barW); | |
| svg += `<text x="0" y="${y + 18}" fill="#cbd5e1" font-size="12" font-weight="500">${it.label}</text>`; | |
| svg += `<rect x="${padL}" y="${y + 5}" width="${barW}" height="18" rx="4" fill="#1e293b"/>`; | |
| if (it.value !== null) { | |
| svg += `<rect x="${padL}" y="${y + 5}" width="${bw}" height="18" rx="4" fill="${it.color}"/>`; | |
| svg += `<text x="${padL + barW + 8}" y="${y + 18}" fill="#f8fafc" font-size="12" font-weight="700">${it.value.toFixed(2)}${unit}</text>`; | |
| } else { | |
| svg += `<text x="${padL + 8}" y="${y + 18}" fill="#fbbf24" font-size="11" font-weight="600">${it.pendingLabel || "NOT RUN"}</text>`; | |
| } | |
| }); | |
| svg += `</svg>`; | |
| el.innerHTML = svg; | |
| } | |
| function groupedBars(containerId, groups, maxVal, unit) { | |
| const el = document.getElementById(containerId); | |
| const w = 520, rowH = 50, padL = 145, padR = 64, padT = 24; | |
| const barW = w - padL - padR; | |
| const h = padT + groups.length * rowH + 8; | |
| let svg = `<svg viewBox="0 0 ${w} ${h}" role="img" aria-label="grouped chart">`; | |
| svg += `<rect x="${padL}" y="4" width="10" height="10" rx="2" fill="#60a5fa"/><text x="${padL + 15}" y="13" fill="#cbd5e1" font-size="11">${groups[0].aName}</text>`; | |
| svg += `<rect x="${padL + 150}" y="4" width="10" height="10" rx="2" fill="#f87171"/><text x="${padL + 165}" y="13" fill="#cbd5e1" font-size="11">${groups[0].bName}</text>`; | |
| groups.forEach((g, idx) => { | |
| const y = padT + idx * rowH; | |
| const aw = Math.round(Math.max(0, Math.min(1, g.a / maxVal)) * barW); | |
| const bw = Math.round(Math.max(0, Math.min(1, g.b / maxVal)) * barW); | |
| svg += `<text x="0" y="${y + 22}" fill="#cbd5e1" font-size="12" font-weight="500">${g.label}</text>`; | |
| svg += `<rect x="${padL}" y="${y + 4}" width="${barW}" height="12" rx="3" fill="#1e293b"/>`; | |
| svg += `<rect x="${padL}" y="${y + 4}" width="${aw}" height="12" rx="3" fill="#60a5fa"/>`; | |
| svg += `<text x="${padL + barW + 6}" y="${y + 14}" fill="#93c5fd" font-size="11" font-weight="600">${g.a.toFixed(unit === "%" ? 2 : 3)}${unit}</text>`; | |
| svg += `<rect x="${padL}" y="${y + 20}" width="${barW}" height="12" rx="3" fill="#1e293b"/>`; | |
| svg += `<rect x="${padL}" y="${y + 20}" width="${bw}" height="12" rx="3" fill="#f87171"/>`; | |
| svg += `<text x="${padL + barW + 6}" y="${y + 30}" fill="#fca5a5" font-size="11" font-weight="600">${g.b.toFixed(unit === "%" ? 2 : 3)}${unit}</text>`; | |
| }); | |
| svg += `</svg>`; | |
| el.innerHTML = svg; | |
| } | |
| function render(data) { | |
| const q = data.paper3.qwen3vl.metrics; | |
| const e = data.paper3.ecgr1.metrics; | |
| const g3 = data.paper3.gate3; | |
| const NOT_RUN = "NOT RUN"; | |
| const autoMeasured = g3.c3_e1_autonomous.status === "measured"; | |
| const blankMeasured = g3.c3_e2_blank_ecg.status === "measured"; | |
| const autoVal = autoMeasured ? Number(g3.c3_e1_autonomous.metrics.Completion_Hard) : null; | |
| // Upstream GT_RDA column = final decision on the model's OWN chain in autonomous mode. | |
| const ownChain = autoMeasured && g3.c3_e1_autonomous.own_chain_decision != null | |
| ? Number(g3.c3_e1_autonomous.own_chain_decision) : null; | |
| const ownDiff = ownChain !== null ? ownChain - q.GT_RDA : null; | |
| const blankIda = blankMeasured && g3.c3_e2_blank_ecg.ida != null ? Number(g3.c3_e2_blank_ecg.ida) : null; | |
| const blankGtRda = blankMeasured && g3.c3_e2_blank_ecg.gt_rda != null ? Number(g3.c3_e2_blank_ecg.gt_rda) : null; | |
| const realIda = blankMeasured && g3.c3_e2_blank_ecg.real_stage1_ida != null | |
| ? Number(g3.c3_e2_blank_ecg.real_stage1_ida) : null; | |
| const loc = (blankMeasured && g3.c3_e2_blank_ecg.ida_localization) || {}; | |
| const hits = loc.diagnoses_with_hits || {}; | |
| const avTxt = Object.keys(hits).length | |
| ? Object.entries(hits).map(([k, v]) => `${k.replace(/_/g, " ")} ${v.correct}/${v.total}`).join(", ") | |
| : ""; | |
| const blankTxt = blankMeasured | |
| ? `IDA ${blankIda !== null ? blankIda.toFixed(2) + "%" : "n/a"}` + | |
| (realIda !== null ? ` vs ${realIda.toFixed(2)}% real` : "") + | |
| `, Step-1 ${Number(g3.c3_e2_blank_ecg.step1_accuracy).toFixed(2)}%` + | |
| (blankGtRda !== null ? `, GT-RDA ${blankGtRda.toFixed(2)}%` : "") | |
| : NOT_RUN; | |
| const ownTxt = ownChain !== null | |
| ? `${ownChain.toFixed(2)}% vs ${q.GT_RDA.toFixed(2)}% TF (${ownDiff >= 0 ? "+" : "−"}${Math.abs(ownDiff).toFixed(2)} pp)` | |
| : NOT_RUN; | |
| document.getElementById("kpis").innerHTML = [ | |
| ["Qwen3-VL GT-RDA", `${q.GT_RDA.toFixed(2)}%`, "With GT reasoning (3,084 cases)"], | |
| ["Qwen3-VL Comp (Hard)", `${q.Completion_Hard.toFixed(2)}%`, `Depth ${q.Depth.toFixed(3)} / 4.0`], | |
| ["ECG-R1 IDA → GT-RDA", `${e.IDA.toFixed(2)}% → ${e.GT_RDA.toFixed(2)}%`, "Specialist Trap (−63.07 pp)"], | |
| ["C3-E1 own-chain decision", ownChain !== null ? `${ownChain.toFixed(2)}%` : NOT_RUN, | |
| ownChain !== null ? `vs ${q.GT_RDA.toFixed(2)}% teacher-forced (${ownDiff >= 0 ? "+" : "−"}${Math.abs(ownDiff).toFixed(2)} pp)` : "Autonomous chain"], | |
| ["C3-E2 blank-ECG IDA", blankIda !== null ? `${blankIda.toFixed(2)}%` : NOT_RUN, | |
| avTxt ? `only in ${avTxt}` : "Blank white canvas"], | |
| ].map(([l, v, s]) => `<div class="kpi"><div class="label">${l}</div><div class="val">${v}</div><div class="sub">${s}</div></div>`).join(""); | |
| hBars("chart-tf", [ | |
| { label: "GT-RDA (with GT chain)", value: q.GT_RDA, color: "#34d399" }, | |
| { label: "IDA (no reasoning)", value: q.IDA, color: "#60a5fa" }, | |
| { label: "Self-RDA (own chain)", value: q.Self_RDA, color: "#a78bfa" }, | |
| { label: "Completion (Hard) TF", value: q.Completion_Hard, color: "#f87171" }, | |
| { label: "Autonomous Comp [C3-E1]", value: autoVal, color: "#fbbf24", pendingLabel: NOT_RUN }, | |
| { label: "Own-chain decision [C3-E1]", value: ownChain, color: "#fb923c", pendingLabel: NOT_RUN }, | |
| { label: "Blank-ECG IDA [C3-E2]", value: blankIda, color: "#f472b6", pendingLabel: NOT_RUN }, | |
| ], 100, "%"); | |
| groupedBars("chart-trap", [ | |
| { label: "IDA (no reasoning)", a: q.IDA, b: e.IDA, aName: "Qwen3-VL-8B", bName: "ECG-R1-8B-RL" }, | |
| { label: "GT-RDA (with GT)", a: q.GT_RDA, b: e.GT_RDA, aName: "Qwen3-VL-8B", bName: "ECG-R1-8B-RL" }, | |
| { label: "Self-RDA (own)", a: q.Self_RDA, b: e.Self_RDA, aName: "Qwen3-VL-8B", bName: "ECG-R1-8B-RL" }, | |
| { label: "Completion (Hard)", a: q.Completion_Hard, b: e.Completion_Hard, aName: "Qwen3-VL-8B", bName: "ECG-R1-8B-RL" }, | |
| ], 100, "%"); | |
| const ou = data.paper4_roi_discovery.organ_union; | |
| const bh = data.paper4_roi_discovery.body_hu; | |
| groupedBars("chart-roi", [ | |
| { label: "Translation GT (paper 0.70)", a: bh.translation.mean_r, b: ou.translation.mean_r, aName: "body_hu (sensitivity)", bName: "organ_union (primary falsified)" }, | |
| { label: "Affine GT (paper 0.71)", a: bh.affine.mean_r, b: ou.affine.mean_r, aName: "body_hu (sensitivity)", bName: "organ_union (primary falsified)" }, | |
| { label: "ANTs real GT (paper 0.64)", a: bh.ants.mean_r, b: ou.ants.mean_r, aName: "body_hu (sensitivity)", bName: "organ_union (primary falsified)" }, | |
| { label: "B-spline GT (paper 0.39)", a: bh.bspline.mean_r, b: ou.bspline.mean_r, aName: "body_hu (sensitivity)", bName: "organ_union (primary falsified)" }, | |
| ], 1.0, ""); | |
| document.getElementById("gate3-line").innerHTML = | |
| `<strong>C3-E1 Autonomous:</strong> <span class="pill ${autoVal !== null ? "ok" : "pending"}">${autoVal !== null ? "Comp (Hard) " + autoVal.toFixed(2) + "%" : NOT_RUN}</span> ` + | |
| `<span class="pill ${ownChain !== null ? "ok" : "pending"}">Own-chain decision ${ownTxt}</span> ` + | |
| `<strong>C3-E2 Blank-ECG:</strong> <span class="pill ${blankMeasured ? "ok" : "pending"}">${blankTxt}</span>` + | |
| (avTxt ? ` <span class="pill ok">IDA localized to ${avTxt}</span>` : ""); | |
| const rows = data.paper3.dx_breakdown || []; | |
| const searchEl = document.getElementById("dx-search"); | |
| const sortEl = document.getElementById("dx-sort"); | |
| const tbody = document.getElementById("dx-tbody"); | |
| function drawTable() { | |
| const qStr = (searchEl.value || "").trim().toLowerCase(); | |
| const sortBy = sortEl.value; | |
| const filtered = rows | |
| .filter(r => !qStr || r.diagnosis.toLowerCase().includes(qStr)) | |
| .slice() | |
| .sort((a, b) => { | |
| if (sortBy === "diagnosis") return a.diagnosis.localeCompare(b.diagnosis); | |
| const val = (r) => { | |
| if (sortBy === "qwen_ida") return r.qwen3vl.ida || 0; | |
| if (sortBy === "ecgr1_ida") return r.ecgr1.ida || 0; | |
| if (sortBy === "qwen_gt_rda") return r.qwen3vl.gt_rda || 0; | |
| if (sortBy === "ecgr1_gt_rda") return r.ecgr1.gt_rda || 0; | |
| if (sortBy === "qwen_comp_hard") return r.qwen3vl.completion_hard || 0; | |
| if (sortBy === "qwen_depth") return r.qwen3vl.depth || 0; | |
| return 0; | |
| }; | |
| return val(b) - val(a); | |
| }); | |
| tbody.innerHTML = filtered.map(r => ` | |
| <tr> | |
| <td><strong>${r.diagnosis}</strong></td> | |
| <td>${r.n_cases}</td> | |
| <td>${Number(r.qwen3vl.ida).toFixed(2)}%</td> | |
| <td>${Number(r.ecgr1.ida).toFixed(2)}%</td> | |
| <td>${Number(r.qwen3vl.completion_hard).toFixed(2)}%</td> | |
| <td>${Number(r.ecgr1.completion_hard).toFixed(2)}%</td> | |
| <td>${Number(r.qwen3vl.depth).toFixed(3)}</td> | |
| <td>${Number(r.qwen3vl.gt_rda).toFixed(2)}%</td> | |
| <td>${Number(r.ecgr1.gt_rda).toFixed(2)}%</td> | |
| </tr>`).join(""); | |
| } | |
| searchEl.addEventListener("input", drawTable); | |
| sortEl.addEventListener("change", drawTable); | |
| drawTable(); | |
| } | |
| fetch("./data.json") | |
| .then(r => { if (!r.ok) throw new Error(r.statusText); return r.json(); }) | |
| .then(render) | |
| .catch(err => { | |
| document.getElementById("kpis").innerHTML = | |
| `<div class="kpi"><div class="label">Error</div><div class="val">data.json unavailable</div><div class="sub">${err}</div></div>`; | |
| }); | |
| </script> | |
| </body> | |
| </html> | |