Skip to content

feat: Add enterprise token consumption schema documentation#48

Open
Daniel Beer (DanielB945) wants to merge 1 commit intomainfrom
add-token-consumption-schema
Open

feat: Add enterprise token consumption schema documentation#48
Daniel Beer (DanielB945) wants to merge 1 commit intomainfrom
add-token-consumption-schema

Conversation

@DanielB945
Copy link
Collaborator

Summary

  • Added comprehensive documentation for backend_griffin_market token consumption tables (purchased_consumables, consumed_consumables, unified_payment_source, shared_subscription_group)
  • Created enterprise-token-pools.md with complete logic for shared vs non-shared token pools, enterprise org classification, and credit limit monitoring
  • Updated CLAUDE.md to reference new token pool documentation in shared knowledge table

Test Plan

  • Review documentation for accuracy against actual BigQuery schemas
  • Verify credit limit query examples are correct
  • Confirm enterprise organization logic matches business requirements

## Changes

### New Documentation
- **shared/enterprise-token-pools.md**: Comprehensive guide to shared vs non-shared token pools
  - Shared token pool logic (is_shared_token_pool flag)
  - Non-shared pool logic (McCann_NY, Cylndr, code users)
  - Enterprise organization classification
  - Complete credit limit monitoring queries
  - Code redemption tracking
  - Future user cap feature documentation

### Schema Updates (shared/bq-schema.md)
- **backend_griffin_market_purchased_consumables**: Token purchases and initial balances
  - Key fields: consumable_id, ltid, organization_id, is_shared_token_pool, quantity
  - Shared vs non-shared pool logic
  - Example queries for credit limit monitoring

- **backend_griffin_market_consumed_consumables**: Token consumption transactions
  - Key field: consumed_by_ltid (critical for shared pool attribution)
  - Consumption tracking by user

- **backend_griffin_market_unified_payment_source**: Payment sources and code redemptions
  - complimentary_code field for tracking code users
  - Code redemption query examples

- **backend_griffin_shared_subscription_group**: Shared subscription groups
  - has_shared_token_pool flag
  - Seat configurations and consumable offerings

### Reference Updates (CLAUDE.md)
- Added enterprise-token-pools.md to shared knowledge table
- Read before any enterprise token/billing analysis

## Context

These tables are critical for:
- Credit limit monitoring (Report 4 in daily reports)
- Enterprise account health tracking
- Token consumption analysis
- Code redemption tracking

## Key Insights

**Shared Token Pools (most enterprise orgs):**
- Records at ORG level: ltid = group_id
- Use consumed_by_ltid to track individual user consumption
- Examples: Indegene, HearWell_BeWell, Miroma, Deriv, McCann_Paris

**Non-Shared Pools:**
- Records at USER level: ltid = individual user
- Examples: McCann_NY, Cylndr Studios (SSO), code users

**McCann Special Case:**
- McCann_NY: Separate entity, non-shared pool
- McCann_Paris: Catch-all for other McCann offices, shared pool

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@DanielB945 Daniel Beer (DanielB945) force-pushed the add-token-consumption-schema branch from 350bdcb to 6df8a81 Compare March 16, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant