feat: MetricFlow semantic layer for financial and economic metrics (#85)#97
Merged
Merged
Conversation
#85) Implements phase 1 of the dbt semantic layer across four domains: - markets/semantic_models.yml: S&P 500, sector, currency, fixed income daily prices - commodities/semantic_models.yml: input, energy, and agriculture commodity prices - government/semantic_models.yml: FRED monthly economic indicators - signals/semantic_models.yml: inflation (CPI/PCE/breakeven) and labor market signals metrics.yml defines 35 metrics covering equity returns, volatility, inflation gauges (CPI YoY, core PCE, breakeven spreads), and labor market indicators (Sahm Rule, JO/unemployed ratio, quits rate). saved_queries.yml provides 6 pre-built agent queries for equity performance, sector rotation, inflation dashboard, labor market dashboard, macro series scan, and commodity prices. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
semantic_models:for 10 dbt models across markets, commodities, government, and signals domainssaved_queries:for common agent questions: equity performance ranking, sector rotation, inflation dashboard, labor market dashboard, FRED series scan, commodity overviewKey design decisions
Semantic models map to analysis/signal models (not raw/staging) — these are the final grain-clean, documented models agents should query. Entities use composite string keys (
symbol|exchange) to avoid ambiguous primary keys in multi-exchange data.Metrics focus on what agents ask — trailing returns (1mo, 3mo, 6mo, 1yr), annualized volatility ratio (std/price), inflation momentum spread, Sahm Rule, and labor tightness ratio. All cross-reference FRED literature and Fed policy frameworks.
Saved queries are agent-ready — each query maps to a natural language question an LLM agent would ask (e.g., "which sectors are outperforming?", "is inflation re-accelerating?").
Test plan
dbt parsepasses once BigQuery adapter is available in CIdbt sl list metricsto confirm all 35 metrics are registereddbt sl query --metrics cpi_yoy --group-by inflation_month__signal_dateto smoke test inflation dashboarddbt sl query --metrics sahm_rule_indicator --group-by labor_month__signal_dateto smoke test labor dashboarddbt sl query --saved-query equity_performance_by_symbolCloses #85
🤖 Generated with Claude Code