diff --git a/docs/event-mapping/Supported_events.rst b/docs/event-mapping/Supported_events.rst index 42939555..6cc53d95 100644 --- a/docs/event-mapping/Supported_events.rst +++ b/docs/event-mapping/Supported_events.rst @@ -56,6 +56,14 @@ Forum events * `edx.forum.thread.viewed`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.thread.viewed.json>`__ | xAPI `map <./xAPI_mapping.rst#edx-forum-thread-viewed>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.viewed.json>`__ * `edx.forum.thread.deleted`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.thread.deleted.json>`__ | xAPI `map <./xAPI_mapping.rst#edx-forum-thread-deleted>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.deleted.json>`__ * `edx.forum.thread.voted`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.thread.voted.json>`__ | xAPI `map <./xAPI_mapping.rst#edx-forum-thread-voted>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.voted.json>`__ +* `edx.forum.thread.reported`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.thread.reported.json>`__ | xAPI `map <./xAPI_mapping.rst#edx-forum-thread-reported>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.reported.json>`__ +* `edx.forum.thread.unreported`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.thread.unreported.json>`__ | xAPI `map <./xAPI_mapping.rst#edx-forum-thread-unreported>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.unreported.json>`__ +* `edx.forum.response.created`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.response.created.json>`__ | xAPI `map <./xAPI_mapping.rst#edx.forum.response.created>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.created.json>`__ +* `edx.forum.response.edited`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.response.edited.json>`__ | xAPI `map <./xAPI_mapping.rst#edx.forum.response.edited>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.edited.json>`__ +* `edx.forum.response.deleted`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.response.deleted.json>`__ | xAPI `map <./xAPI_mapping.rst#edx.forum.response.deleted>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.deleted.json>`__ +* `edx.forum.response.voted`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.response.voted.json>`__ | xAPI `map <./xAPI_mapping.rst#edx.forum.response.voted>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.voted.json>`__ +* `edx.forum.response.reported`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.response.reported.json>`__ | xAPI `map <./xAPI_mapping.rst#edx.forum.response.reported>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.reported.json>`__ +* `edx.forum.response.unreported`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.response.unreported.json>`__ | xAPI `map <./xAPI_mapping.rst#edx.forum.response.unreported>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.unreported.json>`__ .. _edx.course.enrollment.activated: http://edx.readthedocs.io/projects/devdata/en/latest/internal_data_formats/tracking_logs/student_event_types.html#edx-course-enrollment-activated-and-edx-course-enrollment-deactivated @@ -85,3 +93,11 @@ Forum events .. _edx.forum.thread.viewed: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-thread-viewed .. _edx.forum.thread.deleted: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-thread-deleted .. _edx.forum.thread.voted: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-thread-voted +.. _edx.forum.thread.reported: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-thread-reported +.. _edx.forum.thread.unreported: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-thread-unreported +.. _edx.forum.response.created: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-response-created +.. _edx.forum.response.edited: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-response-edited +.. _edx.forum.response.deleted: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-response-deleted +.. _edx.forum.response.voted: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-response-voted +.. _edx.forum.response.reported: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-response-reported +.. _edx.forum.response.unreported: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-response-unreported diff --git a/docs/event-mapping/xAPI_mapping.rst b/docs/event-mapping/xAPI_mapping.rst index 2ee778c0..64246254 100644 --- a/docs/event-mapping/xAPI_mapping.rst +++ b/docs/event-mapping/xAPI_mapping.rst @@ -713,7 +713,7 @@ objectType Acti definition [ type ] http://id.tincanapi.com/activitytype/discussion =========================================================================== ======================================================= -edx.forum.thread.created +edx.forum.thread.voted ======================== =========================================================================== ====================================================== @@ -732,3 +732,156 @@ objectType Acti definition [ type ] http://id.tincanapi.com/activitytype/discussion definition [ extensions [ https://w3id.org/xapi/acrossx/extensions/type ] ] =========================================================================== ====================================================== + +edx.forum.thread.reported +========================= + +=========================================================================== ======================================================= +xAPI Key Value +=========================================================================== ======================================================= +``Actor`` +objectType Agent +account [ homePage ] +account [ name ] +``Verb`` +id https://w3id.org/xapi/acrossx/verbs/reported +display [ en-US ] reported +``Object`` +id /api/discussion/v1/threads/ +objectType Activity +definition [ type ] http://id.tincanapi.com/activitytype/discussion +=========================================================================== ======================================================= + +edx.forum.thread.unreported +=========================== + +=========================================================================== ======================================================= +xAPI Key Value +=========================================================================== ======================================================= +``Actor`` +objectType Agent +account [ homePage ] +account [ name ] +``Verb`` +id https://w3id.org/xapi/openedx/verb/unreported +display [ en-US ] unreported +``Object`` +id /api/discussion/v1/threads/ +objectType Activity +definition [ type ] http://id.tincanapi.com/activitytype/discussion +=========================================================================== ======================================================= + +edx.forum.response.created +========================== + +=========================================================================== ======================================================= +xAPI Key Value +=========================================================================== ======================================================= +``Actor`` +objectType Agent +account [ homePage ] +account [ name ] +``Verb`` +id https://w3id.org/xapi/acrossx/verbs/posted +display [ en-US ] posted +``Object`` +id /api/discussion/v1/comments/ +objectType Activity +definition [ type ] http://id.tincanapi.com/activitytype/discussion +=========================================================================== ======================================================= + +edx.forum.response.edited +========================= + +=========================================================================== ======================================================= +xAPI Key Value +=========================================================================== ======================================================= +``Actor`` +objectType Agent +account [ homePage ] +account [ name ] +``Verb`` +id https://w3id.org/xapi/acrossx/verbs/edited +display [ en-US ] edited +``Object`` +id /api/discussion/v1/comments/ +objectType Activity +definition [ type ] http://id.tincanapi.com/activitytype/discussion +=========================================================================== ======================================================= + +edx.forum.response.deleted +========================== + +=========================================================================== ======================================================= +xAPI Key Value +=========================================================================== ======================================================= +``Actor`` +objectType Agent +account [ homePage ] +account [ name ] +``Verb`` +id https://w3id.org/xapi/dod-isd/verbs/deleted +display [ en-US ] deleted +``Object`` +id /api/discussion/v1/comments/ +objectType Activity +definition [ type ] http://id.tincanapi.com/activitytype/discussion +=========================================================================== ======================================================= + +edx.forum.response.voted +========================== + +=========================================================================== ======================================================= +xAPI Key Value +=========================================================================== ======================================================= +``Actor`` +objectType Agent +account [ homePage ] +account [ name ] +``Verb`` +id https://w3id.org/xapi/openedx/verb/voted +display [ en-US ] voted +``Object`` +id /api/discussion/v1/comments/ +objectType Activity +definition [ type ] http://id.tincanapi.com/activitytype/discussion +definition [ extensions [ https://w3id.org/xapi/acrossx/extensions/type ] ] +=========================================================================== ======================================================= + +edx.forum.response.reported +=========================== + +=========================================================================== ======================================================= +xAPI Key Value +=========================================================================== ======================================================= +``Actor`` +objectType Agent +account [ homePage ] +account [ name ] +``Verb`` +id https://w3id.org/xapi/acrossx/verbs/reported +display [ en-US ] reported +``Object`` +id /api/discussion/v1/comments/ +objectType Activity +definition [ type ] http://id.tincanapi.com/activitytype/discussion +=========================================================================== ======================================================= + +edx.forum.response.unreported +============================= + +=========================================================================== ======================================================= +xAPI Key Value +=========================================================================== ======================================================= +``Actor`` +objectType Agent +account [ homePage ] +account [ name ] +``Verb`` +id https://w3id.org/xapi/openedx/verb/unreported +display [ en-US ] unreported +``Object`` +id /api/discussion/v1/comments/ +objectType Activity +definition [ type ] http://id.tincanapi.com/activitytype/discussion +=========================================================================== ======================================================= diff --git a/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.created.json b/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.created.json new file mode 100644 index 00000000..6c1069fb --- /dev/null +++ b/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.created.json @@ -0,0 +1,37 @@ +{ + "name": "edx.forum.response.created", + "timestamp": "2023-07-19T10:09:04.464412+00:00", + "data": { + "discussion": { + "id": "64b7b2bee68f35003369092d" + }, + "commentable_id": "7d6d6f11-537b-47c6-8575-ad3e315c0e06", + "options": { + "followed": false + }, + "from_mfe_sidebar": false, + "truncated": false, + "body": "

