48 lines
1.0 KiB
Python
48 lines
1.0 KiB
Python
"""Schemas for project-scoped source GIS attributes."""
|
|
|
|
from datetime import date
|
|
from typing import Any, Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
GisElementType = Literal[
|
|
"pipes",
|
|
"junctions",
|
|
"valves",
|
|
"reservoirs",
|
|
"pumps",
|
|
"tanks",
|
|
"scada",
|
|
]
|
|
|
|
|
|
class GisAttributeGroup(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
dataset_key: str
|
|
dataset_title: str
|
|
source_date: date
|
|
layer_key: str
|
|
layer_name: str
|
|
source_fid: int
|
|
match_method: Literal["node_pair", "geometry", "source"]
|
|
match_distance_m: float | None = None
|
|
attributes: dict[str, Any] = Field(default_factory=dict)
|
|
|
|
|
|
class ElementGisProperties(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
element_type: GisElementType
|
|
element_id: str
|
|
groups: list[GisAttributeGroup] = Field(default_factory=list)
|
|
|
|
|
|
class SourceGisFeatureProperties(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
layer_key: str
|
|
source_fid: int
|
|
group: GisAttributeGroup
|