| Server IP : 35.80.110.71 / Your IP : 216.73.216.221 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /proc/2798582/cwd/scripts/analysis/ |
Upload File : |
<?php
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make('Illuminate\Contracts\Console\Kernel');
$kernel->bootstrap();
use App\Models\AuditLibrary\AuditTemplate;
echo "\n=== Audit Scoring Systems Analysis ===\n\n";
$templates = AuditTemplate::all();
// 1. Scoring Methods
echo "1. SCORING METHODS\n";
echo str_repeat('-', 50)."\n";
$methods = $templates->groupBy(fn ($t) => $t->scoring_method?->value ?? 'null');
foreach ($methods as $method => $items) {
echo sprintf(" %-20s %d templates\n", $method.':', count($items));
}
// 2. Grade Scales
echo "\n2. GRADE SCALES (unique configurations)\n";
echo str_repeat('-', 50)."\n";
$gradeScales = $templates->groupBy(fn ($t) => json_encode($t->grade_scale));
foreach ($gradeScales as $scale => $items) {
$decoded = json_decode($scale, true);
echo sprintf(" %d templates use: %s\n", count($items), $scale);
}
// 3. Pass Thresholds
echo "\n3. PASS THRESHOLDS\n";
echo str_repeat('-', 50)."\n";
$thresholds = $templates->groupBy('pass_threshold');
foreach ($thresholds->sortKeys() as $threshold => $items) {
echo sprintf(" %-10s %d templates\n", $threshold.'%:', count($items));
}
// 4. Scoring Models (from markdown parsing)
echo "\n4. SCORING MODELS (unique configurations)\n";
echo str_repeat('-', 50)."\n";
$scoringModels = $templates->groupBy(fn ($t) => json_encode($t->scoring_model));
$modelCount = 0;
foreach ($scoringModels as $model => $items) {
$modelCount++;
if ($modelCount <= 10) {
$decoded = json_decode($model, true);
echo sprintf("\n Model #%d (%d templates):\n", $modelCount, count($items));
if ($decoded) {
echo ' Min: '.($decoded['min'] ?? 'n/a').', Max: '.($decoded['max'] ?? 'n/a')."\n";
if (isset($decoded['labels']) && ! empty($decoded['labels'])) {
echo " Labels:\n";
foreach ($decoded['labels'] as $score => $label) {
echo " {$score}: {$label}\n";
}
}
} else {
echo " (empty/null)\n";
}
}
}
if ($modelCount > 10) {
echo "\n ... and ".($modelCount - 10)." more unique models\n";
}
// 5. Check the AuditScoringMethod enum
echo "\n\n5. AVAILABLE SCORING METHOD ENUM VALUES\n";
echo str_repeat('-', 50)."\n";
$enumClass = App\Enums\AuditScoringMethod::class;
foreach ($enumClass::cases() as $case) {
echo " - {$case->value}\n";
}
// 6. Sample of different scoring models
echo "\n\n6. SAMPLE SCORING MODEL VARIATIONS\n";
echo str_repeat('-', 50)."\n";
$samples = AuditTemplate::whereNotNull('scoring_model')
->where('scoring_model', '!=', '[]')
->where('scoring_model', '!=', '{}')
->inRandomOrder()
->limit(5)
->get(['name', 'scoring_model']);
foreach ($samples as $s) {
echo "\n Template: {$s->name}\n";
echo ' Model: '.json_encode($s->scoring_model, JSON_PRETTY_PRINT)."\n";
}