Skip to content
Open
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
12 changes: 12 additions & 0 deletions src/ol_dbt/models/reporting/_reporting__models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,24 @@ models:
(audit and verified), certificates and program credentials aggregated for each
program.
columns:
- name: platform
description: str, name of the platform
- name: program_name
description: str, name of the program. If program is split over multiple tracks,
the program name is the same for all tracks. e.g. Data, Economics, and Design
of Policy
tests:
- not_null
- name: program_type
description: str, the type of the program. Possible values are 'MicroMasters',
'XSeries' and 'Professional Certificate'
- name: program_track
description: str, name of the specific track for MicroMasters programs. For example,
Statistics and Data Science program has multiple tracks - General Track, Methods
Track, Social Sciences Track, and 'Time Series and Social Sciences Track'.
- name: program_readable_id
description: str, readable ID from xpro or mitxonline formatted as program-v1:{org}+{program
code} e.g.program-v1:xPRO+MLx
- name: total_enrollments
description: int, count of course enrollments in the program, aggregated by user_email
and courserun_readable_id
Expand Down
30 changes: 22 additions & 8 deletions src/ol_dbt/models/reporting/program_summary_report.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ with program_enrollments as (

, aggregated_course_enrollments as (
select
program_courses.program_name
program_courses.platform
, program_courses.program_readable_id
, program_courses.program_name
, count(distinct course_enrollments.courserun_readable_id || course_enrollments.user_email) as total_enrollments
, count(distinct course_enrollments.user_email) as unique_users
, count(distinct course_enrollments.user_country_code) as unique_countries
Expand Down Expand Up @@ -42,20 +44,32 @@ with program_enrollments as (
) as unique_course_certificate_earners
from course_enrollments
inner join program_courses on course_enrollments.course_readable_id = program_courses.course_readable_id
group by program_courses.program_name
group by
program_courses.platform
, program_courses.program_readable_id
, program_courses.program_name
)

, aggregated_program_certificates as (
select
program_name
, count(distinct user_email) as program_certificates
program_type
, program_track
, program_readable_id
, count(distinct case when user_has_completed_program = true then user_email end)
as program_certificates
from program_enrollments
where user_has_completed_program = true
group by program_name
group by
program_type
, program_track
, program_readable_id
)

select
aggregated_course_enrollments.program_name
aggregated_course_enrollments.platform
, aggregated_course_enrollments.program_name
, aggregated_program_certificates.program_type
, aggregated_program_certificates.program_track
, aggregated_course_enrollments.program_readable_id
, aggregated_course_enrollments.total_enrollments
, aggregated_course_enrollments.unique_users
, aggregated_course_enrollments.unique_countries
Expand All @@ -66,4 +80,4 @@ select
, aggregated_program_certificates.program_certificates
from aggregated_course_enrollments
left join aggregated_program_certificates
on aggregated_course_enrollments.program_name = aggregated_program_certificates.program_name
on aggregated_course_enrollments.program_readable_id = aggregated_program_certificates.program_readable_id