Add web UI for browsing NC voter registration and history data#19
Merged
Conversation
- Home page with interactive SVG county map and search form - County registrations page with single-query aggregate stats - Voter history page sorted by election date desc - CountyForm and VoterHistoryForm with clean/validate methods - 13 tests covering forms, views, aggregates, and 404 cases
- Add django-debug-toolbar (dev only) with INSTALLED_APPS, middleware, and URL wiring - Restrict gender/party/race/ethnicity counts to active voters (registration_status_code='A') - Right-align counts column and apply intcomma filter in county registrations table - Expand homepage hero with site description and NCSBE data source link
- Add county_name index on VoterView and ncid index on VoterEventView via conditional RunSQL migration (skips if views don't exist yet) - voter_history: evaluate queryset once with list() instead of .exists() + iteration (saves a second DB round-trip) - Replace browser-native SVG <title> tooltip (1s delay) with instant CSS-positioned floating div on mouseenter/mousemove/mouseleave
- Delete migration 0003 (django-pgviews handles indexes via sync_pgviews) - Simplify Meta.indexes: remove ClassVar annotation, drop explicit names - SVG map: remove green dot artifacts and yellow county fills - SVG map: scale to 100% width with viewBox for responsive display - County registrations: indent metric rows with pl-6 under category headers
- SVG map: highlight county pink (#ff79c6, dracula theme) on hover, restoring original fill on mouse leave - County search: add <datalist> with all 100 counties so users can autocomplete without typing the full name - Add test verifying counties context is passed to home view
- Home view: pass voter_count and event_count to template
- Home template: add summary cards with intcomma counts linking to
NCSBE data sources, wrapped in {% cache 3600 "home_summary" %}
- Add CC BY-SA 3.0 attribution for GayTenn/Wikimedia map below SVG
- Add test verifying voter_count and event_count in home view context
- county_registrations: two-column grid (stats left, sample voters right), both in cards with table-xs for compact display, deeper pl-8 indent - base: add GitHub icon link (CC BY-SA SVG) to navbar-end
- voter_history: no longer 404 when events are empty; show "No voting history found" message instead - voter_history: add Demographics card (county, gender, status, party, race, ethnicity, birth year, age, reg. year) from VoterView - voter_history: compact table-xs, two-column layout (demographics + history) - county_registrations: add hover:bg-base-300 to all data rows - Update tests: rename 404 test to reflect new 200 behavior, add demographics context test and empty events test
- Add @cache_page(3600) to all 3 views; remove redundant {% cache %} block
- Add CHATBOT_URL setting (from env) and "Ask the Chatbot" button on homepage
- Sample voters: increase from 10 to 25, add hover:bg-base-300 to rows
- Deployment: document CHATBOT_URL in Helm values.yaml
- Tests: add disable_cache autouse fixture (DummyCache) so context is
accessible; add chatbot_url and sample_voters count tests
…unts
- Move chatbot button into a dedicated card showing active ToolModel
entries (tool name → model name) so users can see which model
providers are configured
- Remove @cache_page from home view (dynamic ToolModel content)
- Wrap voter/event count cards in {% cache 3600 "home_counts" %}
template fragment to preserve caching for the expensive DB counts
- Replace {% cache %} template block with cache.get_or_set() in the
home view for voter_count and event_count — the template block only
cached rendered HTML while the DB queries still ran on every request
- Change "Ask the Chatbot" button to btn-primary
- Change voter history stat color from text-secondary to text-accent
- Add test verifying counts are stored in cache after home page load
debug_toolbar is a dev-only dependency; without DEBUG=False explicitly set, it was included in INSTALLED_APPS at runtime causing ModuleNotFoundError
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a DaisyUI/Dracula-themed web interface for exploring NC State Board of Elections voter data:
CHATBOT_URLsetting)CountyForm,VoterHistoryForm) for validated, cleaned URL/query inputsVoterView.county_nameandVoterEventView.ncidfor query performancedjango-debug-toolbaradded for development;django.contrib.humanizefor number formattingcache_pageon county and voter history views; homepage data fetched fresh each request