[BUG] Financial ratios and KPIs appearing in wrong sections #23
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Metrics that should be displayed in the Ratios or KPIs sections are appearing as unmapped items within the financial statement areas (income statement, balance sheet, cash flow).
Current Architecture
From
lib/types.ts:422-429:Problem
Some ratio/KPI items with units like
percentorratiomay be:Examples of items that should be in Ratios/KPIs, not statements:
gross_margin) - percent unitoperating_margin) - percent uniteffective_tax_rate) - percent unitbasic_eps,diluted_eps) - per-share unitweighted_average_shares) - count unitProposed Fix
unit: 'percent'orunit: 'ratio'to ensure they're categorized correctlyFiles Affected
lib/server/financials/standard-template.tslib/server/financials/surface.tslib/server/financial-taxonomy.tslib/financial-metrics.tsUpdate: Root Cause Analysis
The Rust sidecar IS being used. The issue is in how KPIs and ratios are surfaced.
Current Architecture:
From
rust/taxonomy/fiscal/v1/kpis/core.kpis.json- this file defines KPIs separately from the financial statement surfaces.Problem:
unit: "percent"orunit: "ratio"incore.surface.jsonare being displayed as financial statement rows instead of in the ratios/KPIs sectionsurface_mapper.rsdoesn't route items to the correct surface kind (ratiosvsincome_statement)FinancialSurfaceKindtype that includesratiosandsegments_kpis, but these may not be populated by the Rust mapperEvidence:
Looking at
lib/server/taxonomy/types.ts, theTaxonomyHydrationResultincludes:surface_rows- for statement surfaces (income, balance, cash_flow)kpi_rows- for KPIsBut the Rust
build_compact_surface_modelinsurface_mapper.rsonly outputs tosurface_rowsanddetail_rows, not a separatekpi_rows.Fix Required:
kpi_rowsfieldcore.surface.jsondoesn't include ratio/KPI items in statement surfacescore.kpis.jsonor create a separate ratios surfacesurface_mapper.rsto categorize by unit typeFiles to Review:
rust/taxonomy/fiscal/v1/core.surface.json- Check for misplaced ratio itemsrust/taxonomy/fiscal/v1/kpis/core.kpis.json- Verify KPI definitionsrust/fiscal-xbrl-core/src/surface_mapper.rs- Check KPI routing logic