// system design
Production-Grade
Architecture
Built on strict separation of concerns — feature generation, pricing execution,
and the UI are fully decoupled layers that communicate via a read-only API contract.
⚙️
Feature Job
backend/feature_job.py
Daily batch that computes pricing signals — inventory levels, demand trends, elasticity — and writes a snapshot per SKU. Guarantees reproducibility and prevents data leakage into future runs.
🧮
Pricing Job
backend/pricing_job.py
Consumes feature snapshots, enforces manual overrides, selects strategy (ML / rule-based / freeze), and writes every decision to the audit trail with full explainability metadata.
🔬
Pricing Optimizer
backend/pricing_runner.py
Runs the constrained optimization pass — calls the ML model, applies margin and inventory constraints, then persists final prices alongside reasoning artifacts for the UI.
🛡️
FastAPI Layer
backend/api/
Read-only data contract. Exposes system health, alerts, global pricing status, and per-SKU history. The UI never touches the DB directly — all reads flow through this verified boundary.
🖥️
Operations UI
frontend/ (Flask)
Material-inspired internal dashboard. Shows health status, alert tables, SKU explorer with price history charts, and admin controls to freeze or force rule-based pricing.
📊
Monitoring & Alerts
monitoring_spec.md
Drift detection triggers retraining events that require human approval before any model version is promoted — preventing silent regressions from reaching production pricing.