Overview
Calculates the minimum power required to operate an agricultural implement on specific terrain, and classifies available tractors by compatibility using an intelligent recommendation system. The endpoint evaluates all available tractors and categorizes them into three suitability levels: OPTIMAL, OVERPOWERED, or INSUFFICIENT.Tractor Classification System
Tractors are classified based on their power utilization efficiency:- OPTIMAL (Green): Power between 100-125% of required (perfect fit)
- OVERPOWERED (Yellow): Power >125% of required (oversized but compatible)
- INSUFFICIENT (Red): Power below required (not compatible)
Factors Considered
The calculation considers:- Base power requirement of the implement (HP)
- Working depth
- Soil type
- Terrain slope percentage
Authentication
This endpoint requires authentication via Bearer token in the Authorization header.Request Body
ID of the agricultural implement to evaluate. Must be a positive integer greater than 0.
ID of the terrain where the implement will operate. Must be a positive integer greater than 0.
Override for working depth in meters. If not provided, uses the implement’s default working depth.Validation: 0 < working_depth_m <= 1.0Default: Uses implement’s
working_depth_cm converted to meters, or 0.25m if not specifiedResponse
Indicates whether the calculation was successful.
Human-readable message describing the result.
Container for calculation results and recommendations.
Request Example
Response Example
Error Responses
Returned when required fields are missing or validation fails.Or for validation errors:
Returned when the authentication token is missing or invalid.
Returned when the specified implement or terrain is not found.Or:
Returned when an unexpected error occurs during processing.
Validation Rules
| Parameter | Type | Required | Validation |
|---|---|---|---|
implement_id | integer | Yes | Must be > 0 |
terrain_id | integer | Yes | Must be > 0 |
working_depth_m | number | No | 0 < value <= 1.0 |
Suitability Thresholds
The classification system uses the following thresholds:| Classification | Power Range | Utilization % | Compatible |
|---|---|---|---|
| OPTIMAL | 100% - 125% of required | 80% - 100% | Yes |
| OVERPOWERED | > 125% of required | < 80% | Yes |
| INSUFFICIENT | < 100% of required | > 100% | No |
Recommendation Priority
The top 5 recommendations are sorted by:- OPTIMAL tractors first, sorted by highest utilization percentage (most efficient)
- OVERPOWERED tractors second, sorted by highest utilization percentage (least oversized)
- INSUFFICIENT tractors are excluded from recommendations
Notes
- Only tractors with status
availableare evaluated - If no compatible tractors exist,
queryIdwill be null and the response includes only the power requirement calculation - The calculation is persisted to the database only when at least one compatible tractor is found
- All calculations include audit logging in the
query_historytable - The
best_matchis always the first item intop_5array, or null if no compatible tractors - Implementation reference: src/controllers/calculationController.js:244-476
