From 8786cfd087843ca15fbda00917c26b11dc98a867 Mon Sep 17 00:00:00 2001 From: Walton Hoops Date: Tue, 30 Apr 2024 12:34:52 -0600 Subject: [PATCH 01/10] fix: prevent stop 151 being added to Red line --- apps/state/config/config.exs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/state/config/config.exs b/apps/state/config/config.exs index d1f95fe3..808f777e 100644 --- a/apps/state/config/config.exs +++ b/apps/state/config/config.exs @@ -717,7 +717,8 @@ config :state, :stops_on_route, "6551", "190", "9070025", - "9070080" + "9070080", + "151" ] } From bbc5af26420d95b0b6964381e664d7fd962c48ca Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 3 May 2024 13:54:20 -0400 Subject: [PATCH 02/10] add Shuttle-NorthStationReading (#797) --- apps/state/config/config.exs | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/state/config/config.exs b/apps/state/config/config.exs index 808f777e..907e97bc 100644 --- a/apps/state/config/config.exs +++ b/apps/state/config/config.exs @@ -230,6 +230,7 @@ config :state, :stops_on_route, "Shuttle-HaverhillReadingLocal-0-" => true, "Shuttle-AndersonWoburnReading-0-" => true, "Shuttle-OakGroveReading-0-" => true, + "Shuttle-NorthStationReading-0-" => true, "CR-Haverhill-fc94d3b2-" => true, "CR-Haverhill-9a2b8f60-" => true, # Lowell Line shuttles From 774cf4c62c72d087ff145f2ac75ede087c7b3a08 Mon Sep 17 00:00:00 2001 From: meagharty <149533950+meagharty@users.noreply.github.com> Date: Fri, 10 May 2024 10:30:58 -0400 Subject: [PATCH 03/10] fix: add Providence/Stoughton shape for CR Rating Spring 2024 (#800) * fix: add shape for CR Rating Spring 2024 * test: assert there are more than 2 non-ignored shapes for CR-Providence * test: update test for better error msg --- .../state_mediator/integration/gtfs_test.exs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/apps/state_mediator/test/state_mediator/integration/gtfs_test.exs b/apps/state_mediator/test/state_mediator/integration/gtfs_test.exs index fe0c4a2d..3c42cdeb 100644 --- a/apps/state_mediator/test/state_mediator/integration/gtfs_test.exs +++ b/apps/state_mediator/test/state_mediator/integration/gtfs_test.exs @@ -195,17 +195,30 @@ defmodule StateMediator.Integration.GtfsTest do assert [%{name: "Braintree - Alewife"}, %{name: "Ashmont - Alewife"}] = shapes_1 end - test "Providence/Stoughton has 2 non-ignored shapes each direction" do + test "Providence/Stoughton has at least 2 non-ignored shapes in direction 0 and 2 in direction 1" do [shapes_0, shapes_1] = shapes_in_both_directions("CR-Providence") assert [ - shape_0, - %{id: "9890004"}, - %{id: "SouthStationToStoughtonViaFairmount"} + # South Station - Wickford Junction via Back Bay + shape_0 + | remaining_shapes ] = shapes_0 assert shape_0.name =~ "South Station - Wickford Junction" + Enum.each(remaining_shapes, fn shape -> + assert shape.id in [ + # South Station - Stoughton via Back Bay + "9890004", + # South Station - Stoughton via Fairmount + "SouthStationToStoughtonViaFairmount", + # South Station - Wickford Junction + "9890009" + ] + end) + + assert Enum.count(remaining_shapes) >= 1 + assert [%{name: "Wickford Junction - South Station"}, %{id: "9890003"}] = shapes_1 end From aba728d8fae1544507bbd05129ad7dd5c33c268b Mon Sep 17 00:00:00 2001 From: Walton Hoops Date: Tue, 14 May 2024 11:19:03 -0600 Subject: [PATCH 04/10] fix: middleborough lines not being used for StopsOnRoute --- apps/state/config/config.exs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/state/config/config.exs b/apps/state/config/config.exs index 907e97bc..7ef4b2fb 100644 --- a/apps/state/config/config.exs +++ b/apps/state/config/config.exs @@ -243,6 +243,8 @@ config :state, :stops_on_route, "CR-Greenbush-BraintreeGreenbush-" => true, "CR-Middleborough-52b80476-0_MM-0277-S_MM-0356-S_0" => true, "CR-Middleborough-75bed2bb-1_MM-0356-S_MM-0277-S_2" => true, + "CR-Middleborough-92c25d3b-0_MM-0277-S_MM-0356-S_0" => true, + "CR-Middleborough-bb403e6b-1_MM-0356-S_MM-0277-S_2" => true, # Franklin/Foxboro Line shuttles "Shuttle-ForgeParkWalpole-0-" => true, "CR-Franklin-3badde55-" => true, From 8963d8bb7610b6d3dd3b77490bdfd88cee81376e Mon Sep 17 00:00:00 2001 From: Walton Hoops Date: Wed, 15 May 2024 08:56:00 -0600 Subject: [PATCH 05/10] chore: add swapscott shuttles to stops on route --- apps/state/config/config.exs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/state/config/config.exs b/apps/state/config/config.exs index 7ef4b2fb..a283511c 100644 --- a/apps/state/config/config.exs +++ b/apps/state/config/config.exs @@ -196,6 +196,9 @@ config :state, :stops_on_route, "Shuttle-LynnNorthStationExpress-0-" => true, "Shuttle-LynnSwampscott-0-" => true, "Shuttle-NorthStationSwampscott-0-" => true, + "Shuttle-NorthStationSwampscottLimited-0-" => true, + "Shuttle-NorthStationSwampscottLocal-0-" => true, + "Shuttle-NorthStationSwampscottExpress-0-" => true, "CR-Newburyport-adde8a7c-" => true, "CR-Newburyport-76fa2c91-" => true, "CR-Newburyport-173cb7ae-" => true, From 4a5bea21eaa3823b9544206548b671c43cf01663 Mon Sep 17 00:00:00 2001 From: Walton Hoops Date: Wed, 15 May 2024 09:26:22 -0600 Subject: [PATCH 06/10] fix: Log an error but don't fail when we can't parse an alert cause --- apps/parse/lib/parse/alerts.ex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/parse/lib/parse/alerts.ex b/apps/parse/lib/parse/alerts.ex index 736bafc0..7cc95059 100644 --- a/apps/parse/lib/parse/alerts.ex +++ b/apps/parse/lib/parse/alerts.ex @@ -6,6 +6,7 @@ defmodule Parse.Alerts do the basic field set. """ + require Logger use Timex alias Model.Alert @@ -75,6 +76,11 @@ defmodule Parse.Alerts do copy(cause) end + defp cause(alert) do + Logger.error("No cause found in alert: #{inspect(alert)}") + "" + end + def lifecycle("ONGOING"), do: "ONGOING" def lifecycle("UPCOMING"), do: "UPCOMING" def lifecycle(<<"UPCOMING", _::binary-1, "ONGOING">>), do: "ONGOING_UPCOMING" From e7fa868d848c2b2de6be48ffb45774414400873f Mon Sep 17 00:00:00 2001 From: Joshua Fabian Date: Mon, 13 May 2024 13:58:51 -0400 Subject: [PATCH 07/10] chore: Enforce ordering for more of Providence/Stoughton Line --- apps/state/config/config.exs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/apps/state/config/config.exs b/apps/state/config/config.exs index a283511c..9daebf50 100644 --- a/apps/state/config/config.exs +++ b/apps/state/config/config.exs @@ -367,7 +367,30 @@ config :state, :stops_on_route, [ "place-rugg", "place-forhl", - "place-NEC-2203" + "place-NEC-2203", + "place-DB-0095" + ], + [ + "place-NEC-2040", + "place-NEC-1969", + "place-NEC-1919", + "place-NEC-1891", + "place-NEC-1851" + ] + ], + {"CR-Providence", 1} => [ + [ + "place-NEC-1851", + "place-NEC-1891", + "place-NEC-1919", + "place-NEC-1969", + "place-NEC-2040" + ], + [ + "place-DB-0095", + "place-NEC-2203", + "place-forhl", + "place-rugg" ] ], {"CR-Greenbush", 0} => [ From 5e51f414502ce14da14c9d7febea54d729084d79 Mon Sep 17 00:00:00 2001 From: Joshua Fabian Date: Mon, 13 May 2024 14:00:02 -0400 Subject: [PATCH 08/10] chore: Readville shows as Providence/Stoughton Line station --- apps/state/config/config.exs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/state/config/config.exs b/apps/state/config/config.exs index 9daebf50..7c40410b 100644 --- a/apps/state/config/config.exs +++ b/apps/state/config/config.exs @@ -479,8 +479,7 @@ config :state, :stops_on_route, "place-DB-2240", "place-DB-2230", "place-DB-2222", - "place-DB-2205", - "place-DB-0095" + "place-DB-2205" ], {"CR-Providence", 1} => [ "place-DB-2265", @@ -489,8 +488,7 @@ config :state, :stops_on_route, "place-DB-2240", "place-DB-2230", "place-DB-2222", - "place-DB-2205", - "place-DB-0095" + "place-DB-2205" ], {"CR-Fairmount", 0} => [ "place-FB-0166", From eba31c888ef59816c082d352e480b6bb5547789c Mon Sep 17 00:00:00 2001 From: Joshua Fabian Date: Mon, 13 May 2024 17:45:20 -0400 Subject: [PATCH 09/10] fix: Show only valid stations on Franklin/Foxboro Line --- apps/state/config/config.exs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/apps/state/config/config.exs b/apps/state/config/config.exs index 7c40410b..f230bb25 100644 --- a/apps/state/config/config.exs +++ b/apps/state/config/config.exs @@ -461,7 +461,16 @@ config :state, :stops_on_route, "place-DB-2240", "place-DB-2230", "place-DB-2222", - "place-DB-2205" + "place-DB-2205", + "place-NEC-2173", + "place-NEC-2139", + "place-NEC-2108", + "place-NEC-2040", + "place-NEC-1919", + "place-NEC-1969", + "place-NEC-1851", + "place-NEC-1768", + "place-NEC-1659" ], {"CR-Franklin", 1} => [ "place-DB-2265", @@ -470,7 +479,16 @@ config :state, :stops_on_route, "place-DB-2240", "place-DB-2230", "place-DB-2222", - "place-DB-2205" + "place-DB-2205", + "place-NEC-2173", + "place-NEC-2139", + "place-NEC-2108", + "place-NEC-2040", + "place-NEC-1919", + "place-NEC-1969", + "place-NEC-1851", + "place-NEC-1768", + "place-NEC-1659" ], {"CR-Providence", 0} => [ "place-DB-2265", From 8f4f9d5aa462d311b163bdbc084855486a35c15e Mon Sep 17 00:00:00 2001 From: Joshua Fabian Date: Mon, 13 May 2024 18:40:07 -0400 Subject: [PATCH 10/10] chore: Show Fairmount Line stations on Franklin/Foxboro Line --- apps/state/config/config.exs | 43 +++++++++++-------- apps/state/test/state/stops_on_route_test.exs | 32 ++++++++------ 2 files changed, 45 insertions(+), 30 deletions(-) diff --git a/apps/state/config/config.exs b/apps/state/config/config.exs index f230bb25..27cb1c69 100644 --- a/apps/state/config/config.exs +++ b/apps/state/config/config.exs @@ -264,14 +264,35 @@ config :state, :stops_on_route, config :state, :stops_on_route, stop_order_overrides: %{ {"CR-Franklin", 0} => [ - ["Norwood Central", "Windsor Gardens", "Plimptonville", "Walpole"], + [ + "place-NEC-2203", + "place-DB-2265", + "place-DB-2258", + "place-DB-2249", + "place-DB-2240", + "place-DB-2230", + "place-DB-2222", + "place-DB-2205", + "place-DB-0095", + "place-FB-0109" + ], ["place-FB-0148", "place-FB-0166", "place-FB-0177", "place-FB-0191"], - ["Walpole", "Foxboro", "Norfolk"], ["place-FB-0191", "place-FS-0049", "place-FB-0230"] ], {"CR-Franklin", 1} => [ - ["Norfolk", "Foxboro", "Walpole"], - ["place-FB-0230", "place-FS-0049", "place-FB-0191"] + ["place-FB-0230", "place-FS-0049", "place-FB-0191"], + [ + "place-FB-0109", + "place-DB-0095", + "place-DB-2205", + "place-DB-2222", + "place-DB-2230", + "place-DB-2240", + "place-DB-2249", + "place-DB-2258", + "place-DB-2265", + "place-NEC-2203" + ] ], {"CR-Fairmount", 0} => [ ["Readville", "Dedham Corp Center", "Foxboro"], @@ -455,13 +476,6 @@ config :state, :stops_on_route, config :state, :stops_on_route, not_on_route: %{ {"CR-Franklin", 0} => [ - "place-DB-2265", - "place-DB-2258", - "place-DB-2249", - "place-DB-2240", - "place-DB-2230", - "place-DB-2222", - "place-DB-2205", "place-NEC-2173", "place-NEC-2139", "place-NEC-2108", @@ -473,13 +487,6 @@ config :state, :stops_on_route, "place-NEC-1659" ], {"CR-Franklin", 1} => [ - "place-DB-2265", - "place-DB-2258", - "place-DB-2249", - "place-DB-2240", - "place-DB-2230", - "place-DB-2222", - "place-DB-2205", "place-NEC-2173", "place-NEC-2139", "place-NEC-2108", diff --git a/apps/state/test/state/stops_on_route_test.exs b/apps/state/test/state/stops_on_route_test.exs index f6c5eb55..8947da46 100644 --- a/apps/state/test/state/stops_on_route_test.exs +++ b/apps/state/test/state/stops_on_route_test.exs @@ -285,10 +285,10 @@ defmodule State.StopsOnRouteTest do test "shows Plimptonville after Windsor Gardens even when they don't share a trip" do State.Stop.new_state([ %Model.Stop{id: "place-sstat"}, - %Model.Stop{id: "Windsor Gardens"}, - %Model.Stop{id: "Plimptonville"}, - %Model.Stop{id: "Walpole"}, - %Model.Stop{id: "Franklin"} + %Model.Stop{id: "place-FB-0166"}, + %Model.Stop{id: "place-FB-0177"}, + %Model.Stop{id: "place-FB-0191"}, + %Model.Stop{id: "place-FB-0275"} ]) State.Route.new_state([%Model.Route{id: "CR-Franklin"}]) @@ -310,28 +310,36 @@ defmodule State.StopsOnRouteTest do State.Schedule.new_state([ %Model.Schedule{trip_id: "via-plimptonville", stop_id: "place-sstat", stop_sequence: 1}, - %Model.Schedule{trip_id: "via-plimptonville", stop_id: "Plimptonville", stop_sequence: 2}, - %Model.Schedule{trip_id: "via-plimptonville", stop_id: "Franklin", stop_sequence: 3}, + %Model.Schedule{trip_id: "via-plimptonville", stop_id: "place-FB-0177", stop_sequence: 2}, + %Model.Schedule{trip_id: "via-plimptonville", stop_id: "place-FB-0275", stop_sequence: 3}, # Windsor Gardens trip has more stops because this bug only shows up when the merge # has windor gardens on the left and plimptonville on the right. # They're sorted by length before merging, so this forces them to be in the order to make the bug appear. %Model.Schedule{trip_id: "via-windsor-gardens", stop_id: "place-sstat", stop_sequence: 1}, %Model.Schedule{ trip_id: "via-windsor-gardens", - stop_id: "Windsor Gardens", + stop_id: "place-FB-0166", stop_sequence: 2 }, - %Model.Schedule{trip_id: "via-windsor-gardens", stop_id: "Walpole", stop_sequence: 3}, - %Model.Schedule{trip_id: "via-windsor-gardens", stop_id: "Franklin", stop_sequence: 4} + %Model.Schedule{ + trip_id: "via-windsor-gardens", + stop_id: "place-FB-0191", + stop_sequence: 3 + }, + %Model.Schedule{ + trip_id: "via-windsor-gardens", + stop_id: "place-FB-0275", + stop_sequence: 4 + } ]) update!() stop_ids = by_route_id("CR-Franklin") - assert Enum.filter(stop_ids, &(&1 in ["Windsor Gardens", "Plimptonville"])) == [ - "Windsor Gardens", - "Plimptonville" + assert Enum.filter(stop_ids, &(&1 in ["place-FB-0166", "place-FB-0177"])) == [ + "place-FB-0166", + "place-FB-0177" ] end