Profile service (Kaleido.Gre.Profile, :8083)
The profile service turns raw activity into affinity: a number from 0 to 1 per customer and game that says how much the customer likes that game right now. It is the batch half of the profile story; the live half is the Redis state kept by Ingest. Both use the same formula, described in Affinity.
API
| Method | Path | Purpose |
|---|---|---|
| GET | /customers/{customerId}/affinities?limit=50 | A customer's games, strongest first, with the three signal scores (limit 1 to 500) |
| GET | /affinities?after&size=200 | Bulk read for the recommender: customers in id order (size 1 to 2,000) |
| POST | /affinities/compute | Stateless what-if: affinities for activity sent in the body, with optional draft settings and asOf |
| GET, PUT | /settings | Read or save the affinity settings (bumps Revision) |
| POST | /builds?asOf= | Queue a full rebuild; 409 if one is queued or running |
| GET | /builds, /builds/{id} | Recent builds and their state |
| DELETE | /data | Truncate affinities and finished builds |
Settings
| Setting | Default | Range | Effect |
|---|---|---|---|
WindowDays | 60 | 1 to 730 | How far back activity is read |
HalfLifeDays | 14 | 0 to 365 | Days for an unplayed game's affinity to halve; 0 turns decay off |
CountWeight | 1 | 0 to 10 | Weight of the number of wagers |
AmountWeight | 1 | 0 to 10 | Weight of the money staked |
TimeWeight | 1 | 0 to 10 | Weight of the time played |
MinScore | 0.05 | 0 to 0.95 | Affinities below this are not stored |
Settings take effect on the next build. Each build records the SettingsRevision it used.
Build sequence
Two details make this safe:
- Build-tagged rows. Rows are upserted with the build id, and rows from older builds are deleted only after the walk completes. Readers always see a full set: the old one until the end, then the new one. A customer who went quiet drops out because no row of theirs carries the new id.
AsOfbuilds. A build "as of" a past moment uses that moment asnow: it reads activity only up to it and decays from it. This is what makes the holdout accuracy test fair: the system honestly cannot see the hidden days.
What-if sequence
Nothing is stored. Viewers may call both endpoints because they only compute.
Data model
| Table | Key | Columns |
|---|---|---|
affinity | (CustomerId, GameRef) | Score, CountScore, AmountScore, TimeScore, WagerCount, WagerAmount, SessionSeconds, LastPlayedAt, BuildId |
build | Id | State, SettingsRevision, AsOf, Customers, Affinities, Error, CreatedAt, FinishedAt |
settings | Id = 1 | The settings above plus Revision, UpdatedAt |
Indexes: (CustomerId, Score) for per-customer reads, GameRef, and BuildId for the end-of-build delete.