Expand financials surfaces with ratios, KPIs, and cadence support

- Add bundled financial modeling pipeline (ratios, KPI dimensions/notes, trend series, standardization)
- Introduce company financial bundles storage (Drizzle migration + repo wiring)
- Refactor financials page/API/query flow to use surfaceKind + cadence and new response shapes
This commit is contained in:
2026-03-07 15:16:35 -05:00
parent a42622ba6e
commit db01f207a5
33 changed files with 3589 additions and 1643 deletions

View File

@@ -515,6 +515,7 @@ export async function upsertFilingTaxonomySnapshot(input: UpsertFilingTaxonomySn
export async function listFilingTaxonomySnapshotsByTicker(input: {
ticker: string;
window: '10y' | 'all';
filingTypes?: Array<'10-K' | '10-Q'>;
limit?: number;
cursor?: string | null;
}) {
@@ -530,6 +531,10 @@ export async function listFilingTaxonomySnapshotsByTicker(input: {
constraints.push(lt(filingTaxonomySnapshot.id, cursorId));
}
if (input.filingTypes && input.filingTypes.length > 0) {
constraints.push(inArray(filingTaxonomySnapshot.filing_type, input.filingTypes));
}
const rows = await db
.select()
.from(filingTaxonomySnapshot)
@@ -573,6 +578,7 @@ export async function listTaxonomyFactsByTicker(input: {
ticker: string;
window: '10y' | 'all';
statement?: FinancialStatementKind;
filingTypes?: Array<'10-K' | '10-Q'>;
cursor?: string | null;
limit?: number;
}) {
@@ -588,6 +594,10 @@ export async function listTaxonomyFactsByTicker(input: {
conditions.push(eq(filingTaxonomyFact.statement_kind, input.statement));
}
if (input.filingTypes && input.filingTypes.length > 0) {
conditions.push(inArray(filingTaxonomySnapshot.filing_type, input.filingTypes));
}
if (cursorId && Number.isFinite(cursorId) && cursorId > 0) {
conditions.push(lt(filingTaxonomyFact.id, cursorId));
}