Event Management
Relevant source files
The following files were used as context for generating this wiki page:
The Event Management system in Actionmap is designed to facilitate the discovery and management of political and community events. It allows users to view localized events tied to specific geographic regions (counties) and provides administrative interfaces for creating, updating, and deleting event records. This module works in tandem with the Representative and News systems to provide a comprehensive view of local political activity.
The system is built on a Ruby on Rails backend, utilizing a relational database to store event metadata including timing, descriptions, and location associations. Users interact with events through a standard set of RESTful routes, while management features are restricted to session-controlled environments.
Sources: README.md:1-12, config/routes.rb:21-27, db/schema.rb:29-37
Data Architecture
Events are centralized entities linked to the geographic hierarchy of the application. Every event is associated with a specific county, which in turn belongs to a state. This structure ensures that events can be filtered and displayed based on a user's location or selected map region.
Database Schema
The events table stores the core attributes of an event. It uses a foreign key county_id to maintain referential integrity with the counties table.
| Field | Type | Constraints | Description |
|---|---|---|---|
name | string | null: false | The title of the event |
description | text | - | Detailed information about the event |
county_id | integer | null: false | Reference to the local county |
start_time | datetime | - | When the event begins |
end_time | datetime | - | When the event concludes |
created_at | datetime | null: false | Record creation timestamp |
Sources: db/schema.rb:29-37
Entity Relationships
The following diagram illustrates how events relate to the broader geographic data model:
The diagram shows that a State contains multiple Counties, and each County can host multiple Events.
Sources: db/schema.rb:14-27, db/schema.rb:29-37, db/schema.rb:73-84
Routing and API Endpoints
The application differentiates between public viewing and private management of events through distinct routing structures. Public routes are handled via the events resource, while management actions (Create, Update, Destroy) are routed through my_events.
Public Endpoints
Public users can access the list of events or view a specific event's details.
GET /events: Index of all available events.GET /events/:id: Detailed view for a single event.
Management Endpoints
Management actions require a session and are mapped to the MyEventsController.
| Method | Path | Action | Description |
|---|---|---|---|
GET | /my_events/new | new | Form to create a new event |
POST | /my_events/new | create | Process new event submission |
GET | /my_events/:id | edit | Form to modify an existing event |
PUT/PATCH | /my_events/:id | update | Process event updates |
DELETE | /my_events/:id | destroy | Remove an event record |
Sources: config/routes.rb:21-27
Event Lifecycle and Interaction
The lifecycle of an event involves its creation by a user/administrator and its subsequent rendering in the UI.
Event Creation Flow
The process for adding a new event involves navigating to the management interface, filling out the event details, and persisting the data.
The sequence diagram details the interaction between the user interface and the backend controllers during event creation.
Sources: config/routes.rb:22-23, [app/controllers/my_news_items_controller.rb:81-88] (logic analogous to event creation), features/step_definitions/web_steps.rb:45-51
Seeding and Initial Data
During development or initial deployment, the system can be populated with sample events. These seeds demonstrate the expected format for event data, including relative timing using Time.zone.now.
# Example seed structure for events
{
name: 'Pride Parade',
description: 'Annual pride parade',
start_time: Time.zone.now + 4.weeks,
end_time: Time.zone.now + 4.weeks + 1.hour,
state_symbol: 'CA',
fips_code: 1
}
Sources: db/seed_data.rb:246-253
Summary
Event Management in Actionmap provides a robust framework for tracking localized political and community activities. By anchoring events to the counties and states tables, the system allows for precise geographical targeting. The dual-routing strategy ensures that while the public can easily discover information, administrative actions are kept within controlled management controllers. This module is essential for the application's goal of helping users learn about political events in their specific area.
Sources: README.md:5-7, db/schema.rb:29-37, config/routes.rb:21-27