Skip to content

Fetch API Parametric data

Interface for fetching data related to parametric models and filters.

APIFetchParametric

Bases: APIFetchInternal

Exposes functions for fetching flight data from the server.

Source code in src/rmlab/api/fetch/parametric.py
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
class APIFetchParametric(APIFetchInternal):
    """Exposes functions for fetching flight data from the server."""

    async def fetch_parametric_filters(self, scen_id: int) -> List[PFilter]:
        """Fetch a list of all parametric filters of scenario from server.

        Args:
            scen_id (int): Scenario ID

        Returns:
            List of parametric filters
        """

        return await self._fetch_bounded_items(scen_id, PFilter)

    async def fetch_parametric_models(self, scen_id: int) -> List[PModel]:
        """Fetch a list of all parametric models of scenario from server.

        Args:
            scen_id (int): Scenario ID

        Returns:
            List of parametric models
        """

        return await self._fetch_bounded_items(scen_id, PModel)

    async def fetch_customers_request_model(self, scen_id: int, pmodel_id: str) -> BaseRequestModel:
        """Fetch a customers request model from id in scenario

        Args:
            scen_id (int): Scenario ID
            pmodel_id (str): Model ID

        Returns:
            The requested customers request model
        """

        json = await self._fetch_pmodel(scen_id,
                                  f"{ParametricModelKind.CUSTOMERS.value}_{CustomersModelKind.REQUEST.value}",
                                  pmodel_id)

        model = make_customers_request_model_from_json(json)
        model.id = pmodel_id
        return model

    async def fetch_customers_choice_model(self, scen_id: int, pmodel_id: str) -> BaseChoiceModel:
        """Fetch a customers choice model from id in scenario

        Args:
            scen_id (int): Scenario ID
            pmodel_id (str): Model ID

        Returns:
            The requested customers choice model
        """

        json = await self._fetch_pmodel(scen_id,
                                  f"{ParametricModelKind.CUSTOMERS.value}_{CustomersModelKind.CHOICE.value}",
                                  pmodel_id)
        model = make_customers_choice_model_from_json(json)
        model.id = pmodel_id
        return model

    async def fetch_pricing_range_model(self, scen_id: int, pmodel_id: str) -> RangeModel:
        """Fetch a pricing range model from id in scenario

        Args:
            scen_id (int): Scenario ID
            pmodel_id (str): Model ID

        Returns:
            The requested pricing range model
        """

        json = await self._fetch_pmodel(scen_id,
                                  f"{ParametricModelKind.PRICING.value}_{PricingModelKind.RANGE.value}",
                                  pmodel_id)
        model = make_pricing_range_from_json(json)
        model.id = pmodel_id
        return model

    async def fetch_pricing_behavior_model(self, scen_id: int, pmodel_id: str) -> BaseBehaviorModel:
        """Fetch a pricing behavior model from id in scenario

        Args:
            scen_id (int): Scenario ID
            pmodel_id (str): Model ID

        Returns:
            The requested pricing behavior model
        """

        json = await self._fetch_pmodel(scen_id,
                                  f"{ParametricModelKind.PRICING.value}_{PricingModelKind.BEHAVIOR.value}",
                                  pmodel_id)
        model = make_pricing_behavior_from_json(json)
        model.id = pmodel_id
        return model

    async def fetch_pricing_optimizer_model(self, scen_id: int, pmodel_id: str) -> OptimizerModel:
        """Fetch a pricing optimizer model from id in scenario

        Args:
            scen_id (int): Scenario ID
            pmodel_id (str): Model ID

        Returns:
            The requested pricing optimizer model
        """

        json = await self._fetch_pmodel(scen_id,
                                  f"{ParametricModelKind.PRICING.value}_{PricingModelKind.OPTIMIZER.value}",
                                  pmodel_id)
        model = make_pricing_optimizer_from_json(json)
        model.id = pmodel_id
        return model

fetch_customers_choice_model(scen_id, pmodel_id) async

Fetch a customers choice model from id in scenario

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
pmodel_idstr

Model ID

required

Returns:

TypeDescription
BaseChoiceModel

The requested customers choice model

Source code in src/rmlab/api/fetch/parametric.py
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
async def fetch_customers_choice_model(self, scen_id: int, pmodel_id: str) -> BaseChoiceModel:
    """Fetch a customers choice model from id in scenario

    Args:
        scen_id (int): Scenario ID
        pmodel_id (str): Model ID

    Returns:
        The requested customers choice model
    """

    json = await self._fetch_pmodel(scen_id,
                              f"{ParametricModelKind.CUSTOMERS.value}_{CustomersModelKind.CHOICE.value}",
                              pmodel_id)
    model = make_customers_choice_model_from_json(json)
    model.id = pmodel_id
    return model