Response 1

", + "id": "64b7b640e68f350033690932", + "url": "http://apps.local.overhang.io:2002/", + "user_forums_roles": [ + "Student" + ], + "user_course_roles": [] + }, + "context": { + "session": "9be7677aefad3235abeb0241f2bea142", + "user_id": 18, + "username": "response", + "ip": "172.18.0.1", + "host": "local.overhang.io:8000", + "agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/114.0", + "path": "/api/discussion/v1/comments/", + "referer": "http://apps.local.overhang.io:2002/", + "accept_language": "en-US,en;q=0.5", + "client_id": null, + "course_id": "course-v1:testX+XAPI101+2019_T2", + "org_id": "testX", + "enterprise_uuid": "" + } +} diff --git a/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.deleted.json b/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.deleted.json new file mode 100644 index 00000000..717a450c --- /dev/null +++ b/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.deleted.json @@ -0,0 +1,32 @@ +{ + "name": "edx.forum.response.deleted", + "timestamp": "2023-07-19T10:30:02.224369+00:00", + "data": { + "body": "

Response 1 edited

", + "commentable_id": "7d6d6f11-537b-47c6-8575-ad3e315c0e06", + "content_type": "Response", + "own_content": true, + "target_username": "response", + "id": "64b7b640e68f350033690932", + "url": "http://apps.local.overhang.io:2002/", + "user_forums_roles": [ + "Student" + ], + "user_course_roles": [] + }, + "context": { + "session": "9be7677aefad3235abeb0241f2bea142", + "user_id": 18, + "username": "response", + "ip": "172.18.0.1", + "host": "local.overhang.io:8000", + "agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/114.0", + "path": "/api/discussion/v1/comments/64b7b640e68f350033690932/", + "referer": "http://apps.local.overhang.io:2002/", + "accept_language": "en-US,en;q=0.5", + "client_id": null, + "course_id": "course-v1:testX+XAPI101+2019_T2", + "org_id": "testX", + "enterprise_uuid": "" + } +} diff --git a/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.edited.json b/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.edited.json new file mode 100644 index 00000000..cb6b7ad9 --- /dev/null +++ b/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.edited.json @@ -0,0 +1,32 @@ +{ + "name": "edx.forum.response.edited", + "timestamp": "2023-07-19T10:22:44.268125+00:00", + "data": { + "target_username": "response", + "own_content": true, + "content_type": "Response", + "edit_reason": null, + "commentable_id": "7d6d6f11-537b-47c6-8575-ad3e315c0e06", + "id": "64b7b640e68f350033690932", + "url": "http://apps.local.overhang.io:2002/", + "user_forums_roles": [ + "Student" + ], + "user_course_roles": [] + }, + "context": { + "session": "9be7677aefad3235abeb0241f2bea142", + "user_id": 18, + "username": "response", + "ip": "172.18.0.1", + "host": "local.overhang.io:8000", + "agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/114.0", + "path": "/api/discussion/v1/comments/64b7b640e68f350033690932/", + "referer": "http://apps.local.overhang.io:2002/", + "accept_language": "en-US,en;q=0.5", + "client_id": null, + "course_id": "course-v1:testX+XAPI101+2019_T2", + "org_id": "testX", + "enterprise_uuid": "" + } +} diff --git a/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.reported.json b/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.reported.json new file mode 100644 index 00000000..ef893644 --- /dev/null +++ b/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.reported.json @@ -0,0 +1,32 @@ +{ + "name": "edx.forum.response.reported", + "timestamp": "2023-07-19T10:33:54.397651+00:00", + "data": { + "body": "

