# Dashboard Template
# Standardized template for creating data dashboards across the AI Agentic Data Stack Framework

metadata:
  template_id: "dashboard-tmpl"
  name: "Dashboard Template"
  version: "1.0.0"
  description: "Comprehensive template for building interactive data dashboards"
  category: "visualization"
  tags: ["dashboard", "visualization", "reporting", "analytics", "bi"]
  created_by: "AI Agentic Data Stack Framework"
  created_date: "2025-01-23"

template:
  name: "Dashboard Template"
  description: "Template for creating comprehensive data dashboards"
  version: "1.0.0"

sections:
  - name: "dashboard_config"
    description: "Dashboard configuration and metadata"
    required: true
  - name: "data_connections"
    description: "Data source connections and queries"
    required: true
  - name: "visual_components"
    description: "Charts, tables, and visual elements"
    required: true
  - name: "filters_controls"
    description: "Interactive filters and user controls"
    required: true
  - name: "layout_styling"
    description: "Dashboard layout and visual styling"
    required: true
  - name: "interactivity_features"
    description: "User interaction and drill-down capabilities"
    required: true
  - name: "validation_rules"
    description: "Dashboard validation and quality rules"
    required: true

# Dashboard Configuration
dashboard_config:
  # Basic Information
  dashboard_id: "${dashboard_id}"
  dashboard_name: "${dashboard_name}"
  description: "${dashboard_description}"
  version: "${dashboard_version}"
  
  # Dashboard Metadata
  metadata:
    owner: "${dashboard_owner}"
    created_by: "${created_by}"
    created_date: "${creation_date}"
    last_modified: "${last_modified_date}"
    tags: ["${dashboard_tags}"]
    
  # Access and Permissions
  access_control:
    visibility: "${visibility_level}" # public, private, restricted
    allowed_users: ["${allowed_users}"]
    allowed_groups: ["${allowed_groups}"]
    permissions: ["${user_permissions}"] # view, edit, admin
    
  # Update Configuration
  update_settings:
    refresh_schedule: "${refresh_schedule}"
    auto_refresh_enabled: ${auto_refresh_enabled}
    refresh_interval_minutes: ${refresh_interval}
    cache_duration_minutes: ${cache_duration}

# Data Connections
data_connections:
  # Data Sources
  data_sources:
    - source_id: "${data_source_id}"
      source_name: "${data_source_name}"
      source_type: "${source_type}" # database, api, file, data_warehouse
      
      # Connection Details
      connection:
        connection_string: "${connection_string}"
        authentication_method: "${auth_method}"
        credentials_reference: "${credentials_ref}"
        
      # Data Queries
      queries:
        - query_id: "${query_id}"
          query_name: "${query_name}"
          query_sql: "${sql_query}"
          parameters: ["${query_parameters}"]
          cache_enabled: ${query_cache_enabled}
          timeout_seconds: ${query_timeout}
          
  # Data Transformations
  transformations:
    - transformation_id: "${transformation_id}"
      transformation_name: "${transformation_name}"
      transformation_type: "${transformation_type}" # filter, aggregate, join, calculate
      input_data: "${input_data_reference}"
      transformation_logic: "${transformation_logic}"
      output_schema: ["${output_fields}"]

