Skip to content

Comments

45 add method to evaluate traffic dynamics#60

Merged
gmatosferreira merged 16 commits intomainfrom
45-add-method-to-evaluate-traffic-dynamics
Jan 30, 2026
Merged

45 add method to evaluate traffic dynamics#60
gmatosferreira merged 16 commits intomainfrom
45-add-method-to-evaluate-traffic-dynamics

Conversation

@gmatosferreira
Copy link
Member

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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, and rt_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)
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

The function csv.read() does not exist in R. This should be read.csv() (base R) or another appropriate CSV reading function.

Suggested change
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)

Copilot uses AI. Check for mistakes.
Comment on lines +72 to +77
write_json(
feed_list,
temp_json,
pretty = TRUE,
auto_unbox = TRUE
)
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
gmatosferreira and others added 4 commits January 30, 2026 19:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…om:U-Shift/GTFShift into 45-add-method-to-evaluate-traffic-dynamics
@gmatosferreira gmatosferreira merged commit 3ece2de into main Jan 30, 2026
1 of 2 checks passed
@gmatosferreira gmatosferreira deleted the 45-add-method-to-evaluate-traffic-dynamics branch January 30, 2026 20:23
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.

Add method to evaluate traffic dynamics

1 participant