-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Problem
Motion has a belongs_to :agenda_item association, but ExtractVotesJob never populates agenda_item_id. All 182 motions currently have agenda_item_id: nil.
This means:
- Cannot trace votes to topics — the chain
Vote → Motion → AgendaItem → AgendaItemTopic → Topicis broken, so we can't show "history of votes on a particular topic" - Cannot show vote detail per agenda item — the meeting show page can't render a collapsible vote breakdown inline with specific agenda items from database records (the page redesign works around this with AI-generated summary text, but database-backed vote grids per item aren't possible)
What Works Today
Vote → Motion → Meeting— member votes per meeting ✓Motion → Meeting → Committee— which committee ✓Vote → Member— who voted how ✓
What Needs to Change
ExtractVotesJob (which calls Ai::OpenAiService#extract_votes) needs to:
- Include agenda item context in the extraction prompt — pass agenda item IDs and titles alongside the minutes text so the AI can match motions to items
- Return
agenda_item_idin the structured response for each motion - Populate
Motion.agenda_item_idwhen creating/updating motion records
The AI already reads minutes text that contains motion descriptions adjacent to agenda item discussions. The matching should be straightforward for most motions. Some motions (like consent agenda batch approvals) may not map cleanly to a single item.
Enables
- Topic vote history page/section: Show all votes related to a topic across meetings (via
Topic → AgendaItemTopic → AgendaItem → Motion → Vote) - Member voting record by topic: Group a member's votes by topic
- Inline vote breakdown on meeting page: Show collapsible member-by-member vote grid attached to specific agenda items (currently the meeting page redesign uses AI-generated summary text for this; database records would allow richer, interactive display)
Backfill
After fixing ExtractVotesJob, re-run for all meetings with minutes to populate agenda_item_id on existing motions. The job is idempotent (uses find_or_create_by).
Not in Scope
- Meeting show page redesign (separate, in progress)
- Member show page vote display improvements
- New vote history UI components
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels