File size: 15,920 Bytes
912d2b5
 
 
 
 
 
 
 
e0d876f
912d2b5
 
 
 
e0d876f
 
 
 
 
912d2b5
e0d876f
86b459c
e0d876f
 
 
 
 
 
 
 
912d2b5
86b459c
e0d876f
 
 
 
 
 
 
 
 
 
 
 
912d2b5
 
 
e0d876f
 
 
 
 
 
 
 
 
 
 
 
5080a18
 
e0d876f
 
912d2b5
5080a18
e0d876f
 
912d2b5
e0d876f
 
5080a18
 
 
 
 
 
 
 
 
a075fab
 
 
 
 
5080a18
 
 
 
 
 
 
e0d876f
5080a18
e0d876f
 
 
 
 
a075fab
e0d876f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a075fab
 
 
 
e0d876f
 
 
 
 
 
 
 
 
 
 
 
 
a075fab
e0d876f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
912d2b5
e0d876f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
912d2b5
e0d876f
 
 
 
 
 
 
 
 
912d2b5
e0d876f
912d2b5
 
e0d876f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
912d2b5
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>SCQC admin</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Hind:wght@400;500;600&family=Hind+Siliguri:wght@400;500;600&display=swap">
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<header class="bar">
  <h1>SCQC</h1>
  <div class="actions" style="align-items:center">
    <span class="userchip hidden" id="me"><span class="avatar" id="me-avatar"></span><span class="small" id="me-name"></span></span>
    <button id="logout" class="hidden">Log out</button>
  </div>
</header>
<nav class="tabs hidden" id="tabs" aria-label="Sections">
  <button data-tab="projects" data-role="admin">Projects</button>
  <button data-tab="dashboard" data-role="admin">Dashboard</button>
  <button data-tab="builder" data-role="admin">Task Builder</button>
  <button data-tab="review">Review Queue</button>
  <button data-tab="analytics" data-role="admin">Analytics</button>
  <button data-tab="payments" data-role="admin">Payments</button>
  <button data-tab="team" data-role="admin">Team</button>
</nav>

