Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add fact_current_enrollments model #101

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions models/enrollment/fact_current_enrollments.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
with
enrollments as (
select course_key, actor_id, enrollment_mode, enrollment_status, emission_time,
from {{ ref("fact_enrollment_status") }} FINAL
where enrollment_status = 'registered'
)

select
enrollments.emission_time as emission_time,
courses.org as org,
courses.course_key as course_key,
courses.course_name as course_name,
courses.course_run as course_run,
enrollments.actor_id as actor_id,
enrollments.enrollment_mode as enrollment_mode,
enrollments.enrollment_status as enrollment_status,
users.username as username,
users.name as name,
users.email as email
from enrollments
join {{ ref("course_names") }} courses on enrollments.course_key = courses.course_key
left outer join
{{ ref("dim_user_pii") }} users on toUUID(actor_id) = users.external_user_id
40 changes: 40 additions & 0 deletions models/enrollment/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,43 @@ models:
- name: emission_time
data_type: datetime
description: "The time the enrollment status was emitted"

- name: fact_current_enrollments
description: "One record per learner per course for the most recent enrollment status with additional learner information"
columns:
- name: emission_time
data_type: DateTime
description: "Timestamp, to the second, of when this event was emitted"
- name: org
data_type: String
description: "The organization that the course belongs to"
- name: course_key
data_type: String
description: "The course key for the course"
- name: course_name
data_type: String
description: "The name of the course"
- name: course_run
data_type: String
description: "The course run for the course"
- name: actor_id
data_type: String
description: "The xAPI actor identifier"
- name: enrollment_mode
data_type: LowCardinality(String)
description: "The mode of enrollment"
- name: enrollment_status
description: "Whether a learner is actively enrolled in a course"
tests:
- accepted_values:
values: ["registered", "unregistered"]
data_type: String
- name: username
data_type: String
description: "The username of the learner"
- name: name
data_type: String
description: "The full name of the learner"
- name: email
data_type: String
description: "The email address of the learner"
Loading