feat(platform): Add item filtering for fetching run results.#442
feat(platform): Add item filtering for fetching run results.#442blanca-pablos merged 5 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds filtering capabilities to the Run.results() method, allowing users to retrieve results for specific items by their item IDs or external IDs. This enhancement provides more granular control over result retrieval, which can improve performance when only a subset of results is needed.
Changes:
- Added
item_idsandexternal_idsoptional parameters toRun.results()method - Implemented filter parameter mapping to API query parameters (
item_id__inandexternal_id__in) - Added comprehensive test coverage for the new filtering functionality
- Updated documentation to reflect the new filtering capabilities
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/aignostics/platform/resources/runs.py | Added item_ids and external_ids parameters to Run.results() method and implemented filter parameter mapping |
| tests/aignostics/platform/resources/runs_test.py | Added two test cases: one verifying filter parameters are correctly mapped to API parameters, another verifying filters are omitted when not provided |
| src/aignostics/platform/CLAUDE.md | Updated documentation to note that Runs.results() supports item_ids and external_ids filters |
| if item_ids is not None: | ||
| filter_kwargs["item_id__in"] = item_ids | ||
| if external_ids is not None: |
There was a problem hiding this comment.
The current implementation does not handle empty lists correctly. If a user passes item_ids=[] or external_ids=[], these will be sent to the API as filter parameters, which would filter out all results (since no item can have an ID in an empty list). The intended behavior when an empty list is provided should likely be the same as when None is provided (i.e., don't apply the filter). Consider checking both is not None and that the list is not empty, similar to the pattern used for the sort parameter at line 679: sort=[sort] if sort else None.
| if item_ids is not None: | |
| filter_kwargs["item_id__in"] = item_ids | |
| if external_ids is not None: | |
| if item_ids: | |
| filter_kwargs["item_id__in"] = item_ids | |
| if external_ids: |
There was a problem hiding this comment.
Agree with this, and the behaviour should be made explicit with a test IMO
There was a problem hiding this comment.
I thought about it but I'd say empty list should return no results, that's semantically correct behavior imo and converting [] to no filter might be confusing?
There was a problem hiding this comment.
Fair enough, I don't feel super strongly but either way it should be tested :)
There was a problem hiding this comment.
ok Claude also thinks this is a bug, maybe you're right 😅 will change it and add tests!
25176d7 to
e826122
Compare
|
Claude encountered an error —— View job ✅ Code Review CompleteI've completed a comprehensive review of PR #442. The implementation is excellent and follows all repository standards. Here's my analysis: 🎯 SummaryThis PR adds Verdict: ✅ APPROVED - Ready to merge ✅ What Was Checked1. Critical Checks (All Passed)
2. Implementation Quality ⭐
3. Test Coverage 🧪Three comprehensive unit tests added:
All tests properly verify:
4. Documentation
5. CLI Test Fix 🔧
📋 Changes Reviewed
|
8bd4646 to
01b4b0b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/aignostics/platform/resources/runs.py:223
- The docstring return type says
list[ItemResultData], butresults()is annotated and implemented as an iterator (it returnspaginate(...)). Since this docstring was updated in this PR, please align theReturns:section with the actual return type (e.g.,Iterator[ItemResultData]).
Returns:
list[ItemResultData]: A list of item results.
Codecov Report✅ All modified and coverable lines are covered by tests.
|
29d64b6 to
4487f0c
Compare
| csv_content += ( | ||
| f";{SPOT_0_CRC32C};{SPOT_0_RESOLUTION_MPP};{SPOT_0_WIDTH};{SPOT_0_HEIGHT};H&E;LUNG;LUNG_CANCER;{SPOT_0_GS_URL}" | ||
| ) |
There was a problem hiding this comment.
This test flaked on me because the CSV is invalid, so the run failed before it could be cancelled
Co-authored-by: Copilot <[email protected]>
|
- FR-04: add 'test' to supported deployment environments (#422) - ApplicationRun.results(): document item_ids and external_ids filter parameters (#442) skip:ci, skip:test:long-running, skip:test:matrix-runner, skip:test:very-long-running Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- FR-04: add 'test' to supported deployment environments (#422) - ApplicationRun.results(): document item_ids and external_ids filter parameters (#442) skip:ci, skip:test:long-running, skip:test:matrix-runner, skip:test:very-long-running Co-Authored-By: Claude Sonnet 4.6 <[email protected]>



Add item_ids and external_ids to Run.results() to be able to filter by a list of items.