A comprehensive, modernized platform that unifies code from multiple existing repositories to create a unified civic data platform for Canadian legislative and policy data.
OpenPolicy Merge is a unified civic data platform that:
- Unifies code from multiple existing repositories
- Inherits the UI/UX from the OpenPolicy project
- Incorporates OpenParliament's historic features and database
- Integrates scrapers from opencivicdata and civic-scraper
- Provides robust APIs with automated test cases
- Uses PostgreSQL as the final database (latest stable version)
- Is fully Dockerized for easy deployment
- Maintains transparency of unused code in
/referencefolder
OpenPolicyMerge/
βββ src/
β βββ api/ # Go API server (main entry point)
β βββ backend/
β β βββ django/ # Django backend (parliamentary data)
β β βββ laravel/ # Laravel backend (infrastructure)
β βββ frontend/ # React web application
β βββ mobile/ # React Native mobile app
β βββ scrapers/ # Data scraping services
β βββ policies/ # OPA policy definitions
βββ data/ # Data storage and management
βββ scripts/ # Data management scripts
βββ external-repos/ # Original repository copies
βββ reference/ # Unused/deprecated code
βββ docker-compose.yml # Multi-service orchestration
βββ docs/ # Documentation
# Clone the repository
git clone <repository-url>
cd OpenPolicyMerge
# Start all services
docker-compose up -d
# Access the application
# Frontend: http://localhost:3000
# API: http://localhost:8080
# Django Admin: http://localhost:8001
# Laravel Admin: http://localhost:8002
# Swagger Docs: http://localhost:8080/docs# Prerequisites
- Go 1.21+
- Python 3.9+
- Node.js 18+
- PostgreSQL 16+
- Redis
# Setup Go API
cd src/api
go mod download
go run main.go
# Setup Django Backend
cd src/backend/django
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver 8001
# Setup Laravel Backend
cd src/backend/laravel
composer install
php artisan migrate
php artisan serve --port=8002
# Setup Frontend
cd src/frontend
npm install
npm startThis project unifies code from the following repositories:
- OpenParliament (
michaelmulley/openparliament) - Canadian legislative data - Open Policy Infrastructure (
rarewox/open-policy-infra) - Policy infrastructure - Admin Open Policy (
rarewox/admin-open-policy) - Admin panel - Open Policy App (
rarewox/open-policy-app) - Mobile application - Open Policy Web (
rarewox/open-policy-web) - Web frontend - Open Policy (
rarewox/open-policy) - Core policy engine - Scrapers CA (
opencivicdata/scrapers-ca) - Canadian civic data scrapers - Civic Scraper (
biglocalnews/civic-scraper) - Civic data scraping framework - Represent Canada (
opennorth/represent-canada) - Canadian representatives API
GET /api/v1/health- Health checkGET /api/v1/status- System status
POST /api/v1/policy/evaluate- Evaluate policiesPOST /api/v1/policy/validate- Validate policy rules
POST /api/v1/scrape- Trigger data scrapingGET /api/v1/scrape/{jurisdiction}- Get scraping status by jurisdiction
GET /api/v1/parliament/bills- Get parliamentary billsGET /api/v1/parliament/politicians- Get politicians dataGET /api/v1/parliament/votes- Get voting records
GET /api/v1/civic/meetings- Get civic meetingsGET /api/v1/civic/documents- Get civic documents
GET /api/v1/represent/representatives- Get representativesGET /api/v1/represent/boundaries- Get electoral boundariesGET /api/v1/represent/postcodes- Get postal codesPOST /api/v1/represent/point- Find representatives by coordinatesGET /api/v1/represent/postcode/{postcode}- Find representatives by postal code
GET /api/v1/admin/policies- Manage policiesGET /api/v1/admin/users- Manage users
- Parliamentary data management
- OpenParliament database integration
- Data scraping orchestration
- Infrastructure management
- Policy administration
- User management
- Version: Latest stable (16+)
- Extensions: PostGIS for geographic data
- Databases:
openparliament- Parliamentary datarepresent- Representatives datapolicy- Policy management
- OpenParliament Database: 6.5GB of Canadian legislative data
- Represent Canada: Electoral boundaries and representatives
- Live Scraping: Federal, provincial, and municipal data
# Database
DB_HOST=localhost
DB_PORT=5432
DB_NAME=openparliament
DB_USER=postgres
DB_PASSWORD=password
# Redis
REDIS_HOST=localhost
REDIS_PORT=6379
# API Keys
REPRESENT_API_KEY=your_api_key
OPENPARLIAMENT_API_KEY=your_api_key
# Data Directories
REPRESENT_DATA_DIR=/app/data
OPENPARLIAMENT_DATA_DIR=/app/data# Run Go API tests
cd src/api
go test ./...
# Run Django tests
cd src/backend/django
python manage.py test
# Run Laravel tests
cd src/backend/laravel
php artisan test- API Test Coverage: 90%+
- Data Integrity Tests: All endpoints
- Error Handling Tests: Comprehensive
- Prometheus: Metrics collection
- Grafana: Dashboard visualization
- Health Checks: Automated monitoring
- Structured logging across all services
- Error tracking and alerting
- Performance monitoring
- JWT authentication
- Role-based access control
- API rate limiting
- Input validation and sanitization
- Secure database connections
# Build and deploy
docker-compose -f docker-compose.prod.yml up -d
# Monitor logs
docker-compose logs -f# Development environment
docker-compose -f docker-compose.dev.yml up -dALL documentation has been consolidated into ONE master document:
This is the SINGLE SOURCE OF TRUTH for everything:
- β Current Status - What's working and what's not
- β Architecture - Complete system design
- β Migration Plan - Scraper migration strategy
- β Next Steps - Clear direction forward
- β All Technical Details - In one place
NO MORE DOCUMENT CHAOS - USE ONLY THE MASTER GUIDE!
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenParliament: For the extensive Canadian legislative database
- OpenNorth: For the Represent Canada API and data
- OpenCivicData: For the civic data scraping framework
- Big Local News: For the civic scraper infrastructure
OpenPolicy Merge - Unifying civic data for a more transparent democracy.