DSA Logo

DSA Portal Build Summary

What we changed from dsasd.org, how we built it, and what's next

Akhil Neil Moiz
4
Core Features
7
Sections Built
1
Page (No Redirects)
11
Real DSA Images
AI
Chatbot Live

What We Set Out to Do

Our original proposal identified three major problems with the current dsasd.org:

Current dsasd.org Problems

  • 9+ menu items with nested dropdowns
  • Members navigate 3-4 pages to find basic info
  • FAQ has only 5 static questions, no search
  • News section shows 2 static cards
  • No AI assistance for common questions
  • Login page is a generic WordPress form
  • Newsletter only accessible via PDF download
  • Mobile nav is hard to use

Our Redesigned Portal

  • 7 flat nav links with smooth scroll
  • Everything on 1 single page with inline panels
  • FAQ has 9+ questions with search + category filters
  • News section shows 3 image cards with tags
  • AI chatbot powered by Claude API
  • Custom sheriff-specific login (badge, rank, station)
  • Newsletter preview cards with expandable content
  • Mobile-responsive with hamburger menu

Feature 1: Interactive Member Dashboard

"One Dashboard. Every Resource. Zero Clicks Wasted."
DSA Dashboard
Dashboard with quick-access resource tiles
DSA Store
Store section with real DSA HQ photos

What we built:

💳

Quick-Access Resource Tiles

8 tiles (Benefits, Legal, Wellness, Forms, Events, Store, Newsletters, PAC) that expand inline detail panels below them — no page redirects

🔎

Autocomplete Search Bar

Type 2+ characters and get instant results that scroll to the section and open the relevant detail panel automatically

📰

Newsletter Preview Cards

Past Silver Star issues displayed as clickable cards with expandable content previews showing article titles

📅

Events with RSVP

Upcoming events listed with date badges, locations, and functional RSVP buttons that update instantly on click

How clicks were minimized:

Actiondsasd.org (Before)Our Portal (After)
Find benefits infoMenu → Benefits → Open Enrollment (3 clicks)Click "Benefits" tile → inline panel (1 click)
Read newsletterMenu → Silver Star → PDF download (3 clicks)Click "Newsletters" tile → preview cards (1 click)
RSVP for eventMenu → Events → Calendar → Event page (4 clicks)Scroll to Events → click RSVP (1 click)
Search for infoFind tiny search icon → new page (2 clicks)Type in header search → auto-scroll (0 clicks)
Check legal rightsMenu → Member Resources → Legal page (3 clicks)Click "Legal Defense" tile (1 click)

Feature 2: AI-Powered Smart FAQ Hub

"Find Answers Instantly — Or Chat With Us"
🤖

Claude AI Chatbot

Floating chat widget powered by Claude API. Trained on DSA knowledge: membership, benefits, legal defense, events, store, stations, PAC, and more

🔍

Searchable FAQ

9 pre-written Q&As with instant search filtering as you type. Category tags let you filter by topic

How the chatbot works:

  • User types a question in the chat widget
  • Frontend sends the message + last 10 messages to POST /api/sheriff/chat
  • Backend builds a Claude API request with a comprehensive system prompt containing DSA knowledge
  • Claude responds with a helpful, professional answer
  • Conversation history is maintained for context

Chatbot knowledge covers:

  • Organization info, headquarters, contact details
  • Membership eligibility, dues, enrollment
  • Benefits (medical, dental, vision, life insurance)
  • Legal defense fund, Weingarten rights, critical incident protocol
  • Wellness programs, peer support, CISM team
  • All 12 stations + detention facilities
  • Events calendar, golf tournament, family picnic
  • DSA Store merchandise, PAC endorsements
  • Contract/MOU information, grievance procedures

Feature 3: Sheriff-Specific Authentication

Old dsasd.org Login

  • Generic WordPress login form
  • Username + password only
  • No sheriff-specific fields
  • Shared user table with all site users
  • Basic session cookies

Our Portal Login

  • Custom modal with Log In / Sign Up tabs
  • Sheriff-specific fields: Badge #, Rank, Station
  • Separate sheriff_users database table
  • Separate jwt_sheriff JWT token cookie
  • Admin panel for viewing all members
  • User chip in header shows name + badge on hover

Signup fields we added:

FieldPurpose
Badge / Sheriff IDUnique identifier (e.g., SD-1234)
RankDeputy, Corporal, Sergeant, Lieutenant, Captain
StationDropdown of all 12 SD County stations
PhoneContact number for the member

Feature 4: Interactive Events Calendar

"See Every Event at a Glance — Click a Date, RSVP Instantly"
📅

Month-View Calendar Grid

Full interactive calendar with month navigation (prev/next/today buttons), day cells that highlight dates with events, and a today indicator

📌

Day Detail Panel

Click any date to see event cards with title, time, location, and optional event images (golf tournament flyer, memorial photo)

🎯

Event Badges + RSVP

Dates with events show a count badge. Each event card has a functional RSVP button that toggles between "RSVP" and "Going"

🛠

Smart Auto-Navigation

Calendar auto-opens to the month of the next upcoming event and auto-selects the first event date so members immediately see what's next

How the calendar works:

  • Event data is stored as a JavaScript array with title, date, time, location, and optional image fields
  • A Map (eventMap) indexes events by date key (YYYY-MM-DD) for instant lookup
  • renderCalendar() builds a 7-column CSS Grid of day buttons, marking today, out-of-month days, and event days with badges
  • Clicking a day calls selectDate() which updates the detail panel with event cards for that date
  • Month navigation (shiftCalendarMonth) re-renders the grid and auto-selects the first event in the new month
  • "Today" button jumps back to the current month and highlights today's date

Tech stack used:

ComponentTechnologyPurpose
Calendar gridCSS Grid (7 columns) + Vanilla JSResponsive month layout with day cells
Event dataJavaScript MapO(1) lookup of events by date key
Date handlingNative Date APIMonth math, day-of-week offsets, formatting
Day detail panelDynamic HTML renderingEvent cards with images and RSVP buttons
NavigationEvent listeners on prev/next/today buttonsMonth shifting and today jump
RSVP toggleInline onclick handlerVisual feedback on button click

SRP functions powering the calendar:

  • buildEventMap() — indexes events by date into a Map for fast lookup
  • getInitialCalendarMonth() — finds the month of the next upcoming event to auto-navigate
  • renderCalendar() — builds the month grid with day buttons, badges, and highlights
  • renderDayDetail() — populates the detail panel with event cards for a selected date
  • selectDate() — updates selection state and triggers re-render
  • shiftCalendarMonth() — navigates forward/backward by one month
  • goToToday() — jumps to the current month and selects today

Real DSA Images Integrated

We sourced 11 images directly from dsasd.org's media library to preserve the organization's visual identity.

DSA Logo
Official DSA badge + star logo
Store Relaunch
DSA Store Relaunch flyer
Golf Tournament
Memorial Golf Tournament flyer
Board Member
Board & staff portrait
Line of Duty
Line of Duty memorial
Silver Star
Silver Star newsletter
DSA Store
DSA Store interior at HQ
Golf
Members at the golf tournament

Tech Stack

Flask + Python
Backend API server
SQLAlchemy
ORM & database
SQLite
Local dev database
JWT Auth
Token-based sessions
Claude API
AI chatbot (Anthropic)
Jekyll
Static site generator
Vanilla JS
No framework needed
CSS Grid
Responsive layouts

Backend API Endpoints:

MethodEndpointPurpose
POST/api/sheriff/authenticateLogin → returns JWT cookie
DELETE/api/sheriff/authenticateLogout → expires cookie
GET/api/sheriff/idGet current user from token
POST/api/sheriff/userCreate new sheriff (signup)
GET/api/sheriff/userList all sheriffs (admin only)
PUT/api/sheriff/userUpdate sheriff profile
DELETE/api/sheriff/userDelete sheriff (admin only)
POST/api/sheriff/chatAI chatbot → Claude API

Key Files:

FilePurpose
cap_back/model/sheriff.pySheriff SQLAlchemy model with sheriff_users table
cap_back/api/sheriff.pyAuth + CRUD endpoints with SRP helpers
cap_back/api/sheriff_chat.pyClaude API integration with SRP functions
cap_front/navigation/sheriff/index.mdFull single-page portal UI

Code Quality: SRP Refactoring