# Visual Components
visual_components:
  # Charts and Visualizations
  charts:
    - chart_id: "${chart_id}"
      chart_name: "${chart_name}"
      chart_type: "${chart_type}" # line, bar, pie, scatter, heatmap, gauge, table
      
      # Data Configuration
      data_config:
        data_source: "${chart_data_source}"
        x_axis_field: "${x_axis_field}"
        y_axis_field: "${y_axis_field}"
        series_field: "${series_field}"
        aggregation_method: "${aggregation_method}"
        
      # Visual Properties
      visual_properties:
        title: "${chart_title}"
        subtitle: "${chart_subtitle}"
        width: ${chart_width}
        height: ${chart_height}
        
        # Color Configuration
        colors:
          color_scheme: "${color_scheme}"
          custom_colors: ["${custom_colors}"]
          
        # Axes Configuration
        axes:
          x_axis:
            title: "${x_axis_title}"
            format: "${x_axis_format}"
            scale_type: "${x_axis_scale}" # linear, log, time
            
          y_axis:
            title: "${y_axis_title}"
            format: "${y_axis_format}"
            min_value: ${y_axis_min}
            max_value: ${y_axis_max}
            
        # Legend Configuration
        legend:
          show_legend: ${show_legend}
          legend_position: "${legend_position}" # top, bottom, left, right
          
      # Interaction Settings
      interactions:
        tooltip_enabled: ${tooltip_enabled}
        tooltip_fields: ["${tooltip_fields}"]
        click_actions: ["${click_actions}"]
        drill_down_enabled: ${drill_down_enabled}
        drill_down_levels: ["${drill_down_levels}"]
        
  # KPI Cards
  kpi_cards:
    - kpi_id: "${kpi_id}"
      kpi_name: "${kpi_name}"
      
      # KPI Data
      data_config:
        data_source: "${kpi_data_source}"
        value_field: "${kpi_value_field}"
        comparison_field: "${comparison_field}"
        
      # Display Properties
      display:
        title: "${kpi_title}"
        format: "${kpi_format}" # number, percentage, currency
        decimal_places: ${decimal_places}
        
        # Comparison Display
        comparison:
          show_comparison: ${show_comparison}
          comparison_type: "${comparison_type}" # previous_period, target, benchmark
          comparison_label: "${comparison_label}"
          
        # Trend Indicators
        trend:
          show_trend: ${show_trend}
          trend_direction: "${trend_direction}" # up, down, flat
          trend_color: "${trend_color}"
          
  # Data Tables
  data_tables:
    - table_id: "${table_id}"
      table_name: "${table_name}"
      
      # Table Data
      data_config:
        data_source: "${table_data_source}"
        columns: ["${table_columns}"]
        default_sort_column: "${default_sort_column}"
        default_sort_order: "${default_sort_order}" # asc, desc
        
      # Table Properties
      properties:
        show_header: ${show_table_header}
        show_row_numbers: ${show_row_numbers}
        rows_per_page: ${rows_per_page}
        pagination_enabled: ${pagination_enabled}
        search_enabled: ${search_enabled}
        
      # Column Configuration
      column_configs:
        - column_name: "${column_name}"
          display_name: "${column_display_name}"
          data_type: "${column_data_type}"
          format: "${column_format}"
          width: ${column_width}
          sortable: ${column_sortable}
          searchable: ${column_searchable}

# Filters and Controls
filters_controls:
  # Filter Components
  filters:
    - filter_id: "${filter_id}"
      filter_name: "${filter_name}"
      filter_type: "${filter_type}" # dropdown, multi_select, date_range, text_search, slider
      
      # Filter Data
      data_config:
        data_source: "${filter_data_source}"
        value_field: "${filter_value_field}"
        display_field: "${filter_display_field}"
        
      # Filter Properties
      properties:
        label: "${filter_label}"
        default_value: "${filter_default_value}"
        required: ${filter_required}
        multiple_selection: ${multiple_selection_allowed}
        
      # Filter Connections
      connections:
        affected_components: ["${affected_components}"]
        parameter_mapping: ["${parameter_mappings}"]
        
  # Global Filters
  global_filters:
    - global_filter_id: "${global_filter_id}"
      filter_name: "${global_filter_name}"
      scope: "${filter_scope}" # dashboard, page, component
      applies_to: ["${applies_to_components}"]
      
  # User Controls
  user_controls:
    - control_id: "${control_id}"
      control_type: "${control_type}" # button, toggle, input, parameter_control
      control_name: "${control_name}"
      action: "${control_action}"
      parameters: ["${control_parameters}"]

