File size: 1,206 Bytes
569fbd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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


import streamlit as st
import plotly.express as px
import pandas as pd

def display_dashboard(df: pd.DataFrame):
    st.subheader("πŸ“Š System Summary")
    col1, col2, col3, col4 = st.columns(4)

    col1.metric("Total Poles", df.shape[0])
    col2.metric("🚨 Red Alerts", df[df["Alert_Level__c"] == "Red"].shape[0])
    col3.metric("⚑ Power Issues", df[df["Power_Sufficient__c"] == "No"].shape[0])
    col4.metric("πŸ“· Offline Cameras", df[df["Camera_Status__c"] == "Offline"].shape[0])

def display_charts(df: pd.DataFrame):
    st.subheader("βš™ Energy Generation")
    fig_energy = px.bar(
        df,
        x="Name",
        y=["Solar_Generation__c", "Wind_Generation__c"],
        barmode="group",
        title="Solar vs Wind Generation"
    )
    st.plotly_chart(fig_energy)

    st.subheader("πŸŽ₯ Camera Status Distribution")
    fig_camera = px.pie(
        df,
        names="Camera_Status__c",
        title="Camera Status",
        hole=0.4
    )
    st.plotly_chart(fig_camera)

    st.subheader("🚨 Alert Level Breakdown")
    fig_alerts = px.histogram(
        df,
        x="Alert_Level__c",
        title="Number of Poles by Alert Level"
    )
    st.plotly_chart(fig_alerts)