STIT-763 perf(api): return every filter option in one request and one query - #277
Merged
Merged
Conversation
- replace the per-field /filter-options contract with an all-fields response keyed by field name; drop the field and source params - add queries.filter_option_rows: one ROW_NUMBER pass over (resource_id, colname) answers all six fields, DISTINCT over the pair - derive the filterable field list from OGFieldFilterOptionsResponse so the model and the query cannot drift - FilterBar calls the options hook once instead of once per dropdown - values verified identical to the previous implementation for every licence profile before the old code was removed
Includes drift that predates this branch: new source types, the removed merge-candidate preview endpoint, the added field-priority endpoint, and requested_resource_id. Only the filter-options section is from STIT-763.
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-0277-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-0277-el.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-277.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-0277-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_0277 | stitch-dev.postgres.database.azure.com |
5432 |
pr_0277 |
Jobs (2)
| job | image | postgres_db | api_url | auth_mode |
|---|---|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-0277@sha256:8f1095d13b615d1ed735743a1cd0c838cb18196d9f59a56f54520f45785bfd3f |
pr_0277 |
||
| seed | ghcr.io/rmi/stitch-seed:pr-0277@sha256:803dd0e0e88c72ae9529e0663a90e42712c8609b3890fcf08248fabf7d5bb3c4 |
https://pr-0277-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io/api/v1 |
stitch-client-bearer-token |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-09-16T23:42:26Z | 2026-09-16T23:42:08Z | 7b5fc34 | ghcr.io/rmi/stitch-api:pr-0277 |
ghcr.io/rmi/stitch-api:pr-0277@sha256:8f1095d13b615d1ed735743a1cd0c838cb18196d9f59a56f54520f45785bfd3f |
| 2026-09-16T23:42:26Z | 2026-09-16T23:42:08Z | 7b5fc34 | ghcr.io/rmi/stitch-entity-linkage:pr-0277 |
ghcr.io/rmi/stitch-entity-linkage:pr-0277@sha256:47ccfb12b48bb831f2fa516829a6d1c1fc2543af71d4b9613805904b2a8079f3 |
| 2026-09-16T23:42:24Z | 2026-09-16T23:42:08Z | 7b5fc34 | ghcr.io/rmi/stitch-seed:pr-0277 |
ghcr.io/rmi/stitch-seed:pr-0277@sha256:803dd0e0e88c72ae9529e0663a90e42712c8609b3890fcf08248fabf7d5bb3c4 |
| 2026-09-16T23:42:22Z | 2026-09-16T23:42:08Z | 7b5fc34 | ghcr.io/rmi/stitch-stitch-llm:pr-0277 |
ghcr.io/rmi/stitch-stitch-llm:pr-0277@sha256:a4c5e892c8a746cf38361b566269e5aa7ef657b720e9d6ca25d6fc2f74e525d1 |
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-0277-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-0277-el.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-277.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-0277-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_0277 | stitch-dev.postgres.database.azure.com |
5432 |
pr_0277 |
Jobs (1)
| job | image | postgres_db |
|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-0277@sha256:d79b1202bdcf1439b4ca1533a8b9caa443e33344c4a65bb04559b064db6a14b9 |
pr_0277 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-09-21T19:11:30Z | 2026-09-21T19:11:09Z | a2e6f74 | ghcr.io/rmi/stitch-api:pr-0277 |
ghcr.io/rmi/stitch-api:pr-0277@sha256:d79b1202bdcf1439b4ca1533a8b9caa443e33344c4a65bb04559b064db6a14b9 |
| 2026-09-21T19:11:25Z | 2026-09-21T19:11:09Z | a2e6f74 | ghcr.io/rmi/stitch-entity-linkage:pr-0277 |
ghcr.io/rmi/stitch-entity-linkage:pr-0277@sha256:8a98817dd6459000c49128c41252331a9e440dc9fbb5f131277d7f3834521ea4 |
| 2026-09-21T19:11:25Z | 2026-09-21T19:11:09Z | a2e6f74 | ghcr.io/rmi/stitch-seed:pr-0277 |
ghcr.io/rmi/stitch-seed:pr-0277@sha256:c39b212ae90296c00aa5a964a8b8bad41b5c719b1b4d334347e8cbe086a589d1 |
| 2026-09-21T19:11:32Z | 2026-09-21T19:11:09Z | a2e6f74 | ghcr.io/rmi/stitch-stitch-llm:pr-0277 |
ghcr.io/rmi/stitch-stitch-llm:pr-0277@sha256:7e0fa38635ebfafd732f2d211d0f0a44ed3cfdaca49cefddd1d9b00dead2ae2f |
- Merging #275 kept `FilterFieldDropdown`, which nothing referenced after this branch moved to a single filter-options query. - Its sort by display label (STIT-746) was the only copy, so deleting the dead wrapper would have dropped country ordering; moved it into the `FILTER_FIELDS.map` instead. - Updated the alphabetical-order test to mock the new keyed response shape rather than the old per-field `{ field, values }`.
mbarlow12
had a problem deploying
to
development
September 23, 2026 04:28 — with
GitHub Actions
Error
mbarlow12
had a problem deploying
to
development
September 23, 2026 04:28 — with
GitHub Actions
Error
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-0277-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_0277 | stitch-dev.postgres.database.azure.com |
5432 |
pr_0277 |
Jobs (1)
| job | image | postgres_db |
|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-0277@sha256:089cfda22b16cea7161e3a8701e5b9f7173d96db64bef243c48ffcbaa67a1816 |
pr_0277 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-09-23T04:26:36Z | 2026-09-23T04:26:23Z | 1e00256 | ghcr.io/rmi/stitch-api:pr-0277 |
ghcr.io/rmi/stitch-api:pr-0277@sha256:089cfda22b16cea7161e3a8701e5b9f7173d96db64bef243c48ffcbaa67a1816 |
| 2026-09-23T04:26:38Z | 2026-09-23T04:26:23Z | 1e00256 | ghcr.io/rmi/stitch-entity-linkage:pr-0277 |
ghcr.io/rmi/stitch-entity-linkage:pr-0277@sha256:bbbd33f6bc2dd9df2e6e25ae2c729cd3e6506d2d9dc0a47f92740d3687bee781 |
| 2026-09-23T04:26:41Z | 2026-09-23T04:26:23Z | 1e00256 | ghcr.io/rmi/stitch-seed:pr-0277 |
ghcr.io/rmi/stitch-seed:pr-0277@sha256:8a70d87091ac67267e54b8c3c97bac6699dbac7083b492000f01f021a1bba4b6 |
| 2026-09-23T04:26:36Z | 2026-09-23T04:26:23Z | 1e00256 | ghcr.io/rmi/stitch-stitch-llm:pr-0277 |
ghcr.io/rmi/stitch-stitch-llm:pr-0277@sha256:b6116b0dd47e03355ef5815698cea1f8fbddedd80426b5bf1911250c332e8ac0 |
mbarlow12
had a problem deploying
to
development
September 23, 2026 04:29 — with
GitHub Actions
Error
CD summary
|
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_0277 | stitch-dev.postgres.database.azure.com |
5432 |
pr_0277 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-09-23T04:29:24Z | 2026-09-23T04:28:08Z | df535e7 | ghcr.io/rmi/stitch-api:pr-0277 |
ghcr.io/rmi/stitch-api:pr-0277@sha256:d52f4860d24b6b24d0b19be97cb10c9eaa65157e52bb5f458d7109f65760e347 |
| 2026-09-23T04:29:24Z | 2026-09-23T04:28:08Z | df535e7 | ghcr.io/rmi/stitch-entity-linkage:pr-0277 |
ghcr.io/rmi/stitch-entity-linkage:pr-0277@sha256:7299d78b79aab93cc9c3a62e022fd6d0b0bdfcdbfea1f344948224aebc0c2323 |
| 2026-09-23T04:29:23Z | 2026-09-23T04:28:08Z | df535e7 | ghcr.io/rmi/stitch-seed:pr-0277 |
ghcr.io/rmi/stitch-seed:pr-0277@sha256:96cc77f210a5a3d867c0bf97caf4f1f11c8e029c344f6c5d897d25a99ead5aae |
| 2026-09-23T04:29:27Z | 2026-09-23T04:28:08Z | df535e7 | ghcr.io/rmi/stitch-stitch-llm:pr-0277 |
ghcr.io/rmi/stitch-stitch-llm:pr-0277@sha256:8c641e881525270d52acf884ad5fe1839108522c7ce39869160bf6962a1c5f6a |
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-0277-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-0277-el.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-277.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-0277-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_0277 | stitch-dev.postgres.database.azure.com |
5432 |
pr_0277 |
Jobs (1)
| job | image | postgres_db |
|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-0277@sha256:1bdce6cd81d1ba00e6accf60b08b4014655a99584c4d6945087bd7113603cffa |
pr_0277 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-09-23T04:30:43Z | 2026-09-23T04:30:20Z | 0a01e86 | ghcr.io/rmi/stitch-api:pr-0277 |
ghcr.io/rmi/stitch-api:pr-0277@sha256:1bdce6cd81d1ba00e6accf60b08b4014655a99584c4d6945087bd7113603cffa |
| 2026-09-23T04:30:45Z | 2026-09-23T04:30:20Z | 0a01e86 | ghcr.io/rmi/stitch-entity-linkage:pr-0277 |
ghcr.io/rmi/stitch-entity-linkage:pr-0277@sha256:4190472c6f8bd10dc4b50bfc1bb10a64d0ce3721d78d5bdc29b1c795867a9cb6 |
| 2026-09-23T04:30:43Z | 2026-09-23T04:30:20Z | 0a01e86 | ghcr.io/rmi/stitch-seed:pr-0277 |
ghcr.io/rmi/stitch-seed:pr-0277@sha256:db76473f447ca13d0492c8af8dfea484acb0209c8bf575ae8468940ff7918391 |
| 2026-09-23T04:30:43Z | 2026-09-23T04:30:20Z | 0a01e86 | ghcr.io/rmi/stitch-stitch-llm:pr-0277 |
ghcr.io/rmi/stitch-stitch-llm:pr-0277@sha256:8f480fb2ebbbe2bab04a6d126dd6148b6ff95aab140722180b02aac30fc92304 |
AlexAxthelm
approved these changes
Sep 23, 2026
AlexAxthelm
left a comment
Collaborator
There was a problem hiding this comment.
Thanks! much cleaner!
This branch was successfully deployed
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.
What changed
Six filter dropdowns each called
GET /oil-gas-fields/filter-options?field=X. One page load, six requests, each rebuilding the same large join. Now one request, one query.db/queries.py— newfilter_option_rows. The ranking window already groups by(resource_id, colname), so one pass picks the winner for every field.DISTINCTis over the(field, value)pair.entities.py—OGFieldFilterOptionsResponselists the six fields.FILTER_OPTION_FIELDSis derived from it, so the model and the query cannot drift.db/og_field_resource_actions.py—filter_optionstakes no params and returns the model.routers/oil_gas_fields.py— route takes no query parameters.fieldis gone.sourceis gone; it was already ignored.components/FilterBar.jsx— one hook call, not one per dropdown.FilterFieldDropdowndeleted.Response keys: basin, country, field_status, primary_hydrocarbon_group, region, state_province. Always present. A field with no values returns
[]. Licensing is unchanged.Risk to review
repointed_id IS NULL.Conflicts with #275
FilterFieldDropdown, which this PR deletes.FILTER_FIELDS.map, and update theuseResourceFilterOptionsmock inResourcesView.test.jsxto the new response shape.Checks
Local Postgres via
make dev-docker, seeded by ETL runs for gem, wm, ccr, alb and bc, plus a corpus of merges, reprioritizations, and llm generated content. >20k top level resources, ~58k source rows./filter-optionsrequest, no query string. All six dropdowns fill. Filtering still returns rows (34,036 to 16,563 on "Producing").LOG_ALL_QUERIES=truethe route logsdb_query_count=2: the sharedget_current_userlookup at 1ms, and the options query at 181ms. One query for the route's own work.make checkpasses.Covering tests:
TestResourceFilterOptionsAction(tests/db/test_resource_actions.py),TestGetResourceFilterOptionsUnit(tests/routers/test_resources_unit.py), andResourcesView.test.jsx,api.test.js,resources.test.js.AI Usage