|
|
|
|
|
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) |
|
|