Get Global Metrics
Retrieves high-level global metrics for the entire distribution system.
Response
Returns a summary object with global performance metrics.
Total number of shipments across the system
Total number of product units successfully fulfilled
Total number of product units that could not be fulfilled
Average shipment distance in kilometers
Example Request
curl -X GET http://localhost:8080/api/metrics/global
Example Response
{
"totalShipments": 1250,
"fulfilledUnits": 45680,
"unfulfilledUnits": 3240,
"averageDistance": 18.7
}
Get Detailed Metrics
Retrieves comprehensive metrics with optional filtering criteria.
Query Parameters
Filter metrics by store ID
Filter metrics by warehouse ID
Filter metrics by product ID
Response
Returns a detailed metrics object with comprehensive analytics.
Overall efficiency score (0-100)
Percentage of demand fulfilled (0.0-1.0)
Total distance covered by all shipments in kilometers
Total number of shipments
Statistics about store coverageNumber of stores that received any stock
Number of stores with 100% demand fulfilled
Number of stores that received no stock
Percentage of stores served (0.0-1.0)
Percentage of stores fully served (0.0-1.0)
Average number of units per shipment
uniqueProductsDistributed
Number of unique products distributed
Number of unique products requested
Store capacity usage statisticsAverage capacity utilization (0.0-1.0)
Number of stores at maximum capacity
Breakdown of unfulfilled demandTotal units of unfulfilled demand
Units unfulfilled due to insufficient stock
Units unfulfilled due to capacity constraints
Total number of units fulfilled
Statistical breakdown of shipment distancesMinimum shipment distance in kilometers
Maximum shipment distance in kilometers
Median shipment distance in kilometers
Distribution breakdown by warehouseTotal units distributed from this warehouse
Percentage of total distribution (0.0-1.0)
Average shipment distance for this warehouse
Most distributed productsTotal quantity distributed
Example Request
curl -X GET http://localhost:8080/api/metrics/detailed
Example Response
{
"efficiencyScore": 87,
"fulfillmentRate": 0.93,
"totalDistance": 23450.5,
"totalShipments": 1250,
"storesServed": {
"servedStores": 148,
"fullyServedStores": 132,
"neverServedStores": 12,
"coveragePercentage": 0.925,
"fullyServedPercentage": 0.825
},
"avgShipmentSize": 36.5,
"uniqueProductsDistributed": 245,
"uniqueProductsRequested": 268,
"capacityUtilization": {
"percentage": 0.72,
"storesAtCapacity": 8,
"totalStores": 160
},
"unfulfilledDemand": {
"totalUnits": 3240,
"unitsByStockShortage": 2100,
"unitsByCapacityShortage": 1140
},
"fulfilledUnits": 45680,
"distanceStats": {
"minDistance": 2.3,
"maxDistance": 127.8,
"medianDistance": 16.5
},
"unitsByWarehouse": [
{
"warehouseId": "WH001",
"totalUnits": 18500,
"percentage": 0.405,
"avgDistance": 15.2
},
{
"warehouseId": "WH002",
"totalUnits": 27180,
"percentage": 0.595,
"avgDistance": 21.3
}
],
"topProducts": [
{
"productId": "PROD001",
"totalQuantity": 4520
},
{
"productId": "PROD045",
"totalQuantity": 3890
},
{
"productId": "PROD012",
"totalQuantity": 3210
}
]
}
Example Request with Filters
curl -X GET "http://localhost:8080/api/metrics/detailed?warehouseId=WH001&productId=PROD001"
Example Response with Filters
{
"efficiencyScore": 92,
"fulfillmentRate": 0.96,
"totalDistance": 8450.2,
"totalShipments": 487,
"storesServed": {
"servedStores": 95,
"fullyServedStores": 88,
"neverServedStores": 3,
"coveragePercentage": 0.969,
"fullyServedPercentage": 0.898
},
"avgShipmentSize": 38.2,
"uniqueProductsDistributed": 1,
"uniqueProductsRequested": 1,
"capacityUtilization": {
"percentage": 0.68,
"storesAtCapacity": 2,
"totalStores": 98
},
"unfulfilledDemand": {
"totalUnits": 180,
"unitsByStockShortage": 120,
"unitsByCapacityShortage": 60
},
"fulfilledUnits": 18600,
"distanceStats": {
"minDistance": 3.1,
"maxDistance": 45.2,
"medianDistance": 14.8
},
"unitsByWarehouse": [
{
"warehouseId": "WH001",
"totalUnits": 18600,
"percentage": 1.0,
"avgDistance": 15.2
}
],
"topProducts": [
{
"productId": "PROD001",
"totalQuantity": 18600
}
]
}
Error Responses
Invalid Filter Parameters (400)
Returned when invalid query parameters are provided.
{
"error": "Invalid parameters",
"message": "Store with ID INVALID does not exist"
}
No Data Available (404)
Returned when no metrics data is available for the given criteria.
{
"error": "No data found",
"message": "No metrics available for the specified filters"
}