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

Renaming files and parameters #118

Closed
wants to merge 44 commits into from
Closed

Conversation

ehwenk
Copy link
Collaborator

@ehwenk ehwenk commented Nov 12, 2024

  • standardise file names
  • standardise parameter names
  • change all pipes to %>%

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
fontikar and others added 14 commits November 27, 2023 10:30
Create a new function to check if a database is compatible with austraits 3.0 functions

In particular, this function is designed to check a database's metadata to determine if it has been built using `traits.build` versus older versions of AusTraits that were compiled by the internal `austraits.build` workflow. If a version of AusTraits (austraits.build) that is version 4.0 (or older) is detected, messages alert the user to how to download an old version of austraits.

As part of this, the helper function `util_list_to_df2` that converts nested lists to dataframes is added to austraits as an internal function. (Needed to convert specified sections of the databases' metadata into a dataframe).

Includes a test for the new `check_compatibility` function.

Closes issue #93
Towards #91

- extract_ functions not joins in metadata list
- Switches removed for only extract_dataset and extract_taxa and extract_trait
- Added internal function function_not_supported to generalise mass tear down of version switches
- Added an internal function to print the version of AusTraits
- Updated tests and testing data to support switch deprecation
- Turned off messaging in check_compatibility
- Enlisted cli for nicer messaging of which database versions are not supported .
- Bug fixes to bind_trait_values by @ehwenk
- seperate_trait_values still broken, relevant tests are currently commented out @ehwenk #99 
- Bumped version number and NEWS.md
- Updated global variables

Co-authored-by: ehwenk <[email protected]>
Addresses #91

### Removal of switches
The following functions will no longer support AusTraits version < 5.0.0:
- extract_*
- trait_pivot_wider
- join_*
- plot_locations
- plot_trait_beeswarm
- as_wide_table

### Changes to existing functions
- plot_locations and trait_pivot_wider now accepts either traits table OR traits.build list object
- summarise_trait_means will trigger warning due to uninformed calculation of means.

### Deprecations
- plot_site_locations and trait_pivot_longer are deprecated

### Addition of helper functions to assist with removal of switches
- Added internal function to check the compatibility of databases
- Added internal function notify users that some database versions will not be supported
Update documentation for package functions to make them generalised to all traits.build databases
Update previous join_ functions and create new database_create_combined_table function to replace join_all.

This includes:

    Splitting the old join_locations into two functions: join_location_coordinates to explicitly join latitude/longitude and join_location_properties to join location metadata
    For join_contexts, join_locations and join_contributors offer different output formats: many_columns, single_column_pretty, single_column_json
    For all functions add option vars = "all", which will add all columns/location properties/context properties.
    Join_contexts is reworked, using the variant that was developed on traits.build for database_create_combined_table. The old join_contexts is still required for as_wide_table (the combined table currently output via austraits.build API) and has been moved to that file.
    as_wide_table maintained for now to support austraits.build API, but will be removed in the coming months.

---------

Co-authored-by: Daniel Falster <[email protected]>
   * New generalised `extract_data` function that makes it possible to subset a traits.build database using any column in any table. (closes issue #82)
    - The function works with single values or vectors of values
    - Does not return an error for empty searches
    - For context property values, searches across all context property categories simultaneously
    - This function is now called by `extract_trait`, `extract_taxa` and `extract_dataset` (closes issue #107)

* Add `bind_databases`.
    - The function from traits.build that is used to bind together datasets has been moved to austraits, allowing one to extract multiple pieces of a database, then bind them back together into a single database (bind_datasets) (closes issue #106)
    - Remove naming of individual databases from `bind_databases`. This had been drawing the `dataset_id` for the database name, but this name then disappeared once the datasets were bound and the results seem to be identical with and without it (including using it to build austraits.build). And of course for generalised use, there is no longer a unique dataset_id for each database being bound. But it seems like in traits.build the column `dataset_id` for the table `taxonomic_updates` is mutated as part of this function - to be checked once we properly reimport this to traits.build. (closes issue #114)

* Add utility functions from traits.build
    - Add `convert_list_to_df1` (util_list_to_df1 on traits.build), `convert_list_to_df2` (util_list_to_df2 on traits.build), and `convert_df_to_list` (util_df_to_list on traits.build)

* Various documentation fixes
    - Rename `database_create_combined_table` to `flatten_database`
    - Fix bug in `flatten_database` - contributors cannot return many columns
    - Update package contributors documentation (closes issue #110)
    - Export `join_context_properties` and add separate documentation for each `join_` function
    - Updating documentation to pass R CMD check, argument names renamed, adding links in roxygen
    - Added some global variables
    - Line Breaks for extract and updated gha workflow
    - Added upload token
    - Changed `plant_trait_name` to `trait_name` in `plot_trait_distribution_beeswarm`

* Add and edit tests
    - NOTE: the function `summarise_trait_means` was still being tests on v3.0.0 and indeed looking at the code, isn't going to summarise, because it is only searching for replicates within a single observation_id; we've commented out this test and will revisit when we edit this function in 2025
---------

Co-authored-by: Fonti Kar <[email protected]>
..no changes to functions, just file names being changed
- replace all `@param austraits` and `@param aus_traits` with `@param database`
- replace all references to just the traits table (previously x, data, trait( with `@param trait_data`
- standardise description of parameters - currently using `@param database traits.build database (list object)` so people realise it is a relational database, but could change to `@param database traits.build database`
Change all native pipes (|>) to %>% pipes
@ehwenk ehwenk closed this Nov 12, 2024
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