Files
loyalty-agent-service/docs/knowledge-refs/campaign/criteria_operators.md

5.1 KiB
Raw Blame History

ref_id, parent_card, title, domain, ref_type, tags
ref_id parent_card title domain ref_type tags
campaign/criteria_operators campaign/campaign_rule Chi tiết Criteria Operators (Rule Criteria Operators) campaign enum_detail
criteria
operators
query builder
AND
OR
condition

Chi tiết Criteria Operators (Rule Criteria Operators)

Thuộc về

campaign/campaign_rule — Card tóm tắt Criteria Operators thành 1 dòng: "Operators: String (Is in, Contains...), Number (Between, Greater...), Date (Fixed, Period...)". Reference này liệt kê TOÀN BỘ operators cho mỗi data type để model nhỏ trả lời chính xác.

Chi tiết

Operators theo Data Type

String / Lookup

Operator Mô tả Ví dụ
Is in Giá trị nằm trong danh sách Customer Status Is in [Active, Inactive]
Is not in Giá trị KHÔNG nằm trong danh sách MCC Is not in [5411, 5412]
Contains Chuỗi chứa text con Customer Name Contains "Nguyễn"
Equal to Bằng chính xác Account Type Equal to "Visa Platinum"
Not equal to Không bằng Gender Not equal to "Male"
Starts with Bắt đầu bằng Card No Starts with "4123"
Ends with Kết thúc bằng Phone Ends with "999"
Is null Giá trị rỗng/null Email Is null
Is not null Giá trị có dữ liệu Email Is not null

Number

Operator Mô tả Ví dụ
Equal Bằng Transaction Count Equal 10
Not equal Không bằng Amount Not equal 0
Less than Nhỏ hơn Age Less than 18
Less than or equal Nhỏ hơn hoặc bằng Amount Less than or equal 500000
Greater than Lớn hơn Nett Amount Greater than 100000
Greater than or equal Lớn hơn hoặc bằng Counter Value >= 5000000
Between Trong khoảng Amount Between 100000 AND 500000
Is null Giá trị rỗng Income Is null
Is not null Giá trị có dữ liệu Income Is not null

Date

Operator Mô tả Ví dụ
On or before Vào ngày hoặc trước Registration Date On or before 2024-01-01
On or after Vào ngày hoặc sau DOB On or after 1990-01-01
Fixed date Đúng ngày cụ thể Transaction Date Fixed date 2024-06-15
Between date range Trong khoảng ngày Transaction Date Between 2024-01-01 AND 2024-12-31
Between period from N So sánh dynamic Last Transaction Between period from 3 months ago

Ghi chú Date: Một số Date operators hỗ trợ so sánh Day/Month bỏ qua Year (VD: DOB ngày 15/03 bất kể năm nào) — dùng cho criteria sinh nhật.

Day of Week

Operator Mô tả Ví dụ
Is the day of week Ngày trong tuần Transaction Date Is the day of week [Monday, Friday]

Giá trị: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.

Time

Operator Mô tả Ví dụ
Is between Trong khoảng thời gian Transaction Time Is between 09:00 AND 17:00

Format: HH:mm (00:00 23:59).

Boolean

Operator Mô tả Ví dụ
Is True hoặc False Is Primary Card Is True

Criteria Categories

Criteria được nhóm theo 6 danh mục:

Category Áp dụng cho Ví dụ fields
Customer Thông tin khách hàng CIF, Customer Status, Gender, DOB, Income, Registration Date
Account Thông tin tài khoản Account Type, Account Status, Account Open Date
Transaction Dữ liệu giao dịch Nett Amount, Transaction Date, Transaction Time, Currency
Attribute Custom attributes Bất kỳ attribute nào đã cấu hình (VD: Membership Tier)
Counter Giá trị Counter tích lũy Counter Value, Counter Bucket (Current/Previous)
Merchant Thông tin merchant Corporation, Chain, Store, MCC (Merchant Category Code)

Logic Grouping Rules

Rule Mô tả
AND / OR Criteria trong cùng 1 group kết hợp bằng AND hoặc OR
Multi-group 1 Rule có thể có nhiều groups, nhưng logic GIỮA các groups phải nhất quán (tất cả AND hoặc tất cả OR)
NOT toggle Mỗi condition có thể bật NOT để đảo ngược (VD: NOT MCC Is in [5411])

Ví dụ cụ thể

Criteria phức tạp — "Thưởng 2x cho VIP ăn uống cuối tuần":

Group 1 (AND):
  - Customer: Membership Tier Equal to "VIP"        ← Attribute operator
  - Transaction: Nett Amount Greater than 100000     ← Number operator
  
Group 2 (AND):                                       ← Inter-group: AND
  - Merchant: MCC Is in [5411, 5412, 5441, 5499]   ← String/Lookup operator
  - Transaction: Day of week Is [Saturday, Sunday]   ← Day of week operator
  - Transaction: Time Is between 11:00 AND 22:00     ← Time operator

Kết quả: Chỉ kích hoạt Rule khi khách VIP chi tiêu > 100K tại merchant ăn uống vào cuối tuần giờ 11h-22h.

Criteria đơn giản — "Thưởng cho mọi giao dịch":

Group 1 (AND):
  - Transaction: Nett Amount Greater than 0          ← Chỉ cần amount > 0