UTI: PoC - Dash application for Trending
[csit.git] / resources / tools / dash / app / pal / report / report.py
@@ -11,7 +11,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Instantiate a Dash app."""
+"""Instantiate the Report Dash application.
+"""
+
 import dash
 from dash import dcc
 from dash import html
@@ -23,7 +25,7 @@ from .data import create_dataframe
 from .layout import html_layout
 
 
-def init_dashboard(server):
+def init_report(server):
     """Create a Plotly Dash dashboard.
 
     :param server: Flask server.
@@ -31,12 +33,13 @@ def init_dashboard(server):
     :returns: Dash app server.
     :rtype: Dash
     """
+
     dash_app = dash.Dash(
         server=server,
-        routes_pathname_prefix="/trending/",
+        routes_pathname_prefix=u"/report/",
         external_stylesheets=[
-            "/static/dist/css/styles.css",
-            "https://fonts.googleapis.com/css?family=Lato",
+            u"/static/dist/css/styles.css",
+            u"https://fonts.googleapis.com/css?family=Lato",
         ],
     )
 
@@ -51,19 +54,23 @@ def init_dashboard(server):
         children=[
             create_data_table(df),
         ],
-        id="dash-container",
+        id=u"dash-container",
     )
     return dash_app.server
 
 
 def create_data_table(df):
-    """Create Dash datatable from Pandas DataFrame."""
+    """Create Dash datatable from Pandas DataFrame.
+
+    DEMO
+    """
+
     table = dash_table.DataTable(
-        id="database-table",
-        columns=[{"name": i, "id": i} for i in df.columns],
-        data=df.to_dict("records"),
-        sort_action="native",
-        sort_mode="native",
-        page_size=300,
+        id=u"database-table",
+        columns=[{u"name": i, u"id": i} for i in df.columns],
+        data=df.to_dict(u"records"),
+        sort_action=u"native",
+        sort_mode=u"native",
+        page_size=5,
     )
     return table