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

replace wheelchair with pedestrianProfile and useRoutedTransfers params #683

Merged
merged 2 commits into from
Dec 10, 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
48 changes: 44 additions & 4 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ paths:

- name: maxMatchingDistance
in: query
required: true
required: false
description: |
Optional. Default is 25 meters.

Expand All @@ -419,10 +419,25 @@ paths:
type: number
default: 25

- name: wheelchair
- name: pedestrianProfile
in: query
required: false
description: |
Optional. Default is `FOOT`.

Accessibility profile to use for pedestrian routing in transfers
between transit connections, on the first mile, and last mile.
schema:
$ref: '#/components/schemas/PedestrianProfile'
default: FOOT

- name: useRoutedTransfers
in: query
description: Whether the trip must be wheelchair accessible.
required: false
description: |
Optional. Default is `false`.

Whether to use transfers routed on OpenStreetMap data.
schema:
type: boolean
default: false
Expand Down Expand Up @@ -500,6 +515,8 @@ paths:
in: query
required: false
description: |
Experimental. Expect unannounced breaking changes (without version bumps).

Optional. Only applies to direct connections.

A list of vehicle type form factors that are allowed to be used for direct connections.
Expand All @@ -515,6 +532,8 @@ paths:
in: query
required: false
description: |
Experimental. Expect unannounced breaking changes (without version bumps).

Optional. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalFormFactors`).

A list of vehicle type form factors that are allowed to be used from the `from` coordinate to the first transit stop.
Expand All @@ -530,6 +549,8 @@ paths:
in: query
required: false
description: |
Experimental. Expect unannounced breaking changes (without version bumps).

Optional. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalFormFactors`).

A list of vehicle type form factors that are allowed to be used from the last transit stop to the `to` coordinate.
Expand All @@ -545,6 +566,8 @@ paths:
in: query
required: false
description: |
Experimental. Expect unannounced breaking changes (without version bumps).

Optional. Only applies to direct connections.

A list of vehicle type form factors that are allowed to be used for direct connections.
Expand All @@ -560,6 +583,8 @@ paths:
in: query
required: false
description: |
Experimental. Expect unannounced breaking changes (without version bumps).

Optional. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalPropulsionTypes`).

A list of vehicle propulsion types that are allowed to be used from the `from` coordinate to the first transit stop.
Expand All @@ -575,6 +600,8 @@ paths:
in: query
required: false
description: |
Experimental. Expect unannounced breaking changes (without version bumps).

Optional. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalPropulsionTypes`).

A list of vehicle propulsion types that are allowed to be used from the last transit stop to the `to` coordinate.
Expand All @@ -590,6 +617,8 @@ paths:
in: query
required: false
description: |
Experimental. Expect unannounced breaking changes (without version bumps).

Optional. Only applies to direct connections.

A list of rental providers that are allowed to be used for direct connections.
Expand All @@ -603,6 +632,8 @@ paths:
in: query
required: false
description: |
Experimental. Expect unannounced breaking changes (without version bumps).

Optional. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalProviders`).

A list of rental providers that are allowed to be used from the `from` coordinate to the first transit stop.
Expand All @@ -616,6 +647,8 @@ paths:
in: query
required: false
description: |
Experimental. Expect unannounced breaking changes (without version bumps).

Optional. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalProviders`).

A list of rental providers that are allowed to be used from the last transit stop to the `to` coordinate.
Expand Down Expand Up @@ -1070,13 +1103,20 @@ components:
description: score according to the internal scoring system (the scoring algorithm might change in the future)
type: number

PedestrianProfile:
description: Different accessibility profiles for pedestrians.
type: string
enum:
- FOOT
- WHEELCHAIR

Mode:
description: |
# Street modes

- `WALK`
- `BIKE`
- `RENTAL`
- `RENTAL` Experimental. Expect unannounced breaking changes (without version bumps).
- `CAR`
- `CAR_PARKING`

