Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1122,7 +1122,7 @@ try:
|
|
| 1122 |
# ================================
|
| 1123 |
# 12. DISPLAY TABLE
|
| 1124 |
# ================================
|
| 1125 |
-
st.subheader("Operator
|
| 1126 |
table_display = (
|
| 1127 |
risk_matrix[[
|
| 1128 |
"Operator Name",
|
|
@@ -1155,7 +1155,7 @@ except Exception as e:
|
|
| 1155 |
|
| 1156 |
# ... (kode sebelumnya tetap sama) ...
|
| 1157 |
|
| 1158 |
-
st.subheader("OBJECTIVE 5:See your team’s
|
| 1159 |
|
| 1160 |
# Custom CSS — tetap seperti sebelumnya (sudah sesuai preferensi)
|
| 1161 |
st.markdown("""
|
|
@@ -1546,7 +1546,7 @@ else:
|
|
| 1546 |
for insight in ob_insights:
|
| 1547 |
st.markdown(f"""
|
| 1548 |
<div class="ai-insight-box">
|
| 1549 |
-
<div class="ai-insight-title">
|
| 1550 |
<p>{insight}</p>
|
| 1551 |
</div>
|
| 1552 |
""", unsafe_allow_html=True)
|
|
@@ -1573,7 +1573,7 @@ else:
|
|
| 1573 |
for insight in coal_insights:
|
| 1574 |
st.markdown(f"""
|
| 1575 |
<div class="ai-insight-box">
|
| 1576 |
-
<div class="ai-insight-title">
|
| 1577 |
<p>{insight}</p>
|
| 1578 |
</div>
|
| 1579 |
""", unsafe_allow_html=True)
|
|
@@ -1702,20 +1702,44 @@ with col_insights:
|
|
| 1702 |
|
| 1703 |
|
| 1704 |
# 3. Shift Pattern Analysis
|
| 1705 |
-
|
| 1706 |
-
|
|
|
|
|
|
|
| 1707 |
|
| 1708 |
-
|
| 1709 |
-
|
| 1710 |
-
shift_pct = (shift_counts[shift_val] / len(df)) * 100
|
| 1711 |
-
# Ganti st.metric dengan HTML custom
|
| 1712 |
-
st.markdown(f"""<div style="font-size: 24px; font-weight: bold;">{shift_counts[shift_val]}</div><div style="color: red; font-size: 14px; margin-top: -5px;">↑ {shift_pct:.1f}% of total alerts</div>""", unsafe_allow_html=True)
|
| 1713 |
|
| 1714 |
-
|
| 1715 |
-
|
| 1716 |
-
|
| 1717 |
-
|
| 1718 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1719 |
st.info("Shift data not available for Shift Pattern Analysis.")
|
| 1720 |
|
| 1721 |
# 4. Operator Risk Profiling
|
|
|
|
| 1122 |
# ================================
|
| 1123 |
# 12. DISPLAY TABLE
|
| 1124 |
# ================================
|
| 1125 |
+
st.subheader("Operator Hazard Summary Table (8 Weeks Observed)")
|
| 1126 |
table_display = (
|
| 1127 |
risk_matrix[[
|
| 1128 |
"Operator Name",
|
|
|
|
| 1155 |
|
| 1156 |
# ... (kode sebelumnya tetap sama) ...
|
| 1157 |
|
| 1158 |
+
st.subheader("OBJECTIVE 5:See your team’s Fatigue Hazard Profile!")
|
| 1159 |
|
| 1160 |
# Custom CSS — tetap seperti sebelumnya (sudah sesuai preferensi)
|
| 1161 |
st.markdown("""
|
|
|
|
| 1546 |
for insight in ob_insights:
|
| 1547 |
st.markdown(f"""
|
| 1548 |
<div class="ai-insight-box">
|
| 1549 |
+
<div class="ai-insight-title">Hazard Summary</div>
|
| 1550 |
<p>{insight}</p>
|
| 1551 |
</div>
|
| 1552 |
""", unsafe_allow_html=True)
|
|
|
|
| 1573 |
for insight in coal_insights:
|
| 1574 |
st.markdown(f"""
|
| 1575 |
<div class="ai-insight-box">
|
| 1576 |
+
<div class="ai-insight-title">Hazard Summary</div>
|
| 1577 |
<p>{insight}</p>
|
| 1578 |
</div>
|
| 1579 |
""", unsafe_allow_html=True)
|
|
|
|
| 1702 |
|
| 1703 |
|
| 1704 |
# 3. Shift Pattern Analysis
|
| 1705 |
+
# 3. Shift Pattern Analysis
|
| 1706 |
+
if col_shift and col_shift in df.columns:
|
| 1707 |
+
shift_counts = df[col_shift].value_counts()
|
| 1708 |
+
st.markdown(f"**Shift Pattern Risk**")
|
| 1709 |
|
| 1710 |
+
for shift_val in shift_counts.index:
|
| 1711 |
+
shift_pct = (shift_counts[shift_val] / len(df)) * 100
|
|
|
|
|
|
|
|
|
|
| 1712 |
|
| 1713 |
+
# Tampilkan jumlah dan persentase dalam satu div
|
| 1714 |
+
st.markdown(
|
| 1715 |
+
f"""
|
| 1716 |
+
<div style="background-color: #f0f8ff; padding: 10px; border-radius: 8px; margin-bottom: 10px; border-left: 5px solid #007BFF;">
|
| 1717 |
+
<div style="font-size: 24px; font-weight: bold; color: #000000;">Shift {shift_val}</div>
|
| 1718 |
+
<div style="font-size: 28px; font-weight: bold; color: #000000; margin: 10px 0;">
|
| 1719 |
+
{shift_counts[shift_val]}
|
| 1720 |
+
</div>
|
| 1721 |
+
<div style="color: #d32f2f; font-size: 16px; font-weight: bold; margin-top: -10px;">
|
| 1722 |
+
↑ {shift_pct:.1f}% of total alerts
|
| 1723 |
+
</div>
|
| 1724 |
+
</div>
|
| 1725 |
+
""",
|
| 1726 |
+
unsafe_allow_html=True
|
| 1727 |
+
)
|
| 1728 |
+
|
| 1729 |
+
# Gunakan st.markdown untuk warning/info dengan persentase berwarna merah tebal
|
| 1730 |
+
if shift_pct > 50:
|
| 1731 |
+
st.markdown(
|
| 1732 |
+
f"<span style='color:#d32f2f; font-weight:bold;'>⚠️ Shift {shift_val} has disproportionately high alerts ({shift_pct:.1f}%). Review shift scheduling and workload.</span>",
|
| 1733 |
+
unsafe_allow_html=True
|
| 1734 |
+
)
|
| 1735 |
+
else:
|
| 1736 |
+
st.markdown(
|
| 1737 |
+
f"<span style='color:#d32f2f; font-weight:bold;'>✅ Shift {shift_val} alert distribution is acceptable ({shift_pct:.1f}%).</span>",
|
| 1738 |
+
unsafe_allow_html=True
|
| 1739 |
+
)
|
| 1740 |
+
|
| 1741 |
+
else:
|
| 1742 |
+
st.info("Shift data not available for Shift Pattern Analysis.")
|
| 1743 |
st.info("Shift data not available for Shift Pattern Analysis.")
|
| 1744 |
|
| 1745 |
# 4. Operator Risk Profiling
|