Skip to content

KPI Module

Mục đích

Quản lý KPI nghiệp vụ: tạo KPI, theo dõi tiến độ, cập nhật trạng thái và xem chi tiết thực hiện. Đây là module tác nghiệp, khác với report KPI ở chỗ nó quản lý đối tượng KPI gốc.

Quy mô

  • 4 FE pages
  • 107 FE components
  • 1 GraphQL file
  • 4 nhóm nghiệp vụ chính

Actors & Permissions

Nhóm chức năngQuyền
KPI managementKPI_PERMISSIONS
Navigation"Quản lý KPI" với icon riêng

Feature Groups

GroupMô tảPages
KPI ListDanh sách KPI, filter, trạng tháiKPIs.tsx
KPI CreateTạo KPI mớiKPICreate.tsx
KPI DetailXem KPI, các tab/detail phụKPIDetail.tsx
KPI UpdateCập nhật tiến độ, trạng thái, thời gianKPIUpdate.tsx

Liên kết Modules

  • settings — KPI config và metric setup nằm ở settings
  • report — report KPI đọc dữ liệu KPI để tổng hợp
  • dashboard — một số dashboard/rank có liên quan KPI
  • user — participant, assignee, branch, role dimensions

Backend Services

ServiceVai trò
controller (Hasura)CRUD KPI entities
ecommerce-apiEvent handlers kpi_branch_*, kpi_staff_*, scheduler kpi_notification

Databases

DBKey tables
ecommercekpi, kpi_metric, kpi_metric_relation, kpi_metric_relation_log, participant-related tables
defaultmodule/permission metadata cho KPI

Đặc điểm kiến trúc

  • Module chỉ có 4 page nhưng số component rất cao, cho thấy phần lớn độ phức tạp nằm ở forms, progress, status và nested detail UI.
  • KPIDetail có nhiều redirect/tab children trong route tree dù bên ngoài chỉ nhìn thấy một page detail.
  • KPI lifecycle được hỗ trợ bởi backend events/schedulers, không chỉ là CRUD thuần.

Deep Dives

  • lifecycle-and-notification — computed lifecycle, progress runtime qua KPI logs, event/scheduler notification và kpi_permission boundary