SHELLAPANDIANGANHUNGING commited on
Commit
bba4141
·
verified ·
1 Parent(s): 489260d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -41
app.py CHANGED
@@ -1698,48 +1698,23 @@ with col_insights:
1698
  st.info(f"{high_speed_pct:.1f}% of alerts occur at high speeds. This is within acceptable range.")
1699
  else:
1700
  st.info("Speed data not available for High-Speed Fatigue Analysis.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1701
 
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
 
1744
  # 4. Operator Risk Profiling
1745
  # 4. Operator Risk Profiling
 
1698
  st.info(f"{high_speed_pct:.1f}% of alerts occur at high speeds. This is within acceptable range.")
1699
  else:
1700
  st.info("Speed data not available for High-Speed Fatigue Analysis.")
1701
+ # 3.Objective
1702
+ if col_shift and col_shift in df.columns:
1703
+ shift_counts = df[col_shift].value_counts()
1704
+
1705
+ st.markdown(f"**Shift Pattern Risk**")
1706
+ for shift_val in shift_counts.index:
1707
+ shift_pct = (shift_counts[shift_val] / len(df)) * 100
1708
+ # Ganti st.metric dengan HTML custom
1709
+ 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)
1710
+
1711
+ if shift_pct > 50:
1712
+ st.warning(f"Shift {shift_val} has disproportionately high alerts ({shift_pct:.1f}%). Review shift scheduling and workload.")
1713
+ else:
1714
+ st.info(f"Shift {shift_val} alert distribution is acceptable ({shift_pct:.1f}%).")
1715
+ else:
1716
+ st.info("Shift data not available for Shift Pattern Analysis.")
1717
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1718
 
1719
  # 4. Operator Risk Profiling
1720
  # 4. Operator Risk Profiling