Prasanna1622's picture
Update modules/visuals.py
adc2118 verified
raw
history blame
868 Bytes
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])
import streamlit as st
import plotly.express as px
def display_charts(df: pd.DataFrame):
fig_energy = px.bar(
df,
x="Name",
y=["Solar_Generation__c", "Wind_Generation__c"],
)
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)