Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,22 +6,22 @@ import pydeck as pdk
|
|
6 |
# ---- Area-Specific Configuration ----
|
7 |
AREA_DETAILS = {
|
8 |
"Hyderabad": {
|
9 |
-
"coords": [17.4036, 78.5247],
|
10 |
"area_name": "Ramanthapur Dairy Farm",
|
11 |
"purpose": "Dairy Farm"
|
12 |
},
|
13 |
"Ballari": {
|
14 |
-
"coords": [15.1468, 76.9237],
|
15 |
"area_name": "Cowl Bazar Power Station",
|
16 |
"purpose": "Power Station"
|
17 |
},
|
18 |
"Gadwal": {
|
19 |
-
"coords": [16.2315, 77.7965],
|
20 |
"area_name": "Bheem Nagar Solar Station",
|
21 |
"purpose": "Solar Station"
|
22 |
},
|
23 |
"Kurnool": {
|
24 |
-
"coords": [15.8281, 78.0373],
|
25 |
"area_name": "Venkata Ramana Agriculture Field",
|
26 |
"purpose": "Agriculture Monitoring"
|
27 |
}
|
@@ -29,14 +29,18 @@ AREA_DETAILS = {
|
|
29 |
|
30 |
POLES_PER_SITE = 12
|
31 |
|
32 |
-
# ---- Generate Poles
|
33 |
def generate_open_area_poles(site_name, center_lat, center_lon, area, purpose):
|
34 |
poles = []
|
35 |
-
spacing = 0.0006
|
|
|
|
|
|
|
36 |
for i in range(POLES_PER_SITE):
|
37 |
lat = center_lat + random.uniform(-0.0002, 0.0002)
|
38 |
lon = center_lon + (i - POLES_PER_SITE // 2) * spacing
|
39 |
alert_level = random.choices(['Green', 'Yellow', 'Red'], weights=[6, 4, 2])[0]
|
|
|
40 |
|
41 |
poles.append({
|
42 |
"Pole ID": f"{site_name[:3].upper()}-{i+1:03}",
|
@@ -48,7 +52,8 @@ def generate_open_area_poles(site_name, center_lat, center_lon, area, purpose):
|
|
48 |
"Power Status": random.choice(['Sufficient', 'Insufficient']),
|
49 |
"Camera Status": random.choice(['Online', 'Offline']),
|
50 |
"Location Area": area,
|
51 |
-
"Purpose": purpose
|
|
|
52 |
})
|
53 |
return poles
|
54 |
|
@@ -117,7 +122,8 @@ st.pydeck_chart(pdk.Deck(
|
|
117 |
"<b>Health Score:</b> {Health Score}<br/>"
|
118 |
"<b>Alert Level:</b> {Alert Level}<br/>"
|
119 |
"<b>Camera:</b> {Camera Status}<br/>"
|
120 |
-
"<b>Power:</b> {Power Status}"
|
|
|
121 |
"style": {"color": "white", "backgroundColor": "black"}
|
122 |
}
|
123 |
))
|
@@ -125,3 +131,4 @@ st.pydeck_chart(pdk.Deck(
|
|
125 |
# ---- Data Table ----
|
126 |
st.subheader("📋 Detailed Pole Information")
|
127 |
st.dataframe(filtered_df, use_container_width=True)
|
|
|
|
6 |
# ---- Area-Specific Configuration ----
|
7 |
AREA_DETAILS = {
|
8 |
"Hyderabad": {
|
9 |
+
"coords": [17.4036, 78.5247],
|
10 |
"area_name": "Ramanthapur Dairy Farm",
|
11 |
"purpose": "Dairy Farm"
|
12 |
},
|
13 |
"Ballari": {
|
14 |
+
"coords": [15.1468, 76.9237],
|
15 |
"area_name": "Cowl Bazar Power Station",
|
16 |
"purpose": "Power Station"
|
17 |
},
|
18 |
"Gadwal": {
|
19 |
+
"coords": [16.2315, 77.7965],
|
20 |
"area_name": "Bheem Nagar Solar Station",
|
21 |
"purpose": "Solar Station"
|
22 |
},
|
23 |
"Kurnool": {
|
24 |
+
"coords": [15.8281, 78.0373],
|
25 |
"area_name": "Venkata Ramana Agriculture Field",
|
26 |
"purpose": "Agriculture Monitoring"
|
27 |
}
|
|
|
29 |
|
30 |
POLES_PER_SITE = 12
|
31 |
|
32 |
+
# ---- Generate Poles with Anomalies ----
|
33 |
def generate_open_area_poles(site_name, center_lat, center_lon, area, purpose):
|
34 |
poles = []
|
35 |
+
spacing = 0.0006
|
36 |
+
anomalies_options = ['None', 'Sensor Fault', 'Overheat', 'Power Surge']
|
37 |
+
anomaly_weights = [0.6, 0.2, 0.1, 0.1]
|
38 |
+
|
39 |
for i in range(POLES_PER_SITE):
|
40 |
lat = center_lat + random.uniform(-0.0002, 0.0002)
|
41 |
lon = center_lon + (i - POLES_PER_SITE // 2) * spacing
|
42 |
alert_level = random.choices(['Green', 'Yellow', 'Red'], weights=[6, 4, 2])[0]
|
43 |
+
anomaly = random.choices(anomalies_options, weights=anomaly_weights)[0]
|
44 |
|
45 |
poles.append({
|
46 |
"Pole ID": f"{site_name[:3].upper()}-{i+1:03}",
|
|
|
52 |
"Power Status": random.choice(['Sufficient', 'Insufficient']),
|
53 |
"Camera Status": random.choice(['Online', 'Offline']),
|
54 |
"Location Area": area,
|
55 |
+
"Purpose": purpose,
|
56 |
+
"Anomalies": anomaly
|
57 |
})
|
58 |
return poles
|
59 |
|
|
|
122 |
"<b>Health Score:</b> {Health Score}<br/>"
|
123 |
"<b>Alert Level:</b> {Alert Level}<br/>"
|
124 |
"<b>Camera:</b> {Camera Status}<br/>"
|
125 |
+
"<b>Power:</b> {Power Status}<br/>"
|
126 |
+
"<b>Anomaly:</b> {Anomalies}",
|
127 |
"style": {"color": "white", "backgroundColor": "black"}
|
128 |
}
|
129 |
))
|
|
|
131 |
# ---- Data Table ----
|
132 |
st.subheader("📋 Detailed Pole Information")
|
133 |
st.dataframe(filtered_df, use_container_width=True)
|
134 |
+
|