Skip to main content

Get Driver Statistics

GET /conductor/get_statistics.php
Retrieve comprehensive statistics for a driver including trips, ratings, and performance metrics.

Query Parameters

conductor_id
integer
required
Driver ID

Response

success
boolean
Request success status
statistics
object
Driver statistics and metrics

Request Example

curl -X GET "https://76.13.114.194/conductor/get_statistics.php?conductor_id=25" \
  -H "Accept: application/json"

Response Example

Success
{
  "success": true,
  "statistics": {
    "total_viajes": 1247,
    "viajes_hoy": 8,
    "viajes_semana": 45,
    "viajes_mes": 142,
    "calificacion_promedio": 4.8,
    "total_calificaciones": 1180,
    "tasa_aceptacion": 92.5,
    "tasa_completacion": 98.2,
    "tasa_cancelacion": 1.8,
    "tiempo_promedio_respuesta": 45,
    "distancia_total_km": 8456.3,
    "horas_activo": 1245.5
  }
}

Performance Metrics

Acceptance Rate

Percentage of trip requests accepted by the driver:
double calculateAcceptanceRate(
  int acceptedTrips,
  int totalRequests,
) {
  if (totalRequests == 0) return 0.0;
  return (acceptedTrips / totalRequests) * 100;
}
A high acceptance rate (above 90%) indicates good driver reliability.

Completion Rate

Percentage of accepted trips that were successfully completed:
double calculateCompletionRate(
  int completedTrips,
  int acceptedTrips,
) {
  if (acceptedTrips == 0) return 0.0;
  return (completedTrips / acceptedTrips) * 100;
}

Cancellation Rate

Percentage of trips cancelled by the driver:
double calculateCancellationRate(
  int cancelledTrips,
  int totalTrips,
) {
  if (totalTrips == 0) return 0.0;
  return (cancelledTrips / totalTrips) * 100;
}
High cancellation rates (above 10%) may result in penalties or account suspension.

Rating System

Drivers are rated by passengers on a scale of 1-5 stars:
  • 5 stars: Excellent service
  • 4 stars: Good service
  • 3 stars: Acceptable service
  • 2 stars: Poor service
  • 1 star: Very poor service

Rating Calculation

double calculateAverageRating(
  List<int> ratings,
) {
  if (ratings.isEmpty) return 0.0;
  final sum = ratings.reduce((a, b) => a + b);
  return sum / ratings.length;
}

// Example:
final ratings = [5, 5, 4, 5, 4, 5, 5, 3, 5, 4];
final average = calculateAverageRating(ratings);
print(average); // 4.5
Drivers must maintain a minimum average rating (typically 4.0+) to remain active on the platform.

Performance Tiers

Drivers may be classified into performance tiers based on their statistics:

Gold

  • Rating: 4.8+
  • Acceptance: 95%+
  • Completion: 98%+

Silver

  • Rating: 4.5+
  • Acceptance: 90%+
  • Completion: 95%+

Bronze

  • Rating: 4.0+
  • Acceptance: 85%+
  • Completion: 90%+

Active Hours Tracking

Active hours are calculated when the driver is:
  • Online and available for trips
  • En route to pick up a passenger
  • Transporting a passenger
class ActiveHoursTracker {
  DateTime? sessionStart;
  double totalHours = 0.0;
  
  void startSession() {
    sessionStart = DateTime.now();
  }
  
  void endSession() {
    if (sessionStart != null) {
      final duration = DateTime.now().difference(sessionStart!);
      totalHours += duration.inMinutes / 60.0;
      sessionStart = null;
    }
  }
}

Error Responses

404
Not Found
Driver not found
500
Internal Server Error
Server error

See Also

Build docs developers (and LLMs) love