1. Source-of-Truth Data Channels
1.1 Carrier-Native Endpoints
- Direct integration with airline developer portals (e.g., Air Canada API, Emirates Skywards API) to pull live baggage policies.
- Sample call:
GET /v/baggage/policy?flightNo=EK201&cabin=Y&origin=DXB&destination=JFK
Authorization: Bearer <token>
- Pros: 100 % fidelity, updated within minutes of policy changes.
- Caveat: Field names vary (
weightLimitKg,maxWeightLb,pieces)—normalize with an internal schema.
1.2 IATA-Compliant Feeds
- NDC or Baggage XML messages via BSP Link for 300+ airlines.
- Use case: Multi-carrier itineraries where one call must resolve baggage for all segments.
1.3 Aggregator APIs
- Duffel, Travelfuison, Kiwi: single contract, normalized JSON.
- Latency: 0–72 h behind airline sources—validate via checksum.
2. Implementation Blueprint
2.1 Hierarchical Fetcher
async def resolve_allowance(carrier: str, flight: str, cabin: str):
"""
Returns allowance dict with confidence score.
Priority: carrier → iata → aggregator → manual.
"""
try:
return await airline_direct(carrier, flight, cabin)
except (TimeoutError, ValidationError):
pass
iata_resp = await iata_ndc(carrier, flight)
if iata_resp.confidence >= 0.9:
return iata_resp
agg_resp = await aggregator(carrier, flight)
if agg_resp.delta_pct(iata_resp) < 0.05:
return agg_resp
return await create_ticket(carrier, flight) # human review
2.2 Rule Engine
YAML configuration:
carriers:
QR:
rules:
- route: DOH-AKL
cabin: Y
allowance: 2PC 23kg
- route: DOH-LHR
cabin: J
allowance: 2PC 32kg
exceptions:
- carrier: UA
condition: "is_star_alliance_gold"
bonus: +1PC
2.3 Cache & Refresh
- TTL map:
- Airline direct: 6 h
- IATA: 12 h
- Aggregator: 24 h
- Webhook listener: subscribe to airline RSS for policy changes.
3. Edge Cases
3.1 Code-Share Segments
SELECT op_carrier AS rule_carrier
FROM segments
WHERE marketing_carrier = 'VS' AND flight_no = 3;
-- baggage follows rule_carrier
3.2 Alliance Logic
- oneworld: allowance follows most significant carrier (MSC).
- SkyTeam: first international markeitng carrier wins.
3.3 Low-Cost Carriers
function ryanairBaggage(route, fareBrand) {
const base = fareBrand === 'Value' ? 10 : 20; // kg cabin only
const purchased = await extrasApi.lookupBooking(pnr);
return { cabin: base, hold: purchased.holdKg || 0 };
}
4. Accuracy Guardrails
4.1 Contract Tests
Feature: Baggage allowance validation
Scenario: LAX-NRT on JL economy
Given flight JL62 in cabin Y
Then hold allowance should be 2×23 kg
And carry-on should be 1×10 kg
4.2 Drift Detection
- Daily diff report between airline and aggregator data.
- PagerDuty alert when discrepancy > 5 %.
5. Fallbacks
- Embedded iframe: render airline bagggage calculator inside booking page.
- Ops ticket: auto-create Jira task when confidence < 0.8.