Skip to content

Commit ae8f805

Browse files
authored
Modifying implementation to match caliper specification (#30)
* Adding example for router configurations * Changing output format to match what is expected by caliper * Changed url to point to updated specification context * Fixing test * Updating version and changelog
1 parent 451d139 commit ae8f805

26 files changed

+47
-25
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Unreleased
1616

1717
*
1818

19+
[3.0.2]
20+
~~~~~~~
21+
* Added more directions for local testing
22+
* changed how event data is enveloped for caliper events
23+
* changed url to point from http://purl.imsglobal.org/ctx/caliper/v1p1 to http://purl.imsglobal.org/ctx/caliper/v1p2
24+
1925
[3.0.1]
2026
~~~~~~~
2127

docs/howto/how_to_test.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,23 @@ Follow instructions in `getting_started <docs/gettingstarted.rst>`_ doc. There i
4545
Change router endpoint
4646
~~~~~~~~~~~~~~~~~~~~~~
4747

48-
When adding configurations for router, change host_configuration.url key to point to a link at `webhook.site <webhook.site>`_. When you visit the site, it will automatically generate an unique link for you. Use the unique url as value for host_configuration.url key.
48+
When adding configurations for router, change host_configuration.url key to point to a link at `webhook.site <webhook.site>`_. When you visit the site, it will automatically generate an unique link for you. Use the unique url as value for host_configuration.url key. Example router settings to send info to webhook.site::
49+
50+
[
51+
{
52+
"host_configurations": {
53+
"url": "https://webhook.site/fa5e53ee-1498-43b0-9b08-f1d1f80e4eb6",
54+
"auth_scheme":"Bearer",
55+
"headers":{"test":"header"}
56+
},
57+
"router_type": "AUTH_HEADERS",
58+
"backend_name": "caliper",
59+
"match_params": {}
60+
}
61+
]
62+
63+
64+
4965

5066
Filtering events
5167
~~~~~~~~~~~~~~~~

event_routing_backends/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
Various backends for receiving edX LMS events..
33
"""
44

5-
__version__ = '3.0.0'
5+
__version__ = '3.0.2'
66

77
default_app_config = 'event_routing_backends.apps.EventRoutingBackendsConfig' # pylint: disable=invalid-name

event_routing_backends/processors/caliper/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Constants related to IMS Caliper and events transformation into Caliper.
33
"""
44

5-
CALIPER_EVENT_CONTEXT = 'http://purl.imsglobal.org/ctx/caliper/v1p1'
5+
CALIPER_EVENT_CONTEXT = 'http://purl.imsglobal.org/ctx/caliper/v1p2'

event_routing_backends/processors/caliper/envelop_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ def __call__(self, event):
3232
return {
3333
'sensor': self.sensor_id,
3434
'sendTime': convert_datetime_to_iso(datetime.now(UTC)),
35-
'data': event,
35+
'data': [event],
3636
'dataVersion': CALIPER_EVENT_CONTEXT
3737
}

event_routing_backends/processors/caliper/tests/fixtures/expected/complete_video(proposed).json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Ended",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/edx.course.enrollment.activated.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Activated",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/edx.course.enrollment.deactivated.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Deactivated",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/edx.grades.problem.submitted.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Submitted",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/edx.problem.completed(proposed).json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Completed",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/edx.problem.hint.demandhint_displayed.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Viewed",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/edx.ui.lms.link_clicked(anonymous_user).json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "NavigatedTo",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/edx.ui.lms.link_clicked.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "NavigatedTo",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/edx.ui.lms.outline.selected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "NavigatedTo",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/edx.ui.lms.sequence.next_selected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "NavigatedTo",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/edx.ui.lms.sequence.previous_selected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "NavigatedTo",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/edx.ui.lms.sequence.tab_selected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "NavigatedTo",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/load_video.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Retrieved",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/pause_video.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Paused",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/play_video.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Started",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/problem_check(browser).json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Submitted",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/problem_check(server).json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Submitted",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/seek_video.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "JumpedTo",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/showanswer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Viewed",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/fixtures/expected/stop_video.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1",
2+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1p2",
33
"action": "Ended",
44
"actor": {
55
"id": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb",

event_routing_backends/processors/caliper/tests/test_envelop_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ def test_caliper_envelop_processor(self, mocked_datetime):
3434
self.assertEqual(result, {
3535
'sensor': self.sensor_id,
3636
'sendTime': convert_datetime_to_iso(str(FROZEN_TIME)),
37-
'data': self.sample_event,
37+
'data': [self.sample_event],
3838
'dataVersion': CALIPER_EVENT_CONTEXT
3939
})

0 commit comments

Comments
 (0)