Optimization Data Interface

IndexSets (ixmp4.data.optimization.indexset)

Data Transfer Object

class ixmp4.data.optimization.indexset.dto.IndexSet(*, created_at: datetime | None, created_by: str | None, id: int, name: str, run__id: int, data: list[int] | list[float] | list[str], data_type: Type | None)

Bases: BaseModel, HasCreationInfo

Optimization index set model.

id: int

Integer id.

name: str

Name of the index set.

run__id: int

Id of the linked run.

data: list[int] | list[float] | list[str]
model_config = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

data_type: Type | None

Service

class ixmp4.data.optimization.indexset.service.IndexSetService(transport: Transport)

Bases: DocsService, GetByIdService

router_prefix: ClassVar[str] = '/optimization/indexsets'
router_tags: ClassVar[Sequence[str]] = ['optimization', 'indexsets']
executor: SessionExecutor
items: ItemRepository
data: IndexSetDataItemRepository
pandas: PandasRepository
versions: VersionRepository
equations: ItemRepository
parameters: ItemRepository
tables: ItemRepository
variables: ItemRepository
create(run_id: int, name: str) IndexSet

Creates an indexset.

Parameters:
Raises:
Returns:

The created indexset.

Return type:

IndexSet

create_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, run_id: int, name: str) None
get(run_id: int, name: str) IndexSet

Retrieves an indexset by its name and run_id.

Parameters:
  • run_id (int) – The unique name of the indexset.

  • name (str) – The unique name of the indexset.

Raises:
Returns:

The retrieved indexset.

Return type:

IndexSet

get_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, run_id: int, name: str) None
get_by_id(id: int) IndexSet

Retrieves an indexset by its id.

Parameters:

id (int) – The integer id of the indexset.

Raises:
Returns:

The retrieved indexset.

Return type:

IndexSet

get_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
delete_by_id(id: int) None

Deletes an indexset.

Parameters:

id (int) – The unique integer id of the indexset.

Raises:
delete_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int) None
data_to_str_list(data: List[float] | List[int] | List[str]) List[str]
data_to_data_list(data: float | int | str | List[float] | List[int] | List[str]) List[float] | List[int] | List[str]
add_data(id: int, data: float | int | str | List[float] | List[int] | List[str]) None

Adds data to an existing IndexSet.

Parameters:
  • id (int) – The id of the target IndexSet.

  • data (float | int | str | List[float] | List[int] | List[str]) – The data to be added to the IndexSet.

Return type:

None

add_data_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int, data: float | int | str | List[float] | List[int] | List[str]) None
remove_data(id: int, data: float | int | str | List[float] | List[int] | List[str], remove_dependent_data: bool = True) None

Removes data from an existing IndexSet.

Parameters:
  • id (int) – The id of the target IndexSet.

  • data (float | int | str | List[float] | List[int] | List[str]) – The data to be removed from the IndexSet.

  • remove_dependent_data (bool, optional) – Whether to delete data from all linked items referencing data. Default: True.

Return type:

None

remove_data_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int, data: float | int | str | List[float] | List[int] | List[str], remove_dependent_data: bool = True) None
list(**kwargs: Unpack[IndexSetFilter]) list[IndexSet]

Lists indexsets by specified criteria.

Parameters:

**kwargs (any) – Filter parameters as specified in IndexSetFilter.

Raises:

Unauthorized – If the current user is not authorized to perform this action.

Returns:

List of indexsets.

Return type:

list[IndexSet]