another response to post

", + "truncated": false, + "commentable_id": "7d6d6f11-537b-47c6-8575-ad3e315c0e06", + "content_type": "Response", + "target_username": "response", + "id": "64b7bbaee68f350033690935", + "url": "http://apps.local.overhang.io:2002/", + "user_forums_roles": [ + "Student" + ], + "user_course_roles": [] + }, + "context": { + "session": "6241e4561684e7ecc8fe1ef1d496ecb8", + "user_id": 17, + "username": "xiajul19", + "ip": "172.18.0.1", + "host": "local.overhang.io:8000", + "agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/114.0", + "path": "/api/discussion/v1/comments/64b7bbaee68f350033690935/", + "referer": "http://apps.local.overhang.io:2002/", + "accept_language": "en-US,en;q=0.5", + "client_id": null, + "course_id": "course-v1:testX+XAPI101+2019_T2", + "org_id": "testX", + "enterprise_uuid": "" + } +} diff --git a/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.unreported.json b/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.unreported.json new file mode 100644 index 00000000..34cd6830 --- /dev/null +++ b/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.unreported.json @@ -0,0 +1,33 @@ +{ + "name": "edx.forum.response.unreported", + "timestamp": "2023-07-19T10:36:17.324355+00:00", + "data": { + "body": "

another response to post

", + "truncated": false, + "commentable_id": "7d6d6f11-537b-47c6-8575-ad3e315c0e06", + "content_type": "Response", + "reported_status_cleared": true, + "target_username": "response", + "id": "64b7bbaee68f350033690935", + "url": "http://apps.local.overhang.io:2002/", + "user_forums_roles": [ + "Student" + ], + "user_course_roles": [] + }, + "context": { + "session": "6241e4561684e7ecc8fe1ef1d496ecb8", + "user_id": 17, + "username": "xiajul19", + "ip": "172.18.0.1", + "host": "local.overhang.io:8000", + "agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/114.0", + "path": "/api/discussion/v1/comments/64b7bbaee68f350033690935/", + "referer": "http://apps.local.overhang.io:2002/", + "accept_language": "en-US,en;q=0.5", + "client_id": null, + "course_id": "course-v1:testX+XAPI101+2019_T2", + "org_id": "testX", + "enterprise_uuid": "" + } +} diff --git a/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.voted.json b/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.voted.json new file mode 100644 index 00000000..2cd0f4d9 --- /dev/null +++ b/event_routing_backends/processors/tests/fixtures/current/edx.forum.response.voted.json @@ -0,0 +1,31 @@ +{ + "name": "edx.forum.response.voted", + "timestamp": "2023-07-19T10:26:30.857649+00:00", + "data": { + "commentable_id": "7d6d6f11-537b-47c6-8575-ad3e315c0e06", + "target_username": "response", + "undo_vote": false, + "vote_value": "up", + "id": "64b7b640e68f350033690932", + "url": "http://apps.local.overhang.io:2002/", + "user_forums_roles": [ + "Student" + ], + "user_course_roles": [] + }, + "context": { + "session": "9be7677aefad3235abeb0241f2bea142", + "user_id": 18, + "username": "response", + "ip": "172.18.0.1", + "host": "local.overhang.io:8000", + "agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/114.0", + "path": "/api/discussion/v1/comments/64b7b640e68f350033690932/", + "referer": "http://apps.local.overhang.io:2002/", + "accept_language": "en-US,en;q=0.5", + "client_id": null, + "course_id": "course-v1:testX+XAPI101+2019_T2", + "org_id": "testX", + "enterprise_uuid": "" + } +} diff --git a/event_routing_backends/processors/tests/fixtures/current/edx.forum.thread.reported.json b/event_routing_backends/processors/tests/fixtures/current/edx.forum.thread.reported.json new file mode 100644 index 00000000..e303317e --- /dev/null +++ b/event_routing_backends/processors/tests/fixtures/current/edx.forum.thread.reported.json @@ -0,0 +1,36 @@ +{ + "name": "edx.forum.thread.reported", + "timestamp": "2023-07-10T09:23:10.354202+00:00", + "data": { + "body": "

