Skip to content

Conversation

@VIKTORVAV99
Copy link
Member

@VIKTORVAV99 VIKTORVAV99 commented Dec 2, 2025

Description

Already had some quick changes for ENTSO-E production so I could determine the scope of this.

Figured I might as well put it here for you guys to have a look at.

Output would be:

    dict({
      'correctedModes': list([
      ]),
      'datetime': datetime.datetime(2025, 10, 21, 16, 45, tzinfo=datetime.timezone.utc),
      'datetime_end': datetime.datetime(2025, 10, 21, 17, 0, tzinfo=datetime.timezone.utc),
      'production': dict({
        'biomass': 774.79,
        'coal': 129.6,
        'gas': 14.7,
        'hydro': 1236.7,
        'nuclear': 4175.4,
        'oil': 0.6,
        'solar': 1.8,
        'unknown': 144.6,
        'wind': 5821.4,
      }),
      'source': 'entsoe.eu',
      'sourceType': <EventSourceType.measured: 'measured'>,
      'storage': dict({
      }),
      'zoneKey': 'FI',
    }),

@github-actions github-actions bot added the python Pull requests that update Python code label Dec 2, 2025
@seljaks
Copy link
Contributor

seljaks commented Dec 3, 2025

High level it looks good!

Have a question about changing the dict key from datetime to tuple[datetime, datetime]. Is there any mechanism where we ensure that events can't be overlapping? Previously this was kinda implied because the next datetime was considered the end of the the currect datetime. Can we have a case now where we have an event with start=x, end=y and another with start=x, end=z i.e. we have two events that partially overlap?
I know this would get caught on DB ingestion because we're not changing the PK, but would be nice to ensure this on the parser side if possible.

Copy link
Member Author

I didn't implement it (yet) but that should be possible with the pydantic validators in the base parser classes. That particular change in the datetime to a tuple is just in the internal representation of the entsoe data in this specific parser. The output would be a plain dict/json where the key is called datetime_end(or what ever we pick).

Might be a better way to do it if we refractor it a bit but this was the quick and easy solution (and should work pretty good since we get the start and end at the same time).

@VIKTORVAV99 VIKTORVAV99 marked this pull request as ready for review December 12, 2025 14:45
@VIKTORVAV99 VIKTORVAV99 requested a review from a team as a code owner December 12, 2025 14:45
@VIKTORVAV99 VIKTORVAV99 requested review from Copilot and removed request for a team December 12, 2025 14:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces support for an optional datetime_end field in production, exchange, and price data structures across the electricitymap parsers. The field is set to None by default for existing data points, allowing for future representation of time intervals rather than point-in-time measurements.

Key Changes

  • Added datetime_end field to data point structures (production, exchange, price)
  • Updated test snapshots to include datetime_end: None for all existing test cases
  • Modified TAIPOWER parser to use keyword arguments for clarity

Reviewed changes

Copilot reviewed 42 out of 60 changed files in this pull request and generated no comments.

File Description
electricitymap/contrib/parsers/TAIPOWER.py Updated production_breakdown.append() to use explicit keyword arguments
Multiple test snapshot files Added datetime_end: None field to all test data points for production, exchange, and price data

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@VIKTORVAV99 VIKTORVAV99 requested a review from Copilot December 12, 2025 14:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 42 out of 60 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants