-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add signal for event-tracking emission
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
""" | ||
Package where events related to the analytics subdomain are implemented. | ||
The analytics subdomain corresponds to {Architecture Subdomain} defined in | ||
the OEP-41. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
Data attributes for events within the architecture subdomain ``analytics``. | ||
These attributes follow the form of attr objects specified in OEP-49 data | ||
pattern. | ||
The attributes for the events come from the CourseDetailView in the LMS, with some unused fields removed | ||
(see deprecation proposal at https://github.com/openedx/public-engineering/issues/160) | ||
""" | ||
|
||
from datetime import datetime | ||
|
||
import attr | ||
|
||
|
||
@attr.s(frozen=True) | ||
class TrackingLogData: | ||
""" | ||
Data describing tracking log data. | ||
Arguments: | ||
name (str): course name | ||
timestamp (datetime): course start date | ||
data (dict): dictionary of extra data (optional) | ||
context (dict): dictionary of context data. | ||
""" | ||
|
||
name = attr.ib(type=str) | ||
timestamp = attr.ib(type=datetime) | ||
data = attr.ib(type=dict, default={}) | ||
context = attr.ib(type=dict, factory=dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Standardized signals definitions for events within the architecture subdomain ``analytics``. | ||
All signals defined in this module must follow the name and versioning | ||
conventions specified in OEP-41. | ||
They also must comply with the payload definition specified in | ||
docs/decisions/0003-events-payload.rst | ||
""" | ||
|
||
from openedx_events.analytics.data import TrackingLogData | ||
from openedx_events.tooling import OpenEdxPublicSignal | ||
|
||
# .. event_type: org.openedx.analytics.event_tracking.emitted.v1 | ||
# .. event_name: TRACKING_EVENT_EMITTED | ||
# .. event_description: emitted when a grade changes in the course | ||
# .. event_data: TrackingLogData | ||
TRACKING_EVENT_EMITTED = OpenEdxPublicSignal( | ||
event_type="org.openedx.analytics.event_tracking.emitted.v1", | ||
data={ | ||
"tracking_log": TrackingLogData, | ||
} | ||
) |