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

@@ -27,6 +27,31 @@
"not_meaningful_for_pack": false,
"warning_codes_when_used": []
},
"cost_of_revenue": {
"direct_authoritative_concepts": [
"us-gaap:CostOfRevenue"
],
"direct_source_concepts": [
"CostOfRevenue",
"CostOfGoodsSold",
"CostOfSales",
"CostOfGoodsAndServicesSold",
"CostOfGoodsAndServiceExcludingDepreciationDepletionAndAmortization",
"CostOfProductsSold",
"CostOfServices"
],
"component_surfaces": {
"positive": [],
"negative": []
},
"component_concept_groups": {
"positive": [],
"negative": []
},
"formula": "direct",
"not_meaningful_for_pack": false,
"warning_codes_when_used": []
},
"gross_profit": {
"direct_authoritative_concepts": [
"us-gaap:GrossProfit"
@@ -38,24 +63,13 @@
"positive": [
"revenue"
],
"negative": []
"negative": [
"cost_of_revenue"
]
},
"component_concept_groups": {
"positive": [],
"negative": [
{
"name": "cost_of_revenue",
"concepts": [
"us-gaap:CostOfRevenue",
"us-gaap:CostOfGoodsSold",
"us-gaap:CostOfSales",
"us-gaap:CostOfGoodsAndServicesSold",
"us-gaap:CostOfGoodsAndServiceExcludingDepreciationDepletionAndAmortization",
"us-gaap:CostOfProductsSold",
"us-gaap:CostOfServices"
]
}
]
"negative": []
},
"formula": "subtract",
"not_meaningful_for_pack": false,

View File

@@ -16,6 +16,64 @@
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "cost_of_revenue",
"statement": "income",
"label": "Cost of Revenue",
"category": "surface",
"order": 20,
"unit": "currency",
"rollup_policy": "direct_only",
"allowed_source_concepts": [
"us-gaap:CostOfRevenue",
"us-gaap:CostOfGoodsSold",
"us-gaap:CostOfSales",
"us-gaap:CostOfGoodsAndServicesSold",
"us-gaap:CostOfGoodsAndServiceExcludingDepreciationDepletionAndAmortization",
"us-gaap:CostOfProductsSold",
"us-gaap:CostOfServices"
],
"allowed_authoritative_concepts": ["us-gaap:CostOfRevenue"],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "gross_profit",
"statement": "income",
"label": "Gross Profit",
"category": "surface",
"order": 30,
"unit": "currency",
"rollup_policy": "direct_or_formula",
"allowed_source_concepts": ["us-gaap:GrossProfit"],
"allowed_authoritative_concepts": ["us-gaap:GrossProfit"],
"formula_fallback": {
"op": "subtract",
"sources": ["revenue", "cost_of_revenue"],
"treat_null_as_zero": false
},
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "gross_margin",
"statement": "income",
"label": "Gross Margin",
"category": "derived",
"order": 35,
"unit": "percent",
"rollup_policy": "formula_only",
"allowed_source_concepts": [],
"allowed_authoritative_concepts": [],
"formula_fallback": {
"op": "divide",
"sources": ["gross_profit", "revenue"],
"treat_null_as_zero": false
},
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "operating_expenses",
"statement": "income",
@@ -24,12 +82,257 @@
"order": 40,
"unit": "currency",
"rollup_policy": "aggregate_children",
"allowed_source_concepts": ["us-gaap:SellingGeneralAndAdministrativeExpense", "us-gaap:ResearchAndDevelopmentExpense"],
"allowed_source_concepts": ["us-gaap:OperatingExpenses"],
"allowed_authoritative_concepts": ["us-gaap:OperatingExpenses"],
"formula_fallback": "sum(detail_rows)",
"detail_grouping_policy": "group_all_children",
"materiality_policy": "income_default"
},
{
"surface_key": "selling_general_and_administrative",
"statement": "income",
"label": "Selling, General & Administrative",
"category": "surface",
"order": 45,
"unit": "currency",
"rollup_policy": "direct_or_formula",
"allowed_source_concepts": [
"us-gaap:SellingGeneralAndAdministrativeExpense",
"us-gaap:SellingGeneralAndAdministrativeExpenseExcludingEmployeeStockOptionPlanSpecialDividendCompensation"
],
"allowed_authoritative_concepts": ["us-gaap:SellingGeneralAndAdministrativeExpense"],
"formula_fallback": {
"op": "sum",
"sources": ["sales_and_marketing", "general_and_administrative"],
"treat_null_as_zero": true
},
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "research_and_development",
"statement": "income",
"label": "Research & Development",
"category": "surface",
"order": 50,
"unit": "currency",
"rollup_policy": "direct_only",
"allowed_source_concepts": ["us-gaap:ResearchAndDevelopmentExpense"],
"allowed_authoritative_concepts": ["us-gaap:ResearchAndDevelopmentExpense"],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "depreciation_and_amortization",
"statement": "income",
"label": "Depreciation & Amortization",
"category": "surface",
"order": 55,
"unit": "currency",
"rollup_policy": "direct_only",
"allowed_source_concepts": [
"us-gaap:DepreciationDepletionAndAmortization",
"us-gaap:DepreciationAmortizationAndAccretionNet",
"us-gaap:DepreciationAndAmortization",
"us-gaap:DepreciationAmortizationAndOther",
"us-gaap:CostOfGoodsAndServicesSoldDepreciationAndAmortization"
],
"allowed_authoritative_concepts": [
"us-gaap:DepreciationDepletionAndAmortization",
"us-gaap:DepreciationAmortizationAndAccretionNet",
"us-gaap:DepreciationAndAmortization",
"us-gaap:DepreciationAmortizationAndOther"
],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "stock_based_compensation",
"statement": "income",
"label": "Stock-Based Compensation",
"category": "surface",
"order": 58,
"unit": "currency",
"rollup_policy": "direct_only",
"allowed_source_concepts": [
"us-gaap:ShareBasedCompensation",
"us-gaap:AllocatedShareBasedCompensationExpense"
],
"allowed_authoritative_concepts": [
"us-gaap:ShareBasedCompensation",
"us-gaap:AllocatedShareBasedCompensationExpense"
],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "operating_income",
"statement": "income",
"label": "Operating Income",
"category": "surface",
"order": 60,
"unit": "currency",
"rollup_policy": "direct_or_formula",
"allowed_source_concepts": [
"us-gaap:OperatingIncomeLoss",
"us-gaap:IncomeFromOperations",
"us-gaap:OperatingProfit"
],
"allowed_authoritative_concepts": ["us-gaap:OperatingIncomeLoss"],
"formula_fallback": {
"op": "subtract",
"sources": ["gross_profit", "operating_expenses"],
"treat_null_as_zero": false
},
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "operating_margin",
"statement": "income",
"label": "Operating Margin",
"category": "derived",
"order": 65,
"unit": "percent",
"rollup_policy": "formula_only",
"allowed_source_concepts": [],
"allowed_authoritative_concepts": [],
"formula_fallback": {
"op": "divide",
"sources": ["operating_income", "revenue"],
"treat_null_as_zero": false
},
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "interest_income",
"statement": "income",
"label": "Interest Income",
"category": "surface",
"order": 70,
"unit": "currency",
"rollup_policy": "direct_only",
"allowed_source_concepts": [
"us-gaap:InterestIncomeOther",
"us-gaap:InvestmentIncomeInterest"
],
"allowed_authoritative_concepts": ["us-gaap:InterestIncomeOther"],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "interest_expense",
"statement": "income",
"label": "Interest Expense",
"category": "surface",
"order": 75,
"unit": "currency",
"rollup_policy": "direct_only",
"allowed_source_concepts": [
"us-gaap:InterestIncomeExpenseNonoperatingNet",
"us-gaap:InterestExpense",
"us-gaap:InterestAndDebtExpense"
],
"allowed_authoritative_concepts": ["us-gaap:InterestExpense"],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default",
"sign_transform": "absolute"
},
{
"surface_key": "other_non_operating_income",
"statement": "income",
"label": "Other Non-Operating Income",
"category": "surface",
"order": 78,
"unit": "currency",
"rollup_policy": "direct_only",
"allowed_source_concepts": [
"us-gaap:OtherNonoperatingIncomeExpense",
"us-gaap:NonoperatingIncomeExpense"
],
"allowed_authoritative_concepts": ["us-gaap:OtherNonoperatingIncomeExpense"],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "pretax_income",
"statement": "income",
"label": "Pretax Income",
"category": "surface",
"order": 80,
"unit": "currency",
"rollup_policy": "direct_or_formula",
"allowed_source_concepts": [
"us-gaap:IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest",
"us-gaap:IncomeBeforeTaxExpenseBenefit",
"us-gaap:PretaxIncome"
],
"allowed_authoritative_concepts": ["us-gaap:IncomeBeforeTaxExpenseBenefit"],
"formula_fallback": {
"op": "sum",
"sources": ["net_income", "income_tax_expense"],
"treat_null_as_zero": false
},
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "income_tax_expense",
"statement": "income",
"label": "Income Tax Expense",
"category": "surface",
"order": 85,
"unit": "currency",
"rollup_policy": "direct_only",
"allowed_source_concepts": ["us-gaap:IncomeTaxExpenseBenefit"],
"allowed_authoritative_concepts": ["us-gaap:IncomeTaxExpenseBenefit"],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "effective_tax_rate",
"statement": "income",
"label": "Effective Tax Rate",
"category": "derived",
"order": 87,
"unit": "percent",
"rollup_policy": "formula_only",
"allowed_source_concepts": [],
"allowed_authoritative_concepts": [],
"formula_fallback": {
"op": "divide",
"sources": ["income_tax_expense", "pretax_income"],
"treat_null_as_zero": false
},
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "ebitda",
"statement": "income",
"label": "EBITDA",
"category": "derived",
"order": 88,
"unit": "currency",
"rollup_policy": "formula_only",
"allowed_source_concepts": [],
"allowed_authoritative_concepts": [],
"formula_fallback": {
"op": "sum",
"sources": ["operating_income", "depreciation_and_amortization"],
"treat_null_as_zero": true
},
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "net_income",
"statement": "income",
@@ -44,6 +347,100 @@
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "net_income_attributable_to_common",
"statement": "income",
"label": "Net Income Attributable to Common",
"category": "surface",
"order": 92,
"unit": "currency",
"rollup_policy": "direct_only",
"allowed_source_concepts": [
"us-gaap:NetIncomeLossAvailableToCommonStockholdersBasic"
],
"allowed_authoritative_concepts": [
"us-gaap:NetIncomeLossAvailableToCommonStockholdersBasic"
],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "diluted_eps",
"statement": "income",
"label": "Diluted EPS",
"category": "surface",
"order": 100,
"unit": "currency",
"rollup_policy": "direct_only",
"allowed_source_concepts": [
"us-gaap:EarningsPerShareDiluted",
"us-gaap:DilutedEarningsPerShare"
],
"allowed_authoritative_concepts": [
"us-gaap:EarningsPerShareDiluted"
],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "basic_eps",
"statement": "income",
"label": "Basic EPS",
"category": "surface",
"order": 105,
"unit": "currency",
"rollup_policy": "direct_only",
"allowed_source_concepts": [
"us-gaap:EarningsPerShareBasic",
"us-gaap:BasicEarningsPerShare"
],
"allowed_authoritative_concepts": [
"us-gaap:EarningsPerShareBasic"
],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "diluted_shares",
"statement": "income",
"label": "Diluted Shares Outstanding",
"category": "surface",
"order": 110,
"unit": "shares",
"rollup_policy": "direct_only",
"allowed_source_concepts": [
"us-gaap:WeightedAverageNumberOfDilutedSharesOutstanding",
"us-gaap:WeightedAverageNumberOfShareOutstandingDiluted"
],
"allowed_authoritative_concepts": [
"us-gaap:WeightedAverageNumberOfDilutedSharesOutstanding"
],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "basic_shares",
"statement": "income",
"label": "Basic Shares Outstanding",
"category": "surface",
"order": 115,
"unit": "shares",
"rollup_policy": "direct_only",
"allowed_source_concepts": [
"us-gaap:WeightedAverageNumberOfSharesOutstandingBasic",
"us-gaap:WeightedAverageNumberOfShareOutstandingBasicAndDiluted"
],
"allowed_authoritative_concepts": [
"us-gaap:WeightedAverageNumberOfSharesOutstandingBasic"
],
"formula_fallback": null,
"detail_grouping_policy": "top_level_only",
"materiality_policy": "income_default"
},
{
"surface_key": "cash_and_equivalents",
"statement": "balance",