class CourseSubjectRecord(Record):
    """Represents course subject categorizations for a course."""
    course_id = StringField(nullable=False, length=200)
    date = DateField(nullable=True)
    subject_uri = StringField(nullable=True, length=200)
    subject_title = StringField(nullable=True, length=200)
    subject_language = StringField(nullable=True, length=200)
Example #2
0
class VideoSegmentDetailRecord(Record):
    """
    Video Segment Usage Detail
    """

    pipeline_video_id = StringField(length=255,
                                    nullable=False,
                                    description='A concatenation of the course_id and the HTML encoded ID of the video.'
                                                ' Intended to uniquely identify an instance of a video in a particular '
                                                'course. Note that ideally we would use an XBlock usage_id here, but '
                                                'it isn\'t present on the legacy events.')
    course_id = StringField(length=255,
                            nullable=False,
                            description='Course the video was displayed in. This is an opaque key serialized to '
                                        'a string.')
    encoded_module_id = StringField(length=255,
                                    nullable=False,
                                    description='This is the HTML encoded module ID for the video. Ideally this would '
                                                'be an XBlock usage_id, but that data is not present on legacy events.')
    duration = IntegerField(description='The video length in seconds. This can be inferred for some videos. We don\'t '
                                        'have reliable metadata for the length of videos in the source data.')
    segment_length = IntegerField(description='The length of each segment, in seconds.')
    users_at_start = IntegerField(description='The number of users who watched the first segment of the video.')
    users_at_end = IntegerField(description='The number of users who watched the end of the video. Note that this is '
                                            'not the number of users who watched the last segment of the video.')
    segment = IntegerField(description='An integer representing the rank of the segment within the video. 0 is the '
                                       'first segment, 1 is the second etc. Note that this does not specify the length '
                                       'of the segment.')
    num_users = IntegerField(description='The number of unique users who watched any part of this segment of the '
                                         'video.')
    num_views = IntegerField(description='The total number of times any part of the segment was viewed, regardless of '
                                         'who was watching it.')
class LastCountryPerCourseRecord(Record):
    """For a given course, stores aggregates about last country."""
    date = DateField(nullable=False, description="Date of course enrollment data.")
    course_id = StringField(length=255, nullable=False, description="Course ID for course/last-country pair being counted.")
    country_code = StringField(length=10, nullable=True, description="Code for country in course/last-country pair being counted.")
    count = IntegerField(nullable=False, description="Number enrolled in course whose current last country code matches.")
    cumulative_count = IntegerField(nullable=False, description="Number ever enrolled in course whose current last-country code matches.")
Example #4
0
class PermissionRecordBase(Record):
    user_id = StringField(description='User ID.', nullable=False, length=30)
    user_email = StringField(description='Email of this user.',
                             nullable=False,
                             length=100)
    has_manage_users = BooleanField(
        description='Whether the user has MANAGE_USERS permission.',
        nullable=False)
    has_edit = BooleanField(
        description='Whether the user has EDIT permission.', nullable=False)
    has_collaborate = BooleanField(
        description='Whether the user has COLLABORATE permission.',
        nullable=False)
    has_read_and_analyze = BooleanField(
        description='Whether the user has READ_AND_ANALYZE permission.',
        nullable=False)
    manage_users_set = BooleanField(
        description=
        'Whether the user has been assigned MANAGE_USERS permission.',
        nullable=False)
    edit_set = BooleanField(
        description='Whether the user has been assigned EDIT permission.',
        nullable=False)
    collaborate_set = BooleanField(
        description=
        'Whether the user has been assigned COLLABORATE permission.',
        nullable=False)
    read_and_analyze_set = BooleanField(
        description=
        'Whether the user has been assigned READ_AND_ANALYZE permission.',
        nullable=False)
