Skip to content

バス路線に専用の速度プロファイルを追加し地下鉄・優等列車扱いによるETA過小評価を修正する - #1580

Merged
TinyKitten merged 1 commit into
devfrom
claude/toei-bus-ikebukuro-65-eta-68oi8b
Jul 2, 2026
Merged

TinyKitten merged 1 commit into
devfrom
claude/toei-bus-ikebukuro-65-eta-68oi8b

Conversation

@TinyKitten

Copy link
Copy Markdown
Member

概要

GTFS由来のバス路線が到着時間推定で「地下鉄の優等列車」(最高速度 75km/h × 1.2 = 90km/h)として扱われていた問題を修正し、transport_type で判定するバス専用の速度プロファイルを追加する。

変更の種類

  • バグ修正
  • 新機能
  • データの修正・追加
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

  • GTFSインポートはバス路線の line_type にGTFSの route_type(バス=3)をそのまま格納しており、StationAPIの路線種別(3=地下鉄)と衝突するため、ETA推定でバスが基本速度75km/hの地下鉄として扱われていた。さらにバス経路の kind=7(BusRoute)が優等種別判定(kind != 0 → ×1.2)に該当し、最高速度90km/hで計算されていた
  • 停留所間隔が短い市街地路線(池65など)では加減速支配のため影響が出ないが、停留所間隔の長い区間(約3km)では所要時間が約3.4分と大幅に過小評価される(実態は約5.7分)
  • arrival_estimation.rs に transport_type == Bus で判定する専用プロファイルを追加: 最高速度 BUS_MAX_SPEED_KMH = 50.0(優等補正×1.2はバイパス)、フォールバック迂回係数 BUS_FALLBACK_DETOUR = 1.30(道路)
  • max_speed_kmh / fallback_detour_factor / detour_factor_for / detour_factors_by_line に transport_type を伝搬(変更は arrival_estimation.rs に閉じており、proto・インポート・リポジトリ層の変更なし)
  • テスト追加: 都営バス池65 落合南長崎駅前→目白駅前相当(約300m×7区間)の較正テスト(実乗車時間約10分と整合)、長距離区間が鉄道速度で巡航しないことの回帰テスト、kind=7 に優等補正が掛からないことのガード

テスト

  • cargo fmt --all -- --check が通ること
  • cargo clippy -- -D warnings が通ること
  • cargo test(SQLX_OFFLINE=true)が通ること

関連Issue

スクリーンショット(任意)

🤖 Generated with Claude Code

https://claude.ai/code/session_01KZrVUqfmEjpBcmNbF4ZyG8


Generated by Claude Code

GTFSインポートはバス路線のline_typeにGTFSのroute_type(バス=3)をそのまま
格納しており、StationAPIの路線種別(3=地下鉄)と衝突するため、ETA推定で
バスが基本速度75km/hの地下鉄として扱われていた。さらにバス経路の
kind=7(BusRoute)が優等種別判定(kind != 0 → ×1.2)に該当し、最高速度
90km/hで計算されていた。停留所間隔が短い市街地路線(池65など)では
加減速支配のため影響が出ないが、停留所間隔の長い区間では所要時間が
大幅に過小評価される。

transport_typeでバスを判定し、最高速度50km/h(優等補正なし)・
迂回係数1.30(道路)の専用プロファイルを適用する。池65
落合南長崎駅前→目白駅前相当(約300m×7区間)で実乗車時間約10分と
整合することを較正テストで確認。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KZrVUqfmEjpBcmNbF4ZyG8
@TinyKitten TinyKitten self-assigned this Jul 2, 2026
@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 44baab63-b946-47af-b1b9-1e0cad35645b

📥 Commits

Reviewing files that changed from the base of the PR and between fb55eef and c9a908e.

📒 Files selected for processing (1)
  • stationapi/src/domain/arrival_estimation.rs
👮 Files not reviewed due to content moderation or server errors (1)
  • stationapi/src/domain/arrival_estimation.rs

📝 Walkthrough

[!WARNING]

Walkthrough skipped

File diffs could not be summarized.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/toei-bus-ikebukuro-65-eta-68oi8b

Comment @coderabbitai help to get the list of available commands.

@TinyKitten
TinyKitten merged commit 5b10042 into dev Jul 2, 2026
11 checks passed
@TinyKitten
TinyKitten deleted the claude/toei-bus-ikebukuro-65-eta-68oi8b branch July 2, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants