-
Notifications
You must be signed in to change notification settings - Fork 27
feat: add data attributes definition for learning subdomain #8
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| """ | ||
| Data attributes for events within the architecture subdomain `learning`. | ||
|
|
||
| These attributes follow the form of attr objects specified in OEP-49 data | ||
| pattern. | ||
| """ | ||
| from datetime import datetime | ||
|
|
||
| import attr | ||
| from opaque_keys.edx.keys import CourseKey | ||
|
|
||
|
|
||
| @attr.s(frozen=True) | ||
| class UserNonPersonalData: | ||
| """ | ||
| Attributes defined for Open edX user object based on non-PII data. | ||
|
|
||
| Arguments: | ||
| id (int): unique identifier for the Django User object. | ||
| is_active (bool): indicates whether the user is active. | ||
| """ | ||
|
|
||
| id = attr.ib(type=int) | ||
| is_active = attr.ib(type=bool) | ||
|
|
||
|
|
||
| @attr.s(frozen=True) | ||
| class UserPersonalData: | ||
| """ | ||
| Attributes defined for Open edX user object based on PII data. | ||
|
|
||
| Arguments: | ||
| username (str): username associated with the Open edX user. | ||
| email (str): email associated with the Open edX user. | ||
| name (str): email associated with the Open edX user's profile. | ||
| """ | ||
|
|
||
| username = attr.ib(type=str) | ||
| email = attr.ib(type=str) | ||
| name = attr.ib(type=str, factory=str) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is is possible to separate out the PII parts (email, name) of this data into a separate object from the non-PII parts? I strongly suspect we'll want to annotate this stuff eventually, but having explicit separation is something simple we can do now.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great suggestion! We're on it
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @ormsbee! We followed your suggestions. Now, the user is divided into two parts with PII and non-PII information
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @feanil! |
||
|
|
||
|
|
||
| @attr.s(frozen=True) | ||
| class UserData(UserNonPersonalData): | ||
| """ | ||
| Attributes defined for Open edX user object. | ||
|
|
||
| This class extends UserNonPersonalData to include PII data completing the | ||
| user object. | ||
|
|
||
| Arguments: | ||
| pii (UserPersonalData): user's Personal Identifiable Information. | ||
| """ | ||
|
|
||
| pii = attr.ib(type=UserPersonalData) | ||
|
|
||
|
|
||
| @attr.s(frozen=True) | ||
| class CourseData: | ||
| """ | ||
| Attributes defined for Open edX Course Overview object. | ||
|
|
||
| Arguments: | ||
| course_key (str): identifier of the Course object. | ||
| display_name (str): display name associated with the course. | ||
| start (datetime): start date for the course. | ||
| end (datetime): end date for the course. | ||
| """ | ||
|
|
||
| course_key = attr.ib(type=CourseKey) | ||
| display_name = attr.ib(type=str, factory=str) | ||
| start = attr.ib(type=datetime, default=None) | ||
| end = attr.ib(type=datetime, default=None) | ||
|
|
||
|
|
||
| @attr.s(frozen=True) | ||
| class CourseEnrollmentData: | ||
| """ | ||
| Attributes defined for Open edX Course Enrollment object. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there anything about the context of the enrollment that we want to capture? Like who did the enrolling?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That might be useful. What do you think about sending Also, do you think It'd be helpful for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would maybe send the money related stuff as a separate event from events related to learning. I'm thinking of it as a separation between things important from an ecommerce domain perspective and the teaching/learning perspective. (Loosely held opinion) |
||
|
|
||
| Arguments: | ||
| user (UserData): user associated with the Course Enrollment. | ||
| course (CourseData): course where the user is enrolled in. | ||
| mode (str): course mode associated with the course. | ||
| is_active (bool): whether the enrollment is active. | ||
| creation_date (datetime): creation date of the enrollment. | ||
| created_by (UserData): if available, who created the enrollment. | ||
| """ | ||
|
|
||
| user = attr.ib(type=UserData) | ||
| course = attr.ib(type=CourseData) | ||
| mode = attr.ib(type=str) | ||
| is_active = attr.ib(type=bool) | ||
| creation_date = attr.ib(type=datetime) | ||
| created_by = attr.ib(type=UserData, default=None) | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing datetime of enrollment? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or is that because it's going in a separate higher-level datetime field for the event as a whole?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, we're missing the creation date of the enrollment. We'll probably -surely- need it. Also, the DateTime field for the event may differ from the enrollment definition, so we'll surely add it. |
||
|
|
||
| @attr.s(frozen=True) | ||
| class CertificateData: | ||
| """ | ||
| Attributes defined for Open edX Certificate data object. | ||
|
|
||
| Arguments: | ||
| user (UserData): user associated with the Certificate. | ||
| course (CourseData): course where the user obtained the certificate. | ||
| mode (str): course mode associated with the course. | ||
| grade (str): user's grade in this course run. | ||
| current_status (str): current certificate status. | ||
| previous_status (str): if available, pre-event certificate status. | ||
| download_url (str): URL where the PDF version of the certificate. | ||
| name (str): user's name. | ||
| """ | ||
|
|
||
| user = attr.ib(type=UserData) | ||
| course = attr.ib(type=CourseData) | ||
| mode = attr.ib(type=str) | ||
| grade = attr.ib(type=str) | ||
| download_url = attr.ib(type=str) | ||
| name = attr.ib(type=str) | ||
| current_status = attr.ib(type=str) | ||
| previous_status = attr.ib(type=str, factory=str) | ||
|
|
||
|
|
||
| @attr.s(frozen=True) | ||
| class CohortData: | ||
| """ | ||
| Attributes defined for Open edX Cohort Membership object. | ||
|
|
||
| Arguments: | ||
| user (UserData): user assigned to the group. | ||
| course (CourseData): course associated with the course group. | ||
| name (str): name of the cohort group. | ||
| """ | ||
|
|
||
| user = attr.ib(type=UserData) | ||
| course = attr.ib(type=CourseData) | ||
| name = attr.ib(type=str) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| # Core requirements for using this application | ||
| -c constraints.txt | ||
|
|
||
| django | ||
| attrs | ||
| django | ||
| edx-opaque-keys[django] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we're not passing the ID of the student?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no specific reason besides security issues -given that the ID is numerical and auto-incremented-. However, after some digging, we found OEP-32 that supports the usage of the user_id:
So, let's adopt the usage of the user_id even with the downsides in this case.
What are your thoughts on this @felipemontoya?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you put it in the UserNonPersonalData attr class. Given the "LMS user_id can be used for public events" portion of OEP-32 I think we are in the clear