Slide 1

Slide 1 text

Kie Live #24

Slide 2

Slide 2 text

Our mailing-lists: ● https://groups.google.com/g/kogito-development ● https://groups.google.com/g/drools-usage ● https://groups.google.com/g/drools-setup All the channels: ● https://kogito.kie.org/community ● https://kie.zulipchat.com (#drools and #kogito channels)

Slide 3

Slide 3 text

● ○ ○ ● ● ●

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Cloud-native application development has become the preferred model for crafting the innovative applications required of digital transformation strategy. Modern programming techniques now exploit shared-distributed cloud architectures, portable container technology and discrete microservices designed to quickly assemble logic , automate processes and adapt when needed. — 451 Research, 2018

Slide 6

Slide 6 text

AI = + + Extract information from data analysis Model the human knowledge and expertise Solve complex problems to better resources allocations + + “The Future of Enterprise AI and Digital Decisions” Machine Learning Digital Decisioning Maths Optimization Ref: Forrester Research, Inc., “The Future of Enterprise AI and Digital Decisions”, BRAIN 2019, Bolzano Rules and Artificial INtelligence Summit Sep 2019

Slide 7

Slide 7 text

Source: https://www.pcmag.com/news/gartners-top-strategic-technology-trends-for-2021

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

What is Business Analysis? Strategic Analysis IT Analysis Business Analysis

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Business Automation

Slide 12

Slide 12 text

Decision Process Business Automation Mathematical Optimization Vehicle Routing // Socrates is human. session.insert(new Human("Socrates")); rule "All humans are mortals" when $h : Human() then insertLogical( new Mortal( $h.getName() ) ); end query "Is Socrates mortal?" Mortal( name == "Socrates" ) end

Slide 13

Slide 13 text

A Standard Based Approach

Slide 14

Slide 14 text

Decision Management

Slide 15

Slide 15 text

● Formal methodologies and best practices ○ Availability of books, training, best practices ○ Availability of professionals, cost reduction ● Tools to help with knowledge capturing/mining/modelling ○ A common ground where IT and Business can meet and collaborate ● Scalable, cloud based, dynamic runtimes ○ Means to draw results from the join effort ● Integrated BAM KPI monitoring and analysis for decision services ○ Means to optimize and improve

Slide 16

Slide 16 text

DMN, which stands for Decision Model and Notation, is a relatively new standard managed by OMG, the organization behind BPMN. … [DMN] is trying to do for Business Decision Management what BPMN did for Business Process Management a decade ago: empower the business to take charge of the logic that drives its operations, through a vendor-independent diagramming language. – Bruce Silver, http://methodandstyle.com/what-is-dmn

Slide 17

Slide 17 text

● A standard for Decision Management from OMG ● A sibling and complementary standard to BPMN (processes) and CMMN (case management) ● Standardizes decision automation from modelling to execution

Slide 18

Slide 18 text

● A standard with the potential to drive radical change in the DM market ○ Similar to the impact BPMN caused on the BPM market 10 years ago ● A complement to analytics and AI models in general: ○ DMN integrates with analytic models and provides explainable white box decisions ○ Important to meet requirements like GDPR compliance ● A complement to blockchain smart contract implementations

Slide 19

Slide 19 text

DMN Introduction: a decision logic example Input Node Decision Node Business Knowledge Model

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

● DMN models are one of the supported Drools assets ○ New capability behind the same API ○ DMN and DRL overlap only for a subset of Drools features ○ The strength of DMN lies on its standard language, business appeal, and ease of documentation ● DMN focus on Decisions, not Rules ● DMN models are stateless only ○ Statefulness can be emulated by retaining state on the client See also https://stackoverflow.com/a/52343002/893991

Slide 22

Slide 22 text

See also https://stackoverflow.com/a/52343002/893991 DMN DRL includes Decision Table paradigm ⬤ ⬤ Stateless ⬤ ⬤ Stateful long-running sessions with mutability ◑ ⬤ CEP ◑ ⬤ a Standard notation ⬤ ◐

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

kie-dmn-validation: static analysis toolings ● validation of DMN against specification XSDs ● static validation of DMN file ○ e.g.: pre-compilation phase semantic validations (duplicate names, etc.) ○ fun-fact: static validation is performed with… Drools rules! ● compilation phase checks ● decision tables static analysis ○ implementing Method & Style checks ○ semantic checks ○ Hit Policy recommender ○ MC/DC test case generator*

Slide 25

Slide 25 text

Decision Table static analysis features ● Table completeness ○ no gaps in the rules ● Table consistency ○ overlaps properly handled by hit policy ● Subsumption ○ rules that could be combined ● Rule masking ○ in P tables where some rule is never the top priority ● "Misleading rules" in P tables ● Normalization checks ● Consistent with DMN expectations ○ imported ItemDefinition types ○ null handling ○ FEEL expressions in output ○ etc. ● Warns about enumerated columns ● Consolidated user-friendly messages

Slide 26

Slide 26 text

The same validation is interoperable from toolings, editors, to build systems Contraction: Rules [1, 3] can be combined for contraction by joining on input 1 Overlap detected: Overlap values: [ 660, "Bad" ] for rules: [2, 4]. UNIQUE hit policy decision tables can only have one matching rule. Gap detected: [ >660, "Fair" ]

Slide 27

Slide 27 text

Another fun example: Misleading rule When this decision table results in “CHECK” ? Example taken from Vanthienen

Slide 28

