-
Notifications
You must be signed in to change notification settings - Fork 22
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/integration iqair devices #4015
Update/integration iqair devices #4015
Conversation
Updates from airqo staging
📝 WalkthroughWalkthroughThe pull request introduces changes to the Changes
Possibly related PRs
Suggested reviewers
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## staging #4015 +/- ##
===========================================
+ Coverage 11.73% 12.21% +0.48%
===========================================
Files 114 51 -63
Lines 15331 4673 -10658
Branches 319 319
===========================================
- Hits 1799 571 -1228
+ Misses 13532 4102 -9430 |
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: 1
🧹 Outside diff range and nitpick comments (1)
src/workflows/airqo_etl_utils/data_warehouse_utils.py (1)
48-48
: LGTM! Consider using consistent assignment style across the file.The simplified syntax for device category assignment is clean and effective. However, for consistency, you might want to update similar assignments throughout the file (e.g., in the
merge_datasets
method) to use this same direct assignment style.Consider updating other device category assignments to match this style:
- low_cost_data.loc[:, "device_category"] = str(DeviceCategory.LOW_COST) - bam_data.loc[:, "device_category"] = str(DeviceCategory.BAM) + low_cost_data["device_category"] = str(DeviceCategory.LOW_COST) + bam_data["device_category"] = str(DeviceCategory.BAM)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
src/workflows/airqo_etl_utils/data_validator.py
(1 hunks)src/workflows/airqo_etl_utils/data_warehouse_utils.py
(1 hunks)
🧰 Additional context used
🪛 Ruff (0.8.0)
src/workflows/airqo_etl_utils/data_validator.py
165-165: Function definition does not bind loop variable mapped_name
(B023)
🔇 Additional comments (1)
src/workflows/airqo_etl_utils/data_validator.py (1)
162-166
: LGTM! Logical improvement in control flow.
The adjusted indentation ensures proper validation of all rows when the 'network' column is absent, which is the correct behavior for handling non-network-specific data.
🧰 Tools
🪛 Ruff (0.8.0)
165-165: Function definition does not bind loop variable mapped_name
(B023)
data[col] = data[col].apply( | ||
lambda x: DataValidationUtils.get_valid_value( | ||
column_name=mapped_name, row_value=x | ||
) |
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.
Fix potential loop variable binding issue.
The current implementation might lead to unexpected behavior as the lambda function captures the loop variable mapped_name
from the outer scope.
Apply this fix to ensure proper variable binding:
- data[col] = data[col].apply(
- lambda x: DataValidationUtils.get_valid_value(
- column_name=mapped_name, row_value=x
- )
- )
+ mapped_name_current = mapped_name # Capture current value
+ data[col] = data[col].apply(
+ lambda x, name=mapped_name_current: DataValidationUtils.get_valid_value(
+ column_name=name, row_value=x
+ )
+ )
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
data[col] = data[col].apply( | |
lambda x: DataValidationUtils.get_valid_value( | |
column_name=mapped_name, row_value=x | |
) | |
mapped_name_current = mapped_name # Capture current value | |
data[col] = data[col].apply( | |
lambda x, name=mapped_name_current: DataValidationUtils.get_valid_value( | |
column_name=name, row_value=x | |
) | |
) |
🧰 Tools
🪛 Ruff (0.8.0)
165-165: Function definition does not bind loop variable mapped_name
(B023)
Description
[Provide a brief description of the changes made in this PR]
Just some clean up for bam data
Summary by CodeRabbit
New Features
Bug Fixes
Refactor