class Summary(db.Model): __tablename__ = 'summary' id = db.Column(db.INTEGER, primary_key=True, nullable=False) text = db.Column(db.Text, nullable=False) summary_group_id = db.Column(db.INTEGER, db.ForeignKey('summary_group.id'), nullable=False) doc_id = db.Column(db.INTEGER, db.ForeignKey('document.id'), nullable=False)
class FluencyResult(db.Model): __tablename__ = 'fluency_result' id = db.Column(db.INTEGER, primary_key=True, nullable=False) fluency = db.Column(db.REAL, nullable=False, default=50.0) is_invalid = db.Column(db.Boolean, default=False) proj_status_id = db.Column(db.INTEGER, db.ForeignKey('project_status.id'), nullable=False) summary_id = db.Column(db.INTEGER, db.ForeignKey('summary.id'), nullable=False)
class SummaryGroupList(db.Model): """ N-to-N table linking project and summary group """ __tablename__ = 'summary_group_list' id = db.Column(db.INTEGER, primary_key=True, nullable=False) fluency_proj_id = db.Column(db.INTEGER, db.ForeignKey('fluency_project.id'), nullable=True) clarity_proj_id = db.Column(db.INTEGER, db.ForeignKey('clarity_project.id'), nullable=True) summ_group_id = db.Column(db.INTEGER, db.ForeignKey('summary_group.id'), nullable=False)
class ProjectStatus(db.Model): __tablename__ = 'project_status' id = db.Column(db.INTEGER, primary_key=True, nullable=False) # total_exp_results = db.Column(db.Integer, nullable=False, default=1) # total_results = db.Column(db.Integer, nullable=False, default=0) is_finished = db.Column(db.Boolean, nullable=False, default=False) is_active = db.Column(db.Boolean, nullable=False, default=False) validity = db.Column(db.Boolean, nullable=True, default=False) mturk_code = db.Column(db.String(255), nullable=True) good_summ_score = db.Column(db.INTEGER, nullable=True) mediocre_summ_score = db.Column(db.INTEGER, nullable=True) bad_summ_score = db.Column(db.INTEGER, nullable=True) expired_in = db.Column(db.DateTime, nullable=True) # Used in informativeness and fluency project # summary_id = db.Column(db.INTEGER, db.ForeignKey('summary.id'), nullable=True) # ref_summary_id = db.Column(db.INTEGER, db.ForeignKey('summary.id'), nullable=True) # Used in annotation project # doc_id = db.Column(db.INTEGER, db.ForeignKey('document.id'), nullable=True) eval_proj_id = db.Column(db.INTEGER, db.ForeignKey('evaluation_project.id'), nullable=True) fluency_proj_id = db.Column(db.INTEGER, db.ForeignKey('fluency_project.id'), nullable=True) clarity_proj_id = db.Column(db.INTEGER, db.ForeignKey('clarity_project.id'), nullable=True) sanity_summ_id = db.Column(db.INTEGER, db.ForeignKey('sanity_summary.id'), nullable=True) fluency_results = db.relationship('FluencyResult', cascade='delete') clarity_results = db.relationship('ClarityResult', cascade='delete')
class SummaryGroup(db.Model): """ For different model or reference group """ __tablename__ = 'summary_group' id = db.Column(db.INTEGER, primary_key=True, nullable=False) name = db.Column(db.String(255), nullable=False) is_ref = db.Column(db.Boolean, nullable=False, default=False) dataset_id = db.Column(db.INTEGER, db.ForeignKey('dataset.id'), nullable=False) summaries = db.relationship('Summary', backref='summary_group')
class SanitySummary(db.Model): """ For sanity checking where user's submission is deemed valid if the good_summary >= mediocre_summary > bad_summary """ __tablename__ = 'sanity_summary' id = db.Column(db.INTEGER, primary_key=True, nullable=False) good_summary = db.Column(db.Text, nullable=False) mediocre_summary = db.Column(db.Text, nullable=False) bad_summary = db.Column(db.Text, nullable=False) dataset_id = db.Column(db.INTEGER, db.ForeignKey('dataset.id'), nullable=False)
class Document(db.Model): __tablename__ = 'document' id = db.Column(db.INTEGER, primary_key=True, nullable=False) doc_id = db.Column(db.String(25), nullable=False) doc_json = db.Column(db.JSON, nullable=False) # For ground truth comparison sanity_statement = db.Column(db.Text, nullable=True) sanity_answer = db.Column(db.Boolean, nullable=True, default=True) # For reference comparison sanity_statement_2 = db.Column(db.Text, nullable=True) sanity_answer_2 = db.Column(db.Boolean, nullable=True, default=True) # For checking whether doc_json is empty or not has_highlight = db.Column(db.Boolean, nullable=False, default=False) # doc_statuses = db.relationship('DocStatus', backref='document', lazy=True) dataset_id = db.Column(db.INTEGER, db.ForeignKey('dataset.id'), nullable=True)