Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -724,7 +724,7 @@ st.markdown(f"""
|
|
| 724 |
# </div>
|
| 725 |
# "
|
| 726 |
st.markdown("""
|
| 727 |
-
<h3 class="objective-title">OBJECTIVE
|
| 728 |
<small>*Showing alarm types by shift: Normal (Green), Amber (Yellow), Red (Red)</small>
|
| 729 |
""", unsafe_allow_html=True)
|
| 730 |
|
|
@@ -756,12 +756,12 @@ def create_radial_chart(pos_data, title, shift_hours, shift_type):
|
|
| 756 |
# Shift Pagi (06:00β18:00) β 0Β° = 12, 90Β° = 3, 180Β° = 6, 270Β° = 9
|
| 757 |
theta = [(h - 12) * 30 for h in shift_hours] # 12 jam * 30Β° = 360Β°
|
| 758 |
tickvals = [0, 90, 180, 270]
|
| 759 |
-
ticktext = ["
|
| 760 |
else: # Shift Sore (18:00β06:00)
|
| 761 |
# Shift Sore (18:00β06:00) β 0Β° = 12, 90Β° = 3, 180Β° = 6, 270Β° = 9
|
| 762 |
theta = [(h - 12) * 30 if h >= 12 else (h + 12) * 30 for h in shift_hours] # 12 jam * 30Β° = 360Β°
|
| 763 |
tickvals = [0, 90, 180, 270]
|
| 764 |
-
ticktext = ["
|
| 765 |
|
| 766 |
fig = go.Figure()
|
| 767 |
fig.add_trace(go.Barpolar(
|
|
@@ -811,7 +811,7 @@ def create_radial_chart(pos_data, title, shift_hours, shift_type):
|
|
| 811 |
# =============== ROW 1: Position 1 & 2 (Pagi & Sore) ===============
|
| 812 |
with col1:
|
| 813 |
# Position 1 Pagi (06:00β18:00)
|
| 814 |
-
st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 1 (06:00β18:00)</div>', unsafe_allow_html=True)
|
| 815 |
pos1_data = alarm_data[alarm_data['Position'] == 1].copy()
|
| 816 |
pos1_data = pos1_data[pos1_data['hour'].between(6, 17, inclusive='both')]
|
| 817 |
fig1 = create_radial_chart(pos1_data, "Position 1 (06:00β18:00)", list(range(6, 18)), 'pagi')
|
|
@@ -822,7 +822,7 @@ with col1:
|
|
| 822 |
|
| 823 |
with col2:
|
| 824 |
# Position 1 Sore (18:00β06:00)
|
| 825 |
-
st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 1 (18:00β06:00)</div>', unsafe_allow_html=True)
|
| 826 |
pos1_data = alarm_data[alarm_data['Position'] == 1].copy()
|
| 827 |
pos1_data = pos1_data[~pos1_data['hour'].between(6, 17, inclusive='both')]
|
| 828 |
fig2 = create_radial_chart(pos1_data, "Position 1 (18:00β06:00)", list(range(18, 24)) + list(range(0, 6)), 'sore')
|
|
@@ -833,7 +833,7 @@ with col2:
|
|
| 833 |
|
| 834 |
with col3:
|
| 835 |
# Position 2 Pagi (06:00β18:00)
|
| 836 |
-
st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 2 (06:00β18:00)</div>', unsafe_allow_html=True)
|
| 837 |
pos2_data = alarm_data[alarm_data['Position'] == 2].copy()
|
| 838 |
pos2_data = pos2_data[pos2_data['hour'].between(6, 17, inclusive='both')]
|
| 839 |
fig3 = create_radial_chart(pos2_data, "Position 2 (06:00β18:00)", list(range(6, 18)), 'pagi')
|
|
@@ -844,7 +844,7 @@ with col3:
|
|
| 844 |
|
| 845 |
with col4:
|
| 846 |
# Position 2 Sore (18:00β06:00)
|
| 847 |
-
st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 2 (18:00β06:00)</div>', unsafe_allow_html=True)
|
| 848 |
pos2_data = alarm_data[alarm_data['Position'] == 2].copy()
|
| 849 |
pos2_data = pos2_data[~pos2_data['hour'].between(6, 17, inclusive='both')]
|
| 850 |
fig4 = create_radial_chart(pos2_data, "Position 2 (18:00β06:00)", list(range(18, 24)) + list(range(0, 6)), 'sore')
|
|
@@ -856,7 +856,7 @@ with col4:
|
|
| 856 |
# =============== ROW 2: Position 3 & 4 (Pagi & Sore) ===============
|
| 857 |
with col5:
|
| 858 |
# Position 3 Pagi (06:00β18:00)
|
| 859 |
-
st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 3 (06:00β18:00)</div>', unsafe_allow_html=True)
|
| 860 |
pos3_data = alarm_data[alarm_data['Position'] == 3].copy()
|
| 861 |
pos3_data = pos3_data[pos3_data['hour'].between(6, 17, inclusive='both')]
|
| 862 |
fig5 = create_radial_chart(pos3_data, "Position 3 (06:00β18:00)", list(range(6, 18)), 'pagi')
|
|
@@ -867,7 +867,7 @@ with col5:
|
|
| 867 |
|
| 868 |
with col6:
|
| 869 |
# Position 3 Sore (18:00β06:00)
|
| 870 |
-
st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 3 (18:00β06:00)</div>', unsafe_allow_html=True)
|
| 871 |
pos3_data = alarm_data[alarm_data['Position'] == 3].copy()
|
| 872 |
pos3_data = pos3_data[~pos3_data['hour'].between(6, 17, inclusive='both')]
|
| 873 |
fig6 = create_radial_chart(pos3_data, "Position 3 (18:00β06:00)", list(range(18, 24)) + list(range(0, 6)), 'sore')
|
|
@@ -878,7 +878,7 @@ with col6:
|
|
| 878 |
|
| 879 |
with col7:
|
| 880 |
# Position 4 Pagi (06:00β18:00)
|
| 881 |
-
st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 4 (06:00β18:00)</div>', unsafe_allow_html=True)
|
| 882 |
pos4_data = alarm_data[alarm_data['Position'] == 4].copy()
|
| 883 |
pos4_data = pos4_data[pos4_data['hour'].between(6, 17, inclusive='both')]
|
| 884 |
fig7 = create_radial_chart(pos4_data, "Position 4 (06:00β18:00)", list(range(6, 18)), 'pagi')
|
|
@@ -889,7 +889,7 @@ with col7:
|
|
| 889 |
|
| 890 |
with col8:
|
| 891 |
# Position 4 Sore (18:00β06:00)
|
| 892 |
-
st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 4 (18:00β06:00)</div>', unsafe_allow_html=True)
|
| 893 |
pos4_data = alarm_data[alarm_data['Position'] == 4].copy()
|
| 894 |
pos4_data = pos4_data[~pos4_data['hour'].between(6, 17, inclusive='both')]
|
| 895 |
fig8 = create_radial_chart(pos4_data, "Position 4 (18:00β06:00)", list(range(18, 24)) + list(range(0, 6)), 'sore')
|
|
|
|
| 724 |
# </div>
|
| 725 |
# "
|
| 726 |
st.markdown("""
|
| 727 |
+
<h3 class="objective-title">OBJECTIVE 2: Alarm Frequency Analysis β Shift-Based Radial Charts</h3>
|
| 728 |
<small>*Showing alarm types by shift: Normal (Green), Amber (Yellow), Red (Red)</small>
|
| 729 |
""", unsafe_allow_html=True)
|
| 730 |
|
|
|
|
| 756 |
# Shift Pagi (06:00β18:00) β 0Β° = 12, 90Β° = 3, 180Β° = 6, 270Β° = 9
|
| 757 |
theta = [(h - 12) * 30 for h in shift_hours] # 12 jam * 30Β° = 360Β°
|
| 758 |
tickvals = [0, 90, 180, 270]
|
| 759 |
+
ticktext = ["09:00", "12:00", "03:00", "06:00"]
|
| 760 |
else: # Shift Sore (18:00β06:00)
|
| 761 |
# Shift Sore (18:00β06:00) β 0Β° = 12, 90Β° = 3, 180Β° = 6, 270Β° = 9
|
| 762 |
theta = [(h - 12) * 30 if h >= 12 else (h + 12) * 30 for h in shift_hours] # 12 jam * 30Β° = 360Β°
|
| 763 |
tickvals = [0, 90, 180, 270]
|
| 764 |
+
ticktext = ["09:00", "12:00", "03:00", "06:00"]
|
| 765 |
|
| 766 |
fig = go.Figure()
|
| 767 |
fig.add_trace(go.Barpolar(
|
|
|
|
| 811 |
# =============== ROW 1: Position 1 & 2 (Pagi & Sore) ===============
|
| 812 |
with col1:
|
| 813 |
# Position 1 Pagi (06:00β18:00)
|
| 814 |
+
# st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 1 (06:00β18:00)</div>', unsafe_allow_html=True)
|
| 815 |
pos1_data = alarm_data[alarm_data['Position'] == 1].copy()
|
| 816 |
pos1_data = pos1_data[pos1_data['hour'].between(6, 17, inclusive='both')]
|
| 817 |
fig1 = create_radial_chart(pos1_data, "Position 1 (06:00β18:00)", list(range(6, 18)), 'pagi')
|
|
|
|
| 822 |
|
| 823 |
with col2:
|
| 824 |
# Position 1 Sore (18:00β06:00)
|
| 825 |
+
# st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 1 (18:00β06:00)</div>', unsafe_allow_html=True)
|
| 826 |
pos1_data = alarm_data[alarm_data['Position'] == 1].copy()
|
| 827 |
pos1_data = pos1_data[~pos1_data['hour'].between(6, 17, inclusive='both')]
|
| 828 |
fig2 = create_radial_chart(pos1_data, "Position 1 (18:00β06:00)", list(range(18, 24)) + list(range(0, 6)), 'sore')
|
|
|
|
| 833 |
|
| 834 |
with col3:
|
| 835 |
# Position 2 Pagi (06:00β18:00)
|
| 836 |
+
# st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 2 (06:00β18:00)</div>', unsafe_allow_html=True)
|
| 837 |
pos2_data = alarm_data[alarm_data['Position'] == 2].copy()
|
| 838 |
pos2_data = pos2_data[pos2_data['hour'].between(6, 17, inclusive='both')]
|
| 839 |
fig3 = create_radial_chart(pos2_data, "Position 2 (06:00β18:00)", list(range(6, 18)), 'pagi')
|
|
|
|
| 844 |
|
| 845 |
with col4:
|
| 846 |
# Position 2 Sore (18:00β06:00)
|
| 847 |
+
# st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 2 (18:00β06:00)</div>', unsafe_allow_html=True)
|
| 848 |
pos2_data = alarm_data[alarm_data['Position'] == 2].copy()
|
| 849 |
pos2_data = pos2_data[~pos2_data['hour'].between(6, 17, inclusive='both')]
|
| 850 |
fig4 = create_radial_chart(pos2_data, "Position 2 (18:00β06:00)", list(range(18, 24)) + list(range(0, 6)), 'sore')
|
|
|
|
| 856 |
# =============== ROW 2: Position 3 & 4 (Pagi & Sore) ===============
|
| 857 |
with col5:
|
| 858 |
# Position 3 Pagi (06:00β18:00)
|
| 859 |
+
# st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 3 (06:00β18:00)</div>', unsafe_allow_html=True)
|
| 860 |
pos3_data = alarm_data[alarm_data['Position'] == 3].copy()
|
| 861 |
pos3_data = pos3_data[pos3_data['hour'].between(6, 17, inclusive='both')]
|
| 862 |
fig5 = create_radial_chart(pos3_data, "Position 3 (06:00β18:00)", list(range(6, 18)), 'pagi')
|
|
|
|
| 867 |
|
| 868 |
with col6:
|
| 869 |
# Position 3 Sore (18:00β06:00)
|
| 870 |
+
# st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 3 (18:00β06:00)</div>', unsafe_allow_html=True)
|
| 871 |
pos3_data = alarm_data[alarm_data['Position'] == 3].copy()
|
| 872 |
pos3_data = pos3_data[~pos3_data['hour'].between(6, 17, inclusive='both')]
|
| 873 |
fig6 = create_radial_chart(pos3_data, "Position 3 (18:00β06:00)", list(range(18, 24)) + list(range(0, 6)), 'sore')
|
|
|
|
| 878 |
|
| 879 |
with col7:
|
| 880 |
# Position 4 Pagi (06:00β18:00)
|
| 881 |
+
# st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 4 (06:00β18:00)</div>', unsafe_allow_html=True)
|
| 882 |
pos4_data = alarm_data[alarm_data['Position'] == 4].copy()
|
| 883 |
pos4_data = pos4_data[pos4_data['hour'].between(6, 17, inclusive='both')]
|
| 884 |
fig7 = create_radial_chart(pos4_data, "Position 4 (06:00β18:00)", list(range(6, 18)), 'pagi')
|
|
|
|
| 889 |
|
| 890 |
with col8:
|
| 891 |
# Position 4 Sore (18:00β06:00)
|
| 892 |
+
# st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 4 (18:00β06:00)</div>', unsafe_allow_html=True)
|
| 893 |
pos4_data = alarm_data[alarm_data['Position'] == 4].copy()
|
| 894 |
pos4_data = pos4_data[~pos4_data['hour'].between(6, 17, inclusive='both')]
|
| 895 |
fig8 = create_radial_chart(pos4_data, "Position 4 (18:00β06:00)", list(range(18, 24)) + list(range(0, 6)), 'sore')
|