Under the hood of Canada Spends with Brendan Samek
AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.
Why it matters
Shows a working recipe, Datasette plus LLM-driven PDF extraction with arithmetic cross-checks, for turning messy government PDFs into a queryable public database.
Canada Spends is a website built by the volunteer group Build Canada that lets anyone browse Canadian government financial data, contracts, grants and transfers, in one place. Its founder Brendan Samek explains how the data is gathered, including using the AI model Gemini to pull numbers out of government PDF documents. The project's public database holds more than 2 million rows, including over 1.1 million contracts worth over $10,000.
Build Canada, a volunteer non-profit launched in February 2025, released Canada Spends to make Canadian government spending explorable by the public. Its stack combines Datasette, Ruby ingestion scripts, sqlite-utils and Gemini-powered PDF extraction, with sums cross-checked to catch extraction errors. A downloadable 2.4 GB SQLite database and live API instance are available, lowering the cost of civic-data scrutiny for journalists and researchers.
Brendan Samek walks through the Canada Spends architecture: Ruby ingestion scripts and sqlite-utils load scraped data into SQLite, served via a public Datasette instance at api.canadasbuilding.com with over 2 million rows and a combined search index over a denormalized copy. Audited financial statements are published as PDFs; Gemini extracts them, validated by cross-checking accounting sums. Tables include contracts-over-10k (1,172,575 rows), nserc_grants (701,310) and transfers (357,797).
Read the original
This summary exists to save you time, not to replace the source.
Key terms
Canada Spends Build Canada Datasette sqlite-utils Gemini SQLite
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
A self-hosted file manager fork with OIDC, LDAP, and real-time search
FileBrowser Quantum lets teams manage multiple storage sources with enterprise authentication and real-time search without complex setup, saving admin time and reducing security risk.
A Go implementation of MCP for connecting LLM apps to tools and data
Go developers can expose LLM tools without writing MCP plumbing, saving time on integration.
An open-source Canva alternative you can self-host, with video export
Self-hosted design tools let teams avoid subscription fees and keep data on their own servers, while adding video export unlocks new content formats for social media creators.
Code-driven AI illustrations are more useful than images from dedicated image models
Code-driven AI illustrations let designers edit assets directly in code, saving time on iteration and ensuring consistency, which is a game-changer for teams that need rapid, reusable visual content.
datasette-charts 0.5a0
Datasette Charts 0.5a0 adds calendar heatmaps, box plots and active-over-time charts, enabling richer data visualisation directly in the browser without extra libraries.