File size: 1,041 Bytes
4b09964
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import dash
from dash import dcc, html
import plotly.express as px
import pandas as pd
import numpy as np

# Define sites and poles
sites = ['Hyderabad', 'Karnrol', 'Bangalore', 'Ongol']
num_poles_per_site = 12

# Generate random data
data = []
for site in sites:
    for pole_id in range(1, num_poles_per_site + 1):
        data.append({
            'Site': site,
            'Pole ID': f'Pole {pole_id}',
            'Status': np.random.randint(0, 100)  # Simulated metric
        })

df = pd.DataFrame(data)

# Pivot for heatmap
heatmap_data = df.pivot(index='Site', columns='Pole ID', values='Status')

# Create heatmap
fig = px.imshow(
    heatmap_data,
    labels=dict(x="Pole ID", y="Site", color="Status"),
    color_continuous_scale="Viridis"
)

# Dash App
app = dash.Dash(__name__)
app.title = "Pole Management Heatmap"

app.layout = html.Div([
    html.H1("Pole Management Heatmap", style={'textAlign': 'center'}),
    dcc.Graph(figure=fig)
])

if __name__ == '__main__':
    app.run_server(debug=True, host='0.0.0.0', port=7860)