sec_interp.core.validation.project_validator module

Validation for project state and layer presence (QGIS-agnostic).

class sec_interp.core.validation.project_validator.ProjectValidator

Bases: object

Orchestrates validation of project parameters independent of the GUI.

Level 2: Business Logic Validation. Uses ValidationContext to accumulate errors and verify cross-field dependencies.

classmethod crs_compatibility_warning(params: ValidationParams) → str

Return a CRS-mismatch warning for the configured layers, or "".

Non-blocking: QGIS reprojects on the fly, but a mismatch can degrade accuracy (and, for rasters, sampling intervals expressed in the wrong CRS). The first valid configured layer is used as reference, so the DEM (if present) leads the comparison.

classmethod crs_plausibility_error(params: ValidationParams) → str

Return a blocking message for mislabelled-CRS suspects, or "".

Best-effort heuristic on layer extents (see crs_plausibility). A wrong CRS label produces silently wrong profiles, so it is treated as a hard error rather than a warning.

classmethod is_dem_complete(params: ValidationParams) → bool

Check if DEM configuration is complete.

classmethod is_drillhole_complete(params: ValidationParams) → bool

Check if required fields are filled if drillhole layers are selected.

classmethod is_geology_complete(params: ValidationParams) → bool

Check if geology configuration is complete.

classmethod is_structure_complete(params: ValidationParams) → bool

Check if structural configuration is complete.

classmethod section_geometry_error(params: ValidationParams) → str

Return the section-line geometry error, or an empty string.

Shared by the core pipeline and the GUI gating (semaphore / preview enablement) so both stay on the same rule.

classmethod validate_all(params: ValidationParams) → bool

Perform a comprehensive validation of all project parameters.

classmethod validate_preview_requirements(params: ValidationParams) → bool

Validate only the minimum requirements needed to generate a preview.

class sec_interp.core.validation.project_validator.ValidationParams(raster_layer: LayerMetadata | None = None, band_number: int | None = None, line_layer: LayerMetadata | None = None, line_vertex_count: int | None = None, line_length: float | None = None, section_feature_id: int | None = None, output_path: str = '', scale: float = 1.0, vert_exag: float = 1.0, buffer_dist: float = 0.0, outcrop_layer: LayerMetadata | None = None, outcrop_field: str | None = None, struct_layer: LayerMetadata | None = None, struct_dip_field: str | None = None, struct_strike_field: str | None = None, dip_scale_factor: float = 1.0, collar_layer: LayerMetadata | None = None, collar_id: str | None = None, collar_use_geom: bool = True, collar_x: str | None = None, collar_y: str | None = None, survey_layer: LayerMetadata | None = None, survey_id: str | None = None, survey_depth: str | None = None, survey_azim: str | None = None, survey_incl: str | None = None, interval_layer: LayerMetadata | None = None, interval_id: str | None = None, interval_from: str | None = None, interval_to: str | None = None, interval_lith: str | None = None)

Bases: object

Data container for all parameters that need cross-layer validation.

Layers are held as detached LayerMetadata produced by the GUI ValidationExtractor adapter.

band_number: int | None = None
buffer_dist: float = 0.0
collar_id: str | None = None
collar_layer: LayerMetadata | None = None
collar_use_geom: bool = True
collar_x: str | None = None
collar_y: str | None = None
dip_scale_factor: float = 1.0
interval_from: str | None = None
interval_id: str | None = None
interval_layer: LayerMetadata | None = None
interval_lith: str | None = None
interval_to: str | None = None
line_layer: LayerMetadata | None = None
line_length: float | None = None
line_vertex_count: int | None = None
outcrop_field: str | None = None
outcrop_layer: LayerMetadata | None = None
output_path: str = ''
raster_layer: LayerMetadata | None = None
scale: float = 1.0
section_feature_id: int | None = None
struct_dip_field: str | None = None
struct_layer: LayerMetadata | None = None
struct_strike_field: str | None = None
survey_azim: str | None = None
survey_depth: str | None = None
survey_id: str | None = None
survey_incl: str | None = None
survey_layer: LayerMetadata | None = None
vert_exag: float = 1.0