"""分析数据集 数据模型""" from sqlalchemy import JSON, Index, String from sqlalchemy.orm import Mapped, mapped_column from app.core.base_model import MappedBase, ModelMixin, UserMixin class AnalysisDatasetModel(ModelMixin, UserMixin, MappedBase): """分析数据集(性状编码 + 样本ID + 分析配置 的具名集合)。 纯元数据表、无外键联表;trait_codes/sample_ids 以 JSON 数组存储, 供统计/GS 模块按需取数(如 GBLUP/ssGBLUP 指定样本子集)。 """ __tablename__ = "bre_analysis_dataset" name: Mapped[str] = mapped_column(String(128), nullable=False, comment="数据集名称") description: Mapped[str | None] = mapped_column(String(512), nullable=True, comment="数据集描述") trait_codes: Mapped[dict | list | None] = mapped_column(JSON, nullable=True, comment="性状编码列表") sample_ids: Mapped[dict | list | None] = mapped_column(JSON, nullable=True, comment="样本ID列表(树/种质id)") config: Mapped[dict | None] = mapped_column(JSON, nullable=True, comment="分析配置") status: Mapped[str | None] = mapped_column(String(16), nullable=True, default="draft", comment="状态(draft/ready)") __table_args__ = ( Index("ix_bre_analysis_dataset_created_deleted", "created_time", "is_deleted"), )