Skip to content

fix(ui-react): find thread datasets by mint_standard_variables (#94) - #95

Merged
mosoriob merged 1 commit into
developfrom
fix/94-ckan-standard-variable-lookup
Aug 9, 2026
Merged

fix(ui-react): find thread datasets by mint_standard_variables (#94)#95
mosoriob merged 1 commit into
developfrom
fix/94-ckan-standard-variable-lookup

Conversation

@mosoriob

@mosoriob mosoriob commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Closes #94.

The defect

The thread wizard sent standard variable names to CKAN as a free-text q. CKAN
does not index mint_standard_variables, and Solr splits the names on _ and
~, so the query matched prose rather than the annotation.

Re-measured against ckan.tacc.utexas.edu before the change: exactly the right
datasets for 3 of 40 annotated variables. 28 returned zero. 3 returned only
false positives.

The Datasets step could not be satisfied, so the Runs step stayed locked. This
blocked #92.

The fix

Match the field client-side, as ui/src/util/datacatalog/ckan-data-catalog.ts
does.

  • packagesMatchingVariables keeps packages whose resources carry one of the
    requested variables, and narrows each package to those resources. The
    narrowing also corrects datatype, which is read off the first resource.
  • loadDatasetResources applies the same filter. A dataset matches because
    some of its resources carry the variable, so binding all of them would hand
    the model input files it cannot read.
  • searchAllPackages pages past CKAN's 1000-row cap instead of truncating
    silently. TACC holds 215 packages, so in practice this is one request.
  • limit now caps the datasets returned, not the pages fetched: the catalog has
    to be read in full before the filter can run.

mint_standard_variables is a comma-separated string per resource at TACC. A
list is tolerated, and list entries are split again, because CKAN enforces no
shape.

Verification

Live against ckan.tacc.utexas.edu, driving the app's own
findDatasetsByVariables for every variable TACC annotates, against ground
truth read from the raw payload:

catalog: 215 packages, 40 annotated standard variables
EXACT MATCH: 40/40
resource narrowing on ...capitan-reef-complex-aquifer-gam-files: 35 resources total, 1 carry groundwater__initial_head
multi-variable request: got 3, expected union 3 - MATCH

Offline: 791 tests pass. The new assertions were checked against the old
lookup - 8 of the 14 in src/lib/__tests__/data-catalog.test.ts fail there,
which is every behavioural one; the 6 that pass are the controls (bbox, dates,
no-variable pass-through).

Two existing fixtures had to change. They gave their packages no
mint_standard_variables, which only worked because the old code matched on
prose - the fixtures encoded the bug.

Not fixed here

/datasets/search in "Variable names" mode still searches CKAN free text. It is
a browse surface, not the thread path, and how it should behave is a UX
question. Filed separately.

The thread wizard sent standard variable names to CKAN as a free-text `q`.
CKAN does not index `mint_standard_variables`, and Solr splits the names on
`_` and `~`, so the query matched prose rather than the annotation. Measured
against TACC: the right datasets for 3 of 40 annotated variables, 28 returning
zero and 3 returning only false positives. The Datasets step could not be
satisfied, so the Runs step stayed locked.

Match the field client-side instead, as the legacy Lit client does:

- `packagesMatchingVariables` keeps the packages whose resources carry one of
  the requested variables, narrowing each package to those resources. The
  narrowing also fixes `datatype`, which is read off the first resource.
- `loadDatasetResources` applies the same filter, so a selected dataset binds
  only the files the model input can read.
- `searchAllPackages` pages past CKAN's 1000-row cap rather than truncating
  without saying so. TACC holds 215 packages, so this is one request.
- `limit` now caps the datasets returned, not the pages fetched: the catalog
  has to be read in full before the filter can run.

Verified live against ckan.tacc.utexas.edu: 40 of 40 annotated variables now
return exactly the annotated datasets.
@vercel

vercel Bot commented Aug 9, 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 9, 2026 7:17pm

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