Skip to content

Commit

Permalink
Site status aggregates alarms over 48 hours now
Browse files Browse the repository at this point in the history
  • Loading branch information
petya-vasileva committed Apr 13, 2024
1 parent ff8a99f commit 77852f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/model/Updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self):
# The following function is used to group alarms by site
# taking into account the most recent 24 hours only
def groupAlarms(self, pivotFrames):
dateFrom, dateTo = hp.defaultTimeRange(1)
dateFrom, dateTo = hp.defaultTimeRange(2)
metaDf = self.pq.readFile('parquet/raw/metaDf.parquet')
# frames, pivotFrames = self.alarms.loadData(dateFrom, dateTo)

Expand Down Expand Up @@ -276,6 +276,7 @@ def storePacketLossDataAndModel(self):

plsDf = createPcktDataset(start_date, end_date)
self.pq.writeToFile(plsDf, f'{self.location}ml-datasets/packet_loss_Df.parquet')
print('packet_loss_Df.parquet created', len(plsDf))

# onehot encode the whole dataset and leave only one month for further ML training
plsDf_onehot_month, plsDf_onehot = one_month_data(plsDf)
Expand Down
13 changes: 7 additions & 6 deletions src/pages/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def builMap(mapDf):
style='mapbox://styles/petyav/ckh3spvk002i419mzf8m9ixzi'
),
showlegend=False,
title = 'Status of all sites in the past 24 hours',
title = 'Status of all sites in the past 48 hours',
template='plotly_white'
)

Expand Down Expand Up @@ -192,7 +192,8 @@ def total_number_of_alarms(sitesDf):
html_elements = [dbc.Col([
dbc.Row(
dbc.Col(
html.H1('Status of all sites in the past 24 hours')
html.H1('Status of all sites in the past 48 hours',
className='card-title')
, align="center")
, align="center", justify='center', className='h-100'),
], className='status-box boxwithshadow', md=3, xs=12)]
Expand All @@ -211,7 +212,7 @@ def total_number_of_alarms(sitesDf):
),
className='mb-3',
),
md=3, xs=3, className='status-count-numbers'
md=3, xs=6, className='status-count-numbers'
)
)

Expand Down Expand Up @@ -356,11 +357,11 @@ def layout(**other_unknown_query_strings):
dbc.Col(
[
html.Div(children=statusTable, id='site-status', className='datatables-cont'),
], className='page-cont sidebysite-cont', xl=6
], className='page-cont sidebysite-cont column-margin', xl=6
),
dbc.Col(dcc.Graph(figure=builMap(sitesDf), id='site-map',
className='cls-site-map'),
className='mb-1 page-cont sidebysite-cont', xl=6
className='cls-site-map'),
className='page-cont sidebysite-cont', xl=6
),
dbc.Col(
html.Div(
Expand Down

0 comments on commit 77852f1

Please sign in to comment.