170 lines
4.9 KiB
Python
170 lines
4.9 KiB
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Literal
|
|
from uuid import UUID
|
|
|
|
from pydantic import BaseModel, Field, field_validator
|
|
|
|
from .operations import VectorSelectionBBox
|
|
|
|
|
|
class BathymetryProfileAcquireRequest(BaseModel):
|
|
bbox: VectorSelectionBBox
|
|
area_id: UUID | None = None
|
|
force_refresh: bool = False
|
|
|
|
|
|
class BathymetrySourceRead(BaseModel):
|
|
key: str
|
|
display_name: str
|
|
owner: str
|
|
authority_level: Literal["authoritative", "contextual"]
|
|
geographic_coverage: str
|
|
data_kind: str
|
|
query_modes: list[str]
|
|
vertical_reference: str
|
|
horizontal_crs: str
|
|
native_resolution: str | None = None
|
|
integration_status: Literal["operational", "probe_only", "available_not_integrated", "catalog_only"]
|
|
acquisition_supported: bool
|
|
configured: bool
|
|
service_url: str | None = None
|
|
catalog_url: str
|
|
attribution: str
|
|
license_note: str
|
|
limitation_message: str
|
|
|
|
|
|
class BathymetryProfileAcquisitionResult(BaseModel):
|
|
output_dataset_id: UUID
|
|
reused: bool
|
|
provider: str
|
|
profile_count: int = Field(ge=0)
|
|
document_count: int = Field(ge=0)
|
|
structured_depth_count: int = Field(ge=0)
|
|
structured_width_count: int = Field(ge=0)
|
|
watercourse_count: int = Field(ge=0)
|
|
bbox_epsg4326: list[float]
|
|
clipped_to_area_id: UUID | None = None
|
|
measurement_date_min: str | None = None
|
|
measurement_date_max: str | None = None
|
|
attribution: str
|
|
limitation_message: str
|
|
|
|
|
|
class BathymetryPartitionFinalizeRequest(BaseModel):
|
|
partition_scope_key: str = Field(min_length=1, max_length=120, pattern=r"^[a-z0-9][a-z0-9_-]*$")
|
|
expected_area_ids: list[UUID] = Field(min_length=1, max_length=500)
|
|
dataset_ids: list[UUID] = Field(default_factory=list, max_length=500)
|
|
no_profile_area_ids: list[UUID] = Field(default_factory=list, max_length=500)
|
|
manifest_sha256: str = Field(pattern=r"^[a-f0-9]{64}$")
|
|
observed_at: datetime
|
|
|
|
@field_validator("expected_area_ids", "dataset_ids", "no_profile_area_ids")
|
|
@classmethod
|
|
def require_unique_ids(cls, value: list[UUID]) -> list[UUID]:
|
|
if len(value) != len(set(value)):
|
|
raise ValueError("Partition identifiers must be unique")
|
|
return value
|
|
|
|
|
|
class BathymetryPartitionFinalizationResult(BaseModel):
|
|
partition_scope_key: str
|
|
regional_partitions_complete: bool
|
|
partition_count: int = Field(ge=1)
|
|
data_partition_count: int = Field(ge=0)
|
|
no_profile_partition_count: int = Field(ge=0)
|
|
profile_count: int = Field(ge=0)
|
|
document_count: int = Field(ge=0)
|
|
structured_depth_count: int = Field(ge=0)
|
|
measurement_date_min: str | None = None
|
|
measurement_date_max: str | None = None
|
|
dataset_ids: list[UUID]
|
|
manifest_sha256: str
|
|
observed_at: datetime
|
|
limitation_message: str
|
|
|
|
|
|
class BathymetrySourceProbeRead(BaseModel):
|
|
source_key: str
|
|
status: Literal[
|
|
"disabled",
|
|
"invalid_configuration",
|
|
"tls_error",
|
|
"endpoint_unavailable",
|
|
"invalid_capabilities",
|
|
"reachable",
|
|
]
|
|
configured_url: str
|
|
capabilities_url: str | None = None
|
|
tls_verified: bool
|
|
capabilities_reachable: bool
|
|
acquisition_supported: bool = False
|
|
wcs_version: str | None = None
|
|
coverage_identifiers: list[str] = Field(default_factory=list)
|
|
advertised_formats: list[str] = Field(default_factory=list)
|
|
advertised_crs: list[str] = Field(default_factory=list)
|
|
response_sha256: str | None = None
|
|
checked_at: datetime
|
|
message: str
|
|
limitation_message: str
|
|
|
|
|
|
class MdkBathymetryAcquireRequest(BaseModel):
|
|
bbox: VectorSelectionBBox
|
|
area_id: UUID | None = None
|
|
force_refresh: bool = False
|
|
|
|
|
|
class MdkBathymetryAcquisitionResult(BaseModel):
|
|
output_dataset_id: UUID
|
|
reused: bool
|
|
provider: str
|
|
coverage_id: str
|
|
bbox_epsg4326: list[float]
|
|
vertical_reference: str
|
|
resolution_m: float = Field(gt=0)
|
|
attribution: str
|
|
limitation_message: str
|
|
|
|
|
|
class BathymetryRasterSelectionRequest(BaseModel):
|
|
bbox: VectorSelectionBBox
|
|
area_id: UUID | None = None
|
|
|
|
|
|
class BathymetryRasterMetric(BaseModel):
|
|
metric_key: str
|
|
metric_label: str
|
|
metric_value: float
|
|
metric_unit: str
|
|
aggregation_method: str
|
|
is_estimate: bool = False
|
|
|
|
|
|
class BathymetryRasterSelectionSummary(BaseModel):
|
|
metric_label: str
|
|
metric_value: float
|
|
metric_unit: str
|
|
aggregation_method: str
|
|
primary_metric_key: str
|
|
metrics: list[BathymetryRasterMetric]
|
|
|
|
|
|
class BathymetryRasterSelectionResponse(BaseModel):
|
|
dataset_id: UUID
|
|
product_key: str
|
|
selection_bbox: VectorSelectionBBox
|
|
selection_area_id: UUID | None = None
|
|
selected_cell_count: int = Field(ge=1)
|
|
valid_cell_count: int = Field(ge=1)
|
|
coverage_ratio: float = Field(ge=0, le=1)
|
|
resolution_m: float = Field(gt=0)
|
|
vertical_reference: str
|
|
survey_period: str
|
|
summary: BathymetryRasterSelectionSummary
|
|
unsupported_metrics: list[str]
|
|
limitation_message: str
|
|
generated_at: str
|