<main class="wrap wide">
  <section id="tab-projects" class="hidden"></section>
  <!-- Login / first-run setup -->
  <section id="login" class="panel stack hidden" style="max-width:460px;margin:40px auto 0">
    <h2 style="margin-top:0" id="login-title">Log in</h2>
    <form id="login-form" class="stack">
      <div><label for="l-user">User name</label><input type="text" id="l-user" required autocomplete="username"></div>
      <div id="l-name-row" class="hidden"><label for="l-name">Your name</label><input type="text" id="l-name" autocomplete="name"></div>
      <div><label for="l-pass">Password</label><input type="password" id="l-pass" required autocomplete="current-password"></div>
      <div id="l-token-row" class="hidden"><label for="l-token">Server admin token (SCQC_ADMIN_TOKEN)</label>
        <input type="password" id="l-token" autocomplete="off">
        <p class="small muted">No accounts exist yet. The token proves you run this server; the account you create here is its first admin.</p></div>
      <div class="actions"><button class="primary" type="submit" id="l-submit">Log in</button></div>
      <p class="errors small" id="login-error" role="alert"></p>
    </form>
  </section>

  <section id="tab-dashboard" class="hidden stack"></section>

  <section id="tab-builder" class="hidden stack">
    <div class="panel stack">
      <div class="actions" style="justify-content:space-between;align-items:center">
        <h2 style="margin:0">Project</h2>
        <div class="actions"><button id="b-new">New project</button><button id="b-load">Load selected project</button></div>
      </div>
      <div class="row">
        <div><label for="b-pid">Project ID</label><input type="text" id="b-pid" placeholder="e.g. HINDI_READ_2026"></div>
        <div><label for="b-title">Title</label><input type="text" id="b-title"></div>
      </div>
      <details class="project-languages"><summary>Languages <span class="muted small">· Select languages</span></summary><div class="checks" id="b-langs"></div></details>
      <details class="project-advanced"><summary>Advanced project settings · Consent and rewards</summary><div class="row">
        <div><label for="b-consent-version">Consent version</label><input type="text" id="b-consent-version" value="v1"></div>
        <div><label for="b-reward">Default reward per approved recording (₹)</label><input type="text" id="b-reward" inputmode="decimal" value="0"></div>
      </div>
      </details>
      <div class="actions"><button id="b-apply-project">Apply project settings</button></div>
    </div>

    <div class="panel stack">
      <h2 style="margin-top:0">Create a new task</h2>
      <div class="panel workflow-panel" style="margin-bottom:12px">
        <label for="workflow-type">Project workflow</label>
        <select id="workflow-type" aria-label="Project workflow">
          <option value="collection">Speech Collection</option>
          <option value="auditing">Dataset Auditing (existing audio and references)</option>
        </select>
        <p class="muted small" id="workflow-help">Collect new speech with configurable quality checks.</p>
        <div id="collection-options">
          <label for="collection-focus">Speech task</label>
          <select id="collection-focus"><option value="read_speech">Read speech</option><option value="image_description">Image-prompted / spontaneous speech</option></select>
          <div id="validation-mode-wrap" style="margin-top:12px"><label for="validation-mode">Validation mode</label>
            <select id="validation-mode"><option value="lexical">Lexical fidelity — match expected words</option><option value="semantic">Semantic / intent fidelity — allow equivalent commands</option></select>
            <p class="muted small">Semantic mode uses explicitly configured equivalent phrases and confusable intents; uncertain cases go to human review. It does not claim open-ended semantic understanding.</p>
          </div>
          <label class="checks" style="margin-top:12px"><span><input type="checkbox" id="prosody-enabled"> Enable prosody-focused collection</span></label>
          <p class="muted small" id="prosody-help">Off by default. Enable for intonation, focus, pauses, or expressive delivery.</p>
          <div id="prosody-options" class="hidden"><label for="prosody-focus">Prosody task</label>
            <select id="prosody-focus"><option value="prosody_pair">Meaning-changing prosody pair</option><option value="tts_prosody">Punctuation and emphasis</option><option value="emotion">Expressive delivery</option></select></div>
        </div>
        <p id="audit-notice" class="muted small hidden">Dataset auditing is a project-level workflow. The existing recording task editor is disabled here until the audio/reference import and adjudication pipeline is configured. No recordings will be imported automatically.</p>
      </div>
      <div class="row">
        <div class="hidden"><label for="t-type">Task type</label>
          <select id="t-type">
            <option value="read_speech">Read speech (ASR data)</option>
            <option value="image_description">Image-prompted speech (ASR data)</option>
            <option value="tts_prosody">TTS reading: punctuation and emphasis</option>
            <option value="prosody_pair">Prosody minimal pair (one member)</option>
            <option value="command">Legacy command (existing projects only)</option>
            <option value="emotion">Expressive speech</option>
          </select></div>
        <div><label for="t-lang">Language</label><select id="t-lang"></select></div>
      </div>
      <div class="row">
        <div><label for="t-id">Task ID</label><input type="text" id="t-id" placeholder="left empty: generated"></div>
        <div><label for="t-level">Validation level</label>
          <select id="t-level">
            <option value="L1">L1 Acoustic: signal checks only</option>
            <option value="L2" selected>L2 Intelligent: acoustic + ASR matching</option>
            <option value="L3">L3 Task-specific: + intent, prosody, alignment</option>
            <option value="L4">L4 Human verified: + two reviewers</option>
          </select></div>
      </div>
      <div class="t-field" data-for="read_speech tts_prosody prosody_pair command"><label for="t-text">Prompt text</label>
        <textarea id="t-text" style="min-height:70px;font-family:inherit;font-size:1.2rem"></textarea></div>
      <div class="t-field row" data-for="image_description">
        <div><label for="t-image">Image link (Google Drive or https)</label><input type="text" id="t-image"></div>
        <div><label for="t-scenario">Instruction shown with the image</label><input type="text" id="t-scenario"></div>
      </div>
      <div class="t-field" data-for="image_description"><label for="t-suggested">Suggested text (a guide for reviewers, never an exact target)</label>
        <textarea id="t-suggested" style="min-height:60px;font-family:inherit;font-size:1rem"></textarea></div>
      <div class="t-field row" data-for="tts_prosody prosody_pair">
        <div><label for="t-emphasis">Word to stress (optional)</label><input type="text" id="t-emphasis"></div>
        <div class="t-field" data-for="prosody_pair"><label for="t-pair">Pair ID (both members share it)</label><input type="text" id="t-pair"></div>
      </div>
      <div class="t-field" data-for="prosody_pair"><label for="t-interp">Intended meaning (shown to the speaker, hidden from listeners)</label><input type="text" id="t-interp"></div>
      <div class="t-field row" data-for="read_speech command" id="intent-fields">
        <div><label for="t-intent">Expected intent ID (semantic mode)</label><input type="text" id="t-intent" placeholder="e.g. lights_on"></div>
        <div><label for="t-confusable">Confusable intent IDs (comma-separated)</label><input type="text" id="t-confusable"></div>
        <div><label for="t-equivalents">Equivalent spoken phrases (one per line)</label><textarea id="t-equivalents" placeholder="बत्ती जला दो" rows="3"></textarea></div>
      </div>
      <div class="t-field" data-for="emotion"><label for="t-situation">Situation</label><input type="text" id="t-situation"></div>
      <div class="t-field" data-for="emotion"><label for="t-emotion">Target emotion (never shown to the speaker)</label><input type="text" id="t-emotion"></div>
      <div class="row">
        <div><label for="t-conf">Auto-accept at confidence of at least</label><input type="text" id="t-conf" inputmode="decimal" placeholder="e.g. 0.85 (empty: rubric only)"></div>
        <div><label for="t-reward">Reward for this task (₹, empty: project default)</label><input type="text" id="t-reward" inputmode="decimal"></div>
      </div>
      <div class="actions">
        <button class="primary" id="t-add">Add task</button>
        <label class="button" for="t-csv" style="cursor:pointer">Import tasks from CSV</label>
        <input type="file" id="t-csv" accept=".csv,text/csv" class="hidden">
      </div>
      <p class="small muted">CSV columns: task_type, language, text, image_url, suggested_text, emphasis, pair_id, interpretation,
        intent, equivalents, confusable, validation_mode, level, accept_confidence, reward, task_id. Only task_type and language are always required.</p>
      <div id="t-list"></div>
    </div>

    <div id="ethics-form" class="panel stack">
      <h2 style="margin-top:0">Ethics review</h2>
      <p class="muted small">Every project must say whether ethics committee approval is required. Participants see what you enter here before they consent.</p>
      <fieldset class="stack" style="border:0;padding:0;margin:0">
        <legend style="font-weight:600;margin-bottom:6px">Is ethics committee approval required for this project?</legend>
        <label class="checks"><span><input type="radio" name="e-req" value="yes"> Yes</span></label>
        <label class="checks"><span><input type="radio" name="e-req" value="no"> No</span></label>
      </fieldset>
      <div id="e-no" class="stack hidden">
        <div><label for="e-reason">Why not? Participants will see this.</label>
          <textarea id="e-reason" style="min-height:80px;font-family:inherit;font-size:1rem"></textarea></div>
      </div>
      <div id="e-yes" class="stack hidden">
        <div><label for="e-status">Status</label>
          <select id="e-status">
            <option value="pending">Waiting for approval (closed to participants)</option>
            <option value="approved">Approved</option>
            <option value="internal_test">Internal test by the team only (not used as data)</option>
          </select></div>
        <div class="row">
          <div><label for="e-committee">Committee</label><input type="text" id="e-committee"></div>
          <div><label for="e-institution">Institution</label><input type="text" id="e-institution"></div>
        </div>
        <div class="row">
          <div><label for="e-protocol">Protocol or reference number</label><input type="text" id="e-protocol"></div>
          <div><label for="e-amendment">Amendment number, if any</label><input type="text" id="e-amendment"></div>
        </div>
        <div class="row">
          <div><label for="e-approved">Approval date</label><input type="date" id="e-approved"></div>
          <div><label for="e-expiry">Expiry date</label><input type="date" id="e-expiry"></div>
        </div>
        <div class="row">
          <div><label for="e-max">Maximum participants</label><input type="text" id="e-max" inputmode="numeric"></div>
          <div><label for="e-age">Minimum age</label><input type="text" id="e-age" inputmode="numeric" value="18"></div>
        </div>
        <div class="row">
          <div><label for="e-retention">Keep recordings for (days)</label><input type="text" id="e-retention" inputmode="numeric"></div>
          <div><label for="e-hosting">Where recordings are stored</label><input type="text" id="e-hosting"></div>
        </div>
        <div><label for="e-uses">Approved uses, one per line</label>
          <textarea id="e-uses" style="min-height:70px;font-family:inherit;font-size:1rem"></textarea></div>
        <div class="row">
          <div><label for="e-researcher">Researcher contact</label><input type="text" id="e-researcher"></div>
          <div><label for="e-committee-contact">Committee contact for participants</label><input type="text" id="e-committee-contact"></div>
        </div>
        <div><label for="e-letter">Approval letter (PDF, visible to admins only)</label>
          <input type="file" id="e-letter" accept="application/pdf,.pdf"></div>
        <div id="e-consent" class="stack"></div>
      </div>
      <div class="actions">
        <button class="primary" id="e-apply">Apply ethics details</button>
        <button id="e-draft">Download draft application</button>
      </div>
      <div id="e-result" aria-live="polite"></div>
    </div>

    <div class="panel stack">
      <details class="advanced"><summary>Manifest JSON (advanced)</summary>
        <p class="muted small">Everything above edits this JSON. <a href="/api/schema" target="_blank" rel="noopener">See the schema</a>.</p>
        <input type="file" id="m-file" accept="application/json,.json" aria-label="Load a manifest file">
        <textarea id="m-text" spellcheck="false" aria-label="Manifest JSON"></textarea>
      </details>
      <div class="actions">
        <button id="m-check">Check</button>
        <button class="primary" id="m-publish">Publish project</button>
      </div>
      <div id="m-result" aria-live="polite"></div>
    </div>
  </section>

  <section id="tab-review" class="hidden">
    <div class="split">
      <div>
        <div class="actions" style="justify-content:space-between;margin-bottom:10px">
          <h2 style="margin:0" id="queue-count">Review queue</h2>
          <button id="reload">Refresh</button>
        </div>
        <div class="chips" id="filters" style="margin-bottom:10px"></div>
        <ul class="queue" id="queue"></ul>
        <p class="muted small" style="margin-top:12px">Keys: space plays, A accepts, R rejects, J moves to the next item.</p>
      </div>
      <div id="detail" class="panel stack"><p class="muted">Pick a recording from the queue.</p></div>
    </div>
  </section>

  <section id="tab-analytics" class="hidden stack"></section>
  <section id="tab-payments" class="hidden stack"></section>
  <section id="tab-team" class="hidden stack"></section>
</main>
<script type="module" src="/static/admin.js"></script>
</body>
</html>