业务本体与标准实体:跨源键值对齐、对账共变算子、健康证据链与实体助手

- 新增标准业务实体(CanonicalEntity)模型、确定性跨源编码翻译、后台候选实体扫描与文档驱动实体智能助手
- 新增指标本体图谱(factor / reconciles_with / upstream_driver)、DAG 防环校验以及 ontology_neighbors / source_health 内置工具
- 新增跨源对账(analysis_reconcile)与滞后共变(analysis_cochange)分析算子,打通 [[h:H1]] 数据源健康证据链、报告导出与本体消融评测
- 数据目录新增「标准业务实体」视图与候选审阅工作台,口径页集成指标本体拓扑面板与端到端浏览器检查
This commit is contained in:
ThearchyHelios
2026-11-12 12:57:53 +08:00
parent 2f90f0eb3a
commit 8d9a712eae
106 changed files with 16654 additions and 295 deletions
+6 -1
View File
@@ -690,9 +690,10 @@ def problem_key(problem: Mapping[str, Any]) -> tuple[str, str, tuple[tuple[str,
def build_content(*, workflow_id: str, version: int, level: str, graph: Any, cards: Sequence[CardBasis]) -> dict[str, Any]:
"""这一版的清单内容:**只由原始输入决定**(这一版不可变的图 + 每张卡引用的那两行记录的值)。"""
from app.core.artifact_store import execution_hash, graph_hash
from app.ledger.ontology import ontology_manifest_section
sources, tables = fetch_dependencies(graph)
return {
out: dict[str, Any] = {
"format": FORMAT,
"workflow_id": str(workflow_id),
"version": int(version),
@@ -704,6 +705,10 @@ def build_content(*, workflow_id: str, version: int, level: str, graph: Any, car
"parameters": parameters_of(graph),
"dependencies": {"sources": sources, "tables": tables, "upstream": upstream_pins(graph)},
}
ontology = ontology_manifest_section(workflow_id=str(workflow_id), version=int(version), graph=graph or {})
if ontology is not None:
out["ontology"] = ontology
return out
def content_hash(content: Mapping[str, Any]) -> str:
+6 -2
View File
@@ -6,12 +6,15 @@ from sqlalchemy.ext.asyncio import AsyncSession
from app.engine.schema import GraphSpec
async def gate_issues(session: AsyncSession, graph: Any, level: str) -> list[dict[str, Any]] | None:
async def gate_issues(
session: AsyncSession, graph: Any, level: str, *, workflow_id: str | None = None,
) -> list[dict[str, Any]] | None:
from app.data.catalog_impact import open_structure_issues
from app.data.sqlcheck import graph_sources, load_checkers_by_name
from app.engine.governance import publish_issues
from app.engine.lint_process import load_subgraphs, with_subgraphs
from app.engine.provider_refs import load_providers
from app.ledger.ontology import ontology_publish_issues
try:
spec = GraphSpec.model_validate(graph)
@@ -21,4 +24,5 @@ async def gate_issues(session: AsyncSession, graph: Any, level: str) -> list[dic
providers = await load_providers(session, spec)
with with_subgraphs(await load_subgraphs(session, spec)):
issues = [i.model_dump() for i in publish_issues(spec, level=level, checkers=checkers, providers=providers)]
return issues + await open_structure_issues(session, spec)
ontology_issues = await ontology_publish_issues(session, spec, workflow_id=str(workflow_id or ""))
return issues + ontology_issues + await open_structure_issues(session, spec)