Skip to content

Conversation

@frozenhelium
Copy link
Contributor

No description provided.

@frozenhelium frozenhelium force-pushed the feature/test-validate-aoi branch from b7ccfbf to d1c9eae Compare November 4, 2025 13:11
@frozenhelium frozenhelium changed the title feat(validate): add queries to test AOI Add queries to test AOI for validate project Nov 4, 2025
@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

❌ Patch coverage is 55.76923% with 69 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.27%. Comparing base (bd312a9) to head (6d7ec41).
⚠️ Report is 3 commits behind head on develop.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
project_types/validate/project.py 40.35% 31 Missing and 3 partials ⚠️
apps/project/graphql/queries.py 39.47% 20 Missing and 3 partials ⚠️
project_types/validate/api_calls.py 59.09% 5 Missing and 4 partials ⚠️
...ps/project/graphql/types/project_types/validate.py 84.21% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #214      +/-   ##
===========================================
- Coverage    87.67%   87.27%   -0.41%     
===========================================
  Files          205      205              
  Lines        12317    12471     +154     
  Branches      1042     1056      +14     
===========================================
+ Hits         10799    10884      +85     
- Misses        1137     1196      +59     
- Partials       381      391      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@frozenhelium frozenhelium force-pushed the feature/test-validate-aoi branch from d1c9eae to 63a6dc6 Compare November 5, 2025 02:42
@frozenhelium frozenhelium requested review from sandeshit, susilnem, thenav56 and tnagorra and removed request for susilnem and tnagorra November 5, 2025 02:44
@frozenhelium frozenhelium marked this pull request as ready for review November 5, 2025 02:44
@frozenhelium frozenhelium force-pushed the feature/test-validate-aoi branch 4 times, most recently from 5f0bef6 to ad48219 Compare November 5, 2025 05:46
Copy link
Member

@thenav56 thenav56 left a comment

Choose a reason for hiding this comment

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

For forwarding the error message from remote, we can add additional attributes to the Exception and use them in the Response Types

"ohsome element count request failed: check for errors in filter or geometries",
extra=log_extra_response(response=response),
)
raise ValidateApiCallError
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense to include the error message in the exception?
Will it be helpful for the users?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it does, currently we're replicating the behaviour of ohsome request call, we should refactor both of these functions. I'll add appropriate 'fixme' for now

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add this as a NOTE

if first_result is None:
return None

return first_result.get("value", None)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to check if the "value" is integer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the int parsing just in case

@frozenhelium frozenhelium requested a review from thenav56 November 7, 2025 02:54
thenav56
thenav56 previously approved these changes Nov 7, 2025
Copy link
Member

@thenav56 thenav56 left a comment

Choose a reason for hiding this comment

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

Looks good.

We might need to pass additional error details to the frontend to provide more context for users and debugging without the need to check server logs.

@frozenhelium frozenhelium force-pushed the feature/test-validate-aoi branch from 8361d4e to 6d7ec41 Compare November 10, 2025 09:45
@frozenhelium frozenhelium merged commit e1b0df8 into develop Nov 10, 2025
4 of 6 checks passed
@frozenhelium frozenhelium deleted the feature/test-validate-aoi branch November 10, 2025 09:59
Comment on lines +96 to +113
project_id: strawberry.ID | None,
asset_id: strawberry.ID | None,
ohsome_filter: str | None,
) -> TestValidateAoiObjectsResponse:
response = TestValidateAoiObjectsResponse(
project_id=project_id,
asset_id=asset_id,
ohsome_filter=ohsome_filter,
)

if project_id is None:
return response.generate_error("project_id is required to test aoi elements")

if asset_id is None:
return response.generate_error("asset_id is required to test aoi elements")

if ohsome_filter is None:
return response.generate_error("ohsome_filter is required to test aoi elements")
Copy link
Collaborator

Choose a reason for hiding this comment

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

These should be required on the API schema itself.

Comment on lines +129 to +144
@strawberry.field(extensions=[IsAuthenticated()])
def test_tasking_manager_project(
self,
hot_tm_id: fields.PydanticId | None,
ohsome_filter: str | None,
) -> TestValidateTaskingManagerProjectResponse:
response = TestValidateTaskingManagerProjectResponse(
hot_tm_id=hot_tm_id,
ohsome_filter=ohsome_filter,
)

if hot_tm_id is None:
return response.generate_error("hot_tm_id is required to test HOT project aoi elements")

if ohsome_filter is None:
return response.generate_error("ohsome_filter is required to test HOT project aoi elements")
Copy link
Collaborator

Choose a reason for hiding this comment

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

These should be required on the API schema itself.

"AOI does not contain objects from selected filter.",
)

allowed_count = 100000
Copy link
Collaborator

Choose a reason for hiding this comment

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

100_000

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's not duplicate this logic.

aoi_id = aoi_response["result"]["id"]

# Test AOI objects
ohsomeFilter = "building=* and geometry:polygon"
Copy link
Collaborator

Choose a reason for hiding this comment

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

ohsome_filter

Comment on lines +142 to +143
area_km2 = get_area_of_geometry(geometry_collection)
allowed_area = 20
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's not duplicate this logic.

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.

4 participants