compas.data

This package defines the core infrastructure for data serialisation in the COMPAS framework. It provides a base class for data objects, a JSON encoder and decoder, serialisers and deserialisers, and schema validation.

Classes

Data

Abstract base class for all COMPAS data objects.

DataDecoder

Data decoder for custom JSON serialization with support for COMPAS data structures and geometric primitives.

DataEncoder

Data encoder for custom JSON serialization with support for COMPAS data structures and geometric primitives.

DecoderError

Exception that is raised when the decoder fails at reconstructing an object that has been identified as a COMPAS data object.

Functions

compas_dataclasses

Find all classes in the COMPAS data model.

dataclass_dataschema

Generate a JSON schema for a COMPAS object class.

dataclass_jsonschema

Generate a JSON schema for a COMPAS object class.

dataclass_typeschema

Generate a JSON schema for the data type of a COMPAS object class.

json_dump

Write a collection of COMPAS object data to a JSON file.

json_dumps

Write a collection of COMPAS objects to a JSON string.

json_dumpz

Write a collection of COMPAS objects to a compressed JSON file (using ZIP compression).

json_load

Read COMPAS object data from a JSON file.

json_loads

Read COMPAS object data from a JSON string.

json_loadz

Read COMPAS object data from a compressed JSON file (ZIP).