validate_dashboard_config
Validate Vizro dashboard configurations by checking JSON or dictionary inputs for accuracy. Generate Python code, provide PyCafe links for remote files, and confirm data and custom chart details for proper dashboard functionality.
Instructions
Validate Vizro model configuration. Run ALWAYS when you have a complete dashboard configuration.
If successful, the tool will return the python code and, if it is a remote file, the py.cafe link to the chart.
The PyCafe link will be automatically opened in your default browser if auto_open is True.
Args:
dashboard_config: Either a JSON string or a dictionary representing a Vizro dashboard model configuration
data_infos: List of DFMetaData objects containing information about the data files
custom_charts: List of ChartPlan objects containing information about the custom charts in the dashboard
auto_open: Whether to automatically open the PyCafe link in a browser
Returns:
ValidationResults object with status and dashboard details
Input Schema
Name | Required | Description | Default |
---|---|---|---|
auto_open | No | ||
custom_charts | Yes | ||
dashboard_config | Yes | ||
data_infos | Yes |
Input Schema (JSON Schema)
{
"$defs": {
"ChartPlan": {
"description": "Base chart plan used to generate chart code based on user visualization requirements.",
"properties": {
"chart_code": {
"description": "\n Python code that generates a generates a plotly go.Figure object. It must fulfill the following criteria:\n 1. Must be wrapped in a function that is named `chart_name`\n 2. Must accept as first argument argument `data_frame` which is a pandas DataFrame\n 3. Must return a plotly go.Figure object\n 4. All data used in the chart must be derived from the data_frame argument, all data manipulations\n must be done within the function.\n 5. DO NOT modify the background (with plot_bgcolor) or color sequences unless explicitly asked for\n 6. When creating hover templates, explicitly ensure that it works on light and dark mode\n ",
"title": "Chart Code",
"type": "string"
},
"chart_name": {
"description": "\n The name of the chart function. Should be unique, concise and in snake_case.\n ",
"pattern": "^[a-z][a-z0-9_]*$",
"title": "Chart Name",
"type": "string"
},
"chart_type": {
"description": "\n Describes the chart type that best reflects the user request.\n ",
"title": "Chart Type",
"type": "string"
},
"imports": {
"description": "\n List of import statements required to render the chart defined by the `chart_code` field. Ensure that every\n import statement is a separate list/array entry: An example of valid list of import statements would be:\n\n [\"import pandas as pd\",\n \"import plotly.express as px\"]\n ",
"items": {
"type": "string"
},
"title": "Imports",
"type": "array"
}
},
"required": [
"chart_type",
"chart_name",
"imports",
"chart_code"
],
"title": "ChartPlan",
"type": "object"
},
"DFMetaData": {
"properties": {
"column_names_types": {
"anyOf": [
{
"additionalProperties": {
"type": "string"
},
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Column Names Types"
},
"file_location_type": {
"enum": [
"local",
"remote"
],
"title": "File Location Type",
"type": "string"
},
"file_name": {
"title": "File Name",
"type": "string"
},
"file_path_or_url": {
"title": "File Path Or Url",
"type": "string"
},
"read_function_string": {
"enum": [
"pd.read_csv",
"pd.read_json",
"pd.read_html",
"pd.read_parquet",
"pd.read_excel"
],
"title": "Read Function String",
"type": "string"
}
},
"required": [
"file_name",
"file_path_or_url",
"file_location_type",
"read_function_string"
],
"title": "DFMetaData",
"type": "object"
}
},
"properties": {
"auto_open": {
"default": true,
"title": "Auto Open",
"type": "boolean"
},
"custom_charts": {
"items": {
"$ref": "#/$defs/ChartPlan"
},
"title": "Custom Charts",
"type": "array"
},
"dashboard_config": {
"additionalProperties": true,
"title": "Dashboard Config",
"type": "object"
},
"data_infos": {
"items": {
"$ref": "#/$defs/DFMetaData"
},
"title": "Data Infos",
"type": "array"
}
},
"required": [
"dashboard_config",
"data_infos",
"custom_charts"
],
"title": "validate_dashboard_configArguments",
"type": "object"
}