You've already forked DataMate
* refactor: remove db table management from LS adapter (mv to scripts later); change adapter to use the same MySQL DB as other modules. * refactor: Rename LS Adapter module to datamate-python
26 lines
1.2 KiB
Python
26 lines
1.2 KiB
Python
from sqlalchemy import Column, String, Integer, JSON, TIMESTAMP
|
|
from sqlalchemy.sql import func
|
|
from app.db.database import Base
|
|
import uuid
|
|
|
|
class LabelingProject(Base):
|
|
"""DM标注项目模型(原 DatasetMapping)"""
|
|
|
|
__tablename__ = "t_dm_labeling_projects"
|
|
|
|
id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()), comment="UUID主键ID")
|
|
dataset_id = Column(String(36), nullable=False, comment="数据集ID")
|
|
name = Column(String(32), nullable=False, comment="项目名称")
|
|
labeling_project_id = Column(Integer, nullable=False, comment="Label Studio项目ID")
|
|
configuration = Column(JSON, nullable=True, comment="标签配置")
|
|
progress = Column(JSON, nullable=True, comment="标注进度统计")
|
|
created_at = Column(TIMESTAMP, server_default=func.current_timestamp(), comment="创建时间")
|
|
deleted_at = Column(TIMESTAMP, nullable=True, comment="删除时间(软删除)")
|
|
|
|
def __repr__(self):
|
|
return f"<LabelingProject(id={self.id}, dataset_id={self.dataset_id}, name={self.name})>"
|
|
|
|
@property
|
|
def is_deleted(self) -> bool:
|
|
"""检查是否已被软删除"""
|
|
return self.deleted_at is not None |