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

Update gtfs parser interface #81

Merged
merged 3 commits into from
May 8, 2024

Conversation

takohei
Copy link
Contributor

@takohei takohei commented May 5, 2024

Close Issues

Description(変更内容)

With the update of gtfs-parser, the parsing and aggregation process will be several times faster.

The following changes were made to update gtfs_parser.

  • Change the instantiation of gtfs_parser from the constructor to GTFSFactory.
  • Change the way of getting aggregated stop relations to call read_stop_relations()
  • Change the encoding of aggregated stop relations csv file from cp932 to utf-8 and set the encoding to the layer.
  • Decrease the max distance of stop unification by name from 0.01 degree to 0.003 degree.

I suggest that this be a major version up since the required Python and QGIS versions have been raised.

Manual Testing(手動テスト)

Please check in QGIS on your Mac OS.

Copy link

coderabbitai bot commented May 5, 2024

ウォークスルー

変更全体の概要を簡潔に示します。README.mdでは停留所の統一基準が調整され、gtfs_go_dialog.pyではCSVを用いた読み書き機能が追加されました。

変更点

ファイル 変更概要
README.md 停留所の統一基準の調整
gtfs_go_dialog.py import csvの追加、GTFSGTFSFactoryに変更、CSV読み書き機能の追加

🐰✨
静かな夜、コードは跳ねる
新しい旅の準備、
細かな変更、統一の魔法、
CSVの葉をめくりながら
停留所は新たな名を得る


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between e67d0db and 5822a7b.
Files selected for processing (3)
  • README.md (1 hunks)
  • gtfs_go_dialog.py (5 hunks)
  • gtfs_parser (1 hunks)
Files skipped from review due to trivial changes (1)
  • gtfs_parser
Additional Context Used
LanguageTool (3)
README.md (3)

Near line 25: Possible missing comma found.
Context: ...FS tables has routes-data and stops-data but tables-structure is somewhat complicate...


Near line 32: This word is normally spelled as one.
Context: ...ng" width="80%"> GTFS also has service time-table information. This plugin can aggregate ...


Near line 35: The noun should probably be in the singular form.
Context: ...with lines indicate a frequency of each lines, set on left side towards direction of ...

Ruff (30)
gtfs_go_dialog.py (30)

25-51: Import block is un-sorted or un-formatted


34-34: from PyQt5.QtCore import * used; unable to detect undefined names


35-35: from PyQt5.QtGui import * used; unable to detect undefined names


36-36: from PyQt5.QtWidgets import * used; unable to detect undefined names


37-37: from qgis.core import * used; unable to detect undefined names


38-38: from qgis.gui import * used; unable to detect undefined names


57-57: QDialog may be undefined, or defined from star imports


103-103: QDate may be undefined, or defined from star imports


116-116: QAbstractItemView may be undefined, or defined from star imports


130-130: QDate may be undefined, or defined from star imports


134-134: QgsCoordinateReferenceSystem may be undefined, or defined from star imports


337-337: Argument name lineEdit should be lowercase


351-351: QgsProject may be undefined, or defined from star imports


356-356: QgsVectorLayer may be undefined, or defined from star imports


362-362: QgsProject may be undefined, or defined from star imports


366-366: QgsVectorLayer may be undefined, or defined from star imports


381-381: QgsProject may be undefined, or defined from star imports


385-385: QgsVectorLayer may be undefined, or defined from star imports


394-394: QgsProject may be undefined, or defined from star imports


398-398: QgsVectorLayer may be undefined, or defined from star imports


414-414: QgsSymbolLayer may be undefined, or defined from star imports


415-415: QgsSymbolLayer may be undefined, or defined from star imports


419-419: QgsProject may be undefined, or defined from star imports


423-423: QgsVectorLayer may be undefined, or defined from star imports


430-430: QgsProject may be undefined, or defined from star imports


526-526: QMessageBox may be undefined, or defined from star imports


547-547: Variable proxyModel in function should be lowercase


547-547: QSortFilterProxyModel may be undefined, or defined from star imports


549-549: Qt may be undefined, or defined from star imports


556-556: Qt may be undefined, or defined from star imports

Additional comments not posted (4)
README.md (1)

67-67: 停止統合基準の変更を確認しました。緯度経度平面での最大距離が0.01度から0.003度に厳格化されています。これにより、停止のグループ化の精度が向上すると考えられます。

