lms.djangoapps.instructor_analytics package#
Subpackages#
Submodules#
lms.djangoapps.instructor_analytics.basic module#
Student and course analytics.
Serve miscellaneous course and student data
- lms.djangoapps.instructor_analytics.basic.coupon_codes_features(features, coupons_list, course_id)#
Return list of Coupon Codes as dictionaries.
coupon_codes_features would return [
{‘course_id’: ‘edX/Open_DemoX/edx_demo_course,, ‘discount’: ‘213’ ….. } {‘course_id’: ‘edX/Open_DemoX/edx_demo_course,, ‘discount’: ‘234’ ….. }
]
- lms.djangoapps.instructor_analytics.basic.course_registration_features(features, registration_codes, csv_type)#
Return list of Course Registration Codes as dictionaries.
course_registration_features would return [
{‘code’: ‘code1’, ‘course_id’: ‘edX/Open_DemoX/edx_demo_course, ….. } {‘code’: ‘code2’, ‘course_id’: ‘edX/Open_DemoX/edx_demo_course, ….. }
]
- lms.djangoapps.instructor_analytics.basic.dump_grading_context(course)#
Render information about course grading context (e.g. which problems are graded in what assignments) Useful for debugging grading_policy.json and policy.json
Returns HTML string
- lms.djangoapps.instructor_analytics.basic.enrolled_students_features(course_key, features)#
Return list of student features as dictionaries.
enrolled_students_features(course_key, [‘username’, ‘first_name’]) would return [
{‘username’: ‘username1’, ‘first_name’: ‘firstname1’} {‘username’: ‘username2’, ‘first_name’: ‘firstname2’} {‘username’: ‘username3’, ‘first_name’: ‘firstname3’}
]
- lms.djangoapps.instructor_analytics.basic.get_enrollments_for_course(exam_attempts)#
Returns all enrollments from a list of attempts. user_id is passed from proctoring.
- lms.djangoapps.instructor_analytics.basic.get_proctored_exam_results(course_key, features)#
Return info about proctored exam results in a course as a dict.
- lms.djangoapps.instructor_analytics.basic.get_response_state(response)#
Returns state of a particular response as string.
This method also does necessary encoding for displaying unicode data correctly.
- lms.djangoapps.instructor_analytics.basic.issued_certificates(course_key, features)#
Return list of issued certificates as dictionaries against the given course key.
issued_certificates(course_key, features) would return [
{course_id: ‘abc’, ‘total_issued_certificate’: ‘5’, ‘mode’: ‘honor’} {course_id: ‘abc’, ‘total_issued_certificate’: ‘10’, ‘mode’: ‘verified’} {course_id: ‘abc’, ‘total_issued_certificate’: ‘15’, ‘mode’: ‘Professional Education’}
]
- lms.djangoapps.instructor_analytics.basic.list_may_enroll(course_key, features)#
Return info about students who may enroll in a course as a dict.
list_may_enroll(course_key, [‘email’]) would return [
{‘email’: ‘email1’} {‘email’: ‘email2’} {‘email’: ‘email3’}
]
Note that result does not include students who may enroll and have already done so.
- lms.djangoapps.instructor_analytics.basic.list_problem_responses(course_key, problem_location, limit_responses=None)#
Return responses to a given problem as a dict.
list_problem_responses(course_key, problem_location)
- would return [
{‘username’: u’user1’, ‘state’: u’…’}, {‘username’: u’user2’, ‘state’: u’…’}, {‘username’: u’user3’, ‘state’: u’…’},
]
where state represents a student’s response to the problem identified by problem_location.
- lms.djangoapps.instructor_analytics.basic.transform_capa_state(state)#
Transforms the CAPA problem state.
- lms.djangoapps.instructor_analytics.basic.transform_ora_state(state)#
ORA problem state transformer transforms the problem states.
Some state variables values are json dumped strings which needs to be loaded into a python object.
lms.djangoapps.instructor_analytics.csvs module#
Student and course analytics.
Format and create csv responses
- lms.djangoapps.instructor_analytics.csvs.create_csv_response(filename, header, datarows)#
Create an HttpResponse with an attached .csv file
header e.g. [‘Name’, ‘Email’] datarows e.g. [[‘Jim’, ‘jim@edy.org’], [‘Jake’, ‘jake@edy.org’], …]
The data in header and datarows must be either Unicode strings, or ASCII-only bytestrings.
- lms.djangoapps.instructor_analytics.csvs.format_dictlist(dictlist, features)#
Convert a list of dictionaries to be compatible with create_csv_response
- dictlist is a list of dictionaries
all dictionaries should have keys from features
features is a list of features
example code: dictlist = [
- {
‘label1’: ‘value-1,1’, ‘label2’: ‘value-1,2’, ‘label3’: ‘value-1,3’, ‘label4’: ‘value-1,4’,
}, {
‘label1’: ‘value-2,1’, ‘label2’: ‘value-2,2’, ‘label3’: ‘value-2,3’, ‘label4’: ‘value-2,4’,
}
]
header, datarows = format_dictlist(dictlist, [‘label1’, ‘label4’])
# results in header = [‘label1’, ‘label4’] datarows = [[‘value-1,1’, ‘value-1,4’],
[‘value-2,1’, ‘value-2,4’]]
}
- lms.djangoapps.instructor_analytics.csvs.format_instances(instances, features)#
Convert a list of instances into a header list and datarows list.
header is just features e.g. [‘username’, ‘email’] datarows is a list of lists, each sublist representing a row in a table
e.g. [[‘username1’, ‘email1@email.com’], [‘username2’, ‘email2@email.com’]] for instances of length 2.
instances is a list of instances, e.g. list of User’s features is a list of features
a feature is a string for which getattr(obj, feature) is valid
Returns header and datarows, formatted for input in create_csv_response
lms.djangoapps.instructor_analytics.distributions module#
Profile Distributions
Aggregate sums for values of fields in students profiles.
For example: The distribution in a course for gender might look like: ‘gender’: {
‘type’: ‘EASY_CHOICE’, ‘data’: {
‘no_data’: 1234, ‘m’: 5678, ‘o’: 2134, ‘f’: 5678
}, ‘display_names’: {
‘no_data’: ‘No Data’, ‘m’: ‘Male’, ‘o’: ‘Other’, ‘f’: ‘Female’
}
- class lms.djangoapps.instructor_analytics.distributions.ProfileDistribution(feature)#
Bases:
objectContainer for profile distribution data
feature is the name of the distribution feature feature_display_name is the display name of feature data is a dictionary of the distribution type is either ‘EASY_CHOICE’ or ‘OPEN_CHOICE’ choices_display_names is a dict if the distribution is an ‘EASY_CHOICE’
- exception ValidationError#
Bases:
ValueErrorError thrown if validation fails.
- validate()#
Validate this profile distribution.
Throws ProfileDistribution.ValidationError
- lms.djangoapps.instructor_analytics.distributions.profile_distribution(course_id, feature)#
Retrieve distribution of students over a given feature. feature is one of AVAILABLE_PROFILE_FEATURES.
Returns a ProfileDistribution instance.
NOTE: no_data will appear as a key instead of None/null to adhere to the json spec. data types are EASY_CHOICE or OPEN_CHOICE