-
Notifications
You must be signed in to change notification settings - Fork 1
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
Accelerate aggregation and parse #11
Conversation
for Pandas 1.1.3 / QGIS 3.34
ウォークスルーGTFSデータ解析のための 変更
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11 +/- ##
===========================================
+ Coverage 80.61% 91.24% +10.63%
===========================================
Files 8 8
Lines 294 377 +83
===========================================
+ Hits 237 344 +107
+ Misses 57 33 -24 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- gtfs_parser/aggregate.py (7 hunks)
- gtfs_parser/gtfs.py (1 hunks)
- gtfs_parser/parse.py (3 hunks)
- tests/test_aggregator.py (1 hunks)
Additional Context Used
GitHub Check Runs (1)
codecov/patch success (13)
gtfs_parser/aggregate.py: [warning] 51-51: gtfs_parser/aggregate.py#L51
Added line #L51 was not covered by tests
gtfs_parser/aggregate.py: [warning] 96-96: gtfs_parser/aggregate.py#L96
Added line #L96 was not covered by tests
gtfs_parser/aggregate.py: [warning] 143-143: gtfs_parser/aggregate.py#L143
Added line #L143 was not covered by tests
gtfs_parser/aggregate.py: [warning] 151-151: gtfs_parser/aggregate.py#L151
Added line #L151 was not covered by tests
gtfs_parser/aggregate.py: [warning] 154-154: gtfs_parser/aggregate.py#L154
Added line #L154 was not covered by tests
gtfs_parser/aggregate.py: [warning] 203-205: gtfs_parser/aggregate.py#L203-L205
Added lines #L203 - L205 were not covered by tests
gtfs_parser/parse.py: [warning] 101-101: gtfs_parser/parse.py#L101
Added line #L101 was not covered by tests
gtfs_parser/parse.py: [warning] 107-108: gtfs_parser/parse.py#L107-L108
Added lines #L107 - L108 were not covered by tests
tests/test_aggregator.py: [warning] 13-13: tests/test_aggregator.py#L13
Added line #L13 was not covered by tests
tests/test_aggregator.py: [warning] 15-15: tests/test_aggregator.py#L15
Added line #L15 was not covered by tests
tests/test_aggregator.py: [warning] 18-22: tests/test_aggregator.py#L18-L22
Added lines #L18 - L22 were not covered by tests
tests/test_aggregator.py: [warning] 33-34: tests/test_aggregator.py#L33-L34
Added lines #L33 - L34 were not covered by tests
tests/test_aggregator.py: [warning] 41-41: tests/test_aggregator.py#L41
Added line #L41 was not covered by tests
Additional comments not posted (17)
gtfs_parser/gtfs.py (1)
22-23
: "location_type" 列の処理が適切に行われています。データの整合性と型の問題を防ぐために、欠損値を "0" で埋め、整数型に変換しています。gtfs_parser/parse.py (4)
17-32
: 停留所データの処理が最適化されており、"ignore_no_route" フラグに基づいて接続されていない停留所を適切に処理しています。
70-72
: 形状データの有無と "ignore_shapes" フラグに基づいて、適切な解析戦略を選択しています。
75-109
: 形状データの処理が効率的に行われており、特徴生成のためのデータ準備に必要なソート、グルーピング、マージ操作が含まれています。
112-147
: 形状データを使用せずにルート特徴を生成する処理が明確で効果的に実装されています。tests/test_aggregator.py (5)
4-7
: 座標が指定されたイプシロン内で互いに近いかどうかをチェックするロジックが正しく、効率的に比較を処理しています。
10-22
: 異なるジオメトリタイプ(ポイント、ラインストリング、マルチラインストリング)を処理し、is_coordinate_close
を使用して座標を比較するロジックが健全でよく構造化されています。
25-34
: 特徴がプロパティを比較することによって特徴のリストに存在するかどうかを効果的にチェックし、必要に応じてジオメトリの比較にis_geometry_close
を使用します。ロジックは明確で、チェックを効率的に処理します。
37-41
: プロパティのセットがプロパティのリストに存在するかどうかを、キーと値のペアを比較することによって直接的にチェックするロジックがシンプルで効果的です。
44-72
:no_unify_stops
フラグが設定されているときのAggregator
クラスの動作をチェックするテストが、Aggregator
メソッドによって返される関係と特徴の数をチェックします。アサーションは、期待される動作を検証するために正しく配置されています。gtfs_parser/aggregate.py (7)
9-41
:__init__
メソッドは、さまざまなパラメータを使用してAggregator
クラスを初期化し、これらのパラメータに基づいて停留所の時間を処理します。フィルタリングと統一のための静的メソッドの使用は、モジュール性のための良い実践です。
42-63
: このメソッドは、日付と時間のパラメータに基づいて停留所の時間をフィルタリングします。出発時間が null 可能であることを処理し、比較のために整数に変換するロジックがうまく実装されています。
66-80
: このメソッドは、"location_type" に基づいて統一せずに類似の停留所を取得します。停留所をフィルタリングし、それらの間の関係を作成するロジックが明確で効果的に実装されています。
83-102
: このメソッドは、親駅、区切り文字、距離に基づいて類似の停留所を統一します。異なる統一戦略を処理するロジックは、よく構造化され、モジュラーです。
105-127
: このメソッドは、親駅に基づいて子停留所を統一します。停留所間の関係を作成し、"location_type" 列を処理するロジックが効果的に実装されています。
130-168
: このメソッドは、区切り文字と距離を基準にしてソロ停留所を統一します。異なる統一条件を処理し、結果をマージするロジックが明確でモジュラーです。
171-189
: このメソッドは、距離を基準に近くの停留所のペアを効果的に計算します。近接性に基づいて停留所をマージし、"stop_name" 列を処理するロジックがうまく実装されています。
LGTM! |
Close Issues
Benchmark
data set
results
remarks
Current read_routes()@parse.py has 2 bugs. I fix them temporary and use for measurement.
Like this:
Description(変更内容)
Accelerate and refactor for aggregation, especially for stop unification
max_distance_degree
0.01 to 0.003 and add process of join near groups.__aggregate_similar_stops()
into small static methods.read_route_frequency()
Add read_stop_relations() to Aggregator
read_stop_relations()
that returns relations of stops and similar stops as a list of dictionaries.Acclerate and refactor read_routes()
read_routes()
into some small methods.Acclerate read_stops()
Add test cases for aggregation
Manual Testing(手動テスト)
Please check in QGIS on your Mac OS.