Following is an example of how to work through receipt from a single Uber ride. I have worked through the business logic to create a reconcilable accounting of every item in the receipt. It reconciles against the weekly activity statement. The business logic has been coded in the Python language to extract the data and compile it into a database ready format. The script can work through 500 receipts per second.
The important parts and data are annotated in red. The data is extracted using Python scripts and Regular Expressions. Here are the data items we want to extract:
- ride_category: Uber X, share, plus cancellations and other events.
- payment_type: ride, quest, cancel, etc.
- ride_date: date of ride.
- distance: just the distance the passenger was in the vehicle.
- total_customer_fare: total reported value to the customer.
- customer_promotions: a value that the customer earns somehow.
- tip: tip/gratuity paid by the customer.
- airport_surcharge: a $5.50 charge reported in refunds.
- ma_surcharge: includes airport surcharge, MA Driver Benefits, and tolls.
- estimated_insurance: insurance charged by Uber for coverage in P2 and P3.
- your_earnings: Fare + adjustments + tips
- amount_uber_spent: Uber sometimes reports taking a loss on a ride.
- amount_uber_kept: amount of Uber’s take of gross less expenses.
- upfront_fare: equals the fare as explained next.
- fare: base fare + promotions or bonuses.
- refunds: pass through charges to customer paid by the driver.
- promotion: not used anymore.
- enroute_time: P2, time between acceptance and arrival at the pickup.
- enroute_distance: distance from acceptance point to the pickup.
- accept_timestamp: P2 begins, time a ride offer was accepted.
- begin_timestamp: P3 begins, time begins for the ride.
- end_timestamp: P3 ends, the ride is over, P1 begins.
Time periods explained
This is a system to explain the total time a driver is in their vehicle whether empty or working. P1 is the time period the car is empty and waiting for a request. P2 begins when a request has been received and accepted. The driver is now driving to the pickup address. P3 begins when the passenger is in the vehicle and the driver starts the ride. P3 ends when the passenger leaves the vehicle and the driver ends the ride.



