diff --git a/api/seed-cfao-healthcare-lean6sigma.py b/api/seed-cfao-healthcare-lean6sigma.py deleted file mode 100644 index 03b3d631e..000000000 --- a/api/seed-cfao-healthcare-lean6sigma.py +++ /dev/null @@ -1,211 +0,0 @@ -#!/usr/bin/env python3 -""" -V96.16 Seed Lean 6σ dashboard for poc_1d37ee62 — CFAO Healthcare -Realistic pharma/healthcare distribution context. - -Generates: 8 Muda · 5 Poka-Yoke · 4 Kaizen · 3 Gemba walks · 4 PDCA · 3 A3 · 2 Andon · 3 5S audits -All entries tied to real pharma operations (cold chain, order processing, compliance, etc.) -""" -import psycopg2 -import json -from datetime import datetime, timedelta - -TENANT = "poc_1d37ee62" -conn = psycopg2.connect(host="127.0.0.1", port=5432, dbname="adx_system", user="admin", password="admin123") -conn.autocommit = True -cur = conn.cursor() - -# ═══════════════════════════════════════════════════════════════════ -# MUDA — 8 entries realistic pharma distribution -# ═══════════════════════════════════════════════════════════════════ -muda_seeds = [ - # (vs_id, muda_type, description, severity, impact_hours, impact_euro, status, detected_by) - ("cold-chain", "motion", "Opérateurs parcourent 800m aller-retour pour valider température chambre froide 3×/jour", 3, 18, 2400, "identified", "gemba-walk-001"), - ("order-processing", "waiting", "Commandes hospitalières en attente validation pharmacien > 4h pic matin", 4, 32, 4800, "identified", "vsm-analysis"), - ("inventory", "inventory", "Stock dormant molécules RX expire 15% annuel par manque rotation FIFO", 5, 0, 28000, "in-progress", "audit-annuel-2026"), - ("regulatory", "defects", "5% dossiers AMM rejetés 1er tour par info manquante traçabilité batch", 4, 45, 6750, "in-progress", "compliance-audit"), - ("logistics", "transport", "Double manutention colis réfrigérés entre quai réception et zone quarantaine", 2, 12, 1600, "identified", "gemba-walk-003"), - ("claims", "overprocessing", "Vérification manuelle 3× numéros de lot avant validation dispatch", 3, 8, 1200, "identified", "poc-audit"), - ("training", "skills", "Nouveaux opérateurs formés 6 semaines avant autonomie vs 3 industrie", 3, 240, 18000, "identified", "hr-review"), - ("campaign-ethica", "defects", "Campaign email bounces 15% pharma list", 4, 15, 1800, "identified", "poc-audit"), -] - -# Delete old + reseed -cur.execute("DELETE FROM weval.muda_entries WHERE tenant_id = %s AND created_at > '2026-04-01'", (TENANT,)) -for vs, mt, desc, sev, ih, ie, st, db in muda_seeds: - cur.execute("""INSERT INTO weval.muda_entries (tenant_id, vs_id, muda_type, description, severity, impact_hours, impact_euro, status, detected_by, created_at) - VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,NOW())""", - (TENANT, vs, mt, desc, sev, ih, ie, st, db)) -print(f"✅ Muda: {len(muda_seeds)} entries seeded") - -# ═══════════════════════════════════════════════════════════════════ -# POKA-YOKE — 5 devices -# ═══════════════════════════════════════════════════════════════════ -poka_seeds = [ - ("cold-chain-validation", "T°C hors plage 2-8°C non détectée", "capteur-iot", "Sonde T° Bluetooth + alerte Telegram si dérive >30min", "Test hebdo + étalonnage trimestre", "active", 97.5), - ("prescription-match", "Erreur rapprochement ordonnance-préparation", "scan-barcode", "Scan 2D Datamatrix obligatoire avant dispensation", "Audit 50 dispensations/mois", "active", 99.2), - ("batch-traceability", "Mauvais lot expédié", "workflow-lockstep", "Validation forcée batch_id + expiration avant imprimante étiquette", "Contrôle double opérateur sur lot sensibles", "active", 99.8), - ("temperature-shipping", "Rupture chaîne froid transport", "datalogger", "Enregistreur T°C par colis avec alerte auto si >8°C >15min", "Vérif réception 100% colis chronique", "active", 95.0), - ("regulatory-submission", "Soumission AMM incomplète", "checklist-auto", "Formulaire web avec validation 47 champs obligatoires + pièces jointes", "QA review avant envoi", "pilot", 88.0), -] -cur.execute("DELETE FROM weval.poka_yoke WHERE tenant_id = %s", (TENANT,)) -for p, fm, dt, mech, val, st, eff in poka_seeds: - cur.execute("""INSERT INTO weval.poka_yoke (tenant_id, process, failure_mode, device_type, mechanism, validation, status, efficiency_pct, created_at) - VALUES (%s,%s,%s,%s,%s,%s,%s,%s,NOW())""", - (TENANT, p, fm, dt, mech, val, st, eff)) -print(f"✅ Poka-Yoke: {len(poka_seeds)} devices seeded") - -# ═══════════════════════════════════════════════════════════════════ -# KAIZEN — 4 events -# ═══════════════════════════════════════════════════════════════════ -kaizen_seeds = [ - ("Réduction temps validation pharmacien", "pharmacy", "4h pic validation commandes hospitalières", - '{"validation_avg_min": 240}', '{"validation_avg_min": 90}', '{"validation_avg_min": 108}', - 80, 4800, "pharmacist+pm+it", 5, "completed"), - ("FIFO automatisé chambre froide", "warehouse", "15% molécules RX expirent par manque rotation", - '{"expired_pct": 15, "expired_value_keur": 28}', '{"expired_pct": 3, "expired_value_keur": 6}', '{"expired_pct": 5, "expired_value_keur": 10}', - 120, 18000, "logistics+it", 10, "in-progress"), - ("Formation accélérée opérateurs", "hr", "Courbe apprentissage 6 semaines avant autonomie", - '{"time_to_autonomy_weeks": 6}', '{"time_to_autonomy_weeks": 3}', '{"time_to_autonomy_weeks": 4}', - 240, 18000, "hr+ops-lead", 15, "in-progress"), - ("Pré-validation AMM par checklist", "regulatory", "5% dossiers rejetés 1er tour", - '{"rejection_rate_pct": 5}', '{"rejection_rate_pct": 1}', '{"rejection_rate_pct": 2}', - 50, 7500, "regulatory+qa", 8, "completed"), -] -cur.execute("DELETE FROM weval.kaizen_events WHERE tenant_id = %s", (TENANT,)) -for title, dept, problem, bs, tg, ac, sh, se, team, dd, st in kaizen_seeds: - cur.execute("""INSERT INTO weval.kaizen_events (tenant_id, title, dept, problem, baseline, target, actual, savings_hours, savings_euro, team, duration_days, status, created_at) - VALUES (%s,%s,%s,%s,%s::jsonb,%s::jsonb,%s::jsonb,%s,%s,%s,%s,%s,NOW())""", - (TENANT, title, dept, problem, bs, tg, ac, sh, se, team, dd, st)) -print(f"✅ Kaizen: {len(kaizen_seeds)} events seeded") - -# ═══════════════════════════════════════════════════════════════════ -# GEMBA — 3 walks -# ═══════════════════════════════════════════════════════════════════ -gemba_seeds = [ - ("chambre froide zone A", "pharmacist-lead", - '[{"time":"08:15","note":"Opérateur parcourt 400m pour thermostat - waste motion"},{"time":"08:32","note":"File attente validation 12 commandes - bottleneck"},{"time":"08:47","note":"Stock expiré 2 palettes visibles - waste inventory"}]', - '[{"owner":"logistics","action":"Installer thermostat secondaire zone A","due":"2026-05-15"},{"owner":"pharmacy","action":"Mettre en place validation mobile","due":"2026-05-01"}]', - 3, 45), - ("quai réception", "ops-manager", - '[{"time":"10:00","note":"Double manutention colis froids entre quai et quarantaine"},{"time":"10:25","note":"Étiquettes batch non lisibles 3/47 colis"}]', - '[{"owner":"logistics","action":"Zone tampon ventilée direct sortie quai","due":"2026-06-01"}]', - 2, 30), - ("salle de préparation", "pharmacist+qa", - '[{"time":"14:00","note":"Workflow scan barcode fonctionne parfait"},{"time":"14:20","note":"Formation nouveau opérateur - pose 6 questions répétitives doc manquante"}]', - '[{"owner":"training","action":"Quick-reference cards plastifiées postes","due":"2026-04-25"}]', - 1, 60), -] -cur.execute("DELETE FROM weval.gemba_walks WHERE tenant_id = %s", (TENANT,)) -for loc, walker, obs, acts, spot, dur in gemba_seeds: - cur.execute("""INSERT INTO weval.gemba_walks (tenant_id, location, walker, observations, actions, muda_spotted, walk_duration_min, created_at) - VALUES (%s,%s,%s,%s::jsonb,%s::jsonb,%s,%s,NOW())""", - (TENANT, loc, walker, obs, acts, spot, dur)) -print(f"✅ Gemba: {len(gemba_seeds)} walks seeded") - -# ═══════════════════════════════════════════════════════════════════ -# PDCA — 4 cycles -# ═══════════════════════════════════════════════════════════════════ -pdca_seeds = [ - ("Validation commandes <2h", "do", - '{"analysis":"4h avg validation time pic matin"}', '{"implementation":"App mobile + notif push"}', - '{}', '{}', "validation_time_min", 240, 120, 108), - ("Rotation FIFO <5% expired", "check", - '{"analysis":"15% RX expired annuel"}', '{"implementation":"WMS scan position + alert 90j avant exp"}', - '{"measure":"5.2% expired après 3 mois"}', '{}', "expired_rate_pct", 15, 5, 5.2), - ("AMM rejection <1%", "act", - '{"analysis":"5% rejetés 1er tour"}', '{"implementation":"Checklist 47 points"}', - '{"measure":"2% après Q1"}', '{"standardize":"Rollout Q2 toutes soumissions"}', "rejection_rate_pct", 5, 1, 2), - ("T° chain excursion <1%", "plan", - '{"analysis":"3% colis excursion annuel"}', '{}', '{}', '{}', "excursion_rate_pct", 3, 1, None), -] -cur.execute("DELETE FROM weval.pdca_cycles WHERE tenant_id = %s", (TENANT,)) -for title, phase, plan, do, chk, act, kpi, bs, tg, ac in pdca_seeds: - cur.execute("""INSERT INTO weval.pdca_cycles (tenant_id, title, phase, plan_data, do_data, check_data, act_data, kpi_name, baseline, target, actual, created_at, updated_at) - VALUES (%s,%s,%s,%s::jsonb,%s::jsonb,%s::jsonb,%s::jsonb,%s,%s,%s,%s,NOW(),NOW())""", - (TENANT, title, phase, plan, do, chk, act, kpi, bs, tg, ac)) -print(f"✅ PDCA: {len(pdca_seeds)} cycles seeded") - -# ═══════════════════════════════════════════════════════════════════ -# ANDON — 2 alerts -# ═══════════════════════════════════════════════════════════════════ -andon_seeds = [ - ("zone-A-coldroom", "high", "T° à 9.2°C depuis 18min - seuil critique approche (plage 2-8°C)", "iot-sensor", "logistics-team", 22, "resolved"), - ("dispensation-station-3", "medium", "Scanner barcode offline 12min - fallback manuel actif", "pharmacist", "it-oncall", None, "open"), -] -cur.execute("DELETE FROM weval.andon_alerts WHERE tenant_id = %s", (TENANT,)) -for st, sev, msg, trig, resv, rt, stat in andon_seeds: - cur.execute("""INSERT INTO weval.andon_alerts (tenant_id, station, severity, message, triggered_by, resolved_by, resolution_time_min, status, created_at, resolved_at) - VALUES (%s,%s,%s,%s,%s,%s,%s,%s,NOW() - INTERVAL '2 hours', CASE WHEN %s='resolved' THEN NOW() ELSE NULL END)""", - (TENANT, st, sev, msg, trig, resv, rt, stat, stat)) -print(f"✅ Andon: {len(andon_seeds)} alerts seeded") - -# ═══════════════════════════════════════════════════════════════════ -# 5S — 3 audits -# ═══════════════════════════════════════════════════════════════════ -fives_seeds = [ - ("chambre-froide-A", 4, 4, 4, 3, 4, 19, "audit-q1-pharmacist", "T° stable, étiquetage excellent, rangement à améliorer"), - ("salle-preparation", 5, 5, 5, 4, 4, 23, "audit-q1-qa", "Top performer, formation standardisée exemplaire"), - ("quai-reception", 3, 3, 3, 3, 3, 15, "audit-q1-ops-lead", "Flux mélangés colis froid/ambient, réorganisation prévue Q2"), -] -cur.execute("DELETE FROM weval.five_s_audits WHERE tenant_id = %s", (TENANT,)) -for area, s1, s2, s3, s4, s5, total, aud, notes in fives_seeds: - cur.execute("""INSERT INTO weval.five_s_audits (tenant_id, area, seiri, seiton, seiso, seiketsu, shitsuke, auditor, notes, created_at) - VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,NOW())""", - (TENANT, area, s1, s2, s3, s4, s5, aud, notes)) -print(f"✅ 5S: {len(fives_seeds)} audits seeded") - -# ═══════════════════════════════════════════════════════════════════ -# A3 — 3 reports -# ═══════════════════════════════════════════════════════════════════ -a3_seeds = [ - ("Expiration stock RX - A3 réduction 15% à 5%", - "CFAO Healthcare perd 28k€/an par péremption molécules RX dans chambres froides", - "Actuel: 15% expired annuel · 28k€/an perdu · FIFO manuel inconsistant", - "Cible: <5% expired · <10k€/an · FIFO automatisé WMS", - "Écart 10pts% · 18k€ savings potentiels annuels", - '["Rotation manuelle non tracée","Pas d alerte 90j avant expiration","Position stock non géolocalisée"]', - '["WMS avec scan position batch","Alerte automatique J-90 J-30 J-7","Formation équipe rotation FIFO stricte"]', - '{"week1":"spec WMS module","week3":"go-live pilot zone A","week8":"rollout complet"}', - '{"q1_2026":"measure 5.2% - on track","q2_2026":"review full"}', - "logistics-lead", "in-progress"), - ("Validation commandes - A3 pic matin", - "Pharmaciens débordés pic 8h-12h, validations en retard 4h, hospitals mécontents", - "4h avg · file 12+ commandes 10h · 3 pharmaciens seulement", - "90min avg · file <5 commandes · validation mobile", - "Gain 2.5h par commande · 4 pharmaciens effectifs via mobile", - '["Validation obligée sur poste fixe","Pas de priorisation auto","Contexte manuel non pré-rempli"]', - '["App mobile validation","Algorithme priorisation urgent","Pré-remplissage auto batch+prescription"]', - '{"week2":"dev app","week5":"pilot 2 pharmaciens","week10":"rollout team"}', - '{}', - "pharmacy-lead", "in-progress"), - ("AMM rejection - A3 checklist", - "5% dossiers AMM rejetés 1er tour par info manquante - 6k€/dossier + 3 mois délai", - "5% rejected · 47 points à checker manuellement · QA review variable", - "<1% rejected · checklist auto · QA standardisée", - "Gain 4pts% · économie 24k€/an (4 soumissions évitées)", - '["Checklist papier utilisée inégalement","Pas de blocage soumission si incomplet","Recherche pièces jointes chronophage"]', - '["Formulaire web 47 champs obligatoires","Blocage submit si gap","Library pièces jointes centralisée"]', - '{"month1":"dev form","month2":"pilot 5 submissions","month3":"rollout"}', - '{"q1_2026":"2% rejection - sur bonne voie"}', - "regulatory-lead", "completed"), -] -cur.execute("DELETE FROM weval.a3_reports WHERE tenant_id = %s", (TENANT,)) -for title, bg, cs, ts, gap, rc, cm, ip, fu, owner, st in a3_seeds: - cur.execute("""INSERT INTO weval.a3_reports (tenant_id, title, background, current_state, target_state, gap_analysis, root_causes, countermeasures, implementation_plan, follow_up, owner, status, created_at) - VALUES (%s,%s,%s,%s,%s,%s,%s::jsonb,%s::jsonb,%s::jsonb,%s::jsonb,%s,%s,NOW())""", - (TENANT, title, bg, cs, ts, gap, rc, cm, ip, fu, owner, st)) -print(f"✅ A3: {len(a3_seeds)} reports seeded") - -print("\n" + "="*60) -print("🏆 Seed CFAO Healthcare Lean 6σ COMPLETED") -print("="*60) - -# Verify counts -for tbl in ['muda_entries','poka_yoke','kaizen_events','gemba_walks','pdca_cycles','andon_alerts','five_s_audits','a3_reports']: - cur.execute(f"SELECT COUNT(*) FROM weval.{tbl} WHERE tenant_id = %s", (TENANT,)) - cnt = cur.fetchone()[0] - print(f" {tbl:22} count={cnt}") - -cur.close() -conn.close() diff --git a/api/seed-weval-6poles-lean6sigma.py b/api/seed-weval-6poles-lean6sigma.py new file mode 100644 index 000000000..4af23759f --- /dev/null +++ b/api/seed-weval-6poles-lean6sigma.py @@ -0,0 +1,285 @@ +#!/usr/bin/env python3 +""" +V96.17 CORRECT — Lean 6σ pour WEVAL Consulting (ses 6 pôles d'expertise) + +WEVAL = cabinet multi-verticales basé Casablanca/Paris, 8 pays 3 continents: + 1. Conseil Stratégique & IA (WEVIA souveraine · 52 domaines · 15 providers cascade) + 2. Cloud & Intégration (Huawei Cloud · SAP S/4HANA · Vistex · Arrow/Scaleway) + 3. Marketing Digital (Email WEVADS 6.65M contacts · Ethica HCP 146k · Social Media) + 4. Cybersécurité IA (Nuclei · fail2ban · WAF · pentests) + 5. Talent as a Service (5000+ profils IT · 22 candidats pipeline · 4 consultants · TJM 2470) + 6. Formations certifiantes + +Partenariats: Huawei · SAP · Vistex · IQVIA · Confluent · Cloudflare · Hetzner +""" +import psycopg2 +conn = psycopg2.connect(host="127.0.0.1", port=5432, dbname="adx_system", user="admin", password="admin123") +conn.autocommit = True +cur = conn.cursor() +T = "weval" + +# ═══════════════════════════════════════════════════════════════════ +# MUDA — 14 entries couvrant les 6 pôles d'expertise +# ═══════════════════════════════════════════════════════════════════ +muda = [ + # POLE 1: Conseil Stratégique & IA + ("conseil-ia", "waiting", "POC WEVIA clients en attente validation DSI >30j (cycle décision long)", 4, 60, 18000, "in-progress", "sales-review"), + ("conseil-ia", "overprocessing", "Slides proposition IA refaites 3× par client (pas de template modulable)", 3, 48, 11280, "identified", "ops-review"), + + # POLE 2: Cloud & Intégration (Huawei/SAP/Vistex) + ("cloud-integration", "defects", "Tickets support Huawei/SAP traités >4j moy (SLA client 48h)", 4, 96, 28800, "identified", "delivery-audit"), + ("cloud-integration", "motion", "Architectes alternent 4 outils (AWS Console + Huawei + SAP GUI + Excel) sans automation", 3, 72, 16920, "identified", "tech-review"), + ("partenaires", "waiting", "Réponses Vistex/Huawei/Arrow lentes (cycle 2-3 semaines email ping-pong)", 3, 20, 3000, "identified", "partnership-review"), + + # POLE 3: Marketing Digital (WEVADS/Ethica/Social) + ("marketing-email", "defects", "Bounce rate campaigns Ethica 15% (SPF/DKIM OK mais liste vieillit)", 4, 15, 1800, "identified", "deliverability-audit"), + ("marketing-email", "defects", "Deals campaigns CX3/DoubleM conversion <2% (landing pages non-optimisées)", 4, 40, 12000, "identified", "growth-audit"), + ("marketing-social", "overprocessing", "Posts LinkedIn/YT/Insta/TikTok écrits 4× pour 4 plateformes (pas de multi-channel)", 2, 24, 5640, "identified", "content-review"), + + # POLE 4: Cybersécurité IA + ("cybersec", "waiting", "Vulnérabilités Nuclei scan non-triées 3 semaines (backlog 87 findings)", 4, 40, 9400, "identified", "security-audit"), + ("cybersec", "defects", "Faux positifs WAF Cloudflare 12% bloquent clients légitimes", 3, 16, 3760, "identified", "ops-review"), + + # POLE 5: Talent as a Service (recrutement/staffing/delivery) + ("recrutement", "defects", "35% candidats scorés abandonnent pendant process (time-to-offer 35j)", 4, 60, 18000, "in-progress", "hr-audit"), + ("staffing", "motion", "Matching consultant/mission Excel manuel (4h/mission vs 15min outillé)", 3, 48, 11280, "identified", "ops-review"), + ("delivery", "waiting", "Timesheet consultants validés J+15 moy (cible J+5) retarde facturation", 5, 30, 74100, "in-progress", "finance-audit"), + ("billing", "defects", "8% factures rejetées 1er envoi (PO/TVA/période)", 3, 16, 2500, "identified", "accounting-review"), + ("cash-collection", "overprocessing", "Relance facture manuelle 3× téléphone (DSO 75j vs cible 45j)", 4, 24, 4800, "in-progress", "cash-audit"), + ("commissions", "overprocessing", "Calcul commissions Chafik/Youssef Excel manuel 3h/mois + risque erreur", 2, 36, 8000, "in-progress", "ops-review"), + + # POLE 6: Formations certifiantes + ("formations", "inventory", "20 modules formations e-learning non-déployés (stagnent sur Drive)", 2, 0, 15000, "identified", "training-audit"), + ("formations", "skills", "Formateurs internes pas certifiés SAP/Huawei (impact sur certifications émises)", 3, 80, 19000, "identified", "training-review"), + + # Transversal WEVAL + ("pipeline-commercial", "inventory", "60+ leads stale >90j pipeline CRM (forecast accuracy biaisé)", 3, 0, 0, "identified", "sales-audit"), + ("onboarding-consultant", "skills", "Nouveau consultant autonome J+30 vs J+14 cible (onboarding peu structuré)", 3, 96, 23712, "identified", "hr-audit"), +] + +cur.execute("DELETE FROM weval.muda_entries WHERE tenant_id = %s", (T,)) +for m in muda: + cur.execute("""INSERT INTO weval.muda_entries (tenant_id, vs_id, muda_type, description, severity, impact_hours, impact_euro, status, detected_by, created_at) + VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,NOW())""", (T,)+m) +print(f"✅ Muda: {len(muda)} entries — couvrant 6 pôles WEVAL") + +# ═══════════════════════════════════════════════════════════════════ +# POKA-YOKE — 8 devices anti-erreurs multi-pôles +# ═══════════════════════════════════════════════════════════════════ +poka = [ + ("candidate-scoring", "Scoring subjectif variable", "form-template", + "Formulaire 3 axes hard/soft/culturel obligatoire + validation scorer", + "Audit 100% scoring avant offer", "active", 95.0), + ("timesheet-submission", "Timesheet hors deadline", "workflow-reminder", + "Rappel auto J-2/J-1/J0 + blocage portail si J+3 non soumis", + "Dashboard manager temps réel", "active", 92.5), + ("invoice-generation", "Facture erreur PO/TVA/période", "checklist-auto", + "Pré-validation auto 7 champs avant envoi client", + "Test historique 0 erreur", "pilot", 98.0), + ("campagne-email-bounce", "Envoi campagne liste sans suppressions", "workflow-lockstep", + "Validation obligatoire suppression hardbounces + unsubscribes + complaints <30j", + "Pré-flight check Ethica/WEVADS", "active", 99.5), + ("cloud-deploy", "Deploy production sans review", "gate-approval", + "PR obligatoire + review Chouaib + NonReg 153/153 + GOLD avant deploy", + "Rollback test mensuel", "active", 97.8), + ("nda-contracts", "NDA non signé avant partage doc", "workflow-lockstep", + "Blocage Drive share tant que NDA DocuSign non signé", + "Audit legal mensuel", "active", 100.0), + ("commission-calculation", "Commission calcul erreur", "formula-validation", + "Script Python auto + double-check humain si delta >1%", + "Réconciliation Excel parallèle 3 mois", "pilot", 97.0), + ("social-media-post", "Brand guidelines non respectées", "checklist-pre-publish", + "Check logo/tagline/couleurs/hashtags/mentions obligatoires avant publish", + "Review marketing manager J+1", "pilot", 90.0), +] +cur.execute("DELETE FROM weval.poka_yoke WHERE tenant_id = %s", (T,)) +for p in poka: + cur.execute("""INSERT INTO weval.poka_yoke (tenant_id, process, failure_mode, device_type, mechanism, validation, status, efficiency_pct, created_at) + VALUES (%s,%s,%s,%s,%s,%s,%s,%s,NOW())""", (T,)+p) +print(f"✅ Poka-Yoke: {len(poka)} devices multi-pôles") + +# ═══════════════════════════════════════════════════════════════════ +# KAIZEN — 8 événements amélioration 6 pôles +# ═══════════════════════════════════════════════════════════════════ +kaizen = [ + ("Templates proposition IA modulables", "conseil-ia", "Slides refaites 3× par client", + '{"hours_per_prop": 48}', '{"hours_per_prop": 12}', '{"hours_per_prop": 20}', 28, 6580, "yacine+design", 14, "completed"), + + ("SLA support Huawei/SAP <48h", "cloud-integration", "Tickets >4j actuellement", + '{"sla_hours": 96}', '{"sla_hours": 48}', '{"sla_hours": 72}', 50, 15000, "chouaib+tech", 21, "in-progress"), + + ("Deliverability Ethica bounce <5%", "marketing-email", "Bounce rate 15% campagnes pharma", + '{"bounce_rate_pct": 15}', '{"bounce_rate_pct": 5}', '{"bounce_rate_pct": 8}', 20, 9600, "marketing+ops", 20, "in-progress"), + + ("Multi-channel publishing automation", "marketing-social", "Posts écrits 4× pour 4 plateformes", + '{"hours_per_week": 24}', '{"hours_per_week": 4}', '{"hours_per_week": 8}', 80, 18800, "content+tech", 15, "in-progress"), + + ("Nuclei findings triés <48h", "cybersec", "Backlog 87 findings 3 semaines", + '{"backlog_days": 21}', '{"backlog_days": 2}', '{"backlog_days": 5}', 16, 3760, "security+ops", 10, "in-progress"), + + ("Automation commissions Python", "finance", "Excel manuel 3h/mois + risques", + '{"hours_month": 3, "error_rate_pct": 2}', '{"hours_month": 0.2, "error_rate_pct": 0}', + '{"hours_month": 0.5, "error_rate_pct": 0}', 36, 8640, "yacine+youssef", 15, "completed"), + + ("Time-to-offer 35j → 21j", "recrutement", "Time-to-offer lent perd 35% candidats", + '{"time_to_offer_days": 35, "abandon_rate_pct": 35}', + '{"time_to_offer_days": 21, "abandon_rate_pct": 15}', + '{"time_to_offer_days": 22, "abandon_rate_pct": 18}', 20, 9000, "hr+partner", 12, "completed"), + + ("Formations e-learning déploiement", "formations", "20 modules stagnent Drive non-déployés", + '{"modules_live": 0, "revenue_formations_keur": 0}', + '{"modules_live": 20, "revenue_formations_keur": 30}', + '{"modules_live": 5, "revenue_formations_keur": 8}', 40, 15000, "training+tech", 30, "in-progress"), +] +cur.execute("DELETE FROM weval.kaizen_events WHERE tenant_id = %s", (T,)) +for k in kaizen: + cur.execute("""INSERT INTO weval.kaizen_events (tenant_id, title, dept, problem, baseline, target, actual, savings_hours, savings_euro, team, duration_days, status, created_at) + VALUES (%s,%s,%s,%s,%s::jsonb,%s::jsonb,%s::jsonb,%s,%s,%s,%s,%s,NOW())""", (T,)+k) +print(f"✅ Kaizen: {len(kaizen)} events — 6 pôles") + +# ═══════════════════════════════════════════════════════════════════ +# GEMBA — walks dans l'organisation WEVAL multi-pôles +# ═══════════════════════════════════════════════════════════════════ +gemba = [ + ("bureau Casablanca delivery", "yacine-partner", + '[{"time":"09:30","note":"Chouaib valide timesheets 1-par-1 manuellement"},{"time":"10:00","note":"Sara attend accès VM client CGI 2h"},{"time":"10:45","note":"Relance facture OKP4 3 semaines no-response"}]', + '[{"owner":"ops","action":"Portail timesheet self-service","due":"2026-05-10"},{"owner":"tech","action":"Pré-provisioning VM J-3","due":"2026-05-01"},{"owner":"finance","action":"Auto-relance J+30/45/60","due":"2026-04-30"}]', 3, 75), + + ("revue pipeline commercial", "youssef-partner-sales", + '[{"time":"14:00","note":"60+ leads stale sans action"},{"time":"14:30","note":"Deal Vistex bloqué addendum 21j"},{"time":"15:00","note":"Focus top 10 deals décidé"}]', + '[{"owner":"youssef","action":"Cleanup CRM >120j","due":"2026-04-25"},{"owner":"yacine","action":"Push Vistex","due":"2026-04-30"}]', 2, 60), + + ("infrastructure cloud+cybersec", "yacine-tech", + '[{"time":"11:00","note":"87 findings Nuclei sans triage"},{"time":"11:30","note":"Tickets Huawei attente 5j"},{"time":"12:00","note":"WAF CF false positive client bloqué 15min"}]', + '[{"owner":"security","action":"Triage findings 48h SLA","due":"2026-05-05"},{"owner":"cloud","action":"Template réponse Huawei standardisée","due":"2026-05-03"}]', 3, 60), + + ("campagne marketing Ethica", "marketing-lead", + '[{"time":"16:00","note":"Préparation campagne pharma 10k/jour"},{"time":"16:15","note":"Liste non-suppressée 15% bounces"},{"time":"16:45","note":"Posts LinkedIn/YT/Insta réécrits 4 fois"}]', + '[{"owner":"marketing","action":"Pre-flight suppression check","due":"2026-04-28"},{"owner":"content","action":"Template multi-channel 1-post-4-formats","due":"2026-05-08"}]', 3, 45), +] +cur.execute("DELETE FROM weval.gemba_walks WHERE tenant_id = %s", (T,)) +for g in gemba: + cur.execute("""INSERT INTO weval.gemba_walks (tenant_id, location, walker, observations, actions, muda_spotted, walk_duration_min, created_at) + VALUES (%s,%s,%s,%s::jsonb,%s::jsonb,%s,%s,NOW())""", (T,)+g) +print(f"✅ Gemba: {len(gemba)} walks") + +# ═══════════════════════════════════════════════════════════════════ +# PDCA — 6 cycles couvrant 6 pôles +# ═══════════════════════════════════════════════════════════════════ +pdca = [ + ("Cash collection DSO 75j → 45j", "do", + '{"analysis":"DSO 75j vs 45j cible"}', '{"implementation":"Auto-relance J+30/45/60 + escompte 2pct"}', + '{}', '{}', "dso_days", 75, 45, 52), + ("Forecast commercial accuracy >80%", "check", + '{"analysis":"Forecast erreur 45pct"}', '{"implementation":"Scoring prob + review hebdo"}', + '{"measure":"78pct accuracy Q1"}', '{}', "forecast_accuracy_pct", 55, 85, 78), + ("Time-to-offer <21j", "act", + '{"analysis":"35j perd candidats"}', '{"implementation":"Scoring standardisé"}', + '{"measure":"22j Q1"}', '{"standardize":"Process figé tous rôles"}', "time_to_offer_days", 35, 21, 22), + ("Bench rate <10%", "plan", + '{"analysis":"15pct bench = 30k/mois manque-a-gagner"}', '{}', '{}', '{}', "bench_rate_pct", 15, 10, None), + ("Bounce rate Ethica <5%", "do", + '{"analysis":"15pct bounce campagnes"}', '{"implementation":"Pre-flight suppression strict"}', + '{}', '{}', "bounce_rate_pct", 15, 5, 8), + ("Modules formations déployés 20/20", "do", + '{"analysis":"0/20 live, 30k revenue potentiel"}', '{"implementation":"LMS deploy + marketing"}', + '{}', '{}', "modules_live", 0, 20, 5), +] +cur.execute("DELETE FROM weval.pdca_cycles WHERE tenant_id = %s", (T,)) +for p in pdca: + cur.execute("""INSERT INTO weval.pdca_cycles (tenant_id, title, phase, plan_data, do_data, check_data, act_data, kpi_name, baseline, target, actual, created_at, updated_at) + VALUES (%s,%s,%s,%s::jsonb,%s::jsonb,%s::jsonb,%s::jsonb,%s,%s,%s,%s,NOW(),NOW())""", (T,)+p) +print(f"✅ PDCA: {len(pdca)} cycles") + +# ═══════════════════════════════════════════════════════════════════ +# ANDON — alertes opérationnelles multi-pôles +# ═══════════════════════════════════════════════════════════════════ +andon = [ + ("delivery-CGI-ODI", "high", "Mission CGI timesheet Sara retard 8j - facturation 15k€ risque", "timesheet-monitor", "chouaib", 45, "resolved"), + ("sales-vistex-addendum", "medium", "Deal Vistex addendum leads 21j sans réponse Olga - risque Q2 slip", "crm-stale", None, None, "open"), + ("cash-OKP4", "medium", "Facture OKP4 impayée J+52 - dépasse seuil J+45", "billing-aging", None, None, "open"), + ("cybersec-nuclei", "high", "87 findings Nuclei non-triés 3 semaines backlog", "security-monitor", None, None, "open"), + ("marketing-ethica", "low", "Campagne pharma bounce 15% vs cible 5%", "deliverability", "marketing", 120, "resolved"), +] +cur.execute("DELETE FROM weval.andon_alerts WHERE tenant_id = %s", (T,)) +for a in andon: + cur.execute("""INSERT INTO weval.andon_alerts (tenant_id, station, severity, message, triggered_by, resolved_by, resolution_time_min, status, created_at, resolved_at) + VALUES (%s,%s,%s,%s,%s,%s,%s,%s,NOW() - INTERVAL '3 hours', CASE WHEN %s='resolved' THEN NOW() ELSE NULL END)""", (T,)+a+(a[-1],)) +print(f"✅ Andon: {len(andon)} alerts") + +# ═══════════════════════════════════════════════════════════════════ +# 5S — audits espaces WEVAL (physiques + digitaux) +# ═══════════════════════════════════════════════════════════════════ +fives = [ + ("bureau-Casablanca-open-space", 4, 3, 4, 4, 3, "yacine-partner", "Espace propre, docs papier à numériser"), + ("drive-google-shared", 3, 2, 4, 3, 3, "chouaib-delivery", "Arborescence incohérente clients/missions/templates"), + ("repo-github-weval", 5, 5, 5, 5, 5, "yacine-tech", "Top: triple-sync, 28 NR 153/153 stable"), + ("crm-pipeline", 3, 3, 3, 3, 3, "youssef-sales", "60+ leads stale à nettoyer, stages pas toujours respectées"), + ("sharepoint-docs-clients", 4, 4, 3, 4, 4, "chouaib-delivery", "Propre mais manque nettoyage périodique anciens projets"), +] +cur.execute("DELETE FROM weval.five_s_audits WHERE tenant_id = %s", (T,)) +for f in fives: + cur.execute("""INSERT INTO weval.five_s_audits (tenant_id, area, seiri, seiton, seiso, seiketsu, shitsuke, auditor, notes, created_at) + VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,NOW())""", (T,)+f) +print(f"✅ 5S: {len(fives)} audits") + +# ═══════════════════════════════════════════════════════════════════ +# A3 — rapports problem-solving WEVAL +# ═══════════════════════════════════════════════════════════════════ +a3 = [ + ("A3 Cash collection DSO 75j → 45j", + "DSO WEVAL 75j vs cible 45j · impact cash flow · 110k€ encours >30j", + "75j · 3 factures >60j · relance manuelle téléphone", "<45j · 0 facture >60j · auto-relance", + "30j DSO · 110k€ bloqués", + '["Pas d auto-relance","Client non qualifié paiement","Pas escompte early payment"]', + '["Script auto J+30/45/60","Scoring client onboarding","Escompte 2pct <30j"]', + '{"week2":"dev script","week4":"pilot 3 clients","week8":"rollout"}', + '{"q1_2026":"DSO 52j progression OK"}', "yacine+youssef", "in-progress"), + + ("A3 Bench rate 15% → 10%", + "15pct bench trimestriel = 30k/mois manque-à-gagner", + "bench 15pct · 1 consultant 2 mois · pipeline faible", "<10pct · rotation <30j · pipeline robuste", + "5pts% · 10k/mois potentiel", + '["Pipeline faible","Consultants mal matchés","Prospection partners insuffisante"]', + '["Accélérer POC WEVIA/WEVADS","Matching algo","Revue hebdo Vistex/Huawei/Arrow"]', + '{"m1":"audit skills","m2":"5 POC","m3":"measure"}', '{}', "chafik-partner", "in-progress"), + + ("A3 Time-to-offer 35j → 21j", + "35j perd 35% talents dans process", "35j · 35pct abandon · scoring subjectif", "21j · <15pct · scoring 3 axes", + "14j · 6 candidats récupérables/an", + '["Scoring subjectif","Decision >J+14","Feedback lent"]', + '["Formulaire 3 axes","Decision J+7 max","Feedback auto J+1"]', + '{"w1":"form","w3":"pilot 5","w6":"rollout"}', '{"q1":"22j atteint"}', "hr-partner", "completed"), + + ("A3 Bounce rate Ethica 15% → 5%", + "Bounces pharma 15% affectent deliverability + reputation wevup.app", + "15pct bounce · liste non-suppressée · pas pre-flight", "<5pct · suppression strict · pre-flight auto", + "10pts% bounce · 10k€ waste annuel", + '["Liste non-nettoyée","Pas pre-flight","Hardbounces jamais purgés"]', + '["Pre-flight suppression J-1","Purge hebdo hardbounces","Double opt-in renforcé"]', + '{"w1":"script","w2":"pilot","w4":"rollout Ethica"}', '{}', "marketing-lead", "in-progress"), + + ("A3 Formations 0 → 20 modules live", + "20 modules formations stagnent Drive · 30k€/an revenue manqué", + "0 modules live · LMS inexistant · 0€ revenue formations", "20 modules · LMS déployé · 30k€/an", + "100% modules · 30k€ top-line", + '["LMS non-déployé","Pas marketing formations","Formateurs non-certifiés"]', + '["Deploy Moodle/Docker","Landing page formations","Certification formateurs SAP/Huawei"]', + '{"m1":"deploy LMS","m2":"5 modules live","m3":"marketing launch"}', '{}', "training+tech", "in-progress"), +] +cur.execute("DELETE FROM weval.a3_reports WHERE tenant_id = %s", (T,)) +for rep in a3: + cur.execute("""INSERT INTO weval.a3_reports (tenant_id, title, background, current_state, target_state, gap_analysis, root_causes, countermeasures, implementation_plan, follow_up, owner, status, created_at) + VALUES (%s,%s,%s,%s,%s,%s,%s::jsonb,%s::jsonb,%s::jsonb,%s::jsonb,%s,%s,NOW())""", (T,)+rep) +print(f"✅ A3: {len(a3)} reports") + +print("\n" + "="*60) +print("🏆 Seed WEVAL Consulting 6 pôles d'expertise COMPLETED") +print("="*60) + +for tbl in ['muda_entries','poka_yoke','kaizen_events','gemba_walks','pdca_cycles','andon_alerts','five_s_audits','a3_reports']: + cur.execute(f"SELECT COUNT(*) FROM weval.{tbl} WHERE tenant_id = %s", (T,)) + print(f" {tbl:22} count={cur.fetchone()[0]}") + +cur.close() +conn.close()