koa_middleware.datamodel_protocol

Classes

SupportsCalibrationModelIO(*args, **kwargs)

Structural interface for DataModel-like objects that can be written to disk and converted into a calibration database record.

class koa_middleware.datamodel_protocol.SupportsCalibrationModelIO(*args, **kwargs)[source]

Bases: Protocol

Structural interface for DataModel-like objects that can be written to disk and converted into a calibration database record.

Any class instance that wishes to be treated as a CalibrationModel must implement the methods defined here.

abstractmethod save(*args, output_path: str | None = None, output_dir: str | None = None, **kwargs) str[source]

Save the data model to disk.

Parameters:
  • output_path (str, optional) – Full file path to save the file to. If None, saves to the current directory.

  • output_dir (str, optional) – Directory to save the file to. Ignored if output_path is provided.

Returns:

The full file path where the model was saved.

Return type:

str

abstractmethod to_record(*args, **kwargs) dict[source]

Convert this model into a calibration database record.

Returns:

A dictionary representing the calibration database record.

Return type:

dict