Files
geointel/frontend/src/types.ts
T
Codex 46204edbf4
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled
Harden raster detection manifest handoff
2026-07-08 12:04:21 +02:00

761 lines
17 KiB
TypeScript

export interface ApiEnvelope<T> {
data: T
}
export interface ApiError {
code: string
message: string
details: Record<string, unknown> | unknown[]
}
export interface ApiErrorEnvelope {
error: ApiError
}
export interface ProjectRead {
id: string
name: string
description?: string | null
region: string
status: string
created_at?: string | null
updated_at?: string | null
}
export interface ProjectCreate {
name: string
description?: string | null
region?: string
}
export interface ProjectListResponse {
items: ProjectRead[]
total: number
limit: number
offset: number
}
export interface DemoWorkflowResponse {
project_id: string
area_id: string
reference_dataset_id: string
candidate_dataset_id: string
raster_dataset_id?: string | null
quality_check_id: string
metric_count: number
status: string
message: string
created: boolean
}
export interface AreaRead {
id: string
project_id: string
name: string
original_crs?: string | null
area_m2?: number | null
created_at?: string | null
geometry_type?: string | null
geometry?: GeoJSON.Polygon | GeoJSON.MultiPolygon | null
}
export interface AreaCreate {
name: string
geometry: GeoJSON.Polygon | GeoJSON.MultiPolygon
crs?: string
}
export interface AreaListResponse {
items: AreaRead[]
total: number
limit: number
offset: number
}
export interface DatasetCreateResponse {
id: string
name: string
dataset_type: string
source: string
dataset_role?: string
source_name?: string | null
reference_layer_name?: string | null
source_metadata?: Record<string, unknown> | null
provenance_metadata?: Record<string, unknown> | null
imported_at?: string | null
project_id: string
area_id?: string | null
storage_path?: string | null
original_filename?: string | null
stored_filename?: string | null
content_type?: string | null
size_bytes?: number | null
checksum_sha256?: string | null
crs?: string | null
bounds_json?: Record<string, number> | null
metadata_json?: Record<string, unknown> | null
vector_summary?: VectorSummary | null
status: string
derived_from_dataset_id?: string | null
created_at?: string | null
feature_count?: number | null
}
export interface JobRead {
id: string
job_type: string
status: string
project_id: string
dataset_id?: string | null
input_dataset_id?: string | null
output_dataset_id?: string | null
parameters_json: Record<string, unknown>
result_json?: Record<string, unknown> | null
error_message?: string | null
created_at?: string | null
started_at?: string | null
finished_at?: string | null
}
export interface JobListResponse {
items: JobRead[]
total: number
limit: number
offset: number
}
export interface VectorSummary {
feature_count?: number | null
geometry_types?: string[] | null
bounds_json?: Record<string, number> | null
approximate_area_m2?: number | null
crs?: string | null
feature_geometry_count?: number | null
invalid_features?: number | null
crs_assumed?: boolean | null
}
export interface VectorSummaryResponse {
feature_count?: number | null
geometry_types?: string[] | null
bounds_json?: Record<string, number> | null
approximate_area_m2?: number | null
crs?: string | null
feature_geometry_count?: number | null
invalid_features?: number | null
crs_assumed?: boolean | null
}
export interface RasterMetadataResponse {
driver: string
dataset_id?: string
width: number
height: number
band_count: number
crs?: string | null
bounds?: number[]
resolution?: number[]
dtype?: string[]
nodata?: unknown
transform?: string[] | number[] | null
path?: string
size_bytes?: number | null
checksum_sha256?: string | null
operation?: string | null
operation_parameters?: Record<string, unknown> | null
source_dataset_id?: string | null
}
export interface RasterInspectResponse {
dataset_id: string
ready: boolean
metadata: Record<string, unknown>
}
export interface RasterPreviewPayload {
path: string
format: string
width: number | null
height: number | null
}
export interface RasterPreviewResponse {
dataset_id: string
ready: boolean
preview: RasterPreviewPayload
metadata?: Record<string, unknown>
}
export interface RasterBandStats {
band_index: number
dtype: string | null
min: number | null
max: number | null
mean: number | null
std: number | null
nodata_count: number
nodata_ratio: number
valid_pixel_count: number
histogram: number[] | null
histogram_bins: number[] | null
}
export interface RasterStatsResponse {
dataset_id: string
source_dataset_id?: string | null
bands: RasterBandStats[]
generated_at?: string | null
}
export interface RasterNdviRequest {
nir_band: number
red_band: number
output_name?: string
}
export interface RasterNdwiRequest {
green_band: number
nir_band: number
output_name?: string
}
export interface RasterNdbiRequest {
swir_band: number
nir_band: number
output_name?: string
}
export interface RasterTileManifestTile {
path: string
pixel_window: number[]
bounds: number[]
transform: number[]
index: number
}
export interface RasterTileManifest {
tile_set_id: string
source_dataset_id: string
source_raster_id: string
bounds: number[]
tile_size: number
overlap: number
parameters: Record<string, unknown>
created_at: string
tile_paths: string[]
count: number
tiles: RasterTileManifestTile[]
}
export interface RasterTileResponse {
dataset_id: string
ready: boolean
operation: string
tile_set_id: string
tile_size: number
overlap: number
manifest_path: string
count: number
manifest: RasterTileManifest
}
export interface RasterTileHandoff {
manifest_path: string
tile_set_id?: string | null
tile_size?: number | null
overlap?: number | null
count?: number | null
source_dataset_id?: string | null
created_at?: string | null
}
export interface VectorBBoxResponse {
dataset_id: string
bounds_json: Record<string, number> | null
feature_count: number
crs?: string | null
}
export interface VectorStatsResponse {
dataset_id: string
feature_count: number
geometry_type_summary: Record<string, number>
bounds_json: Record<string, number> | null
crs?: string | null
}
export interface VectorSelectionBBox {
min_x: number
min_y: number
max_x: number
max_y: number
crs?: 'EPSG:4326'
}
export interface VectorSelectionRequest {
bbox: VectorSelectionBBox
limit?: number
}
export interface VectorSelectionDeriveRequest extends VectorSelectionRequest {
output_name?: string
}
export interface VectorSelectionResponse {
selection_bbox: VectorSelectionBBox
feature_count: number
limit: number
truncated: boolean
geojson: GeoJSON.FeatureCollection
}
export interface DatasetListResponse {
items: DatasetCreateResponse[]
total: number
limit: number
offset: number
}
export interface GeojsonEnvelopeResponse {
data: object
}
export interface ChangeDetectionRequest {
source_dataset_id: string
target_dataset_id: string
iou_threshold: number
include_unchanged: boolean
}
export interface ChangeDetectionSummary {
source_dataset_id: string
target_dataset_id: string
source_feature_count: number
target_feature_count: number
added_count: number
removed_count: number
unchanged_count: number
iou_threshold: number
warnings: string[]
generated_at: string
geojson: GeoJSON.FeatureCollection
}
export interface ProviderCapability {
provider_name: string
display_name: string
authority_level: 'authoritative' | 'contextual' | 'manual' | 'fixture' | string
supported_layers: string[]
supported_geometry_types: string[]
supported_query_modes: string[]
fetch_signature: string
configured: boolean
status: string
limitation_message: string
attribution: string
license_note: string
not_configured_reason: string | null
}
export interface SystemCapabilitiesResponse {
status: string
service: string
version: string
database: string | null
postgis: boolean
rasterio: boolean
geopandas: boolean
yolo: boolean | string
sam: boolean | string
grb: string
sentinel: string
providers: ProviderCapability[]
}
export interface ProviderCapabilitiesResponse {
providers: ProviderCapability[]
}
export interface ProviderLayersResponse {
provider_name: string
layers: string[]
}
export interface ProviderStatusResponse {
provider_name: string
configured: boolean
status: string
limitation_message: string
}
export interface ProviderImportResponse {
provider_name: string
status: string
message: string
requested_layers: string[]
dataset_id: string | null
dataset_role?: string | null
source_name?: string | null
}
export interface DetectionModelCapability {
model_id: string
display_name: string
framework: string
task_type: string
supported_classes: string[]
configured: boolean
status: string
limitation_message: string
version?: string | null
}
export interface DetectionModelsResponse {
models: DetectionModelCapability[]
}
export interface ModelAssetRead {
model_asset_id: string
filename: string
display_name: string
model_path: string
suffix: string
framework: string
task_type: string
size_bytes: number
sha256: string
active: boolean
status: string
limitation_message: string
will_download_models: boolean
}
export interface ModelAssetListResponse {
items: ModelAssetRead[]
total: number
model_directory: string
}
export interface YoloPreflightChecks {
enabled: boolean
dependencies_available?: boolean | null
model_path_set?: boolean | null
model_file_exists?: boolean | null
model_load_requested: boolean
model_load_ok?: boolean | null
manifest_path_set?: boolean | null
manifest_valid?: boolean | null
tile_paths_exist?: boolean | null
tile_limit_ok?: boolean | null
}
export interface YoloPreflightRuntime {
dependencies_assumed: boolean
model_directory?: string | null
yolo_config_dir?: string | null
torch_version?: string | null
ultralytics_version?: string | null
cuda_available?: boolean | null
}
export interface YoloPreflightResponse {
model_id: string
model_asset_id?: string | null
model_path?: string | null
tile_manifest_path?: string | null
status: string
message: string
checks: YoloPreflightChecks
runtime: YoloPreflightRuntime
tile_count: number
max_tiles: number
will_download_models: boolean
will_run_inference: boolean
error_code?: string | null
}
export interface DetectionRunRequest {
project_id: string
dataset_id: string
model_id: string
model_asset_id?: string | null
confidence_threshold: number
class_filter?: string[] | null
tile_manifest_path?: string | null
parameters_json?: Record<string, unknown>
}
export interface DetectionRunResponse {
analysis_run_id: string
job_id: string
project_id: string
dataset_id: string
model_id: string
status: string
detection_count: number
error_code?: string | null
message: string
}
export interface DetectionRunRead {
id: string
project_id: string
dataset_id?: string | null
job_id?: string | null
analysis_type: string
status: string
model_name?: string | null
model_version?: string | null
parameters_json: Record<string, unknown>
result_json?: Record<string, unknown> | null
error_message?: string | null
created_at?: string | null
started_at?: string | null
finished_at?: string | null
}
export interface DetectionRunListResponse {
items: DetectionRunRead[]
total: number
}
export interface DetectionRead {
id: string
project_id: string
dataset_id?: string | null
analysis_run_id?: string | null
job_id?: string | null
model_name: string
model_version?: string | null
class_name: string
confidence: number
bbox_json?: Record<string, unknown> | null
source_tile_path?: string | null
properties_json?: Record<string, unknown> | null
created_at?: string | null
}
export interface DetectionListResponse {
items: DetectionRead[]
total: number
}
export interface DetectionQaRequest {
reference_dataset_id: string
iou_threshold: number
class_name?: string | null
min_confidence?: number | null
}
export interface DetectionQaResult {
status: string
quality_check_id: string
analysis_run_id: string
reference_dataset_id: string
candidate_feature_count: number
reference_feature_count: number
matches: number
false_positives: number
false_negatives: number
precision?: number | null
recall?: number | null
f1_score?: number | null
mean_iou?: number | null
iou_threshold: number
warnings: string[]
}
export type SegmentationModelCapability = DetectionModelCapability
export interface SegmentationModelsResponse {
models: SegmentationModelCapability[]
}
export interface SegmentationRunRequest {
project_id: string
dataset_id: string
model_id: string
confidence_threshold: number
class_filter?: string[] | null
tile_manifest_path?: string | null
parameters_json?: Record<string, unknown>
}
export interface SegmentationRunResponse {
analysis_run_id: string
job_id: string
project_id: string
dataset_id: string
model_id: string
status: string
segmentation_count: number
error_code?: string | null
message: string
}
export interface SegmentationRunRead {
id: string
project_id: string
dataset_id?: string | null
job_id?: string | null
analysis_type: string
status: string
model_name?: string | null
model_version?: string | null
parameters_json: Record<string, unknown>
result_json?: Record<string, unknown> | null
error_message?: string | null
created_at?: string | null
started_at?: string | null
finished_at?: string | null
}
export interface SegmentationRunListResponse {
items: SegmentationRunRead[]
total: number
}
export interface SegmentationRead {
id: string
project_id: string
dataset_id?: string | null
analysis_run_id?: string | null
job_id?: string | null
model_name: string
model_version?: string | null
class_name: string
confidence?: number | null
bbox_json?: Record<string, unknown> | null
area_m2?: number | null
mask_path?: string | null
source_tile_path?: string | null
tile_index?: number | null
properties_json?: Record<string, unknown> | null
provenance_json?: Record<string, unknown> | null
created_at?: string | null
}
export interface SegmentationListResponse {
items: SegmentationRead[]
total: number
}
export interface SegmentationQaRequest {
reference_dataset_id: string
iou_threshold: number
class_name?: string | null
min_confidence?: number | null
}
export type SegmentationQaResult = DetectionQaResult
export interface QaComparisonRequest {
candidate_dataset_id: string
reference_dataset_id: string
iou_threshold: number
area_id?: string | null
}
export interface QaComparisonResult {
status: string
warnings: string[]
candidate_feature_count: number
reference_feature_count: number
matches: number
false_positives: number
false_negatives: number
precision: number | null
recall: number | null
f1_score: number | null
mean_iou: number | null
iou_threshold: number
unsupported_geometry: boolean
unsupported_geometries: string[]
match_evidence?: Record<string, unknown>[]
false_positive_evidence?: Record<string, unknown>[]
false_negative_evidence?: Record<string, unknown>[]
generated_at: string
quality_check_id?: string
}
export interface MetricRead {
id: string
quality_check_id?: string | null
analysis_run_id?: string | null
metric_key: string
metric_value?: number | null
metric_unit?: string | null
label?: string | null
metadata_json?: Record<string, unknown> | null
created_at?: string | null
}
export interface QualityCheckRead {
id: string
project_id: string
job_id?: string | null
analysis_run_id?: string | null
candidate_dataset_id?: string | null
reference_dataset_id: string
check_type: string
status: string
score?: number | null
parameters_json?: Record<string, unknown> | null
findings_json?: Record<string, unknown> | null
created_at?: string | null
completed_at?: string | null
metrics: MetricRead[]
}
export interface QualityCheckListResponse {
items: QualityCheckRead[]
total: number
limit: number
offset: number
}
export interface QualityEvidenceGeoJsonResponse {
quality_check_id: string
project_id: string
candidate_dataset_id?: string | null
reference_dataset_id: string
analysis_run_id?: string | null
feature_count: number
warnings: string[]
geojson: GeoJSON.FeatureCollection
}
export type ExportKind = 'dataset' | 'detection_run' | 'segmentation_run' | 'vector_selection'
export interface ExportRead {
id: string
project_id: string
analysis_run_id?: string | null
export_type: string
storage_path: string
metadata_json?: Record<string, unknown> | null
created_at?: string | null
status: string
}
export interface ExportCreateResponse {
export_id: string
path: string
status: string
export_type: string
metadata_json?: Record<string, unknown> | null
}
export interface ExportListResponse {
items: ExportRead[]
total: number
limit: number
offset: number
}
export interface ExportContentResponse {
export_id: string
export_type: string
content: Record<string, unknown>
}