This is description of post

", + "truncated": false, + "content_type": "Post", + "commentable_id": "7d6d6f11-537b-47c6-8575-ad3e315c0e06", + "thread_type": "discussion", + "group_id": null, + "target_username": "xiajul19", + "title_truncated": false, + "title": "title of post", + "id": "64b7b2bee68f35003369092d", + "url": "http://apps.local.overhang.io:2002/", + "user_forums_roles": [ + "Student" + ], + "user_course_roles": [] + }, + "context": { + "session": "6241e4561684e7ecc8fe1ef1d496ecb8", + "user_id": 17, + "username": "xiajul19", + "ip": "172.18.0.1", + "host": "local.overhang.io:8000", + "agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/114.0", + "path": "/api/discussion/v1/threads/64b7b2bee68f35003369092d/", + "referer": "http://apps.local.overhang.io:2002/", + "accept_language": "en-US,en;q=0.5", + "client_id": null, + "course_id": "course-v1:testX+XAPI101+2019_T2", + "org_id": "testX", + "enterprise_uuid": "" + } +} diff --git a/event_routing_backends/processors/tests/fixtures/current/edx.forum.thread.unreported.json b/event_routing_backends/processors/tests/fixtures/current/edx.forum.thread.unreported.json new file mode 100644 index 00000000..9e0e0123 --- /dev/null +++ b/event_routing_backends/processors/tests/fixtures/current/edx.forum.thread.unreported.json @@ -0,0 +1,37 @@ +{ + "name": "edx.forum.thread.unreported", + "timestamp": "2023-07-10T09:23:10.354202+00:00", + "data": { + "body": "

This is description of post

