garywelz commited on
Commit
08cc526
·
verified ·
1 Parent(s): c39aa1e

Upload 4 files

Browse files
Files changed (2) hide show
  1. chemistry-database-table.html +545 -0
  2. index.html +14 -7
chemistry-database-table.html ADDED
@@ -0,0 +1,545 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Chemistry Processes Database</title>
7
+ <style>
8
+ body {
9
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
10
+ margin: 0;
11
+ padding: 20px;
12
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
13
+ min-height: 100vh;
14
+ }
15
+
16
+ .container {
17
+ max-width: 1400px;
18
+ margin: 0 auto;
19
+ background: white;
20
+ border-radius: 15px;
21
+ box-shadow: 0 20px 40px rgba(0,0,0,0.1);
22
+ overflow: hidden;
23
+ }
24
+
25
+ .header {
26
+ background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
27
+ color: white;
28
+ padding: 30px;
29
+ text-align: center;
30
+ }
31
+
32
+ .header h1 {
33
+ margin: 0;
34
+ font-size: 2.5em;
35
+ font-weight: 300;
36
+ }
37
+
38
+ .header p {
39
+ margin: 10px 0 0 0;
40
+ opacity: 0.8;
41
+ font-size: 1.1em;
42
+ }
43
+
44
+ .stats-grid {
45
+ display: grid;
46
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
47
+ gap: 20px;
48
+ padding: 30px;
49
+ background: #f8f9fa;
50
+ }
51
+
52
+ .stat-card {
53
+ background: white;
54
+ padding: 20px;
55
+ border-radius: 10px;
56
+ text-align: center;
57
+ box-shadow: 0 5px 15px rgba(0,0,0,0.08);
58
+ border-left: 4px solid #e74c3c;
59
+ }
60
+
61
+ .stat-number {
62
+ font-size: 2.5em;
63
+ font-weight: bold;
64
+ color: #2c3e50;
65
+ margin: 0;
66
+ }
67
+
68
+ .stat-label {
69
+ color: #7f8c8d;
70
+ font-size: 0.9em;
71
+ margin: 5px 0 0 0;
72
+ }
73
+
74
+ .table-container {
75
+ padding: 30px;
76
+ overflow-x: auto;
77
+ }
78
+
79
+ .table-header {
80
+ background: #c0392b;
81
+ color: white;
82
+ padding: 20px;
83
+ margin: -30px -30px 20px -30px;
84
+ }
85
+
86
+ .table-header h2 {
87
+ margin: 0;
88
+ font-size: 1.8em;
89
+ font-weight: 300;
90
+ }
91
+
92
+ table {
93
+ width: 100%;
94
+ border-collapse: collapse;
95
+ margin-top: 20px;
96
+ font-size: 0.9em;
97
+ }
98
+
99
+ th, td {
100
+ padding: 12px 8px;
101
+ text-align: left;
102
+ border-bottom: 1px solid #ddd;
103
+ }
104
+
105
+ th {
106
+ background: #ecf0f1;
107
+ font-weight: 600;
108
+ color: #2c3e50;
109
+ position: sticky;
110
+ top: 0;
111
+ cursor: pointer;
112
+ }
113
+
114
+ th:hover {
115
+ background: #d5dbdb;
116
+ }
117
+
118
+ tr:hover {
119
+ background: #f8f9fa;
120
+ }
121
+
122
+ .process-name {
123
+ font-weight: 600;
124
+ color: #2c3e50;
125
+ max-width: 300px;
126
+ }
127
+
128
+ .process-name a {
129
+ color: #e74c3c;
130
+ text-decoration: none;
131
+ }
132
+
133
+ .process-name a:hover {
134
+ text-decoration: underline;
135
+ }
136
+
137
+ .subcategory {
138
+ background: #fde8e8;
139
+ padding: 4px 8px;
140
+ border-radius: 4px;
141
+ font-size: 0.8em;
142
+ color: #c0392b;
143
+ }
144
+
145
+ .complexity {
146
+ padding: 4px 8px;
147
+ border-radius: 4px;
148
+ font-size: 0.8em;
149
+ font-weight: 600;
150
+ }
151
+
152
+ .complexity.low {
153
+ background: #d5f4e6;
154
+ color: #27ae60;
155
+ }
156
+
157
+ .complexity.medium {
158
+ background: #fff3cd;
159
+ color: #856404;
160
+ }
161
+
162
+ .complexity.detailed, .complexity.high {
163
+ background: #fadbd8;
164
+ color: #e74c3c;
165
+ }
166
+
167
+ .number {
168
+ text-align: center;
169
+ font-weight: 600;
170
+ }
171
+
172
+ .loading {
173
+ text-align: center;
174
+ padding: 50px;
175
+ color: #7f8c8d;
176
+ }
177
+
178
+ .error {
179
+ text-align: center;
180
+ padding: 50px;
181
+ color: #e74c3c;
182
+ }
183
+
184
+ .refresh-btn {
185
+ background: #e74c3c;
186
+ color: white;
187
+ border: none;
188
+ padding: 10px 20px;
189
+ border-radius: 5px;
190
+ cursor: pointer;
191
+ font-size: 0.9em;
192
+ margin: 10px;
193
+ }
194
+
195
+ .refresh-btn:hover {
196
+ background: #c0392b;
197
+ }
198
+
199
+ .breakdown {
200
+ padding: 30px;
201
+ background: #f8f9fa;
202
+ border-top: 1px solid #ecf0f1;
203
+ }
204
+
205
+ .breakdown h3 {
206
+ color: #2c3e50;
207
+ margin-bottom: 15px;
208
+ }
209
+
210
+ .breakdown-grid {
211
+ display: grid;
212
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
213
+ gap: 20px;
214
+ }
215
+
216
+ .breakdown-card {
217
+ background: white;
218
+ padding: 20px;
219
+ border-radius: 8px;
220
+ box-shadow: 0 2px 10px rgba(0,0,0,0.05);
221
+ }
222
+
223
+ .breakdown-item {
224
+ display: flex;
225
+ justify-content: space-between;
226
+ padding: 8px 0;
227
+ border-bottom: 1px solid #ecf0f1;
228
+ }
229
+
230
+ .breakdown-item:last-child {
231
+ border-bottom: none;
232
+ }
233
+
234
+ .breakdown-label {
235
+ color: #7f8c8d;
236
+ }
237
+
238
+ .breakdown-count {
239
+ font-weight: 600;
240
+ color: #2c3e50;
241
+ }
242
+
243
+ .color-legend {
244
+ padding: 20px;
245
+ background: #f8f9fa;
246
+ border-top: 1px solid #ecf0f1;
247
+ }
248
+
249
+ .color-legend h3 {
250
+ color: #2c3e50;
251
+ margin-bottom: 15px;
252
+ }
253
+
254
+ .color-grid {
255
+ display: grid;
256
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
257
+ gap: 15px;
258
+ }
259
+
260
+ .color-item {
261
+ display: flex;
262
+ align-items: center;
263
+ gap: 10px;
264
+ padding: 10px;
265
+ background: white;
266
+ border-radius: 5px;
267
+ }
268
+
269
+ .color-box {
270
+ width: 30px;
271
+ height: 30px;
272
+ border-radius: 4px;
273
+ border: 1px solid #ddd;
274
+ }
275
+ </style>
276
+ </head>
277
+ <body>
278
+ <div class="container">
279
+ <div class="header">
280
+ <h1>⚗️ Chemistry Processes Database</h1>
281
+ <p>Programming Framework - Interactive Database Analysis</p>
282
+ <button class="refresh-btn" onclick="loadData()">🔄 Refresh Data</button>
283
+ </div>
284
+
285
+ <div id="loading" class="loading">
286
+ <h3>Loading chemistry processes database...</h3>
287
+ <p>Fetching process data from metadata.json</p>
288
+ </div>
289
+
290
+ <div id="error" class="error" style="display: none;">
291
+ <h3>❌ Error Loading Data</h3>
292
+ <p>Could not fetch chemistry processes metadata. Please check your connection and try again.</p>
293
+ </div>
294
+
295
+ <div id="content" style="display: none;">
296
+ <div class="stats-grid" id="statsGrid">
297
+ <!-- Stats will be populated here -->
298
+ </div>
299
+
300
+ <div class="table-container">
301
+ <div class="table-header">
302
+ <h2>📊 Process Database Table</h2>
303
+ <p style="margin: 10px 0 0 0; opacity: 0.8; font-size: 0.9em;">
304
+ 💡 Click on any process name to view its interactive flowchart
305
+ </p>
306
+ </div>
307
+ <table id="processTable">
308
+ <thead>
309
+ <tr>
310
+ <th onclick="sortTable(0)">Process Name ↕</th>
311
+ <th onclick="sortTable(1)">Subcategory ↕</th>
312
+ <th onclick="sortTable(2)">Complexity ↕</th>
313
+ <th onclick="sortTable(3)">Nodes ↕</th>
314
+ <th onclick="sortTable(4)">Edges ↕</th>
315
+ <th onclick="sortTable(5)">AND Gates ↕</th>
316
+ <th onclick="sortTable(6)">OR Gates ↕</th>
317
+ </tr>
318
+ </thead>
319
+ <tbody id="tableBody">
320
+ <!-- Data will be populated here -->
321
+ </tbody>
322
+ </table>
323
+ </div>
324
+
325
+ <div class="breakdown">
326
+ <h3>📈 Database Analysis</h3>
327
+ <div class="breakdown-grid" id="breakdownGrid">
328
+ <!-- Breakdown will be populated here -->
329
+ </div>
330
+ </div>
331
+
332
+ <div class="color-legend">
333
+ <h3>🎨 Color Scheme (5-Color System)</h3>
334
+ <div class="color-grid">
335
+ <div class="color-item">
336
+ <div class="color-box" style="background: #ff6b6b;"></div>
337
+ <div>
338
+ <strong>Red</strong><br>
339
+ <small>Triggers & Inputs</small>
340
+ </div>
341
+ </div>
342
+ <div class="color-item">
343
+ <div class="color-box" style="background: #ffd43b;"></div>
344
+ <div>
345
+ <strong>Yellow</strong><br>
346
+ <small>Structures & Objects</small>
347
+ </div>
348
+ </div>
349
+ <div class="color-item">
350
+ <div class="color-box" style="background: #51cf66;"></div>
351
+ <div>
352
+ <strong>Green</strong><br>
353
+ <small>Processing & Operations</small>
354
+ </div>
355
+ </div>
356
+ <div class="color-item">
357
+ <div class="color-box" style="background: #74c0fc;"></div>
358
+ <div>
359
+ <strong>Blue</strong><br>
360
+ <small>Intermediates & States</small>
361
+ </div>
362
+ </div>
363
+ <div class="color-item">
364
+ <div class="color-box" style="background: #b197fc;"></div>
365
+ <div>
366
+ <strong>Violet</strong><br>
367
+ <small>Products & Outputs</small>
368
+ </div>
369
+ </div>
370
+ </div>
371
+ </div>
372
+ </div>
373
+ </div>
374
+
375
+ <script>
376
+ // Determine metadata URL based on where this file is hosted
377
+ const METADATA_URL = window.location.hostname.includes('storage.googleapis.com')
378
+ ? 'https://storage.googleapis.com/regal-scholar-453620-r7-podcast-storage/chemistry-processes-database/metadata.json'
379
+ : (window.location.hostname.includes('huggingface.co'))
380
+ ? './chemistry-processes-database/metadata.json'
381
+ : './chemistry-processes-database/metadata.json';
382
+
383
+ let currentSortColumn = -1;
384
+ let sortDirection = 1;
385
+ let processes = [];
386
+
387
+ async function loadData() {
388
+ console.log('🔄 Starting data load from:', METADATA_URL);
389
+ document.getElementById('loading').style.display = 'block';
390
+ document.getElementById('error').style.display = 'none';
391
+ document.getElementById('content').style.display = 'none';
392
+
393
+ try {
394
+ const response = await fetch(METADATA_URL);
395
+ if (!response.ok) {
396
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
397
+ }
398
+
399
+ const data = await response.json();
400
+ console.log('✅ Data loaded successfully:', data.totalProcesses, 'processes');
401
+
402
+ processes = data.processes || [];
403
+ populateData(data);
404
+
405
+ document.getElementById('loading').style.display = 'none';
406
+ document.getElementById('content').style.display = 'block';
407
+
408
+ } catch (error) {
409
+ console.error('❌ Error loading data:', error);
410
+ document.getElementById('loading').style.display = 'none';
411
+ document.getElementById('error').style.display = 'block';
412
+ document.getElementById('error').innerHTML = `
413
+ <h3>❌ Error Loading Data</h3>
414
+ <p>Could not fetch chemistry processes metadata.</p>
415
+ <p style="font-size: 0.9em; color: #95a5a6; margin-top: 10px;">
416
+ Error: ${error.message}
417
+ </p>
418
+ `;
419
+ }
420
+ }
421
+
422
+ function populateData(data) {
423
+ // Populate statistics
424
+ const stats = data.statistics || {};
425
+ document.getElementById('statsGrid').innerHTML = `
426
+ <div class="stat-card">
427
+ <div class="stat-number">${data.totalProcesses || 0}</div>
428
+ <div class="stat-label">Total Processes</div>
429
+ </div>
430
+ <div class="stat-card">
431
+ <div class="stat-number">${stats.totalNodes || 0}</div>
432
+ <div class="stat-label">Total Nodes</div>
433
+ </div>
434
+ <div class="stat-card">
435
+ <div class="stat-number">${stats.totalEdges || 0}</div>
436
+ <div class="stat-label">Total Edges</div>
437
+ </div>
438
+ <div class="stat-card">
439
+ <div class="stat-number">${data.subcategories || 0}</div>
440
+ <div class="stat-label">Subcategories</div>
441
+ </div>
442
+ `;
443
+
444
+ // Populate table
445
+ const tableBody = document.getElementById('tableBody');
446
+ tableBody.innerHTML = '';
447
+
448
+ const processList = data.processes || [];
449
+ processList.forEach(process => {
450
+ const row = document.createElement('tr');
451
+ // Determine viewer URL based on host
452
+ const isGCS = window.location.hostname.includes('storage.googleapis.com');
453
+ const isHF = window.location.hostname.includes('huggingface.co');
454
+ const viewerUrl = isGCS
455
+ ? `https://storage.googleapis.com/regal-scholar-453620-r7-podcast-storage/chemistry-processes-database/processes/${process.subcategory}/${process.id}.html`
456
+ : (isHF)
457
+ ? `./chemistry-processes-database/processes/${process.subcategory}/${process.id}.html`
458
+ : `./processes/${process.subcategory}/${process.id}.html`;
459
+ row.innerHTML = `
460
+ <td class="process-name">
461
+ <a href="${viewerUrl}" target="_blank">${process.name}</a>
462
+ </td>
463
+ <td><span class="subcategory">${process.subcategory_name || process.subcategory}</span></td>
464
+ <td><span class="complexity ${process.complexity}">${process.complexity}</span></td>
465
+ <td class="number">${process.nodes}</td>
466
+ <td class="number">${process.edges}</td>
467
+ <td class="number">${process.andGates || 0}</td>
468
+ <td class="number">${process.orGates || 0}</td>
469
+ `;
470
+ tableBody.appendChild(row);
471
+ });
472
+
473
+ // Populate breakdown
474
+ const breakdown = {};
475
+ processList.forEach(p => {
476
+ const subcat = p.subcategory_name || p.subcategory;
477
+ breakdown[subcat] = (breakdown[subcat] || 0) + 1;
478
+ });
479
+
480
+ let breakdownHTML = '<div class="breakdown-card"><h4>Processes by Subcategory</h4>';
481
+ Object.entries(breakdown).sort((a, b) => b[1] - a[1]).forEach(([subcat, count]) => {
482
+ breakdownHTML += `
483
+ <div class="breakdown-item">
484
+ <span class="breakdown-label">${subcat}</span>
485
+ <span class="breakdown-count">${count}</span>
486
+ </div>
487
+ `;
488
+ });
489
+ breakdownHTML += '</div>';
490
+
491
+ const complexityBreakdown = {};
492
+ processList.forEach(p => {
493
+ const comp = p.complexity || 'unknown';
494
+ complexityBreakdown[comp] = (complexityBreakdown[comp] || 0) + 1;
495
+ });
496
+
497
+ breakdownHTML += '<div class="breakdown-card"><h4>Processes by Complexity</h4>';
498
+ Object.entries(complexityBreakdown).sort((a, b) => b[1] - a[1]).forEach(([comp, count]) => {
499
+ breakdownHTML += `
500
+ <div class="breakdown-item">
501
+ <span class="breakdown-label">${comp}</span>
502
+ <span class="breakdown-count">${count}</span>
503
+ </div>
504
+ `;
505
+ });
506
+ breakdownHTML += '</div>';
507
+
508
+ document.getElementById('breakdownGrid').innerHTML = breakdownHTML;
509
+ }
510
+
511
+ function sortTable(column) {
512
+ const table = document.getElementById('processTable');
513
+ const tbody = table.querySelector('tbody');
514
+ const rows = Array.from(tbody.querySelectorAll('tr'));
515
+
516
+ if (currentSortColumn === column) {
517
+ sortDirection *= -1;
518
+ } else {
519
+ currentSortColumn = column;
520
+ sortDirection = 1;
521
+ }
522
+
523
+ rows.sort((a, b) => {
524
+ const aText = a.cells[column].textContent.trim();
525
+ const bText = b.cells[column].textContent.trim();
526
+
527
+ // Try to parse as number
528
+ const aNum = parseFloat(aText);
529
+ const bNum = parseFloat(bText);
530
+
531
+ if (!isNaN(aNum) && !isNaN(bNum)) {
532
+ return (aNum - bNum) * sortDirection;
533
+ }
534
+
535
+ return aText.localeCompare(bText) * sortDirection;
536
+ });
537
+
538
+ rows.forEach(row => tbody.appendChild(row));
539
+ }
540
+
541
+ // Load data on page load
542
+ loadData();
543
+ </script>
544
+ </body>
545
+ </html>
index.html CHANGED
@@ -311,13 +311,20 @@
311
  <p class="text-gray-600 text-sm mb-3">
