Remove legacy TypeScript financial surface mapping, make Rust JSON single source of truth

- Delete standard-template.ts, surface.ts, materialize.ts (dead code)
- Delete financial-taxonomy.test.ts (relied on removed code)
- Add missing income statement surfaces to core.surface.json
- Add cost_of_revenue mapping to core.income-bridge.json
- Refactor standardize.ts to remove template dependency
- Simplify financial-taxonomy.ts to use only DB snapshots
- Add architecture documentation
This commit is contained in:
2026-03-15 14:38:48 -04:00
parent 7a42d73a48
commit a7f7be50b4
9 changed files with 574 additions and 5009 deletions

View File

@@ -36,8 +36,7 @@ import {
} from '@/lib/server/financials/bundles';
import {
buildDimensionBreakdown,
buildLtmStandardizedRows,
buildStandardizedRows
buildLtmStandardizedRows
} from '@/lib/server/financials/standardize';
import { buildRatioRows } from '@/lib/server/financials/ratios';
import { buildFinancialCategories, buildTrendSeries } from '@/lib/server/financials/trend-series';
@@ -620,16 +619,7 @@ function buildQuarterlyStatementSurfaceRows(input: {
selectedPeriodIds: input.selectedPeriodIds
});
if (aggregatedRows.length > 0) {
return aggregatedRows;
}
return buildStandardizedRows({
rows: input.faithfulRows,
statement: input.statement,
periods: input.sourcePeriods,
facts: input.facts
}) as SurfaceFinancialRow[];
return aggregatedRows;
}
function aggregatePersistedKpiRows(input: {
@@ -1303,7 +1293,6 @@ export async function getCompanyFinancialTaxonomy(input: GetCompanyFinancialsInp
export const __financialTaxonomyInternals = {
buildRows,
buildStandardizedRows,
buildDimensionBreakdown,
buildNormalizationMetadata,
aggregateSurfaceRows,