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')
def test_delimiter(self): self.assertEqual(DelimitedStringField().delimiter, '\0')
def test_elasticsearch_type(self): self.assertEqual(DelimitedStringField().elasticsearch_type, 'string')
def test_hive_type(self): self.assertEqual(DelimitedStringField().hive_type, 'STRING')
def test_sql_type(self): self.assertEqual(DelimitedStringField().sql_type, 'VARCHAR')
def test_deserialize(self, value, expected_value): test_record = DelimitedStringField() self.assertEquals(test_record.deserialize_from_string(value), expected_value)
def test_validate_error(self, value): test_record = DelimitedStringField() self.assertEqual(len(test_record.validate(value)), 1)