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

Enrollment Metrics Rework #214

Merged
merged 5 commits into from
May 17, 2020
Merged

Enrollment Metrics Rework #214

merged 5 commits into from
May 17, 2020

Conversation

johnbaldwin
Copy link
Contributor

Added new figures.pipeline.enrollment_metrics module to conditionally retrieve progress data from the platform depending on the states of StudentModule and LearnerCourseGradeMetrics models for the given CourseEnrollment

Running CourseGradeFactory().read(..) is costly and needed to retrieve dynamic grades when persistent grades is not enabled or supported (as is the case with Ginkgo). This PR addresses this

The existing get_average_progress method is renamed to get_average_progress_deprecated instead of just deleting it. This is so we have the code available in production to support troubleshooting and validation

The individual commits, commit messages and inline documentation should explain details for this PR

This module processes data to provide course enrollment metrics. Course
enrollment is a unique learner/course pair.

See the source code in this commit for documentation
- Added `course_enrollments_for_course`
- Added `student_modules_for_course_enrollment`

This is to support the course progress pipeline performance improvement
code restructuring. The purpose of adding these functions is to move
forward with using `figures.sites` as the source of platform data. To
note, there are a number of places in the code that do not follow this.
As we rework Figures, we will refactor code to use `figures.sites`
instead of directly querying the platform models.

Note the function name change from the existing functions. We are moving
away from using the `get_` prefix for the site functions.
…work

- Updated figures.pipeline.course_daily_metrics loader to use the new
enrollment pipeline code
- Renamed `get_average_progress` to `get_average_progress_deprecated`
and retained if needed to help debug the new enrollment metrics
- Updated tests to support these changes
@johnbaldwin johnbaldwin force-pushed the john/rework-course-progress branch from 60ff839 to 3d82184 Compare May 13, 2020 05:26
@johnbaldwin
Copy link
Contributor Author

I need to look into this. Pylint seems to think that the queryset is a list

https://travis-ci.org/github/appsembler/figures/jobs/686429867#L665

The code it complains about is this:

    most_recent_lcgm = LearnerCourseGradeMetrics.objects.filter(
        user=course_enrollment.user,
        course_id=str(course_enrollment.course_id)).order_by('date_for').last()

Copy link
Contributor

@OmarIthawi OmarIthawi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @johnbaldwin. I need to take another look at it. It's not a tiny code, so I could use some hints from you in the Logic section.

# Logic

```
for each learner+course
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great section! Would you mind adding references in the logic to which function I should take a look at e.g.

Suggested change
for each learner+course
for each learner+course # see `main` function

Copy link
Contributor Author

@johnbaldwin johnbaldwin May 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do!
Edit: After trying this out, I decided to be sparse with referencing which functions get called and focused on readability

get newest lgcm record
get newest sm record

if not lcgm and not sm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if not lcgm and not sm
if not lcgm and not sm # see `func_123`

@OmarIthawi OmarIthawi self-requested a review May 13, 2020 14:12
Copy link
Contributor

@melvinsoft melvinsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnbaldwin I didn't have the time to review all the test, but I'm approving you since the logic changes makes total sense, and it's well documented.

Thanks! Great work!

Copy link

@tkeemon tkeemon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not in a position to test this locally, but the logic here looks good. Hopefully this speeds up the nightly grade calculation.

@johnbaldwin johnbaldwin force-pushed the john/rework-course-progress branch from 975a341 to d40dc78 Compare May 16, 2020 23:35
@johnbaldwin
Copy link
Contributor Author

Fixed the pylint failure. Looks like an issue with pylint-django: pylint-dev/pylint-django#165

@johnbaldwin johnbaldwin merged commit 7961f4f into master May 17, 2020
@johnbaldwin johnbaldwin deleted the john/rework-course-progress branch May 17, 2020 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants