# CanadaGPT Production Readiness Assessment
**Vision:** Chat-first, mobile-optimized authority on Canadian federal politics
**Target Timeline:** 4-6 weeks (ASAP)
**Target Audience:** Both GR Professionals AND General Public
**Security Approach:** Parallel track with feature development
## Executive Summary
CanadaGPT has **strong data foundations** (90% data pipeline completeness, 57 MCP tools, 13+ data sources) but needs **security hardening** and **UX improvements** before commercial launch.
---
## DUAL-TRACK DEVELOPMENT STRATEGY
The platform can be developed in **two parallel tracks** that can be executed **serially or in parallel**:
### Track Overview
| Track | Audience | Core Features | Dependencies | Effort |
|-------|----------|---------------|--------------|--------|
| **PUBLIC** | General Public | Chat, Parliament data, Debates, "My MP" | Core platform | 4-6 weeks |
| **GR** | GR Professionals | Events, Briefings, Lobbying Intel, Team features | PUBLIC + Teams | 6-8 weeks |
### SHARED FOUNDATION (Both Tracks Need)
| Component | Status | Effort | Notes |
|-----------|--------|--------|-------|
| Security hardening | 30% | 2 weeks | Credential rotation, introspection off |
| Chat UX improvements | 75% | 1-2 weeks | History, retry, caching |
| Mobile optimization | 75% | 1 week | Service worker, error states |
| Data pipeline | 90% | Ongoing | Already strong |
| Chatbot knowledge | 60% | 3-5 days | Parliament procedures |
---
## π’ PUBLIC TRACK (General Public)
**Goal:** Make Canadian parliament accessible and engaging for citizens
### Public Track Readiness
| Feature | Current | Target | Effort | Notes |
|---------|---------|--------|--------|-------|
| Core chat (Gordie) | 75% | 90% | 1-2 weeks | Conversation history, knowledge |
| MPs & Bills browser | 90% | 95% | 3-5 days | Minor polish |
| Debates viewer | 85% | 90% | 3-5 days | Already Twitter-style |
| "My MP" feed | 0% | 80% | 1-2 weeks | Personalized constituency tracking |
| Petitions browser | 40% | 85% | 2-3 weeks | Need pipeline + UI |
| Profile pages | 15% | 70% | 1-2 weeks | Build UI for existing DB |
| Discussion groups | 95% | 95% | 2-3 days | Add category pages |
| Social sharing | 100% | 100% | β
Done | OG/Twitter cards complete |
| Moderation | 90% | 95% | 3-5 days | User bans, bulk actions |
| Daily Digest | 0% | 70% | 1-2 weeks | AI summary of parliament activity |
**Public Track Total: 4-6 weeks**
### Public Track Phases
**Phase P1: Core Experience (Week 1-2)**
- [ ] Conversation history UI
- [ ] Enhanced chatbot parliamentary knowledge
- [ ] Video recommendation integration
- [ ] Error retry mechanism
- [ ] @Mention rendering in chat and forum (see below)
**Phase P2: Discovery Features (Week 3-4)**
- [ ] "My MP" personalized feed (postal code β constituency β MP activity)
- [ ] Petitions pipeline + UI
- [ ] Profile pages UI
- [ ] Daily Parliament Digest
- [ ] Canadian news integration (see below)
**Phase P3: Polish (Week 5-6)**
- [ ] Service worker for offline
- [ ] Discussion category pages
- [ ] Moderation improvements
- [ ] Performance optimization
---
## π· GR TRACK (Government Relations Professionals)
**Goal:** Powerful accountability and intelligence tools for GR professionals
### GR Track Dependencies
```
GR Track REQUIRES:
βββ PUBLIC Track (shared chat, data browsing)
βββ Teams/Organizations (multi-user access)
βββ Subscription billing (paid tier access)
βββ MCP Server subscription (API access)
```
### GR Track Readiness
| Feature | Current | Target | Effort | Notes |
|---------|---------|--------|--------|-------|
| Teams/Organizations | 40% | 80% | 3-4 weeks | DB ready, need UI |
| Team invites | 10% | 70% | 1-2 weeks | Build invite flow |
| GR Events UI | 0% | 70% | 2 weeks | Meeting tracking |
| GR Briefings UI | 0% | 70% | 2 weeks | AI-generated briefs |
| GR Templates | 0% | 60% | 1 week | Briefing templates |
| Conflict detection | 10% | 60% | 2 weeks | Actually implement algorithm |
| Money flow viz | 20% | 50% | 2 weeks | D3/Cytoscape graphs |
| Lobbying dashboard | 30% | 70% | 2 weeks | Intel overview |
| FedMCP subscription | 42% | 80% | 4-5 weeks | API keys, metering, billing |
| Salesforce sync | 70% | 80% | 1 week | Backend exists, add monitoring |
**GR Track Total: 6-8 weeks (after PUBLIC foundation)**
### GR Track Phases
**Phase G1: Team Foundation (Week 1-3)**
- [ ] Team member management UI
- [ ] Invite flow + email templates
- [ ] Organization admin dashboard
- [ ] Stripe webhook integration
**Phase G2: Core GR Features (Week 4-6)**
- [ ] GR Events management UI
- [ ] GR Briefings generation UI
- [ ] Conflict detection implementation
- [ ] Lobbying intelligence dashboard
**Phase G3: Advanced Features (Week 7-8)**
- [ ] Money flow visualization
- [ ] FedMCP subscription (API keys, metering)
- [ ] Salesforce sync monitoring
- [ ] Template builder
---
## EXECUTION OPTIONS
### Option A: Serial Execution (Lower Risk)
```
Week 1-6: PUBLIC Track β Soft launch for general public
Week 7-14: GR Track β Launch GR features for professionals
```
**Pros:** Less complexity, validate public product first
**Cons:** GR professionals wait longer
### Option B: Parallel Execution (Faster)
```
Week 1-2: Shared Foundation (both tracks)
Week 3-6: PUBLIC Track (Team A) + GR Track Phase G1 (Team B)
Week 7-8: GR Track Phases G2-G3
```
**Pros:** Both audiences served faster
**Cons:** Requires 2 developers, more coordination
### Option C: Public First, GR Fast-Follow
```
Week 1-4: PUBLIC Track (MVP)
Week 5-8: GR Track (with overlap)
```
**Pros:** Public launch in 4 weeks, GR in 8
**Cons:** Some rework on shared components
---
## READINESS SCORECARD (By Track)
### Shared Components
| Area | Current | Target | Track |
|------|---------|--------|-------|
| Security | 30% | 80% | SHARED |
| Chat UX | 75% | 90% | SHARED |
| Mobile | 75% | 85% | SHARED |
| Data Pipeline | 90% | 95% | SHARED |
| Infrastructure | 80% | 90% | SHARED |
### Public Track Components
| Area | Current | Target | Track |
|------|---------|--------|-------|
| @Mention System | 45% | 90% | PUBLIC |
| MPs/Bills Browser | 90% | 95% | PUBLIC |
| Debates Viewer | 85% | 90% | PUBLIC |
| "My MP" Feed | 0% | 80% | PUBLIC |
| Petitions | 40% | 85% | PUBLIC |
| Profile Pages | 15% | 70% | PUBLIC |
| Discussion Groups | 95% | 95% | PUBLIC |
| Social Sharing | 100% | 100% | PUBLIC β
|
| Moderation | 90% | 95% | PUBLIC |
| Daily Digest | 0% | 70% | PUBLIC |
| News Integration | 0% | 60% | PUBLIC |
### GR Track Components
| Area | Current | Target | Track |
|------|---------|--------|-------|
| Teams/Orgs | 40% | 80% | GR |
| GR Events UI | 0% | 70% | GR |
| GR Briefings UI | 0% | 70% | GR |
| Conflict Detection | 10% | 60% | GR |
| Money Flow Viz | 20% | 50% | GR |
| Lobbying Dashboard | 30% | 70% | GR |
| FedMCP Subscription | 42% | 80% | GR |
| Fact Checking | 0% | 0% | FUTURE |
---
## CANADIAN NEWS INTEGRATION
### Vision
Integrate Canadian news sources so that articles mentioning MPs, bills, parties, and political events are indexed and queryable by the chatbot.
### Target News Sources
| Source | Type | RSS/API | Priority |
|--------|------|---------|----------|
| **CBC News** | Public broadcaster | RSS feeds available | High |
| **CTV News** | Private broadcaster | RSS feeds available | High |
| **Global News** | Private broadcaster | RSS feeds available | High |
| **The Globe and Mail** | National newspaper | Paywall, RSS limited | Medium |
| **National Post** | National newspaper | RSS feeds available | Medium |
| **Toronto Star** | Regional newspaper | Paywall | Low |
| **iPolitics** | Political news | Subscription | Medium |
| **The Hill Times** | Parliamentary news | Subscription | High |
| **Canadian Press** | Wire service | Requires license | High |
### Data Model
**Neo4j Schema:**
```
NewsArticle {
id: ID!
url: String! @unique
title: String!
summary: String
content: String
published_at: DateTime!
source: String! # CBC, CTV, Global, etc.
author: String
topics: [String] # Extracted topics
sentiment: Float # Optional: -1 to 1
created_at: DateTime!
}
Relationships:
(NewsArticle)-[:MENTIONS_MP {confidence: Float}]->(MP)
(NewsArticle)-[:MENTIONS_BILL {confidence: Float}]->(Bill)
(NewsArticle)-[:MENTIONS_PARTY {confidence: Float}]->(Party)
(NewsArticle)-[:MENTIONS_COMMITTEE]->(Committee)
(NewsArticle)-[:COVERS_TOPIC]->(Topic)
```
### Entity Extraction Pipeline
**Step 1: RSS Feed Ingestion**
- Poll RSS feeds every 15-30 minutes
- Extract: title, URL, published date, summary
- Deduplicate by URL
**Step 2: Content Fetching**
- Fetch full article text (respect robots.txt)
- Extract main content (remove ads, nav)
- Handle paywalled content gracefully
**Step 3: Entity Recognition**
- **MP Detection:** Match names against MP database
- Handle nicknames (Bob β Robert)
- Handle titles (Minister, Hon., etc.)
- Fuzzy matching for typos
- **Bill Detection:** Regex for C-### and S-### patterns
- **Party Detection:** Liberal, Conservative, NDP, Bloc, Green
- **Committee Detection:** Match committee codes/names
**Step 4: Relationship Creation**
- Create MENTIONS relationships with confidence scores
- Link to existing Neo4j nodes (MPs, Bills, Parties)
### Implementation Components
**1. News Ingestion Pipeline (`packages/data-pipeline/`)**
```
fedmcp_pipeline/ingest/news.py
βββ RSSFeedClient - Fetch and parse RSS
βββ ContentExtractor - Extract article text
βββ EntityRecognizer - NER for MPs, bills, parties
βββ Neo4jNewsRepository - Store articles and relationships
```
**2. MCP Tools (`packages/fedmcp/`)**
```python
# New tools in server.py
search_news(query, source, date_range, entity_type)
get_news_about_mp(mp_id, limit)
get_news_about_bill(bill_number, limit)
get_news_coverage(topic, date_range)
```
**3. GraphQL Schema (`packages/graph-api/`)**
```graphql
type NewsArticle @node {
id: ID!
url: String!
title: String!
summary: String
published_at: DateTime!
source: String!
mentionedMPs: [MP!]! @relationship(type: "MENTIONS_MP", direction: OUT)
mentionedBills: [Bill!]! @relationship(type: "MENTIONS_BILL", direction: OUT)
}
extend type MP {
newsArticles: [NewsArticle!]! @relationship(type: "MENTIONS_MP", direction: IN)
}
extend type Bill {
newsArticles: [NewsArticle!]! @relationship(type: "MENTIONS_BILL", direction: IN)
}
```
**4. Frontend UI (Optional)**
- News tab on MP profile pages
- News tab on Bill pages
- News search/browse page
### Chatbot Integration
**New capabilities for Gordie:**
- "What's in the news about Pierre Poilievre?"
- "What media coverage has Bill C-234 received?"
- "What are the top political stories today?"
- "How is the Liberal party being covered in the news?"
**System Prompt Addition:**
```
NEWS TOOLS:
- search_news: Search Canadian news articles by keyword, source, or entity
- get_news_about_mp: Get recent news coverage of a specific MP
- get_news_about_bill: Get news coverage about a bill
```
### Implementation Phases
**Phase 1: RSS Infrastructure (1 week)**
- [ ] Create RSSFeedClient for CBC, CTV, Global
- [ ] Set up content extraction
- [ ] Create NewsArticle Neo4j schema
- [ ] Basic ingestion job (no entity extraction)
**Phase 2: Entity Extraction (1-2 weeks)**
- [ ] MP name matching (reuse existing fuzzy match logic)
- [ ] Bill number detection (regex)
- [ ] Party/Committee detection
- [ ] Confidence scoring
**Phase 3: MCP/Chatbot Integration (1 week)**
- [ ] Add news search tools to FedMCP
- [ ] Update chatbot system prompt
- [ ] Test news queries
**Phase 4: UI Integration (1 week - Optional)**
- [ ] News section on MP pages
- [ ] News section on Bill pages
- [ ] News browse/search page
**Total Effort: 3-5 weeks**
### Considerations
**Legal/Ethical:**
- Respect copyright - store summaries, link to originals
- Respect robots.txt and rate limits
- Consider licensing for Canadian Press/wire services
- Don't scrape paywalled content without permission
**Data Quality:**
- False positive MP matches (common names)
- Outdated articles (old MPs)
- Duplicate articles across sources
- Opinion vs news distinction
**Performance:**
- Index articles efficiently (full-text search)
- Cache recent queries
- Limit historical depth (e.g., last 6 months)
---
## @MENTION SYSTEM STATUS
### Current Implementation: 70% Backend / 20% Frontend
The mention system has **solid parsing and autocomplete** but **mentions aren't rendered** as clickable links.
| Component | Status | Notes |
|-----------|--------|-------|
| Parser (`mentionParser.ts`) | β
100% | All 6 entity types parsed correctly |
| Resolver (`mentionResolver.ts`) | β
100% | URLs generated with locale, anchors |
| Autocomplete UI | β
90% | Keyboard nav, type filtering, badges |
| Search queries | β
85% | GraphQL queries for MPs, Bills, Committees, Votes |
| **Rendering in chat** | β 0% | Mentions not converted to links |
| **Rendering in forum** | β 0% | Mentions not converted to links |
| Notifications | β 0% | No mention notifications |
### Supported Entity Types
| Entity | Parser | Autocomplete | Example Syntax |
|--------|--------|--------------|----------------|
| **MPs** | β
| β
| `@mp:pierre-poilievre` |
| **Bills** | β
| β
| `@bill:c-234` or `@bill:c-234:s2.1` (with section) |
| **Committees** | β
| β
| `@committee:fina` or `@committee:fina:45` (with meeting) |
| **Votes** | β
| β
| `@vote:45-1:234` |
| **Debates** | β
| β οΈ | `@debate:2025-12-09` or `@debate:2025-12-09:14:30` |
| **Petitions** | β
| β οΈ | `@petition:e-4823` |
### Critical Gap: No Rendering
**The Problem:** Parsed mentions are NEVER displayed as clickable links.
**What exists:**
```typescript
// segmentTextWithMentions() output:
[
{ type: 'text', content: 'I disagree with ' },
{ type: 'mention', mention: { url: '/en/mps/justin-trudeau', label: 'Justin Trudeau' } },
{ type: 'text', content: ' on ' },
{ type: 'mention', mention: { url: '/en/bills/45-1/c-234', label: 'Bill C-234' } }
]
```
**What's missing:** A React component to render these segments as linked text.
### Implementation Needed
**1. Create MentionRenderer component (1-2 days)**
```typescript
// New file: packages/frontend/src/components/mentions/MentionRenderer.tsx
function MentionRenderer({ text }: { text: string }) {
const segments = segmentTextWithMentions(text);
return segments.map(segment =>
segment.type === 'mention'
? <Link href={segment.mention.url} className="mention-link">{segment.mention.label}</Link>
: <span>{segment.content}</span>
);
}
```
**2. Integrate into displays (2-3 days)**
- `ChatMessage.tsx` - Render assistant/user messages with mentions
- `PostCard.tsx` - Render forum posts with mentions
- `CreatePostForm.tsx` - Preview with mentions
**3. Integrate autocomplete into ChatInput (1-2 days)**
- Add MentionAutocomplete to ChatInput
- Trigger on `@` character
- Insert mention syntax on selection
**Total Effort: 1 week**
### Files to Modify
**New Files:**
- `packages/frontend/src/components/mentions/MentionRenderer.tsx`
**Modified Files:**
- `packages/frontend/src/components/chat/ChatMessage.tsx` - Use MentionRenderer
- `packages/frontend/src/components/chat/ChatInput.tsx` - Add MentionAutocomplete
- `packages/frontend/src/components/forum/PostCard.tsx` - Use MentionRenderer
- `packages/frontend/src/components/forum/CreatePostForm.tsx` - Preview with mentions
---
## PRIORITY 1B: CHATBOT PARLIAMENTARY KNOWLEDGE ENHANCEMENT
### Current Gaps in Gordie's Knowledge
**Strong Areas:**
- β
Data queries: MPs, bills, votes, lobbying, expenses, Hansard
- β
Cross-referencing: Votes β lobbying β expenses β conflicts
**Weak Areas:**
- β Procedures: How parliament actually functions
- β Education: Questions like "How does a bill become law?" rely on Claude's general training
- β Context: WHY bills are introduced, political dynamics
### Recommended Fix: Enhanced System Prompt
Add parliamentary reference guide to `packages/frontend/src/app/api/chat/route.ts`:
```
CANADIAN PARLIAMENT STRUCTURE:
- House of Commons: 338 elected Members of Parliament
- Senate: 105 appointed members (not in this tool set)
- Parliament structure: Parliament β Session β Sitting β Debate
LEGISLATIVE PROCESS:
1. First Reading: Bill introduced, printed
2. Second Reading: Debate on principle, vote
3. Committee: Detailed clause-by-clause study, amendments, witnesses
4. Report Stage: House reviews committee amendments
5. Third Reading: Final debate and vote
6. Senate: Repeats similar process
7. Royal Assent: Governor General signs into law
BILL TYPES:
- Government Bills (C-#): Introduced by Cabinet ministers
- Private Member Bills (C-###): Introduced by backbench MPs
- Senate Bills (S-#): Introduced in Senate first
QUESTION PERIOD:
- 45 minutes daily when House sits
- Opposition questions government ministers
- No advance notice required
COMMITTEES:
- Standing Committees: Permanent, mirror government departments
- Special Committees: Created for specific studies
- Legislative Committees: Created to study specific bills
```
### Educational Video Integration
**Concept:** When users ask "How does parliament work?" questions, Gordie can recommend curated educational videos.
**Implementation Approach:**
1. Detect educational intent in user questions
2. Provide factual answer from enhanced system prompt
3. Offer relevant video recommendation as supplementary resource
4. Use sparingly - only when genuinely educational, not for data queries
**Video Recommendation Triggers (Examples):**
- "How does a bill become law?"
- "What is Question Period?"
- "How do committees work?"
- "How does the Senate work?"
- "What happens at first reading?"
**Anti-Spam Safeguards:**
- Only recommend on first instance per conversation
- Don't recommend for data queries ("What bills did MP X sponsor?")
- Don't recommend if user already asked similar question before
- Maximum 1 video recommendation per conversation unless explicitly asked
**Pending:** Specific video URLs and playlist mappings (need @matt_farrell channel details)
**Files to Modify:**
- `packages/frontend/src/app/api/chat/route.ts` - Add parliament reference to system prompt
- `packages/frontend/src/lib/parliamentaryKnowledge.ts` - New file for educational content
- `packages/frontend/src/lib/videoRecommendations.ts` - New file for video mappings
**Effort:** 3-5 days
---
## PRIORITY 1: CRITICAL BLOCKERS (Must Fix Before Any Launch)
### 1.1 Security Vulnerabilities
| Issue | Severity | Files Affected |
|-------|----------|----------------|
| API keys exposed in git history | CRITICAL | `.env`, `packages/graph-api/.env` |
| Neo4j password hardcoded | CRITICAL | `scripts/deploy-*.sh` |
| GraphQL introspection enabled | HIGH | `packages/graph-api/src/config.ts` |
| Service role key in Docker build args | HIGH | `Dockerfile`, GitHub workflows |
| No request validation/sanitization | HIGH | Data pipeline ingestion scripts |
**Remediation:**
1. Revoke ALL exposed credentials immediately
2. Scrub git history with `git-filter-repo` to remove `.env` files
3. Ensure consistent Secret Manager usage (deployment scripts already do this correctly, but some `.env` files in repo need removal)
4. Disable GraphQL introspection in production
5. Add input sanitization to Cypher queries
> **Note:** GCP Secret Manager is already properly used in deployment scripts. The issue is legacy `.env` files that may still exist in the repo or git history.
### 1.2 Authentication & Authorization
| Issue | Impact |
|-------|--------|
| Unauthenticated fallback allows full API access | Anyone can query GraphQL |
| Tier case sensitivity bug (`FREE` vs `free`) | Quota bypass possible |
| No BYOK input validation | Potential injection/crash |
**Files:**
- `packages/graph-api/src/utils/auth.ts:204-211`
- `packages/frontend/src/auth.ts:153`
- `packages/frontend/src/app/api/chat/route.ts:56-70`
---
## PRIORITY 2: HIGH-VALUE FEATURES FOR LAUNCH
### 2.1 Conversation History UI (Chat-First Essential)
**Current State:** Messages persist to Supabase but no UI to browse
**Impact:** Users can't access past conversations
**Effort:** 1-2 weeks
**Implementation:**
- Add sidebar/modal to ChatWidget
- Query `conversations` table with pagination
- Add search functionality
- Enable conversation deletion
### 2.2 Accessibility (WCAG 2.1 AA)
**Current State:** β
ARIA attributes added to chat components (COMPLETED)
**Impact:** Improves experience for users with disabilities
**Remaining Effort:** ~1 week
**Completed:**
- β
Added `aria-label`, `role`, `aria-describedby` to chat components
**Remaining:**
- Keyboard navigation for all interactive elements
- Screen reader testing
- Focus management
### 2.3 LLM Response Caching
**Current State:** No caching - every query hits Claude API
**Impact:** 30-40% cost savings estimated
**Effort:** 1 week
**Implementation:**
- Cache tool call results (Hansard, MPs, bills)
- Semantic similarity caching for similar questions
- TTL-based invalidation
---
## PRIORITY 2B: SOCIAL & COMMUNITY FEATURES
### Current Implementation Status
| Feature | Status | Completion | Production Ready |
|---------|--------|------------|------------------|
| **Discussion Groups** | β
Implemented | 95% | ~85% |
| **Social Sharing** | β
Complete | 100% | β
Yes |
| **Moderation System** | β
Implemented | 90% | ~85% |
| **Profile Pages** | β οΈ DB Only | 60% | ~15% |
| **Fact Checking** | β Not Started | 0% | β No |
### Discussion Groups (95% Complete)
**Files:** `packages/frontend/src/components/forum/` (13 components)
- `BillDiscussions.tsx`, `PostCard.tsx`, `CreatePostForm.tsx`, `VoteButtons.tsx`
- `InlineReplyForm.tsx`, `PostThread.tsx`, `NotificationBell.tsx`, `MarkdownEditor.tsx`
- Database: `supabase/migrations/20250107000000_forum_system.sql`
**Features Working:**
- β
Nested threaded discussions (10 levels deep)
- β
Bill-specific comment threads
- β
10 forum categories (Healthcare, Climate, Economy, etc.)
- β
Real-time updates via `useRealtimePosts`
- β
Upvote/downvote system
- β
Full-text search (tsvector indexed)
- β
Rate limiting (10 posts/hour)
- β
Markdown with GFM
**Missing:**
- Generic forum category pages (only bill discussions visible)
- Email digest notifications
- Activity feed integration
### Social Sharing (100% Complete) β
**Files:** `packages/frontend/src/components/ShareButton.tsx`, `src/app/api/og/route.tsx`
**Features Complete:**
- β
8 platforms: X, Facebook, LinkedIn, Reddit, EH! Social, Threads, Email, Print
- β
OpenGraph metadata (per-page title/description)
- β
Twitter Cards (summary large image)
- β
Dynamic OG image generation with MP photos
- β
Mobile Web Share API with desktop fallback
- β
Forum post sharing with anchors
### Moderation System (90% Complete)
**Files:** `packages/frontend/src/app/[locale]/admin/moderation/page.tsx`, `src/actions/moderation.ts`
**Features Working:**
- β
Admin moderation dashboard
- β
Report queue with filtering by reason
- β
Actions: delete, lock, pin, warn, dismiss
- β
Admin statistics (pending, resolved, total)
- β
Full audit trail
- β
User report modal (5 predefined reasons)
- β
RLS policies restricting admin access
**Missing:**
- User suspension/ban functionality
- Bulk actions UI
- Email notifications to moderators
- AI-assisted flagging
- Appeals workflow
### Profile Pages (60% Complete - DB Only)
**Database:** `supabase/migrations/20250112000000_user_profile_system.sql`
**Schema Complete:**
- β
`user_profiles`: display_name, avatar, bio, location, username
- β
`user_follows`: follower/following relationships
- β
Privacy controls (profile_visibility, activity_feed_visibility)
- β
Reputation scoring, post/reply counters
**UI Missing (0%):**
- β No `/users/[username]` profile pages
- β No profile edit page
- β No follow/unfollow button UI
- β No follower/following list views
- β No public activity feeds
### Petitions (MCP Complete, Pipeline & UI Missing)
**Status:** MCP tools work, but no data ingestion or frontend UI
| Layer | Status | Notes |
|-------|--------|-------|
| MCP Client | β
100% | Full `PetitionsClient` with all methods |
| MCP Tools | β
100% | 3 tools: `search_petitions`, `get_petition_details`, `get_mp_petitions` |
| GraphQL Schema | β οΈ 60% | Basic `Petition` type, missing grievances/prayer/response fields |
| Data Pipeline | β 0% | No ingestion job - petitions not being imported |
| Neo4j Data | β Empty | Schema exists but no data |
| Frontend UI | β 0% | No `/petitions` pages, no MP petition lists |
| Mentions | β
100% | @petition autocomplete works in chat |
**To Enable Petitions:**
1. **Data Pipeline (1 week)**
- Create `fedmcp_pipeline/ingest/petitions.py`
- Create `run_petitions_ingestion.py`
- Create `Dockerfile.petitions-importer`
- Schedule daily via Cloud Scheduler
2. **GraphQL Schema Enhancement (2-3 days)**
- Add `grievances`, `prayer`, `response` text fields
- Add `government_response_date`, `certification_date`
- Add `topics` relationship for `index_terms`
3. **Frontend UI (1-2 weeks)**
- `/[locale]/petitions` - Browse/search page
- `/[locale]/petitions/[number]` - Detail page with provincial breakdown
- Add `sponsoredPetitions` to MP profile pages
- Create `PetitionCard`, `PetitionDetail` components
**Total Effort: 2-3 weeks**
### Fact Checking (0% in CanadaGPT - Reference Available)
**Status:** Not implemented in CanadaGPT, but **mature implementation exists in BroadcastOS**
**BroadcastOS Factchecker Reference** (`~/broadcast-os/services/factchecker/`):
| Component | Status | Description |
|-----------|--------|-------------|
| Data Model | β
Complete | `Claim`, `FactCheck`, `Citation` Neo4j nodes |
| Verification Pipeline | β
Complete | Fast (4s) + Deep (15s) modes with LLM |
| Parliament Integration | β
Complete | Hansard, Bills, Debates search tools |
| CanLII Integration | β
Complete | Case law + legislation search |
| Producer Dashboard | β
Complete | 3124-line UI for managing fact-checks |
| Overlay System | β
Complete | JWT-authenticated WebSocket delivery |
| Neo4j Persistence | β
Complete | Full CRUD with migrations |
**BroadcastOS Data Model:**
```
Claim { id, claim_text, claim_type, context, speaker, timestamp }
β [:VERIFIED_BY]
FactCheck { verdict, confidence, rationale, citations[], model_used }
β [:CITES]
Citation { url, title, excerpt, relevance_score }
```
**Verdict Types:** `TRUE`, `FALSE`, `MISLEADING`, `NEEDS_CONTEXT`, `UNVERIFIABLE`
**Potential CanadaGPT Integration (Post-MVP):**
- Adapt BroadcastOS `Claim` β CanadaGPT `Statement` fact-checking
- Reuse verification tools (already aligned with FedMCP tools)
- Apply to MP statements, committee testimony, debate claims
- Add fact-check badges to debate viewer
**Effort to Adapt:** 4-6 weeks (schema migration, UI components, verification pipeline)
**Key Files (DO NOT modify yet):**
- `~/broadcast-os/services/factchecker/src/verifier.ts` - Verification logic
- `~/broadcast-os/services/factchecker/src/neo4j/models.ts` - Data models
- `~/broadcast-os/services/factchecker/public/producer.html` - Dashboard UI
---
## PRIORITY 2C: FEDMCP SUBSCRIPTION SERVICE (MVP PAID TIER)
### Overall Assessment: 42% β TARGET 80% FOR MVP
**User Request:** Include MCP server subscription as a paid tier feature for MVP launch.
| Category | Current | MVP Target | Notes |
|----------|---------|------------|-------|
| **Tool Completeness** | 85% | 85% | 57 tools implemented, no stubs |
| **Documentation** | 40% | 70% | Need user docs, API reference |
| **Authentication** | 30% | 80% | Need API keys, per-user access |
| **Packaging** | 70% | 90% | Publish to PyPI, Docker image |
| **Configuration** | 60% | 80% | Config file support, env vars |
| **Reliability** | 75% | 80% | Add health checks |
| **Pricing/Metering** | 0% | 70% | Usage tracking, quota enforcement |
### MVP Subscription Architecture
For MVP, use a **lightweight approach** instead of full multi-tenant rebuild:
```
User β API Gateway (Kong/AWS) β Per-User FedMCP Instance
β
Usage Logging β Supabase β Quota Check
β
Stripe Billing (existing integration)
```
### MVP Implementation Plan
**Phase 1: API Key Authentication (1 week)**
- [ ] Add API key validation to FedMCP server
- [ ] Create `api_keys` table in Supabase (user_id, key_hash, tier, created_at)
- [ ] Add key generation endpoint (`/api/mcp/keys`)
- [ ] Add key management UI in settings page
**Phase 2: Usage Metering (1 week)**
- [ ] Log tool calls to `mcp_usage` table (user_id, tool_name, timestamp, tokens)
- [ ] Add middleware to count requests per user
- [ ] Create quota check function (tie to subscription tier)
- [ ] Add usage display in user dashboard
**Phase 3: Tier-Based Access (3-5 days)**
- [ ] FREE tier: No MCP access (chat only)
- [ ] BASIC tier: 100 MCP tool calls/month
- [ ] PRO tier: 1000 MCP tool calls/month + priority
- [ ] Enforce quotas at API gateway level
**Phase 4: Distribution (1 week)**
- [ ] Publish `fedmcp` to PyPI
- [ ] Create Docker image for self-hosting
- [ ] Write Claude Desktop integration guide
- [ ] Create API reference documentation
**Phase 5: Billing Integration (Already Exists)**
- [ ] Connect MCP tier to existing Stripe subscription
- [ ] Add MCP usage to invoice line items
- [ ] Show MCP quota in billing dashboard
### Files to Create/Modify
**New Files:**
- `packages/fedmcp/src/fedmcp/auth.py` - API key validation
- `packages/fedmcp/src/fedmcp/metering.py` - Usage logging
- `packages/frontend/src/app/api/mcp/keys/route.ts` - Key management API
- `packages/frontend/src/app/[locale]/settings/mcp/page.tsx` - MCP settings UI
- `supabase/migrations/XXXXXX_mcp_api_keys.sql` - API keys table
- `supabase/migrations/XXXXXX_mcp_usage.sql` - Usage tracking table
**Modified Files:**
- `packages/fedmcp/src/fedmcp/server.py` - Add auth middleware
- `packages/fedmcp/pyproject.toml` - PyPI metadata
- `packages/frontend/src/lib/types/supabase.ts` - Add MCP types
### Effort Estimate
| Component | Effort |
|-----------|--------|
| API key auth | 1 week |
| Usage metering | 1 week |
| Tier enforcement | 3-5 days |
| Distribution/docs | 1 week |
| Integration testing | 3-5 days |
| **Total** | **4-5 weeks** |
### Subscription Tiers (Proposed)
| Tier | Price | MCP Access | Tool Calls/Month |
|------|-------|------------|------------------|
| FREE | $0 | β No | 0 |
| BASIC | $15/mo | β
Yes | 100 |
| PRO | $49/mo | β
Yes | 1,000 |
| ENTERPRISE | Custom | β
Yes | Unlimited |
### MVP vs Full Implementation
**MVP (4-5 weeks):**
- API key authentication
- Basic usage metering
- Tier-based quotas
- PyPI distribution
- Integration docs
**Post-MVP (additional 4-6 weeks):**
- Multi-tenant isolated instances
- Real-time usage dashboard
- Advanced analytics
- Team/org shared access
- Webhook notifications
---
## PRIORITY 2D: TEAMS & ORGANIZATIONS READINESS
### Overall Assessment: 70% Database / 15% UI
The teams/organization infrastructure is **well-architected at the database level** but has **minimal frontend implementation**.
| Feature | DB Complete | UI Complete | Overall |
|---------|-------------|-------------|---------|
| **Organizations** | 85% | 10% | 45% |
| **Team Roles** | 80% | 0% | 40% |
| **Billing/Entitlements** | 75% | 20% | 45% |
| **Team Invites** | 20% | 0% | 10% |
| **Shared Resources** | 60% | 10% | 35% |
| **GR Module Backend** | 70% | 0% | 35% |
| **Auth/Access Control** | 90% | 50% | 70% |
### What's Built (Database Layer)
**Organizations Table** (`supabase/migrations/20251226000000_gr_organizations.sql`):
- Multi-tenant organization with `name`, `slug`, Salesforce integration
- Organization settings JSON field
- Indexed slug lookups
**Team Roles & Permissions**:
- `organization_members` table with 4-tier role hierarchy
- Roles: `viewer` β `member` β `manager` β `admin`
- RLS functions: `has_org_membership()`, `has_org_role()`, `org_has_entitlement()`
**Billing & Entitlements**:
- `organization_entitlements` table with feature gating
- Entitlement types: `gov_institutions`, `gr_module`, `salesforce_sync`, `advanced_search`, `api_access`
- Credit system: `add_credits()`, `deduct_credits()` functions
- Stripe columns: `stripe_customer_id`, `stripe_subscription_id`
- 3-tier subscriptions: FREE (10 queries), BASIC (200/month), PRO (1000/month + MCP)
**GR Module Backend** (extensive schema):
- `gr_events` - Event/meeting tracking with Salesforce sync
- `gr_event_attendees` - MP/official attendee tracking
- `gr_briefings` - AI-generated briefing documents
- `gr_brief_templates` - Customizable templates
- `gr_digest_preferences` - Notification preferences
- `gr_sync_queue` - Salesforce bidirectional sync
**Shared Resources**:
- `collection_shares` with permissions (`view`, `edit`, `admin`)
- Visibility levels: `private`, `organization`, `public`
- `can_access_collection()` RLS function
### What's Missing (Frontend)
**Critical Gaps:**
- β No organization admin dashboard
- β No team member management UI (add/remove/roles)
- β No invite system (no table, no emails, no acceptance flow)
- β No GR module pages (events, briefings, templates)
- β No billing dashboard for organizations
- β No shared collections UI
- β No Stripe webhook handlers
**Partial Implementation:**
- β οΈ Public organization viewing exists at `/organizations/`
- β οΈ Basic settings page at `/settings/` (profile only)
- β οΈ Auth context has organization support but no org-level route protection
### Effort to Production-Ready Teams
| Component | Effort | Priority |
|-----------|--------|----------|
| Team member management UI | 1 week | High |
| Invite flow + emails | 1-2 weeks | High |
| Organization settings page | 3-5 days | High |
| GR events UI | 2 weeks | Medium |
| GR briefings UI | 2 weeks | Medium |
| Billing dashboard | 1-2 weeks | Medium |
| Stripe webhooks | 1 week | Medium |
| Collections sharing UI | 1 week | Low |
| **Total for basic teams** | **3-4 weeks** | |
| **Total including GR UI** | **8-10 weeks** | |
### Recommendation for Launch
**For Individual Users (MVP):** Ready to launch - user profiles, subscriptions, and quotas work.
**For Team/Enterprise Customers:** Need 3-4 weeks minimum:
1. Build team member management UI
2. Implement invite flow with email templates
3. Create organization admin dashboard
4. Connect Stripe webhooks
**GR Module for Teams:** Need additional 4-6 weeks:
1. Build event management UI
2. Build AI briefing generation interface
3. Build template builder
4. Add Salesforce sync monitoring
---
## PRIORITY 3: GR MODULE DEEP DIVE
### Current Capabilities (65-70% Complete)
| Feature | Status | Coverage |
|---------|--------|----------|
| Lobbying Registrations | COMPLETE | 163K+ records |
| Lobbying Communications | COMPLETE | 343K+ meetings |
| MP Expenses | COMPLETE | FY2026, 99.9% MP match |
| Federal Contracts | COMPLETE | 1.2M+ contracts |
| Federal Grants | COMPLETE | 500K+ grants |
| Political Contributions | PARTIAL | 100M+ but limited detail |
| Voting Records | COMPLETE | All ballots |
| **Conflict of Interest** | STUB ONLY | 10% - no actual detection |
| **Money Flow Tracing** | PARTIAL | 20% - minimal functionality |
### GR Tools Available (40+ of 57 total)
**Working Well:**
- `search_lobbying_registrations`, `search_lobbying_communications`
- `get_mp_expenses`, `search_mp_expenses`
- `get_top_contractors`, `search_federal_contracts`
- `get_mp_voting_history`, `analyze_party_discipline`
- `trace_money_flow` (partial)
**Stubs/Incomplete:**
- `detect_conflicts_of_interest` - schema exists, no logic
- `analyze_industry_influence` - keyword matching only
- `conflict_of_interest_check` - minimal implementation
### GR Module Gaps
| Missing Feature | Impact for GR Professionals |
|-----------------|---------------------------|
| Conflict detection engine | Can't identify patterns between expenses/lobbying/votes |
| Money flow visualization | Can't follow donor β lobbyist β legislation chains |
| Real-time lobbying alerts | No monitoring of new registrations/meetings |
| Donation-lobbying correlation | Can't connect campaign donors to lobbying activity |
| Geographic lobbying heatmaps | No riding-level lobbying analysis |
### GR Module Recommendations
**High Priority (2-3 weeks each):**
1. Implement actual conflict detection algorithm
2. Build money flow visualization (D3/Cytoscape)
3. Create GR executive dashboard
**Medium Priority:**
4. Real-time lobbying alerts
5. Industry influence scoring
6. Donation-lobbying correlations
---
## PRIORITY 4: CHAT & MOBILE ENHANCEMENTS
### Chat System Gaps
| Gap | Impact | Effort |
|-----|--------|--------|
| No conversation browsing | Users can't access past chats | 1-2 weeks |
| No retry mechanism | Failed messages unrecoverable | 3 days |
| Limited error messages | Poor UX on failures | 2-3 days |
| No chat search | Can't find past answers | 1 week |
### Mobile Gaps
| Gap | Impact | Effort |
|-----|--------|--------|
| No service worker | No offline support | 1 week |
| Voice features unclear | Advertised but status unknown | 1-2 weeks |
| No code splitting | Large bundle size | 3-5 days |
| Touch targets inconsistent | Some buttons too small | 2-3 days |
---
## PRIORITY 5: INFRASTRUCTURE & QUALITY
### Testing (Currently ~5% coverage)
| Area | Current State | Target |
|------|---------------|--------|
| Frontend | 0 test files | 60%+ coverage |
| Graph API | 0 test files | 80%+ coverage |
| Data Pipeline | 1 test file | 70%+ coverage |
| E2E tests | None | Critical paths |
### Monitoring & Observability
| Need | Current State |
|------|---------------|
| Audit logging | Not implemented |
| Error tracking | Minimal console logs |
| Performance monitoring | None |
| Usage analytics | Basic via Supabase |
---
## COMMERCIAL LAUNCH PRIORITIZED CHECKLIST
### Phase 1: Security Hardening (Week 1-2) - BLOCKER
- [ ] Revoke all exposed credentials
- [ ] Scrub git history
- [ ] Migrate to GCP Secret Manager
- [ ] Disable GraphQL introspection
- [ ] Fix tier case sensitivity bug
- [ ] Add request validation
### Phase 2: Core UX (Week 3-4)
- [ ] Conversation history UI
- [ ] Error retry mechanism
- [x] Basic accessibility (ARIA labels) β
COMPLETED
- [ ] Mobile error states
### Phase 3: Cost Optimization (Week 5)
- [ ] LLM response caching
- [ ] Tool result caching
- [ ] Query deduplication
### Phase 4: GR Module Completion (Week 6-8)
- [ ] Conflict detection implementation
- [ ] Money flow visualization
- [ ] GR dashboard
- [ ] Real-time alerts
### Phase 5: Mobile Excellence (Week 9-10)
- [ ] Service worker implementation
- [ ] Voice features completion
- [ ] Performance optimization
- [ ] PWA submission (app stores)
### Phase 6: Quality & Compliance (Week 11-12)
- [ ] Test coverage to 60%+
- [ ] WCAG 2.1 AA audit
- [ ] Audit logging
- [ ] Privacy policy/ToS
---
## HIGH-VALUE FEATURE SUGGESTIONS
### For "Authority on Canadian Federal Politics" Positioning
| Feature | Value | Effort |
|---------|-------|--------|
| **Daily Parliament Digest** | Automated AI summary of yesterday's activity | 2 weeks |
| **MP Report Cards** | Comprehensive scorecards with grades | 3 weeks |
| **Bill Impact Analyzer** | AI analysis of legislation implications | 2 weeks |
| **Riding-Level Insights** | Constituency-specific data & visualization | 4 weeks |
| **Committee Meeting Alerts** | Subscribe to committees, get notified | 1 week |
| **Comparative Vote Analysis** | Side-by-side MP voting comparisons | 2 weeks |
| **Upcoming Events Calendar** | FUTURE scheduled votes, readings, committee meetings (distinct from existing debates calendar which shows past events) | 1 week |
| **Election Mode** | Candidate comparison, riding history | 4 weeks |
> **Note:** The existing `/debates` page shows a calendar of PAST debates. "Upcoming Events Calendar" would show FUTURE scheduled parliamentary activity.
### For GR Professionals Specifically
| Feature | Value |
|---------|-------|
| **Lobbying Intelligence Dashboard** | Real-time tracking, alerts, trends |
| **Conflict Risk Scoring** | Automated risk assessment per MP |
| **Industry Influence Reports** | Sector-specific lobbying analysis |
| **Regulatory Change Tracker** | Monitor bills affecting specific industries |
| **Stakeholder Mapping** | Visualize relationships between entities |
### For General Public Engagement
| Feature | Value |
|---------|-------|
| **"My MP" Personalized Feed** | Track your representative's activities |
| **Parliament Explained** | AI-powered educational content |
| **Fact-Check Integration** | Verify claims from debates |
| **Community Notes** | User-contributed context (moderated) |
| **Petition Tracker** | Follow petitions you care about |
---
## ARCHITECTURE RECOMMENDATIONS
### Short-Term (Pre-Launch)
1. **Add Redis** for response caching and rate limiting
2. **Implement audit logging** to CloudWatch/BigQuery
3. **Add error tracking** (Sentry or similar)
4. **Ensure consistent Secret Manager usage** - Remove any remaining `.env` files with secrets from repo, ensure all services pull from GCP Secret Manager
### Medium-Term (Post-Launch)
1. **GraphQL Federation** - Split schema for scalability
2. **Event-Driven Architecture** - Real-time push notifications when new data arrives (new bills, votes, lobby communications), webhooks for data pipeline events
3. **ML Pipeline** - Topic extraction, sentiment analysis
4. **CDN** for static assets and cached responses
> **Note:** Event-driven architecture is a future enhancement for real-time notifications, not a launch requirement. Current polling-based approach works fine for MVP.
---
## ESTIMATED TIMELINE TO LAUNCH (AGGRESSIVE 4-6 WEEKS)
**Target:** ASAP commercial launch
**Audience:** Both GR Professionals AND General Public
**Security Approach:** Parallel track (alongside feature development)
### Week 1-2: Foundation (Parallel Tracks)
**Security Track:**
- [ ] Revoke exposed credentials, rotate all keys
- [ ] Migrate to GCP Secret Manager
- [ ] Disable GraphQL introspection in production
- [ ] Fix tier case sensitivity bug
**Feature Track:**
- [ ] Conversation history UI (essential for chat-first)
- [ ] Basic error retry mechanism
- [ ] LLM response caching setup
### Week 3-4: Core Experience
**Security Track:**
- [ ] Scrub git history (can be done with service running)
- [ ] Add request validation
- [ ] Audit logging setup
**Feature Track:**
- [x] Essential accessibility (ARIA labels) β
COMPLETED
- [ ] Keyboard navigation improvements
- [ ] Mobile error states
- [ ] GR conflict detection (basic version)
- [ ] Daily Parliament Digest feature
### Week 5-6: Polish & Launch
**Final Push:**
- [ ] Service worker for offline support
- [ ] Performance optimization pass
- [ ] GR dashboard MVP
- [ ] "My MP" personalized feed
- [ ] Final security audit
- [ ] Load testing
- [ ] Soft launch to beta users
**Post-Launch (ongoing):**
- Full WCAG 2.1 AA compliance
- Advanced GR features (money flow visualization)
- PWA app store submissions
- Test coverage expansion
**Total: 6 weeks to soft launch, iterate from there**
---
## FILES TO MODIFY
### Security Fixes
- `packages/graph-api/.env` - Remove, use Secret Manager
- `scripts/deploy-*.sh` - Remove hardcoded credentials
- `packages/graph-api/src/config.ts` - Default introspection to false
- `packages/graph-api/src/utils/auth.ts` - Remove fallback access
- `packages/frontend/src/auth.ts:153` - Normalize tier case
### Chat Improvements
- `packages/frontend/src/components/chat/ChatWidget.tsx` - Add history UI
- `packages/frontend/src/lib/stores/chatStore.ts` - Add retry logic
- ~~All chat components - Add ARIA attributes~~ β
COMPLETED
### GR Module
- `packages/fedmcp/src/fedmcp/server.py` - Implement conflict detection
- New: `packages/frontend/src/app/[locale]/gr-dashboard/` - GR dashboard
- New: Money flow visualization component
---
## VERIFICATION PLAN
After implementation:
1. **Security audit** - Penetration test, credential scan
2. **Accessibility audit** - WAVE tool, screen reader testing
3. **Performance testing** - Lighthouse, Core Web Vitals
4. **Load testing** - Concurrent users, API rate limits
5. **User acceptance testing** - GR professionals beta group