fetch_customers_request_model(scen_id, pmodel_id) async

Fetch a customers request model from id in scenario

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
pmodel_idstr

Model ID

required

Returns:

TypeDescription
BaseRequestModel

The requested customers request model

Source code in src/rmlab/api/fetch/parametric.py
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
async def fetch_customers_request_model(self, scen_id: int, pmodel_id: str) -> BaseRequestModel:
    """Fetch a customers request model from id in scenario

    Args:
        scen_id (int): Scenario ID
        pmodel_id (str): Model ID

    Returns:
        The requested customers request model
    """

    json = await self._fetch_pmodel(scen_id,
                              f"{ParametricModelKind.CUSTOMERS.value}_{CustomersModelKind.REQUEST.value}",
                              pmodel_id)

    model = make_customers_request_model_from_json(json)
    model.id = pmodel_id
    return model

fetch_parametric_filters(scen_id) async

Fetch a list of all parametric filters of scenario from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required

Returns:

TypeDescription
List[PFilter]

List of parametric filters

Source code in src/rmlab/api/fetch/parametric.py
20
21
22
23
24
25
26
27
28
29
30
async def fetch_parametric_filters(self, scen_id: int) -> List[PFilter]:
    """Fetch a list of all parametric filters of scenario from server.

    Args:
        scen_id (int): Scenario ID

    Returns:
        List of parametric filters
    """

    return await self._fetch_bounded_items(scen_id, PFilter)

fetch_parametric_models(scen_id) async

Fetch a list of all parametric models of scenario from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required

Returns:

TypeDescription
List[PModel]

List of parametric models

Source code in src/rmlab/api/fetch/parametric.py
32
33
34
35
36
37
38
39
40
41
42
async def fetch_parametric_models(self, scen_id: int) -> List[PModel]:
    """Fetch a list of all parametric models of scenario from server.

    Args:
        scen_id (int): Scenario ID

    Returns:
        List of parametric models
    """

    return await self._fetch_bounded_items(scen_id, PModel)

fetch_pricing_behavior_model(scen_id, pmodel_id) async

Fetch a pricing behavior model from id in scenario

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
pmodel_idstr

Model ID

required

Returns:

TypeDescription
BaseBehaviorModel

The requested pricing behavior model

Source code in src/rmlab/api/fetch/parametric.py
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
async def fetch_pricing_behavior_model(self, scen_id: int, pmodel_id: str) -> BaseBehaviorModel:
    """Fetch a pricing behavior model from id in scenario

    Args:
        scen_id (int): Scenario ID
        pmodel_id (str): Model ID

    Returns:
        The requested pricing behavior model
    """

    json = await self._fetch_pmodel(scen_id,
                              f"{ParametricModelKind.PRICING.value}_{PricingModelKind.BEHAVIOR.value}",
                              pmodel_id)
    model = make_pricing_behavior_from_json(json)
    model.id = pmodel_id
    return model

fetch_pricing_optimizer_model(scen_id, pmodel_id) async

Fetch a pricing optimizer model from id in scenario

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
pmodel_idstr

Model ID

required

Returns:

TypeDescription
OptimizerModel

The requested pricing optimizer model

Source code in src/rmlab/api/fetch/parametric.py
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
async def fetch_pricing_optimizer_model(self, scen_id: int, pmodel_id: str) -> OptimizerModel:
    """Fetch a pricing optimizer model from id in scenario

    Args:
        scen_id (int): Scenario ID
        pmodel_id (str): Model ID

    Returns:
        The requested pricing optimizer model
    """

    json = await self._fetch_pmodel(scen_id,
                              f"{ParametricModelKind.PRICING.value}_{PricingModelKind.OPTIMIZER.value}",
                              pmodel_id)
    model = make_pricing_optimizer_from_json(json)
    model.id = pmodel_id
    return model

fetch_pricing_range_model(scen_id, pmodel_id) async

Fetch a pricing range model from id in scenario

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
pmodel_idstr

Model ID

required

Returns:

TypeDescription
RangeModel

The requested pricing range model

Source code in src/rmlab/api/fetch/parametric.py
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
async def fetch_pricing_range_model(self, scen_id: int, pmodel_id: str) -> RangeModel:
    """Fetch a pricing range model from id in scenario

    Args:
        scen_id (int): Scenario ID
        pmodel_id (str): Model ID

    Returns:
        The requested pricing range model
    """

    json = await self._fetch_pmodel(scen_id,
                              f"{ParametricModelKind.PRICING.value}_{PricingModelKind.RANGE.value}",
                              pmodel_id)
    model = make_pricing_range_from_json(json)
    model.id = pmodel_id
    return model