OptimAIze Functionality Test"; echo "
"; // Test 1: Check database tables echo "

1. Database Tables Check

"; $tables = [ 'panel_directives', 'optimization_analysis_state' ]; foreach ($tables as $table) { $result = $db->query("SHOW TABLES LIKE '$table'"); if ($result && $result->num_rows > 0) { echo "✅ Table '$table' exists
"; } else { echo "❌ Table '$table' missing
"; } } // Test 2: Check required columns echo "

2. Required Columns Check

"; $columns = [ 'panel_directives' => ['is_impossible', 'llm_checked', 'llm_reasoning'], 'optimization_analysis_state' => ['total_combinations', 'processed_combinations', 'is_running'] ]; foreach ($columns as $table => $cols) { foreach ($cols as $col) { $result = $db->query("SHOW COLUMNS FROM $table LIKE '$col'"); if ($result && $result->num_rows > 0) { echo "✅ Column '$table.$col' exists
"; } else { echo "❌ Column '$table.$col' missing
"; } } } // Test 3: Check for attributes echo "

3. Attributes Check

"; $result = $db->query("SELECT COUNT(*) as count FROM attributes"); $attrCount = $result->fetch_assoc()['count']; echo "Attributes available: $attrCount
"; if ($attrCount >= 2) { echo "✅ Sufficient attributes for combination analysis
"; } else { echo "❌ Need at least 2 attributes for OptimAIze to work
"; } // Test 4: Check OptimAIze files echo "

4. Required Files Check

"; $files = [ 'optimaize.php', 'start_optimization_analysis.php', 'get_optimization_progress.php', 'update_directive_status.php', 'delete_directive.php', 'process_optimization_analysis.php' ]; foreach ($files as $file) { if (file_exists($file)) { echo "✅ File '$file' exists
"; } else { echo "❌ File '$file' missing
"; } } // Test 5: Check GPT configuration echo "

5. GPT Configuration Check

"; if (defined('OPENAI_API_KEY') && !empty(OPENAI_API_KEY)) { echo "✅ OpenAI API key configured
"; // Test GPT Helper if (class_exists('GptHelper')) { echo "✅ GptHelper class available
"; } else { echo "❌ GptHelper class missing
"; } } else { echo "❌ OpenAI API key not configured
"; } // Test 6: Sample combination analysis (if attributes exist) if ($attrCount >= 2) { echo "

6. Sample Combination Analysis

"; $attributes = $db->query("SELECT id, name, choices FROM attributes LIMIT 2"); $attr1 = $attributes->fetch_assoc(); $attr2 = $attributes->fetch_assoc(); if ($attr1 && $attr2) { $choices1 = json_decode($attr1['choices'], true); $choices2 = json_decode($attr2['choices'], true); if (!empty($choices1) && !empty($choices2)) { echo "Sample combination to analyze:
"; echo "- {$attr1['name']}: {$choices1[0]}
"; echo "- {$attr2['name']}: {$choices2[0]}
"; echo "✅ Ready for combination analysis
"; } else { echo "❌ Attributes don't have valid choices
"; } } } // Test 7: Check panel directives echo "

7. Panel Directives Status

"; $directivesCount = $db->query("SELECT COUNT(*) as count FROM panel_directives")->fetch_assoc()['count']; $impossibleCount = $db->query("SELECT COUNT(*) as count FROM panel_directives WHERE is_impossible = 1")->fetch_assoc()['count']; $approvedCount = $db->query("SELECT COUNT(*) as count FROM panel_directives WHERE status = 'approved' AND is_impossible = 1")->fetch_assoc()['count']; echo "Total directives: $directivesCount
"; echo "Impossible combinations: $impossibleCount
"; echo "Approved impossible combinations: $approvedCount
"; // Test summary echo "
"; echo "

Test Summary

"; echo "

If all tests show ✅, your OptimAIze feature is ready to use!

"; echo "

If you see any ❌, please:

"; echo ""; echo "
"; echo "

Next Steps

"; echo "
    "; echo "
  1. Go to Base → Add attributes with choices
  2. "; echo "
  3. Go to OptimAIze → Start Analysis
  4. "; echo "
  5. Review and approve/decline impossible combinations
  6. "; echo "
  7. Generate optimized panel in Panel section
  8. "; echo "
"; ?>