Skip to content

Add detailed energy mix breakdown to live generation data#1

Open
akgularda wants to merge 1 commit into
masterfrom
claude/add-live-values-aaohsi
Open

Add detailed energy mix breakdown to live generation data#1
akgularda wants to merge 1 commit into
masterfrom
claude/add-live-values-aaohsi

Conversation

@akgularda

Copy link
Copy Markdown
Collaborator

Summary

Extended the live generation data to include detailed breakdowns of wind, solar, nuclear, and fossil fuel generation percentages alongside the existing renewable percentage. This provides users with more granular visibility into the current energy mix across all three data sources (ENTSO-E, ESO, and EIA).

Key Changes

  • Type definitions: Added wind, solar, nuclear, and fossil fields to the LivePoint interface in src/types.ts, all nullable to accommodate sources with varying data availability.

  • Data source constants: Expanded scripts/live-sources.mjs with new PSR (Power Source Ranking) and fuel-type categorizations:

    • Added ENTSOE_FOSSIL_PSR, ENTSOE_NUCLEAR_PSR, ENTSOE_WIND_PSR, and ENTSOE_SOLAR_PSR sets for ENTSO-E
    • Added ESO_FOSSIL set for UK ESO data
    • Added EIA_FOSSIL set for US EIA data
  • ENTSO-E parser: Modified parseEntsoe() to track and return all four fuel categories as percentages, returning an object instead of a single number.

  • ESO fetcher: Enhanced fetchEso() to calculate and return wind, solar, nuclear, and fossil percentages alongside renewable percentage.

  • EIA fetcher: Enhanced fetchEia() to track individual fuel types (wind, solar, nuclear, fossil) and return them as percentages of total generation.

  • UI display: Updated CountryPanel.tsx to render the new breakdown fields when available, displaying them as a compact list of labeled percentages below the renewable/carbon metrics.

Implementation Details

  • All new fields are nullable (number | null) to gracefully handle sources that don't provide certain data categories
  • Percentage calculations are consistent across all three data sources using helper functions (perc() and pct())
  • The ENTSO-E parser now returns an object that is spread into the final result, allowing the new fields to coexist with existing metadata
  • UI rendering uses conditional checks to only display available metrics, maintaining clean presentation across different data sources

https://claude.ai/code/session_011gEdBijWzWNvAechVynNQ1

Surface more of the generation mix already fetched from each grid source.
Each fetcher (UK/ESO, US/EIA, EU/ENTSO-E) now derives live wind, solar,
nuclear, and fossil shares alongside the renewable figure — no new API
calls or tokens. Extends LivePoint and renders the breakdown under the
LIVE banner in the country panel.

https://claude.ai/code/session_011gEdBijWzWNvAechVynNQ1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants