Skip to content

BDMS 774 Fix WELL List filters#664

Merged
jeremyzilar merged 3 commits into
stagingfrom
BDMS-774----well-list-filtering
Apr 27, 2026
Merged

BDMS 774 Fix WELL List filters#664
jeremyzilar merged 3 commits into
stagingfrom
BDMS-774----well-list-filtering

Conversation

@jeremyzilar

Copy link
Copy Markdown
Contributor

What is changing

Fixes wells list filtering so column filters actually narrow results server side, supports “does not contain” and other Refine operators, forwards multiple filter query parameters from the UI, and makes the wells toolbar search match Thing.name by substring instead of relying on full text search alone.

Problem

  • The API applied at most one filter JSON value and only implemented contains, so “Type does not contain water” had no effect and extra filters were dropped when Refine sent several filter= entries.
  • The wells search box sent query (full text / search_vector), which often did not behave like searching for a specific well ID or name (for example DE-0229).

API changes (OcotilloAPI)

services/query_helper.py

  • order_sort_filter consumes every submitted filter blob (legacy single filter_ plus optional list).
  • _apply_json_filter_clause implements Refine logical operators used by the Data Grid, including ncontains, contains, startswith, endswith, eq, ne, comparisons, null / nnull, and in, instead of only contains.

services/thing_helper.py

  • get_db_things merges optional filters: list[str] with the legacy single filter and passes them into order_sort_filter.
  • Adds optional name_contains to restrict rows with Thing.name ILIKE %value%.

api/thing.py

  • GET /thing/water-well, GET /thing/spring, and GET /thing bind filter as a list[str] (repeated query params) and expose name_contains as an optional query parameter.

UI changes (OcotilloUI)

src/pages/ocotillo/thing/list.tsx

  • Wells list toolbar passes name_contains (debounced) instead of query so search aligns with substring match on well name.

Deploy / rollout

  • Ship API before or together with this UI change: column filters require the API updates; name_contains requires the new API parameter.
  • Other list surfaces that share order_sort_filter (sensors, locations, lexicon, samples, observations, contacts, thing id-links, etc.) now honor operators that were previously no-ops.

order_sort_filter now walks every filter JSON in the request (optional filters
list plus legacy single filter_). _apply_json_filter_clause supports contains,
ncontains, startswith, endswith, eq, ne, comparison operators, null checks, and
in, in addition to the old contains-only behavior. Any list or report that
sends filter= more than once or uses operators other than contains will now
get real SQL instead of silent no-ops.
get_db_things accepts filters as a list of JSON strings (merged with legacy
single filter_) and passes them to order_sort_filter. Adds name_contains to
narrow rows with Thing.name ILIKE for substring search without changing the
full-text query path.
GET /thing/water-well, GET /thing/spring, and GET /thing now bind filter as a
list so multiple Refine filters are forwarded. Same routes accept optional
name_contains for substring matching on thing name alongside existing query.
@jeremyzilar jeremyzilar merged commit 672e9e4 into staging Apr 27, 2026
8 checks passed
@jeremyzilar jeremyzilar deleted the BDMS-774----well-list-filtering branch April 27, 2026 20:19
@jeremyzilar jeremyzilar restored the BDMS-774----well-list-filtering branch April 27, 2026 21:59
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.

2 participants