Example #5
0
class VideoSegmentSummaryRecord(Record):
    """
    Video Segment Summary Information used to populate the video table
    """

    pipeline_video_id = StringField(length=255,
                                    nullable=False,
                                    description='A concatenation of the course_id and the HTML encoded ID of the video.'
                                                ' Intended to uniquely identify an instance of a video in a particular '
                                                'course. Note that ideally we would use an XBlock usage_id here, but '
                                                'it isn\'t present on the legacy events.')
    course_id = StringField(length=255,
                            nullable=False,
                            description='Course the video was displayed in. This is an opaque key serialized to '
                                        'a string.')
    encoded_module_id = StringField(length=255,
                                    nullable=False,
                                    description='This is the HTML encoded module ID for the video. Ideally this would '
                                                'be an XBlock usage_id, but that data is not present on legacy events.')
    duration = IntegerField(description='The video length in seconds. This can be inferred for some videos. We don\'t '
                                        'have reliable metadata for the length of videos in the source data.')
    segment_length = IntegerField(description='The length of each segment, in seconds.')
    users_at_start = IntegerField(description='The number of users who watched the first segment of the video.')
    users_at_end = IntegerField(description='The number of users who watched the end of the video. Note that this is '
                                            'not the number of users who watched the last segment of the video.')
    total_viewed_seconds = IntegerField(description='The total number of seconds viewed by all users across all '
                                                    'segments.')
Example #6
0
class CourseActivityRecord(Record):
    """Represents count of users performing each category of activity each ISO week."""
    course_id = StringField(length=255, nullable=False, description='The course the learner is enrolled in.')
    interval_start = DateTimeField(nullable=False, description='Start time of ISO week.')
    interval_end = DateTimeField(nullable=False, description='End time of ISO week.')
    label = StringField(length=255, nullable=False, description='The name of activity user performed in the interval.')
    count = IntegerField(description='Total count of activities performed between the interval.')
class CourseSeatRecord(Record):
    """Represents a course seat within course run."""
    course_id = StringField(nullable=False, length=255)
    course_seat_type = StringField(nullable=False, length=255)
    course_seat_price = FloatField(nullable=False)
    course_seat_currency = StringField(nullable=False, length=255)
    course_seat_upgrade_deadline = DateTimeField(nullable=True)
    course_seat_credit_provider = StringField(nullable=True, length=255)
    course_seat_credit_hours = IntegerField(nullable=True)
class LastIpAddressRecord(Record):
    """
    Store information about last IP address observed for a given user in a given course.

    Values are not written to a database, so string lengths are not specified.
    """
    timestamp = StringField(description='Timestamp of last event by user in a course.')
    ip_address = StringField(description='IP address recorded on last event by user in a course.')
    user_id = IntegerField(description='User ID recorded on last event by user in a course.')
    course_id = StringField(description='Course ID recorded on last event by user in a course.')
class TagsDistributionRecord(Record):
    """Represents a count of total/correct submissions for the particular bunch (problem_id, tag_key, tag_value)."""

    course_id = StringField(length=255, nullable=False, description='Course id')
    org_id = StringField(length=255, nullable=False, description='Org id')
    module_id = StringField(length=255, nullable=False, description='Problem id')
    tag_name = StringField(length=255, nullable=False, description='Tag key')
    tag_value = StringField(length=255, nullable=False, description='Tag value')
    total_submissions = IntegerField(nullable=False, description='Number of total submissions')
    correct_submissions = IntegerField(nullable=False, description='Number of correct submissions')
Example #10
0
class CourseRecord(Record):
    """
    Represents a single course's details as fetched from the edX Courses REST API.
    """
    course_id = StringField(nullable=False,
                            length=255,
                            description='Course identifier.')
    name = StringField(nullable=False,
                       length=255,
                       truncate=True,
                       normalize_whitespace=True,
                       description='Course name, truncated to 255 characters.')
    org = StringField(nullable=False,
                      length=255,
                      description='Course organization.')
    number = StringField(nullable=False,
                         length=255,
                         description='Course number.')
    blocks_url = StringField(nullable=False,
                             description='URL of the course\'s blocks')
    short_description = StringField(
        nullable=True,
        length=255,
        truncate=True,
        normalize_whitespace=True,
        description='Short course description, truncated to 255 characters.')
    enrollment_start = DateTimeField(nullable=True,
                                     description='Enrollment start date.')
    enrollment_end = DateTimeField(nullable=True,
                                   description='Enrollment end date.')
    start_date = DateTimeField(nullable=True, description='Course start date.')
    end_date = DateTimeField(nullable=True, description='Course end date.')
    start_display = StringField(nullable=True,
                                length=255,
                                normalize_whitespace=True,
                                description='Course start date description.')
    start_type = StringField(
        nullable=True,
        length=255,
        normalize_whitespace=True,
        description=
        'Indicates how start_display was set, e.g. "string", "timestamp", "empty".'
    )
    effort = StringField(
        nullable=True,
        length=255,
        truncate=True,
        normalize_whitespace=True,
        description=
        'Description of effort required, truncated to 255 characters.')
    pacing = StringField(nullable=True,
                         length=255,
                         normalize_whitespace=True,
                         description='Description of course pacing strategy.')
