Skip to content
Merged
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
81 changes: 81 additions & 0 deletions openedx_events/learning/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,84 @@
They also must comply with the payload definition specified in
docs/decisions/0003-events-payload.rst
"""

from openedx_events.learning.data import (
CertificateData,
CohortData,
CourseEnrollmentData,
RegistrationFormData,
UserData,
)
from openedx_events.tooling import OpenEdxPublicSignal

STUDENT_REGISTRATION_COMPLETED = OpenEdxPublicSignal(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered how these will be documented? Inline annotation documentation has the benefit of being close to the code, and would allow documentation to be added immediately along with the event definitions.

See toggles documentation as an example: https://edx.readthedocs.io/projects/edx-toggles/en/latest/how_to/documenting_new_feature_toggles.html

Thanks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent suggestion! We'll give it a go!

I'll tag you when it's ready!

event_type="org.openedx.learning.student.registration.completed.v1",
data={
"user": UserData,
"registration_form": RegistrationFormData,
}
)


SESSION_LOGIN_COMPLETED = OpenEdxPublicSignal(
event_type="org.openedx.learning.auth.session.login.completed.v1",
data={
"user": UserData,
}
)


COURSE_ENROLLMENT_CREATED = OpenEdxPublicSignal(
event_type="org.openedx.learning.course.enrollment.created.v1",
data={
"enrollment": CourseEnrollmentData,
}
)


COURSE_ENROLLMENT_CHANGED = OpenEdxPublicSignal(
event_type="org.openedx.learning.course.enrollment.changed.v1",
data={
"enrollment": CourseEnrollmentData,
}
)


COURSE_UNENROLLMENT_COMPLETED = OpenEdxPublicSignal(
event_type="org.openedx.learning.course.enrollment.deactivated.v1",
data={
"enrollment": CourseEnrollmentData,
}
)


CERTIFICATE_CREATED = OpenEdxPublicSignal(
event_type="org.openedx.learning.certificate.created.v1",
data={
"certificate": CertificateData,
}
)


CERTIFICATE_CHANGED = OpenEdxPublicSignal(
event_type="org.openedx.learning.certificate.changed.v1",
data={
"certificate": CertificateData,
}
)
Comment on lines +69 to +74
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need the state that it changed from?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(genuine question–I really haven't thought about what folks are looking with this use case at all)



CERTIFICATE_REVOKED = OpenEdxPublicSignal(
event_type="org.openedx.learning.certificate.revoked.v1",
data={
"certificate": CertificateData,
}
)


COHORT_MEMBERSHIP_CHANGED = OpenEdxPublicSignal(
event_type="org.openedx.learning.cohort_membership.changed.v1",
data={
"cohort": CohortData,
}
)