What are you looking for?

Beer Suggestions with DMN and AI

DMN and AI can help solve an incredibly wide range of problems. Learn how it can help with one faced by many in October—picking the right beer to drink 🍺.
By
  • Blog
  • >
  • Beer Suggestions with DMN and AI

Introduction

The summer may be ending, but here in Germany we have learned to drown this disappointment in beer. So, as September gives way to October the inevitable question is raised—“Which beer should I drink?”. Most traditional celebrants of Oktoberfest are likely to insist that you drink something German that abides by the Reinheistgebot, but I’m not so dogmatic and in fact would want everyone to enjoy the perfect beer for them, whatever your tastes and wherever you’re enjoying the seasonal shift. This is why I took some time out of my very busy schedule to build a process to help do just that.

A long while ago, I created a project that used DMN to implement a Sorting Hat (as seen in Harry Potter). This time around, I wanted to expand on that idea a bit because we now happen to have some new tools at our disposal, specifically AI. I discussed in this post about how you can combine DMN and AI to create a really useful way to categorize investment risk. Now, it’s time to combine DMN with AI in order to create something a lot less useful, but a lot more fun.

Building the DMN table

When asking people to describe the kind of beer they like, it’s good to start by understanding the beer style that best suits their palate. You can learn a lot from finding out how sweet, fruity, and hoppy they like their beer. It’s also good to know if they like malty beer or not. So, I created a DRD that represents these inputs for your table.

A DRD with options for deciding which beer to recommend

Each input is a rating between 1 and 10, except for malty, which is a boolean. Entirely because if they were all numbers the table would be more boring. With those defined, I started to create some rules.

Beer-rules

The first important aspect of the table is the Hit Policy, which I decided should be “Collect”. This means that multiple rules could potentially match, because beer is a spectrum and there’s a good bit of overlap on taste.

The rules themselves come from my own personal opinions and some light Googling, that is to say if you disagree with any of the rules here feel free to create an issue (which I will likely ignore because I’m right and you’re wrong).

If this table works the way it should, then you should have one or more beer styles that would suit your preferences. But there’s also the possibility that nothing matches at all! Or, you might know you should drink a stout, but have no idea which ones you can get your hands on! These issues and more are solved by integrating BPMN into the picture.

Building the BPMN model

Adding this DMN table to a BPMN model lets us expand the scope of this invaluable process by letting us integrate other systems and also address different responses depending on the results. In this case, I wanted to add a bunch more features.

  1. A front end where people could enter the data for the table to use
  2. A way to suggest a local beer that suited the beer style we’re suggesting
  3. Email integration so that results can be sent back to the user
Bpmn-beer-recommendations-camunda

The start event will host a front end, and the data gathered there is passed to the DMN table via the “Decide on Beer Style” task—and then the interesting stuff happens.

If the DMN table did manage to find a beer for you, I use the OpenAI Connector to ask ChatGPT to suggest places to find nearby beers in that style. If not, you can trust ChatGPT to suggest an alternative. 👌

In both cases, then an email is sent using the SendGrid Connector with the suggested beverage.

Building a front end

At the start, we need to capture a bunch of data—not just the information used to decide on the beer style, but where they find the beer locally, as well as an email address so I can send the information back to the user. I used the form builder to create this pretty simple form that gathers everything we need.

Beer-recommendation-frontend

Deploy and Run

Now all that’s left is to follow the deployment instructions in the project’s readme file and give it a spin.

You can start the process from Tasklist by filling in the start form.

Deploy-process

You can then go to Operate to view the progress of the process as well as the process variables.

Monitor-process

But you can also drill down into the DMN table to see exactly how the rules performed. In this case, we can see that Reb Brown appears to have landed two styles, Wheat Beer and Belgian Ale—both of which are great, of course.

Image1

Finally, Reb can check his email to find some suggestions on where to get beers in his chosen styles in Dublin where he definitely lives, because he is indeed a real person.

Beer-suggestions-email

Finally…

You can find the project in all its glory right here where you can clone it and run it for yourself. You can also skip all that and get right to the beer by filling out the start form. Like magic,your beer options will appear in your mailbox.

Prost to Oktober! 🍻

Notable Replies
  1. if you disagree with any of the rules here feel free to create an issue which I will likely ignore because I’m right and you’re wrong

    LOL :smiley: :heart:

    The OpenAI Connector is indeed a useful one.

Continue the discussion at forum.camunda.io

Participants

Avatar for Niall Avatar for kristoffer.jalen Avatar for Alex_Voloshyn

Try All Features of Camunda

Related Content

Angle Finance embraces a low-code approach with Camunda to streamline their processes and enhance efficiency.
Learn how and why Vandebron embraced Camunda to simplify and scale up their process orchestration.
Deutsche Telekom improves customer engagement with process orchestration and Camunda.