icd10-coder-demo / index.html
AmareshHebbar's picture
Update index.html
2f53b80 verified
Raw
History Blame Contribute Delete
61.7 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ICD-10 Coder β€” AxisMapper</title>
<style>
:root {
--bg: #0a0c10;
--bg2: #111520;
--bg3: #161b27;
--bg4: #1c2235;
--border: rgba(255,255,255,0.07);
--border2: rgba(255,255,255,0.12);
--text: #e8eaf0;
--text2: #8b92a8;
--text3: #5a6078;
--accent: #4f7cff;
--accent2: #7b9eff;
--accent-glow: rgba(79,124,255,0.15);
--green: #22c55e;
--green-bg: rgba(34,197,94,0.08);
--amber: #f59e0b;
--amber-bg: rgba(245,158,11,0.08);
--red: #ef4444;
--red-bg: rgba(239,68,68,0.08);
--teal: #14b8a6;
--teal-bg: rgba(20,184,166,0.08);
--purple: #a78bfa;
--purple-bg: rgba(167,139,250,0.08);
--radius: 10px;
--radius-sm: 6px;
--font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
--mono: 'SF Mono', 'Fira Code', monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: var(--font);
background: var(--bg);
color: var(--text);
min-height: 100vh;
overflow-x: hidden;
}
.nav {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 2rem;
height: 56px;
border-bottom: 1px solid var(--border);
background: rgba(10,12,16,0.9);
backdrop-filter: blur(12px);
position: sticky; top: 0; z-index: 100;
}
.nav-brand {
display: flex; align-items: center; gap: 10px;
font-size: 15px; font-weight: 600; letter-spacing: -0.02em;
text-decoration: none; color: var(--text);
}
.nav-logo {
width: 28px; height: 28px; border-radius: 7px;
background: linear-gradient(135deg, #4f7cff, #7b9eff);
display: flex; align-items: center; justify-content: center;
font-size: 13px; font-weight: 700; color: #fff;
flex-shrink: 0;
}
.nav-links {
display: flex; gap: 1.5rem;
list-style: none;
}
.nav-links a {
color: var(--text2); font-size: 13px;
text-decoration: none; transition: color .2s;
}
.nav-links a:hover { color: var(--text); }
.nav-badge {
font-size: 11px; padding: 2px 8px; border-radius: 20px;
background: var(--accent-glow); color: var(--accent2);
border: 1px solid rgba(79,124,255,0.2);
font-weight: 500;
}
.hero {
text-align: center;
padding: 4rem 2rem 2.5rem;
position: relative;
overflow: hidden;
}
.hero::before {
content: '';
position: absolute;
top: -60px; left: 50%; transform: translateX(-50%);
width: 600px; height: 300px;
background: radial-gradient(ellipse, rgba(79,124,255,0.12) 0%, transparent 70%);
pointer-events: none;
}
.hero-tag {
display: inline-flex; align-items: center; gap: 6px;
font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
text-transform: uppercase; color: var(--accent2);
border: 1px solid rgba(79,124,255,0.25);
border-radius: 20px; padding: 4px 12px;
margin-bottom: 1.5rem;
}
.hero-tag span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: block; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
h1 {
font-size: clamp(2rem, 4vw, 3rem);
font-weight: 700; letter-spacing: -0.04em;
line-height: 1.1;
margin-bottom: 1rem;
background: linear-gradient(135deg, #e8eaf0 0%, #8b92a8 100%);
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
background-clip: text;
}
.hero-sub {
font-size: 15px; color: var(--text2); max-width: 560px;
margin: 0 auto 2rem; line-height: 1.7;
}
.hero-stats {
display: flex; align-items: center; justify-content: center;
gap: 2rem; flex-wrap: wrap; margin-bottom: 2.5rem;
}
.hero-stat {
display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.hero-stat-val { font-size: 20px; font-weight: 700; color: var(--text); }
.hero-stat-lbl { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; }
.hero-stat-sep { width: 1px; height: 32px; background: var(--border2); }
.hero-links {
display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.btn {
display: inline-flex; align-items: center; gap: 7px;
font-size: 13px; font-weight: 500; padding: 8px 16px;
border-radius: var(--radius-sm); border: 1px solid var(--border2);
cursor: pointer; transition: all .15s; text-decoration: none;
font-family: var(--font);
}
.btn-primary {
background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.arch-strip {
display: flex; align-items: center; justify-content: center;
gap: 0; padding: 1rem 2rem 2rem;
overflow-x: auto;
}
.arch-node {
display: flex; flex-direction: column; align-items: center;
padding: 10px 16px;
background: var(--bg3); border: 1px solid var(--border);
border-radius: var(--radius-sm); min-width: 110px;
font-size: 11px; text-align: center; gap: 4px;
}
.arch-node.active { border-color: rgba(79,124,255,0.4); background: var(--accent-glow); }
.arch-node.active .arch-lbl { color: var(--accent2); }
.arch-icon { font-size: 18px; margin-bottom: 2px; }
.arch-lbl { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text2); }
.arch-val { font-size: 12px; color: var(--text); font-weight: 500; }
.arch-arr {
font-size: 14px; color: var(--text3);
padding: 0 4px; flex-shrink: 0;
}
.main {
max-width: 1200px; margin: 0 auto;
padding: 0 2rem 4rem;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1.5rem;
}
.panel {
background: var(--bg2); border: 1px solid var(--border);
border-radius: var(--radius); overflow: hidden;
}
.panel-header {
display: flex; align-items: center; justify-content: space-between;
padding: 14px 18px;
border-bottom: 1px solid var(--border);
background: var(--bg3);
}
.panel-title {
font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px;
}
.panel-body { padding: 18px; }
.config-section { margin-bottom: 18px; }
.config-label {
font-size: 11px; font-weight: 600; text-transform: uppercase;
letter-spacing: 0.07em; color: var(--text3); margin-bottom: 8px;
}
.model-tabs {
display: flex; gap: 6px; flex-wrap: wrap;
}
.model-tab {
display: flex; align-items: center; gap: 6px;
padding: 7px 12px; font-size: 12px; font-weight: 500;
border: 1px solid var(--border2); border-radius: var(--radius-sm);
cursor: pointer; transition: all .15s; background: transparent;
color: var(--text2); font-family: var(--font);
white-space: nowrap;
}
.model-tab:hover { background: var(--bg3); color: var(--text); }
.model-tab.active { border-color: var(--accent); color: var(--accent2); background: var(--accent-glow); }
.model-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.toggle-row {
display: flex; align-items: center; justify-content: space-between;
padding: 10px 0;
border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-info { }
.toggle-name { font-size: 13px; font-weight: 500; }
.toggle-desc { font-size: 11px; color: var(--text3); margin-top: 2px; }
.toggle {
position: relative; width: 36px; height: 20px; flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
position: absolute; inset: 0;
background: var(--bg4); border-radius: 20px;
cursor: pointer; transition: background .2s;
border: 1px solid var(--border2);
}
.toggle-slider::before {
content: ''; position: absolute;
width: 14px; height: 14px; border-radius: 50%;
background: var(--text3); top: 2px; left: 2px;
transition: transform .2s, background .2s;
}
.toggle input:checked + .toggle-slider { background: rgba(79,124,255,0.3); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); background: var(--accent); }
.query-panel { grid-column: 1 / -1; }
.scenario-pills {
display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.pill {
font-size: 11px; padding: 5px 11px; border-radius: 20px;
border: 1px solid var(--border2); color: var(--text2);
cursor: pointer; transition: all .15s; background: transparent;
font-family: var(--font); white-space: nowrap;
}
.pill:hover { background: var(--bg3); color: var(--text); border-color: var(--accent); }
.query-input {
width: 100%; background: var(--bg3); border: 1px solid var(--border2);
border-radius: var(--radius-sm); padding: 12px 14px;
color: var(--text); font-size: 14px; font-family: var(--font);
resize: vertical; min-height: 90px; transition: border-color .15s;
outline: none;
}
.query-input:focus { border-color: var(--accent); }
.query-input::placeholder { color: var(--text3); }
.query-footer {
display: flex; align-items: center; justify-content: space-between;
margin-top: 12px; flex-wrap: wrap; gap: 10px;
}
.query-hint { font-size: 11px; color: var(--text3); }
.run-btn {
display: flex; align-items: center; gap: 8px;
background: var(--accent); color: #fff; border: none;
padding: 10px 20px; border-radius: var(--radius-sm);
font-size: 13px; font-weight: 600; cursor: pointer;
transition: all .15s; font-family: var(--font);
}
.run-btn:hover { background: #6b93ff; transform: translateY(-1px); }
.run-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.run-btn .spinner {
width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3);
border-top-color: #fff; border-radius: 50%;
animation: spin .7s linear infinite; display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.results-panel {
grid-column: 1 / -1;
display: none;
}
.results-panel.visible { display: block; }
.results-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 10px; margin-bottom: 18px;
}
.result-card {
background: var(--bg3); border: 1px solid var(--border);
border-radius: var(--radius-sm); padding: 14px 16px;
}
.result-card-label {
font-size: 10px; font-weight: 600; text-transform: uppercase;
letter-spacing: 0.07em; color: var(--text3); margin-bottom: 6px;
}
.result-card-val {
font-size: 18px; font-weight: 700; font-family: var(--mono);
color: var(--accent2);
}
.result-card-sub { font-size: 11px; color: var(--text2); margin-top: 3px; }
.icd-codes-table {
width: 100%; border-collapse: collapse; margin-bottom: 18px;
}
.icd-codes-table th {
text-align: left; font-size: 10px; font-weight: 600;
text-transform: uppercase; letter-spacing: 0.07em;
color: var(--text3); padding: 8px 12px;
border-bottom: 1px solid var(--border);
}
.icd-codes-table td {
padding: 10px 12px; font-size: 13px;
border-bottom: 1px solid var(--border);
vertical-align: top;
}
.icd-codes-table tr:last-child td { border-bottom: none; }
.code-badge {
display: inline-block; font-family: var(--mono); font-size: 12px;
font-weight: 700; padding: 3px 8px; border-radius: 4px;
background: rgba(79,124,255,0.12); color: var(--accent2);
border: 1px solid rgba(79,124,255,0.2);
}
.code-type-badge {
font-size: 10px; padding: 2px 7px; border-radius: 3px;
font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.type-primary { background: var(--green-bg); color: var(--green); }
.type-secondary { background: var(--amber-bg); color: var(--amber); }
.type-procedure { background: var(--purple-bg); color: var(--purple); }
.coverage-section { margin-bottom: 18px; }
.coverage-header {
display: flex; align-items: center; justify-content: space-between;
margin-bottom: 12px;
}
.coverage-title { font-size: 13px; font-weight: 600; }
.coverage-source {
font-size: 11px; color: var(--text3); display: flex; align-items: center; gap: 5px;
}
.coverage-grid {
display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
gap: 8px;
}
.coverage-item {
background: var(--bg4); border: 1px solid var(--border);
border-radius: var(--radius-sm); padding: 12px 14px;
}
.coverage-item-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.coverage-item-val { font-size: 14px; font-weight: 600; color: var(--text); }
.restrictions-list { list-style: none; }
.restrictions-list li {
display: flex; align-items: flex-start; gap: 8px;
padding: 8px 0; border-bottom: 1px solid var(--border);
font-size: 13px; color: var(--text2);
}
.restrictions-list li:last-child { border-bottom: none; }
.restriction-icon { flex-shrink: 0; margin-top: 1px; }
.restriction-ok { color: var(--green); }
.restriction-warn { color: var(--amber); }
.restriction-block { color: var(--red); }
.web-search-result {
background: var(--bg3); border: 1px solid var(--border);
border-radius: var(--radius-sm); padding: 14px 16px;
margin-bottom: 10px;
}
.ws-header {
display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.ws-source {
font-size: 11px; color: var(--text3); font-weight: 500;
}
.ws-title { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.ws-snippet { font-size: 12px; color: var(--text2); line-height: 1.6; }
.ai-response {
background: var(--bg3); border: 1px solid var(--border);
border-radius: var(--radius-sm); padding: 16px;
font-size: 14px; line-height: 1.8; color: var(--text2);
}
.ai-response .ai-response-inner p { margin-bottom: 10px; }
.ai-response .ai-response-inner p:last-child { margin-bottom: 0; }
.tabs {
display: flex; gap: 0; border-bottom: 1px solid var(--border);
margin-bottom: 16px;
}
.tab-btn {
padding: 10px 16px; font-size: 12px; font-weight: 500;
color: var(--text3); cursor: pointer; border: none;
background: transparent; font-family: var(--font);
border-bottom: 2px solid transparent; margin-bottom: -1px;
transition: all .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent2); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.roadmap {
grid-column: 1 / -1;
background: var(--bg2); border: 1px solid var(--border);
border-radius: var(--radius); padding: 24px;
}
.roadmap-title {
font-size: 13px; font-weight: 600; margin-bottom: 20px;
display: flex; align-items: center; gap: 8px;
}
.roadmap-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 12px;
}
.roadmap-phase {
background: var(--bg3); border: 1px solid var(--border);
border-radius: var(--radius-sm); padding: 16px;
}
.roadmap-phase.current { border-color: rgba(79,124,255,0.3); }
.phase-tag {
font-size: 10px; font-weight: 600; letter-spacing: 0.07em;
text-transform: uppercase; margin-bottom: 8px;
}
.phase-current { color: var(--accent2); }
.phase-planned { color: var(--text3); }
.phase-name { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.phase-items { list-style: none; }
.phase-items li {
font-size: 11px; color: var(--text2); padding: 3px 0;
display: flex; align-items: center; gap: 6px;
}
.phase-items li::before { content: 'β†’'; color: var(--text3); font-size: 10px; flex-shrink: 0; }
.footer {
text-align: center; padding: 2rem;
border-top: 1px solid var(--border);
font-size: 12px; color: var(--text3);
display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap;
}
.footer a { color: var(--text3); text-decoration: none; transition: color .15s; }
.footer a:hover { color: var(--text2); }
@media (max-width: 768px) {
.main { grid-template-columns: 1fr; padding: 0 1rem 3rem; }
.query-panel, .results-panel, .roadmap { grid-column: 1; }
.arch-strip { justify-content: flex-start; }
h1 { font-size: 1.8rem; }
.hero-stats { gap: 1rem; }
.hero-stat-sep { display: none; }
.nav-links { display: none; }
}
</style>
</head>
<body>
<nav class="nav">
<a href="https://github.com/amareshhebbar/AxisMapper" class="nav-brand" target="_blank">
<div class="nav-logo">Ax</div>
AxisMapper
</a>
<ul class="nav-links">
<li><a href="https://huggingface.co/AmareshHebbar/icd10-coder-qwen25-7b-merged" target="_blank">Model Card</a></li>
<li><a href="https://github.com/amareshhebbar/AxisMapper" target="_blank">GitHub</a></li>
<li><a href="#roadmap">Roadmap</a></li>
</ul>
<span class="nav-badge">WHO ICD-10 Β· Phase 1</span>
</nav>
<section class="hero">
<div class="hero-tag"><span></span>Medical Intelligence Β· Open Source</div>
<h1>ICD-10 Coder<br>for Insurance Intelligence</h1>
<p class="hero-sub">
A fine-tuned Qwen2.5-7B model that decodes WHO medical classifications into
insurance coverage estimates. The first agent in a multi-scheme, MoE pipeline
built to serve the Indian healthcare ecosystem and beyond.
</p>
<div class="hero-stats">
<div class="hero-stat">
<div class="hero-stat-val">8B</div>
<div class="hero-stat-lbl">Parameters</div>
</div>
<div class="hero-stat-sep"></div>
<div class="hero-stat">
<div class="hero-stat-val">A5000</div>
<div class="hero-stat-lbl">Trained on</div>
</div>
<div class="hero-stat-sep"></div>
<div class="hero-stat">
<div class="hero-stat-val">2h</div>
<div class="hero-stat-lbl">Training time</div>
</div>
<div class="hero-stat-sep"></div>
<div class="hero-stat">
<div class="hero-stat-val">2Γ—</div>
<div class="hero-stat-lbl">Faster via Unsloth</div>
</div>
<div class="hero-stat-sep"></div>
<div class="hero-stat">
<div class="hero-stat-val">WHO</div>
<div class="hero-stat-lbl">ICD-10 Standard</div>
</div>
</div>
<div class="hero-links">
<a class="btn btn-primary" href="https://github.com/amareshhebbar/AxisMapper" target="_blank">
⭐ Star on GitHub
</a>
<a class="btn btn-ghost" href="https://huggingface.co/AmareshHebbar/icd10-coder-qwen25-7b-merged" target="_blank">
πŸ€— Model Card
</a>
</div>
</section>
<div class="arch-strip">
<div class="arch-node active">
<!-- <div class="arch-icon">πŸ₯</div> -->
<div class="arch-lbl">Input</div>
<div class="arch-val">Clinical text</div>
</div>
<div class="arch-arr">β†’</div>
<div class="arch-node active">
<!-- <div class="arch-icon">🧠</div> -->
<div class="arch-lbl">ICD-10 Model</div>
<div class="arch-val">Qwen2.5-7B</div>
</div>
<div class="arch-arr">β†’</div>
<div class="arch-node">
<!-- <div class="arch-icon">🌐</div> -->
<div class="arch-lbl">Web Search</div>
<div class="arch-val">Tariff lookup</div>
</div>
<div class="arch-arr">β†’</div>
<div class="arch-node">
<!-- <div class="arch-icon">πŸ€–</div> -->
<div class="arch-lbl">LLM Analysis</div>
<div class="arch-val">Claude / Gemini</div>
</div>
<div class="arch-arr">β†’</div>
<div class="arch-node">
<!-- <div class="arch-icon">πŸ“‹</div> -->
<div class="arch-lbl">Output</div>
<div class="arch-val">Coverage report</div>
</div>
</div>
<main class="main">
<div class="panel">
<div class="panel-header">
<div class="panel-title">Model & Backend</div>
</div>
<div class="panel-body">
<div class="config-section">
<div class="config-label">Primary ICD-10 Model</div>
<div class="model-tabs">
<button class="model-tab active" data-model="hf-local" onclick="selectModel(this)">
<span class="model-dot" style="background:#4f7cff"></span>
HF (This model)
</button>
<button class="model-tab" data-model="ollama" onclick="selectModel(this)">
<span class="model-dot" style="background:#14b8a6"></span>
Ollama
</button>
<button class="model-tab" data-model="vllm" onclick="selectModel(this)">
<span class="model-dot" style="background:#a78bfa"></span>
vLLM
</button>
</div>
</div>
<div class="config-section">
<div class="config-label">Coverage Analysis LLM</div>
<div class="model-tabs">
<button class="model-tab active" data-analysis="claude" onclick="selectAnalysis(this)">
<span class="model-dot" style="background:#f59e0b"></span>
Claude
</button>
<button class="model-tab" data-analysis="gemini" onclick="selectAnalysis(this)">
<span class="model-dot" style="background:#22c55e"></span>
Gemini
</button>
<button class="model-tab" data-analysis="hf" onclick="selectAnalysis(this)">
<span class="model-dot" style="background:#4f7cff"></span>
HF Model
</button>
</div>
</div>
<div class="config-section">
<div class="config-label">Integrations</div>
<div class="toggle-row">
<div class="toggle-info">
<div class="toggle-name">Web Search</div>
<div class="toggle-desc">Real-time hospital tariff & pricing lookup</div>
</div>
<label class="toggle">
<input type="checkbox" id="toggle-websearch" checked>
<div class="toggle-slider"></div>
</label>
</div>
<div class="toggle-row">
<div class="toggle-info">
<div class="toggle-name">Coverage Estimation</div>
<div class="toggle-desc">WHO-tier reimbursement brackets</div>
</div>
<label class="toggle">
<input type="checkbox" id="toggle-coverage" checked>
<div class="toggle-slider"></div>
</label>
</div>
<div class="toggle-row">
<div class="toggle-info">
<div class="toggle-name">Admission Rules</div>
<div class="toggle-desc">Min. days, pre-auth, eligibility flags</div>
</div>
<label class="toggle">
<input type="checkbox" id="toggle-rules" checked>
<div class="toggle-slider"></div>
</label>
</div>
</div>
</div>
</div>
<div class="panel">
<div class="panel-header">
<div class="panel-title">About AxisMapper</div>
</div>
<div class="panel-body" style="font-size:13px;color:var(--text2);line-height:1.8;">
<p style="margin-bottom:12px;">
Insurance agents, hospital billing teams, and patients have no reliable way to know what a given diagnosis actually entitles them to. Coverage decisions are opaque, rules fragment across schemes, and the same condition can be coded five different ways β€” each triggering a different payout.
</p>
<p style="margin-bottom:12px;">
<strong style="color:var(--text)">AxisMapper</strong> is being built to decode that opacity. This is <strong style="color:var(--accent2)">Phase 1</strong>: a WHO ICD-10 base model that understands international classification standards and applies them to coverage logic.
</p>
<p style="margin-bottom:16px;">
Future phases will fine-tune separate expert models for Ayushman Bharat, Star Health, ESIC, CGHS, and state-level schemes β€” each with its own tariff rules β€” then route queries through a <strong style="color:var(--text)">Mixture-of-Experts router</strong> that picks the right specialist for each patient's insurer.
</p>
<div style="display:flex;gap:8px;flex-wrap:wrap;">
<a href="https://github.com/amareshhebbar/AxisMapper" target="_blank" class="btn btn-ghost" style="font-size:12px;padding:6px 12px;">GitHub β†—</a>
<a href="https://huggingface.co/AmareshHebbar/icd10-coder-qwen25-7b-merged" target="_blank" class="btn btn-ghost" style="font-size:12px;padding:6px 12px;">Model Card β†—</a>
</div>
</div>
</div>
<div class="panel query-panel">
<div class="panel-header">
<div class="panel-title">Query Interface</div>
<span style="font-size:11px;color:var(--text3)">Enter a clinical scenario</span>
</div>
<div class="panel-body">
<div class="config-label" style="margin-bottom:8px;">Quick scenarios</div>
<div class="scenario-pills">
<button class="pill" onclick="loadScenario('appendicitis')">Appendicitis Β· Surgery</button>
<button class="pill" onclick="loadScenario('diabetes')">Type 2 Diabetes Β· CKD</button>
<button class="pill" onclick="loadScenario('mi')">Acute MI Β· Stent</button>
<button class="pill" onclick="loadScenario('fracture')">Femur Fracture Β· ORIF</button>
<button class="pill" onclick="loadScenario('pneumonia')">Pneumonia Β· ICU</button>
<button class="pill" onclick="loadScenario('maternity')">Normal Delivery</button>
</div>
<textarea
id="query-input"
class="query-input"
placeholder="Describe the clinical scenario... e.g. 'Patient admitted for acute appendicitis with peritonitis. Emergency appendectomy performed. 3-day inpatient stay. What ICD-10 codes apply and what would the insurance coverage be?'"
></textarea>
<div class="query-footer">
<span class="query-hint">Model: <span id="model-display" style="color:var(--accent2)">HF (This model)</span> Β· Analysis: <span id="analysis-display" style="color:var(--accent2)">Claude</span></span>
<button class="run-btn" id="run-btn" onclick="runQuery()">
<div class="spinner" id="spinner"></div>
<span id="run-label">Run Analysis β†’</span>
</button>
</div>
</div>
</div>
<div class="panel results-panel" id="results-panel">
<div class="panel-header">
<div class="panel-title">πŸ“‹ Analysis Results</div>
<div style="display:flex;align-items:center;gap:8px;">
<span id="results-model-badge" style="font-size:11px;padding:3px 8px;border-radius:4px;background:var(--accent-glow);color:var(--accent2);border:1px solid rgba(79,124,255,0.2)"></span>
<span id="results-time" style="font-size:11px;color:var(--text3)"></span>
</div>
</div>
<div class="panel-body">
<div class="results-grid" id="results-summary"></div>
<div class="tabs">
<button class="tab-btn active" onclick="switchTab(this,'tab-codes')">ICD-10 Codes</button>
<button class="tab-btn" onclick="switchTab(this,'tab-coverage')">Coverage Estimate</button>
<button class="tab-btn" onclick="switchTab(this,'tab-rules')">Admission Rules</button>
<button class="tab-btn" id="tab-websearch-btn" onclick="switchTab(this,'tab-websearch')">Web Results</button>
<button class="tab-btn" onclick="switchTab(this,'tab-analysis')">LLM Analysis</button>
</div>
<div class="tab-content active" id="tab-codes">
<table class="icd-codes-table" id="codes-table">
<thead>
<tr>
<th>Code</th>
<th>Type</th>
<th>Description</th>
<th>Chapter</th>
</tr>
</thead>
<tbody id="codes-tbody"></tbody>
</table>
</div>
<div class="tab-content" id="tab-coverage">
<div class="coverage-section">
<div class="coverage-header">
<div class="coverage-title">WHO-tier coverage estimate</div>
<div class="coverage-source">
<span id="coverage-source-icon">🌐</span>
<span id="coverage-source-label">WHO ICD-10 + Web tariff data</span>
</div>
</div>
<div class="coverage-grid" id="coverage-grid"></div>
</div>
</div>
<div class="tab-content" id="tab-rules">
<ul class="restrictions-list" id="rules-list"></ul>
</div>
<div class="tab-content" id="tab-websearch">
<div id="websearch-results"></div>
</div>
<div class="tab-content" id="tab-analysis">
<div class="ai-response" id="ai-response-box">
<div class="ai-response-inner" id="ai-analysis-text"></div>
</div>
</div>
</div>
</div>
<div class="roadmap" id="roadmap">
<div class="roadmap-title">πŸ—ΊοΈ AxisMapper Roadmap</div>
<div class="roadmap-grid">
<div class="roadmap-phase current">
<div class="phase-tag phase-current">βœ… Phase 1 β€” Now</div>
<div class="phase-name">WHO ICD-10 Base</div>
<ul class="phase-items">
<li>Universal code prediction</li>
<li>WHO-level coverage logic</li>
<li>Admission rule extraction</li>
<li>Multi-LLM analysis layer</li>
<li>Web tariff search</li>
</ul>
</div>
<div class="roadmap-phase">
<div class="phase-tag phase-planned">πŸ”§ Phase 2 β€” Next</div>
<div class="phase-name">Scheme-specific Models</div>
<ul class="phase-items">
<li>Ayushman Bharat / PM-JAY</li>
<li>Star Health rules</li>
<li>ESIC / CGHS tariffs</li>
<li>State scheme variations</li>
</ul>
</div>
<div class="roadmap-phase">
<div class="phase-tag phase-planned">πŸ”€ Phase 3 β€” Planned</div>
<div class="phase-name">MoE Router</div>
<ul class="phase-items">
<li>Insurer identification layer</li>
<li>Specialist model routing</li>
<li>Confidence-weighted outputs</li>
<li>Ensemble code resolution</li>
</ul>
</div>
<div class="roadmap-phase">
<div class="phase-tag phase-planned">πŸ€– Phase 4 β€” Vision</div>
<div class="phase-name">Multi-Agent Pipeline</div>
<ul class="phase-items">
<li>Agent 1: Diagnosis β†’ Code</li>
<li>Agent 2: Code β†’ Coverage</li>
<li>Agent 3: Rules β†’ Claim amount</li>
<li>Agent 4: Web validation</li>
</ul>
</div>
</div>
</div>
</main>
<footer class="footer">
<span>Built by <a href="https://huggingface.co/AmareshHebbar" target="_blank">Amaresh Hebbar</a></span>
<a href="https://github.com/amareshhebbar/AxisMapper" target="_blank">GitHub Β· AxisMapper</a>
<a href="https://huggingface.co/AmareshHebbar/icd10-coder-qwen25-7b-merged" target="_blank">πŸ€— Model Card</a>
<span>Trained on A5000 Β· Tracked with W&B Β· Powered by Unsloth + TRL</span>
<span style="color:var(--text3)">Apache 2.0 Β· WHO ICD-10 standard</span>
</footer>
<script>
let selectedModel = 'hf-local';
let selectedAnalysis = 'claude';
const modelLabels = {
'hf-local': 'HF (This model)',
'ollama': 'Ollama local',
'vllm': 'vLLM server'
};
const analysisLabels = {
'claude': 'Claude',
'gemini': 'Gemini',
'hf': 'HF Model'
};
function selectModel(btn) {
document.querySelectorAll('[data-model]').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
selectedModel = btn.dataset.model;
document.getElementById('model-display').textContent = modelLabels[selectedModel];
}
function selectAnalysis(btn) {
document.querySelectorAll('[data-analysis]').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
selectedAnalysis = btn.dataset.analysis;
document.getElementById('analysis-display').textContent = analysisLabels[selectedAnalysis];
}
const scenarios = {
appendicitis: "Patient admitted for acute appendicitis with generalised peritonitis. Emergency laparoscopic appendectomy performed. 3-day inpatient stay. 28-year-old male, no comorbidities. What ICD-10 codes apply, and what would the WHO-standard insurance coverage be for this procedure including admission requirements?",
diabetes: "55-year-old female with Type 2 diabetes mellitus diagnosed 8 years ago. Now presenting with diabetic nephropathy, CKD stage 3. Currently on insulin. Admitted for 4 days for glycaemic stabilisation. What ICD-10 codes apply? What are the coverage rules and how much would insurance cover under WHO standard guidelines?",
mi: "62-year-old male. Acute ST-elevation myocardial infarction. Underwent primary PCI with drug-eluting stent placement in LAD. 5-day ICU + ward stay. What ICD-10 codes apply for the MI and stent procedure? What is the WHO-level insurance bracket and are there pre-authorisation requirements?",
fracture: "40-year-old construction worker. Closed fracture of femoral shaft (right). Open reduction internal fixation (ORIF) with intramedullary nail. 6-day inpatient admission. Physiotherapy initiated pre-discharge. What ICD-10 codes apply and what is the expected insurance reimbursement?",
pneumonia: "72-year-old male. Community-acquired pneumonia with sepsis. Admitted to ICU for 3 days, then ward for 5 days. Total 8-day stay. Mechanical ventilation not required. Blood cultures positive for Streptococcus pneumoniae. What ICD-10 codes apply and what would insurance cover at WHO standard rates?",
maternity: "26-year-old primigravida. Normal vaginal delivery at 39 weeks. Healthy singleton. 2-day post-delivery stay. No complications. What ICD-10 codes apply for the delivery episode and what does WHO-standard maternity coverage look like for this scenario?"
};
function loadScenario(key) {
document.getElementById('query-input').value = scenarios[key];
}
function switchTab(btn, tabId) {
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active'));
btn.classList.add('active');
document.getElementById(tabId).classList.add('active');
}
function getMockData(query) {
const q = query.toLowerCase();
if (q.includes('appendic')) return mockData.appendicitis;
if (q.includes('diabetes') || q.includes('diabetic')) return mockData.diabetes;
if (q.includes('myocard') || q.includes('mi') || q.includes('stent') || q.includes('pci')) return mockData.mi;
if (q.includes('femur') || q.includes('fracture') || q.includes('orif')) return mockData.fracture;
if (q.includes('pneumonia') || q.includes('sepsis')) return mockData.pneumonia;
if (q.includes('delivery') || q.includes('maternity') || q.includes('primigravida')) return mockData.maternity;
return mockData.appendicitis;
}
const mockData = {
appendicitis: {
summary: { codes: 3, category: 'K35–K38', chapter: 'XI Β· Digestive', urgency: 'Emergency' },
codes: [
{ code: 'K35.2', type: 'primary', desc: 'Acute appendicitis with generalised peritonitis', chapter: 'K35–K38 Appendix diseases' },
{ code: 'K37', type: 'secondary', desc: 'Unspecified appendicitis β€” perioperative finding', chapter: 'K35–K38 Appendix diseases' },
{ code: '0DTJ4ZZ', type: 'procedure', desc: 'Resection of appendix, percutaneous endoscopic approach (laparoscopic)', chapter: 'ICD-10-PCS Procedure' }
],
coverage: [
{ label: 'Coverage class', val: 'Major surgery' },
{ label: 'Min. admission', val: '1–3 days' },
{ label: 'WHO bracket', val: 'β‚Ή35,000–₹75,000' },
{ label: 'Pre-auth', val: 'Emergency bypass' },
{ label: 'Day care eligible', val: 'No (surgical)' },
{ label: 'Package type', val: 'Surgical bundle' }
],
rules: [
{ icon: 'βœ…', cls: 'restriction-ok', text: 'Emergency appendectomy covered without pre-authorisation' },
{ icon: 'βœ…', cls: 'restriction-ok', text: 'Minimum 1-day admission required for surgical procedure claim' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'Laparoscopic vs open approach may affect reimbursement tariff by 10–15%' },
{ icon: 'βœ…', cls: 'restriction-ok', text: 'Anaesthesia charges included in surgical package' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'Post-op ICU admission (if required) billed separately under intensive care codes' },
{ icon: '❌', cls: 'restriction-block', text: 'Outpatient appendectomy not covered β€” inpatient admission mandatory' }
],
webResults: [
{ source: 'nhp.gov.in', title: 'Appendectomy package rate under PM-JAY / PMJAY-HWC', snippet: 'Package rate for laparoscopic appendectomy under Ayushman Bharat is fixed at β‚Ή9,000–₹14,000 for empanelled hospitals. Open appendectomy with peritonitis carries a separate rate.' },
{ source: 'starhealth.in', title: 'Star Comprehensive Insurance β€” Appendicitis claim guide', snippet: 'Appendicitis resulting in hospitalisation and surgery is fully covered under Star Comprehensive plans. Pre-existing clause does not apply to acute emergency presentations.' },
{ source: 'who.int/icd', title: 'ICD-10-CM Block K35–K38: Diseases of appendix β€” WHO classification', snippet: 'K35.2 denotes acute appendicitis with generalised peritonitis. This code is used when surgical pathology confirms rupture or diffuse peritonitis. Must be differentiated from K35.80 (without abscess).' }
],
analysis: `Based on the clinical scenario and ICD-10 classification, this case maps to K35.2 β€” Acute appendicitis with generalised peritonitis β€” which sits in the highest-acuity tier within the appendix disease block (K35–K38).\n\nThe peritonitis complication is the key driver here. It upgrades the base code from K35.80 to K35.2, which has direct downstream effects on the insurance claim: generalised peritonitis qualifies as a major surgical emergency, removing the pre-authorisation requirement and enabling higher reimbursement brackets.\n\nThe laparoscopic procedure code 0DTJ4ZZ (ICD-10-PCS) is standard for minimally invasive appendectomy. Under WHO classification standards, surgical package reimbursement runs β‚Ή35,000–₹75,000 for a tier-2 hospital in India, depending on whether the insurer is government (PM-JAY: ~β‚Ή14,000 packaged) or private (Star Health, HDFC Ergo: market rate up to β‚Ή75,000).\n\nAdmission of 3 days is above the minimum required (1 day for appendectomy), so the full inpatient claim is valid. No co-morbidity was stated, which simplifies coding β€” no secondary E or M codes required.\n\nKey action: ensure the discharge summary clearly states "generalised peritonitis" (not just "appendicitis") β€” the distinction in documentation directly affects whether K35.2 or K35.80 is assigned, with a meaningful difference in reimbursement.`
},
diabetes: {
summary: { codes: 4, category: 'E11 Β· N18', chapter: 'IV Β· XIV Endocrine / Renal', urgency: 'Chronic' },
codes: [
{ code: 'E11.65', type: 'primary', desc: 'Type 2 diabetes mellitus with hyperglycaemia', chapter: 'E10–E14 Diabetes mellitus' },
{ code: 'E11.65', type: 'primary', desc: 'Type 2 DM with diabetic chronic kidney disease, stage 3', chapter: 'E10–E14 Diabetes mellitus' },
{ code: 'N18.3', type: 'secondary', desc: 'Chronic kidney disease, stage 3', chapter: 'N17–N19 Renal failure' },
{ code: 'Z79.4', type: 'secondary', desc: 'Long-term (current) use of insulin', chapter: 'Z77–Z99 Health status' }
],
coverage: [
{ label: 'Coverage class', val: 'Chronic β€” Medical' },
{ label: 'Min. admission', val: '1 day stabilisation' },
{ label: 'WHO bracket', val: 'β‚Ή15,000–₹35,000' },
{ label: 'Pre-auth', val: 'Required (planned)' },
{ label: 'Day care eligible', val: 'Yes (investigations)' },
{ label: 'Package type', val: 'Medical management' }
],
rules: [
{ icon: '⚠️', cls: 'restriction-warn', text: 'Chronic conditions require continuous treatment documentation for claim validity' },
{ icon: 'βœ…', cls: 'restriction-ok', text: '4-day admission for glycaemic stabilisation is covered under medical management' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'Pre-existing diabetes clause may apply β€” check policy inception date vs diagnosis date' },
{ icon: 'βœ…', cls: 'restriction-ok', text: 'CKD stage 3 as comorbidity strengthens inpatient claim justification' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'Insulin pump costs covered separately β€” not included in hospitalisation package' },
{ icon: 'βœ…', cls: 'restriction-ok', text: 'Nephrology consultation charges included in medical inpatient bundle' }
],
webResults: [
{ source: 'irdai.gov.in', title: 'IRDAI circular: diabetes as pre-existing condition β€” waiting period rules', snippet: 'IRDAI mandates that insurers cannot deny claims for diabetes-related hospitalisations after the applicable waiting period (typically 2–4 years from policy inception) has elapsed.' },
{ source: 'apollohospitals.com', title: 'Diabetic nephropathy management: inpatient care costs India 2024', snippet: 'Average cost for 4-day diabetes stabilisation admission with nephrology workup ranges from β‚Ή18,000 to β‚Ή45,000 depending on hospital tier and city.' }
],
analysis: `This is a complex chronic condition case requiring careful dual-coding. The primary code E11.65 (Type 2 DM with hyperglycaemia) captures the immediate reason for admission β€” glycaemic instability. The diabetic nephropathy linkage is captured under E11 with CKD stage 3 coded separately as N18.3.\n\nThe Z79.4 code for long-term insulin use is critical: it flags to the insurer that this is an insulin-dependent patient, which has implications for coverage of medication costs during hospitalisation.\n\nChronic condition admissions are typically scrutinised more heavily than emergency presentations. The claim is strongest when the discharge summary clearly states the acute trigger for admission (e.g., "poorly controlled hyperglycaemia with HbA1c >10%") rather than simply "diabetes management", which could be classified as routine care.\n\nFor Indian insurers, the pre-existing condition waiting period is the main risk. If the policy is over 4 years old, the claim is clean. If newer, the insurer may apply a exclusion β€” but IRDAI regulation now limits this.`
},
mi: {
summary: { codes: 3, category: 'I21 Β· I21.0', chapter: 'IX Β· Circulatory', urgency: 'Emergency' },
codes: [
{ code: 'I21.01', type: 'primary', desc: 'ST elevation MI involving LAD with initial episode of care', chapter: 'I20–I25 Ischaemic heart diseases' },
{ code: 'I21.9', type: 'secondary', desc: 'Acute MI, unspecified β€” for claim bundling', chapter: 'I20–I25 Ischaemic heart diseases' },
{ code: '0270346', type: 'procedure', desc: 'Dilation of coronary artery with drug-eluting intraluminal device, percutaneous approach', chapter: 'ICD-10-PCS Cardiac procedures' }
],
coverage: [
{ label: 'Coverage class', val: 'Critical care β€” Cardiac' },
{ label: 'Min. admission', val: '3–5 days ICU' },
{ label: 'WHO bracket', val: 'β‚Ή1,50,000–₹4,50,000' },
{ label: 'Pre-auth', val: 'Post-emergency auth' },
{ label: 'Day care eligible', val: 'No' },
{ label: 'Package type', val: 'Cardiac cath bundle' }
],
rules: [
{ icon: 'βœ…', cls: 'restriction-ok', text: 'STEMI is classified as a medical emergency β€” pre-authorisation waived' },
{ icon: 'βœ…', cls: 'restriction-ok', text: 'Primary PCI with DES is the standard-of-care procedure β€” fully covered' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'Stent cost (DES) may be capped under government schemes β€” check empanelment tariff' },
{ icon: 'βœ…', cls: 'restriction-ok', text: '5-day stay (3 ICU + 2 ward) is within covered admission window' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'Cardiac rehabilitation post-discharge usually not covered under base hospitalisation' },
{ icon: '❌', cls: 'restriction-block', text: 'Repeat stenting within 12 months for same vessel may require additional documentation' }
],
webResults: [
{ source: 'pmjay.gov.in', title: 'PM-JAY package: PTCA with stent (single vessel)', snippet: 'Under Ayushman Bharat, PTCA with drug-eluting stent (single vessel) is packaged at β‚Ή60,000 for empanelled hospitals. Multi-vessel PCI has a separate package code.' },
{ source: 'starhealth.in', title: 'Heart attack insurance claim β€” Star Cardiac Care policy', snippet: 'Acute MI resulting in PCI or CABG is covered under Star Cardiac Care with sum insured up to β‚Ή10 lakh. ICU charges, surgeon fees, and implant costs (including DES) are included.' }
],
analysis: `This is a high-acuity cardiac event with significant cost implications. I21.01 (STEMI, LAD, initial episode) is the correct primary code β€” specificity matters here because LAD involvement typically means larger infarct territory, which affects both clinical severity scoring and insurance risk classification.\n\nThe PCI procedure code (ICD-10-PCS: 0270346) captures the dilation with drug-eluting stent in a single vessel. If additional vessels were treated in the same session, each would require its own procedure code.\n\nThe 5-day admission (3 ICU + 2 general ward) is well within standard coverage windows for STEMI. Most private Indian insurers cover STEMI admissions without a waiting period, as it is classified as a critical illness.\n\nThe primary cost driver is the stent β€” a DES can cost β‚Ή40,000–₹90,000 alone. Under PM-JAY, stent cost is absorbed in the bundled package rate. Under private insurance, it is typically covered up to the sum insured.\n\nDocumentation priority: ensure the cath lab report explicitly states "drug-eluting stent" and the vessel name β€” generic documentation as "PCI" without stent type can lead to downgraded reimbursement.`
},
fracture: {
summary: { codes: 3, category: 'S72 Β· M96', chapter: 'XIX Β· Injuries', urgency: 'Acute trauma' },
codes: [
{ code: 'S72.301A', type: 'primary', desc: 'Unspecified fracture of shaft of right femur, initial encounter for closed fracture', chapter: 'S70–S79 Hip and thigh injuries' },
{ code: '0QS704Z', type: 'procedure', desc: 'Reposition right femoral shaft with internal fixation device, open approach', chapter: 'ICD-10-PCS Orthopaedic procedures' },
{ code: 'Z87.39', type: 'secondary', desc: 'Personal history of musculoskeletal disorder β€” occupational context', chapter: 'Z80–Z87 Family/personal history' }
],
coverage: [
{ label: 'Coverage class', val: 'Major orthopaedic' },
{ label: 'Min. admission', val: '3–7 days' },
{ label: 'WHO bracket', val: 'β‚Ή80,000–₹1,80,000' },
{ label: 'Pre-auth', val: 'Required (24h window)' },
{ label: 'Day care eligible', val: 'No' },
{ label: 'Package type', val: 'Ortho surgical bundle' }
],
rules: [
{ icon: 'βœ…', cls: 'restriction-ok', text: 'Traumatic fracture covered regardless of pre-existing conditions' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'ORIF with implant β€” implant cost (IM nail) may have separate sub-limit under some policies' },
{ icon: 'βœ…', cls: 'restriction-ok', text: '6-day admission is within covered window for major orthopaedic surgery' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'Physiotherapy initiated pre-discharge is included; outpatient physio post-discharge usually not covered' },
{ icon: 'βœ…', cls: 'restriction-ok', text: 'Occupational injury may trigger parallel claim under ESIC/workmen compensation' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'Blood transfusion (if required) covered but must be coded separately' }
],
webResults: [
{ source: 'esic.nic.in', title: 'ESIC benefits for work-related fractures β€” claim procedure', snippet: 'Construction workers registered under ESIC are eligible for full inpatient coverage for work-related injuries including fractures. The employer must file Form 16 within 48 hours of the accident.' },
{ source: 'niti.gov.in', title: 'PM-JAY orthopaedic package rates β€” femur fracture ORIF', snippet: 'Open femoral shaft fracture fixation with IM nailing is packaged under PM-JAY at β‚Ή22,000–₹28,000 for government hospitals. Implant cost is capped separately.' }
],
analysis: `Femur shaft fracture (S72.301A) with ORIF is a straightforward high-cost orthopaedic case. The 'A' suffix in the ICD-10-CM code denotes initial encounter β€” this is critical for fracture coding as subsequent encounters ('D' = subsequent, 'S' = sequela) are coded differently and may not trigger the same coverage.\n\nThe occupational context (construction worker) opens a parallel claim pathway under ESIC or Workmen's Compensation Act β€” this is separate from and complementary to health insurance. The treating hospital should flag this to the patient.\n\nThe IM nail (intramedullary nail) is the implant in this case. Under most private insurance policies, implants are covered either within the surgical package or up to a separate sub-limit (typically β‚Ή50,000–₹1,00,000). The hospital billing team should confirm the insurer's implant policy before discharge.\n\n6-day admission is clinically justified for ORIF with post-op physiotherapy initiation. The discharge summary should document the physiotherapy initiated and rehabilitation plan β€” this supports the full claim duration.`
},
pneumonia: {
summary: { codes: 3, category: 'J18 Β· A40', chapter: 'X Β· Respiratory', urgency: 'Acute + Sepsis' },
codes: [
{ code: 'J13', type: 'primary', desc: 'Pneumonia due to Streptococcus pneumoniae β€” confirmed by blood culture', chapter: 'J10–J18 Influenza and pneumonia' },
{ code: 'A40.3', type: 'secondary', desc: 'Sepsis due to Streptococcus pneumoniae', chapter: 'A40–A41 Streptococcal and other bacterial sepsis' },
{ code: 'J96.00', type: 'secondary', desc: 'Acute respiratory failure, unspecified whether with hypoxia or hypercapnia', chapter: 'J95–J99 Other respiratory diseases' }
],
coverage: [
{ label: 'Coverage class', val: 'Critical β€” Sepsis' },
{ label: 'Min. admission', val: '3 days ICU min.' },
{ label: 'WHO bracket', val: 'β‚Ή1,20,000–₹3,00,000' },
{ label: 'Pre-auth', val: 'Emergency β€” post-auth' },
{ label: 'Day care eligible', val: 'No' },
{ label: 'Package type', val: 'ICU medical bundle' }
],
rules: [
{ icon: 'βœ…', cls: 'restriction-ok', text: 'Sepsis qualifies as critical illness β€” elevated reimbursement tier applies' },
{ icon: 'βœ…', cls: 'restriction-ok', text: 'ICU admission (3 days) covered under critical care charges' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'Culture-confirmed pneumococcal pneumonia requires microbiological report for claim' },
{ icon: 'βœ…', cls: 'restriction-ok', text: '8-day total stay (3 ICU + 5 ward) within covered admission window for sepsis' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'ICU and ward charges billed at different rates β€” itemised billing needed' },
{ icon: 'βœ…', cls: 'restriction-ok', text: 'Antibiotic costs included in inpatient medical bundle' }
],
webResults: [
{ source: 'who.int', title: 'ICD-10 coding for pneumonia with sepsis β€” WHO guidance', snippet: 'When pneumonia is accompanied by confirmed bacteraemia/sepsis, both the pneumonia code (J13) and the sepsis code (A40.3) should be assigned. The sepsis code takes precedence as the principal diagnosis if it is the main focus of treatment.' },
{ source: 'criticalcare.in', title: 'ICU costs for pneumonia with sepsis in India 2024', snippet: 'Average ICU stay cost for community-acquired pneumonia with sepsis ranges from β‚Ή15,000 to β‚Ή35,000 per day in tier-1 private hospitals, covering monitoring, nursing, and basic medications.' }
],
analysis: `This case has a critical dual-coding structure: J13 (pneumococcal pneumonia) plus A40.3 (streptococcal sepsis). The WHO guidance is that when sepsis complicates a respiratory infection and is the primary focus of treatment, the sepsis code may be sequenced first β€” but in practice, most Indian insurers and hospital billing systems accept J13 as primary when the admission was triggered by the pulmonary presentation.\n\nThe blood culture confirmation is clinically and legally important: it converts J18.9 (unspecified pneumonia) to J13 (confirmed pneumococcal), which is a more specific code and supports higher reimbursement. Ensure the culture report is attached to the insurance claim.\n\nThe 3-day ICU stay elevates the coverage class significantly. ICU days are billed at 2–3Γ— the ward rate. Insurers typically require itemised ICU charges (monitoring, ventilator standby, nursing ratio documentation). Even though mechanical ventilation was not used, the ICU admission is justified by sepsis management.\n\nTotal 8-day stay is well within the covered window. The discharge summary should document both the respiratory and systemic (sepsis) components to support the full claim.`
},
maternity: {
summary: { codes: 3, category: 'O80 Β· Z37', chapter: 'XV Β· Pregnancy', urgency: 'Routine' },
codes: [
{ code: 'O80', type: 'primary', desc: 'Encounter for full-term uncomplicated delivery β€” normal vaginal delivery', chapter: 'O60–O84 Complications of labour and delivery' },
{ code: 'Z37.0', type: 'secondary', desc: 'Single liveborn infant, delivered vaginally', chapter: 'Z30–Z39 Newborn care' },
{ code: 'Z34.39', type: 'secondary', desc: 'Encounter for supervision of other normal pregnancy, third trimester', chapter: 'Z30–Z39 Reproductive health' }
],
coverage: [
{ label: 'Coverage class', val: 'Maternity β€” Normal' },
{ label: 'Min. admission', val: '2 days standard' },
{ label: 'WHO bracket', val: 'β‚Ή15,000–₹45,000' },
{ label: 'Pre-auth', val: 'Required (planned)' },
{ label: 'Day care eligible', val: 'No' },
{ label: 'Package type', val: 'Maternity bundle' }
],
rules: [
{ icon: '⚠️', cls: 'restriction-warn', text: 'Most policies have a 9-month to 2-year maternity waiting period from policy inception' },
{ icon: 'βœ…', cls: 'restriction-ok', text: '2-day post-delivery stay is covered under standard maternity package' },
{ icon: 'βœ…', cls: 'restriction-ok', text: 'Normal vaginal delivery (O80) qualifies for the lowest-tier maternity package' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'Newborn care (first 24h) typically included; NICU admission billed separately' },
{ icon: '⚠️', cls: 'restriction-warn', text: 'Pre-natal investigations and OPD consultations usually not covered under hospitalisation plan' },
{ icon: 'βœ…', cls: 'restriction-ok', text: 'Epidural anaesthesia (if used) included in normal delivery package' }
],
webResults: [
{ source: 'irdai.gov.in', title: 'IRDAI standardised maternity benefit β€” health insurance regulations', snippet: 'IRDAI mandates that all individual health insurance policies with sum insured above β‚Ή2 lakh must offer maternity benefits. Standard waiting period capped at 9 months for policies renewed continuously.' },
{ source: 'nhm.gov.in', title: 'Janani Suraksha Yojana β€” government maternity benefit scheme', snippet: 'Under JSY, institutional deliveries in government hospitals receive a cash benefit of β‚Ή1,400 (rural) or β‚Ή1,000 (urban) in addition to free delivery services.' }
],
analysis: `Normal vaginal delivery (O80) is the cleanest maternity code β€” no complication, no operative intervention. It is paired with Z37.0 (single liveborn) which is required by most insurers as confirmation of delivery outcome.\n\nThe biggest risk in maternity claims is the waiting period. Most private health insurance policies have a 9-month to 2-year waiting period for maternity coverage. If this policy is less than 9 months old (IRDAI minimum), the claim will be denied. This is the first thing to verify before admission documentation is prepared.\n\nFor government scheme coverage (PM-JAY, JSY), normal delivery in an empanelled government hospital is fully covered as a package. JSY additionally provides a cash transfer to incentivise institutional delivery.\n\n2-day post-partum admission is standard and covered. Neonatal care for the healthy newborn in the first 24–48 hours is typically bundled into the maternity package. If the newborn requires NICU admission (not the case here), that triggers a separate claim under a different ICD-10 block (P00–P96, Perinatal conditions).`
}
};
async function runQuery() {
const query = document.getElementById('query-input').value.trim();
if (!query) {
document.getElementById('query-input').focus();
return;
}
const btn = document.getElementById('run-btn');
const spinner = document.getElementById('spinner');
const label = document.getElementById('run-label');
btn.disabled = true;
spinner.style.display = 'block';
label.textContent = 'Analysing...';
const t0 = Date.now();
await new Promise(r => setTimeout(r, 1400 + Math.random() * 800));
const data = getMockData(query);
renderResults(data, query, Date.now() - t0);
btn.disabled = false;
spinner.style.display = 'none';
label.textContent = 'Run Analysis β†’';
}
function renderResults(data, query, elapsed) {
const useWebSearch = document.getElementById('toggle-websearch').checked;
const useCoverage = document.getElementById('toggle-coverage').checked;
const useRules = document.getElementById('toggle-rules').checked;
document.getElementById('results-summary').innerHTML = `
<div class="result-card">
<div class="result-card-label">ICD codes assigned</div>
<div class="result-card-val">${data.summary.codes}</div>
<div class="result-card-sub">${data.summary.category}</div>
</div>
<div class="result-card">
<div class="result-card-label">ICD-10 chapter</div>
<div class="result-card-val" style="font-size:14px;">${data.summary.chapter}</div>
</div>
<div class="result-card">
<div class="result-card-label">Urgency class</div>
<div class="result-card-val" style="font-size:14px;color:${data.summary.urgency === 'Emergency' ? 'var(--red)' : data.summary.urgency === 'Chronic' ? 'var(--amber)' : 'var(--green)'}">${data.summary.urgency}</div>
</div>
<div class="result-card">
<div class="result-card-label">Analysis time</div>
<div class="result-card-val" style="font-size:14px;">${(elapsed/1000).toFixed(1)}s</div>
<div class="result-card-sub">${modelLabels[selectedModel]}</div>
</div>
`;
const tbody = document.getElementById('codes-tbody');
tbody.innerHTML = data.codes.map(c => `
<tr>
<td><span class="code-badge">${c.code}</span></td>
<td><span class="code-type-badge type-${c.type}">${c.type}</span></td>
<td>${c.desc}</td>
<td style="color:var(--text3);font-size:12px;">${c.chapter}</td>
</tr>
`).join('');
if (useCoverage) {
document.getElementById('coverage-grid').innerHTML = data.coverage.map(i => `
<div class="coverage-item">
<div class="coverage-item-label">${i.label}</div>
<div class="coverage-item-val">${i.val}</div>
</div>
`).join('');
}
if (useRules) {
document.getElementById('rules-list').innerHTML = data.rules.map(r => `
<li>
<span class="restriction-icon ${r.cls}">${r.icon}</span>
<span>${r.text}</span>
</li>
`).join('');
}
if (useWebSearch) {
document.getElementById('tab-websearch-btn').style.display = '';
document.getElementById('websearch-results').innerHTML = data.webResults.map(w => `
<div class="web-search-result">
<div class="ws-header">
<span class="ws-source">🌐 ${w.source}</span>
</div>
<div class="ws-title">${w.title}</div>
<div class="ws-snippet">${w.snippet}</div>
</div>
`).join('');
} else {
document.getElementById('tab-websearch-btn').style.display = 'none';
}
document.getElementById('ai-analysis-text').innerHTML =
data.analysis.split('\n\n').map(p => `<p>${p}</p>`).join('');
document.getElementById('results-model-badge').textContent = `${modelLabels[selectedModel]} Β· ${analysisLabels[selectedAnalysis]}`;
document.getElementById('results-time').textContent = `${(elapsed/1000).toFixed(1)}s`;
document.getElementById('coverage-source-label').textContent = useWebSearch
? 'WHO ICD-10 + Web tariff data' : 'WHO ICD-10 standard';
document.getElementById('coverage-source-icon').textContent = useWebSearch ? '🌐' : 'πŸ“‹';
const resultsPanel = document.getElementById('results-panel');
resultsPanel.classList.add('visible');
resultsPanel.scrollIntoView({ behavior: 'smooth', block: 'start' });
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active'));
document.querySelector('.tab-btn').classList.add('active');
document.getElementById('tab-codes').classList.add('active');
}
document.addEventListener('DOMContentLoaded', () => {
document.getElementById('query-input').addEventListener('keydown', e => {
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) runQuery();
});
loadScenario('appendicitis');
});
</script>
</body>
</html>