class Doc(BaseEntity): doc_id = db.Column(db.Integer(), primary_key=True) doc_unique_name = db.Column(db.String(64), nullable=False) doc_raw_name = db.Column(db.String(255), nullable=False) doc_status = db.Column(db.Integer(), db.ForeignKey("status.status_id"), default=StatusEnum.processing.value, nullable=False)
class DocRelation(BaseEntity): doc_relation_id = db.Column(db.Integer(), primary_key=True) doc_relation_name = db.Column(db.String(256), nullable=False) doc_relation_color = db.Column(db.String(256), default="") doc_relation_desc = db.Column(db.Text(), default="") doc_type_id = db.Column(db.Integer(), db.ForeignKey('doc_type.doc_type_id'), nullable=False)
class DocTerm(BaseEntity): doc_term_id = db.Column(db.Integer(), primary_key=True) doc_term_name = db.Column(db.String(256), nullable=False) doc_term_alias = db.Column(db.String(20), default="") doc_term_shortcut = db.Column(db.String(20), default="") doc_term_color = db.Column(db.String(256), default="") doc_term_desc = db.Column(db.Text(), default="") doc_term_index = db.Column(db.Integer(), default=1) doc_term_data_type = db.Column(db.String(256), default="") # 字符、数字、布尔 doc_type_id = db.Column(db.Integer(), db.ForeignKey('doc_type.doc_type_id'), nullable=False)
class TrainTask(BaseEntity): train_task_id = db.Column(db.Integer(), primary_key=True) train_model_name = db.Column(db.String(256), nullable=False) train_model_desc = db.Column(db.Text(), default="") train_config = db.Column(db.JSON(), default={}) train_status = db.Column(db.Integer(), db.ForeignKey("status.status_id"), nullable=False) model_version = db.Column(db.String(256), default="") train_job_id = db.Column(db.Integer(), db.ForeignKey("train_job.train_job_id"), nullable=False)
class DocType(BaseEntity): doc_type_id = db.Column(db.Integer(), primary_key=True) doc_type_name = db.Column(db.String(255), nullable=False) doc_type_desc = db.Column(db.Text(), default="") is_favorite = db.Column(db.Boolean(), default=False) nlp_task_id = db.Column(db.Integer(), db.ForeignKey("nlp_task.nlp_task_id"), nullable=False) group_id = db.Column(db.Integer(), nullable=False, default=0)
class CustomAlgorithm(BaseEntity): custom_algorithm_id = db.Column(db.Integer(), primary_key=True) custom_algorithm_alias = db.Column(db.String(100), nullable=False) custom_algorithm_name = db.Column(db.String(100), nullable=False) custom_algorithm_desc = db.Column(db.String(256), default="") custom_algorithm_ip = db.Column(db.String(256), nullable=False) custom_algorithm_predict_port = db.Column(db.Integer(), nullable=False) custom_algorithm_evaluate_port = db.Column(db.Integer(), nullable=False) custom_algorithm_config = db.Column(db.JSON(), default={}) custom_algorithm_status = db.Column(db.Integer(), db.ForeignKey("status.status_id"), nullable=False) nlp_task_id = db.Column(db.Integer(), db.ForeignKey("nlp_task.nlp_task_id"), nullable=False) preprocess = db.Column(db.JSON(), default={"split_by_sentence": True}) # 抽取:短文本
class EvaluateTask(BaseEntity): evaluate_task_id = db.Column(db.Integer(), primary_key=True) evaluate_task_name = db.Column(db.String(256), nullable=False) evaluate_task_desc = db.Column(db.Text(), default="") evaluate_task_status = db.Column(db.Integer(), db.ForeignKey("status.status_id"), nullable=False) evaluate_task_result = db.Column(db.JSON(), default={}) train_task_id = db.Column(db.Integer(), db.ForeignKey("train_task.train_task_id"), nullable=False)
class ExportJob(BaseEntity): export_job_id = db.Column(db.Integer(), primary_key=True) doc_type_id = db.Column(db.Integer(), db.ForeignKey('doc_type.doc_type_id'), nullable=False) export_file_path = db.Column(db.String(255), default="") export_job_status = db.Column(db.Integer(), db.ForeignKey("status.status_id"), nullable=False) export_mark_job_ids = db.Column(db.JSON(), default=[]) export_predict_job_ids = db.Column(db.JSON(), default=[])
class PredictJob(BaseEntity): predict_job_id = db.Column(db.Integer(), primary_key=True) doc_type_id = db.Column(db.Integer(), db.ForeignKey("doc_type.doc_type_id"), nullable=False) predict_job_name = db.Column(db.String(256), default="") predict_job_type = db.Column(db.Enum(FileTypeEnum)) predict_job_status = db.Column(db.Integer(), db.ForeignKey("status.status_id"), nullable=False) predict_job_desc = db.Column(db.Text(), default="")
class TrainJob(BaseEntity): train_job_id = db.Column(db.Integer(), primary_key=True) train_job_name = db.Column(db.String(256), nullable=False) train_job_status = db.Column(db.Integer(), db.ForeignKey("status.status_id"), nullable=False) train_job_desc = db.Column(db.Text(), default="") doc_type_id = db.Column(db.Integer(), db.ForeignKey("doc_type.doc_type_id"), nullable=False) preprocess = db.Column(db.JSON(), default={"split_by_sentence": True}) # 抽取:短文本
class MarkJob(BaseEntity): mark_job_id = db.Column(db.Integer(), primary_key=True) doc_type_id = db.Column(db.Integer(), db.ForeignKey("doc_type.doc_type_id"), nullable=False) mark_job_name = db.Column(db.String(255), nullable=False) mark_job_desc = db.Column(db.Text(), default="") mark_job_type = db.Column(db.Enum(FileTypeEnum), nullable=False) # text, e_doc, ocr mark_job_status = db.Column(db.Integer(), db.ForeignKey("status.status_id"), default=int(StatusEnum.processing)) annotator_ids = db.Column(db.JSON(), default=[]) reviewer_ids = db.Column(db.JSON(), default=[]) assign_mode = db.Column(db.Enum(AssignModeEnum), nullable=False) # average,
class NlpTask(BaseEntity): nlp_task_id = db.Column(db.Integer(), primary_key=True) nlp_task_name = db.Column(db.String(50), nullable=False)
class Status(BaseEntity): status_id = db.Column(db.Integer(), primary_key=True) status_name = db.Column(db.String(50), nullable=False)
class ClassifyDocRule(BaseEntity): classify_rule_id = db.Column(db.Integer(), primary_key=True) rule_type = db.Column(db.String(255), nullable=False) rule_content = db.Column(db.JSON(), default={}) doc_term_id = db.Column(db.Integer(), db.ForeignKey("doc_term.doc_term_id"), nullable=False) is_active = db.Column(db.Boolean(), default=True)