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

feat: Filter out redundant outside elevator closures #2328

Merged
merged 9 commits into from
Dec 9, 2024

Conversation

cmaddox5
Copy link
Contributor

@cmaddox5 cmaddox5 commented Dec 3, 2024

Adds alert filtering based on presence of a redundant elevator. Only affects alerts outside the current station. CSV is here. Add some instructions to the script just in case the data is updated.


@cmaddox5 cmaddox5 requested a review from a team as a code owner December 3, 2024 20:13
Base automatically changed from cm/current-station-closure to main December 3, 2024 20:21
@cmaddox5 cmaddox5 force-pushed the cm/filter-out-redundant-closures branch from 1d8af7a to d5c12d4 Compare December 3, 2024 20:25
priv/elevators/elevator_station_data.csv Outdated Show resolved Hide resolved
priv/elevators/elevator_redundancy_data.json Outdated Show resolved Hide resolved
lib/screens/v2/candidate_generator/elevator/closures.ex Outdated Show resolved Hide resolved
lib/screens/v2/candidate_generator/elevator/closures.ex Outdated Show resolved Hide resolved
#!/usr/bin/env -S ERL_FLAGS=+B elixir

# Script used to format the spreadsheet found at
# https://docs.google.com/spreadsheets/d/1lHogme-2SuDSgjrRK52k7yVgSFK-v_LMmUfkYgBJjIU/edit?gid=179933470#gid=179933470
Copy link
Contributor

Choose a reason for hiding this comment

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

It occurs to me that this spreadsheet probably doesn't need to be public to the world, as the original copy is, given we are not programmatically downloading it. But we'd have to figure out what we're doing about access control on the team.

@cmaddox5 cmaddox5 force-pushed the cm/filter-out-redundant-closures branch from d5c12d4 to c6d3ed2 Compare December 5, 2024 13:41
@cmaddox5 cmaddox5 force-pushed the cm/filter-out-redundant-closures branch from 61177c3 to 53e79fb Compare December 6, 2024 13:43
Copy link
Contributor

@digitalcora digitalcora left a comment

Choose a reason for hiding this comment

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

One minor question. I'm also noticing there are no new/updated tests for this behavior; we should have something there.

# relevant at other stations.
defp relevant_alert?(alert, home_stop_id) do
relevant_effect?(alert) and informs_one_facility?(alert) and
(Alert.informs_stop_id?(alert, home_stop_id) or not has_nearby_redundancy?(alert))
Copy link
Contributor

Choose a reason for hiding this comment

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

When an alert informs a facility, does it also always inform the facility's parent station? This isn't necessarily true of GTFS in general but I'd believe that it's a guarantee of our alerts implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I can tell, yes. I think it always includes the parent + every child stop not flagged for exclusion in the properties field for the facility.

@cmaddox5
Copy link
Contributor Author

cmaddox5 commented Dec 6, 2024

I'm also noticing there are no new/updated tests for this behavior; we should have something there.

Thanks for the callout. Added a test for this. I'm not sure I'm happy with how I handled the file path now that we have a test fixture so any suggestions is appreciated.

@cmaddox5 cmaddox5 force-pushed the cm/filter-out-redundant-closures branch from 21f85dc to 2344e9b Compare December 6, 2024 19:19
@cmaddox5 cmaddox5 force-pushed the cm/filter-out-redundant-closures branch from 2344e9b to 80e8623 Compare December 6, 2024 19:43
@cmaddox5 cmaddox5 merged commit 3992f12 into main Dec 9, 2024
11 checks passed
@cmaddox5 cmaddox5 deleted the cm/filter-out-redundant-closures branch December 9, 2024 16:34
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