Data ownership
One rule holds across Kaleido GRE: each service owns one Postgres schema, and no other service reads or writes it. Other services reach that data only over the owner's HTTP API. All services share one Postgres instance for convenience; the schemas could move to separate databases without code changes beyond the connection string. Each service keeps its EF migrations history in its own schema (__ef_migrations), and applies migrations at start-up unless Db:AutoMigrate=false.
Postgres schemas
public (Taxonomy API)
| Table | Holds |
|---|---|
game | Catalogue: name, ExternalRef (the platform's game id, the key GRE uses), studio, type, release date, RTP, thumbnail, status |
taxonomy_node | Tree of categories and characteristics with synonyms and a single-value flag |
taxonomy_state | One row with the taxonomy version timestamp, bumped on every tree change |
game_characteristic | A game's tags: origin (Manual, Source, Inferred), confidence, evidence, source document ids, source URLs, channel and proposer |
tag_rejection | Tags a reviewer rejected for a game, so AI never proposes them again for that game |
game_document | Metadata of stored raw HTML pages (the HTML itself is on disk) |
source_conflict | Disagreements between a game's sources, reported by the AI |
tagging_run, tagging_item | Bulk AI tagging runs and their per-game work items |
ai_provider | Configured AI providers with encrypted API keys |
agent_prompt_version | Versioned tagging prompt, one active version |
similarity_settings | Tunable similarity weights, one row with a revision |
vector_snapshot, game_vector | Persisted tag vectors (pgvector sparsevec) and the fingerprint they were built for |
app_user | Users with password hash and role |
activity
| Table | Key | Holds |
|---|---|---|
transaction | EventId | Wagers and payouts: customer, game, kind, amount, currency, time, session |
session | SessionId | Continuous play on one game: start, end, duration |
Indexes on (CustomerId, GameRef, OccurredAt) and (GameRef, OccurredAt) serve per-customer aggregation and time-bounded scans.
profile
| Table | Holds |
|---|---|
affinity | Per customer and game: score, the three signal scores, raw totals, last played, and the build that wrote it |
build | Build runs with state, settings revision and optional AsOf time |
settings | One row of affinity settings with a revision |
recommender
| Table | Holds |
|---|---|
game | Copy of the active catalogue, keyed by GameRef |
neighbour | Neighbour links: Kind=0 tag similarity, Kind=1 co-play, with score and support |
popularity | Share of customers who really play each game |
build | Catalogue and crowd builds |
settings | One row of blend settings with a revision |
suppressed_customer | Player-protection list: customer, reason, optional end time |
simulator
| Table | Holds |
|---|---|
run | Batch simulation runs: seed, size, anchor date, counters |
customer | Ground truth: persona and favourite games per simulated customer |
Redis keys
| Key | Owner | Shape | Notes |
|---|---|---|---|
c:{customerId} | Ingest (writer), Recommender (reader) | Hash. g:{game} = bets,stake,seconds,atMs; o:{source} = last applied Kafka offset; v = version counter | Expires 30 days after the last write (Stream:KeyTtlDays) |
cfg:ingest:sources | Ingest | Hash of ingestion id to JSON config, passwords AES-GCM encrypted | Shared by every ingest instance |
cfg:ingest:meta | Ingest | Hash: rev (revision), local on or off, localrev | Supervisors poll rev |
Redis is not the source of truth: it can be rebuilt from Kafka (7-day retention) and from the activity archive.
Kafka topics
| Topic | Key | Value | Partitions |
|---|---|---|---|
transactions | customer id | TransactionEvent | 48 by default |
sessions | customer id | SessionEvent | 48 by default |
suppression | customer id | Latest suppression state | 48, cleanup.policy=compact |
Keying by customer puts one customer's events on one partition, in order. Formats and schemas are described in Live streaming.
Shared contracts
src/Kaleido.Gre.Contracts/Events.cs holds the only types GRE services share. It has no dependencies.
public record TransactionEvent(Guid EventId, string CustomerId, string GameRef, TransactionKind Kind,
decimal Amount, string Currency, DateTimeOffset OccurredAt, Guid? SessionId = null);
public record SessionEvent(Guid SessionId, string CustomerId, string GameRef, DateTimeOffset StartedAt, DateTimeOffset EndedAt);
public record GameActivity(string GameRef, int WagerCount, decimal WagerAmount, decimal PayoutAmount,
int SessionCount, double SessionSeconds, DateTimeOffset? LastPlayedAt);
GameRef is the platform's game id and matches game.ExternalRef in the Taxonomy API. Games without an ExternalRef are invisible to GRE.