Skip to main content

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)​

TableHolds
gameCatalogue: name, ExternalRef (the platform's game id, the key GRE uses), studio, type, release date, RTP, thumbnail, status
taxonomy_nodeTree of categories and characteristics with synonyms and a single-value flag
taxonomy_stateOne row with the taxonomy version timestamp, bumped on every tree change
game_characteristicA game's tags: origin (Manual, Source, Inferred), confidence, evidence, source document ids, source URLs, channel and proposer
tag_rejectionTags a reviewer rejected for a game, so AI never proposes them again for that game
game_documentMetadata of stored raw HTML pages (the HTML itself is on disk)
source_conflictDisagreements between a game's sources, reported by the AI
tagging_run, tagging_itemBulk AI tagging runs and their per-game work items
ai_providerConfigured AI providers with encrypted API keys
agent_prompt_versionVersioned tagging prompt, one active version
similarity_settingsTunable similarity weights, one row with a revision
vector_snapshot, game_vectorPersisted tag vectors (pgvector sparsevec) and the fingerprint they were built for
app_userUsers with password hash and role

activity​

TableKeyHolds
transactionEventIdWagers and payouts: customer, game, kind, amount, currency, time, session
sessionSessionIdContinuous play on one game: start, end, duration

Indexes on (CustomerId, GameRef, OccurredAt) and (GameRef, OccurredAt) serve per-customer aggregation and time-bounded scans.

profile​

TableHolds
affinityPer customer and game: score, the three signal scores, raw totals, last played, and the build that wrote it
buildBuild runs with state, settings revision and optional AsOf time
settingsOne row of affinity settings with a revision

recommender​

TableHolds
gameCopy of the active catalogue, keyed by GameRef
neighbourNeighbour links: Kind=0 tag similarity, Kind=1 co-play, with score and support
popularityShare of customers who really play each game
buildCatalogue and crowd builds
settingsOne row of blend settings with a revision
suppressed_customerPlayer-protection list: customer, reason, optional end time

simulator​

TableHolds
runBatch simulation runs: seed, size, anchor date, counters
customerGround truth: persona and favourite games per simulated customer

Redis keys​

KeyOwnerShapeNotes
c:{customerId}Ingest (writer), Recommender (reader)Hash. g:{game} = bets,stake,seconds,atMs; o:{source} = last applied Kafka offset; v = version counterExpires 30 days after the last write (Stream:KeyTtlDays)
cfg:ingest:sourcesIngestHash of ingestion id to JSON config, passwords AES-GCM encryptedShared by every ingest instance
cfg:ingest:metaIngestHash: rev (revision), local on or off, localrevSupervisors 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​

TopicKeyValuePartitions
transactionscustomer idTransactionEvent48 by default
sessionscustomer idSessionEvent48 by default
suppressioncustomer idLatest suppression state48, 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.