diff --git a/src/ol_dbt/models/reporting/_reporting__models.yml b/src/ol_dbt/models/reporting/_reporting__models.yml index 6bb091fcb..f2b2865bc 100644 --- a/src/ol_dbt/models/reporting/_reporting__models.yml +++ b/src/ol_dbt/models/reporting/_reporting__models.yml @@ -1370,3 +1370,33 @@ models: - name: user_latest_row_desc description: integer, row number indicating the latest row for each user based on application and course run dates + +- name: instructor_module_problems_report + description: A report showing learner problem data for later roll-up at the instructor + level. + columns: + - name: user_email + description: string, email address of the user + - name: full_name + description: string, full name of the user + - name: courserun_readable_id + description: string, unique identifier for the course run formatted as course-v1:{org}+{course + code}+{run_tag} + - name: section_title + description: string, title of the chapter (section) block within the course + - name: subsection_title + description: string, title of the sequential (subsection) block within the course + - name: problem_name + description: string, name of the problem + - name: attempt + description: int, attempt number for the user's submission + - name: success + description: string, correctness of the attempt (e.g. 'correct' or 'incorrect') + - name: grade + description: number, grade received for this attempt + - name: platform + description: string, platform code (e.g. mitxonline, mitxpro, edxorg, residential) + - name: course_title + description: string, title of the course + - name: organization_name + description: string, name of the organization diff --git a/src/ol_dbt/models/reporting/instructor_module_problems_report.sql b/src/ol_dbt/models/reporting/instructor_module_problems_report.sql new file mode 100644 index 000000000..68c0bfbe7 --- /dev/null +++ b/src/ol_dbt/models/reporting/instructor_module_problems_report.sql @@ -0,0 +1,88 @@ +with enrollment as ( + select * from {{ ref('tfact_enrollment') }} +) + +, user as ( + select * from {{ ref('dim_user') }} +) + +, course_run as ( + select * from {{ ref('dim_course_run') }} + where is_current = true +) + +, problem as ( + select * from {{ ref('dim_problem') }} +) + +, problem_events as ( + select * from {{ ref('tfact_problem_events') }} +) + +, course_content as ( + select * from {{ ref('dim_course_content') }} +) + +, course as ( + select * from {{ ref('dim_course') }} + where is_current = true +) + +, organization_courserun as ( + select * from {{ ref('bridge_organization_courserun') }} +) + +, organization as ( + select * from {{ ref('dim_organization') }} +) + +select + user.email as user_email + , user.full_name + , course_run.courserun_readable_id + , section.block_title as section_title + , subsection.block_title as subsection_title + , problem.problem_name + , problem_events.attempt + , problem_events.success + , problem_events.grade + , enrollment.platform + , course.course_title + , organization.organization_name +from enrollment +inner join user + on enrollment.user_fk = user.user_pk +inner join course_run + on enrollment.courserun_fk = course_run.courserun_pk +inner join problem + on + course_run.courserun_readable_id = problem.courserun_readable_id + and course_run.platform = problem.platform +left join problem_events + on + problem.problem_block_pk = problem_events.problem_block_fk + and problem.platform = problem_events.platform + and problem.courserun_readable_id = problem_events.courserun_readable_id + and user.user_pk = problem_events.user_fk +left join course_content as content + on + problem.content_block_fk = content.content_block_pk + and content.is_latest = true +left join course_content as section + on + content.chapter_block_id = section.block_id + and content.platform = section.platform + and content.courserun_readable_id = section.courserun_readable_id + and section.is_latest = true +left join course_content as subsection + on + content.sequential_block_id = subsection.block_id + and content.platform = subsection.platform + and content.courserun_readable_id = subsection.courserun_readable_id + and subsection.is_latest = true +left join course + on course_run.course_fk = course.course_pk +left join organization_courserun + on course_run.courserun_pk = organization_courserun.courserun_fk +left join organization + on organization_courserun.organization_fk = organization.organization_pk