class EnterpriseUserRecord(Record):
    """Summarizes an enterprise user"""
    enterprise_id = StringField(length=32, nullable=False, description='')
    lms_user_id = IntegerField(nullable=False, description='')
    enterprise_user_id = IntegerField(nullable=False, description='')
    enterprise_sso_uid = StringField(length=255, description='')
    user_account_creation_timestamp = DateTimeField(description='')
    user_email = StringField(length=255, description='')
    user_username = StringField(length=255, description='')
    user_country_code = StringField(length=2, description='')
    last_activity_date = DateField(description='')
Example #12
0
class GradesPersistentCourseGradeRecord(Record):
    id = IntegerField()
    user_id = IntegerField()
    course_id = StringField()
    course_edited_timestamp = DateTimeField()
    course_version = StringField()
    grading_policy_hash = StringField()
    percent_grade = FloatField()
    letter_grade = StringField()
    passed_timestamp = DateTimeField()
    created = DateTimeField()
    modified = DateTimeField()
class VideoTimelineRecord(Record):
    """
    Video Segment Information used to populate the video_timeline table
    """

    pipeline_video_id = StringField(
        length=255,
        nullable=False,
        description=
        'A concatenation of the course_id and the HTML encoded ID of the video.'
        ' Intended to uniquely identify an instance of a video in a particular '
        'course. Note that ideally we would use an XBlock usage_id here, but '
        'it isn\'t present on the legacy events.')
    segment = IntegerField(
        description=
        'An integer representing the rank of the segment within the video. 0 is the '
        'first segment, 1 is the second etc. Note that this does not specify the length '
        'of the segment.')
    num_users = IntegerField(
        description=
        'The number of unique users who watched any part of this segment of the '
        'video.')
    num_views = IntegerField(
        description=
        'The total number of times any part of the segment was viewed, regardless of '
        'who was watching it.')
class ProgramCourseRecord(Record):
    """Represents a course run within a program."""
    program_id = StringField(nullable=False, length=36)
    program_type = StringField(nullable=False, length=32)
    program_title = StringField(nullable=True, length=255)
    catalog_course = StringField(nullable=False, length=255)
    catalog_course_title = StringField(nullable=True, length=255)
    course_id = StringField(nullable=False, length=255)
    org_id = StringField(nullable=False, length=255)
    partner_short_code = StringField(nullable=True, length=8)
Example #15
0
class StudentEngagementIntervalTypeRecord(Record):
    """
    Student Engagement information used to populate student_engagement_{interval_type} tables.
    """

    end_date = DateField(
        description='End date of the interval being analyzed.')
    course_id = StringField(nullable=False,
                            length=255,
                            description='Identifier of course run.')
    username = StringField(
        nullable=False,
        length=255,
        description=
        'The username of the user who was logged in when the event was emitted.'
    )
    days_active = IntegerField(
        description='Count of days user has been active during the interval.')
    problems_attempted = IntegerField(
        description='Count of unique problems attempted.')
    problem_attempts = IntegerField(
        description='Total count of problem attempts.')
    problems_correct = IntegerField(
        description='Count of unique problems that were answered correctly.')
    videos_played = IntegerField(description='Count of unique videos played.')
    forum_posts = IntegerField(description='Count of discussion posts.')
    forum_responses = IntegerField(
        description='Count of discussion responses created by user.')
    forum_comments = IntegerField(
        description='Count of discussion comments by user.')
    forum_upvotes_given = IntegerField(
        description='Total upvotes given by user on discussion posts.')
    forum_downvotes_given = IntegerField(
        description='Total downvotes given by user on discussion posts.')
    forum_upvotes_received = IntegerField(
        description='Total upvotes received by user on discussion posts.')
    forum_downvotes_received = IntegerField(
        description='Total downvotes received by user on discussion posts.')
    textbook_pages_viewed = IntegerField(
        description='Total textbook pages viewed by user.')
    last_subsection_viewed = StringField(
        nullable=False,
        length=1000,
        description=
        'Page URL which was last visited by user during the interval.')
