Skip to main content

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​

MethodPathPurpose
GET/customers/{customerId}/affinities?limit=50A customer's games, strongest first, with the three signal scores (limit 1 to 500)
GET/affinities?after&size=200Bulk read for the recommender: customers in id order (size 1 to 2,000)
POST/affinities/computeStateless what-if: affinities for activity sent in the body, with optional draft settings and asOf
GET, PUT/settingsRead 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/dataTruncate affinities and finished builds

Settings​

SettingDefaultRangeEffect
WindowDays601 to 730How far back activity is read
HalfLifeDays140 to 365Days for an unplayed game's affinity to halve; 0 turns decay off
CountWeight10 to 10Weight of the number of wagers
AmountWeight10 to 10Weight of the money staked
TimeWeight10 to 10Weight of the time played
MinScore0.050 to 0.95Affinities 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.
  • AsOf builds. A build "as of" a past moment uses that moment as now: 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​

TableKeyColumns
affinity(CustomerId, GameRef)Score, CountScore, AmountScore, TimeScore, WagerCount, WagerAmount, SessionSeconds, LastPlayedAt, BuildId
buildIdState, SettingsRevision, AsOf, Customers, Affinities, Error, CreatedAt, FinishedAt
settingsId = 1The settings above plus Revision, UpdatedAt

Indexes: (CustomerId, Score) for per-customer reads, GameRef, and BuildId for the end-of-build delete.