Skip to content

Commit

Permalink
docs(main): Updated README.md and overall documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
timkolloch committed Aug 17, 2024
1 parent dbcc8df commit 403acc6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,24 @@ Because adding all the properties to a food by hand is quite annoying I built th
2. Create an API key for the USDA FDC database by signing up [here](https://fdc.nal.usda.gov/api-key-signup.html). The API key will be sent to you via e-mail.
3. Open the FDC page for every food you want to update (e.g. [this](https://fdc.nal.usda.gov/fdc-app.html#/food-details/169661/nutrients) for maple syrup)
- Either copy the URL into the "URL" field of the food. The field can be found by editing a food item and going to the "More" section.
- Or go to the admin view of your foods `<yout-tandoor-endpoint/admin/cookbook/food/` and edit the food there to enter the FDC ID.
- Or go to the admin view of your foods `<your-tandoor-endpoint>/admin/cookbook/food/` and edit the food there to enter the FDC ID.
- Note that the URL will be preferred if URL and FDC ID are set.
- You can also run the program in interactive mode (`./tandoor_importer --interactive`) to be asked for an FDC ID if your food does not have one assigned.
4. Make sure that every property you have created in Tandoor also has the corresponding FDC ID assigned so the matching can work.

## Usage
1. Copy [appsettings.template.json](./appsettings.template.json) to `appsettings.json` and add your Tandoor endpoint as well as the API key to it.
2. Run the program using `./tandoor_importer`.
2. Run the program using `./tandoor_importer`. Refer to the [Parameters](#parameters) section for configuration.
3. All food items for which a FDC ID was assigned should now have values for all your properties.

## Logs
By default, log level `error` is enabled. To run the program with a different log level please use:
`RUST_LOG=tandoor_importer=info ./tandoor_importer` to set the log level to `info`.
Replace `info` with the desired log level (`trace`, `debug`, `info`, `warn`, `error`)
## Parameters

### Flags
| Name | short name | Description | Required? | Default |
|---------------|------------|-----------------------------------------------------------------------------|-----------|---------|
| --interactive | -i | When set the program asks the user to provide an FDC ID when none was found | No | false |

### Parameters with value
| Name | short name | Description | Required? | Default |
|-------------|------------|-----------------------------------------------------------------|-----------|---------|
| --log-level | -l | Sets the log level [One of: trace, debug, info, warning, error] | No | info |
2 changes: 1 addition & 1 deletion src/models/command_line_arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct Args{
pub override_properties: bool,

/// Interactive mode
#[arg(short, long, help = "When set the program asks the user to enter a FDC ID when none was found.")]
#[arg(short, long, help = "When set the program asks the user to provide an FDC ID when none was found.")]
pub interactive: bool,

/// Log level
Expand Down

0 comments on commit 403acc6

Please sign in to comment.