Skip to content

Handle partial price data better#550

Merged
slovdahl merged 4 commits intomainfrom
handle-partial-by-not-returning-averages-or-highest-lowest
Apr 1, 2026
Merged

Handle partial price data better#550
slovdahl merged 4 commits intomainfrom
handle-partial-by-not-returning-averages-or-highest-lowest

Conversation

@slovdahl
Copy link
Copy Markdown
Owner

@slovdahl slovdahl commented Apr 1, 2026

If today or tomorrow has only partial price data, don't return any averages or highest/lowest price, because it's not possible to return something that makes sense if we don't have prices for the whole day.

@slovdahl slovdahl added bugfix Inconsistencies or issues which will cause a problem for users or implementers. breaking-change A breaking change for existing users. labels Apr 1, 2026
@slovdahl slovdahl requested a review from Copilot April 1, 2026 17:05
@slovdahl slovdahl force-pushed the handle-partial-by-not-returning-averages-or-highest-lowest branch from 7a037ff to e951e8a Compare April 1, 2026 17:08
Copy link
Copy Markdown
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

Updates the SpotHinta electricity pricing model to better handle partial-day datasets by suppressing derived statistics (average/high/low) when a full day of intervals isn’t available, aligning results with the API’s actual completeness.

Changes:

  • Pass resolution from the client into Electricity.from_dict() and store it on the model.
  • Treat “today”/“tomorrow” prices as empty unless the expected number of intervals for the day is present.
  • Add tests + a new fixture covering partial-data scenarios for 15-minute resolution.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 12 comments.

File Description
spothinta_api/spothinta.py Passes resolution through to model construction so completeness logic can key off resolution.
spothinta_api/models.py Adds resolution to Electricity and gates “today/tomorrow” price sets on interval completeness.
tests/test_models.py Adds tests for partial tomorrow/today behavior at 15-minute resolution.
tests/fixtures/energy-15-minut-partial-tomorrow.json Introduces a fixture with full “today” data and partial “tomorrow” data.

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

@slovdahl slovdahl force-pushed the handle-partial-by-not-returning-averages-or-highest-lowest branch 2 times, most recently from cfdba80 to 71aa692 Compare April 1, 2026 17:16
If today or tomorrow has only partial price data, don't return any averages
or highest/lowest price, because it's not possible to return something that
makes sense if we don't have prices for the whole day.
@slovdahl slovdahl force-pushed the handle-partial-by-not-returning-averages-or-highest-lowest branch from 71aa692 to 4e0bc07 Compare April 1, 2026 17:20
@slovdahl slovdahl requested a review from Copilot April 1, 2026 17:36
Copy link
Copy Markdown
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 4 out of 4 changed files in this pull request and generated 3 comments.


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

@slovdahl slovdahl force-pushed the handle-partial-by-not-returning-averages-or-highest-lowest branch from db6f46f to 08157f1 Compare April 1, 2026 18:11
@slovdahl slovdahl requested a review from Copilot April 1, 2026 18:12
@slovdahl slovdahl force-pushed the handle-partial-by-not-returning-averages-or-highest-lowest branch from 08157f1 to a4b2448 Compare April 1, 2026 18:13
Copy link
Copy Markdown
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 6 out of 6 changed files in this pull request and generated 4 comments.


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

@slovdahl slovdahl merged commit af942ea into main Apr 1, 2026
14 checks passed
@slovdahl slovdahl deleted the handle-partial-by-not-returning-averages-or-highest-lowest branch April 1, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change A breaking change for existing users. bugfix Inconsistencies or issues which will cause a problem for users or implementers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants