-
Notifications
You must be signed in to change notification settings - Fork 23
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 metadata name(s) #4366
Update metadata name(s) #4366
Conversation
Warning Rate limit exceeded@NicholasTurner23 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 47 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis pull request refactors multiple modules to standardize device network and category handling by transitioning from string values to Enum types. Function signatures in the AirQoApi and DataUtils classes now accept Enums, with internal logic updated to use the Enum’s string representation. In addition, the DeviceCategory enumeration has been renamed (LOW_COST → LOWCOST and LOW_COST_GAS replaced by GAS) and corresponding references are updated across utilities, DAGs, and helper functions. Minor enhancements in logging and file handling are also included. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client
participant API as AirQoApi
participant Endpoint as API Endpoint
Client->>API: get_devices_by_network(device_network: DeviceNetwork, device_category: DeviceCategory)
API->>API: Convert enums to their string values (.str)
API->>Endpoint: Fetch devices with constructed parameters
Endpoint-->>API: Return devices list
API-->>Client: Return devices list
Possibly related PRs
Suggested reviewers
Poem
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 (
|
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
🧹 Nitpick comments (1)
src/workflows/airqo_etl_utils/constants.py (1)
6-12
: Update docstring to reflect the new enum names.The docstring still references the old name
LOW_COST
instead ofLOWCOST
. Please update it to match the new enum names.- LOW_COST -> Reference monitors + LOWCOST -> Reference monitors
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/workflows/airqo_etl_utils/airqo_api.py
(2 hunks)src/workflows/airqo_etl_utils/airqo_utils.py
(1 hunks)src/workflows/airqo_etl_utils/constants.py
(2 hunks)src/workflows/airqo_etl_utils/data_warehouse_utils.py
(2 hunks)src/workflows/airqo_etl_utils/datautils.py
(6 hunks)src/workflows/airqo_etl_utils/kcca_utils.py
(1 hunks)src/workflows/dags/airqo_measurements.py
(6 hunks)
🧰 Additional context used
📓 Learnings (1)
src/workflows/dags/airqo_measurements.py (1)
Learnt from: AnthonyByansi
PR: airqo-platform/AirQo-api#3262
File: src/workflows/dags/airqo_measurements.py:0-0
Timestamp: 2024-11-12T09:15:21.461Z
Learning: The dataset name `AirQodataset` was corrected to `AirQo-dataset` in multiple places within the `airqo_measurements.py` file to ensure consistency.
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (python)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (11)
src/workflows/airqo_etl_utils/data_warehouse_utils.py (1)
72-72
: LGTM! Device category renaming is consistent.The changes correctly update the device category from
LOW_COST
toLOWCOST
in both locations, maintaining consistency with the enum changes.Also applies to: 122-122
src/workflows/airqo_etl_utils/constants.py (2)
14-14
: LGTM! Device category enum values are consistently renamed.The renaming from
LOW_COST
toLOWCOST
andLOW_COST_GAS
toGAS
improves naming consistency while maintaining the same underlying values.Also applies to: 16-16
52-54
: LGTM! Category string comparison is updated.The
category_from_str
method correctly uses the newGAS
category name.src/workflows/airqo_etl_utils/kcca_utils.py (1)
135-135
: LGTM! Device category is consistently updated.The change correctly updates the device category from
LOW_COST
toLOWCOST
in theprocess_latest_data
method.src/workflows/dags/airqo_measurements.py (1)
187-187
: LGTM! Device categories are consistently updated across all DAGs.The changes correctly update all device category references:
LOW_COST
toLOWCOST
in the low-cost sensor DAGsLOW_COST_GAS
toGAS
in the gaseous sensor DAGsThe renaming maintains functionality while improving naming consistency throughout the codebase.
Also applies to: 194-194, 363-363, 370-370, 489-489, 554-554, 562-562, 613-613, 622-622
src/workflows/airqo_etl_utils/airqo_utils.py (1)
159-159
: LGTM! Device category name standardization.The change from
DeviceCategory.LOW_COST
toDeviceCategory.LOWCOST
aligns with the broader effort to standardize device category naming across the codebase.src/workflows/airqo_etl_utils/datautils.py (4)
62-62
: LGTM! Improved error logging.Enhanced error logging by including the exception message provides better debugging context.
127-127
: LGTM! Explicit file extension handling.Appending '.csv' to the file_name parameter ensures consistent file extension handling.
138-139
: LGTM! Enhanced type safety with Enums.The changes improve type safety by:
- Using Enum types for parameters
- Setting appropriate default values
- Correctly passing the parameters to the API call
Also applies to: 145-146
665-665
: LGTM! Consistent device category naming.Updated device category names to match the standardized naming convention:
LOW_COST_GAS
→GAS
LOW_COST
→LOWCOST
Also applies to: 669-669, 684-684
src/workflows/airqo_etl_utils/airqo_api.py (1)
243-245
: LGTM! Enhanced type safety and consistent Enum handling.The changes improve the code by:
- Using Enum types for parameters instead of strings
- Consistently accessing Enum string values using the
str
property- Maintaining type safety throughout the function
Also applies to: 293-293, 301-301
@@ -71,7 +71,7 @@ def extract_devices_data( | |||
if devices.empty: | |||
logger.exception("Failed to download or fetch devices.") | |||
raise RuntimeError("Failed to cached and api devices data.") | |||
|
|||
print(devices) |
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.
🛠️ Refactor suggestion
Replace print statement with proper logging.
Using print
statements in production code is not recommended. Consider using the logger instead.
- print(devices)
+ logger.debug(f"Loaded devices: {devices}")
📝 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.
print(devices) | |
logger.debug(f"Loaded devices: {devices}") |
Clean up
Description
Just some clean up
Summary by CodeRabbit