Coder Social home page Coder Social logo

wall-brew-co / brew-bot Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 4.0 2.4 MB

A quick, dirty way to get randomized beer recipes

Home Page: https://brewbot.wallbrew.com/

License: MIT License

Clojure 97.07% Makefile 2.93%
beer-recipes beer brewing clojure-library clojurescript-library randomized-beer-recipes

brew-bot's Introduction

brew-bot - The algorithmic beer recipe generator

Clojars Project cljdoc badge GitHub Twitter Follow

We’re making beer. I’m the brewery! Bender Bending Rodriguez from Futurama

A Clojure(Script) library to create randomized beer recipes!

The beta release of our SPA is now available!

This repository follows the guidelines and standards of the Wall Brew Open Source Policy.

Installation

A deployed copy of the most recent version of brew-bot can be found on clojars. To use it, add the following as a dependency in your project.clj file:

Clojars Project

The next time you build your application, Leiningen or deps.edn should pull it automatically. Alternatively, you may clone or fork the repository to work with it directly.

Dependencies

This library heavily relies upon the common-beer-format and returns all recipes and ingredients to match its specification. Therefore, all arguments passed to functions in brew-bot are normalized to these standards as well. Most importantly, it assumes measurements are provided in the International System of Units, also known as the modern metric system. Since many brewing applications, especially those based in America, operate on Imperial Measurements, you may wish to add brewtility to any applications consuming this library to assist with conversions between systems of measure.

Usage

All functions necessary to generate a recipe are provided in the core namespace.

(:require [brew-bot.core :refer :all])

(def fermentables
  (select-fermentables))

(def hops
  (select-hops :random))

(def yeast
  (select-yeasts :random {:count-cutoff 1}))

(def my-random-recipe
  (ingredients->cbf-recipe-template fermentables hops yeast))

Each of the three functions select-fermentables, select-hops, and select-yeasts support multiple arities:

  • Zero - Selects ingredients completely randomly across the full set provided by common-beer-format
  • One - Given a strategy, select ingredients from the full set provided by common-beer-format
  • Two - Given a strategy and a map of options, select ingredients with fine-grained control.

These are the currently supported strategies:

  • :random - Select ingredients at random with an even probability of selection and with replacement
  • :weighted - Select ingredients with a provided selection probability and with replacement. For example, {:galaxy 15.0, :el-dorado 5.0, :topaz 1.0}. In this example, galaxy hops have a 71.43% chance of being selected (15.0 / (15.0 + 5.0 + 1.0)).

These are the currently supported options:

  • amount-cutoff - The maximum weight, in kilograms, of fermentable ingredients to select. Defaults to 2.26796 kilograms (5 pounds)
  • count-cutoff - The maximum number of unique ingredients to allow.
  • selection-weights - A map from ingredient names to probability weights. e.g. {:amber-liquid-extract 5.0 :biscuit-malt 15.0 ...}. Only applicable for the :weighted strategy
  • default-weight - A probability weight to fall back to for ingredients not specified in selection-weights. Only applicable for the :weighted strategy

Additionally, per ingredient type, you may focus the possible ingredient selections. Hops also support two additional options for determining when hops are added and their primary use case.

Fermentables

  • include-adjuncts? - A boolean switch to include adjuncts in the list of selectable ingredients. Defaults to true
  • include-dry-extracts? - A boolean switch to include dry extracts in the list of selectable ingredients. Defaults to true
  • include-extracts? - A boolean switch to include extracts in the list of selectable ingredients. Defaults to true
  • include-grains? - A boolean switch to include grains in the list of selectable ingredients. Defaults to true
  • include-sugars? - A boolean switch to include sugars in the list of selectable ingredients. Defaults to true

Hops

  • timing-strategy - A keyword from the set #{:random :weighted :inferred} to determine how hop timings and uses should be selected. Defaults to :random
  • time-weights - A map from hop addition times to weights. e.g. {120 60.0 45 15.0 ...}
  • use-weights - A map from hop use names to weights. e.g. {"boil" 60 ...}
  • include-aroma? - A boolean switch to include aromatic hops. Defaults to true
  • include-bittering? - A boolean switch to include bittering hops. Defaults to true
  • include-both? - A boolean switch to include dual-purpose hops. Defaults to true

Yeasts

  • include-brewtek? - A boolean switch to include yeasts from Brewtek. Defaults to true
  • include-dcl-fermentis? - A boolean switch to include yeasts from DCL Fermentis. Defaults to true
  • include-lallemand? - A boolean switch to include yeasts from Lallemand. Defaults to true
  • include-white-labs? - A boolean switch to include yeasts from White Labs. Defaults to true
  • include-wyeast? - A boolean switch to include yeasts from Wyeast. Defaults to true

Testing

doo, a Leiningen plugin used to run ClojureScript tests in many JS environments, is already in project.clj. Karma is used as the test runner, and is included in package.json.

To install Karma, simply install the Node package:

npm install

Then build the application and run the tests:

lein test-build

