Skip to content

Commit 2e46aa1

Browse files
committed
feat: add technical architecture and user journey diagrams for events system, enhance user guide with detailed event creation and management instructions
1 parent 211d619 commit 2e46aa1

File tree

7 files changed

+897
-36
lines changed

7 files changed

+897
-36
lines changed

docs/developers/systems/events_system.md

Lines changed: 284 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,87 @@ flowchart TD
185185
- 🖼️ [PNG Export](../../diagrams/exports/png/events_flow.png) - High-resolution image
186186
- 🎯 [SVG Export](../../diagrams/exports/svg/events_flow.svg) - Vector graphics
187187

188+
## Technical Architecture Overview
189+
190+
```mermaid
191+
graph TB
192+
%% User Interface Layer
193+
subgraph "Frontend Layer"
194+
UI[Event UI Components]
195+
FORM[Event Forms]
196+
LIST[Event Listings]
197+
DETAIL[Event Detail Pages]
198+
STIM[Stimulus Controllers]
199+
end
200+
201+
%% Controller Layer
202+
subgraph "Controller Layer"
203+
EC[EventsController]
204+
EAC[EventAttendancesController]
205+
IC[ICS Export Controller]
206+
end
207+
208+
%% Model Layer
209+
subgraph "Core Models"
210+
EVENT[Event Model]
211+
EA[EventAttendance]
212+
EH[EventHost]
213+
CAL[Calendar]
214+
CE[CalendarEntry]
215+
end
216+
217+
%% Location System
218+
subgraph "Location System"
219+
LL[LocatableLocation]
220+
ADDR[Address]
221+
BLDG[Building]
222+
GEO[Geocoding Service]
223+
end
224+
225+
%% Notification System
226+
subgraph "Notification System"
227+
ERN[EventReminderNotifier]
228+
EUN[EventUpdateNotifier]
229+
ERJ[EventReminderJob]
230+
ERS[EventReminderSchedulerJob]
231+
EM[EventMailer]
232+
end
233+
234+
%% Background Processing
235+
subgraph "Background Jobs"
236+
SIDEKIQ[Sidekiq Queue]
237+
GJ[GeocodingJob]
238+
NJ[NotificationJob]
239+
end
240+
241+
%% External Services
242+
subgraph "External Services"
243+
GEOCODE_API[Geocoding API]
244+
EMAIL_SVC[Email Service]
245+
CABLE[Action Cable]
246+
end
247+
248+
%% Database Layer
249+
subgraph "Database"
250+
DB[(PostgreSQL)]
251+
REDIS[(Redis Cache)]
252+
end
253+
254+
%% Key connections
255+
UI --> EC
256+
EC --> EVENT
257+
EVENT --> LL
258+
EVENT --> ERN
259+
ERN --> EM
260+
LL --> ADDR
261+
LL --> BLDG
262+
```
263+
264+
**Diagram Files:**
265+
- 📊 [Technical Architecture](../../diagrams/source/events_technical_architecture.mmd) - Complete system architecture
266+
- 🖼️ [PNG Export](../../diagrams/exports/png/events_technical_architecture.png) - High-resolution image
267+
- 🎯 [SVG Export](../../diagrams/exports/svg/events_technical_architecture.svg) - Vector graphics
268+
188269
## Workflows
189270

190271
### RSVP Flow
@@ -234,18 +315,103 @@ timeline
234315
- 🎯 [SVG Export](../../diagrams/exports/svg/events_reminders_timeline.svg)
235316

