A standalone, high-performance web server built with FastAPI and ConnectRPC (using Protocol Buffers) to serve Canadian legislative (legisinfo) and lobbying (lobbycanada) data using civican-schemas.
- FastAPI Engine: Built on ASGI with fully asynchronous ConnectRPC handlers.
- ConnectRPC / Protobuf Core: Full type safety via
civican-schemas, schema-first design, and native support for three protocols on a single port:- Connect: Lightweight JSON/HTTP protocol compatible with
curland standard HTTP clients. - gRPC: High-performance, binary protocol for backend microservices.
- gRPC-Web: Browser-compatible protocol for frontend applications.
- Connect: Lightweight JSON/HTTP protocol compatible with
- Dual-Source Support:
- LegisinfoService: Query Parliament sessions, bill metadata, and full text documents.
- LobbyCanadaService: Query lobbying registrations, subject matters, and communication reports stored in DuckDB (
lobbycanada.duckdb).
- Docker Containerized: Multi-stage Docker build ready for container deployment.
- Python 3.11+
- uv (recommended) or
pip
Set up the virtual environment and install packages in editable mode:
make installStart the development server with hot reload:
make run LEGISINFO_DATA_PATH=../legisinfo LOBBYCANADA_DB_PATH=../lobbycanada/lobbycanada.duckdbYour API is now running at http://localhost:8001. You can access the standard HTTP health check endpoint at http://localhost:8001/health.
ListSessions: List all parliament sessions.ListBills: List and filter bills with sorting options.GetBill: Retrieve detailed metadata for a single bill.GetBillText: Retrieve full bill text in Markdown or XML.
ListRegistrations: Search and filter lobbyist registrations.GetRegistration: Retrieve registration detail.ListCommunications: Search and filter monthly communication reports.GetCommunication: Retrieve communication report detail.
make docker-upThe container maps host port 8001 to container port 8000 and mounts /data/legisinfo and /data/lobbycanada.
MIT License.