fix(map): read all relevant selection sources
This commit is contained in:
@@ -208,6 +208,25 @@ SOURCE_DEFINITIONS = (
|
||||
"agentschap_landbouw_zeevisserij_agricultural_parcels",
|
||||
),
|
||||
),
|
||||
_contract(
|
||||
source_name="vmm_vha_bathymetry_profiles",
|
||||
display_name="VHA historische dwarsprofielen",
|
||||
authority_level="authoritative",
|
||||
coverage_zones=("flanders",),
|
||||
themes=("bathymetry",),
|
||||
native_layers=("digitale_atlas_profile_points",),
|
||||
geometry_types=("Point",),
|
||||
acquisition_mode="bounded_api",
|
||||
integration_status="operational",
|
||||
source_url="https://vha.waterinfo.be/arcgis/rest/services/digitale_atlas/MapServer/0",
|
||||
attribution="Vlaamse Milieumaatschappij (VMM), Vlaamse Hydrografische Atlas",
|
||||
license_note="Hergebruik volgens de voorwaarden van de Vlaamse overheid en de bronmetadata.",
|
||||
limitation_message=(
|
||||
"Historische puntmetingen met bronafhankelijke meetdatum en verticale referentie; "
|
||||
"geen continue actuele bodemkaart en zonder gelijktijdig waterpeil geen watervolume."
|
||||
),
|
||||
materialized_source_names=("vmm_vha_bathymetry_profiles",),
|
||||
),
|
||||
_contract(
|
||||
source_name="spw_geoportail",
|
||||
display_name="SPW Geoportail Wallonie",
|
||||
|
||||
@@ -64,9 +64,13 @@ def test_coverage_catalog_uses_normalized_contracts_and_does_not_change_provider
|
||||
"rbins_marine_reporting_units",
|
||||
"rbins_msp_2026",
|
||||
"mdk_bathymetry",
|
||||
"vmm_vha_bathymetry_profiles",
|
||||
}
|
||||
assert next(source for source in catalog.sources if source.source_name == "ngi_adminvector").license_note == "CC BY 4.0"
|
||||
assert next(source for source in catalog.sources if source.source_name == "mdk_bathymetry").integration_status == "not_configured"
|
||||
assert next(
|
||||
source for source in catalog.sources if source.source_name == "vmm_vha_bathymetry_profiles"
|
||||
).integration_status == "operational"
|
||||
|
||||
response = TestClient(app).get("/api/v1/external/coverage/catalog")
|
||||
assert response.status_code == 200
|
||||
@@ -268,6 +272,43 @@ def test_spw_bathymetry_materialization_is_source_specific() -> None:
|
||||
assert with_bathymetry.items[0].materialized_dataset_ids == [bathymetry_id]
|
||||
|
||||
|
||||
def test_vha_bathymetry_profiles_are_operational_only_inside_the_persisted_selection() -> None:
|
||||
project_id = uuid4()
|
||||
scope = [
|
||||
scope_area("Belgium land", box(2.5, 49.5, 6.4, 51.5)),
|
||||
scope_area("Flanders", box(2.5, 50.7, 5.9, 51.5)),
|
||||
]
|
||||
selection = CoverageBBox(minx=5.101, miny=51.171, maxx=5.109, maxy=51.179)
|
||||
without_profiles = CoverageRegistryService.resolve(
|
||||
FakeSession(project=SimpleNamespace(id=project_id), areas=scope, datasets=[]),
|
||||
project_id,
|
||||
selection,
|
||||
["bathymetry"],
|
||||
)
|
||||
assert without_profiles.items[0].status == "partial"
|
||||
assert without_profiles.items[0].source_names == ["vmm_vha_bathymetry_profiles"]
|
||||
|
||||
profile_id = uuid4()
|
||||
profiles = SimpleNamespace(
|
||||
id=profile_id,
|
||||
status="ready",
|
||||
source_name="vmm_vha_bathymetry_profiles",
|
||||
reference_layer_name="bathymetry_profile_points",
|
||||
source_metadata={
|
||||
"coverage_zones": ["flanders"],
|
||||
"bbox_epsg4326": [5.1, 51.17, 5.11, 51.18],
|
||||
},
|
||||
)
|
||||
with_profiles = CoverageRegistryService.resolve(
|
||||
FakeSession(project=SimpleNamespace(id=project_id), areas=scope, datasets=[profiles]),
|
||||
project_id,
|
||||
selection,
|
||||
["bathymetry"],
|
||||
)
|
||||
assert with_profiles.items[0].status == "operational"
|
||||
assert with_profiles.items[0].materialized_dataset_ids == [profile_id]
|
||||
|
||||
|
||||
def test_mixed_land_and_north_sea_selection_remains_split() -> None:
|
||||
project_id = uuid4()
|
||||
project = SimpleNamespace(id=project_id)
|
||||
|
||||
@@ -20,7 +20,7 @@ def test_map_first_explorer_is_the_default_product_flow() -> None:
|
||||
assert "<h3>Inzichten</h3>" in workspace
|
||||
assert "Teken rechthoek" in workspace
|
||||
assert "Volledig werkgebied" in workspace
|
||||
assert "Alle beschikbare thema" in workspace
|
||||
assert "Alle relevante thema" in workspace
|
||||
assert "Bron nog niet ingeladen" in workspace
|
||||
assert "useMapThemeSelectionInsights" in workspace
|
||||
assert "datasetsApi.selectVectorFeatures" in read("frontend/src/hooks/useMapThemeSelectionInsights.ts")
|
||||
|
||||
@@ -249,7 +249,7 @@ def test_end_user_dataset_sources_are_human_readable() -> None:
|
||||
assert "department_omgeving_land_use: 'Departement Omgeving'" in display
|
||||
assert "statbel: 'Statbel'" in display
|
||||
assert "getDatasetSourceDisplayName(activeThemeDataset)" in workspace
|
||||
assert "dataset ? getDatasetSourceDisplayName(dataset)" in workspace
|
||||
assert "resultDataset ? getDatasetSourceDisplayName(resultDataset)" in workspace
|
||||
assert "Snel naar een gemeente (optioneel)" in workspace
|
||||
assert "latestDatasetBySeries" in catalog
|
||||
assert "Historische meetmomenten" in catalog
|
||||
|
||||
@@ -29,19 +29,23 @@ def test_flanders_workspace_exposes_governed_thematic_products_on_demand() -> No
|
||||
assert "/datasets/thematic-raster/acquire" in api
|
||||
|
||||
|
||||
def test_selection_reads_persisted_themes_but_acquires_only_the_active_theme() -> None:
|
||||
def test_selection_reads_and_bounded_acquires_all_relevant_themes() -> None:
|
||||
workspace = read("frontend/src/components/map/MapWorkspace.tsx")
|
||||
app = read("frontend/src/App.tsx")
|
||||
selection_hook = read("frontend/src/hooks/useMapThemeSelectionInsights.ts")
|
||||
|
||||
assert "for (const theme of DATA_THEMES)" in workspace
|
||||
assert ".filter((product) => product.theme === activeThemeId)" in workspace
|
||||
assert "? onDemandProductsForZones(resolvedZones)" in workspace
|
||||
assert ".filter((product) => product.theme === activeThemeId)" not in workspace
|
||||
assert "await loadThemeInsights(bbox, availableThemes, areaId)" in workspace
|
||||
assert "!regionalPartitionedThemeActive && !onDemandThemeActive" in workspace
|
||||
assert "onRefreshProjectData" in workspace
|
||||
assert "selectedProjectId ? loadProjectData(selectedProjectId)" in app
|
||||
assert "successful.some((item) => item.acquisition)" in selection_hook
|
||||
assert "await onDatasetsChanged()" in selection_hook
|
||||
assert "settleWithConcurrency(" in selection_hook
|
||||
assert "queries," in selection_hook
|
||||
assert "3," in selection_hook
|
||||
|
||||
|
||||
def test_regional_on_demand_sources_require_a_bounded_drawn_selection() -> None:
|
||||
|
||||
@@ -25,7 +25,15 @@ def test_map_selection_can_acquire_dhmv_and_flood_hazard_products() -> None:
|
||||
selection_hook = read("frontend/src/hooks/useMapThemeSelectionInsights.ts")
|
||||
workspace = read("frontend/src/components/map/MapWorkspace.tsx")
|
||||
|
||||
assert "'thematic_raster' | 'dhmv' | 'flood_hazard' | 'grb'" in selection_hook
|
||||
for acquisition_kind in (
|
||||
"'thematic_raster'",
|
||||
"'dhmv'",
|
||||
"'flood_hazard'",
|
||||
"'grb'",
|
||||
"'official_vector'",
|
||||
"'bathymetry_profiles'",
|
||||
):
|
||||
assert acquisition_kind in selection_hook
|
||||
assert "datasetsApi.acquireDhmv" in selection_hook
|
||||
assert "datasetsApi.acquireFloodHazard" in selection_hook
|
||||
assert "datasetsApi.acquireThematicRaster" in selection_hook
|
||||
|
||||
Reference in New Issue
Block a user