-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Filter import of rental data by pickup type #6240
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
Changes from 1 commit
3a1f3de
55e7913
985817a
e516350
993bed1
49a0f78
42c318f
39750a2
f148008
7735de7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,32 @@ | ||
| package org.opentripplanner.updater.vehicle_rental.datasources.params; | ||
|
|
||
| public enum AllowedRentalType { | ||
| STATIONS, | ||
| VEHICLES, | ||
| ALL, | ||
| import org.opentripplanner.framework.doc.DocumentedEnum; | ||
|
|
||
| /** | ||
| * This is temporary and will be removed in a future version of OTP. | ||
| * | ||
| * Enum to specify the type of rental data that is allowed to be read from the data source. | ||
| */ | ||
| public enum AllowedRentalType implements DocumentedEnum<AllowedRentalType> { | ||
|
||
| STATIONS("Only station data is allowed."), | ||
| VEHICLES("Only vehicle data is allowed."), | ||
| ALL("All types of rental data are allowed."); | ||
|
|
||
| private final String description; | ||
|
|
||
| AllowedRentalType(String description) { | ||
| this.description = description.stripIndent().trim(); | ||
| } | ||
|
|
||
| @Override | ||
| public String typeDescription() { | ||
| return ( | ||
| "Temporary parameter. Use this to specify the type of rental data that is allowed to be read from the data source." | ||
| ); | ||
| } | ||
|
|
||
| @Override | ||
| public String enumValueDescription() { | ||
| return description; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,6 @@ | ||||||||
| package org.opentripplanner.updater.vehicle_rental.datasources.params; | ||||||||
|
|
||||||||
| import java.util.Objects; | ||||||||
| import org.opentripplanner.updater.spi.HttpHeaders; | ||||||||
| import org.opentripplanner.updater.vehicle_rental.VehicleRentalSourceType; | ||||||||
|
|
||||||||
|
|
@@ -14,6 +15,9 @@ public record GbfsVehicleRentalDataSourceParameters( | |||||||
| AllowedRentalType allowedRentalType | ||||||||
|
||||||||
| public AlertUrl { | |
| Objects.requireNonNull(uri); | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -313,19 +313,19 @@ GBFS form factors: | |
| <!-- vehicle-rental BEGIN --> | ||
| <!-- NOTE! This section is auto-generated. Do not change, change doc in code instead. --> | ||
|
|
||
| | Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | | ||
| |---------------------------------------------------------------------------------------|:---------------:|---------------------------------------------------------------------------------|:----------:|---------------|:-----:| | ||
| | type = "vehicle-rental" | `enum` | The type of the updater. | *Required* | | 1.5 | | ||
| | [allowKeepingRentedVehicleAtDestination](#u_1_allowKeepingRentedVehicleAtDestination) | `boolean` | If a vehicle should be allowed to be kept at the end of a station-based rental. | *Optional* | `false` | 2.1 | | ||
| | [allowedRentalType](#u_1_allowedRentalType) | `enum` | Temporary parameter. The type of rental data to include. | *Optional* | `"all"` | 2.7 | | ||
| | frequency | `duration` | How often the data should be updated. | *Optional* | `"PT1M"` | 1.5 | | ||
| | [geofencingZones](#u_1_geofencingZones) | `boolean` | Compute rental restrictions based on GBFS 2.2 geofencing zones. | *Optional* | `false` | 2.3 | | ||
| | language | `string` | TODO | *Optional* | | 2.1 | | ||
| | [network](#u_1_network) | `string` | The name of the network to override the one derived from the source data. | *Optional* | | 1.5 | | ||
| | overloadingAllowed | `boolean` | Allow leaving vehicles at a station even though there are no free slots. | *Optional* | `false` | 2.2 | | ||
| | [sourceType](#u_1_sourceType) | `enum` | What source of vehicle rental updater to use. | *Required* | | 1.5 | | ||
| | url | `string` | The URL to download the data from. | *Required* | | 1.5 | | ||
| | [headers](#u_1_headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 1.5 | | ||
| | Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | | ||
| |---------------------------------------------------------------------------------------|:---------------:|-------------------------------------------------------------------------------------------------------------------|:----------:|---------------|:-----:| | ||
| | type = "vehicle-rental" | `enum` | The type of the updater. | *Required* | | 1.5 | | ||
| | [allowKeepingRentedVehicleAtDestination](#u_1_allowKeepingRentedVehicleAtDestination) | `boolean` | If a vehicle should be allowed to be kept at the end of a station-based rental. | *Optional* | `false` | 2.1 | | ||
| | [allowedRentalType](#u_1_allowedRentalType) | `enum` | Temporary parameter. Use this to specify the type of rental data that is allowed to be read from the data source. | *Optional* | `"all"` | 2.7 | | ||
| | frequency | `duration` | How often the data should be updated. | *Optional* | `"PT1M"` | 1.5 | | ||
| | [geofencingZones](#u_1_geofencingZones) | `boolean` | Compute rental restrictions based on GBFS 2.2 geofencing zones. | *Optional* | `false` | 2.3 | | ||
| | language | `string` | TODO | *Optional* | | 2.1 | | ||
| | [network](#u_1_network) | `string` | The name of the network to override the one derived from the source data. | *Optional* | | 1.5 | | ||
| | overloadingAllowed | `boolean` | Allow leaving vehicles at a station even though there are no free slots. | *Optional* | `false` | 2.2 | | ||
| | [sourceType](#u_1_sourceType) | `enum` | What source of vehicle rental updater to use. | *Required* | | 1.5 | | ||
| | url | `string` | The URL to download the data from. | *Required* | | 1.5 | | ||
| | [headers](#u_1_headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 1.5 | | ||
|
|
||
|
|
||
| ##### Parameter details | ||
|
|
@@ -353,15 +353,11 @@ For this to be possible three things need to be configured: | |
| **Path:** /updaters/[1] | ||
| **Enum values:** `stations` | `vehicles` | `all` | ||
|
|
||
| Temporary parameter. The type of rental data to include. | ||
| Temporary parameter. Use this to specify the type of rental data that is allowed to be read from the data source. | ||
|
|
||
| This parameter is temporary and will be removed in a future version of OTP. | ||
|
||
|
|
||
| The type of rental data to include. This can be one of the following: | ||
|
|
||
| - `ALL`: Include all data types. | ||
| - `STATIONS`: Include station data only. | ||
| - `VEHICLES`: Include floating vehicle data only. | ||
| - `stations` Only station data is allowed. | ||
| - `vehicles` Only vehicle data is allowed. | ||
| - `all` All types of rental data are allowed. | ||
|
|
||
|
|
||
| <h4 id="u_1_geofencingZones">geofencingZones</h4> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@optionsome / @leonardehrenfried What is the right name for this?
I would not include "Allowed" in the name, it restrict the type, so it can not be reused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the "type" (?) of the rental: either free-floating or station-based.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed that we want to use a Set of opt-in rental types. I've used the same pattern when filtering what to import from NeTEx:
OpenTripPlanner/application/src/main/java/org/opentripplanner/netex/loader/parser/NetexDocumentParser.java
Lines 82 to 84 in f4bfedf
In our case we probably want to use opt-in rather than opt-out as it's easier to reason about.