Exemplo n.º 1
0
class Line(db.Model):
    """ A line object, corresponding to an answersheet line """
    __tablename__ = 'line'
    id = db.Column(db.Integer, primary_key=True)
    line_image = db.Column(db.LargeBinary)
    image_width = db.Column(db.Integer)
    image_height = db.Column(db.Integer)
Exemplo n.º 2
0
class Team(db.Model):
    __tablename__ = 'team'
    id = db.Column(db.Integer, primary_key=True)
    teamname = db.Column(db.String(255))
    score = db.Column(db.Integer)

    def get_team_name(self):
        return self.teamname
Exemplo n.º 3
0
class QuestionNumber(db.Model):
    """ A word object, corresponding to words in a line. """
    __tablename__ = 'questionnumber'
    id = db.Column(db.Integer, primary_key=True)
    question_number = db.Column(db.String(255))
    question_image = db.Column(db.LargeBinary)
    image_width = db.Column(db.Integer)
    image_height = db.Column(db.Integer)
Exemplo n.º 4
0
class Variant(db.Model):
    """ for some questions, multiple answers (variants) are correct """
    __tablename__ = 'variant'
    id = db.Column(db.Integer, primary_key=True)
    subanswer_id = db.Column(db.Integer, db.ForeignKey('subanswer.id'))
    answer = db.Column(db.String(255))
    isNumber = db.Column(db.Boolean)

    def get_answer(self):
        return self.answer
Exemplo n.º 5
0
class AnswerGiven(db.Model):
    __tablename__ = 'answergiven'
    id = db.Column(db.Integer, primary_key=True)
    question_id = db.Column(db.Integer,
                            db.ForeignKey('question.id'),
                            nullable=False)
    question = db.relationship('Question')
    team_id = db.Column(db.Integer, db.ForeignKey('team.id'), nullable=False)
    answered_by = db.relationship('Team')
    subanswersgiven = db.relationship('SubAnswerGiven')
Exemplo n.º 6
0
class Person(db.Model):
    """ users """
    __tablename__ = 'person'
    id = db.Column(db.Integer, primary_key=True)
    personname = db.Column(db.String(255))
    password_hash = db.Column(db.String(255))

    def set_password(self, password):
        self.password_hash = generate_password_hash(password)

    def check_password(self, password):
        return check_password_hash(self.password_hash, password)
Exemplo n.º 7
0
class Answersheet(db.Model):
    """ image of complete answersheet (handwritten) """
    __tablename__ = 'answersheet'
    id = db.Column(db.Integer, primary_key=True)
    team_id = db.Column(db.Integer, db.ForeignKey('team.id'), nullable=True)
    answersheet_image = db.Column(db.LargeBinary)
    image_width = db.Column(db.Integer)
    image_height = db.Column(db.Integer)

    def set_team_id(self, team_id):
        self.team_id = team_id

    def get_team_id(self):
        return self.team_id
Exemplo n.º 8
0
class Task(db.Model):

    __tablename__ = "tasks"

    task_id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String, nullable=False)
    due_date = db.Column(db.Date, nullable=False)
    priority = db.Column(db.Integer, nullable=False)
    status = db.Column(db.Integer)

    def __init__(self, name, due_date, priority, status):
        self.name = name
        self.due_date = due_date
        self.priority = priority
        self.status = status

    def __repr__(self):
        return '<name {0}>'.format(self.name)
Exemplo n.º 9
0
class Word(db.Model):
    """ A word object, corresponding to words in a line. """
    __tablename__ = 'word'
    id = db.Column(db.Integer, primary_key=True)
    line_id = db.Column(db.Integer, db.ForeignKey('line.id'))
    word_recognised = db.Column(db.String(255))
    probability = db.Column(db.Float)
    word_image = db.Column(db.LargeBinary)
    image_width = db.Column(db.Integer)
    image_height = db.Column(db.Integer)
Exemplo n.º 10
0
class SubAnswerGiven(db.Model):
    """ A answer can consist of multiple lines, this indicates a single line of an answer. """
    __tablename__ = 'subanswergiven'
    id = db.Column(db.Integer, primary_key=True)
    corr_answer_id = db.Column(db.Integer,
                               db.ForeignKey('subanswer.id'),
                               nullable=False)
    corr_answer = db.relationship('SubAnswer')
    read_answer = db.Column(db.String(255))
    probability_read_answer = db.Column(db.Float)
    correct = db.Column(db.Boolean)
    confidence = db.Column(db.Float)
    probability_read_answer = db.Column(db.Float)
    person_id = db.Column(db.Integer,
                          db.ForeignKey('person.id'),
                          nullable=False)
    checkedby = db.relationship('Person')
    line_id = db.Column(db.Integer, db.ForeignKey('line.id'), nullable=False)
    line = db.relationship('Line')
    answergiven_id = db.Column(db.Integer,
                               db.ForeignKey('answergiven.id'),
                               nullable=False)
Exemplo n.º 11
0
class Question(db.Model):
    __tablename__ = 'question'
    id = db.Column(db.Integer, primary_key=True)
    questionnumber = db.Column(db.Integer)
    person_id = db.Column(db.Integer, db.ForeignKey('person.id'))
    createdby = db.relationship('Person')
    category_id = db.Column(db.Integer, db.ForeignKey('category.id'))
    questioncategory = db.relationship('Category')
    type_id = db.Column(db.Integer, db.ForeignKey('type.id'))
    questiontype = db.relationship('Type')
    question = db.Column(db.String(255))
    subanswers = db.relationship('SubAnswer')
    active = db.Column(db.Boolean)

    def get_question(self):
        return self.question
Exemplo n.º 12
0
class SubAnswer(db.Model):
    """ question can have multiple subquestions, each subquestion has a subanswer """
    __tablename__ = 'subanswer'
    id = db.Column(db.Integer, primary_key=True)
    question_id = db.Column(db.Integer, db.ForeignKey('question.id'))
    variants = db.relationship('Variant')
Exemplo n.º 13
0
class Type(db.Model):
    """ type of question (e.g. multiple choice) """
    __tablename__ = 'type'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255))
Exemplo n.º 14
0
class Category(db.Model):
    """ category of question """
    __tablename__ = 'category'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255))
Exemplo n.º 15
0
class AnswerSheetQuestion(db.Model):
    """ answersheet corresponding to a question """
    __tablename__ = 'answersheetquestion'
    id = db.Column(db.Integer, primary_key=True)
    answersheet_id = db.Column(db.Integer, db.ForeignKey('answersheet.id'))
    question_id = db.Column(db.Integer, db.ForeignKey('question.id'))