feat(taxonomy): add rust sidecar compact surface pipeline

This commit is contained in:
2026-03-12 15:23:10 -04:00
parent f2c25fb9c6
commit 58061af006
84 changed files with 19350 additions and 265 deletions

View File

@@ -1,8 +1,7 @@
import type { Filing, FinancialStatementKind, TaxonomyStatementRow } from '@/lib/types';
import type { TaxonomyConcept, TaxonomyFact, TaxonomyPresentationConcept } from '@/lib/server/taxonomy/types';
import type { FilingTaxonomyPeriod } from '@/lib/server/repos/filing-taxonomy';
import { classifyStatementRole } from '@/lib/server/taxonomy/linkbase-parser';
import { conceptStatementFallback } from '@/lib/server/taxonomy/xbrl-parser';
import { classifyStatementRole, conceptStatementFallback } from '@/lib/server/taxonomy/classifiers';
function compactAccessionNumber(value: string) {
return value.replace(/-/g, '');
@@ -308,8 +307,17 @@ export function materializeTaxonomyStatements(input: {
local_name: localName,
label,
is_extension: !isUsGaapNamespace(namespaceUri),
balance: null,
period_type: null,
data_type: null,
statement_kind: statement,
role_uri: orderedConcept.roleUri,
authoritative_concept_key: null,
mapping_method: null,
surface_key: null,
detail_parent_surface_key: null,
kpi_key: null,
residual_flag: false,
presentation_order: row.order,
presentation_depth: row.depth,
parent_concept_key: row.parentKey,
@@ -331,8 +339,17 @@ export function materializeTaxonomyStatements(input: {
local_name: fact.localName,
label: input.labelByConcept.get(fact.conceptKey) ?? localNameToLabel(fact.localName),
is_extension: !isUsGaapNamespace(fact.namespaceUri),
balance: null,
period_type: null,
data_type: fact.dataType,
statement_kind: fact.statement_kind,
role_uri: fact.role_uri,
authoritative_concept_key: null,
mapping_method: null,
surface_key: null,
detail_parent_surface_key: null,
kpi_key: null,
residual_flag: false,
presentation_order: null,
presentation_depth: null,
parent_concept_key: null,
@@ -346,11 +363,20 @@ export function materializeTaxonomyStatements(input: {
qname: fact.qname,
namespace_uri: fact.namespaceUri,
local_name: fact.localName,
data_type: fact.dataType,
statement_kind: fact.statement_kind,
role_uri: fact.role_uri,
authoritative_concept_key: null,
mapping_method: null,
surface_key: null,
detail_parent_surface_key: null,
kpi_key: null,
residual_flag: false,
context_id: fact.contextId,
unit: fact.unit,
decimals: fact.decimals,
precision: fact.precision,
nil: fact.nil,
value_num: fact.value,
period_start: fact.periodStart,
period_end: fact.periodEnd,