File size: 1,858 Bytes
37e00b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# πŸ“‹ Show Filtered Data Table
st.subheader("πŸ“‹ Pole Data Table")
st.dataframe(filtered_df)

# πŸ”‹ Bar Chart - Power Generation
st.subheader("πŸ”‹ Power Generation per Pole")
fig_bar = px.bar(
    filtered_df,
    x='Name',
    y='Power_Generation__c',
    color='Status__c',
    labels={'Power_Generation__c': 'Power Generated (kWh)'},
    title="Power Output by Pole",
    height=400
)
st.plotly_chart(fig_bar, use_container_width=True)

# ⚠️ Pie Chart - Fault Status Distribution
st.subheader("⚠️ Fault Status Distribution")
fault_data = filtered_df['Fault_Status__c'].value_counts().reset_index()
fault_data.columns = ['Fault Status', 'Count']
fig_pie = px.pie(
    fault_data,
    names='Fault Status',
    values='Count',
    title="Fault Breakdown",
    height=400
)
st.plotly_chart(fig_pie, use_container_width=True)

# πŸ•’ Line Chart - Pole Installations Over Time
st.subheader("πŸ•’ Installation Trend")
install_trend = filtered_df.groupby(filtered_df['Installed_Date__c'].dt.to_period('M')).size()
install_trend.index = install_trend.index.to_timestamp()
fig_line_install = px.line(
    x=install_trend.index,
    y=install_trend.values,
    labels={"x": "Month", "y": "Poles Installed"},
    title="Pole Installations Over Time",
    markers=True
)
st.plotly_chart(fig_line_install, use_container_width=True)

# πŸ› οΈ Line Chart - Maintenance Activity
st.subheader("πŸ› οΈ Maintenance Trend")
maintenance_trend = filtered_df.groupby(filtered_df['Last_Maintenance_Date__c'].dt.to_period('M')).size()
maintenance_trend.index = maintenance_trend.index.to_timestamp()
fig_line_maint = px.line(
    x=maintenance_trend.index,
    y=maintenance_trend.values,
    labels={"x": "Month", "y": "Maintenance Events"},
    title="Maintenance Activities Over Time",
    markers=True
)
st.plotly_chart(fig_line_maint, use_container_width=True)