Example #16
0
class ProblemResponseRecord(Record):
    """
    Record containing the data for a single user's response to a problem, in a given date range.

    If there are multiple questions in a problem, they are spread over separate ProblemResponseRecords.

    Note that the course_id field is available from the partition string.
    """
    # Data sourced from problem_response tracking logs
    course_id = StringField(description='Course containing the problem.')
    answer_id = StringField(description='Learner\'s answer ID.')
    problem_id = StringField(description='Problem\'s block usage ID.')
    problem = StringField(description='Problem display name, at time of answering.')
    username = StringField(description='Learner\'s username.')
    question = StringField(description='Question\'s display name, at time of answering.')
    score = FloatField(description='Score achieved by the learner.')
    max_score = FloatField(description='Maximum possible score for the problem.')
    correct = BooleanField(nullable=True, description='True if all answers are correct; '
                                                      'False if any answers are not correct; '
                                                      'None if any answers have unknown correctness.')
    answer = DelimitedStringField(description='List of answers the user chose for the question.')
    total_attempts = IntegerField(description='Total number of attempts the user has made on the problem.')
    first_attempt_date = DateTimeField(description='date/time of the first attempt the user has made on the problem.')
    last_attempt_date = DateTimeField(description='date/time of the last attempt the user has made on the problem.')

    # Data sourced from course_blocks
    location = StringField(description='Problem location in the course, concatenated from Section, Subsection, Unit, '
                                       'and problem display name.  Sourced from course_blocks.course_path')
    sort_idx = IntegerField(description='Sort index for the problem location.  Sourced from course_blocks.sort_idx')
Example #17
0
class ProfileRecord(Record):
    """Represents a Google Analytics View (profile)."""
    property_id = StringField(
        description='Web property ID to which this view (profile) belongs.',
        nullable=False,
        length=20)
    profile_id = IntegerField(description='View (Profile) ID.', nullable=False)
    profile_name = StringField(description='Name of this view (profile).',
                               nullable=False,
                               length=200)
    profile_type = StringField(description='View (Profile) type. WEB or APP.',
                               nullable=False,
                               length=10)
    created = DateTimeField(
        description='Time this view (profile) was created.', nullable=False)
    updated = DateTimeField(
        description='Time this view (profile) was last modified.',
        nullable=False)
class ProgramCourseRecord(Record):
    """Represents a course run within a program."""
    program_id = StringField(nullable=False, length=36)
    program_type = StringField(nullable=False, length=32)
    program_title = StringField(nullable=True, length=255, normalize_whitespace=True)
    catalog_course = StringField(nullable=False, length=255)
    catalog_course_title = StringField(nullable=True, length=255, normalize_whitespace=True)
    course_id = StringField(nullable=False, length=255)
    org_id = StringField(nullable=True, length=255)
    partner_short_code = StringField(nullable=True, length=8)
    program_slot_number = IntegerField(nullable=True)
Example #19
0
class AccountRecord(Record):
    """Represents a google analytics account."""
    account_id = IntegerField(description='Google Analytics Account ID',
                              nullable=False)
    account_name = StringField(description='Google Analytics Account Name',
                               nullable=False,
                               length=200)
    created = DateTimeField(description='Time the account was created.',
                            nullable=False)
    updated = DateTimeField(description='Time the account was last modified.',
                            nullable=False)
Example #20
0
class PropertyRecord(Record):
    """Represents a Google Analytics Web Property."""
    account_id = IntegerField(
        description='Account ID to which this web property belongs.',
        nullable=False)
    property_id = StringField(
        description='Web property ID of the form UA-XXXXX-YY.',
        nullable=False,
        length=20)
    property_name = StringField(description='Name of this web property.',
                                nullable=False,
                                length=200)
    website_url = StringField(description='Website url for this web property.',
                              nullable=True,
                              length=255)
    created = DateTimeField(description='Time this web property was created.',
                            nullable=False)
    updated = DateTimeField(
        description='Time this web property was last modified.',
        nullable=False)
