Skip to content

fix(ui-react): show every model in the model tree, not only type sdm#Model (#98) - #101

Merged
mosoriob merged 1 commit into
developfrom
fix/98-model-tree-all-software-types
Aug 9, 2026
Merged

fix(ui-react): show every model in the model tree, not only type sdm#Model (#98)#101
mosoriob merged 1 commit into
developfrom
fix/98-model-tree-all-software-types

Conversation

@mosoriob

@mosoriob mosoriob commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Closes #98.

The rule

modelcatalog_software.type classifies a model. It does not say whether a row is a model.

  • The ETL only migrated rows that matched ?id a sdm:Model in the RDF. It then stored the most specific sdm: subtype it found, defaulting to sdm#Model (etl/extract.py:145-171). So every migrated row is a model by construction.
  • Rows written through the REST API's generic softwares resource carry the ontology superclass sd#Software (model-catalog-api/src/mappers/resource-registry.ts:77). All 8 such rows at TACC are models: MODFLOW-96 ×2, MODFLOW-2001 ×3, ParFlow, an InSAR workflow, a particle-filter groundwater assimilation.
  • The legacy Lit UI reads the same column as a display label, never as a filter (ui/src/model-catalog-api/util.ts:14-44).

So any predicate on type hides real models. The queries now pass none.

Effect at TACC

before after
software (model families) 27 55
leaf configurations 18 175
HAND configurations 0 44

Measured live against https://graphql.mint.tacc.utexas.edu/v1/graphql with the exact documents this PR ships.

Why not an allowlist of subtypes

model-catalog-api already keeps one — getSoftwareTypeFilter in src/service.ts:59-76, six URIs. It is already stale: TACC's /models returns 44 of 55 software, silently dropping TheoryBasedModel, TheoryAndEmpiricalModel and DataAssimilation (never added to the list) plus every sd#Software row. An allowlist goes wrong every time the catalog gains a subtype, and it fails silently.

Changes

Three queries lose the where clause:

  • GetModelTreeWithRegions (src/graphql/generated/modeling.ts) — the thread wizard Models step
  • GetModelTree (src/graphql/queries/model-catalog.graphql) — /regions/:id/models
  • GetModelFamilies (same file) — the Model Family picker on registration, which could not offer any family whose type is a subtype, so a new version could not be registered under HAND

src/graphql/generated/graphql.ts was regenerated with graphql-codegen against the committed admin-schema snapshot (src/graphql/generated/schema.graphql) rather than hand-edited. The diff is 10 lines across the two documents.

Registration still writes sdm#Model for a newly created family (src/schemas/registration.ts:12). That is correct — the generic type is the honest default when no subtype is known.

Tests

New src/graphql/__tests__/model-tree-type-filter.test.ts — 9 assertions guarding all three documents against a type predicate. Checked to fail against the old code (6 of 9 red).

Full suite green: 97 files, 802 tests. npm run build and npm run lint clean (0 errors).

Not covered

No render-level browser check — the Models step needs a signed-in thread, and that is #92's job. grep confirms these were the only ontology-type filters in ui-react.

…Model (#98)

The three queries that read modelcatalog_software filtered on
type: { _eq: "https://w3id.org/okn/o/sdm#Model" }. The column classifies a
model — Empirical, Coupled, Theory-Guided and so on — it does not say whether
a row is a model. Every row the ETL migrated matched `?id a sdm:Model` in the
RDF and stored the most specific subtype found; rows written through the REST
API's generic `softwares` resource carry the ontology superclass sd#Software.
So the predicate hid real models.

Against TACC's catalog the thread wizard showed 18 of 175 leaf configurations
and 0 of the 61 with every required input annotated. All 44 Height Above
Nearest Drainage configurations were hidden, so a search for HAND returned
"No models match your search."

- GetModelTreeWithRegions — the thread wizard Models step
- GetModelTree — /regions/:id/models
- GetModelFamilies — the Model Family picker on registration, which could not
  offer any family whose type is a subtype of sdm#Model

An allowlist of subtypes is not the fix. model-catalog-api keeps one
(getSoftwareTypeFilter in service.ts) and it is already stale: it returns 44 of
TACC's 55 software rows.

Verified live against TACC's Hasura: all three documents now return 55 software,
51 versions, 175 leaf configurations, 44 of them HAND.

graphql.ts regenerated by graphql-codegen from the committed admin-schema
snapshot, not hand-edited.
@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 8:59pm

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