Skip to content

Feature 97 update plot details#102

Merged
DarianGill merged 8 commits into
developfrom
feature-97-update-plot-details
Nov 26, 2025
Merged

Feature 97 update plot details#102
DarianGill merged 8 commits into
developfrom
feature-97-update-plot-details

Conversation

@DarianGill

Copy link
Copy Markdown
Collaborator

What:
Uses the new plot schema to display plot obs details now linking the communities to community classifications, the taxon observations to plant concepts, and showing the stratum level in the observed taxon table.

Why:
User feedback suggested that stratum details were important to include and this sets us up well to build out the comm class detail view with the soon-to-be-deployed updates.

How:

  • Made helper functions to extract nested dataframes for taxa and communities
  • Used those helper functions for concept details usages as well
  • Sorted the taxa dataframe by stratum and then by cover descending to mimic the "show strata + overall" view in vb
  • Updated formatting in the taxa table to right-align column header

Testing and Docs:
All tests pass and check() runs with only notes

Future work?

  • May also be nice to color the table background by strata so they're easier to distinguish
  • Also necessary to format some of the data (elevation, lat & lng, etc)

Copilot AI left a comment

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.

Pull request overview

This PR updates the plot observation detail view to use a new plot schema that provides richer nested data structures. The changes improve the display of plot details by linking taxon observations to plant concepts, showing stratum levels in the taxa table, and linking communities to community classifications.

Key changes:

  • Introduced helper functions to extract and normalize nested dataframes from API responses
  • Enhanced taxa display with stratum information and sorted by stratum then cover descending
  • Updated community links to reference community classifications instead of concepts

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
R/detail_view.R Added temporary shim function get_plot_observation to fetch plot data with nested structures until vegbankr is updated
R/detail_plot.R Implemented normalization and display preparation logic for nested plot observation data, including sorting taxa by stratum and cover
R/detail_helpers.R Added reusable helper functions extract_nested_table and bind_nested_rows for working with list-column dataframes, and enhanced create_detail_table_with_headers with custom styling options
R/detail_concept.R Refactored to use new extract_nested_table helper for extracting usages, children, and correlations data
tests/testthat/test_detail_view.R Updated mock bindings to use new get_plot_observation function instead of deprecated methods
tests/testthat/test_detail_plot.R Added comprehensive tests for normalization, legacy format rejection, and taxa display sorting
tests/testthat/helper-detail-mocks.R Updated mock data structure from list to dataframe format with nested list-columns for taxa and classifications

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/detail_plot.R Outdated
Comment thread R/detail_plot.R Outdated
Comment thread R/detail_plot.R

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/detail_concept.R Outdated
Comment thread R/detail_view.R Outdated
Comment thread R/detail_plot.R Outdated
Comment thread R/detail_plot.R Outdated
Comment thread R/detail_plot.R
Comment thread R/detail_view.R Outdated
Comment thread R/detail_view.R
Comment thread R/detail_helpers.R

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@DarianGill DarianGill requested a review from regetz November 22, 2025 07:13

@regetz regetz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great to see this implemented, thanks!

Comment thread R/detail_view.R
"community-classification" = vegbankr::get_community_classification(vb_code),
"community-concept" = vegbankr::get_community_concept(vb_code),
"taxon-observation" = vegbankr::get_taxon_observation(vb_code),
"plot-observation" = vegbankr::get_plot_observation_details(vb_code),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Note that with this change, we no longer need this bespoke endpoint. It's now planned for removal from the API under NCEAS/vegbank2#185.

Comment thread R/detail_view.R
# Shim to support temporary plot fetching until vegbankr is updated
# TODO: Replace when vegbankr:::get_resource_by_code is updated
get_plot_observation <- function(ob_code) {
vegbankr:::get_all_resources(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As discussed (and noted in your code comment), we can go back to using the exported endpoint-specific vegbankr function as soon as the package is updated to support the new parameters. Or if for some reason it feels a lot more convenient or robust to use get_all_resources()/get_resource_by_code() (after the necessary updates), we can consider converting these into exported functions.

@DarianGill DarianGill merged commit fce83e4 into develop Nov 26, 2025
6 checks passed
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.

3 participants