Skip to content

Add Date Filter Support for Volunteer Activity Trend and Volunteers by Location (#179)#224

Open
PamalaMadhumithaYadav wants to merge 1 commit into
mainfrom
PamalaMadhumithaYadav_179_volunteer_date_filter
Open

Add Date Filter Support for Volunteer Activity Trend and Volunteers by Location (#179)#224
PamalaMadhumithaYadav wants to merge 1 commit into
mainfrom
PamalaMadhumithaYadav_179_volunteer_date_filter

Conversation

@PamalaMadhumithaYadav

@PamalaMadhumithaYadav PamalaMadhumithaYadav commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Implemented Issue #179 by adding date filter support for the Volunteer Activity Trend and Volunteers by Location widgets in volunteer_application_analytics.py. These filters are consumed by the Super Admin dashboard charts.

Changes

  • Added build_date_filter_trend() helper — returns the WHERE clause date condition for Volunteer Activity Trend queries
  • Added build_date_filter_location() helper — returns the WHERE clause date condition for Volunteers by Location query
  • Added get_grouping() helper — determines daily vs monthly grouping based on time range
  • Updated get_volunteer_activity_trend() to support 7D, 30D, 1Y, All, and Custom date filters
  • Updated get_volunteers_by_location() to support 7D, 30D, 1Y, All, and Custom date filters (date filtering only — country aggregation logic and response format unchanged)
  • Renamed trend response key from month to period
  • Updated merge logic to use period
  • Trend and location filters are independent (time_range vs time_range_location, with separate custom date params)

Date Filter Behavior

Time Range Filter Trend Grouping
7D Past 7 days Daily
30D Past 30 days Daily
1Y Past 1 year Monthly
All Entire dataset Monthly
Custom Between start_date and end_date Daily

Testing

  • Tested locally using CSV files from the sql/ folder loaded into SQLite (per local testing guidelines)
  • Verified all 5 time ranges for both widgets, including independent filters and custom date ranges
  • Verified period key in all trend responses and cumulative total_volunteers counts
  • Applies to both Virginia and Ireland databases
  • No production credentials hardcoded

Notes for Reviewers

  • LOCAL_TESTING flag is set to False for deployment; when True, the script runs against local CSV data for testing without AWS access

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Volunteer_Application_Analytics ----Add Date Filter for Volunteer Activity Trend and Volunteers by Location

1 participant