mirror of https://github.com/buster-so/buster.git
95 lines
3.1 KiB
YAML
95 lines
3.1 KiB
YAML
models:
|
|
# Base model representing cultural entities
|
|
- name: culture
|
|
description: Core model for cultural groups
|
|
dimensions:
|
|
- name: cultureid
|
|
description: Unique identifier for the culture
|
|
- name: name
|
|
description: Culture name
|
|
options: ["Western", "Eastern"]
|
|
measures:
|
|
- name: revenue
|
|
description: Revenue generated by the culture
|
|
filters:
|
|
# Complex filter using columns from logins and subscriptions
|
|
- name: active_subscribed_customer
|
|
expr: logins.login_count > {threshold} AND subscriptions.subscription_status = 'active'
|
|
args:
|
|
- name: threshold
|
|
type: integer
|
|
description: Minimum number of logins
|
|
description: Customers with logins above threshold and active subscription
|
|
metrics:
|
|
# Metric using relationship columns, requires deduplication for many-to-many
|
|
- name: popular_product_revenue
|
|
expr: SUM(revenue) WHERE culture_products.product_count > 5
|
|
description: Revenue from cultures with popular products
|
|
relationships:
|
|
- name: logins
|
|
source_col: cultureid
|
|
ref_col: cultureid
|
|
type: LEFT # Explicitly set, but LLM could override
|
|
cardinality: one-to-many
|
|
description: Links to login activity
|
|
- name: subscriptions
|
|
source_col: cultureid
|
|
ref_col: cultureid
|
|
cardinality: one-to-one
|
|
description: Links to subscription data (no type, LLM decides)
|
|
- name: culture_products
|
|
source_col: cultureid
|
|
ref_col: cultureid
|
|
cardinality: many-to-many
|
|
description: Links to product associations (many-to-many via junction)
|
|
|
|
# Model for login activity
|
|
- name: logins
|
|
description: Tracks user logins by culture
|
|
dimensions:
|
|
- name: cultureid
|
|
description: Foreign key to culture
|
|
measures:
|
|
- name: login_count
|
|
description: Number of logins
|
|
relationships:
|
|
- name: culture
|
|
source_col: cultureid
|
|
ref_col: cultureid
|
|
cardinality: many-to-one
|
|
|
|
# Model for subscriptions
|
|
- name: subscriptions
|
|
description: Subscription status for cultures
|
|
dimensions:
|
|
- name: cultureid
|
|
description: Foreign key to culture
|
|
- name: subscription_status
|
|
description: Current subscription status
|
|
options: ["active", "inactive"]
|
|
relationships:
|
|
- name: culture
|
|
source_col: cultureid
|
|
ref_col: cultureid
|
|
cardinality: one-to-one
|
|
|
|
# Junction model for many-to-many between culture and products
|
|
- name: culture_products
|
|
description: Junction table linking cultures to products
|
|
dimensions:
|
|
- name: cultureid
|
|
description: Foreign key to culture
|
|
- name: productid
|
|
description: Foreign key to products
|
|
measures:
|
|
- name: product_count
|
|
description: Number of products in this association
|
|
relationships:
|
|
- name: culture
|
|
source_col: cultureid
|
|
ref_col: cultureid
|
|
cardinality: many-to-many
|
|
- name: products
|
|
source_col: productid
|
|
ref_col: productid
|
|
cardinality: many-to-many |