Files
dpb/backend/app/api/v1/module_bre/analysis_dataset/model.py
T
34047007@qq.com b95053c52c init: 初始化 dpb 桃育种系统代码库
前后端 + 后端 FastAPI 全量源码、部署脚本与文档。
2026-08-06 00:17:49 +08:00

32 lines
1.3 KiB
Python

"""分析数据集 数据模型"""
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"),
)