fix: restrict organisation ID filtering to SITE/SUBSTATION location types in Data Platform client#333
Open
PavanRaghavendraKulkarni wants to merge 10 commits into
Open
fix: restrict organisation ID filtering to SITE/SUBSTATION location types in Data Platform client#333PavanRaghavendraKulkarni wants to merge 10 commits into
PavanRaghavendraKulkarni wants to merge 10 commits into
Conversation
…ypes to keep region endpoints unaffected
…ronment configuration
devsjc
reviewed
Jun 25, 2026
peterdudfield
left a comment
Contributor
There was a problem hiding this comment.
Im not sure the title of this PR is correct
| organisation_id: str | None = get_org_id_from_authdata(authdata) if authdata != {} else None | ||
| _site_level = location_type in ( | ||
| models.LocationType.SITE, | ||
| models.LocationType.SUBSTATION, |
Contributor
There was a problem hiding this comment.
should remove substation?
Contributor
|
Im not sure this is needed. For Adani there are only sites. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the Data Platform client so that organisation ID filtering is only applied to
SITEandSUBSTATIONlocation types, not to regional or national queries.Motivation
Prior to this change, the organisation ID filter was applied to all location types when an auth token was present. This inadvertently blocked Adani site forecast and generation queries because the org filter was also being applied inside
get_predicted_generationandget_actual_generationfor non-site location types.Changes
src/quartz_api/internal/backends/dataplatform/client.pyget_predicted_generation: org ID filter now only applied whenlocation_typeisSITEorSUBSTATIONget_actual_generation:_check_user_accessnow only called forSITElocation typeput_actual_generation:_check_user_accessnow only called forSITElocation typeTesting
Manually verified against local dev environment with a valid auth token:
GET /sitesGET /sites/{uuid}/forecast(org site)GET /sites/{uuid}/generation(org site)GET /sites/{uuid}/forecast(other site)