-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoriginal.html
More file actions
478 lines (435 loc) · 21 KB
/
original.html
File metadata and controls
478 lines (435 loc) · 21 KB
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Spec Clarifier for Domain Experts</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
max-width: 900px;
margin: 0 auto;
padding: 20px;
background-color: #f8f9fa;
}
.container {
background: white;
padding: 30px;
border-radius: 12px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h2 {
color: #2c3e50;
border-bottom: 3px solid #3498db;
padding-bottom: 10px;
}
.intro {
background: #e8f4f8;
padding: 15px;
border-radius: 8px;
margin-bottom: 25px;
border-left: 4px solid #3498db;
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
font-weight: bold;
color: #34495e;
margin-bottom: 5px;
}
textarea, input[type="text"], select {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 6px;
font-size: 14px;
box-sizing: border-box;
}
textarea {
resize: vertical;
font-family: inherit;
}
input[type="submit"], button {
background: #3498db;
color: white;
padding: 12px 30px;
border: none;
border-radius: 6px;
font-size: 16px;
cursor: pointer;
font-weight: bold;
}
input[type="submit"]:hover, button:hover {
background: #2980b9;
}
.result {
display: none;
margin-top: 30px;
}
.spec-output {
background: #f8f9fa;
padding: 20px;
border-radius: 8px;
border: 1px solid #ddd;
white-space: pre-wrap;
font-family: 'Courier New', monospace;
font-size: 13px;
max-height: 400px;
overflow-y: auto;
}
.suggestions {
background: #e8f5e8;
padding: 15px;
border-radius: 8px;
margin-top: 20px;
}
.suggestions h3 {
color: #27ae60;
margin-top: 0;
}
.suggestions ul {
margin: 10px 0;
}
.suggestions li {
margin: 5px 0;
}
.back-btn {
background: #95a5a6;
color: white;
padding: 10px 20px;
border: none;
border-radius: 6px;
cursor: pointer;
margin-top: 15px;
margin-right: 10px;
text-decoration: none;
display: inline-block;
}
.back-btn:hover {
background: #7f8c8d;
}
.build-btn {
background: #27ae60;
color: white;
padding: 10px 20px;
border: none;
border-radius: 6px;
cursor: pointer;
margin-top: 15px;
text-decoration: none;
display: inline-block;
}
.build-btn:hover {
background: #219a52;
}
.format-toggle {
margin-bottom: 15px;
padding: 10px;
background: #f8f9fa;
border-radius: 6px;
border: 1px solid #ddd;
}
.format-toggle label {
margin-right: 20px;
font-weight: normal;
cursor: pointer;
}
.format-toggle input[type="radio"] {
margin-right: 5px;
}
.example-btn {
background: #f4f4f4;
color: #666;
border: 1px solid #ccc;
padding: 2px 6px;
border-radius: 4px;
font-size: 11px;
cursor: pointer;
margin-left: 8px;
vertical-align: middle;
box-shadow: none;
float: none;
}
.example-btn:hover {
background: #e0e0e0;
color: #333;
}
.clear-btn {
background: #fff;
color: #888;
border: 1px solid #ddd;
padding: 2px 6px;
border-radius: 4px;
font-size: 11px;
cursor: pointer;
margin-left: 8px;
vertical-align: middle;
box-shadow: none;
float: none;
}
.clear-btn:hover {
background: #f8f8f8;
color: #666;
}
.result-actions {
margin-top: 15px;
}
.result-actions button {
margin-right: 10px;
background-color: #3498db;
color: white;
padding: 10px 20px;
border: none;
border-radius: 6px;
font-size: 16px;
cursor: pointer;
font-weight: bold;
}
.result-actions button:hover {
background-color: #2980b9;
}
.output-container {
position: relative;
margin-bottom: 20px;
}
.copy-btn {
position: absolute;
top: 10px;
right: 10px;
background-color: #3498db;
color: white;
border: none;
border-radius: 6px;
padding: 8px 16px;
cursor: pointer;
font-size: 14px;
display: flex;
align-items: center;
gap: 5px;
}
.copy-btn:hover {
background-color: #2980b9;
}
footer {
text-align: center;
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid #e9ecef;
font-size: 14px;
color: #6c757d;
}
footer a {
color: #3498db;
text-decoration: none;
margin: 0 10px;
}
footer a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="container">
<div id="form-section">
<h2>🧠 Specification Builder for Domain Experts</h2>
<div class="intro">
<p>This app helps you (a subject-matter expert like a clinician, lawyer, engineer, etc.) walk through your goals step-by-step to generate a clear specification for AI-assisted implementation. The system can then use this spec to generate or scaffold actual applications tailored to your domain.</p>
<p><strong>Looking for a more focused approach?</strong> Try our <a href="focused.html" style="color: #2980b9; font-weight: bold;">Critical-Path 6 Specification Builder</a> for a streamlined experience.</p>
</div>
<form id="specForm">
<div class="form-group">
<label>1. What do you want to build? <button type="button" class="example-btn" onclick="useExample(this, 'Transcribe patient visits into SOAP notes')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="goal" rows="2" placeholder="e.g., Transcribe patient visits into SOAP notes"></textarea>
</div>
<div class="form-group">
<label>2. Why is this important? <button type="button" class="example-btn" onclick="useExample(this, 'Improve clinical documentation accuracy and reduce manual burden.')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="why" rows="3" placeholder="e.g., Improve clinical documentation accuracy and reduce manual burden."></textarea>
</div>
<div class="form-group">
<label>3. Who will use this? <button type="button" class="example-btn" onclick="useExample(this, 'Primary care clinicians, lawyers, students, etc.')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="audience" rows="2" placeholder="e.g., Primary care clinicians, lawyers, students, etc."></textarea>
</div>
<div class="form-group">
<label>4. What data goes in? <button type="button" class="example-btn" onclick="useExample(this, 'Audio recordings, PDFs, scanned documents, structured EHR data')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="inputs" rows="2" placeholder="e.g., Audio recordings, PDFs, scanned documents, structured EHR data"></textarea>
</div>
<div class="form-group">
<label>5. What should come out? <button type="button" class="example-btn" onclick="useExample(this, 'Structured SOAP notes, FHIR JSON, HL7 messages, formatted text, PDF summaries')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="outputs" rows="2" placeholder="e.g., Structured SOAP notes, FHIR JSON, HL7 messages, formatted text, PDF summaries"></textarea>
</div>
<div class="form-group">
<label>6. What rules or constraints matter? <button type="button" class="example-btn" onclick="useExample(this, 'No hallucinations, enforce ICD-10/SNOMED mapping, HIPAA compliance, role-based access')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="constraints" rows="4" placeholder="e.g., No hallucinations, enforce ICD-10/SNOMED mapping, HIPAA compliance, role-based access"></textarea>
</div>
<div class="form-group">
<label>7. What does success look like? <button type="button" class="example-btn" onclick="useExample(this, '90%+ accuracy when compared to human notes, deployment-ready within 2 weeks, usable by non-technical staff')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="success" rows="3" placeholder="e.g., 90%+ accuracy when compared to human notes, deployment-ready within 2 weeks, usable by non-technical staff"></textarea>
</div>
<div class="form-group">
<label>8. Any edge cases or known challenges? <button type="button" class="example-btn" onclick="useExample(this, 'Multiple speakers, unclear audio, language mixing, patient non-compliance')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="edges" rows="3" placeholder="e.g., Multiple speakers, unclear audio, language mixing, patient non-compliance"></textarea>
</div>
<div class="form-group">
<label>9. What examples or prompts could we test this with? <button type="button" class="example-btn" onclick="useExample(this, 'Sample audio of a 12-minute consultation with overlaps, 2 PDF documents with poor OCR quality')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="prompts" rows="3" placeholder="e.g., Sample audio of a 12-minute consultation with overlaps, 2 PDF documents with poor OCR quality"></textarea>
</div>
<div class="form-group">
<label>10. How should this app sound or feel (tone/style)? <button type="button" class="example-btn" onclick="useExample(this, 'Professional, supportive, friendly, no jargon')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="style" rows="2" placeholder="e.g., Professional, supportive, friendly, no jargon"></textarea>
</div>
<div class="form-group">
<label>11. What type of app is this? <button type="button" class="example-btn" onclick="useExample(this, 'Interactive Form, Chatbot Assistant, Dashboard/Viewer, Voice-to-Text Tool')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="type" rows="2" placeholder="e.g., Interactive Form, Chatbot Assistant, Dashboard/Viewer, Voice-to-Text Tool"></textarea>
</div>
<div class="form-group">
<label>12. Should any data be stored or exported? <button type="button" class="example-btn" onclick="useExample(this, 'Export PDF, temporary session only, save to user account')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="storage" rows="2" placeholder="e.g., Export PDF, temporary session only, save to user account"></textarea>
</div>
<div class="form-group">
<label>13. What should the user feel when using this app? <button type="button" class="example-btn" onclick="useExample(this, 'Empowered, relieved, clear, confident')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<textarea name="emotion" rows="2" placeholder="e.g., Empowered, relieved, clear, confident"></textarea>
</div>
<div class="form-group">
<label>14. Optional: Want to name this app? <button type="button" class="example-btn" onclick="useExample(this, 'SOAPify, CourtBot, VoiceNoteMD')">📋 Use Example</button> <button type="button" class="clear-btn" onclick="clearField(this)">🗑️ Clear</button></label>
<input type="text" name="name" placeholder="e.g., SOAPify, CourtBot, VoiceNoteMD">
</div>
<button type="button" id="generateBtn" onclick="generateSpec()">Generate Spec</button>
</form>
</div>
<div id="result-section" class="result">
<h2>📄 Generated Specification</h2>
<div class="format-toggle">
<label>
<input type="radio" name="format" value="text" checked onchange="toggleFormat()">
📄 Text Prompt
</label>
<label>
<input type="radio" name="format" value="markdown" onchange="toggleFormat()">
📝 Markdown
</label>
<label>
<input type="radio" name="format" value="json" onchange="toggleFormat()">
📋 JSON Format
</label>
</div>
<div class="output-container">
<div id="spec-output" class="spec-output"></div>
<button class="copy-btn" onclick="copyToClipboard()">📋 Copy to Clipboard</button>
</div>
<div class="suggestions">
<h3>💡 Suggested Use</h3>
<ul>
<li>✅ Use this spec to prompt AI models or agents to build the application described</li>
<li>🔁 Attach this spec or its hash to commits to ensure intent is preserved and traceable</li>
<li>📌 System can use this to auto-generate UIs, backends, or workflow integrations</li>
</ul>
<h3>🧠 Model Suggestions</h3>
<ul>
<li><b>Reasoning LLMs:</b> GPT-4, Claude 3, Gemini 1.5 Pro — for structuring outputs, logic-heavy planning, compliance validation</li>
<li><b>Fast Draft LLMs:</b> GPT-3.5 Turbo, Claude Instant, Mistral 7B — for quick prototyping or drafting workflows</li>
</ul>
</div>
<div class="result-actions">
<button type="button" onclick="showForm()">✏️ Edit Spec</button>
<button type="button" onclick="downloadSpec()">💾 Download</button>
<button type="button" onclick="buildForMe()">🤖 Build it</button>
</div>
</div>
</div>
<footer>
<a href="https://github.com/Sum1Solutions/spec-builder" target="_blank" rel="noopener noreferrer">GitHub Repo</a>
<a href="https://buymeacoffee.com/jon7" target="_blank" rel="noopener noreferrer">Buy Me a Coffee ☕</a>
</footer>
<script>
let currentSpec = {};
function generateSpec() {
const form = document.getElementById('specForm');
const data = new FormData(form);
currentSpec = {};
for (let [key, value] of data.entries()) {
const trimmedValue = value.trim();
if (trimmedValue) { // Only add non-empty values
currentSpec[key] = trimmedValue;
}
}
displaySpec();
}
function displaySpec() {
const outputElement = document.getElementById('spec-output');
const formatRadio = document.querySelector('input[name="format"]:checked');
const format = formatRadio ? formatRadio.value : 'text';
if (format === 'json') {
const specText = JSON.stringify(currentSpec, null, 4);
outputElement.textContent = specText;
outputElement.dataset.text = specText;
} else if (format === 'markdown') {
// Generate concise markdown format
let markdownPrompt = "# Spec\n\n";
// Only show fields that have values
Object.entries(currentSpec).forEach(([key, value]) => {
markdownPrompt += `### ${key}\n${value}\n\n`;
});
outputElement.textContent = markdownPrompt;
outputElement.dataset.text = markdownPrompt;
} else { // text format
// Generate conversational text format
let textPrompt = "Please build an application with the following specifications:\n\n";
// Only show fields that have values
Object.entries(currentSpec).forEach(([key, value]) => {
textPrompt += `• ${key}: ${value}\n`;
});
textPrompt += "\nPlease create a functional application that meets these requirements.";
outputElement.textContent = textPrompt;
outputElement.dataset.text = textPrompt;
}
document.getElementById('result-section').style.display = 'block';
document.getElementById('form-section').style.display = 'none';
}
function toggleFormat() {
// Regenerate output in selected format
generateSpec();
}
function showForm() {
document.getElementById('result-section').style.display = 'none';
document.getElementById('form-section').style.display = 'block';
}
function downloadSpec() {
const format = document.querySelector('input[name="format"]:checked').value;
const content = document.getElementById('spec-output').textContent;
const filename = `spec.${format === 'markdown' ? 'md' : (format === 'json' ? 'json' : 'txt')}`;
const mimeType = `text/${format === 'json' ? 'json' : 'plain'}`;
const blob = new Blob([content], { type: mimeType });
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(a.href);
}
function buildForMe() {
alert('This feature will be available soon! Stay tuned.');
}
function useExample(button, exampleText) {
// Find the nearest textarea or input element
const parent = button.parentElement;
let textarea = parent.parentElement.querySelector('textarea');
if (!textarea) {
textarea = parent.parentElement.querySelector('input[type="text"]');
}
if (textarea) {
textarea.value = exampleText;
}
}
function clearField(button) {
const textarea = button.parentElement.parentElement.querySelector('textarea, input[type="text"]');
if (textarea) {
textarea.value = '';
}
}
</script>
</body>
</html>