Skip to content

Commit

Permalink
rename function build_update_taxonomy (#127)
Browse files Browse the repository at this point in the history
rename function `build_update_taxonomy` to `dataset_update_taxonomy` to align with naming conventions. This function updates taxonomy of 1 dataset at a time
  • Loading branch information
ehwenk authored Nov 15, 2023
1 parent d0b132e commit 27ecb28
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ export("%>%")
export(build_add_version)
export(build_combine)
export(build_setup_pipeline)
export(build_update_taxonomy)
export(check_duplicates)
export(dataset_build)
export(dataset_configure)
export(dataset_find_taxon)
export(dataset_process)
export(dataset_report)
export(dataset_test)
export(dataset_update_taxonomy)
export(get_schema)
export(get_unit_conversions)
export(metadata_add_contexts)
Expand Down
6 changes: 3 additions & 3 deletions R/process.R
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ dataset_process <- function(filename_data_raw,
#' Build dataset
#'
#' Build specified dataset. This function completes three steps, which can be executed separately if desired:
#' `dataset_configure`, `dataset_process`, `build_update_taxonomy`
#' `dataset_configure`, `dataset_process`, `dataset_update_taxonomy`
#'
#' @param filename_metadata Metadata yaml file for a given study
#' @param filename_data_raw Raw `data.csv` file for any given study
Expand Down Expand Up @@ -319,7 +319,7 @@ dataset_build <- function(
dataset_raw <- dataset_process(
filename_data_raw, dataset_config, schema, resource_metadata, unit_conversion_functions,
filter_missing_values = filter_missing_values)
dataset <- build_update_taxonomy(dataset_raw, taxon_list)
dataset <- dataset_update_taxonomy(dataset_raw, taxon_list)

dataset
}
Expand Down Expand Up @@ -1860,7 +1860,7 @@ build_combine <- function(..., d = list(...)) {
#' @importFrom rlang .data
#'
#' @export
build_update_taxonomy <- function(austraits_raw, taxa) {
dataset_update_taxonomy <- function(austraits_raw, taxa) {

columns_in_taxon_list <- names(taxa)

Expand Down
4 changes: 2 additions & 2 deletions R/testdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ dataset_test_worker <-
}, info = "`dataset_process`")

expect_no_error({
build_dataset <- build_update_taxonomy(build_dataset_raw, taxon_list)
}, info = "`build_update_taxonomy`")
build_dataset <- dataset_update_taxonomy(build_dataset_raw, taxon_list)
}, info = "`dataset_update_taxonomy`")

build_dataset
}
Expand Down
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ reference:
- '`build_setup_pipeline`'
- '`build_combine`'
- '`build_add_version`'
- '`build_update_taxonomy`'
- '`dataset_update_taxonomy`'
- '`dataset_build`'
- '`dataset_configure`'
- '`dataset_process`'
Expand Down
2 changes: 1 addition & 1 deletion inst/support/build_base.whisker
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ taxon_list <- read_csv_char("config/taxon_list.csv")
{{#dataset_ids}}
{{dataset_id}}_config <- dataset_configure("{{path}}/{{dataset_id}}/metadata.yml", definitions)
{{dataset_id}}_raw <- dataset_process("{{path}}/{{dataset_id}}/data.csv", {{dataset_id}}_config, schema, resource_metadata, unit_conversions)
{{dataset_id}} <- build_update_taxonomy({{dataset_id}}_raw, taxon_list)
{{dataset_id}} <- dataset_update_taxonomy({{dataset_id}}_raw, taxon_list)

{{/dataset_ids}}

Expand Down
2 changes: 1 addition & 1 deletion inst/support/build_remake.whisker
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ targets:
)
{{dataset_id}}:
command: >
build_update_taxonomy({{dataset_id}}_raw,
dataset_update_taxonomy({{dataset_id}}_raw,
taxon_list
)

Expand Down
2 changes: 1 addition & 1 deletion man/dataset_build.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ test_build_dataset <- function(
}, info = paste(info, "`dataset_process`"))

expect_no_error({
build_dataset <- build_update_taxonomy(build_dataset_raw, taxon_list)
}, info = paste(info, "`build_update_taxonomy`"))
build_dataset <- dataset_update_taxonomy(build_dataset_raw, taxon_list)
}, info = paste(info, "`dataset_update_taxonomy`"))

test_structure(build_dataset, info, schema, definitions, single_dataset = TRUE)

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -666,8 +666,8 @@ test_that("`build_setup_pipeline` is working", {
expect_equal(austraits$build_info$git_SHA, sha)
expect_equal(austraits$build_info$git_SHA, "6c73238d8d048781d9a4f5239a03813be313f0dd")

#expect_length(austraits_raw$taxa, 14) #not valid test with new `build_update_taxonomy setup`
#expect_length(austraits$taxa, 14) #not valid test with new `build_update_taxonomy setup`
#expect_length(austraits_raw$taxa, 14) #not valid test with new `dataset_update_taxonomy setup`
#expect_length(austraits$taxa, 14) #not valid test with new `dataset_update_taxonomy setup`
expect_equal(nrow(austraits$taxa), nrow(austraits_raw$taxa))

# Compare products from three methods, except `build_info`
Expand Down

0 comments on commit 27ecb28

Please sign in to comment.