Skip to content

Add date filter functionality to get_gtfs_segments and get_bus_feed#17

Open
praneethd7 wants to merge 1 commit into
mainfrom
add_date_filter
Open

Add date filter functionality to get_gtfs_segments and get_bus_feed#17
praneethd7 wants to merge 1 commit into
mainfrom
add_date_filter

Conversation

@praneethd7
Copy link
Copy Markdown
Collaborator

Summary

This PR enhances the date filter functionality in get_gtfs_segments and get_bus_feed functions, adding support for single and multiple date inputs with comprehensive validation and error handling.

Key Changes

  • Enhanced date filtering: Added support for analyzing specific dates instead of just the busiest day
  • Flexible input formats: Supports both string ("YYYYMMDD") and datetime.date objects
  • Multiple date analysis: Can analyze multiple dates simultaneously
  • Input validation: Comprehensive error handling for invalid date formats and values
  • Updated documentation: Added examples and usage instructions for the new date filtering features
  • Test coverage: Added comprehensive tests for the new functionality

Files Modified

  • gtfs_segments/gtfs_segments.py - Core functionality enhancements
  • gtfs_segments/partridge_func.py - Supporting functions for date handling
  • gtfs_segments/__init__.py - API updates
  • README.md - Documentation updates with usage examples
  • docs/usage.md - Detailed usage documentation
  • test/test_gtfs_segments.py - New test cases
  • requirements.txt - Updated dependencies

Usage Examples

# Single date analysis
segments_df = get_gtfs_segments("gtfs.zip", date="20240317")

# Multiple dates analysis  
segments_df = get_gtfs_segments("gtfs.zip", date=["20220315", "20220316", "20220317"])

# Mixed date formats
from datetime import date
segments_df = get_gtfs_segments("gtfs.zip", date=["20220315", date(2022, 3, 16)])

Testing

  • All existing tests continue to pass
  • New comprehensive test suite for date filtering functionality
  • Covers edge cases and error conditions

Breaking Changes

None - this is a backward-compatible enhancement. Default behavior (analyzing busiest day) remains unchanged.

…_feed`. Added support for single and multiple date inputs, including validation and error handling for invalid dates. Updated documentation and tests to reflect these changes.
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.

1 participant