The tests will also execute on the JVM, to ensure the library is compatible for both runtime environments.

Contributors

The GitHub profile pictures of all current contributors. Clicking this image will lead you to the GitHub contribution graph.

License

Copyright © Wall Brew Co

This software is provided for free, public use as outlined in the MIT License

brew-bot's People

Contributors

dareknotderek avatar dependabot[bot] avatar github-actions[bot] avatar imgbotapp avatar kix avatar nnichols avatar renovate[bot] avatar wallbrewbot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

brew-bot's Issues

Expand brew-bot ingredients

Is your feature request related to a problem? Please describe.
Currently, brew-bot uses an EDN-like notation for recipe ingredients, but it is incomplete w.r.t. all possible brewing materials.

Describe the solution you'd like
Expands the collections of hops, grains, extracts, and yeasts to be representative of more complete catalogs such as those in BeerSmith

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): lock file maintenance

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/cljdoc_test.yml
  • actions/checkout v4.1.7
  • actions/cache v4
  • cljdoc/cljdoc-check-action v0.0.3
.github/workflows/clojure.yml
  • actions/checkout v4.1.7
  • actions/cache v4
.github/workflows/clojurescript.yml
  • actions/checkout v4.1.7
  • actions/cache v4
  • actions/cache v4
.github/workflows/contributors.yml
  • wow-actions/contributors-list v1
.github/workflows/deploy_to_clojars.yml
  • actions/checkout v4.1.7
  • actions/cache v4
  • hole19/git-tag-action v1.0
.github/workflows/format.yml
  • actions/checkout v4.1.7
  • just-sultanov/setup-cljstyle v1
  • stefanzweifel/git-auto-commit-action v5.0.1
.github/workflows/greetings.yml
  • actions/first-interaction v1
.github/workflows/label.yml
  • actions/labeler v5
.github/workflows/lint.yml
  • actions/checkout v4.1.7
  • reviewdog/action-misspell v1
  • actions/checkout v4.1.7
  • nnichols/clojure-lint-action v2
  • actions/checkout v4.1.7
.github/workflows/scanner.yml
  • actions/checkout v4.1.7
  • clj-holmes/clj-holmes-action 53daa4da4ff495cccf791e4ba4222a8317ddae9e
  • github/codeql-action v3
.github/workflows/sync_labels.yml
  • actions/checkout v4.1.7
  • micnncim/action-label-syncer v1
.github/workflows/todo.yml
  • actions/checkout v4.1.7
leiningen
project.clj
  • cljx-sampling:cljx-sampling 0.1.0
  • com.wallbrew:brewtility 2.0.1
  • com.wallbrew:common-beer-data 1.2.0
  • com.wallbrew:common-beer-format 2.1.0
  • nnichols:nnichols 1.1.0
  • org.clojure:clojure 1.11.3
  • org.clojure:clojurescript 1.11.132
  • doo:doo 0.1.11
  • com.github.clj-kondo:lein-clj-kondo 2024.05.24
  • com.wallbrew:lein-sealog 1.6.0
  • lein-cljsbuild:lein-cljsbuild 1.1.8
  • lein-project-version:lein-project-version 0.1.0
  • mvxcvi:cljstyle 0.16.630
  • ns-sort:ns-sort 1.0.3
  • lein-doo:lein-doo 0.1.11
maven
pom.xml
  • cljx-sampling:cljx-sampling 0.1.0
  • com.wallbrew:brewtility 2.0.1
  • com.wallbrew:common-beer-data 1.2.0
  • com.wallbrew:common-beer-format 2.1.0
  • nnichols:nnichols 1.1.0
  • org.clojure:clojure 1.11.3
  • org.clojure:clojurescript 1.11.132
  • doo:doo 0.1.11
npm
package.json
  • karma ^6.3.2
  • karma-chrome-launcher ^3.0.0
  • karma-cljs-test ^0.1.0
  • karma-firefox-launcher ^2.0.0
  • minimist >=1.2.6

  • Check this box to trigger a request for Renovate to run again on this repository

Add tags for flavors, beer styles

Is your feature request related to a problem? Please describe.
Given the prevalence of meta-information in beer recipes, maps are more useful than a vector for tags.

Describe the solution you'd like
Replacing the tags vector with a map, adding info around common styles/imparted flavors

Describe alternatives you've considered
Using the weights learned to infer the same.

Additional context
Add any other context or screenshots about the feature request here.

Migrate recipe generation and calculations fns to .cljc

Is your feature request related to a problem? Please describe.
N/A

Describe the solution you'd like
Currently, all code is bundled as .cljs files, which is great for working on the UI; however, it locks the code in somewhat. If this code was migrated to .cljc, the core functionality of brew-bot could be deployed to clojars for others to use while still making it accessible to the UI.

Describe alternatives you've considered
The alternative is creating a separate repository, deploying that, and including it as a dependency here; however, since the UI is tightly coupled to that code, it doesn't make much sense.

Additional context
This is a nice-to-have that may lead into config hell.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.