Skip to content

Implement GTFS-Fares v2 models#29

Merged
sargunv merged 4 commits intomainfrom
copilot/implement-gtfs-fare-models
Oct 23, 2025
Merged

Implement GTFS-Fares v2 models#29
sargunv merged 4 commits intomainfrom
copilot/implement-gtfs-fare-models

Conversation

Copy link
Contributor

Copilot AI commented Oct 22, 2025

Implementation of GTFS-Fares v2 models - Complete ✅

  • Add placeholder types for new entities in common.kt (FareMedia, FareProduct, RiderCategory, Area, Timeframe)
  • Create FareMedia.kt model (3 fields: fare_media_id, fare_media_name, fare_media_type)
  • Create FareProduct.kt model (6 fields: fare_product_id, fare_product_name, rider_category_id, fare_media_id, amount, currency)
  • Create RiderCategory.kt model (4 fields: rider_category_id, rider_category_name, is_default_fare_category, eligibility_url)
  • Create FareLegRule.kt model (8 fields: leg_group_id, network_id, from_area_id, to_area_id, from_timeframe_group_id, to_timeframe_group_id, fare_product_id, rule_priority)
  • Create FareLegJoinRule.kt model (4 fields: from_network_id, to_network_id, from_stop_id, to_stop_id)
  • Create FareTransferRule.kt model (7 fields: from_leg_group_id, to_leg_group_id, transfer_count, duration_limit, duration_limit_type, fare_transfer_type, fare_product_id)
  • Create Timeframe.kt model (4 fields: timeframe_group_id, start_time, end_time, service_id)
  • Create Network.kt model (2 fields: network_id, network_name)
  • Create RouteNetwork.kt model (2 fields: network_id, route_id)
  • Create Area.kt model (2 fields: area_id, area_name)
  • Create StopArea.kt model (2 fields: area_id, stop_id)
  • Add tests for each new model
  • Run linting and tests to verify all changes
  • Run CodeQL security check
  • Address review feedback

Summary

Successfully implemented all 11 GTFS-Fares v2 model files with:

  • Proper Kotlin serialization annotations (@SerialName)
  • Appropriate utility types (Id, CurrencyCode, ServiceTime, Url, WholeSeconds, IntBoolean)
  • Foreign key ID references where relevant
  • Value classes for enums following existing patterns
  • Comprehensive test coverage for all models
  • Updated API dump files
  • All linting and tests passing
  • No security vulnerabilities detected
  • Review feedback addressed

All models follow the same conventions as existing GTFS models and match the official GTFS specification at https://gtfs.org/documentation/schedule/reference

Original prompt

In the GTFS module, implement the models for GTFS-Fares v2. The files associated with GTFS-Fares V2 are:

  • fare_media.txt
  • fare_products.txt
  • rider_categories.txt
  • fare_leg_rules.txt
  • fare_leg_join_rules.txt
  • fare_transfer_rules.txt
  • timeframes.txt
  • networks.txt
  • route_networks.txt
  • areas.txt
  • stop_areas.txt

Follow the same conventions as the existing models, including using the appropriate utility types for correct serialization, and ID references where relevant. If the foreign id model doesn't exist, add it as a placeholder like the other placeholders. Double check your work to ensure you didn't invent or miss any fields. Reference https://gtfs.org/documentation/schedule/reference


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Implement models for GTFS-Fares v2 Implement GTFS-Fares v2 models Oct 22, 2025
Copilot AI requested a review from sargunv October 22, 2025 09:08
Copy link
Owner

@sargunv sargunv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Handle my comments

@sargunv sargunv marked this pull request as ready for review October 22, 2025 23:20
Copilot AI requested a review from sargunv October 22, 2025 23:28
Copilot AI and others added 3 commits October 22, 2025 21:21
🤖 Generated with [GitHub Copilot](https://github.com/features/copilot)

Co-Authored-By: GitHub Copilot <noreply@github.com>

Co-authored-by: sargunv <1320357+sargunv@users.noreply.github.com>
- Change FareTransferRule.durationLimit from Int to WholeSeconds
- Change RiderCategory.isDefaultFareCategory from custom value class to IntBoolean
- Remove IsDefaultFareCategory value class
- Update tests to use proper types

🤖 Generated with [GitHub Copilot](https://github.com/features/copilot)

Co-Authored-By: GitHub Copilot <noreply@github.com>

Co-authored-by: sargunv <1320357+sargunv@users.noreply.github.com>
@sargunv sargunv force-pushed the copilot/implement-gtfs-fare-models branch from f70d2b6 to e44d410 Compare October 23, 2025 04:23
@sargunv sargunv merged commit c314eac into main Oct 23, 2025
3 checks passed
@sargunv sargunv deleted the copilot/implement-gtfs-fare-models branch October 23, 2025 04:45
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.

2 participants