-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
BSL supports calc_measures in the Python API (SemanticModel(calc_measures={...})) but not in YAML definitions. This means derived metrics like fraud_rate = fraud_volume / transaction_volume must inline the full expression:
fraud_rate:
expr: (_.has_fraudulent_dispute.cast("int64") * _.eur_amount).sum() / _.eur_amount.sum()Instead of the more maintainable:
calculated_measures:
fraud_rate:
expr: fraud_volume / transaction_volume
description: "Fraud rate as ratio of fraudulent volume to total volume"Proposal
Add a calculated_measures section to the YAML schema that allows referencing other measures by name. This would:
- Parse
calculated_measuresinfrom_yaml()/from_config() - Resolve measure references at evaluation time
- Pass them through to
SemanticModel(calc_measures=...)
Why
- DRY: Avoid duplicating aggregation logic across measures
- Readability:
fraud_volume / transaction_volumeis clearer than the inlined version - Consistency: The Python API already supports this via
calc_measuresparam - LLM agents: Agents reading
semantic_model.ymlcan better understand metric relationships when they see explicit references
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request