Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major upgrades to {austraits} #131

Merged
merged 57 commits into from
Nov 19, 2024
Merged

Major upgrades to {austraits} #131

merged 57 commits into from
Nov 19, 2024

Conversation

fontikar
Copy link
Collaborator

@fontikar fontikar commented Nov 18, 2024

A major feat from all of us but especially @ehwenk! 👏 🎉 thank you for working so tirelessly in refactoring and building more user-friendly functions!

As discussed in #92, the goal of this upgrade was to:

  1. Discontinue support for AusTraits version < 4.2.0

  2. Introduce new traits.build 'wrangling output' functions into austraits

  3. Reduce redundancy across traits.build and austraits to streamline codebase maintenance

    • plot_trait_beeswarm moved back to austraits
    • trait_pivot_ moved back to austraits
  4. Refactor {austraits} functions to support other traits.build databases and allow functionality across more tables and columns.

  5. Update documentation accordingly

fontikar and others added 30 commits January 12, 2023 16:04
…king for new version, waiting for austraits.build update
…rough the internal data subsets for version 3.0.2 and version 4.0.0. Pivot_ needs austraits.build fixes to implenment. Some minor fix to pivot_wider for dependencies #60
Some packages needed to make plots are included in suggests. This means that core functions of package may not work.
- reuse outputs from previous function calls to reduce runtime
- reduce dataset sizes for slow functions (summarise_trait_means, trait_pivot_wider, plot_locations)
- silence some outputs

closes #62
- As documented in #79 , the Zenodo API has changed, breaking our download feature. 
- This commit updates the internals to work with the latest changes. 

Specifically: 

- the way to access json for all versions has changed (changed url structure, and for id we now use one of the record ids, rather than the conceptid)
- the call to download file has changed
- format of the API json has changed

Also

- added record id to the table of versions
- put a check in to remove "v" from any version entered by user
* changes required for v5 austraits.build

* Removed original_name for trait_pivot_wider3 for v5.0.0

* Added trait_pivot_wider for v4.x.x and code for what_version

* Making new switches for join and as_wide_table based on new versioning

* Sub switch for extract_ and recreated internal data

* Sub switches for trait_pivot_longer

* Minor fix in join_methods

* Added vars a global vars

* Removed .data calls when not needed

* Update to work with latest zenodo API (#81)


- As documented in #79 , the Zenodo API has changed, breaking our download feature. 
- This commit updates the internals to work with the latest changes. 

Specifically: 

- the way to access json for all versions has changed (changed url structure, and for id we now use one of the record ids, rather than the conceptid)
- the call to download file has changed
- format of the API json has changed

Also

- added record id to the table of versions
- put a check in to remove "v" from any version entered by user

* Recreated data so extract is passing

* Update `treatment_id` with `treatment_context_id`

* Revert "Update `treatment_id` with `treatment_context_id`"

This reverts commit 3fc6717.

* minor column name changes

Changes column names, reflecting recent changes to traits.build output.

* Update as_wide_table.R

add `any_of` to column selection within `as_wide_table` to accommodate other traits.build databases that don't have the same columns in taxon_list.csv

* Fixed getting versions and load austraits with zenodo updates and minor update with as_wide_table with removal of variable

* Fixed minor bug in get_version_latest

---------

Co-authored-by: Elizabeth Wenk <[email protected]>
Co-authored-by: Daniel Falster <[email protected]>
Co-authored-by: yangsophieee <[email protected]>
* Created lites for all main versions of AusTraits

* Passing for as_wide_table

* Passing for as_wide_table and for extract_

* expanding test suite to all 3 majors, switches for method id adjusted

* expanding test suite to all 3 majors for summarise_D

* Expanding these for all 3 versions

* Added PR trigger for dev branch
ehwenk and others added 10 commits November 13, 2024 13:25
*    extract_ functions can now work with a single table or an entire traits.build database; the single table can have any columns, any number of columns
*    required a tweak to check_compatibility to allow single tables to be declared compatible. A extra parameter was added that indicates if the incoming data is allowed to be a single table
*   lots of documentation that was supposed to be on the previous commit

Closes issue #120
* Changed class name and generic name

* Rename summarise_austraits to summarise_database

* Updated format for print message for v<5

* Updated start up message
* bug fix for `extract_data` so it works even after you have joined other columns
* edit `plot_trait_distribution_beeswarm` to work with a single table and for its message to accurately reflect which grouping variables are allowed
* Renamed file and integrated check compatability in print funciton
As described in issue #123 the function is outputting inaccurate results if presented with a database with data from multiple datasets. We are removing it until we build a more sophisticated function.

Closes issue #123
Revert to original format of `bind_databases` arguments - required for traits.build to work using furrr method
* Update README.Rmd

* Returning tibble for flatten_database

* Minor updates to dependnencies to pass R CMD check

Remove reference to `summarise_trait_means`

* Extract_data missing S3 class assign

* Updated bootswatch

---------

Co-authored-by: ehwenk <[email protected]>
@fontikar fontikar requested a review from dfalster November 18, 2024 00:19
@fontikar fontikar modified the milestones: austraits 3.0, ESA Nov 18, 2024
Copy link
Member

@dfalster dfalster left a comment

Choose a reason for hiding this comment

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

Amazing work @fontikar @ehwenk. I'm very glad we handled this in several branches off develop, instead of one monster changeset. So I'd approved on the basis that we've reviewed it all before.

One request. Codecov is alerting me to several lines that have escaped testing. Can you add more tests to cover these? Feels like now is the time, while codecov is pointing them out.

@dfalster
Copy link
Member

if you scroll through the changes, you see alerts like this

Screenshot 2024-11-18 at 11 37 29 AM

@fontikar
Copy link
Collaborator Author

if you scroll through the changes, you see alerts like this

Screenshot 2024-11-18 at 11 37 29 AM

Good point! Lizzy and I have divided up the functions where codecov has flagged tests are needed

I think some are a bit strange like this one for load_austraits where changes from native pipe to magrittr pipe is not captured by tests...

Screenshot 2024-11-18 at 1 16 28 PM

@dfalster
Copy link
Member

This could an indicator that this line was never tested in the first place.

fontikar and others added 2 commits November 18, 2024 15:53
* Export print function so it works and available for testing

* More tests for plot_locations

* Used cli for error message for and more test for plot_trait_

* Snapshotting the output of print.traits.build

* Testing functions in utils file and removing what_version

* Testing for get_versions_latest
Add tests for parts of functions not being tested
Copy link
Collaborator Author

@fontikar fontikar left a comment

Choose a reason for hiding this comment

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

This looks great! I think we are ready for the merge!! Well done team!!

dfalster and others added 2 commits November 19, 2024 08:45
* Function to test database structure

* Adding new test function where appropriate

* Rebuilt embedded lite data layers so that they have the proper class attached to them

---------

Co-authored-by: Daniel Falster <[email protected]>
R/extract_trait.R Show resolved Hide resolved
@ehwenk ehwenk merged commit 02abab7 into master Nov 19, 2024
8 checks passed
@ehwenk ehwenk deleted the develop branch November 19, 2024 02:34
@ehwenk ehwenk restored the develop branch November 19, 2024 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants