Этап 4 / Волна 11: объектный трейс по бизнес-якорям, доменное заземление, cleanup утечки дебага
This commit is contained in:
@@ -106,14 +106,67 @@ function stringArrayFromPayload(item: EvidenceItem, key: string): string[] {
|
||||
return stringArrayFromUnknown(item.payload[key]);
|
||||
}
|
||||
|
||||
function domainHintsFromSummary(summary: Record<string, unknown>): string[] {
|
||||
const hints: string[] = [];
|
||||
const purityGuard = toObject(summary.domain_purity_guard);
|
||||
const domainCardId = String(purityGuard?.domain_card_id ?? "").trim();
|
||||
if (domainCardId === "settlements_60_62") {
|
||||
return ["bank_settlement", "customer_settlement"];
|
||||
}
|
||||
if (domainCardId === "vat_document_register_book") {
|
||||
return ["vat_flow"];
|
||||
}
|
||||
if (domainCardId === "month_close_costs_20_44") {
|
||||
return ["period_close"];
|
||||
}
|
||||
|
||||
const semanticProfile = toObject(summary.semantic_profile);
|
||||
const domainScope = stringArrayFromUnknown(semanticProfile?.domain_scope);
|
||||
for (const domain of domainScope) {
|
||||
const normalized = domain.toLowerCase();
|
||||
if (
|
||||
normalized === "bank" ||
|
||||
normalized === "settlements" ||
|
||||
normalized === "suppliers" ||
|
||||
normalized === "supplier_payments" ||
|
||||
normalized === "other_settlements"
|
||||
) {
|
||||
hints.push("bank_settlement");
|
||||
continue;
|
||||
}
|
||||
if (normalized === "customers") {
|
||||
hints.push("customer_settlement");
|
||||
continue;
|
||||
}
|
||||
if (normalized === "vat" || normalized === "taxes") {
|
||||
hints.push("vat_flow");
|
||||
continue;
|
||||
}
|
||||
if (normalized === "period_close") {
|
||||
hints.push("period_close");
|
||||
continue;
|
||||
}
|
||||
if (normalized === "deferred_expense") {
|
||||
hints.push("deferred_expense");
|
||||
continue;
|
||||
}
|
||||
if (normalized === "fixed_assets") {
|
||||
hints.push("fixed_asset");
|
||||
}
|
||||
}
|
||||
|
||||
return uniqueStrings(hints);
|
||||
}
|
||||
|
||||
function extractSemanticProfile(summary: Record<string, unknown>): {
|
||||
relation_patterns: string[];
|
||||
anomaly_patterns: string[];
|
||||
} {
|
||||
const semanticProfile = toObject(summary.semantic_profile);
|
||||
const domainHints = domainHintsFromSummary(summary).map((item) => `domain_hint:${item}`);
|
||||
return {
|
||||
relation_patterns: stringArrayFromUnknown(semanticProfile?.relation_patterns),
|
||||
anomaly_patterns: stringArrayFromUnknown(semanticProfile?.anomaly_patterns)
|
||||
relation_patterns: uniqueStrings([...stringArrayFromUnknown(semanticProfile?.relation_patterns), ...domainHints]),
|
||||
anomaly_patterns: uniqueStrings([...stringArrayFromUnknown(semanticProfile?.anomaly_patterns), ...domainHints])
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user