Giao diện
Schema Cơ sở dữ liệu
TÓM TẮT
BoxMe Forecast sử dụng Supabase PostgreSQL với 12+ bảng chia làm 2 nhóm: bảng nghiệp vụ (transactions, warehouses, customers) và bảng ML pipeline (forecast_results, training_jobs, backtest_results...).
Sơ đồ quan hệ tổng thể
Bảng nghiệp vụ
Xem chi tiết tại Bảng nghiệp vụ.
| Bảng | Mục đích | Cột chính |
|---|---|---|
transactions | Dữ liệu đơn hàng gốc | client_id, user_id, product_id, quantity, purchased_at |
warehouses | Cấu hình kho | code, standard_tables, shifts_config, staff_config |
customers | Danh sách khách hàng | customer_code, primary_warehouse_id, tier |
operational_settings | Cấu hình vận hành | target_pick_uph, target_pack_uph, shift_hours |
productivity_standards | Tiêu chuẩn năng suất | warehouse_id, work_type, staff_level, uph |
Bảng ML Pipeline
Xem chi tiết tại Bảng ML Pipeline.
| Bảng | Mục đích | Cột chính |
|---|---|---|
forecast_results | Kết quả dự báo | series_key, forecast_date, predicted_quantity, confidence_* |
model_metadata | Registry model đã train | model_name, metrics, feature_importance |
training_jobs | Tracking training jobs | job_id, status, config, metrics |
backtest_results | Kết quả backtest | cycle_id, fold_number, wmape, bias, fnr |
sku_metadata | Phân loại SKU | product_id, sku_type, avg_daily_demand, cv |
improvement_cycles | State AutoML | cycle_id, state, mape_history |
llm_suggestions | Gợi ý từ LLM | category, parameter_diff, status |
discovered_events | Sự kiện auto-discovered | event_date, confidence, estimated_weight |
data_profiles | Snapshot phân tích | client_id, profile_data (JSONB) |
anomaly_log | Log anomaly | severity, details |
llm_providers | Cấu hình LLM API | provider_name, model_name, is_active |
model_comparisons | A/B test results | model_a_id, model_b_id, comparison_metrics |
SQL Schema
File definition đầy đủ: forecast_engine/src/data/sql_schemas.sql
Tài liệu liên quan
- Bảo mật & RLS — Row Level Security policies
- Kiến trúc — Cách database fit vào kiến trúc tổng thể