Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write an event for a decision evaluation #8115

Closed
Tracked by #8083
saig0 opened this issue Nov 1, 2021 · 4 comments · Fixed by #8794
Closed
Tracked by #8083

Write an event for a decision evaluation #8115

saig0 opened this issue Nov 1, 2021 · 4 comments · Fixed by #8794
Labels
kind/feature Categorizes an issue or PR as a feature, i.e. new behavior scope/broker Marks an issue or PR to appear in the broker section of the changelog

Comments

@saig0
Copy link
Member

saig0 commented Nov 1, 2021

Description

We should write an event when a decision is evaluated. The event should include all data about the decision evaluation (e.g. the decision result, the result of required decisions, etc.). The event can be consumed to analyze and visualize the evaluation of the decision, for example, by Operate and Optimize.

  • create a new record DecisionEvaluationRecord
  • create a new intent evaluated
  • it should include all data about the evaluation that is provided from the DMN module
  • it should include context data about the process instance that the decision is called from

The record could look like this:

{
  "decisionKey": 1L,
  "decisionId": "x",
  "version": 1L,
  "decisionRequirementsKey": 1L,
  "decisionRequirementsId": "x",
  "processDefinitionKey": 1L,
  "processInstanceKey": 1L,
  "elementInstanceKey": 1L,
  "elementId": "x",
  "decisionOutput": "x" (JSON),
  "evaluatedDecisions": [
    {
      "decisionId": "x",
      "decisionName": "x",
      "decisionType": "x",
      "decisionOutput": "x" (JSON),  
      "evaluatedInputs": [ (for decision tables) 
      	{
      	  "inputId": "x",
      	  "inputName": "x",
      	  "inputValue": "x" (JSON) 
      	}
      ],
      "matchedRules": [ (for decision tables)
      	{
      	  "ruleId": "x",
      	  "ruleIndex:": x,
      	  "evaluatedOutputs": [
  	    {
  	      "outputId": "x",
  	      "outputName": "x",
  	      "outputValue": "x" (JSON)
  	    } 
      	  ] 
      	}
      ]
    }
  ]  
}

blocked by #8080
blocked by #8112

@saig0 saig0 added kind/feature Categorizes an issue or PR as a feature, i.e. new behavior scope/broker Marks an issue or PR to appear in the broker section of the changelog labels Nov 1, 2021
@saig0 saig0 added this to the Evaluate DMN decisions milestone Nov 1, 2021
@saig0 saig0 added this to Planned in Zeebe Nov 1, 2021
@menski
Copy link
Contributor

menski commented Nov 22, 2021

@saig0 for better understanding, how will be the result value be structured, i.e. if the hit policy returns multiple outputs, or the hit policy does aggregation?

/cc @nazlikaya

@saig0
Copy link
Member Author

saig0 commented Nov 23, 2021

how will be the result value be structured, i.e. if the hit policy returns multiple outputs, or the hit policy does aggregation?

The result in decisionResult contains the result of the decision. The structure of the result depends on the type of the decision (table), or the hit policy of the decision table. (see also the discussion in Slack)

  • If a decision table has a collect hit policy like sum then it has the collected result.
  • If the decision table has a different hit policy then
    • it could be a primitive value (i.e. string, number, etc. - if there is one output and only one rule can match),
    • or a list (i.e. if multiple rules can match),
    • or a context/document (i.e. if there are multiple outputs).
  • If the decision table is a literal expression then it is the result of the expression.

@saig0
Copy link
Member Author

saig0 commented Jan 21, 2022

@sdorokhova I updated the event and added the ruleIndex (int) to the matchedRules property. The property will contain the index of the matched rule, starting from 1. It's an addition to the ruleId from the XML. It should help to avoid parsing the DMN XML to get the rule index.

@saig0
Copy link
Member Author

saig0 commented Feb 2, 2022

EDIT

  • added new property decisionOutput that contains the output (i.e. the result) of the called decision
  • renamed property decisionResults to evaluatedDecisions
  • renamed property result of decisionResults to decisionOutput

@saig0 saig0 moved this from Planned to In progress in Zeebe Feb 7, 2022
@npepinpe npepinpe moved this from In progress to Review in progress in Zeebe Feb 16, 2022
@ghost ghost closed this as completed in 445ec73 Feb 18, 2022
Zeebe automation moved this from Review in progress to Done Feb 18, 2022
@KerstinHebel KerstinHebel removed this from Done in Zeebe Mar 23, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes an issue or PR as a feature, i.e. new behavior scope/broker Marks an issue or PR to appear in the broker section of the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants