adityanandanx / adityanandanx/raftaar

13. Trip History & Basic Analytics

Aperta
#14 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
0
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## Parent PRD

#1

## What to build

Customer trip history and admin analytics dashboard. Customers view their completed trips with costs. Admins view platform-wide analytics: total trips, revenue, bike utilization, and trip trends with filtering by date, user, station.

Implements database aggregation queries, admin analytics endpoints, and frontend charts/tables.

## Acceptance criteria

- [ ] `GET /trips/history?limit=10&offset=0` returns user's trips (JWT required)
- [ ] Response includes: trip_id, start_station, end_station, start_time, end_time, duration_minutes, cost, status
- [ ] Pagination supported (limit, offset)
- [ ] `GET /admin/analytics/trips` returns trips for filtering (admin only)
- [ ] Accepts filters: start_date, end_date, user_id, station_id, status
- [ ] Response: paginated list of trips with all details
- [ ] `GET /admin/analytics/revenue` returns revenue metrics (admin only)
- [ ] Returns: total_revenue, trips_count, avg_trip_cost, revenue_by_date (array)
- [ ] `GET /admin/analytics/revenue-by-station` returns revenue per station (admin only)
- [ ] Returns: station_id, station_name, total_revenue, trips_count, avg_cost
- [ ] `GET /admin/analytics/bikes` returns utilization (admin only)
- [ ] Returns: bike_id, trips_count, total_hours_in_use, total_revenue_generated
- [ ] Database queries optimized (indexed on user_id, created_at, station_id)
- [ ] Frontend (Customer): Trip history showing trip details, cost, status
- [ ] Frontend (Admin): Analytics dashboard with:
- Total revenue card
- Trips today/week/month cards
- Revenue by station table
- Bike utilization table
- Date range filter
- [ ] Edge cases: no trips (empty state), filters return no results

## Blocked by

- Blocked by #7 (Trip End - needs completed trips)

## User stories addressed

- User story 16: See trip history with costs
- User story 25: View overall statistics (trips, distance, spent)
- User story 33: View all trips in real-time
- User story 34: Filter trips by date, user, station, status
- User story 37: View total revenue for period
- User story 38: See revenue by station
- User story 39: See bike utilization rate

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.