Spaces:
Sleeping
Sleeping
Update modules/visuals.py
Browse files- modules/visuals.py +8 -18
modules/visuals.py
CHANGED
@@ -1,37 +1,25 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
import streamlit as st
|
4 |
-
import plotly.express as px
|
5 |
import pandas as pd
|
6 |
|
7 |
def display_dashboard(df: pd.DataFrame):
|
8 |
st.subheader("π System Summary")
|
9 |
col1, col2, col3, col4 = st.columns(4)
|
10 |
-
|
11 |
col1.metric("Total Poles", df.shape[0])
|
12 |
col2.metric("π¨ Red Alerts", df[df["Alert_Level__c"] == "Red"].shape[0])
|
13 |
col3.metric("β‘ Power Issues", df[df["Power_Sufficient__c"] == "No"].shape[0])
|
14 |
col4.metric("π· Offline Cameras", df[df["Camera_Status__c"] == "Offline"].shape[0])
|
15 |
|
|
|
|
|
|
|
|
|
16 |
def display_charts(df: pd.DataFrame):
|
17 |
-
st.subheader("β Energy Generation")
|
18 |
fig_energy = px.bar(
|
19 |
df,
|
20 |
x="Name",
|
21 |
y=["Solar_Generation__c", "Wind_Generation__c"],
|
22 |
-
barmode="group",
|
23 |
-
title="Solar vs Wind Generation"
|
24 |
)
|
25 |
-
|
26 |
-
|
27 |
-
st.subheader("π₯ Camera Status Distribution")
|
28 |
-
fig_camera = px.pie(
|
29 |
-
df,
|
30 |
-
names="Camera_Status__c",
|
31 |
-
title="Camera Status",
|
32 |
-
hole=0.4
|
33 |
-
)
|
34 |
-
st.plotly_chart(fig_camera)
|
35 |
|
36 |
st.subheader("π¨ Alert Level Breakdown")
|
37 |
fig_alerts = px.histogram(
|
@@ -40,3 +28,5 @@ def display_charts(df: pd.DataFrame):
|
|
40 |
title="Number of Poles by Alert Level"
|
41 |
)
|
42 |
st.plotly_chart(fig_alerts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import pandas as pd
|
2 |
|
3 |
def display_dashboard(df: pd.DataFrame):
|
4 |
st.subheader("π System Summary")
|
5 |
col1, col2, col3, col4 = st.columns(4)
|
6 |
+
|
7 |
col1.metric("Total Poles", df.shape[0])
|
8 |
col2.metric("π¨ Red Alerts", df[df["Alert_Level__c"] == "Red"].shape[0])
|
9 |
col3.metric("β‘ Power Issues", df[df["Power_Sufficient__c"] == "No"].shape[0])
|
10 |
col4.metric("π· Offline Cameras", df[df["Camera_Status__c"] == "Offline"].shape[0])
|
11 |
|
12 |
+
import streamlit as st
|
13 |
+
import plotly.express as px
|
14 |
+
|
15 |
+
|
16 |
def display_charts(df: pd.DataFrame):
|
|
|
17 |
fig_energy = px.bar(
|
18 |
df,
|
19 |
x="Name",
|
20 |
y=["Solar_Generation__c", "Wind_Generation__c"],
|
|
|
|
|
21 |
)
|
22 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
st.subheader("π¨ Alert Level Breakdown")
|
25 |
fig_alerts = px.histogram(
|
|
|
28 |
title="Number of Poles by Alert Level"
|
29 |
)
|
30 |
st.plotly_chart(fig_alerts)
|
31 |
+
|
32 |
+
|