SHELLAPANDIANGANHUNGING commited on
Commit
ef00f8c
·
verified ·
1 Parent(s): 56b6a03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +115 -53
app.py CHANGED
@@ -1380,60 +1380,122 @@ else:
1380
  # ===============================================================
1381
  st.subheader("Hazard Gradient Legend")
1382
  st.markdown("""
1383
- <div class="legend-container">
1384
- <div class="legend-box">
1385
- <div class="legend-title">Worsening Trends (Positive Slope):</div>
1386
- <div class="legend-item">
1387
- <div class="legend-color" style="background-color: #d32f2f;"></div>
1388
- <span>Very High Worsening (≥1.5)</span>
1389
- </div>
1390
- <div class="legend-item">
1391
- <div class="legend-color" style="background-color: #e57373;"></div>
1392
- <span>High Worsening (1.0–1.5)</span>
1393
- </div>
1394
- <div class="legend-item">
1395
- <div class="legend-color" style="background-color: #ef9a9a;"></div>
1396
- <span>Moderate Worsening (0.5–1.0)</span>
1397
- </div>
1398
- <div class="legend-item">
1399
- <div class="legend-color" style="background-color: #ffcdd2;"></div>
1400
- <span>Slight Worsening (0–0.5)</span>
1401
- </div>
1402
- <br>
1403
- <i>Note: Worsening trends indicate increasing fatigue frequency over weeks.</i>
1404
- </div>
1405
- <div class="legend-box">
1406
- <div class="legend-title">Improving Trends (Negative Slope):</div>
1407
- <div class="legend-item">
1408
- <div class="legend-color" style="background-color: #388e3c;"></div>
1409
- <span>Excellent Improvement (≤−1.5)</span>
1410
- </div>
1411
- <div class="legend-item">
1412
- <div class="legend-color" style="background-color: #81c784;"></div>
1413
- <span>Great Improvement (−1.5 to −1.0)</span>
1414
- </div>
1415
- <div class="legend-item">
1416
- <div class="legend-color" style="background-color: #a5d6a7;"></div>
1417
- <span>Good Improvement (−1.0 to −0.5)</span>
1418
- </div>
1419
- <div class="legend-item">
1420
- <div class="legend-color" style="background-color: #c8e6c9;"></div>
1421
- <span>Slight Improvement (−0.5 to 0)</span>
1422
- </div>
1423
- <br>
1424
- <i>Note: Improving trends indicate decreasing fatigue frequency over weeks.</i>
1425
- </div>
1426
- <div class="legend-box">
1427
- <div class="legend-title">One-Time Events (Zero Slope):</div>
1428
- <div class="legend-item">
1429
- <div class="legend-color" style="background-color: #FFD700;"></div>
1430
- <span>One Time Event (0)</span>
1431
- </div>
1432
- <br>
1433
- <i>Note: Applies when an operator has data in only one week — slope is set to 0 by definition.</i>
1434
- </div>
1435
  </div>
1436
- """, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1437
 
1438
  # ===============================================================
1439
  # PLOT FUNCTION — UPDATED: color for slope=0 is now #FFD700
 
1380
  # ===============================================================
1381
  st.subheader("Hazard Gradient Legend")
1382
  st.markdown("""
1383
+ <style>
1384
+ .legend-container {
1385
+ display: flex;
1386
+ gap: 20px;
1387
+ margin-top: 10px;
1388
+ }
1389
+ .legend-box {
1390
+ background-color: #fafafa;
1391
+ border-radius: 12px;
1392
+ padding: 15px 20px;
1393
+ width: 32%;
1394
+ border: 1px solid #e0e0e0;
1395
+ box-shadow: 0px 2px 6px rgba(0,0,0,0.05);
1396
+ }
1397
+ .legend-title {
1398
+ font-weight: 700;
1399
+ margin-bottom: 12px;
1400
+ color: #333;
1401
+ }
1402
+ .legend-item {
1403
+ display: flex;
1404
+ align-items: center;
1405
+ margin-bottom: 6px;
1406
+ }
1407
+ .legend-color {
1408
+ width: 18px;
1409
+ height: 18px;
1410
+ border-radius: 4px;
1411
+ margin-right: 10px;
1412
+ border: 1px solid #ccc;
1413
+ }
1414
+ .legend-note {
1415
+ font-size: 12px;
1416
+ color: #555;
1417
+ font-style: italic;
1418
+ margin-top: 10px;
1419
+ display: block;
1420
+ }
1421
+ </style>
1422
+
1423
+ <div class="legend-container">
1424
+
1425
+ <!-- WORSENING -->
1426
+ <div class="legend-box">
1427
+ <div class="legend-title">Worsening Trends (Positive Slope)</div>
1428
+
1429
+ <div class="legend-item">
1430
+ <div class="legend-color" style="background-color: #d32f2f;"></div>
1431
+ <span>Very High Worsening (≥ 1.5)</span>
 
 
 
1432
  </div>
1433
+
1434
+ <div class="legend-item">
1435
+ <div class="legend-color" style="background-color: #e57373;"></div>
1436
+ <span>High Worsening (1.0 – 1.5)</span>
1437
+ </div>
1438
+
1439
+ <div class="legend-item">
1440
+ <div class="legend-color" style="background-color: #ef9a9a;"></div>
1441
+ <span>Moderate Worsening (0.5 – 1.0)</span>
1442
+ </div>
1443
+
1444
+ <div class="legend-item">
1445
+ <div class="legend-color" style="background-color: #ffcdd2;"></div>
1446
+ <span>Slight Worsening (0 – 0.5)</span>
1447
+ </div>
1448
+
1449
+ <span class="legend-note">
1450
+ Worsening trends indicate increasing fatigue frequency over weeks.
1451
+ </span>
1452
+ </div>
1453
+
1454
+ <!-- IMPROVING -->
1455
+ <div class="legend-box">
1456
+ <div class="legend-title">Improving Trends (Negative Slope)</div>
1457
+
1458
+ <div class="legend-item">
1459
+ <div class="legend-color" style="background-color: #388e3c;"></div>
1460
+ <span>Excellent Improvement (≤ −1.5)</span>
1461
+ </div>
1462
+
1463
+ <div class="legend-item">
1464
+ <div class="legend-color" style="background-color: #81c784;"></div>
1465
+ <span>Great Improvement (−1.5 to −1.0)</span>
1466
+ </div>
1467
+
1468
+ <div class="legend-item">
1469
+ <div class="legend-color" style="background-color: #a5d6a7;"></div>
1470
+ <span>Good Improvement (−1.0 to −0.5)</span>
1471
+ </div>
1472
+
1473
+ <div class="legend-item">
1474
+ <div class="legend-color" style="background-color: #c8e6c9;"></div>
1475
+ <span>Slight Improvement (−0.5 to 0)</span>
1476
+ </div>
1477
+
1478
+ <span class="legend-note">
1479
+ Improving trends indicate decreasing fatigue frequency over weeks.
1480
+ </span>
1481
+ </div>
1482
+
1483
+ <!-- ONE-TIME EVENT -->
1484
+ <div class="legend-box">
1485
+ <div class="legend-title">One-Time Events (Zero Slope)</div>
1486
+
1487
+ <div class="legend-item">
1488
+ <div class="legend-color" style="background-color: #FFD700;"></div>
1489
+ <span>One-Time Event (0)</span>
1490
+ </div>
1491
+
1492
+ <span class="legend-note">
1493
+ Occurs when an operator appears in only one week — slope is defined as 0.
1494
+ </span>
1495
+ </div>
1496
+
1497
+ </div>
1498
+ """, unsafe_allow_html=True)
1499
 
1500
  # ===============================================================
1501
  # PLOT FUNCTION — UPDATED: color for slope=0 is now #FFD700