Skip to content

Commit 68a3aff

Browse files
Merge pull request #108 from code-dot-org/feature/dataops-657
adding us_intl label and country column to dim_user_course_activity
2 parents a43b2b6 + 882cd11 commit 68a3aff

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

dbt/models/marts/users/_users__models.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ models:
7777
tests:
7878
- not_null
7979

80+
- name: us_intl
81+
description: label for us / intl
82+
83+
- name: country
84+
description: the country associated with the individual user's activity in a given school year
85+
8086
- name: first_activity_at
8187
description: timestamp of the student's first activity within the given course and school year- this field is later used to determine when a section/school first started teaching
8288

dbt/models/marts/users/dim_user_course_activity.sql

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ school_years as (
5252
),
5353

5454
users as (
55-
select
56-
user_id,
57-
user_type
55+
select *
5856
from {{ ref('dim_users') }}
5957
),
6058

@@ -63,9 +61,12 @@ combined as (
6361
ul.user_id,
6462
u.user_type,
6563
sy.school_year,
64+
u.us_intl,
65+
u.country,
6666
cs.course_name_true as course_name,
6767
min(ul.created_at) as first_activity_at,
6868
max(ul.created_at) as last_activity_at
69+
6970
from user_levels ul
7071
join users u
7172
on ul.user_id = u.user_id
@@ -74,8 +75,10 @@ combined as (
7475
and ul.level_id = cs.level_id
7576
join school_years sy
7677
on ul.created_at
77-
between sy.started_at and sy.ended_at
78-
{{ dbt_utils.group_by(4) }}
78+
between sy.started_at
79+
and sy.ended_at
80+
81+
{{ dbt_utils.group_by(6) }}
7982
)
8083

8184
select *

0 commit comments

Comments
 (0)