[ENHANCEMENT] [MER-4826] Add tutor log messages to datashop export #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR extends the datashop export functionality to include tutor log messages alongside the existing attempt_evaluated messages. The implementation processes tutor_message events from XAPI data and converts them to the appropriate XML format for datashop export.
Changes Made
1. Enhanced Data Processing Pipeline (
dataset/dataset.py)generate_datashop()function to process bothattempt_evaluatedandtutor_messageeventsprocess_tutor_messagesto the import statement fromdataset.datashop2. New Tutor Message Processing Functions (
dataset/datashop.py)process_tutor_message(j, lookup)j["result"]["message"]process_tutor_messages(part_attempts, context)process_part_attemptsmeta_xml(context)sanitize_element_text()function for proper XML escaping3. Enhanced Message Handling (
dataset/datashop.py)handle_datashop()to process both question activities (http://adlnet.gov/expapi/activities/question) and tutor messages (http://oli.cmu.edu/extensions/tutor_message)Technical Details
Data Flow
tutor_messageevent typeparallel_mapXML Structure
Tutor messages are converted to datashop-compatible XML with:
Error Handling
Benefits
Testing
The implementation maintains backward compatibility and follows existing patterns, ensuring that:
Files Modified
dataset/dataset.py: Extended datashop generation pipelinedataset/datashop.py: Added tutor message processing functions and enhanced message handling