45 add method to evaluate traffic dynamics#60
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds functionality to evaluate traffic dynamics using GTFS Real-Time (GTFS-RT) data, addressing issue #45. The changes enable users to collect real-time vehicle position data from GTFS-RT feeds and use this data to extend lane prioritization analysis with operational metrics like average speed.
Changes:
- Added three new functions:
rt_collect()for JSON-based GTFS-RT feeds,rt_collect_protobuf()for Protocol Buffers feeds, andrt_extend_prioritization()to enrich lane prioritization with real-time speed metrics - Created new vignette documenting GTFS-RT functionality and updated the prioritization vignette to reference real-time capabilities
- Added GTFS-RT feed URLs to Portugal transit sources and included the official GTFS-realtime Protocol Buffers specification file
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| vignettes/rt.Rmd | New vignette introducing GTFS-RT data collection and analysis capabilities |
| vignettes/prioritize.Rmd | Updated to reference new GTFS-RT functionality and improved formatting |
| man/rt_extend_prioritization.Rd | Documentation for extending prioritization with real-time metrics |
| man/rt_collect_protobuf.Rd | Documentation for Protocol Buffers GTFS-RT collection |
| man/rt_collect.Rd | Documentation for JSON GTFS-RT collection |
| inst/extdata/gtfs_sources_pt.csv | Added URL-RT column with real-time feed URLs for Portuguese transit operators |
| inst/extdata/gtfs-realtime.proto | Official GTFS-realtime Protocol Buffers specification file |
| dev/test_rt.R | Development test script demonstrating usage with Portuguese transit data |
| _pkgdown.yml | Added real-time functions to package documentation structure |
| R/rt_extend_prioritization.R | Implementation of prioritization extension with GTFS-RT speed metrics |
| R/rt_collect_protobuf.R | Implementation of Protocol Buffers GTFS-RT data collection |
| R/rt_collect.R | Implementation of JSON GTFS-RT data collection |
| NAMESPACE | Exported new rt_* functions |
| DESCRIPTION | Added RProtoBuf and jsonlite dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| GTFShift::rt_collect("https://api.example.com/gtfs-rt", rt_collect_file) | ||
| lane_prioritization <- GTFShift::prioritize_lanes(gtfs, osm_query) | ||
|
|
||
| rt_collection <- csv.read(rt_collect_file) |> sf::st_as_sf(coords = c("longitude", "latitude"), crs = 4326) |
There was a problem hiding this comment.
The function csv.read() does not exist in R. This should be read.csv() (base R) or another appropriate CSV reading function.
| rt_collection <- csv.read(rt_collect_file) |> sf::st_as_sf(coords = c("longitude", "latitude"), crs = 4326) | |
| rt_collection <- read.csv(rt_collect_file) |> sf::st_as_sf(coords = c("longitude", "latitude"), crs = 4326) |
| write_json( | ||
| feed_list, | ||
| temp_json, | ||
| pretty = TRUE, | ||
| auto_unbox = TRUE | ||
| ) |
There was a problem hiding this comment.
The function calls write_json() without the package namespace. Since jsonlite is imported with @import jsonlite, this should work, but for clarity and to match R best practices, it would be better to use jsonlite::write_json() or ensure the import is correct.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…om:U-Shift/GTFShift into 45-add-method-to-evaluate-traffic-dynamics
No description provided.