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 new learning events for course grades and badges #303

Merged
merged 32 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3122960
feat: [ACI-75] new public events
kyrylo-kh Dec 13, 2023
4ca494d
feat: [ACI-139, ACI-145] new events for badge (#4)
kyrylo-kh Jan 16, 2024
84760dc
feat: [ACI-510, ACI-511, ACI-512] new events and dataclass for ccx co…
andrii-hantkovskyi Mar 26, 2024
098ce1d
feat: [ACI-512] update CCX events payload (#6)
wowkalucky Mar 26, 2024
48b9ed7
chore: [ACI-473] update badges related payload atttibutes to match da…
wowkalucky Mar 26, 2024
5f96415
feat: [ACI-800] implement avro serializer for ccx locator (#9)
andrii-hantkovskyi Mar 27, 2024
42fef33
refactor: [ACI-502, ACI-503] redesign course grading events payload (#8)
wowkalucky Mar 29, 2024
6aa6c90
refactor: [ACI-820] simplify course grade status event payload (#10)
wowkalucky Mar 29, 2024
da07adf
refactor: [ACI-814] update course passing events types (#11)
wowkalucky Mar 31, 2024
8558418
feat: add new learning events for course grades and badges
kyrylo-kh Apr 14, 2024
9d2a80d
fix: [ACI-152] fix ci failure (#12)
andrii-hantkovskyi Apr 18, 2024
960877c
fix: [ACI-152] fix ci failure (#12)
andrii-hantkovskyi Apr 18, 2024
75a280a
chore: upgrade dependencies
wowkalucky Apr 19, 2024
a5bec1c
fix: remove obsolete indexes
wowkalucky Apr 19, 2024
e9df156
Merge branch 'main' into aci.upstream
wowkalucky Apr 19, 2024
bd3ea58
docs(ci): manually downgrade alabaster, so it can be found in the cache
wowkalucky Apr 23, 2024
201485c
chore: upgrade requirements
wowkalucky Apr 23, 2024
fbd4b99
chore: upgrade requirements
kyrylo-kh Apr 24, 2024
942e636
fix: remove unnecessary lines
kyrylo-kh Apr 24, 2024
e770630
Merge branch 'main' into aci.main
wowkalucky Apr 25, 2024
f7995b9
fix: regenerate requirements
wowkalucky Apr 25, 2024
3dd4d32
test: [ACI-949] increase coverage & fix status field problem (#13)
andrii-hantkovskyi Apr 25, 2024
f290a49
chore: upgrade requirements
wowkalucky Apr 25, 2024
f165593
Merge branch 'main' into aci.upstream
wowkalucky Apr 25, 2024
619289a
test: [ACI-949] increase coverage & fix status field problem (#13)
andrii-hantkovskyi Apr 25, 2024
dce6069
refactor: [ACI-972] change course status to is_passing & add docs (#14)
andrii-hantkovskyi May 7, 2024
63f1dc9
fix: remove obsolete changes
wowkalucky May 7, 2024
3b208f8
Merge branch 'aci.main' into aci.upstream
wowkalucky May 7, 2024
a72c7e4
Merge branch 'main' into aci.upstream
wowkalucky May 7, 2024
02d715a
fix: merge upstream requirements
wowkalucky May 7, 2024
1068d0a
style: quality checks
wowkalucky May 7, 2024
bc2c855
style: add missing end of line
wowkalucky May 8, 2024
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
21 changes: 21 additions & 0 deletions openedx_events/event_bus/avro/custom_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from abc import ABC, abstractmethod
from datetime import datetime

from ccx_keys.locator import CCXLocator
from opaque_keys.edx.keys import CourseKey, UsageKey
from opaque_keys.edx.locator import LibraryLocatorV2, LibraryUsageLocatorV2

Expand Down Expand Up @@ -49,6 +50,25 @@ def deserialize(data: str):
return CourseKey.from_string(data)


class CcxCourseLocatorAvroSerializer(BaseCustomTypeAvroSerializer):
"""
CustomTypeAvroSerializer for CCXLocator class.
"""

cls = CCXLocator
field_type = PYTHON_TYPE_TO_AVRO_MAPPING[str]

@staticmethod
def serialize(obj) -> str:
"""Serialize obj into string."""
return str(obj)

@staticmethod
def deserialize(data: str):
"""Deserialize string into obj."""
return CCXLocator.from_string(data)


class DatetimeAvroSerializer(BaseCustomTypeAvroSerializer):
"""
CustomTypeAvroSerializer for datetime class.
Expand Down Expand Up @@ -131,6 +151,7 @@ def deserialize(data: str):

DEFAULT_CUSTOM_SERIALIZERS = [
CourseKeyAvroSerializer,
CcxCourseLocatorAvroSerializer,
DatetimeAvroSerializer,
LibraryLocatorV2AvroSerializer,
LibraryUsageLocatorV2AvroSerializer,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "badge",
"type": {
"name": "BadgeData",
"type": "record",
"fields": [
{
"name": "uuid",
"type": "string"
},
{
"name": "user",
"type": {
"name": "UserData",
"type": "record",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "is_active",
"type": "boolean"
},
{
"name": "pii",
"type": {
"name": "UserPersonalData",
"type": "record",
"fields": [
{
"name": "username",
"type": "string"
},
{
"name": "email",
"type": "string"
},
{
"name": "name",
"type": "string"
}
]
}
}
]
}
},
{
"name": "template",
"type": {
"name": "BadgeTemplateData",
"type": "record",
"fields": [
{
"name": "uuid",
"type": "string"
},
{
"name": "origin",
"type": "string"
},
{
"name": "name",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "description",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "image_url",
"type": [
"null",
"string"
],
"default": null
}
]
}
}
]
}
}
],
"namespace": "org.openedx.learning.badge.awarded.v1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "badge",
"type": {
"name": "BadgeData",
"type": "record",
"fields": [
{
"name": "uuid",
"type": "string"
},
{
"name": "user",
"type": {
"name": "UserData",
"type": "record",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "is_active",
"type": "boolean"
},
{
"name": "pii",
"type": {
"name": "UserPersonalData",
"type": "record",
"fields": [
{
"name": "username",
"type": "string"
},
{
"name": "email",
"type": "string"
},
{
"name": "name",
"type": "string"
}
]
}
}
]
}
},
{
"name": "template",
"type": {
"name": "BadgeTemplateData",
"type": "record",
"fields": [
{
"name": "uuid",
"type": "string"
},
{
"name": "origin",
"type": "string"
},
{
"name": "name",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "description",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "image_url",
"type": [
"null",
"string"
],
"default": null
}
]
}
}
]
}
}
],
"namespace": "org.openedx.learning.badge.revoked.v1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "course_passing_status",
"type": {
"name": "CcxCoursePassingStatusData",
"type": "record",
"fields": [
{
"name": "status",
"type": "string"
},
{
"name": "user",
"type": {
"name": "UserData",
"type": "record",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "is_active",
"type": "boolean"
},
{
"name": "pii",
"type": {
"name": "UserPersonalData",
"type": "record",
"fields": [
{
"name": "username",
"type": "string"
},
{
"name": "email",
"type": "string"
},
{
"name": "name",
"type": "string"
}
]
}
}
]
}
},
{
"name": "course",
"type": {
"name": "CcxCourseData",
"type": "record",
"fields": [
{
"name": "ccx_course_key",
"type": "string"
},
{
"name": "master_course_key",
"type": "string"
},
{
"name": "display_name",
"type": "string"
},
{
"name": "coach_email",
"type": "string"
},
{
"name": "start",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "end",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "max_students_allowed",
"type": [
"null",
"long"
],
"default": null
}
]
}
}
]
}
}
],
"namespace": "org.openedx.learning.ccx.course.passing.status.updated.v1"
}
Loading
Loading