movici_data_core¶
Subpackages¶
bounding_box¶
- calculate_bounding_box_from_data(data: Dict[str, Dict[str, UniformAttributeData | CSRAttributeData]]) BoundingBox¶
- calculate_new_bounding_box(*bboxes: BoundingBox) BoundingBox¶
domain_model¶
- class AttributeSummary(name: str, data_type: DataType[T_datatype], description: str, enum_name: str | None, unit: str, min_val: T_datatype | None, max_val: T_datatype | None)¶
Bases:
Generic[T_datatype]an entry in the
EntityGroupSummary.entity_groupslist. Contains a summary of a single entity group.- Parameters:
name – the attribute name (equal to its type)
data_type – the attribute’s data type
description – the attribute type’s description
enum_name – the attribute type’s enum name (if any)
unit – the attributes type’s unit
min_val – the minimum value of the attribute for the associated entity group (if any)
max_val – the maximum value of the attribute for the associated entity group (if any)
- description: str¶
- enum_name: str | None¶
- max_val: T_datatype | None¶
- min_val: T_datatype | None¶
- name: str¶
- unit: str¶
- class AttributeType(name: str, data_type: DataType, id: UUID | None = None, unit: str = '', description: str = '', enum_name: str | None = None)¶
Bases:
objectAn attribute type contains information about an attribute. Every attribute must have a type. Equivalent to an
AttributeSpecand can be converted to and fromAttributeSpec- Parameters:
name – a snake_case name for the attribute type. Must be unique in the database
data_type – The data type of the attribute
id – the attribute type
UUIDin the database (if any)unit – the unit of the attribute, such as
mors. Default""(emtpy string)description – a description of the attribute describing it’s meaning. Default
""(empty string)enum_name – (Optional) in case of an
enumattribute, the name of theenum
- description: str = ''¶
- enum_name: str | None = None¶
- classmethod from_attribute_spec(spec: AttributeSpec)¶
Convert an
AttributeSpecto anAttributeType
- id: UUID | None = None¶
- name: str¶
- to_attribute_spec()¶
Convert an
AttributeTypeto anAttributeSpec
- unit: str = ''¶
- class BoundingBox(min_x: float | None, min_y: float | None, max_x: float | None, max_y: float | None)¶
Bases:
NamedTupleRepresentation of a bounding box, if any of the components are
None, the bounding box is considered incomplete and reduces toNone- as_tuple_or_none()¶
- classmethod empty() BoundingBox¶
Return an empty BoundingBox (all fields set to None) that can be use as a basis for generating a bounding box from multiple datasets/updates
- classmethod from_tuple_or_none(obj: tuple[float | None, float | None, float | None, float | None] | None)¶
- max_x: float | None¶
Alias for field number 2
- max_y: float | None¶
Alias for field number 3
- min_x: float | None¶
Alias for field number 0
- min_y: float | None¶
Alias for field number 1
- class Dataset(name: str, display_name: str, dataset_type: DatasetType, id: UUID | None = None, workspace: Workspace | None = None, general: dict | None = None, epsg_code: int | None = None, bounding_box: BoundingBox = <factory>, created_at: datetime | None = None, updated_at: datetime | None = None, data: dict | bytes | BinaryIO | Path | None = None, has_data: bool = False)¶
Bases:
object- Parameters:
name – a snake_case dataset name, must be unique in the Workspace
display_name – a human readable display name
dataset_type – the dataset’s type
id – the dataset
UUIDin the database (if any)workspace – the
Workspacethe dataset belongs to (if any)general – the dataset’s general section (dict) for
ENTITY_BASEDandUNSTRUCTUREDdatasets (if any)epsg_code – the dataset’s CRS as an EPSG code
bounding_box – the datasets
BoundingBoxif it contains geospatial data (output only)created_at – the datetime the dataset was created
updated_at – the datetime the dataset was updated
data – the dataset’s data, if presented or loaded
has_data – whether the dataset has data in the database
- bounding_box: BoundingBox¶
- created_at: datetime | None = None¶
- dataset_type: DatasetType¶
- display_name: str¶
- epsg_code: int | None = None¶
- general: dict | None = None¶
- has_data: bool = False¶
- id: UUID | None = None¶
- name: str¶
- updated_at: datetime | None = None¶
- class DatasetFormat(*values)¶
Bases:
str,EnumFormat types for dataset storage.
Matches the
formatfield used in the platform:ENTITY_BASED: Entity-oriented JSON data, destructured into numpy arrays. Entity data is split up into entity groups that contain attributes. see also Movici Data FormatUNSTRUCTURED: Unstructured JSON data, stored as blob but JSON-loadable. A Dataset withUNSTRUCTUREDdata contains a"data"sections that can be JSON encoded, but is otherwise schemalessBINARY: Binary data, stored as blob and passed transparently. A Dataset withBINARYdata can contain any data that is not validated bymovici-data-core
- BINARY = 'binary'¶
- ENTITY_BASED = 'entity_based'¶
- UNSTRUCTURED = 'unstructured'¶
- class DatasetSummary(general: dict, epsg_code: int | None, bounding_box: BoundingBox, entity_groups: list[EntityGroupSummary], count: int)¶
Bases:
objectA DatasetSummary is an overview of the entity groups and attributes in a (
ENTITY_BASEDdataset. It also contains some other information, such as the dataset general section as well as the EPSG code and bounding box. ADatasetSummaryis an output only object- Parameters:
general – the dataset general section
epsg_code – the dataset’s CRS as an EPSG code
bounding_box – the dataset’s
BoundingBoxif it contains geospatial dataentity_groups – a summary of the entity groups in the dataset
count – the total number of entities in the dataset
- bounding_box: BoundingBox¶
- count: int¶
- entity_groups: list[EntityGroupSummary]¶
- epsg_code: int | None¶
- general: dict¶
- class DatasetType(name: str, format: DatasetFormat | None = None, mimetype: str | None = None, id: UUID | None = None)¶
Bases:
objectA DatasetType determines the meaning of a Dataset. Every Dataset must have a type. Examples may be
transport_networkortabular- Parameters:
name – a snake_case name, must be unique in the database
format – determines how Dataset data is formatted
mimetype – in case of a
DatasetFormat.BINARYformat, a dataset type may specify a mimetype. When adding data, the mimetype may be validated if given
- format: DatasetFormat | None = None¶
- id: UUID | None = None¶
- is_equivalent(other: DatasetType)¶
- mimetype: str | None = None¶
- name: str¶
- class EntityGroupSummary(name: str, count: int, attributes: list[AttributeSummary])¶
Bases:
objectan entry in the
DatasetSummary.entity_groupslist. Contains a summary of a single entity group.- Parameters:
name – the entity group name (equal to its type)
count – the number of entities in this entity group
attributes – a summary of the attributes in the entity groups
- attributes: list[AttributeSummary]¶
- count: int¶
- name: str¶
- class EntityType(name: str, id: UUID | None = None)¶
Bases:
objectRepresentation of an entity type
- Parameters:
name – a snake_case name, must be unique in the database
id – the entity type
UUIDin the database (if any)
- id: UUID | None = None¶
- name: str¶
- class ModelType(name: str, jsonschema: dict | None = None, id: UUID | None = None)¶
Bases:
objectA model type is a definition of a model that may be used in a
Scenario. It must contain a jsonschema that validates model configs for that type in theScenarioconfig- Parameters:
name – a snake_case name, must be unique in the database
jsonschema – a
jsonschemadict to validate any model configs for this model type. The json schema may contain movici custom keys such asmovici.typeandmovici.datasetType, to indicate a field is a reference to a Movici object such as aDataset,EntityTypeorAttributeTypeid – the model type
UUIDin the database (if any)
- id: UUID | None = None¶
- jsonschema: dict | None = None¶
- name: str¶
- class Scenario(name: str, display_name: str, description: str, epsg_code: int | None = None, bounding_box: BoundingBox = <factory>, simulation_info: SimulationInfo = <factory>, status: ScenarioStatus = ScenarioStatus.READY, id: UUID | None = None, workspace: Workspace | None = None, created_at: datetime | None = None, updated_at: datetime | None = None, models: list[ScenarioModel] = <factory>, datasets: list[ScenarioDataset] = <factory>, has_updates: bool = False)¶
Bases:
objectA Scenario is a description of a simulation. It contains a collection of models that should work togehter on a collection of datasets in order to perform a certain, specific, calculation, as well as other information such as the timeline information
- Parameters:
name – a snake_case name, must be unique in the workspace
display_name – a human readable display name
description – a human readable description of the scenario
epsg_code – The coordinate reference system (as an EPSG code) of the scenario
bounding_box – the scenario bounding box (output only)
simulation_info – the scenario simulation info
status – the scenario status
id – the scenario
UUIDin the database (if any)workspace – The workspace the scenario belongs to (if any)
created_at – the datetime the scenario was created
updated_at – the datetime the scenario was updated
models – a list of
ScenarioModels for this scenariodatasets – a list of
ScenarioDatasets for this scenario
- bounding_box: BoundingBox¶
- created_at: datetime | None = None¶
- datasets: list[ScenarioDataset]¶
- description: str¶
- display_name: str¶
- epsg_code: int | None = None¶
- has_updates: bool = False¶
- id: UUID | None = None¶
- models: list[ScenarioModel]¶
- name: str¶
- simulation_info: SimulationInfo¶
- status: ScenarioStatus = 'Ready'¶
- updated_at: datetime | None = None¶
- class ScenarioDataset(name: str, dataset_type: DatasetType | None = None, id: UUID | None = None)¶
Bases:
objectA representation of a dataset in a scenario
- Parameters:
name – the dataset name
dataset_type – the dataset dataset type
id – the dataset
UUIDin the database (if any)
- dataset_type: DatasetType | None = None¶
- id: UUID | None = None¶
- name: str¶
- class ScenarioModel(name: str, type: ModelType, config: dict = <factory>, references: list[MoviciDataRefInfo] = <factory>)¶
Bases:
objectA configured model in a scenario
- Parameters:
name – a snake_case model name. Must be unique in a scenario
type – the model type
config – the model config dict
references – a list of
MoviciDataRefInfoobjects that were extracted from the model config dict
- as_dict()¶
- config: dict¶
- name: str¶
- references: list[MoviciDataRefInfo]¶
- with_populated_config()¶
- class ScenarioStatus(*values)¶
Bases:
str,Enum- FAILED = 'Failed'¶
- INVALID = 'Invalid'¶
- READY = 'Ready'¶
- RUNNING = 'Running'¶
- SUCCEEDED = 'Succeeded'¶
- class SimulationInfo(duration: int, reference: float, time_scale: float = 1, start_time: int = 0, mode: Literal['time_oriented'] = 'time_oriented')¶
Bases:
objectA class to hold information about the time settings of the scenario. In a simulation, time progresses in discrete intervals, each with a time step of
time_scaleseconds. The total duration of the simulation isdurationdiscrete intervals. The simulation starts at the discrete time stepstart_time. For purposes of calculating the absolute (wall clock) time in the simulation, att=start_time, the absolute time has a unix timestampreference- Parameters:
duration – the duration of the scenario in discrete time steps
reference – the unix timestamp inside the simulation at
t=0time_scale – the size of a single discrete timestep in seconds. Default:
1start_time – the discrete time step to start the simulation at, usually
t=0. default:0mode – must be set to
"time_oriented". Default ``"time_oriented"
- classmethod default()¶
- duration: int¶
- mode: Literal['time_oriented'] = 'time_oriented'¶
- reference: float¶
- start_time: int = 0¶
- time_scale: float = 1¶
- class Update(dataset: ScenarioDataset, timestamp: int, iteration: int, model: UpdateModel, bounding_box: BoundingBox = <factory>, id: UUID | None = None, created_at: datetime | None = None, data: dict | bytes | BinaryIO | Path | None = None)¶
Bases:
objectAn Update is a change to the World State in a simulation. An update is always produced by a model at a certain timestamp
- Parameters:
dataset – The dataset this update changes the state for
timestamp – the discrete time step this update was produced in the simulation
iteration – the iteration at the timestamp this update was created. Every update in a scenario must have a unique (timestamp, iteration) combination
model – the model in the scenario that produced the update
bounding_box – The bounding_box of the update, in case it contains geospatial attributes. the values should be in the same CRS as its dataset
id – the update
UUIDin the database (if any)created_at – the datetime the update was created
data – the update data payload
- bounding_box: BoundingBox¶
- created_at: datetime | None = None¶
- dataset: ScenarioDataset¶
- id: UUID | None = None¶
- iteration: int¶
- model: UpdateModel¶
- timestamp: int¶
- class UpdateModel(name: str, type: ModelType | None = None)¶
Bases:
objectA short form of a
ScenarioModelto be used byUpdate. Contains only the name and the type, and the type is optional :param name: the model name from the scenario :param type: OptionalModelTypefrom the scenario.- classmethod from_scenario_model(scenario_model: ScenarioModel)¶
- name: str¶
- class Workspace(name: str, display_name: str, id: UUID | None = None, scenario_count: int | None = None, dataset_count: int | None = None)¶
Bases:
objectA Workspace is a logical unit for bundling Scenarios and Datasets. A Scenario must be in the same Workspace as any Dataset it references. Workspaces may group Scenarios and Datasets that belong to a certain project, organisation or that otherwise logically belong together.
- Parameters:
name – a snake_case workspace name, must be unique in the database
display_name – a human readably display name
id – the workspace
UUIDin the database (if any)scenario_count – the number of scenarios in this workspace
dataset_count – the number of datasets in this workspace
- dataset_count: int | None = None¶
- display_name: str¶
- id: UUID | None = None¶
- name: str¶
- scenario_count: int | None = None¶
- utcnow()¶
exceptions¶
- exception DatabaseAlreadyInitialized¶
Bases:
MoviciDataError
- exception DatabaseNotYetInitialized¶
Bases:
MoviciDataError
- exception DeserializationError¶
Bases:
MoviciDataError
- exception InconsistentDatabase¶
Bases:
MoviciDataError
- exception InvalidAction(message: str = 'Invalid action')¶
Bases:
MoviciDataError- payload() dict | None¶
- exception InvalidID(id: Any)¶
Bases:
MoviciDataError- payload() dict | None¶
- exception InvalidResource(resource_type: str, name: str | None = None, id: UUID | None = None, message: str | None = None)¶
Bases:
MoviciDataError- id: UUID | None¶
- payload()¶
- exception MoviciValidationError(error: str | dict[str, list[str]] | None = None, path: str | int = '')¶
Bases:
MoviciDataError- as_dict()¶
- as_http_payload()¶
- consume(errors: Sequence[ValidationError | MoviciValidationError] | ValidationError | MoviciValidationError)¶
- classmethod from_errors(errors: Sequence[ValidationError | MoviciValidationError] | ValidationError | MoviciValidationError, path='')¶
- iter_messages()¶
- messages: dict[str, list[str]]¶
- exception ResourceAlreadyExists(resource_type: str, name: str | None = None, id: UUID | None = None, message: str | None = None)¶
Bases:
InvalidResource
- exception ResourceDoesNotExist(resource_type: str, name: str | None = None, id: UUID | None = None, message: str | None = None)¶
Bases:
InvalidResource
- exception UnsupportedFileType(filetype: FileType)¶
Bases:
MoviciDataError- payload()¶
- class map_errors(mapping: Mapping[Type[Exception], Exception | Type[Exception] | Callable[[...], Exception]])¶
Bases:
objectA decorator to catch certain exceptions and reraise them as a different exception
- Parameters:
mapping – a mapping between exceptions or exception types and a callable per exception or exception type. The callable must accept the same arguments as the decorated method except the
selfargument
- wrap(func)¶
- wrap_async(func)¶
schema¶
- class DatasetList(*, datasets: list[ShortDatasetOut])¶
Bases:
OutModel[Sequence[Dataset]]- datasets: list[ShortDatasetOut]¶
- model_config = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class DatasetWithDataIn(*, name: str, display_name: str = '', type: DatasetType | str, epsg_code: int | None = None, general: dict | None = None, data: dict | None = None)¶
Bases:
ShortDatasetInFull input dataset model, only relevant for ENTITY_BASED and UNSTRUCTURED datasets
- data: dict | None¶
- epsg_code: int | None¶
- general: dict | None¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod read_entity_based_dataset_from_file(path: Path, serializer: ExternalSerializationStrategy)¶
- classmethod read_unstructured_dataset_from_file(path: Path)¶
- to_domain()¶
- class DatasetWithDataOut(*, id: UUID, name: str, display_name: str, dataset_type: DatasetType, has_data: bool, created_at: datetime, updated_at: datetime, epsg_code: int | None = None, bounding_box: BoundingBox, ~pydantic.functional_serializers.PlainSerializer(func=~movici_data_core.schema.<lambda>, return_type=PydanticUndefined, when_used=always), ~pydantic.json_schema.WithJsonSchema(json_schema={'title': 'Bounding Box', 'type': 'array', 'maxItems': 4, 'minItems': 4, 'items': {'type': 'number'}}, mode=None)] | None = None, general: dict | None = None, data: dict)¶
Bases:
ShortDatasetOutFull output dataset model, only relevant for ENTITY_BASED and UNSTRUCTURED datasets
- bounding_box: BoundingBoxField | None¶
- data: dict¶
- epsg_code: int | None¶
- general: dict | None¶
- model_config = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class OutModel¶
Bases:
BaseModel,Generic[T_dom]Base class for output (serialization) models
- Variables:
__envelope__ – An optional string that may be used as the envelope when serializing a sequence of objects. Instead of serializing to a list, the objects will be serialzed to a dictionary containing the envelope key, and then the serialized sequence of objects
- classmethod from_domain(obj: T_dom)¶
- model_config = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ScenarioDatasetIn(*, name: str, type: DatasetType | str | None)¶
Bases:
BaseModel- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str¶
- to_domain()¶
- type: domain_model.DatasetType | str | None¶
- class ScenarioDatasetOut(*, name: str, dataset_type: DatasetType, id: UUID)¶
Bases:
OutModel[ScenarioDataset]- id: UUID¶
- model_config = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str¶
- class ScenarioIn(**data: Any)¶
Bases:
BaseModel- datasets: list[ScenarioDatasetIn]¶
- description: str¶
- display_name: str¶
- epsg_code: int | None¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- models: list[ScenarioModelIn]¶
- name: str¶
- simulation_info: SimulationInfoInOut¶
- to_domain()¶
- class ScenarioModelIn(*, name: str, type: str | ModelType, **extra_data: Any)¶
Bases:
BaseModel- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str¶
- to_domain()¶
- type: str | domain_model.ModelType¶
- class ScenarioModelOut(*, name: str, type: ~typing.Annotated[str | ~movici_data_core.domain_model.ModelType, ~pydantic.functional_validators.BeforeValidator(func=~movici_data_core.schema.<lambda>, json_schema_input_type=PydanticUndefined)], **extra_data: ~typing.Any)¶
Bases:
OutModel[ScenarioModel]- classmethod from_domain(obj: ScenarioModel)¶
- model_config = {'extra': 'allow', 'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str¶
- type: t.Annotated[str | ModelType, BeforeValidator(lambda v: v.name if isinstance(v, ModelType) else v)]¶
- class ScenarioOut(*, id: UUID, name: str, display_name: str, description: str, epsg_code: int | None, simulation_info: SimulationInfoInOut, models: list[Annotated[ScenarioModelOut, BeforeValidator(func=from_domain, json_schema_input_type=PydanticUndefined)]], datasets: list[ScenarioDatasetOut])¶
Bases:
OutModel[Scenario]- datasets: list[ScenarioDatasetOut]¶
- description: str¶
- display_name: str¶
- epsg_code: int | None¶
- id: UUID¶
- model_config = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- models: list[t.Annotated[ScenarioModelOut, BeforeValidator(ScenarioModelOut.from_domain)]]¶
- name: str¶
- simulation_info: SimulationInfoInOut¶
- class ShortDatasetIn(*, name: str, display_name: str = '', type: DatasetType | str)¶
Bases:
BaseModel- display_name: str¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str¶
- to_domain()¶
- type: domain_model.DatasetType | str¶
- class ShortDatasetOut(*, id: UUID, name: str, display_name: str, dataset_type: DatasetType, has_data: bool, created_at: datetime, updated_at: datetime)¶
Bases:
OutModel[Dataset]- created_at: datetime.datetime¶
- display_name: str¶
- has_data: bool¶
- id: UUID¶
- model_config = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str¶
- updated_at: datetime.datetime¶
- class ShortUpdateOut(*, id: UUID, dataset: ScenarioDatasetOut, model: UpdateModelOut, timestamp: int, iteration: int, created_at: datetime)¶
Bases:
OutModel[Update]- created_at: datetime.datetime¶
- dataset: ScenarioDatasetOut¶
- id: UUID¶
- iteration: int¶
- model: UpdateModelOut¶
- model_config = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- timestamp: int¶
- class SimulationInfoInOut(*, duration: int, reference: float, time_scale: float, start_time: int, mode: Literal['time_oriented'] = 'time_oriented')¶
Bases:
OutModel[SimulationInfo]- duration: int¶
- mode: t.Literal['time_oriented']¶
- model_config = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- reference: float¶
- start_time: int¶
- time_scale: float¶
- to_domain()¶
- class UpdateIn(*, dataset: ScenarioDatasetIn, model: UpdateModelIn, timestamp: int, iteration: int, created_at: datetime | None = None)¶
Bases:
BaseModelValidator for incoming updates. The validator does not process the updates “data” key, this must be done separately. However, the
read_from_filemethod, does process the “data” key as well- created_at: datetime.datetime | None¶
- dataset: ScenarioDatasetIn¶
- iteration: int¶
- model: UpdateModelIn¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod read_from_file(path: Path, serializer: ExternalSerializationStrategy, filetype: FileType | None = None) Update¶
Read an Update from a file. The update cannot contain multiple keys that contain dataset data, and that key must either be
"data"or the update’s dataset name- Parameters:
path – A path to an file containing an update. The file must be in a format that the serializer supports, which is generally either JSON or MessagePack.
serializer – An object that inherits from
ExternalSerializationStrategy.filetype – The filetype for the file. If given, it will be explictly (attempted to be) read as a file of this type. If not given, or None, the filetype will be guessed from the filename (suffix)
- Returns:
An Update with the data section in Movici format
- timestamp: int¶
- to_domain()¶
- class UpdateModelIn(*, name: str, type: str | None = None)¶
Bases:
BaseModel- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str¶
- to_domain()¶
- type: str | None¶
- class UpdateModelOut(*, name: str, type: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~movici_data_core.schema.<lambda>, json_schema_input_type=PydanticUndefined)])¶
Bases:
BaseModel- model_config = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str¶
- type: t.Annotated[str, BeforeValidator(lambda v: v.name)]¶
- class UpdateWithDataOut(*, id: UUID, dataset: ScenarioDatasetOut, model: UpdateModelOut, timestamp: int, iteration: int, created_at: datetime, data: dict | None)¶
Bases:
ShortUpdateOut- data: dict | None¶
- model_config = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod write_to_file(update: Update, file: Path | BinaryIO, serializer: ExternalSerializationStrategy, filetype: FileType)¶
Serialize and write an Update to a file.
- Parameters:
update – the Update to write
file – Either a
pathlib.Pathor a file-like object. If given a file-like object it must be opened writable in bytes mode. This method will not open or close the objectserializer – an object implementing
ExternalSerializationStrategy, usuallyEntityInitDataFormatfiletype – A
FileType. This must be aFileTypethat is supported by the serializer
- class WorkspaceIn(*, name: str, display_name: str)¶
Bases:
BaseModel- display_name: str¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str¶
- to_domain()¶
- class WorkspaceListOut(*, workspaces: list[WorkspaceOut])¶
Bases:
OutModel[Sequence[Workspace]]- model_config = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- workspaces: list[WorkspaceOut]¶
- class WorkspaceOut(*, name: str, display_name: str, id: UUID, scenario_count: int, dataset_count: int)¶
Bases:
WorkspaceIn,OutModel[Workspace]- dataset_count: int¶
- id: UUID¶
- model_config = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- scenario_count: int¶
serialization¶
validators¶
- class ModelConfigValidator(attribute_types: dict[str, movici_data_core.domain_model.AttributeType]=<factory>, entity_types: dict[str, movici_data_core.domain_model.EntityType]=<factory>, datasets: dict[str, movici_data_core.domain_model.ScenarioDataset] | None=None, model_types: dict[str, movici_data_core.domain_model.ModelType] | None=None)¶
Bases:
object- attribute_types: dict[str, AttributeType]¶
- dataset_types_by_datasets: dict[str, str] | None¶
- datasets: dict[str, ScenarioDataset] | None = None¶
- entity_types: dict[str, EntityType]¶
- for_scenario(datasets: Sequence[ScenarioDataset], model_types: Sequence[ModelType])¶
- classmethod from_list_data(attribute_types: Sequence[AttributeType], entity_types: Sequence[EntityType], datasets: Sequence[ScenarioDataset] | None = None)¶
- iter_scenario_model_references(id: UUID, scenario_model: ScenarioModel) Iterable[dict]¶
- property lookup¶
- parse_and_validate_scenario_model(model: ScenarioModel) ScenarioModel¶
- process_model_configs(models: list[ScenarioModel]) list[ScenarioModel]¶