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`.')
예제 #2
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='')
예제 #3
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)
예제 #4
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')
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.')
예제 #6
0
 def test_hive_type(self):
     self.assertEqual(BooleanField().hive_type, 'TINYINT')
예제 #7
0
 def test_sql_type(self):
     self.assertEqual(BooleanField().sql_type, 'BOOLEAN')
예제 #8
0
 def test_deserialize(self, value, expected_value):
     for test_record in (BooleanField(), BooleanField(nullable=True)):
         self.assertEquals(test_record.deserialize_from_string(value),
                           expected_value)
예제 #9
0
 def test_serialize(self, value, expected_value):
     # Test with nullable and not
     for test_record in (BooleanField(), BooleanField(nullable=True)):
         self.assertEquals(test_record.serialize_to_string(value),
                           expected_value)
예제 #10
0
 def test_validate_error(self, value):
     test_record = BooleanField()
     self.assertEqual(len(test_record.validate(value)), 1)
예제 #11
0
 def test_validate_success(self, value):
     test_record = BooleanField()
     self.assertEqual(len(test_record.validate(value)), 0)
예제 #12
0
 def test_validate_error(self, value):
     test_record = BooleanField()
     self.assertEqual(len(test_record.validate(value)), 1)
예제 #13
0
 def test_validate_success(self, value):
     test_record = BooleanField()
     self.assertEqual(len(test_record.validate(value)), 0)