Skip to content

feat: geo filter cascade (STIT-742) - #321

Open
mbarlow12 wants to merge 11 commits into
mainfrom
feat/geo-filter-cascade
Open

mbarlow12 wants to merge 11 commits into
mainfrom
feat/geo-filter-cascade

Conversation

@mbarlow12

@mbarlow12 mbarlow12 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds handling of passed filter parameters when requesting filter options. This amounts to applying filtering within the filter_options handling as well.

  • add filter params object to appropriate function signatures and API endpoint
  • apply the parameters to create the desired query prior to executing
  • collect unique attr, value pairs from filtered results
  • send query params to stitch-frontend calls to `/filter-options

Related issues

Closes: STIT-172

Testing

  • make check green and local docker & deployed QA

AI Declaration

Hand design first. No planning. Claude implemented src and test changes.

Checklist

- filter-options now accepts the list query's filter params and returns,
  per field, the values still reachable under every filter except that
  field's own, so multi-select keeps offering the un-ticked values
- the six per-field branches share the list query's pivoted base and union
  into one statement, so the endpoint stays a single round trip
- repointed resources no longer contribute dead option values; the shared
  base excludes them, which the previous standalone query did not
- sorting moves to Python because SQLite and Postgres collate differently
- getResourceFilterOptions takes filters and q, serialized by the same
  helper getResources uses so both requests agree on the wire format
- the react-query key carries the selections, so each combination caches
  separately; with no filters set the URL is unchanged
- the mock path applies the same leave-one-out rule as the backend
- FilterBar takes the options-query params as a prop; ResourcesView passes
  the debounced list params, so one settled change costs one options
  request rather than one per click
- the ticked checkboxes still read the live filters prop, so they keep
  responding immediately
@mbarlow12
mbarlow12 deployed to development October 7, 2026 21:28 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 21:28 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 21:30 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 21:30 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 21:30 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 21:31 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 21:31 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 21:31 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 21:33 — with GitHub Actions Active
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

CD summary 0e727f4

Frontend: https://witty-mushroom-017a3dc1e-321.westus2.1.azurestaticapps.net

Deployments (4)
service url fqdn
api open pr-0321-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
entity-linkage open pr-0321-el.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-321.westus2.1.azurestaticapps.net
stitch-llm open pr-0321-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_0321 stitch-dev.postgres.database.azure.com 5432 pr_0321
Jobs (2)
job image postgres_db api_url auth_mode
db-migrations ghcr.io/rmi/stitch-api:pr-0321@sha256:50df57accc023ac594c65fd8d812e7e24481ec8f5ea660d48c4bd5377d4eac79 pr_0321
seed ghcr.io/rmi/stitch-seed:pr-0321@sha256:2c80c80f6f01d14cba6abd8c7d4f927c90a896315a1f4367925863290cfac790 https://pr-0321-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io/api/v1 stitch-client-bearer-token
Images (4)
build_time commit_time git_sha image image_digest
2026-10-07T21:29:00Z 2026-10-07T21:28:36Z da40851 ghcr.io/rmi/stitch-api:pr-0321 ghcr.io/rmi/stitch-api:pr-0321@sha256:50df57accc023ac594c65fd8d812e7e24481ec8f5ea660d48c4bd5377d4eac79
2026-10-07T21:28:58Z 2026-10-07T21:28:36Z da40851 ghcr.io/rmi/stitch-entity-linkage:pr-0321 ghcr.io/rmi/stitch-entity-linkage:pr-0321@sha256:6c38631b65f01a1b17063dd982848610b177fda4aece22130a8eef4a5cdab012
2026-10-07T21:29:00Z 2026-10-07T21:28:36Z da40851 ghcr.io/rmi/stitch-seed:pr-0321 ghcr.io/rmi/stitch-seed:pr-0321@sha256:2c80c80f6f01d14cba6abd8c7d4f927c90a896315a1f4367925863290cfac790
2026-10-07T21:29:00Z 2026-10-07T21:28:36Z da40851 ghcr.io/rmi/stitch-stitch-llm:pr-0321 ghcr.io/rmi/stitch-stitch-llm:pr-0321@sha256:073515180bfef925b80f0558c2fce3af00a997972b89f78375f494e6e63e281e

…t base

- filter_option_rows goes back to the standalone base it had before, pivoting
  the ranked rows locally, so base_resource_query is byte-identical to its
  original form and the shared helper is gone
- the colname narrowing is now dynamic: the faceted fields, plus only the
  attributes the current filters and search term actually read
- no behaviour change; the unfiltered query returns the same rows and the
  regression against the previous implementation is gone
@mbarlow12
mbarlow12 deployed to development October 7, 2026 23:01 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 23:01 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 23:02 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 23:02 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 23:02 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 23:03 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 23:03 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 7, 2026 23:04 — with GitHub Actions Active
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

CD summary 6c23979

Frontend: https://witty-mushroom-017a3dc1e-321.westus2.1.azurestaticapps.net

Deployments (4)
service url fqdn
api open pr-0321-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
entity-linkage open pr-0321-el.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-321.westus2.1.azurestaticapps.net
stitch-llm open pr-0321-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_0321 stitch-dev.postgres.database.azure.com 5432 pr_0321
Jobs (1)
job image postgres_db
db-migrations ghcr.io/rmi/stitch-api:pr-0321@sha256:f6fdf2838fc5db677883bda26f4379d1d4836c18a641f271c9275713b2f98c3a pr_0321
Images (4)
build_time commit_time git_sha image image_digest
2026-10-07T23:01:56Z 2026-10-07T23:01:40Z 55adcb3 ghcr.io/rmi/stitch-api:pr-0321 ghcr.io/rmi/stitch-api:pr-0321@sha256:f6fdf2838fc5db677883bda26f4379d1d4836c18a641f271c9275713b2f98c3a
2026-10-07T23:01:57Z 2026-10-07T23:01:40Z 55adcb3 ghcr.io/rmi/stitch-entity-linkage:pr-0321 ghcr.io/rmi/stitch-entity-linkage:pr-0321@sha256:153f237a26b75360f6eeacb9b7b0876284927ec8402683fda152ff919942b72a
2026-10-07T23:01:56Z 2026-10-07T23:01:40Z 55adcb3 ghcr.io/rmi/stitch-seed:pr-0321 ghcr.io/rmi/stitch-seed:pr-0321@sha256:ec5a25e8503801f8736156e530e2826f20c7d0dc9a3f27f355e73aca674ca1c6
2026-10-07T23:02:00Z 2026-10-07T23:01:40Z 55adcb3 ghcr.io/rmi/stitch-stitch-llm:pr-0321 ghcr.io/rmi/stitch-stitch-llm:pr-0321@sha256:f92d22a30288bdca4a3edd633e1d8c6f43478ed8815367170ed13a07d825564e

I'd prefer to test the functional API instead of db details.

This and the previous commit dropped checks that the SQLAlchemy
generated SQL had certain patterns. This sort of test (if we want it at
all) would be better if written against against a more holistic pattern.
We design the intended SQL statement structure and record it somewhere;
then pytest constructs a variety of statements and asserts that they
match the complete expected structure.
@mbarlow12
mbarlow12 deployed to development October 20, 2026 20:48 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 20, 2026 20:48 — with GitHub Actions Active
@mbarlow12
mbarlow12 deployed to development October 20, 2026 20:49 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown

CD summary d3fd7a3

Frontend: https://witty-mushroom-017a3dc1e-321.westus2.1.azurestaticapps.net

Deployments (3)
service url fqdn
api open pr-0321-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-321.westus2.1.azurestaticapps.net
stitch-llm open pr-0321-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_0321 stitch-dev.postgres.database.azure.com 5432 pr_0321
Jobs (1)
job image postgres_db
db-migrations ghcr.io/rmi/stitch-api:pr-0321@sha256:fefbc2b42aa726b9feb1cc78c363359ad5436f3d7ac272f9d296fbab7a9e318e pr_0321
Images (3)
build_time commit_time git_sha image image_digest
2026-10-20T20:53:09Z 2026-10-20T20:52:40Z bbba654 ghcr.io/rmi/stitch-api:pr-0321 ghcr.io/rmi/stitch-api:pr-0321@sha256:fefbc2b42aa726b9feb1cc78c363359ad5436f3d7ac272f9d296fbab7a9e318e
2026-10-20T20:53:10Z 2026-10-20T20:52:40Z bbba654 ghcr.io/rmi/stitch-seed:pr-0321 ghcr.io/rmi/stitch-seed:pr-0321@sha256:8144f6b974855c8763193fb78d8c948ef97d66a7430b0ccb947441f1f6332904
2026-10-20T20:53:07Z 2026-10-20T20:52:40Z bbba654 ghcr.io/rmi/stitch-stitch-llm:pr-0321 ghcr.io/rmi/stitch-stitch-llm:pr-0321@sha256:e286de953965a8a0aabab5cb84a6b8bbddca6466de47e343144b1d87aab8b5ed

@github-actions

Copy link
Copy Markdown

CD summary c875129

Frontend: https://witty-mushroom-017a3dc1e-321.westus2.1.azurestaticapps.net

Deployments (3)
service url fqdn
api open pr-0321-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-321.westus2.1.azurestaticapps.net
stitch-llm open pr-0321-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_0321 stitch-dev.postgres.database.azure.com 5432 pr_0321
Jobs (1)
job image postgres_db
db-migrations ghcr.io/rmi/stitch-api:pr-0321@sha256:59bbe6d096611d54d1ca25888254830017ef2c3d28297d1d068a3a331e0673ed pr_0321
Images (3)
build_time commit_time git_sha image image_digest
2026-10-20T21:04:11Z 2026-10-20T21:03:54Z b630628 ghcr.io/rmi/stitch-api:pr-0321 ghcr.io/rmi/stitch-api:pr-0321@sha256:59bbe6d096611d54d1ca25888254830017ef2c3d28297d1d068a3a331e0673ed
2026-10-20T21:04:10Z 2026-10-20T21:03:54Z b630628 ghcr.io/rmi/stitch-seed:pr-0321 ghcr.io/rmi/stitch-seed:pr-0321@sha256:6c41862b779fed4f2c57fdcf95e7c59bea6f7d8ff34291b93c36fb3a609fad3b
2026-10-20T21:04:09Z 2026-10-20T21:03:54Z b630628 ghcr.io/rmi/stitch-stitch-llm:pr-0321 ghcr.io/rmi/stitch-stitch-llm:pr-0321@sha256:7afa7c55bbc8c04f4d3fa98a3ad053ca90aa6056c229eab4c624a46ded72726c

@mbarlow12
mbarlow12 marked this pull request as ready for review October 20, 2026 21:29
@github-actions

Copy link
Copy Markdown

CD summary 4c906fd

Frontend: https://witty-mushroom-017a3dc1e-321.westus2.1.azurestaticapps.net

Deployments (3)
service url fqdn
api open pr-0321-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-321.westus2.1.azurestaticapps.net
stitch-llm open pr-0321-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_0321 stitch-dev.postgres.database.azure.com 5432 pr_0321
Jobs (1)
job image postgres_db
db-migrations ghcr.io/rmi/stitch-api:pr-0321@sha256:e279c3f69fbeab7c9eb9be83215f97ff1e891a281fc6420bcbc3b8cc94a85f70 pr_0321
Images (3)
build_time commit_time git_sha image image_digest
2026-10-20T21:29:26Z 2026-10-20T21:29:10Z 8916f0d ghcr.io/rmi/stitch-api:pr-0321 ghcr.io/rmi/stitch-api:pr-0321@sha256:e279c3f69fbeab7c9eb9be83215f97ff1e891a281fc6420bcbc3b8cc94a85f70
2026-10-20T21:29:26Z 2026-10-20T21:29:10Z 8916f0d ghcr.io/rmi/stitch-seed:pr-0321 ghcr.io/rmi/stitch-seed:pr-0321@sha256:5ad1071f02ffc4deaa2bf06dd737944c812e8e5bd3b0d20ed76da086d1251ea2
2026-10-20T21:29:26Z 2026-10-20T21:29:10Z 8916f0d ghcr.io/rmi/stitch-stitch-llm:pr-0321 ghcr.io/rmi/stitch-stitch-llm:pr-0321@sha256:efbf8f7fafe46666348ad293b88140325143896b15e540e464da4b09540cc4b4

@mbarlow12
mbarlow12 requested review from AlexAxthelm and jdhoffa and removed request for AlexAxthelm October 21, 2026 15:43

This branch was successfully deployed

1 active deployment
development — 4c906fd5 Deployed Oct 20, 2026 by mbarlow12 via Deploy frontend / Build and Deploy Job #1261
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