", + "truncated": false, + "content_type": "Post", + "commentable_id": "7d6d6f11-537b-47c6-8575-ad3e315c0e06", + "reported_status_cleared": true, + "thread_type": "discussion", + "group_id": null, + "target_username": "xiajul19", + "title_truncated": false, + "title": "title of post", + "id": "64b7b2bee68f35003369092d", + "url": "http://apps.local.overhang.io:2002/", + "user_forums_roles": [ + "Student" + ], + "user_course_roles": [] + }, + "context": { + "session": "6241e4561684e7ecc8fe1ef1d496ecb8", + "user_id": 17, + "username": "xiajul19", + "ip": "172.18.0.1", + "host": "local.overhang.io:8000", + "agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/114.0", + "path": "/api/discussion/v1/threads/64b7b2bee68f35003369092d/", + "referer": "http://apps.local.overhang.io:2002/", + "accept_language": "en-US,en;q=0.5", + "client_id": null, + "course_id": "course-v1:testX+XAPI101+2019_T2", + "org_id": "testX", + "enterprise_uuid": "" + } +} diff --git a/event_routing_backends/processors/xapi/constants.py b/event_routing_backends/processors/xapi/constants.py index 16877806..36496cfe 100644 --- a/event_routing_backends/processors/xapi/constants.py +++ b/event_routing_backends/processors/xapi/constants.py @@ -19,6 +19,8 @@ XAPI_VERB_VIEWED = 'http://id.tincanapi.com/verb/viewed' XAPI_VERB_DELETED = 'https://w3id.org/xapi/dod-isd/verbs/deleted' XAPI_VERB_VOTED = 'https://w3id.org/xapi/openedx/verb/voted' +XAPI_VERB_REPORTED = 'https://w3id.org/xapi/acrossx/verbs/reported' +XAPI_VERB_UNREPORTED = 'https://w3id.org/xapi/openedx/verb/unreported' XAPI_VERB_TERMINATED = 'http://adlnet.gov/expapi/verbs/terminated' XAPI_VERB_ASKED = 'http://adlnet.gov/expapi/verbs/asked' @@ -93,6 +95,8 @@ DELETED = 'deleted' EDITED = 'edited' VOTED = 'voted' +REPORTED = 'reported' +UNREPORTED = 'unreported' TERMINATED = 'terminated' NAVIGATED = 'navigated' diff --git a/event_routing_backends/processors/xapi/event_transformers/__init__.py b/event_routing_backends/processors/xapi/event_transformers/__init__.py index c46647d8..4240e075 100644 --- a/event_routing_backends/processors/xapi/event_transformers/__init__.py +++ b/event_routing_backends/processors/xapi/event_transformers/__init__.py @@ -10,6 +10,9 @@ ThreadCreatedTransformer, ThreadDeletedTransformer, ThreadEditedTransformer, + ThreadResponseCreatedTransformer, + ThreadResponseReportedTransformer, + ThreadResponseUnReportedTransformer, ThreadViewedTransformer, ThreadVotedTransformer, ) diff --git a/event_routing_backends/processors/xapi/event_transformers/forum_events.py b/event_routing_backends/processors/xapi/event_transformers/forum_events.py index 5602fa5d..e150f524 100644 --- a/event_routing_backends/processors/xapi/event_transformers/forum_events.py +++ b/event_routing_backends/processors/xapi/event_transformers/forum_events.py @@ -26,7 +26,7 @@ def get_object(self): object_path = self.get_data('context.path', True).rstrip('/').replace(object_id, '').rstrip('/') return Activity( - id='{lms_root_url}/{object_path}/{object_id}'.format( + id='{lms_root_url}{object_path}/{object_id}'.format( lms_root_url=settings.LMS_ROOT_URL, object_path=object_path, object_id=object_id @@ -62,9 +62,10 @@ def get_context_extensions(self): @XApiTransformersRegistry.register('edx.forum.thread.edited') +@XApiTransformersRegistry.register('edx.forum.response.edited') class ThreadEditedTransformer(BaseForumThreadTransformer): """ - Transformers for event generated when learner modifies a thread in discussion forum. + Transformers for event generated when learner modifies a thread/response in discussion forum. """ verb = Verb( id=constants.XAPI_VERB_EDITED, @@ -84,9 +85,10 @@ class ThreadViewedTransformer(BaseForumThreadTransformer): @XApiTransformersRegistry.register('edx.forum.thread.deleted') +@XApiTransformersRegistry.register('edx.forum.response.deleted') class ThreadDeletedTransformer(BaseForumThreadTransformer): """ - Transformers for event generated when learner deletes a thread in discussion forum. + Transformers for event generated when learner deletes a thread/response in discussion forum. """ verb = Verb( id=constants.XAPI_VERB_DELETED, @@ -95,9 +97,10 @@ class ThreadDeletedTransformer(BaseForumThreadTransformer): @XApiTransformersRegistry.register('edx.forum.thread.voted') +@XApiTransformersRegistry.register('edx.forum.response.voted') class ThreadVotedTransformer(BaseForumThreadTransformer): """ - Transformers for event generated when learner votes on a thread in discussion forum. + Transformers for event generated when learner votes on a thread/response in discussion forum. """ verb = Verb( id=constants.XAPI_VERB_VOTED, @@ -116,3 +119,41 @@ def get_context_extensions(self): constants.XAPI_ACTIVITY_MODE: self.get_data('vote_value') }) return extensions + + +@XApiTransformersRegistry.register('edx.forum.response.created') +class ThreadResponseCreatedTransformer(BaseForumThreadTransformer): + """ + Transformer for event generated when learner creates a response + under a thread in discussion forum. + """ + verb = Verb( + id=constants.XAPI_VERB_POSTED, + display=LanguageMap({constants.EN: constants.POSTED}), + ) + + +@XApiTransformersRegistry.register('edx.forum.thread.reported') +@XApiTransformersRegistry.register('edx.forum.response.reported') +class ThreadResponseReportedTransformer(BaseForumThreadTransformer): + """ + Transformer for event generated when learner reports a thread or response + to a thread as inappropriate. + """ + verb = Verb( + id=constants.XAPI_VERB_REPORTED, + display=LanguageMap({constants.EN: constants.REPORTED}), + ) + + +@XApiTransformersRegistry.register('edx.forum.thread.unreported') +@XApiTransformersRegistry.register('edx.forum.response.unreported') +class ThreadResponseUnReportedTransformer(BaseForumThreadTransformer): + """ + Transformer for event generated when learner unreports a thread or response + to a thread which was earlier reported as inappropriate. + """ + verb = Verb( + id=constants.XAPI_VERB_UNREPORTED, + display=LanguageMap({constants.EN: constants.UNREPORTED}), + ) diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.created.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.created.json new file mode 100644 index 00000000..ad1e325f --- /dev/null +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.created.json @@ -0,0 +1,42 @@ +{ + "id": "6d1f033b-3f70-458c-b53a-e6bb63cbaef9", + "actor": { + "objectType": "Agent", + "account": {"homePage": "http://localhost:18000", "name": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb"} + }, + "context": { + "contextActivities": { + "parent": [ + { + "id": "http://localhost:18000/course/course-v1:testX+XAPI101+2019_T2", + "objectType": "Activity", + "definition": { + "name": { + "en-US": "Demonstration Course" + }, + "type": "http://adlnet.gov/expapi/activities/course" + } + } + ] + }, + "extensions": { + "https://w3id.org/xapi/openedx/extension/transformer-version": "event-routing-backends@1.1.1", + "https://w3id.org/xapi/openedx/extensions/session-id": "9be7677aefad3235abeb0241f2bea142" + } + }, + "object": { + "definition": { + "type": "http://id.tincanapi.com/activitytype/discussion" + }, + "id": "http://localhost:18000/api/discussion/v1/comments/64b7b640e68f350033690932", + "objectType": "Activity" + }, + "timestamp": "2023-07-19T10:09:04.464412+00:00", + "verb": { + "display": { + "en": "posted" + }, + "id": "https://w3id.org/xapi/acrossx/verbs/posted" + }, + "version": "1.0.3" +} diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.deleted.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.deleted.json new file mode 100644 index 00000000..29818cd9 --- /dev/null +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.deleted.json @@ -0,0 +1,42 @@ +{ + "id": "6d1f033b-3f70-458c-b53a-e6bb63cbaef9", + "actor": { + "objectType": "Agent", + "account": {"homePage": "http://localhost:18000", "name": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb"} + }, + "context": { + "contextActivities": { + "parent": [ + { + "id": "http://localhost:18000/course/course-v1:testX+XAPI101+2019_T2", + "objectType": "Activity", + "definition": { + "name": { + "en-US": "Demonstration Course" + }, + "type": "http://adlnet.gov/expapi/activities/course" + } + } + ] + }, + "extensions": { + "https://w3id.org/xapi/openedx/extension/transformer-version": "event-routing-backends@1.1.1", + "https://w3id.org/xapi/openedx/extensions/session-id": "9be7677aefad3235abeb0241f2bea142" + } + }, + "object": { + "definition": { + "type": "http://id.tincanapi.com/activitytype/discussion" + }, + "id": "http://localhost:18000/api/discussion/v1/comments/64b7b640e68f350033690932", + "objectType": "Activity" + }, + "timestamp": "2023-07-19T10:30:02.224369+00:00", + "verb": { + "display": { + "en": "deleted" + }, + "id": "https://w3id.org/xapi/dod-isd/verbs/deleted" + }, + "version": "1.0.3" +} diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.edited.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.edited.json new file mode 100644 index 00000000..64922c5b --- /dev/null +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.edited.json @@ -0,0 +1,42 @@ +{ + "id": "6d1f033b-3f70-458c-b53a-e6bb63cbaef9", + "actor": { + "objectType": "Agent", + "account": {"homePage": "http://localhost:18000", "name": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb"} + }, + "context": { + "contextActivities": { + "parent": [ + { + "id": "http://localhost:18000/course/course-v1:testX+XAPI101+2019_T2", + "objectType": "Activity", + "definition": { + "name": { + "en-US": "Demonstration Course" + }, + "type": "http://adlnet.gov/expapi/activities/course" + } + } + ] + }, + "extensions": { + "https://w3id.org/xapi/openedx/extension/transformer-version": "event-routing-backends@1.1.1", + "https://w3id.org/xapi/openedx/extensions/session-id": "9be7677aefad3235abeb0241f2bea142" + } + }, + "object": { + "definition": { + "type": "http://id.tincanapi.com/activitytype/discussion" + }, + "id": "http://localhost:18000/api/discussion/v1/comments/64b7b640e68f350033690932", + "objectType": "Activity" + }, + "timestamp": "2023-07-19T10:22:44.268125+00:00", + "verb": { + "display": { + "en": "edited" + }, + "id": "https://w3id.org/xapi/acrossx/verbs/edited" + }, + "version": "1.0.3" +} diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.reported.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.reported.json new file mode 100644 index 00000000..f5a410ff --- /dev/null +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.reported.json @@ -0,0 +1,42 @@ +{ + "id": "6d1f033b-3f70-458c-b53a-e6bb63cbaef9", + "actor": { + "objectType": "Agent", + "account": {"homePage": "http://localhost:18000", "name": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb"} + }, + "context": { + "contextActivities": { + "parent": [ + { + "id": "http://localhost:18000/course/course-v1:testX+XAPI101+2019_T2", + "objectType": "Activity", + "definition": { + "name": { + "en-US": "Demonstration Course" + }, + "type": "http://adlnet.gov/expapi/activities/course" + } + } + ] + }, + "extensions": { + "https://w3id.org/xapi/openedx/extension/transformer-version": "event-routing-backends@1.1.1", + "https://w3id.org/xapi/openedx/extensions/session-id": "6241e4561684e7ecc8fe1ef1d496ecb8" + } + }, + "object": { + "definition": { + "type": "http://id.tincanapi.com/activitytype/discussion" + }, + "id": "http://localhost:18000/api/discussion/v1/comments/64b7bbaee68f350033690935", + "objectType": "Activity" + }, + "timestamp": "2023-07-19T10:33:54.397651+00:00", + "verb": { + "display": { + "en": "reported" + }, + "id": "https://w3id.org/xapi/acrossx/verbs/reported" + }, + "version": "1.0.3" +} diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.unreported.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.unreported.json new file mode 100644 index 00000000..d1f39321 --- /dev/null +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.unreported.json @@ -0,0 +1,42 @@ +{ + "id": "6d1f033b-3f70-458c-b53a-e6bb63cbaef9", + "actor": { + "objectType": "Agent", + "account": {"homePage": "http://localhost:18000", "name": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb"} + }, + "context": { + "contextActivities": { + "parent": [ + { + "id": "http://localhost:18000/course/course-v1:testX+XAPI101+2019_T2", + "objectType": "Activity", + "definition": { + "name": { + "en-US": "Demonstration Course" + }, + "type": "http://adlnet.gov/expapi/activities/course" + } + } + ] + }, + "extensions": { + "https://w3id.org/xapi/openedx/extension/transformer-version": "event-routing-backends@1.1.1", + "https://w3id.org/xapi/openedx/extensions/session-id": "6241e4561684e7ecc8fe1ef1d496ecb8" + } + }, + "object": { + "definition": { + "type": "http://id.tincanapi.com/activitytype/discussion" + }, + "id": "http://localhost:18000/api/discussion/v1/comments/64b7bbaee68f350033690935", + "objectType": "Activity" + }, + "timestamp": "2023-07-19T10:36:17.324355+00:00", + "verb": { + "display": { + "en": "unreported" + }, + "id": "https://w3id.org/xapi/openedx/verb/unreported" + }, + "version": "1.0.3" +} diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.voted.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.voted.json new file mode 100644 index 00000000..ddb4c5f0 --- /dev/null +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.response.voted.json @@ -0,0 +1,43 @@ +{ + "id": "6d1f033b-3f70-458c-b53a-e6bb63cbaef9", + "actor": { + "objectType": "Agent", + "account": {"homePage": "http://localhost:18000", "name": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb"} + }, + "context": { + "contextActivities": { + "parent": [ + { + "id": "http://localhost:18000/course/course-v1:testX+XAPI101+2019_T2", + "objectType": "Activity", + "definition": { + "name": { + "en-US": "Demonstration Course" + }, + "type": "http://adlnet.gov/expapi/activities/course" + } + } + ] + }, + "extensions": { + "https://w3id.org/xapi/openedx/extension/transformer-version": "event-routing-backends@1.1.1", + "https://w3id.org/xapi/openedx/extensions/session-id": "9be7677aefad3235abeb0241f2bea142", + "https://w3id.org/xapi/acrossx/extensions/type": "up" + } + }, + "object": { + "definition": { + "type": "http://id.tincanapi.com/activitytype/discussion" + }, + "id": "http://localhost:18000/api/discussion/v1/comments/64b7b640e68f350033690932", + "objectType": "Activity" + }, + "timestamp": "2023-07-19T10:26:30.857649+00:00", + "verb": { + "display": { + "en": "voted" + }, + "id": "https://w3id.org/xapi/openedx/verb/voted" + }, + "version": "1.0.3" +} diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.created.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.created.json index 5dbca613..4e9983c9 100644 --- a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.created.json +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.created.json @@ -29,7 +29,7 @@ "definition": { "type": "http://id.tincanapi.com/activitytype/discussion" }, - "id": "http://localhost:18000//api/discussion/v1/threads/64abcdfee68f35002fd013c6", + "id": "http://localhost:18000/api/discussion/v1/threads/64abcdfee68f35002fd013c6", "objectType": "Activity" }, "timestamp": "2023-07-10T09:23:10.354202+00:00", diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.deleted.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.deleted.json index 0026b4da..df1d36c9 100644 --- a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.deleted.json +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.deleted.json @@ -28,7 +28,7 @@ "definition": { "type": "http://id.tincanapi.com/activitytype/discussion" }, - "id": "http://localhost:18000//api/discussion/v1/threads/64abcdfee68f35002fd013c6", + "id": "http://localhost:18000/api/discussion/v1/threads/64abcdfee68f35002fd013c6", "objectType": "Activity" }, "timestamp": "2023-07-10T09:23:10.354202+00:00", diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.edited.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.edited.json index 13f4eb6a..f9285491 100644 --- a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.edited.json +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.edited.json @@ -28,7 +28,7 @@ "definition": { "type": "http://id.tincanapi.com/activitytype/discussion" }, - "id": "http://localhost:18000//api/discussion/v1/threads/64a817fce68f35002fd013c3", + "id": "http://localhost:18000/api/discussion/v1/threads/64a817fce68f35002fd013c3", "objectType": "Activity" }, "timestamp": "2023-07-10T09:23:10.354202+00:00", diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.reported.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.reported.json new file mode 100644 index 00000000..600c16d2 --- /dev/null +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.reported.json @@ -0,0 +1,42 @@ +{ + "id": "6d1f033b-3f70-458c-b53a-e6bb63cbaef9", + "actor": { + "objectType": "Agent", + "account": {"homePage": "http://localhost:18000", "name": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb"} + }, + "context": { + "contextActivities": { + "parent": [ + { + "id": "http://localhost:18000/course/course-v1:testX+XAPI101+2019_T2", + "objectType": "Activity", + "definition": { + "name": { + "en-US": "Demonstration Course" + }, + "type": "http://adlnet.gov/expapi/activities/course" + } + } + ] + }, + "extensions": { + "https://w3id.org/xapi/openedx/extension/transformer-version": "event-routing-backends@1.1.1", + "https://w3id.org/xapi/openedx/extensions/session-id": "6241e4561684e7ecc8fe1ef1d496ecb8" + } + }, + "object": { + "definition": { + "type": "http://id.tincanapi.com/activitytype/discussion" + }, + "id": "http://localhost:18000/api/discussion/v1/threads/64b7b2bee68f35003369092d", + "objectType": "Activity" + }, + "timestamp": "2023-07-10T09:23:10.354202+00:00", + "verb": { + "display": { + "en": "reported" + }, + "id": "https://w3id.org/xapi/acrossx/verbs/reported" + }, + "version": "1.0.3" +} diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.unreported.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.unreported.json new file mode 100644 index 00000000..b83df2a9 --- /dev/null +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.unreported.json @@ -0,0 +1,42 @@ +{ + "id": "6d1f033b-3f70-458c-b53a-e6bb63cbaef9", + "actor": { + "objectType": "Agent", + "account": {"homePage": "http://localhost:18000", "name": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb"} + }, + "context": { + "contextActivities": { + "parent": [ + { + "id": "http://localhost:18000/course/course-v1:testX+XAPI101+2019_T2", + "objectType": "Activity", + "definition": { + "name": { + "en-US": "Demonstration Course" + }, + "type": "http://adlnet.gov/expapi/activities/course" + } + } + ] + }, + "extensions": { + "https://w3id.org/xapi/openedx/extension/transformer-version": "event-routing-backends@1.1.1", + "https://w3id.org/xapi/openedx/extensions/session-id": "6241e4561684e7ecc8fe1ef1d496ecb8" + } + }, + "object": { + "definition": { + "type": "http://id.tincanapi.com/activitytype/discussion" + }, + "id": "http://localhost:18000/api/discussion/v1/threads/64b7b2bee68f35003369092d", + "objectType": "Activity" + }, + "timestamp": "2023-07-10T09:23:10.354202+00:00", + "verb": { + "display": { + "en": "unreported" + }, + "id": "https://w3id.org/xapi/openedx/verb/unreported" + }, + "version": "1.0.3" +} diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.viewed.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.viewed.json index bafe4935..c51212f8 100644 --- a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.viewed.json +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.viewed.json @@ -28,7 +28,7 @@ "definition": { "type": "http://id.tincanapi.com/activitytype/discussion" }, - "id": "http://localhost:18000//api/discussion/v1/comments/64a817fce68f35002fd013c3", + "id": "http://localhost:18000/api/discussion/v1/comments/64a817fce68f35002fd013c3", "objectType": "Activity" }, "timestamp": "2023-07-10T09:23:10.354202+00:00", diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.voted.json b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.voted.json index bdf50cfd..c7fe0a24 100644 --- a/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.voted.json +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.thread.voted.json @@ -29,7 +29,7 @@ "definition": { "type": "http://id.tincanapi.com/activitytype/discussion" }, - "id": "http://localhost:18000//api/discussion/v1/threads/64a817fce68f35002fd013c3", + "id": "http://localhost:18000/api/discussion/v1/threads/64a817fce68f35002fd013c3", "objectType": "Activity" }, "timestamp": "2023-07-10T09:23:10.354202+00:00", diff --git a/event_routing_backends/settings/common.py b/event_routing_backends/settings/common.py index 3863bcda..9b15c498 100644 --- a/event_routing_backends/settings/common.py +++ b/event_routing_backends/settings/common.py @@ -73,8 +73,16 @@ def plugin_settings(settings): 'edx.forum.thread.created', 'edx.forum.thread.deleted', 'edx.forum.thread.edited', - 'edx.forum.thread.viewed', + 'edx.forum.thread.viewed' + 'edx.forum.response.reported', + 'edx.forum.thread.unreported', 'edx.forum.thread.voted', + 'edx.forum.response.created', + 'edx.forum.response.deleted', + 'edx.forum.response.edited', + 'edx.forum.response.reported', + 'edx.forum.response.unreported', + 'edx.forum.response.voted', 'edx.ui.lms.link_clicked', 'edx.ui.lms.sequence.outline.selected', 'edx.ui.lms.outline.selected',