312
  Comprehensive chemistry process diagrams across all major branches.
313
  </p>
314
- <a href="chemistry_index.html"
315
- class="text-orange-600 hover:text-orange-700 font-medium text-sm inline-block"
316
- target="_blank" rel="noopener noreferrer">
317
- Chemistry Index
318
- </a>
319
- <p class="text-xs text-gray-500 mt-2 italic">
320
- Note: New comprehensive database coming soon
 
 
 
 
 
 
 
321
  </p>
322
  </div>
323
 
 
311
  <p class="text-gray-600 text-sm mb-3">
312
  Comprehensive chemistry process diagrams across all major branches.
313
  </p>
314
+ <div class="space-y-2">
315
+ <a href="https://storage.googleapis.com/regal-scholar-453620-r7-podcast-storage/chemistry-processes-database/chemistry-database-table.html"
316
+ class="text-orange-600 hover:text-orange-700 font-medium text-sm inline-block mr-4"
317
+ target="_blank" rel="noopener noreferrer">
318
+ 🗄️ Chemistry Database Table →
319
+ </a>
320
+ <a href="chemistry_index.html"
321
+ class="text-orange-600 hover:text-orange-700 font-medium text-sm inline-block"
322
+ target="_blank" rel="noopener noreferrer">
323
+ 📚 Chemistry Index →
324
+ </a>
325
+ </div>
326
+ <p class="text-xs text-gray-500 mt-2">
327
+ 56 processes across 14 subcategories
328
  </p>
329
  </div>
330