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

@@ -16,6 +16,9 @@ import {
updateFilingMetricsById,
upsertFilingsRecords
} from '@/lib/server/repos/filings';
import {
deleteCompanyFinancialBundlesForTicker
} from '@/lib/server/repos/company-financial-bundles';
import {
getFilingTaxonomySnapshotByFilingId,
upsertFilingTaxonomySnapshot
@@ -623,6 +626,7 @@ async function processSyncFilings(task: Task) {
await upsertFilingTaxonomySnapshot(snapshot);
await updateFilingMetricsById(filing.id, snapshot.derived_metrics);
await deleteCompanyFinancialBundlesForTicker(filing.ticker);
taxonomySnapshotsHydrated += 1;
} catch (error) {
const now = new Date().toISOString();
@@ -656,6 +660,7 @@ async function processSyncFilings(task: Task) {
facts: [],
metric_validations: []
});
await deleteCompanyFinancialBundlesForTicker(filing.ticker);
taxonomySnapshotsFailed += 1;
}