Modeling decisions based on historical data

Hello,

I am trying to model a new system using Camunda’s modelers and BPMN/DMN engines. I’ve gone through Niall’s BPMN/DMN video tutorial, and I am somewhat familiar with the DMN standard as I’ve read the good parts. Otherwise, I’m a complete newbie to DMN and Camunda’s engines.

Suppose I wanted to extend Niall’s model to make a drink order decision such that if Bear Grylls has already had coffee for the day, he should be served lemonade regardless of the time of day.

We could expand the BPM diagram as follows:

If I understand DMN correctly, I could the add a new column to the decision table called “has had coffee today?”. However, what if there are dozens of such questions I could ask based on the order history? Does each question need to have its own input/column in the decision table?

And if the questions are of varying complexity such as:

  • Has he had more than 3 lemonades within the past fortnight? If so, serve death.
  • Has Dale Cooper had coffee within the past 3 months? If so, serve Grylls lemonade (there is only so much coffee in the desert).
  • Has Yoko Ono ever had beer on the same day that Grylls has had lemonade? If so, serve Grylls perfume.

Does that make sense? Is it possible to model something like this with DMN without having to create an input for each question?

I think part of this is my lack of knowledge is also how to provide the boxed context (as the DMN spec calls it) to the DMN table from a BPMN process? I kind of understand how you might do it with Java if you run the engine within your Java project—you can just access the class methods and such. But how about with FEEL or (maybe better) JavaScript?

Thanks!

Here is the DMN table from the tutorial for reference:

Also, to be clear, suppose the order history was available in an external database (e.g. PostgreSQL). Ignore my second question on boxed content, because I think I understand how to set process variables a bit better now.

The real question is in bold.

Help me @Niall-Wan Kenobi, you’re Miall-nly hope.