From 27545dd3ce3ff52fe3ce9e96a0581f255d0b2d9e Mon Sep 17 00:00:00 2001 From: cortadocodes Date: Mon, 13 Mar 2023 16:54:05 +0000 Subject: [PATCH 1/3] STY: Run pre-commit hooks --- dashboard/callbacks.py | 6 +- dashboard/layouts.py | 125 +++++++++++++++++------- docs/source/deploying_the_dashboard.rst | 1 - docs/source/index.rst | 2 +- 4 files changed, 91 insertions(+), 43 deletions(-) diff --git a/dashboard/callbacks.py b/dashboard/callbacks.py index 1a95b6d..6c9d870 100644 --- a/dashboard/callbacks.py +++ b/dashboard/callbacks.py @@ -5,8 +5,8 @@ from dash import Input, Output, State from aerosense_tools.plots import plot_connection_statistic, plot_pressure_bar_chart, plot_sensors -from aerosense_tools.queries import ROW_LIMIT, BigQuery from aerosense_tools.preprocess import RawSignal +from aerosense_tools.queries import ROW_LIMIT, BigQuery from aerosense_tools.utils import generate_time_range, get_cleaned_sensor_column_names @@ -193,8 +193,8 @@ def plot_sensors_graph( finish=finish, ) - data_columns = df.columns[df.columns.str.startswith('f')].tolist() - sensor_data = df[["datetime"] + data_columns].set_index('datetime') + data_columns = df.columns[df.columns.str.startswith("f")].tolist() + sensor_data = df[["datetime"] + data_columns].set_index("datetime") raw_data = RawSignal(sensor_data, sensor_name) raw_data.measurement_to_variable() plot_df = raw_data.dataframe.reset_index() diff --git a/dashboard/layouts.py b/dashboard/layouts.py index 2544e90..64e2fca 100644 --- a/dashboard/layouts.py +++ b/dashboard/layouts.py @@ -40,44 +40,93 @@ def create_sensors_tab_layout(app, tab_name, sensor_names, graph_id, data_limit_ TimeRangeSelect(), html.Br(), html.Label("Custom time range"), - html.Div([html.Div([html.Label("Start datetime"), - dcc.DatePickerSingle(id="start-date", - date=datetime.datetime.now().date().isoformat(), - display_format="Do MMM Y", - persistence=True, - disabled=True, ), ], - style={'display': 'inline-block'}), - html.Div([html.Label("Hour"), - dash_daq.NumericInput(id="start-hour", value=0, min=0, max=23, - persistence=True), ], - style={'display': 'inline-block'}), - html.Div([html.Label("Minute"), - dash_daq.NumericInput(id="start-minute", value=0, min=0, max=59, - persistence=True), ], - style={'display': 'inline-block'}), - html.Div([html.Label("Second"), - dash_daq.NumericInput(id="start-second", value=0, min=0, max=59, - persistence=True), ], - style={'display': 'inline-block'}), - ], style={'margin': '10px 0'}), - - html.Div([html.Div([html.Label("End datetime"), - dcc.DatePickerSingle(id="end-date", display_format="Do MMM Y", - persistence=True, disabled=True, ), ], - style={'display': 'inline-block'}), - html.Div([html.Label("Hour"), - dash_daq.NumericInput(id="end-hour", value=0, min=0, max=23, - persistence=True), ], - style={'display': 'inline-block'}), - html.Div([html.Label("Minute"), - dash_daq.NumericInput(id="end-minute", value=0, min=0, max=59, - persistence=True), ], - style={'display': 'inline-block'}), - html.Div([html.Label("Second"), - dash_daq.NumericInput(id="end-second", value=0, min=0, max=59, - persistence=True), ], - style={'display': 'inline-block'}), - ], style={'margin': '10px 0'}), + html.Div( + [ + html.Div( + [ + html.Label("Start datetime"), + dcc.DatePickerSingle( + id="start-date", + date=datetime.datetime.now().date().isoformat(), + display_format="Do MMM Y", + persistence=True, + disabled=True, + ), + ], + style={"display": "inline-block"}, + ), + html.Div( + [ + html.Label("Hour"), + dash_daq.NumericInput( + id="start-hour", value=0, min=0, max=23, persistence=True + ), + ], + style={"display": "inline-block"}, + ), + html.Div( + [ + html.Label("Minute"), + dash_daq.NumericInput( + id="start-minute", value=0, min=0, max=59, persistence=True + ), + ], + style={"display": "inline-block"}, + ), + html.Div( + [ + html.Label("Second"), + dash_daq.NumericInput( + id="start-second", value=0, min=0, max=59, persistence=True + ), + ], + style={"display": "inline-block"}, + ), + ], + style={"margin": "10px 0"}, + ), + html.Div( + [ + html.Div( + [ + html.Label("End datetime"), + dcc.DatePickerSingle( + id="end-date", + display_format="Do MMM Y", + persistence=True, + disabled=True, + ), + ], + style={"display": "inline-block"}, + ), + html.Div( + [ + html.Label("Hour"), + dash_daq.NumericInput(id="end-hour", value=0, min=0, max=23, persistence=True), + ], + style={"display": "inline-block"}, + ), + html.Div( + [ + html.Label("Minute"), + dash_daq.NumericInput( + id="end-minute", value=0, min=0, max=59, persistence=True + ), + ], + style={"display": "inline-block"}, + ), + html.Div( + [ + html.Label("Second"), + dash_daq.NumericInput( + id="end-second", value=0, min=0, max=59, persistence=True + ), + ], + style={"display": "inline-block"}, + ), + ], + style={"margin": "10px 0"}, + ), html.Br(), html.Button("Plot", id="refresh-button", n_clicks=0), html.Button("Check for new installations", id="installation-check-button", n_clicks=0), diff --git a/docs/source/deploying_the_dashboard.rst b/docs/source/deploying_the_dashboard.rst index f2f8050..2e7527a 100644 --- a/docs/source/deploying_the_dashboard.rst +++ b/docs/source/deploying_the_dashboard.rst @@ -2,4 +2,3 @@ Deployment ========== - diff --git a/docs/source/index.rst b/docs/source/index.rst index 1fd3c5f..c673601 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -4,7 +4,7 @@ Aerosense Dashboard ``aerosense-dashboard`` is a data dashboard allowing high-level visualisation of data from the aerosense system. - - The ``data-gateway`` library is responsible for the data collection and ingress to GretaDB and GretaStore. + - The ``data-gateway`` library is responsible for the data collection and ingress to GretaDB and GretaStore. - The ``aerosense-tools`` library can access and manipulate data from GretaDB or the GretaStore by any python client. This dashboard uses a combination of its own code and ``aerosense-tools`` to access and visualise data from GretaDB. From 80076ed644192cc1b141f084cd8fce5f816204dd Mon Sep 17 00:00:00 2001 From: cortadocodes Date: Mon, 13 Mar 2023 16:54:17 +0000 Subject: [PATCH 2/3] OPS: Set version to correct number --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 01903d1..6f869bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ [tool.poetry] name = "aerosense-dashboard" -version = "0.5.0" +version = "0.4.5" description = "High-level visualisation for aerosense" authors = ["Tom Clark", "Marcus Lugg", "Yuriy Marykovsky"] license = "BSD-3" From 040059487fabcbc5f6ed461181ab3166e16ad7c4 Mon Sep 17 00:00:00 2001 From: cortadocodes Date: Mon, 13 Mar 2023 16:55:13 +0000 Subject: [PATCH 3/3] REV: Add bold tag back to subtitle --- dashboard/layouts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard/layouts.py b/dashboard/layouts.py index 64e2fca..f283172 100644 --- a/dashboard/layouts.py +++ b/dashboard/layouts.py @@ -39,7 +39,7 @@ def create_sensors_tab_layout(app, tab_name, sensor_names, graph_id, data_limit_ html.Label(html.B("Time range")), TimeRangeSelect(), html.Br(), - html.Label("Custom time range"), + html.Label(html.B("Custom time range")), html.Div( [ html.Div(