Skip to content
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

Don't display a vehicle as invalid if it is a block overload #514

Merged
merged 10 commits into from
Mar 18, 2020

Conversation

arkadyan
Copy link
Contributor

@codecov
Copy link

codecov bot commented Mar 16, 2020

Codecov Report

Merging #514 into master will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #514      +/-   ##
==========================================
+ Coverage   97.47%   97.59%   +0.11%     
==========================================
  Files         170      170              
  Lines        3805     3818      +13     
  Branches      523      523              
==========================================
+ Hits         3709     3726      +17     
+ Misses         92       88       -4     
  Partials        4        4              
Impacted Files Coverage Δ
lib/concentrate/vehicle_position.ex 98.83% <100.00%> (+0.11%) ⬆️
lib/gtfs/block.ex 100.00% <100.00%> (ø)
lib/realtime/vehicle.ex 94.91% <100.00%> (+0.17%) ⬆️
lib/gtfs.ex 75.00% <0.00%> (-1.32%) ⬇️
lib/concentrate/consumer/stop_time_updates.ex 100.00% <0.00%> (+25.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6edecaf...09fc489. Read the comment docs.

Copy link
Member

@skyqrose skyqrose left a comment

Choose a reason for hiding this comment

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

  • What if we have a block overload that really is off course?
  • If block overloads are causing trip id discrepancies, could we detect this case directly from the trip ids instead of from the block id? (And if so, could that even be smart enough to detect an off course overload?)
  • Will this be fixed by GTFS updates or Swiftly loading new GTFS files? If so, will that be soon enough that we should wait for that instead of merging this fix?

Approved in case this is urgent and needs to go now.

@@ -230,6 +234,9 @@ defmodule Realtime.Vehicle do
end
end

@spec block_overload?(Block.id()) :: boolean
def block_overload?(block_id), do: String.match?(block_id, ~r/.+-OL.+/)
Copy link
Member

Choose a reason for hiding this comment

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

Should this live in block.ex?

@skyqrose
Copy link
Member

skyqrose commented Mar 17, 2020

Oh hold on. I reread the asana task:

Swifly won't currently provide predictions for these vehicles, so we believe they will appear as inactive.

We don't care about predictions. Will it also not provide trip assignments?

If so, this might not be enough to show these vehicles correctly. Busloc provides a trip assignment but not a stop assignment, so we wouldn't be able to show them on the ladder.

@arkadyan arkadyan force-pushed the mss-handle-block-overloads branch 3 times, most recently from 699b4ee to b1f83d9 Compare March 18, 2020 17:19
@arkadyan
Copy link
Contributor Author

@skyqrose I've updated this substantially now that we are seeing this data come through the pipeline. There are several new commits before the ones that were there. Swiftly is giving us assignments, so we are able to draw the vehicles on the ladder.

@arkadyan arkadyan force-pushed the mss-handle-block-overloads branch from c39c52f to d6adafa Compare March 18, 2020 19:36
Copy link
Member

@skyqrose skyqrose left a comment

Choose a reason for hiding this comment

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

It's unclear to me how having a block overload will cause a vehicle to show up as off course: If Swiftly is able to still assign a stop and trip to a vehicle, then we should still be able to use that trip to check if a vehicle is on course, so why is checking for an overload needed?

lib/concentrate/vehicle_position.ex Outdated Show resolved Hide resolved
lib/concentrate/vehicle_position.ex Outdated Show resolved Hide resolved
@@ -189,6 +192,7 @@ defmodule Realtime.Vehicle do
via_variant: via_variant,
bearing: VehiclePosition.bearing(vehicle_position),
block_id: block_id,
block_id_with_overload: block_id_with_overload,
Copy link
Member

Choose a reason for hiding this comment

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

It looks aside from the off course check, this value isn't used anymore, so we could take the field out of the struct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At least for the moment I want to leave it on the client so we can debug the data in the browser without having to add breakpoints in the server or whatever.

Copy link
Member

Choose a reason for hiding this comment

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

I don't like the idea of adding a field to the vehicle struct just for debugging. What about making a data_discrepancy for block_id? (Then it'd also show up when the debug flag is on.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, changed to that.

@arkadyan
Copy link
Contributor Author

@skyqrose Swiftly is giving us the stop assignment, but not necessarily the right trip or other info, but we can get those from Busloc.

@arkadyan
Copy link
Contributor Author

@skyqrose Thanks, made a couple updates.

@arkadyan arkadyan force-pushed the mss-handle-block-overloads branch from 8805b14 to 09fc489 Compare March 18, 2020 21:37
@arkadyan arkadyan merged commit 1dc0100 into master Mar 18, 2020
@arkadyan arkadyan deleted the mss-handle-block-overloads branch March 18, 2020 21:51
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