gtfs_go_dialog.py (3)

231-231: パーサーのインスタンス化方法が gtfs_parser.GTFS から gtfs_parser.GTFSFactory に変更されています。これにより、設定やGTFSデータのタイプに応じて柔軟にインスタンスを生成できるようになる可能性があります。


Line range hint 281-310: read_stop_relations() 関数を使用して停止関係データを読み込み、UTF-8エンコーディングでCSVファイルに書き込む処理が追加されています。データの互換性と標準化が向上しています。


428-428: CSVファイルのプロバイダエンコーディングをUTF-8に設定しています。これにより、エンコーディングの問題を防ぎ、データの正確な読み取りが保証されます。

Copy link

@coderabbitai coderabbitai bot left a 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

Out of diff range and nitpick comments (1)
gtfs_go_dialog.py (1)

Line range hint 34-38: ワイルドカードインポート(from PyQt5.QtCore import *など)は、未定義の名前が発生する可能性があるため、推奨されません。具体的なクラスや関数を明示的にインポートすることをお勧めします。

- from PyQt5.QtCore import *
- from PyQt5.QtGui import *
- from PyQt5.QtWidgets import *
- from qgis.core import *
- from qgis.gui import *
+ from PyQt5.QtCore import QDateTime, QFile, QFileInfo
+ from PyQt5.QtGui import QIcon, QPixmap
+ from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget
+ from qgis.core import QgsApplication, QgsProviderRegistry
+ from qgis.gui import QgsMapCanvas, QgsMessageBar
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 5822a7b and 2d6b617.
Files selected for processing (1)
  • gtfs_go_dialog.py (5 hunks)
Additional Context Used
Ruff (30)
gtfs_go_dialog.py (30)

25-51: Import block is un-sorted or un-formatted


34-34: from PyQt5.QtCore import * used; unable to detect undefined names


35-35: from PyQt5.QtGui import * used; unable to detect undefined names


36-36: from PyQt5.QtWidgets import * used; unable to detect undefined names


37-37: from qgis.core import * used; unable to detect undefined names


38-38: from qgis.gui import * used; unable to detect undefined names


57-57: QDialog may be undefined, or defined from star imports


103-103: QDate may be undefined, or defined from star imports


116-116: QAbstractItemView may be undefined, or defined from star imports


130-130: QDate may be undefined, or defined from star imports


134-134: QgsCoordinateReferenceSystem may be undefined, or defined from star imports


338-338: Argument name lineEdit should be lowercase


352-352: QgsProject may be undefined, or defined from star imports


357-357: QgsVectorLayer may be undefined, or defined from star imports


363-363: QgsProject may be undefined, or defined from star imports


367-367: QgsVectorLayer may be undefined, or defined from star imports


382-382: QgsProject may be undefined, or defined from star imports


386-386: QgsVectorLayer may be undefined, or defined from star imports


395-395: QgsProject may be undefined, or defined from star imports


399-399: QgsVectorLayer may be undefined, or defined from star imports


415-415: QgsSymbolLayer may be undefined, or defined from star imports


416-416: QgsSymbolLayer may be undefined, or defined from star imports


420-420: QgsProject may be undefined, or defined from star imports


424-424: QgsVectorLayer may be undefined, or defined from star imports


431-431: QgsProject may be undefined, or defined from star imports


527-527: QMessageBox may be undefined, or defined from star imports


548-548: Variable proxyModel in function should be lowercase


548-548: QSortFilterProxyModel may be undefined, or defined from star imports


550-550: Qt may be undefined, or defined from star imports


557-557: Qt may be undefined, or defined from star imports

Additional comments not posted (2)
gtfs_go_dialog.py (2)

231-231: インスタンス生成方法の変更を確認しました。gtfs_parser.GTFSからgtfs_parser.GTFSFactoryへの変更は、柔軟性と標準化を向上させるための良いステップです。


Line range hint 281-311: 停留所関連データの取り扱いとエンコーディングの変更を確認しました。UTF-8への変更は、より広範なシステムとの互換性を保証します。ただし、errors='ignore'の使用には注意が必要です。データ損失を避けるために、エラーが発生した場合は適切に処理することをお勧めします。

@Kanahiro
Copy link
Member

Kanahiro commented May 8, 2024

LGTM!

@Kanahiro Kanahiro merged commit 8740cac into MIERUNE:main May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants