Decision Optimization Dashboard for IBM Cloud Pak for Data DO projects
Project description
DSE_DO_Dashboard
Plotly/Dash-based dashboard for Decision Optimization projects in IBM Cloud Pak for Data.
Source (GitHub)
Documentation (GitHubPages)
This repository contains the package dse_do_dashboard
. This can be installed using pip.
Introduction
This re-usable and extendable framework allows a data-scientist to quickly configure a Plotly/Dash-based dashboard for a project in IBM Cloud Pak for Data. This package is mainly focussed on Decision Optimization projects, but can be used for any CPD project.
Data exchange between the CPD project and the dashboard is through a (DB2/DB2WH/DB-on-cloud) database. The database contains one or more 'scenarios'. A scenario is a set of named DataFrames, divided in 2 sets: inputs and outputs.
A user would typically define a set of custom VisualizationPages, each containing one or more Plotly plots. In addition, Folium maps are supported.
Main classes
- DoDashApp. Main class that contains the framework code for the dashboard. Subclass to define your dashboard.
- VisualizationPage. Subclass for each visualization page in your dashboard.
Usage
Main steps:
- In your CPD project, define subclasses for
dse_do_utils.DataManager
,dse_do_utils.ScenarioDbManager
, anddse_do_utils.PlotlyManager
- Subclass
dse_do_dashboard.DoDashApp
. - For each custom visualization page, define a subclass of
dse_do_dashboard.VisualizationPage
. - Provision a database (DB2 or Db2-on-cloud), get the credentials.
- Use the
dse_do_utils.ScenarioDbManager
in your CPD project to insert one or more scenarios in the DB. - Create an
index.py
file that creates and instance of the DoDashApp and runs the server. - Run
index.py
to start the dashboard. Open link with browser.
DoDashApp UI structure
An instance of a DoDashApp will have the following UI layout:
- A top-menu bar with the logo and a drop-down menu to select the scenario.
- A left side-bar menu with 5 'main' pages:
- Home: Select reference scenarios. To be further developed.
- Prepare Data: Out-of-the-box UI to review the input tables.
- Run Model: run a deployed DO. To be further developed.
- Explore Solution: Out-of-the-box UI to review the output tables.
- Visualization: A tabbed-view of the custom VisualizationPages.
- In the left side-bar a collapsable menu with the custom VisualizationPages
DoDashApp Example
An example of a dashboard class that contains 2 custom VisualizationPages: KpiPage and DemandPage. Most important:
- Create instances of the VisualizationPages
- Specify the class names of the DataManager, ScenarioDbManager and PlotlyManager
class FruitDashApp(DoDashApp):
def __init__(self, db_credentials: Dict, schema: str = None, cache_config: Dict = None,
port: int = 8050, debug: bool = False, host_env: str = None):
visualization_pages = [
KpiPage(self),
DemandPage(self),
]
logo_file_name = "logistics.jpg"
database_manager_class = FruitScenarioDbManager
data_manager_class = FruitDataManager
plotly_manager_class = FruitPlotlyManager
super().__init__(db_credentials, schema,
logo_file_name=logo_file_name,
cache_config=cache_config,
visualization_pages = visualization_pages,
database_manager_class=database_manager_class,
data_manager_class=data_manager_class,
plotly_manager_class=plotly_manager_class,
port=port, debug=debug, host_env=host_env)
VisualizationPage example
Example of a custom VisualizationPage. It uses the Plotly1ColumnVisualizationPage that creates a one-column vertical layout of a set of Plotly figures. Most important:
- Create a subclass of VisualizationPage (in this case of a Plotly1ColumnVisualizationPage). Specify the name, url and id.
- Specify the names of the input and output tables that need to be loaded for the visualizations on this page.
- Define methods on the PlotlyManager that create Plotly Figures and add to method
get_plotly_figures
.
class DemandPage(Plotly1ColumnVisualizationPage):
def __init__(self, dash_app: DoDashApp):
super().__init__(dash_app=dash_app,
page_name='Demand',
page_id='demand_tab',
url='demand',
input_table_names=['Demand','Inventory'], # Use ['*'] to include all tables
output_table_names=[],
)
def get_plotly_figures(self, pm: PlotlyManager) -> List[Figure]:
return [
pm.plotly_demand_pie(),
pm.plotly_demand_vs_inventory_bar(),
]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dse_do_dashboard-0.1.2.3.tar.gz
.
File metadata
- Download URL: dse_do_dashboard-0.1.2.3.tar.gz
- Upload date:
- Size: 55.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9361b6264499fdc5a89970342a3a3117130a24bb16611d32b29bd679af4cc0c |
|
MD5 | fba981b021cfde8359be41adda069b40 |
|
BLAKE2b-256 | 4f9a8cf0d8d73e22a9b2fcafe2977179c71b54d73af7edd2b8a179aa42c46600 |
File details
Details for the file dse_do_dashboard-0.1.2.3-py3-none-any.whl
.
File metadata
- Download URL: dse_do_dashboard-0.1.2.3-py3-none-any.whl
- Upload date:
- Size: 85.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a60df14a4e07400964d349acf5bad6261e641dd735c21458b1f6176698fd4612 |
|
MD5 | 73c7f79d7b2a9eeb3602be04d988cccd |
|
BLAKE2b-256 | d87f3d3d7d30c7787b74d432124455de17a8aad59f2d03e92ce1fc72efbf40f4 |