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

Add zonal ODT params #4332

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion source/jormungandr/jormungandr/interfaces/v1/journey_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@
FloatRange,
KeyValueType,
PositiveFloat,
PositiveInteger,
)
from navitiacommon import type_pb2
from navitiacommon import type_pb2, default_values

BICYCLE_TYPES = [t for t, _ in type_pb2.BicycleType.items()]

Expand Down Expand Up @@ -881,6 +882,21 @@ def __init__(self, output_type_serializer):
hidden=True,
help="whether or not to use predicted/historical traffic data for routing, it affects only car/car_no_park mode in Asgard",
)
parser_get.add_argument(
"_use_zonal_odt",
type=BooleanType(),
default=False,
hidden=True,
help="only available for Loki: " "Use zonal ODT in fallback.",
)
parser_get.add_argument(
"_max_waiting_duration_odt",
type=PositiveInteger(),
default=default_values.max_waiting_duration_odt,
hidden=True,
help='A journey containing a waiting section between TC and Zonal ODT with a duration greater to max_waiting_duration_odt '
'will be discarded. Units : seconds. Must be > 0. Default value : 30 minutes',
)

def parse_args(self, region=None, uri=None):
args = self.parsers['get'].parse_args()
Expand Down
4 changes: 4 additions & 0 deletions source/jormungandr/jormungandr/pt_planners/pt_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def __init__(
departure_coord=None,
arrival_coord=None,
global_max_speed=None,
use_zonal_odt=False,
max_waiting_duration_odt=default_values.max_waiting_duration_odt,
):

self.max_duration = max_duration
Expand Down Expand Up @@ -106,6 +108,8 @@ def __init__(
self.departure_coord = departure_coord
self.arrival_coord = arrival_coord
self.global_max_speed = global_max_speed
self.use_zonal_odt = use_zonal_odt
self.max_waiting_duration_odt = max_waiting_duration_odt


# Needed for GraphicalIsochrones
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ def _create_parameters(
if self._requested_dest_obj
else None,
global_max_speed=request["_global_max_speed"],
use_zonal_odt=request["_use_zonal_odt"],
max_waiting_duration_odt=request["_max_waiting_duration_odt"],
)

def _async_request(self):
Expand Down
2 changes: 2 additions & 0 deletions source/jormungandr/jormungandr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,8 @@ def _set_arrival_attractivity(stop_point_id, location):
)
)
req.journeys.global_max_speed = journey_parameters.global_max_speed
req.journeys.use_zonal_odt = journey_parameters.use_zonal_odt
req.journeys.max_waiting_duration_odt = journey_parameters.max_waiting_duration_odt
####################

return req
Expand Down
2 changes: 1 addition & 1 deletion source/navitia-proto
Submodule navitia-proto updated 1 files
+17 −15 request.proto
2 changes: 2 additions & 0 deletions source/navitiacommon/navitiacommon/default_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@

additional_parameters = False

max_waiting_duration_odt = 30 * 60 # 30 minutes

ghost_words = [] # type: List[str]

# {
Expand Down