Improve presentation of dataset metadata in Search results#181
Merged
Conversation
added 2 commits
May 31, 2026 02:10
…ields Expanded search result metadata previously showed the raw CKAN extras as a flat key: value list, with the spatial geometry dumped as a JSON string. - Add SpatialMap (react-leaflet + OpenStreetMap) to draw the spatial extent. - Add DatasetMetadata to give fields human-friendly labels, group harvest_* provenance into its own subsection, and fall back to plain text when the spatial value is not parseable geometry. - Extract pure geometry parsing/bounds into spatialGeometry for unit testing. Closes #180
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves the expanded metadata section of a search result card. Previously the CKAN
extraswere rendered as a flat list of rawkey: valuepairs, with thespatialgeometry dumped as a long JSON coordinate string.Now:
spatialGeoJSON geometry is drawn on an OpenStreetMap basemap (Leaflet), with the view fitted to its bounding box, so the area a dataset covers is visible at a glance.data_vintage→ "Data vintage"), harvest provenance (harvest_*) is grouped into its own subsection, and long opaque values (UUIDs) are shown in a monospace font.spatialvalue is not parseable geometry it falls back to plain text.Implementation
ui/src/components/SpatialMap.js— react-leaflet + OSM tiles; renders the geometry and fits bounds. Point geometries are drawn as circle markers to avoid Leaflet's broken default-icon assets under the CRA build.ui/src/components/spatialGeometry.js— pure GeoJSON parsing (string / object / Feature / FeatureCollection) and bounding-box computation, kept free of Leaflet so it is unit-testable.ui/src/components/DatasetMetadata.js— labels, grouping, and the spatial fallback.ui/src/pages/Search.js— uses the newDatasetMetadatacomponent.leafletandreact-leafletdependencies.Testing
ui/src/components/DatasetMetadata.test.js(8 tests, all passing) covering labels, harvest grouping, the spatial map/plain-text fallback, and geometry parsing.docker compose up -d --buildand verified the container serves the new bundle.Backwards compatibility
UI-only change. No API behavior, request/response shapes, or routes change.
Closes #180