Skip to content

Config Registry

TÓM TẮT

configRegistry.ts (~900+ dòng) là single source of truth cho 21 loại config. Hỗ trợ in-memory defaults, database override (per-warehouse), và caching.

21 Config Keys

Foundation (6)

KeyMô tả
seasonalSeasonal patterns (monthly weights)
dowDay-of-week distribution
weekOfMonthWeek-of-month multipliers
paydayPayday configuration
baselineOptionsBAU baseline options
capacityCapacity settings

Sales (3)

KeyMô tả
doubleDaysDouble-day event configs
countrySalesCountry-specific sale events
seasonalEventsSeasonal event calendar

Models (3)

KeyMô tả
segmentConfigsEnsemble weights per segment
hwDefaultsHolt-Winters default parameters
quantileParamsConfidence interval parameters

Algorithms (2)

KeyMô tả
anomalyConfigAnomaly detection thresholds
tuningParamsAuto-tuning parameter ranges

Workforce (5)

KeyMô tả
workforceDefaultsDefault staffing settings
warehouseCodeMapWarehouse code mappings
warehouseSeasonalPer-warehouse seasonal adjustments
warehouseEventMultipliersPer-warehouse event multipliers
warehouseDailyAveragesPer-warehouse daily volume baselines

Monitoring (2)

KeyMô tả
monitorConfigAccuracy alert thresholds
laborLawConfigsLabor law configs (VN/TH/PH)

Database Integration

typescript
// Load config from Supabase with caching
await ConfigRegistry.loadFromDB(warehouseCode);

// Get config value (falls back to in-memory default)
const dowConfig = ConfigRegistry.get('dow');

Tài liệu liên quan

BoxMe Forecast — Tài liệu kỹ thuật nội bộ