Skip to content

RM Systems

RmProcess module-attribute

RmProcess = ListOfNamed[RmStep]

RmStep module-attribute

RmStep = as_pydantic_field()

RmSystem

Bases: Named

Source code in passengersim/config/rm_systems.py
class RmSystem(Named, extra="forbid"):
    processes: DictAttr[str, RmProcess]

    availability_control: Literal[
        "infer", "leg", "cabin", "theft", "bp", "bp_loose", "vn", "none"
    ] = "infer"
    """Fare class availability algorithm for carriers using this RmSystem.

    The default value will infer the appropriate control based on the steps in
    the DCP process (This is pending implementation).

    Allowed values include:
    - "leg" (default): Uses leg-based controls.
    - "bp": Bid price controls with strict resolution (fare must be strictly
            greater than bid price).
    - "bp_loose": Bid price controls with non-strict resolution (fare must be
                  greater than *or equal to* bid price).
    - "vn": Virtual nesting.
    - "none": No controls.
    """

    description: str = ""
    """Description of the RM system.

    The description is optional and can be used to summarize the RM system.
    It has no effect on the actual operation of the RM system."""

    frat5: str | None = None
    """Name of the FRAT5 curve to use.

    This is the default that will be applied if not found at a more detailed
    level (e.g. carrier level).
    """

    @field_validator("processes")
    @classmethod
    def _require_dcp_process(cls, value: dict[str, RmProcess]):
        """Ensure that every RmSystem is either empty or has a DCP process.

        This validator also converts all keys to lowercase.
        """
        lower_value = DictAttr()
        for k, v in value.items():
            lower_value[k.lower()] = v
        if len(lower_value) and "dcp" not in lower_value:
            raise ValueError("Non-empty RmSystem missing a `dcp` process.")
        return lower_value

availability_control class-attribute instance-attribute

availability_control: Literal[
    "infer",
    "leg",
    "cabin",
    "theft",
    "bp",
    "bp_loose",
    "vn",
    "none",
] = "infer"

Fare class availability algorithm for carriers using this RmSystem.

The default value will infer the appropriate control based on the steps in the DCP process (This is pending implementation).

Allowed values include: - "leg" (default): Uses leg-based controls. - "bp": Bid price controls with strict resolution (fare must be strictly greater than bid price). - "bp_loose": Bid price controls with non-strict resolution (fare must be greater than or equal to bid price). - "vn": Virtual nesting. - "none": No controls.

description class-attribute instance-attribute

description: str = ''

Description of the RM system.

The description is optional and can be used to summarize the RM system. It has no effect on the actual operation of the RM system.

frat5 class-attribute instance-attribute

frat5: str | None = None

Name of the FRAT5 curve to use.

This is the default that will be applied if not found at a more detailed level (e.g. carrier level).

processes instance-attribute

processes: DictAttr[str, RmProcess]