Skip to content

Add rental system to GraphQL API#5909

Merged
optionsome merged 21 commits into
opentripplanner:dev-2.xfrom
HSLdevcom:rentalvehicle-details
Jul 8, 2024
Merged

Add rental system to GraphQL API#5909
optionsome merged 21 commits into
opentripplanner:dev-2.xfrom
HSLdevcom:rentalvehicle-details

Conversation

@sharhio

@sharhio sharhio commented Jun 14, 2024

Copy link
Copy Markdown
Contributor

Summary

  1. RentalVehicleSystem is returned for rental vehicles. This is so that a the system url to an operator can be provided (especially when there is no vehicle specific link available.)
  2. Searching for nearest stations/vehicles can be filtered by networks. In some cases we only want to show the stations/vehicles of certain operators, and without filtering, the nearest search returns a very large amount of unnecessary data. The large amount of unwanted data coupled with a result limit makes most of the results unusable.
  3. Added an option for hiding networks from maplayers so that unnecessary data doesn't always need to be returned from otp. (For example, in cases where one only wants to show the vehicles of a network and never the stations.)
  4. Sometimes data is faulty and the name field contains an empty string, this causes an error in the FeedScopedId. Added an empty string check.

Unit tests

  • Added new parameters to unit tests.
  • Manual verification was done.

@sharhio
sharhio requested a review from a team as a code owner June 14, 2024 07:51
@codecov

codecov Bot commented Jun 14, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 77.27273% with 5 lines in your changes missing coverage. Please review.

Project coverage is 69.51%. Comparing base (2a5c8be) to head (87bda74).
Report is 38 commits behind head on dev-2.x.

Files Patch % Lines
...ntripplanner/apis/gtfs/generated/GraphQLTypes.java 50.00% 2 Missing ⚠️
...e_rental/datasources/GbfsGeofencingZoneMapper.java 0.00% 1 Missing and 1 partial ⚠️
...anner/apis/transmodel/TransmodelGraphQLSchema.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #5909      +/-   ##
=============================================
+ Coverage      69.45%   69.51%   +0.05%     
- Complexity     17070    17104      +34     
=============================================
  Files           1937     1938       +1     
  Lines          73692    73743      +51     
  Branches        7540     7547       +7     
=============================================
+ Hits           51184    51263      +79     
+ Misses         19880    19841      -39     
- Partials        2628     2639      +11     

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

@optionsome optionsome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not really sure if we should have the network filtering in the map layer or just do it in UI. The problem is that even though we might not want to show some networks in our UI, some other people might. On the other hand, setting this filter on a request level is not really feasible with the map layers. There is an option that we expose filtered and unfiltered versions of the map layer but there is some push towards unifying the map layers and this would be slightly away from it by adding yet another map layer that is only used by us.

Comment thread src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java Outdated
Comment thread src/main/java/org/opentripplanner/inspector/vector/LayerParameters.java Outdated
Comment thread src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls Outdated
Comment thread src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls Outdated
@leonardehrenfried
leonardehrenfried self-requested a review June 18, 2024 09:04
return environment -> getSource(environment).vehicleType;
}

@Override

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't want to expose core model classes directly in the API. Can you please add an Impl (=mapper) class just like RentalVehicleImpl?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have added a mapper.

@leonardehrenfried leonardehrenfried left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I want to see tests and the mapper class.

…ources/GbfsGeofencingZoneMapper.java

Co-authored-by: Leonard Ehrenfried <mail@leonard.io>
@leonardehrenfried leonardehrenfried changed the title Rental vehicle result and maplayer adjustments Add rental system to GraphQL API Jun 19, 2024
"ID of the vehicle in the format of network:id"
vehicleId: String
"The vehicle rental system information."
vehicleRentalSystem: VehicleRentalSystem

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We need to discuss in the developer meeting what to do with the naming of this field/type and if it's already too late to create a type for this.

@optionsome

Copy link
Copy Markdown
Member

This is now ready for review.

nearest places related to bicycling.
"""
filterByModes: [Mode],
"Only include vehicle rental networks that match one of the given network names."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the term "network name" is confusing here. Is it the network id?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While updating it, I noticed we could also make the list items non null so I did it in the same commit 87bda74

@leonardehrenfried leonardehrenfried left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a bit of documentation.

@optionsome

Copy link
Copy Markdown
Member

I've approved this now to get rid of my old review but I'll wait for @vpaturet 's review before merging.

@vpaturet vpaturet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good

@optionsome
optionsome merged commit e508838 into opentripplanner:dev-2.x Jul 8, 2024
@optionsome
optionsome deleted the rentalvehicle-details branch July 8, 2024 18:57
t2gran pushed a commit that referenced this pull request Jul 8, 2024
@t2gran t2gran added this to the 2.6 (next release) milestone Jul 23, 2024
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.

5 participants