We applied the Single Responsibility Principle across all three codebases. See our detailed SRP Refactoring Blog for code comparisons.

  • Frontend: 14 monolithic JS functions → 30+ focused helpers (e.g., apiRequest(), showLoggedInUI(), sanitizeHTML())
  • Backend API: JWT decode duplicated 4x → 1 shared decode_sheriff_token(); cookie logic 2x → 1 set_sheriff_cookie()
  • Chatbot API: 1 monolithic handler → 5 single-purpose functions (validate_chat_request, build_message_history, call_claude_api, parse_claude_response)

Work Split

Akhil

  • Backend API architecture
  • Sheriff model & database schema
  • JWT authentication system
  • Claude API chatbot integration
  • SRP refactoring (backend)
  • API endpoint design

Neil

  • UI/UX design & layout
  • Single-page architecture
  • Search bar with autocomplete
  • Login/signup modal design
  • Real DSA image integration
  • SRP refactoring (frontend JS)

Moiz

  • Events calendar & RSVP
  • FAQ search & category filters
  • Newsletter preview cards
  • Admin panel & member table
  • Mobile responsive design
  • Blog writeups & documentation

All Sections Built

SectionFeaturesClick Reduction
HeroDSA logo, stats (4,229 members / 70+ years / 12 stations / 24/7), CTA buttonsLanding → immediate context
Resources Dashboard8 tiles with inline expandable detail panels3-4 clicks → 1 click
News3 cards with images, category tags, datesStatic page → scrollable feed
Events CalendarInteractive month-view calendar, day detail panel, event cards with images, RSVP buttons, auto-navigation to next eventCalendar page → click-a-date inline
About4 cards: Mission, Stations, Leadership, History with imagesAbout page → scrollable section
Store8 product cards + real store photos + relaunch flyerStore page → inline grid
FAQ9 Q&As, search filter, category tags, AI chatbot5 static Q&As → searchable + AI
ContactStaff photos, address/phone/email cardsContact page → inline section
NewsletterSilver Star preview cards with expandable issue contentsPDF download → inline preview
Admin PanelMember table (admin only), toggled from user dropdownN/A (new feature)

What's Next

FeatureStatusPlanned Tech
Push notifications for new newslettersPlannedService Workers, Web Push API
Personalized dashboard per memberPlannedJWT claims + conditional rendering
Document center with file downloadsPlannedFlask file serving, S3 storage
Integration with dsasd.org WordPress APIPlannedWordPress REST API, data sync
Accessibility audit (WCAG 2.1 AA)PlannedKeyboard nav, ARIA labels, contrast

Planned ML Integration

We plan to add machine learning features to make the portal smarter and more personalized for DSA members.

🧠

Smart Content Recommendations

Track which resource tiles, FAQ topics, and newsletter issues each member interacts with, then use collaborative filtering to surface the most relevant content on their dashboard

📈

FAQ Auto-Categorization

Use NLP text classification (scikit-learn / TF-IDF) to automatically tag and route new member questions to the correct FAQ category or staff contact

👥

Member Engagement Scoring

Build a logistic regression model that predicts which members are at risk of disengaging based on login frequency, RSVP history, and resource usage patterns

💬

Chatbot Intent Detection

Train a lightweight intent classifier to detect question categories before sending to Claude API — enabling faster responses for common queries and reducing API costs

ML Implementation Plan:

ML FeatureModel / ApproachData SourceStack
Content recommendationsCollaborative filtering (item-based)User click/interaction logsPython, scikit-learn, Flask API
FAQ auto-categorizationTF-IDF + Naive Bayes classifierExisting FAQ Q&As + chatbot historyscikit-learn, NLTK
Engagement scoringLogistic regressionLogin timestamps, RSVP data, page viewspandas, scikit-learn
Chatbot intent detectionText classifier (SVM / logistic)Labeled chatbot conversation logsscikit-learn, Flask middleware

How it connects to the existing portal:

  • Data collection — Log user interactions (tile clicks, searches, RSVPs, chat questions) to a new analytics table in the SQLite database
  • Model training — Run offline training scripts in Python using scikit-learn on the collected interaction data
  • Serving predictions — Add new Flask API endpoints (e.g., /api/sheriff/recommendations, /api/sheriff/engagement) that return ML predictions
  • Frontend integration — Dashboard tiles reorder based on recommendation scores; at-risk members get flagged in the admin panel