fix(ui-react): show the datasets the region filter hides (#97) - #113
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Closes #97.
The problem
Two faults, opposite in direction.
findDatasetssent CKAN anext_bbox. That filters on having a location, not on location, so a package with nospatialfield never reached the client — 11 of TACC's 33 annotated packages, for every region. No control could show them.And
MintThreadnever passed the region toDatasetsStep, 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.
! no location. This is what the date filter already does.What changed
lib/geo/bbox.ts— one GeoJSON bounding-box extractor, replacing two partial ones.packageSpatialCoveragereadcoordinates[0]and knew a bare Polygon only;calculateBoundingBoxrecursedcoordinates/geometriesbut notFeature.geometryorFeatureCollection.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.findDatasetsstops sendingext_bboxand labels each datasetregion_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.MintThreadreads the thread's region geometries and passes them down.GetThreadnow selectsregion { geometries }:region_idnames the region without saying where it is.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:
no locationext_bboxTwo packages that CKAN's own
ext_bboxdrops —setx_climate_data(aFeature) andtest-sunday-speaker-series-links(aFeatureCollection), both squarely inside Texas — now classify asinside.ext_bboxis not merely a server-side version of the same test: ckanext-spatial indexes bare geometries only.Tests
883 green. The
Feature/FeatureCollection/Pointassertions were checked to fail against both old extractors.