バス停名はカタカナに変換して挿入#1355
Conversation
📝 Walkthroughウォークスルーひらがなからカタカナへの変換ヘルパーを追加し、バスGTFS統合でストップ名の正規化を実施します。また、バスデータの決定的なID生成ユーティリティ(generate_bus_line_cd、generate_bus_station_cd、generate_bus_station_g_cd)を導入し、駅関連データの挿入フローを拡張します。 変更内容
推定コード審査工数🎯 3 (中程度) | ⏱️ ~20分 詩
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
stationapi/src/import.rs (1)
1160-1173: ひらがな→カタカナ変換のロジックは正しいです。基本的なひらがな範囲(U+3041〜U+3096)とオフセット(0x60)は正確です。踊り字(ゝ→ヽ、ゞ→ヾ)は変換対象外ですが、バス停名にはほぼ使われないため問題ないでしょう。
コーディングガイドラインに従い、この関数のユニットテスト追加を検討してください(
cargo test --lib --package stationapiで実行可能)。🔎 ユニットテストの提案
#[cfg(test)] mod tests { use super::*; #[test] fn test_hiragana_to_katakana() { assert_eq!(hiragana_to_katakana("とげぬき"), "トゲヌキ"); assert_eq!(hiragana_to_katakana("あいうえお"), "アイウエオ"); // 漢字はそのまま assert_eq!(hiragana_to_katakana("とげぬき地蔵前"), "トゲヌキ地蔵前"); // カタカナはそのまま assert_eq!(hiragana_to_katakana("カタカナ"), "カタカナ"); // 混合 assert_eq!(hiragana_to_katakana("ひらがなカタカナ漢字"), "ヒラガナカタカナ漢字"); } }
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
stationapi/src/import.rs
🧰 Additional context used
📓 Path-based instructions (2)
stationapi/src/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
Run
cargo test --lib --package stationapiormake test-unitfor unit tests focusing on entities and repository mocks without database
Files:
stationapi/src/import.rs
**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
**/*.rs: Before committing, runcargo fmton all Rust code
Before committing, runcargo clippy --all-targets --all-featuresand resolve new Clippy warnings unless covered by existing#![allow]attributes
Files:
stationapi/src/import.rs
🧠 Learnings (1)
📚 Learning: 2025-11-25T10:50:36.694Z
Learnt from: CR
Repo: TrainLCD/StationAPI PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T10:50:36.694Z
Learning: Applies to stationapi/src/use_case/interactor/query.rs : When modifying `QueryInteractor`, ensure enrichment steps (companies, train types, line symbols) still behave as expected and verify helper methods such as `update_station_vec_with_attributes` and `build_route_tree_map`
Applied to files:
stationapi/src/import.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test Suite
🔇 Additional comments (1)
stationapi/src/import.rs (1)
1739-1744: 変換ロジックの適用は適切ですが、フォールバック時の動作を確認してください。
stop_name_kがNoneの場合、stop.stop_nameがそのまま使用されます。stop.stop_nameにひらがなが含まれている場合、変換されずに格納される可能性があります。フォールバック値も変換すべきか検討してください:
🔎 フォールバック時も変換する場合の修正案
.bind( stop.stop_name_k .as_ref() .map(|k| hiragana_to_katakana(k)) - .unwrap_or_else(|| stop.stop_name.clone()), + .unwrap_or_else(|| hiragana_to_katakana(&stop.stop_name)), )
駅名検索とかもDBにはカタカナで駅名が入っている前提なので、「とげぬき地蔵前」バス停が「とげぬき」等で部分一致しなくなっていた
Summary by CodeRabbit
リリースノート
✏️ Tip: You can customize this high-level summary in your review settings.