Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1699,6 +1699,8 @@ with col_insights:
|
|
| 1699 |
else:
|
| 1700 |
st.info("Speed data not available for High-Speed Fatigue Analysis.")
|
| 1701 |
|
|
|
|
|
|
|
| 1702 |
# 3. Shift Pattern Analysis
|
| 1703 |
if col_shift and col_shift in df.columns:
|
| 1704 |
shift_counts = df[col_shift].value_counts()
|
|
@@ -1707,10 +1709,31 @@ with col_insights:
|
|
| 1707 |
for shift_val in shift_counts.index:
|
| 1708 |
shift_pct = (shift_counts[shift_val] / len(df)) * 100
|
| 1709 |
# Ganti st.metric dengan HTML custom
|
| 1710 |
-
st.markdown(
|
| 1711 |
-
|
| 1712 |
-
|
| 1713 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1714 |
if shift_pct > 50:
|
| 1715 |
st.warning(f"Shift {shift_val} has disproportionately high alerts ({shift_pct:.1f}%). Review shift scheduling and workload.")
|
| 1716 |
else:
|
|
|
|
| 1699 |
else:
|
| 1700 |
st.info("Speed data not available for High-Speed Fatigue Analysis.")
|
| 1701 |
|
| 1702 |
+
|
| 1703 |
+
|
| 1704 |
# 3. Shift Pattern Analysis
|
| 1705 |
if col_shift and col_shift in df.columns:
|
| 1706 |
shift_counts = df[col_shift].value_counts()
|
|
|
|
| 1709 |
for shift_val in shift_counts.index:
|
| 1710 |
shift_pct = (shift_counts[shift_val] / len(df)) * 100
|
| 1711 |
# Ganti st.metric dengan HTML custom
|
| 1712 |
+
st.markdown(
|
| 1713 |
+
f"""
|
| 1714 |
+
<div style="
|
| 1715 |
+
background-color:#fff9c4;
|
| 1716 |
+
padding:12px 16px;
|
| 1717 |
+
border-radius:10px;
|
| 1718 |
+
border:1px solid #eee;
|
| 1719 |
+
margin-bottom:10px;
|
| 1720 |
+
">
|
| 1721 |
+
<div style="font-size:16px; font-weight:600;">
|
| 1722 |
+
Shift {shift_val} Alerts
|
| 1723 |
+
</div>
|
| 1724 |
+
|
| 1725 |
+
<div style="font-size:28px; font-weight:700; margin-top:4px;">
|
| 1726 |
+
{shift_counts[shift_val]}
|
| 1727 |
+
</div>
|
| 1728 |
+
|
| 1729 |
+
<div style="font-size:14px; font-weight:700; margin-top:-2px;">
|
| 1730 |
+
<span style="color:#d32f2f;">↑ {shift_pct:.1f}% of total alerts</span>
|
| 1731 |
+
</div>
|
| 1732 |
+
</div>
|
| 1733 |
+
""",
|
| 1734 |
+
unsafe_allow_html=True
|
| 1735 |
+
)
|
| 1736 |
+
|
| 1737 |
if shift_pct > 50:
|
| 1738 |
st.warning(f"Shift {shift_val} has disproportionately high alerts ({shift_pct:.1f}%). Review shift scheduling and workload.")
|
| 1739 |
else:
|