Skip to content

fix(queries): Look back 3 days from start for forecasts#135

Merged
devsjc merged 1 commit intomainfrom
devsjc/yellow-line-fix
Mar 23, 2026
Merged

fix(queries): Look back 3 days from start for forecasts#135
devsjc merged 1 commit intomainfrom
devsjc/yellow-line-fix

Conversation

@devsjc
Copy link
Copy Markdown
Contributor

@devsjc devsjc commented Mar 23, 2026

Contribution Checklist

  • Have you followed the Open Climate Fix Contribution Guidelines?
  • Have you referenced the Issue this PR addresses, where applicable?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added a summary of the changes?
  • Have you written new tests for your changes, where applicable?
  • Have you successfully run make lint with your changes locally?
  • Have you successfully run make test with your changes locally?

Warning

PRs may be closed if all the above boxes are not checked.

Changes in this Pull Request

Modifies the lookback from start on timeseries forcast collection to 3 days instead of 2. This is because, whilst the forecast may be only 2 days long, we often floor to 6 hours for the start of the lookback.
Addresses openclimatefix/quartz-api#217

@github-actions
Copy link
Copy Markdown

Benchmark Results

Benchmark results
?   	github.com/openclimatefix/data-platform/cmd	[no test files]
?   	github.com/openclimatefix/data-platform/internal/gen/ocf/dp	[no test files]
?   	github.com/openclimatefix/data-platform/internal/interceptors	[no test files]
PASS
ok  	github.com/openclimatefix/data-platform/internal/server/dummy	0.005s
{"level":"debug","time":"2026-03-23T10:33:12Z","message":"Completed migrations"}
goos: linux
goarch: amd64
pkg: github.com/openclimatefix/data-platform/internal/server/postgres
cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
BenchmarkPostgresClient/small/GetForecastAsTimeseries-4         	      52	  21739040 ns/op
BenchmarkPostgresClient/small/GetForecastAtTimestamp-4          	      75	  15743107 ns/op
BenchmarkPostgresClient/small/GetObservationsAsTimeseries-4     	    1062	   1062694 ns/op
BenchmarkPostgresClient/small/CreateForecast-4                  	      81	  14143920 ns/op
PASS
ok  	github.com/openclimatefix/data-platform/internal/server/postgres	68.415s
?   	github.com/openclimatefix/data-platform/internal/server/postgres/gen	[no test files]
Benchmark vs base branch
goos: linux
goarch: amd64
pkg: github.com/openclimatefix/data-platform/internal/server/postgres
cpu: AMD EPYC 7763 64-Core Processor                
                                                   │ bench-main.txt │
                                                   │     sec/op     │
PostgresClient/small/GetForecastAsTimeseries-4         21.65m ± ∞ ¹
PostgresClient/small/GetForecastAtTimestamp-4          15.26m ± ∞ ¹
PostgresClient/small/GetObservationsAsTimeseries-4     1.291m ± ∞ ¹
PostgresClient/small/CreateForecast-4                  15.37m ± ∞ ¹
geomean                                                8.998m
¹ need >= 6 samples for confidence interval at level 0.95

cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
                                                   │ bench-devsjc-yellow-line-fix.txt │
                                                   │              sec/op              │
PostgresClient/small/GetForecastAsTimeseries-4                           21.74m ± ∞ ¹
PostgresClient/small/GetForecastAtTimestamp-4                            15.74m ± ∞ ¹
PostgresClient/small/GetObservationsAsTimeseries-4                       1.063m ± ∞ ¹
PostgresClient/small/CreateForecast-4                                    14.14m ± ∞ ¹
geomean                                                                  8.469m
¹ need >= 6 samples for confidence interval at level 0.95

@devsjc devsjc merged commit bf2b325 into main Mar 23, 2026
4 checks passed
@devsjc devsjc deleted the devsjc/yellow-line-fix branch March 23, 2026 10:34
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.

1 participant