Skip to content

Library Traffic Data Averaging Using Historical Data #243

@estao1

Description

@estao1

Expected Behavior

The API should provide averaged traffic data based on historical patterns stored in the library_traffic_history table. Users should be able to query typical occupancy levels at different times to help plan their study sessions.

Examples:

  • Average traffic for Langson Library 4th Floor on Wednesdays at 2pm
  • Average afternoon traffic for Gateway Study Center across all weekdays
  • Daily average traffic for Science Library during finals week

Current Behavior

The library traffic feature currently:

  • Scrapes traffic data every 15 minutes when libraries are open ("active" status)
  • Scrapes traffic data every 60 minutes when libraries are closed ("idle" status)
  • Stores current snapshot in library_traffic table
  • Accumulates historical data in library_traffic_history table with timestamps

The API only returns the most recent snapshot via /library-traffic endpoint. Historical data is being collected but not exposed or aggregated for analysis.

Possible Solution

Add new API endpoints that leverage the historical data to provide averaged traffic patterns:

Averaging Approaches/Features to Consider

  1. Hourly Averages: Average traffic per hour of the day (e.g. 2pm on Mondays)
  2. Daily Averages: Average traffic per day of the week (e.g. Tuesdays)
  3. Time-of-Day Averages: Average traffic across different time blocks (e.g. morning, afternoon, evening)
  4. Day-Specific Averages: Average traffic on a specific Calendar day (e.g. Wednesday of finals week)
  5. Custom Time Ranges: Allow users to specify date ranges for custom averaging

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions