SHELLAPANDIANGANHUNGING commited on
Commit
34faf68
·
verified ·
1 Parent(s): 569d718

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -15
app.py CHANGED
@@ -1156,10 +1156,12 @@ import streamlit as st
1156
  import pandas as pd
1157
  import numpy as np
1158
  import plotly.graph_objects as go
 
1159
  # =================== OBJECTIVE 5: Operator Fatigue Risk Gradient Dashboard =====================
1160
- # =================== OBJECTIVE 5: Operator Fatigue Risk Gradient Dashboard =====================
1161
 
1162
- st.subheader("OBJECTIVE 5: See Your Team’s Fatigue Hazard Profile!")
 
 
1163
 
1164
  # Custom CSS — tetap seperti sebelumnya (sudah sesuai preferensi)
1165
  st.markdown("""
@@ -1385,12 +1387,11 @@ else:
1385
  all_coal = get_all_operators_with_slope(coal_data)
1386
 
1387
  # ===============================================================
1388
- # LEGEND — UPDATED: 3 kotak horizontal, notes inside each box, "Worsening" labels
1389
  # ===============================================================
1390
  st.subheader("Hazard Gradient Legend")
1391
  st.markdown("""
1392
  <div class="legend-container">
1393
- <!-- Worsening Trends -->
1394
  <div class="legend-box">
1395
  <div class="legend-title">Worsening Trends (Positive Slope):</div>
1396
  <div class="legend-item">
@@ -1409,12 +1410,10 @@ else:
1409
  <div class="legend-color" style="background-color: #ffcdd2;"></div>
1410
  <span>Slight Worsening (0–0.5)</span>
1411
  </div>
1412
- <i style="display: block; margin-top: 12px; font-size: 12px; color: #666; font-style: italic;">
1413
  Note: Positive slope indicates increasing fatigue event frequency over weeks — requires immediate risk mitigation.
1414
  </i>
1415
  </div>
1416
-
1417
- <!-- Improving Trends -->
1418
  <div class="legend-box">
1419
  <div class="legend-title">Improving Trends (Negative Slope):</div>
1420
  <div class="legend-item">
@@ -1432,22 +1431,19 @@ else:
1432
  <div class="legend-item">
1433
  <div class="legend-color" style="background-color: #c8e6c9;"></div>
1434
  <span>Slight Improvement (−0.5 to 0)</span>
1435
- </div>
1436
- <i style="display: block; margin-top: 12px; font-size: 12px; color: #666; font-style: italic;">
1437
- Note: Negative slope reflects a consistent decline in fatigue events — indicates effective fatigue management practices.
1438
  </i>
 
1439
  </div>
1440
-
1441
- <!-- One-Time Events -->
1442
  <div class="legend-box">
1443
  <div class="legend-title">One-Time Events (Zero Slope):</div>
1444
  <div class="legend-item">
1445
  <div class="legend-color" style="background-color: #FFD700;"></div>
1446
  <span>One Time Event (0)</span>
1447
  </div>
1448
- <i style="display: block; margin-top: 12px; font-size: 12px; color: #666; font-style: italic;">
1449
- Note: Slope = 0 by definition when data exists for only one week — trend assessment is not applicable.
1450
- </i>
1451
  </div>
1452
  </div>
1453
  """, unsafe_allow_html=True)
@@ -1674,6 +1670,8 @@ else:
1674
  st.error(f"Error in Top 10 Operator analysis: {str(e)}")
1675
  st.exception(e) # optionally show full traceback during dev
1676
 
 
 
1677
  # =================== OBJECTIVE 6: Automated Insights & AI Recommendations =====================
1678
  st.subheader("OBJECTIVE 6: Instant Insights & Recommendations")
1679
 
 
1156
  import pandas as pd
1157
  import numpy as np
1158
  import plotly.graph_objects as go
1159
+
1160
  # =================== OBJECTIVE 5: Operator Fatigue Risk Gradient Dashboard =====================
 
1161
 
1162
+ # ... (kode sebelumnya tetap sama) ...
1163
+
1164
+ st.subheader("OBJECTIVE 5:See your team’s fatigue Fatigue Hazard Profile!")
1165
 
1166
  # Custom CSS — tetap seperti sebelumnya (sudah sesuai preferensi)
1167
  st.markdown("""
 
1387
  all_coal = get_all_operators_with_slope(coal_data)
1388
 
1389
  # ===============================================================
1390
+ # LEGEND — UPDATED: Stable One Time Event, Gray Yellow
1391
  # ===============================================================
1392
  st.subheader("Hazard Gradient Legend")
1393
  st.markdown("""
1394
  <div class="legend-container">
 
1395
  <div class="legend-box">
1396
  <div class="legend-title">Worsening Trends (Positive Slope):</div>
1397
  <div class="legend-item">
 
1410
  <div class="legend-color" style="background-color: #ffcdd2;"></div>
1411
  <span>Slight Worsening (0–0.5)</span>
1412
  </div>
1413
+ <i style="display: block; margin-top: 12px; font-size: 12px; color: #666; font-style: italic;">
1414
  Note: Positive slope indicates increasing fatigue event frequency over weeks — requires immediate risk mitigation.
1415
  </i>
1416
  </div>
 
 
1417
  <div class="legend-box">
1418
  <div class="legend-title">Improving Trends (Negative Slope):</div>
1419
  <div class="legend-item">
 
1431
  <div class="legend-item">
1432
  <div class="legend-color" style="background-color: #c8e6c9;"></div>
1433
  <span>Slight Improvement (−0.5 to 0)</span>
1434
+ <i style="display: block; margin-top: 12px; font-size: 12px; color: #666; font-style: italic;">
1435
+ Note: Positive slope indicates increasing fatigue event frequency over weeks — requires immediate risk mitigation.
 
1436
  </i>
1437
+ </div>
1438
  </div>
 
 
1439
  <div class="legend-box">
1440
  <div class="legend-title">One-Time Events (Zero Slope):</div>
1441
  <div class="legend-item">
1442
  <div class="legend-color" style="background-color: #FFD700;"></div>
1443
  <span>One Time Event (0)</span>
1444
  </div>
1445
+ <br>
1446
+ <i>Note: Applies when an operator has data in only one week — slope is set to 0 by definition.</i>
 
1447
  </div>
1448
  </div>
1449
  """, unsafe_allow_html=True)
 
1670
  st.error(f"Error in Top 10 Operator analysis: {str(e)}")
1671
  st.exception(e) # optionally show full traceback during dev
1672
 
1673
+
1674
+
1675
  # =================== OBJECTIVE 6: Automated Insights & AI Recommendations =====================
1676
  st.subheader("OBJECTIVE 6: Instant Insights & Recommendations")
1677