Skip to content

Commit d83ca90

Browse files
chore: apply dbt project evaluator improvements
1 parent b074897 commit d83ca90

35 files changed

Lines changed: 1189 additions & 907 deletions

dbt_project/dbt_project.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,24 @@ clean-targets:
2020
# Schema values map to BigQuery datasets. generate_schema_name macro must
2121
# return the custom schema as-is (see macros/generate_schema_name.sql).
2222
models:
23+
dbt_project_evaluator:
24+
+enabled: "{{ var('enable_dbt_project_evaluator', false) }}"
2325
dbt_project:
2426
+materialized: table
2527
staging:
2628
+schema: economics_staging
2729
+materialized: view
30+
corporate_actions:
31+
+enabled: "{{ var('enable_legacy_staging_alias_models', false) }}"
32+
split_adjusted_prices:
33+
+enabled: "{{ var('enable_legacy_staging_alias_models', false) }}"
2834
markets:
2935
+schema: economics_marts
3036
+materialized: table
37+
major_indicies_summary:
38+
+enabled: "{{ var('enable_legacy_misspelled_market_models', false) }}"
39+
major_indicies_analysis_return:
40+
+enabled: "{{ var('enable_legacy_misspelled_market_models', false) }}"
3141
commodities:
3242
+schema: economics_marts
3343
+materialized: table

dbt_project/models/agents_preprocess/agent_market_performance.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ select
6464
period_end_price,
6565
'major_index' as market_category,
6666
cast(null as date) as snapshot_date
67-
from {{ ref('major_indicies_summary') }}
67+
from {{ ref('major_indices_summary') }}