236317
## What's Implemented
237-
- **RSVPs/Attendees**: `EventAttendance` model with `person_id`, `event_id`, `status` (interested/going/not_going), guarded by privacy/policy.
238-
- **Event Hosts**: Polymorphic `EventHost` model allowing multiple entities (People, Communities, Organizations) to host events.
239-
- **ICS Export**: Export endpoint at `/events/:id/ics` that renders VEVENT from name/description/time/location.
240-
- **Event Reminder System**: Comprehensive notification system for upcoming events with multiple delivery channels.
241-
- **Event Update Notifications**: Automatic notifications when event details change.
242-
- **Location Support**: Full location support with polymorphic `LocatableLocation` model.
243-
244-
## What's Not Implemented Yet
245-
- **Recurrence**: No repeat rules; all events are single instances.
246-
- **Calendar Entries**: `CalendarEntry` exists but is not used to associate events to calendars.
247-
- **Advanced RSVP Features**: No waitlists, capacity limits, or guest allowances.
248-
- **Bulk Operations**: No bulk event creation, editing, or management tools.
318+
319+
### Core Event Management
320+
- **Event Model**: Full lifecycle support with draft/scheduled/upcoming/past states
321+
- **Multilingual Content**: Translatable name and rich text descriptions via Mobility + Action Text
322+
- **Event Validation**: Time validation (ends_at > starts_at), URL format validation
323+
- **Privacy Controls**: Public/private events with policy-based access control
324+
- **Categorization**: Multiple categories per event via `Categorizable` concern
325+
- **Cover Images**: Attachment support via `Attachments::Images` concern
326+
- **Friendly URLs**: SEO-friendly slugs via `FriendlySlug` concern
327+
328+
### Location System (Advanced)
329+
- **Polymorphic Location Support**: Three location types via `LocatableLocation`:
330+
- Simple location (text name only)
331+
- Full Address with geocoding
332+
- Building with associated Address
333+
- **Dynamic Location Selector**: Stimulus-powered UI for switching location types
334+
- **Inline Location Creation**: Create new addresses/buildings directly in event form
335+
- **Location Validation**: Manual `location_attributes=` setter handles polymorphic nested creation
336+
- **Geocoding Integration**: Background jobs for address geocoding
337+
338+
#### Location Selector Deep Dive
339+
340+
The location selector provides a sophisticated, user-friendly interface for managing event locations with three distinct types: Simple, Address, and Building. This system uses Stimulus controllers for dynamic UI management and custom backend processing for polymorphic location creation.
341+
342+
**Location Types Overview**
343+
344+
**Simple Location**
345+
- Text-only location description (e.g., "Community Center", "Online via Zoom")
346+
- Stored directly on the `LocatableLocation` model in the `name` field
347+
- Best for virtual events, TBA locations, or simple venue references
348+
- No geocoding or mapping features
349+
350+
**Address Location**
351+
- Full postal address with geocoding capabilities
352+
- Uses existing `Address` records or creates new ones inline
353+
- Includes geocoding for mapping and directions
354+
- Fields: line1, line2, city, state, postal_code, country, physical/postal flags
355+
- Supports primary address designation
356+
357+
**Building Location**
358+
- Named venues/facilities with associated addresses
359+
- Uses existing `Building` records or creates new ones inline
360+
- Buildings have their own address through association
361+
- Perfect for institutions, community centers, schools
362+
- Provides both building name and full address context
363+
364+
**Dynamic UI Implementation**
365+
366+
**Stimulus Controller (`location_selector_controller.js`)**
367+
- **Targets**: `typeSelector`, `simpleLocation`, `addressLocation`, `buildingLocation`, `newAddress`, `newBuilding`
368+
- **Actions**: `toggleLocationType`, `showNewAddress`, `showNewBuilding`, `updateVisibility`
369+
- **State Management**: Shows/hides location sections based on user selection
370+
- **Form Clearing**: Clears irrelevant fields when switching location types
371+
- **Accessibility**: Focuses first field in new forms, maintains keyboard navigation
372+
373+
**Key Methods:**
374+
- `connect()`: Initialize form state based on existing data
375+
- `toggleLocationType(event)`: Show appropriate location section
376+
- `hideAllLocationTypes()`: Reset all location sections
377+
- `showNewAddress(event)` / `showNewBuilding(event)`: Toggle inline creation forms
378+
- `clearSimpleLocationFields()` / `clearStructuredLocationFields()`: Field cleanup
379+
380+
**Backend Processing**
381+
382+
The system uses a custom `location_attributes=` setter on `LocatableLocation` instead of Rails' standard `accepts_nested_attributes_for` due to polymorphic association complexity.
383+
384+
**Polymorphic Location Creation Flow:**
385+
1. Form submission includes `location_attributes` nested in event params
386+
2. `location_attributes=` setter determines location type from submitted data
387+
3. For Address: Creates `Address` record with geocoding job scheduling
388+
4. For Building: Creates `Building` with nested `Address`, handles attribute normalization
389+
5. `LocatableLocation` polymorphic association points to appropriate location record
390+
6. Geocoding jobs run in background for address-based locations
391+
392+
**Form Integration & UI**
393+
394+
**Inline Creation Features:**
395+
- "New" buttons reveal inline forms without page navigation
396+
- Address and Building forms use consistent partial rendering
397+
- Form validation shows errors inline without losing user input
398+
- Progressive enhancement: works without JavaScript (graceful degradation)
399+
400+
**Validation & Error Handling:**
401+
- Model validations for Event, Address, Building, and LocatableLocation
402+
- Form error display within respective location sections
403+
- JavaScript preserves form state during error correction
404+
- Backend error handling with graceful rollback protection
405+
406+
**Integration Points:**
407+
- Authorization via policies for Address/Building creation
408+
- Geocoding integration with background job processing
409+
- Performance optimizations with efficient queries and selective loading
410+
411+
**Diagram Files:**
412+
- 📊 [Location Selector Flow](../../diagrams/source/events_location_selector_flow.mmd) - Detailed UI and backend flow
413+
- 🖼️ [PNG Export](../../diagrams/exports/png/events_location_selector_flow.png) - High-resolution image
414+
- 🎯 [SVG Export](../../diagrams/exports/svg/events_location_selector_flow.svg) - Vector graphics
249415

