Skip to content

feat(chemistry): add well show major and minor chemistry summary cards#234

Open
jirhiker wants to merge 1 commit intostagingfrom
well-show-major-chemistry
Open

feat(chemistry): add well show major and minor chemistry summary cards#234
jirhiker wants to merge 1 commit intostagingfrom
well-show-major-chemistry

Conversation

@jirhiker
Copy link
Copy Markdown
Member

@jirhiker jirhiker commented Mar 31, 2026

Why

This PR addresses the following problem / context:

  • Add major and minor chemistry summaries to the well show page.
  • Surface latest chemistry values directly on the well detail view using the OGC collections.
  • Keep chemistry information consistent with the current well show card layout.

How

Implementation summary - the following was changed / added / removed:

  • Added dedicated major and minor chemistry summary card components for the well show page.
  • Queried the OGC major and minor chemistry collections by name=<well.name> and normalized the returned latest feature into read-only summary fields.
  • Integrated the chemistry cards into the right column of the well show layout and added focused component and page tests for query gating and empty states.

Notes

Any special considerations, workarounds, or follow-up work to note?

  • The frontend assumes the OGC collections return the latest record for the requested well name.
  • The chemistry cards currently show a curated subset of available fields and can be expanded further if needed.
  • Targeted Vitest coverage was added for the chemistry summary components and well show query behavior.

@jirhiker jirhiker changed the title feat(chemistry): add Major and Minor Chemistry components with summaries and integration into WellShow feat(chemistry): add well show major and minor chemistry summary cards Mar 31, 2026
@github-actions
Copy link
Copy Markdown

Preview Deployment

Preview URL: $PREVIEW_URL

Note: This preview uses the staging API endpoints and has auth disabled for testing.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d2d147e2f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

const serverSideNameRows = await getFeatures({ name: wellName as string })
if (serverSideNameRows.length > 0) return serverSideNameRows[0]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Select newest chemistry record before rendering summary

This returns the first server row without any ordering, so the summary can show stale analytes/date when a collection contains multiple records for the same well (especially possible when resolving *_chemistry_results). Because the UI labels this as “Latest Chemistry Date,” choosing rows[0] is not reliable; request explicit descending sort or pick the max latest_chemistry_date/sample_date client-side before normalizing.

Useful? React with 👍 / 👎.

return (page?.data ?? []) as MajorChemistryFeature[]
}

const serverSideNameRows = await getFeatures({ name: wellName as string })
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match chemistry rows by stable well id, not only name

The query filters by name and then immediately uses the first result, but well names are not guaranteed unique and server-side name filtering may be non-exact. In those cases this page can silently display chemistry from another well even though the route already has a stable well id; prefer filtering/validating by thing_id/well_id (or at least verify the returned feature matches the current well) before building the summary.

Useful? React with 👍 / 👎.

@TylerAdamMartinez
Copy link
Copy Markdown
Contributor

@TylerAdamMartinez
Copy link
Copy Markdown
Contributor

Captura de pantalla 2026-04-01 a la(s) 10 08 24 I like the null state

@TylerAdamMartinez
Copy link
Copy Markdown
Contributor

Could you post a screenshot of this feature showing data. Wasn't able to find a good example.

@jirhiker
Copy link
Copy Markdown
Member Author

jirhiker commented Apr 1, 2026

Screenshot 2026-04-01 at 10 42 56 AM Screenshot 2026-04-01 at 10 42 42 AM

Copy link
Copy Markdown
Contributor

@TylerAdamMartinez TylerAdamMartinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the summary fields are meant to be changeable/editable, then it makes sense. Otherwise, perhaps those summaries could be typographed in the same style as the other cards.

}
}

const SummaryField = ({ label, value }: { label: string; value: string }) => (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What made you decide to use a read-only text field instead of MUI Typography?

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