C-Dash: Pre-load the data from parquets
[csit.git] / csit.infra.dash / app / cdash / trending / trending.py
index a098a8d..a9dfbc1 100644 (file)
 """Instantiate the Trending Dash application.
 """
 import dash
+import pandas as pd
 
 from ..utils.constants import Constants as C
 from .layout import Layout
 
 
-def init_trending(server, time_period=None):
+def init_trending(
+        server,
+        data_trending: pd.DataFrame
+    ) -> dash.Dash:
     """Create a Plotly Dash dashboard.
 
     :param server: Flask server.
@@ -37,11 +41,10 @@ def init_trending(server, time_period=None):
 
     layout = Layout(
         app=dash_app,
+        data_trending=data_trending,
         html_layout_file=C.HTML_LAYOUT_FILE,
         graph_layout_file=C.TREND_GRAPH_LAYOUT_FILE,
-        data_spec_file=C.DATA_SPEC_FILE,
-        tooltip_file=C.TOOLTIP_FILE,
-        time_period=time_period
+        tooltip_file=C.TOOLTIP_FILE
     )
     dash_app.index_string = layout.html_layout
     dash_app.layout = layout.add_content()