Add history window controls and expand taxonomy pack support

- add 3Y/5Y/10Y financial history filtering and reorganize normalization details UI
- add new fiscal taxonomy surface/income bridge/KPI packs and update Rust taxonomy loading
- auto-detect Homebrew SQLite for native `sqlite-vec` in local dev/e2e with docs and env guidance
This commit is contained in:
2026-03-18 23:40:28 -04:00
parent f8426c4dde
commit 17de3dd72d
102 changed files with 14978 additions and 1316 deletions

View File

@@ -93,6 +93,29 @@ const PACK_ORDER = [
"insurance",
"reit_real_estate",
"broker_asset_manager",
"agriculture",
"contractors_construction",
"contractors_federal_government",
"development_stage",
"entertainment_broadcasters",
"entertainment_cable_television",
"entertainment_casinos",
"entertainment_films",
"entertainment_music",
"extractive_mining",
"mortgage_banking",
"title_plant",
"franchisors",
"not_for_profit",
"plan_defined_benefit",
"plan_defined_contribution",
"plan_health_welfare",
"real_estate_general",
"real_estate_common_interest",
"real_estate_retail_land",
"real_estate_time_sharing",
"software",
"steamship",
] as const;
type PackName = (typeof PACK_ORDER)[number];
@@ -452,6 +475,34 @@ export { ${packs.map((p) => `${p.pack.toUpperCase().replace(/-/g, "_")}_KPIS`).j
`;
}
function buildUnionSurfaceDefinitions(
surfacePacks: Map<PackName, SurfacePackFile>,
): Map<string, SurfaceDefinition[]> {
const surfacesByStatement = new Map<string, SurfaceDefinition[]>();
const seen = new Set<string>();
for (const pack of PACK_ORDER) {
const file = surfacePacks.get(pack);
if (!file) {
continue;
}
for (const surface of file.surfaces) {
const dedupeKey = `${surface.statement}:${surface.surface_key}`;
if (seen.has(dedupeKey)) {
continue;
}
seen.add(dedupeKey);
const existing = surfacesByStatement.get(surface.statement) || [];
existing.push(surface);
surfacesByStatement.set(surface.statement, existing);
}
}
return surfacesByStatement;
}
function generateMainIndex(): string {
return `// Auto-generated by scripts/generate-taxonomy.ts
// DO NOT EDIT MANUALLY - changes will be overwritten
@@ -533,17 +584,9 @@ async function main() {
writeFileSync(join(OUTPUT_DIR, "types.ts"), generateTypesFile());
log("Generating surfaces...");
const coreSurfaces = surfacePacks.get("core");
if (coreSurfaces) {
const surfacesByStatement = new Map<string, SurfaceDefinition[]>();
for (const surface of coreSurfaces.surfaces) {
const existing = surfacesByStatement.get(surface.statement) || [];
existing.push(surface);
surfacesByStatement.set(surface.statement, existing);
}
for (const [statement, surfaces] of surfacesByStatement) {
const unionSurfaceDefinitions = buildUnionSurfaceDefinitions(surfacePacks);
if (unionSurfaceDefinitions.size > 0) {
for (const [statement, surfaces] of unionSurfaceDefinitions) {
writeFileSync(
join(OUTPUT_DIR, "surfaces", `${statement}.ts`),
generateSurfaceFile(statement, surfaces),
@@ -552,7 +595,7 @@ async function main() {
writeFileSync(
join(OUTPUT_DIR, "surfaces", "index.ts"),
generateSurfacesIndex(surfacesByStatement),
generateSurfacesIndex(unionSurfaceDefinitions),
);
}
@@ -592,7 +635,10 @@ async function main() {
log("Generating main index...");
writeFileSync(join(OUTPUT_DIR, "index.ts"), generateMainIndex());
const surfaceCount = coreSurfaces?.surfaces.length || 0;
const surfaceCount = [...unionSurfaceDefinitions.values()].reduce(
(sum, surfaces) => sum + surfaces.length,
0,
);
const computedCount = computedFiles.reduce(
(sum, f) => sum + f.definitions.length,
0,