chore: initial commit — leaudit-platform project skeleton
17-table PostgreSQL schema with full Chinese column comments, FastAPI project structure (admin/common/modules), DSL rule files, and schema migration scripts.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
"""LeAudit AuditRun 模型 —— leaudit_audit_runs 表。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import BigInteger, Boolean, DateTime, Integer, Numeric, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from fastapi_common.fastapi_common_web.models import BaseModel
|
||||
|
||||
|
||||
class LeauditAuditRun(BaseModel):
|
||||
"""评查运行主表。"""
|
||||
|
||||
__tablename__ = "leaudit_audit_runs"
|
||||
|
||||
Id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
|
||||
documentId: Mapped[int] = mapped_column(BigInteger, comment="关联 leaudit_documents.id")
|
||||
documentFileId: Mapped[int | None] = mapped_column(BigInteger, comment="输入文件ID")
|
||||
runNo: Mapped[int] = mapped_column(Integer, comment="同一文档第几次执行")
|
||||
triggerSource: Mapped[str] = mapped_column(String(64), comment="upload/manual/retry/migration/batch")
|
||||
triggerUserId: Mapped[int | None] = mapped_column(BigInteger, comment="触发人")
|
||||
taskId: Mapped[str | None] = mapped_column(String(128), comment="Celery 任务 ID")
|
||||
|
||||
# 状态
|
||||
status: Mapped[str] = mapped_column(String(64), default="pending", comment="pending/processing/completed/failed/cancelled")
|
||||
phase: Mapped[str | None] = mapped_column(String(32), comment="draft/executed")
|
||||
|
||||
# 规则溯源
|
||||
ruleSetId: Mapped[int] = mapped_column(BigInteger, comment="关联 leaudit_rule_sets.id")
|
||||
ruleVersionId: Mapped[int] = mapped_column(BigInteger, comment="关联 leaudit_rule_versions.id")
|
||||
ruleTypeId: Mapped[str | None] = mapped_column(String(256), comment="LeAudit metadata.type_id")
|
||||
ruleSourceOssUrl: Mapped[str | None] = mapped_column(String(2048), comment="规则 YAML OSS 地址")
|
||||
ruleSourceSha256: Mapped[str | None] = mapped_column(String(64), comment="规则文件 SHA256")
|
||||
ruleLocalCachePath: Mapped[str | None] = mapped_column(String(1024), comment="本地缓存路径")
|
||||
|
||||
# 模型快照
|
||||
engineVersion: Mapped[str | None] = mapped_column(String(64))
|
||||
llmProvider: Mapped[str | None] = mapped_column(String(64))
|
||||
llmModel: Mapped[str | None] = mapped_column(String(128))
|
||||
vlmProvider: Mapped[str | None] = mapped_column(String(64))
|
||||
vlmModel: Mapped[str | None] = mapped_column(String(128))
|
||||
ocrProvider: Mapped[str | None] = mapped_column(String(64))
|
||||
ocrModel: Mapped[str | None] = mapped_column(String(128))
|
||||
|
||||
# Rescue
|
||||
rescueMode: Mapped[str | None] = mapped_column(String(32), comment="off/tier1/auto")
|
||||
rescueApplied: Mapped[bool] = mapped_column(Boolean, default=False, comment="是否执行 rescue")
|
||||
|
||||
# 结果汇总
|
||||
totalScore: Mapped[float | None] = mapped_column(Numeric(10, 2))
|
||||
passedCount: Mapped[int | None] = mapped_column(Integer)
|
||||
failedCount: Mapped[int | None] = mapped_column(Integer)
|
||||
skippedCount: Mapped[int | None] = mapped_column(Integer)
|
||||
resultStatus: Mapped[str | None] = mapped_column(String(32), comment="pass/fail/partial/error")
|
||||
|
||||
# 时间
|
||||
startedAt: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
|
||||
finishedAt: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
|
||||
Reference in New Issue
Block a user