Spaces:
Sleeping
Sleeping
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) | |