Inspiration

In the on-demand gig economy, delivery opportunities flash onto driver screens and vanish in seconds. Drivers are forced to make split-second decisions while actively driving, relying on one deceptive metric: the advertised gross payout. But the advertised payout doesn't always tell the full story. A $120 MXN fare might appear lucrative, but hidden costs like gridlock traffic, uncompensated merchant wait times, high fuel burn, and deadhead trips to deserted drop-off zones frequently turn supposed earnings into net losses.

We built OptiDrive to eliminate this information asymmetry. Designed to work alongside existing delivery platforms, OptiDrive acts as an intelligent copilot that helps couriers "Drive Smarter. Earn More." by delivering actionable, real-time financial clarity before they accept an order.

What it does

OptiDrive operates through a structured four-stage decision pipeline:

  • 01 Receives: Ingests incoming order payloads alongside the courier's real-time coordinates and telemetry.

  • 02 Understands: Quantifies true trip costs by evaluating distance, expected pickup wait times, congestion drag, and destination convenience:

$$$\Pi_{\text{net}} = R_{\text{fare}} - \left( d \cdot C_{\text{fuel}} \cdot (1 + \alpha_{\text{traffic}}) + t_{\text{wait}} \cdot C_{\text{idle}} + C_{\text{wear}} \right)$$where $$R_{\text{fare}}$$ is base revenue, $$d$$ is trip distance, $$\alpha_{\text{traffic}} \in [0, 1]$$ represents congestion drag, $$t_{\text{wait}}$$ is merchant delay, and $$C_{\text{wear}}$$ models vehicle depreciation.

  • 03 Recommends: Delivers a clear, actionable verdict (ACCEPT or REJECT) backed by Explainable AI (XAI) that justifies the decision in natural language.

  • 04 Accompany: Guides the driver with adaptable routing suggestions while aggregating long-term earnings insights, peak hours, and high-demand days.

How we built it

  • Backend Framework: Built with Python and Flask, exposing dedicated RESTful endpoints (/api/evaluar) to process vehicle metrics and dispatch simulation payloads.

  • Explainable AI (XAI): Integrated the Google Gemini API (explainer.py) to parse trip conditions into conversational, context-aware justifications rather than opaque numerical scores.

  • Time-Series Database: Provisioned a TigerData (PostgreSQL) database using psycopg2-binary to persist live vehicle telemetry (telemetry_logs) and historical AI decision audits (historial_viajes).

  • Cloud & Networking: Deployed on a Vultr Ubuntu VPS, orchestrated via Nginx as a reverse proxy routing external port 80 traffic to internal port 5000, and mapped through DNS to our custom domain optidrive.tech.

  • Frontend: Designed an interactive operator dashboard (home.html, profile.html, configuracion.html) utilizing dynamic JavaScript fetch calls and customized stylesheets (general.css).

Challenges we ran into

  • Sub-Second XAI Latency: Structuring prompts for Gemini that ingest multi-variable logistical parameters (distance, tariff, and traffic levels) and return mathematically consistent, concise explanations without delaying the driver's tight acceptance window.

  • Headless Cloud Architecture: Transitioning from a local development environment to an Ubuntu server required resolving network bindings (0.0.0.0 vs. 127.0.0.1), managing Nginx upstream reverse-proxy headers, and isolating terminal sessions using process managers so the live application wouldn't terminate on SSH disconnection.

  • Cost Factor Modeling: Translating non-linear, qualitative factors such as merchant dwell times and traffic friction into realistic operational parameters.

Accomplishments that we're proud of

  • Successfully deploying a fully functional, publicly accessible web application on our custom domain optidrive.tech backed by enterprise-grade infrastructure.

  • Achieving end-to-end latency of under a second from frontend dispatch to Gemini evaluation and persistent SQL transaction logging.

  • Creating an Explainable AI pipeline that transparently educates workers on their real unit economics instead of functioning as a black box.

What we learned

  • Practical systems administration: setting up Nginx reverse proxies, configuring domain DNS records (A and CNAME), and managing system daemons on remote Linux servers.
  • The critical difference between predictive AI and explainable AI (XAI): in fast-paced logistics, operators don't just need a recommendation—they need to understand the economic justification behind it to trust the tool.

What's next for OptiDrive

  • Floating Mobile Overlay: Developing an Android Accessibility/Overlay service that detects incoming trip alerts directly on top of apps like Uber Eats or DoorDash.
  • Return-Trip Predictive Modeling: Leveraging accumulated TigerData telemetry to calculate the probability of finding a paid return delivery from any destination zone.

  • Custom Vehicle Profiles: Allowing couriers to define exact vehicle metrics (combustion engine mpg, electric vehicle battery drain, or motorcycle wear) for hyper-personalized profit calculations.

Built With

Share this project:

Updates

Submission history