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

feat: add discussion forum comment interaction events transformers #334

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/event-mapping/Supported_events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ Forum events
* `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.forum.comment.created`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.comment.created.json>`__ | xAPI `map <./xAPI_mapping.rst#edx.forum.comment.created>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.comment.created.json>`__
* `edx.forum.comment.edited`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.comment.edited.json>`__ | xAPI `map <./xAPI_mapping.rst#edx.forum.comment.edited>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.comment.edited.json>`__
* `edx.forum.comment.deleted`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.comment.deleted.json>`__ | xAPI `map <./xAPI_mapping.rst#edx.forum.comment.deleted>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.comment.deleted.json>`__
* `edx.forum.comment.reported`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.comment.reported.json>`__ | xAPI `map <./xAPI_mapping.rst#edx.forum.comment.reported>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.comment.reported.json>`__
* `edx.forum.comment.unreported`_ | edX `sample <../../event_routing_backends/processors/tests/fixtures/current/edx.forum.comment.unreported.json>`__ | xAPI `map <./xAPI_mapping.rst#edx.forum.comment.unreported>`__ , `sample <../../event_routing_backends/processors/xapi/tests/fixtures/expected/edx.forum.comment.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
Expand Down Expand Up @@ -101,3 +106,8 @@ Forum events
.. _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
.. _edx.forum.comment.created: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-comment-created
.. _edx.forum.comment.edited: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-comment-edited
.. _edx.forum.comment.deleted: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-comment-deleted
.. _edx.forum.comment.reported: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-comment-reported
.. _edx.forum.comment.unreported: https://docs.openedx.org/en/latest/developers/references/internal_data_formats/tracking_logs/student_event_types.html#edx-forum-comment-unreported
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "edx.forum.comment.created",
"timestamp": "2023-08-08T12:09:39.157587+00:00",
"data": {
"discussion": {
"id": "64d1df0887e82a002b35a6f7"
},
"commentable_id": "course",
"options": {
"followed": false
},
"from_mfe_sidebar": false,
"response": {
"id": "64d1df2087e82a002b35a6fb"
},
"truncated": false,
"body": "<p>First comment</p>",
"id": "64d2308202808b0030b8afaf",
"url": "http://apps.local.overhang.io:2002/",
"user_forums_roles": [
"Student"
],
"user_course_roles": []
},
"context": {
"session": "cf416827826486d4986255dd8d4781bc",
"user_id": 5,
"username": "xiaaug24",
"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+XP101+2023_T1",
"org_id": "TestX",
"enterprise_uuid": ""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "edx.forum.comment.deleted",
"timestamp": "2023-08-08T12:07:43.102353+00:00",
"data": {
"body": "<p>Edit comment</p>",
"commentable_id": "course",
"content_type": "Comment",
"own_content": true,
"target_username": "xiaaug24",
"id": "64d1df3c87e82a002b35a6fc",
"url": "http://apps.local.overhang.io:2002/",
"user_forums_roles": [
"Student"
],
"user_course_roles": []
},
"context": {
"session": "cf416827826486d4986255dd8d4781bc",
"user_id": 5,
"username": "xiaaug24",
"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/64d1df3c87e82a002b35a6fc/",
"referer": "http://apps.local.overhang.io:2002/",
"accept_language": "en-US,en;q=0.5",
"client_id": null,
"course_id": "course-v1:TestX+XP101+2023_T1",
"org_id": "TestX",
"enterprise_uuid": ""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "edx.forum.comment.edited",
"timestamp": "2023-08-08T12:05:54.453258+00:00",
"data": {
"target_username": "xiaaug24",
"own_content": true,
"content_type": "Comment",
"edit_reason": null,
"commentable_id": "course",
"id": "64d1df3c87e82a002b35a6fc",
"url": "http://apps.local.overhang.io:2002/",
"user_forums_roles": [
"Student"
],
"user_course_roles": []
},
"context": {
"session": "cf416827826486d4986255dd8d4781bc",
"user_id": 5,
"username": "xiaaug24",
"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/64d1df3c87e82a002b35a6fc/",
"referer": "http://apps.local.overhang.io:2002/",
"accept_language": "en-US,en;q=0.5",
"client_id": null,
"course_id": "course-v1:TestX+XP101+2023_T1",
"org_id": "TestX",
"enterprise_uuid": ""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "edx.forum.comment.reported",
"timestamp": "2023-08-08T12:11:25.068027+00:00",
"data": {
"body": "<p>First comment</p>",
"truncated": false,
"commentable_id": "course",
"content_type": "Comment",
"target_username": "xiaaug24",
"id": "64d2308202808b0030b8afaf",
"url": "http://apps.local.overhang.io:2002/",
"user_forums_roles": [
"Student"
],
"user_course_roles": []
},
"context": {
"session": "cf416827826486d4986255dd8d4781bc",
"user_id": 5,
"username": "xiaaug24",
"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/64d2308202808b0030b8afaf/",
"referer": "http://apps.local.overhang.io:2002/",
"accept_language": "en-US,en;q=0.5",
"client_id": null,
"course_id": "course-v1:TestX+XP101+2023_T1",
"org_id": "TestX",
"enterprise_uuid": ""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "edx.forum.comment.unreported",
"timestamp": "2023-08-08T12:12:58.380220+00:00",
"data": {
"body": "<p>First comment</p>",
"truncated": false,
"commentable_id": "course",
"content_type": "Comment",
"reported_status_cleared": true,
"target_username": "xiaaug24",
"id": "64d2308202808b0030b8afaf",
"url": "http://apps.local.overhang.io:2002/",
"user_forums_roles": [
"Student"
],
"user_course_roles": []
},
"context": {
"session": "cf416827826486d4986255dd8d4781bc",
"user_id": 5,
"username": "xiaaug24",
"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/64d2308202808b0030b8afaf/",
"referer": "http://apps.local.overhang.io:2002/",
"accept_language": "en-US,en;q=0.5",
"client_id": null,
"course_id": "course-v1:TestX+XP101+2023_T1",
"org_id": "TestX",
"enterprise_uuid": ""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ def get_context_extensions(self):

@XApiTransformersRegistry.register('edx.forum.thread.edited')
@XApiTransformersRegistry.register('edx.forum.response.edited')
@XApiTransformersRegistry.register('edx.forum.comment.edited')
class ThreadEditedTransformer(BaseForumThreadTransformer):
"""
Transformers for event generated when learner modifies a thread/response in discussion forum.
Transformers for event generated when learner modifies a
thread/response/comment in discussion forum.
"""
verb = Verb(
id=constants.XAPI_VERB_EDITED,
Expand All @@ -86,9 +88,11 @@ class ThreadViewedTransformer(BaseForumThreadTransformer):

@XApiTransformersRegistry.register('edx.forum.thread.deleted')
@XApiTransformersRegistry.register('edx.forum.response.deleted')
@XApiTransformersRegistry.register('edx.forum.comment.deleted')
class ThreadDeletedTransformer(BaseForumThreadTransformer):
"""
Transformers for event generated when learner deletes a thread/response in discussion forum.
Transformers for event generated when learner deletes a
thread/response/comment in discussion forum.
"""
verb = Verb(
id=constants.XAPI_VERB_DELETED,
Expand Down Expand Up @@ -122,10 +126,11 @@ def get_context_extensions(self):


@XApiTransformersRegistry.register('edx.forum.response.created')
@XApiTransformersRegistry.register('edx.forum.comment.created')
class ThreadResponseCreatedTransformer(BaseForumThreadTransformer):
"""
Transformer for event generated when learner creates a response
under a thread in discussion forum.
or comment under a thread in discussion forum.
"""
verb = Verb(
id=constants.XAPI_VERB_POSTED,
Expand All @@ -135,10 +140,11 @@ class ThreadResponseCreatedTransformer(BaseForumThreadTransformer):

@XApiTransformersRegistry.register('edx.forum.thread.reported')
@XApiTransformersRegistry.register('edx.forum.response.reported')
@XApiTransformersRegistry.register('edx.forum.comment.reported')
class ThreadResponseReportedTransformer(BaseForumThreadTransformer):
"""
Transformer for event generated when learner reports a thread or response
to a thread as inappropriate.
Transformer for event generated when learner reports a thread,
response or comment as inappropriate.
"""
verb = Verb(
id=constants.XAPI_VERB_REPORTED,
Expand All @@ -148,10 +154,11 @@ class ThreadResponseReportedTransformer(BaseForumThreadTransformer):

@XApiTransformersRegistry.register('edx.forum.thread.unreported')
@XApiTransformersRegistry.register('edx.forum.response.unreported')
@XApiTransformersRegistry.register('edx.forum.comment.unreported')
class ThreadResponseUnReportedTransformer(BaseForumThreadTransformer):
"""
Transformer for event generated when learner unreports a thread or response
to a thread which was earlier reported as inappropriate.
Transformer for event generated when learner unreports a thread,
response or comment which was earlier reported as inappropriate.
"""
verb = Verb(
id=constants.XAPI_VERB_UNREPORTED,
Expand Down
Original file line number Diff line number Diff line change
@@ -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+XP101+2023_T1",
"objectType": "Activity",
"definition": {
"name": {
"en-US": "Demonstration Course"
},
"type": "http://adlnet.gov/expapi/activities/course"
}
}
]
},
"extensions": {
"https://w3id.org/xapi/openedx/extension/transformer-version": "[email protected]",
"https://w3id.org/xapi/openedx/extensions/session-id": "cf416827826486d4986255dd8d4781bc"
}
},
"object": {
"definition": {
"type": "http://id.tincanapi.com/activitytype/discussion"
},
"id": "http://localhost:18000/api/discussion/v1/comments/64d2308202808b0030b8afaf",
"objectType": "Activity"
},
"timestamp": "2023-08-08T12:09:39.157587+00:00",
"verb": {
"display": {
"en": "posted"
},
"id": "https://w3id.org/xapi/acrossx/verbs/posted"
},
"version": "1.0.3"
}
Original file line number Diff line number Diff line change
@@ -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+XP101+2023_T1",
"objectType": "Activity",
"definition": {
"name": {
"en-US": "Demonstration Course"
},
"type": "http://adlnet.gov/expapi/activities/course"
}
}
]
},
"extensions": {
"https://w3id.org/xapi/openedx/extension/transformer-version": "[email protected]",
"https://w3id.org/xapi/openedx/extensions/session-id": "cf416827826486d4986255dd8d4781bc"
}
},
"object": {
"definition": {
"type": "http://id.tincanapi.com/activitytype/discussion"
},
"id": "http://localhost:18000/api/discussion/v1/comments/64d1df3c87e82a002b35a6fc",
"objectType": "Activity"
},
"timestamp": "2023-08-08T12:07:43.102353+00:00",
"verb": {
"display": {
"en": "deleted"
},
"id": "https://w3id.org/xapi/dod-isd/verbs/deleted"
},
"version": "1.0.3"
}
Original file line number Diff line number Diff line change
@@ -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+XP101+2023_T1",
"objectType": "Activity",
"definition": {
"name": {
"en-US": "Demonstration Course"
},
"type": "http://adlnet.gov/expapi/activities/course"
}
}
]
},
"extensions": {
"https://w3id.org/xapi/openedx/extension/transformer-version": "[email protected]",
"https://w3id.org/xapi/openedx/extensions/session-id": "cf416827826486d4986255dd8d4781bc"
}
},
"object": {
"definition": {
"type": "http://id.tincanapi.com/activitytype/discussion"
},
"id": "http://localhost:18000/api/discussion/v1/comments/64d1df3c87e82a002b35a6fc",
"objectType": "Activity"
},
"timestamp": "2023-08-08T12:05:54.453258+00:00",
"verb": {
"display": {
"en": "edited"
},
"id": "https://w3id.org/xapi/acrossx/verbs/edited"
},
"version": "1.0.3"
}
Loading