Persist map selections as derived datasets
This commit is contained in:
@@ -406,6 +406,40 @@ Rules:
|
||||
- Results are generated from persisted PostGIS `vector_features`, not from client-side map data.
|
||||
- The response is capped by `limit` and returns `truncated=true` when more matching rows exist.
|
||||
|
||||
### POST `/api/v1/projects/{project_id}/datasets/{dataset_id}/vector/select/derive`
|
||||
|
||||
Persists a bbox selection as a new derived vector dataset and indexes the
|
||||
selected output into `vector_features`.
|
||||
|
||||
Request:
|
||||
|
||||
```json
|
||||
{
|
||||
"bbox": {
|
||||
"min_x": 5.0,
|
||||
"min_y": 51.0,
|
||||
"max_x": 5.1,
|
||||
"max_y": 51.1,
|
||||
"crs": "EPSG:4326"
|
||||
},
|
||||
"limit": 250,
|
||||
"output_name": "selected-buildings"
|
||||
}
|
||||
```
|
||||
|
||||
Response: `DatasetRead` in the canonical API envelope.
|
||||
|
||||
Rules:
|
||||
|
||||
- Only vector/GeoJSON datasets are supported.
|
||||
- Coordinates are EPSG:4326 longitude/latitude.
|
||||
- The new dataset uses `dataset_role="derived"`, `source="operation:selection"`,
|
||||
`source_name="map_selection"` and `derived_from_dataset_id` pointing to the
|
||||
source dataset.
|
||||
- The persisted GeoJSON properties retain source provenance as
|
||||
`source_dataset_id` and `source_vector_feature_id`.
|
||||
- Empty selections return `VECTOR_OPERATION_EMPTY_RESULT` and do not create a dataset.
|
||||
|
||||
### GET `/api/v1/projects/{project_id}/datasets/{dataset_id}/content`
|
||||
|
||||
Returns stored vector dataset content through the canonical API envelope.
|
||||
|
||||
@@ -1,3 +1,34 @@
|
||||
## Sprint 108 Map selection derived datasets (2026-06-25)
|
||||
|
||||
Changed:
|
||||
- Added `POST /api/v1/projects/{project_id}/datasets/{dataset_id}/vector/select/derive`.
|
||||
- Added `VectorSelectionDeriveRequest` for bbox selection-to-derived-dataset requests.
|
||||
- Added `VectorOperationsService.derive_selection_dataset`, which selects persisted PostGIS `vector_features`, writes a derived GeoJSON dataset artifact, stores source provenance and re-indexes the derived features into `vector_features`.
|
||||
- Added `Save as dataset` to the Map workspace selection result state with loading/error/latest-dataset feedback.
|
||||
- Updated frontend dataset API typing and wiring for selection-derived datasets.
|
||||
- Updated `docs/API_CONTRACTS.md`, `backend/README.md`, `frontend/README.md`, `CHANGELOG.md` and `docs/TODO.md`.
|
||||
- Added regression coverage in `backend/tests/test_sprint108_map_selection_derived_dataset.py`.
|
||||
|
||||
Validation:
|
||||
- RED: `python -m pytest backend\tests\test_sprint108_map_selection_derived_dataset.py -q` failed before implementation because the service, route and frontend contracts were absent.
|
||||
- `python -m pytest backend\tests\test_sprint108_map_selection_derived_dataset.py -q` passed: 4 tests.
|
||||
- `python -m compileall backend/app` passed.
|
||||
- `cd backend && python -m pytest -q` passed: 345 tests.
|
||||
- `cd frontend && npm run typecheck` passed.
|
||||
- `cd frontend && npm run build` passed.
|
||||
- `cd backend && python -m alembic heads` passed: `202606120900 (head)`.
|
||||
- `cd backend && python -m alembic upgrade head --sql` passed.
|
||||
- `bash -n scripts/live_migration_smoke.sh` passed.
|
||||
- `bash scripts/run_readiness_check.sh` passed.
|
||||
|
||||
Limitations:
|
||||
- Selection-derived datasets are bbox-only and use EPSG:4326 coordinates.
|
||||
- Empty selections are rejected with `VECTOR_OPERATION_EMPTY_RESULT`.
|
||||
- No migrations, live provider fetching, AI dependency, real model behavior or new product domain were added.
|
||||
|
||||
Next recommended pass:
|
||||
- Run full release validation, deploy to `http://192.168.10.150:1202` and live-smoke `Save as dataset` from the Map workspace.
|
||||
|
||||
## Sprint 107 Map selection export handoff (2026-06-25)
|
||||
|
||||
Changed:
|
||||
|
||||
@@ -374,3 +374,4 @@ This file now starts with the current implementation status. Older preparation/b
|
||||
- [x] Add AI Lab action guardrails so explicit fixture models are not exposed as normal operator runs.
|
||||
- [x] Add persisted vector area selection from the Map workspace with bbox extract and GeoJSON download.
|
||||
- [x] Persist map area selections as Export Center handoff artifacts.
|
||||
- [x] Persist map area selections as reusable derived vector datasets indexed into `vector_features`.
|
||||
|
||||
Reference in New Issue
Block a user