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

If configured, add subway station entrances from OSM to walk steps #6343

Merged

Conversation

leonardehrenfried
Copy link
Member

Summary

This takes over from #6076. We led @HenrikSundell down a few dead-ends which I'm sorry about.

I have analysed the problem of the inheritance of TransitEntranceVertex and StationEntranceVertex and have concluded that it's a problem that is too big to be solved in this PR.

The big question we have to answer is if we want to flatten the Vertex hierarchy and rely less on instanceOf checks to describe vertex behaviour. If we have clarified what we want (of which I'm not sure myself) we can change the code and unify TransitEntranceVertex and StationEntranceVertex.

Issue

Closes #6078

Unit tests

Tests added.

Bumping the serialization version id

✔️

cc @optionsome

HenrikSundell and others added 30 commits September 18, 2024 17:22
# Conflicts:
#	application/src/main/java/org/opentripplanner/model/plan/Entrance.java
#	application/src/main/java/org/opentripplanner/model/plan/StepEntity.java
#	application/src/main/java/org/opentripplanner/street/model/vertex/StationEntranceVertex.java
#	application/src/main/java/org/opentripplanner/street/model/vertex/VertexFactory.java
#	application/src/main/java/org/opentripplanner/transit/service/datafetchers/StepEntityTypeResolver.java
#	doc/user/BuildConfiguration.md
Co-authored-by: Joel Lappalainen <lappalj8@gmail.com>
Co-authored-by: Joel Lappalainen <lappalj8@gmail.com>
@optionsome
Copy link
Member

Can you add a bit of documentation for the RelativeDirection enum in the schema as well to document this CONTINUE/ENTER_STATION/EXIT_STATION relationship.

Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 59.81308% with 43 lines in your changes missing coverage. Please review.

Project coverage is 69.79%. Comparing base (2d012a3) to head (74106b5).
Report is 51 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...ing/algorithm/mapping/StatesToWalkStepsMapper.java 25.00% 11 Missing and 1 partial ⚠️
...ner/street/model/vertex/StationEntranceVertex.java 0.00% 12 Missing ⚠️
...ipplanner/apis/gtfs/datafetchers/EntranceImpl.java 78.57% 3 Missing ⚠️
...nner/graph_builder/module/osm/VertexGenerator.java 40.00% 2 Missing and 1 partial ⚠️
...pis/gtfs/datafetchers/StepFeatureTypeResolver.java 66.66% 1 Missing and 1 partial ⚠️
..._builder/module/configure/GraphBuilderModules.java 0.00% 2 Missing ⚠️
...ner/graph_builder/module/osm/OsmModuleBuilder.java 33.33% 2 Missing ⚠️
...r/street/model/edge/StreetTransitEntranceLink.java 60.00% 1 Missing and 1 partial ⚠️
...r/apis/transmodel/model/plan/PathGuidanceType.java 50.00% 1 Missing ⚠️
...er/graph_builder/module/osm/ElevatorProcessor.java 50.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6343      +/-   ##
=============================================
- Coverage      69.85%   69.79%   -0.07%     
- Complexity     17922    17956      +34     
=============================================
  Files           2035     2045      +10     
  Lines          76495    76737     +242     
  Branches        7824     7834      +10     
=============================================
+ Hits           53435    53557     +122     
- Misses         20324    20434     +110     
- Partials        2736     2746      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@leonardehrenfried
Copy link
Member Author

leonardehrenfried commented Jan 2, 2025

Can you add a bit of documentation for the RelativeDirection enum in the schema as well to document this CONTINUE/ENTER_STATION/EXIT_STATION relationship.

Done in 0b6a74a

Comment on lines 3550 to 3551
- Passing through a station entrance or exit when it is not know whether the passenger is
entering or exiting. If known then entrance information is in the `step.entity` field.
Copy link
Member

Choose a reason for hiding this comment

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

It's a bit vague here what the "known" refers here to. Currently if it's known that are we entering or exiting a station, this information is not exposed, right? However, I think you are trying to refer to the other station information here. You could cross reference to the ENTER/EXIT_STATION here so it's more clear that those enum values are related. The step field is now called feature, not entity.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, correct, if we are entering/exiting we get the information from pathways but don't actually add the entity feature.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, it wasn't a lot of work to extract the Entrance from the pathway data so I did it here instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if you want to keep the "if available" line then.

@leonardehrenfried
Copy link
Member Author

@optionsome It doesn't appear possible to map two internal enum values to the same API value. For that reason I added a mapper that does this before it even gets to the GraphQL library code.

@@ -75,6 +84,18 @@ void testMap() {
assertEquals("DocumentedEnumMapping[apiName=iH, internal=Hi]", mapping.toString());
}

@ParameterizedTest
@EnumSource(RelativeDirection.class)
Copy link
Member

Choose a reason for hiding this comment

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

Cool, didn't know this was possible.

Comment on lines +27 to +30
case ENTER_STATION,
EXIT_STATION,
ENTER_OR_EXIT_STATION,
FOLLOW_SIGNS -> RelativeDirection.CONTINUE;
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the late response here, but this can be dropped. We will just add the new enum values to the Transmodel GraphQL API - I can do it if you want.

The JS GraphQL lib has a validator to compare to schema files for breaking changes - adding Enum values are considered a dangerous change - not a braking change. It should be handled by defensive programming on the client side. So, at entur we want to add the new enum values and we will cross fingers and hope our clients did the right thing.

Copy link
Member

Choose a reason for hiding this comment

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

I also want to add a better unit-test to the enums we have today - so I can do that in the same change.

Copy link
Member

Choose a reason for hiding this comment

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

Could/should we create a CI test for validating that we are not creating breaking schema changes with the JS GraphQL lib?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we still need the mapper so to we don't ever expose ENTER_OR_EXIT_STATION.

@leonardehrenfried leonardehrenfried merged commit 2691404 into opentripplanner:dev-2.x Jan 16, 2025
5 checks passed
t2gran pushed a commit that referenced this pull request Jan 16, 2025
t2gran pushed a commit that referenced this pull request Jan 16, 2025
@leonardehrenfried leonardehrenfried deleted the station-entrances branch January 16, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump serialization id Add this label if you want the serialization id automatically bumped after merging the PR Config Change New Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subway entrance names
5 participants