ГЛОБАЛЬНЫЙ РЕФАКТОРИНГ АРХИТЕКТУРЫ - Рефакторинг этапов 2.109 - 2.112 - Ужесточение типы plan-аудита и live-route аудита в deep grounding
This commit is contained in:
@@ -11,6 +11,26 @@ function toObject(value) {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function normalizeRawRetrievalResult(raw) {
|
||||
const source = toObject(raw);
|
||||
if (!source) {
|
||||
return {};
|
||||
}
|
||||
return {
|
||||
status: source.status,
|
||||
result_type: source.result_type,
|
||||
items: source.items,
|
||||
summary: source.summary,
|
||||
evidence: source.evidence,
|
||||
why_included: source.why_included,
|
||||
selection_reason: source.selection_reason,
|
||||
risk_factors: source.risk_factors,
|
||||
business_interpretation: source.business_interpretation,
|
||||
confidence: source.confidence,
|
||||
limitations: source.limitations,
|
||||
errors: source.errors
|
||||
};
|
||||
}
|
||||
function toStringOrNull(value) {
|
||||
if (typeof value !== "string")
|
||||
return null;
|
||||
@@ -61,6 +81,19 @@ function normalizeStringArray(value) {
|
||||
}
|
||||
return value.map((item) => String(item));
|
||||
}
|
||||
function normalizeNumberRecord(value) {
|
||||
const source = toObject(value);
|
||||
if (!source) {
|
||||
return {};
|
||||
}
|
||||
const result = {};
|
||||
for (const [key, entry] of Object.entries(source)) {
|
||||
if (typeof entry === "number" && Number.isFinite(entry)) {
|
||||
result[key] = entry;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function mergeSummaryWithProblemUnitMeta(summary, input) {
|
||||
return {
|
||||
...summary,
|
||||
@@ -391,7 +424,7 @@ function normalizeEvidenceItems(fragmentId, requirementIds, route, value) {
|
||||
});
|
||||
}
|
||||
function normalizeRetrievalResult(fragmentId, requirementIds, route, raw) {
|
||||
const rawResult = toObject(raw) ?? {};
|
||||
const rawResult = normalizeRawRetrievalResult(raw);
|
||||
const items = normalizeObjectArray(rawResult.items);
|
||||
const summary = normalizeSummary(rawResult.summary);
|
||||
const evidence = normalizeEvidenceItems(fragmentId, requirementIds, route, rawResult.evidence);
|
||||
@@ -457,8 +490,8 @@ function normalizeRetrievalResult(fragmentId, requirementIds, route, raw) {
|
||||
severityDistribution: graphBoundSummary.severity_distribution,
|
||||
confidenceDistribution: graphBoundSummary.confidence_distribution,
|
||||
lifecycleEnrichedUnits: graphBoundSummary.lifecycle_enriched_units ?? 0,
|
||||
lifecycleDomainDistribution: (graphBoundSummary.lifecycle_domain_distribution ?? {}),
|
||||
lifecycleDefectDistribution: (graphBoundSummary.lifecycle_defect_distribution ?? {})
|
||||
lifecycleDomainDistribution: normalizeNumberRecord(graphBoundSummary.lifecycle_domain_distribution),
|
||||
lifecycleDefectDistribution: normalizeNumberRecord(graphBoundSummary.lifecycle_defect_distribution)
|
||||
});
|
||||
if (graphBuild) {
|
||||
enrichedSummary = mergeSummaryWithGraphMeta(enrichedSummary, graphBuild.summary);
|
||||
|
||||
Reference in New Issue
Block a user