Expand Down
30 changes: 23 additions & 7 deletions src/endpoints/routing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,9 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const {
? route_direct(e, gbfs_rd, from_p, to_p, direct_modes,
query.directRentalFormFactors_,
query.directRentalPropulsionTypes_,
query.directRentalProviders_, *t, query.wheelchair_,
query.directRentalProviders_, *t,
query.pedestrianProfile_ ==
api::PedestrianProfileEnum::WHEELCHAIR,
std::chrono::seconds{query.maxDirectTime_})
: std::pair{std::vector<api::Itinerary>{}, kInfinityDuration};
UTL_STOP_TIMING(direct);
Expand All @@ -469,7 +471,8 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const {
return get_offsets(
pos, dir, start_modes, start_form_factors,
start_propulsion_types, start_rental_providers,
query.wheelchair_,
query.pedestrianProfile_ ==
api::PedestrianProfileEnum::WHEELCHAIR,
std::chrono::seconds{query.maxPreTransitTime_},
query.maxMatchingDistance_, gbfs_rd);
}},
Expand All @@ -483,7 +486,8 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const {
return get_offsets(
pos, dir, dest_modes, dest_form_factors,
dest_propulsion_types, dest_rental_providers,
query.wheelchair_,
query.pedestrianProfile_ ==
api::PedestrianProfileEnum::WHEELCHAIR,
std::chrono::seconds{query.maxPostTransitTime_},
query.maxMatchingDistance_, gbfs_rd);
}},
Expand All @@ -498,7 +502,9 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const {
? osr::direction::kBackward
: osr::direction::kForward;
return get_td_offsets(
*e, pos, dir, start_modes, query.wheelchair_,
*e, pos, dir, start_modes,
query.pedestrianProfile_ ==
api::PedestrianProfileEnum::WHEELCHAIR,
std::chrono::seconds{query.maxPreTransitTime_});
}},
start)
Expand All @@ -513,7 +519,9 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const {
? osr::direction::kForward
: osr::direction::kBackward;
return get_td_offsets(
*e, pos, dir, dest_modes, query.wheelchair_,
*e, pos, dir, dest_modes,
query.pedestrianProfile_ ==
api::PedestrianProfileEnum::WHEELCHAIR,
std::chrono::seconds{
query.maxPostTransitTime_});
}},
Expand All @@ -530,7 +538,13 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const {
.min_connection_count_ = static_cast<unsigned>(query.numItineraries_),
.extend_interval_earlier_ = start_time.extend_interval_earlier_,
.extend_interval_later_ = start_time.extend_interval_later_,
.prf_idx_ = static_cast<n::profile_idx_t>(query.wheelchair_ ? 2U : 1U),
.prf_idx_ = static_cast<n::profile_idx_t>(
query.useRoutedTransfers_
? (query.pedestrianProfile_ ==
api::PedestrianProfileEnum::WHEELCHAIR
? 2U
: 1U)
: 0U),
.allowed_claszes_ = to_clasz_mask(query.transitModes_),
.require_bike_transport_ = query.requireBikeTransport_,
.transfer_time_settings_ =
Expand Down Expand Up @@ -585,7 +599,9 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const {
[&, cache = street_routing_cache_t{}](auto&& j) mutable {
return journey_to_response(
w_, l_, pl_, *tt_, *tags_, e, rtt, matches_, shapes_, gbfs_rd,
query.wheelchair_, j, start, dest, cache, *blocked);
query.pedestrianProfile_ ==
api::PedestrianProfileEnum::WHEELCHAIR,
j, start, dest, cache, *blocked);
}),
.previousPageCursor_ =
fmt::format("EARLIER|{}", to_seconds(r.interval_.from_)),
Expand Down
5 changes: 4 additions & 1 deletion test/routing_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ TEST(motis, routing) {
"&toPlace=50.11347,8.67664"
"&time=2019-05-01T01:25Z"
"&timetableView=false"
"&useRoutedTransfers=true"
"&preTransitModes=WALK,RENTAL");

auto ss = std::stringstream{};
Expand All @@ -422,7 +423,8 @@ TEST(motis, routing) {
"?fromPlace=49.87263,8.63127"
"&toPlace=50.11347,8.67664"
"&time=2019-05-01T01:25Z"
"&wheelchair=true"
"&pedestrianProfile=WHEELCHAIR"
"&useRoutedTransfers=true"
"&timetableView=false");

auto ss = std::stringstream{};
Expand All @@ -447,6 +449,7 @@ TEST(motis, routing) {
"?fromPlace=49.87263,8.63127"
"&toPlace=50.11347,8.67664"
"&time=2019-05-01T01:25Z"
"&useRoutedTransfers=true"
"&timetableView=false");

auto ss = std::stringstream{};
Expand Down
8 changes: 7 additions & 1 deletion ui/src/lib/openapi/schemas.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,18 @@ export const MatchSchema = {
}
} as const;

export const PedestrianProfileSchema = {
description: 'Different accessibility profiles for pedestrians.',
type: 'string',
enum: ['FOOT', 'WHEELCHAIR']
} as const;

export const ModeSchema = {
description: `# Street modes

- \`WALK\`
- \`BIKE\`
- \`RENTAL\`
- \`RENTAL\` Experimental. Expect unannounced breaking changes (without version bumps).
- \`CAR\`
- \`CAR_PARKING\`

Expand Down
Loading
Loading