SHELLAPANDIANGANHUNGING commited on
Commit
2c7e819
·
verified ·
1 Parent(s): 95b4142

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -30
app.py CHANGED
@@ -1702,54 +1702,35 @@ with col_insights:
1702
  # 3. Shift Pattern Analysis
1703
  if col_shift and col_shift in df.columns:
1704
  shift_counts = df[col_shift].value_counts()
1705
-
1706
  st.markdown("**Shift Pattern Risk**")
1707
 
1708
- shift_color = "#d32f2f" # warna merah gelap
1709
 
1710
  for shift_val in shift_counts.index:
1711
  shift_pct = (shift_counts[shift_val] / len(df)) * 100
1712
-
1713
- # Metric-style card (PASTIKAN unsafe_allow_html=True)
1714
  st.markdown(
1715
  f"""
1716
- <div style="
1717
- padding: 12px 16px;
1718
- border-radius: 12px;
1719
- background-color: #ffffff;
1720
- border: 1px solid #eee;
1721
- margin-bottom: 10px;
1722
- box-shadow: 0 1px 3px rgba(0,0,0,0.05);
1723
- ">
1724
- <div style="font-size: 16px; font-weight: 600;">
1725
- Shift {shift_val} Alerts
1726
- </div>
1727
-
1728
- <div style="font-size: 28px; font-weight: 700;">
1729
- {shift_counts[shift_val]}
1730
- </div>
1731
-
1732
- <div style="font-size: 14px; font-weight: 700; color:{shift_color};">
1733
- {shift_pct:.1f}% of total alerts
1734
  </div>
1735
  </div>
1736
  """,
1737
- unsafe_allow_html=True # <-- WAJIB ADA INI
1738
  )
1739
 
1740
- # Risk Message
1741
  if shift_pct > 50:
1742
- st.warning(
1743
- f"Shift {shift_val} has disproportionately high alerts ({shift_pct:.1f}%). Review shift scheduling and workload."
1744
- )
1745
  else:
1746
- st.info(
1747
- f"Shift {shift_val} alert distribution is acceptable ({shift_pct:.1f}%)."
1748
- )
1749
  else:
1750
  st.info("Shift data not available for Shift Pattern Analysis.")
1751
 
1752
 
 
1753
  # 4. Operator Risk Profiling
1754
  if col_operator and col_operator in df.columns:
1755
  operator_alerts = df[col_operator].value_counts()
 
1702
  # 3. Shift Pattern Analysis
1703
  if col_shift and col_shift in df.columns:
1704
  shift_counts = df[col_shift].value_counts()
 
1705
  st.markdown("**Shift Pattern Risk**")
1706
 
1707
+ shift_color = "#d32f2f" # merah gelap
1708
 
1709
  for shift_val in shift_counts.index:
1710
  shift_pct = (shift_counts[shift_val] / len(df)) * 100
1711
+
 
1712
  st.markdown(
1713
  f"""
1714
+ <div style="padding:12px 16px; border-radius:10px; background-color:#fff; border:1px solid #eee; margin-bottom:10px;">
1715
+ <div style="font-size:16px; font-weight:600; color:inherit;">Shift {shift_val} Alerts</div>
1716
+ <div style="font-size:28px; font-weight:700; color:inherit;">{shift_counts[shift_val]}</div>
1717
+ <div style="font-size:14px; font-weight:700;">
1718
+ <span style="color:{shift_color};">{shift_pct:.1f}% of total alerts</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
1719
  </div>
1720
  </div>
1721
  """,
1722
+ unsafe_allow_html=True
1723
  )
1724
 
 
1725
  if shift_pct > 50:
1726
+ st.warning(f"Shift {shift_val} has disproportionately high alerts ({shift_pct:.1f}%). Review shift scheduling and workload.")
 
 
1727
  else:
1728
+ st.info(f"Shift {shift_val} alert distribution is acceptable ({shift_pct:.1f}%).")
 
 
1729
  else:
1730
  st.info("Shift data not available for Shift Pattern Analysis.")
1731
 
1732
 
1733
+
1734
  # 4. Operator Risk Profiling
1735
  if col_operator and col_operator in df.columns:
1736
  operator_alerts = df[col_operator].value_counts()