list_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
paginated_list(pagination: Pagination, **kwargs: Unpack[IndexSetFilter]) PaginatedResult[List[IndexSet]]
tabulate(**kwargs: Unpack[IndexSetFilter]) WithJsonSchema(json_schema={'properties': {'index': {'anyOf': [{'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Index'}, 'columns': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Columns'}, 'dtypes': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Dtypes'}, 'data': {'anyOf': [{'items': {'items': {'anyOf': [{'type': 'boolean'}, {'type': 'integer'}, {'type': 'number'}, {'type': 'string'}, {'additionalProperties': True, 'type': 'object'}, {'items': {'type': 'number'}, 'type': 'array'}, {'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'format': 'date-time', 'type': 'string'}, {'type': 'null'}]}, 'type': 'array'}, 'type': 'array'}, {'type': 'null'}], 'title': 'Data'}}, 'required': ['data'], 'title': 'DataFrameTypeAdapter', 'type': 'object'}, mode=serialization)]

Tabulates indexsets by specified criteria.

Parameters:

**kwargs (any) – Filter parameters as specified in IndexSetFilter.

Returns:

A data frame with the columns:
  • id

  • name

  • data

  • run__id

  • created_at

  • created_by

Return type:

pandas.DataFrame

tabulate_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
paginated_tabulate(pagination: Pagination, **kwargs: Unpack[IndexSetFilter]) PaginatedResult[Annotated[DataFrame, PlainValidator, PlainSerializer, WithJsonSchema]]

Filters

class ixmp4.data.optimization.indexset.filter.IndexSetFilter

Bases: IndexSetFilter

id: int
id__in: list[int]
name: str
name__in: list[str]
name__like: str
name__ilike: str
name__notlike: str
name__notilike: str
run__id: int
run__id__in: list[int]

Scalars (ixmp4.data.optimization.scalar)

Data Transfer Object

class ixmp4.data.optimization.scalar.dto.Scalar(*, created_at: datetime | None, created_by: str | None, id: int, name: str, value: float, unit: Unit, unit__id: int, run__id: int)

Bases: BaseModel, HasCreationInfo

Optimization scalar data model.

id: int

Integer id.

name: str

Name of the scalar.

value: float
unit: Unit
unit__id: int
run__id: int
model_config = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Service

class ixmp4.data.optimization.scalar.service.ScalarService(transport: Transport)

Bases: DocsService, GetByIdService

router_prefix: ClassVar[str] = '/optimization/scalars'
router_tags: ClassVar[Sequence[str]] = ['optimization', 'scalars']
executor: SessionExecutor
items: ItemRepository
pandas: PandasRepository
versions: VersionRepository
runs: ItemRepository
indexsets: ItemRepository
create(run_id: int, name: str, value: float | int, unit_name: str) Scalar

Creates a scalar.

Parameters:
  • run_id (int) – The id of the ixmp4.data.run.dto.Run for which this Scalar is defined.

  • name (str) – The name of the Scalar.

  • value (float) – The value of the Scalar.

  • unit_name (str) – The name of the ixmp4.data.abstract.Unit for which this Scalar is defined.

Raises:
Returns:

The created scalar.

Return type:

Scalar

create_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, run_id: int, name: str, value: float | int, unit_name: str) None
get(run_id: int, name: str) Scalar

Retrieves a scalar by its name and run_id.

Parameters:
  • run_id (int) – The unique name of the scalar.

  • name (str) – The unique name of the scalar.

Raises:
  • ScalarNotFound – If the scalar with name does not exist.

  • Unauthorized – If the current user is not authorized to perform this action.

Returns:

The retrieved scalar.

Return type:

Scalar

get_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, run_id: int, name: str) None
get_by_id(id: int) Scalar

Retrieves a scalar by its id.

Parameters:

id (int) – The integer id of the scalar.

Raises:
  • ScalarNotFound – If the scalar with id does not exist.

  • Unauthorized – If the current user is not authorized to perform this action.

Returns:

The retrieved scalar.

Return type:

Scalar

get_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
delete_by_id(id: int) None

Deletes a scalar.

Parameters:

id (int) – The unique integer id of the scalar.

Raises:
delete_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int) None
update_by_id(id: int, value: float | int | None = None, unit_name: str | None = None) Scalar

Updates a Scalar.

Parameters:
  • id (int) – The integer id of the Scalar.

  • value (float, optional) – The value of the Scalar.

  • unit_id (int, optional) – The id of the ixmp4.data.abstract.Unit for which this Scalar is defined.

Returns:

The updated Scalar.

Return type:

ixmp4.data.abstract.optimization.Scalar

update_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int, value: float | int | None = None, unit_name: str | None = None) None
list(**kwargs: Unpack[ScalarFilter]) list[Scalar]

Lists scalars by specified criteria.

Parameters:

**kwargs (any) – Filter scalars as specified in ScalarFilter.

Raises:

Unauthorized – If the current user is not authorized to perform this action.

Returns:

List of scalars.

Return type:

list[Scalar]

list_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
paginated_list(pagination: Pagination, **kwargs: Unpack[ScalarFilter]) PaginatedResult[List[Scalar]]
tabulate(**kwargs: Unpack[ScalarFilter]) WithJsonSchema(json_schema={'properties': {'index': {'anyOf': [{'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Index'}, 'columns': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Columns'}, 'dtypes': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Dtypes'}, 'data': {'anyOf': [{'items': {'items': {'anyOf': [{'type': 'boolean'}, {'type': 'integer'}, {'type': 'number'}, {'type': 'string'}, {'additionalProperties': True, 'type': 'object'}, {'items': {'type': 'number'}, 'type': 'array'}, {'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'format': 'date-time', 'type': 'string'}, {'type': 'null'}]}, 'type': 'array'}, 'type': 'array'}, {'type': 'null'}], 'title': 'Data'}}, 'required': ['data'], 'title': 'DataFrameTypeAdapter', 'type': 'object'}, mode=serialization)]

Tabulates scalars by specified criteria.

Parameters:

**kwargs (any) – Filter scalars as specified in ScalarFilter.

Returns:

A data frame with the columns:
  • id

  • name

Return type:

pandas.DataFrame

tabulate_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
paginated_tabulate(pagination: Pagination, **kwargs: Unpack[ScalarFilter]) PaginatedResult[Annotated[DataFrame, PlainValidator, PlainSerializer, WithJsonSchema]]

Filters

class ixmp4.data.optimization.scalar.filter.ScalarFilter

Bases: ScalarFilter

id: int
id__in: list[int]
name: str
name__in: list[str]
name__like: str
name__ilike: str
name__notlike: str
name__notilike: str
run__id: int
run__id__in: list[int]

Equations (ixmp4.data.optimization.equation)

Data Transfer Object

class ixmp4.data.optimization.equation.dto.Equation(*, created_at: datetime | None, created_by: str | None, id: int, name: str, data: dict[str, list[float] | list[int] | list[str]], indexset_names: list[str] | None, column_names: list[str] | None, run__id: int)

Bases: BaseModel, HasCreationInfo

Optimization equation model.

id: int

Integer id.

name: str

Name of the equation.

data: dict[str, list[float] | list[int] | list[str]]
indexset_names: list[str] | None
column_names: list[str] | None
run__id: int
model_config = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Service

class ixmp4.data.optimization.equation.service.EquationService(transport: Transport)

Bases: DocsService, IndexSetAssociatedService

router_prefix: ClassVar[str] = '/optimization/equations'
router_tags: ClassVar[Sequence[str]] = ['optimization', 'equations']
executor: SessionExecutor
items: ItemRepository
pandas: PandasRepository
versions: VersionRepository
associations: AssociationRepository
indexsets: ItemRepository
create(run_id: int, name: str, constrained_to_indexsets: list[str] | None = None, column_names: list[str] | None = None) Equation

Creates a equation.

Each column of the Equation needs to be constrained to an existing ixmp4.data.abstract.optimization.IndexSet. These are specified by name and per default, these will be the column names. They can be overwritten by specifying column_names, which needs to specify a unique name for each column.

Parameters:
  • run_id (int) – The id of the ixmp4.data.run.dto.Run for which this Equation is defined.

  • name (str) – The unique name of the Equation.

  • constrained_to_indexsets (list[str] | None = None) – List of ixmp4.data.abstract.optimization.IndexSet names that define the allowed contents of the Equation’s columns. If None, no data can be added beyond levels and marginals!

  • column_names (list[str] | None = None) – Optional list of names to use as column names. If given, overwrites the names inferred from constrained_to_indexsets.

Raises:
Returns:

The created equation.

Return type:

Equation

create_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, run_id: int, name: str, constrained_to_indexsets: list[str] | None = None, column_names: list[str] | None = None) None
get(run_id: int, name: str) Equation

Retrieves a equation by its name and run_id.

Parameters:
  • run_id (int) – The unique name of the equation.

  • name (str) – The unique name of the equation.

Raises:
  • EquationNotFound – If the equation with name does not exist.

  • Unauthorized – If the current user is not authorized to perform this action.

Returns:

The retrieved equation.

Return type:

Equation

get_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, run_id: int, name: str) None
get_by_id(id: int) Equation

Retrieves a equation by its id.

Parameters:

id (int) – The integer id of the equation.

Raises:
  • EquationNotFound – If the equation with id does not exist.

  • Unauthorized – If the current user is not authorized to perform this action.

Returns:

The retrieved equation.

Return type:

Equation

get_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
delete_by_id(id: int) None

Deletes a equation.

Parameters:

id (int) – The unique integer id of the equation.

Raises:
delete_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int) None
add_data(id: int, data: Any]) None

Adds data to an Equation.

The data will be validated with the linked constrained ixmp4.data.abstract.optimization.IndexSet`s. For that, `data.keys() must correspond to the names of the Equation’s columns. Each column can only contain values that are in the linked IndexSet.data. Each row of entries must be unique. No values can be missing, None, or NaN. If data.keys() contains names already present in Equation.data, existing values will be overwritten.

Parameters:
  • id (int) – The id of the ixmp4.data.abstract.optimization.Equation.

  • data (dict[str, Any] | pandas.DataFrame) – The data to be added.

Raises:
  • ixmp4.data.optimization.exceptions.OptimizationItemUsageError

    • If values are missing, None, or NaN - If values are not allowed based on constraints to Indexset s - If rows are not unique

  • Unauthorized – If the current user is not authorized to perform this action.

Return type:

None

add_data_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int, data: Any]) None
remove_data(id: int, data: Any] | None = None) None

Removes data from an Equation.

Parameters:
  • id (int) – The id of the ixmp4.data.abstract.optimization.Equation.

  • data (dict[str, Any] | pandas.DataFrame, optional) – The data to be removed. If specified, remove only specific data. This must specify all indexed columns. All other keys/columns are ignored. Otherwise, remove all data (the default).

Raises:

Unauthorized – If the current user is not authorized to perform this action.

Return type:

None

remove_data_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int, data: Any] | None = None) None
list(**kwargs: Unpack[EquationFilter]) list[Equation]

Lists equations by specified criteria.

Parameters:

**kwargs (any) – Filter parameters as specified in EquationFilter.

Raises:

Unauthorized – If the current user is not authorized to perform this action.

Returns:

List of equations.

Return type:

list[Equation]

list_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
paginated_list(pagination: Pagination, **kwargs: Unpack[EquationFilter]) PaginatedResult[List[Equation]]
tabulate(**kwargs: Unpack[EquationFilter]) WithJsonSchema(json_schema={'properties': {'index': {'anyOf': [{'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Index'}, 'columns': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Columns'}, 'dtypes': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Dtypes'}, 'data': {'anyOf': [{'items': {'items': {'anyOf': [{'type': 'boolean'}, {'type': 'integer'}, {'type': 'number'}, {'type': 'string'}, {'additionalProperties': True, 'type': 'object'}, {'items': {'type': 'number'}, 'type': 'array'}, {'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'format': 'date-time', 'type': 'string'}, {'type': 'null'}]}, 'type': 'array'}, 'type': 'array'}, {'type': 'null'}], 'title': 'Data'}}, 'required': ['data'], 'title': 'DataFrameTypeAdapter', 'type': 'object'}, mode=serialization)]

Tabulates equations by specified criteria.

Parameters:

**kwargs (any) – Filter parameters as specified in EquationFilter.

Returns:

A data frame with the columns:
  • id

  • name

  • data

  • run__id

  • created_at

  • created_by

Return type:

pandas.DataFrame

tabulate_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
paginated_tabulate(pagination: Pagination, **kwargs: Unpack[EquationFilter]) PaginatedResult[Annotated[DataFrame, PlainValidator, PlainSerializer, WithJsonSchema]]

Filters

class ixmp4.data.optimization.equation.filter.EquationFilter

Bases: EquationFilter

id: int
id__in: list[int]
name: str
name__in: list[str]
name__like: str
name__ilike: str
name__notlike: str
name__notilike: str
run__id: int
run__id__in: list[int]

Paramters (ixmp4.data.optimization.parameter)

Data Transfer Object

class ixmp4.data.optimization.parameter.dto.Parameter(*, created_at: datetime | None, created_by: str | None, id: int, name: str, data: dict[str, Any], indexset_names: list[str], column_names: list[str] | None, run__id: int)

Bases: BaseModel, HasCreationInfo

Optimization parameter data model.

id: int

Integer id.

name: str

Name of the parameter.

data: dict[str, Any]
indexset_names: list[str]
column_names: list[str] | None
run__id: int
model_config = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Service

class ixmp4.data.optimization.parameter.service.ParameterService(transport: Transport)

Bases: DocsService, IndexSetAssociatedService

router_prefix: ClassVar[str] = '/optimization/parameters'
router_tags: ClassVar[Sequence[str]] = ['optimization', 'parameters']
executor: SessionExecutor
items: ItemRepository
pandas: PandasRepository
versions: VersionRepository
associations: AssociationRepository
indexsets: ItemRepository
create(run_id: int, name: str, constrained_to_indexsets: list[str], column_names: list[str] | None = None) Parameter

Creates a Parameter.

Each column of the Parameter needs to be constrained to an existing ixmp4.data.abstract.optimization.IndexSet. These are specified by name and per default, these will be the column names. They can be overwritten by specifying column_names, which needs to specify a unique name for each column.

Parameters:
  • run_id (int) – The id of the ixmp4.data.run.dto.Run for which this Parameter is defined.

  • name (str) – The unique name of the Parameter.

  • constrained_to_indexsets (list[str]) – List of ixmp4.data.abstract.optimization.IndexSet names that define the allowed contents of the Parameter’s columns.

  • column_names (list[str] | None = None) – Optional list of names to use as column names. If given, overwrites the names inferred from constrained_to_indexsets.

Raises:
Returns:

The created parameter.

Return type:

Parameter

create_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, run_id: int, name: str, constrained_to_indexsets: list[str], column_names: list[str] | None = None) None
get(run_id: int, name: str) Parameter

Retrieves a parameter by its name and run_id.

Parameters:
  • run_id (int) – The unique name of the parameter.

  • name (str) – The unique name of the parameter.

Raises:
  • ParameterNotFound – If the parameter with name does not exist.

  • Unauthorized – If the current user is not authorized to perform this action.

Returns:

The retrieved parameter.

Return type:

Parameter

get_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, run_id: int, name: str) None
get_by_id(id: int) Parameter

Retrieves a parameter by its id.

Parameters:

id (int) – The integer id of the parameter.

Raises:
Returns:

The retrieved parameter.

Return type:

Parameter

get_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
delete_by_id(id: int) None

Deletes a parameter.

Parameters:

id (int) – The unique integer id of the parameter.

Raises:
delete_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int) None
add_data(id: int, data: dict[str, ~typing.Any] | ~typing.Annotated[~pandas.DataFrame, ~pydantic.functional_validators.PlainValidator(func=~ixmp4.data.dataframe.parse_df, json_schema_input_type=~typing.Any), ~pydantic.functional_serializers.PlainSerializer(func=~ixmp4.data.dataframe.serialize_df, return_type=dict, when_used=json), ~pydantic.json_schema.WithJsonSchema(json_schema={'properties': {'index': {'anyOf': [{'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Index'}, 'columns': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Columns'}, 'dtypes': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Dtypes'}, 'data': {'anyOf': [{'items': {'items': {'anyOf': [{'type': 'boolean'}, {'type': 'integer'}, {'type': 'number'}, {'type': 'string'}, {'additionalProperties': True, 'type': 'object'}, {'items': {'type': 'number'}, 'type': 'array'}, {'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'format': 'date-time', 'type': 'string'}, {'type': 'null'}]}, 'type': 'array'}, 'type': 'array'}, {'type': 'null'}], 'title': 'Data'}}, 'required': ['data'], 'title': 'DataFrameTypeAdapter', 'type': 'object'}, mode=serialization)]) None

Adds data to a Parameter.

The data will be validated with the linked constrained ixmp4.data.abstract.optimization.IndexSet`s. For that, `data.keys() must correspond to the names of the Parameter’s columns. Each column can only contain values that are in the linked IndexSet.data. Each row of entries must be unique. No values can be missing, None, or NaN. If data.keys() contains names already present in Parameter.data, existing values will be overwritten.

Parameters:
  • id (int) – The id of the ixmp4.data.abstract.optimization.Parameter.

  • data (dict[str, Any] | pandas.DataFrame) – The data to be added.

Raises:

ixmp4.core.exceptions.OptimizationDataValidationError

  • If values are missing, None, or NaN - If values are not allowed based on constraints to Indexset s - If rows are not unique

Return type:

None

add_data_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int, data: dict[str, ~typing.Any] | ~typing.Annotated[~pandas.DataFrame, ~pydantic.functional_validators.PlainValidator(func=~ixmp4.data.dataframe.parse_df, json_schema_input_type=~typing.Any), ~pydantic.functional_serializers.PlainSerializer(func=~ixmp4.data.dataframe.serialize_df, return_type=dict, when_used=json), ~pydantic.json_schema.WithJsonSchema(json_schema={'properties': {'index': {'anyOf': [{'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Index'}, 'columns': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Columns'}, 'dtypes': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Dtypes'}, 'data': {'anyOf': [{'items': {'items': {'anyOf': [{'type': 'boolean'}, {'type': 'integer'}, {'type': 'number'}, {'type': 'string'}, {'additionalProperties': True, 'type': 'object'}, {'items': {'type': 'number'}, 'type': 'array'}, {'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'format': 'date-time', 'type': 'string'}, {'type': 'null'}]}, 'type': 'array'}, 'type': 'array'}, {'type': 'null'}], 'title': 'Data'}}, 'required': ['data'], 'title': 'DataFrameTypeAdapter', 'type': 'object'}, mode=serialization)]) None
remove_data(id: int, data: Any] | None = None) None

Removes data from a Parameter.

Parameters:
  • id (int) – The id of the ixmp4.data.abstract.optimization.Parameter.

  • data (dict[str, Any] | pandas.DataFrame) – The data to be removed. This must specify all indexed columns. All other keys/columns are ignored.

Return type:

None

remove_data_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int, data: Any] | None = None) None
list(**kwargs: Unpack[ParameterFilter]) list[Parameter]

Lists parameters by specified criteria.

Parameters:

**kwargs (any) – Filter parameters as specified in ParameterFilter.

Raises:

Unauthorized – If the current user is not authorized to perform this action.

Returns:

List of parameters.

Return type:

list[Parameter]

list_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
paginated_list(pagination: Pagination, **kwargs: Unpack[ParameterFilter]) PaginatedResult[List[Parameter]]
tabulate(**kwargs: Unpack[ParameterFilter]) WithJsonSchema(json_schema={'properties': {'index': {'anyOf': [{'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Index'}, 'columns': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Columns'}, 'dtypes': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Dtypes'}, 'data': {'anyOf': [{'items': {'items': {'anyOf': [{'type': 'boolean'}, {'type': 'integer'}, {'type': 'number'}, {'type': 'string'}, {'additionalProperties': True, 'type': 'object'}, {'items': {'type': 'number'}, 'type': 'array'}, {'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'format': 'date-time', 'type': 'string'}, {'type': 'null'}]}, 'type': 'array'}, 'type': 'array'}, {'type': 'null'}], 'title': 'Data'}}, 'required': ['data'], 'title': 'DataFrameTypeAdapter', 'type': 'object'}, mode=serialization)]

Tabulates parameters by specified criteria.

Parameters:

**kwargs (any) – Filter parameters as specified in ParameterFilter.

Returns:

A data frame with the columns:
  • id

  • name

  • data

  • run__id

  • created_at

  • created_by

Return type:

pandas.DataFrame

tabulate_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
paginated_tabulate(pagination: Pagination, **kwargs: Unpack[ParameterFilter]) PaginatedResult[Annotated[DataFrame, PlainValidator, PlainSerializer, WithJsonSchema]]

Filters

class ixmp4.data.optimization.parameter.filter.ParameterFilter

Bases: ParameterFilter

id: int
id__in: list[int]
name: str
name__in: list[str]
name__like: str
name__ilike: str
name__notlike: str
name__notilike: str
run__id: int
run__id__in: list[int]

Tables (ixmp4.data.optimization.table)

Data Transfer Object

class ixmp4.data.optimization.table.dto.Table(*, created_at: datetime | None, created_by: str | None, id: int, name: str, data: dict[str, list[float] | list[int] | list[str]], indexset_names: list[str], column_names: list[str] | None, run__id: int)

Bases: BaseModel, HasCreationInfo

Optimization table data model.

id: int

Integer id.

name: str

Name of the table.

data: dict[str, list[float] | list[int] | list[str]]
indexset_names: list[str]
column_names: list[str] | None
run__id: int
model_config = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Service

class ixmp4.data.optimization.table.service.TableService(transport: Transport)

Bases: DocsService, IndexSetAssociatedService

router_prefix: ClassVar[str] = '/optimization/tables'
router_tags: ClassVar[Sequence[str]] = ['optimization', 'tables']
executor: SessionExecutor
items: ItemRepository
pandas: PandasRepository
versions: VersionRepository
associations: AssociationRepository
indexsets: ItemRepository
runs: ItemRepository
create(run_id: int, name: str, constrained_to_indexsets: list[str], column_names: list[str] | None = None) Table

Creates a table.

Each column of the Table needs to be constrained to an existing ixmp4.data.abstract.optimization.IndexSet. These are specified by name and per default, these will be the column names. They can be overwritten by specifying column_names, which needs to specify a unique name for each column.

Parameters:
  • run_id (int) – The id of the Run for which this Table is defined.

  • name (str) – The unique name of the Table.

  • constrained_to_indexsets (list[str]) – List of IndexSet names that define the allowed contents of the Table’s columns.

  • column_names (list[str] | None = None) – Optional list of names to use as column names. If given, overwrites the names inferred from constrained_to_indexsets.

Raises:
Returns:

The created table.

Return type:

Table

create_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, run_id: int, name: str, constrained_to_indexsets: list[str], column_names: list[str] | None = None) None
get(run_id: int, name: str) Table

Retrieves a table by its name and run_id.

Parameters:
  • run_id (int) – The unique name of the table.

  • name (str) – The unique name of the table.

Raises:
  • TableNotFound – If the table with name does not exist.

  • Unauthorized – If the current user is not authorized to perform this action.

Returns:

The retrieved table.

Return type:

Table

get_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, run_id: int, name: str) None
get_by_id(id: int) Table

Retrieves a table by its id.

Parameters:

id (int) – The integer id of the table.

Raises:
  • TableNotFound – If the table with id does not exist.

  • Unauthorized – If the current user is not authorized to perform this action.

Returns:

The retrieved table.

Return type:

Table

get_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
delete_by_id(id: int) None

Deletes a table.

Parameters:

id (int) – The unique integer id of the table.

Raises:
  • TableNotFound – If the table with id does not exist.

  • TableDeletionPrevented – If the table with id is used in the database, preventing it’s deletion.

  • Unauthorized – If the current user is not authorized to perform this action.

delete_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int) None
add_data(id: int, data: dict[str, ~typing.Any] | ~typing.Annotated[~pandas.DataFrame, ~pydantic.functional_validators.PlainValidator(func=~ixmp4.data.dataframe.parse_df, json_schema_input_type=~typing.Any), ~pydantic.functional_serializers.PlainSerializer(func=~ixmp4.data.dataframe.serialize_df, return_type=dict, when_used=json), ~pydantic.json_schema.WithJsonSchema(json_schema={'properties': {'index': {'anyOf': [{'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Index'}, 'columns': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Columns'}, 'dtypes': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Dtypes'}, 'data': {'anyOf': [{'items': {'items': {'anyOf': [{'type': 'boolean'}, {'type': 'integer'}, {'type': 'number'}, {'type': 'string'}, {'additionalProperties': True, 'type': 'object'}, {'items': {'type': 'number'}, 'type': 'array'}, {'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'format': 'date-time', 'type': 'string'}, {'type': 'null'}]}, 'type': 'array'}, 'type': 'array'}, {'type': 'null'}], 'title': 'Data'}}, 'required': ['data'], 'title': 'DataFrameTypeAdapter', 'type': 'object'}, mode=serialization)]) None

Adds data to a Table.

The data will be validated with the linked constrained ixmp4.data.abstract.optimization.IndexSet`s. For that, `data.keys() must correspond to the names of the Table’s columns. Each column can only contain values that are in the linked IndexSet.data. Each row of entries must be unique. No values can be missing, None, or NaN. If data.keys() contains names already present in Table.data, existing values will be overwritten.

Parameters:
Raises:

OptimizationDataValidationError

  • If values are missing, None, or NaN - If values are not allowed based on constraints to Indexset s - If rows are not unique

Return type:

None

add_data_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int, data: dict[str, ~typing.Any] | ~typing.Annotated[~pandas.DataFrame, ~pydantic.functional_validators.PlainValidator(func=~ixmp4.data.dataframe.parse_df, json_schema_input_type=~typing.Any), ~pydantic.functional_serializers.PlainSerializer(func=~ixmp4.data.dataframe.serialize_df, return_type=dict, when_used=json), ~pydantic.json_schema.WithJsonSchema(json_schema={'properties': {'index': {'anyOf': [{'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Index'}, 'columns': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Columns'}, 'dtypes': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Dtypes'}, 'data': {'anyOf': [{'items': {'items': {'anyOf': [{'type': 'boolean'}, {'type': 'integer'}, {'type': 'number'}, {'type': 'string'}, {'additionalProperties': True, 'type': 'object'}, {'items': {'type': 'number'}, 'type': 'array'}, {'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'format': 'date-time', 'type': 'string'}, {'type': 'null'}]}, 'type': 'array'}, 'type': 'array'}, {'type': 'null'}], 'title': 'Data'}}, 'required': ['data'], 'title': 'DataFrameTypeAdapter', 'type': 'object'}, mode=serialization)]) None
remove_data(id: int, data: Any] | None = None) None

Removes data from a Table.

Parameters:
  • id (int) – The id of the ixmp4.data.abstract.optimization.Table.

  • data (dict[str, Any] | pandas.DataFrame) – The data to be removed. This must specify all indexed columns. All other keys/columns are ignored.

Return type:

None

remove_data_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int, data: Any] | None = None) None
list(**kwargs: Unpack[TableFilter]) list[Table]

Lists tables by specified criteria.

Parameters:

**kwargs (any) – Filter tables as specified in TableFilter.

Raises:

Unauthorized – If the current user is not authorized to perform this action.

Returns:

List of tables.

Return type:

list[Table]

list_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
paginated_list(pagination: Pagination, **kwargs: Unpack[TableFilter]) PaginatedResult[List[Table]]
tabulate(**kwargs: Unpack[TableFilter]) WithJsonSchema(json_schema={'properties': {'index': {'anyOf': [{'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Index'}, 'columns': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Columns'}, 'dtypes': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Dtypes'}, 'data': {'anyOf': [{'items': {'items': {'anyOf': [{'type': 'boolean'}, {'type': 'integer'}, {'type': 'number'}, {'type': 'string'}, {'additionalProperties': True, 'type': 'object'}, {'items': {'type': 'number'}, 'type': 'array'}, {'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'format': 'date-time', 'type': 'string'}, {'type': 'null'}]}, 'type': 'array'}, 'type': 'array'}, {'type': 'null'}], 'title': 'Data'}}, 'required': ['data'], 'title': 'DataFrameTypeAdapter', 'type': 'object'}, mode=serialization)]

Tabulates tables by specified criteria.

Parameters:

**kwargs (any) – Filter tables as specified in TableFilter.

Returns:

A data frame with the columns:
  • id

  • name

  • data

  • run__id

  • created_at

  • created_by

Return type:

pandas.DataFrame

tabulate_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
paginated_tabulate(pagination: Pagination, **kwargs: Unpack[TableFilter]) PaginatedResult[Annotated[DataFrame, PlainValidator, PlainSerializer, WithJsonSchema]]

Filters

class ixmp4.data.optimization.table.filter.TableFilter

Bases: TableFilter

id: int
id__in: list[int]
name: str
name__in: list[str]
name__like: str
name__ilike: str
name__notlike: str
name__notilike: str
run__id: int
run__id__in: list[int]

Variables (ixmp4.data.optimization.variable)

Data Transfer Object

class ixmp4.data.optimization.variable.dto.Variable(*, created_at: datetime | None, created_by: str | None, id: int, name: str, data: dict[str, list[float] | list[int] | list[str]], indexset_names: list[str] | None, column_names: list[str] | None, run__id: int)

Bases: BaseModel, HasCreationInfo

Optimization variable data model.

id: int

Integer id.

name: str

Name of the variable.

data: dict[str, list[float] | list[int] | list[str]]
indexset_names: list[str] | None
column_names: list[str] | None
run__id: int
model_config = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Service

class ixmp4.data.optimization.variable.service.VariableService(transport: Transport)

Bases: DocsService, IndexSetAssociatedService

router_prefix: ClassVar[str] = '/optimization/variables'
router_tags: ClassVar[Sequence[str]] = ['optimization', 'variables']
executor: SessionExecutor
items: ItemRepository
pandas: PandasRepository
versions: VersionRepository
associations: AssociationRepository
indexsets: ItemRepository
runs: ItemRepository
create(run_id: int, name: str, constrained_to_indexsets: list[str] | None = None, column_names: list[str] | None = None) Variable

Creates a table.

Raises:
Returns:

The created table.

Return type:

ixmp4.data.optimization.variable.dto.Variable

create_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, run_id: int, name: str, constrained_to_indexsets: list[str] | None = None, column_names: list[str] | None = None) None
get(run_id: int, name: str) Variable

Retrieves a table by its name and run_id.

Parameters:
  • run_id (int) – The unique name of the table.

  • name (str) – The unique name of the table.

Raises:
  • VariableNotFound – If the table with name does not exist.

  • Unauthorized – If the current user is not authorized to perform this action.

Returns:

The retrieved table.

Return type:

Variable

get_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, run_id: int, name: str) None
get_by_id(id: int) Variable

Retrieves a table by its id.

Parameters:

id (int) – The integer id of the table.

Raises:
Returns:

The retrieved table.

Return type:

Variable

get_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
delete_by_id(id: int) None

Deletes a table.

Parameters:

id (int) – The unique integer id of the table.

Raises:
delete_by_id_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int) None
add_data(id: int, data: dict[str, ~typing.Any] | ~typing.Annotated[~pandas.DataFrame, ~pydantic.functional_validators.PlainValidator(func=~ixmp4.data.dataframe.parse_df, json_schema_input_type=~typing.Any), ~pydantic.functional_serializers.PlainSerializer(func=~ixmp4.data.dataframe.serialize_df, return_type=dict, when_used=json), ~pydantic.json_schema.WithJsonSchema(json_schema={'properties': {'index': {'anyOf': [{'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Index'}, 'columns': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Columns'}, 'dtypes': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Dtypes'}, 'data': {'anyOf': [{'items': {'items': {'anyOf': [{'type': 'boolean'}, {'type': 'integer'}, {'type': 'number'}, {'type': 'string'}, {'additionalProperties': True, 'type': 'object'}, {'items': {'type': 'number'}, 'type': 'array'}, {'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'format': 'date-time', 'type': 'string'}, {'type': 'null'}]}, 'type': 'array'}, 'type': 'array'}, {'type': 'null'}], 'title': 'Data'}}, 'required': ['data'], 'title': 'DataFrameTypeAdapter', 'type': 'object'}, mode=serialization)]) None

Adds data to a Variable.

The data will be validated with the linked constrained ixmp4.data.abstract.optimization.IndexSet`s. For that, `data.keys() must correspond to the names of the Variable’s columns. Each column can only contain values that are in the linked IndexSet.data. Each row of entries must be unique. No values can be missing, None, or NaN. If data.keys() contains names already present in Variable.data, existing values will be overwritten.

Parameters:
  • id (int) – The id of the ixmp4.data.abstract.optimization.Variable.

  • data (dict[str, Any] | pandas.DataFrame) – The data to be added.

Raises:

ixmp4.core.exceptions.OptimizationItemUsageError

  • If values are missing, None, or NaN - If values are not allowed based on constraints to Variables s - If rows are not unique

Return type:

None

add_data_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int, data: dict[str, ~typing.Any] | ~typing.Annotated[~pandas.DataFrame, ~pydantic.functional_validators.PlainValidator(func=~ixmp4.data.dataframe.parse_df, json_schema_input_type=~typing.Any), ~pydantic.functional_serializers.PlainSerializer(func=~ixmp4.data.dataframe.serialize_df, return_type=dict, when_used=json), ~pydantic.json_schema.WithJsonSchema(json_schema={'properties': {'index': {'anyOf': [{'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Index'}, 'columns': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Columns'}, 'dtypes': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Dtypes'}, 'data': {'anyOf': [{'items': {'items': {'anyOf': [{'type': 'boolean'}, {'type': 'integer'}, {'type': 'number'}, {'type': 'string'}, {'additionalProperties': True, 'type': 'object'}, {'items': {'type': 'number'}, 'type': 'array'}, {'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'format': 'date-time', 'type': 'string'}, {'type': 'null'}]}, 'type': 'array'}, 'type': 'array'}, {'type': 'null'}], 'title': 'Data'}}, 'required': ['data'], 'title': 'DataFrameTypeAdapter', 'type': 'object'}, mode=serialization)]) None
remove_data(id: int, data: Any] | None = None) None

Removes data from a Variable.

Parameters:
  • id (int) – The id of the ixmp4.data.abstract.optimization.Variable.

  • data (dict[str, Any] | pandas.DataFrame, optional) – The data to be removed. If specified, remove only specific data. This must specify all indexed columns. All other keys/columns are ignored. Otherwise, remove all data (the default).

Return type:

None

remove_data_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, /, id: int, data: Any] | None = None) None
list(**kwargs: Unpack[VariableFilter]) List[Variable]

Lists variables by specified criteria.

Parameters:

**kwargs (any) – Filter variables as specified in VariableFilter.

Raises:

Unauthorized – If the current user is not authorized to perform this action.

Returns:

List of variables.

Return type:

list[Variable]

list_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol, **kwargs: Unpack[VariableFilter]) None
paginated_list(pagination: Pagination, **kwargs: Unpack[VariableFilter]) PaginatedResult[List[Variable]]
tabulate(**kwargs: Unpack[VariableFilter]) WithJsonSchema(json_schema={'properties': {'index': {'anyOf': [{'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Index'}, 'columns': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Columns'}, 'dtypes': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'title': 'Dtypes'}, 'data': {'anyOf': [{'items': {'items': {'anyOf': [{'type': 'boolean'}, {'type': 'integer'}, {'type': 'number'}, {'type': 'string'}, {'additionalProperties': True, 'type': 'object'}, {'items': {'type': 'number'}, 'type': 'array'}, {'items': {'type': 'integer'}, 'type': 'array'}, {'items': {'type': 'string'}, 'type': 'array'}, {'format': 'date-time', 'type': 'string'}, {'type': 'null'}]}, 'type': 'array'}, 'type': 'array'}, {'type': 'null'}], 'title': 'Data'}}, 'required': ['data'], 'title': 'DataFrameTypeAdapter', 'type': 'object'}, mode=serialization)]

Tabulates variables by specified criteria.

Parameters:

**kwargs (any) – Filter variables as specified in VariableFilter.

Returns:

A data frame with the columns:
  • id

  • name

Return type:

pandas.DataFrame

tabulate_auth_check(auth_ctx: AuthorizationContext, platform: PlatformProtocol) None
paginated_tabulate(pagination: Pagination, **kwargs: Unpack[VariableFilter]) PaginatedResult[Annotated[DataFrame, PlainValidator, PlainSerializer, WithJsonSchema]]

Filters

class ixmp4.data.optimization.variable.filter.VariableFilter

Bases: VariableFilter

id: int
id__in: list[int]
name: str
name__in: list[str]
name__like: str
name__ilike: str
name__notlike: str
name__notilike: str
run__id: int
run__id__in: list[int]

Base Filters

class ixmp4.data.filters.optimization.EquationFilter

Bases: IdFilter, NameFilter, RunIdFilter

id: int
id__in: list[int]
name: str
name__in: list[str]
name__like: str
name__ilike: str
name__notlike: str
name__notilike: str
run__id: int
run__id__in: list[int]
class ixmp4.data.filters.optimization.IndexSetFilter

Bases: IdFilter, NameFilter, RunIdFilter

id: int
id__in: list[int]
name: str
name__in: list[str]
name__like: str
name__ilike: str
name__notlike: str
name__notilike: str
run__id: int
run__id__in: list[int]
class ixmp4.data.filters.optimization.ParameterFilter

Bases: IdFilter, NameFilter, RunIdFilter

id: int
id__in: list[int]
name: str
name__in: list[str]
name__like: str
name__ilike: str
name__notlike: str
name__notilike: str
run__id: int
run__id__in: list[int]
class ixmp4.data.filters.optimization.ScalarFilter

Bases: IdFilter, NameFilter, RunIdFilter

id: int
id__in: list[int]
name: str
name__in: list[str]
name__like: str
name__ilike: str
name__notlike: str
name__notilike: str
run__id: int
run__id__in: list[int]
class ixmp4.data.filters.optimization.TableFilter

Bases: IdFilter, NameFilter, RunIdFilter

id: int
id__in: list[int]
name: str
name__in: list[str]
name__like: str
name__ilike: str
name__notlike: str
name__notilike: str
run__id: int
run__id__in: list[int]
class ixmp4.data.filters.optimization.VariableFilter

Bases: IdFilter, NameFilter, RunIdFilter

id: int
id__in: list[int]
name: str
name__in: list[str]
name__like: str
name__ilike: str
name__notlike: str
name__notilike: str
run__id: int
run__id__in: list[int]