feat: Canadian corporate registry ingestion pipeline#3
Open
xrendan wants to merge 1 commit into
Open
Conversation
Add corporate entity tracking across all Canadian jurisdictions to connect government fiscal data with the actual entities receiving public money. Key changes: - Rename Organization → GovernmentEntity (full DB rename: tables, columns, VIEW) - Add CorporateEntity, CorporateDirector, DirectorAppointment, CorporateRegistration models - Add BusinessEstablishment (ODBiz) and StandardizedAddress (ODA) for enrichment - Federal ISED XML normalizer (SAX parser, 500K+ records, batch upserts) - BC OrgBook API normalizer (2.4M entities, paginated) - Quebec registry CSV normalizer (6-file ZIP) - Provincial HTML scrapers (ON, AB, SK) with shared concern - ODBiz CSV normalizer (450K businesses with NAICS codes) - ODA CSV normalizer (10M addresses per-province with geocoding) - Director enrichment via ISED JSON API - Admin dashboard with per-source and bulk ingestion trigger buttons - REST API endpoints for corporate entities, directors, and business establishments - pg_trgm extension with GIN indexes for fuzzy name matching at scale - Production rake tasks (data:ingest_all, data:ingest_federal, etc.) - QA-verified against real government data (62K ODBiz, 14K ISED, 1.7M ODA records) 77 tests, 239 assertions, 0 failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
baa6a90 to
5ce141b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Organization→GovernmentEntity(tables, columns, spending_deviations VIEW, all references across 31+ files)CorporateDirector+DirectorAppointmentmodels with ISED JSON API enrichment for federal corporationsNew models
CorporateEntity,CorporateDirector,DirectorAppointment,CorporateRegistration,CorporateEntityAlias,BusinessEstablishment,StandardizedAddressNew normalizers/scrapers
CorporateNormalizer(ISED SAX),OrgbookBcNormalizer,QuebecRegistryNormalizer,OdbizNormalizer,OdaNormalizer,OntarioObrScraper,AlbertaCoresScraper,SaskatchewanIscScraperDatabase
10 migrations: pg_trgm extension, Organization→GovernmentEntity rename, 7 new tables, scraping progress column
Test plan
bin/rails db:migrateon production Supabasebin/rails db:seedto register new data sourcesrake data:ingest_all🤖 Generated with Claude Code