File size: 1,302 Bytes
798d1ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import pandas as pd
import plotly.express as px

def display_summary(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["AlertLevel"] == "Red"].shape[0])
    col3.metric("Power Issues", df[df["PowerSufficient"] == "No"].shape[0])
    col4.metric("Offline Cameras", df[df["CameraStatus"] == "Offline"].shape[0])

def display_tel_map(df: pd.DataFrame):
    st.subheader("πŸ—ΊοΈ Telangana Pole Heatmap")
    red_df = df[df["AlertLevel"] == "Red"]
    fig = px.scatter_mapbox(
        red_df,
        lat="Location_Latitude",
        lon="Location_Longitude",
        color="AlertLevel",
        hover_name="PoleID",
        zoom=6.3,
        height=500,
        mapbox_style="carto-positron"
    )
    st.plotly_chart(fig, use_container_width=True)

def display_energy_trends(df: pd.DataFrame):
    st.subheader("βš™οΈ Solar vs Wind")
    st.plotly_chart(px.bar(df, x="PoleID", y=["SolarGen(kWh)", "WindGen(kWh)"], barmode="group"))

def display_scatter(df: pd.DataFrame):
    st.subheader("πŸ“‰ Tilt vs Vibration")
    fig = px.scatter(df, x="Tilt(Β°)", y="Vibration(g)", color="AlertLevel", hover_data=["PoleID", "Site"])
    st.plotly_chart(fig)