class CourseRecord(Record):
    """Represents a course."""
    course_id = StringField(nullable=False, length=255)
    catalog_course = StringField(nullable=False, length=255)
    catalog_course_title = StringField(nullable=True,
                                       length=255,
                                       normalize_whitespace=True)
    start_time = DateTimeField(nullable=True)
    end_time = DateTimeField(nullable=True)
    enrollment_start_time = DateTimeField(nullable=True)
    enrollment_end_time = DateTimeField(nullable=True)
    content_language = StringField(nullable=True, length=50)
    pacing_type = StringField(nullable=True, length=255)
    level_type = StringField(nullable=True, length=255)
    availability = StringField(nullable=True, length=255)
    org_id = StringField(nullable=False, length=255)
    partner_short_code = StringField(nullable=True, length=8)
    marketing_url = StringField(nullable=True, length=1024)
    min_effort = IntegerField(nullable=True)
    max_effort = IntegerField(nullable=True)
class CourseBlockRecord(Record):
    """
    Represents a course block as fetched from the edX Course Blocks REST API, augmented with details about its
    position in the course.
    """
    block_id = StringField(length=564, nullable=False, description='Block identifier.')
    course_id = StringField(length=255, nullable=False, description='Identifier for the course containing the block.')
    block_type = StringField(length=255, nullable=False,
                             description='Block type, e.g. `video`, `chapter`, `problem`, `vectordraw`.')
    display_name = StringField(length=255, nullable=False, truncate=True, normalize_whitespace=True,
                               description='User-facing title of the block. Will be truncated to 255 characters.')
    is_root = BooleanField(default=False, nullable=False,
                           description='True if the block is the course\'s root node.')
    is_orphan = BooleanField(default=False, nullable=False,
                             description='True if the block has no parent nodes, but is not a root node.')
    is_dag = BooleanField(default=False, nullable=False,
                          description='True if the block has more than one parent, making the course a Directed '
                                      'Acyclic Graph.  If True, parent_block_id, course_path, and sort_idx will be set '
                                      'to the first place the block is found when traversing the course blocks tree.')
    parent_block_id = StringField(length=255, nullable=True,
                                  description='Block identifier for the block\'s parent.')
    course_path = StringField(nullable=True, normalize_whitespace=True,
                              description='Concatenated string of parent block display_name values, from '
                                          'the root node to the parent_block_id.')
    sort_idx = IntegerField(nullable=True,
                            description='Number indicating the position that this block holds in a course-outline '
                                        'sorted list of blocks. See `CourseBlocksApiDataTask.sort_orphan_blocks_up`.')
class CourseSummaryEnrollmentRecord(Record):
    """Recent enrollment summary and metadata for a course."""
    course_id = StringField(nullable=False,
                            length=255,
                            description='A unique identifier of the course')
    catalog_course_title = StringField(nullable=True,
                                       length=255,
                                       normalize_whitespace=True,
                                       description='The name of the course')
    catalog_course = StringField(nullable=True,
                                 length=255,
                                 description='Course identifier without run')
    start_time = DateTimeField(
        nullable=True, description='The date and time that the course begins')
    end_time = DateTimeField(
        nullable=True, description='The date and time that the course ends')
    pacing_type = StringField(nullable=True,
                              length=255,
                              description='The type of pacing for this course')
    availability = StringField(nullable=True,
                               length=255,
                               description='Availability status of the course')
    enrollment_mode = StringField(
        length=100,
        nullable=False,
        description='Enrollment mode for the enrollment counts')
    count = IntegerField(
        nullable=True, description='The count of currently enrolled learners')
    count_change_7_days = IntegerField(
        nullable=True,
        description='Difference in enrollment counts over the past 7 days')
    cumulative_count = IntegerField(
        nullable=True,
        description='The cumulative total of all users ever enrolled')
