Ordering Green Coffee with Go and jq
When sweetmarias stops selling a coffee they tend to stop hosting any content
about that coffee. I don’t think that this is intentional, but in any case it
means any stats or recorded info they have tends to disappear pretty soon after
you order the coffee. I resolved this for my personal needs by building a tool
written in Go) that will extract all the current coffees and their relevant
information as JSON. Currently, I use it like this:
sm-list > all.json
When I order coffee, I basically want to look at the entire sweetmarias catalog. I tend to sort by score, since my favorite coffee of all time had an exceptionally high score (93!) On top of that I’m not interested in already roasted coffee, decaf, or samples. Here’s how I build up a list of coffees to review, based on the export corpus.
cat all.json | jq -C -s '. | sort_by(.Score) | reverse | . | select(.Title | test("(?i)decaf|roasted|sample") | not )' | less -S
I looked over the data above (annoyingly not word wrapped, yet, but one step at a time.) Based on that I chose a few coffees and made my order by clicking the URLs for each one. After ordering I stored the information about the coffees I ordered:
cat ~/all.json | grep -P '(Ethiopia Dry Process Kayon Mountain Taaroo|Ethiopia Dry Process Guji Shakiso Hambela|Sweet Maria.s New Classic Espresso|Ethiopia Agaro Duromina Coop|Brazil Dry Process Fazenda Campos Altos|El Salvador Honey Process Finca El Naranjo|https://www.sweetmarias.com/el-salvador-la-esperanza-h1-cultivar-6141.html)' > order.js
I commited that information to my coffee log, with the intention to use that information when I roast coffee, going forward. On top of that, I figured I’d share what I ordered with some friends:
cat order.json | jq -r '" * [" + .Title + "](" + .URL + "): " + .Overview + "\n"' | fmt -t | perl -pe 's/^(\S)/ $1/'
Here’s the output, rendered from the markdown:
Brazil Dry Process Fazenda Campos Altos: Fruited notes are somewhat edgy, but with convincing sweetness underneath -overripe berry, dried prune, dark baking chocolate, roasted nut, and creamy body. City+ to Full City+. Good for espresso.
Sweet Maria’s New Classic Espresso: A classic, balanced espresso, but without the baggage of the old world espresso conventions …and without robusta! The espresso has balanced bittersweet notes, thick and opaque body, almond and chocolate roast flavors, hints of peach tea, spice, jasmine.
Ethiopia Dry Process Guji Shakiso Hambela Dabaye: Fruit flavors are juicy and clean, strawberry jam and berry-like brightness illuminate the cup, hints of sweet citrus, peach puree and tart acidic impression. City to Full City.
Ethiopia Agaro Duromina Coop Lot 17: Duromina has intense cup flavors, nectarine, peach skin, herbal rue and orange marmalade notes are attention grabbing. Deeper roasts pull out cacao bittersweetness and rustic dried stone fruit. City to Full City. Good for espresso.
El Salvador Honey Process Finca El Naranjo: Honey sweetness accented by dried cherry, pomegranate and cranberry notes, and tannic acidity and mouthfeel. Darker roasts show cocoa bittersweetness, and softer fruit characteristics. City to Full City.
Ethiopia Dry Process Kayon Mountain Taaroo: Such a clean and complex DP cup, notes of fresh and dried fruits, baking spices, blueberry hard candy, mixed berry jam and stunning floral aroma. A standout pour over brew. City to City+.
El Salvador La Esperanza “H1” Cultivar: La Esperanza is a fairly delicate, nuanced El Salvador. Toffee/caramel sweetness, roasted barley green tea, lemony acidity, light body, clean mouthfeel. City to Full City.
If you’re interested in roasting your own coffee I wrote up how I do it. That description is a little out of date, but it gives you enough detail to get started yourself.
(The following includes affiliate links.)
sm-list is written in Go; if you want to learn more about programming
Go, you should check out
The Go Programming Language.
It is one of the best programming books I’ve read. You will not only learn
Go, but also get some solid introductions on how to write code that is safely
concurrent. Highly recommend. This book is so good that I might write
a blog post solely about learning Go with this book.
I haven’t started reading it yet, but on my list in programming books to read is Designing Data-Intensive Applications. I have heard great things.Posted Wed, Sep 4, 2019
If you're interested in being notified when new posts are published, you can subscribe here; you'll get an email once a week at the most.