Calculating recipes with Obsidian

My journey through note taking systems led me to Obsidian in mid-2022. One way I use it is for managing recipes. While I have dedicated recipe managers—Paprika and Mela—the flexibility to combine historical notes and adjustments into the same place makes it easier for me to iterate on an idea.

I’ve been recently working on recipe for seasoned cucumbers. I started with every ingredient broken out by weight. I prefer to work with weights because they are easily repeated later. 1% salt wash ratio works no matter how many cucumbers you’re working with. And it’s easy to adjust to taste with a scale and write down +10g rice vinegar.

When I finished this recipe I found myself with a different problem. I start with a variable amount of cucumber. The ingredient quantities are ratios based on the cucumber weight. I needed to compute every weight for every ingredient by hand every time I cut up a bunch of cucumbers!

I did this math on paper by hand twice before remembering that Obsidian Dataview has inline expressions. I could convert the amounts in the recipe to expressions that calculate automatically the ratio automatically and give me the exact weight for whatever starting amount of raw product.

To make this work I define an inline field for whatever base value I want to build off of. In the example below I’m using [Weight:: 1000] for the cucumber. Then each ingredient has an inline expression calculating how much it needs based on the given weight. Salt is 1%, so this.Weight * 0.01% for the salt.

Here’s the recipe source text. I use dv: for inline expressions.

## Ingredients

* [Weight:: 1000]g Persian cucumber
* `dv: round(this.Weight * 0.01)`g salt wash for ~30 minutes
* `dv: round(this.Weight * 0.28)`g seasoned rice vinegar
    * Add `dv: round(this.Weight * 0.01)`g sugar if using unseasoned vinegar
* `dv: round(this.Weight * 0.06)`g soy sauce
* `dv: round(this.Weight * 0.05)`g Chinkiang black vinegar 
* `dv: round(this.Weight * 0.05)`g sesame oil
* `dv: round(this.Weight * 0.035)`g garlic, roughly minced
* Thai chilis or other hot chilies to taste, ~1 Thai chili per 500g of cucumber. 

## Directions
1. Chop or smash cucumber into bite sized pieces. 
2. Toss with salt and let sit for about 30 minutes. 
3. Rinse briefly in cold water and drain. 
4. Pat dry and transfer to leakproof container. 
5. Combine all other ingredients and mix thoroughly. 
6. Pour liquid mixture over cucumbers. Ensure they are fully covered. 
7. Seal and refrigerate for at least 8 hours, preferably overnight. 

Keeps in the fridge for about two weeks. 
written June 11th, 2023

June 2023

Can’t find what you’re looking for? Try hitting the home page or viewing all archives.