Feature 97 update plot details#102
Conversation
…and within stratum desc by cover
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
regetz
left a comment
There was a problem hiding this comment.
Great to see this implemented, thanks!
| "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), |
There was a problem hiding this comment.
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.
| # 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( |
There was a problem hiding this comment.
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.
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:
Testing and Docs:
All tests pass and check() runs with only notes
Future work?