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

Add tutorial on building traits.yml #7

Open
ehwenk opened this issue Oct 24, 2023 · 1 comment
Open

Add tutorial on building traits.yml #7

ehwenk opened this issue Oct 24, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@ehwenk
Copy link
Contributor

ehwenk commented Oct 24, 2023

  • suggestion by @dcol2804 to add a tutorial on building the traits dictionary yml file
  • indicating more about indention and special characters that might cause problems (I'm assuming things like brackets around certain units).
  • in addition, we should build a function that converts a pair of csv files into the traits.yml, taking advantage of the code we'd developed for APD. (One main traits csv file and a second file with categorical traits values and their definitions.)
@dcol2804
Copy link
Contributor

Here are my thoughts for a quick introduction to editing .yml files, using the traits.yml as an example.

  1. Brief introduction about what a yml file is and their importance function in the traits.build package - (e.g. interface between human readable text and programming languages, heirarchical structure defined by indentation), see traits.build-template traits.yml file and give an example.

  2. Get the user to edit the traits.yml file, for example create a new trait below the others. (I'm sure @ehwenk will have tonnes of advice about how to structure a definition, how to define units, watch out for using symbols in the units). Tell the user which categories in a trait are essential for building austraits e.g. type, allowed values.

  3. Have an example of copying some definition text into a new trait and it having the wrong indentation for example. Then remake AusTraits and show the error. Then give an explanation of how to fix it.

Another error which held me up was a few spaces at the bottom of the traits.yml - as an R user I haven't trained my eye to look out for spaces in code..:

incomplete final line found on 'config/traits.yml'
Backtrace:

  1. ├─traits.build (local) expect_isin(...)
  2. │ └─object %in% expected
  3. ├─definitions$elements %>% names()
  4. └─traits.build::get_schema(...)
  5. └─yaml::read_yaml(path)
  6. ├─base::paste(readLines(file, warn = readLines.warn), collapse = "\n")
    
  7. └─base::readLines(file, warn = readLines.warn)
    

@ehwenk ehwenk added this to AusTraits Aug 1, 2024
@ehwenk ehwenk added the enhancement New feature or request label Aug 1, 2024
@ehwenk ehwenk moved this to Backlog in AusTraits Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

2 participants