Deal Engine and multi-modal transit architecture¶
Two self-hosted subsystems keep Paladio independent of commercial itinerary aggregators: a TimescaleDB-backed flight and lodging Deal Engine that scores packages against P10 quantile baselines and realism gates, and a 14-table local GTFS + Valhalla + 5-tier fare transit stack.
Continuous flight and lodging Deal Engine¶
backend/app/engine/market/ runs scheduled daily sweeps (03:00 UTC) and on-demand route backfills to catch statistically rare price drops rather than noisy promotional banners.
Experimental data scraping
While the quantile baseline, verdict, and itinerary gating pipeline is deterministic, the flight and lodging data scraping layer is currently experimental and subject to upstream provider changes.
flowchart LR
Flights["Aviasales Cache API + Ryanair Public API"] --> Ticks["TimescaleDB market_price_ticks"]
Ticks --> Daily["price_daily & route_baselines (q02..q90)"]
Daily --> Verdict["Verdict & Detector (P10 / R_MAX / Min Savings)"]
Verdict --> Verifier["Live Fare Verifier + Lodging ProviderRouter"]
Lodging["Booking / Google Travel / Agoda / Trip.com"] --> Verifier
Verifier --> Gate["SovereignItineraryGate (Realism >= 8.0)"]
Gate --> Alerts["deal_candidates & Redis paladio:events & Push Relays"]
- Time-series quantile baselines:
market_price_ticks(TimescaleDB hypertable with compression) aggregates intoprice_dailyandroute_baselinesacross 6 booking lead-time buckets (0–7,8–21,22–60,61–120,121–240,241+days) with 7 quantiles (q02,q05,q10,q25,q50,q75,q90) over a 540-day window and hierarchical fallback (full,drop_lead,drop_month). - Lodging sharding and entity resolution:
ShardPlanner,LodgingAggregator, andEntityResolverqueryBookingScraperProvider,GoogleTravelHotelsProvider,AgodaProvider,TripComProvider, andHistoryQuoteProviderthroughProviderRouter(circuit breakers at5failures / 24-hour cooldown and daily tier call budgets), deduplicating cross-provider hotels and scoring candidates via taste-aware weights (price 0.30,quality 0.25,location 0.20,taste 0.15,flexibility 0.05,trust 0.05). - Feasibility and realism gating: Candidates passing
MIN_ABS_SAVINGS_CENTS(30.00EUR), flight dead-window checks (00:00–05:00local),MIN_ON_GROUND_HOURS(36hours), andLODGING_MIN_QUALITY(70.0) must clearSovereignItineraryGate(REALISM_MIN >= 8.0) before firing alerts or pairing with public holidays (DealPackageService).
Multi-modal transit and 5-tier fare engine¶
Paladio derives local transit feeds into indexed relational tables instead of keeping heavy graph engines loaded for every city on Earth simultaneously.
- Valhalla street graphs:
OSMMapServicedownloads OSM extracts intovalhalladata(/custom_files), powering local walking, cycling, and driving legs plusN x Nsolver distance matrices. - GTFS ingestion and 14-table derivation:
GTFSResolverService+build_city_gtfs_taskfetch and sanitize feeds intogtfsdata, thenTransitDerivationServicenormalizes agencies, lines, stations, patterns, stops, pattern trips, station-line links, service summaries, service calendar days, shapes, transfers, and fare tables directly in PostgreSQL (transit_*). - Transitous live fallback:
TransitousServicequeries MOTIS transit routing with Redis caching whenever a destination lacks compiled local GTFS coverage (UNAVAILABLEintransit_coverage). - 5-tier
FareResolver: Estimates leg fares and daily pass recommendations (get_transit_pass_advice) from compiled GTFS fare rules, dedicated adapters (Tokyo ODPTandLondon TfL), and cited officialtransit_fare_quotes(reseeded byscripts/migrate_verified_fares_to_quotes.py).