Recalculate metrics for a specific transaction
POST/transactions/:id/recalculate-metrics
Manually triggers recalculation of aggregated metrics from raw meter values for a transaction.
What Gets Recalculated:
- Latest Values:
latestPower,latestCurrent,latestVoltage(from most recent meter value) - Average Values:
averagePower,averageCurrent,averageVoltage(mean across all samples) - Peak Values:
peakPower,peakCurrent,peakVoltage(maximum values observed) - Energy Total:
energyDelivered(from start/end meter values)
When to Use:
- After manually correcting or deleting meter values
- When importing historical telemetry data
- To fix metric calculation errors
- After data migration or bulk imports
Process Flow:
- Fetches all meter values for the transaction
- Calculates latest values from most recent samples
- Computes averages across all periodic samples
- Finds peak values from all samples
- Updates transaction record with new metrics
- Returns updated transaction object
Performance Note: Recalculation queries all meter values for the transaction. For sessions with thousands of meter values, this may take several seconds.
Best Practices:
- Only recalculate when metrics appear incorrect
- Run during low-traffic periods for large sessions
- Verify results after recalculation
- Consider impact on billing systems
This operation only updates derived metrics calculated from meter values. It does not modify raw meter value entries or affect billing/invoicing unless your system recalculates bills based on updated metrics.
Metrics are automatically calculated when new meter values arrive from chargers. Manual recalculation is only needed when correcting historical data or fixing calculation errors.
For active sessions, metrics update automatically every 30-60 seconds as new meter values arrive. Only recalculate if you suspect the metrics are incorrect.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 500
A charging transaction/session
Standard error response format
Standard error response format
Standard error response format
Standard error response format
Standard error response format