File size: 16,995 Bytes
5b045db 2ba2a7c 5b045db 3cc6b13 |
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 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Event Analytics Dashboard</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<style>
body {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.container {
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px);
margin: 20px auto;
padding: 30px;
}
.header {
text-align: center;
margin-bottom: 30px;
}
.header h1 {
color: #2c3e50;
font-weight: 700;
margin-bottom: 10px;
}
.header p {
color: #7f8c8d;
font-size: 1.1em;
}
.upload-section {
background: #f8f9fa;
border-radius: 15px;
padding: 30px;
margin-bottom: 30px;
border: 2px dashed #dee2e6;
transition: all 0.3s ease;
}
.upload-section:hover {
border-color: #007bff;
background: #e3f2fd;
}
.upload-icon {
font-size: 3rem;
color: #007bff;
margin-bottom: 20px;
}
.btn-primary {
background: linear-gradient(45deg, #007bff, #0056b3);
border: none;
padding: 12px 30px;
border-radius: 25px;
font-weight: 600;
transition: all 0.3s ease;
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}
.alert {
border-radius: 10px;
border: none;
padding: 15px 20px;
margin-bottom: 20px;
}
.alert-success {
background: linear-gradient(45deg, #28a745, #20c997);
color: white;
}
.alert-danger {
background: linear-gradient(45deg, #dc3545, #c82333);
color: white;
}
.plot-container {
background: white;
border-radius: 15px;
padding: 20px;
margin-bottom: 30px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.plot-title {
color: #2c3e50;
font-weight: 600;
margin-bottom: 15px;
padding-bottom: 10px;
border-bottom: 2px solid #e9ecef;
}
.insight-box {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
border-radius: 10px;
margin-top: 20px;
}
.insight-title {
font-weight: 600;
margin-bottom: 10px;
}
.swot-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 15px;
margin-top: 20px;
}
.swot-item {
background: rgba(255, 255, 255, 0.1);
padding: 15px;
border-radius: 8px;
backdrop-filter: blur(5px);
}
.swot-item h6 {
margin-bottom: 10px;
font-weight: 600;
}
.swot-item ul {
margin: 0;
padding-left: 20px;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-top: 20px;
}
.stat-card {
background: linear-gradient(135deg, #28a745, #20c997);
color: white;
padding: 20px;
border-radius: 10px;
text-align: center;
}
.stat-value {
font-size: 2rem;
font-weight: 700;
margin-bottom: 5px;
}
.stat-label {
font-size: 0.9rem;
opacity: 0.9;
}
.loading {
text-align: center;
padding: 40px;
}
.spinner {
border: 4px solid #f3f3f3;
border-top: 4px solid #007bff;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto 20px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.feature-list {
list-style: none;
padding: 0;
}
.feature-list li {
padding: 8px 0;
color: #6c757d;
}
.feature-list i {
color: #007bff;
margin-right: 10px;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>Event Analytics Dashboard</h1>
</div>
<!-- Flash Messages -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ 'danger' if category == 'error' else 'success' }} alert-dismissible fade show" role="alert">
<i class="fas fa-{{ 'exclamation-triangle' if category == 'error' else 'check-circle' }}"></i>
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endfor %}
{% endif %}
{% endwith %}
<!-- Upload Section -->
<div class="upload-section text-center">
<div class="upload-icon">
<i class="fas fa-cloud-upload-alt"></i>
</div>
<h3>Upload Your Document</h3>
<form method="POST" enctype="multipart/form-data" id="uploadForm">
<div class="mb-3">
<input type="file" class="form-control" name="document" accept=".docx" required style="display: none;" id="fileInput">
<label for="fileInput" class="btn btn-outline-primary btn-lg">
<i class="fas fa-folder-open"></i> Choose DOCX File
</label>
</div>
<div id="fileName" class="mb-3 text-muted"></div>
<button type="submit" class="btn btn-primary btn-lg" id="uploadBtn">
<i class="fas fa-upload"></i> Upload & Analyze
</button>
</form>
</div>
<!-- Loading Section -->
<div id="loadingSection" class="loading" style="display: none;">
<div class="spinner"></div>
<h4>Processing your document...</h4>
<p class="text-muted">Please wait while we analyze your event data</p>
</div>
<!-- Results Section -->
{% if plots %}
<div class="results-section">
<h2 class="text-center mb-4">
<i class="fas fa-chart-pie"></i> Analysis Results
</h2>
<!-- Statistics Overview -->
{% if plots.stats %}
<div class="plot-container">
<h3 class="plot-title"><i class="fas fa-calculator"></i> Statistics Overview</h3>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-value">{{ plots.stats.total_events }}</div>
<div class="stat-label">Total Events</div>
</div>
<div class="stat-card">
<div class="stat-value">{{ plots.stats.avg_events_per_year }}</div>
<div class="stat-label">Avg Events/Year</div>
</div>
<div class="stat-card">
<div class="stat-value">{{ plots.stats.most_active_year }}</div>
<div class="stat-label">Most Active Year</div>
</div>
<div class="stat-card">
<div class="stat-value">{{ plots.stats.most_common_category }}</div>
<div class="stat-label">Top Category</div>
</div>
</div>
</div>
{% endif %}
<!-- Bar Chart -->
{% if plots.bar %}
<div class="plot-container">
<h3 class="plot-title"><i class="fas fa-chart-bar"></i> Event Distribution by Category</h3>
{{ plots.bar.plot|safe }}
{% if plots.bar.insight %}
<div class="insight-box">
<div class="insight-title">๐ Key Insights</div>
<p><strong>Main Finding:</strong> {{ plots.bar.insight.main_insight }}</p>
<div class="swot-grid">
<div class="swot-item">
<h6><i class="fas fa-thumbs-up"></i> Strengths</h6>
<ul>
{% for strength in plots.bar.insight.swot.strengths %}
<li>{{ strength }}</li>
{% endfor %}
</ul>
</div>
<div class="swot-item">
<h6><i class="fas fa-exclamation-triangle"></i> Weaknesses</h6>
<ul>
{% for weakness in plots.bar.insight.swot.weaknesses %}
<li>{{ weakness }}</li>
{% endfor %}
</ul>
</div>
<div class="swot-item">
<h6><i class="fas fa-lightbulb"></i> Opportunities</h6>
<ul>
{% for opportunity in plots.bar.insight.swot.opportunities %}
<li>{{ opportunity }}</li>
{% endfor %}
</ul>
</div>
<div class="swot-item">
<h6><i class="fas fa-shield-alt"></i> Threats</h6>
<ul>
{% for threat in plots.bar.insight.swot.threats %}
<li>{{ threat }}</li>
{% endfor %}
</ul>
</div>
</div>
<div class="mt-3">
<strong>๐ก Recommendations:</strong>
<ul>
{% for recommendation in plots.bar.insight.recommendations %}
<li>{{ recommendation }}</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
</div>
{% endif %}
<!-- Pie Chart -->
{% if plots.pie %}
<div class="plot-container">
<h3 class="plot-title"><i class="fas fa-chart-pie"></i> Latest Year Event Distribution</h3>
{{ plots.pie.plot|safe }}
{% if plots.pie.insight %}
<div class="insight-box">
<div class="insight-title">๐ฅง Distribution Analysis</div>
<p><strong>Main Finding:</strong> {{ plots.pie.insight.main_insight }}</p>
</div>
{% endif %}
</div>
{% endif %}
<!-- Line Chart -->
{% if plots.line %}
<div class="plot-container">
<h3 class="plot-title"><i class="fas fa-chart-line"></i> Event Trends Over Time</h3>
{{ plots.line.plot|safe }}
{% if plots.line.insight %}
<div class="insight-box">
<div class="insight-title">๐ Trend Analysis</div>
<p><strong>Main Finding:</strong> {{ plots.line.insight.main_insight }}</p>
</div>
{% endif %}
</div>
{% endif %}
<!-- Area Chart -->
{% if plots.area %}
<div class="plot-container">
<h3 class="plot-title"><i class="fas fa-area-chart"></i> Cumulative Event Distribution</h3>
{{ plots.area.plot|safe }}
{% if plots.area.insight %}
<div class="insight-box">
<div class="insight-title">๐ Cumulative Analysis</div>
<p><strong>Main Finding:</strong> {{ plots.area.insight.main_insight }}</p>
</div>
{% endif %}
</div>
{% endif %}
<!-- Action Items -->
<div class="plot-container">
<h3 class="plot-title"><i class="fas fa-tasks"></i> Action Items & Next Steps</h3>
<div class="row">
<div class="col-md-6">
<div class="insight-box">
<div class="insight-title">๐ฏ Immediate Actions</div>
<ul>
<li>Review underperforming categories</li>
<li>Allocate resources to high-potential areas</li>
<li>Plan for balanced event distribution</li>
</ul>
</div>
</div>
<div class="col-md-6">
<div class="insight-box">
<div class="insight-title">๐ฎ Future Planning</div>
<ul>
<li>Set targets for next academic year</li>
<li>Develop cross-category collaborations</li>
<li>Implement regular monitoring system</li>
</ul>
</div>
</div>
</div>
</div>
</div>
{% endif %}
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script>
<script>
// File input handling
document.getElementById('fileInput').addEventListener('change', function(e) {
const fileName = e.target.files[0]?.name;
const fileNameDiv = document.getElementById('fileName');
if (fileName) {
fileNameDiv.innerHTML = `<i class="fas fa-file-word text-primary"></i> Selected: <strong>${fileName}</strong>`;
} else {
fileNameDiv.innerHTML = '';
}
});
// Form submission handling
document.getElementById('uploadForm').addEventListener('submit', function(e) {
const fileInput = document.getElementById('fileInput');
const uploadBtn = document.getElementById('uploadBtn');
const loadingSection = document.getElementById('loadingSection');
if (!fileInput.files[0]) {
e.preventDefault();
alert('Please select a DOCX file first!');
return;
}
// Show loading
loadingSection.style.display = 'block';
uploadBtn.disabled = true;
uploadBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Processing...';
// Scroll to loading section
loadingSection.scrollIntoView({ behavior: 'smooth' });
});
// Auto-dismiss alerts after 5 seconds
setTimeout(function() {
const alerts = document.querySelectorAll('.alert');
alerts.forEach(function(alert) {
const bsAlert = new bootstrap.Alert(alert);
bsAlert.close();
});
}, 5000);
// Smooth scrolling for better UX
document.addEventListener('DOMContentLoaded', function() {
// Add smooth scrolling to all links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
});
</script>
</body>
</html> |