### ===================================================================================================================
### MYVIIA DASHBOARD TOOL
### ===================================================================================================================
# Copyright ©VIIA 2025
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
import platform
from pathlib import Path
from warnings import warn
from sys import version_info, executable
# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.tools.fem_dashboard_utils import fem_show_streamlit_dashboard, fem_get_windows_theme
### ===================================================================================================================
### 2. Initialise the MYVIIA dashboard
### ===================================================================================================================
[docs]def myviia_dashboard():
"""
This function will initialise and create the MYVIIA dashboard tool in the browser.
Input:
- No input required.
Output:
- The dashboard is shown in the browser.
"""
# Check python version, as we are experiencing issues with version 3.9.7
version = version_info
if version.major == 3 and version.minor == 9 and version.micro == 7:
warn(
"WARNING: The Python version that you use (3.9.7) might not work with the dashboard. If an error occur "
"please install a different subversion of Python.")
# Get location of interpreter
interpreter = Path(executable)
print(f"Used interpreter for the dashboard: {interpreter}.")
# Get the location of the dashboard
dashboard_location = Path(__file__).parent / 'MV_dashboard' / 'Home.py'
# Determine the theme based on the OS
if 'win' in platform.system().lower():
theme = fem_get_windows_theme() # Get the Windows theme
else:
theme = 'light' # Default to light for non-Windows
# Show the dashboard
fem_show_streamlit_dashboard(
dashboard_location=dashboard_location, interpreter=interpreter, args=('--theme.base', theme))
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================