Repository navigation
線路の長さと求め直した較正をtrainRouteのEstimatedだけで使い、estimateArrivalTimesとconnectedRoutesを元の計算に戻した - #1714
Conversation
…dRoutesを元の計算に戻した Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (12)
Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour. 📝 WalkthroughWalkthroughEstimated trainRoute の推定に再較正済み速度と線路距離を適用します。estimateArrivalTimes と connectedRoutes は従来の較正と距離処理を維持します。テスト、レポート、ドキュメントも Estimated trainRoute を対象に更新しています。 ChangesEstimated trainRoute の推定
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant QueryInteractor
participant estimate_legs
participant ArrivalEstimation
participant speed_table
participant segment_speed_table
QueryInteractor->>estimate_legs: 区間列と Estimated モデルを渡す
estimate_legs->>ArrivalEstimation: 再較正パラメータと線路距離を渡す
ArrivalEstimation->>speed_table: 路線速度を参照する
ArrivalEstimation->>segment_speed_table: 対象区間の速度上書きを参照する
ArrivalEstimation-->>estimate_legs: 推定時間を返す
Merge Risk: ⚪ Minimal · up to The calibration split and updated measurements appear consistent with the intended behavior. No actionable merge-blocking issue is established; merge after normal checks pass. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 8 files. (4 skipped: 4 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
うさぎは線路をぴょんと渡り Comment |
概要
#1712 の新しい計算 (駅間の距離に線路の長さを使い、その距離で求め直した速度の較正) を、
trainRouteのEstimatedだけで使うようにしました。estimateArrivalTimesとconnectedRoutesは、#1712 の前の計算に戻します。#1712 の目的は、MobileApp の開発用 GPX を実際の運行に近づけることでした。GPX の生成が使うのは
trainRouteのEstimatedだけですが、#1712 は共有の推定に変更を入れたので、アプリの ETA (estimateArrivalTimes) と経路検索 (connectedRoutes) の結果まで変わっていました。新しい計算を必要な場所に閉じ込め、ほかは元の挙動に戻します。変更の種類
変更内容
arrival_estimation.rs)EstimationParamsにspeed_calibration: SpeedCalibrationを足しました。既定はOriginal(到着時間推定の駅間距離に線路の長さを使い、速度の較正をその距離で求め直した #1712 の前の表、legacy_speed_table.rs) で、Recalibrated(speed_table.rs/segment_speed_table.rs) は明示したときだけ使います。Estimatedだけが新しい計算を使う (query.rs)trainRouteのEstimatedは、lineGroupIdでもlegsでも、求め直した較正と線路の長さで推定します。estimateArrivalTimesは、legsのあり・なしとも、元の較正と直線距離 × 迂回係数に戻しました。legsの推定を非公開のestimate_legsにまとめ、estimateArrivalTimesとEstimatedで較正と距離だけを切り替えます。乗換の徒歩と待ち時間の組み立て方は共通です。src/repository.rs)connectedRoutesの系統網を、線路の長さを渡さないRouteNetwork::buildと元の較正で組み立てます (到着時間推定の駅間距離に線路の長さを使い、速度の較正をその距離で求め直した #1712 の前と同じ)。src/travel_times.rs・scripts/travel_time_report.py)legsを渡したestimateArrivalTimesからtrainRouteのEstimatedに替えました。推定の規則や較正を変えると動くのはEstimatedだけになるためです。記録 (baseline.csv) は、Estimatedの値が 到着時間推定の駅間距離に線路の長さを使い、速度の較正をその距離で求め直した #1712 の時点の推定と同じなので、更新していません。estimated_connected_train_route_carries_the_estimate_arrival_times:EstimatedとestimateArrivalTimesの値の一致をやめ、同じ駅を通ること、見込みが減らないこと、停車・加減速が推定のモデルにそろうことを確かめます。estimated_train_route_matches_a_single_leg_estimate: 比べる相手を、同じ区間を 1 つの leg にしたEstimatedのtrainRouteにしました。estimated_model_follows_the_arrival_estimation: 期待値をEstimatedと同じ較正 (Recalibrated) で求めます。legsを渡した ETA の一致を確かめるconnected_route_eta_and_train_route_follow_the_legs(stationsByNameでfromStationGroupId指定時に乗換で行ける駅も返すようにした #1687) は、変更せずに通ります。AGENTS.md・docs/architecture.md・travel_times/README.md・scripts/README.mdと各テーブルの先頭のコメントに、求め直した計算を使うのはEstimatedだけであることを書きました。本番・ステージングとの比較
このブランチを
make data && make devで起動した Worker に同じ問い合わせを送りました。Estimated以外は本番 (#1710 の前)、Estimatedは今のステージング (#1712) と比べています。trainRouteのLegacy(lineGroupIdあり、駅だけ、legs)estimateArrivalTimes(方向あり、方向なし、legs)connectedRoutes(60 組 × 並べ方 3 通り)trainRouteのEstimated(lineGroupId、legs)問い合わせは、無作為に選んだ 60 の種別グループと駅グループの組から作りました。
make travel-time-reportの値 (21 件、典型からのずれの平均 4.71%) も、ステージングの値と同じです。テスト
make fmtが通ることmake clippyが通ること(wasm32 ターゲットを含む)make testが通ることcargo fmt --all -- --check、make clippy、make testを実行し、すべて成功しました (stationapi 443 件、stationapi-worker 28 件ほか、失敗なし)。make testは、generated/がある状態とdata/*.csvだけの状態の両方で通しています。関連Issue
Refs #1712
スクリーンショット(任意)
🤖 Generated with Claude Code
Summary by CodeRabbit
trainRouteのEstimatedモデルで、再較正済みの速度テーブルと線路距離に基づく所要時間推定を行うようになりました。線路距離がない駅間は、直線距離と迂回係数で補います。Estimatedの推定値はLegacyと同じになります。