mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-19 21:18:16 +02:00
feat: implement AI copilot scoring engine for product analysis and recommendations, including a verification script for recent product logic.
This commit is contained in:
1 parent
56b09a438d
commit
a008b40a59
4 files changed
+71
-2
No files matched your search
@@ -0,0 +1,27 @@
|
||||
|
||||
import { ScoringEngine } from "../src/features/ai-copilot/business/scoring-engine";
|
||||
import { ProductAnalysisInput } from "../src/features/ai-copilot/models/ai-analysis.types";
|
||||
|
||||
const mockProducts: ProductAnalysisInput[] = [
|
||||
{ codein: "PROD1", libelle1: "Nouveau Récent", regularityScore: 1, inactivityMonths: 0, totalCa: 100, totalQuantite: 10, tauxMarge: 30, score: 50, storeCount: 1, sales12m: {} },
|
||||
{ codein: "PROD2", libelle1: "Nouveau Ancien", regularityScore: 1, inactivityMonths: 6, totalCa: 100, totalQuantite: 10, tauxMarge: 30, score: 50, storeCount: 1, sales12m: {} },
|
||||
{ codein: "PROD3", libelle1: "Ancien Actif", regularityScore: 12, inactivityMonths: 0, totalCa: 1000, totalQuantite: 100, tauxMarge: 30, score: 50, storeCount: 1, sales12m: {} },
|
||||
{ codein: "PROD4", libelle1: "Nouveau Limite", regularityScore: 2, inactivityMonths: 1, totalCa: 100, totalQuantite: 10, tauxMarge: 30, score: 50, storeCount: 1, sales12m: {} },
|
||||
{ codein: "PROD5", libelle1: "Nouveau Hors Limite", regularityScore: 2, inactivityMonths: 2, totalCa: 100, totalQuantite: 10, tauxMarge: 30, score: 50, storeCount: 1, sales12m: {} },
|
||||
];
|
||||
|
||||
console.log("--- Testing isRecent Logic ---");
|
||||
|
||||
mockProducts.forEach(p => {
|
||||
const result = ScoringEngine.analyzeRayon(p, mockProducts);
|
||||
console.log(`Product: ${p.libelle1} (reg: ${p.regularityScore}, inact: ${p.inactivityMonths})`);
|
||||
console.log(` isRecent: ${result.decision.isRecent}`);
|
||||
console.log(` Recommendation: ${result.decision.recommendation}`);
|
||||
});
|
||||
|
||||
// Expectations:
|
||||
// PROD1: true (1 < 3 && 0 <= 1)
|
||||
// PROD2: false (1 < 3 && 6 > 1) -> Recommendation should NOT be protected (unless score high)
|
||||
// PROD3: false (12 >= 3)
|
||||
// PROD4: true (2 < 3 && 1 <= 1)
|
||||
// PROD5: false (2 < 3 && 2 > 1)
|
||||
Reference in new issue
Block a user