Skip to content

Commit ae5a685

Browse files
committed
add more docs
1 parent 6b64dd3 commit ae5a685

File tree

3 files changed

+69
-15
lines changed

3 files changed

+69
-15
lines changed

models/intermediate/intermediate.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,45 @@ models:
1212
values:
1313
- weekend
1414
- weekday
15+
- name: month_name_short
16+
description: The short name of the month
17+
tests:
18+
- not_null
19+
- accepted_values:
20+
values:
21+
- Jan
22+
- Feb
23+
- Mar
24+
- Apr
25+
- May
26+
- Jun
27+
- Jul
28+
- Aug
29+
- Sep
30+
- Oct
31+
- Nov
32+
- Dec
33+
- name: day_of_month
34+
description: The day of the month
35+
tests:
36+
- not_null
37+
- dbt_expectations.expect_column_values_to_be_between:
38+
min_value: 1
39+
max_value: 31
40+
- name: day_of_year
41+
description: The day of the year
42+
tests:
43+
- not_null
44+
- dbt_expectations.expect_column_values_to_be_between:
45+
min_value: 1
46+
max_value: 366
47+
- name: week_of_year
48+
description: The week of the year
49+
tests:
50+
- not_null
51+
- dbt_expectations.expect_column_values_to_be_between:
52+
min_value: 0
53+
max_value: 53
1554

1655
- name: dim_time
1756
description: A dimension table of time

models/marts/marts.yml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,9 @@ models:
88
description: Month of the year
99
tests:
1010
- not_null
11-
- accepted_values:
12-
values:
13-
- 1
14-
- 2
15-
- 3
16-
- 4
17-
- 5
18-
- 6
19-
- 7
20-
- 8
21-
- 9
22-
- 10
23-
- 11
24-
- 12
11+
- dbt_expectations.expect_column_values_to_be_between:
12+
min_value: 1
13+
max_value: 12
2514
- name: year
2615
description: Year
2716
tests:
@@ -42,10 +31,22 @@ models:
4231
description: Name of the day of the week of the peak moment of the month
4332
tests:
4433
- not_null
34+
- accepted_values:
35+
values:
36+
- Monday
37+
- Tuesday
38+
- Wednesday
39+
- Thursday
40+
- Friday
41+
- Saturday
42+
- Sunday
4543
- name: month_peak_day_of_month
4644
description: Day of the month of the peak moment of the month
4745
tests:
4846
- not_null
47+
- dbt_expectations.expect_column_values_to_be_between:
48+
min_value: 1
49+
max_value: 31
4950
- name: month_peak_day_type
5051
description: Type of the day of the peak moment of the month
5152
tests:
@@ -58,6 +59,16 @@ models:
5859
description: Whether the peak moment of the month is a holiday
5960
tests:
6061
- not_null
62+
- name: month_peak_part_of_day
63+
description: Part of the day of the peak moment of the month
64+
tests:
65+
- not_null
66+
- accepted_values:
67+
values:
68+
- morning
69+
- afternoon
70+
- evening
71+
- night
6172
- name: month_peak_value
6273
description: Peak value of the month
6374
tests:

models/marts/mrt_capacity_tariff.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ components as (
1313
u.from_timestamp,
1414
u.to_timestamp,
1515
u.usage * 4 as quarter_power,
16-
dd.*
16+
dd.*,
17+
tt.*
1718
from usage_data u
1819
left join {{ ref('dim_dates') }} dd
1920
on u.from_timestamp::date = dd.date_day
21+
left join {{ ref('dim_time') }} tt
22+
on u.from_timestamp::time = tt.moment
2023
),
2124

2225
month_peaks as (
@@ -43,6 +46,7 @@ with_avg as (
4346
d.day_type as month_peak_day_type,
4447
d.is_holiday as month_peak_is_holiday,
4548
p.month_peak as month_peak_value,
49+
d.part_of_day as month_peak_part_of_day,
4650
avg(p.month_peak) over (rows between 11 preceding and current row) as month_peak_12month_avg,
4751
from components d
4852
join month_peaks p

0 commit comments

Comments
 (0)