Fix financial taxonomy snapshot normalization
This commit is contained in:
@@ -43,11 +43,11 @@ function createHydrationResult(): TaxonomyHydrationResult {
|
||||
facts: [],
|
||||
metric_validations: [],
|
||||
normalization_summary: {
|
||||
surfaceRowCount: 0,
|
||||
detailRowCount: 0,
|
||||
kpiRowCount: 0,
|
||||
unmappedRowCount: 0,
|
||||
materialUnmappedRowCount: 0,
|
||||
surface_row_count: 0,
|
||||
detail_row_count: 0,
|
||||
kpi_row_count: 0,
|
||||
unmapped_row_count: 0,
|
||||
material_unmapped_row_count: 0,
|
||||
warnings: ['rust_warning']
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import type {
|
||||
Filing,
|
||||
FinancialStatementKind,
|
||||
MetricValidationResult,
|
||||
NormalizationSummary,
|
||||
StructuredKpiRow,
|
||||
SurfaceDetailMap,
|
||||
SurfaceFinancialRow,
|
||||
TaxonomyStatementRow
|
||||
MetricValidationResult
|
||||
} from '@/lib/types';
|
||||
import type {
|
||||
FilingTaxonomyAssetType,
|
||||
@@ -117,6 +112,98 @@ export type TaxonomyMetricValidationCheck = {
|
||||
error: string | null;
|
||||
};
|
||||
|
||||
export type TaxonomyHydrationPeriod = {
|
||||
id: string;
|
||||
filing_id: number;
|
||||
accession_number: string;
|
||||
filing_date: string;
|
||||
period_start: string | null;
|
||||
period_end: string | null;
|
||||
filing_type: '10-K' | '10-Q';
|
||||
period_label: string;
|
||||
};
|
||||
|
||||
export type TaxonomyHydrationStatementRow = {
|
||||
key: string;
|
||||
label: string;
|
||||
concept_key: string;
|
||||
qname: string;
|
||||
namespace_uri: string;
|
||||
local_name: string;
|
||||
is_extension: boolean;
|
||||
statement: FinancialStatementKind;
|
||||
role_uri: string | null;
|
||||
order: number;
|
||||
depth: number;
|
||||
parent_key: string | null;
|
||||
values: Record<string, number | null>;
|
||||
units: Record<string, string | null>;
|
||||
has_dimensions: boolean;
|
||||
source_fact_ids: number[];
|
||||
};
|
||||
|
||||
export type TaxonomyHydrationSurfaceRow = {
|
||||
key: string;
|
||||
label: string;
|
||||
category: string;
|
||||
template_section?: string;
|
||||
order: number;
|
||||
unit: 'currency' | 'count' | 'shares' | 'percent' | 'ratio';
|
||||
values: Record<string, number | null>;
|
||||
source_concepts: string[];
|
||||
source_row_keys: string[];
|
||||
source_fact_ids: number[];
|
||||
formula_key: string | null;
|
||||
has_dimensions: boolean;
|
||||
resolved_source_row_keys: Record<string, string | null>;
|
||||
statement?: 'income' | 'balance' | 'cash_flow';
|
||||
detail_count?: number;
|
||||
resolution_method?: 'direct' | 'surface_bridge' | 'formula_derived' | 'not_meaningful';
|
||||
confidence?: 'high' | 'medium' | 'low';
|
||||
warning_codes?: string[];
|
||||
};
|
||||
|
||||
export type TaxonomyHydrationDetailRow = {
|
||||
key: string;
|
||||
parent_surface_key: string;
|
||||
label: string;
|
||||
concept_key: string;
|
||||
qname: string;
|
||||
namespace_uri: string;
|
||||
local_name: string;
|
||||
unit: string | null;
|
||||
values: Record<string, number | null>;
|
||||
source_fact_ids: number[];
|
||||
is_extension: boolean;
|
||||
dimensions_summary: string[];
|
||||
residual_flag: boolean;
|
||||
};
|
||||
|
||||
export type TaxonomyHydrationStructuredKpiRow = {
|
||||
key: string;
|
||||
label: string;
|
||||
category: string;
|
||||
unit: 'currency' | 'count' | 'shares' | 'percent' | 'ratio';
|
||||
order: number;
|
||||
segment: string | null;
|
||||
axis: string | null;
|
||||
member: string | null;
|
||||
values: Record<string, number | null>;
|
||||
source_concepts: string[];
|
||||
source_fact_ids: number[];
|
||||
provenance_type: 'taxonomy' | 'structured_note';
|
||||
has_dimensions: boolean;
|
||||
};
|
||||
|
||||
export type TaxonomyHydrationNormalizationSummary = {
|
||||
surface_row_count: number;
|
||||
detail_row_count: number;
|
||||
kpi_row_count: number;
|
||||
unmapped_row_count: number;
|
||||
material_unmapped_row_count: number;
|
||||
warnings: string[];
|
||||
};
|
||||
|
||||
export type TaxonomyHydrationInput = {
|
||||
filingId: number;
|
||||
ticker: string;
|
||||
@@ -140,12 +227,12 @@ export type TaxonomyHydrationResult = {
|
||||
parser_version: string;
|
||||
taxonomy_regime: 'us-gaap' | 'ifrs-full' | 'unknown';
|
||||
fiscal_pack: string | null;
|
||||
periods: FilingTaxonomyPeriod[];
|
||||
faithful_rows: Record<FinancialStatementKind, TaxonomyStatementRow[]>;
|
||||
statement_rows: Record<FinancialStatementKind, TaxonomyStatementRow[]>;
|
||||
surface_rows: Record<FinancialStatementKind, SurfaceFinancialRow[]>;
|
||||
detail_rows: Record<FinancialStatementKind, SurfaceDetailMap>;
|
||||
kpi_rows: StructuredKpiRow[];
|
||||
periods: TaxonomyHydrationPeriod[];
|
||||
faithful_rows: Record<FinancialStatementKind, TaxonomyHydrationStatementRow[]>;
|
||||
statement_rows: Record<FinancialStatementKind, TaxonomyHydrationStatementRow[]>;
|
||||
surface_rows: Record<FinancialStatementKind, TaxonomyHydrationSurfaceRow[]>;
|
||||
detail_rows: Record<FinancialStatementKind, Record<string, TaxonomyHydrationDetailRow[]>>;
|
||||
kpi_rows: TaxonomyHydrationStructuredKpiRow[];
|
||||
contexts: Array<{
|
||||
context_id: string;
|
||||
entity_identifier: string | null;
|
||||
@@ -191,5 +278,5 @@ export type TaxonomyHydrationResult = {
|
||||
source_file: string | null;
|
||||
}>;
|
||||
metric_validations: TaxonomyMetricValidationCheck[];
|
||||
normalization_summary: NormalizationSummary;
|
||||
normalization_summary: TaxonomyHydrationNormalizationSummary;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user