Departure
Traffic and weather-aware optimal-leave-time calculation. The differentiator.
Endpoints
Object shape
The departure object describes the optimal time-to-leave window for an event, given live traffic and weather.
| Field | Type | Description | |
|---|---|---|---|
| event_id | string | Reference event. | |
| earliest_departure | datetime | Leave by this time to arrive comfortably on time. | |
| latest_departure | datetime | Last safe departure — leaving after risks lateness. | |
| travel | object | Decomposed: total_minutes, drive_minutes, parking_minutes, walk_minutes. | |
| traffic_level | string | free, light, moderate, heavy, severe. | |
| weather | object? | Forecast at the destination at arrival time. | |
| weather_warning | object? | Active weather warning, if any. | |
| confidence | string | low, medium, high. | |
| calculated_at | datetime | When this snapshot was computed. | |
| next_recalc_at | datetime | When ChronaPilot will recompute (typically every 1–10 min). |
Stateless compute
POST /v1/departure/compute
Compute a departure for a hypothetical event without persisting anything. Useful for booking flows that want a leave-time estimate before the user confirms.
| Field | Type | Description |
|---|---|---|
| from_location | object | required — lat/lng or address. |
| to_location | object | required — lat/lng or address. |
| arrive_by | datetime | required — desired arrival time. |
| travel.mode | string | drive (default), walk, transit. |
| travel.parking_buffer_min | integer | Default 5. |
Stateful — current departure
GET /v1/events/{id}/departureReturns the latest cached departure for an event under monitoring. The event must have a location.
Force a recompute
POST /v1/events/{id}/departure/recomputeBypasses the cache and runs a fresh routing + traffic + weather lookup. Rate-limited to 4 per minute per event.
Background monitoring
Every event with a future start time and a location is monitored automatically. ChronaPilot recomputes:
- Every 5 minutes when more than 3 hours from start.
- Every 2 minutes when within 3 hours.
- Every 60 seconds when within 30 minutes.
Updates fire departure.updated. Threshold crossings (e.g. "you should leave in 5 minutes") fire departure.threshold_reached.
Reference implementation
- DepartureCalculator.cs — algorithm
- AzureMapsRouteClient.cs — routing
- AzureMapsWeatherClient.cs — weather
- AlertEvaluationService.cs — background loop
- EventMonitoring.cs — persisted state