-
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 data attributes definition for learning subdomain
- Loading branch information
1 parent
1f8a798
commit aa94458
Showing
7 changed files
with
145 additions
and
25 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,87 @@ | ||
""" | ||
Data attributes for events within the architecture subdomain `learning`. | ||
These attributes follow the form of attr objects specified in OEP-49 data | ||
pattern. | ||
""" | ||
from typing import Dict | ||
|
||
import attr | ||
from opaque_keys.edx.keys import CourseKey | ||
|
||
|
||
@attr.s(frozen=True) | ||
class ProfileData: | ||
""" | ||
Attributes defined for Open edX student's profile object. | ||
""" | ||
|
||
meta = attr.ib(type=Dict[str, str], factory=dict) | ||
name = attr.ib(type=str, factory=str) | ||
|
||
|
||
@attr.s(frozen=True) | ||
class StudentData: | ||
""" | ||
Attributes defined for Open edX student object. | ||
""" | ||
|
||
username = attr.ib(type=str) | ||
email = attr.ib(type=str) | ||
first_name = attr.ib(type=str, factory=str) | ||
last_name = attr.ib(type=str, factory=str) | ||
is_active = attr.ib(type=bool, default=True) | ||
profile = attr.ib(type=ProfileData, default=ProfileData()) | ||
|
||
|
||
@attr.s(frozen=True) | ||
class RegistrationData: | ||
""" | ||
Attributes defined for Open edX registration profile object. | ||
""" | ||
|
||
activation_key = attr.ib(type=str) | ||
|
||
|
||
@attr.s(frozen=True) | ||
class CourseOverviewData: | ||
""" | ||
Attributes defined for Open edX Course Overview object. | ||
""" | ||
|
||
course_key = attr.ib(type=CourseKey) | ||
display_name = attr.ib(type=CourseKey, factory=str) | ||
|
||
|
||
@attr.s(frozen=True) | ||
class CourseEnrollmentData: | ||
""" | ||
Attributes defined for Open edX Course Enrollment object. | ||
""" | ||
|
||
user = attr.ib(type=StudentData) | ||
course = attr.ib(type=CourseOverviewData) | ||
mode = attr.ib(type=str) | ||
is_active = attr.ib(type=bool) | ||
|
||
|
||
@attr.s(frozen=True) | ||
class CertificateData(CourseEnrollmentData): | ||
""" | ||
Attributes defined for Open edX Certificate data object. | ||
""" | ||
|
||
grade = attr.ib(type=str) | ||
status = attr.ib(type=str) | ||
download_url = attr.ib(type=str) | ||
name = attr.ib(type=str) | ||
|
||
|
||
@attr.s(frozen=True) | ||
class CohortData: | ||
""" | ||
Attributes defined for Open edX Cohort Membership object. | ||
""" | ||
|
||
user = attr.ib(type=StudentData) | ||
course = attr.ib(type=CourseOverviewData) |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Core requirements for using this application | ||
-c constraints.txt | ||
|
||
attrs | ||
django | ||
django-crum | ||
edx-opaque-keys[django] |
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
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
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
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
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