Skip to content

fix(ui-react): show the datasets the region filter hides (#97) - #113

Merged
mosoriob merged 1 commit into
developfrom
fix/97-datasets-region-filter
Aug 10, 2026
Merged

fix(ui-react): show the datasets the region filter hides (#97)#113
mosoriob merged 1 commit into
developfrom
fix/97-datasets-region-filter

Conversation

@mosoriob

Copy link
Copy Markdown
Contributor

Closes #97.

The problem

Two faults, opposite in direction.

findDatasets sent CKAN an ext_bbox. That filters on having a location, not on location, so a package with no spatial field never reached the client — 11 of TACC's 33 annotated packages, for every region. No control could show them.

And MintThread never passed the region to DatasetsStep, so what did arrive was not narrowed at all. An Alaska package was offered under a Texas framing.

The rule

Two rules, not one toggle. "No location" and "wrong location" are different claims.

  1. Unknown extent — show it, and badge it ! no location. This is what the date filter already does.
  2. Known extent, outside the region — hide it, and count it, behind the same "Show N…" link the datatype filter has.

What changed

  • lib/geo/bbox.ts — one GeoJSON bounding-box extractor, replacing two partial ones. packageSpatialCoverage read coordinates[0] and knew a bare Polygon only; calculateBoundingBox recursed coordinates/geometries but not Feature.geometry or FeatureCollection.features. TACC holds Polygon ×103, FeatureCollection ×5, MultiPolygon, Point and Feature — a client-side filter on either would have dropped 8 packages without a word. That is the Thread datasets: ui-react searches CKAN free text instead of the mint_standard_variables field #94 fault again.
  • findDatasets stops sending ext_bbox and labels each dataset region_match: inside | outside | unknown. Nothing is dropped for the region; the UI decides. Costs no extra request — Thread datasets: ui-react searches CKAN free text instead of the mint_standard_variables field #94 already reads the whole catalog.
  • MintThread reads the thread's region geometries and passes them down. GetThread now selects region { geometries }: region_id names the region without saying where it is.
  • The region chip says when a region carries no extent, rather than implying a filter that never ran.
  • MintDatasets (the unrouted legacy panel) keeps its old behaviour explicitly, so it does not silently widen.

Measured live against TACC

Annotated packages, no variable narrowing:

Region Offered of which badged no location Behind the link Before
Texas 29 11 4 16 via ext_bbox
California (the default framing) 11 11 22 0
Alaska 15 11 18

Two packages that CKAN's own ext_bbox drops — setx_climate_data (a Feature) and test-sunday-speaker-series-links (a FeatureCollection), both squarely inside Texas — now classify as inside. ext_bbox is not merely a server-side version of the same test: ckanext-spatial indexes bare geometries only.

Tests

883 green. The Feature/FeatureCollection/Point assertions were checked to fail against both old extractors.

A dataset with no location metadata was invisible in the thread wizard.
`ext_bbox` filters on *having* a location, not on location, so CKAN never
sent those packages to the client at all: 11 of TACC's 33 annotated
packages, for every region. The wizard also never passed the region down,
so what did arrive was not narrowed either — an Alaska package was offered
under a Texas framing.

Two rules, not one toggle. Unknown extent is shown and badged, as the date
filter already does. Known-but-outside is hidden behind the counted link
the datatype filter already has.

- lib/geo/bbox.ts: one GeoJSON bounding-box extractor, replacing two
  partial ones. `packageSpatialCoverage` read `coordinates[0]` and knew a
  bare Polygon only; `calculateBoundingBox` missed `Feature.geometry` and
  `FeatureCollection.features`. TACC holds Polygon x103, FeatureCollection
  x5, MultiPolygon, Point and Feature, so a client-side filter on either
  would have dropped 8 packages in silence.
- findDatasets stops sending `ext_bbox` and labels each dataset
  `region_match: inside | outside | unknown` instead. Nothing is dropped
  for the region; the UI decides what to do with each answer.
- MintThread reads the thread's region geometries and passes them down.
  GetThread now selects `region { geometries }` — `region_id` names the
  region without saying where it is.
- The region chip says when a region carries no extent, rather than
  implying a filter that never ran.

Measured live against TACC, annotated packages only. Texas: 29 offered
(18 in-region, 11 badged no location) and 4 behind the link, where
`ext_bbox` served 16. California, the default framing: 11 offered and
badged, where it showed an empty step. Two packages CKAN's own `ext_bbox`
drops — a Feature and a FeatureCollection, both squarely inside Texas —
now classify as inside.

883 tests green.
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
monorepo Ready Ready Preview Aug 10, 2026 12:20am

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.

1 participant