-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdashboard.html
More file actions
1099 lines (967 loc) · 41.7 KB
/
dashboard.html
File metadata and controls
1099 lines (967 loc) · 41.7 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
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LLM4RE Datasets - Analytics Dashboard</title>
<link rel="stylesheet" href="styles.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.9.1/dist/chart.min.js"></script>
<style>
.dashboard-container {
max-width: 1400px;
margin: 0 auto;
padding: 20px;
}
.dashboard-header {
text-align: center;
margin-bottom: 2rem;
padding: 2rem;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-radius: 10px;
}
.dashboard-title {
font-size: 2.5rem;
margin-bottom: 0.5rem;
}
.dashboard-subtitle {
font-size: 1.2rem;
opacity: 0.9;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin-bottom: 2rem;
}
.stat-card {
background: white;
padding: 1.5rem;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
text-align: center;
}
.stat-number {
font-size: 2rem;
font-weight: bold;
color: #667eea;
margin-bottom: 0.5rem;
}
.stat-label {
color: #666;
font-size: 0.9rem;
}
.charts-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
gap: 2rem;
margin-bottom: 2rem;
}
.chart-container {
background: white;
padding: 1.5rem;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.chart-title {
font-size: 1.3rem;
font-weight: bold;
margin-bottom: 1rem;
color: #333;
text-align: center;
}
.insights-section {
background: white;
padding: 2rem;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
margin-bottom: 2rem;
}
.insights-title {
font-size: 1.5rem;
font-weight: bold;
margin-bottom: 1rem;
color: #333;
}
.insight-item {
margin-bottom: 1rem;
padding: 1rem;
background: #f8f9fa;
border-left: 4px solid #667eea;
border-radius: 5px;
}
.insight-text {
margin-bottom: 0.5rem;
}
.insight-metric {
font-weight: bold;
color: #667eea;
}
.back-to-main {
position: fixed;
top: 20px;
left: 20px;
background: #667eea;
color: white;
padding: 10px 15px;
border-radius: 5px;
text-decoration: none;
font-weight: bold;
z-index: 1000;
}
.back-to-main:hover {
background: #5a6fd8;
}
.full-width-chart {
grid-column: 1 / -1;
}
.trend-chart {
height: 300px;
}
.domain-treemap {
height: 400px;
}
</style>
</head>
<body>
<a href="index.html" class="back-to-main">
<i class="fas fa-arrow-left"></i> Back to Datasets
</a>
<div class="dashboard-container">
<div class="dashboard-header">
<h1 class="dashboard-title">LLM4RE Datasets Analytics Dashboard</h1>
<p class="dashboard-subtitle">Key Characteristics Analysis for Large Language Models in Requirements
Engineering</p>
</div>
<!-- Key Statistics -->
<div class="stats-grid">
<div class="stat-card">
<div class="stat-number" id="total-datasets">0</div>
<div class="stat-label">Total Datasets</div>
</div>
<div class="stat-card">
<div class="stat-number" id="total-size">0</div>
<div class="stat-label">Total Data Points</div>
</div>
<div class="stat-card">
<div class="stat-number" id="avg-size">0</div>
<div class="stat-label">Average Dataset Size</div>
</div>
<div class="stat-card">
<div class="stat-number" id="languages-count">0</div>
<div class="stat-label">Languages Supported</div>
</div>
<div class="stat-card">
<div class="stat-number" id="domains-count">0</div>
<div class="stat-label">Domains Covered</div>
</div>
<div class="stat-card">
<div class="stat-number" id="years-span">0</div>
<div class="stat-label">Years Span</div>
</div>
</div>
<!-- Charts Grid -->
<div class="charts-grid">
<!-- Dataset Distribution by Domain -->
<div class="chart-container">
<h3 class="chart-title">Dataset Distribution by Domain</h3>
<canvas id="domainChart"></canvas>
</div>
<!-- Dataset Distribution by Task -->
<div class="chart-container">
<h3 class="chart-title">Dataset Distribution by Task</h3>
<canvas id="taskChart"></canvas>
</div>
<!-- Dataset Distribution by Artifact Type -->
<div class="chart-container">
<h3 class="chart-title">Dataset Distribution by Artifact Type</h3>
<canvas id="artifactChart"></canvas>
</div>
<!-- Dataset Distribution by RE Stage -->
<div class="chart-container">
<h3 class="chart-title">Dataset Distribution by RE Stage</h3>
<canvas id="stageChart"></canvas>
</div>
<!-- Dataset Size Distribution -->
<div class="chart-container">
<h3 class="chart-title">Dataset Size Distribution</h3>
<canvas id="sizeChart"></canvas>
</div>
<!-- Language Distribution -->
<div class="chart-container">
<h3 class="chart-title">Language Distribution</h3>
<canvas id="languageChart"></canvas>
</div>
<!-- Publication Timeline -->
<div class="chart-container">
<h3 class="chart-title">Dataset Publication Timeline</h3>
<canvas id="timelineChart"></canvas>
</div>
<!-- License Distribution -->
<div class="chart-container">
<h3 class="chart-title">License Distribution</h3>
<canvas id="licenseChart"></canvas>
</div>
<!-- Granularity Distribution -->
<div class="chart-container">
<h3 class="chart-title">Granularity Distribution</h3>
<canvas id="granularityChart"></canvas>
</div>
<!-- Bubble Plot: RE Stage vs Task -->
<div class="chart-container full-width-chart">
<h3 class="chart-title">RE Stage vs Task Distribution</h3>
<canvas id="bubbleChart"></canvas>
</div>
</div>
<!-- Key Insights -->
<div class="insights-section">
<h2 class="insights-title">Key Insights for LLM4RE Tasks</h2>
<div class="insight-item">
<div class="insight-text"><strong>Domain Coverage:</strong> The dataset collection spans <span
class="insight-metric" id="insight-domains">multiple domains</span>, with the most represented
being <span class="insight-metric" id="top-domain">aerospace and healthcare</span>.</div>
</div>
<div class="insight-item">
<div class="insight-text"><strong>Task Diversity:</strong> <span class="insight-metric"
id="insight-tasks">Classification tasks</span> dominate the collection, representing <span
class="insight-metric" id="classification-percentage">over 40%</span> of all datasets.</div>
</div>
<div class="insight-item">
<div class="insight-text"><strong>Data Granularity:</strong> The collection includes datasets at <span
class="insight-metric" id="insight-granularity">multiple granularity levels</span>, with <span
class="insight-metric" id="top-granularity">document-level</span> and <span
class="insight-metric" id="second-granularity">sentence-level</span> being most common.</div>
</div>
<div class="insight-item">
<div class="insight-text"><strong>Language Support:</strong> While <span class="insight-metric"
id="insight-english">English dominates</span> with <span class="insight-metric"
id="english-percentage">over 80%</span> of datasets, there is growing support for <span
class="insight-metric" id="insight-multilingual">multilingual datasets</span> including Chinese
and other languages.</div>
</div>
<div class="insight-item">
<div class="insight-text"><strong>Size Distribution:</strong> Dataset sizes vary significantly, from
small datasets with <span class="insight-metric" id="min-size">under 100 items</span> to large-scale
collections with <span class="insight-metric" id="max-size">over 400,000 items</span>, providing
diverse training scenarios for LLMs.</div>
</div>
<div class="insight-item">
<div class="insight-text"><strong>Temporal Trends:</strong> The collection shows <span
class="insight-metric" id="insight-trend">increasing activity</span> in recent years, with <span
class="insight-metric" id="recent-datasets">over 60%</span> of datasets published in the last 3
years, reflecting growing interest in LLM4RE research.</div>
</div>
<div class="insight-item">
<div class="insight-text"><strong>RE Stage Coverage:</strong> Datasets cover <span
class="insight-metric" id="insight-stages">all major RE stages</span>, with particular emphasis
on <span class="insight-metric" id="top-stage">analysis and verification</span> tasks.</div>
</div>
<div class="insight-item">
<div class="insight-text"><strong>Openness:</strong> <span class="insight-metric"
id="open-percentage">Over 70%</span> of datasets are available under open licenses, promoting
reproducibility and collaborative research in the LLM4RE community.</div>
</div>
</div>
</div>
<script>
// Global variables
let datasets = [];
let analytics = {};
// Initialize dashboard
document.addEventListener('DOMContentLoaded', async () => {
try {
await loadData();
calculateAnalytics();
updateStatistics();
createCharts();
generateDynamicInsights(); // Add this line
} catch (error) {
console.error('Error initializing dashboard:', error);
}
});
// Load data from CSV files
async function loadData() {
try {
const response = await fetch('data/datasets.csv');
if (!response.ok) {
throw new Error(`Failed to load datasets: ${response.status} ${response.statusText}`);
}
const text = await response.text();
datasets = parseCSV(text);
console.log(`Loaded ${datasets.length} datasets for dashboard`);
} catch (error) {
console.error('Error loading dashboard data:', error);
document.querySelector('.dashboard-container').innerHTML = `
<div style="text-align: center; padding: 50px; color: #e74c3c;">
<h2>Error Loading Dashboard</h2>
<p>${error.message}</p>
</div>
`;
throw error;
}
}
// Parse CSV data
function parseCSV(text) {
const lines = text.trim().split('\n');
const headers = lines[0].split(',').map(h => h.trim());
return lines.slice(1)
.filter(line => line.trim() !== '' && line.split(',').some(v => v.trim() !== '')) // Filter empty or comma-only lines
.map(line => {
const values = parseCSVLine(line);
const obj = {};
headers.forEach((header, index) => {
obj[header] = values[index] || '';
});
return obj;
});
}
// Parse CSV line handling quoted values
function parseCSVLine(line) {
const result = [];
let current = '';
let inQuotes = false;
for (let i = 0; i < line.length; i++) {
const char = line[i];
if (char === '"') {
inQuotes = !inQuotes;
} else if (char === ',' && !inQuotes) {
result.push(current.trim());
current = '';
} else {
current += char;
}
}
result.push(current.trim());
return result;
}
// Calculate analytics
function calculateAnalytics() {
analytics = {
totalDatasets: datasets.length,
totalSize: 0,
avgSize: 0,
languages: new Set(),
domains: new Set(),
years: new Set(),
domainCounts: {},
taskCounts: {},
artifactCounts: {},
stageCounts: {},
languageCounts: {},
licenseCounts: {},
granularityCounts: {},
sizeRanges: { small: 0, medium: 0, large: 0, xlarge: 0 },
yearCounts: {}
};
datasets.forEach(dataset => {
// Size calculations
const size = parseInt(dataset.Size) || 0;
analytics.totalSize += size;
// Languages
if (dataset.Languages) {
const langs = dataset.Languages.split(',').map(l => l.trim());
langs.forEach(lang => {
analytics.languages.add(lang);
analytics.languageCounts[lang] = (analytics.languageCounts[lang] || 0) + 1;
});
}
// Domains
if (dataset.Domain) {
const domains = dataset.Domain.split(',').map(d => d.trim());
domains.forEach(domain => {
if (domain) {
analytics.domains.add(domain);
analytics.domainCounts[domain] = (analytics.domainCounts[domain] || 0) + 1;
}
});
}
// Years
if (dataset.Year) {
analytics.years.add(dataset.Year);
analytics.yearCounts[dataset.Year] = (analytics.yearCounts[dataset.Year] || 0) + 1;
}
// Tasks
if (dataset.Task) {
analytics.taskCounts[dataset.Task] = (analytics.taskCounts[dataset.Task] || 0) + 1;
}
// Artifact types
if (dataset['Artifact type']) {
analytics.artifactCounts[dataset['Artifact type']] = (analytics.artifactCounts[dataset['Artifact type']] || 0) + 1;
}
// RE stages
if (dataset['RE stage']) {
analytics.stageCounts[dataset['RE stage']] = (analytics.stageCounts[dataset['RE stage']] || 0) + 1;
}
// Licenses
if (dataset.License) {
analytics.licenseCounts[dataset.License] = (analytics.licenseCounts[dataset.License] || 0) + 1;
}
// Granularity
if (dataset.Granularity) {
analytics.granularityCounts[dataset.Granularity] = (analytics.granularityCounts[dataset.Granularity] || 0) + 1;
}
// Size ranges
if (size < 1000) analytics.sizeRanges.small++;
else if (size < 10000) analytics.sizeRanges.medium++;
else if (size < 100000) analytics.sizeRanges.large++;
else analytics.sizeRanges.xlarge++;
});
analytics.avgSize = Math.round(analytics.totalSize / analytics.totalDatasets);
}
// Update statistics
function updateStatistics() {
document.getElementById('total-datasets').textContent = analytics.totalDatasets;
document.getElementById('total-size').textContent = analytics.totalSize.toLocaleString();
document.getElementById('avg-size').textContent = analytics.avgSize.toLocaleString();
document.getElementById('languages-count').textContent = analytics.languages.size;
document.getElementById('domains-count').textContent = analytics.domains.size;
const years = Array.from(analytics.years).map(y => parseInt(y)).filter(y => !isNaN(y));
const yearSpan = years.length > 0 ? Math.max(...years) - Math.min(...years) + 1 : 0;
document.getElementById('years-span').textContent = yearSpan;
}
// Create charts
function createCharts() {
createDomainChart();
createTaskChart();
createArtifactChart();
createStageChart();
createSizeChart();
createLanguageChart();
createTimelineChart();
createLicenseChart();
createGranularityChart();
createBubbleChart();
}
function createDomainChart() {
const ctx = document.getElementById('domainChart').getContext('2d');
const sortedDomains = Object.entries(analytics.domainCounts)
.sort(([, a], [, b]) => b - a)
//.slice(0, 8);
new Chart(ctx, {
type: 'doughnut',
data: {
labels: sortedDomains.map(([domain]) => domain),
datasets: [{
data: sortedDomains.map(([, count]) => count),
backgroundColor: [
'#667eea', '#764ba2', '#f093fb', '#f5576c',
'#4facfe', '#00f2fe', '#43e97b', '#38f9d7',
'#ff9a9e', '#fecfef', '#fecfef', '#a8edea',
'#fed6e3', '#d299c2', '#ffecd2', '#fcb69f'
]
}]
},
options: {
responsive: true,
plugins: {
legend: {
position: 'bottom'
}
}
}
});
}
function createTaskChart() {
const ctx = document.getElementById('taskChart').getContext('2d');
const sortedTasks = Object.entries(analytics.taskCounts)
.sort(([, a], [, b]) => b - a);
new Chart(ctx, {
type: 'bar',
data: {
labels: sortedTasks.map(([task]) => task),
datasets: [{
label: 'Number of Datasets',
data: sortedTasks.map(([, count]) => count),
backgroundColor: '#667eea'
}]
},
options: {
responsive: true,
scales: {
y: {
beginAtZero: true
}
}
}
});
}
function createArtifactChart() {
const ctx = document.getElementById('artifactChart').getContext('2d');
const sortedArtifacts = Object.entries(analytics.artifactCounts)
.sort(([, a], [, b]) => b - a);
new Chart(ctx, {
type: 'pie',
data: {
labels: sortedArtifacts.map(([artifact]) => artifact),
datasets: [{
data: sortedArtifacts.map(([, count]) => count),
backgroundColor: [
'#667eea', '#764ba2', '#f093fb', '#f5576c',
'#4facfe', '#00f2fe', '#43e97b', '#38f9d7'
]
}]
},
options: {
responsive: true,
plugins: {
legend: {
position: 'bottom'
}
}
}
});
}
function createStageChart() {
const ctx = document.getElementById('stageChart').getContext('2d');
const sortedStages = Object.entries(analytics.stageCounts)
.sort(([, a], [, b]) => b - a);
new Chart(ctx, {
type: 'bar',
data: {
labels: sortedStages.map(([stage]) => stage),
datasets: [{
label: 'Number of Datasets',
data: sortedStages.map(([, count]) => count),
backgroundColor: '#764ba2'
}]
},
options: {
responsive: true,
indexAxis: 'y',
scales: {
x: {
beginAtZero: true
}
}
}
});
}
function createSizeChart() {
const ctx = document.getElementById('sizeChart').getContext('2d');
new Chart(ctx, {
type: 'bar',
data: {
labels: ['Small (<1K)', 'Medium (1K-10K)', 'Large (10K-100K)', 'X-Large (>100K)'],
datasets: [{
label: 'Number of Datasets',
data: [
analytics.sizeRanges.small,
analytics.sizeRanges.medium,
analytics.sizeRanges.large,
analytics.sizeRanges.xlarge
],
backgroundColor: ['#f093fb', '#f5576c', '#4facfe', '#00f2fe']
}]
},
options: {
responsive: true,
scales: {
y: {
beginAtZero: true
}
}
}
});
}
function createLanguageChart() {
const ctx = document.getElementById('languageChart').getContext('2d');
const sortedLanguages = Object.entries(analytics.languageCounts)
.sort(([, a], [, b]) => b - a)
.slice(0, 6);
new Chart(ctx, {
type: 'doughnut',
data: {
labels: sortedLanguages.map(([lang]) => lang),
datasets: [{
data: sortedLanguages.map(([, count]) => count),
backgroundColor: [
'#667eea', '#764ba2', '#f093fb', '#f5576c',
'#4facfe', '#00f2fe'
]
}]
},
options: {
responsive: true,
plugins: {
legend: {
position: 'bottom'
}
}
}
});
}
function createTimelineChart() {
const ctx = document.getElementById('timelineChart').getContext('2d');
// Get min and max years
const years = Object.keys(analytics.yearCounts).map(y => parseInt(y)).filter(y => !isNaN(y));
if (years.length === 0) return;
const minYear = Math.min(...years);
const maxYear = Math.max(...years);
// Create array with all years from min to max
const allYears = [];
const allCounts = [];
for (let year = minYear; year <= maxYear; year++) {
allYears.push(year.toString());
allCounts.push(analytics.yearCounts[year.toString()] || 0);
}
new Chart(ctx, {
type: 'line',
data: {
labels: allYears,
datasets: [{
label: 'Datasets Published',
data: allCounts,
borderColor: '#667eea',
backgroundColor: 'rgba(102, 126, 234, 0.1)',
tension: 0.4,
fill: true,
pointRadius: 5,
pointHoverRadius: 7
}]
},
options: {
responsive: true,
maintainAspectRatio: true,
scales: {
y: {
beginAtZero: true,
ticks: {
stepSize: 1
}
}
}
}
});
}
function createLicenseChart() {
const ctx = document.getElementById('licenseChart').getContext('2d');
const sortedLicenses = Object.entries(analytics.licenseCounts)
.sort(([, a], [, b]) => b - a);
new Chart(ctx, {
type: 'pie',
data: {
labels: sortedLicenses.map(([license]) => license),
datasets: [{
data: sortedLicenses.map(([, count]) => count),
backgroundColor: [
'#667eea', '#764ba2', '#f093fb', '#f5576c',
'#4facfe', '#00f2fe', '#43e97b', '#38f9d7'
]
}]
},
options: {
responsive: true,
plugins: {
legend: {
position: 'bottom'
}
}
}
});
}
function createGranularityChart() {
const ctx = document.getElementById('granularityChart').getContext('2d');
const sortedGranularity = Object.entries(analytics.granularityCounts)
.sort(([, a], [, b]) => b - a);
new Chart(ctx, {
type: 'bar',
data: {
labels: sortedGranularity.map(([granularity]) => granularity),
datasets: [{
label: 'Number of Datasets',
data: sortedGranularity.map(([, count]) => count),
backgroundColor: '#43e97b'
}]
},
options: {
responsive: true,
scales: {
y: {
beginAtZero: true
}
}
}
});
}
function createBubbleChart() {
const ctx = document.getElementById('bubbleChart').getContext('2d');
// Create matrix of RE stages vs Tasks
const stages = Object.keys(analytics.stageCounts).sort();
const tasks = Object.keys(analytics.taskCounts).sort();
// Create bubble data
const bubbleData = [];
const stageTaskCounts = {};
// Count datasets for each stage-task combination
datasets.forEach(dataset => {
const stage = dataset['RE stage'];
const task = dataset.Task;
if (stage && task) {
const key = `${stage}|${task}`;
stageTaskCounts[key] = (stageTaskCounts[key] || 0) + 1;
}
});
// Create bubble data points
stages.forEach((stage, stageIndex) => {
tasks.forEach((task, taskIndex) => {
const key = `${stage}|${task}`;
const count = stageTaskCounts[key] || 0;
if (count > 0) {
bubbleData.push({
x: taskIndex,
y: stageIndex,
r: Math.sqrt(count) * 4 + 8 // Adjusted radius scaling
});
}
});
});
new Chart(ctx, {
type: 'bubble',
data: {
datasets: [{
label: 'Number of Datasets',
data: bubbleData,
backgroundColor: 'rgba(102, 126, 234, 0.6)',
borderColor: '#667eea',
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: true,
scales: {
x: {
type: 'linear',
position: 'bottom',
min: -0.8, // Increased margin to prevent overlap
max: tasks.length - 0.2,
ticks: {
stepSize: 1,
callback: function (value) {
return tasks[Math.round(value)] || '';
},
maxRotation: 45, // Rotate labels to prevent overlap
minRotation: 0
},
grid: {
display: true,
color: 'rgba(0,0,0,0.1)'
}
},
y: {
type: 'linear',
min: -0.8, // Increased margin to prevent overlap
max: stages.length - 0.2,
ticks: {
stepSize: 1,
callback: function (value) {
return stages[Math.round(value)] || '';
}
},
grid: {
display: true,
color: 'rgba(0,0,0,0.1)'
}
}
},
plugins: {
tooltip: {
callbacks: {
label: function (context) {
const data = context.raw;
const task = tasks[Math.round(data.x)];
const stage = stages[Math.round(data.y)];
const count = Math.round(((data.r - 8) / 4) ** 2);
return `${stage} + ${task}: ${count} datasets`;
}
}
},
legend: {
display: false
}
}
}
});
}
// Generate dynamic insights based on actual data
function generateDynamicInsights() {
if (!datasets || datasets.length === 0) return;
const insights = analyzeData();
updateInsightsSection(insights);
}
// Analyze the dataset to generate insights
function analyzeData() {
const totalDatasets = datasets.length;
// Domain analysis
const domainCounts = {};
const taskCounts = {};
const granularityCounts = {};
const languageCounts = {};
const stageCounts = {};
const licenseCounts = {};
const yearCounts = {};
const sizes = [];
datasets.forEach(dataset => {
// Count domains
if (dataset.Domain && dataset.Domain.trim()) {
const domains = dataset.Domain.split(',').map(d => d.trim());
domains.forEach(domain => {
if (domain) {
domainCounts[domain] = (domainCounts[domain] || 0) + 1;
}
});
}
// Count tasks
if (dataset.Task && dataset.Task.trim()) {
taskCounts[dataset.Task] = (taskCounts[dataset.Task] || 0) + 1;
}
// Count granularity
if (dataset.Granularity && dataset.Granularity.trim()) {
granularityCounts[dataset.Granularity] = (granularityCounts[dataset.Granularity] || 0) + 1;
}
// Count languages
if (dataset.Languages && dataset.Languages.trim()) {
const languages = dataset.Languages.split(',').map(lang => lang.trim());
languages.forEach(lang => {
languageCounts[lang] = (languageCounts[lang] || 0) + 1;
});
}
// Count RE stages
if (dataset['RE stage'] && dataset['RE stage'].trim()) {
stageCounts[dataset['RE stage']] = (stageCounts[dataset['RE stage']] || 0) + 1;
}
// Count licenses
if (dataset.License && dataset.License.trim()) {
licenseCounts[dataset.License] = (licenseCounts[dataset.License] || 0) + 1;
}
// Count years
if (dataset.Year && dataset.Year.trim()) {
yearCounts[dataset.Year] = (yearCounts[dataset.Year] || 0) + 1;
}
// Collect sizes
if (dataset.Size && dataset.Size.trim() && !isNaN(parseInt(dataset.Size))) {
sizes.push(parseInt(dataset.Size));
}
});
// Get top domains
const topDomains = Object.entries(domainCounts)
.sort(([, a], [, b]) => b - a)
.slice(0, 3)
.map(([domain, count]) => ({ domain, count }));
// Get top tasks
const topTasks = Object.entries(taskCounts)
.sort(([, a], [, b]) => b - a)
.slice(0, 3)
.map(([task, count]) => ({ task, count }));
// Get top granularity levels
const topGranularity = Object.entries(granularityCounts)
.sort(([, a], [, b]) => b - a)
.slice(0, 2)
.map(([granularity, count]) => ({ granularity, count }));
// Get top RE stages
const topStages = Object.entries(stageCounts)
.sort(([, a], [, b]) => b - a)
.slice(0, 2)
.map(([stage, count]) => ({ stage, count }));
// Calculate language statistics
const englishCount = languageCounts['en'] || 0;
const englishPercentage = Math.round((englishCount / totalDatasets) * 100);
const nonEnglishLanguages = Object.keys(languageCounts).filter(lang => lang !== 'en');
// Calculate open license percentage
const openLicenses = ['Creative Commons Attribution Share Alike 4.0 International',
'GNU General Public License v3.0', 'Apache 2.0', 'MIT'];
const openLicenseCount = Object.entries(licenseCounts)
.filter(([license]) => openLicenses.some(open => license.includes(open)))
.reduce((sum, [, count]) => sum + count, 0);
const openPercentage = Math.round((openLicenseCount / totalDatasets) * 100);
// Calculate temporal trends
const currentYear = new Date().getFullYear();
const recentYears = Object.keys(yearCounts)
.filter(year => parseInt(year) >= currentYear - 3)
.reduce((sum, year) => sum + yearCounts[year], 0);
const recentPercentage = Math.round((recentYears / totalDatasets) * 100);
// Calculate size statistics
const minSize = sizes.length > 0 ? Math.min(...sizes) : 0;
const maxSize = sizes.length > 0 ? Math.max(...sizes) : 0;