Fare¶
- class passengersim.config.Fare[source]¶
Bases:
BaseModelA single fare rule connecting a carrier, market, and booking class.
A
Farerecord defines the price and conditions under which a passenger may purchase a seat in a specific booking class on a specific carrier between an origin and destination.Attributes:
IATA carrier code for the airline offering this fare.
Origin airport or location code for this fare.
Destination airport or location code for this fare.
Booking class (fare class) identifier, e.g.
"Y","B","Q".Optional brand name associated with this fare (e.g. a cabin product name).
Base price of this fare in the simulation's currency units.
Minimum number of days before departure that this fare must be purchased.
Named restrictions that apply to this fare.
Optional category label for grouping fares (e.g. by product tier).
Cabin code for this fare, e.g.
"Y"for economy.Minimum number of nights the passenger must stay at the destination.
Whether a Saturday night stay is required to purchase this fare.
Unique identifier for the origin–destination market of this fare.
Methods:
serialize_restrictions(value)Serialize the restrictions list to a pipe-separated string.
- carrier : str¶
IATA carrier code for the airline offering this fare.
- orig : str¶
Origin airport or location code for this fare.
- dest : str¶
Destination airport or location code for this fare.
- booking_class : str¶
Booking class (fare class) identifier, e.g.
"Y","B","Q".
- brand : str | None¶
Optional brand name associated with this fare (e.g. a cabin product name).
Defaults to an empty string, indicating no specific brand.
- price : float¶
Base price of this fare in the simulation’s currency units.
- advance_purchase : int¶
Minimum number of days before departure that this fare must be purchased.
- restrictions : list[str]¶
Named restrictions that apply to this fare.
These are typically related to refundability, changeability, and other conditions that may apply to the fare and which may be subject to random preference variation across customers.
The names may not contain pipe or slash characters, as these are used as separators when parsing from strings. The names should match those used in choice models.
- category : str | None¶
Optional category label for grouping fares (e.g. by product tier).
- cabin : str | None¶
Cabin code for this fare, e.g.
"Y"for economy. Defaults to"Y".
- min_stay : int¶
Minimum number of nights the passenger must stay at the destination.
A value of
0indicates no minimum stay requirement.
- saturday_night_required : bool | None¶
Whether a Saturday night stay is required to purchase this fare.
- serialize_restrictions(value: list[str]) str[source]¶
Serialize the restrictions list to a pipe-separated string.
Pydantic calls this serializer whenever the model is converted to a dictionary or JSON. The resulting string is compatible with the
allow_pipe_sep()validator for round-trip fidelity.- Parameters:
- value : list of str¶
The list of restriction name strings to serialize.
- Returns:
str – A single string with restriction names joined by
"|", or an empty string if value is empty.
- property market_identifier : str¶
Unique identifier for the origin–destination market of this fare.
- Returns:
str – Identifier string in the format
"<orig>~<dest>".