1. System Overview

The Purchase Recommendation System (PRS) converts raw inventory data into actionable purchase orders through a fully transparent, explainable pipeline.

Upload Data
Excel files for items, sales, vendors, stock
Run Pipeline
Forecast → Replenish → Rank vendors
Review Results
Filter, sort, column selector
Create Orders
Draft, edit, group by vendor
2. Processing Workflow
1
Canonical Weekly Series — Merges weekly, monthly, and annual sales into a unified weekly timeline. Priority: Weekly > Monthly > Annual. Fills gaps using proportional distribution or equal split.
2
Anomaly Detection — Flags weeks where |z-score| > threshold or % change exceeds limit. Also computes recent vs historical trend for dampening/boosting.
3
Forecasting — WMA (Weighted Moving Average, weights 0.5/0.3/0.2), Prophet (Facebook's time-series model), or Hybrid (average of both). MAPE is computed for model comparison.
4
Replenishment — Computes CV, demand type, safety stock, min/max stock, and recommended order quantities (with and without open POs). Applies demand adjustment if enabled.
5
Vendor Rankings — Scores each vendor per SKU using availability and price. Type-2 vendors (specialty) ranked before Type-1 for their covered SKUs. Resolves discounts (detailed > flat > none).
6
Order Allocation — Allocates quantities sequentially to ranked vendors. Sets BestVendor1/2/3, AllocationSummary, EstimatedTotalCost, BackorderRisk.
7
ABC-FMS Classification — Classifies each SKU by sales value (A/B/C) and velocity (Fast/Medium/Slow). Derives Priority Group (P1–P4).
8
Budget Engine — If a budget limit is set: Full mode drops lowest-priority SKUs; Partial mode iteratively reduces quantities round-robin until within budget.
3. Glossary
SKUStock Keeping Unit — unique product identifier
MRPMaximum Retail Price — base price before discount
μ (Mean)Weighted average weekly demand
σ (Sigma)Weighted standard deviation of weekly demand
CVCoefficient of Variation = σ / μ. Measures demand volatility.
SSSafety Stock — buffer against demand uncertainty
Min StockMinimum desired inventory level = μ×H + SS
Max StockMaximum desired inventory = Min + μ×H
HPlanning horizon in weeks
zService level Z-score (95% → z=1.65)
WMAWeighted Moving Average (weights: 50%, 30%, 20%)
ProphetFacebook's time-series forecasting model (requires ≥12 weeks)
MAPEMean Absolute Percentage Error — forecast accuracy metric
RecQty(ExclPO)Recommended quantity excluding open POs
RecQty(InclPO)Recommended quantity after subtracting open POs
FinalQtyFinal order quantity (may be overridden or budget-adjusted)
Type-1 VendorGeneral supplier — eligible for all SKUs
Type-2 VendorSpecialty supplier — eligible only for covered SKUs, ranked first
Alpha (α)Weight for availability in vendor scoring (1=availability only, 0=price only)
4. Configuration Parameters
ParameterDefaultDescription
Forecast ModeAutoAuto picks best model by MAPE; WMA/Prophet/Hybrid also available
Horizon Weeks4How many weeks to plan ahead (H)
Service Level95%Stock availability target; determines z-score for safety stock
Alpha0.8Vendor scoring weight for availability vs price
Z-Threshold3.0Anomaly detection sensitivity — higher means fewer anomalies
CV Stable< 0.5Below this CV = Stable demand
CV Variable< 1.0Below this CV = Variable demand (otherwise Erratic)
Trend Threshold30%Recent vs historical change % to trigger trend flag
Demand AdjustmentOffMultiplies Safety Stock by (1 + adj%)
BudgetNoneTotal order budget cap
Budget ModeFullFull=drop SKUs; Partial=reduce quantities round-robin
5. Flags Reference
FlagBadge ColorMeaningAction
UnfulfilledRedSKU has open customer orders that weren't fulfilledPrioritize for immediate purchase
LowHistoryYellowInsufficient historical data for reliable forecastVerify manually; consider override
AnomalyBlueOne or more weeks had statistical sales anomaliesReview whether spike is real demand
NewSKUGreySKU found in stock/orders but not in ItemMasterAdd to ItemMaster for next run
NoDiscountBlackNo discount data for the top-ranked vendorCheck vendor discount sheet
NoDataLightNo sales history at all — forecast unavailableGather demand data; use override
Trend ↑Red arrowRecent 3-week average is ≥30% above historical averageSafety stock boosted 10% automatically
Trend ↓Blue arrowRecent 3-week average is ≥30% below historical averageSafety stock reduced 10% automatically
6. ABC-FMS Classification
ABC (Sales Value)
ATop 80% of annual sales valueCritical
BNext 15% of annual sales valueImportant
CBottom 5% of annual sales valueRoutine
FMS (Velocity)
FastMean weekly ≥ 10 units
MediumMean weekly 3–9 units
SlowMean weekly < 3 units
Priority Groups
PriorityABC+FMS combinationsMeaning
P1-CriticalA+Fast, A+MediumNever stock out — monitor daily
P2-HighA+Slow, B+FastHigh attention — weekly review
P3-MediumB+Medium, B+Slow, C+FastStandard replenishment cycle
P4-LowC+Medium, C+SlowMinimal safety stock; consider dropship
7. Key Formulas
CV = σ / μ
SS = z × σ × √H
Min = μ × H + SS
Max = Min + μ × H
ExclPO = Max(0, Min − Stock)
InclPO = Max(0, Min − (Stock+PO))
NetPrice = MRP × (1 − discount%)
Score = α×Avail + (1−α)×Price
WMA = 0.5×w1 + 0.3×w2 + 0.2×w3
Hybrid = (WMA + Prophet) / 2
MAPE = avg|actual−forecast|/actual
DemandAdj: SS × (1 + adj%/100)
TrendUp: SS × 1.10
TrendDown: SS × 0.90
Service Level → Z: 90%=1.28, 95%=1.65, 98%=2.05, 99%=2.33
8. Vendor Engine
  • Discount Priority: Detailed Sheet (vendor+SKU exact match) > Flat (vendor-wide) > 0% + NoDiscountDataFlag
  • Type-2 Precedence: Type-2 vendors cover only specific SKUs and are always ranked above Type-1 vendors for those SKUs
  • Availability Score: vendor_stock / recommended_qty (capped at 1.0; 1.0 if stock unknown)
  • Price Score: min_price / vendor_price (1.0 for the cheapest vendor)
  • Combined Score: α × Availability + (1-α) × Price
  • Allocation: Sequential — fill from Vendor 1, then 2, then 3. BackorderRisk=High if any qty remains unfulfilled.
9. Draft Orders
  1. Go to Orders and click New Draft Order
  2. Use Import from Run to pull all SKUs with FinalQty > 0 from any run
  3. Edit quantities, vendor assignments, and apply discount overrides per line
  4. The By Vendor grouping lets you review exactly what each vendor will receive
  5. Set a budget on the order to see real-time over/under budget warnings
  6. Multiple drafts can coexist — e.g. one per vendor or one per category
10. Best Practices
  • Always upload at least 12 weeks of sales data to enable Prophet forecasting
  • Use SalesMonthly and SalesAnnual as fallbacks when weekly data is sparse
  • Run with Hybrid mode for best accuracy when data is sufficient
  • Set Service Level to 98% for A-class, critical SKUs; 90% for C-class slow movers
  • Use the Overrides sheet to lock quantities for specific SKUs or put SKUs on replenishment hold
  • Review Erratic demand SKUs manually — high CV means the model has high uncertainty
  • New SKUs (yellow rows) need to be added to ItemMaster with MRP for proper pricing
  • Use ABC-FMS Priority Groups to focus attention on P1-Critical items first
  • Export to Excel after each run for records and offline analysis