feat(job): expose locate job definition and add locate qualification examples#617
Conversation
…nces Lets users train a custom audience for locate jobs, mirroring the existing add_classification_example / add_compare_example. Locate truths are bounding boxes, so the method takes a list[Box]; the generic example endpoint and the LocateExamplePayload / LocateExampleTruth models already exist, so no backend change is needed. - Box.to_example_model() converts to ExampleBoxShape (0-100 scale). - Extract calculate_boxes_coverage() into box.py (shared with RapidsManager) and use it as the example's randomCorrectProbability. - Add a Simple/Advanced tab layout to the locate docs example. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: karl <karl@rapidata.ai>
Code ReviewOverviewThis PR promotes Code Quality
The refactoring is clean and behavior-preserving. The new version also drops the unused One note on the sort ordering:
Both methods perform the same def _as_percentages(self):
return self.x_min * 100, self.y_min * 100, self.x_max * 100, self.y_max * 100Not blocking, just noting it. Import convention violation in Per CLAUDE.md: "use The file already has # Move this:
from rapidata.rapidata_client.validation.rapids.box import (
Box,
calculate_boxes_coverage,
)
# To this:
from rapidata.rapidata_client.validation.rapids.box import calculate_boxes_coverage
if TYPE_CHECKING:
from rapidata.rapidata_client.validation.rapids.box import Box
The method now just delegates to the module-level function. It could be inlined at its two call sites ( Potential IssuesNo unit tests for The function is algorithmically non-trivial (sweep-line area union). The PR notes end-to-end testing, but no unit tests were added. Consider adding a few cases:
Hardcoded audience IDs in docs
The locate example uses DocumentationThe Simple/Advanced tab pattern is consistent and well-executed. The callout notes (especially the warning block about audience training time) are clear without being verbose. The parameter availability matrix update for Locate is accurate based on the implementation. Minor nit: in Summary
The core logic and API shape are solid. The import convention and test coverage are the two things worth addressing before merge. |
Code Review — feat(job): expose locate job definition and add locate qualification examplesOverviewThis PR promotes Strengths
Issues1.
|
cac00ba
into
feat(job)/expose-locate-job-definition
What
Exposes the locate rapid type as a first-class public API in the SDK and adds support for locate qualification examples on custom audiences.
feat(job)— expose locate job definition_create_locate_job_definition→create_locate_job_definition(now public), matching the existing publiccreate_compare_job_definition.feat(audience)— locate qualification examplesadd_locate_exampletoAudienceExampleHandlerandRapidataAudience, mirroring the existingadd_classification_example/add_compare_examplemethods.Box.to_example_model()and extracts the box-coverage sweep-line into a module-levelcalculate_boxes_coverage(shared byRapidsManagerand the new audience example, sorandomCorrectProbabilityis computed consistently with the locate validation rapid).docsexamples/locate_job.md(simple + advanced/custom-audience paths), nav + search-plugin wiring.find_audiences("alignment")[0]toget_audience_by_id(...)for reproducibility, and pointsaud_*example jobs at curated/custom audiences so they produce results.Testing
py_compileclean; the coverage extraction is behaviour-preserving (existingRapidsManagercallers unchanged).Notes
examples/locate_job.mdreferences a real curated audience id (aud_MU1GZYoESyO) for a runnable example.🔗 Session: https://session-eb4cb58b.poseidon.rapidata.internal/