-
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/calculate hourly airqualitydata using bigqdata #4351
Update/calculate hourly airqualitydata using bigqdata #4351
Conversation
…ing_bigqdata Updates from airqo staging
📝 WalkthroughWalkthroughThis pull request updates the data calibration process in the Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client
participant Utils as AirQoDataUtils
participant Data as DataFrame
participant RFModel as RandomForestModel
participant LassoModel as LassoModel
Client->>Utils: Call calibrate_data(data)
Utils->>Data: Initialize pm2_5_calibrated_value & pm10_calibrated_value (np.nan)
Utils->>Data: Group data by city
Utils->>RFModel: Predict PM2.5 values for group
Utils->>LassoModel: Predict PM10 values for group
RFModel-->>Utils: Return PM2.5 predictions
LassoModel-->>Utils: Return PM10 predictions
Utils->>Data: Update DataFrame with calibrated values
Utils->>Client: Return calibrated DataFrame
Suggested reviewers
Poem
Tip 🌐 Web search-backed reviews and chat
✨ Finishing Touches
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/workflows/airqo_etl_utils/airqo_utils.py
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (python)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
src/workflows/airqo_etl_utils/airqo_utils.py (1)
621-622
: LGTM! Good initialization of calibrated value columns.Using
np.nan
for initializing the calibrated value columns is a good practice as it properly represents missing values in pandas DataFrames.
"pm2_5_calibrated_value", | ||
"pm10_calibrated_value", |
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.
Remove calibrated value columns from input variables.
Including pm2_5_calibrated_value
and pm10_calibrated_value
in the input variables list could cause issues:
- These columns are initialized with
np.nan
, and line 641 drops rows with missing values in input variables. - These are target variables that we're trying to predict, not input features.
Apply this diff to fix the issue:
"error_pm10",
"pm2_5_pm10",
"pm2_5_pm10_mod",
- "pm2_5_calibrated_value",
- "pm10_calibrated_value",
]
📝 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.
"pm2_5_calibrated_value", | |
"pm10_calibrated_value", | |
"error_pm10", | |
"pm2_5_pm10", | |
"pm2_5_pm10_mod", | |
] |
Description
Create default calibrated fields for non airqo device measurements.
Summary by CodeRabbit
New Features
Refactor