feat(voy-calc): support batch request - #576
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
There are correctness/contract issues in the new typing (required keys not represented) and a JSON decoding error path that currently raises an unhelpful exception.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds batch-request support to the Voyage Calculator endpoint, enabling multiple voyage calculations (up to 5 routes) to be submitted in a single API call and returned in a dedicated result container.
Changes:
- Added
VoyageCalculator.batch_search()with request shaping, max-routes validation, and response mapping into a new result type. - Introduced
VoyageCalculatorBatchResult(withmetadata) plus DataFrame/list helpers for batch responses. - Exported the new
VoyageCalculatorRoutetype and added real-API tests covering batch behavior.
File summaries
| File | Description |
|---|---|
| vortexasdk/endpoints/voyage_calculator.py | Adds batch request route typing and batch_search() implementation. |
| vortexasdk/endpoints/voyage_calculator_result.py | Adds VoyageCalculatorBatchResult container with metadata and to_df(). |
| vortexasdk/endpoints/init.py | Re-exports VoyageCalculatorRoute from the endpoints package. |
| vortexasdk/init.py | Re-exports VoyageCalculatorRoute from the top-level package. |
| tests/endpoints/test_voyage_calculator.py | Adds integration tests for batch search, dataframe output, metadata, and max-routes validation. |
Review details
Suppressed comments (1)
vortexasdk/endpoints/voyage_calculator.py:41
VoyageCalculatorRouteis declared withtotal=False, which makes all keys optional for type-checkers, but the docstring statestype,vessel_status,origin, anddestinationare required. Mark these four keys asRequired[...]so static typing matches the API contract.
type: VoyageCalculatorType
vessel_status: VoyageCalculatorVesselStatus
origin: Union[str, LatLong]
destination: Union[str, LatLong]
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
samhuk
approved these changes
Sep 4, 2026
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.
RELATED TICKETS
CHANGELOG
batch_search()method toVoyageCalculator— accepts up to 5 route specifications in a single request and returns results with correlation fields (origin, destination, vessel_class, avoid_zone) alongside calculation results (ETA, ETD, speed, duration)VoyageCalculatorRouteTypedDict withRequiredmarkers on mandatory keys (type, vessel_status, origin, destination) for type-checker safetyVoyageCalculatorBatchResultcontainer withmetadatafield for per-item status messagesTESTS
TestVoyageCalculatorBatchcovering: multi-route batch, single-route batch,to_df(), column filtering, metadata access, avoid_zone supportTestVoyageCalculatorBatchValidationfor client-side validation: max 5 routes exceeded, empty routes listCOMMENTS
batch_searchcallsretry_postdirectly rather than going throughsearch_with_clientwhich expects dict payloads_handle_responsefromclient.pyfor consistent error logging and JSONDecodeError safetysearch()method is unchanged — fully backwards compatible