|
1 | 1 | version: 2
|
2 | 2 |
|
3 |
| -models: |
| 3 | +models: |
| 4 | + - name: dim_active_students |
| 5 | + description: | |
| 6 | + This model serves as a **prototype** for the active student metric. (Please update this description as the metric is improved/modified.) |
| 7 | +
|
| 8 | + The model aggregates student activities _per user, per day_ across**: |
| 9 | + - `user_levels` |
| 10 | + - `sign-ins` |
| 11 | + - `projects` |
| 12 | +
|
| 13 | + ** the timestamps used for `user_level` and `projects` are the created_at timestamps right now. A better approach (in theory) would be to |
| 14 | + use updated_at, but we would need to start logging those daily. |
| 15 | +
|
| 16 | + columns: |
| 17 | + - name: activity_date |
| 18 | + description: "The date on which activity was recorded for the user, merged across all aggregated activity types." |
| 19 | + tests: |
| 20 | + - not_null |
| 21 | + data_type: "date" |
| 22 | + |
| 23 | + - name: user_id |
| 24 | + description: "The Code.org user id for a user, consolidated from any activity across user levels, sign-ins, and projects data." |
| 25 | + tests: |
| 26 | + - not_null |
| 27 | + data_type: "varchar" |
| 28 | + |
| 29 | + - name: user_type_merged |
| 30 | + description: "The type of user (e.g., student, teacher), sourced from the Code.org user profile." |
| 31 | + data_type: "varchar" |
| 32 | + |
| 33 | + - name: country |
| 34 | + description: "The country of the user, derived from Code.org user-geographical data linked to the user_id. The country is volitile - it maps to the user's _current_ geographic lociation, not necessarily their location at the time of the event, and it can change over time." |
| 35 | + data_type: "varchar" |
| 36 | + |
| 37 | + - name: us_intl |
| 38 | + description: "Classifies the `country` as U.S. or international (`us` or `intl`). International really means non-U.S." |
| 39 | + data_type: "varchar" |
| 40 | + |
| 41 | + - name: school_year |
| 42 | + description: "The school year during which the activity occurred, determined by matching the activity date with school year ranges. A school year is defined as the 365 days between July 1 in year 1, and June 30 in year 2." |
| 43 | + data_type: "varchar" |
| 44 | + |
| 45 | + - name: calendar_year |
| 46 | + description: "The calendar year extracted from the activity date, used for additional temporal analysis." |
| 47 | + data_type: "integer" |
| 48 | + |
| 49 | + - name: num_user_level_records |
| 50 | + description: "The number of new user level records created for the user on the given day." |
| 51 | + data_type: "integer" |
| 52 | + |
| 53 | + - name: num_project_records |
| 54 | + description: "The number of new projects created (project records) associated with the user for the given day." |
| 55 | + data_type: "integer" |
| 56 | + |
| 57 | + - name: num_sign_ins |
| 58 | + description: "The number of sign-in records for the user on the given day." |
| 59 | + data_type: "integer" |
| 60 | + |
| 61 | + - name: has_sign_in_activity |
| 62 | + description: "`0|1` flag indicating whether there was any sign-in activity for the user on the given day (1 for yes, 0 for no)." |
| 63 | + data_type: "integer" |
| 64 | + |
| 65 | + - name: has_user_level_activity |
| 66 | + description: "`0|1` flag indicating whether there was any user level activity for the user on the given day (1 for yes, 0 for no)." |
| 67 | + data_type: "integer" |
| 68 | + |
| 69 | + - name: has_project_activity |
| 70 | + description: "`0|1` flag indicating whether there was any project activity for the user on the given day (1 for yes, 0 for no)." |
| 71 | + data_type: "integer" |
| 72 | + |
| 73 | + - name: activity_type |
| 74 | + description: "A 3-character long string 'encoded' to represent the three possible types of activity present for the user on the given day: 'S' for sign-ins, 'L' for user levels, 'P' for projects, in that order; '_' represents absence of the respective activity. For example: `SL_` means that on this day the user has user_level activity and a sign-in record, but no project created. `__P` means only a project was created on this day for this user. This field reflects in a single sring the 0|1 values from the `has_[event]_activity` fields." |
| 75 | + data_type: "varchar" |
| 76 | + |
| 77 | + tests: |
| 78 | + - dbt_utils.unique_combination_of_columns: |
| 79 | + combination_of_columns: |
| 80 | + - user_id |
| 81 | + - activity_date |
4 | 82 |
|
5 | 83 | - name: dim_students
|
6 | 84 | description: This model contains all student accounts ever created + geographic info on the student
|
7 |
| - columns: |
8 |
| - - name: user_id |
9 |
| - description: unique ID for individual student user |
10 |
| - tests: |
11 |
| - - not_null |
12 |
| - - unique |
| 85 | + |
| 86 | + columns: |
| 87 | + - name: user_id |
| 88 | + description: unique ID for individual student user |
| 89 | + tests: |
| 90 | + - not_null |
| 91 | + - unique |
| 92 | + |
13 | 93 |
|
14 | 94 | # - name: user_type
|
15 | 95 | # description: always "student"- used for verification
|
16 | 96 | # tests:
|
17 | 97 | # - not_null
|
18 | 98 |
|
19 |
| - - name: created_at_school_year |
20 |
| - description: the school year in which the student account was created |
21 |
| - |
22 |
| - - name: gender |
23 |
| - description: the classified gender of a student based on their free-response input |
24 |
| - |
25 |
| - - name: is_urg |
26 |
| - description: flag to determine whether a student selected at least one of the following races- black, hispanic, hawaiian/ pacific islander, native american |
27 |
| - |
28 |
| - - name: is_international |
29 |
| - description: 1 if last activity was outside the US, 0 otherwise |
| 99 | + - name: created_at_school_year |
| 100 | + description: the school year in which the student account was created |
| 101 | + |
| 102 | + - name: gender |
| 103 | + description: the classified gender of a student based on their free-response input |
| 104 | + |
| 105 | + - name: is_urg |
| 106 | + description: flag to determine whether a student selected at least one of the following races- black, hispanic, hawaiian/ pacific islander, native american |
| 107 | + |
| 108 | + - name: is_international |
| 109 | + description: 1 if last activity was outside the US, 0 otherwise |
| 110 | + |
| 111 | + - name: school_id |
| 112 | + description: school association of student |
30 | 113 |
|
31 |
| - - name: school_id |
32 |
| - description: school association of student |
| 114 | + # - name: user_type |
| 115 | + # description: always "student"- used for verification |
| 116 | + # tests: |
| 117 | + # - not_null |
33 | 118 |
|
34 | 119 | # - name: dim_student_status
|
35 | 120 | # description: This model categorizes students based on their activity status across different school years. It provides insights into user engagement by assigning a status that reflects their activity in the current, previous, and any earlier school years.
|
36 |
| -# columns: |
| 121 | +# columns: |
37 | 122 | # - name: student_id
|
38 | 123 | # description: the unique ID associated with the activity
|
39 | 124 | # - name: school_year
|
|
0 commit comments