Enrollment

Deals with the account file We call a product to refer to a specific credit card (with card number and all) Points account has a one-to-one relationship with a product

Core-Earn

Deals with the transaction file We have spend buckets to categorize customers based on the amount they spend over a time period

  • For example, a user might get 2 points per dollar for their first $1000 spent, then 1 point per dollar after that⁠ One product can have multiple spend buckets Some spend buckets have group_id=null these are for non-tiering rules

Campaign Engine

We have segments and campaigns A campaign target a customer segment

Points Bank

Stores the points for each user tranches table — each row represent an amount of points and link to a user and expiry (each user can have multiple rows in the tranches table) Each transaction has a many-to-many relationship with a tranche (one transaction can have multiple tranches and one tranche can have multiple transactions)

How to find out the total number of points for a user?

Isn’t that O(n) time? where n is the number of tranches? which can be very large

Reporting

Report via events or API

Process

raw_spend_transaction transaction