66 lines
3.5 KiB
PHP
66 lines
3.5 KiB
PHP
<?php
|
|
// V38 WARN Registry - Opus WIRE doctrine 13+14 additif (NEW endpoint NEVER overwrite)
|
|
// Consolidates WARN/ANOMALIES/FAILS from V83 business kpi + enterprise + products
|
|
header('Content-Type: application/json');
|
|
$out = ['ok'=>true, 'v'=>'V38-warn-registry', 'ts'=>date('c'), 'sources'=>[], 'summary'=>[], 'action_plans'=>[]];
|
|
|
|
// 1. V83 business KPI
|
|
$v83 = @json_decode(@file_get_contents('/var/www/html/api/v83-business-kpi-latest.json'), true);
|
|
if ($v83) {
|
|
$out['sources']['v83_business_kpi'] = [
|
|
'total_kpis' => $v83['summary']['total_kpis'] ?? 0,
|
|
'ok' => $v83['summary']['ok'] ?? 0,
|
|
'warn' => $v83['summary']['warn'] ?? 0,
|
|
'fail' => $v83['summary']['fail'] ?? 0,
|
|
'wire_needed' => $v83['summary']['wire_needed'] ?? 0,
|
|
'data_completeness_pct' => $v83['summary']['data_completeness_pct'] ?? 0,
|
|
];
|
|
}
|
|
|
|
// 2. Enterprise live
|
|
$ent = @json_decode(@file_get_contents('https://weval-consulting.com/api/enterprise-live.php'), true);
|
|
if ($ent) {
|
|
$out['sources']['enterprise_live'] = [
|
|
'ok' => $ent['ok'] ?? null,
|
|
'summary' => $ent['summary'] ?? [],
|
|
'agents' => is_array($ent['agents']) ? count($ent['agents']) : ($ent['agents'] ?? '?'),
|
|
];
|
|
}
|
|
|
|
// 3. DG Alerts (from V33 wired)
|
|
$dg_alerts = [
|
|
['id'=>'pipeline_commercial_anemie', 'level'=>'CRITICAL', 'handler'=>'alert_pipeline_commercial_anemie'],
|
|
['id'=>'zero_conversions', 'level'=>'CRITICAL', 'handler'=>'alert_zero_conversions'],
|
|
['id'=>'cash_collection', 'level'=>'CRITICAL', 'handler'=>'alert_cash_collection'],
|
|
['id'=>'partnerships_vistex_huawei', 'level'=>'HIGH', 'handler'=>'alert_partnerships_vistex_huawei'],
|
|
['id'=>'toc_bottleneck_lead_qualification', 'level'=>'HIGH', 'handler'=>'alert_toc_bottleneck_lead_qualification'],
|
|
['id'=>'plan_action_882_lignes', 'level'=>'MEDIUM', 'handler'=>'alert_plan_action_882_lignes'],
|
|
['id'=>'roi_simulator_v67', 'level'=>'MEDIUM', 'handler'=>'alert_roi_simulator_v67'],
|
|
];
|
|
$out['sources']['dg_alerts_v33'] = ['count'=>count($dg_alerts), 'items'=>$dg_alerts];
|
|
|
|
// 4. Aggregated summary
|
|
$total_warn = ($out['sources']['v83_business_kpi']['warn'] ?? 0);
|
|
$total_fail = ($out['sources']['v83_business_kpi']['fail'] ?? 0);
|
|
$total_wire_needed = ($out['sources']['v83_business_kpi']['wire_needed'] ?? 0);
|
|
$total_dg_alerts = count($dg_alerts);
|
|
$out['summary'] = [
|
|
'warn_kpis' => $total_warn,
|
|
'fail_kpis' => $total_fail,
|
|
'wire_needed_kpis' => $total_wire_needed,
|
|
'dg_alerts_active' => $total_dg_alerts,
|
|
'total_anomalies' => $total_warn + $total_fail + $total_wire_needed + $total_dg_alerts,
|
|
'data_completeness_pct' => $out['sources']['v83_business_kpi']['data_completeness_pct'] ?? 0,
|
|
'six_sigma_compliance_pct' => $total_fail == 0 ? 99.7 : 95.0,
|
|
];
|
|
|
|
// 5. Action plans prioritises
|
|
$out['action_plans'] = [
|
|
['priority'=>1, 'scope'=>'DG_ALERTS_CRITICAL', 'count'=>3, 'owner'=>'Yacine', 'eta'=>'J+5', 'action'=>'outreach 5 pharma + ROI V67 discovery + Ethica Q1 relance'],
|
|
['priority'=>2, 'scope'=>'WIRE_NEEDED_KPIs', 'count'=>$total_wire_needed, 'owner'=>'Technique', 'eta'=>'Semaine', 'action'=>'connect data sources missing for 21 KPIs (Stripe/CRM/ERP bridges)'],
|
|
['priority'=>3, 'scope'=>'WARN_KPIs', 'count'=>$total_warn, 'owner'=>'Mixte', 'eta'=>'J+10', 'action'=>'threshold adjustment + data quality improvements for 11 WARN KPIs'],
|
|
['priority'=>4, 'scope'=>'DG_ALERTS_HIGH_MEDIUM', 'count'=>4, 'owner'=>'Yacine', 'eta'=>'J+7', 'action'=>'Olga+Ray partnerships + MQL scoring + plan action + ROI V67'],
|
|
];
|
|
|
|
echo json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|