Skip to main content

models

Typed config models for the preprocessing steps.

Each model mirrors one PostProcessor subclass: its type is the discriminator and its fields match that postprocessor's __init__ kwargs. apply_preprocessing dumps these back to plain dicts for the existing create_postprocessors machinery, so the field names here must stay in step with the constructors in bitfount.federated.algorithms.model_algorithms.post_processing.

Only the transforms the registry actually uses are modelled. Add a model (and extend PreprocessingConfig) when a new postprocessor type is registered.

Classes

ExtractionSpec

class ExtractionSpec(**data: Any):

One json_extract_to_columns extraction.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables

  • static model_config
  • static source_path : str
  • static target_column : str

FieldMapping

class FieldMapping(**data: Any):

One json_restructure field move (dot-notation paths).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables

  • static model_config
  • static source_path : str
  • static target_path : str

JSONExtractToColumnsConfig

class JSONExtractToColumnsConfig(**data: Any):

Extract JSON dict fields into new DataFrame columns.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables

  • static drop_source : bool
  • static model_config
  • static source_column : str
  • static type : Literal['json_extract_to_columns']

JSONKeyRenameConfig

class JSONKeyRenameConfig(**data: Any):

Rename keys within JSON dict columns.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables

  • static column_patterns : list[str]
  • static model_config
  • static recursive : bool
  • static type : Literal['json_key_rename']

JSONRestructureConfig

class JSONRestructureConfig(**data: Any):

Move fields between levels of a JSON dict column.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables

  • static column_patterns : list[str]
  • static keep_original : bool
  • static model_config
  • static type : Literal['json_restructure']

KeyMapping

class KeyMapping(**data: Any):

One json_key_rename key rename.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables

  • static model_config
  • static source_key : str
  • static target_key : str

ScaleLandmarkCoordinatesConfig

class ScaleLandmarkCoordinatesConfig(**data: Any):

Scale landmark coordinates from model-input to target image space.

columns_required is not a postprocessor constructor kwarg — it is read by get_postprocessor_metadata_columns to fetch the target dimension columns (e.g. Columns/Rows) before the transform runs, then dropped.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables

  • static columns_required : list[str]
  • static drop_target_dimension_columns : bool
  • static model_config
  • static source_column : str
  • static source_height : float
  • static source_width : float
  • static swap_xy : bool
  • static target_column : str | None
  • static target_height_column : str
  • static target_width_column : str
  • static type : Literal['scale_landmark_coordinates']

StringToJSONConfig

class StringToJSONConfig(**data: Any):

Convert string columns containing JSON into dict objects.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables

  • static column_patterns : list[str]
  • static model_config
  • static type : Literal['string_to_json']

ZipFlattenCoordinatesConfig

class ZipFlattenCoordinatesConfig(**data: Any):

Zip slice indices with coordinate groups into flat triples.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables

  • static coordinates_path : str
  • static drop_source : bool
  • static model_config
  • static slice_indices_path : str
  • static source_column : str
  • static target_column : str
  • static type : Literal['zip_flatten_coordinates']