Feat/see source values (STIT-493)#159
Conversation
New endpoint keeps existing models stable, and provides good ergonomics for when we introduce per-field overrides
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-159-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-159-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-159.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-159-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_159 | stitch-dev.postgres.database.azure.com |
5432 |
pr_159 |
Jobs (2)
| job | image | postgres_db | api_url | auth_mode |
|---|---|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-159@sha256:4c6f1206bb3354048b300b7cd402ba0f45017fd586249c70d676e73e2d9fa750 |
pr_159 |
||
| seed | ghcr.io/rmi/stitch-seed:pr-159@sha256:528b85515404f8c3a33b1afe0609e5d621370400a99564a17f5a10a70ac2e11c |
https://pr-159-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io/api/v1 |
stitch-client-bearer-token |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-07-03T13:49:42Z | 2026-07-03T13:49:28Z | 981aa8b | ghcr.io/rmi/stitch-api:pr-159 |
ghcr.io/rmi/stitch-api:pr-159@sha256:4c6f1206bb3354048b300b7cd402ba0f45017fd586249c70d676e73e2d9fa750 |
| 2026-07-03T13:49:44Z | 2026-07-03T13:49:28Z | 981aa8b | ghcr.io/rmi/stitch-entity-linkage:pr-159 |
ghcr.io/rmi/stitch-entity-linkage:pr-159@sha256:aa9261d37c434acd6deccd94b8e20994d66b038e5b012271c470d15203bafd3f |
| 2026-07-03T13:49:46Z | 2026-07-03T13:49:28Z | 981aa8b | ghcr.io/rmi/stitch-seed:pr-159 |
ghcr.io/rmi/stitch-seed:pr-159@sha256:528b85515404f8c3a33b1afe0609e5d621370400a99564a17f5a10a70ac2e11c |
| 2026-07-03T13:49:45Z | 2026-07-03T13:49:28Z | 981aa8b | ghcr.io/rmi/stitch-stitch-llm:pr-159 |
ghcr.io/rmi/stitch-stitch-llm:pr-159@sha256:11769ac5d8a4d8d5eef0055cc19dd36533762dc41aca9d865238834f2c8daf82 |
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-159-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-159-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-159.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-159-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_159 | stitch-dev.postgres.database.azure.com |
5432 |
pr_159 |
Jobs (1)
| job | image | postgres_db |
|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-159@sha256:7c91485e30f635fd4f9b72e15761d41c17681f195afecbf131f673e56bef509d |
pr_159 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-07-06T10:26:58Z | 2026-07-06T10:26:44Z | 9e70f3d | ghcr.io/rmi/stitch-api:pr-159 |
ghcr.io/rmi/stitch-api:pr-159@sha256:7c91485e30f635fd4f9b72e15761d41c17681f195afecbf131f673e56bef509d |
| 2026-07-06T10:27:02Z | 2026-07-06T10:26:44Z | 9e70f3d | ghcr.io/rmi/stitch-entity-linkage:pr-159 |
ghcr.io/rmi/stitch-entity-linkage:pr-159@sha256:8f5f251a038c1674c43c0c799995c723d54dad9418cc4bd184815dbe1c5d03f8 |
| 2026-07-06T10:27:02Z | 2026-07-06T10:26:44Z | 9e70f3d | ghcr.io/rmi/stitch-seed:pr-159 |
ghcr.io/rmi/stitch-seed:pr-159@sha256:913db5d93e9399763c9e3170dc62ee6112aa24f39b671f2f5bd5798c2c423cfc |
| 2026-07-06T10:27:02Z | 2026-07-06T10:26:44Z | 9e70f3d | ghcr.io/rmi/stitch-stitch-llm:pr-159 |
ghcr.io/rmi/stitch-stitch-llm:pr-159@sha256:574a5fa04e39b00d3cbdad99e83004914f1794c86d28239b6cba40b970e8a0da |
There was a problem hiding this comment.
Pull request overview
Adds a “see source values” capability so users can inspect every source’s value for an individual field (ordered by effective priority), exposed via a new backend endpoint and surfaced in the resource detail UI via an expandable field card.
Changes:
- Backend: introduce a per-field “source values” response model + DB action + API route (
/{id}/fields/{field}/sources) and integration tests. - Frontend: add query/hook wiring and a new
ResourceFieldCardthat lazily fetches and displays all source values when expanded. - Seed/test updates: add demo seed data and expand component/page test coverage for the new behavior.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/stitch-ogsi/src/stitch/ogsi/model/init.py | Adds OGFieldSourceValueView response model for per-field source values. |
| deployments/api/src/stitch/api/db/og_field_resource_actions.py | Implements field_source_values DB action to compute/sort per-source values with licensing and validation. |
| deployments/api/src/stitch/api/routers/oil_gas_fields.py | Exposes new GET endpoint /{id}/fields/{field}/sources returning OGFieldSourceValueView[]. |
| deployments/api/tests/db/test_resource_actions.py | Adds integration tests covering sorting, overrides, omission rules, licensing, and error cases. |
| deployments/stitch-frontend/src/queries/api.js | Adds getFieldSourceValues API client function. |
| deployments/stitch-frontend/src/queries/resources.js | Adds React Query keys + query definition for field source-values. |
| deployments/stitch-frontend/src/hooks/useResources.js | Adds useFieldSourceValues hook (real + mock) wrapping the new query. |
| deployments/stitch-frontend/src/components/ResourceFieldCard.jsx | New UI component that makes a field card expandable to show per-source values on demand. |
| deployments/stitch-frontend/src/components/ResourceFieldCard.test.jsx | Tests expand/collapse, lazy enabling, winner highlighting, and loading/error/empty states. |
| deployments/stitch-frontend/src/components/FieldCard.jsx | Enhances FieldCard to optionally render as an expandable toggle button with panel content. |
| deployments/stitch-frontend/src/components/FieldCard.test.jsx | Adds tests for new expandable button behavior and panel rendering. |
| deployments/stitch-frontend/src/pages/ResourceDetailPage.jsx | Switches key field displays to ResourceFieldCard to enable per-field source inspection. |
| deployments/stitch-frontend/src/pages/ResourceDetailPage.test.jsx | Mocks useFieldSourceValues to keep page tests stable with the new component usage. |
| deployments/seed/data/006-source-values-demo.json | Adds seed/demo data illustrating multi-source values for a resource. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-159-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-159-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-159.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-159-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_159 | stitch-dev.postgres.database.azure.com |
5432 |
pr_159 |
Jobs (1)
| job | image | postgres_db |
|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-159@sha256:64d2d371aeea72220812c6f67802b93580a6b8d20fbe391aa07f288a4fb69c43 |
pr_159 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-07-06T14:48:17Z | 2026-07-06T14:47:58Z | 9936ddf | ghcr.io/rmi/stitch-api:pr-159 |
ghcr.io/rmi/stitch-api:pr-159@sha256:64d2d371aeea72220812c6f67802b93580a6b8d20fbe391aa07f288a4fb69c43 |
| 2026-07-06T14:48:18Z | 2026-07-06T14:47:58Z | 9936ddf | ghcr.io/rmi/stitch-entity-linkage:pr-159 |
ghcr.io/rmi/stitch-entity-linkage:pr-159@sha256:babee0705d82325c3cba5817740ee486e7d0e9e1d7aaa42c0763fed3141d6af6 |
| 2026-07-06T14:48:17Z | 2026-07-06T14:47:58Z | 9936ddf | ghcr.io/rmi/stitch-seed:pr-159 |
ghcr.io/rmi/stitch-seed:pr-159@sha256:fa5f02ffd937ebe7cf684f01944e438679182f81e021a45ba34b6729eadb3b0d |
| 2026-07-06T14:48:17Z | 2026-07-06T14:47:58Z | 9936ddf | ghcr.io/rmi/stitch-stitch-llm:pr-159 |
ghcr.io/rmi/stitch-stitch-llm:pr-159@sha256:ddfc7cc9bcb8e8c4a26595655a01737f6ba954b73eb15a7bab145cd1721d9c0c |
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-159-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-159-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-159.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-159-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_159 | stitch-dev.postgres.database.azure.com |
5432 |
pr_159 |
Jobs (1)
| job | image | postgres_db |
|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-159@sha256:b8003427f6019621e9c199c5c178c4d345d13f3366f16171d90d2910ee0b113e |
pr_159 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-07-06T14:47:45Z | 2026-07-06T14:47:26Z | 7bd2765 | ghcr.io/rmi/stitch-api:pr-159 |
ghcr.io/rmi/stitch-api:pr-159@sha256:b8003427f6019621e9c199c5c178c4d345d13f3366f16171d90d2910ee0b113e |
| 2026-07-06T14:47:45Z | 2026-07-06T14:47:26Z | 7bd2765 | ghcr.io/rmi/stitch-entity-linkage:pr-159 |
ghcr.io/rmi/stitch-entity-linkage:pr-159@sha256:b3ca5606bc5dd6b7f7b58dfe6cddba568cd31aa1e00c08d14077535665ffdf4a |
| 2026-07-06T14:47:46Z | 2026-07-06T14:47:26Z | 7bd2765 | ghcr.io/rmi/stitch-seed:pr-159 |
ghcr.io/rmi/stitch-seed:pr-159@sha256:922a6ce337f5a88dcaa28c8e34a538c6abcd483546a8f2da523e85a6763b4199 |
| 2026-07-06T14:47:45Z | 2026-07-06T14:47:26Z | 7bd2765 | ghcr.io/rmi/stitch-stitch-llm:pr-159 |
ghcr.io/rmi/stitch-stitch-llm:pr-159@sha256:5fd2b8f9f405ec556a8af96650c88f8e3f589b91954378788974220c82c165a9 |
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-159-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-159-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-159.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-159-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_159 | stitch-dev.postgres.database.azure.com |
5432 |
pr_159 |
Jobs (1)
| job | image | postgres_db |
|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-159@sha256:d8cb8fc7362ed917e49db02e875668b93d2b9afab66732253deefcf46c301fe1 |
pr_159 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-07-06T16:25:43Z | 2026-07-06T16:24:07Z | a6e9208 | ghcr.io/rmi/stitch-api:pr-159 |
ghcr.io/rmi/stitch-api:pr-159@sha256:d8cb8fc7362ed917e49db02e875668b93d2b9afab66732253deefcf46c301fe1 |
| 2026-07-06T16:25:45Z | 2026-07-06T16:24:07Z | a6e9208 | ghcr.io/rmi/stitch-entity-linkage:pr-159 |
ghcr.io/rmi/stitch-entity-linkage:pr-159@sha256:7f05ce7e2993817475d8167b7aa037b1ed961605d98f53a77043c63f451b708d |
| 2026-07-06T16:25:43Z | 2026-07-06T16:24:07Z | a6e9208 | ghcr.io/rmi/stitch-seed:pr-159 |
ghcr.io/rmi/stitch-seed:pr-159@sha256:3e2aeef84ab134b57689ec3600e2f91f9e27c30459031003210749c371b6f28a |
| 2026-07-06T16:25:46Z | 2026-07-06T16:24:07Z | a6e9208 | ghcr.io/rmi/stitch-stitch-llm:pr-159 |
ghcr.io/rmi/stitch-stitch-llm:pr-159@sha256:c4d9f9569f803b95ad1491a471a44e2565bc06c1226c3ba7712d8ec7d873f388 |
mbarlow12
left a comment
There was a problem hiding this comment.
The main thing I noticed is that we're already populating a full list of source data when a user hits the {id}/detail endpoint, responding with OGFieldDetailView. Its source_data attribute has all the data we need to display the list of values for a given attribute with the exception of the actual priority number, but the sources are already sorted in priority order. Unless we need to display "1/2/3/4/...", I think the dropdown could be displayed in pure JS without a second API call.
| ) | ||
|
|
||
|
|
||
| async def field_source_values( |
There was a problem hiding this comment.
Do we need a separate endpoint? The OGFieldDetailView already has a full list of sources, sorted in priority order. Could we drop the extra API call & endpoint if we use that data?
There was a problem hiding this comment.
We need a finer grained endpoint, since we'll need to move away from the idea that a resource only has a single set of priorities, and to the idea that each field has its own set of priorities (so the priorities for "Basin" and "Local name" may be differently ordered).
To that end, I think dropping the full list of sources from the OGFieldDetailView is probably a good call moving forward (or at least don't imply that it's an ordered set), and if we need source details, we can fetch those as needed.
There was a problem hiding this comment.
If we drop the full list of sources, then the Detail view becomes just the ListItemView and forces us to make calls for every field attribute the user wants to view. Any other service will need to do the same to get the full, equivalent data for a Field.
| const validId = Number.isFinite(numericId); | ||
| const endpoint = "oil-gas-fields"; | ||
| const { | ||
| data: detailView, |
There was a problem hiding this comment.
We're waiting here to load the full resource view as it is. Why not fetch data per attribute in pure JS?
There was a problem hiding this comment.
I think this is related to the other comment about needing a finer grain on the priority details, and possibly dropping some detail from the details endpoint
|
@mbarlow12 just noting that you reviewed without approval just now. Could you please flag if any of your comments were specifically blocking here (and if so, which ones?) |
I'll approve to get things moving, but I'm still not entirely convinced we need an extra endpoint with the additional models. Even with the upcoming reprioritization PR, our relatively expensive query still gets executed to produce the OGFieldDetailView. That query also already takes into account the priority values. All the data we need is there, but it's not quite structured properly. I'd advocate for adjusting the shape of the detail view and tweaking our coalescing/SQL (which we still have to do regardless of the dropdown display) over adding a separate endpoint (+ new models, wiring, dependencies, permissions) that ultimately calls the same function The big catch here is that if |
That's totally fair, @mbarlow12 can you please open a ticket under the Tech Debt epic outlining your concerns (ideally in some detail, and referencing this PR) so that we can explore in a future sprint? And can you please add a comment to this PR with the resulting ticket linked? In general, I don't want to block something that "works" in favour of something that's "perfect", but I still think it's relevant to capture these qualms in detail so that we can follow up on them |
I'm generally on board with this, if we can find an ergonomic way of including the full data in the |
Add component to expand
FieldCards into a detailed view of the component sources in priority fallback order, with winner highlighted.Adds endpoint to API to provide data for detailed view. Note that the current Resource Detail endpoint won't be sufficient for this after we introduce per-field priorities (upcoming PR).
Also note, the owner/operator fields aren't included in this at this time (more complex behavior)