Skip to content

Vehicle Position Validation Metrics #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Hasaber8
Copy link
Contributor

For #41

@Hasaber8 Hasaber8 marked this pull request as draft February 14, 2025 06:23
@coveralls
Copy link

coveralls commented Feb 14, 2025

Coverage Status

coverage: 33.516% (-24.9%) from 58.388%
when pulling 0add21f on Hasaber8:metrics/latlong
into 12fb595 on OneBusAway:main.


//Count invalid postions
for _, vehicle := range realTimeData.Vehicles {
fmt.Println(float64(*vehicle.Position.Latitude), float64(*vehicle.Position.Longitude))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

little doubtful about this part, need to test with actual data.

@Ahmedhossamdev Ahmedhossamdev marked this pull request as ready for review February 18, 2025 01:48
@Hasaber8
Copy link
Contributor Author

Hasaber8 commented Mar 7, 2025

@aaronbrethorst Can you please review this when you get time?

Copy link
Member

@aaronbrethorst aaronbrethorst left a comment

Choose a reason for hiding this comment

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

I think this will do exactly what it says it will, but I have two requests before merging:

  1. instead of looking at whether the positions of vehicles are globally valid or invalid, please extract the boundaries of the current region from the shapes data (the GTFS library may have this functionality built in), and then see if each vehicle point is within the boundaries or not.
  2. Please add some basic unit tests.

thanks for pitching in! :)

@Hasaber8
Copy link
Contributor Author

ack. will work on these

@Hasaber8
Copy link
Contributor Author

@aaronbrethorst This is gtg for review, I see another PR adding tests for the rest of the gtfs file.

@aaronbrethorst aaronbrethorst requested a review from Copilot March 30, 2025 00:33
Copy link

@Copilot 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 PR implements vehicle position validation metrics by introducing new Prometheus gauges and region boundary extraction functionality from GTFS static data. Key changes include:

  • Adding two new gauge metrics (invalid vehicle positions count and valid vehicle positions percentage) in metrics.go.
  • Introducing functions for extracting region boundaries and validating vehicle positions in gtfs-realtime-bindings.go.
  • Adding tests for boundary validation and region extraction in gtfs-realtime-bindings_test.go.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
internal/metrics/metrics.go Adds new gauge metrics for vehicle position validation.
internal/metrics/gtfs-realtime-bindings_test.go Provides test coverage for boundary extraction and position validation.
internal/metrics/gtfs-realtime-bindings.go Implements region boundary extraction, validation functions and updates the vehicle position count function.
Files not reviewed (1)
  • go.mod: Language not supported
Comments suppressed due to low confidence (1)

internal/metrics/gtfs-realtime-bindings.go:195

  • [nitpick] There are two similar functions: 'CountVehiclePositions' and 'CountVehiclePosition'. Consider renaming one of them to clearly differentiate their purposes and avoid confusion.
func CountVehiclePosition(server models.ObaServer) (int, error) {

@Hasaber8
Copy link
Contributor Author

Hasaber8 commented Apr 6, 2025

coveralls is down for maintenance, thus the failed build

@Hasaber8 Hasaber8 requested a review from aaronbrethorst April 10, 2025 16: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.

3 participants