Slide 28 text

Another fun example: Misleading rule DMN: Rule 4 is a misleading rule. It could be misleading over other rules, such as rule: 2 Example taken from Vanthienen

Slide 29

Slide 29 text

Hit policy recommender in a nutshell ● If there are Gaps, no recommendations. ● If No Gaps and no Overlaps: recommend UNIQUE where possible. ● If No Gaps , but Overlaps with same output: recommend ANY ● If No Gaps , but Overlaps with different output: recommend PRIORITY where possible

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

● Principles for re-use: ○ Import Decision Services, BKMs for decision logic re-use ○ Import ItemDefinitions for data structure (dictionary) re-use ● At the edge of (pure) functional approach: ○ today’s date use-case ○ send a notification/email (with BPMN) use-case ○ message routing (with Apache Camel) use-case

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

#3 #2 ● Decision Service ● ItemDefinion #1 ● BKMs ● Input Data ● Decision

Slide 38

Slide 38 text

● Principles for re-use: ○ Import Decision Services, BKMs for decision logic re-use ○ Import ItemDefinitions for data structure (dictionary) re-use ● At the edge of (pure) functional approach: ○ today’s date use-case ○ send a notification/email (with BPMN) use-case ○ message routing (with Apache Camel) use-case

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

See also https://github.com/RedHat-Healthcare

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

from("direct:hl7") .bean(HL7RoutingEventParser .class, "buildRoutingEvent(${body})" ) .claimCheck(ClaimCheckOperation .Push) .process(toMap) .process(toDMNCommand) .to("kie-local://ksession1?channel=default") // Drools+DMN processing .process(dmnToHeader) .claimCheck(ClaimCheckOperation .Pop) .to("log:com.redhat.idaas?level=DEBUG&showAll=true&multiline=true" ) .transform().simple("${body.messageData}" ) .filter(simple("${header.topicsHeader} contains 'MMSAllADT'")) .to("kafka:MMSAllADT?brokers={{idaas.kafka.bootstrap}} ") .end() .filter(simple("${header.topicsHeader} contains 'MMSDischarges'")) .to("kafka:MMSDischarges?brokers={{idaas.kafka.bootstrap}} ") .end();

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

● The OpenAPI Specification ○ a broadly adopted industry standard for describing modern APIs ● Out-of-the-box support for DMN ItemDefinitions, DMN evaluations ● An API contract generated automatically from a DMN model ● Can also be used to generate/stub clients with ease

Slide 48

Slide 48 text

See also http://hdl.handle.net/10589/150128

Slide 49

Slide 49 text

(demo)

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

See also https://github.com/tarilabs/dmn-framingham-cvd-risk-score

Slide 52

Slide 52 text

(demo)

Slide 53

Slide 53 text

● ○ ○ ● ○ ○ ● ○ ○ ● ○ ○

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

● Think decisions, not rules ● Focus on communication, documentation, common language ● Cost reduction: availability of professionals, books, training ● No vendor lock-in: DMN standardizes syntax and semantics ○ DMN TCK: https://dmn-tck.github.io/tck ● Native cloud based deployment on OpenShift

Slide 56

Slide 56 text

https://drools.org/learn/documentation.html https://kogito.kie.org/guides

Slide 57

Slide 57 text

References: DMN Validation For all levels: Medium/Advanced level: https://www.youtube.com/watch?v=eQRDc6fq2yw

Slide 58

Slide 58 text

References: DMN Patterns For all levels: Medium/Advanced level: Y-Combinator with DMN/FEEL https://blog.kie.org/2020/04/functional-programming-in-dmn-it- feels-like-recursing-my-university-studies-again.html

Slide 59

Slide 59 text

DMN recommendations and communities (cont.) https://www.mismo.org/news-and-events/all-news/mismo-recommends-dmn-standard- https://www.bpm-plus.org

Slide 60

Slide 60 text

… and other Communities with also DMN interests https://dmcommunity.org https://dmn-tck.github.io/tck

Slide 61

Slide 61 text

Resources https://youtu.be/zaTw1c5-47c https://youtu.be/EVXp2q_8yFw Drools featuring DMN support - https://drools.org/learn/dmn.html Learn DMN - http://learn-dmn-in-15-minutes.com Kogito - http://kogito.kie.org/ TrustyAI introduction: https://blog.kie.org/2020/06/trusty-ai-introduction.html TrustyAI introduction talk: https://www.youtube.com/watch?v=HdEwp2RhG7w Red Hat Business Process Automation: https://www.redhat.com/en/products/process-automation

Slide 62

Slide 62 text

A pragmatic approach to Decision Management with DMN Abstract: Decision Management is an important pillar of Business Automation and a key aspect of all Digital Transformation initiatives. DMN as an open standard is a very effective enabler of decision management both from a methodological but also pragmatic perspective, since the execution semantic is defined in the specification itself. We will delve into some key aspects of DMN in order to understand their characteristics, their advantages and limitations, and their best application in a cloud-native context too. This session is intended to provide interesting insights both to Business Analysts and Developers/Coders. Speaker: Matteo Mortari I contribute to the DMN execution engine used in Drools, Kogito and Red Hat Process Automation suite. I believe there is a whole new range of unexplored applications for Expert Systems (AI) within the Corporate business; additionally, I believe defining the Business Rules on the BRMS system not only enables knowledge inference from raw data but, most importantly, helps to shorten the distance between experts and analysts, between developers and end-users, business stakeholders.