Implement dual-surface financials and db bootstrap

This commit is contained in:
2026-03-06 16:24:56 -05:00
parent 8e62c66677
commit 8b1fff4130
7 changed files with 1207 additions and 179 deletions

View File

@@ -213,6 +213,21 @@ export type TaxonomyStatementRow = {
sourceFactIds: number[];
};
export type FinancialStatementSurfaceKind = 'faithful' | 'standardized';
export type StandardizedStatementRow = {
key: string;
label: string;
category: string;
order: number;
values: Record<string, number | null>;
hasDimensions: boolean;
sourceConcepts: string[];
sourceRowKeys: string[];
sourceFactIds: number[];
resolvedSourceRowKeys: Record<string, string | null>;
};
export type TaxonomyFactRow = {
id: number;
snapshotId: number;
@@ -256,16 +271,6 @@ export type MetricValidationResult = {
validatedAt: string | null;
};
export type StandardizedStatementRow = {
key: string;
label: string;
concept: string;
category: string;
sourceConcepts: string[];
values: Record<string, number | null>;
hasDimensions: boolean;
};
export type FilingFaithfulStatementRow = {
key: string;
label: string;
@@ -280,6 +285,8 @@ export type FilingFaithfulStatementRow = {
export type DimensionBreakdownRow = {
rowKey: string;
concept: string | null;
sourceRowKey: string | null;
sourceLabel: string | null;
periodId: string;
axis: string;
member: string;
@@ -287,6 +294,11 @@ export type DimensionBreakdownRow = {
unit: string | null;
};
export type FinancialStatementSurface<Row> = {
kind: FinancialStatementSurfaceKind;
rows: Row[];
};
export type CompanyFinancialStatementsResponse = {
company: {
ticker: string;
@@ -295,8 +307,12 @@ export type CompanyFinancialStatementsResponse = {
};
statement: FinancialStatementKind;
window: FinancialHistoryWindow;
defaultSurface: FinancialStatementSurfaceKind;
periods: FinancialStatementPeriod[];
rows: TaxonomyStatementRow[];
surfaces: {
faithful: FinancialStatementSurface<TaxonomyStatementRow>;
standardized: FinancialStatementSurface<StandardizedStatementRow>;
};
nextCursor: string | null;
facts: {
rows: TaxonomyFactRow[];