# Layout and Styling
layout_styling:
  # Page Layout
  page_layout:
    layout_type: "${layout_type}" # grid, freeform, tabbed
    page_width: "${page_width}"
    page_height: "${page_height}"
    background_color: "${background_color}"
    
  # Grid Configuration
  grid_config:
    grid_columns: ${grid_columns}
    grid_rows: ${grid_rows}
    cell_padding: ${cell_padding}
    cell_margin: ${cell_margin}
    
  # Component Positioning
  component_positions:
    - component_id: "${component_id}"
      position:
        x: ${component_x}
        y: ${component_y}
        width: ${component_width}
        height: ${component_height}
        z_index: ${component_z_index}
        
  # Theme and Styling
  theme:
    theme_name: "${theme_name}"
    primary_color: "${primary_color}"
    secondary_color: "${secondary_color}"
    accent_color: "${accent_color}"
    text_color: "${text_color}"
    background_color: "${page_background_color}"
    
    # Typography
    typography:
      font_family: "${font_family}"
      title_font_size: ${title_font_size}
      subtitle_font_size: ${subtitle_font_size}
      body_font_size: ${body_font_size}
      
  # Responsive Design
  responsive_config:
    mobile_enabled: ${mobile_responsive}
    tablet_enabled: ${tablet_responsive}
    breakpoints:
      mobile: ${mobile_breakpoint}
      tablet: ${tablet_breakpoint}
      desktop: ${desktop_breakpoint}

# Interactivity Features
interactivity_features:
  # Cross-filtering
  cross_filtering:
    enabled: ${cross_filtering_enabled}
    filter_propagation: ["${filter_propagation_rules}"]
    highlight_related: ${highlight_related_data}
    
  # Drill-down Capabilities
  drill_down:
    - component_id: "${drill_component_id}"
      drill_levels: ["${drill_down_levels}"]
      drill_actions: ["${drill_actions}"]
      target_dashboard: "${target_dashboard}"
      parameter_passing: ["${parameter_passing}"]
      
  # Export and Sharing
  export_sharing:
    export_options:
      pdf_export: ${pdf_export_enabled}
      excel_export: ${excel_export_enabled}
      image_export: ${image_export_enabled}
      data_export: ${data_export_enabled}
      
    sharing_options:
      email_sharing: ${email_sharing_enabled}
      link_sharing: ${link_sharing_enabled}
      embed_code: ${embed_code_enabled}
      public_sharing: ${public_sharing_enabled}
      
  # Real-time Features
  real_time:
    live_data_enabled: ${live_data_enabled}
    update_notifications: ${update_notifications_enabled}
    data_alerts: ["${data_alert_rules}"]

# Performance Configuration
performance_config:
  # Caching Strategy
  caching:
    cache_enabled: ${caching_enabled}
    cache_duration: ${cache_duration_minutes}
    cache_invalidation_rules: ["${cache_invalidation_rules}"]
    
  # Query Optimization
  query_optimization:
    query_timeout: ${query_timeout_seconds}
    result_limit: ${max_result_rows}
    pagination_enabled: ${pagination_enabled}
    
  # Rendering Optimization
  rendering:
    lazy_loading: ${lazy_loading_enabled}
    progressive_rendering: ${progressive_rendering_enabled}
    chart_sampling: ${chart_data_sampling_enabled}

# Quality Assurance
quality_assurance:
  # Data Quality Checks
  data_quality:
    - check_name: "${quality_check_name}"
      check_type: "${check_type}" # completeness, accuracy, freshness
      threshold: ${quality_threshold}
      alert_on_failure: ${alert_on_failure}
      
  # Performance Monitoring
  performance_monitoring:
    load_time_monitoring: ${load_time_monitoring_enabled}
    query_performance_tracking: ${query_performance_tracking}
    user_interaction_tracking: ${user_tracking_enabled}
    
  # Testing Configuration
  testing:
    automated_testing: ${automated_testing_enabled}
    test_scenarios: ["${test_scenarios}"]
    regression_testing: ${regression_testing_enabled}

# Validation Rules
validation_rules:
  required_fields:
    - dashboard_id
    - dashboard_name
    - data_sources
    - visual_components
    
  performance_requirements:
    max_load_time_seconds: 5
    max_query_time_seconds: 30
    min_cache_hit_ratio: 0.8
    
  quality_standards:
    - data_accuracy: "99% minimum"
    - uptime_requirement: "99.9%"
    - responsive_design: "Required for mobile"

# Template Metadata
template_metadata:
  author: "AI Agentic Data Stack Framework"
  maintainer: "Data Analyst"
  last_updated: "2025-01-23"
  changelog:
    - version: "1.0.0"
      date: "2025-01-23"
      changes: "Initial template creation with comprehensive dashboard configuration"