Skip to content

Commit

Permalink
Add BibType as a column in methods table (#193)
Browse files Browse the repository at this point in the history
As described [here](#192), the `BibType ` associated with a dataset is used by the R package `RefManageR` to process the references, but is not displayed anywhere within the traits.build database. A column recording the BibType of the
primary citation is now included within the reference table. 
This change has not effected any dataset metadata.yml files, but is
simply capturing and outputting data that was already documented in
them.

Note that `austraits` functions still work and the function
`extract_data` lets you filter data based on `BibType`.
  • Loading branch information
ehwenk authored Jan 15, 2025
1 parent 970f851 commit e825a40
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 61 deletions.
2 changes: 2 additions & 0 deletions R/process.R
Original file line number Diff line number Diff line change
Expand Up @@ -1633,6 +1633,7 @@ process_format_methods <- function(metadata, dataset_id, sources, contributors)
)

source_primary_key <- metadata$source$primary$key
source_primary_type <- metadata$source$primary$bibtype
source_secondary_keys <- citation_types %>%
dplyr::filter(.data$type == "secondary") %>%
purrr::pluck("source_id")
Expand Down Expand Up @@ -1676,6 +1677,7 @@ process_format_methods <- function(metadata, dataset_id, sources, contributors)
tibble::tibble(
dataset_id = dataset_id,
source_primary_key = source_primary_key,
source_primary_type = source_primary_type,
source_primary_citation = bib_print(sources[[source_primary_key]]),
source_secondary_key = ifelse(
length(source_secondary_keys) > 0,
Expand Down
1 change: 1 addition & 0 deletions inst/support/traits.build_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ austraits:
description: &description A 1-2 sentence description of the purpose of the study.
sampling_strategy: &sampling_strategy A written description of how study locations were selected and how study individuals were selected. When available, this information is lifted verbatim from a published manuscript. For preserved specimens, this field ideally indicates which records were 'sampled' to measure a specific trait.
source_primary_key: Citation key for the primary source in `sources`. The key is typically formatted as `Surname_year`.
source_primary_type: Citation type for the primary source in `sources`, using standard BibTex citation types (Article, Book, Misc, Online, Report, Techreport, Thesis, Unpublished).
source_primary_citation: Citation for the primary source. This detail is generated from the primary source in the metadata.
source_secondary_key: Citation key for the secondary source in `sources`. The key is typically formatted as `Surname_year`.
source_secondary_citation: Citations for the secondary source. This detail is generated from the secondary source in the metadata.
Expand Down
46 changes: 23 additions & 23 deletions tests/testthat/examples/Test_2023_1/output/methods.csv

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions tests/testthat/examples/Test_2023_2/output/methods.csv

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions tests/testthat/examples/Test_2023_3/output/methods.csv

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions tests/testthat/examples/Test_2023_4/output/methods.csv

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/testthat/examples/Test_2023_5/output/methods.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dataset_id,trait_name,methods,method_id,description,sampling_strategy,source_primary_key,source_primary_citation,source_secondary_key,source_secondary_citation,source_original_dataset_key,source_original_dataset_citation,data_collectors,assistants,dataset_curators
Test_2023_5,leaf_mass_per_area,unknown,01,Collection of trait data on Australian plants compiled by Anna Richards and Ian Wright from papers,See the individual 'additional references' for the individual study motivations.,Richards_2008,"A. Richards and I. J. Wright. ""Unpublished data: Transcription of Australian plant functional trait data from Ian Wright's collection of papers, Macquarie University"". 2009.",Leuning_1991; Meakins_0000,"R. Leuning, R. N. Cromer, and S. Rance. ""Spatial distributions of foliar nitrogen and phosphorus in crowns of Eucalyptus grandis"". _Oecologia_ 88.4 (1991), pp. 504-510. doi: [10.1007/bf00317712](https://doi.org/10.1007%2Fbf00317712); Meakins. ""Unpublished data: Study of Brindabella species"".",Bell_1985; Bevege_1978; Lambert_1979,"Bell. ""Nutrient requirements for the establishment of native flora at Weipa"". In: _Conference proceedings of N Australian mine rehab workshop 9_. 1985; D. I. Bevege. _Biomass and nutrient distribution in indigenous forest ecosystems_. Tech. rep. Queensland Department of Forestry, 1978, p. 20; M. J. Lambert. ""Sulphur relationships of native and exotic tree species"". Masters. Macquarie University, Sydney, 1979.",Anna Richards (contact),,Ian Wright
Test_2023_5,leaf_lifespan,"From Richards_2008_2 (unpublished); See original references, listed alphabetically under 'additional references'",01,Collection of trait data on Australian plants compiled by Anna Richards and Ian Wright from papers,See the individual 'additional references' for the individual study motivations.,Richards_2008,"A. Richards and I. J. Wright. ""Unpublished data: Transcription of Australian plant functional trait data from Ian Wright's collection of papers, Macquarie University"". 2009.",Leuning_1991; Meakins_0000,"R. Leuning, R. N. Cromer, and S. Rance. ""Spatial distributions of foliar nitrogen and phosphorus in crowns of Eucalyptus grandis"". _Oecologia_ 88.4 (1991), pp. 504-510. doi: [10.1007/bf00317712](https://doi.org/10.1007%2Fbf00317712); Meakins. ""Unpublished data: Study of Brindabella species"".",Bell_1985; Bevege_1978; Lambert_1979,"Bell. ""Nutrient requirements for the establishment of native flora at Weipa"". In: _Conference proceedings of N Australian mine rehab workshop 9_. 1985; D. I. Bevege. _Biomass and nutrient distribution in indigenous forest ecosystems_. Tech. rep. Queensland Department of Forestry, 1978, p. 20; M. J. Lambert. ""Sulphur relationships of native and exotic tree species"". Masters. Macquarie University, Sydney, 1979.",Anna Richards (contact),,Ian Wright
dataset_id,trait_name,methods,method_id,description,sampling_strategy,source_primary_key,source_primary_type,source_primary_citation,source_secondary_key,source_secondary_citation,source_original_dataset_key,source_original_dataset_citation,data_collectors,assistants,dataset_curators
Test_2023_5,leaf_mass_per_area,unknown,01,Collection of trait data on Australian plants compiled by Anna Richards and Ian Wright from papers,See the individual 'additional references' for the individual study motivations.,Richards_2008,Unpublished,"A. Richards and I. J. Wright. ""Unpublished data: Transcription of Australian plant functional trait data from Ian Wright's collection of papers, Macquarie University"". 2009.",Leuning_1991; Meakins_0000,"R. Leuning, R. N. Cromer, and S. Rance. ""Spatial distributions of foliar nitrogen and phosphorus in crowns of Eucalyptus grandis"". _Oecologia_ 88.4 (1991), pp. 504-510. doi: [10.1007/bf00317712](https://doi.org/10.1007%2Fbf00317712); Meakins. ""Unpublished data: Study of Brindabella species"".",Bell_1985; Bevege_1978; Lambert_1979,"Bell. ""Nutrient requirements for the establishment of native flora at Weipa"". In: _Conference proceedings of N Australian mine rehab workshop 9_. 1985; D. I. Bevege. _Biomass and nutrient distribution in indigenous forest ecosystems_. Tech. rep. Queensland Department of Forestry, 1978, p. 20; M. J. Lambert. ""Sulphur relationships of native and exotic tree species"". Masters. Macquarie University, Sydney, 1979.",Anna Richards (contact),,Ian Wright
Test_2023_5,leaf_lifespan,"From Richards_2008_2 (unpublished); See original references, listed alphabetically under 'additional references'",01,Collection of trait data on Australian plants compiled by Anna Richards and Ian Wright from papers,See the individual 'additional references' for the individual study motivations.,Richards_2008,Unpublished,"A. Richards and I. J. Wright. ""Unpublished data: Transcription of Australian plant functional trait data from Ian Wright's collection of papers, Macquarie University"". 2009.",Leuning_1991; Meakins_0000,"R. Leuning, R. N. Cromer, and S. Rance. ""Spatial distributions of foliar nitrogen and phosphorus in crowns of Eucalyptus grandis"". _Oecologia_ 88.4 (1991), pp. 504-510. doi: [10.1007/bf00317712](https://doi.org/10.1007%2Fbf00317712); Meakins. ""Unpublished data: Study of Brindabella species"".",Bell_1985; Bevege_1978; Lambert_1979,"Bell. ""Nutrient requirements for the establishment of native flora at Weipa"". In: _Conference proceedings of N Australian mine rehab workshop 9_. 1985; D. I. Bevege. _Biomass and nutrient distribution in indigenous forest ecosystems_. Tech. rep. Queensland Department of Forestry, 1978, p. 20; M. J. Lambert. ""Sulphur relationships of native and exotic tree species"". Masters. Macquarie University, Sydney, 1979.",Anna Richards (contact),,Ian Wright
6 changes: 3 additions & 3 deletions tests/testthat/examples/Test_2023_6/output/methods.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dataset_id,trait_name,methods,method_id,description,sampling_strategy,source_primary_key,source_primary_citation,source_secondary_key,source_secondary_citation,source_original_dataset_key,source_original_dataset_citation,data_collectors,assistants,dataset_curators
Test_2023_6,leaf_mass_per_area,unknown,01,Collection of trait data on Australian plants compiled by Anna Richards and Ian Wright from papers,See the individual 'additional references' for the individual study motivations.,Richards_2008,"A. Richards and I. J. Wright. ""Unpublished data: Transcription of Australian plant functional trait data from Ian Wright's collection of papers, Macquarie University"". 2009.",Leuning_1991; Meakins_0000,"R. Leuning, R. N. Cromer, and S. Rance. ""Spatial distributions of foliar nitrogen and phosphorus in crowns of Eucalyptus grandis"". _Oecologia_ 88.4 (1991), pp. 504-510. doi: [10.1007/bf00317712](https://doi.org/10.1007%2Fbf00317712); Meakins. ""Unpublished data: Study of Brindabella species"".",Bell_1985; Bevege_1978; Lambert_1979,"Bell. ""Nutrient requirements for the establishment of native flora at Weipa"". In: _Conference proceedings of N Australian mine rehab workshop 9_. 1985; D. I. Bevege. _Biomass and nutrient distribution in indigenous forest ecosystems_. Tech. rep. Queensland Department of Forestry, 1978, p. 20; M. J. Lambert. ""Sulphur relationships of native and exotic tree species"". Masters. Macquarie University, Sydney, 1979.",Anna Richards (contact),,Ian Wright
Test_2023_6,leaf_lifespan,"From Richards_2008_2 (unpublished); See original references, listed alphabetically under 'additional references'",01,Collection of trait data on Australian plants compiled by Anna Richards and Ian Wright from papers,See the individual 'additional references' for the individual study motivations.,Richards_2008,"A. Richards and I. J. Wright. ""Unpublished data: Transcription of Australian plant functional trait data from Ian Wright's collection of papers, Macquarie University"". 2009.",Leuning_1991; Meakins_0000,"R. Leuning, R. N. Cromer, and S. Rance. ""Spatial distributions of foliar nitrogen and phosphorus in crowns of Eucalyptus grandis"". _Oecologia_ 88.4 (1991), pp. 504-510. doi: [10.1007/bf00317712](https://doi.org/10.1007%2Fbf00317712); Meakins. ""Unpublished data: Study of Brindabella species"".",Bell_1985; Bevege_1978; Lambert_1979,"Bell. ""Nutrient requirements for the establishment of native flora at Weipa"". In: _Conference proceedings of N Australian mine rehab workshop 9_. 1985; D. I. Bevege. _Biomass and nutrient distribution in indigenous forest ecosystems_. Tech. rep. Queensland Department of Forestry, 1978, p. 20; M. J. Lambert. ""Sulphur relationships of native and exotic tree species"". Masters. Macquarie University, Sydney, 1979.",Anna Richards (contact),,Ian Wright
dataset_id,trait_name,methods,method_id,description,sampling_strategy,source_primary_key,source_primary_type,source_primary_citation,source_secondary_key,source_secondary_citation,source_original_dataset_key,source_original_dataset_citation,data_collectors,assistants,dataset_curators
Test_2023_6,leaf_mass_per_area,unknown,01,Collection of trait data on Australian plants compiled by Anna Richards and Ian Wright from papers,See the individual 'additional references' for the individual study motivations.,Richards_2008,Unpublished,"A. Richards and I. J. Wright. ""Unpublished data: Transcription of Australian plant functional trait data from Ian Wright's collection of papers, Macquarie University"". 2009.",Leuning_1991; Meakins_0000,"R. Leuning, R. N. Cromer, and S. Rance. ""Spatial distributions of foliar nitrogen and phosphorus in crowns of Eucalyptus grandis"". _Oecologia_ 88.4 (1991), pp. 504-510. doi: [10.1007/bf00317712](https://doi.org/10.1007%2Fbf00317712); Meakins. ""Unpublished data: Study of Brindabella species"".",Bell_1985; Bevege_1978; Lambert_1979,"Bell. ""Nutrient requirements for the establishment of native flora at Weipa"". In: _Conference proceedings of N Australian mine rehab workshop 9_. 1985; D. I. Bevege. _Biomass and nutrient distribution in indigenous forest ecosystems_. Tech. rep. Queensland Department of Forestry, 1978, p. 20; M. J. Lambert. ""Sulphur relationships of native and exotic tree species"". Masters. Macquarie University, Sydney, 1979.",Anna Richards (contact),,Ian Wright
Test_2023_6,leaf_lifespan,"From Richards_2008_2 (unpublished); See original references, listed alphabetically under 'additional references'",01,Collection of trait data on Australian plants compiled by Anna Richards and Ian Wright from papers,See the individual 'additional references' for the individual study motivations.,Richards_2008,Unpublished,"A. Richards and I. J. Wright. ""Unpublished data: Transcription of Australian plant functional trait data from Ian Wright's collection of papers, Macquarie University"". 2009.",Leuning_1991; Meakins_0000,"R. Leuning, R. N. Cromer, and S. Rance. ""Spatial distributions of foliar nitrogen and phosphorus in crowns of Eucalyptus grandis"". _Oecologia_ 88.4 (1991), pp. 504-510. doi: [10.1007/bf00317712](https://doi.org/10.1007%2Fbf00317712); Meakins. ""Unpublished data: Study of Brindabella species"".",Bell_1985; Bevege_1978; Lambert_1979,"Bell. ""Nutrient requirements for the establishment of native flora at Weipa"". In: _Conference proceedings of N Australian mine rehab workshop 9_. 1985; D. I. Bevege. _Biomass and nutrient distribution in indigenous forest ecosystems_. Tech. rep. Queensland Department of Forestry, 1978, p. 20; M. J. Lambert. ""Sulphur relationships of native and exotic tree species"". Masters. Macquarie University, Sydney, 1979.",Anna Richards (contact),,Ian Wright
Loading

0 comments on commit e825a40

Please sign in to comment.