class EnrollmentSummaryRecord(Record):
    """Summarizes a user's enrollment history for a particular course."""

    course_id = StringField(length=255,
                            nullable=False,
                            description='Course the learner enrolled in.')
    user_id = IntegerField(nullable=False,
                           description='The user\'s numeric identifier.')
    current_enrollment_mode = StringField(
        length=100,
        nullable=False,
        description='The last mode seen on an activation or mode change event.'
    )
    current_enrollment_is_active = BooleanField(
        nullable=False,
        description=
        'True if the user is currently enrolled as of the end of the interval.'
    )
    first_enrollment_mode = StringField(
        length=100,
        nullable=True,
        description='The mode the user first enrolled with.')
    first_enrollment_time = DateTimeField(
        nullable=True, description='The time of the user\'s first enrollment.')
    last_unenrollment_time = DateTimeField(
        nullable=True,
        description='The time of the user\'s last unenrollment.')
    first_verified_enrollment_time = DateTimeField(
        nullable=True,
        description='The time the user first switched to the verified track.')
    first_credit_enrollment_time = DateTimeField(
        nullable=True,
        description='The time the user first switched to the credit track.')
    end_time = DateTimeField(
        nullable=False,
        description='The end of the interval that was analyzed.')
Example #25
0
 def test_validate_success(self, value):
     test_record = StringField()
     self.assertEqual(len(test_record.validate(value)), 0)
Example #26
0
class IdForPropertyPermission(object):
    property_id = StringField(description='Web property ID.',
                              nullable=False,
                              length=20)
 def test_sql_type_with_length_not_null(self):
     test_record = StringField(length=10, nullable=False)
     self.assertEqual(test_record.sql_type, 'VARCHAR(10) NOT NULL')
Example #28
0
 def test_validate_error(self, value):
     test_record = StringField()
     self.assertEqual(len(test_record.validate(value)), 1)
Example #29
0
class EnterpriseEnrollmentRecord(Record):
    """Summarizes a course's enrollment by gender and date."""
    enterprise_id = StringField(length=32, nullable=False, description='')
    enterprise_name = StringField(length=255, nullable=False, description='')
    lms_user_id = IntegerField(nullable=False, description='')
    enterprise_user_id = IntegerField(nullable=False, description='')
    course_id = StringField(length=255, nullable=False, description='The course the learner is enrolled in.')
    enrollment_created_timestamp = DateTimeField(nullable=False, description='')
    user_current_enrollment_mode = StringField(length=32, nullable=False, description='')
    consent_granted = BooleanField(description='')
    letter_grade = StringField(length=32, description='')
    has_passed = BooleanField(description='')
    passed_timestamp = DateTimeField(description='')
    enterprise_sso_uid = StringField(length=255, description='')
    enterprise_site_id = IntegerField(description='')
    course_title = StringField(length=255, description='')
    course_start = DateTimeField(description='')
    course_end = DateTimeField(description='')
    course_pacing_type = StringField(length=32, description='')
    course_duration_weeks = StringField(length=32, description='')
    course_min_effort = IntegerField(description='')
    course_max_effort = IntegerField(description='')
    user_account_creation_timestamp = DateTimeField(description='')
    user_email = StringField(length=255, description='')
    user_username = StringField(length=255, description='')
    course_key = StringField(length=255, description='')
    user_country_code = StringField(length=2, description='')
    last_activity_date = DateField(description='')
    coupon_name = StringField(length=255, description='')
    coupon_code = StringField(length=255, description='')
    offer = StringField(length=255, description='')
    current_grade = FloatField(description='')
    course_price = FloatField(description='')
    discount_price = FloatField(description='')
    unenrollment_timestamp = DateTimeField(description='')
 def test_hive_type(self):
     self.assertEqual(StringField().hive_type, 'STRING')
Example #31
0
 def test_length_exceeded(self, value):
     test_record = StringField(length=3)
     self.assertEqual(len(test_record.validate(value)), 1)
Example #32
0
 def test_truncate(self, value):
     test_record = StringField(length=3, truncate=True)
     self.assertEqual(len(test_record.validate(value)), 0)
     self.assertEqual(test_record.serialize_to_string(value), 'abc')
class LastCountryOfUserRecord(Record):
    """For a given user_id, stores information about last country."""
    country_name = StringField(length=255, description="Name of last country.")
    country_code = StringField(length=10, description="Code for last country.")
    user_id = IntegerField(description="User ID of user with country information.")
 class WithOthers(Record):
     """A record with class-level non-Field variables defined."""
     foo = 'foo'
     name = StringField()
     bar = 10
Example #35
0
 def test_non_nullable(self):
     test_record = StringField(nullable=False)
     self.assertEqual(len(test_record.validate(None)), 1)