Skip to content

Improve presentation of dataset metadata in Search results#181

Merged
rbardaji merged 2 commits into
mainfrom
feature/180-metadata-presentation
May 31, 2026
Merged

Improve presentation of dataset metadata in Search results#181
rbardaji merged 2 commits into
mainfrom
feature/180-metadata-presentation

Conversation

@rbardaji

Copy link
Copy Markdown
Collaborator

Summary

Improves the expanded metadata section of a search result card. Previously the CKAN extras were rendered as a flat list of raw key: value pairs, with the spatial geometry dumped as a long JSON coordinate string.

Now:

  • Spatial extent on a map — the spatial GeoJSON 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.
  • Readable fields — metadata fields get human-friendly labels (e.g. data_vintage → "Data vintage"), harvest provenance (harvest_*) is grouped into its own subsection, and long opaque values (UUIDs) are shown in a monospace font.
  • No information lost — every field shown before is still surfaced; if a spatial value 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 new DatasetMetadata component.
  • Adds leaflet and react-leaflet dependencies.

Testing

  • New unit tests in ui/src/components/DatasetMetadata.test.js (8 tests, all passing) covering labels, harvest grouping, the spatial map/plain-text fallback, and geometry parsing.
  • Production build compiles cleanly.
  • Deployed via docker compose up -d --build and verified the container serves the new bundle.

Backwards compatibility

UI-only change. No API behavior, request/response shapes, or routes change.

Closes #180

Raul Bardaji 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
@rbardaji rbardaji merged commit 886cac4 into main May 31, 2026
1 check passed
@rbardaji rbardaji deleted the feature/180-metadata-presentation branch May 31, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve presentation of dataset metadata in Search results

1 participant