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='')
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 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 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()
def test_deserialize_from_string(self): self.assertEqual(FloatField().deserialize_from_string('10.05'), 10.05) self.assertEqual(FloatField().deserialize_from_string('inf'), float('inf'))
def test_serialize_to_string(self): self.assertEqual(FloatField().serialize_to_string(10.05), '10.05') self.assertEqual(FloatField().serialize_to_string(float('inf')), 'inf')
def test_hive_type(self): self.assertEqual(FloatField().hive_type, 'FLOAT')
def test_sql_type(self): self.assertEqual(FloatField().sql_type, 'FLOAT')
def test_validate_error(self, value): test_record = FloatField() self.assertEqual(len(test_record.validate(value)), 1)
def test_validate_success(self, value): test_record = FloatField() validation_results = test_record.validate(value) self.assertEqual(len(validation_results), 0)