-
Notifications
You must be signed in to change notification settings - Fork 0
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
Ruleテーブル追加、Dockerfile追加 #6
Conversation
Walkthrough全体的な変更は、Dockerイメージの構築に関する設定の改善、Python環境のセットアップ、依存関係の自動化、マージャンのルールに関する新しいエンティティ導入、ログとスクレイピングスクリプトの機能改善を含んでいます。これらの変更は、効率的な開発環境の構築とゲームデータの管理・抽出の向上を目指しています。 Changes
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 (
|
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.
Review Status
Actionable comments generated: 5
Configuration used: .coderabbit.yaml
Files selected for processing (8)
- .dockerignore (1 hunks)
- Dockerfile (1 hunks)
- build.sh (1 hunks)
- er/mahjong.md (2 hunks)
- extractor.py (3 hunks)
- pyproject.toml (1 hunks)
- run_extractor.sh (1 hunks)
- scrape.py (8 hunks)
Files skipped from review due to trivial changes (1)
- .dockerignore
Additional comments: 2
pyproject.toml (1)
- 46-46: Pythonのバージョン依存関係を
^3.12
に更新し、requests
,pyarrow
,pandas
のマイナーバージョンを更新しています。これらの変更はPRの目的に沿っており、問題はありません。er/mahjong.md (1)
- 18-42:
rules
エンティティをER図に追加し、ゲームルールの構成を管理するための多様なフィールドを導入しています。これらの変更はプロジェクトの目的に沿っており、問題はありません。
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.
Review Status
Actionable comments generated: 0
Configuration used: .coderabbit.yaml
Files selected for processing (3)
- Dockerfile (1 hunks)
- build.sh (1 hunks)
- extractor.py (3 hunks)
Files skipped from review as they are similar to previous changes (2)
- Dockerfile
- build.sh
Additional comments: 2
extractor.py (2)
- 7-7:
argparse
のインポートは適切ですが、ファイルの他のインポートとの間に空行を入れることで、標準ライブラリとサードパーティライブラリのインポートを区別することを推奨します。- 57-73: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [14-73]
extract_logs
関数のis_old
フラグとlog_dir
引数の扱いは適切です。ただし、requests.get
の呼び出しにおいて、URLを組み立てる際に文字列フォーマットを使用している点は良いですが、URLの組み立てにはurllib.parse.urljoin
を使用することを推奨します。これにより、URLの組み立てがより安全になります。raise_for_status
を使用してHTTPリクエストのエラーハンドリングを行っている点は良いですが、requests.get
の呼び出しにおいてタイムアウトを設定していないため、ネットワークの問題でスクリプトが無期限に待機する可能性があります。requests.get
にタイムアウトを設定することを推奨します。- ログファイルのダウンロードと保存処理において、
os.makedirs
を使用してディレクトリを作成している点は良いですが、ファイルの存在チェックを行ってからダウンロードする処理は、無駄なネットワークリクエストを減らすためにも重要です。しかし、ファイルが既に存在する場合にダウンロードをスキップするロジックが見当たりません。ファイルの存在チェック後にダウンロードをスキップする処理を追加することを推奨します。argparse
を使用してコマンドライン引数を処理している点は良いですが、--output-dir
引数にデフォルト値を設定していないため、引数を省略した場合にスクリプトが失敗する可能性があります。デフォルトの出力ディレクトリを設定するか、引数が必須であることを明示することを推奨します。
@coderabbitai resolve |
Summary by CodeRabbit
.dockerignore
ファイルを追加しました。python:3.12-slim-bookworm
に基づいて設定する新しいDockerfile
を追加しました。環境変数の設定、ファイルの/opt/apps
へのコピー、app
ユーザーの作成、ビルドスクリプトの実行、権限の設定、エントリーポイントとデフォルトコマンドの定義が含まれます。build.sh
スクリプトを追加しました。rules
を導入し、ER図のplayers
エンティティを置き換えました。extract_latest_logs
関数の機能をextract_logs
関数にリファクタリングし、output_dir
パラメータの代わりにis_old
フラグを使用するように変更しました。^3.9
から^3.12
に更新し、requests
、pyarrow
、pandas
のマイナーバージョンを更新しました。extractor.py
を異なるオプションで2回実行し、生成されたログをGoogle Cloud Storageバケットに同期するrun_extractor.sh
ファイルを新規に追加しました。rules
リストに格納するためのパーシングロジックを更新し、ルールデータを新しいParquetファイルに書き込むための保存ロジックを調整しました。