|
| 1 | +""" |
| 2 | +Data attributes for events within the architecture subdomain `learning`. |
| 3 | +
|
| 4 | +These attributes follow the form of attr objects specified in OEP-49 data |
| 5 | +pattern. |
| 6 | +""" |
| 7 | +from datetime import datetime |
| 8 | +from typing import Dict |
| 9 | + |
| 10 | +import attr |
| 11 | +from opaque_keys.edx.keys import CourseKey |
| 12 | + |
| 13 | + |
| 14 | +@attr.s(frozen=True) |
| 15 | +class StudentData: |
| 16 | + """ |
| 17 | + Attributes defined for Open edX student object. |
| 18 | + """ |
| 19 | + |
| 20 | + username = attr.ib(type=str) |
| 21 | + email = attr.ib(type=str) |
| 22 | + is_active = attr.ib(type=bool, default=True) |
| 23 | + meta = attr.ib(type=Dict[str, str], factory=dict) |
| 24 | + name = attr.ib(type=str, factory=str) |
| 25 | + |
| 26 | + |
| 27 | +@attr.s(frozen=True) |
| 28 | +class RegistrationFormData: |
| 29 | + """ |
| 30 | + Attributes defined for Open edX student object. |
| 31 | + """ |
| 32 | + |
| 33 | + account_form = attr.ib(type=Dict[str, str], factory=dict) |
| 34 | + extension_form = attr.ib(type=Dict[str, str], factory=dict) |
| 35 | + |
| 36 | + |
| 37 | +@attr.s(frozen=True) |
| 38 | +class CourseData: |
| 39 | + """ |
| 40 | + Attributes defined for Open edX Course Overview object. |
| 41 | + """ |
| 42 | + |
| 43 | + course_key = attr.ib(type=CourseKey) |
| 44 | + display_name = attr.ib(type=str, factory=str) |
| 45 | + start = attr.ib(type=datetime, default=None) |
| 46 | + end = attr.ib(type=datetime, default=None) |
| 47 | + |
| 48 | + |
| 49 | +@attr.s(frozen=True) |
| 50 | +class CourseEnrollmentData: |
| 51 | + """ |
| 52 | + Attributes defined for Open edX Course Enrollment object. |
| 53 | + """ |
| 54 | + |
| 55 | + user = attr.ib(type=StudentData) |
| 56 | + course = attr.ib(type=CourseData) |
| 57 | + mode = attr.ib(type=str) |
| 58 | + is_active = attr.ib(type=bool) |
| 59 | + |
| 60 | + |
| 61 | +@attr.s(frozen=True) |
| 62 | +class CertificateData: |
| 63 | + """ |
| 64 | + Attributes defined for Open edX Certificate data object. |
| 65 | + """ |
| 66 | + |
| 67 | + user = attr.ib(type=StudentData) |
| 68 | + course = attr.ib(type=CourseData) |
| 69 | + mode = attr.ib(type=str) |
| 70 | + grade = attr.ib(type=str) |
| 71 | + status = attr.ib(type=str) |
| 72 | + download_url = attr.ib(type=str) |
| 73 | + name = attr.ib(type=str) |
| 74 | + |
| 75 | + |
| 76 | +@attr.s(frozen=True) |
| 77 | +class CohortData: |
| 78 | + """ |
| 79 | + Attributes defined for Open edX Cohort Membership object. |
| 80 | + """ |
| 81 | + |
| 82 | + user = attr.ib(type=StudentData) |
| 83 | + course = attr.ib(type=CourseData) |
| 84 | + name = attr.ib(type=str) |
0 commit comments