Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

CIVICAN ConnectRPC API Server

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.


🚀 Features

  • 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 curl and standard HTTP clients.
    • gRPC: High-performance, binary protocol for backend microservices.
    • gRPC-Web: Browser-compatible protocol for frontend applications.
  • 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.

🛠️ Getting Started

Prerequisites

  • Python 3.11+
  • uv (recommended) or pip

1. Installation

Set up the virtual environment and install packages in editable mode:

make install

2. Run Locally

Start the development server with hot reload:

make run LEGISINFO_DATA_PATH=../legisinfo LOBBYCANADA_DB_PATH=../lobbycanada/lobbycanada.duckdb

Your API is now running at http://localhost:8001. You can access the standard HTTP health check endpoint at http://localhost:8001/health.


📡 API Services

1. LegisinfoService (/legisinfo.v1.LegisinfoService/*)

  • 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.

2. LobbyCanadaService (/lobbycanada.v1.LobbyCanadaService/*)

  • ListRegistrations: Search and filter lobbyist registrations.
  • GetRegistration: Retrieve registration detail.
  • ListCommunications: Search and filter monthly communication reports.
  • GetCommunication: Retrieve communication report detail.

🐳 Docker Deployment

make docker-up

The container maps host port 8001 to container port 8000 and mounts /data/legisinfo and /data/lobbycanada.


📜 License

MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages