Models / Review

ChangeCreationResult

class teksi_hooks.models.review.ChangeCreationResult(job_id, import_model, incremental_import_model=None, created_models=<factory>, incremental_created_models=<factory>, effect_document=None, changes=<factory>, validation_findings=<factory>, classified_changes=<factory>, features_by_class=<factory>, diff_schema_result=<factory>)[source]

Result of a change-creation workflow.

The result exposes intermediate products for diagnostics, tests and subsequent review or persistence workflows.

Parameters:

Fields

job_id

Type: str | None

Database-generated identifier of the inserted review-job metadata row.

import_model

Type: str | None

Name of the import model.

incremental_import_model

Type: str | None

Name of the incremental import model.

created_models

Type: list[str]

List of created models.

incremental_created_models

Type: list[str]

List of created incremental models.

effect_document

Type: EffectDocument | None

Effect Document of the corresponding workflow.

changes

Type: list[Change]

Changes of the corresponding workflow.

validation_findings

Type: list[ValidationFinding]

Validation findings of the corresponding workflow.

classified_changes

Type: ClassifiedChanges | None

Classified Changes of the corresponding workflow.

features_by_class

Type: dict[str, list[ReviewFeature]]

List of review features by class.

diff_schema_result

Type: DiffSchemaWriteResult | None

Result of the Diff Schema Writer.

DiffReviewDecisionResult

class teksi_hooks.models.review.DiffReviewDecisionResult(job_id, snapshot_id, decision, job_status, persistence_result=None)[source]

Result of accepting or rejecting a diff review job.

An accepted decision includes the result returned by the canonical persistence capability. A rejected decision does not invoke persistence and therefore has no persistence result.

Parameters:
  • job_id (str)

  • snapshot_id (UUID)

  • decision (DiffReviewDecision)

  • job_status (DiffReviewJobStatus)

  • persistence_result (PersistenceResult | None)

Fields

job_id

Type: str

Logical identifier of the diff review job that was resolved.

snapshot_id

Type: UUID

Identifier of the immutable diff snapshot to which the decision was applied.

decision

Type: DiffReviewDecision

Decision taken for the pending review job.

job_status

Type: DiffReviewJobStatus

Resulting lifecycle status of the diff review job.

persistence_result

Type: PersistenceResult | None

Aggregate result of persisting accepted canonical changes. This is None when the review job was rejected.

DiffReviewJob

class teksi_hooks.models.review.DiffReviewJob(job_db_id, job_id, job_status, validation_success, metadata=<factory>, features_by_class=<factory>)[source]

Stored state required to inspect and resolve one diff review job.

A review job combines job-level lifecycle and validation information with the review features generated for the corresponding canonical changes.

The job is an application-level representation of the data persisted in tww_diff. It does not define how accepted changes are physically applied to live data.

Attributes

job_db_id:

Database-generated identifier of the job metadata row.

Review-feature rows may use this value as their foreign key to the job metadata table.

job_id:

Stable external identifier of the review job.

This identifier is supplied by the calling workflow and is used when retrieving, accepting, rejecting or replacing a review job.

job_status:

Current lifecycle status of the review job.

Expected values include pending, rejected and applied. Services resolving the job must reject unsupported transitions.

validation_success:

Whether validation of the imported data completed successfully before the review job was created.

A false value indicates that the job must not be applied to live data.

metadata:

Workflow and model-specific metadata associated with the review job.

This may include source-model identifiers, source-file paths, import and live schema names, provider and data-owner identifiers, incremental import information, mapping provenance and snapshot identifiers.

Generic review logic must not assign semantics to model-specific entries.

features_by_class:

Review features grouped by canonical class identifier.

Each key is a canonical class identifier and each value contains the ordered review features stored for that class and job. The features contain the reviewed canonical values, imported values, changed attributes, findings and review geometries needed by subsequent decision and persistence workflows.

Parameters:
  • job_db_id (int)

  • job_id (str)

  • job_status (str)

  • validation_success (bool)

  • metadata (Mapping[str, Any])

  • features_by_class (Mapping[str, Sequence[ReviewFeature]])

Fields

job_db_id

Type: int

Database-generated identifier of the review-job metadata row. Review-feature rows may reference this value through their job foreign key.

job_id

Type: str

Stable external identifier used to retrieve, replace, accept or reject the review job.

job_status

Type: str

Current lifecycle status of the review job, such as ‘pending’, ‘rejected’ or ‘applied’.

validation_success

Type: bool

Whether validation of the imported data completed successfully before the review job was created.

metadata

Type: Mapping[str, Any]

Workflow and model-specific metadata associated with the review job. This may include source models, source files, schema names, provider context, mapping provenance and snapshot identifiers.

features_by_class

Type: Mapping[str, Sequence[ReviewFeature,]]

Review features grouped by canonical class identifier. Feature ordering within each class is preserved.

DiffSchemaWriteResult

class teksi_hooks.models.review.DiffSchemaWriteResult(job_db_id, job_id, row_count)[source]

Result of writing one diff review job into the tww_diff schema.

The result identifies the newly written job and reports the total number of review-feature rows persisted across all canonical class tables.

It does not contain the review features themselves and does not indicate that any accepted changes have been applied to live data.

Attributes

job_db_id:

Database-generated identifier of the inserted job metadata row.

This identifier is used internally by review-feature rows as their reference to the job.

job_id:

Stable external identifier supplied by the review workflow.

This may be used by callers to retrieve or resolve the stored review job without depending on its database-generated identifier.

row_count:

Total number of review-feature rows written across all canonical class tables for the job.

The metadata row itself is not included in this count.

Parameters:
  • job_db_id (int)

  • job_id (str)

  • row_count (int)

Fields

job_db_id

Type: int

Database-generated identifier of the inserted review-job metadata row.

job_id

Type: str

Stable external identifier of the written review job.

row_count

Type: int

Total number of review-feature rows written across all canonical class tables. The metadata row is not included.

PreparedSource

class teksi_hooks.models.review.PreparedSource(source_model, created_models, effect_document, metadata=<factory>)[source]

Validated canonical projection staged for a multi-source diff workflow.

A prepared source is not a persisted review job. It holds the projected effects of one source delivery until all required sources have been prepared and the final pending review job can be created.

Parameters:
  • source_model (str)

  • created_models (tuple[str, ...])

  • effect_document (EffectDocument)

  • metadata (Mapping[str, Any])

Fields

source_model

Type: str

Exact source-model identifier used to import and project the source delivery.

created_models

Type: tuple[str, ...]

Concrete INTERLIS model identifiers used to create the quarantine schema. Models are ordered dependency-first, with the primary source model appearing last.

effect_document

Type: EffectDocument

Canonical effect document projected from the validated source quarantine. A later incremental source may override matching effects before the pending review job is created.

metadata

Type: Mapping[str, Any]

Workflow and source-specific metadata associated with the prepared projection. This may include the source role, XTF path, quarantine schema, semantic model group, model language, provider context and mapping provenance.

ReviewFeature

class teksi_hooks.models.review.ReviewFeature(class_id, object_id, attributes=<factory>, geometries=<factory>)[source]

Feature prepared for review artifact export.

A ReviewFeature is not necessarily a database row. It is a review/export representation of a classified change.

A review writer may turn this into any geospatial storage type that can hold its corresponding geometry types

Parameters:
  • class_id (str)

  • object_id (str)

  • attributes (dict[str, Any])

  • geometries (dict[str, Any])

Fields

class_id

Type: str

Canonical class identifier represented by this review feature.

object_id

Type: str

Canonical object identifier represented by this review feature.

attributes

Type: dict[str, Any]

Canonical attribute values and review metadata attributes to be exported for this feature.

geometries

Type: dict[str, Any]

Geometry values keyed by canonical geometry attribute name. Multiple geometry attributes are supported because some canonical classes may expose more than one geometry.