lib.ll_event_parsers

This file contains parsers that parse event data from Learning Locker.

Module Contents

lib.ll_event_parsers.parse_viewed_courses(json)

Parse course viewed statements.

Extract the students that have viewed the course from the course viewed statements. Return a list of those students.

Parameters

json (dict(str, str)) – All the course viewed statements since a certain time.

Returns

List of students who have viewed the course.

Return type

list(str)

lib.ll_event_parsers.parse_quiz_completed_feedback(json)

Parse quiz completed statements.

Receives a quiz completed statement. Extract from that statement the actor, quiz and course names and ids. Also extract the score and attempt id.

Parameters

json (dict(str, NoneType)) – A quiz completed statement.

Returns

A dictionary containing the score and attempt id as well as actor, quiz and course names and ids.

Return type

dict(str, str)

lib.ll_event_parsers.parse_new_activity_created(json)

Parse a module created statement.

Receives a statement of module created. Extract from that statement the course id, course name and name and type of the new activity.

Parameters

json (dict(str, dict(str, str))) – A module created statement.

Returns

A dictionary containing the course id and name, and module name and type.

Return type

dict(str, int)

lib.ll_event_parsers.check_course_sync_agent_type(json)

Check if the type of the incoming statement is course.

Parameters

json (union(dict(str, NoneType), dict(str, dict(str, str)))) – A statement, possibly with type course.

Returns

A boolean, true if the type of the incoming statement is a course, false otherwise.

Return type

bool

lib.ll_event_parsers.check_user_sync_agent_type(json)

Check type of incoming user statement.

Parameters

json (dict(str, NoneType)) – A user statement.

Returns

The type of the verb of the statement.

Return type

str

lib.ll_event_parsers.check_question_update_data(json)

Check if there is data about questions present in the statement.

Parameters

json (dict(str, NoneType)) – A quiz edit page viewed statement.

Returns

A boolean, true if there is data about questions, false otherwise.

Return type

bool

lib.ll_event_parsers.parse_module_sync_agent_data(json)

Parse the statement of a module that has to be synced.

Parameters

json (union(dict(str, NoneType), dict(str, dict(str, str)))) – A statement of a module that has to be synced.

Returns

A dictionary containing the course id, verb, target, type, external id, name of the object and actor id.

Return type

dict(str, int)

lib.ll_event_parsers.parse_course_sync_agent_data(json)

Parse the incoming statement for a sync agent event concerning a course.

Parameters

json (dict(str, NoneType)) – A statement concerning a course that needs to be synced.

Returns

A dictionary containing the course id, platform, course name, verb and actor id of the statement.

Return type

dict(str, str)

lib.ll_event_parsers.parse_user_assign_sync_agent_data(json)

Parse the incoming statement for a sync agent event concerning a user role assignment.

Parameters

json (dict(str, NoneType)) – A statement concerning a user role assignment that needs to be synced.

Returns

A dictionary containing all user information, a course id, and its role for that course.

Return type

dict(str, str)

lib.ll_event_parsers.parse_user_unassign_sync_agent_data(json)

Parse the incoming statement for a sync agent event concerning a user role unassignment.

Parameters

json (union(dict(str, NoneType), dict(str, dict(str, str)))) – A statement concerning a user role unassignment that needs to be synced.

Returns

A dictionary containing a user id, a course id, and the unassigned role for that course.

Return type

dict(str, str)

lib.ll_event_parsers.parse_user_delete_sync_agent_data(json)

Parse the incoming statement for a sync agent event concerning a user deletion.

Parameters

json (dict(str, NoneType)) – A statement concerning a user deletion.

Returns

A dictionary containing the user id of the deleted user.

Return type

dict(str, str)

lib.ll_event_parsers.parse_user_update_sync_agent_data(json)

Parse the incoming statement for a sync agent event concerning a user update.

Parameters

json (dict(str, NoneType)) – A statement concerning a user update that needs to be synced.

Returns

A dictionary containing all user information of the updated user.

Return type

dict(str, str)

lib.ll_event_parsers.parse_question_update_sync_agent_data(json)

Parse the incoming statement for a sync agent event concerning a question update.

Parameters

json (dict(str, NoneType)) – A statement concerning a question update.

Returns

A dictionary containing a course id, quiz id and all question information.

Return type

dict(str, str)