Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1380,60 +1380,122 @@ else:
|
|
| 1380 |
# ===============================================================
|
| 1381 |
st.subheader("Hazard Gradient Legend")
|
| 1382 |
st.markdown("""
|
| 1383 |
-
|
| 1384 |
-
|
| 1385 |
-
|
| 1386 |
-
|
| 1387 |
-
|
| 1388 |
-
|
| 1389 |
-
|
| 1390 |
-
|
| 1391 |
-
|
| 1392 |
-
|
| 1393 |
-
|
| 1394 |
-
|
| 1395 |
-
|
| 1396 |
-
|
| 1397 |
-
|
| 1398 |
-
|
| 1399 |
-
|
| 1400 |
-
|
| 1401 |
-
|
| 1402 |
-
|
| 1403 |
-
|
| 1404 |
-
|
| 1405 |
-
|
| 1406 |
-
|
| 1407 |
-
|
| 1408 |
-
|
| 1409 |
-
|
| 1410 |
-
|
| 1411 |
-
|
| 1412 |
-
|
| 1413 |
-
|
| 1414 |
-
|
| 1415 |
-
|
| 1416 |
-
|
| 1417 |
-
|
| 1418 |
-
|
| 1419 |
-
|
| 1420 |
-
|
| 1421 |
-
|
| 1422 |
-
|
| 1423 |
-
|
| 1424 |
-
|
| 1425 |
-
|
| 1426 |
-
|
| 1427 |
-
|
| 1428 |
-
|
| 1429 |
-
|
| 1430 |
-
|
| 1431 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|