import streamlit as st import matplotlib.pyplot as plt def display_dashboard(df): """ Display system-wide summary metrics on the dashboard. :param df: DataFrame containing the pole data. """ st.subheader("📊 System Summary") # Columns to display different metrics col1, col2, col3 = st.columns(3) # Total Poles col1.metric("Total Poles", df.shape[0]) # Red Alerts col2.metric("🚨 Red Alerts", df[df['Alert Level'] == "Red"].shape[0]) # Power Insufficiency Issues col3.metric("⚡ Power Issues", df[df['Power Sufficient'] == "No"].shape[0]) def display_charts(df): """ Display charts for energy generation and tilt vs vibration. :param df: DataFrame containing the pole data. """ st.subheader("⚙️ Energy Generation Trends") # Plot bar chart for Solar and Wind Generation fig, ax = plt.subplots(figsize=(10, 6)) df.set_index("Pole ID")[["Solar Gen (kWh)", "Wind Gen (kWh)"]].plot(kind="bar", ax=ax) ax.set_ylabel("Energy Generation (kWh)") ax.set_xlabel("Pole ID") st.pyplot(fig) st.subheader("📉 Tilt vs Vibration") # Plot scatter chart for Tilt vs Vibration fig, ax = plt.subplots(figsize=(10, 6)) ax.scatter(df["Tilt (°)"], df["Vibration (g)"], color='blue') ax.set_xlabel("Tilt (°)") ax.set_ylabel("Vibration (g)") st.pyplot(fig)