miller345 commited on
Commit
7dc6571
·
verified ·
1 Parent(s): 315c496

Add seeded environment data, provenance, statistics, and dataset card

Browse files
.gitattributes CHANGED
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ data/airline_routes.json filter=lfs diff=lfs merge=lfs -text
LICENSES.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Source licenses and attribution
2
+
3
+ No source data license has been established for the bundled route file. This private release records the existing reference input and does not assign a new license to it or to the original application fixtures.
4
+
5
+ The direct input is the application’s bundled `airline_routes.json`. It contains airport locations, route distances and durations, and carrier identifiers. The original external provider of this bundled reference file is undocumented. Dated flight offers, fares, and amenities are generated by application code.
6
+
7
+ No blanket license is assigned to components whose reuse terms are undocumented. Source-specific declarations and per-item notices describe their respective content. Synthetic benchmark fixtures are identified separately from source-derived records.
README.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: "Flight Search Data"
3
+ tags:
4
+ - webarena-pro
5
+ - web-agents
6
+ - benchmark-environment
7
+ - tabular
8
+ - geospatial
9
+ ---
10
+
11
+ **Flight Search Data** provides airport and route reference records used by WebArena-Pro’s Flight Search environment, a locally hosted flight-search and booking application for evaluating web agents.
12
+
13
+ The direct input is the application’s bundled `airline_routes.json`. It contains airport locations, route distances and durations, and carrier identifiers. The original external provider of this bundled reference file is undocumented. Dated flight offers, fares, and amenities are generated by application code.
14
+
15
+ We prepared the released content for local use in the environment:
16
+
17
+ - Preserved the bundled airport and route reference file without rewriting its values.
18
+ - Exported one airport per JSONL record and one directed route per JSONL record.
19
+ - Included the deterministic offer-generation preparation code; generated offers vary with route, date, and search parameters.
20
+
21
+ | Statistic | Value |
22
+ |---|---:|
23
+ | Airports | 3770 |
24
+ | Directed route entries | 55627 |
25
+ | Routes with carrier data | 55274 |
26
+ | Routes omitted by the application for missing carrier data | 353 |
27
+ | Local release files before documentation | 8 |
28
+ | Local payload size | 30,311,610 bytes (30.31 MB / 28.91 MiB) |
29
+
30
+ Reference files are under `data/`; generation and loading code is under `preparation/`. Route entries are not a count of dated flights.
31
+
32
+ No source data license has been established for the bundled route file. This private release records the existing reference input and does not assign a new license to it or to the original application fixtures.
33
+
34
+ The application is maintained in the [WebArena-Pro repository](https://github.com/McGill-NLP/webarena-pro).
data/airline_routes.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e8d97548f626230927e3e38b8ba9712710612ef90292e9a0696698d20b3bac3
3
+ size 21798276
data/airports.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/routes.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
preparation/config.py ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Pricing constants and configuration."""
2
+
3
+ # Base price formula
4
+ BASE_FIXED_USD = 40
5
+ BASE_PER_KM_USD = 0.08
6
+
7
+ # Cabin class multipliers
8
+ CLASS_MULTIPLIERS = {
9
+ "economy": 1.0,
10
+ "premium_economy": 1.6,
11
+ "business": 3.2,
12
+ "first": 5.5,
13
+ }
14
+
15
+ # Day-of-week multipliers (0=Monday, 6=Sunday)
16
+ DAY_MULTIPLIERS = {
17
+ 0: 0.90, # Monday
18
+ 1: 0.90, # Tuesday
19
+ 2: 0.90, # Wednesday
20
+ 3: 1.00, # Thursday
21
+ 4: 1.15, # Friday
22
+ 5: 1.05, # Saturday
23
+ 6: 1.10, # Sunday
24
+ }
25
+
26
+ # Season multipliers by month
27
+ SEASON_MULTIPLIERS = {
28
+ 1: 0.85, # January - off season
29
+ 2: 0.85, # February - off season
30
+ 3: 0.95, # March
31
+ 4: 1.00, # April
32
+ 5: 1.05, # May
33
+ 6: 1.15, # June - summer peak
34
+ 7: 1.20, # July - summer peak
35
+ 8: 1.15, # August - summer peak
36
+ 9: 0.90, # September - off season
37
+ 10: 0.95, # October
38
+ 11: 1.00, # November
39
+ 12: 1.40, # December - Christmas
40
+ }
41
+
42
+ # Season bonus for EU destinations in summer
43
+ EU_SUMMER_BONUS = 0.15 # +15% on top of summer multiplier
44
+ EU_CONTINENTS = {"EU"}
45
+ EU_SUMMER_MONTHS = {6, 7, 8}
46
+
47
+ # Demand multipliers
48
+ MONOPOLY_ROUTE_BONUS = 0.20 # +20% if only 1 carrier
49
+ HIGH_COMPETITION_DISCOUNT = 0.05 # -5% if 4+ carriers
50
+
51
+ # Advance booking multipliers (days before departure)
52
+ ADVANCE_MULTIPLIERS = [
53
+ (3, 1.85), # 0-3 days: +85% (last-minute premium)
54
+ (7, 1.50), # 4-7 days: +50%
55
+ (14, 1.20), # 8-14 days: +20%
56
+ (21, 1.10), # 15-21 days: +10%
57
+ (60, 1.00), # 22-60 days: base
58
+ (90, 0.90), # 61-90 days: -10%
59
+ (float("inf"), 0.95), # 91+ days: -5%
60
+ ]
61
+
62
+ # Short-distance surcharge (flat fee added to very short flights)
63
+ # Waived for legs that are part of a connecting itinerary, but NOT for round trips.
64
+ SHORT_DISTANCE_THRESHOLD_KM = 500
65
+ SHORT_DISTANCE_FEE_MIN = 50
66
+ SHORT_DISTANCE_FEE_MAX = 150
67
+
68
+ # Jitter range (±8%)
69
+ JITTER_RANGE = 0.08
70
+
71
+ # Hub detection thresholds
72
+ HUB_MIN_ROUTES = 100
73
+ HUB_TOP_N = 125
74
+
75
+ # Connecting flight constraints
76
+ MAX_1STOP_DISTANCE_RATIO = 1.8 # Max total distance vs great-circle
77
+ MAX_2STOP_DISTANCE_RATIO = 2.5
78
+ MAX_LAYOVER_MINUTES = 360 # 6 hours
79
+
80
+ # Minimum connection time (MCT) by connection type.
81
+ # A leg is "domestic" if origin and destination share the same country_code,
82
+ # "international" otherwise. The tuple key is (arriving_leg_type, departing_leg_type).
83
+ MIN_CONNECTION_MINUTES: dict[tuple[str, str], int] = {
84
+ ("domestic", "domestic"): 45, # Same terminal / no customs
85
+ ("domestic", "international"): 75, # Need international departure processing
86
+ ("international", "domestic"): 90, # Customs & immigration on arrival
87
+ ("international", "international"): 120, # Customs + international re-departure
88
+ }
89
+ # Fallback used when connection type can't be determined
90
+ MIN_LAYOVER_MINUTES = 60
91
+ # Layovers shorter than this trigger a "Short connection" warning
92
+ SHORT_CONNECTION_MINUTES = 90
93
+
94
+ # Flight generation
95
+ MIN_FLIGHTS_PER_DAY = 1
96
+ MAX_FLIGHTS_SINGLE_CARRIER = 3
97
+ MAX_FLIGHTS_MULTI_CARRIER = 15
98
+ DEPARTURE_HOUR_MIN = 5 # 05:00 (fallback only)
99
+ DEPARTURE_HOUR_MAX = 23 # 23:00 (fallback only)
100
+
101
+ # ---------------------------------------------------------------------------
102
+ # Realistic departure time distributions by route type
103
+ # ---------------------------------------------------------------------------
104
+ # Each list has 24 entries (index 0 = midnight, 23 = 11 PM).
105
+ # Higher weight = more departures at that hour.
106
+ DEPARTURE_WEIGHTS: dict[str, list[int]] = {
107
+ # NA → EU: Evening departures, arrive early morning EU time
108
+ "na_to_eu": [
109
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 4, 5, 8, 12, 15, 14, 10, 7, 4, 1,
110
+ ],
111
+ # EU → NA: Daytime departures, arrive daytime NA
112
+ "eu_to_na": [
113
+ 0, 0, 0, 0, 0, 0, 1, 3, 7, 12, 15, 14, 10, 8, 5, 3, 2, 1, 1, 0, 0, 0, 0, 0,
114
+ ],
115
+ # NA → Asia: Late morning / early afternoon departures
116
+ "na_to_asia": [
117
+ 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 12, 15, 14, 10, 7, 4, 2, 1, 0, 0, 0, 0, 0,
118
+ ],
119
+ # Asia → NA: Afternoon departures, arrive same day NA
120
+ "asia_to_na": [
121
+ 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 7, 10, 14, 14, 10, 7, 4, 2, 1, 0, 0, 0, 0,
122
+ ],
123
+ # EU → Asia: afternoon–evening lean
124
+ "eu_to_asia": [
125
+ 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 8, 7, 5, 3, 2, 1, 0,
126
+ ],
127
+ # Asia → EU: late-night departures (23:00–02:30), arrive morning EU
128
+ "asia_to_eu": [
129
+ 5, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 8, 14,
130
+ ],
131
+ # Domestic / same-continent: morning rush + evening rush
132
+ "domestic": [
133
+ 0, 0, 0, 0, 0, 1, 4, 8, 10, 8, 6, 5, 5, 5, 5, 5, 6, 8, 8, 5, 3, 2, 1, 0,
134
+ ],
135
+ # Default intercontinental: broad daytime bell curve
136
+ "default": [
137
+ 0, 0, 0, 0, 0, 1, 3, 5, 7, 8, 8, 7, 6, 6, 6, 6, 6, 6, 5, 4, 3, 2, 1, 0,
138
+ ],
139
+ }
140
+
141
+ # Popularity-based time window limits (num_carriers → earliest, latest hour allowed)
142
+ # Routes with fewer carriers get a tighter daytime-only window.
143
+ POPULARITY_TIME_LIMITS: list[tuple[int, int, int]] = [
144
+ # (min_carriers, earliest_hour, latest_hour)
145
+ (8, 5, 23), # Very popular: 5 AM – 11 PM
146
+ (4, 6, 22), # Popular: 6 AM – 10 PM
147
+ (2, 6, 21), # Moderate: 6 AM – 9 PM
148
+ (0, 7, 21), # Low: 7 AM – 9 PM
149
+ ]
150
+
151
+ # Midnight–5 AM curfew multiplier by airport size (route count threshold)
152
+ # Smaller airports have essentially zero overnight flights; major hubs keep some.
153
+ CURFEW_FACTORS: list[tuple[int, float]] = [
154
+ # (min_routes, factor applied to 0:00–5:59 weights)
155
+ (200, 0.25), # Major hubs
156
+ (100, 0.10), # Large airports
157
+ (50, 0.04), # Medium airports
158
+ (0, 0.01), # Small airports — near-zero
159
+ ]
160
+
161
+ # Hub airport bonus to total flight count
162
+ HUB_FLIGHT_BONUS: list[tuple[int, int, int]] = [
163
+ # (min_routes, bonus_min, bonus_max)
164
+ (200, 3, 6),
165
+ (100, 1, 4),
166
+ (50, 0, 2),
167
+ ]
168
+
169
+ # Route types with intentional late-night / early-morning departures.
170
+ # These skip the popularity window and airport curfew so the overnight
171
+ # pattern encoded in DEPARTURE_WEIGHTS is preserved.
172
+ OVERNIGHT_EXEMPT_ROUTES: set[str] = {"asia_to_eu"}
173
+
174
+ # Maximum random extension to the popularity latest-hour (in minutes).
175
+ # Popular routes can have departures up to this much later than the base limit.
176
+ POPULARITY_LATEST_EXTENSION_MAX = 90 # 1.5 hours
177
+
178
+ # Departure-weight per-hour jitter range (±fraction applied to each hourly weight)
179
+ DEPARTURE_WEIGHT_JITTER = 0.20
180
+
181
+ # Aircraft types by distance
182
+ AIRCRAFT_BY_DISTANCE = [
183
+ (500, ["E190", "E175", "CRJ-900"]),
184
+ (2000, ["A320", "A321", "737-800", "737 MAX 8"]),
185
+ (5000, ["A321neo LR", "757-200", "767-300ER"]),
186
+ (10000, ["787-8", "787-9", "A330-300", "A350-900"]),
187
+ (float("inf"), ["777-300ER", "A350-1000", "787-10", "A380"]),
188
+ ]
189
+
190
+ # Connection discount (applied per-leg for any connecting itinerary)
191
+ CONNECTING_BASE_DISCOUNT = 0.75 # 25% off each leg vs buying separately
192
+
193
+ # Same-airline connection bonus: additional discount when all segments
194
+ # in a connecting itinerary are operated by the same carrier.
195
+ # Stacks with CONNECTING_BASE_DISCOUNT: effective = 0.75 * 0.88 = 0.66 (34% off)
196
+ SAME_AIRLINE_CONNECTION_DISCOUNT = 0.88 # Extra 12% off on top of base connection discount
197
+
198
+ # Round-trip same-airline discount: when a return flight is on the same carrier
199
+ # as an outbound flight, the return leg gets this multiplier.
200
+ # Simulates bundled round-trip fares offered by airlines.
201
+ ROUND_TRIP_SAME_AIRLINE_DISCOUNT = 0.92 # 8% off the return leg
202
+
203
+ # CO2 emissions estimate (kg per passenger per km)
204
+ # Source: ICAO Carbon Emissions Calculator methodology
205
+ # Economy baseline ~0.09 kg/km, scales with cabin class (more space = more emissions share)
206
+ EMISSIONS_KG_PER_KM = {
207
+ "economy": 0.09,
208
+ "premium_economy": 0.13,
209
+ "business": 0.25,
210
+ "first": 0.35,
211
+ }
212
+
213
+ # "Best" flight ranking: top N flights by composite score are tagged is_best=True
214
+ BEST_FLIGHTS_COUNT = 3
215
+ # Composite score weights for "best" ranking
216
+ BEST_WEIGHT_PRICE = 0.45
217
+ BEST_WEIGHT_DURATION = 0.35
218
+ BEST_WEIGHT_STOPS = 0.20
219
+
220
+ # Amenity generation rules
221
+ # Legroom ranges (inches) by cabin class
222
+ LEGROOM_RANGES = {
223
+ "economy": (29, 32),
224
+ "premium_economy": (34, 38),
225
+ "business": (38, 78),
226
+ "first": (78, 86),
227
+ }
228
+
229
+ # WiFi probability by aircraft family (widebody long-haul more likely)
230
+ WIFI_AIRCRAFT = {
231
+ "787-8": 0.95, "787-9": 0.95, "787-10": 0.95,
232
+ "A350-900": 0.92, "A350-1000": 0.92,
233
+ "A330-300": 0.70, "777-300ER": 0.85,
234
+ "A380": 0.80,
235
+ "A321neo LR": 0.80, "757-200": 0.50, "767-300ER": 0.60,
236
+ "A320": 0.55, "A321": 0.60, "737-800": 0.50, "737 MAX 8": 0.75,
237
+ "E190": 0.25, "E175": 0.20, "CRJ-900": 0.15,
238
+ }
239
+
240
+ # Power/USB probability by aircraft family
241
+ POWER_AIRCRAFT = {
242
+ "787-8": 0.95, "787-9": 0.95, "787-10": 0.95,
243
+ "A350-900": 0.95, "A350-1000": 0.95,
244
+ "A330-300": 0.75, "777-300ER": 0.85,
245
+ "A380": 0.90,
246
+ "A321neo LR": 0.80, "757-200": 0.40, "767-300ER": 0.55,
247
+ "A320": 0.45, "A321": 0.50, "737-800": 0.40, "737 MAX 8": 0.70,
248
+ "E190": 0.15, "E175": 0.10, "CRJ-900": 0.05,
249
+ }
250
+
251
+ # Video probability (seatback IFE) — mostly widebody long-haul
252
+ VIDEO_AIRCRAFT = {
253
+ "787-8": 0.90, "787-9": 0.92, "787-10": 0.92,
254
+ "A350-900": 0.93, "A350-1000": 0.93,
255
+ "A330-300": 0.80, "777-300ER": 0.90,
256
+ "A380": 0.95,
257
+ "A321neo LR": 0.40, "757-200": 0.25, "767-300ER": 0.60,
258
+ "A320": 0.10, "A321": 0.12, "737-800": 0.08, "737 MAX 8": 0.15,
259
+ "E190": 0.0, "E175": 0.0, "CRJ-900": 0.0,
260
+ }
261
+
262
+ # Business/first class always get power and higher WiFi/video odds
263
+ PREMIUM_CLASS_AMENITY_BOOST = 0.30 # +30% probability for business/first
264
+
265
+ # Search limits
266
+ MAX_RESULTS = 200
267
+ MAX_AUTOCOMPLETE_RESULTS = 10
268
+
269
+ # ---------------------------------------------------------------------------
270
+ # Currency exchange rates (USD base)
271
+ # ---------------------------------------------------------------------------
272
+ EXCHANGE_RATES: dict[str, float] = {
273
+ "USD": 1.0,
274
+ "EUR": 0.92,
275
+ "GBP": 0.79,
276
+ "JPY": 149.50,
277
+ "CAD": 1.36,
278
+ "AUD": 1.53,
279
+ "CHF": 0.88,
280
+ "CNY": 7.24,
281
+ "INR": 83.12,
282
+ "MXN": 17.15,
283
+ "BRL": 4.97,
284
+ "KRW": 1325.0,
285
+ "SGD": 1.34,
286
+ "HKD": 7.82,
287
+ "NOK": 10.55,
288
+ "SEK": 10.42,
289
+ "DKK": 6.88,
290
+ "NZD": 1.63,
291
+ "ZAR": 18.63,
292
+ "THB": 35.50,
293
+ "TWD": 31.50,
294
+ "PLN": 4.02,
295
+ "TRY": 30.25,
296
+ "ILS": 3.67,
297
+ "AED": 3.67,
298
+ "SAR": 3.75,
299
+ "CLP": 925.0,
300
+ "COP": 3950.0,
301
+ "ARS": 830.0,
302
+ "PHP": 55.80,
303
+ "MYR": 4.72,
304
+ "IDR": 15650.0,
305
+ "VND": 24500.0,
306
+ "EGP": 30.90,
307
+ "QAR": 3.64,
308
+ "KWD": 0.31,
309
+ "BHD": 0.38,
310
+ }
311
+
312
+ CURRENCY_SYMBOLS: dict[str, str] = {
313
+ "USD": "$", "EUR": "\u20ac", "GBP": "\u00a3", "JPY": "\u00a5",
314
+ "CAD": "C$", "AUD": "A$", "CHF": "CHF", "CNY": "\u00a5",
315
+ "INR": "\u20b9", "MXN": "MX$", "BRL": "R$", "KRW": "\u20a9",
316
+ "SGD": "S$", "HKD": "HK$", "NOK": "kr", "SEK": "kr",
317
+ "DKK": "kr", "NZD": "NZ$", "ZAR": "R", "THB": "\u0e3f",
318
+ "TWD": "NT$", "PLN": "z\u0142", "TRY": "\u20ba", "ILS": "\u20aa",
319
+ "AED": "AED", "SAR": "SAR", "CLP": "CLP$", "COP": "COP$",
320
+ "ARS": "ARS$", "PHP": "\u20b1", "MYR": "RM", "IDR": "Rp",
321
+ "VND": "\u20ab", "EGP": "E\u00a3", "QAR": "QAR", "KWD": "KD",
322
+ "BHD": "BD",
323
+ }
324
+
325
+ # Map country codes (ISO 3166-1 alpha-2) to default currency
326
+ COUNTRY_CURRENCY_MAP: dict[str, str] = {
327
+ "US": "USD", "GB": "GBP", "DE": "EUR", "FR": "EUR", "IT": "EUR",
328
+ "ES": "EUR", "NL": "EUR", "BE": "EUR", "AT": "EUR", "PT": "EUR",
329
+ "IE": "EUR", "FI": "EUR", "GR": "EUR", "JP": "JPY", "CA": "CAD",
330
+ "AU": "AUD", "CH": "CHF", "CN": "CNY", "IN": "INR", "MX": "MXN",
331
+ "BR": "BRL", "KR": "KRW", "SG": "SGD", "HK": "HKD", "NO": "NOK",
332
+ "SE": "SEK", "DK": "DKK", "NZ": "NZD", "ZA": "ZAR", "TH": "THB",
333
+ "TW": "TWD", "PL": "PLN", "TR": "TRY", "IL": "ILS", "AE": "AED",
334
+ "SA": "SAR", "CL": "CLP", "CO": "COP", "AR": "ARS", "PH": "PHP",
335
+ "MY": "MYR", "ID": "IDR", "VN": "VND", "EG": "EGP", "QA": "QAR",
336
+ "KW": "KWD", "BH": "BHD",
337
+ }
preparation/data_loader.py ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Load airline_routes.json and build in-memory route graph + search index."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import os
7
+ from dataclasses import dataclass, field
8
+
9
+
10
+ @dataclass
11
+ class Route:
12
+ destination: str
13
+ distance_km: int
14
+ duration_min: int
15
+ carriers: list[dict] # [{"iata": "AA", "name": "American Airlines"}, ...]
16
+
17
+
18
+ @dataclass
19
+ class Airport:
20
+ iata: str
21
+ name: str
22
+ city_name: str
23
+ country: str
24
+ country_code: str
25
+ continent: str
26
+ latitude: float
27
+ longitude: float
28
+ timezone: str
29
+ elevation: int
30
+ icao: str
31
+ display_name: str
32
+ routes: list[Route] = field(default_factory=list)
33
+ hub_score: float = 0.0
34
+
35
+
36
+ class RouteGraph:
37
+ """In-memory route graph and search index."""
38
+
39
+ def __init__(self) -> None:
40
+ self.airports: dict[str, Airport] = {}
41
+ # route_map[origin_iata][dest_iata] = Route
42
+ self.route_map: dict[str, dict[str, Route]] = {}
43
+ # Search index: lowercase tokens → set of IATA codes
44
+ self._search_index: dict[str, set[str]] = {}
45
+
46
+ def load(self, filepath: str) -> None:
47
+ with open(filepath) as f:
48
+ data: dict = json.load(f)
49
+
50
+ for iata, info in data.items():
51
+ routes = []
52
+ for r in info.get("routes", []):
53
+ if not r["carriers"]:
54
+ continue # Skip routes with no carrier data
55
+ routes.append(Route(
56
+ destination=r["iata"],
57
+ distance_km=r["km"],
58
+ duration_min=r["min"],
59
+ carriers=r["carriers"],
60
+ ))
61
+
62
+ airport = Airport(
63
+ iata=iata,
64
+ name=info["name"],
65
+ city_name=info["city_name"],
66
+ country=info["country"],
67
+ country_code=info["country_code"],
68
+ continent=info["continent"],
69
+ latitude=float(info["latitude"]) if info.get("latitude") is not None else 0.0,
70
+ longitude=float(info["longitude"]) if info.get("longitude") is not None else 0.0,
71
+ timezone=info.get("timezone", "UTC"),
72
+ elevation=info.get("elevation", 0),
73
+ icao=info.get("icao", ""),
74
+ display_name=info.get("display_name", f"{info['city_name']} ({iata})"),
75
+ routes=routes,
76
+ )
77
+ self.airports[iata] = airport
78
+
79
+ # Build route map
80
+ self.route_map.setdefault(iata, {})
81
+ for route in routes:
82
+ self.route_map[iata][route.destination] = route
83
+
84
+ # Build search index
85
+ self._index_airport(airport)
86
+
87
+ def _index_airport(self, airport: Airport) -> None:
88
+ tokens = set()
89
+ # IATA code
90
+ tokens.add(airport.iata.lower())
91
+ # City name tokens
92
+ for word in airport.city_name.lower().split():
93
+ tokens.add(word)
94
+ # Airport name tokens
95
+ for word in airport.name.lower().split():
96
+ tokens.add(word)
97
+ # Country
98
+ for word in airport.country.lower().split():
99
+ tokens.add(word)
100
+ # Country code
101
+ tokens.add(airport.country_code.lower())
102
+
103
+ for token in tokens:
104
+ # Index exact token and all prefixes ≥ 2 chars
105
+ for i in range(2, len(token) + 1):
106
+ prefix = token[:i]
107
+ self._search_index.setdefault(prefix, set()).add(airport.iata)
108
+
109
+ def search_airports(self, query: str, limit: int = 10) -> list[Airport]:
110
+ """Search airports by IATA code, city, name, or country."""
111
+ q = query.strip().lower()
112
+ if not q:
113
+ return []
114
+
115
+ # Exact IATA match first
116
+ if len(q) == 3 and q.upper() in self.airports:
117
+ exact = self.airports[q.upper()]
118
+ results = [exact]
119
+ # Add more results from prefix search
120
+ candidates = self._search_index.get(q, set())
121
+ for iata in candidates:
122
+ if iata != exact.iata:
123
+ results.append(self.airports[iata])
124
+ if len(results) >= limit:
125
+ break
126
+ return results[:limit]
127
+
128
+ # Split query into tokens, intersect matches
129
+ query_tokens = q.split()
130
+ if not query_tokens:
131
+ return []
132
+
133
+ # Get candidates matching first token
134
+ candidates = self._search_index.get(query_tokens[0], set()).copy()
135
+
136
+ # Intersect with additional tokens
137
+ for token in query_tokens[1:]:
138
+ token_matches = self._search_index.get(token, set())
139
+ candidates &= token_matches
140
+
141
+ if not candidates:
142
+ return []
143
+
144
+ # Sort by hub score (descending), then alphabetically
145
+ airports = [self.airports[iata] for iata in candidates if iata in self.airports]
146
+ airports.sort(key=lambda a: (-a.hub_score, a.city_name))
147
+ return airports[:limit]
148
+
149
+ def get_direct_route(self, origin: str, destination: str) -> Route | None:
150
+ return self.route_map.get(origin, {}).get(destination)
151
+
152
+ def get_outbound_routes(self, origin: str) -> dict[str, Route]:
153
+ return self.route_map.get(origin, {})
154
+
155
+
156
+ # Singleton
157
+ _graph: RouteGraph | None = None
158
+
159
+
160
+ def get_route_graph() -> RouteGraph:
161
+ global _graph
162
+ if _graph is None:
163
+ _graph = RouteGraph()
164
+ data_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "airline_routes.json")
165
+ _graph.load(data_path)
166
+ return _graph
preparation/flight_generator.py ADDED
@@ -0,0 +1,547 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Generate concrete flights for a route + date."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import random
6
+ from datetime import date, datetime, timedelta, timezone
7
+
8
+ from zoneinfo import ZoneInfo
9
+
10
+ from .config import (
11
+ AIRCRAFT_BY_DISTANCE,
12
+ CONNECTING_BASE_DISCOUNT,
13
+ CURFEW_FACTORS,
14
+ DEPARTURE_WEIGHT_JITTER,
15
+ DEPARTURE_WEIGHTS,
16
+ EMISSIONS_KG_PER_KM,
17
+ HUB_FLIGHT_BONUS,
18
+ LEGROOM_RANGES,
19
+ MAX_FLIGHTS_MULTI_CARRIER,
20
+ MAX_FLIGHTS_SINGLE_CARRIER,
21
+ MAX_LAYOVER_MINUTES,
22
+ MIN_CONNECTION_MINUTES,
23
+ MIN_FLIGHTS_PER_DAY,
24
+ MIN_LAYOVER_MINUTES,
25
+ OVERNIGHT_EXEMPT_ROUTES,
26
+ POPULARITY_LATEST_EXTENSION_MAX,
27
+ POPULARITY_TIME_LIMITS,
28
+ POWER_AIRCRAFT,
29
+ PREMIUM_CLASS_AMENITY_BOOST,
30
+ SAME_AIRLINE_CONNECTION_DISCOUNT,
31
+ SHORT_CONNECTION_MINUTES,
32
+ VIDEO_AIRCRAFT,
33
+ WIFI_AIRCRAFT,
34
+ )
35
+ from .data_loader import Route, RouteGraph
36
+ from .models import CabinClass, FlightOffer, FlightSegment, LayoverInfo
37
+ from .price_engine import compute_price
38
+ from .route_finder import RoutePlan
39
+ from .seed_utils import seeded_random
40
+
41
+
42
+ def _pick_aircraft(distance_km: int, rng: random.Random) -> str:
43
+ for max_dist, aircraft_list in AIRCRAFT_BY_DISTANCE:
44
+ if distance_km <= max_dist:
45
+ return rng.choice(aircraft_list)
46
+ return "777-300ER"
47
+
48
+
49
+ def _make_flight_number(carrier_iata: str, rng: random.Random) -> str:
50
+ return f"{carrier_iata}{rng.randint(100, 9999)}"
51
+
52
+
53
+ def _generate_amenities(
54
+ aircraft: str, cabin_class: CabinClass, distance_km: int, rng: random.Random,
55
+ ) -> dict:
56
+ """Generate seat amenities based on aircraft, cabin class, and distance."""
57
+ cls = cabin_class.value
58
+ lo, hi = LEGROOM_RANGES.get(cls, (29, 32))
59
+ legroom = rng.randint(lo, hi)
60
+
61
+ is_premium = cls in ("business", "first")
62
+ boost = PREMIUM_CLASS_AMENITY_BOOST if is_premium else 0.0
63
+
64
+ # WiFi
65
+ wifi_prob = min(1.0, WIFI_AIRCRAFT.get(aircraft, 0.3) + boost)
66
+ has_wifi = rng.random() < wifi_prob
67
+ wifi_type = None
68
+ if has_wifi:
69
+ # Free WiFi more common on premium classes and newer aircraft
70
+ free_prob = 0.7 if is_premium else (0.3 if aircraft.startswith(("787", "A35")) else 0.12)
71
+ wifi_type = "Free Wi-Fi" if rng.random() < free_prob else "Wi-Fi for a fee"
72
+
73
+ # Power & USB
74
+ power_prob = min(1.0, POWER_AIRCRAFT.get(aircraft, 0.2) + boost)
75
+ has_power = rng.random() < power_prob
76
+ # USB slightly more common than AC power
77
+ has_usb = has_power or rng.random() < min(1.0, power_prob + 0.15)
78
+
79
+ # Video/IFE
80
+ video_prob = min(1.0, VIDEO_AIRCRAFT.get(aircraft, 0.05) + boost)
81
+ # Long-haul (>4000km) gets a boost
82
+ if distance_km > 4000:
83
+ video_prob = min(1.0, video_prob + 0.15)
84
+ has_video = rng.random() < video_prob
85
+ video_type = None
86
+ if has_video:
87
+ if aircraft in ("A380", "777-300ER", "787-9", "787-10", "A350-900", "A350-1000"):
88
+ video_type = "On-demand video"
89
+ elif distance_km > 3000:
90
+ video_type = "On-demand video" if rng.random() < 0.7 else "Seatback screen"
91
+ else:
92
+ video_type = "Live TV" if rng.random() < 0.4 else "Seatback screen"
93
+
94
+ return {
95
+ "legroom_inches": legroom,
96
+ "has_wifi": has_wifi,
97
+ "wifi_type": wifi_type,
98
+ "has_power": has_power,
99
+ "has_usb": has_usb,
100
+ "has_video": has_video,
101
+ "video_type": video_type,
102
+ }
103
+
104
+
105
+ def _classify_route_type(origin_continent: str, dest_continent: str) -> str:
106
+ """Classify a route for departure time distribution selection.
107
+
108
+ Returns a key into DEPARTURE_WEIGHTS.
109
+ """
110
+ if origin_continent == dest_continent:
111
+ return "domestic"
112
+ o, d = origin_continent, dest_continent
113
+ if o == "NA" and d == "EU":
114
+ return "na_to_eu"
115
+ if o == "EU" and d == "NA":
116
+ return "eu_to_na"
117
+ if o == "NA" and d == "AS":
118
+ return "na_to_asia"
119
+ if o == "AS" and d == "NA":
120
+ return "asia_to_na"
121
+ if o == "EU" and d == "AS":
122
+ return "eu_to_asia"
123
+ if o == "AS" and d == "EU":
124
+ return "asia_to_eu"
125
+ return "default"
126
+
127
+
128
+ def _build_departure_weights(
129
+ route_type: str,
130
+ num_carriers: int,
131
+ origin_route_count: int,
132
+ rng: random.Random,
133
+ ) -> list[float]:
134
+ """Build hourly departure weights adjusted for popularity, curfew, and jitter.
135
+
136
+ Returns a 24-element list of non-negative floats (one weight per hour 0–23).
137
+
138
+ Overnight-exempt routes (e.g. asia_to_eu with 23:00–02:30 departures)
139
+ skip the popularity window and curfew so their late-night pattern is
140
+ preserved intact.
141
+ """
142
+ base = list(DEPARTURE_WEIGHTS.get(route_type, DEPARTURE_WEIGHTS["default"]))
143
+ weights = [float(w) for w in base]
144
+
145
+ is_overnight = route_type in OVERNIGHT_EXEMPT_ROUTES
146
+
147
+ if not is_overnight:
148
+ # 1. Popularity-based time window: zero out hours outside the range
149
+ earliest, latest = 7, 21 # defaults
150
+ for min_carriers, eh, lh in POPULARITY_TIME_LIMITS:
151
+ if num_carriers >= min_carriers:
152
+ earliest, latest = eh, lh
153
+ break
154
+ # Random extension up to 1.5 h on the latest hour
155
+ if num_carriers >= 2:
156
+ latest = min(23, latest + rng.randint(0, POPULARITY_LATEST_EXTENSION_MAX) // 60)
157
+ for h in range(0, earliest):
158
+ weights[h] = 0.0
159
+ for h in range(latest + 1, 24):
160
+ weights[h] = 0.0
161
+
162
+ # 2. Airport curfew: reduce midnight–5 AM based on airport size
163
+ curfew_factor = 0.01
164
+ for min_routes, factor in CURFEW_FACTORS:
165
+ if origin_route_count >= min_routes:
166
+ curfew_factor = factor
167
+ break
168
+ for h in range(0, 6):
169
+ weights[h] *= curfew_factor
170
+
171
+ # 3. Per-route jitter: ±DEPARTURE_WEIGHT_JITTER on each hour
172
+ for h in range(24):
173
+ if weights[h] > 0:
174
+ jitter = 1.0 - DEPARTURE_WEIGHT_JITTER + 2 * DEPARTURE_WEIGHT_JITTER * rng.random()
175
+ weights[h] *= jitter
176
+
177
+ return weights
178
+
179
+
180
+ def _sample_departure_minutes(
181
+ weights: list[float], num_flights: int, rng: random.Random,
182
+ ) -> list[int]:
183
+ """Sample N departure times (minutes since midnight) from hourly weights.
184
+
185
+ Each sampled departure gets a random minute offset within its chosen hour.
186
+ Returns sorted list.
187
+ """
188
+ total = sum(weights)
189
+ if total <= 0:
190
+ # Fallback: uniform 7 AM – 9 PM
191
+ return sorted(rng.randint(7 * 60, 21 * 60) for _ in range(num_flights))
192
+
193
+ # Sample hours via weighted random selection
194
+ hours = rng.choices(range(24), weights=weights, k=num_flights)
195
+ # Convert to minutes with random offset within the hour
196
+ minutes = [h * 60 + rng.randint(0, 59) for h in hours]
197
+ return sorted(minutes)
198
+
199
+
200
+ def _carrier_weights_at_airport(
201
+ graph: RouteGraph, origin: str, leg_carriers: list[dict],
202
+ ) -> list[float]:
203
+ """Weight carriers by their presence at the origin airport.
204
+
205
+ Carriers that operate more routes from this airport (hub carriers)
206
+ get higher selection weight, so they appear on more flights.
207
+ """
208
+ # Count how many routes each carrier operates from origin
209
+ carrier_route_counts: dict[str, int] = {}
210
+ for route in graph.airports[origin].routes:
211
+ for carrier in route.carriers:
212
+ iata = carrier["iata"]
213
+ carrier_route_counts[iata] = carrier_route_counts.get(iata, 0) + 1
214
+
215
+ weights = []
216
+ for carrier in leg_carriers:
217
+ count = carrier_route_counts.get(carrier["iata"], 1)
218
+ # Square-root scaling: hubs get more weight but don't completely dominate
219
+ weights.append(count ** 0.5)
220
+ return weights
221
+
222
+
223
+ def _get_timezone(graph: RouteGraph, iata: str) -> ZoneInfo:
224
+ airport = graph.airports.get(iata)
225
+ if airport and airport.timezone:
226
+ try:
227
+ return ZoneInfo(airport.timezone)
228
+ except KeyError:
229
+ pass
230
+ return ZoneInfo("UTC")
231
+
232
+
233
+ def _leg_type(graph: RouteGraph, origin_iata: str, dest_iata: str) -> str:
234
+ """Return 'domestic' if both airports are in the same country, else 'international'."""
235
+ o = graph.airports.get(origin_iata)
236
+ d = graph.airports.get(dest_iata)
237
+ if o and d and o.country_code == d.country_code:
238
+ return "domestic"
239
+ return "international"
240
+
241
+
242
+ def _min_connection_minutes(
243
+ graph: RouteGraph,
244
+ arriving_origin: str,
245
+ hub: str,
246
+ departing_dest: str,
247
+ ) -> int:
248
+ """Return the minimum connection time at *hub* given the arriving and departing legs."""
249
+ arr_type = _leg_type(graph, arriving_origin, hub)
250
+ dep_type = _leg_type(graph, hub, departing_dest)
251
+ return MIN_CONNECTION_MINUTES.get((arr_type, dep_type), MIN_LAYOVER_MINUTES)
252
+
253
+
254
+ def generate_flights_for_route(
255
+ graph: RouteGraph,
256
+ route_plan: RoutePlan,
257
+ departure_date: date,
258
+ cabin_class: CabinClass,
259
+ hub_iatas: list[str],
260
+ ) -> list[FlightOffer]:
261
+ """Generate concrete flight offers for a route plan on a given date."""
262
+ origin = route_plan.waypoints[0]
263
+ destination = route_plan.waypoints[-1]
264
+
265
+ # Seed based on route + date for determinism
266
+ seed_key = f"{origin}-{destination}-{departure_date.isoformat()}-{cabin_class.value}"
267
+ rng = seeded_random(seed_key, *route_plan.waypoints)
268
+
269
+ if route_plan.stops == 0:
270
+ return _generate_direct_flights(graph, route_plan, departure_date, cabin_class, rng)
271
+ else:
272
+ return _generate_connecting_flights(graph, route_plan, departure_date, cabin_class, rng)
273
+
274
+
275
+ def _generate_direct_flights(
276
+ graph: RouteGraph,
277
+ route_plan: RoutePlan,
278
+ departure_date: date,
279
+ cabin_class: CabinClass,
280
+ rng: random.Random,
281
+ ) -> list[FlightOffer]:
282
+ """Generate multiple direct flight options for a single-leg route."""
283
+ leg = route_plan.legs[0]
284
+ origin = route_plan.waypoints[0]
285
+ destination = route_plan.waypoints[1]
286
+
287
+ origin_airport = graph.airports[origin]
288
+ dest_airport = graph.airports[destination]
289
+ origin_route_count = len(origin_airport.routes)
290
+
291
+ # Number of flights based on carrier count
292
+ num_carriers = len(leg.carriers)
293
+ if num_carriers == 1:
294
+ num_flights = rng.randint(MIN_FLIGHTS_PER_DAY, MAX_FLIGHTS_SINGLE_CARRIER)
295
+ elif num_carriers <= 3:
296
+ num_flights = rng.randint(3, 8)
297
+ else:
298
+ num_flights = rng.randint(8, MAX_FLIGHTS_MULTI_CARRIER)
299
+
300
+ # Hub airport bonus: major airports generate more flights
301
+ for min_routes, bonus_min, bonus_max in HUB_FLIGHT_BONUS:
302
+ if origin_route_count >= min_routes:
303
+ num_flights += rng.randint(bonus_min, bonus_max)
304
+ break
305
+
306
+ # Realistic departure time distribution based on route type
307
+ route_type = _classify_route_type(origin_airport.continent, dest_airport.continent)
308
+ dep_weights = _build_departure_weights(route_type, num_carriers, origin_route_count, rng)
309
+ departure_hours = _sample_departure_minutes(dep_weights, num_flights, rng)
310
+
311
+ origin_tz = _get_timezone(graph, origin)
312
+ dest_tz = _get_timezone(graph, destination)
313
+
314
+ # Pre-compute carrier weights for hub-airline bias
315
+ carrier_wts = _carrier_weights_at_airport(graph, origin, leg.carriers)
316
+
317
+ flights = []
318
+ for dep_minutes in departure_hours:
319
+ carrier = rng.choices(leg.carriers, weights=carrier_wts, k=1)[0]
320
+ dep_hour = dep_minutes // 60
321
+ dep_min = dep_minutes % 60
322
+
323
+ departure_dt = datetime(
324
+ departure_date.year, departure_date.month, departure_date.day,
325
+ dep_hour, dep_min,
326
+ tzinfo=origin_tz,
327
+ )
328
+
329
+ # Calculate arrival
330
+ arrival_dt = departure_dt + timedelta(minutes=leg.duration_min)
331
+ arrival_dt = arrival_dt.astimezone(dest_tz)
332
+
333
+ price = compute_price(
334
+ distance_km=leg.distance_km,
335
+ cabin_class=cabin_class.value,
336
+ departure_date=departure_date,
337
+ departure_hour=dep_hour,
338
+ num_carriers=num_carriers,
339
+ dest_continent=dest_airport.continent,
340
+ rng=rng,
341
+ )
342
+
343
+ flight_id = f"{origin}{destination}{departure_date.isoformat()}{dep_minutes}{carrier['iata']}"
344
+
345
+ aircraft = _pick_aircraft(leg.distance_km, rng)
346
+ amenities = _generate_amenities(aircraft, cabin_class, leg.distance_km, rng)
347
+
348
+ # Overnight: compare local calendar dates in their respective timezones.
349
+ # Python .date() on a tz-aware datetime returns the local date in that tz.
350
+ is_overnight = arrival_dt.date() != departure_dt.date()
351
+
352
+ segment = FlightSegment(
353
+ airline_code=carrier["iata"],
354
+ airline_name=carrier["name"],
355
+ flight_number=_make_flight_number(carrier["iata"], rng),
356
+ aircraft=aircraft,
357
+ origin=origin,
358
+ origin_city=origin_airport.city_name,
359
+ destination=destination,
360
+ destination_city=dest_airport.city_name,
361
+ departure=departure_dt,
362
+ arrival=arrival_dt,
363
+ duration_minutes=leg.duration_min,
364
+ is_overnight=is_overnight,
365
+ **amenities,
366
+ )
367
+
368
+ emissions = int(leg.distance_km * EMISSIONS_KG_PER_KM.get(cabin_class.value, 0.09))
369
+
370
+ flights.append(FlightOffer(
371
+ id=flight_id,
372
+ segments=[segment],
373
+ total_duration_minutes=leg.duration_min,
374
+ stops=0,
375
+ price_usd=price,
376
+ cabin_class=cabin_class,
377
+ origin=origin,
378
+ destination=destination,
379
+ departure=departure_dt,
380
+ arrival=arrival_dt,
381
+ emissions_kg=emissions,
382
+ ))
383
+
384
+ return flights
385
+
386
+
387
+ def _generate_connecting_flights(
388
+ graph: RouteGraph,
389
+ route_plan: RoutePlan,
390
+ departure_date: date,
391
+ cabin_class: CabinClass,
392
+ rng: random.Random,
393
+ ) -> list[FlightOffer]:
394
+ """Generate connecting flight options (1-stop or 2-stop)."""
395
+ origin = route_plan.waypoints[0]
396
+ destination = route_plan.waypoints[-1]
397
+ origin_airport = graph.airports[origin]
398
+ dest_airport = graph.airports[destination]
399
+ origin_route_count = len(origin_airport.routes)
400
+
401
+ # Realistic departure times for the first leg
402
+ first_leg = route_plan.legs[0]
403
+ num_first_carriers = len(first_leg.carriers) if first_leg.carriers else 1
404
+ route_type = _classify_route_type(origin_airport.continent, dest_airport.continent)
405
+ dep_weights = _build_departure_weights(route_type, num_first_carriers, origin_route_count, rng)
406
+
407
+ # Generate 2-5 options per connecting route
408
+ num_options = rng.randint(2, 5)
409
+ dep_times = _sample_departure_minutes(dep_weights, num_options, rng)
410
+
411
+ flights = []
412
+ for option_idx in range(num_options):
413
+ departure_minutes = dep_times[option_idx]
414
+
415
+ segments = []
416
+ layover_infos: list[LayoverInfo] = []
417
+ current_time = datetime(
418
+ departure_date.year, departure_date.month, departure_date.day,
419
+ departure_minutes // 60, departure_minutes % 60,
420
+ tzinfo=_get_timezone(graph, origin),
421
+ )
422
+ total_price = 0.0
423
+ total_duration = 0
424
+
425
+ valid = True
426
+ for i, leg in enumerate(route_plan.legs):
427
+ leg_origin = route_plan.waypoints[i]
428
+ leg_dest = route_plan.waypoints[i + 1]
429
+ origin_tz = _get_timezone(graph, leg_origin)
430
+ dest_tz = _get_timezone(graph, leg_dest)
431
+ origin_ap = graph.airports[leg_origin]
432
+ dest_ap = graph.airports[leg_dest]
433
+
434
+ if not leg.carriers:
435
+ valid = False
436
+ break
437
+ leg_cwts = _carrier_weights_at_airport(graph, leg_origin, leg.carriers)
438
+ carrier = rng.choices(leg.carriers, weights=leg_cwts, k=1)[0]
439
+ departure_dt = current_time.astimezone(origin_tz)
440
+ arrival_dt = departure_dt + timedelta(minutes=leg.duration_min)
441
+ arrival_dt = arrival_dt.astimezone(dest_tz)
442
+
443
+ # Overnight: compare local calendar dates in their respective timezones
444
+ is_overnight = arrival_dt.date() != departure_dt.date()
445
+
446
+ # Per-leg price with connection discount
447
+ # (see price_engine.py and config.py for full pricing docs)
448
+ leg_price = compute_price(
449
+ distance_km=leg.distance_km,
450
+ cabin_class=cabin_class.value,
451
+ departure_date=departure_date,
452
+ departure_hour=departure_dt.hour,
453
+ num_carriers=len(leg.carriers),
454
+ dest_continent=dest_ap.continent,
455
+ rng=rng,
456
+ is_connection=True,
457
+ )
458
+ leg_price *= CONNECTING_BASE_DISCOUNT
459
+ total_price += leg_price
460
+
461
+ aircraft = _pick_aircraft(leg.distance_km, rng)
462
+ amenities = _generate_amenities(aircraft, cabin_class, leg.distance_km, rng)
463
+
464
+ segments.append(FlightSegment(
465
+ airline_code=carrier["iata"],
466
+ airline_name=carrier["name"],
467
+ flight_number=_make_flight_number(carrier["iata"], rng),
468
+ aircraft=aircraft,
469
+ origin=leg_origin,
470
+ origin_city=origin_ap.city_name,
471
+ destination=leg_dest,
472
+ destination_city=dest_ap.city_name,
473
+ departure=departure_dt,
474
+ arrival=arrival_dt,
475
+ duration_minutes=leg.duration_min,
476
+ is_overnight=is_overnight,
477
+ **amenities,
478
+ ))
479
+
480
+ # Add layover time for next leg
481
+ if i < len(route_plan.legs) - 1:
482
+ next_dest = route_plan.waypoints[i + 2]
483
+ min_conn = _min_connection_minutes(graph, leg_origin, leg_dest, next_dest)
484
+ layover = rng.randint(min_conn, MAX_LAYOVER_MINUTES)
485
+ current_time = arrival_dt + timedelta(minutes=layover)
486
+ total_duration += leg.duration_min + layover
487
+
488
+ # Layover overnight: both times at the hub airport (same tz).
489
+ # arrival_dt is already in dest_tz (= hub tz).
490
+ # current_time inherits that tz after timedelta addition.
491
+ layover_overnight = current_time.date() != arrival_dt.date()
492
+
493
+ layover_infos.append(LayoverInfo(
494
+ duration_minutes=layover,
495
+ airport=leg_dest,
496
+ airport_city=dest_ap.city_name,
497
+ is_overnight=layover_overnight,
498
+ is_short_connection=layover < SHORT_CONNECTION_MINUTES,
499
+ ))
500
+
501
+ # Check if layover pushes to next day too far
502
+ if (current_time - datetime(
503
+ departure_date.year, departure_date.month, departure_date.day,
504
+ tzinfo=origin_tz
505
+ )).days > 1:
506
+ valid = False
507
+ break
508
+ else:
509
+ total_duration += leg.duration_min
510
+
511
+ if not valid:
512
+ continue
513
+
514
+ # Same-airline connection discount: if all segments are on the same
515
+ # carrier, apply an additional discount (bundled itinerary fare).
516
+ carrier_codes = {seg.airline_code for seg in segments}
517
+ if len(carrier_codes) == 1:
518
+ total_price *= SAME_AIRLINE_CONNECTION_DISCOUNT
519
+
520
+ total_price = round(total_price, 0)
521
+ first_departure = segments[0].departure
522
+ last_arrival = segments[-1].arrival
523
+
524
+ flight_id = (
525
+ f"{origin}{destination}{departure_date.isoformat()}"
526
+ f"{departure_minutes}{'-'.join(route_plan.waypoints)}{option_idx}"
527
+ )
528
+
529
+ total_distance = sum(leg.distance_km for leg in route_plan.legs)
530
+ emissions = int(total_distance * EMISSIONS_KG_PER_KM.get(cabin_class.value, 0.09))
531
+
532
+ flights.append(FlightOffer(
533
+ id=flight_id,
534
+ segments=segments,
535
+ layovers=layover_infos,
536
+ total_duration_minutes=total_duration,
537
+ stops=route_plan.stops,
538
+ price_usd=total_price,
539
+ cabin_class=cabin_class,
540
+ origin=origin,
541
+ destination=destination,
542
+ departure=first_departure,
543
+ arrival=last_arrival,
544
+ emissions_kg=emissions,
545
+ ))
546
+
547
+ return flights
preparation/price_engine.py ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Fare calculation engine.
2
+
3
+ ==========================================================================
4
+ PRICING OVERVIEW
5
+ ==========================================================================
6
+
7
+ Every flight price is computed from a deterministic formula with 7
8
+ multipliers applied to a distance-based base fare. Additional discounts
9
+ are applied at the itinerary level for connecting flights and round trips.
10
+
11
+ --------------------------------------------------------------------------
12
+ 1. BASE FARE
13
+ --------------------------------------------------------------------------
14
+ base_usd = BASE_FIXED_USD + (distance_km * BASE_PER_KM_USD)
15
+ = 40 + (distance_km * 0.08)
16
+
17
+ Rationale: $40 fixed cost covers airport fees/taxes; $0.08/km covers
18
+ fuel and operating cost. A 5,000 km flight has base = $440.
19
+
20
+ --------------------------------------------------------------------------
21
+ 2. PER-FLIGHT MULTIPLIERS (applied multiplicatively)
22
+ --------------------------------------------------------------------------
23
+ final = base * M_class * M_day * M_time * M_season * M_demand
24
+ * M_advance * M_jitter
25
+
26
+ 2a. Cabin class (M_class)
27
+ economy 1.0x
28
+ premium_econ 1.6x
29
+ business 3.2x
30
+ first 5.5x
31
+
32
+ 2b. Day of week (M_day) — based on departure date's weekday
33
+ Mon–Wed 0.90x (mid-week discount)
34
+ Thu 1.00x
35
+ Fri 1.15x (weekend premium)
36
+ Sat 1.05x
37
+ Sun 1.10x
38
+
39
+ 2c. Time of day (M_time) — based on departure hour (local time)
40
+ 06:00–08:00 1.10x (morning rush)
41
+ 09:00–15:00 1.00x (off-peak)
42
+ 16:00–19:00 1.15x (evening rush)
43
+ 22:00–05:00 0.85x (red-eye discount)
44
+
45
+ 2d. Seasonality (M_season) — based on departure month
46
+ Jan, Feb 0.85x (winter off-season)
47
+ Mar 0.95x
48
+ Apr 1.00x
49
+ May 1.05x
50
+ Jun 1.15x (summer peak)
51
+ Jul 1.20x (summer peak)
52
+ Aug 1.15x (summer peak)
53
+ Sep 0.90x (shoulder season)
54
+ Oct 0.95x
55
+ Nov 1.00x
56
+ Dec 1.40x (Christmas peak)
57
+
58
+ EU summer bonus: flights to European airports (continent="EU")
59
+ during Jun–Aug get an extra +0.15 added to the season multiplier.
60
+
61
+ 2e. Route demand (M_demand) — based on carrier competition
62
+ 1 carrier 1.20x (monopoly surcharge)
63
+ 2–3 carriers 1.00x
64
+ 4+ carriers 0.95x (high-competition discount)
65
+
66
+ 2f. Advance booking (M_advance) — days between booking and departure
67
+ 0–3 days 1.50x (last-minute premium)
68
+ 4–7 days 1.35x
69
+ 8–14 days 1.20x
70
+ 15–21 days 1.10x
71
+ 22–60 days 1.00x (sweet spot)
72
+ 61–90 days 0.90x (early-bird discount)
73
+ 91+ days 0.95x (far-out, slight premium vs sweet spot)
74
+
75
+ 2g. Seeded jitter (M_jitter) — deterministic per-flight randomness
76
+ 1.0 ± 0.08 (±8%, drawn from uniform distribution)
77
+ Uses SHA-256 seeded RNG so same search → same jitter.
78
+
79
+ Minimum price floor: $25 (after all multipliers and surcharges).
80
+
81
+ 2h. Short-distance surcharge — flat fee for very short flights
82
+ Routes ≤ 500 km get +$50–$150 (random, deterministic per flight).
83
+ Waived when the leg is part of a connecting itinerary.
84
+ Still applies to round-trip flights (each direction independently).
85
+
86
+ --------------------------------------------------------------------------
87
+ 3. ITINERARY-LEVEL DISCOUNTS
88
+ --------------------------------------------------------------------------
89
+
90
+ 3a. Connecting-flight base discount
91
+ Each leg of a multi-segment itinerary is priced individually
92
+ using the formula above, then multiplied by CONNECTING_BASE_DISCOUNT
93
+ (0.75). This gives a 25% per-leg discount vs buying each segment
94
+ as a separate one-way ticket — simulating how airlines sell
95
+ through-fares cheaper than two one-ways.
96
+
97
+ 3b. Same-airline connection discount
98
+ If ALL segments of a connecting itinerary are operated by the
99
+ SAME carrier, the total price is further multiplied by
100
+ SAME_AIRLINE_CONNECTION_DISCOUNT (0.88), giving an extra 12%
101
+ off on top of the base connection discount.
102
+
103
+ Combined effect: each leg at 0.75, then total * 0.88 =
104
+ effective ~34% discount vs separate one-ways on same carrier.
105
+
106
+ Rationale: airlines offer lower fares when they control the
107
+ entire itinerary (no interline agreement needed, guaranteed
108
+ connections, single PNR).
109
+
110
+ 3c. Round-trip same-airline discount
111
+ After generating both outbound and return flights for a round-trip
112
+ search, return flights that share at least one carrier with ANY
113
+ outbound flight get multiplied by ROUND_TRIP_SAME_AIRLINE_DISCOUNT
114
+ (0.92), giving an 8% discount on the return leg.
115
+
116
+ Rationale: airlines incentivize round-trip bookings on their own
117
+ metal. A passenger who flies AA outbound and AA return pays less
118
+ per leg than mixing carriers.
119
+
120
+ --------------------------------------------------------------------------
121
+ 4. CALENDAR PRICING
122
+ --------------------------------------------------------------------------
123
+ The calendar endpoint (/api/calendar) shows the cheapest representative
124
+ price per day. It uses compute_price() with:
125
+ - departure_hour = 12 (noon, off-peak → M_time = 1.00)
126
+ - booking_date = target_date - 14 days (M_advance = 1.20)
127
+ This gives a "typical" price that varies only by day-of-week and
128
+ season, useful for the date-picker price overlay.
129
+
130
+ ==========================================================================
131
+ """
132
+
133
+ from __future__ import annotations
134
+
135
+ import random
136
+ from datetime import date, timedelta
137
+
138
+ from .config import (
139
+ ADVANCE_MULTIPLIERS,
140
+ BASE_FIXED_USD,
141
+ BASE_PER_KM_USD,
142
+ CLASS_MULTIPLIERS,
143
+ DAY_MULTIPLIERS,
144
+ EU_CONTINENTS,
145
+ EU_SUMMER_BONUS,
146
+ EU_SUMMER_MONTHS,
147
+ HIGH_COMPETITION_DISCOUNT,
148
+ JITTER_RANGE,
149
+ MONOPOLY_ROUTE_BONUS,
150
+ SEASON_MULTIPLIERS,
151
+ SHORT_DISTANCE_FEE_MAX,
152
+ SHORT_DISTANCE_FEE_MIN,
153
+ SHORT_DISTANCE_THRESHOLD_KM,
154
+ )
155
+
156
+
157
+ def compute_price(
158
+ distance_km: int,
159
+ cabin_class: str,
160
+ departure_date: date,
161
+ departure_hour: int,
162
+ num_carriers: int,
163
+ dest_continent: str,
164
+ rng: random.Random,
165
+ booking_date: date | None = None,
166
+ is_connection: bool = False,
167
+ ) -> float:
168
+ """Compute a single-flight price using the 7-multiplier formula.
169
+
170
+ This is the core pricing function. It computes the fare for one
171
+ segment (one takeoff–landing pair). Itinerary-level discounts
172
+ (connection, round-trip) are applied separately by the caller.
173
+
174
+ Args:
175
+ distance_km: Great-circle distance of the route.
176
+ cabin_class: One of "economy", "premium_economy", "business", "first".
177
+ departure_date: Date of departure (affects day-of-week, season).
178
+ departure_hour: Hour of departure in local time 0–23 (affects time-of-day).
179
+ num_carriers: Number of airlines operating this route (affects demand).
180
+ dest_continent: Destination airport continent code (for EU summer bonus).
181
+ rng: Seeded Random instance (for deterministic jitter).
182
+ booking_date: Date of booking (defaults to today; affects advance multiplier).
183
+ is_connection: True when this leg is part of a connecting itinerary
184
+ (suppresses the short-distance surcharge).
185
+
186
+ Returns:
187
+ Price in USD, rounded to nearest dollar, minimum $25.
188
+ """
189
+ # --- Base fare ---
190
+ base = BASE_FIXED_USD + (distance_km * BASE_PER_KM_USD)
191
+
192
+ # --- Multiplier 1: Cabin class ---
193
+ class_mult = CLASS_MULTIPLIERS.get(cabin_class, 1.0)
194
+
195
+ # --- Multiplier 2: Day of week ---
196
+ day_mult = DAY_MULTIPLIERS.get(departure_date.weekday(), 1.0)
197
+
198
+ # --- Multiplier 3: Time of day ---
199
+ if 6 <= departure_hour <= 8:
200
+ time_mult = 1.10 # Morning peak
201
+ elif 16 <= departure_hour <= 19:
202
+ time_mult = 1.15 # Evening peak
203
+ elif departure_hour >= 22 or departure_hour <= 5:
204
+ time_mult = 0.85 # Red-eye discount
205
+ else:
206
+ time_mult = 1.00
207
+
208
+ # --- Multiplier 4: Seasonality ---
209
+ season_mult = SEASON_MULTIPLIERS.get(departure_date.month, 1.0)
210
+ if dest_continent in EU_CONTINENTS and departure_date.month in EU_SUMMER_MONTHS:
211
+ season_mult += EU_SUMMER_BONUS
212
+
213
+ # --- Multiplier 5: Route demand (carrier competition) ---
214
+ if num_carriers == 1:
215
+ demand_mult = 1.0 + MONOPOLY_ROUTE_BONUS
216
+ elif num_carriers >= 4:
217
+ demand_mult = 1.0 - HIGH_COMPETITION_DISCOUNT
218
+ else:
219
+ demand_mult = 1.0
220
+
221
+ # --- Multiplier 6: Advance booking ---
222
+ if booking_date is None:
223
+ from .benchmark import today
224
+ booking_date = today()
225
+ days_advance = max(0, (departure_date - booking_date).days)
226
+ advance_mult = 1.0
227
+ for threshold, mult in ADVANCE_MULTIPLIERS:
228
+ if days_advance <= threshold:
229
+ advance_mult = mult
230
+ break
231
+
232
+ # --- Multiplier 7: Seeded jitter (±8%) ---
233
+ jitter = 1.0 + rng.uniform(-JITTER_RANGE, JITTER_RANGE)
234
+
235
+ price = (base * class_mult * day_mult * time_mult
236
+ * season_mult * demand_mult * advance_mult * jitter)
237
+
238
+ # Short-distance surcharge: random $50–$150 fee on very short flights.
239
+ # Waived when the leg is part of a connecting itinerary.
240
+ if distance_km <= SHORT_DISTANCE_THRESHOLD_KM and not is_connection:
241
+ price += rng.randint(SHORT_DISTANCE_FEE_MIN, SHORT_DISTANCE_FEE_MAX)
242
+
243
+ return max(25.0, round(price, 0))
244
+
245
+
246
+ def compute_calendar_price(
247
+ distance_km: int,
248
+ cabin_class: str,
249
+ target_date: date,
250
+ num_carriers: int,
251
+ dest_continent: str,
252
+ rng: random.Random,
253
+ ) -> float:
254
+ """Compute the cheapest representative price for a given date.
255
+
256
+ Used by the calendar endpoint to show day-by-day pricing.
257
+ Assumes noon departure (off-peak) and 14-day advance booking
258
+ to give a stable "typical" price that varies only by day-of-week
259
+ and season.
260
+ """
261
+ return compute_price(
262
+ distance_km=distance_km,
263
+ cabin_class=cabin_class,
264
+ departure_date=target_date,
265
+ departure_hour=12,
266
+ num_carriers=num_carriers,
267
+ dest_continent=dest_continent,
268
+ rng=rng,
269
+ booking_date=target_date - timedelta(days=14),
270
+ )
preparation/seed_utils.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic seeding utilities.
2
+
3
+ Same search parameters always produce the same flights and prices.
4
+ Uses SHA-256 hash of search params → integer seed for random.Random.
5
+ """
6
+
7
+ import hashlib
8
+ import random
9
+
10
+
11
+ def make_seed(*parts: str | int | float) -> int:
12
+ """Create a deterministic seed from arbitrary parts."""
13
+ key = "|".join(str(p) for p in parts)
14
+ h = hashlib.sha256(key.encode()).hexdigest()
15
+ return int(h[:16], 16)
16
+
17
+
18
+ def seeded_random(*parts: str | int | float) -> random.Random:
19
+ """Return a seeded Random instance for the given search params."""
20
+ return random.Random(make_seed(*parts))
release-manifest.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "repo_id": "WebArena-Pro/flight-search-data",
3
+ "application_repository": "https://github.com/McGill-NLP/webarena-pro",
4
+ "prepared_at_utc": "2026-11-13T20:57:11.709480+00:00",
5
+ "visibility": "private",
6
+ "source_urls": [],
7
+ "files": [
8
+ {
9
+ "path": "LICENSES.md",
10
+ "bytes": 812,
11
+ "sha256": "44acf2ff1d9d2dfa148398f5dffe99d8e2416f6ad13512211b3fe8af66a4a05e"
12
+ },
13
+ {
14
+ "path": "README.md",
15
+ "bytes": 1772,
16
+ "sha256": "f04b3fedba8babb26eeb05c0ba6eff4506a47db88d99aea077e692de0b00d089"
17
+ },
18
+ {
19
+ "path": "data/airline_routes.json",
20
+ "bytes": 21798276,
21
+ "sha256": "7e8d97548f626230927e3e38b8ba9712710612ef90292e9a0696698d20b3bac3"
22
+ },
23
+ {
24
+ "path": "data/airports.jsonl",
25
+ "bytes": 1100832,
26
+ "sha256": "c5e841afd7dd76802c281bdea49f6fb0d7d24aa5299a00b0fbfdb4f4e29b2b3d"
27
+ },
28
+ {
29
+ "path": "data/routes.jsonl",
30
+ "bytes": 7363846,
31
+ "sha256": "48caa98005d3299c01c26e03caf9aa5897ab8596d9517fbaaf2f0f1620a02f5f"
32
+ },
33
+ {
34
+ "path": "preparation/config.py",
35
+ "bytes": 11926,
36
+ "sha256": "d3341b2041bff017c085eb5181245490210ab6e73d6faef66b7e87c6e0ffbd3b"
37
+ },
38
+ {
39
+ "path": "preparation/data_loader.py",
40
+ "bytes": 5473,
41
+ "sha256": "a4093a915ee66a6e4f71fc9fae9de05c2e0dbeac46857587bfd5b27d93714d01"
42
+ },
43
+ {
44
+ "path": "preparation/flight_generator.py",
45
+ "bytes": 20040,
46
+ "sha256": "4ed15c427d3ad0ed4d0bb9d09b24f3bb6d8e78446ceeafde3ed3bc95a60cc523"
47
+ },
48
+ {
49
+ "path": "preparation/price_engine.py",
50
+ "bytes": 10599,
51
+ "sha256": "157aa96a7924fbc61d8727a31be9e3dd28a2e93dbc8df0bd042d443ff1abb18c"
52
+ },
53
+ {
54
+ "path": "preparation/seed_utils.py",
55
+ "bytes": 618,
56
+ "sha256": "be45bd1cef86447b18d8cb0b661fae07427d76c203368c2631a7ca39bf5cc103"
57
+ }
58
+ ],
59
+ "remote_media_preserved": false
60
+ }