class TextLibrary(db.Model): """文本库表""" __tablename__ = "rs_textlibrary" id = db.Column(db.Integer, primary_key=True) textlibrary_name = db.Column(db.String(255)) description = db.Column(db.String(255)) line_no = db.Column(db.Integer, default=0) # 0表示未导入 import_status = db.Column(db.Integer, default=0) create_user = db.Column(db.Integer) create_time = db.Column(db.DateTime) # 0表示未删除 is_delete = db.Column(db.Integer, default=0) delete_time = db.Column(db.DateTime) def as_dict(self): o_dict = { c.name: getattr(self, c.name) for c in self.__table__.columns } if o_dict['create_time']: o_dict['create_time'] = o_dict['create_time'].strftime( u'%Y-%m-%d %H:%m:%S') if o_dict['delete_time']: o_dict['delete_time'] = o_dict['delete_time'].strftime( u'%Y-%m-%d %H:%m:%S') return o_dict def __repr__(self): return '<TEXT_LIBRARY {}>'.format(self.textlibrary_name)
class csv_data__csv_table(db.Model): __schema_name__ = 'csv_data' __tablename__ = 'csv_table' __columnsmap__ = { 'id': 'integer', 'utilityname': 'string', 'statename': 'string', 'countyname': 'string', 'outagecount': 'integer', 'customercount': 'integer', 'recorddatetime': 'datetime', 'stepount': 'integer', 'perdiff': 'float', 'duration': 'integer' } id = db.Column('id', db.Integer(), primary_key=True) utilityname = db.Column('utilitynamee', db.String()) statename = db.Column('statename', db.String()) countyname = db.column('countyname', db.String()) outagecount = db.Column('outagecount', db.Integer()) customercount = db.Column('customercount', db.Integer()) recorddatetime = db.Column('recorddatetime', db.DateTime()) stepcount = db.Column('stepcount', db.Integer()) perdiff = db.column('perdiff', db.Float()) duration = db.column('duration', db.Integer())
class Dictionary(db.Model): """词典表""" __tablename__ = "rs_analysis_event_library" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(255)) file_name = db.Column(db.String(255)) create_user = db.Column(db.Integer) create_time = db.Column(db.DateTime) def as_dict(self): o_dict = { c.name: getattr(self, c.name) for c in self.__table__.columns } if o_dict['create_time']: o_dict['create_time'] = o_dict['create_time'].strftime( u'%Y-%m-%d %H:%m:%S') return o_dict def __repr__(self): return '<Dictionary {}>'.format(self.name)
class User(db.Model): """用户角色/身份表""" __tablename__ = "rs_user" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(255)) password = db.Column(db.String(255)) nickname = db.Column(db.String(255)) create_time = db.Column(db.DateTime) def as_dict(self): o_dict = { c.name: getattr(self, c.name) for c in self.__table__.columns } if o_dict['create_time']: o_dict['create_time'] = o_dict['create_time'].strftime( u'%Y-%m-%d %H:%m:%S') return o_dict def __repr__(self): return '<User {}>'.format(self.name)
class TextLibraryData(db.Model): """文本库数据表""" id = db.Column(db.Integer,primary_key=True) title = db.Column(db.String(255)) summary = db.Column(db.Text) keywords = db.Column(db.String(255)) publish_time = db.Column(db.DateTime) author = db.Column(db.String(255)) content = db.Column(db.Text) url = db.Column(db.String(512)) create_time = db.Column(db.DateTime) # 0表示未删除 is_delete = db.Column(db.Integer, default=0) def as_dict(self): o_dict = {c.name: getattr(self, c.name) for c in self.__table__.columns} if o_dict['create_time']: o_dict['create_time'] = o_dict['create_time'].strftime(u'%Y-%m-%d %H:%m:%S') if o_dict['publish_time']: o_dict['publish_time'] = o_dict['publish_time'].strftime(u'%Y-%m-%d %H:%m:%S') return o_dict def __repr__(self): return '<TEXT_LIBRARY_DATA {}>'.format(self.title)
class AnalycisEventResult(db.Model): # 事件分类结果 id = db.Column(db.Integer, primary_key=True) text_id = db.Column(db.String(255)) recall_rate = db.Column(db.DECIMAL) accuracy_rate = db.Column(db.DECIMAL) event_num = db.Column(db.Integer) event_result = db.Column(db.Text) def as_dict(self): return {c.name: getattr(self, c.name) for c in self.__table__.columns} def __repr__(self): return '<Analysis_Event_Result {}>'.format(self.id)
class AnalysisProject(db.Model): """文本库分析表""" __tablename__ = 'rs_analysis_project' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100)) analysis_fields = db.Column(db.String(255)) analysis_algorithm = db.Column(db.Integer) analysis_type = db.Column(db.Integer) status = db.Column(db.Integer, default=0) # 0为未完成, 1为已完成 dictionary_id = db.Column(db.Integer) textlibrary_id = db.Column(db.Integer) create_time = db.Column(db.DateTime) create_user = db.Column(db.Integer) start_time = db.Column(db.DateTime) end_time = db.Column(db.DateTime) is_delete = db.Column(db.Integer, default=0) delete_user = db.Column(db.Integer) def as_dict(self): o_dict = { c.name: getattr(self, c.name) for c in self.__table__.columns } if o_dict['create_time']: o_dict['create_time'] = o_dict['create_time'].strftime( u'%Y-%m-%d %H:%m:%S') if o_dict['start_time']: o_dict['start_time'] = o_dict['start_time'].strftime( u'%Y-%m-%d %H:%m:%S') if o_dict['end_time']: o_dict['end_time'] = o_dict['end_time'].strftime( u'%Y-%m-%d %H:%m:%S') return o_dict def __repr__(self): return '<Analysis Project {}>'.format(self.name)