-
Notifications
You must be signed in to change notification settings - Fork 39
Open Sourced CarbonDB and PowerHOG #1441
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
base: main
Are you sure you want to change the base?
Conversation
* main: (feat): Added internal self tests for test data validity Removing confusing info that message was transported via email Update cron schedule and randomize URL input in GitHub Action for testing webNRG
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.
28 files reviewed, 12 comments
| carbon_intensity_g_per_kWh = get_carbon_intensity(latitude, longitude) # cached | ||
|
|
||
| energy_J = float(data['energy_uj']) / 1e6 | ||
| energy_kWh = energy_J / (3_600*1_000) | ||
| carbon_kg = (energy_kWh * carbon_intensity_g_per_kWh)/1_000 |
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.
logic: get_carbon_intensity() returns -1 on error but this negative value is used directly in carbon calculation without validation, resulting in negative carbon_kg
Greptile Overview
Greptile Summary
Moved CarbonDB and PowerHOG features from enterprise (
ee/) to open source, making them publicly available through new API routes and frontend interfaces.Major changes:
Critical issues found:
api/carbondb.py:187where table column names are interpolated directly into queries/v2/carbondbendpoint - comma-separated values aren't validated as integers before database castingcarbondb_add()where negative carbon intensity values (-1error codes) propagate into calculations, resulting in negative carbon measurementsOther concerns:
escapeString()function