Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,22 +7,22 @@ import pydeck as pdk
|
|
7 |
AREA_DETAILS = {
|
8 |
"Hyderabad": {
|
9 |
"coords": [17.4036, 78.5247],
|
10 |
-
"area_name": "Ramanthapur
|
11 |
"purpose": "Dairy Farm"
|
12 |
},
|
13 |
"Ballari": {
|
14 |
"coords": [15.1468, 76.9237],
|
15 |
-
"area_name": "Cowl Bazar
|
16 |
"purpose": "Power Station"
|
17 |
},
|
18 |
"Gadwal": {
|
19 |
"coords": [16.2315, 77.7965],
|
20 |
-
"area_name": "Bheem Nagar
|
21 |
"purpose": "Solar Station"
|
22 |
},
|
23 |
"Kurnool": {
|
24 |
"coords": [15.8281, 78.0373],
|
25 |
-
"area_name": "Venkata Ramana
|
26 |
"purpose": "Agriculture Monitoring"
|
27 |
}
|
28 |
}
|
@@ -33,14 +33,20 @@ POLES_PER_SITE = 12
|
|
33 |
def generate_open_area_poles(site_name, center_lat, center_lon, area, purpose):
|
34 |
poles = []
|
35 |
spacing = 0.0006
|
36 |
-
anomalies_options = ['
|
37 |
-
anomaly_weights = [0.
|
|
|
|
|
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 |
-
|
|
|
|
|
|
|
|
|
44 |
|
45 |
poles.append({
|
46 |
"Pole ID": f"{site_name[:3].upper()}-{i+1:03}",
|
@@ -51,7 +57,7 @@ def generate_open_area_poles(site_name, center_lat, center_lon, area, purpose):
|
|
51 |
"Health Score": round(random.uniform(70, 100), 2),
|
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 |
})
|
@@ -130,4 +136,4 @@ st.pydeck_chart(pdk.Deck(
|
|
130 |
|
131 |
# ---- Data Table ----
|
132 |
st.subheader("📋 Detailed Pole Information")
|
133 |
-
st.dataframe(filtered_df, use_container_width=True)
|
|
|
7 |
AREA_DETAILS = {
|
8 |
"Hyderabad": {
|
9 |
"coords": [17.4036, 78.5247],
|
10 |
+
"area_name": "Ramanthapur",
|
11 |
"purpose": "Dairy Farm"
|
12 |
},
|
13 |
"Ballari": {
|
14 |
"coords": [15.1468, 76.9237],
|
15 |
+
"area_name": "Cowl Bazar",
|
16 |
"purpose": "Power Station"
|
17 |
},
|
18 |
"Gadwal": {
|
19 |
"coords": [16.2315, 77.7965],
|
20 |
+
"area_name": "Bheem Nagar",
|
21 |
"purpose": "Solar Station"
|
22 |
},
|
23 |
"Kurnool": {
|
24 |
"coords": [15.8281, 78.0373],
|
25 |
+
"area_name": "Venkata Ramana",
|
26 |
"purpose": "Agriculture Monitoring"
|
27 |
}
|
28 |
}
|
|
|
33 |
def generate_open_area_poles(site_name, center_lat, center_lon, area, purpose):
|
34 |
poles = []
|
35 |
spacing = 0.0006
|
36 |
+
anomalies_options = ['Sensor Fault', 'Overheat', 'Power Surge']
|
37 |
+
anomaly_weights = [0.5, 0.3, 0.2]
|
38 |
+
anomaly_options_with_none = ['None'] + anomalies_options
|
39 |
+
anomaly_weights_with_none = [0.6] + [0.4 * w for w in anomaly_weights]
|
40 |
|
41 |
for i in range(POLES_PER_SITE):
|
42 |
lat = center_lat + random.uniform(-0.0002, 0.0002)
|
43 |
lon = center_lon + (i - POLES_PER_SITE // 2) * spacing
|
44 |
alert_level = random.choices(['Green', 'Yellow', 'Red'], weights=[6, 4, 2])[0]
|
45 |
+
|
46 |
+
if alert_level == 'Red':
|
47 |
+
anomaly = random.choices(anomalies_options, weights=anomaly_weights)[0]
|
48 |
+
else:
|
49 |
+
anomaly = random.choices(anomaly_options_with_none, weights=anomaly_weights_with_none)[0]
|
50 |
|
51 |
poles.append({
|
52 |
"Pole ID": f"{site_name[:3].upper()}-{i+1:03}",
|
|
|
57 |
"Health Score": round(random.uniform(70, 100), 2),
|
58 |
"Power Status": random.choice(['Sufficient', 'Insufficient']),
|
59 |
"Camera Status": random.choice(['Online', 'Offline']),
|
60 |
+
"Location Area": area, # Only location name, no purpose here
|
61 |
"Purpose": purpose,
|
62 |
"Anomalies": anomaly
|
63 |
})
|
|
|
136 |
|
137 |
# ---- Data Table ----
|
138 |
st.subheader("📋 Detailed Pole Information")
|
139 |
+
st.dataframe(filtered_df, use_container_width=True)
|