File size: 1,703 Bytes
37aa687
d68bb02
 
 
 
37aa687
d68bb02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63ada1b
d68bb02
 
 
 
 
 
37aa687
d68bb02
37aa687
d68bb02
 
 
d233a21
d68bb02
 
 
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
37
38
39
40
41
42
43
44
45
46
47
48
49
import streamlit as st
import folium
from folium.plugins import HeatMap
import pandas as pd
import plotly.express as px

# Function to display the fault heatmap
def display_fault_heatmap(df):
    st.subheader("🌡️ Fault Heatmap")
    
    # Filter out red alert poles
    red_alert_poles = df[df["Alert Level"] == "Red"]
    
    # Create a folium map centered around a location (e.g., Hyderabad)
    map_center = [17.385044, 78.486671]  # Hyderabad latitude, longitude (you can adjust for other cities)
    folium_map = folium.Map(location=map_center, zoom_start=7)
    
    # Add markers for poles with red alerts
    for _, row in red_alert_poles.iterrows():
        folium.CircleMarker(
            location=[row['Latitude'], row['Longitude']],  # Adjust your data accordingly
            radius=8,
            color='red',
            fill=True,
            fill_color='red',
            fill_opacity=0.7,
            popup=f"Pole: {row['Pole ID']}, Anomalies: {row['Anomalies']}"
        ).add_to(folium_map)
    
    # Display the map
    st.write(folium_map)

# Function to display the dashboard
def display_dashboard(df):
    st.subheader("📊 System Summary")
    col1, col2 = st.columns(2)
    col1.metric("Total Poles", df.shape[0])
    col2.metric("🚨 Red Alerts", df[df['Alert Level'] == "Red"].shape[0])

    display_fault_heatmap(df)

def display_charts(df):
    st.subheader("⚙️ Energy Generation")
    st.plotly_chart(px.bar(df, x="Pole ID", y=["Solar Gen (kWh)", "Wind Gen (kWh)"], barmode="group"))

    st.subheader("📉 Tilt vs Vibration")
    fig = px.scatter(df, x="Tilt (°)", y="Vibration (g)", color="Alert Level", hover_data=["Pole ID"])
    st.plotly_chart(fig)