SHELLAPANDIANGANHUNGING commited on
Commit
3a6a570
·
verified ·
1 Parent(s): 6aefb3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -1712,12 +1712,12 @@ with col_insights:
1712
  critical_alerts = df[df['hour'].isin(critical_hours)]
1713
  critical_pct = (len(critical_alerts) / len(df)) * 100 if len(df) > 0 else 0
1714
 
1715
- st.markdown(f"**Critical Hour Risk (2-5 AM)**")
1716
  # Use conditional formatting for background color
1717
  bg_color = "#ffcccc" if critical_pct > 50 else "#ffebcc" if critical_pct > 25 else "#ffffcc" if critical_pct > 10 else "#e6ffe6"
1718
  st.markdown(f'<div style="background-color: {bg_color}; padding: 10px; border-radius: 5px;">Critical Hour Alerts: {len(critical_alerts)} ({critical_pct:.1f}% of total alerts)</div>', unsafe_allow_html=True)
1719
  if critical_pct > 10: # If more than 10% of alerts happen in critical hours
1720
- st.warning(f"High risk: {critical_pct:.1f}% of fatigue alerts occur during critical hours (2-5 AM). This is a known circadian dip period.")
1721
  else:
1722
  st.info(f"{critical_pct:.1f}% of alerts occur during critical hours. This is within acceptable range.")
1723
 
@@ -1780,7 +1780,7 @@ with col_recs:
1780
  peak_hour = df["hour"].value_counts().idxmax()
1781
  critical_hours = [2, 3, 4, 5]
1782
  if peak_hour in critical_hours:
1783
- insights_found.append(f" Most fatigue risk occurs at **{peak_hour}:00** — during critical circadian low period (2-5 AM). Consider enhanced monitoring.")
1784
  else:
1785
  insights_found.append(f"Most fatigue risk occurs at **{peak_hour}:00** — likely due to circadian drop.")
1786
 
@@ -1805,9 +1805,9 @@ with col_recs:
1805
  # Contoh rekomendasi berdasarkan insight
1806
  if any("circadian low" in i.lower() for i in insights_found):
1807
  ai_recs.append({
1808
- "recommendation": "Deploy enhanced fatigue monitoring systems (e.g., EOR) specifically during 2-5 AM shifts.",
1809
  "data_point": f"Critical Hour Alerts: {len(critical_alerts)} ({critical_pct:.1f}% of total alerts)",
1810
- "reason": "High percentage of alerts occurring during the known circadian low period (2-5 AM) indicates increased risk during these hours."
1811
  })
1812
  if any("shift" in i.lower() for i in insights_found):
1813
  ai_recs.append({
 
1712
  critical_alerts = df[df['hour'].isin(critical_hours)]
1713
  critical_pct = (len(critical_alerts) / len(df)) * 100 if len(df) > 0 else 0
1714
 
1715
+ st.markdown(f"**Critical Hour Risk (3-6 AM)**")
1716
  # Use conditional formatting for background color
1717
  bg_color = "#ffcccc" if critical_pct > 50 else "#ffebcc" if critical_pct > 25 else "#ffffcc" if critical_pct > 10 else "#e6ffe6"
1718
  st.markdown(f'<div style="background-color: {bg_color}; padding: 10px; border-radius: 5px;">Critical Hour Alerts: {len(critical_alerts)} ({critical_pct:.1f}% of total alerts)</div>', unsafe_allow_html=True)
1719
  if critical_pct > 10: # If more than 10% of alerts happen in critical hours
1720
+ st.warning(f"High risk: {critical_pct:.1f}% of fatigue alerts occur during critical hours (3-6 AM). This is a known circadian dip period.")
1721
  else:
1722
  st.info(f"{critical_pct:.1f}% of alerts occur during critical hours. This is within acceptable range.")
1723
 
 
1780
  peak_hour = df["hour"].value_counts().idxmax()
1781
  critical_hours = [2, 3, 4, 5]
1782
  if peak_hour in critical_hours:
1783
+ insights_found.append(f" Most fatigue risk occurs at **{peak_hour}:00** — during critical circadian low period (3-6 AM). Consider enhanced monitoring.")
1784
  else:
1785
  insights_found.append(f"Most fatigue risk occurs at **{peak_hour}:00** — likely due to circadian drop.")
1786
 
 
1805
  # Contoh rekomendasi berdasarkan insight
1806
  if any("circadian low" in i.lower() for i in insights_found):
1807
  ai_recs.append({
1808
+ "recommendation": "Deploy enhanced fatigue monitoring systems (e.g., EOR) specifically during 3-6 AM shifts.",
1809
  "data_point": f"Critical Hour Alerts: {len(critical_alerts)} ({critical_pct:.1f}% of total alerts)",
1810
+ "reason": "High percentage of alerts occurring during the known circadian low period (3-6 AM) indicates increased risk during these hours."
1811
  })
1812
  if any("shift" in i.lower() for i in insights_found):
1813
  ai_recs.append({