feat(taxonomy): add rust sidecar compact surface pipeline

This commit is contained in:
2026-03-12 15:23:10 -04:00
parent f2c25fb9c6
commit 58061af006
84 changed files with 19350 additions and 265 deletions

View File

@@ -0,0 +1,100 @@
PRAGMA foreign_keys=OFF;
--> statement-breakpoint
CREATE TABLE `__new_filing_taxonomy_snapshot` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`filing_id` integer NOT NULL,
`ticker` text NOT NULL,
`filing_date` text NOT NULL,
`filing_type` text NOT NULL,
`parse_status` text NOT NULL,
`parse_error` text,
`source` text NOT NULL,
`parser_engine` text DEFAULT 'fiscal-xbrl' NOT NULL,
`parser_version` text DEFAULT 'unknown' NOT NULL,
`taxonomy_regime` text DEFAULT 'unknown' NOT NULL,
`fiscal_pack` text,
`periods` text,
`faithful_rows` text,
`statement_rows` text,
`surface_rows` text,
`detail_rows` text,
`kpi_rows` text,
`derived_metrics` text,
`validation_result` text,
`normalization_summary` text,
`facts_count` integer DEFAULT 0 NOT NULL,
`concepts_count` integer DEFAULT 0 NOT NULL,
`dimensions_count` integer DEFAULT 0 NOT NULL,
`created_at` text NOT NULL,
`updated_at` text NOT NULL,
FOREIGN KEY (`filing_id`) REFERENCES `filing`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
INSERT INTO `__new_filing_taxonomy_snapshot` (
`id`,
`filing_id`,
`ticker`,
`filing_date`,
`filing_type`,
`parse_status`,
`parse_error`,
`source`,
`parser_engine`,
`parser_version`,
`taxonomy_regime`,
`fiscal_pack`,
`periods`,
`faithful_rows`,
`statement_rows`,
`surface_rows`,
`detail_rows`,
`kpi_rows`,
`derived_metrics`,
`validation_result`,
`normalization_summary`,
`facts_count`,
`concepts_count`,
`dimensions_count`,
`created_at`,
`updated_at`
)
SELECT
`id`,
`filing_id`,
`ticker`,
`filing_date`,
`filing_type`,
`parse_status`,
`parse_error`,
`source`,
`parser_engine`,
`parser_version`,
`taxonomy_regime`,
`fiscal_pack`,
`periods`,
`faithful_rows`,
`statement_rows`,
`surface_rows`,
`detail_rows`,
`kpi_rows`,
`derived_metrics`,
`validation_result`,
`normalization_summary`,
`facts_count`,
`concepts_count`,
`dimensions_count`,
`created_at`,
`updated_at`
FROM `filing_taxonomy_snapshot`;
--> statement-breakpoint
DROP TABLE `filing_taxonomy_snapshot`;
--> statement-breakpoint
ALTER TABLE `__new_filing_taxonomy_snapshot` RENAME TO `filing_taxonomy_snapshot`;
--> statement-breakpoint
CREATE UNIQUE INDEX `filing_taxonomy_snapshot_filing_uidx` ON `filing_taxonomy_snapshot` (`filing_id`);
--> statement-breakpoint
CREATE INDEX `filing_taxonomy_snapshot_ticker_date_idx` ON `filing_taxonomy_snapshot` (`ticker`,`filing_date`);
--> statement-breakpoint
CREATE INDEX `filing_taxonomy_snapshot_status_idx` ON `filing_taxonomy_snapshot` (`parse_status`);
--> statement-breakpoint
PRAGMA foreign_keys=ON;