AIMScribe
AIMScribe annotation platform
398effe
Raw History Blame Contribute Delete
10.1 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AIMScribe β€” Annotation Dashboard</title>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<header>
<h1>AIMScribe Β· Annotation Dashboard</h1>
<span class="spacer"></span>
<span class="who" id="who"></span>
<a href="/static/sd.html"><button>Speaker turns</button></a>
<a href="/static/asr.html"><button>Transcription</button></a>
<button id="refresh">Refresh</button>
<button id="logout">Sign out</button>
</header>
<main>
<div class="card">
<strong>Corpus progress</strong>
<div class="grid" id="progress" style="margin-top:12px"></div>
</div>
<div class="card">
<div class="row">
<strong>Annotator scorecards</strong>
<span class="muted">worst gold DER first β€” this table exists to route attention</span>
</div>
<div class="wrap" style="margin-top:10px">
<table>
<thead><tr>
<th>annotator</th><th>status</th><th>subs</th><th>audio&nbsp;min</th>
<th>min/hr</th><th>listen</th>
<th>edit rate</th><th>gold DER</th>
<th>text edit</th><th>gold CER</th><th>gold WER</th>
<th>rejected</th><th>flags</th>
</tr></thead>
<tbody id="people"></tbody>
</table>
</div>
<p class="muted" style="margin:10px 0 0;font-size:12.5px">
<strong>gold DER</strong> β€” speaker-turn error against adjudicated truth.
<strong>gold CER / WER</strong> β€” transcript error against the same. CER leads because
Bengali word spacing varies between annotators, so WER punishes a character-perfect
transcript for choices nobody agrees on.
<strong>edit rate / text edit</strong> β€” how much of the machine draft they changed;
near zero means it was accepted without listening.
<strong>listen</strong> β€” fraction of audio actually played.
<strong>min/hr</strong> β€” audio minutes finished per hour worked.
Dashes mean the annotator has done no work of that type.
</p>
</div>
<div class="card">
<div class="row">
<strong>Inter-annotator agreement</strong>
<span class="muted">the ceiling on every model score you will ever report</span>
</div>
<div id="agree" style="margin-top:10px"></div>
</div>
<div class="card">
<div class="row">
<strong>Review queue</strong>
<span class="muted" id="queueCount"></span>
</div>
<div class="wrap" style="margin-top:10px">
<table>
<thead><tr>
<th>recording</th><th>chunk</th><th>mode</th><th>annotator</th><th>turns</th>
<th>listen</th><th>edit</th><th>gold DER</th>
<th>text</th><th>gold CER</th><th>flags</th><th></th>
</tr></thead>
<tbody id="queue"></tbody>
</table>
</div>
</div>
</main>
<div id="toast"></div>
<script>
'use strict';
const $ = id => document.getElementById(id);
async function api(p, o = {}) {
const r = await fetch(p, { credentials: 'same-origin',
headers: { 'Content-Type': 'application/json' }, ...o });
if (r.status === 401) { location.href = '/static/index.html'; throw new Error('auth'); }
const b = await r.json().catch(() => null);
if (!r.ok) throw new Error(b?.detail || r.statusText);
return b;
}
function toast(m, ms = 2600) {
const t = $('toast'); t.textContent = m; t.style.display = 'block';
clearTimeout(toast._t); toast._t = setTimeout(() => t.style.display = 'none', ms);
}
const pill = (v, good, bad, txt) => {
if (v === null || v === undefined) return '<span class="muted">β€”</span>';
const cls = v <= good ? 'ok' : v >= bad ? 'bad' : 'warn';
return `<span class="pill ${cls}">${txt ?? v}</span>`;
};
async function loadProgress() {
const p = await api('/api/stats/progress');
const cards = [
['recordings', p.recordings],
['tasks', `${p.tasks_touched} / ${p.tasks_total}`],
['audio hours done', `${p.audio_hours_done} / ${p.audio_hours_total}`],
['complete', p.percent_complete + '%'],
['active annotators', p.annotators_active],
['awaiting review', p.annotations_by_status?.submitted ?? 0],
['approved', p.annotations_by_status?.approved ?? 0],
['rejected', p.annotations_by_status?.rejected ?? 0],
];
$('progress').innerHTML = cards.map(([k, v]) =>
`<div class="stat"><div class="v">${v}</div><div class="k">${k}</div></div>`).join('');
}
async function loadPeople() {
const d = await api('/api/stats/annotators');
$('people').innerHTML = d.annotators.map(a => `
<tr>
<td>${a.full_name || a.username}</td>
<td>${a.qualified ? '<span class="pill ok">qualified</span>'
: '<span class="pill warn">calibration</span>'}</td>
<td class="num">${a.submissions}</td>
<td class="num">${a.audio_minutes ?? 'β€”'}</td>
<td class="num">${a.minutes_per_hour ?? 'β€”'}</td>
<td class="num">${pill(1 - (a.listen_ratio ?? 0), 0.1, 0.5,
Math.round((a.listen_ratio ?? 0) * 100) + '%')}</td>
<td class="num">${pill(-(a.mean_edit_rate ?? 0), -0.02, -0.005,
a.mean_edit_rate ?? 'β€”')}</td>
<td class="num">${pill(a.gold_der, 0.25, 0.35)}</td>
<td class="num">${a.mean_text_edit_rate === null || a.mean_text_edit_rate === undefined
? '<span class="muted">β€”</span>'
: pill(-a.mean_text_edit_rate, -0.01, -0.002, a.mean_text_edit_rate)}</td>
<td class="num">${pill(a.gold_cer, 0.15, 0.30)}</td>
<td class="num">${pill(a.gold_wer, 0.25, 0.45)}</td>
<td class="num">${a.rejected}</td>
<td class="num">${a.flagged_submissions ? `<span class="pill bad">${a.flagged_submissions}</span>` : '0'}</td>
</tr>`).join('') || '<tr><td colspan="13" class="muted">No submissions yet.</td></tr>';
}
async function loadAgreement() {
const d = await api('/api/stats/agreement');
if (!d.pairs) {
$('agree').innerHTML = '<span class="muted">No double-annotated chunks finished yet.</span>';
return;
}
const worst = d.items.slice(0, 8).map(i =>
`<tr><td>${i.recording}</td><td>${i.a}</td><td>${i.b}</td>
<td class="num">${pill(1 - i.agreement, 0.2, 0.4, i.agreement)}</td>
<td class="num">${i.text_cer === undefined
? '<span class="muted">β€”</span>' : pill(i.text_cer, 0.15, 0.30)}</td></tr>`).join('');
$('agree').innerHTML = `
<div class="grid" style="margin-bottom:10px">
<div class="stat"><div class="v">${d.mean_agreement ?? 'β€”'}</div>
<div class="k">mean agreement (${d.pairs} pairs)</div></div>
<div class="stat"><div class="v">${d.mean_agreement !== null
? (1 - d.mean_agreement).toFixed(3) : 'β€”'}</div>
<div class="k">implied DER floor for any model</div></div>
</div>
<div class="wrap"><table>
<thead><tr><th>recording</th><th>A</th><th>B</th><th>turn agreement</th>
<th>transcript CER</th></tr></thead>
<tbody>${worst}</tbody></table></div>
<p class="muted" style="margin:8px 0 0;font-size:12.5px">
Lowest-agreement chunks first β€” these are the passages where your guidelines are
ambiguous. Adjudicate them and the definition tightens for everyone.</p>`;
}
async function loadQueue() {
const d = await api('/api/review/queue');
$('queueCount').textContent = `${d.count} awaiting review`;
$('queue').innerHTML = d.items.map(i => `
<tr>
<td>${i.recording}</td><td class="num">${i.chunk + 1}</td>
<td><span class="pill">${i.mode ?? 'diarization'}</span></td>
<td>${i.annotator}</td>
<td class="num">${i.turns} <span class="muted">(draft ${i.draft_turns})</span></td>
<td class="num">${Math.round((i.listen_ratio ?? 0) * 100)}%</td>
<td class="num">${i.edit_rate ?? 'β€”'}</td>
<td class="num">${pill(i.gold_der, 0.25, 0.35)}</td>
<td class="num">${i.wants_text
? `${i.text_edit_rate ?? 'β€”'} <span class="muted">/ ${
Math.round((i.transcript_coverage ?? 0) * 100)}% done</span>`
: '<span class="muted">β€”</span>'}</td>
<td class="num">${pill(i.gold_cer, 0.15, 0.30)}</td>
<td>${i.flags.map(f => `<span class="pill bad">${f.replace('_', ' ')}</span>`).join(' ') || ''}</td>
<td class="row" style="gap:6px">
<button data-ok="${i.annotation_id}">Approve</button>
<button class="danger" data-no="${i.annotation_id}">Reject</button>
<button data-gold="${i.annotation_id}" title="Promote to gold for this chunk">β˜…</button>
</td>
</tr>`).join('') || '<tr><td colspan="12" class="muted">Queue is empty.</td></tr>';
const act = async (id, fn, msg) => { await fn(id); toast(msg); await refresh(); };
$('queue').querySelectorAll('[data-ok]').forEach(b => b.onclick = () =>
act(b.dataset.ok, id => api('/api/review', { method: 'POST',
body: JSON.stringify({ annotation_id: +id, decision: 'approved' }) }), 'Approved'));
$('queue').querySelectorAll('[data-no]').forEach(b => b.onclick = () => {
const note = prompt('Reason for rejection (sent to the annotator):', '');
if (note === null) return;
act(b.dataset.no, id => api('/api/review', { method: 'POST',
body: JSON.stringify({ annotation_id: +id, decision: 'rejected', note }) }), 'Rejected');
});
$('queue').querySelectorAll('[data-gold]').forEach(b => b.onclick = () =>
act(b.dataset.gold, id => api(`/api/adjudicate/${id}`, { method: 'POST' }),
'Promoted to gold'));
}
async function refresh() {
try {
const me = await api('/api/me');
$('who').textContent = `${me.full_name || me.username} Β· ${me.role}`;
await Promise.all([loadProgress(), loadPeople(), loadAgreement(), loadQueue()]);
} catch (e) { toast(e.message, 5000); }
}
$('refresh').onclick = refresh;
$('logout').onclick = async () => {
await fetch('/api/logout', { method: 'POST', credentials: 'same-origin' }).catch(() => {});
location.href = '/static/index.html';
};
document.addEventListener('DOMContentLoaded', refresh);
</script>
</body>
</html>