diff --git a/api/visual-management-live.php b/api/visual-management-live.php index dd1eb2848..33c6ce0e8 100644 --- a/api/visual-management-live.php +++ b/api/visual-management-live.php @@ -13,8 +13,12 @@ function q($sql) { $raw = @shell_exec($cmd); $rows = []; foreach (array_filter(array_map('trim', explode("\n", $raw ?? ''))) as $line) { - if (strpos($line, '|') === false) continue; - $rows[] = array_map('trim', explode('|', $line)); + // Support single-column AND multi-column rows + if (strpos($line, '|') !== false) { + $rows[] = array_map('trim', explode('|', $line)); + } else { + $rows[] = [$line]; + } } return $rows; } diff --git a/api/wevia-master-api.php b/api/wevia-master-api.php index df2261e4d..2ba75ab42 100644 --- a/api/wevia-master-api.php +++ b/api/wevia-master-api.php @@ -236,6 +236,44 @@ if (!empty($_mam)) { exit; } + + // GUARD 17: Visual Management dashboard (doctrine 65) + if (preg_match('/\b(?:visual\s*management|vm\s*dashboard|kpi\s*wall|tableau\s*de\s*bord|lean\s*6\s*sigma|andon|health\s*score|kpi\s*live)\b/iu', $__opus_m)) { + $__v = @file_get_contents('http://127.0.0.1/api/visual-management-live.php'); + $__d = @json_decode($__v, true); + if ($__d) { + $__b = $__d['business'] ?? []; + $__f = $__d['flux'] ?? []; + $__q = $__d['quality'] ?? []; + $__msg = "VISUAL MANAGEMENT LIVE (doctrine 65):\n"; + $__msg .= " Health: " . ($__d['health_score'] ?? 0) . "/100 (" . ($__d['health_status'] ?? '?') . ")\n"; + $__msg .= " Andons: " . ($__d['andons_count'] ?? 0) . "\n\n"; + $__msg .= "BUSINESS:\n"; + $__msg .= " CRM Deals: " . number_format($__b['crm_deals'] ?? 0) . " (" . number_format(($__b['crm_deals_amount_eur'] ?? 0)/1000) . "k EUR)\n"; + $__msg .= " Companies: " . number_format($__b['crm_companies'] ?? 0) . "\n"; + $__msg .= " Contacts B2B: " . number_format($__b['crm_contacts_b2b'] ?? 0) . "\n"; + $__msg .= " Activities: " . number_format($__b['crm_activities'] ?? 0) . "\n"; + $__msg .= " Ethica HCPs: " . number_format($__b['ethica_hcps'] ?? 0) . "\n\n"; + $__msg .= "FLUX:\n"; + $__msg .= " send_contacts 30j: " . number_format($__f['send_contacts_last_30d'] ?? 0) . "\n"; + $__msg .= " graph_send 7j: " . number_format($__f['graph_send_last_7d'] ?? 0) . "\n"; + $__msg .= " weval_leads 7j: " . number_format($__f['weval_leads_last_7d'] ?? 0) . "\n\n"; + $__msg .= "QUALITY: NonReg " . ($__q['nonreg_score'] ?? 0) . "% | L99 " . ($__q['l99_score'] ?? 0) . "%\n\n"; + if (!empty($__d['andons'])) { + $__msg .= "ALERTES:\n"; + foreach ($__d['andons'] as $__a) { + $__msg .= " [" . $__a['severity'] . "] " . $__a['kpi'] . ": " . $__a['message'] . "\n"; + } + } + $__msg .= "\nDashboard: https://weval-consulting.com/visual-management.html"; + } else { + $__msg = "Visual Management query failed"; + } + header('Content-Type: application/json'); + echo json_encode(['provider'=>'opus-early-guard','content'=>$__msg,'tool'=>'visual_management_show','source'=>'early-guard-primary']); + exit; + } + // END OPUS_DBINFRA_GUARDS_17AVR // === END OPUS_ROOT_CAUSE_GUARDS_EARLY_17AVR === diff --git a/api/wiki/doctrine-65-visual-management.md b/api/wiki/doctrine-65-visual-management.md new file mode 100644 index 000000000..7276ba931 --- /dev/null +++ b/api/wiki/doctrine-65-visual-management.md @@ -0,0 +1,70 @@ +# Doctrine #65 — VISUAL MANAGEMENT + +**Date**: 17 avril 2026 18:15 +**Source**: Yanis "ET VISUAL MANAGEMENT" +**Statut**: ACTIVE · UX Premium doctrine 60 conforme + +## Règle + +WEVAL doit exposer un **tableau de bord Visual Management** agrégeant **6 familles KPI** Lean Six Sigma : + +1. **Business** — CRM pipeline state (deals, companies, contacts, activities, HCPs, office accounts) +2. **Flux** — Flow detection (send_contacts 7/30j, graph_send 7j, weval_leads 7j, pipeline flux) +3. **Quality** — NonReg + L99 scores (objectif 100%) +4. **Andon** — Alertes automatiques RED/ORANGE sur stagnation (anti-doctrine 55 invisibilité) +5. **Classification** — B2B/B2C segmentation % (doctrine 63 progress) +6. **Infra** — Load/Mem/Disk/Docker/Uptime + +## Health Score global + +Pondération : +- NonReg % (max 25) +- L99 % (max 25) +- Andon penalty (25 - 5*count) +- CRM B2B pool (25 si >1000 contacts) + +Statuts : **GREEN** ≥85 · **AMBER** 60-85 · **RED** <60 + +## Andon auto-detection + +| Condition | Severity | Remède | +|---|---|---| +| send_contacts pas d'ajout 7+ jours | RED | Relancer merge (P0-CRM-1) | +| graph_send <100 / 7j | ORANGE | Vérifier SMTP / route-by-destination | +| pipeline_deals_last_30d = 0 | RED | Relancer prospection commerciale | +| activities < 100 AND contacts B2B >10k | ORANGE | CRM sous-exploité | +| nonreg < 100% | ORANGE | Fix regressions before deploy | + +## Fichiers + +- `/api/visual-management-live.php` — API live (260 lignes) +- `/visual-management.html` — Dashboard UX premium (12KB) +- `/api/wiki/doctrine-65-visual-management.md` — cette doctrine + +## Intent chat WEVIA Master + +Regex: `\\b(?:visual\\s*management|vm\\s*dashboard|kpi\\s*wall|tableau\\s*de\\s*bord|lean\\s*6\\s*sigma|andon|health\\s*score|kpi\\s*live)\\b` + +Exemples: +- "visual management" +- "health score" +- "andon" +- "kpi wall" +- "tableau de bord" +- "lean 6 sigma" + +Retourne: 6 familles KPI + Andons + URL dashboard. + +## Auto-refresh + +Dashboard HTML : **30 sec** +Cache-Control : `max-age=30` +API JSON SSE-compatible pour consommation temps réel. + +## Intégration doctrines existantes + +- Surface **doctrine 55** (CRM staleness) via Andon flux +- Surface **doctrine 63** (classification) via KPI Classification +- Respecte **doctrine 60** (UX premium: auto-refresh, toast, skeleton loading, 0 hardcode) +- Respecte **doctrine 57** (no fake data: 100% live DB + API) + diff --git a/visual-management.html b/visual-management.html new file mode 100644 index 000000000..716a6f0fd --- /dev/null +++ b/visual-management.html @@ -0,0 +1,231 @@ + +
+ +