dbt_project/models/agents_preprocess/agent_market_performance_snapshot.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ major_index_snapshot as (
7474
period_end_price,
7575
'major_index' as market_category,
7676
DATE_TRUNC(period_end_date, MONTH) as snapshot_date
77-
from {{ ref('major_indicies_summary') }}
77+
from {{ ref('major_indices_summary') }}
7878
{% if is_incremental() %}
7979
where DATE_TRUNC(period_end_date, MONTH) >= COALESCE(
8080
(select max(snapshot_date) from {{ this }}),

dbt_project/models/agents_preprocess/schema.yml

Lines changed: 128 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
models:
44
- name: agent_market_performance
55
description: >
6-
Union of market summary models (us_sector, major_indicies, sp500, nasdaq)
6+
Union of market summary models (us_sector, major_indices, sp500, nasdaq)
77
with standardized column names for agent consumption.
88
columns:
99
- name: symbol
@@ -58,34 +58,155 @@ models:
5858
- not_null
5959

6060
- name: agent_financial_conditions_index
61-
description: "Financial conditions index data for agent consumption"
61+
description: >
62+
Financial conditions index and component scores from the raw transformation output,
63+
filtered to populated FCI observations for agent consumption.
64+
columns:
65+
- name: date
66+
tests:
67+
- not_null
68+
- unique
69+
- name: fci
70+
tests:
71+
- not_null
6272

6373
- name: agent_fred_monthly_diff
64-
description: "FRED monthly differences for agent consumption"
74+
description: >
75+
Monthly FRED series observations and period-over-period differences for agent consumption.
76+
tests:
77+
- unique_combination:
78+
arguments:
79+
combination_of_columns: [series_code, date]
80+
columns:
81+
- name: series_code
82+
tests:
83+
- not_null
84+
- name: date
85+
tests:
86+
- not_null
6587

6688
- name: agent_housing_inventory_latest_aggregates
67-
description: "Housing inventory aggregates for agent consumption"
89+
description: >
90+
Latest housing inventory aggregate values and change metrics for agent consumption.
91+
tests:
92+
- unique_combination:
93+
arguments:
94+
combination_of_columns: [series_code, month, date_grain]
95+
config:
96+
severity: warn
97+
columns:
98+
- name: series_code
99+
tests:
100+
- not_null
101+
- name: month
102+
tests:
103+
- not_null
104+
- name: current_value
105+
tests:
106+
- not_null
68107

69108
- name: agent_housing_mortgage_rates
70-
description: "Housing mortgage rates for agent consumption"
109+
description: >
110+
Mortgage rate and estimated monthly payment series for agent consumption.
111+
columns:
112+
- name: date
113+
tests:
114+
- not_null
115+
- unique
71116

72117
- name: agent_reddit_posts_daily
73-
description: "Daily Reddit post aggregates for agent consumption"
118+
description: >
119+
Raw daily Reddit post records exposed for agent consumption.
120+
tests:
121+
- unique_combination:
122+
arguments:
123+
combination_of_columns: [title, subreddit, partition_date]
124+
config:
125+
severity: warn
126+
columns:
127+
- name: title
128+
tests:
129+
- not_null
130+
- name: subreddit
131+
tests:
132+
- not_null
133+
- name: partition_date
134+
tests:
135+
- not_null
74136

75137
- name: agent_reddit_sentiment_trends
76-
description: "Reddit sentiment trends for agent consumption"
138+
description: >
139+
Daily Reddit sentiment trend metrics by subreddit for agent consumption.
140+
tests:
141+
- unique_combination:
142+
arguments:
143+
combination_of_columns: [date, subreddit]
144+
columns:
145+
- name: date
146+
tests:
147+
- not_null
148+
- name: subreddit
149+
tests:
150+
- not_null
77151

78152
- name: agent_fred_series_latest_aggregates_snapshot
79153
description: "Snapshot view of FRED aggregates for agent consumption"
154+
tests:
155+
- unique_combination:
156+
arguments:
157+
combination_of_columns: [snapshot_date, series_code, month, date_grain]
158+
columns:
159+
- name: snapshot_date
160+
tests:
161+
- not_null
162+
- name: series_code
163+
tests:
164+
- not_null
80165

81166
- name: agent_leading_econ_return_indicator_snapshot
82167
description: "Snapshot view of leading economic return indicator for agent consumption"
168+
columns:
169+
- name: snapshot_date
170+
tests:
171+
- not_null
172+
- name: symbol
173+
tests:
174+
- not_null
83175

84176
- name: agent_market_performance_snapshot
85177
description: "Incremental snapshot of market performance for agent consumption"
178+
tests:
179+
- unique_combination:
180+
arguments:
181+
combination_of_columns: [snapshot_date, market_category, symbol, asset_type, time_period]
182+
config:
183+
severity: warn
184+
columns:
185+
- name: snapshot_date
186+
tests:
187+
- not_null
188+
- name: symbol
189+
tests:
190+
- not_null
86191

87192
- name: agent_commodity_performance_snapshot
88193
description: "Incremental snapshot of commodity performance for agent consumption"
194+
tests:
195+
- unique_combination:
196+
arguments:
197+
combination_of_columns: [snapshot_date, commodity_category, commodity_name, commodity_unit, time_period]
198+
columns:
199+
- name: snapshot_date
200+
tests:
201+
- not_null
202+
- name: commodity_name
203+
tests:
204+
- not_null
89205

90206
- name: agent_treasury_yield_curve_spreads
91207
description: "Incremental treasury yield curve spreads for agent consumption"
208+
columns:
209+
- name: date
210+
tests:
211+
- not_null
212+
- unique

dbt_project/models/analysis/base_historical_analysis.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ WITH return_data AS (
7676
high_1yr,
7777
low_1yr,
7878
std_diff_1yr,
79-
'major_indicies' AS category
80-
FROM {{ ref('major_indicies_analysis_return') }}
79+
'major_indices' AS category
80+
FROM {{ ref('major_indices_analysis_return') }}
8181

8282
UNION ALL
8383

dbt_project/models/analysis/schema.yml

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ models:
4747
- name: std_diff_1yr
4848
description: "Standard deviation difference over 1 year"
4949
- name: category
50-
description: "Asset category: currency, fixed_income, global_markets, major_indicies, or sector"
50+
description: "Asset category: currency, fixed_income, global_markets, major_indices, or sector"
5151
tests:
5252
- not_null
5353
- accepted_values:
5454
arguments:
55-
values: ['currency', 'fixed_income', 'global_markets', 'major_indicies', 'sector']
55+
values: ['currency', 'fixed_income', 'global_markets', 'major_indices', 'sector']
5656
- name: series_name
5757
description: "Name of the FRED economic series"
5858
- name: value
@@ -311,3 +311,53 @@ models:
311311
description: "Sector's average exposure across all macro factors"
312312
- name: factor_rank
313313
description: "Rank of this sector within the factor (1 = highest exposure)"
314+
315+
- name: commodity_market_signals
316+
description: >
317+
Daily commodity market health signals, including copper/gold, gold/SPY,
318+
and oil momentum indicators for market-regime analysis.
319+
columns:
320+
- name: date
321+
tests:
322+
- not_null
323+
- unique
324+
325+
- name: reddit_cross_subreddit_activity
326+
description: >
327+
Cross-subreddit story detection using shared URLs and repeated titles across
328+
financial and economic Reddit communities.
329+
tests:
330+
- unique_combination:
331+
arguments:
332+
combination_of_columns: [match_type, match_key, partition_date]
333+
config:
334+
severity: warn
335+
columns:
336+
- name: match_type
337+
tests:
338+
- not_null
339+
- accepted_values:
340+
arguments:
341+
values: ['url_match', 'title_match']
342+
- name: match_key
343+
tests:
344+
- not_null
345+
- name: partition_date
346+
tests:
347+
- not_null
348+
349+
- name: reddit_thread_structure
350+
description: >
351+
Thread-level Reddit comment structure metrics, including depth, reply ratio,
352+
controversy flags, and discussion quality by post.
353+
columns:
354+
- name: post_id
355+
tests:
356+
- not_null
357+
- unique
358+
- name: subreddit
359+
tests:
360+
- not_null
361+
- name: partition_date
362+
tests:
363+
- not_null

dbt_project/models/data_quality/dq_return_spikes.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ where
5050
-- Exclude known stock splits (these cause legitimate large price moves)
5151
and not exists (
5252
select 1
53-
from {{ ref('corporate_actions') }} ca
53+
from {{ ref('stg_corporate_actions') }} ca
5454
where ca.source_table = '{{ table_name }}'
5555
and ca.symbol = {{ table_name }}_returns.symbol
5656
and ca.date = {{ table_name }}_returns.date

dbt_project/models/data_quality/dq_zscore_anomalies.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ where
5959
-- Exclude dates within 2 days of a known stock split
6060
and not exists (
6161
select 1
62-
from {{ ref('corporate_actions') }} ca
62+
from {{ ref('stg_corporate_actions') }} ca
6363
where ca.source_table = '{{ table_name }}'
6464
and ca.symbol = {{ table_name }}_rolling.symbol
6565
and ca.action_type = 'split'

dbt_project/models/government/schema.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ models:
3939
Provides the most recent aggregated housing inventory metrics, offering a
4040
current snapshot of housing availability and market conditions. Updated
4141
daily with the latest available inventory data.
42+
tests:
43+
- unique_combination:
44+
arguments:
45+
combination_of_columns: [series_code, month, date_grain]
46+
config:
47+
severity: warn
48+
columns:
49+
- name: series_code
50+
tests:
51+
- not_null
52+
- name: month
53+
tests:
54+
- not_null
55+
- name: current_value
56+
tests:
57+
- not_null
4258

4359

4460
- name: housing_inventory
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ calculate_market_analysis_return('stg_major_indices') }}

0 commit comments

Comments
 (0)