{
 "engine": "pricing-guardrail",
 "seed": 42,
 "params": {
  "seed": 42,
  "floor_mult": 0.9,
  "block_mult": 1.03,
  "drift_z": 2.0,
  "deals_lost": 0.15,
  "guardrail": true
 },
 "world": {
  "quotes": 600,
  "reps": 12,
  "drifting_reps": [
   "R01",
   "R03",
   "R04"
  ],
  "weeks": 12,
  "corridor": [
   {
    "name": "DIAGNOSTIC",
    "cost": 0.62,
    "floor": 0.69,
    "target": 0.79,
    "ceiling": 1.0
   },
   {
    "name": "CONSUMABLES",
    "cost": 0.71,
    "floor": 0.79,
    "target": 0.89,
    "ceiling": 1.0
   },
   {
    "name": "FURNITURE",
    "cost": 0.58,
    "floor": 0.65,
    "target": 0.75,
    "ceiling": 1.0
   },
   {
    "name": "MONITORING",
    "cost": 0.66,
    "floor": 0.74,
    "target": 0.84,
    "ceiling": 1.0
   },
   {
    "name": "SURGICAL",
    "cost": 0.55,
    "floor": 0.62,
    "target": 0.72,
    "ceiling": 1.0
   }
  ],
  "sla_hours": 4,
  "sla_p": 0.8,
  "grant_p": {
   "VOLUME": 0.7,
   "COMPETITOR": 0.85,
   "STRATEGIC": 0.9
  },
  "rolling_window": 10,
  "list_value": 90861476
 },
 "decisions": {
  "approve": 558,
  "needs_approval": {
   "requests": 10,
   "granted": 5,
   "declined": 2,
   "auto_declined": 17,
   "escalated": 3,
   "escalated_granted": 3,
   "escalated_declined": 0
  },
  "block": 15,
  "repriced": 34,
  "total": 600
 },
 "values": {
  "approve": 85292240,
  "granted": 1552792,
  "declined": 2470833,
  "block": 1545611
 },
 "margin": {
  "leak_before": 248428,
  "leak_after": 39639,
  "protected_gross": 208789,
  "foregone_on_repriced": 132127,
  "deals_lost_assumed": 0.15,
  "protected_net": 157652
 },
 "approvals_per_week": [
  1,
  0,
  1,
  0,
  2,
  0,
  3,
  0,
  0,
  0,
  2,
  1
 ],
 "approvals_per_week_mean": 0.83,
 "drift": {
  "formula": "z = (mean of the rep's last 10 discounts - mean of the category means of those 10 quotes) / (population sd of all discounts so far / sqrt(10)); flag when z > drift_z",
  "threshold": 2.0,
  "flagged": [
   {
    "rep": "R09",
    "at_quote": 89,
    "rep_quote_n": 10,
    "rolling_mean": 0.2505,
    "population_mean": 0.1267,
    "population_sd": 0.0807,
    "z": 4.85,
    "drifting": false
   },
   {
    "rep": "R11",
    "at_quote": 108,
    "rep_quote_n": 10,
    "rolling_mean": 0.2011,
    "population_mean": 0.1273,
    "population_sd": 0.0783,
    "z": 2.98,
    "drifting": false
   },
   {
    "rep": "R04",
    "at_quote": 138,
    "rep_quote_n": 12,
    "rolling_mean": 0.1808,
    "population_mean": 0.125,
    "population_sd": 0.0781,
    "z": 2.26,
    "drifting": true
   },
   {
    "rep": "R01",
    "at_quote": 381,
    "rep_quote_n": 34,
    "rolling_mean": 0.1886,
    "population_mean": 0.1321,
    "population_sd": 0.0827,
    "z": 2.16,
    "drifting": true
   },
   {
    "rep": "R03",
    "at_quote": 498,
    "rep_quote_n": 42,
    "rolling_mean": 0.1962,
    "population_mean": 0.1422,
    "population_sd": 0.0845,
    "z": 2.02,
    "drifting": true
   }
  ],
  "flagged_count": 5,
  "true_positives": 3,
  "missed": []
 },
 "by_category": [
  {
   "category": "DIAGNOSTIC",
   "cost": 0.62,
   "floor": 0.69,
   "target": 0.79,
   "quotes": 129,
   "approve": 126,
   "granted": 0,
   "declined": 2,
   "block": 1,
   "list_value": 19333414,
   "leak_before": 4389
  },
  {
   "category": "CONSUMABLES",
   "cost": 0.71,
   "floor": 0.79,
   "target": 0.89,
   "quotes": 107,
   "approve": 85,
   "granted": 5,
   "declined": 10,
   "block": 7,
   "list_value": 17099480,
   "leak_before": 157845
  },
  {
   "category": "FURNITURE",
   "cost": 0.58,
   "floor": 0.65,
   "target": 0.75,
   "quotes": 132,
   "approve": 132,
   "granted": 0,
   "declined": 0,
   "block": 0,
   "list_value": 20630730,
   "leak_before": 0
  },
  {
   "category": "MONITORING",
   "cost": 0.66,
   "floor": 0.74,
   "target": 0.84,
   "quotes": 126,
   "approve": 109,
   "granted": 3,
   "declined": 7,
   "block": 7,
   "list_value": 19094302,
   "leak_before": 86194
  },
  {
   "category": "SURGICAL",
   "cost": 0.55,
   "floor": 0.62,
   "target": 0.72,
   "quotes": 106,
   "approve": 106,
   "granted": 0,
   "declined": 0,
   "block": 0,
   "list_value": 14703550,
   "leak_before": 0
  }
 ],
 "by_rep": [
  {
   "rep": "R01",
   "habit": 0.0731,
   "drifting": true,
   "quotes": 62,
   "mean_discount": 0.187,
   "last10_mean": 0.2918,
   "leak_before": 35194,
   "leak_after": 200,
   "blocked": 4,
   "requests": 1,
   "flagged": true,
   "caught_at": 381
  },
  {
   "rep": "R02",
   "habit": 0.1685,
   "drifting": false,
   "quotes": 50,
   "mean_discount": 0.1676,
   "last10_mean": 0.1713,
   "leak_before": 10561,
   "leak_after": 0,
   "blocked": 1,
   "requests": 0,
   "flagged": false,
   "caught_at": null
  },
  {
   "rep": "R03",
   "habit": 0.0601,
   "drifting": true,
   "quotes": 49,
   "mean_discount": 0.1508,
   "last10_mean": 0.2131,
   "leak_before": 3588,
   "leak_after": 1506,
   "blocked": 0,
   "requests": 1,
   "flagged": true,
   "caught_at": 498
  },
  {
   "rep": "R04",
   "habit": 0.14,
   "drifting": true,
   "quotes": 52,
   "mean_discount": 0.2404,
   "last10_mean": 0.3116,
   "leak_before": 73445,
   "leak_after": 11168,
   "blocked": 4,
   "requests": 4,
   "flagged": true,
   "caught_at": 138
  },
  {
   "rep": "R05",
   "habit": 0.1212,
   "drifting": false,
   "quotes": 41,
   "mean_discount": 0.1267,
   "last10_mean": 0.1279,
   "leak_before": 0,
   "leak_after": 0,
   "blocked": 0,
   "requests": 0,
   "flagged": false,
   "caught_at": null
  },
  {
   "rep": "R06",
   "habit": 0.1081,
   "drifting": false,
   "quotes": 52,
   "mean_discount": 0.1048,
   "last10_mean": 0.0822,
   "leak_before": 0,
   "leak_after": 0,
   "blocked": 0,
   "requests": 0,
   "flagged": false,
   "caught_at": null
  },
  {
   "rep": "R07",
   "habit": 0.0,
   "drifting": false,
   "quotes": 49,
   "mean_discount": 0.0252,
   "last10_mean": 0.0172,
   "leak_before": 0,
   "leak_after": 0,
   "blocked": 0,
   "requests": 0,
   "flagged": false,
   "caught_at": null
  },
  {
   "rep": "R08",
   "habit": 0.0,
   "drifting": false,
   "quotes": 41,
   "mean_discount": 0.0185,
   "last10_mean": 0.0321,
   "leak_before": 0,
   "leak_after": 0,
   "blocked": 0,
   "requests": 0,
   "flagged": false,
   "caught_at": null
  },
  {
   "rep": "R09",
   "habit": 0.2453,
   "drifting": false,
   "quotes": 53,
   "mean_discount": 0.2484,
   "last10_mean": 0.2617,
   "leak_before": 124004,
   "leak_after": 26765,
   "blocked": 6,
   "requests": 4,
   "flagged": true,
   "caught_at": 89
  },
  {
   "rep": "R10",
   "habit": 0.092,
   "drifting": false,
   "quotes": 51,
   "mean_discount": 0.0976,
   "last10_mean": 0.0922,
   "leak_before": 0,
   "leak_after": 0,
   "blocked": 0,
   "requests": 0,
   "flagged": false,
   "caught_at": null
  },
  {
   "rep": "R11",
   "habit": 0.2121,
   "drifting": false,
   "quotes": 48,
   "mean_discount": 0.2025,
   "last10_mean": 0.1833,
   "leak_before": 1636,
   "leak_after": 0,
   "blocked": 0,
   "requests": 0,
   "flagged": true,
   "caught_at": 108
  },
  {
   "rep": "R12",
   "habit": 0.1207,
   "drifting": false,
   "quotes": 52,
   "mean_discount": 0.1216,
   "last10_mean": 0.1124,
   "leak_before": 0,
   "leak_after": 0,
   "blocked": 0,
   "requests": 0,
   "flagged": false,
   "caught_at": null
  }
 ],
 "log": [
  "Q001 \u00b7 R01 \u00b7 DIAGNOSTIC  \u00b7 qty  7 \u00b7 value \u20b937,282 \u00b7 quoted 0.96 \u00b7 floor 0.69 \u2192 APPROVE",
  "Q002 \u00b7 R03 \u00b7 FURNITURE   \u00b7 qty  4 \u00b7 value \u20b917,788 \u00b7 quoted 0.96 \u00b7 floor 0.65 \u2192 APPROVE",
  "Q003 \u00b7 R06 \u00b7 SURGICAL    \u00b7 qty  2 \u00b7 value \u20b91,74,752 \u00b7 quoted 0.96 \u00b7 floor 0.62 \u2192 APPROVE",
  "Q004 \u00b7 R09 \u00b7 DIAGNOSTIC  \u00b7 qty  4 \u00b7 value \u20b973,664 \u00b7 quoted 0.73 \u00b7 floor 0.69 \u2192 APPROVE",
  "Q005 \u00b7 R11 \u00b7 FURNITURE   \u00b7 qty  7 \u00b7 value \u20b931,374 \u00b7 quoted 0.80 \u00b7 floor 0.65 \u2192 APPROVE",
  "Q006 \u00b7 R09 \u00b7 SURGICAL    \u00b7 qty 10 \u00b7 value \u20b943,610 \u00b7 quoted 0.69 \u00b7 floor 0.62 \u2192 APPROVE",
  "Q007 \u00b7 R11 \u00b7 MONITORING  \u00b7 qty 16 \u00b7 value \u20b93,14,416 \u00b7 quoted 0.78 \u00b7 floor 0.74 \u2192 APPROVE",
  "Q008 \u00b7 R05 \u00b7 CONSUMABLES \u00b7 qty  8 \u00b7 value \u20b91,52,456 \u00b7 quoted 0.84 \u00b7 floor 0.79 \u2192 APPROVE",
  "Q009 \u00b7 R02 \u00b7 CONSUMABLES \u00b7 qty  5 \u00b7 value \u20b953,780 \u00b7 quoted 0.80 \u00b7 floor 0.79 \u2192 APPROVE",
  "Q010 \u00b7 R06 \u00b7 MONITORING  \u00b7 qty  1 \u00b7 value \u20b911,000 \u00b7 quoted 0.90 \u00b7 floor 0.74 \u2192 APPROVE",
  "Q011 \u00b7 R12 \u00b7 CONSUMABLES \u00b7 qty 11 \u00b7 value \u20b93,32,585 \u00b7 quoted 0.89 \u00b7 floor 0.79 \u2192 APPROVE",
  "Q012 \u00b7 R09 \u00b7 FURNITURE   \u00b7 qty  4 \u00b7 value \u20b943,872 \u00b7 quoted 0.80 \u00b7 floor 0.65 \u2192 APPROVE",
  "Q089 \u00b7 DRIFT \u00b7 R09 last-10 mean 0.251 vs population 0.127 \u00b7 sd 0.081 \u00b7 z 4.85 > 2.0 \u2192 FLAGGED (habitual, not drifting)",
  "Q108 \u00b7 DRIFT \u00b7 R11 last-10 mean 0.201 vs population 0.127 \u00b7 sd 0.078 \u00b7 z 2.98 > 2.0 \u2192 FLAGGED (habitual, not drifting)",
  "Q138 \u00b7 DRIFT \u00b7 R04 last-10 mean 0.181 vs population 0.125 \u00b7 sd 0.078 \u00b7 z 2.26 > 2.0 \u2192 FLAGGED",
  "Q381 \u00b7 DRIFT \u00b7 R01 last-10 mean 0.189 vs population 0.132 \u00b7 sd 0.083 \u00b7 z 2.16 > 2.0 \u2192 FLAGGED",
  "Q498 \u00b7 DRIFT \u00b7 R03 last-10 mean 0.196 vs population 0.142 \u00b7 sd 0.085 \u00b7 z 2.02 > 2.0 \u2192 FLAGGED"
 ]
}