250416
## Event Hosts System
251417

@@ -482,19 +648,109 @@ The event reminder system has comprehensive test coverage:
482648
- Controller: `BetterTogether::EventsController` (index groups into draft/upcoming/past)
483649
- RSVP actions: `rsvp_interested`, `rsvp_going`, `rsvp_cancel` (require authentication)
484650
- ICS export: `ics` action renders calendar file with proper MIME type
485-
- Show/View: Uses FriendlySlug to present readable URLs and `Viewable` for basic metrics
486-
- Creation: Standard CRUD with validations
487-
488-
## Calendars
489-
- `BetterTogether::Calendar`: A named, translatable container linked to a Community (`belongs_to :community`), with privacy and slug.
490-
- `BetterTogether::CalendarEntry`: Placeholder model for future association of events to calendar entries (not yet wired).
491-
492-
## What’s Not Implemented Yet
493-
- RSVPs/Attendees: No attendance model or RSVP workflow.
494-
- Recurrence: No repeat rules; all events are single instances.
495-
- ICS Export: Not currently generating .ics files.
496-
- Calendar Entries: `CalendarEntry` exists but is not used to associate events to calendars.
497-
498-
## How to Extend Safely
499-
- Recurrence: Add a `recurrence_rule` string + service to materialize occurrences; ensure scopes reflect next occurrences.
500-
- Calendar mapping: Create `CalendarEntry` with `calendar_id`, `event_id` and query by calendar.
651+
652+
## User Experience & Journey Maps
653+
654+
### Event Organizer Journey
655+
The complete event organizer experience from planning to follow-up:
656+
657+
```mermaid
658+
journey
659+
title Event Organizer Journey
660+
section Planning
661+
Idea Generation: 5: Organizer
662+
Community Research: 4: Organizer
663+
Venue Coordination: 3: Organizer
664+
Date Selection: 4: Organizer
665+
section Event Creation
666+
Access Platform: 5: Organizer
667+
Create New Event: 5: Organizer
668+
Add Event Details: 4: Organizer
669+
Set Location: 4: Organizer
670+
Upload Images: 3: Organizer
671+
Add Co-hosts: 4: Organizer
672+
Set Privacy: 5: Organizer
673+
Publish Event: 5: Organizer
674+
section Promotion
675+
Share Event Link: 4: Organizer
676+
Social Media Posts: 3: Organizer
677+
Community Announcements: 4: Organizer
678+
section Management
679+
Monitor RSVPs: 5: Organizer
680+
Answer Questions: 4: Organizer
681+
Update Details: 3: Organizer
682+
Coordinate with Co-hosts: 4: Organizer
683+
section Event Day
684+
Final Preparations: 3: Organizer
685+
Check-in Attendees: 4: Organizer
686+
Host Event: 5: Organizer
687+
section Follow-up
688+
Thank Attendees: 4: Organizer
689+
Gather Feedback: 3: Organizer
690+
Share Photos: 4: Organizer
691+
Plan Next Event: 5: Organizer
692+
```
693+
694+
**Diagram Files:**
695+
- 📊 [Organizer Journey](../../diagrams/source/events_organizer_journey.mmd) - Complete organizer experience
696+
- 🖼️ [PNG Export](../../diagrams/exports/png/events_organizer_journey.png) - High-resolution image
697+
- 🎯 [SVG Export](../../diagrams/exports/svg/events_organizer_journey.svg) - Vector graphics
698+
699+
### Event Attendee Journey
700+
The complete attendee experience from discovery to community building:
701+
702+
```mermaid
703+
journey
704+
title Event Attendee Journey
705+
section Discovery
706+
Browse Events: 5: User
707+
Search by Category: 4: User
708+
Read Event Details: 5: User
709+
Check Location/Time: 5: User
710+
section Decision
711+
Consider Interest: 4: User
712+
Check Schedule: 3: User
713+
RSVP as Interested: 4: User
714+
RSVP as Going: 5: User
715+
Add to Calendar: 4: User
716+
section Preparation
717+
Receive 24h Reminder: 5: User
718+
Plan Transportation: 3: User
719+
Receive 1h Reminder: 5: User
720+
section Attendance
721+
Receive Start Reminder: 4: User
722+
Travel to Event: 3: User
723+
Check-in at Event: 4: User
724+
Participate in Event: 5: User
725+
section Follow-up
726+
Leave Event: 4: User
727+
Share Experience: 4: User
728+
Connect with New Contacts: 3: User
729+
Look for Similar Events: 5: User
730+
section Community Building
731+
Join Related Groups: 4: User
732+
Become Event Organizer: 5: User
733+
Help Promote Events: 3: User
734+
```
735+
736+
**Diagram Files:**
737+
- 📊 [Attendee Journey](../../diagrams/source/events_attendee_journey.mmd) - Complete attendee experience
738+
- 🖼️ [PNG Export](../../diagrams/exports/png/events_attendee_journey.png) - High-resolution image
739+
- 🎯 [SVG Export](../../diagrams/exports/svg/events_attendee_journey.svg) - Vector graphics
740+
741+
## Additional Resources
742+
743+
### User Documentation
744+
- 📖 [Event User Guide](../users/events_user_guide.md) - Comprehensive guide for organizers and attendees
745+
- 🎯 [Best Practices](../users/events_user_guide.md#best-practices) - Tips for successful event management
746+
- 🔧 [Troubleshooting](../users/events_user_guide.md#troubleshooting-common-issues) - Common issues and solutions
747+
748+
### All Event System Diagrams
749+
- 📊 [Events Schema ERD](../../diagrams/source/events_schema_erd.mmd) - Database relationships
750+
- 📊 [Events Flow](../../diagrams/source/events_flow.mmd) - Complete system workflow
751+
- 📊 [Location Selector Flow](../../diagrams/source/events_location_selector_flow.mmd) - Location selection UI/UX
752+
- 📊 [RSVP Flow](../../diagrams/source/events_rsvp_flow.mmd) - Attendance workflow
753+
- 📊 [Reminder Timeline](../../diagrams/source/events_reminders_timeline.mmd) - Notification scheduling
754+
- 📊 [Technical Architecture](../../diagrams/source/events_technical_architecture.mmd) - System architecture
755+
- 📊 [Organizer Journey](../../diagrams/source/events_organizer_journey.mmd) - Organizer user experience
756+
- 📊 [Attendee Journey](../../diagrams/source/events_attendee_journey.mmd) - Attendee user experience
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
journey
2+
title Event Attendee Journey
3+
section Discovery
4+
Browse Events: 5: User
5+
Search by Category: 4: User
6+
Read Event Details: 5: User
7+
Check Location/Time: 5: User
8+
View Host Information: 3: User
9+
section Decision
10+
Consider Interest: 4: User
11+
Check Schedule: 3: User
12+
RSVP as Interested: 4: User
13+
RSVP as Going: 5: User
14+
Add to Calendar: 4: User
15+
section Preparation
16+
Receive 24h Reminder: 5: User
17+
Plan Transportation: 3: User
18+
Invite Friends: 4: User
19+
Receive 1h Reminder: 5: User
20+
section Attendance
21+
Receive Start Reminder: 4: User
22+
Travel to Event: 3: User
23+
Check-in at Event: 4: User
24+
Participate in Event: 5: User
25+
Network with Others: 4: User
26+
section Follow-up
27+
Leave Event: 4: User
28+
Share Experience: 4: User
29+
Connect with New Contacts: 3: User
30+
Provide Feedback: 3: User
31+
Look for Similar Events: 5: User
32+
section Community Building
33+
Join Related Groups: 4: User
34+
Become Event Organizer: 5: User
35+
Help Promote Events: 3: User
36+
Mentor New Members: 4: User

0 commit comments

Comments
 (0)